LZ4_decompress_safe:
 2452|    352|{
 2453|    352|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2454|    352|                                  decode_full_block, noDict,
 2455|       |                                  (BYTE*)dest, NULL, 0);
 2456|    352|}
LZ4_decompress_safe_forceExtDict:
 2526|    363|{
 2527|    363|    DEBUGLOG(5, "LZ4_decompress_safe_forceExtDict");
  ------------------
  |  |  289|    363|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2528|    363|    return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
 2529|    363|                                  decode_full_block, usingExtDict,
 2530|    363|                                  (BYTE*)dest, (const BYTE*)dictStart, dictSize);
 2531|    363|}
LZ4_decompress_safe_usingDict:
 2720|    363|{
 2721|    363|    if (dictSize==0)
  ------------------
  |  Branch (2721:9): [True: 0, False: 363]
  ------------------
 2722|      0|        return LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize);
 2723|    363|    if (dictStart+dictSize == dest) {
  ------------------
  |  Branch (2723:9): [True: 0, False: 363]
  ------------------
 2724|      0|        if (dictSize >= 64 KB - 1) {
  ------------------
  |  |  251|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (2724:13): [True: 0, False: 0]
  ------------------
 2725|      0|            return LZ4_decompress_safe_withPrefix64k(source, dest, compressedSize, maxOutputSize);
 2726|      0|        }
 2727|      0|        assert(dictSize >= 0);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 2728|      0|        return LZ4_decompress_safe_withSmallPrefix(source, dest, compressedSize, maxOutputSize, (size_t)dictSize);
 2729|      0|    }
 2730|    363|    assert(dictSize >= 0);
  ------------------
  |  |  273|    363|#    define assert(condition) ((void)0)
  ------------------
 2731|    363|    return LZ4_decompress_safe_forceExtDict(source, dest, compressedSize, maxOutputSize, dictStart, (size_t)dictSize);
 2732|    363|}
lz4.c:LZ4_wildCopy8:
  466|  9.44k|{
  467|  9.44k|    BYTE* d = (BYTE*)dstPtr;
  468|  9.44k|    const BYTE* s = (const BYTE*)srcPtr;
  469|  9.44k|    BYTE* const e = (BYTE*)dstEnd;
  470|       |
  471|   837k|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  349|   837k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (471:50): [True: 827k, False: 9.44k]
  ------------------
  472|  9.44k|}
lz4.c:LZ4_isLittleEndian:
  364|  73.1k|{
  365|  73.1k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  366|  73.1k|    return one.c[0];
  367|  73.1k|}
lz4.c:LZ4_read16:
  393|  73.1k|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  398|  8.34k|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_decompress_generic:
 2035|    715|{
 2036|    715|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (2036:9): [True: 0, False: 715]
  |  Branch (2036:26): [True: 0, False: 715]
  ------------------
 2037|       |
 2038|    715|    {   const BYTE* ip = (const BYTE*) src;
 2039|    715|        const BYTE* const iend = ip + srcSize;
 2040|       |
 2041|    715|        BYTE* op = (BYTE*) dst;
 2042|    715|        BYTE* const oend = op + outputSize;
 2043|    715|        BYTE* cpy;
 2044|       |
 2045|    715|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (2045:37): [True: 352, False: 363]
  ------------------
 2046|       |
 2047|    715|        const int checkOffset = (dictSize < (int)(64 KB));
  ------------------
  |  |  251|    715|#define KB *(1 <<10)
  ------------------
 2048|       |
 2049|       |
 2050|       |        /* Set up the "end" pointers for the shortcut. */
 2051|    715|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 2052|    715|        const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/;
 2053|       |
 2054|    715|        const BYTE* match;
 2055|    715|        size_t offset;
 2056|    715|        unsigned token;
 2057|    715|        size_t length;
 2058|       |
 2059|       |
 2060|    715|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  289|    715|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2061|       |
 2062|       |        /* Special cases */
 2063|    715|        assert(lowPrefix <= op);
  ------------------
  |  |  273|    715|#    define assert(condition) ((void)0)
  ------------------
 2064|    715|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  180|    715|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    715|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 715]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2065|       |            /* Empty output buffer */
 2066|      0|            if (partialDecoding) return 0;
  ------------------
  |  Branch (2066:17): [True: 0, False: 0]
  ------------------
 2067|      0|            return ((srcSize==1) && (*ip==0)) ? 0 : -1;
  ------------------
  |  Branch (2067:21): [True: 0, False: 0]
  |  Branch (2067:37): [True: 0, False: 0]
  ------------------
 2068|      0|        }
 2069|    715|        if (unlikely(srcSize==0)) { return -1; }
  ------------------
  |  |  180|    715|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    715|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 715]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2070|       |
 2071|       |    /* LZ4_FAST_DEC_LOOP:
 2072|       |     * designed for modern OoO performance cpus,
 2073|       |     * where copying reliably 32-bytes is preferable to an unpredictable branch.
 2074|       |     * note : fast loop may show a regression for some client arm chips. */
 2075|    715|#if LZ4_FAST_DEC_LOOP
 2076|    715|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|    715|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2076:13): [True: 7, False: 708]
  ------------------
 2077|      7|            DEBUGLOG(6, "move to safe decode loop");
  ------------------
  |  |  289|      7|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2078|      7|            goto safe_decode;
 2079|      7|        }
 2080|       |
 2081|       |        /* Fast loop : decode sequences as long as output < oend-FASTLOOP_SAFE_DISTANCE */
 2082|    708|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  289|    708|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2083|  72.7k|        while (1) {
  ------------------
  |  Branch (2083:16): [True: 72.7k, Folded]
  ------------------
 2084|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2085|  72.7k|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  |  273|  72.7k|#    define assert(condition) ((void)0)
  ------------------
 2086|  72.7k|            assert(ip < iend);
  ------------------
  |  |  273|  72.7k|#    define assert(condition) ((void)0)
  ------------------
 2087|  72.7k|            token = *ip++;
 2088|  72.7k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  260|  72.7k|#define ML_BITS  4
  ------------------
 2089|  72.7k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  289|  72.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2090|       |
 2091|       |            /* decode literal length */
 2092|  72.7k|            if (length == RUN_MASK) {
  ------------------
  |  |  263|  72.7k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|  72.7k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|  72.7k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2092:17): [True: 2.51k, False: 70.2k]
  ------------------
 2093|  2.51k|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  263|  2.51k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|  2.51k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|  2.51k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2094|  2.51k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2094:21): [True: 7, False: 2.50k]
  ------------------
 2095|      7|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  289|      7|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2096|      7|                    goto _output_error;
 2097|      7|                }
 2098|  2.50k|                length += addl;
 2099|  2.50k|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  2.50k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  2.50k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 2.50k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2100|  2.50k|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  2.50k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  2.50k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 2.50k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2101|       |
 2102|       |                /* copy literals */
 2103|  2.50k|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  277|  2.50k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2104|  2.50k|                if ((op+length>oend-32) || (ip+length>iend-32)) { goto safe_literal_copy; }
  ------------------
  |  Branch (2104:21): [True: 18, False: 2.49k]
  |  Branch (2104:44): [True: 357, False: 2.13k]
  ------------------
 2105|  2.13k|                LZ4_wildCopy32(op, ip, op+length);
 2106|  2.13k|                ip += length; op += length;
 2107|  70.2k|            } else if (ip <= iend-(16 + 1/*max lit + offset + nextToken*/)) {
  ------------------
  |  Branch (2107:24): [True: 70.1k, False: 38]
  ------------------
 2108|       |                /* We don't need to check oend, since we check it once for each loop below */
 2109|  70.1k|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)length);
  ------------------
  |  |  289|  70.1k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2110|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2111|  70.1k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  349|  70.1k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2112|  70.1k|                ip += length; op += length;
 2113|  70.1k|            } else {
 2114|     38|                goto safe_literal_copy;
 2115|     38|            }
 2116|       |
 2117|       |            /* get offset */
 2118|  72.3k|            offset = LZ4_readLE16(ip); ip+=2;
 2119|  72.3k|            DEBUGLOG(6, "blockPos%6u: offset = %u", (unsigned)(op-(BYTE*)dst), (unsigned)offset);
  ------------------
  |  |  289|  72.3k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2120|  72.3k|            match = op - offset;
 2121|  72.3k|            assert(match <= op);  /* overflow check */
  ------------------
  |  |  273|  72.3k|#    define assert(condition) ((void)0)
  ------------------
 2122|       |
 2123|       |            /* get matchlength */
 2124|  72.3k|            length = token & ML_MASK;
  ------------------
  |  |  261|  72.3k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  72.3k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2125|  72.3k|            DEBUGLOG(7, "  match length token = %u (len==%u)", (unsigned)length, (unsigned)length+MINMATCH);
  ------------------
  |  |  289|  72.3k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2126|       |
 2127|  72.3k|            if (length == ML_MASK) {
  ------------------
  |  |  261|  72.3k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  72.3k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2127:17): [True: 41.0k, False: 31.2k]
  ------------------
 2128|  41.0k|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  245|  41.0k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2129|  41.0k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2129:21): [True: 3, False: 41.0k]
  ------------------
 2130|      3|                    DEBUGLOG(5, "error reading long match length");
  ------------------
  |  |  289|      3|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2131|      3|                    goto _output_error;
 2132|      3|                }
 2133|  41.0k|                length += addl;
 2134|  41.0k|                length += MINMATCH;
  ------------------
  |  |  242|  41.0k|#define MINMATCH 4
  ------------------
 2135|  41.0k|                DEBUGLOG(7, "  long match length == %u", (unsigned)length);
  ------------------
  |  |  289|  41.0k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2136|  41.0k|                if (unlikely((uptrval)(op)+length<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  41.0k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  41.0k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 41.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2137|  41.0k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|  41.0k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2137:21): [True: 156, False: 40.9k]
  ------------------
 2138|    156|                    goto safe_match_copy;
 2139|    156|                }
 2140|  41.0k|            } else {
 2141|  31.2k|                length += MINMATCH;
  ------------------
  |  |  242|  31.2k|#define MINMATCH 4
  ------------------
 2142|  31.2k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|  31.2k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2142:21): [True: 25, False: 31.2k]
  ------------------
 2143|     25|                    DEBUGLOG(7, "moving to safe_match_copy (ml==%u)", (unsigned)length);
  ------------------
  |  |  289|     25|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2144|     25|                    goto safe_match_copy;
 2145|     25|                }
 2146|       |
 2147|       |                /* Fastpath check: skip LZ4_wildCopy32 when true */
 2148|  31.2k|                if ((dict == withPrefix64k) || (match >= lowPrefix)) {
  ------------------
  |  Branch (2148:21): [True: 0, False: 31.2k]
  |  Branch (2148:48): [True: 30.2k, False: 926]
  ------------------
 2149|  30.2k|                    if (offset >= 8) {
  ------------------
  |  Branch (2149:25): [True: 18.6k, False: 11.6k]
  ------------------
 2150|  18.6k|                        assert(match >= lowPrefix);
  ------------------
  |  |  273|  18.6k|#    define assert(condition) ((void)0)
  ------------------
 2151|  18.6k|                        assert(match <= op);
  ------------------
  |  |  273|  18.6k|#    define assert(condition) ((void)0)
  ------------------
 2152|  18.6k|                        assert(op + 18 <= oend);
  ------------------
  |  |  273|  18.6k|#    define assert(condition) ((void)0)
  ------------------
 2153|       |
 2154|  18.6k|                        LZ4_memcpy(op, match, 8);
  ------------------
  |  |  349|  18.6k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2155|  18.6k|                        LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  349|  18.6k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2156|  18.6k|                        LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  349|  18.6k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2157|  18.6k|                        op += length;
 2158|  18.6k|                        continue;
 2159|  18.6k|            }   }   }
 2160|       |
 2161|  53.4k|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  180|  53.4k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  53.4k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2161:18): [True: 53.4k, False: 0]
  |  Branch (2161:33): [True: 104, False: 53.3k]
  ------------------
 2162|    104|                DEBUGLOG(5, "Error : pos=%zi, offset=%zi => outside buffers", op-lowPrefix, op-match);
  ------------------
  |  |  289|    104|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2163|    104|                goto _output_error;
 2164|    104|            }
 2165|       |            /* match starting within external dictionary */
 2166|  53.3k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2166:17): [True: 21.8k, False: 31.5k]
  |  Branch (2166:41): [True: 1.23k, False: 20.6k]
  ------------------
 2167|  1.23k|                assert(dictEnd != NULL);
  ------------------
  |  |  273|  1.23k|#    define assert(condition) ((void)0)
  ------------------
 2168|  1.23k|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  180|  1.23k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  1.23k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 1.23k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2169|      0|                    if (partialDecoding) {
  ------------------
  |  Branch (2169:25): [True: 0, False: 0]
  ------------------
 2170|      0|                        DEBUGLOG(7, "partialDecoding: dictionary match, close to dstEnd");
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2171|      0|                        length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1845|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1845:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2172|      0|                    } else {
 2173|      0|                        DEBUGLOG(6, "end-of-block condition violated")
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2174|      0|                        goto _output_error;
 2175|      0|                }   }
 2176|       |
 2177|  1.23k|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2177:21): [True: 1.10k, False: 132]
  ------------------
 2178|       |                    /* match fits entirely within external dictionary : just copy */
 2179|  1.10k|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  357|  1.10k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2180|  1.10k|                    op += length;
 2181|  1.10k|                } else {
 2182|       |                    /* match stretches into both external dictionary and current block */
 2183|    132|                    size_t const copySize = (size_t)(lowPrefix - match);
 2184|    132|                    size_t const restSize = length - copySize;
 2185|    132|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  349|    132|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2186|    132|                    op += copySize;
 2187|    132|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2187:25): [True: 95, False: 37]
  ------------------
 2188|     95|                        BYTE* const endOfMatch = op + restSize;
 2189|     95|                        const BYTE* copyFrom = lowPrefix;
 2190|  1.14M|                        while (op < endOfMatch) { *op++ = *copyFrom++; }
  ------------------
  |  Branch (2190:32): [True: 1.14M, False: 95]
  ------------------
 2191|     95|                    } else {
 2192|     37|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  349|     37|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2193|     37|                        op += restSize;
 2194|     37|                }   }
 2195|  1.23k|                continue;
 2196|  1.23k|            }
 2197|       |
 2198|       |            /* copy match within block */
 2199|  52.1k|            cpy = op + length;
 2200|       |
 2201|  52.1k|            assert((op <= oend) && (oend-op >= 32));
  ------------------
  |  |  273|  52.1k|#    define assert(condition) ((void)0)
  ------------------
 2202|  52.1k|            if (unlikely(offset<16)) {
  ------------------
  |  |  180|  52.1k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  52.1k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 34.4k, False: 17.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2203|  34.4k|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2204|  34.4k|            } else {
 2205|  17.6k|                LZ4_wildCopy32(op, match, cpy);
 2206|  17.6k|            }
 2207|       |
 2208|  52.1k|            op = cpy;   /* wildcopy correction */
 2209|  52.1k|        }
 2210|      7|    safe_decode:
 2211|      7|#endif
 2212|       |
 2213|       |        /* Main Loop : decode remaining sequences where output < FASTLOOP_SAFE_DISTANCE */
 2214|      7|        DEBUGLOG(6, "using safe decode loop");
  ------------------
  |  |  289|      7|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2215|    884|        while (1) {
  ------------------
  |  Branch (2215:16): [True: 884, Folded]
  ------------------
 2216|    884|            assert(ip < iend);
  ------------------
  |  |  273|    884|#    define assert(condition) ((void)0)
  ------------------
 2217|    884|            token = *ip++;
 2218|    884|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  260|    884|#define ML_BITS  4
  ------------------
 2219|    884|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  289|    884|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2220|       |
 2221|       |            /* A two-stage shortcut for the most common case:
 2222|       |             * 1) If the literal length is 0..14, and there is enough space,
 2223|       |             * enter the shortcut and copy 16 bytes on behalf of the literals
 2224|       |             * (in the fast mode, only 8 bytes can be safely copied this way).
 2225|       |             * 2) Further if the match length is 4..18, copy 18 bytes in a similar
 2226|       |             * manner; but we ensure that there's enough space in the output for
 2227|       |             * those 18 bytes earlier, upon entering the shortcut (in other words,
 2228|       |             * there is a combined check for both stages).
 2229|       |             */
 2230|    884|            if ( (length != RUN_MASK)
  ------------------
  |  |  263|    884|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    884|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    884|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2230:18): [True: 716, False: 168]
  ------------------
 2231|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2232|    716|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  177|    716|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|    716|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 322, False: 394]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2233|       |                /* Copy the literals */
 2234|    322|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  349|    322|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2235|    322|                op += length; ip += length;
 2236|       |
 2237|       |                /* The second stage: prepare for match copying, decode full info.
 2238|       |                 * If it doesn't work out, the info won't be wasted. */
 2239|    322|                length = token & ML_MASK; /* match length */
  ------------------
  |  |  261|    322|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    322|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2240|    322|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u (len=%u)", (unsigned)(op-(BYTE*)dst), (unsigned)length, (unsigned)length + 4);
  ------------------
  |  |  289|    322|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2241|    322|                offset = LZ4_readLE16(ip); ip += 2;
 2242|    322|                match = op - offset;
 2243|    322|                assert(match <= op); /* check overflow */
  ------------------
  |  |  273|    322|#    define assert(condition) ((void)0)
  ------------------
 2244|       |
 2245|       |                /* Do not deal with overlapping matches. */
 2246|    322|                if ( (length != ML_MASK)
  ------------------
  |  |  261|    322|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    322|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2246:22): [True: 248, False: 74]
  ------------------
 2247|    248|                  && (offset >= 8)
  ------------------
  |  Branch (2247:22): [True: 111, False: 137]
  ------------------
 2248|    111|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2248:23): [True: 0, False: 111]
  |  Branch (2248:46): [True: 77, False: 34]
  ------------------
 2249|       |                    /* Copy the match. */
 2250|     77|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  349|     77|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2251|     77|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  349|     77|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2252|     77|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  349|     77|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2253|     77|                    op += length + MINMATCH;
  ------------------
  |  |  242|     77|#define MINMATCH 4
  ------------------
 2254|       |                    /* Both stages worked, load the next token. */
 2255|     77|                    continue;
 2256|     77|                }
 2257|       |
 2258|       |                /* The second stage didn't work out, but the info is ready.
 2259|       |                 * Propel it right to the point of match copying. */
 2260|    245|                goto _copy_match;
 2261|    322|            }
 2262|       |
 2263|       |            /* decode literal length */
 2264|    562|            if (length == RUN_MASK) {
  ------------------
  |  |  263|    562|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    562|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    562|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2264:17): [True: 168, False: 394]
  ------------------
 2265|    168|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  263|    168|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    168|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    168|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2266|    168|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2266:21): [True: 21, False: 147]
  ------------------
 2267|    147|                length += addl;
 2268|    147|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|    147|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    147|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 147]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2269|    147|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|    147|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    147|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 147]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2270|    147|            }
 2271|       |
 2272|    541|#if LZ4_FAST_DEC_LOOP
 2273|    954|        safe_literal_copy:
 2274|    954|#endif
 2275|       |            /* copy literals */
 2276|    954|            cpy = op+length;
 2277|       |
 2278|    954|            LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  277|    954|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2279|    954|            if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  246|    954|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  245|    777|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2279:17): [True: 177, False: 777]
  |  Branch (2279:39): [True: 246, False: 531]
  ------------------
 2280|       |                /* We've either hit the input parsing restriction or the output parsing restriction.
 2281|       |                 * In the normal scenario, decoding a full block, it must be the last sequence,
 2282|       |                 * otherwise it's an error (invalid input or dimensions).
 2283|       |                 * In partialDecoding scenario, it's necessary to ensure there is no buffer overflow.
 2284|       |                 */
 2285|    423|                if (partialDecoding) {
  ------------------
  |  Branch (2285:21): [True: 0, False: 423]
  ------------------
 2286|       |                    /* Since we are partial decoding we may be in this block because of the output parsing
 2287|       |                     * restriction, which is not valid since the output buffer is allowed to be undersized.
 2288|       |                     */
 2289|      0|                    DEBUGLOG(7, "partialDecoding: copying literals, close to input or output end")
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2290|      0|                    DEBUGLOG(7, "partialDecoding: literal length = %u", (unsigned)length);
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2291|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in dstBuffer : %i", (int)(oend - op));
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2292|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in srcBuffer : %i", (int)(iend - ip));
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2293|       |                    /* Finishing in the middle of a literals segment,
 2294|       |                     * due to lack of input.
 2295|       |                     */
 2296|      0|                    if (ip+length > iend) {
  ------------------
  |  Branch (2296:25): [True: 0, False: 0]
  ------------------
 2297|      0|                        length = (size_t)(iend-ip);
 2298|      0|                        cpy = op + length;
 2299|      0|                    }
 2300|       |                    /* Finishing in the middle of a literals segment,
 2301|       |                     * due to lack of output space.
 2302|       |                     */
 2303|      0|                    if (cpy > oend) {
  ------------------
  |  Branch (2303:25): [True: 0, False: 0]
  ------------------
 2304|      0|                        cpy = oend;
 2305|      0|                        assert(op<=oend);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 2306|      0|                        length = (size_t)(oend-op);
 2307|      0|                    }
 2308|    423|                } else {
 2309|       |                     /* We must be on the last sequence (or invalid) because of the parsing limitations
 2310|       |                      * so check that we exactly consume the input and don't overrun the output buffer.
 2311|       |                      */
 2312|    423|                    if ((ip+length != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2312:25): [True: 327, False: 96]
  |  Branch (2312:48): [True: 2, False: 94]
  ------------------
 2313|    329|                        DEBUGLOG(5, "should have been last run of literals")
  ------------------
  |  |  289|    329|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2314|    329|                        DEBUGLOG(5, "ip(%p) + length(%i) = %p != iend (%p)", ip, (int)length, ip+length, iend);
  ------------------
  |  |  289|    329|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2315|    329|                        DEBUGLOG(5, "or cpy(%p) > (oend-MFLIMIT)(%p)", cpy, oend-MFLIMIT);
  ------------------
  |  |  289|    329|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2316|    329|                        DEBUGLOG(5, "after writing %u bytes / %i bytes available", (unsigned)(op-(BYTE*)dst), outputSize);
  ------------------
  |  |  289|    329|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2317|    329|                        goto _output_error;
 2318|    329|                    }
 2319|    423|                }
 2320|     94|                LZ4_memmove(op, ip, length);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  357|     94|#    define LZ4_memmove __builtin_memmove
  ------------------
 2321|     94|                ip += length;
 2322|     94|                op += length;
 2323|       |                /* Necessarily EOF when !partialDecoding.
 2324|       |                 * When partialDecoding, it is EOF if we've either
 2325|       |                 * filled the output buffer or
 2326|       |                 * can't proceed with reading an offset for following match.
 2327|       |                 */
 2328|     94|                if (!partialDecoding || (cpy == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2328:21): [True: 94, False: 0]
  |  Branch (2328:41): [True: 0, False: 0]
  |  Branch (2328:58): [True: 0, False: 0]
  ------------------
 2329|     94|                    break;
 2330|     94|                }
 2331|    531|            } else {
 2332|    531|                LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2333|    531|                ip += length; op = cpy;
 2334|    531|            }
 2335|       |
 2336|       |            /* get offset */
 2337|    531|            offset = LZ4_readLE16(ip); ip+=2;
 2338|    531|            match = op - offset;
 2339|       |
 2340|       |            /* get matchlength */
 2341|    531|            length = token & ML_MASK;
  ------------------
  |  |  261|    531|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    531|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2342|    531|            DEBUGLOG(7, "blockPos%6u: matchLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  289|    531|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2343|       |
 2344|    776|    _copy_match:
 2345|    776|            if (length == ML_MASK) {
  ------------------
  |  |  261|    776|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    776|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2345:17): [True: 403, False: 373]
  ------------------
 2346|    403|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  245|    403|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2347|    403|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2347:21): [True: 9, False: 394]
  ------------------
 2348|    394|                length += addl;
 2349|    394|                if (unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  180|    394|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    394|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 394]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2350|    394|            }
 2351|    767|            length += MINMATCH;
  ------------------
  |  |  242|    767|#define MINMATCH 4
  ------------------
 2352|       |
 2353|    767|#if LZ4_FAST_DEC_LOOP
 2354|    948|        safe_match_copy:
 2355|    948|#endif
 2356|    948|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error;   /* Error : offset outside buffers */
  ------------------
  |  |  180|    948|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    948|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2356:17): [True: 948, False: 0]
  |  Branch (2356:34): [True: 125, False: 823]
  ------------------
 2357|       |            /* match starting within external dictionary */
 2358|    823|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2358:17): [True: 433, False: 390]
  |  Branch (2358:41): [True: 40, False: 393]
  ------------------
 2359|     40|                assert(dictEnd != NULL);
  ------------------
  |  |  273|     40|#    define assert(condition) ((void)0)
  ------------------
 2360|     40|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  180|     40|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|     40|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 1, False: 39]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2361|      1|                    if (partialDecoding) length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1845|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1845:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2361:25): [True: 0, False: 1]
  ------------------
 2362|      1|                    else goto _output_error;   /* doesn't respect parsing restriction */
 2363|      1|                }
 2364|       |
 2365|     39|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2365:21): [True: 8, False: 31]
  ------------------
 2366|       |                    /* match fits entirely within external dictionary : just copy */
 2367|      8|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  357|      8|#    define LZ4_memmove __builtin_memmove
  ------------------
 2368|      8|                    op += length;
 2369|     31|                } else {
 2370|       |                    /* match stretches into both external dictionary and current block */
 2371|     31|                    size_t const copySize = (size_t)(lowPrefix - match);
 2372|     31|                    size_t const restSize = length - copySize;
 2373|     31|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  349|     31|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2374|     31|                    op += copySize;
 2375|     31|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2375:25): [True: 26, False: 5]
  ------------------
 2376|     26|                        BYTE* const endOfMatch = op + restSize;
 2377|     26|                        const BYTE* copyFrom = lowPrefix;
 2378|   127k|                        while (op < endOfMatch) *op++ = *copyFrom++;
  ------------------
  |  Branch (2378:32): [True: 127k, False: 26]
  ------------------
 2379|     26|                    } else {
 2380|      5|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  349|      5|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2381|      5|                        op += restSize;
 2382|      5|                }   }
 2383|     39|                continue;
 2384|     40|            }
 2385|    783|            assert(match >= lowPrefix);
  ------------------
  |  |  273|    783|#    define assert(condition) ((void)0)
  ------------------
 2386|       |
 2387|       |            /* copy match within block */
 2388|    783|            cpy = op + length;
 2389|       |
 2390|       |            /* partialDecoding : may end anywhere within the block */
 2391|    783|            assert(op<=oend);
  ------------------
  |  |  273|    783|#    define assert(condition) ((void)0)
  ------------------
 2392|    783|            if (partialDecoding && (cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  247|      0|#define MATCH_SAFEGUARD_DISTANCE  ((2*WILDCOPYLENGTH) - MINMATCH)   /* ensure it's possible to write 2 x wildcopyLength without overflowing output buffer */
  |  |  ------------------
  |  |  |  |  244|      0|#define WILDCOPYLENGTH 8
  |  |  ------------------
  |  |               #define MATCH_SAFEGUARD_DISTANCE  ((2*WILDCOPYLENGTH) - MINMATCH)   /* ensure it's possible to write 2 x wildcopyLength without overflowing output buffer */
  |  |  ------------------
  |  |  |  |  242|      0|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (2392:17): [True: 0, False: 783]
  |  Branch (2392:36): [True: 0, False: 0]
  ------------------
 2393|      0|                size_t const mlen = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1845|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1845:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2394|      0|                const BYTE* const matchEnd = match + mlen;
 2395|      0|                BYTE* const copyEnd = op + mlen;
 2396|      0|                if (matchEnd > op) {   /* overlap copy */
  ------------------
  |  Branch (2396:21): [True: 0, False: 0]
  ------------------
 2397|      0|                    while (op < copyEnd) { *op++ = *match++; }
  ------------------
  |  Branch (2397:28): [True: 0, False: 0]
  ------------------
 2398|      0|                } else {
 2399|      0|                    LZ4_memcpy(op, match, mlen);
  ------------------
  |  |  349|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2400|      0|                }
 2401|      0|                op = copyEnd;
 2402|      0|                if (op == oend) { break; }
  ------------------
  |  Branch (2402:21): [True: 0, False: 0]
  ------------------
 2403|      0|                continue;
 2404|      0|            }
 2405|       |
 2406|    783|            if (unlikely(offset<8)) {
  ------------------
  |  |  180|    783|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    783|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 459, False: 324]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2407|    459|                LZ4_write32(op, 0);   /* silence msan warning when offset==0 */
 2408|    459|                op[0] = match[0];
 2409|    459|                op[1] = match[1];
 2410|    459|                op[2] = match[2];
 2411|    459|                op[3] = match[3];
 2412|    459|                match += inc32table[offset];
 2413|    459|                LZ4_memcpy(op+4, match, 4);
  ------------------
  |  |  349|    459|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2414|    459|                match -= dec64table[offset];
 2415|    459|            } else {
 2416|    324|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  349|    324|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2417|    324|                match += 8;
 2418|    324|            }
 2419|    783|            op += 8;
 2420|       |
 2421|    783|            if (unlikely(cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  180|    783|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    783|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 166, False: 617]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2422|    166|                BYTE* const oCopyLimit = oend - (WILDCOPYLENGTH-1);
  ------------------
  |  |  244|    166|#define WILDCOPYLENGTH 8
  ------------------
 2423|    166|                if (cpy > oend-LASTLITERALS) { goto _output_error; } /* Error : last LASTLITERALS bytes must be literals (uncompressed) */
  ------------------
  |  |  245|    166|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2423:21): [True: 22, False: 144]
  ------------------
 2424|    144|                if (op < oCopyLimit) {
  ------------------
  |  Branch (2424:21): [True: 135, False: 9]
  ------------------
 2425|    135|                    LZ4_wildCopy8(op, match, oCopyLimit);
 2426|    135|                    match += oCopyLimit - op;
 2427|    135|                    op = oCopyLimit;
 2428|    135|                }
 2429|    337|                while (op < cpy) { *op++ = *match++; }
  ------------------
  |  Branch (2429:24): [True: 193, False: 144]
  ------------------
 2430|    617|            } else {
 2431|    617|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  349|    617|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2432|    617|                if (length > 16) { LZ4_wildCopy8(op+8, match+8, cpy); }
  ------------------
  |  Branch (2432:21): [True: 336, False: 281]
  ------------------
 2433|    617|            }
 2434|    761|            op = cpy;   /* wildcopy correction */
 2435|    761|        }
 2436|       |
 2437|       |        /* end of decoding */
 2438|     94|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  289|     94|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2439|     94|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2440|       |
 2441|       |        /* Overflow error detected */
 2442|    621|    _output_error:
 2443|    621|        return (int) (-(((const char*)ip)-src))-1;
 2444|      7|    }
 2445|      7|}
lz4.c:read_variable_length:
 1981|  44.1k|{
 1982|  44.1k|    Rvl_t s, length = 0;
 1983|  44.1k|    assert(ip != NULL);
  ------------------
  |  |  273|  44.1k|#    define assert(condition) ((void)0)
  ------------------
 1984|  44.1k|    assert(*ip !=  NULL);
  ------------------
  |  |  273|  44.1k|#    define assert(condition) ((void)0)
  ------------------
 1985|  44.1k|    assert(ilimit != NULL);
  ------------------
  |  |  273|  44.1k|#    define assert(condition) ((void)0)
  ------------------
 1986|  44.1k|    if (initial_check && unlikely((*ip) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|  2.68k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  2.68k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 18, False: 2.66k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1986:9): [True: 2.68k, False: 41.4k]
  ------------------
 1987|     18|        return rvl_error;
 1988|     18|    }
 1989|  44.1k|    s = **ip;
 1990|  44.1k|    (*ip)++;
 1991|  44.1k|    length += s;
 1992|  44.1k|    if (unlikely((*ip) > ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|  44.1k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  44.1k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 2, False: 44.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1993|      2|        return rvl_error;
 1994|      2|    }
 1995|       |    /* accumulator overflow detection (32-bit mode only) */
 1996|  44.1k|    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 (1996:9): [Folded, False: 44.1k]
  ------------------
 1997|      0|        return rvl_error;
 1998|      0|    }
 1999|  44.1k|    if (likely(s != 255)) return length;
  ------------------
  |  |  177|  44.1k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|  44.1k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 42.3k, False: 1.84k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2000|  84.1k|    do {
 2001|  84.1k|        s = **ip;
 2002|  84.1k|        (*ip)++;
 2003|  84.1k|        length += s;
 2004|  84.1k|        if (unlikely((*ip) > ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|  84.1k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  84.1k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 20, False: 84.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2005|     20|            return rvl_error;
 2006|     20|        }
 2007|       |        /* accumulator overflow detection (32-bit mode only) */
 2008|  84.1k|        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 (2008:13): [Folded, False: 84.1k]
  ------------------
 2009|      0|            return rvl_error;
 2010|      0|        }
 2011|  84.1k|    } while (s == 255);
  ------------------
  |  Branch (2011:14): [True: 82.3k, False: 1.82k]
  ------------------
 2012|       |
 2013|  1.82k|    return length;
 2014|  1.84k|}
lz4.c:LZ4_wildCopy32:
  523|  19.8k|{
  524|  19.8k|    BYTE* d = (BYTE*)dstPtr;
  525|  19.8k|    const BYTE* s = (const BYTE*)srcPtr;
  526|  19.8k|    BYTE* const e = (BYTE*)dstEnd;
  527|       |
  528|   247k|    do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  349|   247k|#    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|   247k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (528:79): [True: 227k, False: 19.8k]
  ------------------
  529|  19.8k|}
lz4.c:LZ4_readLE16:
  431|  73.1k|{
  432|  73.1k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (432:9): [True: 73.1k, False: 0]
  ------------------
  433|  73.1k|        return LZ4_read16(memPtr);
  434|  73.1k|    } else {
  435|      0|        const BYTE* p = (const BYTE*)memPtr;
  436|      0|        return (U16)((U16)p[0] | (p[1]<<8));
  437|      0|    }
  438|  73.1k|}
lz4.c:LZ4_memcpy_using_offset:
  536|  34.4k|{
  537|  34.4k|    BYTE v[8];
  538|       |
  539|  34.4k|    assert(dstEnd >= dstPtr + MINMATCH);
  ------------------
  |  |  273|  34.4k|#    define assert(condition) ((void)0)
  ------------------
  540|       |
  541|  34.4k|    switch(offset) {
  542|  25.0k|    case 1:
  ------------------
  |  Branch (542:5): [True: 25.0k, False: 9.38k]
  ------------------
  543|  25.0k|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  236|  25.0k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  234|  25.0k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  544|  25.0k|        break;
  545|    343|    case 2:
  ------------------
  |  Branch (545:5): [True: 343, False: 34.1k]
  ------------------
  546|    343|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  349|    343|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  547|    343|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  349|    343|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  548|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  549|       |#  pragma warning(push)
  550|       |#  pragma warning(disable : 6385) /* warning C6385: Reading invalid data from 'v'. */
  551|       |#endif
  552|    343|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  349|    343|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  553|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  554|       |#  pragma warning(pop)
  555|       |#endif
  556|    343|        break;
  557|    600|    case 4:
  ------------------
  |  Branch (557:5): [True: 600, False: 33.8k]
  ------------------
  558|    600|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  349|    600|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  559|    600|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  349|    600|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  560|    600|        break;
  561|  8.44k|    default:
  ------------------
  |  Branch (561:5): [True: 8.44k, False: 26.0k]
  ------------------
  562|  8.44k|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  563|  8.44k|        return;
  564|  34.4k|    }
  565|       |
  566|  26.0k|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  349|  26.0k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  567|  26.0k|    dstPtr += 8;
  568|  1.12M|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (568:12): [True: 1.10M, False: 26.0k]
  ------------------
  569|  1.10M|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  349|  1.10M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  570|  1.10M|        dstPtr += 8;
  571|  1.10M|    }
  572|  26.0k|}
lz4.c:LZ4_memcpy_using_offset_base:
  497|  8.44k|{
  498|  8.44k|    assert(srcPtr + offset == dstPtr);
  ------------------
  |  |  273|  8.44k|#    define assert(condition) ((void)0)
  ------------------
  499|  8.44k|    if (offset < 8) {
  ------------------
  |  Branch (499:9): [True: 7.88k, False: 560]
  ------------------
  500|  7.88k|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  501|  7.88k|        dstPtr[0] = srcPtr[0];
  502|  7.88k|        dstPtr[1] = srcPtr[1];
  503|  7.88k|        dstPtr[2] = srcPtr[2];
  504|  7.88k|        dstPtr[3] = srcPtr[3];
  505|  7.88k|        srcPtr += inc32table[offset];
  506|  7.88k|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  349|  7.88k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  507|  7.88k|        srcPtr -= dec64table[offset];
  508|  7.88k|        dstPtr += 8;
  509|  7.88k|    } else {
  510|    560|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  349|    560|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  511|    560|        dstPtr += 8;
  512|    560|        srcPtr += 8;
  513|    560|    }
  514|       |
  515|  8.44k|    LZ4_wildCopy8(dstPtr, srcPtr, dstEnd);
  516|  8.44k|}

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

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

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

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

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

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

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

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

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

inflate_fast_avx2:
   53|  3.77k|void Z_INTERNAL INFLATE_FAST(PREFIX3(stream) *strm, uint32_t start) {
   54|       |    /* start: inflate()'s starting value for strm->avail_out */
   55|  3.77k|    struct inflate_state *state;
   56|  3.77k|    z_const unsigned char *in;  /* local strm->next_in */
  ------------------
  |  |   23|  3.77k|#define z_const const
  ------------------
   57|  3.77k|    const unsigned char *last;  /* have enough input while in < last */
   58|  3.77k|    unsigned char *out;         /* local strm->next_out */
   59|  3.77k|    unsigned char *beg;         /* inflate()'s initial strm->next_out */
   60|  3.77k|    unsigned char *end;         /* while out < end, enough space available */
   61|  3.77k|    unsigned char *safe;        /* can use chunkcopy provided out < safe */
   62|  3.77k|    unsigned char *window;      /* allocated sliding window, if wsize != 0 */
   63|  3.77k|    unsigned wsize;             /* window size or zero if not using window */
   64|  3.77k|    unsigned whave;             /* valid bytes in the window */
   65|  3.77k|    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.77k|    unsigned bits;              /* local strm->bits */
  105|  3.77k|    uint64_t hold;              /* local strm->hold */
  106|  3.77k|    unsigned lmask;             /* mask for first level of length codes */
  107|  3.77k|    unsigned dmask;             /* mask for first level of distance codes */
  108|  3.77k|    code const *lcode;          /* local strm->lencode */
  109|  3.77k|    code const *dcode;          /* local strm->distcode */
  110|  3.77k|    const code *here;           /* retrieved table entry */
  111|  3.77k|    unsigned op;                /* code bits, operation, extra bits, or */
  112|       |                                /*  window position, window bytes to copy */
  113|  3.77k|    unsigned len;               /* match length, unused bytes */
  114|  3.77k|    unsigned char *from;        /* where to copy match from */
  115|  3.77k|    unsigned dist;              /* match distance */
  116|  3.77k|    unsigned extra_safe;        /* copy chunks safely in all cases */
  117|       |
  118|       |    /* copy state to local variables */
  119|  3.77k|    state = (struct inflate_state *)strm->state;
  120|  3.77k|    in = strm->next_in;
  121|  3.77k|    last = in + (strm->avail_in - (INFLATE_FAST_MIN_HAVE - 1));
  ------------------
  |  |  137|  3.77k|#define INFLATE_FAST_MIN_HAVE 15
  ------------------
  122|  3.77k|    out = strm->next_out;
  123|  3.77k|    beg = out - (start - strm->avail_out);
  124|  3.77k|    end = out + (strm->avail_out - (INFLATE_FAST_MIN_LEFT - 1));
  ------------------
  |  |  138|  3.77k|#define INFLATE_FAST_MIN_LEFT 260
  ------------------
  125|  3.77k|    safe = out + strm->avail_out;
  126|  3.77k|    wsize = state->wsize;
  127|  3.77k|    whave = state->whave;
  128|  3.77k|    wnext = state->wnext;
  129|  3.77k|    window = state->window;
  130|  3.77k|    hold = state->hold;
  131|  3.77k|    bits = state->bits;
  132|  3.77k|    lcode = state->lencode;
  133|  3.77k|    dcode = state->distcode;
  134|  3.77k|    lmask = (1U << state->lenbits) - 1;
  135|  3.77k|    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.77k|    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.77k]
  |  Branch (140:33): [True: 0, False: 0]
  |  Branch (140:50): [True: 0, False: 0]
  ------------------
  141|       |
  142|  3.77k|#define REFILL() do { \
  143|  3.77k|        hold |= load_64_bits(in, bits); \
  144|  3.77k|        in += 7; \
  145|  3.77k|        in -= ((bits >> 3) & 7); \
  146|  3.77k|        bits |= 56; \
  147|  3.77k|    } while (0)
  148|       |
  149|       |    /* decode literals and length/distances until end-of-block or not enough
  150|       |       input data or output space */
  151|   293k|    do {
  152|   293k|        REFILL();
  ------------------
  |  |  142|   293k|#define REFILL() do { \
  |  |  143|   293k|        hold |= load_64_bits(in, bits); \
  |  |  144|   293k|        in += 7; \
  |  |  145|   293k|        in -= ((bits >> 3) & 7); \
  |  |  146|   293k|        bits |= 56; \
  |  |  147|   293k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (147:14): [Folded, False: 293k]
  |  |  ------------------
  ------------------
  153|   293k|        here = lcode + (hold & lmask);
  154|   293k|        if (here->op == 0) {
  ------------------
  |  Branch (154:13): [True: 90.3k, False: 202k]
  ------------------
  155|  90.3k|            *out++ = (unsigned char)(here->val);
  156|  90.3k|            DROPBITS(here->bits);
  ------------------
  |  |  118|  90.3k|    do { \
  |  |  119|  90.3k|        hold >>= (n); \
  |  |  120|  90.3k|        bits -= (unsigned)(n); \
  |  |  121|  90.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 90.3k]
  |  |  ------------------
  ------------------
  157|  90.3k|            here = lcode + (hold & lmask);
  158|  90.3k|            if (here->op == 0) {
  ------------------
  |  Branch (158:17): [True: 37.4k, False: 52.9k]
  ------------------
  159|  37.4k|                *out++ = (unsigned char)(here->val);
  160|  37.4k|                DROPBITS(here->bits);
  ------------------
  |  |  118|  37.4k|    do { \
  |  |  119|  37.4k|        hold >>= (n); \
  |  |  120|  37.4k|        bits -= (unsigned)(n); \
  |  |  121|  37.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 37.4k]
  |  |  ------------------
  ------------------
  161|  37.4k|                here = lcode + (hold & lmask);
  162|  37.4k|            }
  163|  90.3k|        }
  164|   299k|      dolen:
  165|   299k|        DROPBITS(here->bits);
  ------------------
  |  |  118|   299k|    do { \
  |  |  119|   299k|        hold >>= (n); \
  |  |  120|   299k|        bits -= (unsigned)(n); \
  |  |  121|   299k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 299k]
  |  |  ------------------
  ------------------
  166|   299k|        op = here->op;
  167|   299k|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (167:13): [True: 31.6k, False: 267k]
  ------------------
  168|  31.6k|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  169|  31.6k|                    "inflate:         literal '%c'\n" :
  170|  31.6k|                    "inflate:         literal 0x%02x\n", here->val));
  171|  31.6k|            *out++ = (unsigned char)(here->val);
  172|   267k|        } else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (172:20): [True: 260k, False: 7.17k]
  ------------------
  173|   260k|            len = here->val;
  174|   260k|            op &= MAX_BITS;                       /* number of extra bits */
  ------------------
  |  |   39|   260k|#define MAX_BITS 15
  ------------------
  175|   260k|            len += BITS(op);
  ------------------
  |  |  114|   260k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  176|   260k|            DROPBITS(op);
  ------------------
  |  |  118|   260k|    do { \
  |  |  119|   260k|        hold >>= (n); \
  |  |  120|   260k|        bits -= (unsigned)(n); \
  |  |  121|   260k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 260k]
  |  |  ------------------
  ------------------
  177|   260k|            Tracevv((stderr, "inflate:         length %u\n", len));
  178|   260k|            here = dcode + (hold & dmask);
  179|   260k|            if (bits < MAX_BITS + MAX_DIST_EXTRA_BITS) {
  ------------------
  |  |   39|   260k|#define MAX_BITS 15
  ------------------
                          if (bits < MAX_BITS + MAX_DIST_EXTRA_BITS) {
  ------------------
  |  |   41|   260k|#define MAX_DIST_EXTRA_BITS 13
  ------------------
  |  Branch (179:17): [True: 332, False: 260k]
  ------------------
  180|    332|                REFILL();
  ------------------
  |  |  142|    332|#define REFILL() do { \
  |  |  143|    332|        hold |= load_64_bits(in, bits); \
  |  |  144|    332|        in += 7; \
  |  |  145|    332|        in -= ((bits >> 3) & 7); \
  |  |  146|    332|        bits |= 56; \
  |  |  147|    332|    } while (0)
  |  |  ------------------
  |  |  |  Branch (147:14): [Folded, False: 332]
  |  |  ------------------
  ------------------
  181|    332|            }
  182|   262k|          dodist:
  183|   262k|            DROPBITS(here->bits);
  ------------------
  |  |  118|   262k|    do { \
  |  |  119|   262k|        hold >>= (n); \
  |  |  120|   262k|        bits -= (unsigned)(n); \
  |  |  121|   262k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 262k]
  |  |  ------------------
  ------------------
  184|   262k|            op = here->op;
  185|   262k|            if (op & 16) {                      /* distance base */
  ------------------
  |  Branch (185:17): [True: 260k, False: 1.64k]
  ------------------
  186|   260k|                dist = here->val;
  187|   260k|                op &= MAX_BITS;                 /* number of extra bits */
  ------------------
  |  |   39|   260k|#define MAX_BITS 15
  ------------------
  188|   260k|                dist += BITS(op);
  ------------------
  |  |  114|   260k|    (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|   260k|                DROPBITS(op);
  ------------------
  |  |  118|   260k|    do { \
  |  |  119|   260k|        hold >>= (n); \
  |  |  120|   260k|        bits -= (unsigned)(n); \
  |  |  121|   260k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 260k]
  |  |  ------------------
  ------------------
  196|   260k|                Tracevv((stderr, "inflate:         distance %u\n", dist));
  197|   260k|                op = (unsigned)(out - beg);     /* max distance in output */
  198|   260k|                if (dist > op) {                /* see if copy from window */
  ------------------
  |  Branch (198:21): [True: 20, False: 260k]
  ------------------
  199|     20|                    op = dist - op;             /* distance back in window */
  200|     20|                    if (op > whave) {
  ------------------
  |  Branch (200:25): [True: 20, 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|     20|                        SET_BAD("invalid distance too far back");
  ------------------
  |  |  132|     20|    do { \
  |  |  133|     20|        state->mode = BAD; \
  |  |  134|     20|        strm->msg = (char *)errmsg; \
  |  |  135|     20|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 20]
  |  |  ------------------
  ------------------
  225|     20|                        break;
  226|     20|#endif
  227|     20|                    }
  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|   260k|                } else if (extra_safe) {
  ------------------
  |  Branch (265:28): [True: 0, False: 260k]
  ------------------
  266|       |                    /* Whole reference is in range of current output. */
  267|      0|                        out = chunkcopy_safe(out, out - dist, len, safe);
  268|      0|#endif
  269|   260k|                } 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|   260k|                    if (dist >= len || dist >= CHUNKSIZE())
  ------------------
  |  |  118|   209k|#define CHUNKSIZE        chunksize_avx2
  ------------------
  |  Branch (275:25): [True: 51.1k, False: 209k]
  |  Branch (275:40): [True: 2.37k, False: 206k]
  ------------------
  276|  53.5k|                        out = CHUNKCOPY(out, out - dist, len);
  ------------------
  |  |  119|  53.5k|#define CHUNKCOPY        chunkcopy_avx2
  ------------------
  277|   206k|                    else
  278|   206k|                        out = CHUNKMEMSET(out, out - dist, len);
  ------------------
  |  |  121|   206k|#define CHUNKMEMSET      chunkmemset_avx2
  ------------------
  279|   260k|                }
  280|   260k|            } else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (280:24): [True: 1.63k, False: 5]
  ------------------
  281|  1.63k|                here = dcode + here->val + BITS(op);
  ------------------
  |  |  114|  1.63k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  282|  1.63k|                goto dodist;
  283|  1.63k|            } else {
  284|      5|                SET_BAD("invalid distance code");
  ------------------
  |  |  132|      5|    do { \
  |  |  133|      5|        state->mode = BAD; \
  |  |  134|      5|        strm->msg = (char *)errmsg; \
  |  |  135|      5|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 5]
  |  |  ------------------
  ------------------
  285|      5|                break;
  286|      5|            }
  287|   262k|        } else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (287:20): [True: 6.26k, False: 918]
  ------------------
  288|  6.26k|            here = lcode + here->val + BITS(op);
  ------------------
  |  |  114|  6.26k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  289|  6.26k|            goto dolen;
  290|  6.26k|        } else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (290:20): [True: 916, False: 2]
  ------------------
  291|    916|            Tracevv((stderr, "inflate:         end of block\n"));
  292|    916|            state->mode = TYPE;
  293|    916|            break;
  294|    916|        } else {
  295|      2|            SET_BAD("invalid literal/length code");
  ------------------
  |  |  132|      2|    do { \
  |  |  133|      2|        state->mode = BAD; \
  |  |  134|      2|        strm->msg = (char *)errmsg; \
  |  |  135|      2|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 2]
  |  |  ------------------
  ------------------
  296|      2|            break;
  297|      2|        }
  298|   299k|    } while (in < last && out < end);
  ------------------
  |  Branch (298:14): [True: 289k, False: 2.73k]
  |  Branch (298:27): [True: 289k, False: 93]
  ------------------
  299|       |
  300|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  301|  3.77k|    len = bits >> 3;
  302|  3.77k|    in -= len;
  303|  3.77k|    bits -= len << 3;
  304|  3.77k|    hold &= (UINT64_C(1) << bits) - 1;
  305|       |
  306|       |    /* update state and return */
  307|  3.77k|    strm->next_in = in;
  308|  3.77k|    strm->next_out = out;
  309|  3.77k|    strm->avail_in = (unsigned)(in < last ? (INFLATE_FAST_MIN_HAVE - 1) + (last - in)
  ------------------
  |  |  137|  3.48k|#define INFLATE_FAST_MIN_HAVE 15
  ------------------
  |  Branch (309:33): [True: 3.48k, False: 289]
  ------------------
  310|  3.77k|                                          : (INFLATE_FAST_MIN_HAVE - 1) - (in - last));
  ------------------
  |  |  137|    289|#define INFLATE_FAST_MIN_HAVE 15
  ------------------
  311|  3.77k|    strm->avail_out = (unsigned)(out < end ? (INFLATE_FAST_MIN_LEFT - 1) + (end - out)
  ------------------
  |  |  138|  3.67k|#define INFLATE_FAST_MIN_LEFT 260
  ------------------
  |  Branch (311:34): [True: 3.67k, False: 95]
  ------------------
  312|  3.77k|                                           : (INFLATE_FAST_MIN_LEFT - 1) - (out - end));
  ------------------
  |  |  138|     95|#define INFLATE_FAST_MIN_LEFT 260
  ------------------
  313|       |
  314|  3.77k|    Assert(bits <= 32, "Remaining bits greater than 32");
  315|  3.77k|    state->hold = (uint32_t)hold;
  316|  3.77k|    state->bits = bits;
  317|  3.77k|    return;
  318|  3.77k|}

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

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

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

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

chunkset_avx2.c:zng_memread_2:
   12|  1.82k|static inline uint16_t zng_memread_2(const void *ptr) {
   13|  1.82k|#if defined(HAVE_MAY_ALIAS)
   14|  1.82k|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   15|  1.82k|    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|  1.82k|}
chunkset_avx2.c:zng_memread_4:
   23|  1.52k|static inline uint32_t zng_memread_4(const void *ptr) {
   24|  1.52k|#if defined(HAVE_MAY_ALIAS)
   25|  1.52k|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  1.52k|    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.52k|}
chunkset_avx2.c:zng_memread_8:
   34|   293k|static inline uint64_t zng_memread_8(const void *ptr) {
   35|   293k|#if defined(HAVE_MAY_ALIAS)
   36|   293k|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   37|   293k|    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|   293k|}

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

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

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

zstd_decompress_block.c:ZSTD_highbit32:
  175|   220k|{
  176|   220k|    assert(val != 0);
  ------------------
  |  |   70|   220k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|   220k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|   220k|}
zstd_decompress_block.c:ZSTD_countLeadingZeros32:
   70|   220k|{
   71|   220k|    assert(val != 0);
  ------------------
  |  |   70|   220k|#    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|   220k|}
entropy_common.c:ZSTD_countTrailingZeros32:
   29|  5.00k|{
   30|  5.00k|    assert(val != 0);
  ------------------
  |  |   70|  5.00k|#    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|  5.00k|}
entropy_common.c:ZSTD_highbit32:
  175|  11.9k|{
  176|  11.9k|    assert(val != 0);
  ------------------
  |  |   70|  11.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  11.9k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  11.9k|}
entropy_common.c:ZSTD_countLeadingZeros32:
   70|  11.9k|{
   71|  11.9k|    assert(val != 0);
  ------------------
  |  |   70|  11.9k|#    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|  11.9k|}
fse_decompress.c:ZSTD_highbit32:
  175|  36.6k|{
  176|  36.6k|    assert(val != 0);
  ------------------
  |  |   70|  36.6k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  36.6k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  36.6k|}
fse_decompress.c:ZSTD_countLeadingZeros32:
   70|  36.6k|{
   71|  36.6k|    assert(val != 0);
  ------------------
  |  |   70|  36.6k|#    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|  36.6k|}
huf_decompress.c:ZSTD_highbit32:
  175|  1.25k|{
  176|  1.25k|    assert(val != 0);
  ------------------
  |  |   70|  1.25k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  1.25k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  1.25k|}
huf_decompress.c:ZSTD_countLeadingZeros32:
   70|  1.25k|{
   71|  1.25k|    assert(val != 0);
  ------------------
  |  |   70|  1.25k|#    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.25k|}
huf_decompress.c:ZSTD_countTrailingZeros64:
   94|    318|{
   95|    318|    assert(val != 0);
  ------------------
  |  |   70|    318|#    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|    318|}

zstd_decompress_block.c:BIT_initDStream:
  255|  2.01k|{
  256|  2.01k|    if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   46|      4|# 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|      4|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      4|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      4|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (256:9): [True: 4, False: 2.00k]
  ------------------
  257|       |
  258|  2.00k|    bitD->start = (const char*)srcBuffer;
  259|  2.00k|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|  2.00k|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 1.95k, False: 52]
  ------------------
  262|  1.95k|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|  1.95k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|  1.95k|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|  1.95k|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 1.83k, False: 125]
  ------------------
  266|  1.95k|          if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
  ------------------
  |  |   49|    125|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    125|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    125|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (266:15): [True: 125, False: 1.83k]
  ------------------
  267|  1.95k|    } else {
  268|     52|        bitD->ptr   = bitD->start;
  269|     52|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|     52|        switch(srcSize)
  271|     52|        {
  272|      6|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 6, False: 46]
  ------------------
  273|      6|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|      6|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|     14|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 8, False: 44]
  ------------------
  276|     14|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     14|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|     17|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 3, False: 49]
  ------------------
  279|     17|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     17|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|     20|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 3, False: 49]
  ------------------
  282|     20|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     20|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|     30|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 10, False: 42]
  ------------------
  285|     30|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     30|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|     44|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 14, False: 38]
  ------------------
  288|     44|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     44|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|     52|        default: break;
  ------------------
  |  Branch (290:9): [True: 8, False: 44]
  ------------------
  291|     52|        }
  292|     52|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|     52|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 46, False: 6]
  ------------------
  294|     52|            if (lastByte == 0) return ERROR(corruption_detected);  /* endMark not present */
  ------------------
  |  |   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 (294:17): [True: 6, False: 46]
  ------------------
  295|     52|        }
  296|     46|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|     46|    }
  298|       |
  299|  1.87k|    return srcSize;
  300|  2.00k|}
zstd_decompress_block.c:BIT_readBits:
  363|  7.51M|{
  364|  7.51M|    BitContainerType const value = BIT_lookBits(bitD, nbBits);
  365|  7.51M|    BIT_skipBits(bitD, nbBits);
  366|  7.51M|    return value;
  367|  7.51M|}
zstd_decompress_block.c:BIT_lookBits:
  331|  7.51M|{
  332|       |    /* arbitrate between double-shift and shift+mask */
  333|  7.51M|#if 1
  334|       |    /* if bitD->bitsConsumed + nbBits > sizeof(bitD->bitContainer)*8,
  335|       |     * bitstream is likely corrupted, and result is undefined */
  336|  7.51M|    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.51M|}
zstd_decompress_block.c:BIT_getMiddleBits:
  308|  7.51M|{
  309|  7.51M|    U32 const regMask = sizeof(bitContainer)*8 - 1;
  310|       |    /* if start > regMask, bitstream is corrupted, and result is undefined */
  311|  7.51M|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  7.51M|#    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.51M|#if defined(__x86_64__) || defined(_M_X64)
  318|  7.51M|    return (bitContainer >> (start & regMask)) & ((((U64)1) << nbBits) - 1);
  319|       |#else
  320|       |    return (bitContainer >> (start & regMask)) & BIT_mask[nbBits];
  321|       |#endif
  322|  7.51M|}
zstd_decompress_block.c:BIT_skipBits:
  354|  9.43M|{
  355|  9.43M|    bitD->bitsConsumed += nbBits;
  356|  9.43M|}
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))) {
  ------------------
  |  |  188|  2.50M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 2.39M, False: 117k]
  |  |  ------------------
  ------------------
  416|  2.39M|        static const BitContainerType zeroFilled = 0;
  417|  2.39M|        bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
  418|       |        /* overflow detected, erroneous scenario or end of stream: no update */
  419|  2.39M|        return BIT_DStream_overflow;
  420|  2.39M|    }
  421|       |
  422|   117k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|   117k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|   117k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 86.2k, False: 31.7k]
  ------------------
  425|  86.2k|        return BIT_reloadDStream_internal(bitD);
  426|  86.2k|    }
  427|  31.7k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 20.4k, False: 11.2k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|  20.4k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 19.8k, False: 682]
  ------------------
  430|    682|        return BIT_DStream_completed;
  431|  20.4k|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  11.2k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  11.2k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  11.2k|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (435:13): [True: 837, False: 10.3k]
  ------------------
  436|    837|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|    837|            result = BIT_DStream_endOfBuffer;
  438|    837|        }
  439|  11.2k|        bitD->ptr -= nbBytes;
  440|  11.2k|        bitD->bitsConsumed -= nbBytes*8;
  441|  11.2k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  11.2k|        return result;
  443|  31.7k|    }
  444|  31.7k|}
zstd_decompress_block.c:BIT_reloadDStream_internal:
  385|  86.2k|{
  386|  86.2k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|  86.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|  86.2k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|  86.2k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  86.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|  86.2k|    bitD->bitsConsumed &= 7;
  390|  86.2k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|  86.2k|    return BIT_DStream_unfinished;
  392|  86.2k|}
zstd_decompress_block.c:BIT_readBitsFast:
  372|  1.92M|{
  373|  1.92M|    BitContainerType const value = BIT_lookBitsFast(bitD, nbBits);
  374|  1.92M|    assert(nbBits >= 1);
  ------------------
  |  |   70|  1.92M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  375|  1.92M|    BIT_skipBits(bitD, nbBits);
  376|  1.92M|    return value;
  377|  1.92M|}
zstd_decompress_block.c:BIT_lookBitsFast:
  347|  1.92M|{
  348|  1.92M|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|  1.92M|    assert(nbBits >= 1);
  ------------------
  |  |   70|  1.92M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|  1.92M|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|  1.92M|}
zstd_decompress_block.c:BIT_endOfDStream:
  450|    426|{
  451|    426|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (451:13): [True: 389, False: 37]
  |  Branch (451:49): [True: 382, False: 7]
  ------------------
  452|    426|}
fse_decompress.c:BIT_initDStream:
  255|    681|{
  256|    681|    if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   46|      1|# 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|      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 (256:9): [True: 1, False: 680]
  ------------------
  257|       |
  258|    680|    bitD->start = (const char*)srcBuffer;
  259|    680|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|    680|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 563, False: 117]
  ------------------
  262|    563|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|    563|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|    563|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|    563|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 548, False: 15]
  ------------------
  266|    563|          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: 548]
  ------------------
  267|    563|    } else {
  268|    117|        bitD->ptr   = bitD->start;
  269|    117|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|    117|        switch(srcSize)
  271|    117|        {
  272|      7|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 7, False: 110]
  ------------------
  273|      7|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|      7|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|      9|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 2, False: 115]
  ------------------
  276|      9|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|      9|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|     59|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 50, False: 67]
  ------------------
  279|     59|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     59|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|     72|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 13, False: 104]
  ------------------
  282|     72|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     72|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|     94|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 22, False: 95]
  ------------------
  285|     94|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     94|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|    108|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 14, False: 103]
  ------------------
  288|    108|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|    108|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|    117|        default: break;
  ------------------
  |  Branch (290:9): [True: 9, False: 108]
  ------------------
  291|    117|        }
  292|    117|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|    117|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 111, False: 6]
  ------------------
  294|    117|            if (lastByte == 0) return ERROR(corruption_detected);  /* endMark not present */
  ------------------
  |  |   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 (294:17): [True: 6, False: 111]
  ------------------
  295|    117|        }
  296|    111|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|    111|    }
  298|       |
  299|    659|    return srcSize;
  300|    680|}
fse_decompress.c:BIT_readBits:
  363|  72.9k|{
  364|  72.9k|    BitContainerType const value = BIT_lookBits(bitD, nbBits);
  365|  72.9k|    BIT_skipBits(bitD, nbBits);
  366|  72.9k|    return value;
  367|  72.9k|}
fse_decompress.c:BIT_lookBits:
  331|  72.9k|{
  332|       |    /* arbitrate between double-shift and shift+mask */
  333|  72.9k|#if 1
  334|       |    /* if bitD->bitsConsumed + nbBits > sizeof(bitD->bitContainer)*8,
  335|       |     * bitstream is likely corrupted, and result is undefined */
  336|  72.9k|    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|  72.9k|}
fse_decompress.c:BIT_getMiddleBits:
  308|  72.9k|{
  309|  72.9k|    U32 const regMask = sizeof(bitContainer)*8 - 1;
  310|       |    /* if start > regMask, bitstream is corrupted, and result is undefined */
  311|  72.9k|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  72.9k|#    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|  72.9k|#if defined(__x86_64__) || defined(_M_X64)
  318|  72.9k|    return (bitContainer >> (start & regMask)) & ((((U64)1) << nbBits) - 1);
  319|       |#else
  320|       |    return (bitContainer >> (start & regMask)) & BIT_mask[nbBits];
  321|       |#endif
  322|  72.9k|}
fse_decompress.c:BIT_skipBits:
  354|  85.0k|{
  355|  85.0k|    bitD->bitsConsumed += nbBits;
  356|  85.0k|}
fse_decompress.c:BIT_reloadDStream:
  413|  41.0k|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|  41.0k|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  188|  41.0k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 651, False: 40.4k]
  |  |  ------------------
  ------------------
  416|    651|        static const BitContainerType zeroFilled = 0;
  417|    651|        bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
  418|       |        /* overflow detected, erroneous scenario or end of stream: no update */
  419|    651|        return BIT_DStream_overflow;
  420|    651|    }
  421|       |
  422|  40.4k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  40.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|  40.4k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 10.7k, False: 29.6k]
  ------------------
  425|  10.7k|        return BIT_reloadDStream_internal(bitD);
  426|  10.7k|    }
  427|  29.6k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 23.8k, False: 5.82k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|  23.8k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 23.1k, False: 633]
  ------------------
  430|    633|        return BIT_DStream_completed;
  431|  23.8k|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  5.82k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  5.82k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  5.82k|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (435:13): [True: 63, False: 5.75k]
  ------------------
  436|     63|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|     63|            result = BIT_DStream_endOfBuffer;
  438|     63|        }
  439|  5.82k|        bitD->ptr -= nbBytes;
  440|  5.82k|        bitD->bitsConsumed -= nbBytes*8;
  441|  5.82k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  5.82k|        return result;
  443|  29.6k|    }
  444|  29.6k|}
fse_decompress.c:BIT_reloadDStream_internal:
  385|  10.7k|{
  386|  10.7k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|  10.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|  10.7k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|  10.7k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  10.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|  10.7k|    bitD->bitsConsumed &= 7;
  390|  10.7k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|  10.7k|    return BIT_DStream_unfinished;
  392|  10.7k|}
fse_decompress.c:BIT_readBitsFast:
  372|  12.1k|{
  373|  12.1k|    BitContainerType const value = BIT_lookBitsFast(bitD, nbBits);
  374|  12.1k|    assert(nbBits >= 1);
  ------------------
  |  |   70|  12.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  375|  12.1k|    BIT_skipBits(bitD, nbBits);
  376|  12.1k|    return value;
  377|  12.1k|}
fse_decompress.c:BIT_lookBitsFast:
  347|  12.1k|{
  348|  12.1k|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|  12.1k|    assert(nbBits >= 1);
  ------------------
  |  |   70|  12.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|  12.1k|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|  12.1k|}
huf_decompress.c:BIT_initDStream:
  255|    936|{
  256|    936|    if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   46|     13|# 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|     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 (256:9): [True: 13, False: 923]
  ------------------
  257|       |
  258|    923|    bitD->start = (const char*)srcBuffer;
  259|    923|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|    923|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 760, False: 163]
  ------------------
  262|    760|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|    760|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|    760|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|    760|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 749, False: 11]
  ------------------
  266|    760|          if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
  ------------------
  |  |   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 (266:15): [True: 11, False: 749]
  ------------------
  267|    760|    } else {
  268|    163|        bitD->ptr   = bitD->start;
  269|    163|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|    163|        switch(srcSize)
  271|    163|        {
  272|     15|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 15, False: 148]
  ------------------
  273|     15|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     15|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|     25|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 10, False: 153]
  ------------------
  276|     25|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     25|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|     41|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 16, False: 147]
  ------------------
  279|     41|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     41|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|     72|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 31, False: 132]
  ------------------
  282|     72|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     72|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|     90|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 18, False: 145]
  ------------------
  285|     90|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     90|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|    106|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 16, False: 147]
  ------------------
  288|    106|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|    106|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|    163|        default: break;
  ------------------
  |  Branch (290:9): [True: 57, False: 106]
  ------------------
  291|    163|        }
  292|    163|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|    163|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 155, False: 8]
  ------------------
  294|    163|            if (lastByte == 0) return ERROR(corruption_detected);  /* endMark not present */
  ------------------
  |  |   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 (294:17): [True: 8, False: 155]
  ------------------
  295|    163|        }
  296|    155|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|    155|    }
  298|       |
  299|    904|    return srcSize;
  300|    923|}
huf_decompress.c:BIT_reloadDStream:
  413|  49.4k|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|  49.4k|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  188|  49.4k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 79, False: 49.3k]
  |  |  ------------------
  ------------------
  416|     79|        static const BitContainerType zeroFilled = 0;
  417|     79|        bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
  418|       |        /* overflow detected, erroneous scenario or end of stream: no update */
  419|     79|        return BIT_DStream_overflow;
  420|     79|    }
  421|       |
  422|  49.3k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  49.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|  49.3k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 45.9k, False: 3.42k]
  ------------------
  425|  45.9k|        return BIT_reloadDStream_internal(bitD);
  426|  45.9k|    }
  427|  3.42k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 774, False: 2.64k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|    774|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 758, False: 16]
  ------------------
  430|     16|        return BIT_DStream_completed;
  431|    774|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  2.64k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  2.64k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  2.64k|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (435:13): [True: 384, False: 2.26k]
  ------------------
  436|    384|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|    384|            result = BIT_DStream_endOfBuffer;
  438|    384|        }
  439|  2.64k|        bitD->ptr -= nbBytes;
  440|  2.64k|        bitD->bitsConsumed -= nbBytes*8;
  441|  2.64k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  2.64k|        return result;
  443|  3.42k|    }
  444|  3.42k|}
huf_decompress.c:BIT_reloadDStream_internal:
  385|  70.2k|{
  386|  70.2k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|  70.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|  70.2k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|  70.2k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  70.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|  70.2k|    bitD->bitsConsumed &= 7;
  390|  70.2k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|  70.2k|    return BIT_DStream_unfinished;
  392|  70.2k|}
huf_decompress.c:BIT_lookBitsFast:
  347|   984k|{
  348|   984k|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|   984k|    assert(nbBits >= 1);
  ------------------
  |  |   70|   984k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|   984k|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|   984k|}
huf_decompress.c:BIT_skipBits:
  354|   984k|{
  355|   984k|    bitD->bitsConsumed += nbBits;
  356|   984k|}
huf_decompress.c:BIT_endOfDStream:
  450|    853|{
  451|    853|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (451:13): [True: 610, False: 243]
  |  Branch (451:49): [True: 7, False: 603]
  ------------------
  452|    853|}
huf_decompress.c:BIT_reloadDStreamFast:
  401|  24.6k|{
  402|  24.6k|    if (UNLIKELY(bitD->ptr < bitD->limitPtr))
  ------------------
  |  |  188|  24.6k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 255, False: 24.3k]
  |  |  ------------------
  ------------------
  403|    255|        return BIT_DStream_overflow;
  404|  24.3k|    return BIT_reloadDStream_internal(bitD);
  405|  24.6k|}

zstd_decompress_block.c:ZSTD_maybeNullPtrAdd:
  386|  3.89k|{
  387|  3.89k|    return add > 0 ? ptr + add : ptr;
  ------------------
  |  Branch (387:12): [True: 3.89k, False: 1]
  ------------------
  388|  3.89k|}
zstd_decompress_block.c:ZSTD_wrappedPtrSub:
  374|  1.06M|{
  375|  1.06M|    return ptr - sub;
  376|  1.06M|}
zstd_decompress_block.c:ZSTD_wrappedPtrAdd:
  361|  1.06M|{
  362|  1.06M|    return ptr + add;
  363|  1.06M|}
huf_decompress.c:ZSTD_maybeNullPtrAdd:
  386|    889|{
  387|    889|    return add > 0 ? ptr + add : ptr;
  ------------------
  |  Branch (387:12): [True: 886, False: 3]
  ------------------
  388|    889|}

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

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

zstd_common.c:ERR_isError:
   52|  10.0k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  10.0k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  10.0k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  10.0k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_common.c:ERR_getErrorCode:
   54|  3.50k|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: 227, False: 3.27k]
  ------------------
zstd_ddict.c:ERR_isError:
   52|  6.13k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  6.13k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  6.13k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  6.13k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_decompress.c:ERR_isError:
   52|  45.2k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  45.2k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  45.2k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  45.2k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_decompress_block.c:ERR_isError:
   52|  2.51M|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  2.51M|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  2.51M|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  2.51M|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_v05.c:ERR_isError:
   52|   103k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|   103k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|   103k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|   103k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_v06.c:ERR_isError:
   52|   117k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|   117k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|   117k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|   117k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_v07.c:ERR_isError:
   52|  84.4k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  84.4k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  84.4k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  84.4k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
entropy_common.c:ERR_isError:
   52|    894|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|    894|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    894|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    894|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
fse_decompress.c:ERR_isError:
   52|  2.11k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  2.11k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  2.11k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  2.11k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
huf_decompress.c:ERR_isError:
   52|  3.14k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  3.14k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  3.14k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  3.14k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------

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

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

zstd_ddict.c:MEM_readLE32:
  322|  2.83k|{
  323|  2.83k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 2.83k, False: 0]
  ------------------
  324|  2.83k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  2.83k|}
zstd_ddict.c:MEM_isLittleEndian:
  141|  2.83k|{
  142|  2.83k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  2.83k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  2.83k|}
zstd_ddict.c:MEM_read32:
  183|  2.83k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress.c:MEM_readLE32:
  322|  29.1k|{
  323|  29.1k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 29.1k, False: 0]
  ------------------
  324|  29.1k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  29.1k|}
zstd_decompress.c:MEM_isLittleEndian:
  141|  30.2k|{
  142|  30.2k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  30.2k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  30.2k|}
zstd_decompress.c:MEM_read32:
  183|  29.1k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress.c:MEM_readLE16:
  290|    504|{
  291|    504|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 504, False: 0]
  ------------------
  292|    504|        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|    504|}
zstd_decompress.c:MEM_read16:
  182|    504|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_decompress.c:MEM_readLE64:
  338|    550|{
  339|    550|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 550, False: 0]
  ------------------
  340|    550|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|    550|}
zstd_decompress.c:MEM_read64:
  184|    550|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
zstd_decompress_block.c:MEM_readLE24:
  311|  6.85k|{
  312|  6.85k|    return (U32)MEM_readLE16(memPtr) + ((U32)(((const BYTE*)memPtr)[2]) << 16);
  313|  6.85k|}
zstd_decompress_block.c:MEM_readLE32:
  322|    680|{
  323|    680|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 680, False: 0]
  ------------------
  324|    680|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|    680|}
zstd_decompress_block.c:MEM_isLittleEndian:
  141|   107k|{
  142|   107k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   107k|    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|   107k|}
zstd_decompress_block.c:MEM_read32:
  183|    680|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress_block.c:MEM_write64:
  189|  16.1k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
zstd_decompress_block.c:MEM_readLE16:
  290|  7.07k|{
  291|  7.07k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 7.07k, False: 0]
  ------------------
  292|  7.07k|        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.07k|}
zstd_decompress_block.c:MEM_read16:
  182|  7.07k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_decompress_block.c:MEM_32bits:
  137|  11.5M|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_decompress_block.c:MEM_64bits:
  138|  2.50M|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_decompress_block.c:MEM_readLEST:
  354|  99.4k|{
  355|  99.4k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 99.4k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|  99.4k|    else
  358|  99.4k|        return (size_t)MEM_readLE64(memPtr);
  359|  99.4k|}
zstd_decompress_block.c:MEM_readLE64:
  338|  99.4k|{
  339|  99.4k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 99.4k, False: 0]
  ------------------
  340|  99.4k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  99.4k|}
zstd_decompress_block.c:MEM_read64:
  184|  99.4k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
zstd_v05.c:MEM_readLE32:
  322|  42.8k|{
  323|  42.8k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 42.8k, False: 0]
  ------------------
  324|  42.8k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  42.8k|}
zstd_v05.c:MEM_isLittleEndian:
  141|   264k|{
  142|   264k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   264k|    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|   264k|}
zstd_v05.c:MEM_read32:
  183|  42.8k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_v05.c:MEM_readLEST:
  354|  96.1k|{
  355|  96.1k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 96.1k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|  96.1k|    else
  358|  96.1k|        return (size_t)MEM_readLE64(memPtr);
  359|  96.1k|}
zstd_v05.c:MEM_32bits:
  137|   249k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_v05.c:MEM_readLE64:
  338|  96.1k|{
  339|  96.1k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 96.1k, False: 0]
  ------------------
  340|  96.1k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  96.1k|}
zstd_v05.c:MEM_read64:
  184|  96.1k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
zstd_v05.c:MEM_readLE16:
  290|    704|{
  291|    704|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 704, False: 0]
  ------------------
  292|    704|        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|    704|}
zstd_v05.c:MEM_read16:
  182|    704|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_v05.c:MEM_64bits:
  138|  21.4k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_v05.c:MEM_writeLE16:
  300|   125k|{
  301|   125k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (301:9): [True: 125k, False: 0]
  ------------------
  302|   125k|        MEM_write16(memPtr, val);
  303|   125k|    } else {
  304|      0|        BYTE* p = (BYTE*)memPtr;
  305|      0|        p[0] = (BYTE)val;
  306|      0|        p[1] = (BYTE)(val>>8);
  307|      0|    }
  308|   125k|}
zstd_v05.c:MEM_write16:
  187|   125k|MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(unalign16*)memPtr = value; }
entropy_common.c:MEM_readLE32:
  322|  41.0k|{
  323|  41.0k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 41.0k, False: 0]
  ------------------
  324|  41.0k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  41.0k|}
entropy_common.c:MEM_isLittleEndian:
  141|  41.0k|{
  142|  41.0k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  41.0k|    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|  41.0k|}
entropy_common.c:MEM_read32:
  183|  41.0k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
fse_decompress.c:MEM_write64:
  189|    850|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
fse_decompress.c:MEM_readLEST:
  354|  17.1k|{
  355|  17.1k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 17.1k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|  17.1k|    else
  358|  17.1k|        return (size_t)MEM_readLE64(memPtr);
  359|  17.1k|}
fse_decompress.c:MEM_32bits:
  137|  17.1k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
fse_decompress.c:MEM_isLittleEndian:
  141|  17.1k|{
  142|  17.1k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  17.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|  17.1k|}
fse_decompress.c:MEM_readLE64:
  338|  17.1k|{
  339|  17.1k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 17.1k, False: 0]
  ------------------
  340|  17.1k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  17.1k|}
fse_decompress.c:MEM_read64:
  184|  17.1k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
huf_decompress.c:MEM_isLittleEndian:
  141|   190k|{
  142|   190k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   190k|    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|   190k|}
huf_decompress.c:MEM_write64:
  189|   157k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
huf_decompress.c:MEM_readLEST:
  354|  74.4k|{
  355|  74.4k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 74.4k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|  74.4k|    else
  358|  74.4k|        return (size_t)MEM_readLE64(memPtr);
  359|  74.4k|}
huf_decompress.c:MEM_32bits:
  137|  75.3k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
huf_decompress.c:MEM_readLE64:
  338|  74.4k|{
  339|  74.4k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 74.4k, False: 0]
  ------------------
  340|  74.4k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  74.4k|}
huf_decompress.c:MEM_read64:
  184|  74.4k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
huf_decompress.c:MEM_64bits:
  138|   174k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
huf_decompress.c:MEM_readLE16:
  290|  1.66k|{
  291|  1.66k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 1.66k, False: 0]
  ------------------
  292|  1.66k|        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.66k|}
huf_decompress.c:MEM_read16:
  182|  1.66k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }

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

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

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

HUF_readDTableX1_wksp:
  386|    406|{
  387|    406|    U32 tableLog = 0;
  388|    406|    U32 nbSymbols = 0;
  389|    406|    size_t iSize;
  390|    406|    void* const dtPtr = DTable + 1;
  391|    406|    HUF_DEltX1* const dt = (HUF_DEltX1*)dtPtr;
  392|    406|    HUF_ReadDTableX1_Workspace* wksp = (HUF_ReadDTableX1_Workspace*)workSpace;
  393|       |
  394|    406|    DEBUG_STATIC_ASSERT(HUF_DECOMPRESS_WORKSPACE_SIZE >= sizeof(*wksp));
  ------------------
  |  |   39|    406|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  395|    406|    if (sizeof(*wksp) > wkspSize) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (395:9): [True: 0, False: 406]
  ------------------
  396|       |
  397|    406|    DEBUG_STATIC_ASSERT(sizeof(DTableDesc) == sizeof(HUF_DTable));
  ------------------
  |  |   39|    406|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  398|       |    /* ZSTD_memset(huffWeight, 0, sizeof(huffWeight)); */   /* is not necessary, even though some analyzer complain ... */
  399|       |
  400|    406|    iSize = HUF_readStats_wksp(wksp->huffWeight, HUF_SYMBOLVALUE_MAX + 1, wksp->rankVal, &nbSymbols, &tableLog, src, srcSize, wksp->statsWksp, sizeof(wksp->statsWksp), flags);
  ------------------
  |  |   39|    406|#define HUF_SYMBOLVALUE_MAX  255
  ------------------
  401|    406|    if (HUF_isError(iSize)) return iSize;
  ------------------
  |  |   78|    406|#define HUF_isError ERR_isError
  ------------------
  |  Branch (401:9): [True: 150, False: 256]
  ------------------
  402|       |
  403|       |
  404|       |    /* Table header */
  405|    256|    {   DTableDesc dtd = HUF_getDTableDesc(DTable);
  406|    256|        U32 const maxTableLog = dtd.maxTableLog + 1;
  407|    256|        U32 const targetTableLog = MIN(maxTableLog, HUF_DECODER_FAST_TABLELOG);
  ------------------
  |  |   54|    256|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 256]
  |  |  ------------------
  ------------------
  408|    256|        tableLog = HUF_rescaleStats(wksp->huffWeight, wksp->rankVal, nbSymbols, tableLog, targetTableLog);
  409|    256|        if (tableLog > (U32)(dtd.maxTableLog+1)) return ERROR(tableLog_tooLarge);   /* DTable too small, Huffman tree cannot fit in */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (409:13): [True: 0, False: 256]
  ------------------
  410|    256|        dtd.tableType = 0;
  411|    256|        dtd.tableLog = (BYTE)tableLog;
  412|    256|        ZSTD_memcpy(DTable, &dtd, sizeof(dtd));
  ------------------
  |  |   44|    256|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  413|    256|    }
  414|       |
  415|       |    /* Compute symbols and rankStart given rankVal:
  416|       |     *
  417|       |     * rankVal already contains the number of values of each weight.
  418|       |     *
  419|       |     * symbols contains the symbols ordered by weight. First are the rankVal[0]
  420|       |     * weight 0 symbols, followed by the rankVal[1] weight 1 symbols, and so on.
  421|       |     * symbols[0] is filled (but unused) to avoid a branch.
  422|       |     *
  423|       |     * rankStart contains the offset where each rank belongs in the DTable.
  424|       |     * rankStart[0] is not filled because there are no entries in the table for
  425|       |     * weight 0.
  426|       |     */
  427|      0|    {   int n;
  428|    256|        U32 nextRankStart = 0;
  429|    256|        int const unroll = 4;
  430|    256|        int const nLimit = (int)nbSymbols - unroll + 1;
  431|  3.38k|        for (n=0; n<(int)tableLog+1; n++) {
  ------------------
  |  Branch (431:19): [True: 3.13k, False: 256]
  ------------------
  432|  3.13k|            U32 const curr = nextRankStart;
  433|  3.13k|            nextRankStart += wksp->rankVal[n];
  434|  3.13k|            wksp->rankStart[n] = curr;
  435|  3.13k|        }
  436|  6.88k|        for (n=0; n < nLimit; n += unroll) {
  ------------------
  |  Branch (436:19): [True: 6.63k, False: 256]
  ------------------
  437|  6.63k|            int u;
  438|  33.1k|            for (u=0; u < unroll; ++u) {
  ------------------
  |  Branch (438:23): [True: 26.5k, False: 6.63k]
  ------------------
  439|  26.5k|                size_t const w = wksp->huffWeight[n+u];
  440|  26.5k|                wksp->symbols[wksp->rankStart[w]++] = (BYTE)(n+u);
  441|  26.5k|            }
  442|  6.63k|        }
  443|    608|        for (; n < (int)nbSymbols; ++n) {
  ------------------
  |  Branch (443:16): [True: 352, False: 256]
  ------------------
  444|    352|            size_t const w = wksp->huffWeight[n];
  445|    352|            wksp->symbols[wksp->rankStart[w]++] = (BYTE)n;
  446|    352|        }
  447|    256|    }
  448|       |
  449|       |    /* fill DTable
  450|       |     * We fill all entries of each weight in order.
  451|       |     * That way length is a constant for each iteration of the outer loop.
  452|       |     * We can switch based on the length to a different inner loop which is
  453|       |     * optimized for that particular case.
  454|       |     */
  455|    256|    {   U32 w;
  456|    256|        int symbol = wksp->rankVal[0];
  457|    256|        int rankStart = 0;
  458|  3.13k|        for (w=1; w<tableLog+1; ++w) {
  ------------------
  |  Branch (458:19): [True: 2.87k, False: 256]
  ------------------
  459|  2.87k|            int const symbolCount = wksp->rankVal[w];
  460|  2.87k|            int const length = (1 << w) >> 1;
  461|  2.87k|            int uStart = rankStart;
  462|  2.87k|            BYTE const nbBits = (BYTE)(tableLog + 1 - w);
  463|  2.87k|            int s;
  464|  2.87k|            int u;
  465|  2.87k|            switch (length) {
  466|    256|            case 1:
  ------------------
  |  Branch (466:13): [True: 256, False: 2.62k]
  ------------------
  467|  9.24k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (467:27): [True: 8.98k, False: 256]
  ------------------
  468|  8.98k|                    HUF_DEltX1 D;
  469|  8.98k|                    D.byte = wksp->symbols[symbol + s];
  470|  8.98k|                    D.nbBits = nbBits;
  471|  8.98k|                    dt[uStart] = D;
  472|  8.98k|                    uStart += 1;
  473|  8.98k|                }
  474|    256|                break;
  475|    256|            case 2:
  ------------------
  |  Branch (475:13): [True: 256, False: 2.62k]
  ------------------
  476|  3.41k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (476:27): [True: 3.15k, False: 256]
  ------------------
  477|  3.15k|                    HUF_DEltX1 D;
  478|  3.15k|                    D.byte = wksp->symbols[symbol + s];
  479|  3.15k|                    D.nbBits = nbBits;
  480|  3.15k|                    dt[uStart+0] = D;
  481|  3.15k|                    dt[uStart+1] = D;
  482|  3.15k|                    uStart += 2;
  483|  3.15k|                }
  484|    256|                break;
  485|    256|            case 4:
  ------------------
  |  Branch (485:13): [True: 256, False: 2.62k]
  ------------------
  486|  1.70k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (486:27): [True: 1.44k, False: 256]
  ------------------
  487|  1.44k|                    U64 const D4 = HUF_DEltX1_set4(wksp->symbols[symbol + s], nbBits);
  488|  1.44k|                    MEM_write64(dt + uStart, D4);
  489|  1.44k|                    uStart += 4;
  490|  1.44k|                }
  491|    256|                break;
  492|    256|            case 8:
  ------------------
  |  Branch (492:13): [True: 256, False: 2.62k]
  ------------------
  493|  1.37k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (493:27): [True: 1.12k, False: 256]
  ------------------
  494|  1.12k|                    U64 const D4 = HUF_DEltX1_set4(wksp->symbols[symbol + s], nbBits);
  495|  1.12k|                    MEM_write64(dt + uStart, D4);
  496|  1.12k|                    MEM_write64(dt + uStart + 4, D4);
  497|  1.12k|                    uStart += 8;
  498|  1.12k|                }
  499|    256|                break;
  500|  1.85k|            default:
  ------------------
  |  Branch (500:13): [True: 1.85k, False: 1.02k]
  ------------------
  501|  6.69k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (501:27): [True: 4.83k, False: 1.85k]
  ------------------
  502|  4.83k|                    U64 const D4 = HUF_DEltX1_set4(wksp->symbols[symbol + s], nbBits);
  503|  43.4k|                    for (u=0; u < length; u += 16) {
  ------------------
  |  Branch (503:31): [True: 38.5k, False: 4.83k]
  ------------------
  504|  38.5k|                        MEM_write64(dt + uStart + u + 0, D4);
  505|  38.5k|                        MEM_write64(dt + uStart + u + 4, D4);
  506|  38.5k|                        MEM_write64(dt + uStart + u + 8, D4);
  507|  38.5k|                        MEM_write64(dt + uStart + u + 12, D4);
  508|  38.5k|                    }
  509|  4.83k|                    assert(u == length);
  ------------------
  |  |   70|  4.83k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  510|  4.83k|                    uStart += length;
  511|  4.83k|                }
  512|  1.85k|                break;
  513|  2.87k|            }
  514|  2.87k|            symbol += symbolCount;
  515|  2.87k|            rankStart += symbolCount * length;
  516|  2.87k|        }
  517|    256|    }
  518|    256|    return iSize;
  519|    256|}
HUF_readDTableX2_wksp:
 1182|    380|{
 1183|    380|    U32 tableLog, maxW, nbSymbols;
 1184|    380|    DTableDesc dtd = HUF_getDTableDesc(DTable);
 1185|    380|    U32 maxTableLog = dtd.maxTableLog;
 1186|    380|    size_t iSize;
 1187|    380|    void* dtPtr = DTable+1;   /* force compiler to avoid strict-aliasing */
 1188|    380|    HUF_DEltX2* const dt = (HUF_DEltX2*)dtPtr;
 1189|    380|    U32 *rankStart;
 1190|       |
 1191|    380|    HUF_ReadDTableX2_Workspace* const wksp = (HUF_ReadDTableX2_Workspace*)workSpace;
 1192|       |
 1193|    380|    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 (1193:9): [True: 0, False: 380]
  ------------------
 1194|       |
 1195|    380|    rankStart = wksp->rankStart0 + 1;
 1196|    380|    ZSTD_memset(wksp->rankStats, 0, sizeof(wksp->rankStats));
  ------------------
  |  |   46|    380|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 1197|    380|    ZSTD_memset(wksp->rankStart0, 0, sizeof(wksp->rankStart0));
  ------------------
  |  |   46|    380|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 1198|       |
 1199|    380|    DEBUG_STATIC_ASSERT(sizeof(HUF_DEltX2) == sizeof(HUF_DTable));   /* if compiler fails here, assertion is wrong */
  ------------------
  |  |   39|    380|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
 1200|    380|    if (maxTableLog > HUF_TABLELOG_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   37|    380|#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 (1200:9): [True: 0, False: 380]
  ------------------
 1201|       |    /* ZSTD_memset(weightList, 0, sizeof(weightList)); */  /* is not necessary, even though some analyzer complain ... */
 1202|       |
 1203|    380|    iSize = HUF_readStats_wksp(wksp->weightList, HUF_SYMBOLVALUE_MAX + 1, wksp->rankStats, &nbSymbols, &tableLog, src, srcSize, wksp->calleeWksp, sizeof(wksp->calleeWksp), flags);
  ------------------
  |  |   39|    380|#define HUF_SYMBOLVALUE_MAX  255
  ------------------
 1204|    380|    if (HUF_isError(iSize)) return iSize;
  ------------------
  |  |   78|    380|#define HUF_isError ERR_isError
  ------------------
  |  Branch (1204:9): [True: 55, False: 325]
  ------------------
 1205|       |
 1206|       |    /* check result */
 1207|    325|    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 (1207:9): [True: 0, False: 325]
  ------------------
 1208|    325|    if (tableLog <= HUF_DECODER_FAST_TABLELOG && maxTableLog > HUF_DECODER_FAST_TABLELOG) maxTableLog = HUF_DECODER_FAST_TABLELOG;
  ------------------
  |  |   31|    650|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
                  if (tableLog <= HUF_DECODER_FAST_TABLELOG && maxTableLog > HUF_DECODER_FAST_TABLELOG) maxTableLog = HUF_DECODER_FAST_TABLELOG;
  ------------------
  |  |   31|    236|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
                  if (tableLog <= HUF_DECODER_FAST_TABLELOG && maxTableLog > HUF_DECODER_FAST_TABLELOG) maxTableLog = HUF_DECODER_FAST_TABLELOG;
  ------------------
  |  |   31|    236|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
  |  Branch (1208:9): [True: 236, False: 89]
  |  Branch (1208:50): [True: 236, False: 0]
  ------------------
 1209|       |
 1210|       |    /* find maxWeight */
 1211|    618|    for (maxW = tableLog; wksp->rankStats[maxW]==0; maxW--) {}  /* necessarily finds a solution before 0 */
  ------------------
  |  Branch (1211:27): [True: 293, False: 325]
  ------------------
 1212|       |
 1213|       |    /* Get start index of each weight */
 1214|    325|    {   U32 w, nextRankStart = 0;
 1215|  3.09k|        for (w=1; w<maxW+1; w++) {
  ------------------
  |  Branch (1215:19): [True: 2.77k, False: 325]
  ------------------
 1216|  2.77k|            U32 curr = nextRankStart;
 1217|  2.77k|            nextRankStart += wksp->rankStats[w];
 1218|  2.77k|            rankStart[w] = curr;
 1219|  2.77k|        }
 1220|    325|        rankStart[0] = nextRankStart;   /* put all 0w symbols at the end of sorted list*/
 1221|    325|        rankStart[maxW+1] = nextRankStart;
 1222|    325|    }
 1223|       |
 1224|       |    /* sort symbols by weight */
 1225|    325|    {   U32 s;
 1226|  49.8k|        for (s=0; s<nbSymbols; s++) {
  ------------------
  |  Branch (1226:19): [True: 49.5k, False: 325]
  ------------------
 1227|  49.5k|            U32 const w = wksp->weightList[s];
 1228|  49.5k|            U32 const r = rankStart[w]++;
 1229|  49.5k|            wksp->sortedSymbol[r].symbol = (BYTE)s;
 1230|  49.5k|        }
 1231|    325|        rankStart[0] = 0;   /* forget 0w symbols; this is beginning of weight(1) */
 1232|    325|    }
 1233|       |
 1234|       |    /* Build rankVal */
 1235|    325|    {   U32* const rankVal0 = wksp->rankVal[0];
 1236|    325|        {   int const rescale = (maxTableLog-tableLog) - 1;   /* tableLog <= maxTableLog */
 1237|    325|            U32 nextRankVal = 0;
 1238|    325|            U32 w;
 1239|  3.09k|            for (w=1; w<maxW+1; w++) {
  ------------------
  |  Branch (1239:23): [True: 2.77k, False: 325]
  ------------------
 1240|  2.77k|                U32 curr = nextRankVal;
 1241|  2.77k|                nextRankVal += wksp->rankStats[w] << (w+rescale);
 1242|  2.77k|                rankVal0[w] = curr;
 1243|  2.77k|        }   }
 1244|    325|        {   U32 const minBits = tableLog+1 - maxW;
 1245|    325|            U32 consumed;
 1246|  3.08k|            for (consumed = minBits; consumed < maxTableLog - minBits + 1; consumed++) {
  ------------------
  |  Branch (1246:38): [True: 2.75k, False: 325]
  ------------------
 1247|  2.75k|                U32* const rankValPtr = wksp->rankVal[consumed];
 1248|  2.75k|                U32 w;
 1249|  28.6k|                for (w = 1; w < maxW+1; w++) {
  ------------------
  |  Branch (1249:29): [True: 25.8k, False: 2.75k]
  ------------------
 1250|  25.8k|                    rankValPtr[w] = rankVal0[w] >> consumed;
 1251|  25.8k|    }   }   }   }
 1252|       |
 1253|    325|    HUF_fillDTableX2(dt, maxTableLog,
 1254|    325|                   wksp->sortedSymbol,
 1255|    325|                   wksp->rankStart0, wksp->rankVal, maxW,
 1256|    325|                   tableLog+1);
 1257|       |
 1258|    325|    dtd.tableLog = (BYTE)maxTableLog;
 1259|    325|    dtd.tableType = 1;
 1260|    325|    ZSTD_memcpy(DTable, &dtd, sizeof(dtd));
  ------------------
  |  |   44|    325|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1261|    325|    return iSize;
 1262|    325|}
HUF_selectDecoder:
 1822|    567|{
 1823|    567|    assert(dstSize > 0);
  ------------------
  |  |   70|    567|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1824|    567|    assert(dstSize <= 128*1024);
  ------------------
  |  |   70|    567|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1825|       |#if defined(HUF_FORCE_DECOMPRESS_X1)
 1826|       |    (void)dstSize;
 1827|       |    (void)cSrcSize;
 1828|       |    return 0;
 1829|       |#elif defined(HUF_FORCE_DECOMPRESS_X2)
 1830|       |    (void)dstSize;
 1831|       |    (void)cSrcSize;
 1832|       |    return 1;
 1833|       |#else
 1834|       |    /* decoder timing evaluation */
 1835|    567|    {   U32 const Q = (cSrcSize >= dstSize) ? 15 : (U32)(cSrcSize * 16 / dstSize);   /* Q < 16 */
  ------------------
  |  Branch (1835:23): [True: 28, False: 539]
  ------------------
 1836|    567|        U32 const D256 = (U32)(dstSize >> 8);
 1837|    567|        U32 const DTime0 = algoTime[Q][0].tableTime + (algoTime[Q][0].decode256Time * D256);
 1838|    567|        U32 DTime1 = algoTime[Q][1].tableTime + (algoTime[Q][1].decode256Time * D256);
 1839|    567|        DTime1 += DTime1 >> 5;  /* small advantage to algorithm using less memory, to reduce cache eviction */
 1840|    567|        return DTime1 < DTime0;
 1841|    567|    }
 1842|    567|#endif
 1843|    567|}
HUF_decompress1X1_DCtx_wksp:
 1895|     66|{
 1896|     66|    const BYTE* ip = (const BYTE*) cSrc;
 1897|       |
 1898|     66|    size_t const hSize = HUF_readDTableX1_wksp(dctx, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1899|     66|    if (HUF_isError(hSize)) return hSize;
  ------------------
  |  |   78|     66|#define HUF_isError ERR_isError
  ------------------
  |  Branch (1899:9): [True: 30, False: 36]
  ------------------
 1900|     36|    if (hSize >= cSrcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1900:9): [True: 1, False: 35]
  ------------------
 1901|     35|    ip += hSize; cSrcSize -= hSize;
 1902|       |
 1903|     35|    return HUF_decompress1X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, flags);
 1904|     36|}
HUF_decompress4X_hufOnly_wksp:
 1925|    577|{
 1926|       |    /* validation checks */
 1927|    577|    if (dstSize == 0) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1927:9): [True: 0, False: 577]
  ------------------
 1928|    577|    if (cSrcSize == 0) return ERROR(corruption_detected);
  ------------------
  |  |   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 (1928:9): [True: 10, False: 567]
  ------------------
 1929|       |
 1930|    567|    {   U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize);
 1931|       |#if defined(HUF_FORCE_DECOMPRESS_X1)
 1932|       |        (void)algoNb;
 1933|       |        assert(algoNb == 0);
 1934|       |        return HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1935|       |#elif defined(HUF_FORCE_DECOMPRESS_X2)
 1936|       |        (void)algoNb;
 1937|       |        assert(algoNb == 1);
 1938|       |        return HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1939|       |#else
 1940|    567|        return algoNb ? HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags) :
  ------------------
  |  Branch (1940:16): [True: 227, False: 340]
  ------------------
 1941|    567|                        HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1942|    577|#endif
 1943|    577|    }
 1944|    577|}
huf_decompress.c:HUF_getDTableDesc:
  144|  1.37k|{
  145|  1.37k|    DTableDesc dtd;
  146|  1.37k|    ZSTD_memcpy(&dtd, table, sizeof(dtd));
  ------------------
  |  |   44|  1.37k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  147|  1.37k|    return dtd;
  148|  1.37k|}
huf_decompress.c:HUF_rescaleStats:
  353|    256|{
  354|    256|    if (tableLog > targetTableLog)
  ------------------
  |  Branch (354:9): [True: 60, False: 196]
  ------------------
  355|     60|        return tableLog;
  356|    196|    if (tableLog < targetTableLog) {
  ------------------
  |  Branch (356:9): [True: 145, False: 51]
  ------------------
  357|    145|        U32 const scale = targetTableLog - tableLog;
  358|    145|        U32 s;
  359|       |        /* Increase the weight for all non-zero probability symbols by scale. */
  360|  11.0k|        for (s = 0; s < nbSymbols; ++s) {
  ------------------
  |  Branch (360:21): [True: 10.8k, False: 145]
  ------------------
  361|  10.8k|            huffWeight[s] += (BYTE)((huffWeight[s] == 0) ? 0 : scale);
  ------------------
  |  Branch (361:37): [True: 5.16k, False: 5.70k]
  ------------------
  362|  10.8k|        }
  363|       |        /* Update rankVal to reflect the new weights.
  364|       |         * All weights except 0 get moved to weight + scale.
  365|       |         * Weights [1, scale] are empty.
  366|       |         */
  367|    946|        for (s = targetTableLog; s > scale; --s) {
  ------------------
  |  Branch (367:34): [True: 801, False: 145]
  ------------------
  368|    801|            rankVal[s] = rankVal[s - scale];
  369|    801|        }
  370|    939|        for (s = scale; s > 0; --s) {
  ------------------
  |  Branch (370:25): [True: 794, False: 145]
  ------------------
  371|    794|            rankVal[s] = 0;
  372|    794|        }
  373|    145|    }
  374|    196|    return targetTableLog;
  375|    256|}
huf_decompress.c:HUF_DEltX1_set4:
  335|  7.40k|static U64 HUF_DEltX1_set4(BYTE symbol, BYTE nbBits) {
  336|  7.40k|    U64 D4;
  337|  7.40k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (337:9): [True: 7.40k, False: 0]
  ------------------
  338|  7.40k|        D4 = (U64)((symbol << 8) + nbBits);
  339|  7.40k|    } else {
  340|      0|        D4 = (U64)(symbol + (nbBits << 8));
  341|      0|    }
  342|  7.40k|    assert(D4 < (1U << 16));
  ------------------
  |  |   70|  7.40k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  343|  7.40k|    D4 *= 0x0001000100010001ULL;
  344|  7.40k|    return D4;
  345|  7.40k|}
huf_decompress.c:HUF_fillDTableX2:
 1128|    325|{
 1129|    325|    U32* const rankVal = rankValOrigin[0];
 1130|    325|    const int scaleLog = nbBitsBaseline - targetLog;   /* note : targetLog >= srcLog, hence scaleLog <= 1 */
 1131|    325|    const U32 minBits  = nbBitsBaseline - maxWeight;
 1132|    325|    int w;
 1133|    325|    int const wEnd = (int)maxWeight + 1;
 1134|       |
 1135|       |    /* Fill DTable in order of weight. */
 1136|  3.09k|    for (w = 1; w < wEnd; ++w) {
  ------------------
  |  Branch (1136:17): [True: 2.77k, False: 325]
  ------------------
 1137|  2.77k|        int const begin = (int)rankStart[w];
 1138|  2.77k|        int const end = (int)rankStart[w+1];
 1139|  2.77k|        U32 const nbBits = nbBitsBaseline - w;
 1140|       |
 1141|  2.77k|        if (targetLog-nbBits >= minBits) {
  ------------------
  |  Branch (1141:13): [True: 2.49k, False: 281]
  ------------------
 1142|       |            /* Enough room for a second symbol. */
 1143|  2.49k|            int start = rankVal[w];
 1144|  2.49k|            U32 const length = 1U << ((targetLog - nbBits) & 0x1F /* quiet static-analyzer */);
 1145|  2.49k|            int minWeight = nbBits + scaleLog;
 1146|  2.49k|            int s;
 1147|  2.49k|            if (minWeight < 1) minWeight = 1;
  ------------------
  |  Branch (1147:17): [True: 230, False: 2.26k]
  ------------------
 1148|       |            /* Fill the DTable for every symbol of weight w.
 1149|       |             * These symbols get at least 1 second symbol.
 1150|       |             */
 1151|  16.5k|            for (s = begin; s != end; ++s) {
  ------------------
  |  Branch (1151:29): [True: 14.0k, False: 2.49k]
  ------------------
 1152|  14.0k|                HUF_fillDTableX2Level2(
 1153|  14.0k|                    DTable + start, targetLog, nbBits,
 1154|  14.0k|                    rankValOrigin[nbBits], minWeight, wEnd,
 1155|  14.0k|                    sortedList, rankStart,
 1156|  14.0k|                    nbBitsBaseline, sortedList[s].symbol);
 1157|  14.0k|                start += length;
 1158|  14.0k|            }
 1159|  2.49k|        } else {
 1160|       |            /* Only a single symbol. */
 1161|    281|            HUF_fillDTableX2ForWeight(
 1162|    281|                DTable + rankVal[w],
 1163|    281|                sortedList + begin, sortedList + end,
 1164|    281|                nbBits, targetLog,
 1165|    281|                /* baseSeq */ 0, /* level */ 1);
 1166|    281|        }
 1167|  2.77k|    }
 1168|    325|}
huf_decompress.c:HUF_fillDTableX2Level2:
 1073|  14.0k|{
 1074|       |    /* Fill skipped values (all positions up to rankVal[minWeight]).
 1075|       |     * These are positions only get a single symbol because the combined weight
 1076|       |     * is too large.
 1077|       |     */
 1078|  14.0k|    if (minWeight>1) {
  ------------------
  |  Branch (1078:9): [True: 13.4k, False: 557]
  ------------------
 1079|  13.4k|        U32 const length = 1U << ((targetLog - consumedBits) & 0x1F /* quiet static-analyzer */);
 1080|  13.4k|        U64 const DEltX2 = HUF_buildDEltX2U64(baseSeq, consumedBits, /* baseSeq */ 0, /* level */ 1);
 1081|  13.4k|        int const skipSize = rankVal[minWeight];
 1082|  13.4k|        assert(length > 1);
  ------------------
  |  |   70|  13.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1083|  13.4k|        assert((U32)skipSize < length);
  ------------------
  |  |   70|  13.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1084|  13.4k|        switch (length) {
 1085|  5.24k|        case 2:
  ------------------
  |  Branch (1085:9): [True: 5.24k, False: 8.23k]
  ------------------
 1086|  5.24k|            assert(skipSize == 1);
  ------------------
  |  |   70|  5.24k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1087|  5.24k|            ZSTD_memcpy(DTable, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  5.24k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1088|  5.24k|            break;
 1089|    629|        case 4:
  ------------------
  |  Branch (1089:9): [True: 629, False: 12.8k]
  ------------------
 1090|    629|            assert(skipSize <= 4);
  ------------------
  |  |   70|    629|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1091|    629|            ZSTD_memcpy(DTable + 0, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|    629|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1092|    629|            ZSTD_memcpy(DTable + 2, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|    629|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1093|    629|            break;
 1094|  7.61k|        default:
  ------------------
  |  Branch (1094:9): [True: 7.61k, False: 5.87k]
  ------------------
 1095|  7.61k|            {
 1096|  7.61k|                int i;
 1097|  21.8k|                for (i = 0; i < skipSize; i += 8) {
  ------------------
  |  Branch (1097:29): [True: 14.2k, False: 7.61k]
  ------------------
 1098|  14.2k|                    ZSTD_memcpy(DTable + i + 0, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  14.2k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1099|  14.2k|                    ZSTD_memcpy(DTable + i + 2, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  14.2k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1100|  14.2k|                    ZSTD_memcpy(DTable + i + 4, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  14.2k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1101|  14.2k|                    ZSTD_memcpy(DTable + i + 6, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  14.2k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1102|  14.2k|                }
 1103|  7.61k|            }
 1104|  13.4k|        }
 1105|  13.4k|    }
 1106|       |
 1107|       |    /* Fill each of the second level symbols by weight. */
 1108|  14.0k|    {
 1109|  14.0k|        int w;
 1110|  52.7k|        for (w = minWeight; w < maxWeight1; ++w) {
  ------------------
  |  Branch (1110:29): [True: 38.7k, False: 14.0k]
  ------------------
 1111|  38.7k|            int const begin = rankStart[w];
 1112|  38.7k|            int const end = rankStart[w+1];
 1113|  38.7k|            U32 const nbBits = nbBitsBaseline - w;
 1114|  38.7k|            U32 const totalBits = nbBits + consumedBits;
 1115|  38.7k|            HUF_fillDTableX2ForWeight(
 1116|  38.7k|                DTable + rankVal[w],
 1117|  38.7k|                sortedSymbols + begin, sortedSymbols + end,
 1118|  38.7k|                totalBits, targetLog,
 1119|  38.7k|                baseSeq, /* level */ 2);
 1120|  38.7k|        }
 1121|  14.0k|    }
 1122|  14.0k|}
huf_decompress.c:HUF_buildDEltX2U64:
  993|  48.9k|{
  994|  48.9k|    U32 DElt = HUF_buildDEltX2U32(symbol, nbBits, baseSeq, level);
  995|  48.9k|    return (U64)DElt + ((U64)DElt << 32);
  996|  48.9k|}
huf_decompress.c:HUF_buildDEltX2U32:
  962|   107k|{
  963|   107k|    U32 seq;
  964|   107k|    DEBUG_STATIC_ASSERT(offsetof(HUF_DEltX2, sequence) == 0);
  ------------------
  |  |   39|   107k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  965|   107k|    DEBUG_STATIC_ASSERT(offsetof(HUF_DEltX2, nbBits) == 2);
  ------------------
  |  |   39|   107k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  966|   107k|    DEBUG_STATIC_ASSERT(offsetof(HUF_DEltX2, length) == 3);
  ------------------
  |  |   39|   107k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  967|   107k|    DEBUG_STATIC_ASSERT(sizeof(HUF_DEltX2) == sizeof(U32));
  ------------------
  |  |   39|   107k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  968|   107k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (968:9): [True: 107k, False: 0]
  ------------------
  969|   107k|        seq = level == 1 ? symbol : (baseSeq + (symbol << 8));
  ------------------
  |  Branch (969:15): [True: 33.0k, False: 74.0k]
  ------------------
  970|   107k|        return seq + (nbBits << 16) + ((U32)level << 24);
  971|   107k|    } else {
  972|      0|        seq = level == 1 ? (symbol << 8) : ((baseSeq << 8) + symbol);
  ------------------
  |  Branch (972:15): [True: 0, False: 0]
  ------------------
  973|      0|        return (seq << 16) + (nbBits << 8) + (U32)level;
  974|      0|    }
  975|   107k|}
huf_decompress.c:HUF_fillDTableX2ForWeight:
 1015|  38.9k|{
 1016|  38.9k|    U32 const length = 1U << ((tableLog - nbBits) & 0x1F /* quiet static-analyzer */);
 1017|  38.9k|    const sortedSymbol_t* ptr;
 1018|  38.9k|    assert(level >= 1 && level <= 2);
  ------------------
  |  |   70|  38.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1019|  38.9k|    switch (length) {
 1020|  13.7k|    case 1:
  ------------------
  |  Branch (1020:5): [True: 13.7k, False: 25.2k]
  ------------------
 1021|  56.3k|        for (ptr = begin; ptr != end; ++ptr) {
  ------------------
  |  Branch (1021:27): [True: 42.5k, False: 13.7k]
  ------------------
 1022|  42.5k|            HUF_DEltX2 const DElt = HUF_buildDEltX2(ptr->symbol, nbBits, baseSeq, level);
 1023|  42.5k|            *DTableRank++ = DElt;
 1024|  42.5k|        }
 1025|  13.7k|        break;
 1026|  7.70k|    case 2:
  ------------------
  |  Branch (1026:5): [True: 7.70k, False: 31.2k]
  ------------------
 1027|  23.2k|        for (ptr = begin; ptr != end; ++ptr) {
  ------------------
  |  Branch (1027:27): [True: 15.5k, False: 7.70k]
  ------------------
 1028|  15.5k|            HUF_DEltX2 const DElt = HUF_buildDEltX2(ptr->symbol, nbBits, baseSeq, level);
 1029|  15.5k|            DTableRank[0] = DElt;
 1030|  15.5k|            DTableRank[1] = DElt;
 1031|  15.5k|            DTableRank += 2;
 1032|  15.5k|        }
 1033|  7.70k|        break;
 1034|  6.68k|    case 4:
  ------------------
  |  Branch (1034:5): [True: 6.68k, False: 32.2k]
  ------------------
 1035|  23.9k|        for (ptr = begin; ptr != end; ++ptr) {
  ------------------
  |  Branch (1035:27): [True: 17.2k, False: 6.68k]
  ------------------
 1036|  17.2k|            U64 const DEltX2 = HUF_buildDEltX2U64(ptr->symbol, nbBits, baseSeq, level);
 1037|  17.2k|            ZSTD_memcpy(DTableRank + 0, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  17.2k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1038|  17.2k|            ZSTD_memcpy(DTableRank + 2, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  17.2k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1039|  17.2k|            DTableRank += 4;
 1040|  17.2k|        }
 1041|  6.68k|        break;
 1042|  5.21k|    case 8:
  ------------------
  |  Branch (1042:5): [True: 5.21k, False: 33.7k]
  ------------------
 1043|  15.6k|        for (ptr = begin; ptr != end; ++ptr) {
  ------------------
  |  Branch (1043:27): [True: 10.4k, False: 5.21k]
  ------------------
 1044|  10.4k|            U64 const DEltX2 = HUF_buildDEltX2U64(ptr->symbol, nbBits, baseSeq, level);
 1045|  10.4k|            ZSTD_memcpy(DTableRank + 0, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  10.4k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1046|  10.4k|            ZSTD_memcpy(DTableRank + 2, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  10.4k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1047|  10.4k|            ZSTD_memcpy(DTableRank + 4, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  10.4k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1048|  10.4k|            ZSTD_memcpy(DTableRank + 6, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  10.4k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1049|  10.4k|            DTableRank += 8;
 1050|  10.4k|        }
 1051|  5.21k|        break;
 1052|  5.59k|    default:
  ------------------
  |  Branch (1052:5): [True: 5.59k, False: 33.3k]
  ------------------
 1053|  13.3k|        for (ptr = begin; ptr != end; ++ptr) {
  ------------------
  |  Branch (1053:27): [True: 7.74k, False: 5.59k]
  ------------------
 1054|  7.74k|            U64 const DEltX2 = HUF_buildDEltX2U64(ptr->symbol, nbBits, baseSeq, level);
 1055|  7.74k|            HUF_DEltX2* const DTableRankEnd = DTableRank + length;
 1056|  73.0k|            for (; DTableRank != DTableRankEnd; DTableRank += 8) {
  ------------------
  |  Branch (1056:20): [True: 65.3k, False: 7.74k]
  ------------------
 1057|  65.3k|                ZSTD_memcpy(DTableRank + 0, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  65.3k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1058|  65.3k|                ZSTD_memcpy(DTableRank + 2, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  65.3k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1059|  65.3k|                ZSTD_memcpy(DTableRank + 4, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  65.3k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1060|  65.3k|                ZSTD_memcpy(DTableRank + 6, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  65.3k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1061|  65.3k|            }
 1062|  7.74k|        }
 1063|  5.59k|        break;
 1064|  38.9k|    }
 1065|  38.9k|}
huf_decompress.c:HUF_buildDEltX2:
  981|  58.0k|{
  982|  58.0k|    HUF_DEltX2 DElt;
  983|  58.0k|    U32 const val = HUF_buildDEltX2U32(symbol, nbBits, baseSeq, level);
  984|  58.0k|    DEBUG_STATIC_ASSERT(sizeof(DElt) == sizeof(val));
  ------------------
  |  |   39|  58.0k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  985|  58.0k|    ZSTD_memcpy(&DElt, &val, sizeof(val));
  ------------------
  |  |   44|  58.0k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  986|  58.0k|    return DElt;
  987|  58.0k|}
huf_decompress.c:HUF_decodeStreamX2:
 1310|    666|{
 1311|    666|    BYTE* const pStart = p;
 1312|       |
 1313|       |    /* up to 8 symbols at a time */
 1314|    666|    if ((size_t)(pEnd - p) >= sizeof(bitDPtr->bitContainer)) {
  ------------------
  |  Branch (1314:9): [True: 624, False: 42]
  ------------------
 1315|    624|        if (dtLog <= 11 && MEM_64bits()) {
  ------------------
  |  Branch (1315:13): [True: 362, False: 262]
  |  Branch (1315:28): [True: 362, False: 0]
  ------------------
 1316|       |            /* up to 10 symbols at a time */
 1317|  13.7k|            while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-9)) {
  ------------------
  |  Branch (1317:20): [True: 13.4k, False: 362]
  ------------------
 1318|  13.4k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1293|  13.4k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 13.4k]
  |  |  ------------------
  ------------------
 1319|  13.4k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1293|  13.4k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 13.4k]
  |  |  ------------------
  ------------------
 1320|  13.4k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1293|  13.4k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 13.4k]
  |  |  ------------------
  ------------------
 1321|  13.4k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1293|  13.4k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 13.4k]
  |  |  ------------------
  ------------------
 1322|  13.4k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1293|  13.4k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 13.4k]
  |  |  ------------------
  ------------------
 1323|  13.4k|            }
 1324|    362|        } else {
 1325|       |            /* up to 8 symbols at a time */
 1326|  5.78k|            while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-(sizeof(bitDPtr->bitContainer)-1))) {
  ------------------
  |  Branch (1326:20): [True: 5.52k, False: 262]
  ------------------
 1327|  5.52k|                HUF_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 1302|  5.52k|    do {                                                           \
  |  | 1303|  5.52k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 5.52k, False: 0]
  |  |  ------------------
  |  | 1304|  5.52k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  5.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 5.52k]
  |  |  ------------------
  ------------------
 1328|  5.52k|                HUF_DECODE_SYMBOLX2_1(p, bitDPtr);
  ------------------
  |  | 1296|  5.52k|    do {                                                           \
  |  | 1297|  5.52k|        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 (1297:13): [True: 5.52k, False: 0]
  |  |  |  Branch (1297:29): [True: 0, Folded]
  |  |  ------------------
  |  | 1298|  5.52k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1299|  5.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1299:14): [Folded, False: 5.52k]
  |  |  ------------------
  ------------------
 1329|  5.52k|                HUF_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 1302|  5.52k|    do {                                                           \
  |  | 1303|  5.52k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 5.52k, False: 0]
  |  |  ------------------
  |  | 1304|  5.52k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  5.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 5.52k]
  |  |  ------------------
  ------------------
 1330|  5.52k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1293|  5.52k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 5.52k]
  |  |  ------------------
  ------------------
 1331|  5.52k|            }
 1332|    262|        }
 1333|    624|    } else {
 1334|     42|        BIT_reloadDStream(bitDPtr);
 1335|     42|    }
 1336|       |
 1337|       |    /* closer to end : up to 2 symbols at a time */
 1338|    666|    if ((size_t)(pEnd - p) >= 2) {
  ------------------
  |  Branch (1338:9): [True: 628, False: 38]
  ------------------
 1339|  1.27k|        while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p <= pEnd-2))
  ------------------
  |  Branch (1339:16): [True: 642, False: 628]
  ------------------
 1340|    642|            HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1293|    642|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 642]
  |  |  ------------------
  ------------------
 1341|       |
 1342|   148k|        while (p <= pEnd-2)
  ------------------
  |  Branch (1342:16): [True: 147k, False: 628]
  ------------------
 1343|   147k|            HUF_DECODE_SYMBOLX2_0(p, bitDPtr);   /* no need to reload : reached the end of DStream */
  ------------------
  |  | 1293|   147k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 147k]
  |  |  ------------------
  ------------------
 1344|    628|    }
 1345|       |
 1346|    666|    if (p < pEnd)
  ------------------
  |  Branch (1346:9): [True: 424, False: 242]
  ------------------
 1347|    424|        p += HUF_decodeLastSymbolX2(p, bitDPtr, dt, dtLog);
 1348|       |
 1349|    666|    return p-pStart;
 1350|    666|}
huf_decompress.c:HUF_decodeSymbolX2:
 1267|   287k|{
 1268|   287k|    size_t const val = BIT_lookBitsFast(DStream, dtLog);   /* note : dtLog >= 1 */
 1269|   287k|    ZSTD_memcpy(op, &dt[val].sequence, 2);
  ------------------
  |  |   44|   287k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1270|   287k|    BIT_skipBits(DStream, dt[val].nbBits);
 1271|   287k|    return dt[val].length;
 1272|   287k|}
huf_decompress.c:HUF_decodeLastSymbolX2:
 1276|    424|{
 1277|    424|    size_t const val = BIT_lookBitsFast(DStream, dtLog);   /* note : dtLog >= 1 */
 1278|    424|    ZSTD_memcpy(op, &dt[val].sequence, 1);
  ------------------
  |  |   44|    424|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1279|    424|    if (dt[val].length==1) {
  ------------------
  |  Branch (1279:9): [True: 195, False: 229]
  ------------------
 1280|    195|        BIT_skipBits(DStream, dt[val].nbBits);
 1281|    229|    } else {
 1282|    229|        if (DStream->bitsConsumed < (sizeof(DStream->bitContainer)*8)) {
  ------------------
  |  Branch (1282:13): [True: 131, False: 98]
  ------------------
 1283|    131|            BIT_skipBits(DStream, dt[val].nbBits);
 1284|    131|            if (DStream->bitsConsumed > (sizeof(DStream->bitContainer)*8))
  ------------------
  |  Branch (1284:17): [True: 4, False: 127]
  ------------------
 1285|       |                /* ugly hack; works only because it's the last symbol. Note : can't easily extract nbBits from just this symbol */
 1286|      4|                DStream->bitsConsumed = (sizeof(DStream->bitContainer)*8);
 1287|    131|        }
 1288|    229|    }
 1289|    424|    return 1;
 1290|    424|}
huf_decompress.c:HUF_decompress1X1_usingDTable_internal:
  118|     35|    {                                                                       \
  119|     35|        if (flags & HUF_flags_bmi2) {                                       \
  ------------------
  |  Branch (119:13): [True: 35, False: 0]
  ------------------
  120|     35|            return fn##_bmi2(dst, dstSize, cSrc, cSrcSize, DTable);         \
  121|     35|        }                                                                   \
  122|     35|        return fn##_default(dst, dstSize, cSrc, cSrcSize, DTable);          \
  123|     35|    }
huf_decompress.c:HUF_decompress1X1_usingDTable_internal_bmi2:
  112|     35|    {                                                                       \
  113|     35|        return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable);             \
  114|     35|    }                                                                       \
huf_decompress.c:HUF_decompress1X1_usingDTable_internal_body:
  579|     35|{
  580|     35|    BYTE* op = (BYTE*)dst;
  581|     35|    BYTE* const oend = ZSTD_maybeNullPtrAdd(op, dstSize);
  582|     35|    const void* dtPtr = DTable + 1;
  583|     35|    const HUF_DEltX1* const dt = (const HUF_DEltX1*)dtPtr;
  584|     35|    BIT_DStream_t bitD;
  585|     35|    DTableDesc const dtd = HUF_getDTableDesc(DTable);
  586|     35|    U32 const dtLog = dtd.tableLog;
  587|       |
  588|     35|    CHECK_F( BIT_initDStream(&bitD, cSrc, cSrcSize) );
  ------------------
  |  |   63|     35|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|     35|    size_t const e = f;     \
  |  |  |  |   59|     35|    do {                    \
  |  |  |  |   60|     35|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 2, False: 33]
  |  |  |  |  ------------------
  |  |  |  |   61|     35|            return e;       \
  |  |  |  |   62|     35|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 33]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 33]
  |  |  ------------------
  ------------------
  589|       |
  590|     33|    HUF_decodeStreamX1(op, &bitD, oend, dt, dtLog);
  591|       |
  592|     33|    if (!BIT_endOfDStream(&bitD)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     32|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     32|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     32|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (592:9): [True: 32, False: 1]
  ------------------
  593|       |
  594|      1|    return dstSize;
  595|     33|}
huf_decompress.c:HUF_decodeStreamX1:
  547|    505|{
  548|    505|    BYTE* const pStart = p;
  549|       |
  550|       |    /* up to 4 symbols at a time */
  551|    505|    if ((pEnd - p) > 3) {
  ------------------
  |  Branch (551:9): [True: 425, False: 80]
  ------------------
  552|  28.4k|        while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-3)) {
  ------------------
  |  Branch (552:16): [True: 28.0k, False: 425]
  ------------------
  553|  28.0k|            HUF_DECODE_SYMBOLX1_2(p, bitDPtr);
  ------------------
  |  |  540|  28.0k|    do {                                            \
  |  |  541|  28.0k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 28.0k, False: 0]
  |  |  ------------------
  |  |  542|  28.0k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  28.0k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 28.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  28.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 28.0k]
  |  |  ------------------
  ------------------
  554|  28.0k|            HUF_DECODE_SYMBOLX1_1(p, bitDPtr);
  ------------------
  |  |  534|  28.0k|    do {                                            \
  |  |  535|  28.0k|        if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |   37|      0|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  |  |  ------------------
  |  |  |  Branch (535:13): [True: 28.0k, False: 0]
  |  |  |  Branch (535:29): [True: 0, Folded]
  |  |  ------------------
  |  |  536|  28.0k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  28.0k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 28.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  537|  28.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (537:14): [Folded, False: 28.0k]
  |  |  ------------------
  ------------------
  555|  28.0k|            HUF_DECODE_SYMBOLX1_2(p, bitDPtr);
  ------------------
  |  |  540|  28.0k|    do {                                            \
  |  |  541|  28.0k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 28.0k, False: 0]
  |  |  ------------------
  |  |  542|  28.0k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  28.0k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 28.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  28.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 28.0k]
  |  |  ------------------
  ------------------
  556|  28.0k|            HUF_DECODE_SYMBOLX1_0(p, bitDPtr);
  ------------------
  |  |  531|  28.0k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (531:71): [Folded, False: 28.0k]
  |  |  ------------------
  ------------------
  557|  28.0k|        }
  558|    425|    } else {
  559|     80|        BIT_reloadDStream(bitDPtr);
  560|     80|    }
  561|       |
  562|       |    /* [0-3] symbols remaining */
  563|    505|    if (MEM_32bits())
  ------------------
  |  Branch (563:9): [True: 0, False: 505]
  ------------------
  564|      0|        while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd))
  ------------------
  |  Branch (564:16): [True: 0, False: 0]
  ------------------
  565|      0|            HUF_DECODE_SYMBOLX1_0(p, bitDPtr);
  ------------------
  |  |  531|      0|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (531:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  566|       |
  567|       |    /* no more data to retrieve from bitstream, no need to reload */
  568|   536k|    while (p < pEnd)
  ------------------
  |  Branch (568:12): [True: 535k, False: 505]
  ------------------
  569|   535k|        HUF_DECODE_SYMBOLX1_0(p, bitDPtr);
  ------------------
  |  |  531|   535k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (531:71): [Folded, False: 535k]
  |  |  ------------------
  ------------------
  570|       |
  571|    505|    return (size_t)(pEnd-pStart);
  572|    505|}
huf_decompress.c:HUF_decodeSymbolX1:
  523|   696k|{
  524|   696k|    size_t const val = BIT_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */
  525|   696k|    BYTE const c = dt[val].byte;
  526|   696k|    BIT_skipBits(Dstream, dt[val].nbBits);
  527|   696k|    return c;
  528|   696k|}
huf_decompress.c:HUF_decompress4X2_usingDTable_internal:
 1721|    209|{
 1722|    209|    HUF_DecompressUsingDTableFn fallbackFn = HUF_decompress4X2_usingDTable_internal_default;
 1723|    209|    HUF_DecompressFastLoopFn loopFn = HUF_decompress4X2_usingDTable_internal_fast_c_loop;
 1724|       |
 1725|    209|#if DYNAMIC_BMI2
 1726|    209|    if (flags & HUF_flags_bmi2) {
  ------------------
  |  Branch (1726:9): [True: 209, False: 0]
  ------------------
 1727|    209|        fallbackFn = HUF_decompress4X2_usingDTable_internal_bmi2;
 1728|    209|# if ZSTD_ENABLE_ASM_X86_64_BMI2
 1729|    209|        if (!(flags & HUF_flags_disableAsm)) {
  ------------------
  |  Branch (1729:13): [True: 209, False: 0]
  ------------------
 1730|    209|            loopFn = HUF_decompress4X2_usingDTable_internal_fast_asm_loop;
 1731|    209|        }
 1732|    209|# endif
 1733|    209|    } else {
 1734|      0|        return fallbackFn(dst, dstSize, cSrc, cSrcSize, DTable);
 1735|      0|    }
 1736|    209|#endif
 1737|       |
 1738|       |#if ZSTD_ENABLE_ASM_X86_64_BMI2 && defined(__BMI2__)
 1739|       |    if (!(flags & HUF_flags_disableAsm)) {
 1740|       |        loopFn = HUF_decompress4X2_usingDTable_internal_fast_asm_loop;
 1741|       |    }
 1742|       |#endif
 1743|       |
 1744|    209|    if (HUF_ENABLE_FAST_DECODE && !(flags & HUF_flags_disableFast)) {
  ------------------
  |  |   40|    418|# define HUF_ENABLE_FAST_DECODE 1
  |  |  ------------------
  |  |  |  Branch (40:33): [True: 209, Folded]
  |  |  ------------------
  ------------------
  |  Branch (1744:35): [True: 209, False: 0]
  ------------------
 1745|    209|        size_t const ret = HUF_decompress4X2_usingDTable_internal_fast(dst, dstSize, cSrc, cSrcSize, DTable, loopFn);
 1746|    209|        if (ret != 0)
  ------------------
  |  Branch (1746:13): [True: 64, False: 145]
  ------------------
 1747|     64|            return ret;
 1748|    209|    }
 1749|    145|    return fallbackFn(dst, dstSize, cSrc, cSrcSize, DTable);
 1750|    209|}
huf_decompress.c:HUF_decompress4X2_usingDTable_internal_body:
 1388|    145|{
 1389|    145|    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 (1389:9): [True: 0, False: 145]
  ------------------
 1390|    145|    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 (1390:9): [True: 0, False: 145]
  ------------------
 1391|       |
 1392|    145|    {   const BYTE* const istart = (const BYTE*) cSrc;
 1393|    145|        BYTE* const ostart = (BYTE*) dst;
 1394|    145|        BYTE* const oend = ostart + dstSize;
 1395|    145|        BYTE* const olimit = oend - (sizeof(size_t)-1);
 1396|    145|        const void* const dtPtr = DTable+1;
 1397|    145|        const HUF_DEltX2* const dt = (const HUF_DEltX2*)dtPtr;
 1398|       |
 1399|       |        /* Init */
 1400|    145|        BIT_DStream_t bitD1;
 1401|    145|        BIT_DStream_t bitD2;
 1402|    145|        BIT_DStream_t bitD3;
 1403|    145|        BIT_DStream_t bitD4;
 1404|    145|        size_t const length1 = MEM_readLE16(istart);
 1405|    145|        size_t const length2 = MEM_readLE16(istart+2);
 1406|    145|        size_t const length3 = MEM_readLE16(istart+4);
 1407|    145|        size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6);
 1408|    145|        const BYTE* const istart1 = istart + 6;  /* jumpTable */
 1409|    145|        const BYTE* const istart2 = istart1 + length1;
 1410|    145|        const BYTE* const istart3 = istart2 + length2;
 1411|    145|        const BYTE* const istart4 = istart3 + length3;
 1412|    145|        size_t const segmentSize = (dstSize+3) / 4;
 1413|    145|        BYTE* const opStart2 = ostart + segmentSize;
 1414|    145|        BYTE* const opStart3 = opStart2 + segmentSize;
 1415|    145|        BYTE* const opStart4 = opStart3 + segmentSize;
 1416|    145|        BYTE* op1 = ostart;
 1417|    145|        BYTE* op2 = opStart2;
 1418|    145|        BYTE* op3 = opStart3;
 1419|    145|        BYTE* op4 = opStart4;
 1420|    145|        U32 endSignal = 1;
 1421|    145|        DTableDesc const dtd = HUF_getDTableDesc(DTable);
 1422|    145|        U32 const dtLog = dtd.tableLog;
 1423|       |
 1424|    145|        if (length4 > cSrcSize) return ERROR(corruption_detected);  /* overflow */
  ------------------
  |  |   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 (1424:13): [True: 3, False: 142]
  ------------------
 1425|    142|        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 (1425:13): [True: 0, False: 142]
  ------------------
 1426|    142|        assert(dstSize >= 6 /* validated above */);
  ------------------
  |  |   70|    142|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1427|    142|        CHECK_F( BIT_initDStream(&bitD1, istart1, length1) );
  ------------------
  |  |   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: 5, False: 137]
  |  |  |  |  ------------------
  |  |  |  |   61|    142|            return e;       \
  |  |  |  |   62|    142|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 137]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 137]
  |  |  ------------------
  ------------------
 1428|    137|        CHECK_F( BIT_initDStream(&bitD2, istart2, length2) );
  ------------------
  |  |   63|    137|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|    137|    size_t const e = f;     \
  |  |  |  |   59|    137|    do {                    \
  |  |  |  |   60|    137|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 4, False: 133]
  |  |  |  |  ------------------
  |  |  |  |   61|    137|            return e;       \
  |  |  |  |   62|    137|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 133]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 133]
  |  |  ------------------
  ------------------
 1429|    133|        CHECK_F( BIT_initDStream(&bitD3, istart3, length3) );
  ------------------
  |  |   63|    133|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|    133|    size_t const e = f;     \
  |  |  |  |   59|    133|    do {                    \
  |  |  |  |   60|    133|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 4, False: 129]
  |  |  |  |  ------------------
  |  |  |  |   61|    133|            return e;       \
  |  |  |  |   62|    133|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 129]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 129]
  |  |  ------------------
  ------------------
 1430|    129|        CHECK_F( BIT_initDStream(&bitD4, istart4, length4) );
  ------------------
  |  |   63|    129|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|    129|    size_t const e = f;     \
  |  |  |  |   59|    129|    do {                    \
  |  |  |  |   60|    129|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 2, False: 127]
  |  |  |  |  ------------------
  |  |  |  |   61|    129|            return e;       \
  |  |  |  |   62|    129|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 127]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 127]
  |  |  ------------------
  ------------------
 1431|       |
 1432|       |        /* 16-32 symbols per loop (4-8 symbols per stream) */
 1433|    127|        if ((size_t)(oend - op4) >= sizeof(size_t)) {
  ------------------
  |  Branch (1433:13): [True: 127, False: 0]
  ------------------
 1434|  3.26k|            for ( ; (endSignal) & (op4 < olimit); ) {
  ------------------
  |  Branch (1434:21): [True: 3.14k, False: 127]
  ------------------
 1435|  3.14k|#if defined(__clang__) && (defined(__x86_64__) || defined(__i386__))
 1436|  3.14k|                HUF_DECODE_SYMBOLX2_2(op1, &bitD1);
  ------------------
  |  | 1302|  3.14k|    do {                                                           \
  |  | 1303|  3.14k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 3.14k, False: 0]
  |  |  ------------------
  |  | 1304|  3.14k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  3.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1437|  3.14k|                HUF_DECODE_SYMBOLX2_1(op1, &bitD1);
  ------------------
  |  | 1296|  3.14k|    do {                                                           \
  |  | 1297|  3.14k|        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 (1297:13): [True: 3.14k, False: 0]
  |  |  |  Branch (1297:29): [True: 0, Folded]
  |  |  ------------------
  |  | 1298|  3.14k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1299|  3.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1299:14): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1438|  3.14k|                HUF_DECODE_SYMBOLX2_2(op1, &bitD1);
  ------------------
  |  | 1302|  3.14k|    do {                                                           \
  |  | 1303|  3.14k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 3.14k, False: 0]
  |  |  ------------------
  |  | 1304|  3.14k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  3.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1439|  3.14k|                HUF_DECODE_SYMBOLX2_0(op1, &bitD1);
  ------------------
  |  | 1293|  3.14k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1440|  3.14k|                HUF_DECODE_SYMBOLX2_2(op2, &bitD2);
  ------------------
  |  | 1302|  3.14k|    do {                                                           \
  |  | 1303|  3.14k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 3.14k, False: 0]
  |  |  ------------------
  |  | 1304|  3.14k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  3.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1441|  3.14k|                HUF_DECODE_SYMBOLX2_1(op2, &bitD2);
  ------------------
  |  | 1296|  3.14k|    do {                                                           \
  |  | 1297|  3.14k|        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 (1297:13): [True: 3.14k, False: 0]
  |  |  |  Branch (1297:29): [True: 0, Folded]
  |  |  ------------------
  |  | 1298|  3.14k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1299|  3.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1299:14): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1442|  3.14k|                HUF_DECODE_SYMBOLX2_2(op2, &bitD2);
  ------------------
  |  | 1302|  3.14k|    do {                                                           \
  |  | 1303|  3.14k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 3.14k, False: 0]
  |  |  ------------------
  |  | 1304|  3.14k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  3.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1443|  3.14k|                HUF_DECODE_SYMBOLX2_0(op2, &bitD2);
  ------------------
  |  | 1293|  3.14k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1444|  3.14k|                endSignal &= BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished;
 1445|  3.14k|                endSignal &= BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished;
 1446|  3.14k|                HUF_DECODE_SYMBOLX2_2(op3, &bitD3);
  ------------------
  |  | 1302|  3.14k|    do {                                                           \
  |  | 1303|  3.14k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 3.14k, False: 0]
  |  |  ------------------
  |  | 1304|  3.14k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  3.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1447|  3.14k|                HUF_DECODE_SYMBOLX2_1(op3, &bitD3);
  ------------------
  |  | 1296|  3.14k|    do {                                                           \
  |  | 1297|  3.14k|        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 (1297:13): [True: 3.14k, False: 0]
  |  |  |  Branch (1297:29): [True: 0, Folded]
  |  |  ------------------
  |  | 1298|  3.14k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1299|  3.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1299:14): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1448|  3.14k|                HUF_DECODE_SYMBOLX2_2(op3, &bitD3);
  ------------------
  |  | 1302|  3.14k|    do {                                                           \
  |  | 1303|  3.14k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 3.14k, False: 0]
  |  |  ------------------
  |  | 1304|  3.14k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  3.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1449|  3.14k|                HUF_DECODE_SYMBOLX2_0(op3, &bitD3);
  ------------------
  |  | 1293|  3.14k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1450|  3.14k|                HUF_DECODE_SYMBOLX2_2(op4, &bitD4);
  ------------------
  |  | 1302|  3.14k|    do {                                                           \
  |  | 1303|  3.14k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 3.14k, False: 0]
  |  |  ------------------
  |  | 1304|  3.14k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  3.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1451|  3.14k|                HUF_DECODE_SYMBOLX2_1(op4, &bitD4);
  ------------------
  |  | 1296|  3.14k|    do {                                                           \
  |  | 1297|  3.14k|        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 (1297:13): [True: 3.14k, False: 0]
  |  |  |  Branch (1297:29): [True: 0, Folded]
  |  |  ------------------
  |  | 1298|  3.14k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1299|  3.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1299:14): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1452|  3.14k|                HUF_DECODE_SYMBOLX2_2(op4, &bitD4);
  ------------------
  |  | 1302|  3.14k|    do {                                                           \
  |  | 1303|  3.14k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 3.14k, False: 0]
  |  |  ------------------
  |  | 1304|  3.14k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  3.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1453|  3.14k|                HUF_DECODE_SYMBOLX2_0(op4, &bitD4);
  ------------------
  |  | 1293|  3.14k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1454|  3.14k|                endSignal &= BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished;
 1455|  3.14k|                endSignal &= BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished;
 1456|       |#else
 1457|       |                HUF_DECODE_SYMBOLX2_2(op1, &bitD1);
 1458|       |                HUF_DECODE_SYMBOLX2_2(op2, &bitD2);
 1459|       |                HUF_DECODE_SYMBOLX2_2(op3, &bitD3);
 1460|       |                HUF_DECODE_SYMBOLX2_2(op4, &bitD4);
 1461|       |                HUF_DECODE_SYMBOLX2_1(op1, &bitD1);
 1462|       |                HUF_DECODE_SYMBOLX2_1(op2, &bitD2);
 1463|       |                HUF_DECODE_SYMBOLX2_1(op3, &bitD3);
 1464|       |                HUF_DECODE_SYMBOLX2_1(op4, &bitD4);
 1465|       |                HUF_DECODE_SYMBOLX2_2(op1, &bitD1);
 1466|       |                HUF_DECODE_SYMBOLX2_2(op2, &bitD2);
 1467|       |                HUF_DECODE_SYMBOLX2_2(op3, &bitD3);
 1468|       |                HUF_DECODE_SYMBOLX2_2(op4, &bitD4);
 1469|       |                HUF_DECODE_SYMBOLX2_0(op1, &bitD1);
 1470|       |                HUF_DECODE_SYMBOLX2_0(op2, &bitD2);
 1471|       |                HUF_DECODE_SYMBOLX2_0(op3, &bitD3);
 1472|       |                HUF_DECODE_SYMBOLX2_0(op4, &bitD4);
 1473|       |                endSignal = (U32)LIKELY((U32)
 1474|       |                            (BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished)
 1475|       |                        & (BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished)
 1476|       |                        & (BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished)
 1477|       |                        & (BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished));
 1478|       |#endif
 1479|  3.14k|            }
 1480|    127|        }
 1481|       |
 1482|       |        /* check corruption */
 1483|    127|        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 (1483:13): [True: 1, False: 126]
  ------------------
 1484|    126|        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 (1484:13): [True: 1, False: 125]
  ------------------
 1485|    125|        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 (1485:13): [True: 1, False: 124]
  ------------------
 1486|       |        /* note : op4 already verified within main loop */
 1487|       |
 1488|       |        /* finish bitStreams one by one */
 1489|    124|        HUF_decodeStreamX2(op1, &bitD1, opStart2, dt, dtLog);
 1490|    124|        HUF_decodeStreamX2(op2, &bitD2, opStart3, dt, dtLog);
 1491|    124|        HUF_decodeStreamX2(op3, &bitD3, opStart4, dt, dtLog);
 1492|    124|        HUF_decodeStreamX2(op4, &bitD4, oend,     dt, dtLog);
 1493|       |
 1494|       |        /* check */
 1495|    124|        { U32 const endCheck = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4);
 1496|    124|          if (!endCheck) return ERROR(corruption_detected); }
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1496:15): [True: 124, False: 0]
  ------------------
 1497|       |
 1498|       |        /* decoded size */
 1499|      0|        return dstSize;
 1500|    124|    }
 1501|    124|}
huf_decompress.c:HUF_decompress4X2_usingDTable_internal_bmi2:
 1506|    145|                    size_t cSrcSize, HUF_DTable const* DTable) {
 1507|    145|    return HUF_decompress4X2_usingDTable_internal_body(dst, dstSize, cSrc, cSrcSize, DTable);
 1508|    145|}
huf_decompress.c:HUF_decompress4X2_usingDTable_internal_fast:
 1671|    209|    HUF_DecompressFastLoopFn loopFn) {
 1672|    209|    void const* dt = DTable + 1;
 1673|    209|    const BYTE* const ilowest = (const BYTE*)cSrc;
 1674|    209|    BYTE* const oend = ZSTD_maybeNullPtrAdd((BYTE*)dst, dstSize);
 1675|    209|    HUF_DecompressFastArgs args;
 1676|    209|    {
 1677|    209|        size_t const ret = HUF_DecompressFastArgs_init(&args, dst, dstSize, cSrc, cSrcSize, DTable);
 1678|    209|        FORWARD_IF_ERROR(ret, "Failed to init asm args");
  ------------------
  |  |  146|    209|    do {                                                                           \
  |  |  147|    209|        size_t const err_code = (err);                                             \
  |  |  148|    209|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 11, False: 198]
  |  |  ------------------
  |  |  149|     11|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|     11|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|     11|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|     11|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|     11|    do {                                           \
  |  |  |  |   99|     11|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 11]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     11|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|     11|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|     11|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|     11|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|     11|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     11|            return err_code;                                                       \
  |  |  155|     11|        }                                                                          \
  |  |  156|    209|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 198]
  |  |  ------------------
  ------------------
 1679|    198|        if (ret == 0)
  ------------------
  |  Branch (1679:13): [True: 145, False: 53]
  ------------------
 1680|    145|            return 0;
 1681|    198|    }
 1682|       |
 1683|     53|    assert(args.ip[0] >= args.ilowest);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1684|     53|    loopFn(&args);
 1685|       |
 1686|       |    /* note : op4 already verified within main loop */
 1687|     53|    assert(args.ip[0] >= ilowest);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1688|     53|    assert(args.ip[1] >= ilowest);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1689|     53|    assert(args.ip[2] >= ilowest);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1690|     53|    assert(args.ip[3] >= ilowest);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1691|     53|    assert(args.op[3] <= oend);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1692|       |
 1693|     53|    assert(ilowest == args.ilowest);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1694|     53|    assert(ilowest + 6 == args.iend[0]);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1695|     53|    (void)ilowest;
 1696|       |
 1697|       |    /* finish bitStreams one by one */
 1698|     53|    {
 1699|     53|        size_t const segmentSize = (dstSize+3) / 4;
 1700|     53|        BYTE* segmentEnd = (BYTE*)dst;
 1701|     53|        int i;
 1702|    223|        for (i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1702:21): [True: 192, False: 31]
  ------------------
 1703|    192|            BIT_DStream_t bit;
 1704|    192|            if (segmentSize <= (size_t)(oend - segmentEnd))
  ------------------
  |  Branch (1704:17): [True: 163, False: 29]
  ------------------
 1705|    163|                segmentEnd += segmentSize;
 1706|     29|            else
 1707|     29|                segmentEnd = oend;
 1708|    192|            FORWARD_IF_ERROR(HUF_initRemainingDStream(&bit, &args, i, segmentEnd), "corruption");
  ------------------
  |  |  146|    192|    do {                                                                           \
  |  |  147|    192|        size_t const err_code = (err);                                             \
  |  |  148|    192|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 22, False: 170]
  |  |  ------------------
  |  |  149|     22|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|     22|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 22]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|     22|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|     22|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|     22|    do {                                           \
  |  |  |  |   99|     22|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 22]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     22|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 22]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|     22|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|     22|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 22]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|     22|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|     22|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 22]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     22|            return err_code;                                                       \
  |  |  155|     22|        }                                                                          \
  |  |  156|    192|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 170]
  |  |  ------------------
  ------------------
 1709|    170|            args.op[i] += HUF_decodeStreamX2(args.op[i], &bit, segmentEnd, (HUF_DEltX2 const*)dt, HUF_DECODER_FAST_TABLELOG);
  ------------------
  |  |   31|    170|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
 1710|    170|            if (args.op[i] != segmentEnd)
  ------------------
  |  Branch (1710:17): [True: 0, False: 170]
  ------------------
 1711|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1712|    170|        }
 1713|     53|    }
 1714|       |
 1715|       |    /* decoded size */
 1716|     31|    return dstSize;
 1717|     53|}
huf_decompress.c:HUF_DecompressFastArgs_init:
  192|    427|{
  193|    427|    void const* dt = DTable + 1;
  194|    427|    U32 const dtLog = HUF_getDTableDesc(DTable).tableLog;
  195|       |
  196|    427|    const BYTE* const istart = (const BYTE*)src;
  197|       |
  198|    427|    BYTE* const oend = ZSTD_maybeNullPtrAdd((BYTE*)dst, dstSize);
  199|       |
  200|       |    /* The fast decoding loop assumes 64-bit little-endian.
  201|       |     * This condition is false on x32.
  202|       |     */
  203|    427|    if (!MEM_isLittleEndian() || MEM_32bits())
  ------------------
  |  Branch (203:9): [True: 0, False: 427]
  |  Branch (203:34): [True: 0, False: 427]
  ------------------
  204|      0|        return 0;
  205|       |
  206|       |    /* Avoid nullptr addition */
  207|    427|    if (dstSize == 0)
  ------------------
  |  Branch (207:9): [True: 0, False: 427]
  ------------------
  208|      0|        return 0;
  209|    427|    assert(dst != NULL);
  ------------------
  |  |   70|    427|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  210|       |
  211|       |    /* strict minimum : jump table + 1 byte per stream */
  212|    427|    if (srcSize < 10)
  ------------------
  |  Branch (212:9): [True: 4, False: 423]
  ------------------
  213|      4|        return ERROR(corruption_detected);
  ------------------
  |  |   49|      4|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      4|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      4|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  214|       |
  215|       |    /* Must have at least 8 bytes per stream because we don't handle initializing smaller bit containers.
  216|       |     * If table log is not correct at this point, fallback to the old decoder.
  217|       |     * On small inputs we don't have enough data to trigger the fast loop, so use the old decoder.
  218|       |     */
  219|    423|    if (dtLog != HUF_DECODER_FAST_TABLELOG)
  ------------------
  |  |   31|    423|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
  |  Branch (219:9): [True: 145, False: 278]
  ------------------
  220|    145|        return 0;
  221|       |
  222|       |    /* Read the jump table. */
  223|    278|    {
  224|    278|        size_t const length1 = MEM_readLE16(istart);
  225|    278|        size_t const length2 = MEM_readLE16(istart+2);
  226|    278|        size_t const length3 = MEM_readLE16(istart+4);
  227|    278|        size_t const length4 = srcSize - (length1 + length2 + length3 + 6);
  228|    278|        args->iend[0] = istart + 6;  /* jumpTable */
  229|    278|        args->iend[1] = args->iend[0] + length1;
  230|    278|        args->iend[2] = args->iend[1] + length2;
  231|    278|        args->iend[3] = args->iend[2] + length3;
  232|       |
  233|       |        /* HUF_initFastDStream() requires this, and this small of an input
  234|       |         * won't benefit from the ASM loop anyways.
  235|       |         */
  236|    278|        if (length1 < 8 || length2 < 8 || length3 < 8 || length4 < 8)
  ------------------
  |  Branch (236:13): [True: 48, False: 230]
  |  Branch (236:28): [True: 37, False: 193]
  |  Branch (236:43): [True: 40, False: 153]
  |  Branch (236:58): [True: 5, False: 148]
  ------------------
  237|    130|            return 0;
  238|    148|        if (length4 > srcSize) return ERROR(corruption_detected);   /* overflow */
  ------------------
  |  |   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 (238:13): [True: 48, False: 100]
  ------------------
  239|    148|    }
  240|       |    /* ip[] contains the position that is currently loaded into bits[]. */
  241|    100|    args->ip[0] = args->iend[1] - sizeof(U64);
  242|    100|    args->ip[1] = args->iend[2] - sizeof(U64);
  243|    100|    args->ip[2] = args->iend[3] - sizeof(U64);
  244|    100|    args->ip[3] = (BYTE const*)src + srcSize - sizeof(U64);
  245|       |
  246|       |    /* op[] contains the output pointers. */
  247|    100|    args->op[0] = (BYTE*)dst;
  248|    100|    args->op[1] = args->op[0] + (dstSize+3)/4;
  249|    100|    args->op[2] = args->op[1] + (dstSize+3)/4;
  250|    100|    args->op[3] = args->op[2] + (dstSize+3)/4;
  251|       |
  252|       |    /* No point to call the ASM loop for tiny outputs. */
  253|    100|    if (args->op[3] >= oend)
  ------------------
  |  Branch (253:9): [True: 1, False: 99]
  ------------------
  254|      1|        return 0;
  255|       |
  256|       |    /* bits[] is the bit container.
  257|       |        * It is read from the MSB down to the LSB.
  258|       |        * It is shifted left as it is read, and zeros are
  259|       |        * shifted in. After the lowest valid bit a 1 is
  260|       |        * set, so that CountTrailingZeros(bits[]) can be used
  261|       |        * to count how many bits we've consumed.
  262|       |        */
  263|     99|    args->bits[0] = HUF_initFastDStream(args->ip[0]);
  264|     99|    args->bits[1] = HUF_initFastDStream(args->ip[1]);
  265|     99|    args->bits[2] = HUF_initFastDStream(args->ip[2]);
  266|     99|    args->bits[3] = HUF_initFastDStream(args->ip[3]);
  267|       |
  268|       |    /* The decoders must be sure to never read beyond ilowest.
  269|       |     * This is lower than iend[0], but allowing decoders to read
  270|       |     * down to ilowest can allow an extra iteration or two in the
  271|       |     * fast loop.
  272|       |     */
  273|     99|    args->ilowest = istart;
  274|       |
  275|     99|    args->oend = oend;
  276|     99|    args->dt = dt;
  277|       |
  278|     99|    return 1;
  279|    100|}
huf_decompress.c:HUF_initFastDStream:
  150|    396|static size_t HUF_initFastDStream(BYTE const* ip) {
  151|    396|    BYTE const lastByte = ip[7];
  152|    396|    size_t const bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (152:33): [True: 351, False: 45]
  ------------------
  153|    396|    size_t const value = MEM_readLEST(ip) | 1;
  154|    396|    assert(bitsConsumed <= 8);
  ------------------
  |  |   70|    396|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  155|    396|    assert(sizeof(size_t) == 8);
  ------------------
  |  |   70|    396|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  156|    396|    return value << bitsConsumed;
  157|    396|}
huf_decompress.c:HUF_initRemainingDStream:
  282|    358|{
  283|       |    /* Validate that we haven't overwritten. */
  284|    358|    if (args->op[stream] > segmentEnd)
  ------------------
  |  Branch (284:9): [True: 0, False: 358]
  ------------------
  285|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  286|       |    /* Validate that we haven't read beyond iend[].
  287|       |        * Note that ip[] may be < iend[] because the MSB is
  288|       |        * the next bit to read, and we may have consumed 100%
  289|       |        * of the stream, so down to iend[i] - 8 is valid.
  290|       |        */
  291|    358|    if (args->ip[stream] < args->iend[stream] - 8)
  ------------------
  |  Branch (291:9): [True: 40, False: 318]
  ------------------
  292|     40|        return ERROR(corruption_detected);
  ------------------
  |  |   49|     40|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     40|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     40|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  293|       |
  294|       |    /* Construct the BIT_DStream_t. */
  295|    318|    assert(sizeof(size_t) == 8);
  ------------------
  |  |   70|    318|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  296|    318|    bit->bitContainer = MEM_readLEST(args->ip[stream]);
  297|    318|    bit->bitsConsumed = ZSTD_countTrailingZeros64(args->bits[stream]);
  298|    318|    bit->start = (const char*)args->ilowest;
  299|    318|    bit->limitPtr = bit->start + sizeof(size_t);
  300|    318|    bit->ptr = (const char*)args->ip[stream];
  301|       |
  302|    318|    return 0;
  303|    358|}
huf_decompress.c:HUF_decompress4X1_usingDTable_internal:
  899|    218|{
  900|    218|    HUF_DecompressUsingDTableFn fallbackFn = HUF_decompress4X1_usingDTable_internal_default;
  901|    218|    HUF_DecompressFastLoopFn loopFn = HUF_decompress4X1_usingDTable_internal_fast_c_loop;
  902|       |
  903|    218|#if DYNAMIC_BMI2
  904|    218|    if (flags & HUF_flags_bmi2) {
  ------------------
  |  Branch (904:9): [True: 218, False: 0]
  ------------------
  905|    218|        fallbackFn = HUF_decompress4X1_usingDTable_internal_bmi2;
  906|    218|# if ZSTD_ENABLE_ASM_X86_64_BMI2
  907|    218|        if (!(flags & HUF_flags_disableAsm)) {
  ------------------
  |  Branch (907:13): [True: 218, False: 0]
  ------------------
  908|    218|            loopFn = HUF_decompress4X1_usingDTable_internal_fast_asm_loop;
  909|    218|        }
  910|    218|# endif
  911|    218|    } else {
  912|      0|        return fallbackFn(dst, dstSize, cSrc, cSrcSize, DTable);
  913|      0|    }
  914|    218|#endif
  915|       |
  916|       |#if ZSTD_ENABLE_ASM_X86_64_BMI2 && defined(__BMI2__)
  917|       |    if (!(flags & HUF_flags_disableAsm)) {
  918|       |        loopFn = HUF_decompress4X1_usingDTable_internal_fast_asm_loop;
  919|       |    }
  920|       |#endif
  921|       |
  922|    218|    if (HUF_ENABLE_FAST_DECODE && !(flags & HUF_flags_disableFast)) {
  ------------------
  |  |   40|    436|# define HUF_ENABLE_FAST_DECODE 1
  |  |  ------------------
  |  |  |  Branch (40:33): [True: 218, Folded]
  |  |  ------------------
  ------------------
  |  Branch (922:35): [True: 218, False: 0]
  ------------------
  923|    218|        size_t const ret = HUF_decompress4X1_usingDTable_internal_fast(dst, dstSize, cSrc, cSrcSize, DTable, loopFn);
  924|    218|        if (ret != 0)
  ------------------
  |  Branch (924:13): [True: 87, False: 131]
  ------------------
  925|     87|            return ret;
  926|    218|    }
  927|    131|    return fallbackFn(dst, dstSize, cSrc, cSrcSize, DTable);
  928|    218|}
huf_decompress.c:HUF_decompress4X1_usingDTable_internal_body:
  606|    131|{
  607|       |    /* Check */
  608|    131|    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 (608:9): [True: 0, False: 131]
  ------------------
  609|    131|    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 (609:9): [True: 0, False: 131]
  ------------------
  610|       |
  611|    131|    {   const BYTE* const istart = (const BYTE*) cSrc;
  612|    131|        BYTE* const ostart = (BYTE*) dst;
  613|    131|        BYTE* const oend = ostart + dstSize;
  614|    131|        BYTE* const olimit = oend - 3;
  615|    131|        const void* const dtPtr = DTable + 1;
  616|    131|        const HUF_DEltX1* const dt = (const HUF_DEltX1*)dtPtr;
  617|       |
  618|       |        /* Init */
  619|    131|        BIT_DStream_t bitD1;
  620|    131|        BIT_DStream_t bitD2;
  621|    131|        BIT_DStream_t bitD3;
  622|    131|        BIT_DStream_t bitD4;
  623|    131|        size_t const length1 = MEM_readLE16(istart);
  624|    131|        size_t const length2 = MEM_readLE16(istart+2);
  625|    131|        size_t const length3 = MEM_readLE16(istart+4);
  626|    131|        size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6);
  627|    131|        const BYTE* const istart1 = istart + 6;  /* jumpTable */
  628|    131|        const BYTE* const istart2 = istart1 + length1;
  629|    131|        const BYTE* const istart3 = istart2 + length2;
  630|    131|        const BYTE* const istart4 = istart3 + length3;
  631|    131|        const size_t segmentSize = (dstSize+3) / 4;
  632|    131|        BYTE* const opStart2 = ostart + segmentSize;
  633|    131|        BYTE* const opStart3 = opStart2 + segmentSize;
  634|    131|        BYTE* const opStart4 = opStart3 + segmentSize;
  635|    131|        BYTE* op1 = ostart;
  636|    131|        BYTE* op2 = opStart2;
  637|    131|        BYTE* op3 = opStart3;
  638|    131|        BYTE* op4 = opStart4;
  639|    131|        DTableDesc const dtd = HUF_getDTableDesc(DTable);
  640|    131|        U32 const dtLog = dtd.tableLog;
  641|    131|        U32 endSignal = 1;
  642|       |
  643|    131|        if (length4 > cSrcSize) return ERROR(corruption_detected);   /* overflow */
  ------------------
  |  |   49|     35|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     35|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     35|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (643:13): [True: 35, False: 96]
  ------------------
  644|     96|        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 (644:13): [True: 0, False: 96]
  ------------------
  645|     96|        assert(dstSize >= 6); /* validated above */
  ------------------
  |  |   70|     96|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  646|     96|        CHECK_F( BIT_initDStream(&bitD1, istart1, length1) );
  ------------------
  |  |   63|     96|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|     96|    size_t const e = f;     \
  |  |  |  |   59|     96|    do {                    \
  |  |  |  |   60|     96|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 3, False: 93]
  |  |  |  |  ------------------
  |  |  |  |   61|     96|            return e;       \
  |  |  |  |   62|     96|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 93]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 93]
  |  |  ------------------
  ------------------
  647|     93|        CHECK_F( BIT_initDStream(&bitD2, istart2, length2) );
  ------------------
  |  |   63|     93|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|     93|    size_t const e = f;     \
  |  |  |  |   59|     93|    do {                    \
  |  |  |  |   60|     93|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 6, False: 87]
  |  |  |  |  ------------------
  |  |  |  |   61|     93|            return e;       \
  |  |  |  |   62|     93|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 87]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 87]
  |  |  ------------------
  ------------------
  648|     87|        CHECK_F( BIT_initDStream(&bitD3, istart3, length3) );
  ------------------
  |  |   63|     87|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|     87|    size_t const e = f;     \
  |  |  |  |   59|     87|    do {                    \
  |  |  |  |   60|     87|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 3, False: 84]
  |  |  |  |  ------------------
  |  |  |  |   61|     87|            return e;       \
  |  |  |  |   62|     87|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 84]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 84]
  |  |  ------------------
  ------------------
  649|     84|        CHECK_F( BIT_initDStream(&bitD4, istart4, length4) );
  ------------------
  |  |   63|     84|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|     84|    size_t const e = f;     \
  |  |  |  |   59|     84|    do {                    \
  |  |  |  |   60|     84|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 3, False: 81]
  |  |  |  |  ------------------
  |  |  |  |   61|     84|            return e;       \
  |  |  |  |   62|     84|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 81]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 81]
  |  |  ------------------
  ------------------
  650|       |
  651|       |        /* up to 16 symbols per loop (4 symbols per stream) in 64-bit mode */
  652|     81|        if ((size_t)(oend - op4) >= sizeof(size_t)) {
  ------------------
  |  Branch (652:13): [True: 76, False: 5]
  ------------------
  653|  3.08k|            for ( ; (endSignal) & (op4 < olimit) ; ) {
  ------------------
  |  Branch (653:21): [True: 3.01k, False: 76]
  ------------------
  654|  3.01k|                HUF_DECODE_SYMBOLX1_2(op1, &bitD1);
  ------------------
  |  |  540|  3.01k|    do {                                            \
  |  |  541|  3.01k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 3.01k, False: 0]
  |  |  ------------------
  |  |  542|  3.01k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.01k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  3.01k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
  655|  3.01k|                HUF_DECODE_SYMBOLX1_2(op2, &bitD2);
  ------------------
  |  |  540|  3.01k|    do {                                            \
  |  |  541|  3.01k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 3.01k, False: 0]
  |  |  ------------------
  |  |  542|  3.01k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.01k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  3.01k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
  656|  3.01k|                HUF_DECODE_SYMBOLX1_2(op3, &bitD3);
  ------------------
  |  |  540|  3.01k|    do {                                            \
  |  |  541|  3.01k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 3.01k, False: 0]
  |  |  ------------------
  |  |  542|  3.01k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.01k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  3.01k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
  657|  3.01k|                HUF_DECODE_SYMBOLX1_2(op4, &bitD4);
  ------------------
  |  |  540|  3.01k|    do {                                            \
  |  |  541|  3.01k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 3.01k, False: 0]
  |  |  ------------------
  |  |  542|  3.01k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.01k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  3.01k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
  658|  3.01k|                HUF_DECODE_SYMBOLX1_1(op1, &bitD1);
  ------------------
  |  |  534|  3.01k|    do {                                            \
  |  |  535|  3.01k|        if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |   37|      0|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  |  |  ------------------
  |  |  |  Branch (535:13): [True: 3.01k, False: 0]
  |  |  |  Branch (535:29): [True: 0, Folded]
  |  |  ------------------
  |  |  536|  3.01k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.01k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  537|  3.01k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (537:14): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
  659|  3.01k|                HUF_DECODE_SYMBOLX1_1(op2, &bitD2);
  ------------------
  |  |  534|  3.01k|    do {                                            \
  |  |  535|  3.01k|        if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |   37|      0|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  |  |  ------------------
  |  |  |  Branch (535:13): [True: 3.01k, False: 0]
  |  |  |  Branch (535:29): [True: 0, Folded]
  |  |  ------------------
  |  |  536|  3.01k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.01k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  537|  3.01k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (537:14): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
  660|  3.01k|                HUF_DECODE_SYMBOLX1_1(op3, &bitD3);
  ------------------
  |  |  534|  3.01k|    do {                                            \
  |  |  535|  3.01k|        if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |   37|      0|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  |  |  ------------------
  |  |  |  Branch (535:13): [True: 3.01k, False: 0]
  |  |  |  Branch (535:29): [True: 0, Folded]
  |  |  ------------------
  |  |  536|  3.01k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.01k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  537|  3.01k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (537:14): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
  661|  3.01k|                HUF_DECODE_SYMBOLX1_1(op4, &bitD4);
  ------------------
  |  |  534|  3.01k|    do {                                            \
  |  |  535|  3.01k|        if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |   37|      0|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  |  |  ------------------
  |  |  |  Branch (535:13): [True: 3.01k, False: 0]
  |  |  |  Branch (535:29): [True: 0, Folded]
  |  |  ------------------
  |  |  536|  3.01k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.01k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  537|  3.01k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (537:14): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
  662|  3.01k|                HUF_DECODE_SYMBOLX1_2(op1, &bitD1);
  ------------------
  |  |  540|  3.01k|    do {                                            \
  |  |  541|  3.01k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 3.01k, False: 0]
  |  |  ------------------
  |  |  542|  3.01k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.01k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  3.01k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
  663|  3.01k|                HUF_DECODE_SYMBOLX1_2(op2, &bitD2);
  ------------------
  |  |  540|  3.01k|    do {                                            \
  |  |  541|  3.01k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 3.01k, False: 0]
  |  |  ------------------
  |  |  542|  3.01k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.01k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  3.01k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
  664|  3.01k|                HUF_DECODE_SYMBOLX1_2(op3, &bitD3);
  ------------------
  |  |  540|  3.01k|    do {                                            \
  |  |  541|  3.01k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 3.01k, False: 0]
  |  |  ------------------
  |  |  542|  3.01k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.01k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  3.01k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
  665|  3.01k|                HUF_DECODE_SYMBOLX1_2(op4, &bitD4);
  ------------------
  |  |  540|  3.01k|    do {                                            \
  |  |  541|  3.01k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 3.01k, False: 0]
  |  |  ------------------
  |  |  542|  3.01k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.01k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  3.01k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
  666|  3.01k|                HUF_DECODE_SYMBOLX1_0(op1, &bitD1);
  ------------------
  |  |  531|  3.01k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (531:71): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
  667|  3.01k|                HUF_DECODE_SYMBOLX1_0(op2, &bitD2);
  ------------------
  |  |  531|  3.01k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (531:71): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
  668|  3.01k|                HUF_DECODE_SYMBOLX1_0(op3, &bitD3);
  ------------------
  |  |  531|  3.01k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (531:71): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
  669|  3.01k|                HUF_DECODE_SYMBOLX1_0(op4, &bitD4);
  ------------------
  |  |  531|  3.01k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (531:71): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
  670|  3.01k|                endSignal &= BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished;
  671|  3.01k|                endSignal &= BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished;
  672|  3.01k|                endSignal &= BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished;
  673|  3.01k|                endSignal &= BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished;
  674|  3.01k|            }
  675|     76|        }
  676|       |
  677|       |        /* check corruption */
  678|       |        /* note : should not be necessary : op# advance in lock step, and we control op4.
  679|       |         *        but curiously, binary generated by gcc 7.2 & 7.3 with -mbmi2 runs faster when >=1 test is present */
  680|     81|        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 (680:13): [True: 0, False: 81]
  ------------------
  681|     81|        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 (681:13): [True: 0, False: 81]
  ------------------
  682|     81|        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 (682:13): [True: 0, False: 81]
  ------------------
  683|       |        /* note : op4 supposed already verified within main loop */
  684|       |
  685|       |        /* finish bitStreams one by one */
  686|     81|        HUF_decodeStreamX1(op1, &bitD1, opStart2, dt, dtLog);
  687|     81|        HUF_decodeStreamX1(op2, &bitD2, opStart3, dt, dtLog);
  688|     81|        HUF_decodeStreamX1(op3, &bitD3, opStart4, dt, dtLog);
  689|     81|        HUF_decodeStreamX1(op4, &bitD4, oend,     dt, dtLog);
  690|       |
  691|       |        /* check */
  692|     81|        { U32 const endCheck = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4);
  693|     81|          if (!endCheck) return ERROR(corruption_detected); }
  ------------------
  |  |   49|     81|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     81|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     81|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (693:15): [True: 81, False: 0]
  ------------------
  694|       |
  695|       |        /* decoded size */
  696|      0|        return dstSize;
  697|     81|    }
  698|     81|}
huf_decompress.c:HUF_decompress4X1_usingDTable_internal_bmi2:
  703|    131|                    size_t cSrcSize, HUF_DTable const* DTable) {
  704|    131|    return HUF_decompress4X1_usingDTable_internal_body(dst, dstSize, cSrc, cSrcSize, DTable);
  705|    131|}
huf_decompress.c:HUF_decompress4X1_usingDTable_internal_fast:
  845|    218|{
  846|    218|    void const* dt = DTable + 1;
  847|    218|    BYTE const* const ilowest = (BYTE const*)cSrc;
  848|    218|    BYTE* const oend = ZSTD_maybeNullPtrAdd((BYTE*)dst, dstSize);
  849|    218|    HUF_DecompressFastArgs args;
  850|    218|    {   size_t const ret = HUF_DecompressFastArgs_init(&args, dst, dstSize, cSrc, cSrcSize, DTable);
  851|    218|        FORWARD_IF_ERROR(ret, "Failed to init fast loop args");
  ------------------
  |  |  146|    218|    do {                                                                           \
  |  |  147|    218|        size_t const err_code = (err);                                             \
  |  |  148|    218|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 41, False: 177]
  |  |  ------------------
  |  |  149|     41|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|     41|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 41]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|     41|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|     41|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|     41|    do {                                           \
  |  |  |  |   99|     41|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 41]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     41|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 41]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|     41|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|     41|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 41]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|     41|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|     41|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 41]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     41|            return err_code;                                                       \
  |  |  155|     41|        }                                                                          \
  |  |  156|    218|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 177]
  |  |  ------------------
  ------------------
  852|    177|        if (ret == 0)
  ------------------
  |  Branch (852:13): [True: 131, False: 46]
  ------------------
  853|    131|            return 0;
  854|    177|    }
  855|       |
  856|     46|    assert(args.ip[0] >= args.ilowest);
  ------------------
  |  |   70|     46|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  857|     46|    loopFn(&args);
  858|       |
  859|       |    /* Our loop guarantees that ip[] >= ilowest and that we haven't
  860|       |    * overwritten any op[].
  861|       |    */
  862|     46|    assert(args.ip[0] >= ilowest);
  ------------------
  |  |   70|     46|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  863|     46|    assert(args.ip[0] >= ilowest);
  ------------------
  |  |   70|     46|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  864|     46|    assert(args.ip[1] >= ilowest);
  ------------------
  |  |   70|     46|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  865|     46|    assert(args.ip[2] >= ilowest);
  ------------------
  |  |   70|     46|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  866|     46|    assert(args.ip[3] >= ilowest);
  ------------------
  |  |   70|     46|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  867|     46|    assert(args.op[3] <= oend);
  ------------------
  |  |   70|     46|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  868|       |
  869|     46|    assert(ilowest == args.ilowest);
  ------------------
  |  |   70|     46|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  870|     46|    assert(ilowest + 6 == args.iend[0]);
  ------------------
  |  |   70|     46|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  871|     46|    (void)ilowest;
  872|       |
  873|       |    /* finish bit streams one by one. */
  874|     46|    {   size_t const segmentSize = (dstSize+3) / 4;
  875|     46|        BYTE* segmentEnd = (BYTE*)dst;
  876|     46|        int i;
  877|    194|        for (i = 0; i < 4; ++i) {
  ------------------
  |  Branch (877:21): [True: 166, False: 28]
  ------------------
  878|    166|            BIT_DStream_t bit;
  879|    166|            if (segmentSize <= (size_t)(oend - segmentEnd))
  ------------------
  |  Branch (879:17): [True: 141, False: 25]
  ------------------
  880|    141|                segmentEnd += segmentSize;
  881|     25|            else
  882|     25|                segmentEnd = oend;
  883|    166|            FORWARD_IF_ERROR(HUF_initRemainingDStream(&bit, &args, i, segmentEnd), "corruption");
  ------------------
  |  |  146|    166|    do {                                                                           \
  |  |  147|    166|        size_t const err_code = (err);                                             \
  |  |  148|    166|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 18, False: 148]
  |  |  ------------------
  |  |  149|     18|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|     18|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|     18|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|     18|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|     18|    do {                                           \
  |  |  |  |   99|     18|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     18|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|     18|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|     18|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|     18|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|     18|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     18|            return err_code;                                                       \
  |  |  155|     18|        }                                                                          \
  |  |  156|    166|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 148]
  |  |  ------------------
  ------------------
  884|       |            /* Decompress and validate that we've produced exactly the expected length. */
  885|    148|            args.op[i] += HUF_decodeStreamX1(args.op[i], &bit, segmentEnd, (HUF_DEltX1 const*)dt, HUF_DECODER_FAST_TABLELOG);
  ------------------
  |  |   31|    148|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
  886|    148|            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 (886:17): [True: 0, False: 148]
  ------------------
  887|    148|        }
  888|     46|    }
  889|       |
  890|       |    /* decoded size */
  891|     28|    assert(dstSize != 0);
  ------------------
  |  |   70|     28|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  892|     28|    return dstSize;
  893|     46|}
huf_decompress.c:HUF_decompress4X2_DCtx_wksp:
 1772|    227|{
 1773|    227|    const BYTE* ip = (const BYTE*) cSrc;
 1774|       |
 1775|    227|    size_t hSize = HUF_readDTableX2_wksp(dctx, cSrc, cSrcSize,
 1776|    227|                                         workSpace, wkspSize, flags);
 1777|    227|    if (HUF_isError(hSize)) return hSize;
  ------------------
  |  |   78|    227|#define HUF_isError ERR_isError
  ------------------
  |  Branch (1777:9): [True: 18, False: 209]
  ------------------
 1778|    209|    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 (1778:9): [True: 0, False: 209]
  ------------------
 1779|    209|    ip += hSize; cSrcSize -= hSize;
 1780|       |
 1781|    209|    return HUF_decompress4X2_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, flags);
 1782|    209|}
huf_decompress.c:HUF_decompress4X1_DCtx_wksp:
  933|    340|{
  934|    340|    const BYTE* ip = (const BYTE*) cSrc;
  935|       |
  936|    340|    size_t const hSize = HUF_readDTableX1_wksp(dctx, cSrc, cSrcSize, workSpace, wkspSize, flags);
  937|    340|    if (HUF_isError(hSize)) return hSize;
  ------------------
  |  |   78|    340|#define HUF_isError ERR_isError
  ------------------
  |  Branch (937:9): [True: 120, False: 220]
  ------------------
  938|    220|    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 (938:9): [True: 2, False: 218]
  ------------------
  939|    218|    ip += hSize; cSrcSize -= hSize;
  940|       |
  941|    218|    return HUF_decompress4X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, flags);
  942|    220|}

ZSTD_DDict_dictContent:
   47|  3.83k|{
   48|  3.83k|    assert(ddict != NULL);
  ------------------
  |  |   70|  3.83k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   49|  3.83k|    return ddict->dictContent;
   50|  3.83k|}
ZSTD_DDict_dictSize:
   53|  3.83k|{
   54|  3.83k|    assert(ddict != NULL);
  ------------------
  |  |   70|  3.83k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   55|  3.83k|    return ddict->dictSize;
   56|  3.83k|}
ZSTD_copyDDictParameters:
   59|  1.52k|{
   60|  1.52k|    DEBUGLOG(4, "ZSTD_copyDDictParameters");
  ------------------
  |  |  104|  1.52k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
   61|  1.52k|    assert(dctx != NULL);
  ------------------
  |  |   70|  1.52k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   62|  1.52k|    assert(ddict != NULL);
  ------------------
  |  |   70|  1.52k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   63|  1.52k|    dctx->dictID = ddict->dictID;
   64|  1.52k|    dctx->prefixStart = ddict->dictContent;
   65|  1.52k|    dctx->virtualStart = ddict->dictContent;
   66|  1.52k|    dctx->dictEnd = (const BYTE*)ddict->dictContent + ddict->dictSize;
   67|  1.52k|    dctx->previousDstEnd = dctx->dictEnd;
   68|  1.52k|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
   69|  1.52k|    dctx->dictContentBeginForFuzzing = dctx->prefixStart;
   70|  1.52k|    dctx->dictContentEndForFuzzing = dctx->previousDstEnd;
   71|  1.52k|#endif
   72|  1.52k|    if (ddict->entropyPresent) {
  ------------------
  |  Branch (72:9): [True: 1, False: 1.52k]
  ------------------
   73|      1|        dctx->litEntropy = 1;
   74|      1|        dctx->fseEntropy = 1;
   75|      1|        dctx->LLTptr = ddict->entropy.LLTable;
   76|      1|        dctx->MLTptr = ddict->entropy.MLTable;
   77|      1|        dctx->OFTptr = ddict->entropy.OFTable;
   78|      1|        dctx->HUFptr = ddict->entropy.hufTable;
   79|      1|        dctx->entropy.rep[0] = ddict->entropy.rep[0];
   80|      1|        dctx->entropy.rep[1] = ddict->entropy.rep[1];
   81|      1|        dctx->entropy.rep[2] = ddict->entropy.rep[2];
   82|  1.52k|    } else {
   83|  1.52k|        dctx->litEntropy = 0;
   84|  1.52k|        dctx->fseEntropy = 0;
   85|  1.52k|    }
   86|  1.52k|}
ZSTD_createDDict_advanced:
  149|  2.99k|{
  150|  2.99k|    if ((!customMem.customAlloc) ^ (!customMem.customFree)) return NULL;
  ------------------
  |  Branch (150:9): [True: 0, False: 2.99k]
  ------------------
  151|       |
  152|  2.99k|    {   ZSTD_DDict* const ddict = (ZSTD_DDict*) ZSTD_customMalloc(sizeof(ZSTD_DDict), customMem);
  153|  2.99k|        if (ddict == NULL) return NULL;
  ------------------
  |  Branch (153:13): [True: 0, False: 2.99k]
  ------------------
  154|  2.99k|        ddict->cMem = customMem;
  155|  2.99k|        {   size_t const initResult = ZSTD_initDDict_internal(ddict,
  156|  2.99k|                                            dict, dictSize,
  157|  2.99k|                                            dictLoadMethod, dictContentType);
  158|  2.99k|            if (ZSTD_isError(initResult)) {
  ------------------
  |  |   44|  2.99k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (158:17): [True: 152, False: 2.84k]
  ------------------
  159|    152|                ZSTD_freeDDict(ddict);
  160|    152|                return NULL;
  161|    152|        }   }
  162|  2.84k|        return ddict;
  163|  2.99k|    }
  164|  2.99k|}
ZSTD_createDDict:
  171|  2.99k|{
  172|  2.99k|    ZSTD_customMem const allocator = { NULL, NULL, NULL };
  173|  2.99k|    return ZSTD_createDDict_advanced(dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dct_auto, allocator);
  174|  2.99k|}
ZSTD_freeDDict:
  213|  13.6k|{
  214|  13.6k|    if (ddict==NULL) return 0;   /* support free on NULL */
  ------------------
  |  Branch (214:9): [True: 10.6k, False: 2.99k]
  ------------------
  215|  2.99k|    {   ZSTD_customMem const cMem = ddict->cMem;
  216|  2.99k|        ZSTD_customFree(ddict->dictBuffer, cMem);
  217|  2.99k|        ZSTD_customFree(ddict, cMem);
  218|  2.99k|        return 0;
  219|  13.6k|    }
  220|  13.6k|}
zstd_ddict.c:ZSTD_initDDict_internal:
  124|  2.99k|{
  125|  2.99k|    if ((dictLoadMethod == ZSTD_dlm_byRef) || (!dict) || (!dictSize)) {
  ------------------
  |  Branch (125:9): [True: 0, False: 2.99k]
  |  Branch (125:47): [True: 0, False: 2.99k]
  |  Branch (125:58): [True: 0, False: 2.99k]
  ------------------
  126|      0|        ddict->dictBuffer = NULL;
  127|      0|        ddict->dictContent = dict;
  128|      0|        if (!dict) dictSize = 0;
  ------------------
  |  Branch (128:13): [True: 0, False: 0]
  ------------------
  129|  2.99k|    } else {
  130|  2.99k|        void* const internalBuffer = ZSTD_customMalloc(dictSize, ddict->cMem);
  131|  2.99k|        ddict->dictBuffer = internalBuffer;
  132|  2.99k|        ddict->dictContent = internalBuffer;
  133|  2.99k|        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 (133:13): [True: 0, False: 2.99k]
  ------------------
  134|  2.99k|        ZSTD_memcpy(internalBuffer, dict, dictSize);
  ------------------
  |  |   44|  2.99k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  135|  2.99k|    }
  136|  2.99k|    ddict->dictSize = dictSize;
  137|  2.99k|    ddict->entropy.hufTable[0] = (HUF_DTable)((ZSTD_HUFFDTABLE_CAPACITY_LOG)*0x1000001);  /* cover both little and big endian */
  ------------------
  |  |   78|  2.99k|#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
  ------------------
  138|       |
  139|       |    /* parse dictionary content */
  140|  2.99k|    FORWARD_IF_ERROR( ZSTD_loadEntropy_intoDDict(ddict, dictContentType) , "");
  ------------------
  |  |  146|  2.99k|    do {                                                                           \
  |  |  147|  2.99k|        size_t const err_code = (err);                                             \
  |  |  148|  2.99k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 152, False: 2.84k]
  |  |  ------------------
  |  |  149|    152|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|    152|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 152]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|    152|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|    152|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|    152|    do {                                           \
  |  |  |  |   99|    152|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 152]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    152|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 152]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|    152|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|    152|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 152]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|    152|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|    152|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 152]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|    152|            return err_code;                                                       \
  |  |  155|    152|        }                                                                          \
  |  |  156|  2.99k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 2.84k]
  |  |  ------------------
  ------------------
  141|       |
  142|  2.84k|    return 0;
  143|  2.99k|}
zstd_ddict.c:ZSTD_loadEntropy_intoDDict:
   92|  2.99k|{
   93|  2.99k|    ddict->dictID = 0;
   94|  2.99k|    ddict->entropyPresent = 0;
   95|  2.99k|    if (dictContentType == ZSTD_dct_rawContent) return 0;
  ------------------
  |  Branch (95:9): [True: 0, False: 2.99k]
  ------------------
   96|       |
   97|  2.99k|    if (ddict->dictSize < 8) {
  ------------------
  |  Branch (97:9): [True: 307, False: 2.68k]
  ------------------
   98|    307|        if (dictContentType == ZSTD_dct_fullDict)
  ------------------
  |  Branch (98:13): [True: 0, False: 307]
  ------------------
   99|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  100|    307|        return 0;   /* pure content mode */
  101|    307|    }
  102|  2.68k|    {   U32 const magic = MEM_readLE32(ddict->dictContent);
  103|  2.68k|        if (magic != ZSTD_MAGIC_DICTIONARY) {
  ------------------
  |  |  143|  2.68k|#define ZSTD_MAGIC_DICTIONARY       0xEC30A437    /* valid since v0.7.0 */
  ------------------
  |  Branch (103:13): [True: 2.53k, False: 153]
  ------------------
  104|  2.53k|            if (dictContentType == ZSTD_dct_fullDict)
  ------------------
  |  Branch (104:17): [True: 0, False: 2.53k]
  ------------------
  105|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  106|  2.53k|            return 0;   /* pure content mode */
  107|  2.53k|        }
  108|  2.68k|    }
  109|    153|    ddict->dictID = MEM_readLE32((const char*)ddict->dictContent + ZSTD_FRAMEIDSIZE);
  ------------------
  |  |   82|    153|#define ZSTD_FRAMEIDSIZE 4   /* magic number size */
  ------------------
  110|       |
  111|       |    /* load entropy tables */
  112|    153|    RETURN_ERROR_IF(ZSTD_isError(ZSTD_loadDEntropy(
  ------------------
  |  |  114|    153|    do {                                                                       \
  |  |  115|    153|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 152, False: 1]
  |  |  ------------------
  |  |  116|    152|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    152|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 152]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    152|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    152|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    152|    do {                                           \
  |  |  |  |   99|    152|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 152]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    152|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 152]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    152|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    152|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 152]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    152|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    152|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 152]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    152|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    152|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    152|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    152|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    152|        }                                                                      \
  |  |  123|    153|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
  113|    153|            &ddict->entropy, ddict->dictContent, ddict->dictSize)),
  114|    153|        dictionary_corrupted, "");
  115|      1|    ddict->entropyPresent = 1;
  116|      1|    return 0;
  117|    153|}

ZSTD_createDCtx:
  311|  6.47k|{
  312|  6.47k|    DEBUGLOG(3, "ZSTD_createDCtx");
  ------------------
  |  |  104|  6.47k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 6.47k]
  |  |  ------------------
  ------------------
  313|  6.47k|    return ZSTD_createDCtx_internal(ZSTD_defaultCMem);
  314|  6.47k|}
ZSTD_freeDCtx:
  325|  6.47k|{
  326|  6.47k|    if (dctx==NULL) return 0;   /* support free on NULL */
  ------------------
  |  Branch (326:9): [True: 0, False: 6.47k]
  ------------------
  327|  6.47k|    RETURN_ERROR_IF(dctx->staticSize, memory_allocation, "not compatible with static DCtx");
  ------------------
  |  |  114|  6.47k|    do {                                                                       \
  |  |  115|  6.47k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 6.47k]
  |  |  ------------------
  |  |  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.47k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 6.47k]
  |  |  ------------------
  ------------------
  328|  6.47k|    {   ZSTD_customMem const cMem = dctx->customMem;
  329|  6.47k|        ZSTD_clearDict(dctx);
  330|  6.47k|        ZSTD_customFree(dctx->inBuff, cMem);
  331|  6.47k|        dctx->inBuff = NULL;
  332|  6.47k|#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1)
  333|  6.47k|        if (dctx->legacyContext)
  ------------------
  |  Branch (333:13): [True: 0, False: 6.47k]
  ------------------
  334|      0|            ZSTD_freeLegacyStreamContext(dctx->legacyContext, dctx->previousLegacyVersion);
  335|  6.47k|#endif
  336|  6.47k|        if (dctx->ddictSet) {
  ------------------
  |  Branch (336:13): [True: 0, False: 6.47k]
  ------------------
  337|      0|            ZSTD_freeDDictHashSet(dctx->ddictSet, cMem);
  338|       |            dctx->ddictSet = NULL;
  339|      0|        }
  340|  6.47k|        ZSTD_customFree(dctx, cMem);
  341|  6.47k|        return 0;
  342|  6.47k|    }
  343|  6.47k|}
ZSTD_getFrameHeader_advanced:
  448|  3.44k|{
  449|  3.44k|    const BYTE* ip = (const BYTE*)src;
  450|  3.44k|    size_t const minInputSize = ZSTD_startingInputLength(format);
  451|       |
  452|  3.44k|    DEBUGLOG(5, "ZSTD_getFrameHeader_advanced: minInputSize = %zu, srcSize = %zu", minInputSize, srcSize);
  ------------------
  |  |  104|  3.44k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.44k]
  |  |  ------------------
  ------------------
  453|       |
  454|  3.44k|    if (srcSize > 0) {
  ------------------
  |  Branch (454:9): [True: 3.44k, False: 0]
  ------------------
  455|       |        /* note : technically could be considered an assert(), since it's an invalid entry */
  456|  3.44k|        RETURN_ERROR_IF(src==NULL, GENERIC, "invalid parameter : src==NULL, but srcSize>0");
  ------------------
  |  |  114|  3.44k|    do {                                                                       \
  |  |  115|  3.44k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 3.44k]
  |  |  ------------------
  |  |  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.44k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.44k]
  |  |  ------------------
  ------------------
  457|  3.44k|    }
  458|  3.44k|    if (srcSize < minInputSize) {
  ------------------
  |  Branch (458:9): [True: 0, False: 3.44k]
  ------------------
  459|      0|        if (srcSize > 0 && format != ZSTD_f_zstd1_magicless) {
  ------------------
  |  Branch (459:13): [True: 0, False: 0]
  |  Branch (459:28): [True: 0, False: 0]
  ------------------
  460|       |            /* when receiving less than @minInputSize bytes,
  461|       |             * control these bytes at least correspond to a supported magic number
  462|       |             * in order to error out early if they don't.
  463|       |            **/
  464|      0|            size_t const toCopy = MIN(4, srcSize);
  ------------------
  |  |   54|      0|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  465|      0|            unsigned char hbuf[4]; MEM_writeLE32(hbuf, ZSTD_MAGICNUMBER);
  ------------------
  |  |  142|      0|#define ZSTD_MAGICNUMBER            0xFD2FB528    /* valid since v0.8.0 */
  ------------------
  466|      0|            assert(src != NULL);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  467|      0|            ZSTD_memcpy(hbuf, src, toCopy);
  ------------------
  |  |   44|      0|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  468|      0|            if ( MEM_readLE32(hbuf) != ZSTD_MAGICNUMBER ) {
  ------------------
  |  |  142|      0|#define ZSTD_MAGICNUMBER            0xFD2FB528    /* valid since v0.8.0 */
  ------------------
  |  Branch (468:18): [True: 0, False: 0]
  ------------------
  469|       |                /* not a zstd frame : let's check if it's a skippable frame */
  470|      0|                MEM_writeLE32(hbuf, ZSTD_MAGIC_SKIPPABLE_START);
  ------------------
  |  |  144|      0|#define ZSTD_MAGIC_SKIPPABLE_START  0x184D2A50    /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */
  ------------------
  471|      0|                ZSTD_memcpy(hbuf, src, toCopy);
  ------------------
  |  |   44|      0|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  472|      0|                if ((MEM_readLE32(hbuf) & ZSTD_MAGIC_SKIPPABLE_MASK) != ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  145|      0|#define ZSTD_MAGIC_SKIPPABLE_MASK   0xFFFFFFF0
  ------------------
                              if ((MEM_readLE32(hbuf) & ZSTD_MAGIC_SKIPPABLE_MASK) != ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  144|      0|#define ZSTD_MAGIC_SKIPPABLE_START  0x184D2A50    /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */
  ------------------
  |  Branch (472:21): [True: 0, False: 0]
  ------------------
  473|      0|                    RETURN_ERROR(prefix_unknown,
  ------------------
  |  |  131|      0|    do {                                                                     \
  |  |  132|      0|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|      0|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|      0|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|      0|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|      0|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|      0|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  474|      0|                                "first bytes don't correspond to any supported magic number");
  475|      0|        }   }   }
  476|      0|        return minInputSize;
  477|      0|    }
  478|       |
  479|  3.44k|    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.44k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  480|  3.44k|    if ( (format != ZSTD_f_zstd1_magicless)
  ------------------
  |  Branch (480:10): [True: 3.44k, False: 0]
  ------------------
  481|  3.44k|      && (MEM_readLE32(src) != ZSTD_MAGICNUMBER) ) {
  ------------------
  |  |  142|  3.44k|#define ZSTD_MAGICNUMBER            0xFD2FB528    /* valid since v0.8.0 */
  ------------------
  |  Branch (481:10): [True: 381, False: 3.06k]
  ------------------
  482|    381|        if ((MEM_readLE32(src) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  145|    381|#define ZSTD_MAGIC_SKIPPABLE_MASK   0xFFFFFFF0
  ------------------
                      if ((MEM_readLE32(src) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  144|    381|#define ZSTD_MAGIC_SKIPPABLE_START  0x184D2A50    /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */
  ------------------
  |  Branch (482:13): [True: 0, False: 381]
  ------------------
  483|       |            /* skippable frame */
  484|      0|            if (srcSize < ZSTD_SKIPPABLEHEADERSIZE)
  ------------------
  |  | 1260|      0|#define ZSTD_SKIPPABLEHEADERSIZE    8
  ------------------
  |  Branch (484:17): [True: 0, False: 0]
  ------------------
  485|      0|                return ZSTD_SKIPPABLEHEADERSIZE; /* magic number + frame length */
  ------------------
  |  | 1260|      0|#define ZSTD_SKIPPABLEHEADERSIZE    8
  ------------------
  486|      0|            ZSTD_memset(zfhPtr, 0, sizeof(*zfhPtr));
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  487|      0|            zfhPtr->frameType = ZSTD_skippableFrame;
  488|      0|            zfhPtr->dictID = MEM_readLE32(src) - ZSTD_MAGIC_SKIPPABLE_START;
  ------------------
  |  |  144|      0|#define ZSTD_MAGIC_SKIPPABLE_START  0x184D2A50    /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */
  ------------------
  489|      0|            zfhPtr->headerSize = ZSTD_SKIPPABLEHEADERSIZE;
  ------------------
  |  | 1260|      0|#define ZSTD_SKIPPABLEHEADERSIZE    8
  ------------------
  490|      0|            zfhPtr->frameContentSize = MEM_readLE32((const char *)src + ZSTD_FRAMEIDSIZE);
  ------------------
  |  |   82|      0|#define ZSTD_FRAMEIDSIZE 4   /* magic number size */
  ------------------
  491|      0|            return 0;
  492|      0|        }
  493|    381|        RETURN_ERROR(prefix_unknown, "");
  ------------------
  |  |  131|    381|    do {                                                                     \
  |  |  132|    381|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|    381|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 381]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|    381|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|    381|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|    381|    do {                                           \
  |  |  |  |   99|    381|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 381]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    381|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 381]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|    381|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|    381|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 381]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|    381|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|    381|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 381]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|    381|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|    381|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    381|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    381|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|    381|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  494|    381|    }
  495|       |
  496|       |    /* ensure there is enough `srcSize` to fully read/decode frame header */
  497|  3.06k|    {   size_t const fhsize = ZSTD_frameHeaderSize_internal(src, srcSize, format);
  498|  3.06k|        if (srcSize < fhsize) return fhsize;
  ------------------
  |  Branch (498:13): [True: 0, False: 3.06k]
  ------------------
  499|  3.06k|        zfhPtr->headerSize = (U32)fhsize;
  500|  3.06k|    }
  501|       |
  502|      0|    {   BYTE const fhdByte = ip[minInputSize-1];
  503|  3.06k|        size_t pos = minInputSize;
  504|  3.06k|        U32 const dictIDSizeCode = fhdByte&3;
  505|  3.06k|        U32 const checksumFlag = (fhdByte>>2)&1;
  506|  3.06k|        U32 const singleSegment = (fhdByte>>5)&1;
  507|  3.06k|        U32 const fcsID = fhdByte>>6;
  508|  3.06k|        U64 windowSize = 0;
  509|  3.06k|        U32 dictID = 0;
  510|  3.06k|        U64 frameContentSize = ZSTD_CONTENTSIZE_UNKNOWN;
  ------------------
  |  |  203|  3.06k|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  511|  3.06k|        RETURN_ERROR_IF((fhdByte & 0x08) != 0, frameParameter_unsupported,
  ------------------
  |  |  114|  3.06k|    do {                                                                       \
  |  |  115|  3.06k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 3.06k]
  |  |  ------------------
  |  |  116|      3|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      3|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      3|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      3|    do {                                           \
  |  |  |  |   99|      3|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      3|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      3|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      3|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      3|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      3|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      3|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      3|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      3|        }                                                                      \
  |  |  123|  3.06k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.06k]
  |  |  ------------------
  ------------------
  512|  3.06k|                        "reserved bits, must be zero");
  513|       |
  514|  3.06k|        if (!singleSegment) {
  ------------------
  |  Branch (514:13): [True: 2.40k, False: 655]
  ------------------
  515|  2.40k|            BYTE const wlByte = ip[pos++];
  516|  2.40k|            U32 const windowLog = (wlByte >> 3) + ZSTD_WINDOWLOG_ABSOLUTEMIN;
  ------------------
  |  |   78|  2.40k|#define ZSTD_WINDOWLOG_ABSOLUTEMIN 10
  ------------------
  517|  2.40k|            RETURN_ERROR_IF(windowLog > ZSTD_WINDOWLOG_MAX, frameParameter_windowTooLarge, "");
  ------------------
  |  |  114|  2.40k|    do {                                                                       \
  |  |  115|  7.22k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [Folded, False: 2.40k]
  |  |  |  Branch (115:13): [True: 1, False: 2.40k]
  |  |  ------------------
  |  |  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.40k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.40k]
  |  |  ------------------
  ------------------
  518|  2.40k|            windowSize = (1ULL << windowLog);
  519|  2.40k|            windowSize += (windowSize >> 3) * (wlByte&7);
  520|  2.40k|        }
  521|  3.06k|        switch(dictIDSizeCode)
  522|  3.06k|        {
  523|      0|            default:
  ------------------
  |  Branch (523:13): [True: 0, False: 3.06k]
  ------------------
  524|      0|                assert(0);  /* impossible */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  525|      0|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  526|    118|            case 0 : break;
  ------------------
  |  Branch (526:13): [True: 118, False: 2.94k]
  ------------------
  527|  2.41k|            case 1 : dictID = ip[pos]; pos++; break;
  ------------------
  |  Branch (527:13): [True: 2.41k, False: 651]
  ------------------
  528|    478|            case 2 : dictID = MEM_readLE16(ip+pos); pos+=2; break;
  ------------------
  |  Branch (528:13): [True: 478, False: 2.58k]
  ------------------
  529|     55|            case 3 : dictID = MEM_readLE32(ip+pos); pos+=4; break;
  ------------------
  |  Branch (529:13): [True: 55, False: 3.00k]
  ------------------
  530|  3.06k|        }
  531|  3.06k|        switch(fcsID)
  532|  3.06k|        {
  533|      0|            default:
  ------------------
  |  Branch (533:13): [True: 0, False: 3.06k]
  ------------------
  534|      0|                assert(0);  /* impossible */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  535|      0|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  536|  2.39k|            case 0 : if (singleSegment) frameContentSize = ip[pos]; break;
  ------------------
  |  Branch (536:13): [True: 2.39k, False: 666]
  |  Branch (536:26): [True: 15, False: 2.38k]
  ------------------
  537|     26|            case 1 : frameContentSize = MEM_readLE16(ip+pos)+256; break;
  ------------------
  |  Branch (537:13): [True: 26, False: 3.03k]
  ------------------
  538|     90|            case 2 : frameContentSize = MEM_readLE32(ip+pos); break;
  ------------------
  |  Branch (538:13): [True: 90, False: 2.97k]
  ------------------
  539|    550|            case 3 : frameContentSize = MEM_readLE64(ip+pos); break;
  ------------------
  |  Branch (539:13): [True: 550, False: 2.51k]
  ------------------
  540|  3.06k|        }
  541|  3.06k|        if (singleSegment) windowSize = frameContentSize;
  ------------------
  |  Branch (541:13): [True: 655, False: 2.40k]
  ------------------
  542|       |
  543|  3.06k|        zfhPtr->frameType = ZSTD_frame;
  544|  3.06k|        zfhPtr->frameContentSize = frameContentSize;
  545|  3.06k|        zfhPtr->windowSize = windowSize;
  546|  3.06k|        zfhPtr->blockSizeMax = (unsigned) MIN(windowSize, ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   54|  3.06k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 141, False: 2.92k]
  |  |  ------------------
  ------------------
  547|  3.06k|        zfhPtr->dictID = dictID;
  548|  3.06k|        zfhPtr->checksumFlag = checksumFlag;
  549|  3.06k|    }
  550|      0|    return 0;
  551|  3.06k|}
ZSTD_getFrameContentSize:
  570|  1.94k|{
  571|  1.94k|#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1)
  572|  1.94k|    if (ZSTD_isLegacy(src, srcSize)) {
  ------------------
  |  Branch (572:9): [True: 1.94k, False: 0]
  ------------------
  573|  1.94k|        unsigned long long const ret = ZSTD_getDecompressedSize_legacy(src, srcSize);
  574|  1.94k|        return ret == 0 ? ZSTD_CONTENTSIZE_UNKNOWN : ret;
  ------------------
  |  |  203|  1.76k|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (574:16): [True: 1.76k, False: 186]
  ------------------
  575|  1.94k|    }
  576|      0|#endif
  577|      0|    {   ZSTD_FrameHeader zfh;
  578|      0|        if (ZSTD_getFrameHeader(&zfh, src, srcSize) != 0)
  ------------------
  |  Branch (578:13): [True: 0, False: 0]
  ------------------
  579|      0|            return ZSTD_CONTENTSIZE_ERROR;
  ------------------
  |  |  204|      0|#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
  ------------------
  580|      0|        if (zfh.frameType == ZSTD_skippableFrame) {
  ------------------
  |  Branch (580:13): [True: 0, False: 0]
  ------------------
  581|      0|            return 0;
  582|      0|        } else {
  583|      0|            return zfh.frameContentSize;
  584|      0|    }   }
  585|      0|}
ZSTD_decompressDCtx:
 1198|  4.20k|{
 1199|  4.20k|    return ZSTD_decompress_usingDDict(dctx, dst, dstCapacity, src, srcSize, ZSTD_getDDict(dctx));
 1200|  4.20k|}
ZSTD_loadDEntropy:
 1454|    153|{
 1455|    153|    const BYTE* dictPtr = (const BYTE*)dict;
 1456|    153|    const BYTE* const dictEnd = dictPtr + dictSize;
 1457|       |
 1458|    153|    RETURN_ERROR_IF(dictSize <= 8, dictionary_corrupted, "dict is too small");
  ------------------
  |  |  114|    153|    do {                                                                       \
  |  |  115|    153|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 153]
  |  |  ------------------
  |  |  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|    153|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 153]
  |  |  ------------------
  ------------------
 1459|    153|    assert(MEM_readLE32(dict) == ZSTD_MAGIC_DICTIONARY);   /* dict must be valid */
  ------------------
  |  |   70|    153|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1460|    153|    dictPtr += 8;   /* skip header = magic + dictID */
 1461|       |
 1462|    153|    ZSTD_STATIC_ASSERT(offsetof(ZSTD_entropyDTables_t, OFTable) == offsetof(ZSTD_entropyDTables_t, LLTable) + sizeof(entropy->LLTable));
  ------------------
  |  |   43|    153|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|    153|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1463|    153|    ZSTD_STATIC_ASSERT(offsetof(ZSTD_entropyDTables_t, MLTable) == offsetof(ZSTD_entropyDTables_t, OFTable) + sizeof(entropy->OFTable));
  ------------------
  |  |   43|    153|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|    153|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1464|    153|    ZSTD_STATIC_ASSERT(sizeof(entropy->LLTable) + sizeof(entropy->OFTable) + sizeof(entropy->MLTable) >= HUF_DECOMPRESS_WORKSPACE_SIZE);
  ------------------
  |  |   43|    153|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|    153|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1465|    153|    {   void* const workspace = &entropy->LLTable;   /* use fse tables as temporary workspace; implies fse tables are grouped together */
 1466|    153|        size_t const workspaceSize = sizeof(entropy->LLTable) + sizeof(entropy->OFTable) + sizeof(entropy->MLTable);
 1467|       |#ifdef HUF_FORCE_DECOMPRESS_X1
 1468|       |        /* in minimal huffman, we always use X1 variants */
 1469|       |        size_t const hSize = HUF_readDTableX1_wksp(entropy->hufTable,
 1470|       |                                                dictPtr, dictEnd - dictPtr,
 1471|       |                                                workspace, workspaceSize, /* flags */ 0);
 1472|       |#else
 1473|    153|        size_t const hSize = HUF_readDTableX2_wksp(entropy->hufTable,
 1474|    153|                                                dictPtr, (size_t)(dictEnd - dictPtr),
 1475|    153|                                                workspace, workspaceSize, /* flags */ 0);
 1476|    153|#endif
 1477|    153|        RETURN_ERROR_IF(HUF_isError(hSize), dictionary_corrupted, "");
  ------------------
  |  |  114|    153|    do {                                                                       \
  |  |  115|    153|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 37, False: 116]
  |  |  ------------------
  |  |  116|     37|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     37|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 37]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     37|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     37|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     37|    do {                                           \
  |  |  |  |   99|     37|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 37]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     37|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 37]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     37|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     37|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 37]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     37|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     37|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 37]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     37|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     37|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     37|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     37|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     37|        }                                                                      \
  |  |  123|    153|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 116]
  |  |  ------------------
  ------------------
 1478|    116|        dictPtr += hSize;
 1479|    116|    }
 1480|       |
 1481|      0|    {   short offcodeNCount[MaxOff+1];
 1482|    116|        unsigned offcodeMaxValue = MaxOff, offcodeLog;
  ------------------
  |  |  106|    116|#define MaxOff  31
  ------------------
 1483|    116|        size_t const offcodeHeaderSize = FSE_readNCount(offcodeNCount, &offcodeMaxValue, &offcodeLog, dictPtr, (size_t)(dictEnd-dictPtr));
 1484|    116|        RETURN_ERROR_IF(FSE_isError(offcodeHeaderSize), dictionary_corrupted, "");
  ------------------
  |  |  114|    116|    do {                                                                       \
  |  |  115|    116|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 12, False: 104]
  |  |  ------------------
  |  |  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|    116|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 104]
  |  |  ------------------
  ------------------
 1485|    104|        RETURN_ERROR_IF(offcodeMaxValue > MaxOff, dictionary_corrupted, "");
  ------------------
  |  |  114|    104|    do {                                                                       \
  |  |  115|    104|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 104]
  |  |  ------------------
  |  |  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|    104|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 104]
  |  |  ------------------
  ------------------
 1486|    104|        RETURN_ERROR_IF(offcodeLog > OffFSELog, dictionary_corrupted, "");
  ------------------
  |  |  114|    104|    do {                                                                       \
  |  |  115|    104|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2, False: 102]
  |  |  ------------------
  |  |  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|    104|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 102]
  |  |  ------------------
  ------------------
 1487|    102|        ZSTD_buildFSETable( entropy->OFTable,
 1488|    102|                            offcodeNCount, offcodeMaxValue,
 1489|    102|                            OF_base, OF_bits,
 1490|    102|                            offcodeLog,
 1491|    102|                            entropy->workspace, sizeof(entropy->workspace),
 1492|    102|                            /* bmi2 */0);
 1493|    102|        dictPtr += offcodeHeaderSize;
 1494|    102|    }
 1495|       |
 1496|      0|    {   short matchlengthNCount[MaxML+1];
 1497|    102|        unsigned matchlengthMaxValue = MaxML, matchlengthLog;
  ------------------
  |  |  103|    102|#define MaxML   52
  ------------------
 1498|    102|        size_t const matchlengthHeaderSize = FSE_readNCount(matchlengthNCount, &matchlengthMaxValue, &matchlengthLog, dictPtr, (size_t)(dictEnd-dictPtr));
 1499|    102|        RETURN_ERROR_IF(FSE_isError(matchlengthHeaderSize), dictionary_corrupted, "");
  ------------------
  |  |  114|    102|    do {                                                                       \
  |  |  115|    102|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 8, False: 94]
  |  |  ------------------
  |  |  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|    102|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 94]
  |  |  ------------------
  ------------------
 1500|     94|        RETURN_ERROR_IF(matchlengthMaxValue > MaxML, dictionary_corrupted, "");
  ------------------
  |  |  114|     94|    do {                                                                       \
  |  |  115|     94|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 94]
  |  |  ------------------
  |  |  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|     94|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 94]
  |  |  ------------------
  ------------------
 1501|     94|        RETURN_ERROR_IF(matchlengthLog > MLFSELog, dictionary_corrupted, "");
  ------------------
  |  |  114|     94|    do {                                                                       \
  |  |  115|     94|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 91]
  |  |  ------------------
  |  |  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|     94|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 91]
  |  |  ------------------
  ------------------
 1502|     91|        ZSTD_buildFSETable( entropy->MLTable,
 1503|     91|                            matchlengthNCount, matchlengthMaxValue,
 1504|     91|                            ML_base, ML_bits,
 1505|     91|                            matchlengthLog,
 1506|     91|                            entropy->workspace, sizeof(entropy->workspace),
 1507|     91|                            /* bmi2 */ 0);
 1508|     91|        dictPtr += matchlengthHeaderSize;
 1509|     91|    }
 1510|       |
 1511|      0|    {   short litlengthNCount[MaxLL+1];
 1512|     91|        unsigned litlengthMaxValue = MaxLL, litlengthLog;
  ------------------
  |  |  104|     91|#define MaxLL   35
  ------------------
 1513|     91|        size_t const litlengthHeaderSize = FSE_readNCount(litlengthNCount, &litlengthMaxValue, &litlengthLog, dictPtr, (size_t)(dictEnd-dictPtr));
 1514|     91|        RETURN_ERROR_IF(FSE_isError(litlengthHeaderSize), dictionary_corrupted, "");
  ------------------
  |  |  114|     91|    do {                                                                       \
  |  |  115|     91|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 8, False: 83]
  |  |  ------------------
  |  |  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|     91|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 83]
  |  |  ------------------
  ------------------
 1515|     83|        RETURN_ERROR_IF(litlengthMaxValue > MaxLL, dictionary_corrupted, "");
  ------------------
  |  |  114|     83|    do {                                                                       \
  |  |  115|     83|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 83]
  |  |  ------------------
  |  |  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|     83|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 83]
  |  |  ------------------
  ------------------
 1516|     83|        RETURN_ERROR_IF(litlengthLog > LLFSELog, dictionary_corrupted, "");
  ------------------
  |  |  114|     83|    do {                                                                       \
  |  |  115|     83|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 82]
  |  |  ------------------
  |  |  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|     83|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 82]
  |  |  ------------------
  ------------------
 1517|     82|        ZSTD_buildFSETable( entropy->LLTable,
 1518|     82|                            litlengthNCount, litlengthMaxValue,
 1519|     82|                            LL_base, LL_bits,
 1520|     82|                            litlengthLog,
 1521|     82|                            entropy->workspace, sizeof(entropy->workspace),
 1522|     82|                            /* bmi2 */ 0);
 1523|     82|        dictPtr += litlengthHeaderSize;
 1524|     82|    }
 1525|       |
 1526|     82|    RETURN_ERROR_IF(dictPtr+12 > dictEnd, dictionary_corrupted, "");
  ------------------
  |  |  114|     82|    do {                                                                       \
  |  |  115|     82|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 10, False: 72]
  |  |  ------------------
  |  |  116|     10|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     10|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     10|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     10|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     10|    do {                                           \
  |  |  |  |   99|     10|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     10|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     10|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     10|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     10|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     10|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     10|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     10|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     10|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     10|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     10|        }                                                                      \
  |  |  123|     82|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 72]
  |  |  ------------------
  ------------------
 1527|     72|    {   int i;
 1528|     72|        size_t const dictContentSize = (size_t)(dictEnd - (dictPtr+12));
 1529|    132|        for (i=0; i<3; i++) {
  ------------------
  |  Branch (1529:19): [True: 131, False: 1]
  ------------------
 1530|    131|            U32 const rep = MEM_readLE32(dictPtr); dictPtr += 4;
 1531|    131|            RETURN_ERROR_IF(rep==0 || rep > dictContentSize,
  ------------------
  |  |  114|    131|    do {                                                                       \
  |  |  115|    388|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 5, False: 126]
  |  |  |  Branch (115:13): [True: 66, False: 60]
  |  |  ------------------
  |  |  116|     71|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     71|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 71]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     71|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     71|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     71|    do {                                           \
  |  |  |  |   99|     71|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 71]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     71|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 71]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     71|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     71|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 71]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     71|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     71|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 71]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     71|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     71|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     71|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     71|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     71|        }                                                                      \
  |  |  123|    131|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 60]
  |  |  ------------------
  ------------------
 1532|    131|                            dictionary_corrupted, "");
 1533|     60|            entropy->rep[i] = rep;
 1534|     60|    }   }
 1535|       |
 1536|      1|    return (size_t)(dictPtr - (const BYTE*)dict);
 1537|     72|}
ZSTD_decompressBegin:
 1561|  3.50k|{
 1562|  3.50k|    assert(dctx != NULL);
  ------------------
  |  |   70|  3.50k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1563|  3.50k|#if ZSTD_TRACE
 1564|  3.50k|    dctx->traceCtx = (ZSTD_trace_decompress_begin != NULL) ? ZSTD_trace_decompress_begin(dctx) : 0;
  ------------------
  |  Branch (1564:22): [True: 0, False: 3.50k]
  ------------------
 1565|  3.50k|#endif
 1566|  3.50k|    dctx->expected = ZSTD_startingInputLength(dctx->format);  /* dctx->format must be properly set */
 1567|  3.50k|    dctx->stage = ZSTDds_getFrameHeaderSize;
 1568|  3.50k|    dctx->processedCSize = 0;
 1569|  3.50k|    dctx->decodedSize = 0;
 1570|  3.50k|    dctx->previousDstEnd = NULL;
 1571|  3.50k|    dctx->prefixStart = NULL;
 1572|  3.50k|    dctx->virtualStart = NULL;
 1573|  3.50k|    dctx->dictEnd = NULL;
 1574|  3.50k|    dctx->entropy.hufTable[0] = (HUF_DTable)((ZSTD_HUFFDTABLE_CAPACITY_LOG)*0x1000001);  /* cover both little and big endian */
  ------------------
  |  |   78|  3.50k|#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
  ------------------
 1575|  3.50k|    dctx->litEntropy = dctx->fseEntropy = 0;
 1576|  3.50k|    dctx->dictID = 0;
 1577|  3.50k|    dctx->bType = bt_reserved;
 1578|  3.50k|    dctx->isFrameDecompression = 1;
 1579|  3.50k|    ZSTD_STATIC_ASSERT(sizeof(dctx->entropy.rep) == sizeof(repStartValue));
  ------------------
  |  |   43|  3.50k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  3.50k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1580|  3.50k|    ZSTD_memcpy(dctx->entropy.rep, repStartValue, sizeof(repStartValue));  /* initial repcodes */
  ------------------
  |  |   44|  3.50k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1581|  3.50k|    dctx->LLTptr = dctx->entropy.LLTable;
 1582|  3.50k|    dctx->MLTptr = dctx->entropy.MLTable;
 1583|  3.50k|    dctx->OFTptr = dctx->entropy.OFTable;
 1584|  3.50k|    dctx->HUFptr = dctx->entropy.hufTable;
 1585|  3.50k|    return 0;
 1586|  3.50k|}
ZSTD_decompressBegin_usingDict:
 1589|  1.98k|{
 1590|  1.98k|    FORWARD_IF_ERROR( ZSTD_decompressBegin(dctx) , "");
  ------------------
  |  |  146|  1.98k|    do {                                                                           \
  |  |  147|  1.98k|        size_t const err_code = (err);                                             \
  |  |  148|  1.98k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 1.98k]
  |  |  ------------------
  |  |  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.98k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
 1591|  1.98k|    if (dict && dictSize)
  ------------------
  |  Branch (1591:9): [True: 0, False: 1.98k]
  |  Branch (1591:17): [True: 0, False: 0]
  ------------------
 1592|      0|        RETURN_ERROR_IF(
  ------------------
  |  |  114|      0|    do {                                                                       \
  |  |  115|      0|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1593|  1.98k|            ZSTD_isError(ZSTD_decompress_insertDictionary(dctx, dict, dictSize)),
 1594|  1.98k|            dictionary_corrupted, "");
 1595|  1.98k|    return 0;
 1596|  1.98k|}
ZSTD_decompressBegin_usingDDict:
 1602|  1.52k|{
 1603|  1.52k|    DEBUGLOG(4, "ZSTD_decompressBegin_usingDDict");
  ------------------
  |  |  104|  1.52k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
 1604|  1.52k|    assert(dctx != NULL);
  ------------------
  |  |   70|  1.52k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1605|  1.52k|    if (ddict) {
  ------------------
  |  Branch (1605:9): [True: 1.52k, False: 0]
  ------------------
 1606|  1.52k|        const char* const dictStart = (const char*)ZSTD_DDict_dictContent(ddict);
 1607|  1.52k|        size_t const dictSize = ZSTD_DDict_dictSize(ddict);
 1608|  1.52k|        const void* const dictEnd = dictStart + dictSize;
 1609|  1.52k|        dctx->ddictIsCold = (dctx->dictEnd != dictEnd);
 1610|  1.52k|        DEBUGLOG(4, "DDict is %s",
  ------------------
  |  |  104|  1.52k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
 1611|  1.52k|                    dctx->ddictIsCold ? "~cold~" : "hot!");
 1612|  1.52k|    }
 1613|  1.52k|    FORWARD_IF_ERROR( ZSTD_decompressBegin(dctx) , "");
  ------------------
  |  |  146|  1.52k|    do {                                                                           \
  |  |  147|  1.52k|        size_t const err_code = (err);                                             \
  |  |  148|  1.52k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 1.52k]
  |  |  ------------------
  |  |  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.52k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
 1614|  1.52k|    if (ddict) {   /* NULL ddict is equivalent to no dictionary */
  ------------------
  |  Branch (1614:9): [True: 1.52k, False: 0]
  ------------------
 1615|  1.52k|        ZSTD_copyDDictParameters(dctx, ddict);
 1616|  1.52k|    }
 1617|  1.52k|    return 0;
 1618|  1.52k|}
ZSTD_decompress_usingDDict:
 1660|  6.52k|{
 1661|       |    /* pass content and size in case legacy frames are encountered */
 1662|  6.52k|    return ZSTD_decompressMultiFrame(dctx, dst, dstCapacity, src, srcSize,
 1663|       |                                     NULL, 0,
 1664|  6.52k|                                     ddict);
 1665|  6.52k|}
zstd_decompress.c:ZSTD_initDCtx_internal:
  253|  6.47k|{
  254|  6.47k|    dctx->staticSize  = 0;
  255|  6.47k|    dctx->ddict       = NULL;
  256|  6.47k|    dctx->ddictLocal  = NULL;
  257|  6.47k|    dctx->dictEnd     = NULL;
  258|  6.47k|    dctx->ddictIsCold = 0;
  259|  6.47k|    dctx->dictUses = ZSTD_dont_use;
  260|  6.47k|    dctx->inBuff      = NULL;
  261|  6.47k|    dctx->inBuffSize  = 0;
  262|  6.47k|    dctx->outBuffSize = 0;
  263|  6.47k|    dctx->streamStage = zdss_init;
  264|  6.47k|#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1)
  265|  6.47k|    dctx->legacyContext = NULL;
  266|  6.47k|    dctx->previousLegacyVersion = 0;
  267|  6.47k|#endif
  268|  6.47k|    dctx->noForwardProgress = 0;
  269|  6.47k|    dctx->oversizedDuration = 0;
  270|  6.47k|    dctx->isFrameDecompression = 1;
  271|  6.47k|#if DYNAMIC_BMI2
  272|  6.47k|    dctx->bmi2 = ZSTD_cpuSupportsBmi2();
  273|  6.47k|#endif
  274|  6.47k|    dctx->ddictSet = NULL;
  275|  6.47k|    ZSTD_DCtx_resetParameters(dctx);
  276|  6.47k|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  277|       |    dctx->dictContentEndForFuzzing = NULL;
  278|  6.47k|#endif
  279|  6.47k|}
zstd_decompress.c:ZSTD_createDCtx_internal:
  294|  6.47k|static ZSTD_DCtx* ZSTD_createDCtx_internal(ZSTD_customMem customMem) {
  295|  6.47k|    if ((!customMem.customAlloc) ^ (!customMem.customFree)) return NULL;
  ------------------
  |  Branch (295:9): [True: 0, False: 6.47k]
  ------------------
  296|       |
  297|  6.47k|    {   ZSTD_DCtx* const dctx = (ZSTD_DCtx*)ZSTD_customMalloc(sizeof(*dctx), customMem);
  298|  6.47k|        if (!dctx) return NULL;
  ------------------
  |  Branch (298:13): [True: 0, False: 6.47k]
  ------------------
  299|  6.47k|        dctx->customMem = customMem;
  300|  6.47k|        ZSTD_initDCtx_internal(dctx);
  301|  6.47k|        return dctx;
  302|  6.47k|    }
  303|  6.47k|}
zstd_decompress.c:ZSTD_clearDict:
  317|  10.6k|{
  318|  10.6k|    ZSTD_freeDDict(dctx->ddictLocal);
  319|  10.6k|    dctx->ddictLocal = NULL;
  320|       |    dctx->ddict = NULL;
  321|  10.6k|    dctx->dictUses = ZSTD_dont_use;
  322|  10.6k|}
zstd_decompress.c:ZSTD_frameHeaderSize_internal:
  417|  6.52k|{
  418|  6.52k|    size_t const minInputSize = ZSTD_startingInputLength(format);
  419|  6.52k|    RETURN_ERROR_IF(srcSize < minInputSize, srcSize_wrong, "");
  ------------------
  |  |  114|  6.52k|    do {                                                                       \
  |  |  115|  6.52k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 6.52k]
  |  |  ------------------
  |  |  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.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 6.52k]
  |  |  ------------------
  ------------------
  420|       |
  421|  6.52k|    {   BYTE const fhd = ((const BYTE*)src)[minInputSize-1];
  422|  6.52k|        U32 const dictID= fhd & 3;
  423|  6.52k|        U32 const singleSegment = (fhd >> 5) & 1;
  424|  6.52k|        U32 const fcsId = fhd >> 6;
  425|  6.52k|        return minInputSize + !singleSegment
  426|  6.52k|             + ZSTD_did_fieldSize[dictID] + ZSTD_fcs_fieldSize[fcsId]
  427|  6.52k|             + (singleSegment && !fcsId);
  ------------------
  |  Branch (427:17): [True: 1.43k, False: 5.09k]
  |  Branch (427:34): [True: 84, False: 1.34k]
  ------------------
  428|  6.52k|    }
  429|  6.52k|}
zstd_decompress.c:ZSTD_startingInputLength:
  233|  21.9k|{
  234|  21.9k|    size_t const startingInputLength = ZSTD_FRAMEHEADERSIZE_PREFIX(format);
  ------------------
  |  | 1257|  21.9k|#define ZSTD_FRAMEHEADERSIZE_PREFIX(format) ((format) == ZSTD_f_zstd1 ? 5 : 1)   /* minimum input size required to query frame header size */
  |  |  ------------------
  |  |  |  Branch (1257:46): [True: 21.9k, False: 0]
  |  |  ------------------
  ------------------
  235|       |    /* only supports formats ZSTD_f_zstd1 and ZSTD_f_zstd1_magicless */
  236|  21.9k|    assert( (format == ZSTD_f_zstd1) || (format == ZSTD_f_zstd1_magicless) );
  ------------------
  |  |   70|  21.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  237|  21.9k|    return startingInputLength;
  238|  21.9k|}
zstd_decompress.c:readSkippableFrameSize:
  588|      4|{
  589|      4|    size_t const skippableHeaderSize = ZSTD_SKIPPABLEHEADERSIZE;
  ------------------
  |  | 1260|      4|#define ZSTD_SKIPPABLEHEADERSIZE    8
  ------------------
  590|      4|    U32 sizeU32;
  591|       |
  592|      4|    RETURN_ERROR_IF(srcSize < ZSTD_SKIPPABLEHEADERSIZE, srcSize_wrong, "");
  ------------------
  |  |  114|      4|    do {                                                                       \
  |  |  115|      4|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|      4|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4]
  |  |  ------------------
  ------------------
  593|       |
  594|      4|    sizeU32 = MEM_readLE32((BYTE const*)src + ZSTD_FRAMEIDSIZE);
  ------------------
  |  |   82|      4|#define ZSTD_FRAMEIDSIZE 4   /* magic number size */
  ------------------
  595|      4|    RETURN_ERROR_IF((U32)(sizeU32 + ZSTD_SKIPPABLEHEADERSIZE) < sizeU32,
  ------------------
  |  |  114|      4|    do {                                                                       \
  |  |  115|      4|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|      4|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4]
  |  |  ------------------
  ------------------
  596|      4|                    frameParameter_unsupported, "");
  597|      4|    {   size_t const skippableSize = skippableHeaderSize + sizeU32;
  598|      4|        RETURN_ERROR_IF(skippableSize > srcSize, srcSize_wrong, "");
  ------------------
  |  |  114|      4|    do {                                                                       \
  |  |  115|      4|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 4, False: 0]
  |  |  ------------------
  |  |  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|      4|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  599|      0|        return skippableSize;
  600|      4|    }
  601|      4|}
zstd_decompress.c:ZSTD_decompressMultiFrame:
 1075|  6.52k|{
 1076|  6.52k|    void* const dststart = dst;
 1077|  6.52k|    int moreThan1Frame = 0;
 1078|       |
 1079|  6.52k|    DEBUGLOG(5, "ZSTD_decompressMultiFrame");
  ------------------
  |  |  104|  6.52k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 6.52k]
  |  |  ------------------
  ------------------
 1080|  6.52k|    assert(dict==NULL || ddict==NULL);  /* either dict or ddict set, not both */
  ------------------
  |  |   70|  6.52k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1081|       |
 1082|  6.52k|    if (ddict) {
  ------------------
  |  Branch (1082:9): [True: 2.31k, False: 4.20k]
  ------------------
 1083|  2.31k|        dict = ZSTD_DDict_dictContent(ddict);
 1084|  2.31k|        dictSize = ZSTD_DDict_dictSize(ddict);
 1085|  2.31k|    }
 1086|       |
 1087|  8.51k|    while (srcSize >= ZSTD_startingInputLength(dctx->format)) {
  ------------------
  |  Branch (1087:12): [True: 8.27k, False: 237]
  ------------------
 1088|       |
 1089|  8.27k|#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1)
 1090|  8.27k|        if (dctx->format == ZSTD_f_zstd1 && ZSTD_isLegacy(src, srcSize)) {
  ------------------
  |  Branch (1090:13): [True: 8.27k, False: 0]
  |  Branch (1090:45): [True: 4.76k, False: 3.51k]
  ------------------
 1091|  4.76k|            size_t decodedSize;
 1092|  4.76k|            size_t const frameSize = ZSTD_findFrameCompressedSizeLegacy(src, srcSize);
 1093|  4.76k|            if (ZSTD_isError(frameSize)) return frameSize;
  ------------------
  |  |   44|  4.76k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1093:17): [True: 175, False: 4.58k]
  ------------------
 1094|  4.58k|            RETURN_ERROR_IF(dctx->staticSize, memory_allocation,
  ------------------
  |  |  114|  4.58k|    do {                                                                       \
  |  |  115|  4.58k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.58k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  4.58k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.58k]
  |  |  ------------------
  ------------------
 1095|  4.58k|                "legacy support is not compatible with static dctx");
 1096|       |
 1097|  4.58k|            decodedSize = ZSTD_decompressLegacy(dst, dstCapacity, src, frameSize, dict, dictSize);
 1098|  4.58k|            if (ZSTD_isError(decodedSize)) return decodedSize;
  ------------------
  |  |   44|  4.58k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1098:17): [True: 2.64k, False: 1.94k]
  ------------------
 1099|       |
 1100|  1.94k|            {
 1101|  1.94k|                unsigned long long const expectedSize = ZSTD_getFrameContentSize(src, srcSize);
 1102|  1.94k|                RETURN_ERROR_IF(expectedSize == ZSTD_CONTENTSIZE_ERROR, corruption_detected, "Corrupted frame header!");
  ------------------
  |  |  114|  1.94k|    do {                                                                       \
  |  |  115|  1.94k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 1.94k]
  |  |  ------------------
  |  |  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.94k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.94k]
  |  |  ------------------
  ------------------
 1103|  1.94k|                if (expectedSize != ZSTD_CONTENTSIZE_UNKNOWN) {
  ------------------
  |  |  203|  1.94k|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (1103:21): [True: 185, False: 1.76k]
  ------------------
 1104|    185|                    RETURN_ERROR_IF(expectedSize != decodedSize, corruption_detected,
  ------------------
  |  |  114|    185|    do {                                                                       \
  |  |  115|    185|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 184, False: 1]
  |  |  ------------------
  |  |  116|    184|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    184|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 184]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    184|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    184|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    184|    do {                                           \
  |  |  |  |   99|    184|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 184]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    184|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 184]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    184|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    184|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 184]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    184|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    184|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 184]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    184|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    184|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    184|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    184|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    184|        }                                                                      \
  |  |  123|    185|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
 1105|    185|                        "Frame header size does not match decoded size!");
 1106|    185|                }
 1107|  1.94k|            }
 1108|       |
 1109|  1.76k|            assert(decodedSize <= dstCapacity);
  ------------------
  |  |   70|  1.76k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1110|  1.76k|            dst = (BYTE*)dst + decodedSize;
 1111|  1.76k|            dstCapacity -= decodedSize;
 1112|       |
 1113|  1.76k|            src = (const BYTE*)src + frameSize;
 1114|  1.76k|            srcSize -= frameSize;
 1115|       |
 1116|  1.76k|            continue;
 1117|  1.94k|        }
 1118|  3.51k|#endif
 1119|       |
 1120|  3.51k|        if (dctx->format == ZSTD_f_zstd1 && srcSize >= 4) {
  ------------------
  |  Branch (1120:13): [True: 3.51k, False: 0]
  |  Branch (1120:45): [True: 3.51k, False: 0]
  ------------------
 1121|  3.51k|            U32 const magicNumber = MEM_readLE32(src);
 1122|  3.51k|            DEBUGLOG(5, "reading magic number %08X", (unsigned)magicNumber);
  ------------------
  |  |  104|  3.51k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.51k]
  |  |  ------------------
  ------------------
 1123|  3.51k|            if ((magicNumber & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  145|  3.51k|#define ZSTD_MAGIC_SKIPPABLE_MASK   0xFFFFFFF0
  ------------------
                          if ((magicNumber & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  144|  3.51k|#define ZSTD_MAGIC_SKIPPABLE_START  0x184D2A50    /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */
  ------------------
  |  Branch (1123:17): [True: 4, False: 3.50k]
  ------------------
 1124|       |                /* skippable frame detected : skip it */
 1125|      4|                size_t const skippableSize = readSkippableFrameSize(src, srcSize);
 1126|      4|                FORWARD_IF_ERROR(skippableSize, "invalid skippable frame");
  ------------------
  |  |  146|      4|    do {                                                                           \
  |  |  147|      4|        size_t const err_code = (err);                                             \
  |  |  148|      4|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 4, False: 0]
  |  |  ------------------
  |  |  149|      4|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      4|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      4|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      4|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      4|            return err_code;                                                       \
  |  |  155|      4|        }                                                                          \
  |  |  156|      4|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1127|      0|                assert(skippableSize <= srcSize);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1128|       |
 1129|      0|                src = (const BYTE *)src + skippableSize;
 1130|      0|                srcSize -= skippableSize;
 1131|      0|                continue; /* check next frame */
 1132|      4|        }   }
 1133|       |
 1134|  3.50k|        if (ddict) {
  ------------------
  |  Branch (1134:13): [True: 1.52k, False: 1.98k]
  ------------------
 1135|       |            /* we were called from ZSTD_decompress_usingDDict */
 1136|  1.52k|            FORWARD_IF_ERROR(ZSTD_decompressBegin_usingDDict(dctx, ddict), "");
  ------------------
  |  |  146|  1.52k|    do {                                                                           \
  |  |  147|  1.52k|        size_t const err_code = (err);                                             \
  |  |  148|  1.52k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 1.52k]
  |  |  ------------------
  |  |  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.52k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 1.52k]
  |  |  ------------------
  ------------------
 1137|  1.98k|        } else {
 1138|       |            /* this will initialize correctly with no dict if dict == NULL, so
 1139|       |             * use this in all cases but ddict */
 1140|  1.98k|            FORWARD_IF_ERROR(ZSTD_decompressBegin_usingDict(dctx, dict, dictSize), "");
  ------------------
  |  |  146|  1.98k|    do {                                                                           \
  |  |  147|  1.98k|        size_t const err_code = (err);                                             \
  |  |  148|  1.98k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 1.98k]
  |  |  ------------------
  |  |  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.98k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
 1141|  1.98k|        }
 1142|  3.50k|        ZSTD_checkContinuity(dctx, dst, dstCapacity);
 1143|       |
 1144|  3.50k|        {   const size_t res = ZSTD_decompressFrame(dctx, dst, dstCapacity,
 1145|  3.50k|                                                    &src, &srcSize);
 1146|  3.50k|            RETURN_ERROR_IF(
  ------------------
  |  |  114|  3.50k|    do {                                                                       \
  |  |  115|  7.39k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 381, False: 3.12k]
  |  |  |  Branch (115:13): [True: 31, False: 350]
  |  |  ------------------
  |  |  116|     31|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     31|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 31]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     31|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     31|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     31|    do {                                           \
  |  |  |  |   99|     31|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 31]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     31|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 31]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     31|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     31|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 31]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     31|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     31|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 31]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     31|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     31|        }                                                                      \
  |  |  123|  3.50k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.47k]
  |  |  ------------------
  ------------------
 1147|  3.50k|                (ZSTD_getErrorCode(res) == ZSTD_error_prefix_unknown)
 1148|  3.50k|             && (moreThan1Frame==1),
 1149|  3.50k|                srcSize_wrong,
 1150|  3.50k|                "At least one frame successfully completed, "
 1151|  3.50k|                "but following bytes are garbage: "
 1152|  3.50k|                "it's more likely to be a srcSize error, "
 1153|  3.50k|                "specifying more input bytes than size of frame(s). "
 1154|  3.50k|                "Note: one could be unlucky, it might be a corruption error instead, "
 1155|  3.50k|                "happening right at the place where we expect zstd magic bytes. "
 1156|  3.50k|                "But this is _much_ less likely than a srcSize field error.");
 1157|  3.47k|            if (ZSTD_isError(res)) return res;
  ------------------
  |  |   44|  3.47k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1157:17): [True: 3.24k, False: 227]
  ------------------
 1158|    227|            assert(res <= dstCapacity);
  ------------------
  |  |   70|    227|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1159|    227|            if (res != 0)
  ------------------
  |  Branch (1159:17): [True: 223, False: 4]
  ------------------
 1160|    223|                dst = (BYTE*)dst + res;
 1161|    227|            dstCapacity -= res;
 1162|    227|        }
 1163|      0|        moreThan1Frame = 1;
 1164|    227|    }  /* while (srcSize >= ZSTD_frameHeaderSize_prefix) */
 1165|       |
 1166|    237|    RETURN_ERROR_IF(srcSize, srcSize_wrong, "input not entirely consumed");
  ------------------
  |  |  114|    237|    do {                                                                       \
  |  |  115|    237|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 127, False: 110]
  |  |  ------------------
  |  |  116|    127|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    127|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 127]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    127|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    127|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    127|    do {                                           \
  |  |  |  |   99|    127|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 127]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    127|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 127]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    127|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    127|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 127]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    127|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    127|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 127]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    127|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    127|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    127|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    127|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    127|        }                                                                      \
  |  |  123|    237|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 110]
  |  |  ------------------
  ------------------
 1167|       |
 1168|    110|    return (size_t)((BYTE*)dst - (BYTE*)dststart);
 1169|    237|}
zstd_decompress.c:ZSTD_decompressFrame:
  956|  3.50k|{
  957|  3.50k|    const BYTE* const istart = (const BYTE*)(*srcPtr);
  958|  3.50k|    const BYTE* ip = istart;
  959|  3.50k|    BYTE* const ostart = (BYTE*)dst;
  960|  3.50k|    BYTE* const oend = dstCapacity != 0 ? ostart + dstCapacity : ostart;
  ------------------
  |  Branch (960:24): [True: 3.50k, False: 1]
  ------------------
  961|  3.50k|    BYTE* op = ostart;
  962|  3.50k|    size_t remainingSrcSize = *srcSizePtr;
  963|       |
  964|  3.50k|    DEBUGLOG(4, "ZSTD_decompressFrame (srcSize:%i)", (int)*srcSizePtr);
  ------------------
  |  |  104|  3.50k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.50k]
  |  |  ------------------
  ------------------
  965|       |
  966|       |    /* check */
  967|  3.50k|    RETURN_ERROR_IF(
  ------------------
  |  |  114|  3.50k|    do {                                                                       \
  |  |  115|  10.5k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3.50k, False: 0]
  |  |  |  Branch (115:13): [True: 49, False: 3.45k]
  |  |  ------------------
  |  |  116|     49|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     49|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 49]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     49|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     49|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     49|    do {                                           \
  |  |  |  |   99|     49|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 49]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     49|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 49]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     49|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     49|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 49]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     49|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     49|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 49]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     49|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     49|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     49|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     49|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     49|        }                                                                      \
  |  |  123|  3.50k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.45k]
  |  |  ------------------
  ------------------
  968|  3.50k|        remainingSrcSize < ZSTD_FRAMEHEADERSIZE_MIN(dctx->format)+ZSTD_blockHeaderSize,
  969|  3.50k|        srcSize_wrong, "");
  970|       |
  971|       |    /* Frame Header */
  972|  3.45k|    {   size_t const frameHeaderSize = ZSTD_frameHeaderSize_internal(
  973|  3.45k|                ip, ZSTD_FRAMEHEADERSIZE_PREFIX(dctx->format), dctx->format);
  ------------------
  |  | 1257|  3.45k|#define ZSTD_FRAMEHEADERSIZE_PREFIX(format) ((format) == ZSTD_f_zstd1 ? 5 : 1)   /* minimum input size required to query frame header size */
  |  |  ------------------
  |  |  |  Branch (1257:46): [True: 3.45k, False: 0]
  |  |  ------------------
  ------------------
  974|  3.45k|        if (ZSTD_isError(frameHeaderSize)) return frameHeaderSize;
  ------------------
  |  |   44|  3.45k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (974:13): [True: 0, False: 3.45k]
  ------------------
  975|  3.45k|        RETURN_ERROR_IF(remainingSrcSize < frameHeaderSize+ZSTD_blockHeaderSize,
  ------------------
  |  |  114|  3.45k|    do {                                                                       \
  |  |  115|  3.45k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 9, False: 3.44k]
  |  |  ------------------
  |  |  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|  3.45k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.44k]
  |  |  ------------------
  ------------------
  976|  3.45k|                        srcSize_wrong, "");
  977|  3.44k|        FORWARD_IF_ERROR( ZSTD_decodeFrameHeader(dctx, ip, frameHeaderSize) , "");
  ------------------
  |  |  146|  3.44k|    do {                                                                           \
  |  |  147|  3.44k|        size_t const err_code = (err);                                             \
  |  |  148|  3.44k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 385, False: 3.06k]
  |  |  ------------------
  |  |  149|    385|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|    385|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 385]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|    385|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|    385|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|    385|    do {                                           \
  |  |  |  |   99|    385|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 385]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    385|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 385]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|    385|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|    385|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 385]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|    385|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|    385|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 385]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|    385|            return err_code;                                                       \
  |  |  155|    385|        }                                                                          \
  |  |  156|  3.44k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 3.06k]
  |  |  ------------------
  ------------------
  978|  3.06k|        ip += frameHeaderSize; remainingSrcSize -= frameHeaderSize;
  979|  3.06k|    }
  980|       |
  981|       |    /* Shrink the blockSizeMax if enabled */
  982|  3.06k|    if (dctx->maxBlockSizeParam != 0)
  ------------------
  |  Branch (982:9): [True: 0, False: 3.06k]
  ------------------
  983|      0|        dctx->fParams.blockSizeMax = MIN(dctx->fParams.blockSizeMax, (unsigned)dctx->maxBlockSizeParam);
  ------------------
  |  |   54|      0|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  984|       |
  985|       |    /* Loop on each block */
  986|  4.97k|    while (1) {
  ------------------
  |  Branch (986:12): [True: 4.97k, Folded]
  ------------------
  987|  4.97k|        BYTE* oBlockEnd = oend;
  988|  4.97k|        size_t decodedSize;
  989|  4.97k|        blockProperties_t blockProperties;
  990|  4.97k|        size_t const cBlockSize = ZSTD_getcBlockSize(ip, remainingSrcSize, &blockProperties);
  991|  4.97k|        if (ZSTD_isError(cBlockSize)) return cBlockSize;
  ------------------
  |  |   44|  4.97k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (991:13): [True: 37, False: 4.94k]
  ------------------
  992|       |
  993|  4.94k|        ip += ZSTD_blockHeaderSize;
  994|  4.94k|        remainingSrcSize -= ZSTD_blockHeaderSize;
  995|  4.94k|        RETURN_ERROR_IF(cBlockSize > remainingSrcSize, srcSize_wrong, "");
  ------------------
  |  |  114|  4.94k|    do {                                                                       \
  |  |  115|  4.94k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 57, False: 4.88k]
  |  |  ------------------
  |  |  116|     57|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     57|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     57|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     57|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     57|    do {                                           \
  |  |  |  |   99|     57|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 57]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     57|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     57|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     57|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     57|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     57|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     57|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     57|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     57|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     57|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     57|        }                                                                      \
  |  |  123|  4.94k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.88k]
  |  |  ------------------
  ------------------
  996|       |
  997|  4.88k|        if (ip >= op && ip < oBlockEnd) {
  ------------------
  |  Branch (997:13): [True: 2, False: 4.88k]
  |  Branch (997:25): [True: 0, False: 2]
  ------------------
  998|       |            /* We are decompressing in-place. Limit the output pointer so that we
  999|       |             * don't overwrite the block that we are currently reading. This will
 1000|       |             * fail decompression if the input & output pointers aren't spaced
 1001|       |             * far enough apart.
 1002|       |             *
 1003|       |             * This is important to set, even when the pointers are far enough
 1004|       |             * apart, because ZSTD_decompressBlock_internal() can decide to store
 1005|       |             * literals in the output buffer, after the block it is decompressing.
 1006|       |             * Since we don't want anything to overwrite our input, we have to tell
 1007|       |             * ZSTD_decompressBlock_internal to never write past ip.
 1008|       |             *
 1009|       |             * See ZSTD_allocateLiteralsBuffer() for reference.
 1010|       |             */
 1011|      0|            oBlockEnd = op + (ip - op);
 1012|      0|        }
 1013|       |
 1014|  4.88k|        switch(blockProperties.blockType)
 1015|  4.88k|        {
 1016|  2.88k|        case bt_compressed:
  ------------------
  |  Branch (1016:9): [True: 2.88k, False: 1.99k]
  ------------------
 1017|  2.88k|            assert(dctx->isFrameDecompression == 1);
  ------------------
  |  |   70|  2.88k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1018|  2.88k|            decodedSize = ZSTD_decompressBlock_internal(dctx, op, (size_t)(oBlockEnd-op), ip, cBlockSize, not_streaming);
 1019|  2.88k|            break;
 1020|  1.64k|        case bt_raw :
  ------------------
  |  Branch (1020:9): [True: 1.64k, False: 3.24k]
  ------------------
 1021|       |            /* Use oend instead of oBlockEnd because this function is safe to overlap. It uses memmove. */
 1022|  1.64k|            decodedSize = ZSTD_copyRawBlock(op, (size_t)(oend-op), ip, cBlockSize);
 1023|  1.64k|            break;
 1024|    354|        case bt_rle :
  ------------------
  |  Branch (1024:9): [True: 354, False: 4.52k]
  ------------------
 1025|    354|            decodedSize = ZSTD_setRleBlock(op, (size_t)(oBlockEnd-op), *ip, blockProperties.origSize);
 1026|    354|            break;
 1027|      0|        case bt_reserved :
  ------------------
  |  Branch (1027:9): [True: 0, False: 4.88k]
  ------------------
 1028|      0|        default:
  ------------------
  |  Branch (1028:9): [True: 0, False: 4.88k]
  ------------------
 1029|      0|            RETURN_ERROR(corruption_detected, "invalid block type");
  ------------------
  |  |  131|      0|    do {                                                                     \
  |  |  132|      0|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|      0|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|      0|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|      0|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|      0|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|      0|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1030|  4.88k|        }
 1031|  4.88k|        FORWARD_IF_ERROR(decodedSize, "Block decompression failure");
  ------------------
  |  |  146|  4.88k|    do {                                                                           \
  |  |  147|  4.88k|        size_t const err_code = (err);                                             \
  |  |  148|  4.88k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 2.58k, False: 2.29k]
  |  |  ------------------
  |  |  149|  2.58k|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|  2.58k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2.58k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|  2.58k|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|  2.58k|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|  2.58k|    do {                                           \
  |  |  |  |   99|  2.58k|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 2.58k]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|  2.58k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 2.58k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|  2.58k|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|  2.58k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2.58k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  2.58k|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|  2.58k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2.58k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  2.58k|            return err_code;                                                       \
  |  |  155|  2.58k|        }                                                                          \
  |  |  156|  4.88k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 2.29k]
  |  |  ------------------
  ------------------
 1032|  2.29k|        DEBUGLOG(5, "Decompressed block of dSize = %u", (unsigned)decodedSize);
  ------------------
  |  |  104|  2.29k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.29k]
  |  |  ------------------
  ------------------
 1033|  2.29k|        if (dctx->validateChecksum) {
  ------------------
  |  Branch (1033:13): [True: 1.64k, False: 649]
  ------------------
 1034|  1.64k|            XXH64_update(&dctx->xxhState, op, decodedSize);
  ------------------
  |  |  460|  1.64k|#  define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update)
  |  |  ------------------
  |  |  |  |  443|  1.64k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|  1.64k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1035|  1.64k|        }
 1036|  2.29k|        if (decodedSize) /* support dst = NULL,0 */ {
  ------------------
  |  Branch (1036:13): [True: 785, False: 1.50k]
  ------------------
 1037|    785|            op += decodedSize;
 1038|    785|        }
 1039|  2.29k|        assert(ip != NULL);
  ------------------
  |  |   70|  2.29k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1040|  2.29k|        ip += cBlockSize;
 1041|  2.29k|        remainingSrcSize -= cBlockSize;
 1042|  2.29k|        if (blockProperties.lastBlock) break;
  ------------------
  |  Branch (1042:13): [True: 380, False: 1.91k]
  ------------------
 1043|  2.29k|    }
 1044|       |
 1045|    380|    if (dctx->fParams.frameContentSize != ZSTD_CONTENTSIZE_UNKNOWN) {
  ------------------
  |  |  203|    380|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (1045:9): [True: 191, False: 189]
  ------------------
 1046|    191|        RETURN_ERROR_IF((U64)(op-ostart) != dctx->fParams.frameContentSize,
  ------------------
  |  |  114|    191|    do {                                                                       \
  |  |  115|    191|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 118, False: 73]
  |  |  ------------------
  |  |  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|    191|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 73]
  |  |  ------------------
  ------------------
 1047|    191|                        corruption_detected, "");
 1048|    191|    }
 1049|    262|    if (dctx->fParams.checksumFlag) { /* Frame content checksum verification */
  ------------------
  |  Branch (1049:9): [True: 35, False: 227]
  ------------------
 1050|     35|        RETURN_ERROR_IF(remainingSrcSize<4, checksum_wrong, "");
  ------------------
  |  |  114|     35|    do {                                                                       \
  |  |  115|     35|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 32]
  |  |  ------------------
  |  |  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|     35|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 32]
  |  |  ------------------
  ------------------
 1051|     32|        if (!dctx->forceIgnoreChecksum) {
  ------------------
  |  Branch (1051:13): [True: 32, False: 0]
  ------------------
 1052|     32|            U32 const checkCalc = (U32)XXH64_digest(&dctx->xxhState);
  ------------------
  |  |  461|     32|#  define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest)
  |  |  ------------------
  |  |  |  |  443|     32|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|     32|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1053|     32|            U32 checkRead;
 1054|     32|            checkRead = MEM_readLE32(ip);
 1055|     32|            RETURN_ERROR_IF(checkRead != checkCalc, checksum_wrong, "");
  ------------------
  |  |  114|     32|    do {                                                                       \
  |  |  115|     32|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 32, False: 0]
  |  |  ------------------
  |  |  116|     32|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     32|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 32]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     32|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     32|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     32|    do {                                           \
  |  |  |  |   99|     32|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 32]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     32|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 32]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     32|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     32|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 32]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     32|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     32|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 32]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     32|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     32|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     32|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     32|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     32|        }                                                                      \
  |  |  123|     32|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1056|     32|        }
 1057|      0|        ip += 4;
 1058|      0|        remainingSrcSize -= 4;
 1059|      0|    }
 1060|    227|    ZSTD_DCtx_trace_end(dctx, (U64)(op-ostart), (U64)(ip-istart), /* streaming */ 0);
 1061|       |    /* Allow caller to get size read */
 1062|    227|    DEBUGLOG(4, "ZSTD_decompressFrame: decompressed frame of size %i, consuming %i bytes of input", (int)(op-ostart), (int)(ip - (const BYTE*)*srcPtr));
  ------------------
  |  |  104|    227|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 227]
  |  |  ------------------
  ------------------
 1063|    227|    *srcPtr = ip;
 1064|    227|    *srcSizePtr = remainingSrcSize;
 1065|    227|    return (size_t)(op-ostart);
 1066|    262|}
zstd_decompress.c:ZSTD_getDDict:
 1181|  4.20k|{
 1182|  4.20k|    switch (dctx->dictUses) {
 1183|      0|    default:
  ------------------
  |  Branch (1183:5): [True: 0, False: 4.20k]
  ------------------
 1184|      0|        assert(0 /* Impossible */);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1185|      0|        ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
 1186|  4.20k|    case ZSTD_dont_use:
  ------------------
  |  Branch (1186:5): [True: 4.20k, False: 0]
  ------------------
 1187|  4.20k|        ZSTD_clearDict(dctx);
 1188|  4.20k|        return NULL;
 1189|      0|    case ZSTD_use_indefinitely:
  ------------------
  |  Branch (1189:5): [True: 0, False: 4.20k]
  ------------------
 1190|      0|        return dctx->ddict;
 1191|      0|    case ZSTD_use_once:
  ------------------
  |  Branch (1191:5): [True: 0, False: 4.20k]
  ------------------
 1192|      0|        dctx->dictUses = ZSTD_dont_use;
 1193|      0|        return dctx->ddict;
 1194|  4.20k|    }
 1195|  4.20k|}
zstd_decompress.c:ZSTD_decodeFrameHeader:
  703|  3.44k|{
  704|  3.44k|    size_t const result = ZSTD_getFrameHeader_advanced(&(dctx->fParams), src, headerSize, dctx->format);
  705|  3.44k|    if (ZSTD_isError(result)) return result;    /* invalid header */
  ------------------
  |  |   44|  3.44k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (705:9): [True: 385, False: 3.06k]
  ------------------
  706|  3.06k|    RETURN_ERROR_IF(result>0, srcSize_wrong, "headerSize too small");
  ------------------
  |  |  114|  3.06k|    do {                                                                       \
  |  |  115|  3.06k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 3.06k]
  |  |  ------------------
  |  |  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.06k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.06k]
  |  |  ------------------
  ------------------
  707|       |
  708|       |    /* Reference DDict requested by frame if dctx references multiple ddicts */
  709|  3.06k|    if (dctx->refMultipleDDicts == ZSTD_rmd_refMultipleDDicts && dctx->ddictSet) {
  ------------------
  |  Branch (709:9): [True: 0, False: 3.06k]
  |  Branch (709:66): [True: 0, False: 0]
  ------------------
  710|      0|        ZSTD_DCtx_selectFrameDDict(dctx);
  711|      0|    }
  712|       |
  713|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  714|       |    /* Skip the dictID check in fuzzing mode, because it makes the search
  715|       |     * harder.
  716|       |     */
  717|       |    RETURN_ERROR_IF(dctx->fParams.dictID && (dctx->dictID != dctx->fParams.dictID),
  718|       |                    dictionary_wrong, "");
  719|       |#endif
  720|  3.06k|    dctx->validateChecksum = (dctx->fParams.checksumFlag && !dctx->forceIgnoreChecksum) ? 1 : 0;
  ------------------
  |  Branch (720:31): [True: 614, False: 2.44k]
  |  Branch (720:61): [True: 614, False: 0]
  ------------------
  721|  3.06k|    if (dctx->validateChecksum) XXH64_reset(&dctx->xxhState, 0);
  ------------------
  |  |  459|    614|#  define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset)
  |  |  ------------------
  |  |  |  |  443|    614|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|    614|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (721:9): [True: 614, False: 2.44k]
  ------------------
  722|  3.06k|    dctx->processedCSize += headerSize;
  723|  3.06k|    return 0;
  724|  3.06k|}
zstd_decompress.c:ZSTD_copyRawBlock:
  898|  1.64k|{
  899|  1.64k|    DEBUGLOG(5, "ZSTD_copyRawBlock");
  ------------------
  |  |  104|  1.64k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.64k]
  |  |  ------------------
  ------------------
  900|  1.64k|    RETURN_ERROR_IF(srcSize > dstCapacity, dstSize_tooSmall, "");
  ------------------
  |  |  114|  1.64k|    do {                                                                       \
  |  |  115|  1.64k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 1.64k]
  |  |  ------------------
  |  |  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.64k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.64k]
  |  |  ------------------
  ------------------
  901|  1.64k|    if (dst == NULL) {
  ------------------
  |  Branch (901:9): [True: 0, False: 1.64k]
  ------------------
  902|      0|        if (srcSize == 0) return 0;
  ------------------
  |  Branch (902:13): [True: 0, False: 0]
  ------------------
  903|      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]
  |  |  ------------------
  ------------------
  904|      0|    }
  905|  1.64k|    ZSTD_memmove(dst, src, srcSize);
  ------------------
  |  |   45|  1.64k|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  906|  1.64k|    return srcSize;
  907|  1.64k|}
zstd_decompress.c:ZSTD_setRleBlock:
  912|    354|{
  913|    354|    RETURN_ERROR_IF(regenSize > dstCapacity, dstSize_tooSmall, "");
  ------------------
  |  |  114|    354|    do {                                                                       \
  |  |  115|    354|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 9, False: 345]
  |  |  ------------------
  |  |  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|    354|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 345]
  |  |  ------------------
  ------------------
  914|    345|    if (dst == NULL) {
  ------------------
  |  Branch (914:9): [True: 0, False: 345]
  ------------------
  915|      0|        if (regenSize == 0) return 0;
  ------------------
  |  Branch (915:13): [True: 0, False: 0]
  ------------------
  916|      0|        RETURN_ERROR(dstBuffer_null, "");
  ------------------
  |  |  131|      0|    do {                                                                     \
  |  |  132|      0|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|      0|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|      0|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|      0|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|      0|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|      0|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  917|      0|    }
  918|    345|    ZSTD_memset(dst, b, regenSize);
  ------------------
  |  |   46|    345|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  919|    345|    return regenSize;
  920|    345|}
zstd_decompress.c:ZSTD_DCtx_trace_end:
  923|    227|{
  924|    227|#if ZSTD_TRACE
  925|    227|    if (dctx->traceCtx && ZSTD_trace_decompress_end != NULL) {
  ------------------
  |  Branch (925:9): [True: 0, False: 227]
  |  Branch (925:27): [True: 0, False: 0]
  ------------------
  926|      0|        ZSTD_Trace trace;
  927|      0|        ZSTD_memset(&trace, 0, sizeof(trace));
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  928|      0|        trace.version = ZSTD_VERSION_NUMBER;
  ------------------
  |  |  115|      0|#define ZSTD_VERSION_NUMBER  (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
  |  |  ------------------
  |  |  |  |  112|      0|#define ZSTD_VERSION_MAJOR    1
  |  |  ------------------
  |  |               #define ZSTD_VERSION_NUMBER  (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
  |  |  ------------------
  |  |  |  |  113|      0|#define ZSTD_VERSION_MINOR    5
  |  |  ------------------
  |  |               #define ZSTD_VERSION_NUMBER  (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
  |  |  ------------------
  |  |  |  |  114|      0|#define ZSTD_VERSION_RELEASE  7
  |  |  ------------------
  ------------------
  929|      0|        trace.streaming = streaming;
  930|      0|        if (dctx->ddict) {
  ------------------
  |  Branch (930:13): [True: 0, False: 0]
  ------------------
  931|      0|            trace.dictionaryID = ZSTD_getDictID_fromDDict(dctx->ddict);
  932|      0|            trace.dictionarySize = ZSTD_DDict_dictSize(dctx->ddict);
  933|      0|            trace.dictionaryIsCold = dctx->ddictIsCold;
  934|      0|        }
  935|      0|        trace.uncompressedSize = (size_t)uncompressedSize;
  936|      0|        trace.compressedSize = (size_t)compressedSize;
  937|      0|        trace.dctx = dctx;
  938|      0|        ZSTD_trace_decompress_end(dctx->traceCtx, &trace);
  939|      0|    }
  940|       |#else
  941|       |    (void)dctx;
  942|       |    (void)uncompressedSize;
  943|       |    (void)compressedSize;
  944|       |    (void)streaming;
  945|       |#endif
  946|    227|}
zstd_decompress.c:ZSTD_DCtx_resetParameters:
  241|  6.47k|{
  242|  6.47k|    assert(dctx->streamStage == zdss_init);
  ------------------
  |  |   70|  6.47k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  243|  6.47k|    dctx->format = ZSTD_f_zstd1;
  244|  6.47k|    dctx->maxWindowSize = ZSTD_MAXWINDOWSIZE_DEFAULT;
  ------------------
  |  |   40|  6.47k|#  define ZSTD_MAXWINDOWSIZE_DEFAULT (((U32)1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT) + 1)
  |  |  ------------------
  |  |  |  | 1287|  6.47k|#define ZSTD_WINDOWLOG_LIMIT_DEFAULT 27   /* by default, the streaming decoder will refuse any frame
  |  |  ------------------
  ------------------
  245|  6.47k|    dctx->outBufferMode = ZSTD_bm_buffered;
  246|  6.47k|    dctx->forceIgnoreChecksum = ZSTD_d_validateChecksum;
  247|  6.47k|    dctx->refMultipleDDicts = ZSTD_rmd_refSingleDDict;
  248|  6.47k|    dctx->disableHufAsm = 0;
  249|  6.47k|    dctx->maxBlockSizeParam = 0;
  250|  6.47k|}

ZSTD_getcBlockSize:
   65|  4.97k|{
   66|  4.97k|    RETURN_ERROR_IF(srcSize < ZSTD_blockHeaderSize, srcSize_wrong, "");
  ------------------
  |  |  114|  4.97k|    do {                                                                       \
  |  |  115|  4.97k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 4, False: 4.97k]
  |  |  ------------------
  |  |  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|  4.97k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
   67|       |
   68|  4.97k|    {   U32 const cBlockHeader = MEM_readLE24(src);
   69|  4.97k|        U32 const cSize = cBlockHeader >> 3;
   70|  4.97k|        bpPtr->lastBlock = cBlockHeader & 1;
   71|  4.97k|        bpPtr->blockType = (blockType_e)((cBlockHeader >> 1) & 3);
   72|  4.97k|        bpPtr->origSize = cSize;   /* only useful for RLE */
   73|  4.97k|        if (bpPtr->blockType == bt_rle) return 1;
  ------------------
  |  Branch (73:13): [True: 354, False: 4.61k]
  ------------------
   74|  4.61k|        RETURN_ERROR_IF(bpPtr->blockType == bt_reserved, corruption_detected, "");
  ------------------
  |  |  114|  4.61k|    do {                                                                       \
  |  |  115|  4.61k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 33, False: 4.58k]
  |  |  ------------------
  |  |  116|     33|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     33|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 33]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     33|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     33|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     33|    do {                                           \
  |  |  |  |   99|     33|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 33]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     33|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 33]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     33|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     33|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 33]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     33|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     33|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 33]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     33|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     33|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     33|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     33|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     33|        }                                                                      \
  |  |  123|  4.61k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.58k]
  |  |  ------------------
  ------------------
   75|  4.58k|        return cSize;
   76|  4.61k|    }
   77|  4.61k|}
ZSTD_buildFSETable:
  630|  2.40k|{
  631|  2.40k|#if DYNAMIC_BMI2
  632|  2.40k|    if (bmi2) {
  ------------------
  |  Branch (632:9): [True: 2.12k, False: 275]
  ------------------
  633|  2.12k|        ZSTD_buildFSETable_body_bmi2(dt, normalizedCounter, maxSymbolValue,
  634|  2.12k|                baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  635|  2.12k|        return;
  636|  2.12k|    }
  637|    275|#endif
  638|    275|    (void)bmi2;
  639|    275|    ZSTD_buildFSETable_body_default(dt, normalizedCounter, maxSymbolValue,
  640|    275|            baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  641|    275|}
ZSTD_decodeSeqHeaders:
  697|  2.19k|{
  698|  2.19k|    const BYTE* const istart = (const BYTE*)src;
  699|  2.19k|    const BYTE* const iend = istart + srcSize;
  700|  2.19k|    const BYTE* ip = istart;
  701|  2.19k|    int nbSeq;
  702|  2.19k|    DEBUGLOG(5, "ZSTD_decodeSeqHeaders");
  ------------------
  |  |  104|  2.19k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.19k]
  |  |  ------------------
  ------------------
  703|       |
  704|       |    /* check */
  705|  2.19k|    RETURN_ERROR_IF(srcSize < MIN_SEQUENCES_SIZE, srcSize_wrong, "");
  ------------------
  |  |  114|  2.19k|    do {                                                                       \
  |  |  115|  2.19k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 2.19k]
  |  |  ------------------
  |  |  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.19k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.19k]
  |  |  ------------------
  ------------------
  706|       |
  707|       |    /* SeqHead */
  708|  2.19k|    nbSeq = *ip++;
  709|  2.19k|    if (nbSeq > 0x7F) {
  ------------------
  |  Branch (709:9): [True: 1.63k, False: 560]
  ------------------
  710|  1.63k|        if (nbSeq == 0xFF) {
  ------------------
  |  Branch (710:13): [True: 69, False: 1.56k]
  ------------------
  711|     69|            RETURN_ERROR_IF(ip+2 > iend, srcSize_wrong, "");
  ------------------
  |  |  114|     69|    do {                                                                       \
  |  |  115|     69|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 66]
  |  |  ------------------
  |  |  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|     69|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 66]
  |  |  ------------------
  ------------------
  712|     66|            nbSeq = MEM_readLE16(ip) + LONGNBSEQ;
  ------------------
  |  |   96|     66|#define LONGNBSEQ 0x7F00
  ------------------
  713|     66|            ip+=2;
  714|  1.56k|        } else {
  715|  1.56k|            RETURN_ERROR_IF(ip >= iend, srcSize_wrong, "");
  ------------------
  |  |  114|  1.56k|    do {                                                                       \
  |  |  115|  1.56k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 1.56k]
  |  |  ------------------
  |  |  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.56k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.56k]
  |  |  ------------------
  ------------------
  716|  1.56k|            nbSeq = ((nbSeq-0x80)<<8) + *ip++;
  717|  1.56k|        }
  718|  1.63k|    }
  719|  2.18k|    *nbSeqPtr = nbSeq;
  720|       |
  721|  2.18k|    if (nbSeq == 0) {
  ------------------
  |  Branch (721:9): [True: 105, False: 2.08k]
  ------------------
  722|       |        /* No sequence : section ends immediately */
  723|    105|        RETURN_ERROR_IF(ip != iend, corruption_detected,
  ------------------
  |  |  114|    105|    do {                                                                       \
  |  |  115|    105|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 18, False: 87]
  |  |  ------------------
  |  |  116|     18|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     18|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     18|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     18|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     18|    do {                                           \
  |  |  |  |   99|     18|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     18|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     18|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     18|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     18|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     18|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     18|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     18|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     18|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     18|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     18|        }                                                                      \
  |  |  123|    105|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
  724|    105|            "extraneous data present in the Sequences section");
  725|     87|        return (size_t)(ip - istart);
  726|    105|    }
  727|       |
  728|       |    /* FSE table descriptors */
  729|  2.08k|    RETURN_ERROR_IF(ip+1 > iend, srcSize_wrong, ""); /* minimum possible size: 1 byte for symbol encoding types */
  ------------------
  |  |  114|  2.08k|    do {                                                                       \
  |  |  115|  2.08k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 2.08k]
  |  |  ------------------
  |  |  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.08k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.08k]
  |  |  ------------------
  ------------------
  730|  2.08k|    RETURN_ERROR_IF(*ip & 3, corruption_detected, ""); /* The last field, Reserved, must be all-zeroes. */
  ------------------
  |  |  114|  2.08k|    do {                                                                       \
  |  |  115|  2.08k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 32, False: 2.04k]
  |  |  ------------------
  |  |  116|     32|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     32|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 32]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     32|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     32|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     32|    do {                                           \
  |  |  |  |   99|     32|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 32]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     32|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 32]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     32|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     32|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 32]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     32|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     32|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 32]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     32|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     32|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     32|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     32|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     32|        }                                                                      \
  |  |  123|  2.08k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.04k]
  |  |  ------------------
  ------------------
  731|  2.04k|    {   SymbolEncodingType_e const LLtype = (SymbolEncodingType_e)(*ip >> 6);
  732|  2.04k|        SymbolEncodingType_e const OFtype = (SymbolEncodingType_e)((*ip >> 4) & 3);
  733|  2.04k|        SymbolEncodingType_e const MLtype = (SymbolEncodingType_e)((*ip >> 2) & 3);
  734|  2.04k|        ip++;
  735|       |
  736|       |        /* Build DTables */
  737|  2.04k|        {   size_t const llhSize = ZSTD_buildSeqTable(dctx->entropy.LLTable, &dctx->LLTptr,
  738|  2.04k|                                                      LLtype, MaxLL, LLFSELog,
  ------------------
  |  |  104|  2.04k|#define MaxLL   35
  ------------------
                                                                    LLtype, MaxLL, LLFSELog,
  ------------------
  |  |  109|  2.04k|#define LLFSELog    9
  ------------------
  739|  2.04k|                                                      ip, iend-ip,
  740|  2.04k|                                                      LL_base, LL_bits,
  741|  2.04k|                                                      LL_defaultDTable, dctx->fseEntropy,
  742|  2.04k|                                                      dctx->ddictIsCold, nbSeq,
  743|  2.04k|                                                      dctx->workspace, sizeof(dctx->workspace),
  744|  2.04k|                                                      ZSTD_DCtx_get_bmi2(dctx));
  745|  2.04k|            RETURN_ERROR_IF(ZSTD_isError(llhSize), corruption_detected, "ZSTD_buildSeqTable failed");
  ------------------
  |  |  114|  2.04k|    do {                                                                       \
  |  |  115|  2.04k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 7, False: 2.04k]
  |  |  ------------------
  |  |  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|  2.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.04k]
  |  |  ------------------
  ------------------
  746|  2.04k|            ip += llhSize;
  747|  2.04k|        }
  748|       |
  749|      0|        {   size_t const ofhSize = ZSTD_buildSeqTable(dctx->entropy.OFTable, &dctx->OFTptr,
  750|  2.04k|                                                      OFtype, MaxOff, OffFSELog,
  ------------------
  |  |  106|  2.04k|#define MaxOff  31
  ------------------
                                                                    OFtype, MaxOff, OffFSELog,
  ------------------
  |  |  110|  2.04k|#define OffFSELog   8
  ------------------
  751|  2.04k|                                                      ip, iend-ip,
  752|  2.04k|                                                      OF_base, OF_bits,
  753|  2.04k|                                                      OF_defaultDTable, dctx->fseEntropy,
  754|  2.04k|                                                      dctx->ddictIsCold, nbSeq,
  755|  2.04k|                                                      dctx->workspace, sizeof(dctx->workspace),
  756|  2.04k|                                                      ZSTD_DCtx_get_bmi2(dctx));
  757|  2.04k|            RETURN_ERROR_IF(ZSTD_isError(ofhSize), corruption_detected, "ZSTD_buildSeqTable failed");
  ------------------
  |  |  114|  2.04k|    do {                                                                       \
  |  |  115|  2.04k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 18, False: 2.02k]
  |  |  ------------------
  |  |  116|     18|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     18|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     18|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     18|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     18|    do {                                           \
  |  |  |  |   99|     18|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     18|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     18|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     18|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     18|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     18|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     18|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     18|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     18|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     18|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     18|        }                                                                      \
  |  |  123|  2.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.02k]
  |  |  ------------------
  ------------------
  758|  2.02k|            ip += ofhSize;
  759|  2.02k|        }
  760|       |
  761|      0|        {   size_t const mlhSize = ZSTD_buildSeqTable(dctx->entropy.MLTable, &dctx->MLTptr,
  762|  2.02k|                                                      MLtype, MaxML, MLFSELog,
  ------------------
  |  |  103|  2.02k|#define MaxML   52
  ------------------
                                                                    MLtype, MaxML, MLFSELog,
  ------------------
  |  |  108|  2.02k|#define MLFSELog    9
  ------------------
  763|  2.02k|                                                      ip, iend-ip,
  764|  2.02k|                                                      ML_base, ML_bits,
  765|  2.02k|                                                      ML_defaultDTable, dctx->fseEntropy,
  766|  2.02k|                                                      dctx->ddictIsCold, nbSeq,
  767|  2.02k|                                                      dctx->workspace, sizeof(dctx->workspace),
  768|  2.02k|                                                      ZSTD_DCtx_get_bmi2(dctx));
  769|  2.02k|            RETURN_ERROR_IF(ZSTD_isError(mlhSize), corruption_detected, "ZSTD_buildSeqTable failed");
  ------------------
  |  |  114|  2.02k|    do {                                                                       \
  |  |  115|  2.02k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 10, False: 2.01k]
  |  |  ------------------
  |  |  116|     10|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     10|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     10|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     10|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     10|    do {                                           \
  |  |  |  |   99|     10|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     10|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     10|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     10|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     10|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     10|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     10|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     10|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     10|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     10|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     10|        }                                                                      \
  |  |  123|  2.02k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.01k]
  |  |  ------------------
  ------------------
  770|  2.01k|            ip += mlhSize;
  771|  2.01k|        }
  772|  2.01k|    }
  773|       |
  774|      0|    return ip-istart;
  775|  2.02k|}
ZSTD_decompressBlock_internal:
 2069|  2.88k|{   /* blockType == blockCompressed */
 2070|  2.88k|    const BYTE* ip = (const BYTE*)src;
 2071|  2.88k|    DEBUGLOG(5, "ZSTD_decompressBlock_internal (cSize : %u)", (unsigned)srcSize);
  ------------------
  |  |  104|  2.88k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.88k]
  |  |  ------------------
  ------------------
 2072|       |
 2073|       |    /* Note : the wording of the specification
 2074|       |     * allows compressed block to be sized exactly ZSTD_blockSizeMax(dctx).
 2075|       |     * This generally does not happen, as it makes little sense,
 2076|       |     * since an uncompressed block would feature same size and have no decompression cost.
 2077|       |     * Also, note that decoder from reference libzstd before < v1.5.4
 2078|       |     * would consider this edge case as an error.
 2079|       |     * As a consequence, avoid generating compressed blocks of size ZSTD_blockSizeMax(dctx)
 2080|       |     * for broader compatibility with the deployed ecosystem of zstd decoders */
 2081|  2.88k|    RETURN_ERROR_IF(srcSize > ZSTD_blockSizeMax(dctx), srcSize_wrong, "");
  ------------------
  |  |  114|  2.88k|    do {                                                                       \
  |  |  115|  2.88k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 2.88k]
  |  |  ------------------
  |  |  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.88k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.88k]
  |  |  ------------------
  ------------------
 2082|       |
 2083|       |    /* Decode literals section */
 2084|  2.88k|    {   size_t const litCSize = ZSTD_decodeLiteralsBlock(dctx, src, srcSize, dst, dstCapacity, streaming);
 2085|  2.88k|        DEBUGLOG(5, "ZSTD_decodeLiteralsBlock : cSize=%u, nbLiterals=%zu", (U32)litCSize, dctx->litSize);
  ------------------
  |  |  104|  2.88k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.88k]
  |  |  ------------------
  ------------------
 2086|  2.88k|        if (ZSTD_isError(litCSize)) return litCSize;
  ------------------
  |  |   44|  2.88k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (2086:13): [True: 694, False: 2.19k]
  ------------------
 2087|  2.19k|        ip += litCSize;
 2088|  2.19k|        srcSize -= litCSize;
 2089|  2.19k|    }
 2090|       |
 2091|       |    /* Build Decoding Tables */
 2092|      0|    {
 2093|       |        /* Compute the maximum block size, which must also work when !frame and fParams are unset.
 2094|       |         * Additionally, take the min with dstCapacity to ensure that the totalHistorySize fits in a size_t.
 2095|       |         */
 2096|  2.19k|        size_t const blockSizeMax = MIN(dstCapacity, ZSTD_blockSizeMax(dctx));
  ------------------
  |  |   54|  2.19k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 104, False: 2.08k]
  |  |  ------------------
  ------------------
 2097|  2.19k|        size_t const totalHistorySize = ZSTD_totalHistorySize(ZSTD_maybeNullPtrAdd((BYTE*)dst, blockSizeMax), (BYTE const*)dctx->virtualStart);
 2098|       |        /* isLongOffset must be true if there are long offsets.
 2099|       |         * Offsets are long if they are larger than ZSTD_maxShortOffset().
 2100|       |         * We don't expect that to be the case in 64-bit mode.
 2101|       |         *
 2102|       |         * We check here to see if our history is large enough to allow long offsets.
 2103|       |         * If it isn't, then we can't possible have (valid) long offsets. If the offset
 2104|       |         * is invalid, then it is okay to read it incorrectly.
 2105|       |         *
 2106|       |         * If isLongOffsets is true, then we will later check our decoding table to see
 2107|       |         * if it is even possible to generate long offsets.
 2108|       |         */
 2109|  2.19k|        ZSTD_longOffset_e isLongOffset = (ZSTD_longOffset_e)(MEM_32bits() && (totalHistorySize > ZSTD_maxShortOffset()));
  ------------------
  |  Branch (2109:62): [True: 0, False: 2.19k]
  |  Branch (2109:78): [True: 0, False: 0]
  ------------------
 2110|       |        /* These macros control at build-time which decompressor implementation
 2111|       |         * we use. If neither is defined, we do some inspection and dispatch at
 2112|       |         * runtime.
 2113|       |         */
 2114|  2.19k|#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \
 2115|  2.19k|    !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG)
 2116|  2.19k|        int usePrefetchDecoder = dctx->ddictIsCold;
 2117|       |#else
 2118|       |        /* Set to 1 to avoid computing offset info if we don't need to.
 2119|       |         * Otherwise this value is ignored.
 2120|       |         */
 2121|       |        int usePrefetchDecoder = 1;
 2122|       |#endif
 2123|  2.19k|        int nbSeq;
 2124|  2.19k|        size_t const seqHSize = ZSTD_decodeSeqHeaders(dctx, &nbSeq, ip, srcSize);
 2125|  2.19k|        if (ZSTD_isError(seqHSize)) return seqHSize;
  ------------------
  |  |   44|  2.19k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (2125:13): [True: 91, False: 2.10k]
  ------------------
 2126|  2.10k|        ip += seqHSize;
 2127|  2.10k|        srcSize -= seqHSize;
 2128|       |
 2129|  2.10k|        RETURN_ERROR_IF((dst == NULL || dstCapacity == 0) && nbSeq > 0, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|  2.10k|    do {                                                                       \
  |  |  115|  8.40k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 2.10k]
  |  |  |  Branch (115:13): [True: 1, False: 2.09k]
  |  |  |  Branch (115:13): [True: 1, False: 0]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|  2.10k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.09k]
  |  |  ------------------
  ------------------
 2130|  2.09k|        RETURN_ERROR_IF(MEM_64bits() && sizeof(size_t) == sizeof(void*) && (size_t)(-1) - (size_t)dst < (size_t)(1 << 20), dstSize_tooSmall,
  ------------------
  |  |  114|  2.09k|    do {                                                                       \
  |  |  115|  10.4k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2.09k, False: 0]
  |  |  |  Branch (115:13): [True: 0, Folded]
  |  |  |  Branch (115:13): [True: 0, False: 2.09k]
  |  |  ------------------
  |  |  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.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.09k]
  |  |  ------------------
  ------------------
 2131|  2.09k|                "invalid dst");
 2132|       |
 2133|       |        /* If we could potentially have long offsets, or we might want to use the prefetch decoder,
 2134|       |         * compute information about the share of long offsets, and the maximum nbAdditionalBits.
 2135|       |         * NOTE: could probably use a larger nbSeq limit
 2136|       |         */
 2137|  2.09k|        if (isLongOffset || (!usePrefetchDecoder && (totalHistorySize > (1u << 24)) && (nbSeq > 8))) {
  ------------------
  |  Branch (2137:13): [True: 0, False: 2.09k]
  |  Branch (2137:30): [True: 1.11k, False: 984]
  |  Branch (2137:53): [True: 0, False: 1.11k]
  |  Branch (2137:88): [True: 0, False: 0]
  ------------------
 2138|      0|            ZSTD_OffsetInfo const info = ZSTD_getOffsetInfo(dctx->OFTptr, nbSeq);
 2139|      0|            if (isLongOffset && info.maxNbAdditionalBits <= STREAM_ACCUMULATOR_MIN) {
  ------------------
  |  |   45|      0|#define STREAM_ACCUMULATOR_MIN    ((U32)(MEM_32bits() ? STREAM_ACCUMULATOR_MIN_32 : STREAM_ACCUMULATOR_MIN_64))
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  |               #define STREAM_ACCUMULATOR_MIN    ((U32)(MEM_32bits() ? STREAM_ACCUMULATOR_MIN_32 : STREAM_ACCUMULATOR_MIN_64))
  |  |  ------------------
  |  |  |  |   44|      0|#define STREAM_ACCUMULATOR_MIN_64  57
  |  |  ------------------
  |  |  |  Branch (45:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2139:17): [True: 0, False: 0]
  |  Branch (2139:33): [True: 0, False: 0]
  ------------------
 2140|       |                /* If isLongOffset, but the maximum number of additional bits that we see in our table is small
 2141|       |                 * enough, then we know it is impossible to have too long an offset in this block, so we can
 2142|       |                 * use the regular offset decoder.
 2143|       |                 */
 2144|      0|                isLongOffset = ZSTD_lo_isRegularOffset;
 2145|      0|            }
 2146|      0|            if (!usePrefetchDecoder) {
  ------------------
  |  Branch (2146:17): [True: 0, False: 0]
  ------------------
 2147|      0|                U32 const minShare = MEM_64bits() ? 7 : 20; /* heuristic values, correspond to 2.73% and 7.81% */
  ------------------
  |  Branch (2147:38): [True: 0, False: 0]
  ------------------
 2148|      0|                usePrefetchDecoder = (info.longOffsetShare >= minShare);
 2149|      0|            }
 2150|      0|        }
 2151|       |
 2152|  2.09k|        dctx->ddictIsCold = 0;
 2153|       |
 2154|  2.09k|#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \
 2155|  2.09k|    !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG)
 2156|  2.09k|        if (usePrefetchDecoder) {
  ------------------
  |  Branch (2156:13): [True: 984, False: 1.11k]
  ------------------
 2157|       |#else
 2158|       |        (void)usePrefetchDecoder;
 2159|       |        {
 2160|       |#endif
 2161|    984|#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
 2162|    984|            return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
 2163|    984|#endif
 2164|    984|        }
 2165|       |
 2166|  1.11k|#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG
 2167|       |        /* else */
 2168|  1.11k|        if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (2168:13): [True: 596, False: 519]
  ------------------
 2169|    596|            return ZSTD_decompressSequencesSplitLitBuffer(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
 2170|    519|        else
 2171|    519|            return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
 2172|  1.11k|#endif
 2173|  1.11k|    }
 2174|  1.11k|}
ZSTD_checkContinuity:
 2179|  3.50k|{
 2180|  3.50k|    if (dst != dctx->previousDstEnd && dstSize > 0) {   /* not contiguous */
  ------------------
  |  Branch (2180:9): [True: 3.50k, False: 0]
  |  Branch (2180:40): [True: 3.50k, False: 1]
  ------------------
 2181|  3.50k|        dctx->dictEnd = dctx->previousDstEnd;
 2182|  3.50k|        dctx->virtualStart = (const char*)dst - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->prefixStart));
 2183|  3.50k|        dctx->prefixStart = dst;
 2184|  3.50k|        dctx->previousDstEnd = dst;
 2185|  3.50k|    }
 2186|  3.50k|}
zstd_decompress_block.c:ZSTD_decodeLiteralsBlock:
  137|  2.88k|{
  138|  2.88k|    DEBUGLOG(5, "ZSTD_decodeLiteralsBlock");
  ------------------
  |  |  104|  2.88k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.88k]
  |  |  ------------------
  ------------------
  139|  2.88k|    RETURN_ERROR_IF(srcSize < MIN_CBLOCK_SIZE, corruption_detected, "");
  ------------------
  |  |  114|  2.88k|    do {                                                                       \
  |  |  115|  2.88k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 2.88k]
  |  |  ------------------
  |  |  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.88k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.88k]
  |  |  ------------------
  ------------------
  140|       |
  141|  2.88k|    {   const BYTE* const istart = (const BYTE*) src;
  142|  2.88k|        SymbolEncodingType_e const litEncType = (SymbolEncodingType_e)(istart[0] & 3);
  143|  2.88k|        size_t const blockSizeMax = ZSTD_blockSizeMax(dctx);
  144|       |
  145|  2.88k|        switch(litEncType)
  146|  2.88k|        {
  147|      2|        case set_repeat:
  ------------------
  |  Branch (147:9): [True: 2, False: 2.88k]
  ------------------
  148|      2|            DEBUGLOG(5, "set_repeat flag : re-using stats from previous compressed literals block");
  ------------------
  |  |  104|      2|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2]
  |  |  ------------------
  ------------------
  149|      2|            RETURN_ERROR_IF(dctx->litEntropy==0, dictionary_corrupted, "");
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
  150|      0|            ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  151|       |
  152|    681|        case set_compressed:
  ------------------
  |  Branch (152:9): [True: 681, False: 2.20k]
  ------------------
  153|    681|            RETURN_ERROR_IF(srcSize < 5, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need up to 5 for case 3");
  ------------------
  |  |  114|    681|    do {                                                                       \
  |  |  115|    681|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 680]
  |  |  ------------------
  |  |  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|    681|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 680]
  |  |  ------------------
  ------------------
  154|    680|            {   size_t lhSize, litSize, litCSize;
  155|    680|                U32 singleStream=0;
  156|    680|                U32 const lhlCode = (istart[0] >> 2) & 3;
  157|    680|                U32 const lhc = MEM_readLE32(istart);
  158|    680|                size_t hufSuccess;
  159|    680|                size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity);
  ------------------
  |  |   54|    680|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 604, False: 76]
  |  |  ------------------
  ------------------
  160|    680|                int const flags = 0
  161|    680|                    | (ZSTD_DCtx_get_bmi2(dctx) ? HUF_flags_bmi2 : 0)
  ------------------
  |  Branch (161:24): [True: 680, False: 0]
  ------------------
  162|    680|                    | (dctx->disableHufAsm ? HUF_flags_disableAsm : 0);
  ------------------
  |  Branch (162:24): [True: 0, False: 680]
  ------------------
  163|    680|                switch(lhlCode)
  164|    680|                {
  165|    125|                case 0: case 1: default:   /* note : default is impossible, since lhlCode into [0..3] */
  ------------------
  |  Branch (165:17): [True: 69, False: 611]
  |  Branch (165:25): [True: 56, False: 624]
  |  Branch (165:33): [True: 0, False: 680]
  ------------------
  166|       |                    /* 2 - 2 - 10 - 10 */
  167|    125|                    singleStream = !lhlCode;
  168|    125|                    lhSize = 3;
  169|    125|                    litSize  = (lhc >> 4) & 0x3FF;
  170|    125|                    litCSize = (lhc >> 14) & 0x3FF;
  171|    125|                    break;
  172|    498|                case 2:
  ------------------
  |  Branch (172:17): [True: 498, False: 182]
  ------------------
  173|       |                    /* 2 - 2 - 14 - 14 */
  174|    498|                    lhSize = 4;
  175|    498|                    litSize  = (lhc >> 4) & 0x3FFF;
  176|    498|                    litCSize = lhc >> 18;
  177|    498|                    break;
  178|     57|                case 3:
  ------------------
  |  Branch (178:17): [True: 57, False: 623]
  ------------------
  179|       |                    /* 2 - 2 - 18 - 18 */
  180|     57|                    lhSize = 5;
  181|     57|                    litSize  = (lhc >> 4) & 0x3FFFF;
  182|     57|                    litCSize = (lhc >> 22) + ((size_t)istart[4] << 10);
  183|     57|                    break;
  184|    680|                }
  185|    680|                RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|    680|    do {                                                                       \
  |  |  115|  2.02k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 667, False: 13]
  |  |  |  Branch (115:13): [True: 0, False: 667]
  |  |  ------------------
  |  |  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|    680|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 680]
  |  |  ------------------
  ------------------
  186|    680|                RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, "");
  ------------------
  |  |  114|    680|    do {                                                                       \
  |  |  115|    680|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 4, False: 676]
  |  |  ------------------
  |  |  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|    680|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 676]
  |  |  ------------------
  ------------------
  187|    676|                if (!singleStream)
  ------------------
  |  Branch (187:21): [True: 607, False: 69]
  ------------------
  188|    607|                    RETURN_ERROR_IF(litSize < MIN_LITERALS_FOR_4_STREAMS, literals_headerWrong,
  ------------------
  |  |  114|    607|    do {                                                                       \
  |  |  115|    607|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 4, False: 603]
  |  |  ------------------
  |  |  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|    607|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 603]
  |  |  ------------------
  ------------------
  189|    676|                        "Not enough literals (%zu) for the 4-streams mode (min %u)",
  190|    676|                        litSize, MIN_LITERALS_FOR_4_STREAMS);
  191|    672|                RETURN_ERROR_IF(litCSize + lhSize > srcSize, corruption_detected, "");
  ------------------
  |  |  114|    672|    do {                                                                       \
  |  |  115|    672|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 27, False: 645]
  |  |  ------------------
  |  |  116|     27|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     27|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 27]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     27|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     27|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     27|    do {                                           \
  |  |  |  |   99|     27|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 27]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     27|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 27]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     27|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     27|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 27]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     27|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     27|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 27]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     27|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     27|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     27|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     27|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     27|        }                                                                      \
  |  |  123|    672|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 645]
  |  |  ------------------
  ------------------
  192|    645|                RETURN_ERROR_IF(expectedWriteSize < litSize , dstSize_tooSmall, "");
  ------------------
  |  |  114|    645|    do {                                                                       \
  |  |  115|    645|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2, False: 643]
  |  |  ------------------
  |  |  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|    645|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 643]
  |  |  ------------------
  ------------------
  193|    643|                ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 0);
  194|       |
  195|       |                /* prefetch huffman table if cold */
  196|    643|                if (dctx->ddictIsCold && (litSize > 768 /* heuristic */)) {
  ------------------
  |  Branch (196:21): [True: 55, False: 588]
  |  Branch (196:42): [True: 22, False: 33]
  ------------------
  197|     22|                    PREFETCH_AREA(dctx->HUFptr, sizeof(dctx->entropy.hufTable));
  ------------------
  |  |  159|     22|    do {                                                 \
  |  |  160|     22|        const char* const _ptr = (const char*)(p);       \
  |  |  161|     22|        size_t const _size = (size_t)(s);                \
  |  |  162|     22|        size_t _pos;                                     \
  |  |  163|  5.67k|        for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \
  |  |  ------------------
  |  |  |  |  156|  5.65k|#define CACHELINE_SIZE 64
  |  |  ------------------
  |  |  |  Branch (163:22): [True: 5.65k, False: 22]
  |  |  ------------------
  |  |  164|  5.65k|            PREFETCH_L2(_ptr + _pos);                    \
  |  |  ------------------
  |  |  |  |  146|  5.65k|#    define PREFETCH_L2(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */)
  |  |  ------------------
  |  |  165|  5.65k|        }                                                \
  |  |  166|     22|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 22]
  |  |  ------------------
  ------------------
  198|     22|                }
  199|       |
  200|    643|                if (litEncType==set_repeat) {
  ------------------
  |  Branch (200:21): [True: 0, False: 643]
  ------------------
  201|      0|                    if (singleStream) {
  ------------------
  |  Branch (201:25): [True: 0, False: 0]
  ------------------
  202|      0|                        hufSuccess = HUF_decompress1X_usingDTable(
  203|      0|                            dctx->litBuffer, litSize, istart+lhSize, litCSize,
  204|      0|                            dctx->HUFptr, flags);
  205|      0|                    } else {
  206|      0|                        assert(litSize >= MIN_LITERALS_FOR_4_STREAMS);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  207|      0|                        hufSuccess = HUF_decompress4X_usingDTable(
  208|      0|                            dctx->litBuffer, litSize, istart+lhSize, litCSize,
  209|      0|                            dctx->HUFptr, flags);
  210|      0|                    }
  211|    643|                } else {
  212|    643|                    if (singleStream) {
  ------------------
  |  Branch (212:25): [True: 66, False: 577]
  ------------------
  213|       |#if defined(HUF_FORCE_DECOMPRESS_X2)
  214|       |                        hufSuccess = HUF_decompress1X_DCtx_wksp(
  215|       |                            dctx->entropy.hufTable, dctx->litBuffer, litSize,
  216|       |                            istart+lhSize, litCSize, dctx->workspace,
  217|       |                            sizeof(dctx->workspace), flags);
  218|       |#else
  219|     66|                        hufSuccess = HUF_decompress1X1_DCtx_wksp(
  220|     66|                            dctx->entropy.hufTable, dctx->litBuffer, litSize,
  221|     66|                            istart+lhSize, litCSize, dctx->workspace,
  222|     66|                            sizeof(dctx->workspace), flags);
  223|     66|#endif
  224|    577|                    } else {
  225|    577|                        hufSuccess = HUF_decompress4X_hufOnly_wksp(
  226|    577|                            dctx->entropy.hufTable, dctx->litBuffer, litSize,
  227|    577|                            istart+lhSize, litCSize, dctx->workspace,
  228|    577|                            sizeof(dctx->workspace), flags);
  229|    577|                    }
  230|    643|                }
  231|    643|                if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (231:21): [True: 8, False: 635]
  ------------------
  232|      8|                {
  233|      8|                    assert(litSize > ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   70|      8|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  234|      8|                    ZSTD_memcpy(dctx->litExtraBuffer, dctx->litBufferEnd - ZSTD_LITBUFFEREXTRASIZE, ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   44|     48|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  |  |  ------------------
  |  |  |  Branch (44:51): [True: 0, Folded]
  |  |  |  Branch (44:51): [True: 8, Folded]
  |  |  |  Branch (44:51): [Folded, False: 8]
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [True: 8, Folded]
  |  |  |  Branch (44:55): [Folded, False: 8]
  |  |  ------------------
  ------------------
  235|      8|                    ZSTD_memmove(dctx->litBuffer + ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH, dctx->litBuffer, litSize - ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   45|     48|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  |  |  ------------------
  |  |  |  Branch (45:49): [True: 0, Folded]
  |  |  |  Branch (45:49): [True: 8, Folded]
  |  |  |  Branch (45:49): [Folded, False: 8]
  |  |  |  Branch (45:57): [True: 0, Folded]
  |  |  |  Branch (45:57): [True: 8, Folded]
  |  |  |  Branch (45:57): [Folded, False: 8]
  |  |  ------------------
  ------------------
  236|      8|                    dctx->litBuffer += ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  118|      8|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|      8|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|     16|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 8]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 8, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                  dctx->litBuffer += ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  199|      8|#define WILDCOPY_OVERLENGTH 32
  ------------------
  237|      8|                    dctx->litBufferEnd -= WILDCOPY_OVERLENGTH;
  ------------------
  |  |  199|      8|#define WILDCOPY_OVERLENGTH 32
  ------------------
  238|      8|                    assert(dctx->litBufferEnd <= (BYTE*)dst + blockSizeMax);
  ------------------
  |  |   70|      8|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  239|      8|                }
  240|       |
  241|    643|                RETURN_ERROR_IF(HUF_isError(hufSuccess), corruption_detected, "");
  ------------------
  |  |  114|    643|    do {                                                                       \
  |  |  115|    643|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 583, False: 60]
  |  |  ------------------
  |  |  116|    583|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    583|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 583]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    583|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    583|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    583|    do {                                           \
  |  |  |  |   99|    583|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 583]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    583|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 583]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    583|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    583|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 583]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    583|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    583|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 583]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    583|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    583|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    583|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    583|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    583|        }                                                                      \
  |  |  123|    643|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 60]
  |  |  ------------------
  ------------------
  242|       |
  243|     60|                dctx->litPtr = dctx->litBuffer;
  244|     60|                dctx->litSize = litSize;
  245|     60|                dctx->litEntropy = 1;
  246|     60|                if (litEncType==set_compressed) dctx->HUFptr = dctx->entropy.hufTable;
  ------------------
  |  Branch (246:21): [True: 60, False: 0]
  ------------------
  247|     60|                return litCSize + lhSize;
  248|    643|            }
  249|       |
  250|    293|        case set_basic:
  ------------------
  |  Branch (250:9): [True: 293, False: 2.58k]
  ------------------
  251|    293|            {   size_t litSize, lhSize;
  252|    293|                U32 const lhlCode = ((istart[0]) >> 2) & 3;
  253|    293|                size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity);
  ------------------
  |  |   54|    293|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 215, False: 78]
  |  |  ------------------
  ------------------
  254|    293|                switch(lhlCode)
  255|    293|                {
  256|    160|                case 0: case 2: default:   /* note : default is impossible, since lhlCode into [0..3] */
  ------------------
  |  Branch (256:17): [True: 138, False: 155]
  |  Branch (256:25): [True: 22, False: 271]
  |  Branch (256:33): [True: 0, False: 293]
  ------------------
  257|    160|                    lhSize = 1;
  258|    160|                    litSize = istart[0] >> 3;
  259|    160|                    break;
  260|     95|                case 1:
  ------------------
  |  Branch (260:17): [True: 95, False: 198]
  ------------------
  261|     95|                    lhSize = 2;
  262|     95|                    litSize = MEM_readLE16(istart) >> 4;
  263|     95|                    break;
  264|     38|                case 3:
  ------------------
  |  Branch (264:17): [True: 38, False: 255]
  ------------------
  265|     38|                    lhSize = 3;
  266|     38|                    RETURN_ERROR_IF(srcSize<3, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize = 3");
  ------------------
  |  |  114|     38|    do {                                                                       \
  |  |  115|     38|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 37]
  |  |  ------------------
  |  |  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|     38|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 37]
  |  |  ------------------
  ------------------
  267|     37|                    litSize = MEM_readLE24(istart) >> 4;
  268|     37|                    break;
  269|    293|                }
  270|       |
  271|    292|                RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|    292|    do {                                                                       \
  |  |  115|    828|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 244, False: 48]
  |  |  |  Branch (115:13): [True: 0, False: 244]
  |  |  ------------------
  |  |  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|    292|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 292]
  |  |  ------------------
  ------------------
  272|    292|                RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, "");
  ------------------
  |  |  114|    292|    do {                                                                       \
  |  |  115|    292|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 7, False: 285]
  |  |  ------------------
  |  |  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|    292|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 285]
  |  |  ------------------
  ------------------
  273|    285|                RETURN_ERROR_IF(expectedWriteSize < litSize, dstSize_tooSmall, "");
  ------------------
  |  |  114|    285|    do {                                                                       \
  |  |  115|    285|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 284]
  |  |  ------------------
  |  |  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|    285|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 284]
  |  |  ------------------
  ------------------
  274|    284|                ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 1);
  275|    284|                if (lhSize+litSize+WILDCOPY_OVERLENGTH > srcSize) {  /* risk reading beyond src buffer with wildcopy */
  ------------------
  |  |  199|    284|#define WILDCOPY_OVERLENGTH 32
  ------------------
  |  Branch (275:21): [True: 172, False: 112]
  ------------------
  276|    172|                    RETURN_ERROR_IF(litSize+lhSize > srcSize, corruption_detected, "");
  ------------------
  |  |  114|    172|    do {                                                                       \
  |  |  115|    172|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 37, False: 135]
  |  |  ------------------
  |  |  116|     37|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     37|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 37]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     37|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     37|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     37|    do {                                           \
  |  |  |  |   99|     37|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 37]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     37|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 37]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     37|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     37|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 37]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     37|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     37|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 37]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     37|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     37|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     37|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     37|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     37|        }                                                                      \
  |  |  123|    172|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 135]
  |  |  ------------------
  ------------------
  277|    135|                    if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (277:25): [True: 0, False: 135]
  ------------------
  278|      0|                    {
  279|      0|                        ZSTD_memcpy(dctx->litBuffer, istart + lhSize, litSize - ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   44|      0|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  |  |  ------------------
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
  280|      0|                        ZSTD_memcpy(dctx->litExtraBuffer, istart + lhSize + litSize - ZSTD_LITBUFFEREXTRASIZE, ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   44|      0|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  |  |  ------------------
  |  |  |  Branch (44:51): [True: 0, Folded]
  |  |  |  Branch (44:51): [True: 0, Folded]
  |  |  |  Branch (44:51): [Folded, False: 0]
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
  281|      0|                    }
  282|    135|                    else
  283|    135|                    {
  284|    135|                        ZSTD_memcpy(dctx->litBuffer, istart + lhSize, litSize);
  ------------------
  |  |   44|    135|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  285|    135|                    }
  286|    135|                    dctx->litPtr = dctx->litBuffer;
  287|    135|                    dctx->litSize = litSize;
  288|    135|                    return lhSize+litSize;
  289|    172|                }
  290|       |                /* direct reference into compressed stream */
  291|    112|                dctx->litPtr = istart+lhSize;
  292|    112|                dctx->litSize = litSize;
  293|    112|                dctx->litBufferEnd = dctx->litPtr + litSize;
  294|    112|                dctx->litBufferLocation = ZSTD_not_in_dst;
  295|    112|                return lhSize+litSize;
  296|    284|            }
  297|       |
  298|  1.90k|        case set_rle:
  ------------------
  |  Branch (298:9): [True: 1.90k, False: 976]
  ------------------
  299|  1.90k|            {   U32 const lhlCode = ((istart[0]) >> 2) & 3;
  300|  1.90k|                size_t litSize, lhSize;
  301|  1.90k|                size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity);
  ------------------
  |  |   54|  1.90k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 1.87k, False: 29]
  |  |  ------------------
  ------------------
  302|  1.90k|                switch(lhlCode)
  303|  1.90k|                {
  304|      2|                case 0: case 2: default:   /* note : default is impossible, since lhlCode into [0..3] */
  ------------------
  |  Branch (304:17): [True: 2, False: 1.90k]
  |  Branch (304:25): [True: 0, False: 1.90k]
  |  Branch (304:33): [True: 0, False: 1.90k]
  ------------------
  305|      2|                    lhSize = 1;
  306|      2|                    litSize = istart[0] >> 3;
  307|      2|                    break;
  308|     59|                case 1:
  ------------------
  |  Branch (308:17): [True: 59, False: 1.84k]
  ------------------
  309|     59|                    lhSize = 2;
  310|     59|                    RETURN_ERROR_IF(srcSize<3, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize+1 = 3");
  ------------------
  |  |  114|     59|    do {                                                                       \
  |  |  115|     59|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 58]
  |  |  ------------------
  |  |  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|     59|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 58]
  |  |  ------------------
  ------------------
  311|     58|                    litSize = MEM_readLE16(istart) >> 4;
  312|     58|                    break;
  313|  1.84k|                case 3:
  ------------------
  |  Branch (313:17): [True: 1.84k, False: 61]
  ------------------
  314|  1.84k|                    lhSize = 3;
  315|  1.84k|                    RETURN_ERROR_IF(srcSize<4, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize+1 = 4");
  ------------------
  |  |  114|  1.84k|    do {                                                                       \
  |  |  115|  1.84k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 1.84k]
  |  |  ------------------
  |  |  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.84k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.84k]
  |  |  ------------------
  ------------------
  316|  1.84k|                    litSize = MEM_readLE24(istart) >> 4;
  317|  1.84k|                    break;
  318|  1.90k|                }
  319|  1.90k|                RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|  1.90k|    do {                                                                       \
  |  |  115|  5.71k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1.90k, False: 2]
  |  |  |  Branch (115:13): [True: 0, False: 1.90k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  1.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.90k]
  |  |  ------------------
  ------------------
  320|  1.90k|                RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, "");
  ------------------
  |  |  114|  1.90k|    do {                                                                       \
  |  |  115|  1.90k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 19, False: 1.88k]
  |  |  ------------------
  |  |  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|  1.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.88k]
  |  |  ------------------
  ------------------
  321|  1.88k|                RETURN_ERROR_IF(expectedWriteSize < litSize, dstSize_tooSmall, "");
  ------------------
  |  |  114|  1.88k|    do {                                                                       \
  |  |  115|  1.88k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 1.88k]
  |  |  ------------------
  |  |  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.88k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.88k]
  |  |  ------------------
  ------------------
  322|  1.88k|                ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 1);
  323|  1.88k|                if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (323:21): [True: 1.48k, False: 395]
  ------------------
  324|  1.48k|                {
  325|  1.48k|                    ZSTD_memset(dctx->litBuffer, istart[lhSize], litSize - ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   46|  8.93k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  |  |  ------------------
  |  |  |  Branch (46:55): [True: 0, Folded]
  |  |  |  Branch (46:55): [True: 1.48k, Folded]
  |  |  |  Branch (46:55): [Folded, False: 1.48k]
  |  |  ------------------
  ------------------
  326|  1.48k|                    ZSTD_memset(dctx->litExtraBuffer, istart[lhSize], ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   46|  8.93k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  |  |  ------------------
  |  |  |  Branch (46:55): [True: 0, Folded]
  |  |  |  Branch (46:55): [True: 1.48k, Folded]
  |  |  |  Branch (46:55): [Folded, False: 1.48k]
  |  |  ------------------
  ------------------
  327|  1.48k|                }
  328|    395|                else
  329|    395|                {
  330|    395|                    ZSTD_memset(dctx->litBuffer, istart[lhSize], litSize);
  ------------------
  |  |   46|    395|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  331|    395|                }
  332|  1.88k|                dctx->litPtr = dctx->litBuffer;
  333|  1.88k|                dctx->litSize = litSize;
  334|  1.88k|                return lhSize+1;
  335|  1.88k|            }
  336|      0|        default:
  ------------------
  |  Branch (336:9): [True: 0, False: 2.88k]
  ------------------
  337|      0|            RETURN_ERROR(corruption_detected, "impossible");
  ------------------
  |  |  131|      0|    do {                                                                     \
  |  |  132|      0|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|      0|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|      0|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|      0|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|      0|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|      0|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  338|  2.88k|        }
  339|  2.88k|    }
  340|  2.88k|}
zstd_decompress_block.c:ZSTD_allocateLiteralsBuffer:
   82|  2.81k|{
   83|  2.81k|    size_t const blockSizeMax = ZSTD_blockSizeMax(dctx);
   84|  2.81k|    assert(litSize <= blockSizeMax);
  ------------------
  |  |   70|  2.81k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   85|  2.81k|    assert(dctx->isFrameDecompression || streaming == not_streaming);
  ------------------
  |  |   70|  2.81k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   86|  2.81k|    assert(expectedWriteSize <= blockSizeMax);
  ------------------
  |  |   70|  2.81k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   87|  2.81k|    if (streaming == not_streaming && dstCapacity > blockSizeMax + WILDCOPY_OVERLENGTH + litSize + WILDCOPY_OVERLENGTH) {
  ------------------
  |  |  199|  2.81k|#define WILDCOPY_OVERLENGTH 32
  ------------------
                  if (streaming == not_streaming && dstCapacity > blockSizeMax + WILDCOPY_OVERLENGTH + litSize + WILDCOPY_OVERLENGTH) {
  ------------------
  |  |  199|  2.81k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  |  Branch (87:9): [True: 2.81k, False: 0]
  |  Branch (87:39): [True: 1.07k, False: 1.74k]
  ------------------
   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.07k|        dctx->litBuffer = (BYTE*)dst + blockSizeMax + WILDCOPY_OVERLENGTH;
  ------------------
  |  |  199|  1.07k|#define WILDCOPY_OVERLENGTH 32
  ------------------
   94|  1.07k|        dctx->litBufferEnd = dctx->litBuffer + litSize;
   95|  1.07k|        dctx->litBufferLocation = ZSTD_in_dst;
   96|  1.74k|    } else if (litSize <= ZSTD_LITBUFFEREXTRASIZE) {
  ------------------
  |  |  118|  1.74k|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|  1.74k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  3.48k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 1.74k]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 1.74k, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (96:16): [True: 229, False: 1.51k]
  ------------------
   97|       |        /* Literals fit entirely within the extra buffer, put them there to avoid
   98|       |         * having to split the literals.
   99|       |         */
  100|    229|        dctx->litBuffer = dctx->litExtraBuffer;
  101|    229|        dctx->litBufferEnd = dctx->litBuffer + litSize;
  102|    229|        dctx->litBufferLocation = ZSTD_not_in_dst;
  103|  1.51k|    } else {
  104|  1.51k|        assert(blockSizeMax > ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   70|  1.51k|#    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.51k|        if (splitImmediately) {
  ------------------
  |  Branch (112:13): [True: 1.50k, False: 8]
  ------------------
  113|       |            /* won't fit in litExtraBuffer, so it will be split between end of dst and extra buffer */
  114|  1.50k|            dctx->litBuffer = (BYTE*)dst + expectedWriteSize - litSize + ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  118|  1.50k|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|  1.50k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  3.00k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 1.50k]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 1.50k, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          dctx->litBuffer = (BYTE*)dst + expectedWriteSize - litSize + ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  199|  1.50k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  115|  1.50k|            dctx->litBufferEnd = dctx->litBuffer + litSize - ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|  1.50k|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|  1.50k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  3.00k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 1.50k]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 1.50k, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  116|  1.50k|        } else {
  117|       |            /* initially this will be stored entirely in dst during huffman decoding, it will partially be shifted to litExtraBuffer after */
  118|      8|            dctx->litBuffer = (BYTE*)dst + expectedWriteSize - litSize;
  119|      8|            dctx->litBufferEnd = (BYTE*)dst + expectedWriteSize;
  120|      8|        }
  121|  1.51k|        dctx->litBufferLocation = ZSTD_split;
  122|  1.51k|        assert(dctx->litBufferEnd <= (BYTE*)dst + expectedWriteSize);
  ------------------
  |  |   70|  1.51k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  123|  1.51k|    }
  124|  2.81k|}
zstd_decompress_block.c:ZSTD_buildFSETable_body_bmi2:
  620|  2.12k|{
  621|  2.12k|    ZSTD_buildFSETable_body(dt, normalizedCounter, maxSymbolValue,
  622|  2.12k|            baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  623|  2.12k|}
zstd_decompress_block.c:ZSTD_buildFSETable_body:
  489|  2.40k|{
  490|  2.40k|    ZSTD_seqSymbol* const tableDecode = dt+1;
  491|  2.40k|    U32 const maxSV1 = maxSymbolValue + 1;
  492|  2.40k|    U32 const tableSize = 1 << tableLog;
  493|       |
  494|  2.40k|    U16* symbolNext = (U16*)wksp;
  495|  2.40k|    BYTE* spread = (BYTE*)(symbolNext + MaxSeq + 1);
  ------------------
  |  |  107|  2.40k|#define MaxSeq MAX(MaxLL, MaxML)   /* Assumption : MaxOff < MaxLL,MaxML */
  |  |  ------------------
  |  |  |  |   55|  2.40k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [Folded, False: 2.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  496|  2.40k|    U32 highThreshold = tableSize - 1;
  497|       |
  498|       |
  499|       |    /* Sanity Checks */
  500|  2.40k|    assert(maxSymbolValue <= MaxSeq);
  ------------------
  |  |   70|  2.40k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  501|  2.40k|    assert(tableLog <= MaxFSELog);
  ------------------
  |  |   70|  2.40k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  502|  2.40k|    assert(wkspSize >= ZSTD_BUILD_FSE_TABLE_WKSP_SIZE);
  ------------------
  |  |   70|  2.40k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  503|  2.40k|    (void)wkspSize;
  504|       |    /* Init, lay down lowprob symbols */
  505|  2.40k|    {   ZSTD_seqSymbol_header DTableH;
  506|  2.40k|        DTableH.tableLog = tableLog;
  507|  2.40k|        DTableH.fastMode = 1;
  508|  2.40k|        {   S16 const largeLimit= (S16)(1 << (tableLog-1));
  509|  2.40k|            U32 s;
  510|  37.5k|            for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (510:23): [True: 35.1k, False: 2.40k]
  ------------------
  511|  35.1k|                if (normalizedCounter[s]==-1) {
  ------------------
  |  Branch (511:21): [True: 10.8k, False: 24.2k]
  ------------------
  512|  10.8k|                    tableDecode[highThreshold--].baseValue = s;
  513|  10.8k|                    symbolNext[s] = 1;
  514|  24.2k|                } else {
  515|  24.2k|                    if (normalizedCounter[s] >= largeLimit) DTableH.fastMode=0;
  ------------------
  |  Branch (515:25): [True: 1.35k, False: 22.9k]
  ------------------
  516|  24.2k|                    assert(normalizedCounter[s]>=0);
  ------------------
  |  |   70|  24.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  517|  24.2k|                    symbolNext[s] = (U16)normalizedCounter[s];
  518|  24.2k|        }   }   }
  519|  2.40k|        ZSTD_memcpy(dt, &DTableH, sizeof(DTableH));
  ------------------
  |  |   44|  2.40k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  520|  2.40k|    }
  521|       |
  522|       |    /* Spread symbols */
  523|  2.40k|    assert(tableSize <= 512);
  ------------------
  |  |   70|  2.40k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  524|       |    /* Specialized symbol spreading for the case when there are
  525|       |     * no low probability (-1 count) symbols. When compressing
  526|       |     * small blocks we avoid low probability symbols to hit this
  527|       |     * case, since header decoding speed matters more.
  528|       |     */
  529|  2.40k|    if (highThreshold == tableSize - 1) {
  ------------------
  |  Branch (529:9): [True: 570, False: 1.83k]
  ------------------
  530|    570|        size_t const tableMask = tableSize-1;
  531|    570|        size_t const step = FSE_TABLESTEP(tableSize);
  ------------------
  |  |  623|    570|#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
  ------------------
  532|       |        /* First lay down the symbols in order.
  533|       |         * We use a uint64_t to lay down 8 bytes at a time. This reduces branch
  534|       |         * misses since small blocks generally have small table logs, so nearly
  535|       |         * all symbols have counts <= 8. We ensure we have 8 bytes at the end of
  536|       |         * our buffer to handle the over-write.
  537|       |         */
  538|    570|        {
  539|    570|            U64 const add = 0x0101010101010101ull;
  540|    570|            size_t pos = 0;
  541|    570|            U64 sv = 0;
  542|    570|            U32 s;
  543|  9.91k|            for (s=0; s<maxSV1; ++s, sv += add) {
  ------------------
  |  Branch (543:23): [True: 9.34k, False: 570]
  ------------------
  544|  9.34k|                int i;
  545|  9.34k|                int const n = normalizedCounter[s];
  546|  9.34k|                MEM_write64(spread + pos, sv);
  547|  16.1k|                for (i = 8; i < n; i += 8) {
  ------------------
  |  Branch (547:29): [True: 6.83k, False: 9.34k]
  ------------------
  548|  6.83k|                    MEM_write64(spread + pos + i, sv);
  549|  6.83k|                }
  550|  9.34k|                assert(n>=0);
  ------------------
  |  |   70|  9.34k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  551|  9.34k|                pos += (size_t)n;
  552|  9.34k|            }
  553|    570|        }
  554|       |        /* Now we spread those positions across the table.
  555|       |         * The benefit of doing it in two stages is that we avoid the
  556|       |         * variable size inner loop, which caused lots of branch misses.
  557|       |         * Now we can run through all the positions without any branch misses.
  558|       |         * We unroll the loop twice, since that is what empirically worked best.
  559|       |         */
  560|    570|        {
  561|    570|            size_t position = 0;
  562|    570|            size_t s;
  563|    570|            size_t const unroll = 2;
  564|    570|            assert(tableSize % unroll == 0); /* FSE_MIN_TABLELOG is 5 */
  ------------------
  |  |   70|    570|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  565|  31.7k|            for (s = 0; s < (size_t)tableSize; s += unroll) {
  ------------------
  |  Branch (565:25): [True: 31.1k, False: 570]
  ------------------
  566|  31.1k|                size_t u;
  567|  93.5k|                for (u = 0; u < unroll; ++u) {
  ------------------
  |  Branch (567:29): [True: 62.3k, False: 31.1k]
  ------------------
  568|  62.3k|                    size_t const uPosition = (position + (u * step)) & tableMask;
  569|  62.3k|                    tableDecode[uPosition].baseValue = spread[s + u];
  570|  62.3k|                }
  571|  31.1k|                position = (position + (unroll * step)) & tableMask;
  572|  31.1k|            }
  573|    570|            assert(position == 0);
  ------------------
  |  |   70|    570|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  574|    570|        }
  575|  1.83k|    } else {
  576|  1.83k|        U32 const tableMask = tableSize-1;
  577|  1.83k|        U32 const step = FSE_TABLESTEP(tableSize);
  ------------------
  |  |  623|  1.83k|#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
  ------------------
  578|  1.83k|        U32 s, position = 0;
  579|  27.6k|        for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (579:19): [True: 25.7k, False: 1.83k]
  ------------------
  580|  25.7k|            int i;
  581|  25.7k|            int const n = normalizedCounter[s];
  582|   171k|            for (i=0; i<n; i++) {
  ------------------
  |  Branch (582:23): [True: 145k, False: 25.7k]
  ------------------
  583|   145k|                tableDecode[position].baseValue = s;
  584|   145k|                position = (position + step) & tableMask;
  585|   156k|                while (UNLIKELY(position > highThreshold)) position = (position + step) & tableMask;   /* lowprob area */
  ------------------
  |  |  188|   156k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 10.7k, False: 145k]
  |  |  ------------------
  ------------------
  586|   145k|        }   }
  587|  1.83k|        assert(position == 0); /* position must reach all cells once, otherwise normalizedCounter is incorrect */
  ------------------
  |  |   70|  1.83k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  588|  1.83k|    }
  589|       |
  590|       |    /* Build Decoding table */
  591|  2.40k|    {
  592|  2.40k|        U32 u;
  593|   220k|        for (u=0; u<tableSize; u++) {
  ------------------
  |  Branch (593:19): [True: 218k, False: 2.40k]
  ------------------
  594|   218k|            U32 const symbol = tableDecode[u].baseValue;
  595|   218k|            U32 const nextState = symbolNext[symbol]++;
  596|   218k|            tableDecode[u].nbBits = (BYTE) (tableLog - ZSTD_highbit32(nextState) );
  597|   218k|            tableDecode[u].nextState = (U16) ( (nextState << tableDecode[u].nbBits) - tableSize);
  598|   218k|            assert(nbAdditionalBits[symbol] < 255);
  ------------------
  |  |   70|   218k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  599|   218k|            tableDecode[u].nbAdditionalBits = nbAdditionalBits[symbol];
  600|   218k|            tableDecode[u].baseValue = baseValue[symbol];
  601|   218k|        }
  602|  2.40k|    }
  603|  2.40k|}
zstd_decompress_block.c:ZSTD_buildFSETable_body_default:
  610|    275|{
  611|    275|    ZSTD_buildFSETable_body(dt, normalizedCounter, maxSymbolValue,
  612|    275|            baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  613|    275|}
zstd_decompress_block.c:ZSTD_buildSeqTable:
  654|  6.11k|{
  655|  6.11k|    switch(type)
  656|  6.11k|    {
  657|    225|    case set_rle :
  ------------------
  |  Branch (657:5): [True: 225, False: 5.88k]
  ------------------
  658|    225|        RETURN_ERROR_IF(!srcSize, srcSize_wrong, "");
  ------------------
  |  |  114|    225|    do {                                                                       \
  |  |  115|    225|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2, False: 223]
  |  |  ------------------
  |  |  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|    225|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 223]
  |  |  ------------------
  ------------------
  659|    223|        RETURN_ERROR_IF((*(const BYTE*)src) > max, corruption_detected, "");
  ------------------
  |  |  114|    223|    do {                                                                       \
  |  |  115|    223|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 4, False: 219]
  |  |  ------------------
  |  |  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|    223|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 219]
  |  |  ------------------
  ------------------
  660|    219|        {   U32 const symbol = *(const BYTE*)src;
  661|    219|            U32 const baseline = baseValue[symbol];
  662|    219|            U8 const nbBits = nbAdditionalBits[symbol];
  663|    219|            ZSTD_buildSeqTable_rle(DTableSpace, baseline, nbBits);
  664|    219|        }
  665|    219|        *DTablePtr = DTableSpace;
  666|    219|        return 1;
  667|  3.69k|    case set_basic :
  ------------------
  |  Branch (667:5): [True: 3.69k, False: 2.42k]
  ------------------
  668|  3.69k|        *DTablePtr = defaultTable;
  669|  3.69k|        return 0;
  670|     44|    case set_repeat:
  ------------------
  |  Branch (670:5): [True: 44, False: 6.06k]
  ------------------
  671|     44|        RETURN_ERROR_IF(!flagRepeatTable, corruption_detected, "");
  ------------------
  |  |  114|     44|    do {                                                                       \
  |  |  115|     44|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 6, False: 38]
  |  |  ------------------
  |  |  116|      6|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      6|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      6|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      6|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      6|    do {                                           \
  |  |  |  |   99|      6|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 6]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      6|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      6|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      6|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      6|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      6|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      6|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      6|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      6|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      6|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      6|        }                                                                      \
  |  |  123|     44|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 38]
  |  |  ------------------
  ------------------
  672|       |        /* prefetch FSE table if used */
  673|     38|        if (ddictIsCold && (nbSeq > 24 /* heuristic */)) {
  ------------------
  |  Branch (673:13): [True: 0, False: 38]
  |  Branch (673:28): [True: 0, False: 0]
  ------------------
  674|      0|            const void* const pStart = *DTablePtr;
  675|      0|            size_t const pSize = sizeof(ZSTD_seqSymbol) * (SEQSYMBOL_TABLE_SIZE(maxLog));
  ------------------
  |  |   74|      0| #define SEQSYMBOL_TABLE_SIZE(log)   (1 + (1 << (log)))
  ------------------
  676|      0|            PREFETCH_AREA(pStart, pSize);
  ------------------
  |  |  159|      0|    do {                                                 \
  |  |  160|      0|        const char* const _ptr = (const char*)(p);       \
  |  |  161|      0|        size_t const _size = (size_t)(s);                \
  |  |  162|      0|        size_t _pos;                                     \
  |  |  163|      0|        for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \
  |  |  ------------------
  |  |  |  |  156|      0|#define CACHELINE_SIZE 64
  |  |  ------------------
  |  |  |  Branch (163:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  164|      0|            PREFETCH_L2(_ptr + _pos);                    \
  |  |  ------------------
  |  |  |  |  146|      0|#    define PREFETCH_L2(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */)
  |  |  ------------------
  |  |  165|      0|        }                                                \
  |  |  166|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  677|      0|        }
  678|     38|        return 0;
  679|  2.15k|    case set_compressed :
  ------------------
  |  Branch (679:5): [True: 2.15k, False: 3.96k]
  ------------------
  680|  2.15k|        {   unsigned tableLog;
  681|  2.15k|            S16 norm[MaxSeq+1];
  682|  2.15k|            size_t const headerSize = FSE_readNCount(norm, &max, &tableLog, src, srcSize);
  683|  2.15k|            RETURN_ERROR_IF(FSE_isError(headerSize), corruption_detected, "");
  ------------------
  |  |  114|  2.15k|    do {                                                                       \
  |  |  115|  2.15k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 12, False: 2.14k]
  |  |  ------------------
  |  |  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.15k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.14k]
  |  |  ------------------
  ------------------
  684|  2.14k|            RETURN_ERROR_IF(tableLog > maxLog, corruption_detected, "");
  ------------------
  |  |  114|  2.14k|    do {                                                                       \
  |  |  115|  2.14k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 11, False: 2.12k]
  |  |  ------------------
  |  |  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|  2.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.12k]
  |  |  ------------------
  ------------------
  685|  2.12k|            ZSTD_buildFSETable(DTableSpace, norm, max, baseValue, nbAdditionalBits, tableLog, wksp, wkspSize, bmi2);
  686|  2.12k|            *DTablePtr = DTableSpace;
  687|  2.12k|            return headerSize;
  688|  2.14k|        }
  689|      0|    default :
  ------------------
  |  Branch (689:5): [True: 0, False: 6.11k]
  ------------------
  690|      0|        assert(0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  691|      0|        RETURN_ERROR(GENERIC, "impossible");
  ------------------
  |  |  131|      0|    do {                                                                     \
  |  |  132|      0|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|      0|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|      0|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|      0|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|      0|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|      0|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  692|  6.11k|    }
  693|  6.11k|}
zstd_decompress_block.c:ZSTD_buildSeqTable_rle:
  464|    219|{
  465|    219|    void* ptr = dt;
  466|    219|    ZSTD_seqSymbol_header* const DTableH = (ZSTD_seqSymbol_header*)ptr;
  467|    219|    ZSTD_seqSymbol* const cell = dt + 1;
  468|       |
  469|    219|    DTableH->tableLog = 0;
  470|    219|    DTableH->fastMode = 0;
  471|       |
  472|    219|    cell->nbBits = 0;
  473|    219|    cell->nextState = 0;
  474|    219|    assert(nbAddBits < 255);
  ------------------
  |  |   70|    219|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  475|    219|    cell->nbAdditionalBits = nbAddBits;
  476|    219|    cell->baseValue = baseValue;
  477|    219|}
zstd_decompress_block.c:ZSTD_blockSizeMax:
   55|  12.8k|{
   56|  12.8k|    size_t const blockSizeMax = dctx->isFrameDecompression ? dctx->fParams.blockSizeMax : ZSTD_BLOCKSIZE_MAX;
  ------------------
  |  |  148|  12.8k|#define ZSTD_BLOCKSIZE_MAX     (1<<ZSTD_BLOCKSIZELOG_MAX)
  |  |  ------------------
  |  |  |  |  147|      0|#define ZSTD_BLOCKSIZELOG_MAX  17
  |  |  ------------------
  ------------------
  |  Branch (56:33): [True: 12.8k, False: 0]
  ------------------
   57|  12.8k|    assert(blockSizeMax <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  12.8k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   58|  12.8k|    return blockSizeMax;
   59|  12.8k|}
zstd_decompress_block.c:ZSTD_totalHistorySize:
 1997|  2.19k|{
 1998|  2.19k|    return (size_t)(op - virtualStart);
 1999|  2.19k|}
zstd_decompress_block.c:ZSTD_decompressSequencesLong:
 1979|    984|{
 1980|    984|    DEBUGLOG(5, "ZSTD_decompressSequencesLong");
  ------------------
  |  |  104|    984|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 984]
  |  |  ------------------
  ------------------
 1981|    984|#if DYNAMIC_BMI2
 1982|    984|    if (ZSTD_DCtx_get_bmi2(dctx)) {
  ------------------
  |  Branch (1982:9): [True: 984, False: 0]
  ------------------
 1983|    984|        return ZSTD_decompressSequencesLong_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1984|    984|    }
 1985|      0|#endif
 1986|      0|  return ZSTD_decompressSequencesLong_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1987|    984|}
zstd_decompress_block.c:ZSTD_decompressSequencesLong_bmi2:
 1931|    984|{
 1932|    984|    return ZSTD_decompressSequencesLong_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1933|    984|}
zstd_decompress_block.c:ZSTD_decompressSequencesLong_body:
 1738|    984|{
 1739|    984|    const BYTE* ip = (const BYTE*)seqStart;
 1740|    984|    const BYTE* const iend = ip + seqSize;
 1741|    984|    BYTE* const ostart = (BYTE*)dst;
 1742|    984|    BYTE* const oend = dctx->litBufferLocation == ZSTD_in_dst ? dctx->litBuffer : ZSTD_maybeNullPtrAdd(ostart, maxDstSize);
  ------------------
  |  Branch (1742:24): [True: 86, False: 898]
  ------------------
 1743|    984|    BYTE* op = ostart;
 1744|    984|    const BYTE* litPtr = dctx->litPtr;
 1745|    984|    const BYTE* litBufferEnd = dctx->litBufferEnd;
 1746|    984|    const BYTE* const prefixStart = (const BYTE*) (dctx->prefixStart);
 1747|    984|    const BYTE* const dictStart = (const BYTE*) (dctx->virtualStart);
 1748|    984|    const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd);
 1749|       |
 1750|       |    /* Regen sequences */
 1751|    984|    if (nbSeq) {
  ------------------
  |  Branch (1751:9): [True: 982, False: 2]
  ------------------
 1752|    982|#define STORED_SEQS 8
 1753|    982|#define STORED_SEQS_MASK (STORED_SEQS-1)
 1754|    982|#define ADVANCED_SEQS STORED_SEQS
 1755|    982|        seq_t sequences[STORED_SEQS];
 1756|    982|        int const seqAdvance = MIN(nbSeq, ADVANCED_SEQS);
  ------------------
  |  |   54|    982|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 14, False: 968]
  |  |  ------------------
  ------------------
 1757|    982|        seqState_t seqState;
 1758|    982|        int seqNb;
 1759|    982|        size_t prefetchPos = (size_t)(op-prefixStart); /* track position relative to prefixStart */
 1760|       |
 1761|    982|        dctx->fseEntropy = 1;
 1762|  3.92k|        { int i; for (i=0; i<ZSTD_REP_NUM; i++) seqState.prevOffset[i] = dctx->entropy.rep[i]; }
  ------------------
  |  |   64|  3.92k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1762:28): [True: 2.94k, False: 982]
  ------------------
 1763|    982|        assert(dst != NULL);
  ------------------
  |  |   70|    982|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1764|    982|        assert(iend >= ip);
  ------------------
  |  |   70|    982|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1765|    982|        RETURN_ERROR_IF(
  ------------------
  |  |  114|    982|    do {                                                                       \
  |  |  115|    982|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 40, False: 942]
  |  |  ------------------
  |  |  116|     40|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     40|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 40]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     40|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     40|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     40|    do {                                           \
  |  |  |  |   99|     40|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 40]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     40|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 40]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     40|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     40|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 40]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     40|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     40|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 40]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     40|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     40|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     40|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     40|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     40|        }                                                                      \
  |  |  123|    982|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 942]
  |  |  ------------------
  ------------------
 1766|    982|            ERR_isError(BIT_initDStream(&seqState.DStream, ip, iend-ip)),
 1767|    982|            corruption_detected, "");
 1768|    942|        ZSTD_initFseState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr);
 1769|    942|        ZSTD_initFseState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr);
 1770|    942|        ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr);
 1771|       |
 1772|       |        /* prepare in advance */
 1773|  8.43k|        for (seqNb=0; seqNb<seqAdvance; seqNb++) {
  ------------------
  |  Branch (1773:23): [True: 7.49k, False: 942]
  ------------------
 1774|  7.49k|            seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset, seqNb == nbSeq-1);
 1775|  7.49k|            prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd);
 1776|  7.49k|            sequences[seqNb] = sequence;
 1777|  7.49k|        }
 1778|       |
 1779|       |        /* decompress without stomping litBuffer */
 1780|  1.06M|        for (; seqNb < nbSeq; seqNb++) {
  ------------------
  |  Branch (1780:16): [True: 1.06M, False: 266]
  ------------------
 1781|  1.06M|            seq_t sequence = ZSTD_decodeSequence(&seqState, isLongOffset, seqNb == nbSeq-1);
 1782|       |
 1783|  1.06M|            if (dctx->litBufferLocation == ZSTD_split && litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength > dctx->litBufferEnd) {
  ------------------
  |  | 1754|   672k|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1752|   672k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
                          if (dctx->litBufferLocation == ZSTD_split && litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength > dctx->litBufferEnd) {
  ------------------
  |  | 1753|   672k|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|   672k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
  |  Branch (1783:17): [True: 672k, False: 390k]
  |  Branch (1783:58): [True: 434, False: 672k]
  ------------------
 1784|       |                /* lit buffer is reaching split point, empty out the first buffer and transition to litExtraBuffer */
 1785|    434|                const size_t leftoverLit = dctx->litBufferEnd - litPtr;
 1786|    434|                if (leftoverLit)
  ------------------
  |  Branch (1786:21): [True: 424, False: 10]
  ------------------
 1787|    424|                {
 1788|    424|                    RETURN_ERROR_IF(leftoverLit > (size_t)(oend - op), dstSize_tooSmall, "remaining lit must fit within dstBuffer");
  ------------------
  |  |  114|    424|    do {                                                                       \
  |  |  115|    424|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 10, False: 414]
  |  |  ------------------
  |  |  116|     10|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     10|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     10|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     10|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     10|    do {                                           \
  |  |  |  |   99|     10|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     10|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     10|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     10|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     10|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     10|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     10|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     10|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     10|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     10|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     10|        }                                                                      \
  |  |  123|    424|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 414]
  |  |  ------------------
  ------------------
 1789|    414|                    ZSTD_safecopyDstBeforeSrc(op, litPtr, leftoverLit);
 1790|    414|                    sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength -= leftoverLit;
  ------------------
  |  | 1754|    414|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1752|    414|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
                                  sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength -= leftoverLit;
  ------------------
  |  | 1753|    414|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|    414|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1791|    414|                    op += leftoverLit;
 1792|    414|                }
 1793|    424|                litPtr = dctx->litExtraBuffer;
 1794|    424|                litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|    424|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|    424|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    848|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 424]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 424, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1795|    424|                dctx->litBufferLocation = ZSTD_not_in_dst;
 1796|    424|                {   size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd);
  ------------------
  |  | 1754|    424|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1752|    424|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
                              {   size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd);
  ------------------
  |  | 1753|    424|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|    424|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1797|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1798|       |                    assert(!ZSTD_isError(oneSeqSize));
 1799|       |                    ZSTD_assertValidSequence(dctx, op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], prefixStart, dictStart);
 1800|       |#endif
 1801|    424|                    if (ZSTD_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  |   44|    424|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1801:25): [True: 72, False: 352]
  ------------------
 1802|       |
 1803|    352|                    prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd);
 1804|    352|                    sequences[seqNb & STORED_SEQS_MASK] = sequence;
  ------------------
  |  | 1753|    352|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|    352|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1805|    352|                    op += oneSeqSize;
 1806|    352|            }   }
 1807|  1.06M|            else
 1808|  1.06M|            {
 1809|       |                /* lit buffer is either wholly contained in first or second split, or not split at all*/
 1810|  1.06M|                size_t const oneSeqSize = dctx->litBufferLocation == ZSTD_split ?
  ------------------
  |  Branch (1810:43): [True: 672k, False: 390k]
  ------------------
 1811|   672k|                    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) :
  ------------------
  |  | 1754|   672k|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1752|   672k|#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) :
  ------------------
  |  | 1753|   672k|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|   672k|#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) :
  ------------------
  |  |  199|   672k|#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) :
  ------------------
  |  | 1754|   672k|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1752|   672k|#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) :
  ------------------
  |  | 1753|   672k|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|   672k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1812|  1.06M|                    ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd);
  ------------------
  |  | 1754|   390k|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1752|   390k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
                                  ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd);
  ------------------
  |  | 1753|   390k|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|   390k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1813|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1814|       |                assert(!ZSTD_isError(oneSeqSize));
 1815|       |                ZSTD_assertValidSequence(dctx, op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], prefixStart, dictStart);
 1816|       |#endif
 1817|  1.06M|                if (ZSTD_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  |   44|  1.06M|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1817:21): [True: 594, False: 1.06M]
  ------------------
 1818|       |
 1819|  1.06M|                prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd);
 1820|  1.06M|                sequences[seqNb & STORED_SEQS_MASK] = sequence;
  ------------------
  |  | 1753|  1.06M|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|  1.06M|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1821|  1.06M|                op += oneSeqSize;
 1822|  1.06M|            }
 1823|  1.06M|        }
 1824|    266|        RETURN_ERROR_IF(!BIT_endOfDStream(&seqState.DStream), corruption_detected, "");
  ------------------
  |  |  114|    266|    do {                                                                       \
  |  |  115|    266|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 22, False: 244]
  |  |  ------------------
  |  |  116|     22|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     22|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 22]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     22|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     22|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     22|    do {                                           \
  |  |  |  |   99|     22|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 22]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     22|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 22]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     22|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     22|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 22]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     22|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     22|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 22]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     22|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     22|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     22|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     22|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     22|        }                                                                      \
  |  |  123|    266|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 244]
  |  |  ------------------
  ------------------
 1825|       |
 1826|       |        /* finish queue */
 1827|    244|        seqNb -= seqAdvance;
 1828|  1.79k|        for ( ; seqNb<nbSeq ; seqNb++) {
  ------------------
  |  Branch (1828:17): [True: 1.66k, False: 133]
  ------------------
 1829|  1.66k|            seq_t *sequence = &(sequences[seqNb&STORED_SEQS_MASK]);
  ------------------
  |  | 1753|  1.66k|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|  1.66k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1830|  1.66k|            if (dctx->litBufferLocation == ZSTD_split && litPtr + sequence->litLength > dctx->litBufferEnd) {
  ------------------
  |  Branch (1830:17): [True: 824, False: 842]
  |  Branch (1830:58): [True: 110, False: 714]
  ------------------
 1831|    110|                const size_t leftoverLit = dctx->litBufferEnd - litPtr;
 1832|    110|                if (leftoverLit) {
  ------------------
  |  Branch (1832:21): [True: 109, False: 1]
  ------------------
 1833|    109|                    RETURN_ERROR_IF(leftoverLit > (size_t)(oend - op), dstSize_tooSmall, "remaining lit must fit within dstBuffer");
  ------------------
  |  |  114|    109|    do {                                                                       \
  |  |  115|    109|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 108]
  |  |  ------------------
  |  |  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|    109|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 108]
  |  |  ------------------
  ------------------
 1834|    108|                    ZSTD_safecopyDstBeforeSrc(op, litPtr, leftoverLit);
 1835|    108|                    sequence->litLength -= leftoverLit;
 1836|    108|                    op += leftoverLit;
 1837|    108|                }
 1838|    109|                litPtr = dctx->litExtraBuffer;
 1839|    109|                litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|    109|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|    109|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    218|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 109]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 109, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1840|    109|                dctx->litBufferLocation = ZSTD_not_in_dst;
 1841|    109|                {   size_t const oneSeqSize = ZSTD_execSequence(op, oend, *sequence, &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd);
 1842|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1843|       |                    assert(!ZSTD_isError(oneSeqSize));
 1844|       |                    ZSTD_assertValidSequence(dctx, op, oend, sequences[seqNb&STORED_SEQS_MASK], prefixStart, dictStart);
 1845|       |#endif
 1846|    109|                    if (ZSTD_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  |   44|    109|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1846:25): [True: 21, False: 88]
  ------------------
 1847|     88|                    op += oneSeqSize;
 1848|     88|                }
 1849|     88|            }
 1850|  1.55k|            else
 1851|  1.55k|            {
 1852|  1.55k|                size_t const oneSeqSize = dctx->litBufferLocation == ZSTD_split ?
  ------------------
  |  Branch (1852:43): [True: 714, False: 842]
  ------------------
 1853|    714|                    ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequence->litLength - WILDCOPY_OVERLENGTH, *sequence, &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd) :
  ------------------
  |  |  199|    714|#define WILDCOPY_OVERLENGTH 32
  ------------------
 1854|  1.55k|                    ZSTD_execSequence(op, oend, *sequence, &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd);
 1855|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1856|       |                assert(!ZSTD_isError(oneSeqSize));
 1857|       |                ZSTD_assertValidSequence(dctx, op, oend, sequences[seqNb&STORED_SEQS_MASK], prefixStart, dictStart);
 1858|       |#endif
 1859|  1.55k|                if (ZSTD_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  |   44|  1.55k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1859:21): [True: 89, False: 1.46k]
  ------------------
 1860|  1.46k|                op += oneSeqSize;
 1861|  1.46k|            }
 1862|  1.66k|        }
 1863|       |
 1864|       |        /* save reps for next block */
 1865|    532|        { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) dctx->entropy.rep[i] = (U32)(seqState.prevOffset[i]); }
  ------------------
  |  |   64|    532|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1865:28): [True: 399, False: 133]
  ------------------
 1866|    133|    }
 1867|       |
 1868|       |    /* last literal segment */
 1869|    135|    if (dctx->litBufferLocation == ZSTD_split) { /* first deplete literal buffer in dst, then copy litExtraBuffer */
  ------------------
  |  Branch (1869:9): [True: 31, False: 104]
  ------------------
 1870|     31|        size_t const lastLLSize = litBufferEnd - litPtr;
 1871|     31|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend - op), dstSize_tooSmall, "");
  ------------------
  |  |  114|     31|    do {                                                                       \
  |  |  115|     31|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 7, False: 24]
  |  |  ------------------
  |  |  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|     31|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 24]
  |  |  ------------------
  ------------------
 1872|     24|        if (op != NULL) {
  ------------------
  |  Branch (1872:13): [True: 24, False: 0]
  ------------------
 1873|     24|            ZSTD_memmove(op, litPtr, lastLLSize);
  ------------------
  |  |   45|     24|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1874|     24|            op += lastLLSize;
 1875|     24|        }
 1876|     24|        litPtr = dctx->litExtraBuffer;
 1877|     24|        litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|     24|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|     24|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|     48|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 24]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 24, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1878|     24|    }
 1879|    128|    {   size_t const lastLLSize = litBufferEnd - litPtr;
 1880|    128|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall, "");
  ------------------
  |  |  114|    128|    do {                                                                       \
  |  |  115|    128|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 18, False: 110]
  |  |  ------------------
  |  |  116|     18|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     18|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     18|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     18|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     18|    do {                                           \
  |  |  |  |   99|     18|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     18|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     18|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     18|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     18|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     18|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     18|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     18|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     18|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     18|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     18|        }                                                                      \
  |  |  123|    128|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 110]
  |  |  ------------------
  ------------------
 1881|    110|        if (op != NULL) {
  ------------------
  |  Branch (1881:13): [True: 110, False: 0]
  ------------------
 1882|    110|            ZSTD_memmove(op, litPtr, lastLLSize);
  ------------------
  |  |   45|    110|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1883|    110|            op += lastLLSize;
 1884|    110|        }
 1885|    110|    }
 1886|       |
 1887|      0|    return (size_t)(op - ostart);
 1888|    128|}
zstd_decompress_block.c:ZSTD_initFseState:
 1193|  5.63k|{
 1194|  5.63k|    const void* ptr = dt;
 1195|  5.63k|    const ZSTD_seqSymbol_header* const DTableH = (const ZSTD_seqSymbol_header*)ptr;
 1196|  5.63k|    DStatePtr->state = BIT_readBits(bitD, DTableH->tableLog);
 1197|  5.63k|    DEBUGLOG(6, "ZSTD_initFseState : val=%u using %u bits",
  ------------------
  |  |  104|  5.63k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.63k]
  |  |  ------------------
  ------------------
 1198|  5.63k|                (U32)DStatePtr->state, DTableH->tableLog);
 1199|  5.63k|    BIT_reloadDStream(bitD);
 1200|  5.63k|    DStatePtr->table = dt + 1;
 1201|  5.63k|}
zstd_decompress_block.c:ZSTD_decodeSequence:
 1230|  2.50M|{
 1231|  2.50M|    seq_t seq;
 1232|       |    /*
 1233|       |     * ZSTD_seqSymbol is a 64 bits wide structure.
 1234|       |     * It can be loaded in one operation
 1235|       |     * and its fields extracted by simply shifting or bit-extracting on aarch64.
 1236|       |     * GCC doesn't recognize this and generates more unnecessary ldr/ldrb/ldrh
 1237|       |     * operations that cause performance drop. This can be avoided by using this
 1238|       |     * ZSTD_memcpy hack.
 1239|       |     */
 1240|       |#if defined(__aarch64__) && (defined(__GNUC__) && !defined(__clang__))
 1241|       |    ZSTD_seqSymbol llDInfoS, mlDInfoS, ofDInfoS;
 1242|       |    ZSTD_seqSymbol* const llDInfo = &llDInfoS;
 1243|       |    ZSTD_seqSymbol* const mlDInfo = &mlDInfoS;
 1244|       |    ZSTD_seqSymbol* const ofDInfo = &ofDInfoS;
 1245|       |    ZSTD_memcpy(llDInfo, seqState->stateLL.table + seqState->stateLL.state, sizeof(ZSTD_seqSymbol));
 1246|       |    ZSTD_memcpy(mlDInfo, seqState->stateML.table + seqState->stateML.state, sizeof(ZSTD_seqSymbol));
 1247|       |    ZSTD_memcpy(ofDInfo, seqState->stateOffb.table + seqState->stateOffb.state, sizeof(ZSTD_seqSymbol));
 1248|       |#else
 1249|  2.50M|    const ZSTD_seqSymbol* const llDInfo = seqState->stateLL.table + seqState->stateLL.state;
 1250|  2.50M|    const ZSTD_seqSymbol* const mlDInfo = seqState->stateML.table + seqState->stateML.state;
 1251|  2.50M|    const ZSTD_seqSymbol* const ofDInfo = seqState->stateOffb.table + seqState->stateOffb.state;
 1252|  2.50M|#endif
 1253|  2.50M|    seq.matchLength = mlDInfo->baseValue;
 1254|  2.50M|    seq.litLength = llDInfo->baseValue;
 1255|  2.50M|    {   U32 const ofBase = ofDInfo->baseValue;
 1256|  2.50M|        BYTE const llBits = llDInfo->nbAdditionalBits;
 1257|  2.50M|        BYTE const mlBits = mlDInfo->nbAdditionalBits;
 1258|  2.50M|        BYTE const ofBits = ofDInfo->nbAdditionalBits;
 1259|  2.50M|        BYTE const totalBits = llBits+mlBits+ofBits;
 1260|       |
 1261|  2.50M|        U16 const llNext = llDInfo->nextState;
 1262|  2.50M|        U16 const mlNext = mlDInfo->nextState;
 1263|  2.50M|        U16 const ofNext = ofDInfo->nextState;
 1264|  2.50M|        U32 const llnbBits = llDInfo->nbBits;
 1265|  2.50M|        U32 const mlnbBits = mlDInfo->nbBits;
 1266|  2.50M|        U32 const ofnbBits = ofDInfo->nbBits;
 1267|       |
 1268|  2.50M|        assert(llBits <= MaxLLBits);
  ------------------
  |  |   70|  2.50M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1269|  2.50M|        assert(mlBits <= MaxMLBits);
  ------------------
  |  |   70|  2.50M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1270|  2.50M|        assert(ofBits <= MaxOff);
  ------------------
  |  |   70|  2.50M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1271|       |        /*
 1272|       |         * As gcc has better branch and block analyzers, sometimes it is only
 1273|       |         * valuable to mark likeliness for clang, it gives around 3-4% of
 1274|       |         * performance.
 1275|       |         */
 1276|       |
 1277|       |        /* sequence */
 1278|  2.50M|        {   size_t offset;
 1279|  2.50M|            if (ofBits > 1) {
  ------------------
  |  Branch (1279:17): [True: 907k, False: 1.59M]
  ------------------
 1280|   907k|                ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1);
  ------------------
  |  |   43|   907k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|   907k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1281|   907k|                ZSTD_STATIC_ASSERT(LONG_OFFSETS_MAX_EXTRA_BITS_32 == 5);
  ------------------
  |  |   43|   907k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|   907k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1282|   907k|                ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 > LONG_OFFSETS_MAX_EXTRA_BITS_32);
  ------------------
  |  |   43|   907k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|   907k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1283|   907k|                ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 - LONG_OFFSETS_MAX_EXTRA_BITS_32 >= MaxMLBits);
  ------------------
  |  |   43|   907k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|   907k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1284|   907k|                if (MEM_32bits() && longOffsets && (ofBits >= STREAM_ACCUMULATOR_MIN_32)) {
  ------------------
  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  ------------------
  |  Branch (1284:21): [True: 0, False: 907k]
  |  Branch (1284:37): [True: 0, False: 0]
  |  Branch (1284:52): [True: 0, False: 0]
  ------------------
 1285|       |                    /* Always read extra bits, this keeps the logic simple,
 1286|       |                     * avoids branches, and avoids accidentally reading 0 bits.
 1287|       |                     */
 1288|      0|                    U32 const extraBits = LONG_OFFSETS_MAX_EXTRA_BITS_32;
  ------------------
  |  | 1216|      0|    (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32       \
  |  |  ------------------
  |  |  |  | 1263|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |                   (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32       \
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  |  |  Branch (1216:6): [True: 0, Folded]
  |  |  ------------------
  |  | 1217|      0|        ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32  \
  |  |  ------------------
  |  |  |  | 1263|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |                       ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32  \
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  | 1218|      0|        : 0)
  ------------------
 1289|      0|                    offset = ofBase + (BIT_readBitsFast(&seqState->DStream, ofBits - extraBits) << extraBits);
 1290|      0|                    BIT_reloadDStream(&seqState->DStream);
 1291|      0|                    offset += BIT_readBitsFast(&seqState->DStream, extraBits);
 1292|   907k|                } else {
 1293|   907k|                    offset = ofBase + BIT_readBitsFast(&seqState->DStream, ofBits/*>0*/);   /* <=  (ZSTD_WINDOWLOG_MAX-1) bits */
 1294|   907k|                    if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream);
  ------------------
  |  Branch (1294:25): [True: 0, False: 907k]
  ------------------
 1295|   907k|                }
 1296|   907k|                seqState->prevOffset[2] = seqState->prevOffset[1];
 1297|   907k|                seqState->prevOffset[1] = seqState->prevOffset[0];
 1298|   907k|                seqState->prevOffset[0] = offset;
 1299|  1.59M|            } else {
 1300|  1.59M|                U32 const ll0 = (llDInfo->baseValue == 0);
 1301|  1.59M|                if (LIKELY((ofBits == 0))) {
  ------------------
  |  |  187|  1.59M|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (187:19): [True: 1.09M, False: 502k]
  |  |  ------------------
  ------------------
 1302|  1.09M|                    offset = seqState->prevOffset[ll0];
 1303|  1.09M|                    seqState->prevOffset[1] = seqState->prevOffset[!ll0];
 1304|  1.09M|                    seqState->prevOffset[0] = offset;
 1305|  1.09M|                } else {
 1306|   502k|                    offset = ofBase + ll0 + BIT_readBitsFast(&seqState->DStream, 1);
 1307|   502k|                    {   size_t temp = (offset==3) ? seqState->prevOffset[0] - 1 : seqState->prevOffset[offset];
  ------------------
  |  Branch (1307:39): [True: 20.6k, False: 482k]
  ------------------
 1308|   502k|                        temp -= !temp; /* 0 is not valid: input corrupted => force offset to -1 => corruption detected at execSequence */
 1309|   502k|                        if (offset != 1) seqState->prevOffset[2] = seqState->prevOffset[1];
  ------------------
  |  Branch (1309:29): [True: 301k, False: 201k]
  ------------------
 1310|   502k|                        seqState->prevOffset[1] = seqState->prevOffset[0];
 1311|   502k|                        seqState->prevOffset[0] = offset = temp;
 1312|   502k|            }   }   }
 1313|  2.50M|            seq.offset = offset;
 1314|  2.50M|        }
 1315|       |
 1316|  2.50M|        if (mlBits > 0)
  ------------------
  |  Branch (1316:13): [True: 126k, False: 2.37M]
  ------------------
 1317|   126k|            seq.matchLength += BIT_readBitsFast(&seqState->DStream, mlBits/*>0*/);
 1318|       |
 1319|  2.50M|        if (MEM_32bits() && (mlBits+llBits >= STREAM_ACCUMULATOR_MIN_32-LONG_OFFSETS_MAX_EXTRA_BITS_32))
  ------------------
  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  ------------------
                      if (MEM_32bits() && (mlBits+llBits >= STREAM_ACCUMULATOR_MIN_32-LONG_OFFSETS_MAX_EXTRA_BITS_32))
  ------------------
  |  | 1216|      0|    (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32       \
  |  |  ------------------
  |  |  |  | 1263|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |                   (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32       \
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  |  |  Branch (1216:6): [True: 0, Folded]
  |  |  ------------------
  |  | 1217|      0|        ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32  \
  |  |  ------------------
  |  |  |  | 1263|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |                       ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32  \
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  | 1218|      0|        : 0)
  ------------------
  |  Branch (1319:13): [True: 0, False: 2.50M]
  |  Branch (1319:29): [True: 0, False: 0]
  ------------------
 1320|      0|            BIT_reloadDStream(&seqState->DStream);
 1321|  2.50M|        if (MEM_64bits() && UNLIKELY(totalBits >= STREAM_ACCUMULATOR_MIN_64-(LLFSELog+MLFSELog+OffFSELog)))
  ------------------
  |  |  188|  2.50M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 1.06k, False: 2.50M]
  |  |  ------------------
  ------------------
  |  Branch (1321:13): [True: 2.50M, False: 0]
  ------------------
 1322|  1.06k|            BIT_reloadDStream(&seqState->DStream);
 1323|       |        /* Ensure there are enough bits to read the rest of data in 64-bit mode. */
 1324|  2.50M|        ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64);
  ------------------
  |  |   43|  2.50M|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  2.50M|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1325|       |
 1326|  2.50M|        if (llBits > 0)
  ------------------
  |  Branch (1326:13): [True: 387k, False: 2.11M]
  ------------------
 1327|   387k|            seq.litLength += BIT_readBitsFast(&seqState->DStream, llBits/*>0*/);
 1328|       |
 1329|  2.50M|        if (MEM_32bits())
  ------------------
  |  Branch (1329:13): [True: 0, False: 2.50M]
  ------------------
 1330|      0|            BIT_reloadDStream(&seqState->DStream);
 1331|       |
 1332|  2.50M|        DEBUGLOG(6, "seq: litL=%u, matchL=%u, offset=%u",
  ------------------
  |  |  104|  2.50M|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.50M]
  |  |  ------------------
  ------------------
 1333|  2.50M|                    (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset);
 1334|       |
 1335|  2.50M|        if (!isLastSeq) {
  ------------------
  |  Branch (1335:13): [True: 2.50M, False: 433]
  ------------------
 1336|       |            /* don't update FSE state for last Sequence */
 1337|  2.50M|            ZSTD_updateFseStateWithDInfo(&seqState->stateLL, &seqState->DStream, llNext, llnbBits);    /* <=  9 bits */
 1338|  2.50M|            ZSTD_updateFseStateWithDInfo(&seqState->stateML, &seqState->DStream, mlNext, mlnbBits);    /* <=  9 bits */
 1339|  2.50M|            if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream);    /* <= 18 bits */
  ------------------
  |  Branch (1339:17): [True: 0, False: 2.50M]
  ------------------
 1340|  2.50M|            ZSTD_updateFseStateWithDInfo(&seqState->stateOffb, &seqState->DStream, ofNext, ofnbBits);  /* <=  8 bits */
 1341|  2.50M|            BIT_reloadDStream(&seqState->DStream);
 1342|  2.50M|        }
 1343|  2.50M|    }
 1344|       |
 1345|  2.50M|    return seq;
 1346|  2.50M|}
zstd_decompress_block.c:ZSTD_updateFseStateWithDInfo:
 1205|  7.50M|{
 1206|  7.50M|    size_t const lowBits = BIT_readBits(bitD, nbBits);
 1207|  7.50M|    DStatePtr->state = nextState + lowBits;
 1208|  7.50M|}
zstd_decompress_block.c:ZSTD_prefetchMatch:
 1717|  1.06M|{
 1718|  1.06M|    prefetchPos += sequence.litLength;
 1719|  1.06M|    {   const BYTE* const matchBase = (sequence.offset > prefetchPos) ? dictEnd : prefixStart;
  ------------------
  |  Branch (1719:39): [True: 2.39k, False: 1.06M]
  ------------------
 1720|       |        /* note : this operation can overflow when seq.offset is really too large, which can only happen when input is corrupted.
 1721|       |         * No consequence though : memory address is only used for prefetching, not for dereferencing */
 1722|  1.06M|        const BYTE* const match = ZSTD_wrappedPtrSub(ZSTD_wrappedPtrAdd(matchBase, prefetchPos), sequence.offset);
 1723|  1.06M|        PREFETCH_L1(match); PREFETCH_L1(match+CACHELINE_SIZE);   /* note : it's safe to invoke PREFETCH() on any memory address, including invalid ones */
  ------------------
  |  |  145|  1.06M|#    define PREFETCH_L1(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
  ------------------
                      PREFETCH_L1(match); PREFETCH_L1(match+CACHELINE_SIZE);   /* note : it's safe to invoke PREFETCH() on any memory address, including invalid ones */
  ------------------
  |  |  145|  1.06M|#    define PREFETCH_L1(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
  ------------------
 1724|  1.06M|    }
 1725|  1.06M|    return prefetchPos + sequence.matchLength;
 1726|  1.06M|}
zstd_decompress_block.c:ZSTD_safecopyDstBeforeSrc:
  877|   334k|static void ZSTD_safecopyDstBeforeSrc(BYTE* op, const BYTE* ip, ptrdiff_t length) {
  878|   334k|    ptrdiff_t const diff = op - ip;
  879|   334k|    BYTE* const oend = op + length;
  880|       |
  881|   334k|    if (length < 8 || diff > -8) {
  ------------------
  |  Branch (881:9): [True: 276k, False: 58.2k]
  |  Branch (881:23): [True: 57.1k, False: 1.08k]
  ------------------
  882|       |        /* Handle short lengths, close overlaps, and dst not before src. */
  883|  6.18M|        while (op < oend) *op++ = *ip++;
  ------------------
  |  Branch (883:16): [True: 5.85M, False: 333k]
  ------------------
  884|   333k|        return;
  885|   333k|    }
  886|       |
  887|  1.08k|    if (op <= oend - WILDCOPY_OVERLENGTH && diff < -WILDCOPY_VECLEN) {
  ------------------
  |  |  199|  2.17k|#define WILDCOPY_OVERLENGTH 32
  ------------------
                  if (op <= oend - WILDCOPY_OVERLENGTH && diff < -WILDCOPY_VECLEN) {
  ------------------
  |  |  200|    788|#define WILDCOPY_VECLEN 16
  ------------------
  |  Branch (887:9): [True: 788, False: 301]
  |  Branch (887:45): [True: 727, False: 61]
  ------------------
  888|    727|        ZSTD_wildcopy(op, ip, oend - WILDCOPY_OVERLENGTH - op, ZSTD_no_overlap);
  ------------------
  |  |  199|    727|#define WILDCOPY_OVERLENGTH 32
  ------------------
  889|    727|        ip += oend - WILDCOPY_OVERLENGTH - op;
  ------------------
  |  |  199|    727|#define WILDCOPY_OVERLENGTH 32
  ------------------
  890|    727|        op += oend - WILDCOPY_OVERLENGTH - op;
  ------------------
  |  |  199|    727|#define WILDCOPY_OVERLENGTH 32
  ------------------
  891|    727|    }
  892|       |
  893|       |    /* Handle the leftovers. */
  894|   305k|    while (op < oend) *op++ = *ip++;
  ------------------
  |  Branch (894:12): [True: 304k, False: 1.08k]
  ------------------
  895|  1.08k|}
zstd_decompress_block.c:ZSTD_execSequence:
 1005|  1.23M|{
 1006|  1.23M|    BYTE* const oLitEnd = op + sequence.litLength;
 1007|  1.23M|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
 1008|  1.23M|    BYTE* const oMatchEnd = op + sequenceLength;   /* risk : address space overflow (32-bits) */
 1009|  1.23M|    BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH;   /* risk : address space underflow on oend=NULL */
  ------------------
  |  |  199|  1.23M|#define WILDCOPY_OVERLENGTH 32
  ------------------
 1010|  1.23M|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
 1011|  1.23M|    const BYTE* match = oLitEnd - sequence.offset;
 1012|       |
 1013|  1.23M|    assert(op != NULL /* Precondition */);
  ------------------
  |  |   70|  1.23M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1014|  1.23M|    assert(oend_w < oend /* No underflow */);
  ------------------
  |  |   70|  1.23M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1015|       |
 1016|       |#if defined(__aarch64__)
 1017|       |    /* prefetch sequence starting from match that will be used for copy later */
 1018|       |    PREFETCH_L1(match);
 1019|       |#endif
 1020|       |    /* Handle edge cases in a slow path:
 1021|       |     *   - Read beyond end of literals
 1022|       |     *   - Match end is within WILDCOPY_OVERLIMIT of oend
 1023|       |     *   - 32-bit mode and the match length overflows
 1024|       |     */
 1025|  1.23M|    if (UNLIKELY(
  ------------------
  |  |  188|  6.19M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 1.30k, False: 1.23M]
  |  |  |  Branch (188:40): [True: 221, False: 1.23M]
  |  |  |  Branch (188:40): [True: 1.07k, False: 1.23M]
  |  |  |  Branch (188:40): [True: 0, False: 1.23M]
  |  |  |  Branch (188:40): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1026|  1.23M|        iLitEnd > litLimit ||
 1027|  1.23M|        oMatchEnd > oend_w ||
 1028|  1.23M|        (MEM_32bits() && (size_t)(oend - op) < sequenceLength + WILDCOPY_OVERLENGTH)))
 1029|  1.30k|        return ZSTD_execSequenceEnd(op, oend, sequence, litPtr, litLimit, prefixStart, virtualStart, dictEnd);
 1030|       |
 1031|       |    /* Assumptions (everything else goes into ZSTD_execSequenceEnd()) */
 1032|  1.23M|    assert(op <= oLitEnd /* No overflow */);
  ------------------
  |  |   70|  1.23M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1033|  1.23M|    assert(oLitEnd < oMatchEnd /* Non-zero match & no overflow */);
  ------------------
  |  |   70|  1.23M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1034|  1.23M|    assert(oMatchEnd <= oend /* No underflow */);
  ------------------
  |  |   70|  1.23M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1035|  1.23M|    assert(iLitEnd <= litLimit /* Literal length is in bounds */);
  ------------------
  |  |   70|  1.23M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1036|  1.23M|    assert(oLitEnd <= oend_w /* Can wildcopy literals */);
  ------------------
  |  |   70|  1.23M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1037|  1.23M|    assert(oMatchEnd <= oend_w /* Can wildcopy matches */);
  ------------------
  |  |   70|  1.23M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1038|       |
 1039|       |    /* Copy Literals:
 1040|       |     * Split out litLength <= 16 since it is nearly always true. +1.6% on gcc-9.
 1041|       |     * We likely don't need the full 32-byte wildcopy.
 1042|       |     */
 1043|  1.23M|    assert(WILDCOPY_OVERLENGTH >= 16);
  ------------------
  |  |   70|  1.23M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1044|  1.23M|    ZSTD_copy16(op, (*litPtr));
 1045|  1.23M|    if (UNLIKELY(sequence.litLength > 16)) {
  ------------------
  |  |  188|  1.23M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 91.8k, False: 1.14M]
  |  |  ------------------
  ------------------
 1046|  91.8k|        ZSTD_wildcopy(op + 16, (*litPtr) + 16, sequence.litLength - 16, ZSTD_no_overlap);
 1047|  91.8k|    }
 1048|  1.23M|    op = oLitEnd;
 1049|  1.23M|    *litPtr = iLitEnd;   /* update for next sequence */
 1050|       |
 1051|       |    /* Copy Match */
 1052|  1.23M|    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
  ------------------
  |  Branch (1052:9): [True: 802, False: 1.23M]
  ------------------
 1053|       |        /* offset beyond prefix -> go into extDict */
 1054|    802|        RETURN_ERROR_IF(UNLIKELY(sequence.offset > (size_t)(oLitEnd - virtualStart)), corruption_detected, "");
  ------------------
  |  |  114|    802|    do {                                                                       \
  |  |  115|    802|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 424, False: 378]
  |  |  ------------------
  |  |  116|    424|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    424|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 424]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    424|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    424|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    424|    do {                                           \
  |  |  |  |   99|    424|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 424]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    424|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 424]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    424|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    424|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 424]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    424|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    424|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 424]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    424|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    424|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    424|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    424|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    424|        }                                                                      \
  |  |  123|    802|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 378]
  |  |  ------------------
  ------------------
 1055|    378|        match = dictEnd + (match - prefixStart);
 1056|    378|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (1056:13): [True: 322, False: 56]
  ------------------
 1057|    322|            ZSTD_memmove(oLitEnd, match, sequence.matchLength);
  ------------------
  |  |   45|    322|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1058|    322|            return sequenceLength;
 1059|    322|        }
 1060|       |        /* span extDict & currentPrefixSegment */
 1061|     56|        {   size_t const length1 = dictEnd - match;
 1062|     56|        ZSTD_memmove(oLitEnd, match, length1);
  ------------------
  |  |   45|     56|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1063|     56|        op = oLitEnd + length1;
 1064|     56|        sequence.matchLength -= length1;
 1065|     56|        match = prefixStart;
 1066|     56|        }
 1067|     56|    }
 1068|       |    /* Match within prefix of 1 or more bytes */
 1069|  1.23M|    assert(op <= oMatchEnd);
  ------------------
  |  |   70|  1.23M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1070|  1.23M|    assert(oMatchEnd <= oend_w);
  ------------------
  |  |   70|  1.23M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1071|  1.23M|    assert(match >= prefixStart);
  ------------------
  |  |   70|  1.23M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1072|  1.23M|    assert(sequence.matchLength >= 1);
  ------------------
  |  |   70|  1.23M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1073|       |
 1074|       |    /* Nearly all offsets are >= WILDCOPY_VECLEN bytes, which means we can use wildcopy
 1075|       |     * without overlap checking.
 1076|       |     */
 1077|  1.23M|    if (LIKELY(sequence.offset >= WILDCOPY_VECLEN)) {
  ------------------
  |  |  187|  1.23M|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (187:19): [True: 472k, False: 764k]
  |  |  ------------------
  ------------------
 1078|       |        /* We bet on a full wildcopy for matches, since we expect matches to be
 1079|       |         * longer than literals (in general). In silesia, ~10% of matches are longer
 1080|       |         * than 16 bytes.
 1081|       |         */
 1082|   472k|        ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength, ZSTD_no_overlap);
 1083|   472k|        return sequenceLength;
 1084|   472k|    }
 1085|   764k|    assert(sequence.offset < WILDCOPY_VECLEN);
  ------------------
  |  |   70|   764k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1086|       |
 1087|       |    /* Copy 8 bytes and spread the offset to be >= 8. */
 1088|   764k|    ZSTD_overlapCopy8(&op, &match, sequence.offset);
 1089|       |
 1090|       |    /* If the match length is > 8 bytes, then continue with the wildcopy. */
 1091|   764k|    if (sequence.matchLength > 8) {
  ------------------
  |  Branch (1091:9): [True: 129k, False: 634k]
  ------------------
 1092|   129k|        assert(op < oMatchEnd);
  ------------------
  |  |   70|   129k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1093|   129k|        ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength - 8, ZSTD_overlap_src_before_dst);
 1094|   129k|    }
 1095|   764k|    return sequenceLength;
 1096|  1.23M|}
zstd_decompress_block.c:ZSTD_execSequenceEnd:
  911|  1.30k|{
  912|  1.30k|    BYTE* const oLitEnd = op + sequence.litLength;
  913|  1.30k|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
  914|  1.30k|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
  915|  1.30k|    const BYTE* match = oLitEnd - sequence.offset;
  916|  1.30k|    BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  199|  1.30k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  917|       |
  918|       |    /* bounds checks : careful of address space overflow in 32-bit mode */
  919|  1.30k|    RETURN_ERROR_IF(sequenceLength > (size_t)(oend - op), dstSize_tooSmall, "last match must fit within dstBuffer");
  ------------------
  |  |  114|  1.30k|    do {                                                                       \
  |  |  115|  1.30k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 507, False: 793]
  |  |  ------------------
  |  |  116|    507|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    507|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 507]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    507|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    507|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    507|    do {                                           \
  |  |  |  |   99|    507|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 507]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    507|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 507]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    507|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    507|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 507]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    507|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    507|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 507]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    507|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    507|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    507|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    507|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    507|        }                                                                      \
  |  |  123|  1.30k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 793]
  |  |  ------------------
  ------------------
  920|    793|    RETURN_ERROR_IF(sequence.litLength > (size_t)(litLimit - *litPtr), corruption_detected, "try to read beyond literal buffer");
  ------------------
  |  |  114|    793|    do {                                                                       \
  |  |  115|    793|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 154, False: 639]
  |  |  ------------------
  |  |  116|    154|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    154|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 154]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    154|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    154|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    154|    do {                                           \
  |  |  |  |   99|    154|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 154]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    154|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 154]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    154|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    154|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 154]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    154|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    154|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 154]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    154|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    154|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    154|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    154|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    154|        }                                                                      \
  |  |  123|    793|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 639]
  |  |  ------------------
  ------------------
  921|    639|    assert(op < op + sequenceLength);
  ------------------
  |  |   70|    639|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  922|    639|    assert(oLitEnd < op + sequenceLength);
  ------------------
  |  |   70|    639|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  923|       |
  924|       |    /* copy literals */
  925|    639|    ZSTD_safecopy(op, oend_w, *litPtr, sequence.litLength, ZSTD_no_overlap);
  926|    639|    op = oLitEnd;
  927|    639|    *litPtr = iLitEnd;
  928|       |
  929|       |    /* copy Match */
  930|    639|    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
  ------------------
  |  Branch (930:9): [True: 55, False: 584]
  ------------------
  931|       |        /* offset beyond prefix */
  932|     55|        RETURN_ERROR_IF(sequence.offset > (size_t)(oLitEnd - virtualStart), corruption_detected, "");
  ------------------
  |  |  114|     55|    do {                                                                       \
  |  |  115|     55|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 46, False: 9]
  |  |  ------------------
  |  |  116|     46|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     46|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 46]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     46|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     46|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     46|    do {                                           \
  |  |  |  |   99|     46|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 46]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     46|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 46]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     46|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     46|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 46]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     46|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     46|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 46]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     46|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     46|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     46|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     46|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     46|        }                                                                      \
  |  |  123|     55|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 9]
  |  |  ------------------
  ------------------
  933|      9|        match = dictEnd - (prefixStart - match);
  934|      9|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (934:13): [True: 8, False: 1]
  ------------------
  935|      8|            ZSTD_memmove(oLitEnd, match, sequence.matchLength);
  ------------------
  |  |   45|      8|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  936|      8|            return sequenceLength;
  937|      8|        }
  938|       |        /* span extDict & currentPrefixSegment */
  939|      1|        {   size_t const length1 = dictEnd - match;
  940|      1|        ZSTD_memmove(oLitEnd, match, length1);
  ------------------
  |  |   45|      1|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  941|      1|        op = oLitEnd + length1;
  942|      1|        sequence.matchLength -= length1;
  943|      1|        match = prefixStart;
  944|      1|        }
  945|      1|    }
  946|    585|    ZSTD_safecopy(op, oend_w, match, sequence.matchLength, ZSTD_overlap_src_before_dst);
  947|    585|    return sequenceLength;
  948|    639|}
zstd_decompress_block.c:ZSTD_safecopy:
  837|   335k|static void ZSTD_safecopy(BYTE* op, const BYTE* const oend_w, BYTE const* ip, ptrdiff_t length, ZSTD_overlap_e ovtype) {
  838|   335k|    ptrdiff_t const diff = op - ip;
  839|   335k|    BYTE* const oend = op + length;
  840|       |
  841|   335k|    assert((ovtype == ZSTD_no_overlap && (diff <= -8 || diff >= 8 || op >= oend_w)) ||
  ------------------
  |  |   70|   335k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  842|   335k|           (ovtype == ZSTD_overlap_src_before_dst && diff >= 0));
  843|       |
  844|   335k|    if (length < 8) {
  ------------------
  |  Branch (844:9): [True: 251k, False: 83.7k]
  ------------------
  845|       |        /* Handle short lengths. */
  846|  1.09M|        while (op < oend) *op++ = *ip++;
  ------------------
  |  Branch (846:16): [True: 845k, False: 251k]
  ------------------
  847|   251k|        return;
  848|   251k|    }
  849|  83.7k|    if (ovtype == ZSTD_overlap_src_before_dst) {
  ------------------
  |  Branch (849:9): [True: 83.5k, False: 206]
  ------------------
  850|       |        /* Copy 8 bytes and ensure the offset >= 8 when there can be overlap. */
  851|  83.5k|        assert(length >= 8);
  ------------------
  |  |   70|  83.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  852|  83.5k|        ZSTD_overlapCopy8(&op, &ip, diff);
  853|  83.5k|        length -= 8;
  854|  83.5k|        assert(op - ip >= 8);
  ------------------
  |  |   70|  83.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  855|  83.5k|        assert(op <= oend);
  ------------------
  |  |   70|  83.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  856|  83.5k|    }
  857|       |
  858|  83.7k|    if (oend <= oend_w) {
  ------------------
  |  Branch (858:9): [True: 75, False: 83.6k]
  ------------------
  859|       |        /* No risk of overwrite. */
  860|     75|        ZSTD_wildcopy(op, ip, length, ovtype);
  861|     75|        return;
  862|     75|    }
  863|  83.6k|    if (op <= oend_w) {
  ------------------
  |  Branch (863:9): [True: 571, False: 83.1k]
  ------------------
  864|       |        /* Wildcopy until we get close to the end. */
  865|    571|        assert(oend > oend_w);
  ------------------
  |  |   70|    571|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  866|    571|        ZSTD_wildcopy(op, ip, oend_w - op, ovtype);
  867|    571|        ip += oend_w - op;
  868|    571|        op += oend_w - op;
  869|    571|    }
  870|       |    /* Handle the leftovers. */
  871|  14.2M|    while (op < oend) *op++ = *ip++;
  ------------------
  |  Branch (871:12): [True: 14.1M, False: 83.6k]
  ------------------
  872|  83.6k|}
zstd_decompress_block.c:ZSTD_overlapCopy8:
  804|  1.46M|HINT_INLINE void ZSTD_overlapCopy8(BYTE** op, BYTE const** ip, size_t offset) {
  805|  1.46M|    assert(*ip <= *op);
  ------------------
  |  |   70|  1.46M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  806|  1.46M|    if (offset < 8) {
  ------------------
  |  Branch (806:9): [True: 1.14M, False: 319k]
  ------------------
  807|       |        /* close range match, overlap */
  808|  1.14M|        static const U32 dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 };   /* added */
  809|  1.14M|        static const int dec64table[] = { 8, 8, 8, 7, 8, 9,10,11 };   /* subtracted */
  810|  1.14M|        int const sub2 = dec64table[offset];
  811|  1.14M|        (*op)[0] = (*ip)[0];
  812|  1.14M|        (*op)[1] = (*ip)[1];
  813|  1.14M|        (*op)[2] = (*ip)[2];
  814|  1.14M|        (*op)[3] = (*ip)[3];
  815|  1.14M|        *ip += dec32table[offset];
  816|  1.14M|        ZSTD_copy4(*op+4, *ip);
  817|  1.14M|        *ip -= sub2;
  818|  1.14M|    } else {
  819|   319k|        ZSTD_copy8(*op, *ip);
  820|   319k|    }
  821|  1.46M|    *ip += 8;
  822|  1.46M|    *op += 8;
  823|  1.46M|    assert(*op - *ip >= 8);
  ------------------
  |  |   70|  1.46M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  824|  1.46M|}
zstd_decompress_block.c:ZSTD_copy4:
   47|  1.14M|static void ZSTD_copy4(void* dst, const void* src) { ZSTD_memcpy(dst, src, 4); }
  ------------------
  |  |   44|  1.14M|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
zstd_decompress_block.c:ZSTD_execSequenceSplitLitBuffer:
 1104|  1.25M|{
 1105|  1.25M|    BYTE* const oLitEnd = op + sequence.litLength;
 1106|  1.25M|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
 1107|  1.25M|    BYTE* const oMatchEnd = op + sequenceLength;   /* risk : address space overflow (32-bits) */
 1108|  1.25M|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
 1109|  1.25M|    const BYTE* match = oLitEnd - sequence.offset;
 1110|       |
 1111|  1.25M|    assert(op != NULL /* Precondition */);
  ------------------
  |  |   70|  1.25M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1112|  1.25M|    assert(oend_w < oend /* No underflow */);
  ------------------
  |  |   70|  1.25M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1113|       |    /* Handle edge cases in a slow path:
 1114|       |     *   - Read beyond end of literals
 1115|       |     *   - Match end is within WILDCOPY_OVERLIMIT of oend
 1116|       |     *   - 32-bit mode and the match length overflows
 1117|       |     */
 1118|  1.25M|    if (UNLIKELY(
  ------------------
  |  |  188|  5.62M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 334k, False: 925k]
  |  |  |  Branch (188:40): [True: 0, False: 1.25M]
  |  |  |  Branch (188:40): [True: 334k, False: 925k]
  |  |  |  Branch (188:40): [True: 0, False: 925k]
  |  |  |  Branch (188:40): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1119|  1.25M|            iLitEnd > litLimit ||
 1120|  1.25M|            oMatchEnd > oend_w ||
 1121|  1.25M|            (MEM_32bits() && (size_t)(oend - op) < sequenceLength + WILDCOPY_OVERLENGTH)))
 1122|   334k|        return ZSTD_execSequenceEndSplitLitBuffer(op, oend, oend_w, sequence, litPtr, litLimit, prefixStart, virtualStart, dictEnd);
 1123|       |
 1124|       |    /* Assumptions (everything else goes into ZSTD_execSequenceEnd()) */
 1125|   925k|    assert(op <= oLitEnd /* No overflow */);
  ------------------
  |  |   70|   925k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1126|   925k|    assert(oLitEnd < oMatchEnd /* Non-zero match & no overflow */);
  ------------------
  |  |   70|   925k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1127|   925k|    assert(oMatchEnd <= oend /* No underflow */);
  ------------------
  |  |   70|   925k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1128|   925k|    assert(iLitEnd <= litLimit /* Literal length is in bounds */);
  ------------------
  |  |   70|   925k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1129|   925k|    assert(oLitEnd <= oend_w /* Can wildcopy literals */);
  ------------------
  |  |   70|   925k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1130|   925k|    assert(oMatchEnd <= oend_w /* Can wildcopy matches */);
  ------------------
  |  |   70|   925k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1131|       |
 1132|       |    /* Copy Literals:
 1133|       |     * Split out litLength <= 16 since it is nearly always true. +1.6% on gcc-9.
 1134|       |     * We likely don't need the full 32-byte wildcopy.
 1135|       |     */
 1136|   925k|    assert(WILDCOPY_OVERLENGTH >= 16);
  ------------------
  |  |   70|   925k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1137|   925k|    ZSTD_copy16(op, (*litPtr));
 1138|   925k|    if (UNLIKELY(sequence.litLength > 16)) {
  ------------------
  |  |  188|   925k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 84.1k, False: 841k]
  |  |  ------------------
  ------------------
 1139|  84.1k|        ZSTD_wildcopy(op+16, (*litPtr)+16, sequence.litLength-16, ZSTD_no_overlap);
 1140|  84.1k|    }
 1141|   925k|    op = oLitEnd;
 1142|   925k|    *litPtr = iLitEnd;   /* update for next sequence */
 1143|       |
 1144|       |    /* Copy Match */
 1145|   925k|    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
  ------------------
  |  Branch (1145:9): [True: 497, False: 924k]
  ------------------
 1146|       |        /* offset beyond prefix -> go into extDict */
 1147|    497|        RETURN_ERROR_IF(UNLIKELY(sequence.offset > (size_t)(oLitEnd - virtualStart)), corruption_detected, "");
  ------------------
  |  |  114|    497|    do {                                                                       \
  |  |  115|    497|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 203, False: 294]
  |  |  ------------------
  |  |  116|    203|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    203|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 203]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    203|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    203|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    203|    do {                                           \
  |  |  |  |   99|    203|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 203]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    203|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 203]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    203|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    203|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 203]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    203|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    203|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 203]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    203|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    203|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    203|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    203|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    203|        }                                                                      \
  |  |  123|    497|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 294]
  |  |  ------------------
  ------------------
 1148|    294|        match = dictEnd + (match - prefixStart);
 1149|    294|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (1149:13): [True: 188, False: 106]
  ------------------
 1150|    188|            ZSTD_memmove(oLitEnd, match, sequence.matchLength);
  ------------------
  |  |   45|    188|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1151|    188|            return sequenceLength;
 1152|    188|        }
 1153|       |        /* span extDict & currentPrefixSegment */
 1154|    106|        {   size_t const length1 = dictEnd - match;
 1155|    106|            ZSTD_memmove(oLitEnd, match, length1);
  ------------------
  |  |   45|    106|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1156|    106|            op = oLitEnd + length1;
 1157|    106|            sequence.matchLength -= length1;
 1158|    106|            match = prefixStart;
 1159|    106|    }   }
 1160|       |    /* Match within prefix of 1 or more bytes */
 1161|   924k|    assert(op <= oMatchEnd);
  ------------------
  |  |   70|   924k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1162|   924k|    assert(oMatchEnd <= oend_w);
  ------------------
  |  |   70|   924k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1163|   924k|    assert(match >= prefixStart);
  ------------------
  |  |   70|   924k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1164|   924k|    assert(sequence.matchLength >= 1);
  ------------------
  |  |   70|   924k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1165|       |
 1166|       |    /* Nearly all offsets are >= WILDCOPY_VECLEN bytes, which means we can use wildcopy
 1167|       |     * without overlap checking.
 1168|       |     */
 1169|   924k|    if (LIKELY(sequence.offset >= WILDCOPY_VECLEN)) {
  ------------------
  |  |  187|   924k|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (187:19): [True: 306k, False: 617k]
  |  |  ------------------
  ------------------
 1170|       |        /* We bet on a full wildcopy for matches, since we expect matches to be
 1171|       |         * longer than literals (in general). In silesia, ~10% of matches are longer
 1172|       |         * than 16 bytes.
 1173|       |         */
 1174|   306k|        ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength, ZSTD_no_overlap);
 1175|   306k|        return sequenceLength;
 1176|   306k|    }
 1177|   617k|    assert(sequence.offset < WILDCOPY_VECLEN);
  ------------------
  |  |   70|   617k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1178|       |
 1179|       |    /* Copy 8 bytes and spread the offset to be >= 8. */
 1180|   617k|    ZSTD_overlapCopy8(&op, &match, sequence.offset);
 1181|       |
 1182|       |    /* If the match length is > 8 bytes, then continue with the wildcopy. */
 1183|   617k|    if (sequence.matchLength > 8) {
  ------------------
  |  Branch (1183:9): [True: 102k, False: 515k]
  ------------------
 1184|   102k|        assert(op < oMatchEnd);
  ------------------
  |  |   70|   102k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1185|   102k|        ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength-8, ZSTD_overlap_src_before_dst);
 1186|   102k|    }
 1187|   617k|    return sequenceLength;
 1188|   924k|}
zstd_decompress_block.c:ZSTD_execSequenceEndSplitLitBuffer:
  959|   334k|{
  960|   334k|    BYTE* const oLitEnd = op + sequence.litLength;
  961|   334k|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
  962|   334k|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
  963|   334k|    const BYTE* match = oLitEnd - sequence.offset;
  964|       |
  965|       |
  966|       |    /* bounds checks : careful of address space overflow in 32-bit mode */
  967|   334k|    RETURN_ERROR_IF(sequenceLength > (size_t)(oend - op), dstSize_tooSmall, "last match must fit within dstBuffer");
  ------------------
  |  |  114|   334k|    do {                                                                       \
  |  |  115|   334k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 98, False: 333k]
  |  |  ------------------
  |  |  116|     98|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     98|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 98]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     98|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     98|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     98|    do {                                           \
  |  |  |  |   99|     98|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 98]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     98|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 98]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     98|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     98|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 98]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     98|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     98|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 98]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     98|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     98|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     98|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     98|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     98|        }                                                                      \
  |  |  123|   334k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 333k]
  |  |  ------------------
  ------------------
  968|   333k|    RETURN_ERROR_IF(sequence.litLength > (size_t)(litLimit - *litPtr), corruption_detected, "try to read beyond literal buffer");
  ------------------
  |  |  114|   333k|    do {                                                                       \
  |  |  115|   333k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 333k]
  |  |  ------------------
  |  |  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|   333k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 333k]
  |  |  ------------------
  ------------------
  969|   333k|    assert(op < op + sequenceLength);
  ------------------
  |  |   70|   333k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  970|   333k|    assert(oLitEnd < op + sequenceLength);
  ------------------
  |  |   70|   333k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  971|       |
  972|       |    /* copy literals */
  973|   333k|    RETURN_ERROR_IF(op > *litPtr && op < *litPtr + sequence.litLength, dstSize_tooSmall, "output should not catch up to and overwrite literal buffer");
  ------------------
  |  |  114|   333k|    do {                                                                       \
  |  |  115|  1.00M|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 333k, False: 902]
  |  |  |  Branch (115:13): [True: 48, False: 332k]
  |  |  ------------------
  |  |  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|   333k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 333k]
  |  |  ------------------
  ------------------
  974|   333k|    ZSTD_safecopyDstBeforeSrc(op, *litPtr, sequence.litLength);
  975|   333k|    op = oLitEnd;
  976|   333k|    *litPtr = iLitEnd;
  977|       |
  978|       |    /* copy Match */
  979|   333k|    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
  ------------------
  |  Branch (979:9): [True: 105, False: 333k]
  ------------------
  980|       |        /* offset beyond prefix */
  981|    105|        RETURN_ERROR_IF(sequence.offset > (size_t)(oLitEnd - virtualStart), corruption_detected, "");
  ------------------
  |  |  114|    105|    do {                                                                       \
  |  |  115|    105|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 65, False: 40]
  |  |  ------------------
  |  |  116|     65|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     65|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     65|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     65|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     65|    do {                                           \
  |  |  |  |   99|     65|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 65]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     65|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     65|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     65|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     65|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     65|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     65|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     65|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     65|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     65|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     65|        }                                                                      \
  |  |  123|    105|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 40]
  |  |  ------------------
  ------------------
  982|     40|        match = dictEnd - (prefixStart - match);
  983|     40|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (983:13): [True: 22, False: 18]
  ------------------
  984|     22|            ZSTD_memmove(oLitEnd, match, sequence.matchLength);
  ------------------
  |  |   45|     22|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  985|     22|            return sequenceLength;
  986|     22|        }
  987|       |        /* span extDict & currentPrefixSegment */
  988|     18|        {   size_t const length1 = dictEnd - match;
  989|     18|        ZSTD_memmove(oLitEnd, match, length1);
  ------------------
  |  |   45|     18|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  990|     18|        op = oLitEnd + length1;
  991|     18|        sequence.matchLength -= length1;
  992|     18|        match = prefixStart;
  993|     18|        }
  994|     18|    }
  995|   333k|    ZSTD_safecopy(op, oend_w, match, sequence.matchLength, ZSTD_overlap_src_before_dst);
  996|   333k|    return sequenceLength;
  997|   333k|}
zstd_decompress_block.c:ZSTD_decompressSequencesSplitLitBuffer:
 1956|    596|{
 1957|    596|    DEBUGLOG(5, "ZSTD_decompressSequencesSplitLitBuffer");
  ------------------
  |  |  104|    596|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 596]
  |  |  ------------------
  ------------------
 1958|    596|#if DYNAMIC_BMI2
 1959|    596|    if (ZSTD_DCtx_get_bmi2(dctx)) {
  ------------------
  |  Branch (1959:9): [True: 596, False: 0]
  ------------------
 1960|    596|        return ZSTD_decompressSequencesSplitLitBuffer_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1961|    596|    }
 1962|      0|#endif
 1963|      0|    return ZSTD_decompressSequencesSplitLitBuffer_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1964|    596|}
zstd_decompress_block.c:ZSTD_decompressSequencesSplitLitBuffer_bmi2:
 1920|    596|{
 1921|    596|    return ZSTD_decompressSequences_bodySplitLitBuffer(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1922|    596|}
zstd_decompress_block.c:ZSTD_decompressSequences_bodySplitLitBuffer:
 1407|    596|{
 1408|    596|    const BYTE* ip = (const BYTE*)seqStart;
 1409|    596|    const BYTE* const iend = ip + seqSize;
 1410|    596|    BYTE* const ostart = (BYTE*)dst;
 1411|    596|    BYTE* const oend = ZSTD_maybeNullPtrAdd(ostart, maxDstSize);
 1412|    596|    BYTE* op = ostart;
 1413|    596|    const BYTE* litPtr = dctx->litPtr;
 1414|    596|    const BYTE* litBufferEnd = dctx->litBufferEnd;
 1415|    596|    const BYTE* const prefixStart = (const BYTE*) (dctx->prefixStart);
 1416|    596|    const BYTE* const vBase = (const BYTE*) (dctx->virtualStart);
 1417|    596|    const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd);
 1418|    596|    DEBUGLOG(5, "ZSTD_decompressSequences_bodySplitLitBuffer (%i seqs)", nbSeq);
  ------------------
  |  |  104|    596|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 596]
  |  |  ------------------
  ------------------
 1419|       |
 1420|       |    /* Literals are split between internal buffer & output buffer */
 1421|    596|    if (nbSeq) {
  ------------------
  |  Branch (1421:9): [True: 596, False: 0]
  ------------------
 1422|    596|        seqState_t seqState;
 1423|    596|        dctx->fseEntropy = 1;
 1424|  2.38k|        { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) seqState.prevOffset[i] = dctx->entropy.rep[i]; }
  ------------------
  |  |   64|  2.38k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1424:28): [True: 1.78k, False: 596]
  ------------------
 1425|    596|        RETURN_ERROR_IF(
  ------------------
  |  |  114|    596|    do {                                                                       \
  |  |  115|    596|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 38, False: 558]
  |  |  ------------------
  |  |  116|     38|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     38|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 38]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     38|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     38|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     38|    do {                                           \
  |  |  |  |   99|     38|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 38]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     38|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 38]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     38|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     38|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 38]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     38|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     38|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 38]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     38|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     38|        }                                                                      \
  |  |  123|    596|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 558]
  |  |  ------------------
  ------------------
 1426|    596|            ERR_isError(BIT_initDStream(&seqState.DStream, ip, iend-ip)),
 1427|    596|            corruption_detected, "");
 1428|    558|        ZSTD_initFseState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr);
 1429|    558|        ZSTD_initFseState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr);
 1430|    558|        ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr);
 1431|    558|        assert(dst != NULL);
  ------------------
  |  |   70|    558|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1432|       |
 1433|    558|        ZSTD_STATIC_ASSERT(
  ------------------
  |  |   43|    558|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|    558|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1434|    558|                BIT_DStream_unfinished < BIT_DStream_completed &&
 1435|    558|                BIT_DStream_endOfBuffer < BIT_DStream_completed &&
 1436|    558|                BIT_DStream_completed < BIT_DStream_overflow);
 1437|       |
 1438|       |        /* decompress without overrunning litPtr begins */
 1439|    558|        {   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) */
 1440|       |            /* Align the decompression loop to 32 + 16 bytes.
 1441|       |                *
 1442|       |                * zstd compiled with gcc-9 on an Intel i9-9900k shows 10% decompression
 1443|       |                * speed swings based on the alignment of the decompression loop. This
 1444|       |                * performance swing is caused by parts of the decompression loop falling
 1445|       |                * out of the DSB. The entire decompression loop should fit in the DSB,
 1446|       |                * when it can't we get much worse performance. You can measure if you've
 1447|       |                * hit the good case or the bad case with this perf command for some
 1448|       |                * compressed file test.zst:
 1449|       |                *
 1450|       |                *   perf stat -e cycles -e instructions -e idq.all_dsb_cycles_any_uops \
 1451|       |                *             -e idq.all_mite_cycles_any_uops -- ./zstd -tq test.zst
 1452|       |                *
 1453|       |                * If you see most cycles served out of the MITE you've hit the bad case.
 1454|       |                * If you see most cycles served out of the DSB you've hit the good case.
 1455|       |                * If it is pretty even then you may be in an okay case.
 1456|       |                *
 1457|       |                * This issue has been reproduced on the following CPUs:
 1458|       |                *   - Kabylake: Macbook Pro (15-inch, 2019) 2.4 GHz Intel Core i9
 1459|       |                *               Use Instruments->Counters to get DSB/MITE cycles.
 1460|       |                *               I never got performance swings, but I was able to
 1461|       |                *               go from the good case of mostly DSB to half of the
 1462|       |                *               cycles served from MITE.
 1463|       |                *   - Coffeelake: Intel i9-9900k
 1464|       |                *   - Coffeelake: Intel i7-9700k
 1465|       |                *
 1466|       |                * I haven't been able to reproduce the instability or DSB misses on any
 1467|       |                * of the following CPUS:
 1468|       |                *   - Haswell
 1469|       |                *   - Broadwell: Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GH
 1470|       |                *   - Skylake
 1471|       |                *
 1472|       |                * Alignment is done for each of the three major decompression loops:
 1473|       |                *   - ZSTD_decompressSequences_bodySplitLitBuffer - presplit section of the literal buffer
 1474|       |                *   - ZSTD_decompressSequences_bodySplitLitBuffer - postsplit section of the literal buffer
 1475|       |                *   - ZSTD_decompressSequences_body
 1476|       |                * Alignment choices are made to minimize large swings on bad cases and influence on performance
 1477|       |                * from changes external to this code, rather than to overoptimize on the current commit.
 1478|       |                *
 1479|       |                * If you are seeing performance stability this script can help test.
 1480|       |                * It tests on 4 commits in zstd where I saw performance change.
 1481|       |                *
 1482|       |                *   https://gist.github.com/terrelln/9889fc06a423fd5ca6e99351564473f4
 1483|       |                */
 1484|    558|#if defined(__GNUC__) && defined(__x86_64__)
 1485|    558|            __asm__(".p2align 6");
 1486|       |#  if __GNUC__ >= 7
 1487|       |	    /* good for gcc-7, gcc-9, and gcc-11 */
 1488|       |            __asm__("nop");
 1489|       |            __asm__(".p2align 5");
 1490|       |            __asm__("nop");
 1491|       |            __asm__(".p2align 4");
 1492|       |#    if __GNUC__ == 8 || __GNUC__ == 10
 1493|       |	    /* good for gcc-8 and gcc-10 */
 1494|       |            __asm__("nop");
 1495|       |            __asm__(".p2align 3");
 1496|       |#    endif
 1497|       |#  endif
 1498|    558|#endif
 1499|       |
 1500|       |            /* Handle the initial state where litBuffer is currently split between dst and litExtraBuffer */
 1501|   586k|            for ( ; nbSeq; nbSeq--) {
  ------------------
  |  Branch (1501:21): [True: 586k, False: 30]
  ------------------
 1502|   586k|                sequence = ZSTD_decodeSequence(&seqState, isLongOffset, nbSeq==1);
 1503|   586k|                if (litPtr + sequence.litLength > dctx->litBufferEnd) break;
  ------------------
  |  Branch (1503:21): [True: 371, False: 586k]
  ------------------
 1504|   586k|                {   size_t const oneSeqSize = ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequence.litLength - WILDCOPY_OVERLENGTH, sequence, &litPtr, litBufferEnd, prefixStart, vBase, dictEnd);
  ------------------
  |  |  199|   586k|#define WILDCOPY_OVERLENGTH 32
  ------------------
 1505|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1506|       |                    assert(!ZSTD_isError(oneSeqSize));
 1507|       |                    ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase);
 1508|       |#endif
 1509|   586k|                    if (UNLIKELY(ZSTD_isError(oneSeqSize)))
  ------------------
  |  |  188|   586k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 157, False: 586k]
  |  |  ------------------
  ------------------
 1510|    157|                        return oneSeqSize;
 1511|   586k|                    DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize);
  ------------------
  |  |  104|   586k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 586k]
  |  |  ------------------
  ------------------
 1512|   586k|                    op += oneSeqSize;
 1513|   586k|            }   }
 1514|    401|            DEBUGLOG(6, "reached: (litPtr + sequence.litLength > dctx->litBufferEnd)");
  ------------------
  |  |  104|    401|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 401]
  |  |  ------------------
  ------------------
 1515|       |
 1516|       |            /* If there are more sequences, they will need to read literals from litExtraBuffer; copy over the remainder from dst and update litPtr and litEnd */
 1517|    401|            if (nbSeq > 0) {
  ------------------
  |  Branch (1517:17): [True: 371, False: 30]
  ------------------
 1518|    371|                const size_t leftoverLit = dctx->litBufferEnd - litPtr;
 1519|    371|                DEBUGLOG(6, "There are %i sequences left, and %zu/%zu literals left in buffer", nbSeq, leftoverLit, sequence.litLength);
  ------------------
  |  |  104|    371|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 371]
  |  |  ------------------
  ------------------
 1520|    371|                if (leftoverLit) {
  ------------------
  |  Branch (1520:21): [True: 366, False: 5]
  ------------------
 1521|    366|                    RETURN_ERROR_IF(leftoverLit > (size_t)(oend - op), dstSize_tooSmall, "remaining lit must fit within dstBuffer");
  ------------------
  |  |  114|    366|    do {                                                                       \
  |  |  115|    366|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 6, False: 360]
  |  |  ------------------
  |  |  116|      6|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      6|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      6|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      6|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      6|    do {                                           \
  |  |  |  |   99|      6|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 6]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      6|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      6|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      6|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      6|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      6|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      6|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      6|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      6|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      6|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      6|        }                                                                      \
  |  |  123|    366|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 360]
  |  |  ------------------
  ------------------
 1522|    360|                    ZSTD_safecopyDstBeforeSrc(op, litPtr, leftoverLit);
 1523|    360|                    sequence.litLength -= leftoverLit;
 1524|    360|                    op += leftoverLit;
 1525|    360|                }
 1526|    365|                litPtr = dctx->litExtraBuffer;
 1527|    365|                litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|    365|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|    365|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    730|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 365]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 365, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1528|    365|                dctx->litBufferLocation = ZSTD_not_in_dst;
 1529|    365|                {   size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litBufferEnd, prefixStart, vBase, dictEnd);
 1530|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1531|       |                    assert(!ZSTD_isError(oneSeqSize));
 1532|       |                    ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase);
 1533|       |#endif
 1534|    365|                    if (UNLIKELY(ZSTD_isError(oneSeqSize)))
  ------------------
  |  |  188|    365|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 63, False: 302]
  |  |  ------------------
  ------------------
 1535|     63|                        return oneSeqSize;
 1536|    302|                    DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize);
  ------------------
  |  |  104|    302|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 302]
  |  |  ------------------
  ------------------
 1537|    302|                    op += oneSeqSize;
 1538|    302|                }
 1539|      0|                nbSeq--;
 1540|    302|            }
 1541|    401|        }
 1542|       |
 1543|    332|        if (nbSeq > 0) {
  ------------------
  |  Branch (1543:13): [True: 301, False: 31]
  ------------------
 1544|       |            /* there is remaining lit from extra buffer */
 1545|       |
 1546|    301|#if defined(__GNUC__) && defined(__x86_64__)
 1547|    301|            __asm__(".p2align 6");
 1548|    301|            __asm__("nop");
 1549|    301|#  if __GNUC__ != 7
 1550|       |            /* worse for gcc-7 better for gcc-8, gcc-9, and gcc-10 and clang */
 1551|    301|            __asm__(".p2align 4");
 1552|    301|            __asm__("nop");
 1553|    301|            __asm__(".p2align 3");
 1554|       |#  elif __GNUC__ >= 11
 1555|       |            __asm__(".p2align 3");
 1556|       |#  else
 1557|       |            __asm__(".p2align 5");
 1558|       |            __asm__("nop");
 1559|       |            __asm__(".p2align 3");
 1560|       |#  endif
 1561|    301|#endif
 1562|       |
 1563|   399k|            for ( ; nbSeq ; nbSeq--) {
  ------------------
  |  Branch (1563:21): [True: 399k, False: 8]
  ------------------
 1564|   399k|                seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset, nbSeq==1);
 1565|   399k|                size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litBufferEnd, prefixStart, vBase, dictEnd);
 1566|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1567|       |                assert(!ZSTD_isError(oneSeqSize));
 1568|       |                ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase);
 1569|       |#endif
 1570|   399k|                if (UNLIKELY(ZSTD_isError(oneSeqSize)))
  ------------------
  |  |  188|   399k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 293, False: 399k]
  |  |  ------------------
  ------------------
 1571|    293|                    return oneSeqSize;
 1572|   399k|                DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize);
  ------------------
  |  |  104|   399k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 399k]
  |  |  ------------------
  ------------------
 1573|   399k|                op += oneSeqSize;
 1574|   399k|            }
 1575|    301|        }
 1576|       |
 1577|       |        /* check if reached exact end */
 1578|     39|        DEBUGLOG(5, "ZSTD_decompressSequences_bodySplitLitBuffer: after decode loop, remaining nbSeq : %i", nbSeq);
  ------------------
  |  |  104|     39|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 39]
  |  |  ------------------
  ------------------
 1579|     39|        RETURN_ERROR_IF(nbSeq, corruption_detected, "");
  ------------------
  |  |  114|     39|    do {                                                                       \
  |  |  115|     39|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 39]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|     39|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 39]
  |  |  ------------------
  ------------------
 1580|     39|        DEBUGLOG(5, "bitStream : start=%p, ptr=%p, bitsConsumed=%u", seqState.DStream.start, seqState.DStream.ptr, seqState.DStream.bitsConsumed);
  ------------------
  |  |  104|     39|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 39]
  |  |  ------------------
  ------------------
 1581|     39|        RETURN_ERROR_IF(!BIT_endOfDStream(&seqState.DStream), corruption_detected, "");
  ------------------
  |  |  114|     39|    do {                                                                       \
  |  |  115|     39|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 14, False: 25]
  |  |  ------------------
  |  |  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|     39|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 25]
  |  |  ------------------
  ------------------
 1582|       |        /* save reps for next block */
 1583|    100|        { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) dctx->entropy.rep[i] = (U32)(seqState.prevOffset[i]); }
  ------------------
  |  |   64|    100|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1583:28): [True: 75, False: 25]
  ------------------
 1584|     25|    }
 1585|       |
 1586|       |    /* last literal segment */
 1587|     25|    if (dctx->litBufferLocation == ZSTD_split) {
  ------------------
  |  Branch (1587:9): [True: 22, False: 3]
  ------------------
 1588|       |        /* split hasn't been reached yet, first get dst then copy litExtraBuffer */
 1589|     22|        size_t const lastLLSize = (size_t)(litBufferEnd - litPtr);
 1590|     22|        DEBUGLOG(6, "copy last literals from segment : %u", (U32)lastLLSize);
  ------------------
  |  |  104|     22|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 22]
  |  |  ------------------
  ------------------
 1591|     22|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend - op), dstSize_tooSmall, "");
  ------------------
  |  |  114|     22|    do {                                                                       \
  |  |  115|     22|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 12, False: 10]
  |  |  ------------------
  |  |  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|     22|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 10]
  |  |  ------------------
  ------------------
 1592|     10|        if (op != NULL) {
  ------------------
  |  Branch (1592:13): [True: 10, False: 0]
  ------------------
 1593|     10|            ZSTD_memmove(op, litPtr, lastLLSize);
  ------------------
  |  |   45|     10|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1594|     10|            op += lastLLSize;
 1595|     10|        }
 1596|     10|        litPtr = dctx->litExtraBuffer;
 1597|     10|        litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|     10|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|     10|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|     20|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 10]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 10, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1598|     10|        dctx->litBufferLocation = ZSTD_not_in_dst;
 1599|     10|    }
 1600|       |    /* copy last literals from internal buffer */
 1601|     13|    {   size_t const lastLLSize = (size_t)(litBufferEnd - litPtr);
 1602|     13|        DEBUGLOG(6, "copy last literals from internal buffer : %u", (U32)lastLLSize);
  ------------------
  |  |  104|     13|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 13]
  |  |  ------------------
  ------------------
 1603|     13|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall, "");
  ------------------
  |  |  114|     13|    do {                                                                       \
  |  |  115|     13|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 9, False: 4]
  |  |  ------------------
  |  |  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|     13|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4]
  |  |  ------------------
  ------------------
 1604|      4|        if (op != NULL) {
  ------------------
  |  Branch (1604:13): [True: 4, False: 0]
  ------------------
 1605|      4|            ZSTD_memcpy(op, litPtr, lastLLSize);
  ------------------
  |  |   44|      4|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1606|      4|            op += lastLLSize;
 1607|      4|    }   }
 1608|       |
 1609|      4|    DEBUGLOG(6, "decoded block of size %u bytes", (U32)(op - ostart));
  ------------------
  |  |  104|      4|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4]
  |  |  ------------------
  ------------------
 1610|      4|    return (size_t)(op - ostart);
 1611|     13|}
zstd_decompress_block.c:ZSTD_decompressSequences:
 1943|    519|{
 1944|    519|    DEBUGLOG(5, "ZSTD_decompressSequences");
  ------------------
  |  |  104|    519|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 519]
  |  |  ------------------
  ------------------
 1945|    519|#if DYNAMIC_BMI2
 1946|    519|    if (ZSTD_DCtx_get_bmi2(dctx)) {
  ------------------
  |  Branch (1946:9): [True: 519, False: 0]
  ------------------
 1947|    519|        return ZSTD_decompressSequences_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1948|    519|    }
 1949|      0|#endif
 1950|      0|    return ZSTD_decompressSequences_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1951|    519|}
zstd_decompress_block.c:ZSTD_decompressSequences_bmi2:
 1911|    519|{
 1912|    519|    return ZSTD_decompressSequences_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1913|    519|}
zstd_decompress_block.c:ZSTD_decompressSequences_body:
 1619|    519|{
 1620|    519|    const BYTE* ip = (const BYTE*)seqStart;
 1621|    519|    const BYTE* const iend = ip + seqSize;
 1622|    519|    BYTE* const ostart = (BYTE*)dst;
 1623|    519|    BYTE* const oend = dctx->litBufferLocation == ZSTD_not_in_dst ? ZSTD_maybeNullPtrAdd(ostart, maxDstSize) : dctx->litBuffer;
  ------------------
  |  Branch (1623:24): [True: 209, False: 310]
  ------------------
 1624|    519|    BYTE* op = ostart;
 1625|    519|    const BYTE* litPtr = dctx->litPtr;
 1626|    519|    const BYTE* const litEnd = litPtr + dctx->litSize;
 1627|    519|    const BYTE* const prefixStart = (const BYTE*)(dctx->prefixStart);
 1628|    519|    const BYTE* const vBase = (const BYTE*)(dctx->virtualStart);
 1629|    519|    const BYTE* const dictEnd = (const BYTE*)(dctx->dictEnd);
 1630|    519|    DEBUGLOG(5, "ZSTD_decompressSequences_body: nbSeq = %d", nbSeq);
  ------------------
  |  |  104|    519|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 519]
  |  |  ------------------
  ------------------
 1631|       |
 1632|       |    /* Regen sequences */
 1633|    519|    if (nbSeq) {
  ------------------
  |  Branch (1633:9): [True: 434, False: 85]
  ------------------
 1634|    434|        seqState_t seqState;
 1635|    434|        dctx->fseEntropy = 1;
 1636|  1.73k|        { U32 i; for (i = 0; i < ZSTD_REP_NUM; i++) seqState.prevOffset[i] = dctx->entropy.rep[i]; }
  ------------------
  |  |   64|  1.73k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1636:30): [True: 1.30k, False: 434]
  ------------------
 1637|    434|        RETURN_ERROR_IF(
  ------------------
  |  |  114|    434|    do {                                                                       \
  |  |  115|    434|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 57, False: 377]
  |  |  ------------------
  |  |  116|     57|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     57|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     57|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     57|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     57|    do {                                           \
  |  |  |  |   99|     57|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 57]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     57|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     57|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     57|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     57|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     57|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     57|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     57|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     57|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     57|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     57|        }                                                                      \
  |  |  123|    434|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 377]
  |  |  ------------------
  ------------------
 1638|    434|            ERR_isError(BIT_initDStream(&seqState.DStream, ip, iend - ip)),
 1639|    434|            corruption_detected, "");
 1640|    377|        ZSTD_initFseState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr);
 1641|    377|        ZSTD_initFseState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr);
 1642|    377|        ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr);
 1643|    377|        assert(dst != NULL);
  ------------------
  |  |   70|    377|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1644|       |
 1645|    377|#if defined(__GNUC__) && defined(__x86_64__)
 1646|    377|            __asm__(".p2align 6");
 1647|    377|            __asm__("nop");
 1648|       |#  if __GNUC__ >= 7
 1649|       |            __asm__(".p2align 5");
 1650|       |            __asm__("nop");
 1651|       |            __asm__(".p2align 3");
 1652|       |#  else
 1653|    377|            __asm__(".p2align 4");
 1654|    377|            __asm__("nop");
 1655|    377|            __asm__(".p2align 3");
 1656|    377|#  endif
 1657|    377|#endif
 1658|       |
 1659|   447k|        for ( ; nbSeq ; nbSeq--) {
  ------------------
  |  Branch (1659:17): [True: 447k, False: 121]
  ------------------
 1660|   447k|            seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset, nbSeq==1);
 1661|   447k|            size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litEnd, prefixStart, vBase, dictEnd);
 1662|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1663|       |            assert(!ZSTD_isError(oneSeqSize));
 1664|       |            ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase);
 1665|       |#endif
 1666|   447k|            if (UNLIKELY(ZSTD_isError(oneSeqSize)))
  ------------------
  |  |  188|   447k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 256, False: 446k]
  |  |  ------------------
  ------------------
 1667|    256|                return oneSeqSize;
 1668|   446k|            DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize);
  ------------------
  |  |  104|   446k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 446k]
  |  |  ------------------
  ------------------
 1669|   446k|            op += oneSeqSize;
 1670|   446k|        }
 1671|       |
 1672|       |        /* check if reached exact end */
 1673|    121|        assert(nbSeq == 0);
  ------------------
  |  |   70|    121|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1674|    121|        RETURN_ERROR_IF(!BIT_endOfDStream(&seqState.DStream), corruption_detected, "");
  ------------------
  |  |  114|    121|    do {                                                                       \
  |  |  115|    121|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 8, False: 113]
  |  |  ------------------
  |  |  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|    121|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 113]
  |  |  ------------------
  ------------------
 1675|       |        /* save reps for next block */
 1676|    452|        { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) dctx->entropy.rep[i] = (U32)(seqState.prevOffset[i]); }
  ------------------
  |  |   64|    452|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1676:28): [True: 339, False: 113]
  ------------------
 1677|    113|    }
 1678|       |
 1679|       |    /* last literal segment */
 1680|    198|    {   size_t const lastLLSize = (size_t)(litEnd - litPtr);
 1681|    198|        DEBUGLOG(6, "copy last literals : %u", (U32)lastLLSize);
  ------------------
  |  |  104|    198|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 198]
  |  |  ------------------
  ------------------
 1682|    198|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall, "");
  ------------------
  |  |  114|    198|    do {                                                                       \
  |  |  115|    198|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 195]
  |  |  ------------------
  |  |  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|    198|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 195]
  |  |  ------------------
  ------------------
 1683|    195|        if (op != NULL) {
  ------------------
  |  Branch (1683:13): [True: 195, False: 0]
  ------------------
 1684|    195|            ZSTD_memcpy(op, litPtr, lastLLSize);
  ------------------
  |  |   44|    195|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1685|    195|            op += lastLLSize;
 1686|    195|    }   }
 1687|       |
 1688|    195|    DEBUGLOG(6, "decoded block of size %u bytes", (U32)(op - ostart));
  ------------------
  |  |  104|    195|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 195]
  |  |  ------------------
  ------------------
 1689|    195|    return (size_t)(op - ostart);
 1690|    198|}

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

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

FSEv05_buildDTable:
 1158|  1.86k|{
 1159|  1.86k|    FSEv05_DTableHeader DTableH;
 1160|  1.86k|    void* const tdPtr = dt+1;   /* because dt is unsigned, 32-bits aligned on 32-bits */
 1161|  1.86k|    FSEv05_DECODE_TYPE* const tableDecode = (FSEv05_DECODE_TYPE*) (tdPtr);
  ------------------
  |  | 1056|  1.86k|#define FSEv05_DECODE_TYPE FSEv05_decode_t
  ------------------
 1162|  1.86k|    const U32 tableSize = 1 << tableLog;
 1163|  1.86k|    const U32 tableMask = tableSize-1;
 1164|  1.86k|    const U32 step = FSEv05_tableStep(tableSize);
 1165|  1.86k|    U16 symbolNext[FSEv05_MAX_SYMBOL_VALUE+1];
 1166|  1.86k|    U32 position = 0;
 1167|  1.86k|    U32 highThreshold = tableSize-1;
 1168|  1.86k|    const S16 largeLimit= (S16)(1 << (tableLog-1));
 1169|  1.86k|    U32 noLarge = 1;
 1170|  1.86k|    U32 s;
 1171|       |
 1172|       |    /* Sanity Checks */
 1173|  1.86k|    if (maxSymbolValue > FSEv05_MAX_SYMBOL_VALUE) return ERROR(maxSymbolValue_tooLarge);
  ------------------
  |  | 1048|  1.86k|#define FSEv05_MAX_SYMBOL_VALUE 255
  ------------------
                  if (maxSymbolValue > FSEv05_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 (1173:9): [True: 0, False: 1.86k]
  ------------------
 1174|  1.86k|    if (tableLog > FSEv05_MAX_TABLELOG) return ERROR(tableLog_tooLarge);
  ------------------
  |  | 1094|  1.86k|#define FSEv05_MAX_TABLELOG  (FSEv05_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  | 1042|  1.86k|#define FSEv05_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
                  if (tableLog > FSEv05_MAX_TABLELOG) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   49|     18|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     18|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     18|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1174:9): [True: 18, False: 1.84k]
  ------------------
 1175|       |
 1176|       |    /* Init, lay down lowprob symbols */
 1177|  1.84k|    memset(tableDecode, 0, sizeof(FSEv05_FUNCTION_TYPE) * (maxSymbolValue+1) );   /* useless init, but keep static analyzer happy, and we don't need to performance optimize legacy decoders */
 1178|  1.84k|    DTableH.tableLog = (U16)tableLog;
 1179|  31.3k|    for (s=0; s<=maxSymbolValue; s++) {
  ------------------
  |  Branch (1179:15): [True: 29.4k, False: 1.84k]
  ------------------
 1180|  29.4k|        if (normalizedCounter[s]==-1) {
  ------------------
  |  Branch (1180:13): [True: 11.7k, False: 17.6k]
  ------------------
 1181|  11.7k|            tableDecode[highThreshold--].symbol = (FSEv05_FUNCTION_TYPE)s;
 1182|  11.7k|            symbolNext[s] = 1;
 1183|  17.6k|        } else {
 1184|  17.6k|            if (normalizedCounter[s] >= largeLimit) noLarge=0;
  ------------------
  |  Branch (1184:17): [True: 940, False: 16.7k]
  ------------------
 1185|  17.6k|            symbolNext[s] = normalizedCounter[s];
 1186|  17.6k|    }   }
 1187|       |
 1188|       |    /* Spread symbols */
 1189|  31.3k|    for (s=0; s<=maxSymbolValue; s++) {
  ------------------
  |  Branch (1189:15): [True: 29.4k, False: 1.84k]
  ------------------
 1190|  29.4k|        int i;
 1191|   737k|        for (i=0; i<normalizedCounter[s]; i++) {
  ------------------
  |  Branch (1191:19): [True: 708k, False: 29.4k]
  ------------------
 1192|   708k|            tableDecode[position].symbol = (FSEv05_FUNCTION_TYPE)s;
 1193|   708k|            position = (position + step) & tableMask;
 1194|   719k|            while (position > highThreshold) position = (position + step) & tableMask;   /* lowprob area */
  ------------------
  |  Branch (1194:20): [True: 11.7k, False: 708k]
  ------------------
 1195|   708k|    }   }
 1196|       |
 1197|  1.84k|    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 (1197:9): [True: 0, False: 1.84k]
  ------------------
 1198|       |
 1199|       |    /* Build Decoding table */
 1200|  1.84k|    {
 1201|  1.84k|        U32 i;
 1202|   721k|        for (i=0; i<tableSize; i++) {
  ------------------
  |  Branch (1202:19): [True: 719k, False: 1.84k]
  ------------------
 1203|   719k|            FSEv05_FUNCTION_TYPE symbol = (FSEv05_FUNCTION_TYPE)(tableDecode[i].symbol);
  ------------------
  |  | 1054|   719k|#define FSEv05_FUNCTION_TYPE BYTE
  ------------------
 1204|   719k|            U16 nextState = symbolNext[symbol]++;
 1205|   719k|            tableDecode[i].nbBits = (BYTE) (tableLog - BITv05_highbit32 ((U32)nextState) );
 1206|   719k|            tableDecode[i].newState = (U16) ( (nextState << tableDecode[i].nbBits) - tableSize);
 1207|   719k|    }   }
 1208|       |
 1209|  1.84k|    DTableH.fastMode = (U16)noLarge;
 1210|  1.84k|    memcpy(dt, &DTableH, sizeof(DTableH));
 1211|  1.84k|    return 0;
 1212|  1.84k|}
FSEv05_isError:
 1219|  5.52k|unsigned FSEv05_isError(size_t code) { return ERR_isError(code); }
FSEv05_readNCount:
 1232|  2.15k|{
 1233|  2.15k|    const BYTE* const istart = (const BYTE*) headerBuffer;
 1234|  2.15k|    const BYTE* const iend = istart + hbSize;
 1235|  2.15k|    const BYTE* ip = istart;
 1236|  2.15k|    int nbBits;
 1237|  2.15k|    int remaining;
 1238|  2.15k|    int threshold;
 1239|  2.15k|    U32 bitStream;
 1240|  2.15k|    int bitCount;
 1241|  2.15k|    unsigned charnum = 0;
 1242|  2.15k|    int previous0 = 0;
 1243|       |
 1244|  2.15k|    if (hbSize < 4) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|     23|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     23|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     23|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1244:9): [True: 23, False: 2.13k]
  ------------------
 1245|  2.13k|    bitStream = MEM_readLE32(ip);
 1246|  2.13k|    nbBits = (bitStream & 0xF) + FSEv05_MIN_TABLELOG;   /* extract tableLog */
  ------------------
  |  | 1098|  2.13k|#define FSEv05_MIN_TABLELOG 5
  ------------------
 1247|  2.13k|    if (nbBits > FSEv05_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  | 1100|  2.13k|#define FSEv05_TABLELOG_ABSOLUTE_MAX 15
  ------------------
                  if (nbBits > FSEv05_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   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 (1247:9): [True: 58, False: 2.07k]
  ------------------
 1248|  2.07k|    bitStream >>= 4;
 1249|  2.07k|    bitCount = 4;
 1250|  2.07k|    *tableLogPtr = nbBits;
 1251|  2.07k|    remaining = (1<<nbBits)+1;
 1252|  2.07k|    threshold = 1<<nbBits;
 1253|  2.07k|    nbBits++;
 1254|       |
 1255|  32.2k|    while ((remaining>1) && (charnum<=*maxSVPtr)) {
  ------------------
  |  Branch (1255:12): [True: 30.2k, False: 2.00k]
  |  Branch (1255:29): [True: 30.1k, False: 46]
  ------------------
 1256|  30.1k|        if (previous0) {
  ------------------
  |  Branch (1256:13): [True: 2.87k, False: 27.3k]
  ------------------
 1257|  2.87k|            unsigned n0 = charnum;
 1258|  3.01k|            while ((bitStream & 0xFFFF) == 0xFFFF) {
  ------------------
  |  Branch (1258:20): [True: 139, False: 2.87k]
  ------------------
 1259|    139|                n0+=24;
 1260|    139|                if (ip < iend-5) {
  ------------------
  |  Branch (1260:21): [True: 99, False: 40]
  ------------------
 1261|     99|                    ip+=2;
 1262|     99|                    bitStream = MEM_readLE32(ip) >> bitCount;
 1263|     99|                } else {
 1264|     40|                    bitStream >>= 16;
 1265|     40|                    bitCount+=16;
 1266|     40|            }   }
 1267|  3.87k|            while ((bitStream & 3) == 3) {
  ------------------
  |  Branch (1267:20): [True: 997, False: 2.87k]
  ------------------
 1268|    997|                n0+=3;
 1269|    997|                bitStream>>=2;
 1270|    997|                bitCount+=2;
 1271|    997|            }
 1272|  2.87k|            n0 += bitStream & 3;
 1273|  2.87k|            bitCount += 2;
 1274|  2.87k|            if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_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 (1274:17): [True: 27, False: 2.85k]
  ------------------
 1275|  10.4k|            while (charnum < n0) normalizedCounter[charnum++] = 0;
  ------------------
  |  Branch (1275:20): [True: 7.62k, False: 2.85k]
  ------------------
 1276|  2.85k|            if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
  ------------------
  |  Branch (1276:17): [True: 1.77k, False: 1.07k]
  |  Branch (1276:35): [True: 318, False: 759]
  ------------------
 1277|  2.09k|                ip += bitCount>>3;
 1278|  2.09k|                bitCount &= 7;
 1279|  2.09k|                bitStream = MEM_readLE32(ip) >> bitCount;
 1280|  2.09k|            }
 1281|    759|            else
 1282|    759|                bitStream >>= 2;
 1283|  2.85k|        }
 1284|  30.1k|        {
 1285|  30.1k|            const short max = (short)((2*threshold-1)-remaining);
 1286|  30.1k|            short count;
 1287|       |
 1288|  30.1k|            if ((bitStream & (threshold-1)) < (U32)max) {
  ------------------
  |  Branch (1288:17): [True: 21.8k, False: 8.31k]
  ------------------
 1289|  21.8k|                count = (short)(bitStream & (threshold-1));
 1290|  21.8k|                bitCount   += nbBits-1;
 1291|  21.8k|            } else {
 1292|  8.31k|                count = (short)(bitStream & (2*threshold-1));
 1293|  8.31k|                if (count >= threshold) count -= max;
  ------------------
  |  Branch (1293:21): [True: 2.98k, False: 5.33k]
  ------------------
 1294|  8.31k|                bitCount   += nbBits;
 1295|  8.31k|            }
 1296|       |
 1297|  30.1k|            count--;   /* extra accuracy */
 1298|  30.1k|            remaining -= FSEv05_abs(count);
 1299|  30.1k|            normalizedCounter[charnum++] = count;
 1300|  30.1k|            previous0 = !count;
 1301|  45.3k|            while (remaining < threshold) {
  ------------------
  |  Branch (1301:20): [True: 15.2k, False: 30.1k]
  ------------------
 1302|  15.2k|                nbBits--;
 1303|  15.2k|                threshold >>= 1;
 1304|  15.2k|            }
 1305|       |
 1306|  30.1k|            if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
  ------------------
  |  Branch (1306:17): [True: 24.0k, False: 6.13k]
  |  Branch (1306:35): [True: 1.93k, False: 4.20k]
  ------------------
 1307|  25.9k|                ip += bitCount>>3;
 1308|  25.9k|                bitCount &= 7;
 1309|  25.9k|            } else {
 1310|  4.20k|                bitCount -= (int)(8 * (iend - 4 - ip));
 1311|  4.20k|                ip = iend - 4;
 1312|  4.20k|            }
 1313|  30.1k|            bitStream = MEM_readLE32(ip) >> (bitCount & 31);
 1314|  30.1k|    }   }
 1315|  2.04k|    if (remaining != 1) return ERROR(GENERIC);
  ------------------
  |  |   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 (1315:9): [True: 46, False: 2.00k]
  ------------------
 1316|  2.00k|    *maxSVPtr = charnum-1;
 1317|       |
 1318|  2.00k|    ip += (bitCount+7)>>3;
 1319|  2.00k|    if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   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 (1319:9): [True: 56, False: 1.94k]
  ------------------
 1320|  1.94k|    return ip-istart;
 1321|  2.00k|}
FSEv05_buildDTable_rle:
 1329|    107|{
 1330|    107|    void* ptr = dt;
 1331|    107|    FSEv05_DTableHeader* const DTableH = (FSEv05_DTableHeader*)ptr;
 1332|    107|    void* dPtr = dt + 1;
 1333|    107|    FSEv05_decode_t* const cell = (FSEv05_decode_t*)dPtr;
 1334|       |
 1335|    107|    DTableH->tableLog = 0;
 1336|    107|    DTableH->fastMode = 0;
 1337|       |
 1338|    107|    cell->newState = 0;
 1339|    107|    cell->symbol = symbolValue;
 1340|    107|    cell->nbBits = 0;
 1341|       |
 1342|    107|    return 0;
 1343|    107|}
FSEv05_buildDTable_raw:
 1347|    384|{
 1348|    384|    void* ptr = dt;
 1349|    384|    FSEv05_DTableHeader* const DTableH = (FSEv05_DTableHeader*)ptr;
 1350|    384|    void* dPtr = dt + 1;
 1351|    384|    FSEv05_decode_t* const dinfo = (FSEv05_decode_t*)dPtr;
 1352|    384|    const unsigned tableSize = 1 << nbBits;
 1353|    384|    const unsigned tableMask = tableSize - 1;
 1354|    384|    const unsigned maxSymbolValue = tableMask;
 1355|    384|    unsigned s;
 1356|       |
 1357|       |    /* Sanity checks */
 1358|    384|    if (nbBits < 1) return ERROR(GENERIC);         /* min size */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1358:9): [True: 0, False: 384]
  ------------------
 1359|       |
 1360|       |    /* Build Decoding Table */
 1361|    384|    DTableH->tableLog = (U16)nbBits;
 1362|    384|    DTableH->fastMode = 1;
 1363|  33.6k|    for (s=0; s<=maxSymbolValue; s++) {
  ------------------
  |  Branch (1363:15): [True: 33.2k, False: 384]
  ------------------
 1364|  33.2k|        dinfo[s].newState = 0;
 1365|  33.2k|        dinfo[s].symbol = (BYTE)s;
 1366|  33.2k|        dinfo[s].nbBits = (BYTE)nbBits;
 1367|  33.2k|    }
 1368|       |
 1369|    384|    return 0;
 1370|    384|}
FSEv05_decompress_usingDTable:
 1443|    925|{
 1444|    925|    const void* ptr = dt;
 1445|    925|    const FSEv05_DTableHeader* DTableH = (const FSEv05_DTableHeader*)ptr;
 1446|    925|    const U32 fastMode = DTableH->fastMode;
 1447|       |
 1448|       |    /* select fast mode (static) */
 1449|    925|    if (fastMode) return FSEv05_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 1);
  ------------------
  |  Branch (1449:9): [True: 510, False: 415]
  ------------------
 1450|    415|    return FSEv05_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 0);
 1451|    925|}
FSEv05_decompress:
 1455|  1.02k|{
 1456|  1.02k|    const BYTE* const istart = (const BYTE*)cSrc;
 1457|  1.02k|    const BYTE* ip = istart;
 1458|  1.02k|    short counting[FSEv05_MAX_SYMBOL_VALUE+1];
 1459|  1.02k|    DTable_max_t dt;   /* Static analyzer seems unable to understand this table will be properly initialized later */
 1460|  1.02k|    unsigned tableLog;
 1461|  1.02k|    unsigned maxSymbolValue = FSEv05_MAX_SYMBOL_VALUE;
  ------------------
  |  | 1048|  1.02k|#define FSEv05_MAX_SYMBOL_VALUE 255
  ------------------
 1462|  1.02k|    size_t errorCode;
 1463|       |
 1464|  1.02k|    if (cSrcSize<2) return ERROR(srcSize_wrong);   /* too small input size */
  ------------------
  |  |   49|     18|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     18|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     18|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1464:9): [True: 18, False: 1.00k]
  ------------------
 1465|       |
 1466|       |    /* normal FSEv05 decoding mode */
 1467|  1.00k|    errorCode = FSEv05_readNCount (counting, &maxSymbolValue, &tableLog, istart, cSrcSize);
 1468|  1.00k|    if (FSEv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1468:9): [True: 43, False: 963]
  ------------------
 1469|    963|    if (errorCode >= cSrcSize) return ERROR(srcSize_wrong);   /* too small input size */
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1469:9): [True: 20, False: 943]
  ------------------
 1470|    943|    ip += errorCode;
 1471|    943|    cSrcSize -= errorCode;
 1472|       |
 1473|    943|    errorCode = FSEv05_buildDTable (dt, counting, maxSymbolValue, tableLog);
 1474|    943|    if (FSEv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1474:9): [True: 18, False: 925]
  ------------------
 1475|       |
 1476|       |    /* always return, even if it is an error code */
 1477|    925|    return FSEv05_decompress_usingDTable (dst, maxDstSize, ip, cSrcSize, dt);
 1478|    943|}
HUFv05_isError:
 1723|  4.07k|unsigned HUFv05_isError(size_t code) { return ERR_isError(code); }
HUFv05_readDTableX2:
 1818|    357|{
 1819|    357|    BYTE huffWeight[HUFv05_MAX_SYMBOL_VALUE + 1];
 1820|    357|    U32 rankVal[HUFv05_ABSOLUTEMAX_TABLELOG + 1];   /* large enough for values from 0 to 16 */
 1821|    357|    U32 tableLog = 0;
 1822|    357|    size_t iSize;
 1823|    357|    U32 nbSymbols = 0;
 1824|    357|    U32 n;
 1825|    357|    U32 nextRankStart;
 1826|    357|    void* const dtPtr = DTable + 1;
 1827|    357|    HUFv05_DEltX2* const dt = (HUFv05_DEltX2*)dtPtr;
 1828|       |
 1829|    357|    HUFv05_STATIC_ASSERT(sizeof(HUFv05_DEltX2) == sizeof(U16));   /* if compilation fails here, assertion is false */
  ------------------
  |  | 1725|    357|#define HUFv05_STATIC_ASSERT(c) { enum { HUFv05_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
 1830|       |    /* memset(huffWeight, 0, sizeof(huffWeight)); */   /* is not necessary, even though some analyzer complain ... */
 1831|       |
 1832|    357|    iSize = HUFv05_readStats(huffWeight, HUFv05_MAX_SYMBOL_VALUE + 1, rankVal, &nbSymbols, &tableLog, src, srcSize);
  ------------------
  |  | 1714|    357|#define HUFv05_MAX_SYMBOL_VALUE 255
  ------------------
 1833|    357|    if (HUFv05_isError(iSize)) return iSize;
  ------------------
  |  Branch (1833:9): [True: 124, False: 233]
  ------------------
 1834|       |
 1835|       |    /* check result */
 1836|    233|    if (tableLog > DTable[0]) return ERROR(tableLog_tooLarge);   /* DTable is too small */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1836:9): [True: 0, False: 233]
  ------------------
 1837|    233|    DTable[0] = (U16)tableLog;   /* maybe should separate sizeof allocated DTable, from used size of DTable, in case of re-use */
 1838|       |
 1839|       |    /* Prepare ranks */
 1840|    233|    nextRankStart = 0;
 1841|  1.37k|    for (n=1; n<=tableLog; n++) {
  ------------------
  |  Branch (1841:15): [True: 1.14k, False: 233]
  ------------------
 1842|  1.14k|        U32 current = nextRankStart;
 1843|  1.14k|        nextRankStart += (rankVal[n] << (n-1));
 1844|  1.14k|        rankVal[n] = current;
 1845|  1.14k|    }
 1846|       |
 1847|       |    /* fill DTable */
 1848|  10.2k|    for (n=0; n<nbSymbols; n++) {
  ------------------
  |  Branch (1848:15): [True: 10.0k, False: 233]
  ------------------
 1849|  10.0k|        const U32 w = huffWeight[n];
 1850|  10.0k|        const U32 length = (1 << w) >> 1;
 1851|  10.0k|        U32 i;
 1852|  10.0k|        HUFv05_DEltX2 D;
 1853|  10.0k|        D.byte = (BYTE)n; D.nbBits = (BYTE)(tableLog + 1 - w);
 1854|  31.3k|        for (i = rankVal[w]; i < rankVal[w] + length; i++)
  ------------------
  |  Branch (1854:30): [True: 21.3k, False: 10.0k]
  ------------------
 1855|  21.3k|            dt[i] = D;
 1856|  10.0k|        rankVal[w] += length;
 1857|  10.0k|    }
 1858|       |
 1859|    233|    return iSize;
 1860|    233|}
HUFv05_decompress1X2_usingDTable:
 1908|     73|{
 1909|     73|    BYTE* op = (BYTE*)dst;
 1910|     73|    BYTE* const oend = op + dstSize;
 1911|     73|    const U32 dtLog = DTable[0];
 1912|     73|    const void* dtPtr = DTable;
 1913|     73|    const HUFv05_DEltX2* const dt = ((const HUFv05_DEltX2*)dtPtr)+1;
 1914|     73|    BITv05_DStream_t bitD;
 1915|       |
 1916|     73|    if (dstSize <= cSrcSize) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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 (1916:9): [True: 1, False: 72]
  ------------------
 1917|     72|    { size_t const errorCode = BITv05_initDStream(&bitD, cSrc, cSrcSize);
 1918|     72|      if (HUFv05_isError(errorCode)) return errorCode; }
  ------------------
  |  Branch (1918:11): [True: 17, False: 55]
  ------------------
 1919|       |
 1920|     55|    HUFv05_decodeStreamX2(op, &bitD, oend, dt, dtLog);
 1921|       |
 1922|       |    /* check */
 1923|     55|    if (!BITv05_endOfDStream(&bitD)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     54|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     54|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     54|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1923:9): [True: 54, False: 1]
  ------------------
 1924|       |
 1925|      1|    return dstSize;
 1926|     55|}
HUFv05_decompress1X2:
 1929|     91|{
 1930|     91|    HUFv05_CREATE_STATIC_DTABLEX2(DTable, HUFv05_MAX_TABLELOG);
  ------------------
  |  | 1604|     91|        unsigned short DTable[HUFv05_DTABLE_SIZE(maxTableLog)] = { maxTableLog }
  ------------------
 1931|     91|    const BYTE* ip = (const BYTE*) cSrc;
 1932|     91|    size_t errorCode;
 1933|       |
 1934|     91|    errorCode = HUFv05_readDTableX2 (DTable, cSrc, cSrcSize);
 1935|     91|    if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1935:9): [True: 17, False: 74]
  ------------------
 1936|     74|    if (errorCode >= cSrcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1936:9): [True: 1, False: 73]
  ------------------
 1937|     73|    ip += errorCode;
 1938|     73|    cSrcSize -= errorCode;
 1939|       |
 1940|     73|    return HUFv05_decompress1X2_usingDTable (dst, dstSize, ip, cSrcSize, DTable);
 1941|     74|}
HUFv05_decompress4X2_usingDTable:
 1948|    158|{
 1949|       |    /* Check */
 1950|    158|    if (cSrcSize < 10) return ERROR(corruption_detected);   /* strict minimum : jump table + 1 byte per stream */
  ------------------
  |  |   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 (1950:9): [True: 6, False: 152]
  ------------------
 1951|    152|    {
 1952|    152|        const BYTE* const istart = (const BYTE*) cSrc;
 1953|    152|        BYTE* const ostart = (BYTE*) dst;
 1954|    152|        BYTE* const oend = ostart + dstSize;
 1955|    152|        const void* const dtPtr = DTable;
 1956|    152|        const HUFv05_DEltX2* const dt = ((const HUFv05_DEltX2*)dtPtr) +1;
 1957|    152|        const U32 dtLog = DTable[0];
 1958|    152|        size_t errorCode;
 1959|       |
 1960|       |        /* Init */
 1961|    152|        BITv05_DStream_t bitD1;
 1962|    152|        BITv05_DStream_t bitD2;
 1963|    152|        BITv05_DStream_t bitD3;
 1964|    152|        BITv05_DStream_t bitD4;
 1965|    152|        const size_t length1 = MEM_readLE16(istart);
 1966|    152|        const size_t length2 = MEM_readLE16(istart+2);
 1967|    152|        const size_t length3 = MEM_readLE16(istart+4);
 1968|    152|        size_t length4;
 1969|    152|        const BYTE* const istart1 = istart + 6;  /* jumpTable */
 1970|    152|        const BYTE* const istart2 = istart1 + length1;
 1971|    152|        const BYTE* const istart3 = istart2 + length2;
 1972|    152|        const BYTE* const istart4 = istart3 + length3;
 1973|    152|        const size_t segmentSize = (dstSize+3) / 4;
 1974|    152|        BYTE* const opStart2 = ostart + segmentSize;
 1975|    152|        BYTE* const opStart3 = opStart2 + segmentSize;
 1976|    152|        BYTE* const opStart4 = opStart3 + segmentSize;
 1977|    152|        BYTE* op1 = ostart;
 1978|    152|        BYTE* op2 = opStart2;
 1979|    152|        BYTE* op3 = opStart3;
 1980|    152|        BYTE* op4 = opStart4;
 1981|    152|        U32 endSignal;
 1982|       |
 1983|    152|        length4 = cSrcSize - (length1 + length2 + length3 + 6);
 1984|    152|        if (length4 > cSrcSize) return ERROR(corruption_detected);   /* overflow */
  ------------------
  |  |   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 (1984:13): [True: 15, False: 137]
  ------------------
 1985|    137|        errorCode = BITv05_initDStream(&bitD1, istart1, length1);
 1986|    137|        if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1986:13): [True: 14, False: 123]
  ------------------
 1987|    123|        errorCode = BITv05_initDStream(&bitD2, istart2, length2);
 1988|    123|        if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1988:13): [True: 22, False: 101]
  ------------------
 1989|    101|        errorCode = BITv05_initDStream(&bitD3, istart3, length3);
 1990|    101|        if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1990:13): [True: 18, False: 83]
  ------------------
 1991|     83|        errorCode = BITv05_initDStream(&bitD4, istart4, length4);
 1992|     83|        if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1992:13): [True: 6, False: 77]
  ------------------
 1993|       |
 1994|       |        /* 16-32 symbols per loop (4-8 symbols per stream) */
 1995|     77|        endSignal = BITv05_reloadDStream(&bitD1) | BITv05_reloadDStream(&bitD2) | BITv05_reloadDStream(&bitD3) | BITv05_reloadDStream(&bitD4);
 1996|    669|        for ( ; (endSignal==BITv05_DStream_unfinished) && (op4<(oend-7)) ; ) {
  ------------------
  |  Branch (1996:17): [True: 599, False: 70]
  |  Branch (1996:59): [True: 592, False: 7]
  ------------------
 1997|    592|            HUFv05_DECODE_SYMBOLX2_2(op1, &bitD1);
  ------------------
  |  | 1878|    592|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 592, False: 0]
  |  |  ------------------
  |  | 1879|    592|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    592|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1998|    592|            HUFv05_DECODE_SYMBOLX2_2(op2, &bitD2);
  ------------------
  |  | 1878|    592|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 592, False: 0]
  |  |  ------------------
  |  | 1879|    592|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    592|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1999|    592|            HUFv05_DECODE_SYMBOLX2_2(op3, &bitD3);
  ------------------
  |  | 1878|    592|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 592, False: 0]
  |  |  ------------------
  |  | 1879|    592|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    592|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2000|    592|            HUFv05_DECODE_SYMBOLX2_2(op4, &bitD4);
  ------------------
  |  | 1878|    592|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 592, False: 0]
  |  |  ------------------
  |  | 1879|    592|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    592|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2001|    592|            HUFv05_DECODE_SYMBOLX2_1(op1, &bitD1);
  ------------------
  |  | 1874|    592|    if (MEM_64bits() || (HUFv05_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1712|      0|#define HUFv05_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv05_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (1874:9): [True: 592, False: 0]
  |  |  |  Branch (1874:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1875|    592|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    592|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2002|    592|            HUFv05_DECODE_SYMBOLX2_1(op2, &bitD2);
  ------------------
  |  | 1874|    592|    if (MEM_64bits() || (HUFv05_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1712|      0|#define HUFv05_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv05_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (1874:9): [True: 592, False: 0]
  |  |  |  Branch (1874:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1875|    592|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    592|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2003|    592|            HUFv05_DECODE_SYMBOLX2_1(op3, &bitD3);
  ------------------
  |  | 1874|    592|    if (MEM_64bits() || (HUFv05_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1712|      0|#define HUFv05_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv05_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (1874:9): [True: 592, False: 0]
  |  |  |  Branch (1874:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1875|    592|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    592|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2004|    592|            HUFv05_DECODE_SYMBOLX2_1(op4, &bitD4);
  ------------------
  |  | 1874|    592|    if (MEM_64bits() || (HUFv05_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1712|      0|#define HUFv05_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv05_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (1874:9): [True: 592, False: 0]
  |  |  |  Branch (1874:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1875|    592|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    592|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2005|    592|            HUFv05_DECODE_SYMBOLX2_2(op1, &bitD1);
  ------------------
  |  | 1878|    592|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 592, False: 0]
  |  |  ------------------
  |  | 1879|    592|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    592|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2006|    592|            HUFv05_DECODE_SYMBOLX2_2(op2, &bitD2);
  ------------------
  |  | 1878|    592|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 592, False: 0]
  |  |  ------------------
  |  | 1879|    592|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    592|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2007|    592|            HUFv05_DECODE_SYMBOLX2_2(op3, &bitD3);
  ------------------
  |  | 1878|    592|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 592, False: 0]
  |  |  ------------------
  |  | 1879|    592|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    592|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2008|    592|            HUFv05_DECODE_SYMBOLX2_2(op4, &bitD4);
  ------------------
  |  | 1878|    592|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 592, False: 0]
  |  |  ------------------
  |  | 1879|    592|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    592|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2009|    592|            HUFv05_DECODE_SYMBOLX2_0(op1, &bitD1);
  ------------------
  |  | 1871|    592|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2010|    592|            HUFv05_DECODE_SYMBOLX2_0(op2, &bitD2);
  ------------------
  |  | 1871|    592|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2011|    592|            HUFv05_DECODE_SYMBOLX2_0(op3, &bitD3);
  ------------------
  |  | 1871|    592|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2012|    592|            HUFv05_DECODE_SYMBOLX2_0(op4, &bitD4);
  ------------------
  |  | 1871|    592|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2013|    592|            endSignal = BITv05_reloadDStream(&bitD1) | BITv05_reloadDStream(&bitD2) | BITv05_reloadDStream(&bitD3) | BITv05_reloadDStream(&bitD4);
 2014|    592|        }
 2015|       |
 2016|       |        /* check corruption */
 2017|     77|        if (op1 > opStart2) return ERROR(corruption_detected);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2017:13): [True: 0, False: 77]
  ------------------
 2018|     77|        if (op2 > opStart3) return ERROR(corruption_detected);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2018:13): [True: 0, False: 77]
  ------------------
 2019|     77|        if (op3 > opStart4) return ERROR(corruption_detected);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2019:13): [True: 0, False: 77]
  ------------------
 2020|       |        /* note : op4 supposed already verified within main loop */
 2021|       |
 2022|       |        /* finish bitStreams one by one */
 2023|     77|        HUFv05_decodeStreamX2(op1, &bitD1, opStart2, dt, dtLog);
 2024|     77|        HUFv05_decodeStreamX2(op2, &bitD2, opStart3, dt, dtLog);
 2025|     77|        HUFv05_decodeStreamX2(op3, &bitD3, opStart4, dt, dtLog);
 2026|     77|        HUFv05_decodeStreamX2(op4, &bitD4, oend,     dt, dtLog);
 2027|       |
 2028|       |        /* check */
 2029|     77|        endSignal = BITv05_endOfDStream(&bitD1) & BITv05_endOfDStream(&bitD2) & BITv05_endOfDStream(&bitD3) & BITv05_endOfDStream(&bitD4);
 2030|     77|        if (!endSignal) return ERROR(corruption_detected);
  ------------------
  |  |   49|     77|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     77|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     77|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2030:13): [True: 77, False: 0]
  ------------------
 2031|       |
 2032|       |        /* decoded size */
 2033|      0|        return dstSize;
 2034|     77|    }
 2035|     77|}
HUFv05_decompress4X2:
 2039|    266|{
 2040|    266|    HUFv05_CREATE_STATIC_DTABLEX2(DTable, HUFv05_MAX_TABLELOG);
  ------------------
  |  | 1604|    266|        unsigned short DTable[HUFv05_DTABLE_SIZE(maxTableLog)] = { maxTableLog }
  ------------------
 2041|    266|    const BYTE* ip = (const BYTE*) cSrc;
 2042|    266|    size_t errorCode;
 2043|       |
 2044|    266|    errorCode = HUFv05_readDTableX2 (DTable, cSrc, cSrcSize);
 2045|    266|    if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (2045:9): [True: 107, False: 159]
  ------------------
 2046|    159|    if (errorCode >= cSrcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2046:9): [True: 1, False: 158]
  ------------------
 2047|    158|    ip += errorCode;
 2048|    158|    cSrcSize -= errorCode;
 2049|       |
 2050|    158|    return HUFv05_decompress4X2_usingDTable (dst, dstSize, ip, cSrcSize, DTable);
 2051|    159|}
HUFv05_readDTableX4:
 2146|  1.17k|{
 2147|  1.17k|    BYTE weightList[HUFv05_MAX_SYMBOL_VALUE + 1];
 2148|  1.17k|    sortedSymbol_t sortedSymbol[HUFv05_MAX_SYMBOL_VALUE + 1];
 2149|  1.17k|    U32 rankStats[HUFv05_ABSOLUTEMAX_TABLELOG + 1] = { 0 };
 2150|  1.17k|    U32 rankStart0[HUFv05_ABSOLUTEMAX_TABLELOG + 2] = { 0 };
 2151|  1.17k|    U32* const rankStart = rankStart0+1;
 2152|  1.17k|    rankVal_t rankVal;
 2153|  1.17k|    U32 tableLog, maxW, sizeOfSort, nbSymbols;
 2154|  1.17k|    const U32 memLog = DTable[0];
 2155|  1.17k|    size_t iSize;
 2156|  1.17k|    void* dtPtr = DTable;
 2157|  1.17k|    HUFv05_DEltX4* const dt = ((HUFv05_DEltX4*)dtPtr) + 1;
 2158|       |
 2159|  1.17k|    HUFv05_STATIC_ASSERT(sizeof(HUFv05_DEltX4) == sizeof(unsigned));   /* if compilation fails here, assertion is false */
  ------------------
  |  | 1725|  1.17k|#define HUFv05_STATIC_ASSERT(c) { enum { HUFv05_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
 2160|  1.17k|    if (memLog > HUFv05_ABSOLUTEMAX_TABLELOG) return ERROR(tableLog_tooLarge);
  ------------------
  |  | 1711|  1.17k|#define HUFv05_ABSOLUTEMAX_TABLELOG  16   /* absolute limit of HUFv05_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
                  if (memLog > HUFv05_ABSOLUTEMAX_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 (2160:9): [True: 0, False: 1.17k]
  ------------------
 2161|       |    /* memset(weightList, 0, sizeof(weightList)); */   /* is not necessary, even though some analyzer complain ... */
 2162|       |
 2163|  1.17k|    iSize = HUFv05_readStats(weightList, HUFv05_MAX_SYMBOL_VALUE + 1, rankStats, &nbSymbols, &tableLog, src, srcSize);
  ------------------
  |  | 1714|  1.17k|#define HUFv05_MAX_SYMBOL_VALUE 255
  ------------------
 2164|  1.17k|    if (HUFv05_isError(iSize)) return iSize;
  ------------------
  |  Branch (2164:9): [True: 856, False: 316]
  ------------------
 2165|       |
 2166|       |    /* check result */
 2167|    316|    if (tableLog > memLog) return ERROR(tableLog_tooLarge);   /* DTable can't fit code depth */
  ------------------
  |  |   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 (2167:9): [True: 2, False: 314]
  ------------------
 2168|       |
 2169|       |    /* find maxWeight */
 2170|  1.09k|    for (maxW = tableLog; rankStats[maxW]==0; maxW--) {}  /* necessarily finds a solution before 0 */
  ------------------
  |  Branch (2170:27): [True: 779, False: 314]
  ------------------
 2171|       |
 2172|       |    /* Get start index of each weight */
 2173|    314|    {
 2174|    314|        U32 w, nextRankStart = 0;
 2175|  1.67k|        for (w=1; w<=maxW; w++) {
  ------------------
  |  Branch (2175:19): [True: 1.36k, False: 314]
  ------------------
 2176|  1.36k|            U32 current = nextRankStart;
 2177|  1.36k|            nextRankStart += rankStats[w];
 2178|  1.36k|            rankStart[w] = current;
 2179|  1.36k|        }
 2180|    314|        rankStart[0] = nextRankStart;   /* put all 0w symbols at the end of sorted list*/
 2181|    314|        sizeOfSort = nextRankStart;
 2182|    314|    }
 2183|       |
 2184|       |    /* sort symbols by weight */
 2185|    314|    {
 2186|    314|        U32 s;
 2187|  32.4k|        for (s=0; s<nbSymbols; s++) {
  ------------------
  |  Branch (2187:19): [True: 32.1k, False: 314]
  ------------------
 2188|  32.1k|            U32 w = weightList[s];
 2189|  32.1k|            U32 r = rankStart[w]++;
 2190|  32.1k|            sortedSymbol[r].symbol = (BYTE)s;
 2191|  32.1k|            sortedSymbol[r].weight = (BYTE)w;
 2192|  32.1k|        }
 2193|    314|        rankStart[0] = 0;   /* forget 0w symbols; this is beginning of weight(1) */
 2194|    314|    }
 2195|       |
 2196|       |    /* Build rankVal */
 2197|    314|    {
 2198|    314|        const U32 minBits = tableLog+1 - maxW;
 2199|    314|        U32 nextRankVal = 0;
 2200|    314|        U32 w, consumed;
 2201|    314|        const int rescale = (memLog-tableLog) - 1;   /* tableLog <= memLog */
 2202|    314|        U32* rankVal0 = rankVal[0];
 2203|  1.67k|        for (w=1; w<=maxW; w++) {
  ------------------
  |  Branch (2203:19): [True: 1.36k, False: 314]
  ------------------
 2204|  1.36k|            U32 current = nextRankVal;
 2205|  1.36k|            nextRankVal += rankStats[w] << (w+rescale);
 2206|  1.36k|            rankVal0[w] = current;
 2207|  1.36k|        }
 2208|  2.31k|        for (consumed = minBits; consumed <= memLog - minBits; consumed++) {
  ------------------
  |  Branch (2208:34): [True: 2.00k, False: 314]
  ------------------
 2209|  2.00k|            U32* rankValPtr = rankVal[consumed];
 2210|  15.1k|            for (w = 1; w <= maxW; w++) {
  ------------------
  |  Branch (2210:25): [True: 13.1k, False: 2.00k]
  ------------------
 2211|  13.1k|                rankValPtr[w] = rankVal0[w] >> consumed;
 2212|  13.1k|    }   }   }
 2213|       |
 2214|    314|    HUFv05_fillDTableX4(dt, memLog,
 2215|    314|                   sortedSymbol, sizeOfSort,
 2216|    314|                   rankStart0, rankVal, maxW,
 2217|    314|                   tableLog+1);
 2218|       |
 2219|    314|    return iSize;
 2220|    316|}
HUFv05_decompress1X4_usingDTable:
 2287|     60|{
 2288|     60|    const BYTE* const istart = (const BYTE*) cSrc;
 2289|     60|    BYTE* const ostart = (BYTE*) dst;
 2290|     60|    BYTE* const oend = ostart + dstSize;
 2291|       |
 2292|     60|    const U32 dtLog = DTable[0];
 2293|     60|    const void* const dtPtr = DTable;
 2294|     60|    const HUFv05_DEltX4* const dt = ((const HUFv05_DEltX4*)dtPtr) +1;
 2295|     60|    size_t errorCode;
 2296|       |
 2297|       |    /* Init */
 2298|     60|    BITv05_DStream_t bitD;
 2299|     60|    errorCode = BITv05_initDStream(&bitD, istart, cSrcSize);
 2300|     60|    if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (2300:9): [True: 15, False: 45]
  ------------------
 2301|       |
 2302|       |    /* finish bitStreams one by one */
 2303|     45|    HUFv05_decodeStreamX4(ostart, &bitD, oend,     dt, dtLog);
 2304|       |
 2305|       |    /* check */
 2306|     45|    if (!BITv05_endOfDStream(&bitD)) return ERROR(corruption_detected);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2306:9): [True: 44, False: 1]
  ------------------
 2307|       |
 2308|       |    /* decoded size */
 2309|      1|    return dstSize;
 2310|     45|}
HUFv05_decompress:
 2465|    286|{
 2466|    286|    static const decompressionAlgo decompress[3] = { HUFv05_decompress4X2, HUFv05_decompress4X4, NULL };
 2467|       |    /* estimate decompression time */
 2468|    286|    U32 Q;
 2469|    286|    const U32 D256 = (U32)(dstSize >> 8);
 2470|    286|    U32 Dtime[3];
 2471|    286|    U32 algoNb = 0;
 2472|    286|    int n;
 2473|       |
 2474|       |    /* validation checks */
 2475|    286|    if (dstSize == 0) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   49|      4|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      4|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      4|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2475:9): [True: 4, False: 282]
  ------------------
 2476|    282|    if (cSrcSize >= dstSize) return ERROR(corruption_detected);   /* invalid, or not compressed, but not compressed already dealt with */
  ------------------
  |  |   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 (2476:9): [True: 3, False: 279]
  ------------------
 2477|    279|    if (cSrcSize == 1) { memset(dst, *(const BYTE*)cSrc, dstSize); return dstSize; }   /* RLE */
  ------------------
  |  Branch (2477:9): [True: 13, False: 266]
  ------------------
 2478|       |
 2479|       |    /* decoder timing evaluation */
 2480|    266|    Q = (U32)(cSrcSize * 16 / dstSize);   /* Q < 16 since dstSize > cSrcSize */
 2481|  1.06k|    for (n=0; n<3; n++)
  ------------------
  |  Branch (2481:15): [True: 798, False: 266]
  ------------------
 2482|    798|        Dtime[n] = algoTime[Q][n].tableTime + (algoTime[Q][n].decode256Time * D256);
 2483|       |
 2484|    266|    Dtime[1] += Dtime[1] >> 4; Dtime[2] += Dtime[2] >> 3; /* advantage to algorithms using less memory, for cache eviction */
 2485|       |
 2486|    266|    if (Dtime[1] < Dtime[0]) algoNb = 1;
  ------------------
  |  Branch (2486:9): [True: 0, False: 266]
  ------------------
 2487|       |
 2488|    266|    return decompress[algoNb](dst, dstSize, cSrc, cSrcSize);
 2489|       |
 2490|       |    /* return HUFv05_decompress4X2(dst, dstSize, cSrc, cSrcSize); */   /* multi-streams single-symbol decoding */
 2491|       |    /* return HUFv05_decompress4X4(dst, dstSize, cSrc, cSrcSize); */   /* multi-streams double-symbols decoding */
 2492|       |    /* return HUFv05_decompress4X6(dst, dstSize, cSrc, cSrcSize); */   /* multi-streams quad-symbols decoding */
 2493|    279|}
ZSTDv05_isError:
 2577|  93.4k|unsigned ZSTDv05_isError(size_t code) { return ERR_isError(code); }
ZSTDv05_decompressBegin:
 2617|  3.95k|{
 2618|  3.95k|    dctx->expected = ZSTDv05_frameHeaderSize_min;
 2619|  3.95k|    dctx->stage = ZSTDv05ds_getFrameHeaderSize;
 2620|  3.95k|    dctx->previousDstEnd = NULL;
 2621|  3.95k|    dctx->base = NULL;
 2622|  3.95k|    dctx->vBase = NULL;
 2623|  3.95k|    dctx->dictEnd = NULL;
 2624|  3.95k|    dctx->hufTableX4[0] = ZSTD_HUFFDTABLE_CAPACITY_LOG;
  ------------------
  |  |  436|  3.95k|#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
  ------------------
 2625|  3.95k|    dctx->flagStaticTables = 0;
 2626|  3.95k|    return 0;
 2627|  3.95k|}
ZSTDv05_createDCtx:
 2630|  1.97k|{
 2631|  1.97k|    ZSTDv05_DCtx* dctx = (ZSTDv05_DCtx*)malloc(sizeof(ZSTDv05_DCtx));
 2632|  1.97k|    if (dctx==NULL) return NULL;
  ------------------
  |  Branch (2632:9): [True: 0, False: 1.97k]
  ------------------
 2633|  1.97k|    ZSTDv05_decompressBegin(dctx);
 2634|  1.97k|    return dctx;
 2635|  1.97k|}
ZSTDv05_freeDCtx:
 2638|  1.97k|{
 2639|  1.97k|    free(dctx);
 2640|  1.97k|    return 0;   /* reserved as a potential error code in the future */
 2641|  1.97k|}
ZSTDv05_getFrameParams:
 2752|  3.10k|{
 2753|  3.10k|    U32 magicNumber;
 2754|  3.10k|    if (srcSize < ZSTDv05_frameHeaderSize_min) return ZSTDv05_frameHeaderSize_max;
  ------------------
  |  |  400|      0|#define ZSTDv05_frameHeaderSize_max 5         /* define, for static allocation */
  ------------------
  |  Branch (2754:9): [True: 0, False: 3.10k]
  ------------------
 2755|  3.10k|    magicNumber = MEM_readLE32(src);
 2756|  3.10k|    if (magicNumber != ZSTDv05_MAGICNUMBER) return ERROR(prefix_unknown);
  ------------------
  |  |  153|  3.10k|#define ZSTDv05_MAGICNUMBER 0xFD2FB525   /* v0.5 */
  ------------------
                  if (magicNumber != ZSTDv05_MAGICNUMBER) return ERROR(prefix_unknown);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2756:9): [True: 0, False: 3.10k]
  ------------------
 2757|  3.10k|    memset(params, 0, sizeof(*params));
 2758|  3.10k|    params->windowLog = (((const BYTE*)src)[4] & 15) + ZSTDv05_WINDOWLOG_ABSOLUTEMIN;
  ------------------
  |  |  256|  3.10k|#define ZSTDv05_WINDOWLOG_ABSOLUTEMIN 11
  ------------------
 2759|  3.10k|    if ((((const BYTE*)src)[4] >> 4) != 0) return ERROR(frameParameter_unsupported);   /* reserved bits */
  ------------------
  |  |   49|     68|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     68|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     68|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2759:9): [True: 68, False: 3.03k]
  ------------------
 2760|  3.03k|    return 0;
 2761|  3.10k|}
ZSTDv05_decompress_usingDict:
 3449|  1.97k|{
 3450|  1.97k|    ZSTDv05_decompressBegin_usingDict(dctx, dict, dictSize);
 3451|  1.97k|    ZSTDv05_checkContinuity(dctx, dst);
 3452|  1.97k|    return ZSTDv05_decompress_continueDCtx(dctx, dst, maxDstSize, src, srcSize);
 3453|  1.97k|}
ZSTDv05_findFrameSizeInfoLegacy:
 3485|  2.04k|{
 3486|  2.04k|    const BYTE* ip = (const BYTE*)src;
 3487|  2.04k|    size_t remainingSize = srcSize;
 3488|  2.04k|    size_t nbBlocks = 0;
 3489|  2.04k|    blockProperties_t blockProperties;
 3490|       |
 3491|       |    /* Frame Header */
 3492|  2.04k|    if (srcSize < ZSTDv05_frameHeaderSize_min) {
  ------------------
  |  Branch (3492:9): [True: 0, False: 2.04k]
  ------------------
 3493|      0|        ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(srcSize_wrong));
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3494|      0|        return;
 3495|      0|    }
 3496|  2.04k|    if (MEM_readLE32(src) != ZSTDv05_MAGICNUMBER) {
  ------------------
  |  |  153|  2.04k|#define ZSTDv05_MAGICNUMBER 0xFD2FB525   /* v0.5 */
  ------------------
  |  Branch (3496:9): [True: 0, False: 2.04k]
  ------------------
 3497|      0|        ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(prefix_unknown));
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3498|      0|        return;
 3499|      0|    }
 3500|  2.04k|    ip += ZSTDv05_frameHeaderSize_min; remainingSize -= ZSTDv05_frameHeaderSize_min;
 3501|       |
 3502|       |    /* Loop on each block */
 3503|  3.93k|    while (1)
  ------------------
  |  Branch (3503:12): [True: 3.93k, Folded]
  ------------------
 3504|  3.93k|    {
 3505|  3.93k|        size_t cBlockSize = ZSTDv05_getcBlockSize(ip, remainingSize, &blockProperties);
 3506|  3.93k|        if (ZSTDv05_isError(cBlockSize)) {
  ------------------
  |  Branch (3506:13): [True: 4, False: 3.92k]
  ------------------
 3507|      4|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, cBlockSize);
 3508|      4|            return;
 3509|      4|        }
 3510|       |
 3511|  3.92k|        ip += ZSTDv05_blockHeaderSize;
 3512|  3.92k|        remainingSize -= ZSTDv05_blockHeaderSize;
 3513|  3.92k|        if (cBlockSize > remainingSize) {
  ------------------
  |  Branch (3513:13): [True: 60, False: 3.86k]
  ------------------
 3514|     60|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(srcSize_wrong));
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3515|     60|            return;
 3516|     60|        }
 3517|       |
 3518|  3.86k|        if (cBlockSize == 0) break;   /* bt_end */
  ------------------
  |  Branch (3518:13): [True: 1.97k, False: 1.89k]
  ------------------
 3519|       |
 3520|  1.89k|        ip += cBlockSize;
 3521|  1.89k|        remainingSize -= cBlockSize;
 3522|  1.89k|        nbBlocks++;
 3523|  1.89k|    }
 3524|       |
 3525|  1.97k|    *cSize = ip - (const BYTE*)src;
 3526|  1.97k|    *dBound = nbBlocks * BLOCKSIZE;
  ------------------
  |  |  396|  1.97k|#define BLOCKSIZE (128 KB)                 /* define, for static allocation */
  |  |  ------------------
  |  |  |  |  392|  1.97k|#define KB *(1 <<10)
  |  |  ------------------
  ------------------
 3527|  1.97k|}
ZSTDv05_decompressBegin_usingDict:
 3687|  1.97k|{
 3688|  1.97k|    size_t errorCode;
 3689|  1.97k|    errorCode = ZSTDv05_decompressBegin(dctx);
 3690|  1.97k|    if (ZSTDv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (3690:9): [True: 0, False: 1.97k]
  ------------------
 3691|       |
 3692|  1.97k|    if (dict && dictSize) {
  ------------------
  |  Branch (3692:9): [True: 1.97k, False: 0]
  |  Branch (3692:17): [True: 1.25k, False: 720]
  ------------------
 3693|  1.25k|        errorCode = ZSTDv05_decompress_insertDictionary(dctx, dict, dictSize);
 3694|  1.25k|        if (ZSTDv05_isError(errorCode)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|  1.05k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  1.05k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  1.05k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3694:13): [True: 1.05k, False: 207]
  ------------------
 3695|  1.25k|    }
 3696|       |
 3697|    927|    return 0;
 3698|  1.97k|}
zstd_v05.c:FSEv05_tableStep:
 1142|  1.86k|static U32 FSEv05_tableStep(U32 tableSize) { return (tableSize>>1) + (tableSize>>3) + 3; }
zstd_v05.c:BITv05_highbit32:
  702|   723k|{
  703|       |#   if defined(_MSC_VER)   /* Visual */
  704|       |    unsigned long r;
  705|       |    return _BitScanReverse(&r, val) ? (unsigned)r : 0;
  706|       |#   elif defined(__GNUC__) && (__GNUC__ >= 3)   /* Use GCC Intrinsic */
  707|       |    return __builtin_clz (val) ^ 31;
  708|       |#   else   /* Software version */
  709|       |    static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 };
  710|       |    U32 v = val;
  711|       |    unsigned r;
  712|       |    v |= v >> 1;
  713|       |    v |= v >> 2;
  714|       |    v |= v >> 4;
  715|       |    v |= v >> 8;
  716|       |    v |= v >> 16;
  717|       |    r = DeBruijnClz[ (U32) (v * 0x07C4ACDDU) >> 27];
  718|       |    return r;
  719|       |#   endif
  720|   723k|}
zstd_v05.c:FSEv05_abs:
 1227|  30.1k|static short FSEv05_abs(short a) { return a<0 ? -a : a; }
  ------------------
  |  Branch (1227:43): [True: 14.4k, False: 15.6k]
  ------------------
zstd_v05.c:FSEv05_decompress_usingDTable_generic:
 1376|    925|{
 1377|    925|    BYTE* const ostart = (BYTE*) dst;
 1378|    925|    BYTE* op = ostart;
 1379|    925|    BYTE* const omax = op + maxDstSize;
 1380|    925|    BYTE* const olimit = omax-3;
 1381|       |
 1382|    925|    BITv05_DStream_t bitD;
 1383|    925|    FSEv05_DState_t state1;
 1384|    925|    FSEv05_DState_t state2;
 1385|    925|    size_t errorCode;
 1386|       |
 1387|       |    /* Init */
 1388|    925|    errorCode = BITv05_initDStream(&bitD, cSrc, cSrcSize);   /* replaced last arg by maxCompressed Size */
 1389|    925|    if (FSEv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1389:9): [True: 107, False: 818]
  ------------------
 1390|       |
 1391|    818|    FSEv05_initDState(&state1, &bitD, dt);
 1392|    818|    FSEv05_initDState(&state2, &bitD, dt);
 1393|       |
 1394|    818|#define FSEv05_GETSYMBOL(statePtr) fast ? FSEv05_decodeSymbolFast(statePtr, &bitD) : FSEv05_decodeSymbol(statePtr, &bitD)
 1395|       |
 1396|       |    /* 4 symbols per loop */
 1397|  11.2k|    for ( ; (BITv05_reloadDStream(&bitD)==BITv05_DStream_unfinished) && (op<olimit) ; op+=4) {
  ------------------
  |  Branch (1397:13): [True: 10.4k, False: 724]
  |  Branch (1397:73): [True: 10.3k, False: 94]
  ------------------
 1398|  10.3k|        op[0] = FSEv05_GETSYMBOL(&state1);
  ------------------
  |  | 1394|  10.3k|#define FSEv05_GETSYMBOL(statePtr) fast ? FSEv05_decodeSymbolFast(statePtr, &bitD) : FSEv05_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1394:36): [True: 2.70k, False: 7.68k]
  |  |  ------------------
  ------------------
 1399|       |
 1400|  10.3k|        if (FSEv05_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  | 1094|  10.3k|#define FSEv05_MAX_TABLELOG  (FSEv05_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  | 1042|  10.3k|#define FSEv05_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (1400:13): [Folded, False: 10.3k]
  ------------------
 1401|      0|            BITv05_reloadDStream(&bitD);
 1402|       |
 1403|  10.3k|        op[1] = FSEv05_GETSYMBOL(&state2);
  ------------------
  |  | 1394|  10.3k|#define FSEv05_GETSYMBOL(statePtr) fast ? FSEv05_decodeSymbolFast(statePtr, &bitD) : FSEv05_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1394:36): [True: 2.70k, False: 7.68k]
  |  |  ------------------
  ------------------
 1404|       |
 1405|  10.3k|        if (FSEv05_MAX_TABLELOG*4+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  | 1094|  10.3k|#define FSEv05_MAX_TABLELOG  (FSEv05_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  | 1042|  10.3k|#define FSEv05_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (1405:13): [Folded, False: 10.3k]
  ------------------
 1406|      0|            { if (BITv05_reloadDStream(&bitD) > BITv05_DStream_unfinished) { op+=2; break; } }
  ------------------
  |  Branch (1406:19): [True: 0, False: 0]
  ------------------
 1407|       |
 1408|  10.3k|        op[2] = FSEv05_GETSYMBOL(&state1);
  ------------------
  |  | 1394|  10.3k|#define FSEv05_GETSYMBOL(statePtr) fast ? FSEv05_decodeSymbolFast(statePtr, &bitD) : FSEv05_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1394:36): [True: 2.70k, False: 7.68k]
  |  |  ------------------
  ------------------
 1409|       |
 1410|  10.3k|        if (FSEv05_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  | 1094|  10.3k|#define FSEv05_MAX_TABLELOG  (FSEv05_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  | 1042|  10.3k|#define FSEv05_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (1410:13): [Folded, False: 10.3k]
  ------------------
 1411|      0|            BITv05_reloadDStream(&bitD);
 1412|       |
 1413|  10.3k|        op[3] = FSEv05_GETSYMBOL(&state2);
  ------------------
  |  | 1394|  10.3k|#define FSEv05_GETSYMBOL(statePtr) fast ? FSEv05_decodeSymbolFast(statePtr, &bitD) : FSEv05_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1394:36): [True: 2.70k, False: 7.68k]
  |  |  ------------------
  ------------------
 1414|  10.3k|    }
 1415|       |
 1416|       |    /* tail */
 1417|       |    /* note : BITv05_reloadDStream(&bitD) >= FSEv05_DStream_partiallyFilled; Ends at exactly BITv05_DStream_completed */
 1418|  10.5k|    while (1) {
  ------------------
  |  Branch (1418:12): [True: 10.5k, Folded]
  ------------------
 1419|  10.5k|        if ( (BITv05_reloadDStream(&bitD)>BITv05_DStream_completed) || (op==omax) || (BITv05_endOfDStream(&bitD) && (fast || FSEv05_endOfDState(&state1))) )
  ------------------
  |  Branch (1419:14): [True: 161, False: 10.4k]
  |  Branch (1419:72): [True: 0, False: 10.4k]
  |  Branch (1419:87): [True: 365, False: 10.0k]
  |  Branch (1419:118): [True: 62, False: 303]
  |  Branch (1419:126): [True: 65, False: 238]
  ------------------
 1420|    288|            break;
 1421|       |
 1422|  10.2k|        *op++ = FSEv05_GETSYMBOL(&state1);
  ------------------
  |  | 1394|  10.2k|#define FSEv05_GETSYMBOL(statePtr) fast ? FSEv05_decodeSymbolFast(statePtr, &bitD) : FSEv05_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1394:36): [True: 3.79k, False: 6.48k]
  |  |  ------------------
  ------------------
 1423|       |
 1424|  10.2k|        if ( (BITv05_reloadDStream(&bitD)>BITv05_DStream_completed) || (op==omax) || (BITv05_endOfDStream(&bitD) && (fast || FSEv05_endOfDState(&state2))) )
  ------------------
  |  Branch (1424:14): [True: 123, False: 10.1k]
  |  Branch (1424:72): [True: 134, False: 10.0k]
  |  Branch (1424:87): [True: 491, False: 9.53k]
  |  Branch (1424:118): [True: 222, False: 269]
  |  Branch (1424:126): [True: 51, False: 218]
  ------------------
 1425|    530|            break;
 1426|       |
 1427|  9.75k|        *op++ = FSEv05_GETSYMBOL(&state2);
  ------------------
  |  | 1394|  9.75k|#define FSEv05_GETSYMBOL(statePtr) fast ? FSEv05_decodeSymbolFast(statePtr, &bitD) : FSEv05_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1394:36): [True: 3.49k, False: 6.26k]
  |  |  ------------------
  ------------------
 1428|  9.75k|    }
 1429|       |
 1430|       |    /* end ? */
 1431|    818|    if (BITv05_endOfDStream(&bitD) && FSEv05_endOfDState(&state1) && FSEv05_endOfDState(&state2))
  ------------------
  |  Branch (1431:9): [True: 416, False: 402]
  |  Branch (1431:39): [True: 301, False: 115]
  |  Branch (1431:70): [True: 251, False: 50]
  ------------------
 1432|    251|        return op-ostart;
 1433|       |
 1434|    567|    if (op==omax) return ERROR(dstSize_tooSmall);   /* dst buffer is full, but cSrc unfinished */
  ------------------
  |  |   49|    134|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    134|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    134|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1434:9): [True: 134, False: 433]
  ------------------
 1435|       |
 1436|    433|    return ERROR(corruption_detected);
  ------------------
  |  |   49|    433|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    433|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    433|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1437|    567|}
zstd_v05.c:FSEv05_initDState:
  951|  2.44k|{
  952|  2.44k|    const void* ptr = dt;
  953|  2.44k|    const FSEv05_DTableHeader* const DTableH = (const FSEv05_DTableHeader*)ptr;
  954|  2.44k|    DStatePtr->state = BITv05_readBits(bitD, DTableH->tableLog);
  955|  2.44k|    BITv05_reloadDStream(bitD);
  956|  2.44k|    DStatePtr->table = dt + 1;
  957|  2.44k|}
zstd_v05.c:BITv05_readBits:
  790|   348k|{
  791|   348k|    size_t value = BITv05_lookBits(bitD, nbBits);
  792|   348k|    BITv05_skipBits(bitD, nbBits);
  793|   348k|    return value;
  794|   348k|}
zstd_v05.c:BITv05_lookBits:
  771|   348k|{
  772|   348k|    const U32 bitMask = sizeof(bitD->bitContainer)*8 - 1;
  773|   348k|    return ((bitD->bitContainer << (bitD->bitsConsumed & bitMask)) >> 1) >> ((bitMask-nbBits) & bitMask);
  774|   348k|}
zstd_v05.c:BITv05_skipBits:
  785|  4.81M|{
  786|  4.81M|    bitD->bitsConsumed += nbBits;
  787|  4.81M|}
zstd_v05.c:FSEv05_decodeSymbolFast:
  977|  18.0k|{
  978|  18.0k|    const FSEv05_decode_t DInfo = ((const FSEv05_decode_t*)(DStatePtr->table))[DStatePtr->state];
  979|  18.0k|    const U32 nbBits = DInfo.nbBits;
  980|  18.0k|    BYTE symbol = DInfo.symbol;
  981|  18.0k|    size_t lowBits = BITv05_readBitsFast(bitD, nbBits);
  982|       |
  983|  18.0k|    DStatePtr->state = DInfo.newState + lowBits;
  984|  18.0k|    return symbol;
  985|  18.0k|}
zstd_v05.c:BITv05_readBitsFast:
  799|  18.0k|{
  800|  18.0k|    size_t value = BITv05_lookBitsFast(bitD, nbBits);
  801|  18.0k|    BITv05_skipBits(bitD, nbBits);
  802|  18.0k|    return value;
  803|  18.0k|}
zstd_v05.c:BITv05_lookBitsFast:
  779|  4.46M|{
  780|  4.46M|    const U32 bitMask = sizeof(bitD->bitContainer)*8 - 1;
  781|  4.46M|    return (bitD->bitContainer << (bitD->bitsConsumed & bitMask)) >> (((bitMask+1)-nbBits) & bitMask);
  782|  4.46M|}
zstd_v05.c:FSEv05_decodeSymbol:
  966|   270k|{
  967|   270k|    const FSEv05_decode_t DInfo = ((const FSEv05_decode_t*)(DStatePtr->table))[DStatePtr->state];
  968|   270k|    const U32  nbBits = DInfo.nbBits;
  969|   270k|    BYTE symbol = DInfo.symbol;
  970|   270k|    size_t lowBits = BITv05_readBits(bitD, nbBits);
  971|       |
  972|   270k|    DStatePtr->state = DInfo.newState + lowBits;
  973|   270k|    return symbol;
  974|   270k|}
zstd_v05.c:FSEv05_endOfDState:
  988|  1.28k|{
  989|  1.28k|    return DStatePtr->state == 0;
  990|  1.28k|}
zstd_v05.c:HUFv05_readStats:
 1745|  1.52k|{
 1746|  1.52k|    U32 weightTotal;
 1747|  1.52k|    U32 tableLog;
 1748|  1.52k|    const BYTE* ip = (const BYTE*) src;
 1749|  1.52k|    size_t iSize;
 1750|  1.52k|    size_t oSize;
 1751|  1.52k|    U32 n;
 1752|       |
 1753|  1.52k|    if (!srcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1753:9): [True: 24, False: 1.50k]
  ------------------
 1754|  1.50k|    iSize = ip[0];
 1755|       |    /* memset(huffWeight, 0, hwSize); */   /* is not necessary, even though some analyzer complain ... */
 1756|       |
 1757|  1.50k|    if (iSize >= 128)  { /* special header */
  ------------------
  |  Branch (1757:9): [True: 460, False: 1.04k]
  ------------------
 1758|    460|        if (iSize >= (242)) {  /* RLE */
  ------------------
  |  Branch (1758:13): [True: 349, False: 111]
  ------------------
 1759|    349|            static int l[14] = { 1, 2, 3, 4, 7, 8, 15, 16, 31, 32, 63, 64, 127, 128 };
 1760|    349|            oSize = l[iSize-242];
 1761|    349|            memset(huffWeight, 1, hwSize);
 1762|    349|            iSize = 0;
 1763|    349|        }
 1764|    111|        else {   /* Incompressible */
 1765|    111|            oSize = iSize - 127;
 1766|    111|            iSize = ((oSize+1)/2);
 1767|    111|            if (iSize+1 > srcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|     18|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     18|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     18|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1767:17): [True: 18, False: 93]
  ------------------
 1768|     93|            if (oSize >= hwSize) return ERROR(corruption_detected);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1768:17): [True: 0, False: 93]
  ------------------
 1769|     93|            ip += 1;
 1770|  1.45k|            for (n=0; n<oSize; n+=2) {
  ------------------
  |  Branch (1770:23): [True: 1.36k, False: 93]
  ------------------
 1771|  1.36k|                huffWeight[n]   = ip[n/2] >> 4;
 1772|  1.36k|                huffWeight[n+1] = ip[n/2] & 15;
 1773|  1.36k|    }   }   }
 1774|  1.04k|    else  {   /* header compressed with FSEv05 (normal case) */
 1775|  1.04k|        if (iSize+1 > srcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1775:13): [True: 21, False: 1.02k]
  ------------------
 1776|  1.02k|        oSize = FSEv05_decompress(huffWeight, hwSize-1, ip+1, iSize);   /* max (hwSize-1) values decoded, as last one is implied */
 1777|  1.02k|        if (FSEv05_isError(oSize)) return oSize;
  ------------------
  |  Branch (1777:13): [True: 773, False: 251]
  ------------------
 1778|  1.02k|    }
 1779|       |
 1780|       |    /* collect weight stats */
 1781|    693|    memset(rankStats, 0, (HUFv05_ABSOLUTEMAX_TABLELOG + 1) * sizeof(U32));
  ------------------
  |  | 1711|    693|#define HUFv05_ABSOLUTEMAX_TABLELOG  16   /* absolute limit of HUFv05_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
 1782|    693|    weightTotal = 0;
 1783|  46.4k|    for (n=0; n<oSize; n++) {
  ------------------
  |  Branch (1783:15): [True: 45.7k, False: 679]
  ------------------
 1784|  45.7k|        if (huffWeight[n] >= HUFv05_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected);
  ------------------
  |  | 1711|  45.7k|#define HUFv05_ABSOLUTEMAX_TABLELOG  16   /* absolute limit of HUFv05_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
                      if (huffWeight[n] >= HUFv05_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected);
  ------------------
  |  |   49|     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 (1784:13): [True: 14, False: 45.7k]
  ------------------
 1785|  45.7k|        rankStats[huffWeight[n]]++;
 1786|  45.7k|        weightTotal += (1 << huffWeight[n]) >> 1;
 1787|  45.7k|    }
 1788|    679|    if (weightTotal == 0) return ERROR(corruption_detected);
  ------------------
  |  |   49|     49|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     49|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     49|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1788:9): [True: 49, False: 630]
  ------------------
 1789|       |
 1790|       |    /* get last non-null symbol weight (implied, total must be 2^n) */
 1791|    630|    tableLog = BITv05_highbit32(weightTotal) + 1;
 1792|    630|    if (tableLog > HUFv05_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected);
  ------------------
  |  | 1711|    630|#define HUFv05_ABSOLUTEMAX_TABLELOG  16   /* absolute limit of HUFv05_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
                  if (tableLog > HUFv05_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected);
  ------------------
  |  |   49|     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 (1792:9): [True: 27, False: 603]
  ------------------
 1793|    603|    {   /* determine last weight */
 1794|    603|        U32 total = 1 << tableLog;
 1795|    603|        U32 rest = total - weightTotal;
 1796|    603|        U32 verif = 1 << BITv05_highbit32(rest);
 1797|    603|        U32 lastWeight = BITv05_highbit32(rest) + 1;
 1798|    603|        if (verif != rest) return ERROR(corruption_detected);    /* last value must be a clean power of 2 */
  ------------------
  |  |   49|     35|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     35|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     35|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1798:13): [True: 35, False: 568]
  ------------------
 1799|    568|        huffWeight[oSize] = (BYTE)lastWeight;
 1800|    568|        rankStats[lastWeight]++;
 1801|    568|    }
 1802|       |
 1803|       |    /* check tree construction validity */
 1804|    568|    if ((rankStats[1] < 2) || (rankStats[1] & 1)) return ERROR(corruption_detected);   /* by construction : at least 2 elts of rank 1, must be even */
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1804:9): [True: 19, False: 549]
  |  Branch (1804:31): [True: 0, False: 549]
  ------------------
 1805|       |
 1806|       |    /* results */
 1807|    549|    *nbSymbolsPtr = (U32)(oSize+1);
 1808|    549|    *tableLogPtr = tableLog;
 1809|    549|    return iSize+1;
 1810|    568|}
zstd_v05.c:BITv05_initDStream:
  735|  1.77k|{
  736|  1.77k|    if (srcSize < 1) { memset(bitD, 0, sizeof(*bitD)); 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 (736:9): [True: 11, False: 1.76k]
  ------------------
  737|       |
  738|  1.76k|    if (srcSize >=  sizeof(size_t)) {  /* normal case */
  ------------------
  |  Branch (738:9): [True: 1.19k, False: 565]
  ------------------
  739|  1.19k|        U32 contain32;
  740|  1.19k|        bitD->start = (const char*)srcBuffer;
  741|  1.19k|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(size_t);
  742|  1.19k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  743|  1.19k|        contain32 = ((const BYTE*)srcBuffer)[srcSize-1];
  744|  1.19k|        if (contain32 == 0) return ERROR(GENERIC);   /* endMark not present */
  ------------------
  |  |   49|    116|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    116|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    116|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (744:13): [True: 116, False: 1.08k]
  ------------------
  745|  1.08k|        bitD->bitsConsumed = 8 - BITv05_highbit32(contain32);
  746|  1.08k|    } else {
  747|    565|        U32 contain32;
  748|    565|        bitD->start = (const char*)srcBuffer;
  749|    565|        bitD->ptr   = bitD->start;
  750|    565|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  751|    565|        switch(srcSize)
  752|    565|        {
  753|     51|            case 7: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[6]) << (sizeof(size_t)*8 - 16);/* fall-through */
  ------------------
  |  Branch (753:13): [True: 51, False: 514]
  ------------------
  754|    108|            case 6: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[5]) << (sizeof(size_t)*8 - 24);/* fall-through */
  ------------------
  |  Branch (754:13): [True: 57, False: 508]
  ------------------
  755|    305|            case 5: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[4]) << (sizeof(size_t)*8 - 32);/* fall-through */
  ------------------
  |  Branch (755:13): [True: 197, False: 368]
  ------------------
  756|    367|            case 4: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[3]) << 24; /* fall-through */
  ------------------
  |  Branch (756:13): [True: 62, False: 503]
  ------------------
  757|    435|            case 3: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[2]) << 16; /* fall-through */
  ------------------
  |  Branch (757:13): [True: 68, False: 497]
  ------------------
  758|    496|            case 2: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[1]) <<  8; /* fall-through */
  ------------------
  |  Branch (758:13): [True: 61, False: 504]
  ------------------
  759|    565|            default: break;
  ------------------
  |  Branch (759:13): [True: 69, False: 496]
  ------------------
  760|    565|        }
  761|    565|        contain32 = ((const BYTE*)srcBuffer)[srcSize-1];
  762|    565|        if (contain32 == 0) return ERROR(GENERIC);   /* endMark not present */
  ------------------
  |  |   49|     78|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     78|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     78|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (762:13): [True: 78, False: 487]
  ------------------
  763|    487|        bitD->bitsConsumed = 8 - BITv05_highbit32(contain32);
  764|    487|        bitD->bitsConsumed += (U32)(sizeof(size_t) - srcSize)*8;
  765|    487|    }
  766|       |
  767|  1.57k|    return srcSize;
  768|  1.76k|}
zstd_v05.c:HUFv05_decodeStreamX2:
 1882|    363|{
 1883|    363|    BYTE* const pStart = p;
 1884|       |
 1885|       |    /* up to 4 symbols at a time */
 1886|  4.99k|    while ((BITv05_reloadDStream(bitDPtr) == BITv05_DStream_unfinished) && (p <= pEnd-4)) {
  ------------------
  |  Branch (1886:12): [True: 4.68k, False: 310]
  |  Branch (1886:76): [True: 4.63k, False: 53]
  ------------------
 1887|  4.63k|        HUFv05_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 1878|  4.63k|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 4.63k, False: 0]
  |  |  ------------------
  |  | 1879|  4.63k|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|  4.63k|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1888|  4.63k|        HUFv05_DECODE_SYMBOLX2_1(p, bitDPtr);
  ------------------
  |  | 1874|  4.63k|    if (MEM_64bits() || (HUFv05_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1712|      0|#define HUFv05_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv05_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (1874:9): [True: 4.63k, False: 0]
  |  |  |  Branch (1874:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1875|  4.63k|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|  4.63k|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1889|  4.63k|        HUFv05_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 1878|  4.63k|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 4.63k, False: 0]
  |  |  ------------------
  |  | 1879|  4.63k|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|  4.63k|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1890|  4.63k|        HUFv05_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1871|  4.63k|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 1891|  4.63k|    }
 1892|       |
 1893|       |    /* closer to the end */
 1894|    462|    while ((BITv05_reloadDStream(bitDPtr) == BITv05_DStream_unfinished) && (p < pEnd))
  ------------------
  |  Branch (1894:12): [True: 147, False: 315]
  |  Branch (1894:76): [True: 99, False: 48]
  ------------------
 1895|     99|        HUFv05_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1871|     99|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 1896|       |
 1897|       |    /* no more data to retrieve from bitstream, hence no need to reload */
 1898|  4.41M|    while (p < pEnd)
  ------------------
  |  Branch (1898:12): [True: 4.41M, False: 363]
  ------------------
 1899|  4.41M|        HUFv05_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1871|  4.41M|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 1900|       |
 1901|    363|    return pEnd-pStart;
 1902|    363|}
zstd_v05.c:BITv05_endOfDStream:
  838|  21.6k|{
  839|  21.6k|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (839:13): [True: 21.2k, False: 364]
  |  Branch (839:49): [True: 1.27k, False: 20.0k]
  ------------------
  840|  21.6k|}
zstd_v05.c:BITv05_reloadDStream:
  806|   118k|{
  807|   118k|    if (bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))  /* should never happen */
  ------------------
  |  Branch (807:9): [True: 515, False: 118k]
  ------------------
  808|    515|        return BITv05_DStream_overflow;
  809|       |
  810|   118k|    if (bitD->ptr >= bitD->start + sizeof(bitD->bitContainer)) {
  ------------------
  |  Branch (810:9): [True: 86.8k, False: 31.1k]
  ------------------
  811|  86.8k|        bitD->ptr -= bitD->bitsConsumed >> 3;
  812|  86.8k|        bitD->bitsConsumed &= 7;
  813|  86.8k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  814|  86.8k|        return BITv05_DStream_unfinished;
  815|  86.8k|    }
  816|  31.1k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (816:9): [True: 23.1k, False: 8.05k]
  ------------------
  817|  23.1k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BITv05_DStream_endOfBuffer;
  ------------------
  |  Branch (817:13): [True: 22.1k, False: 959]
  ------------------
  818|    959|        return BITv05_DStream_completed;
  819|  23.1k|    }
  820|  8.05k|    {
  821|  8.05k|        U32 nbBytes = bitD->bitsConsumed >> 3;
  822|  8.05k|        BITv05_DStream_status result = BITv05_DStream_unfinished;
  823|  8.05k|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (823:13): [True: 265, False: 7.78k]
  ------------------
  824|    265|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  825|    265|            result = BITv05_DStream_endOfBuffer;
  826|    265|        }
  827|  8.05k|        bitD->ptr -= nbBytes;
  828|  8.05k|        bitD->bitsConsumed -= nbBytes*8;
  829|  8.05k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD) */
  830|  8.05k|        return result;
  831|  31.1k|    }
  832|  31.1k|}
zstd_v05.c:HUFv05_decodeSymbolX2:
 1863|  4.44M|{
 1864|  4.44M|        const size_t val = BITv05_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */
 1865|  4.44M|        const BYTE c = dt[val].byte;
 1866|  4.44M|        BITv05_skipBits(Dstream, dt[val].nbBits);
 1867|  4.44M|        return c;
 1868|  4.44M|}
zstd_v05.c:HUFv05_fillDTableX4:
 2105|    314|{
 2106|    314|    U32 rankVal[HUFv05_ABSOLUTEMAX_TABLELOG + 1];
 2107|    314|    const int scaleLog = nbBitsBaseline - targetLog;   /* note : targetLog >= srcLog, hence scaleLog <= 1 */
 2108|    314|    const U32 minBits  = nbBitsBaseline - maxWeight;
 2109|    314|    U32 s;
 2110|       |
 2111|    314|    memcpy(rankVal, rankValOrigin, sizeof(rankVal));
 2112|       |
 2113|       |    /* fill DTable */
 2114|  32.3k|    for (s=0; s<sortedListSize; s++) {
  ------------------
  |  Branch (2114:15): [True: 32.0k, False: 314]
  ------------------
 2115|  32.0k|        const U16 symbol = sortedList[s].symbol;
 2116|  32.0k|        const U32 weight = sortedList[s].weight;
 2117|  32.0k|        const U32 nbBits = nbBitsBaseline - weight;
 2118|  32.0k|        const U32 start = rankVal[weight];
 2119|  32.0k|        const U32 length = 1 << (targetLog-nbBits);
 2120|       |
 2121|  32.0k|        if (targetLog-nbBits >= minBits) {   /* enough room for a second symbol */
  ------------------
  |  Branch (2121:13): [True: 17.4k, False: 14.6k]
  ------------------
 2122|  17.4k|            U32 sortedRank;
 2123|  17.4k|            int minWeight = nbBits + scaleLog;
 2124|  17.4k|            if (minWeight < 1) minWeight = 1;
  ------------------
  |  Branch (2124:17): [True: 1.07k, False: 16.3k]
  ------------------
 2125|  17.4k|            sortedRank = rankStart[minWeight];
 2126|  17.4k|            HUFv05_fillDTableX4Level2(DTable+start, targetLog-nbBits, nbBits,
 2127|  17.4k|                           rankValOrigin[nbBits], minWeight,
 2128|  17.4k|                           sortedList+sortedRank, sortedListSize-sortedRank,
 2129|  17.4k|                           nbBitsBaseline, symbol);
 2130|  17.4k|        } else {
 2131|  14.6k|            U32 i;
 2132|  14.6k|            const U32 end = start + length;
 2133|  14.6k|            HUFv05_DEltX4 DElt;
 2134|       |
 2135|  14.6k|            MEM_writeLE16(&(DElt.sequence), symbol);
 2136|  14.6k|            DElt.nbBits   = (BYTE)(nbBits);
 2137|  14.6k|            DElt.length   = 1;
 2138|   462k|            for (i = start; i < end; i++)
  ------------------
  |  Branch (2138:29): [True: 447k, False: 14.6k]
  ------------------
 2139|   447k|                DTable[i] = DElt;
 2140|  14.6k|        }
 2141|  32.0k|        rankVal[weight] += length;
 2142|  32.0k|    }
 2143|    314|}
zstd_v05.c:HUFv05_fillDTableX4Level2:
 2062|  17.4k|{
 2063|  17.4k|    HUFv05_DEltX4 DElt;
 2064|  17.4k|    U32 rankVal[HUFv05_ABSOLUTEMAX_TABLELOG + 1];
 2065|  17.4k|    U32 s;
 2066|       |
 2067|       |    /* get pre-calculated rankVal */
 2068|  17.4k|    memcpy(rankVal, rankValOrigin, sizeof(rankVal));
 2069|       |
 2070|       |    /* fill skipped values */
 2071|  17.4k|    if (minWeight>1) {
  ------------------
  |  Branch (2071:9): [True: 15.8k, False: 1.58k]
  ------------------
 2072|  15.8k|        U32 i, skipSize = rankVal[minWeight];
 2073|  15.8k|        MEM_writeLE16(&(DElt.sequence), baseSeq);
 2074|  15.8k|        DElt.nbBits   = (BYTE)(consumed);
 2075|  15.8k|        DElt.length   = 1;
 2076|   121k|        for (i = 0; i < skipSize; i++)
  ------------------
  |  Branch (2076:21): [True: 106k, False: 15.8k]
  ------------------
 2077|   106k|            DTable[i] = DElt;
 2078|  15.8k|    }
 2079|       |
 2080|       |    /* fill DTable */
 2081|   112k|    for (s=0; s<sortedListSize; s++) {   /* note : sortedSymbols already skipped */
  ------------------
  |  Branch (2081:15): [True: 94.7k, False: 17.4k]
  ------------------
 2082|  94.7k|        const U32 symbol = sortedSymbols[s].symbol;
 2083|  94.7k|        const U32 weight = sortedSymbols[s].weight;
 2084|  94.7k|        const U32 nbBits = nbBitsBaseline - weight;
 2085|  94.7k|        const U32 length = 1 << (sizeLog-nbBits);
 2086|  94.7k|        const U32 start = rankVal[weight];
 2087|  94.7k|        U32 i = start;
 2088|  94.7k|        const U32 end = start + length;
 2089|       |
 2090|  94.7k|        MEM_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8)));
 2091|  94.7k|        DElt.nbBits = (BYTE)(nbBits + consumed);
 2092|  94.7k|        DElt.length = 2;
 2093|   732k|        do { DTable[i++] = DElt; } while (i<end);   /* since length >= 1 */
  ------------------
  |  Branch (2093:43): [True: 637k, False: 94.7k]
  ------------------
 2094|       |
 2095|  94.7k|        rankVal[weight] += length;
 2096|  94.7k|    }
 2097|  17.4k|}
zstd_v05.c:HUFv05_decodeStreamX4:
 2258|     45|{
 2259|     45|    BYTE* const pStart = p;
 2260|       |
 2261|       |    /* up to 8 symbols at a time */
 2262|    193|    while ((BITv05_reloadDStream(bitDPtr) == BITv05_DStream_unfinished) && (p < pEnd-7)) {
  ------------------
  |  Branch (2262:12): [True: 170, False: 23]
  |  Branch (2262:76): [True: 148, False: 22]
  ------------------
 2263|    148|        HUFv05_DECODE_SYMBOLX4_2(p, bitDPtr);
  ------------------
  |  | 2254|    148|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2254:9): [True: 148, False: 0]
  |  |  ------------------
  |  | 2255|    148|        ptr += HUFv05_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2264|    148|        HUFv05_DECODE_SYMBOLX4_1(p, bitDPtr);
  ------------------
  |  | 2250|    148|    if (MEM_64bits() || (HUFv05_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1712|      0|#define HUFv05_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv05_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (2250:9): [True: 148, False: 0]
  |  |  |  Branch (2250:25): [True: 0, Folded]
  |  |  ------------------
  |  | 2251|    148|        ptr += HUFv05_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2265|    148|        HUFv05_DECODE_SYMBOLX4_2(p, bitDPtr);
  ------------------
  |  | 2254|    148|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2254:9): [True: 148, False: 0]
  |  |  ------------------
  |  | 2255|    148|        ptr += HUFv05_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2266|    148|        HUFv05_DECODE_SYMBOLX4_0(p, bitDPtr);
  ------------------
  |  | 2247|    148|    ptr += HUFv05_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2267|    148|    }
 2268|       |
 2269|       |    /* closer to the end */
 2270|     62|    while ((BITv05_reloadDStream(bitDPtr) == BITv05_DStream_unfinished) && (p <= pEnd-2))
  ------------------
  |  Branch (2270:12): [True: 37, False: 25]
  |  Branch (2270:76): [True: 17, False: 20]
  ------------------
 2271|     17|        HUFv05_DECODE_SYMBOLX4_0(p, bitDPtr);
  ------------------
  |  | 2247|     17|    ptr += HUFv05_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2272|       |
 2273|  1.63k|    while (p <= pEnd-2)
  ------------------
  |  Branch (2273:12): [True: 1.58k, False: 45]
  ------------------
 2274|  1.58k|        HUFv05_DECODE_SYMBOLX4_0(p, bitDPtr);   /* no need to reload : reached the end of DStream */
  ------------------
  |  | 2247|  1.58k|    ptr += HUFv05_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2275|       |
 2276|     45|    if (p < pEnd)
  ------------------
  |  Branch (2276:9): [True: 23, False: 22]
  ------------------
 2277|     23|        p += HUFv05_decodeLastSymbolX4(p, bitDPtr, dt, dtLog);
 2278|       |
 2279|     45|    return p-pStart;
 2280|     45|}
zstd_v05.c:HUFv05_decodeLastSymbolX4:
 2232|     23|{
 2233|     23|    const size_t val = BITv05_lookBitsFast(DStream, dtLog);   /* note : dtLog >= 1 */
 2234|     23|    memcpy(op, dt+val, 1);
 2235|     23|    if (dt[val].length==1) BITv05_skipBits(DStream, dt[val].nbBits);
  ------------------
  |  Branch (2235:9): [True: 9, False: 14]
  ------------------
 2236|     14|    else {
 2237|     14|        if (DStream->bitsConsumed < (sizeof(DStream->bitContainer)*8)) {
  ------------------
  |  Branch (2237:13): [True: 12, False: 2]
  ------------------
 2238|     12|            BITv05_skipBits(DStream, dt[val].nbBits);
 2239|     12|            if (DStream->bitsConsumed > (sizeof(DStream->bitContainer)*8))
  ------------------
  |  Branch (2239:17): [True: 1, False: 11]
  ------------------
 2240|      1|                DStream->bitsConsumed = (sizeof(DStream->bitContainer)*8);   /* ugly hack; works only because it's the last symbol. Note : can't easily extract nbBits from just this symbol */
 2241|     12|    }   }
 2242|     23|    return 1;
 2243|     23|}
zstd_v05.c:HUFv05_decodeSymbolX4:
 2224|  2.19k|{
 2225|  2.19k|    const size_t val = BITv05_lookBitsFast(DStream, dtLog);   /* note : dtLog >= 1 */
 2226|  2.19k|    memcpy(op, dt+val, 2);
 2227|  2.19k|    BITv05_skipBits(DStream, dt[val].nbBits);
 2228|  2.19k|    return dt[val].length;
 2229|  2.19k|}
zstd_v05.c:ZSTDv05_checkContinuity:
 3330|  1.97k|{
 3331|  1.97k|    if (dst != dctx->previousDstEnd) {   /* not contiguous */
  ------------------
  |  Branch (3331:9): [True: 1.97k, False: 0]
  ------------------
 3332|  1.97k|        dctx->dictEnd = dctx->previousDstEnd;
 3333|  1.97k|        dctx->vBase = (const char*)dst - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->base));
 3334|  1.97k|        dctx->base = dst;
 3335|  1.97k|        dctx->previousDstEnd = dst;
 3336|  1.97k|    }
 3337|  1.97k|}
zstd_v05.c:ZSTDv05_decompressBlock_internal:
 3343|    910|{   /* blockType == blockCompressed */
 3344|    910|    const BYTE* ip = (const BYTE*)src;
 3345|    910|    size_t litCSize;
 3346|       |
 3347|    910|    if (srcSize >= BLOCKSIZE) return ERROR(srcSize_wrong);
  ------------------
  |  |  396|    910|#define BLOCKSIZE (128 KB)                 /* define, for static allocation */
  |  |  ------------------
  |  |  |  |  392|    910|#define KB *(1 <<10)
  |  |  ------------------
  ------------------
                  if (srcSize >= BLOCKSIZE) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3347:9): [True: 0, False: 910]
  ------------------
 3348|       |
 3349|       |    /* Decode literals sub-block */
 3350|    910|    litCSize = ZSTDv05_decodeLiteralsBlock(dctx, src, srcSize);
 3351|    910|    if (ZSTDv05_isError(litCSize)) return litCSize;
  ------------------
  |  Branch (3351:9): [True: 554, False: 356]
  ------------------
 3352|    356|    ip += litCSize;
 3353|    356|    srcSize -= litCSize;
 3354|       |
 3355|    356|    return ZSTDv05_decompressSequences(dctx, dst, dstCapacity, ip, srcSize);
 3356|    910|}
zstd_v05.c:ZSTDv05_decodeLiteralsBlock:
 2812|    910|{
 2813|    910|    const BYTE* const istart = (const BYTE*) src;
 2814|       |
 2815|       |    /* any compressed block with literals segment must be at least this size */
 2816|    910|    if (srcSize < MIN_CBLOCK_SIZE) return ERROR(corruption_detected);
  ------------------
  |  |  439|    910|#define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */ + MIN_SEQUENCES_SIZE /* nbSeq==0 */)   /* for a non-null block */
  |  |  ------------------
  |  |  |  |  438|    910|#define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */
  |  |  ------------------
  ------------------
                  if (srcSize < MIN_CBLOCK_SIZE) return ERROR(corruption_detected);
  ------------------
  |  |   49|     86|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     86|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     86|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2816:9): [True: 86, False: 824]
  ------------------
 2817|       |
 2818|    824|    switch(istart[0]>> 6)
 2819|    824|    {
 2820|    400|    case IS_HUFv05:
  ------------------
  |  |  409|    400|#define IS_HUFv05 0
  ------------------
  |  Branch (2820:5): [True: 400, False: 424]
  ------------------
 2821|    400|        {
 2822|    400|            size_t litSize, litCSize, singleStream=0;
 2823|    400|            U32 lhSize = ((istart[0]) >> 4) & 3;
 2824|    400|            if (srcSize < 5) return ERROR(corruption_detected);   /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3 */
  ------------------
  |  |   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 (2824:17): [True: 2, False: 398]
  ------------------
 2825|    398|            switch(lhSize)
 2826|    398|            {
 2827|    222|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (2827:13): [True: 129, False: 269]
  |  Branch (2827:21): [True: 93, False: 305]
  |  Branch (2827:29): [True: 0, False: 398]
  ------------------
 2828|       |                /* 2 - 2 - 10 - 10 */
 2829|    222|                lhSize=3;
 2830|    222|                singleStream = istart[0] & 16;
 2831|    222|                litSize  = ((istart[0] & 15) << 6) + (istart[1] >> 2);
 2832|    222|                litCSize = ((istart[1] &  3) << 8) + istart[2];
 2833|    222|                break;
 2834|      7|            case 2:
  ------------------
  |  Branch (2834:13): [True: 7, False: 391]
  ------------------
 2835|       |                /* 2 - 2 - 14 - 14 */
 2836|      7|                lhSize=4;
 2837|      7|                litSize  = ((istart[0] & 15) << 10) + (istart[1] << 2) + (istart[2] >> 6);
 2838|      7|                litCSize = ((istart[2] & 63) <<  8) + istart[3];
 2839|      7|                break;
 2840|    169|            case 3:
  ------------------
  |  Branch (2840:13): [True: 169, False: 229]
  ------------------
 2841|       |                /* 2 - 2 - 18 - 18 */
 2842|    169|                lhSize=5;
 2843|    169|                litSize  = ((istart[0] & 15) << 14) + (istart[1] << 6) + (istart[2] >> 2);
 2844|    169|                litCSize = ((istart[2] &  3) << 16) + (istart[3] << 8) + istart[4];
 2845|    169|                break;
 2846|    398|            }
 2847|    398|            if (litSize > BLOCKSIZE) return ERROR(corruption_detected);
  ------------------
  |  |  396|    398|#define BLOCKSIZE (128 KB)                 /* define, for static allocation */
  |  |  ------------------
  |  |  |  |  392|    398|#define KB *(1 <<10)
  |  |  ------------------
  ------------------
                          if (litSize > BLOCKSIZE) 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 (2847:17): [True: 1, False: 397]
  ------------------
 2848|    397|            if (litCSize + lhSize > srcSize) return ERROR(corruption_detected);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2848:17): [True: 20, False: 377]
  ------------------
 2849|       |
 2850|    377|            if (HUFv05_isError(singleStream ?
  ------------------
  |  Branch (2850:17): [True: 363, False: 14]
  |  Branch (2850:32): [True: 91, False: 286]
  ------------------
 2851|     91|                            HUFv05_decompress1X2(dctx->litBuffer, litSize, istart+lhSize, litCSize) :
 2852|    377|                            HUFv05_decompress   (dctx->litBuffer, litSize, istart+lhSize, litCSize) ))
 2853|    363|                return ERROR(corruption_detected);
  ------------------
  |  |   49|    363|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    363|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    363|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2854|       |
 2855|     14|            dctx->litPtr = dctx->litBuffer;
 2856|     14|            dctx->litSize = litSize;
 2857|     14|            memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |  441|     14|#define WILDCOPY_OVERLENGTH 8
  ------------------
 2858|     14|            return litCSize + lhSize;
 2859|    377|        }
 2860|     64|    case IS_PCH:
  ------------------
  |  |  410|     64|#define IS_PCH 1
  ------------------
  |  Branch (2860:5): [True: 64, False: 760]
  ------------------
 2861|     64|        {
 2862|     64|            size_t errorCode;
 2863|     64|            size_t litSize, litCSize;
 2864|     64|            U32 lhSize = ((istart[0]) >> 4) & 3;
 2865|     64|            if (lhSize != 1)  /* only case supported for now : small litSize, single stream */
  ------------------
  |  Branch (2865:17): [True: 1, False: 63]
  ------------------
 2866|      1|                return ERROR(corruption_detected);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2867|     63|            if (!dctx->flagStaticTables)
  ------------------
  |  Branch (2867:17): [True: 1, False: 62]
  ------------------
 2868|      1|                return ERROR(dictionary_corrupted);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2869|       |
 2870|       |            /* 2 - 2 - 10 - 10 */
 2871|     62|            lhSize=3;
 2872|     62|            litSize  = ((istart[0] & 15) << 6) + (istart[1] >> 2);
 2873|     62|            litCSize = ((istart[1] &  3) << 8) + istart[2];
 2874|     62|            if (litCSize + lhSize > srcSize) 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 (2874:17): [True: 2, False: 60]
  ------------------
 2875|       |
 2876|     60|            errorCode = HUFv05_decompress1X4_usingDTable(dctx->litBuffer, litSize, istart+lhSize, litCSize, dctx->hufTableX4);
 2877|     60|            if (HUFv05_isError(errorCode)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     59|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     59|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     59|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2877:17): [True: 59, False: 1]
  ------------------
 2878|       |
 2879|      1|            dctx->litPtr = dctx->litBuffer;
 2880|      1|            dctx->litSize = litSize;
 2881|      1|            memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |  441|      1|#define WILDCOPY_OVERLENGTH 8
  ------------------
 2882|      1|            return litCSize + lhSize;
 2883|     60|        }
 2884|     28|    case IS_RAW:
  ------------------
  |  |  411|     28|#define IS_RAW 2
  ------------------
  |  Branch (2884:5): [True: 28, False: 796]
  ------------------
 2885|     28|        {
 2886|     28|            size_t litSize;
 2887|     28|            U32 lhSize = ((istart[0]) >> 4) & 3;
 2888|     28|            switch(lhSize)
 2889|     28|            {
 2890|     11|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (2890:13): [True: 4, False: 24]
  |  Branch (2890:21): [True: 7, False: 21]
  |  Branch (2890:29): [True: 0, False: 28]
  ------------------
 2891|     11|                lhSize=1;
 2892|     11|                litSize = istart[0] & 31;
 2893|     11|                break;
 2894|      7|            case 2:
  ------------------
  |  Branch (2894:13): [True: 7, False: 21]
  ------------------
 2895|      7|                litSize = ((istart[0] & 15) << 8) + istart[1];
 2896|      7|                break;
 2897|     10|            case 3:
  ------------------
  |  Branch (2897:13): [True: 10, False: 18]
  ------------------
 2898|     10|                litSize = ((istart[0] & 15) << 16) + (istart[1] << 8) + istart[2];
 2899|     10|                break;
 2900|     28|            }
 2901|       |
 2902|     28|            if (lhSize+litSize+WILDCOPY_OVERLENGTH > srcSize) {  /* risk reading beyond src buffer with wildcopy */
  ------------------
  |  |  441|     28|#define WILDCOPY_OVERLENGTH 8
  ------------------
  |  Branch (2902:17): [True: 18, False: 10]
  ------------------
 2903|     18|                if (litSize+lhSize > srcSize) return ERROR(corruption_detected);
  ------------------
  |  |   49|     17|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     17|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     17|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2903:21): [True: 17, False: 1]
  ------------------
 2904|      1|                memcpy(dctx->litBuffer, istart+lhSize, litSize);
 2905|      1|                dctx->litPtr = dctx->litBuffer;
 2906|      1|                dctx->litSize = litSize;
 2907|      1|                memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |  441|      1|#define WILDCOPY_OVERLENGTH 8
  ------------------
 2908|      1|                return lhSize+litSize;
 2909|     18|            }
 2910|       |            /* direct reference into compressed stream */
 2911|     10|            dctx->litPtr = istart+lhSize;
 2912|     10|            dctx->litSize = litSize;
 2913|     10|            return lhSize+litSize;
 2914|     28|        }
 2915|    332|    case IS_RLE:
  ------------------
  |  |  412|    332|#define IS_RLE 3
  ------------------
  |  Branch (2915:5): [True: 332, False: 492]
  ------------------
 2916|    332|        {
 2917|    332|            size_t litSize;
 2918|    332|            U32 lhSize = ((istart[0]) >> 4) & 3;
 2919|    332|            switch(lhSize)
 2920|    332|            {
 2921|     42|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (2921:13): [True: 1, False: 331]
  |  Branch (2921:21): [True: 41, False: 291]
  |  Branch (2921:29): [True: 0, False: 332]
  ------------------
 2922|     42|                lhSize = 1;
 2923|     42|                litSize = istart[0] & 31;
 2924|     42|                break;
 2925|    242|            case 2:
  ------------------
  |  Branch (2925:13): [True: 242, False: 90]
  ------------------
 2926|    242|                litSize = ((istart[0] & 15) << 8) + istart[1];
 2927|    242|                break;
 2928|     48|            case 3:
  ------------------
  |  Branch (2928:13): [True: 48, False: 284]
  ------------------
 2929|     48|                litSize = ((istart[0] & 15) << 16) + (istart[1] << 8) + istart[2];
 2930|     48|                if (srcSize<4) return ERROR(corruption_detected);   /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need lhSize+1 = 4 */
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2930:21): [True: 1, False: 47]
  ------------------
 2931|     47|                break;
 2932|    332|            }
 2933|    331|            if (litSize > BLOCKSIZE) return ERROR(corruption_detected);
  ------------------
  |  |  396|    331|#define BLOCKSIZE (128 KB)                 /* define, for static allocation */
  |  |  ------------------
  |  |  |  |  392|    331|#define KB *(1 <<10)
  |  |  ------------------
  ------------------
                          if (litSize > BLOCKSIZE) 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 (2933:17): [True: 1, False: 330]
  ------------------
 2934|    330|            memset(dctx->litBuffer, istart[lhSize], litSize + WILDCOPY_OVERLENGTH);
  ------------------
  |  |  441|    330|#define WILDCOPY_OVERLENGTH 8
  ------------------
 2935|    330|            dctx->litPtr = dctx->litBuffer;
 2936|    330|            dctx->litSize = litSize;
 2937|    330|            return lhSize+1;
 2938|    331|        }
 2939|      0|    default:
  ------------------
  |  Branch (2939:5): [True: 0, False: 824]
  ------------------
 2940|      0|        return ERROR(corruption_detected);   /* impossible */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2941|    824|    }
 2942|    824|}
zstd_v05.c:ZSTDv05_decompressSequences:
 3260|    356|{
 3261|    356|    const BYTE* ip = (const BYTE*)seqStart;
 3262|    356|    const BYTE* const iend = ip + seqSize;
 3263|    356|    BYTE* const ostart = (BYTE*)dst;
 3264|    356|    BYTE* op = ostart;
 3265|    356|    BYTE* const oend = ostart + maxDstSize;
 3266|    356|    size_t errorCode, dumpsLength=0;
 3267|    356|    const BYTE* litPtr = dctx->litPtr;
 3268|    356|    const BYTE* const litEnd = litPtr + dctx->litSize;
 3269|    356|    int nbSeq=0;
 3270|    356|    const BYTE* dumps = NULL;
 3271|    356|    unsigned* DTableLL = dctx->LLTable;
 3272|    356|    unsigned* DTableML = dctx->MLTable;
 3273|    356|    unsigned* DTableOffb = dctx->OffTable;
 3274|    356|    const BYTE* const base = (const BYTE*) (dctx->base);
 3275|    356|    const BYTE* const vBase = (const BYTE*) (dctx->vBase);
 3276|    356|    const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd);
 3277|       |
 3278|       |    /* Build Decoding Tables */
 3279|    356|    errorCode = ZSTDv05_decodeSeqHeaders(&nbSeq, &dumps, &dumpsLength,
 3280|    356|                                      DTableLL, DTableML, DTableOffb,
 3281|    356|                                      ip, seqSize, dctx->flagStaticTables);
 3282|    356|    if (ZSTDv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (3282:9): [True: 57, False: 299]
  ------------------
 3283|    299|    ip += errorCode;
 3284|       |
 3285|       |    /* Regen sequences */
 3286|    299|    if (nbSeq) {
  ------------------
  |  Branch (3286:9): [True: 274, False: 25]
  ------------------
 3287|    274|        seq_t sequence;
 3288|    274|        seqState_t seqState;
 3289|       |
 3290|    274|        memset(&sequence, 0, sizeof(sequence));
 3291|    274|        sequence.offset = REPCODE_STARTVALUE;
  ------------------
  |  |  415|    274|#define REPCODE_STARTVALUE 1
  ------------------
 3292|    274|        seqState.dumps = dumps;
 3293|    274|        seqState.dumpsEnd = dumps + dumpsLength;
 3294|    274|        seqState.prevOffset = REPCODE_STARTVALUE;
  ------------------
  |  |  415|    274|#define REPCODE_STARTVALUE 1
  ------------------
 3295|    274|        errorCode = BITv05_initDStream(&(seqState.DStream), ip, iend-ip);
 3296|    274|        if (ERR_isError(errorCode)) 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 (3296:13): [True: 6, False: 268]
  ------------------
 3297|    268|        FSEv05_initDState(&(seqState.stateLL), &(seqState.DStream), DTableLL);
 3298|    268|        FSEv05_initDState(&(seqState.stateOffb), &(seqState.DStream), DTableOffb);
 3299|    268|        FSEv05_initDState(&(seqState.stateML), &(seqState.DStream), DTableML);
 3300|       |
 3301|  75.6k|        for ( ; (BITv05_reloadDStream(&(seqState.DStream)) <= BITv05_DStream_completed) && nbSeq ; ) {
  ------------------
  |  Branch (3301:17): [True: 75.5k, False: 65]
  |  Branch (3301:92): [True: 75.5k, False: 25]
  ------------------
 3302|  75.5k|            size_t oneSeqSize;
 3303|  75.5k|            nbSeq--;
 3304|  75.5k|            ZSTDv05_decodeSequence(&sequence, &seqState);
 3305|  75.5k|            oneSeqSize = ZSTDv05_execSequence(op, oend, sequence, &litPtr, litEnd, base, vBase, dictEnd);
 3306|  75.5k|            if (ZSTDv05_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  Branch (3306:17): [True: 178, False: 75.3k]
  ------------------
 3307|  75.3k|            op += oneSeqSize;
 3308|  75.3k|        }
 3309|       |
 3310|       |        /* check if reached exact end */
 3311|     90|        if (nbSeq) return ERROR(corruption_detected);
  ------------------
  |  |   49|     64|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     64|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     64|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3311:13): [True: 64, False: 26]
  ------------------
 3312|     90|    }
 3313|       |
 3314|       |    /* last literal segment */
 3315|     51|    {
 3316|     51|        size_t lastLLSize = litEnd - litPtr;
 3317|     51|        if (litPtr > litEnd) return ERROR(corruption_detected);   /* too many literals already used */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3317:13): [True: 0, False: 51]
  ------------------
 3318|     51|        if (op+lastLLSize > oend) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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 (3318:13): [True: 1, False: 50]
  ------------------
 3319|     50|        if (lastLLSize > 0) {
  ------------------
  |  Branch (3319:13): [True: 47, False: 3]
  ------------------
 3320|     47|            memcpy(op, litPtr, lastLLSize);
 3321|     47|            op += lastLLSize;
 3322|     47|        }
 3323|     50|    }
 3324|       |
 3325|      0|    return op-ostart;
 3326|     51|}
zstd_v05.c:ZSTDv05_decodeSeqHeaders:
 2948|    356|{
 2949|    356|    const BYTE* const istart = (const BYTE*)src;
 2950|    356|    const BYTE* ip = istart;
 2951|    356|    const BYTE* const iend = istart + srcSize;
 2952|    356|    U32 LLtype, Offtype, MLtype;
 2953|    356|    unsigned LLlog, Offlog, MLlog;
 2954|    356|    size_t dumpsLength;
 2955|       |
 2956|       |    /* check */
 2957|    356|    if (srcSize < MIN_SEQUENCES_SIZE)
  ------------------
  |  |  438|    356|#define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */
  ------------------
  |  Branch (2957:9): [True: 1, False: 355]
  ------------------
 2958|      1|        return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2959|       |
 2960|       |    /* SeqHead */
 2961|    355|    *nbSeq = *ip++;
 2962|    355|    if (*nbSeq==0) return 1;
  ------------------
  |  Branch (2962:9): [True: 21, False: 334]
  ------------------
 2963|    334|    if (*nbSeq >= 128) {
  ------------------
  |  Branch (2963:9): [True: 212, False: 122]
  ------------------
 2964|    212|        if (ip >= iend) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2964:13): [True: 1, False: 211]
  ------------------
 2965|    211|        *nbSeq = ((nbSeq[0]-128)<<8) + *ip++;
 2966|    211|    }
 2967|       |
 2968|    333|    if (ip >= iend) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2968:9): [True: 1, False: 332]
  ------------------
 2969|    332|    LLtype  = *ip >> 6;
 2970|    332|    Offtype = (*ip >> 4) & 3;
 2971|    332|    MLtype  = (*ip >> 2) & 3;
 2972|    332|    if (*ip & 2) {
  ------------------
  |  Branch (2972:9): [True: 138, False: 194]
  ------------------
 2973|    138|        if (ip+3 > iend) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2973:13): [True: 1, False: 137]
  ------------------
 2974|    137|        dumpsLength  = ip[2];
 2975|    137|        dumpsLength += ip[1] << 8;
 2976|    137|        ip += 3;
 2977|    194|    } else {
 2978|    194|        if (ip+2 > iend) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2978:13): [True: 0, False: 194]
  ------------------
 2979|    194|        dumpsLength  = ip[1];
 2980|    194|        dumpsLength += (ip[0] & 1) << 8;
 2981|    194|        ip += 2;
 2982|    194|    }
 2983|    331|    *dumpsPtr = ip;
 2984|    331|    ip += dumpsLength;
 2985|    331|    *dumpsLengthPtr = dumpsLength;
 2986|       |
 2987|       |    /* check */
 2988|    331|    if (ip > iend-3) return ERROR(srcSize_wrong); /* min : all 3 are "raw", hence no header, but at least xxLog bits per type */
  ------------------
  |  |   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 (2988:9): [True: 7, False: 324]
  ------------------
 2989|       |
 2990|       |    /* sequences */
 2991|    324|    {
 2992|    324|        S16 norm[MaxML+1];    /* assumption : MaxML >= MaxLL >= MaxOff */
 2993|    324|        size_t headerSize;
 2994|       |
 2995|       |        /* Build DTables */
 2996|    324|        switch(LLtype)
 2997|    324|        {
 2998|     26|        case FSEv05_ENCODING_RLE :
  ------------------
  |  |  431|     26|#define FSEv05_ENCODING_RLE     1
  ------------------
  |  Branch (2998:9): [True: 26, False: 298]
  ------------------
 2999|     26|            LLlog = 0;
 3000|     26|            FSEv05_buildDTable_rle(DTableLL, *ip++);
 3001|     26|            break;
 3002|    194|        case FSEv05_ENCODING_RAW :
  ------------------
  |  |  430|    194|#define FSEv05_ENCODING_RAW     0
  ------------------
  |  Branch (3002:9): [True: 194, False: 130]
  ------------------
 3003|    194|            LLlog = LLbits;
  ------------------
  |  |  419|    194|#define LLbits   6
  ------------------
 3004|    194|            FSEv05_buildDTable_raw(DTableLL, LLbits);
  ------------------
  |  |  419|    194|#define LLbits   6
  ------------------
 3005|    194|            break;
 3006|      3|        case FSEv05_ENCODING_STATIC:
  ------------------
  |  |  432|      3|#define FSEv05_ENCODING_STATIC  2
  ------------------
  |  Branch (3006:9): [True: 3, False: 321]
  ------------------
 3007|      3|            if (!flagStaticTable) 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 (3007:17): [True: 1, False: 2]
  ------------------
 3008|      2|            break;
 3009|    101|        case FSEv05_ENCODING_DYNAMIC :
  ------------------
  |  |  433|    101|#define FSEv05_ENCODING_DYNAMIC 3
  ------------------
  |  Branch (3009:9): [True: 101, False: 223]
  ------------------
 3010|    101|        default :   /* impossible */
  ------------------
  |  Branch (3010:9): [True: 0, False: 324]
  ------------------
 3011|    101|            {   unsigned max = MaxLL;
  ------------------
  |  |  423|    101|#define MaxLL  ((1<<LLbits) - 1)
  |  |  ------------------
  |  |  |  |  419|    101|#define LLbits   6
  |  |  ------------------
  ------------------
 3012|    101|                headerSize = FSEv05_readNCount(norm, &max, &LLlog, ip, iend-ip);
 3013|    101|                if (FSEv05_isError(headerSize)) return ERROR(GENERIC);
  ------------------
  |  |   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 (3013:21): [True: 3, False: 98]
  ------------------
 3014|     98|                if (LLlog > LLFSEv05Log) return ERROR(corruption_detected);
  ------------------
  |  |  426|     98|#define LLFSEv05Log   10
  ------------------
                              if (LLlog > LLFSEv05Log) 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 (3014:21): [True: 1, False: 97]
  ------------------
 3015|     97|                ip += headerSize;
 3016|     97|                FSEv05_buildDTable(DTableLL, norm, max, LLlog);
 3017|     97|        }   }
 3018|       |
 3019|    319|        switch(Offtype)
 3020|    319|        {
 3021|     26|        case FSEv05_ENCODING_RLE :
  ------------------
  |  |  431|     26|#define FSEv05_ENCODING_RLE     1
  ------------------
  |  Branch (3021:9): [True: 26, False: 293]
  ------------------
 3022|     26|            Offlog = 0;
 3023|     26|            if (ip > iend-2) return ERROR(srcSize_wrong);   /* min : "raw", hence no header, but at least xxLog bits */
  ------------------
  |  |   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 (3023:17): [True: 1, False: 25]
  ------------------
 3024|     25|            FSEv05_buildDTable_rle(DTableOffb, *ip++ & MaxOff); /* if *ip > MaxOff, data is corrupted */
  ------------------
  |  |  424|     25|#define MaxOff ((1<<Offbits)- 1)
  |  |  ------------------
  |  |  |  |  420|     25|#define Offbits  5
  |  |  ------------------
  ------------------
 3025|     25|            break;
 3026|     36|        case FSEv05_ENCODING_RAW :
  ------------------
  |  |  430|     36|#define FSEv05_ENCODING_RAW     0
  ------------------
  |  Branch (3026:9): [True: 36, False: 283]
  ------------------
 3027|     36|            Offlog = Offbits;
  ------------------
  |  |  420|     36|#define Offbits  5
  ------------------
 3028|     36|            FSEv05_buildDTable_raw(DTableOffb, Offbits);
  ------------------
  |  |  420|     36|#define Offbits  5
  ------------------
 3029|     36|            break;
 3030|      2|        case FSEv05_ENCODING_STATIC:
  ------------------
  |  |  432|      2|#define FSEv05_ENCODING_STATIC  2
  ------------------
  |  Branch (3030:9): [True: 2, False: 317]
  ------------------
 3031|      2|            if (!flagStaticTable) 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 (3031:17): [True: 1, False: 1]
  ------------------
 3032|      1|            break;
 3033|    255|        case FSEv05_ENCODING_DYNAMIC :
  ------------------
  |  |  433|    255|#define FSEv05_ENCODING_DYNAMIC 3
  ------------------
  |  Branch (3033:9): [True: 255, False: 64]
  ------------------
 3034|    255|        default :   /* impossible */
  ------------------
  |  Branch (3034:9): [True: 0, False: 319]
  ------------------
 3035|    255|            {   unsigned max = MaxOff;
  ------------------
  |  |  424|    255|#define MaxOff ((1<<Offbits)- 1)
  |  |  ------------------
  |  |  |  |  420|    255|#define Offbits  5
  |  |  ------------------
  ------------------
 3036|    255|                headerSize = FSEv05_readNCount(norm, &max, &Offlog, ip, iend-ip);
 3037|    255|                if (FSEv05_isError(headerSize)) return ERROR(GENERIC);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3037:21): [True: 20, False: 235]
  ------------------
 3038|    235|                if (Offlog > OffFSEv05Log) return ERROR(corruption_detected);
  ------------------
  |  |  427|    235|#define OffFSEv05Log   9
  ------------------
                              if (Offlog > OffFSEv05Log) 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 (3038:21): [True: 1, False: 234]
  ------------------
 3039|    234|                ip += headerSize;
 3040|    234|                FSEv05_buildDTable(DTableOffb, norm, max, Offlog);
 3041|    234|        }   }
 3042|       |
 3043|    296|        switch(MLtype)
 3044|    296|        {
 3045|     57|        case FSEv05_ENCODING_RLE :
  ------------------
  |  |  431|     57|#define FSEv05_ENCODING_RLE     1
  ------------------
  |  Branch (3045:9): [True: 57, False: 239]
  ------------------
 3046|     57|            MLlog = 0;
 3047|     57|            if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
  ------------------
  |  |   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 (3047:17): [True: 1, False: 56]
  ------------------
 3048|     56|            FSEv05_buildDTable_rle(DTableML, *ip++);
 3049|     56|            break;
 3050|    154|        case FSEv05_ENCODING_RAW :
  ------------------
  |  |  430|    154|#define FSEv05_ENCODING_RAW     0
  ------------------
  |  Branch (3050:9): [True: 154, False: 142]
  ------------------
 3051|    154|            MLlog = MLbits;
  ------------------
  |  |  418|    154|#define MLbits   7
  ------------------
 3052|    154|            FSEv05_buildDTable_raw(DTableML, MLbits);
  ------------------
  |  |  418|    154|#define MLbits   7
  ------------------
 3053|    154|            break;
 3054|      2|        case FSEv05_ENCODING_STATIC:
  ------------------
  |  |  432|      2|#define FSEv05_ENCODING_STATIC  2
  ------------------
  |  Branch (3054:9): [True: 2, False: 294]
  ------------------
 3055|      2|            if (!flagStaticTable) 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 (3055:17): [True: 1, False: 1]
  ------------------
 3056|      1|            break;
 3057|     83|        case FSEv05_ENCODING_DYNAMIC :
  ------------------
  |  |  433|     83|#define FSEv05_ENCODING_DYNAMIC 3
  ------------------
  |  Branch (3057:9): [True: 83, False: 213]
  ------------------
 3058|     83|        default :   /* impossible */
  ------------------
  |  Branch (3058:9): [True: 0, False: 296]
  ------------------
 3059|     83|            {   unsigned max = MaxML;
  ------------------
  |  |  422|     83|#define MaxML  ((1<<MLbits) - 1)
  |  |  ------------------
  |  |  |  |  418|     83|#define MLbits   7
  |  |  ------------------
  ------------------
 3060|     83|                headerSize = FSEv05_readNCount(norm, &max, &MLlog, ip, iend-ip);
 3061|     83|                if (FSEv05_isError(headerSize)) return ERROR(GENERIC);
  ------------------
  |  |   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 (3061:21): [True: 13, False: 70]
  ------------------
 3062|     70|                if (MLlog > MLFSEv05Log) return ERROR(corruption_detected);
  ------------------
  |  |  425|     70|#define MLFSEv05Log   10
  ------------------
                              if (MLlog > MLFSEv05Log) return ERROR(corruption_detected);
  ------------------
  |  |   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 (3062:21): [True: 3, False: 67]
  ------------------
 3063|     67|                ip += headerSize;
 3064|     67|                FSEv05_buildDTable(DTableML, norm, max, MLlog);
 3065|     67|    }   }   }
 3066|       |
 3067|    278|    return ip-istart;
 3068|    296|}
zstd_v05.c:ZSTDv05_decodeSequence:
 3090|  75.5k|{
 3091|  75.5k|    size_t litLength;
 3092|  75.5k|    size_t prevOffset;
 3093|  75.5k|    size_t offset;
 3094|  75.5k|    size_t matchLength;
 3095|  75.5k|    const BYTE* dumps = seqState->dumps;
 3096|  75.5k|    const BYTE* const de = seqState->dumpsEnd;
 3097|       |
 3098|       |    /* Literal length */
 3099|  75.5k|    litLength = FSEv05_peakSymbol(&(seqState->stateLL));
 3100|  75.5k|    prevOffset = litLength ? seq->offset : seqState->prevOffset;
  ------------------
  |  Branch (3100:18): [True: 6.36k, False: 69.2k]
  ------------------
 3101|  75.5k|    if (litLength == MaxLL) {
  ------------------
  |  |  423|  75.5k|#define MaxLL  ((1<<LLbits) - 1)
  |  |  ------------------
  |  |  |  |  419|  75.5k|#define LLbits   6
  |  |  ------------------
  ------------------
  |  Branch (3101:9): [True: 1.58k, False: 73.9k]
  ------------------
 3102|  1.58k|        const U32 add = *dumps++;
 3103|  1.58k|        if (add < 255) litLength += add;
  ------------------
  |  Branch (3103:13): [True: 950, False: 630]
  ------------------
 3104|    630|        else if (dumps + 2 <= de) {
  ------------------
  |  Branch (3104:18): [True: 116, False: 514]
  ------------------
 3105|    116|            litLength = MEM_readLE16(dumps);
 3106|    116|            dumps += 2;
 3107|    116|            if ((litLength & 1) && dumps < de) {
  ------------------
  |  Branch (3107:17): [True: 59, False: 57]
  |  Branch (3107:36): [True: 56, False: 3]
  ------------------
 3108|     56|                litLength += *dumps << 16;
 3109|     56|                dumps += 1;
 3110|     56|            }
 3111|    116|            litLength>>=1;
 3112|    116|        }
 3113|  1.58k|        if (dumps >= de) { dumps = de-1; }  /* late correction, to avoid read overflow (data is now corrupted anyway) */
  ------------------
  |  Branch (3113:13): [True: 641, False: 939]
  ------------------
 3114|  1.58k|    }
 3115|       |
 3116|       |    /* Offset */
 3117|  75.5k|    {
 3118|  75.5k|        static const U32 offsetPrefix[MaxOff+1] = {
 3119|  75.5k|                1 /*fake*/, 1, 2, 4, 8, 16, 32, 64, 128, 256,
 3120|  75.5k|                512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144,
 3121|  75.5k|                524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, /*fake*/ 1, 1, 1, 1, 1 };
 3122|  75.5k|        U32 offsetCode = FSEv05_peakSymbol(&(seqState->stateOffb));   /* <= maxOff, by table construction */
 3123|  75.5k|        U32 nbBits = offsetCode - 1;
 3124|  75.5k|        if (offsetCode==0) nbBits = 0;   /* cmove */
  ------------------
  |  Branch (3124:13): [True: 37.2k, False: 38.2k]
  ------------------
 3125|  75.5k|        offset = offsetPrefix[offsetCode] + BITv05_readBits(&(seqState->DStream), nbBits);
 3126|  75.5k|        if (MEM_32bits()) BITv05_reloadDStream(&(seqState->DStream));
  ------------------
  |  Branch (3126:13): [True: 0, False: 75.5k]
  ------------------
 3127|  75.5k|        if (offsetCode==0) offset = prevOffset;   /* repcode, cmove */
  ------------------
  |  Branch (3127:13): [True: 37.2k, False: 38.2k]
  ------------------
 3128|  75.5k|        if (offsetCode | !litLength) seqState->prevOffset = seq->offset;   /* cmove */
  ------------------
  |  Branch (3128:13): [True: 72.9k, False: 2.63k]
  ------------------
 3129|  75.5k|        FSEv05_decodeSymbol(&(seqState->stateOffb), &(seqState->DStream));    /* update */
 3130|  75.5k|    }
 3131|       |
 3132|       |    /* Literal length update */
 3133|  75.5k|    FSEv05_decodeSymbol(&(seqState->stateLL), &(seqState->DStream));   /* update */
 3134|  75.5k|    if (MEM_32bits()) BITv05_reloadDStream(&(seqState->DStream));
  ------------------
  |  Branch (3134:9): [True: 0, False: 75.5k]
  ------------------
 3135|       |
 3136|       |    /* MatchLength */
 3137|  75.5k|    matchLength = FSEv05_decodeSymbol(&(seqState->stateML), &(seqState->DStream));
 3138|  75.5k|    if (matchLength == MaxML) {
  ------------------
  |  |  422|  75.5k|#define MaxML  ((1<<MLbits) - 1)
  |  |  ------------------
  |  |  |  |  418|  75.5k|#define MLbits   7
  |  |  ------------------
  ------------------
  |  Branch (3138:9): [True: 2.38k, False: 73.1k]
  ------------------
 3139|  2.38k|        const U32 add = dumps<de ? *dumps++ : 0;
  ------------------
  |  Branch (3139:25): [True: 2.37k, False: 12]
  ------------------
 3140|  2.38k|        if (add < 255) matchLength += add;
  ------------------
  |  Branch (3140:13): [True: 1.10k, False: 1.27k]
  ------------------
 3141|  1.27k|        else if (dumps + 2 <= de) {
  ------------------
  |  Branch (3141:18): [True: 132, False: 1.14k]
  ------------------
 3142|    132|            matchLength = MEM_readLE16(dumps);
 3143|    132|            dumps += 2;
 3144|    132|            if ((matchLength & 1) && dumps < de) {
  ------------------
  |  Branch (3144:17): [True: 88, False: 44]
  |  Branch (3144:38): [True: 87, False: 1]
  ------------------
 3145|     87|                matchLength += *dumps << 16;
 3146|     87|                dumps += 1;
 3147|     87|            }
 3148|    132|            matchLength >>= 1;
 3149|    132|        }
 3150|  2.38k|        if (dumps >= de) { dumps = de-1; }  /* late correction, to avoid read overflow (data is now corrupted anyway) */
  ------------------
  |  Branch (3150:13): [True: 1.59k, False: 789]
  ------------------
 3151|  2.38k|    }
 3152|  75.5k|    matchLength += MINMATCH;
  ------------------
  |  |  414|  75.5k|#define MINMATCH 4
  ------------------
 3153|       |
 3154|       |    /* save result */
 3155|  75.5k|    seq->litLength = litLength;
 3156|  75.5k|    seq->offset = offset;
 3157|  75.5k|    seq->matchLength = matchLength;
 3158|  75.5k|    seqState->dumps = dumps;
 3159|       |
 3160|       |#if 0   /* debug */
 3161|       |    {
 3162|       |        static U64 totalDecoded = 0;
 3163|       |        printf("pos %6u : %3u literals & match %3u bytes at distance %6u \n",
 3164|       |           (U32)(totalDecoded), (U32)litLength, (U32)matchLength, (U32)offset);
 3165|       |        totalDecoded += litLength + matchLength;
 3166|       |    }
 3167|       |#endif
 3168|  75.5k|}
zstd_v05.c:FSEv05_peakSymbol:
  960|   151k|{
  961|   151k|    const FSEv05_decode_t DInfo = ((const FSEv05_decode_t*)(DStatePtr->table))[DStatePtr->state];
  962|   151k|    return DInfo.symbol;
  963|   151k|}
zstd_v05.c:ZSTDv05_execSequence:
 3175|  75.5k|{
 3176|  75.5k|    static const int dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 };   /* added */
 3177|  75.5k|    static const int dec64table[] = { 8, 8, 8, 7, 8, 9,10,11 };   /* subtracted */
 3178|  75.5k|    BYTE* const oLitEnd = op + sequence.litLength;
 3179|  75.5k|    const size_t sequenceLength = sequence.litLength + sequence.matchLength;
 3180|  75.5k|    BYTE* const oMatchEnd = op + sequenceLength;   /* risk : address space overflow (32-bits) */
 3181|  75.5k|    BYTE* const oend_8 = oend-8;
 3182|  75.5k|    const BYTE* const litEnd = *litPtr + sequence.litLength;
 3183|  75.5k|    const BYTE* match = oLitEnd - sequence.offset;
 3184|       |
 3185|       |    /* checks */
 3186|  75.5k|    size_t const seqLength = sequence.litLength + sequence.matchLength;
 3187|       |
 3188|  75.5k|    if (seqLength > (size_t)(oend - op)) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3188:9): [True: 42, False: 75.5k]
  ------------------
 3189|  75.5k|    if (sequence.litLength > (size_t)(litLimit - *litPtr)) return ERROR(corruption_detected);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3189:9): [True: 55, False: 75.4k]
  ------------------
 3190|       |    /* Now we know there are no overflow in literal nor match lengths, can use pointer checks */
 3191|  75.4k|    if (oLitEnd > oend_8) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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 (3191:9): [True: 1, False: 75.4k]
  ------------------
 3192|       |
 3193|  75.4k|    if (oMatchEnd > oend) return ERROR(dstSize_tooSmall);   /* overwrite beyond dst buffer */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3193:9): [True: 0, False: 75.4k]
  ------------------
 3194|  75.4k|    if (litEnd > litLimit) return ERROR(corruption_detected);   /* overRead beyond lit buffer */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3194:9): [True: 0, False: 75.4k]
  ------------------
 3195|       |
 3196|       |    /* copy Literals */
 3197|  75.4k|    ZSTDv05_wildcopy(op, *litPtr, (ptrdiff_t)sequence.litLength);   /* note : oLitEnd <= oend-8 : no risk of overwrite beyond oend */
 3198|  75.4k|    op = oLitEnd;
 3199|  75.4k|    *litPtr = litEnd;   /* update for next sequence */
 3200|       |
 3201|       |    /* copy Match */
 3202|  75.4k|    if (sequence.offset > (size_t)(oLitEnd - base)) {
  ------------------
  |  Branch (3202:9): [True: 185, False: 75.2k]
  ------------------
 3203|       |        /* offset beyond prefix */
 3204|    185|        if (sequence.offset > (size_t)(oLitEnd - vBase))
  ------------------
  |  Branch (3204:13): [True: 80, False: 105]
  ------------------
 3205|     80|            return ERROR(corruption_detected);
  ------------------
  |  |   49|     80|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     80|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     80|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3206|    105|        match = dictEnd - (base-match);
 3207|    105|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (3207:13): [True: 80, False: 25]
  ------------------
 3208|     80|            memmove(oLitEnd, match, sequence.matchLength);
 3209|     80|            return sequenceLength;
 3210|     80|        }
 3211|       |        /* span extDict & currentPrefixSegment */
 3212|     25|        {
 3213|     25|            size_t length1 = dictEnd - match;
 3214|     25|            memmove(oLitEnd, match, length1);
 3215|     25|            op = oLitEnd + length1;
 3216|     25|            sequence.matchLength -= length1;
 3217|     25|            match = base;
 3218|     25|            if (op > oend_8 || sequence.matchLength < MINMATCH) {
  ------------------
  |  |  414|     25|#define MINMATCH 4
  ------------------
  |  Branch (3218:17): [True: 0, False: 25]
  |  Branch (3218:32): [True: 13, False: 12]
  ------------------
 3219|     45|              while (op < oMatchEnd) *op++ = *match++;
  ------------------
  |  Branch (3219:22): [True: 32, False: 13]
  ------------------
 3220|     13|              return sequenceLength;
 3221|     13|            }
 3222|     25|    }   }
 3223|       |    /* Requirement: op <= oend_8 */
 3224|       |
 3225|       |    /* match within prefix */
 3226|  75.3k|    if (sequence.offset < 8) {
  ------------------
  |  Branch (3226:9): [True: 73.3k, False: 1.95k]
  ------------------
 3227|       |        /* close range match, overlap */
 3228|  73.3k|        const int sub2 = dec64table[sequence.offset];
 3229|  73.3k|        op[0] = match[0];
 3230|  73.3k|        op[1] = match[1];
 3231|  73.3k|        op[2] = match[2];
 3232|  73.3k|        op[3] = match[3];
 3233|  73.3k|        match += dec32table[sequence.offset];
 3234|  73.3k|        ZSTDv05_copy4(op+4, match);
 3235|  73.3k|        match -= sub2;
 3236|  73.3k|    } else {
 3237|  1.95k|        ZSTDv05_copy8(op, match);
 3238|  1.95k|    }
 3239|  75.3k|    op += 8; match += 8;
 3240|       |
 3241|  75.3k|    if (oMatchEnd > oend-(16-MINMATCH)) {
  ------------------
  |  |  414|  75.3k|#define MINMATCH 4
  ------------------
  |  Branch (3241:9): [True: 21, False: 75.2k]
  ------------------
 3242|     21|        if (op < oend_8) {
  ------------------
  |  Branch (3242:13): [True: 18, False: 3]
  ------------------
 3243|     18|            ZSTDv05_wildcopy(op, match, oend_8 - op);
 3244|     18|            match += oend_8 - op;
 3245|     18|            op = oend_8;
 3246|     18|        }
 3247|     94|        while (op < oMatchEnd)
  ------------------
  |  Branch (3247:16): [True: 73, False: 21]
  ------------------
 3248|     73|            *op++ = *match++;
 3249|  75.2k|    } else {
 3250|  75.2k|        ZSTDv05_wildcopy(op, match, (ptrdiff_t)sequence.matchLength-8);   /* works even if matchLength < 8 */
 3251|  75.2k|    }
 3252|  75.3k|    return sequenceLength;
 3253|  75.4k|}
zstd_v05.c:ZSTDv05_wildcopy:
  458|   150k|{
  459|   150k|    const BYTE* ip = (const BYTE*)src;
  460|   150k|    BYTE* op = (BYTE*)dst;
  461|   150k|    BYTE* const oend = op + length;
  462|   150k|    do
  463|  46.0M|        COPY8(op, ip)
  ------------------
  |  |  453|  46.0M|#define COPY8(d,s) { ZSTDv05_copy8(d,s); d+=8; s+=8; }
  ------------------
  464|  46.0M|    while (op < oend);
  ------------------
  |  Branch (464:12): [True: 45.8M, False: 150k]
  ------------------
  465|   150k|}
zstd_v05.c:ZSTDv05_copy4:
 2569|  73.3k|static void ZSTDv05_copy4(void* dst, const void* src) { memcpy(dst, src, 4); }
zstd_v05.c:ZSTDv05_copy8:
  451|  46.0M|static void ZSTDv05_copy8(void* dst, const void* src) { memcpy(dst, src, 8); }
zstd_v05.c:ZSTDv05_decompress_continueDCtx:
 3373|  1.97k|{
 3374|  1.97k|    const BYTE* ip = (const BYTE*)src;
 3375|  1.97k|    const BYTE* iend = ip + srcSize;
 3376|  1.97k|    BYTE* const ostart = (BYTE*)dst;
 3377|  1.97k|    BYTE* op = ostart;
 3378|  1.97k|    BYTE* const oend = ostart + maxDstSize;
 3379|  1.97k|    size_t remainingSize = srcSize;
 3380|  1.97k|    blockProperties_t blockProperties;
 3381|  1.97k|    memset(&blockProperties, 0, sizeof(blockProperties));
 3382|       |
 3383|       |    /* Frame Header */
 3384|  1.97k|    {   size_t frameHeaderSize;
 3385|  1.97k|        if (srcSize < ZSTDv05_frameHeaderSize_min+ZSTDv05_blockHeaderSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3385:13): [True: 0, False: 1.97k]
  ------------------
 3386|  1.97k|        frameHeaderSize = ZSTDv05_decodeFrameHeader_Part1(dctx, src, ZSTDv05_frameHeaderSize_min);
 3387|  1.97k|        if (ZSTDv05_isError(frameHeaderSize)) return frameHeaderSize;
  ------------------
  |  Branch (3387:13): [True: 0, False: 1.97k]
  ------------------
 3388|  1.97k|        if (srcSize < frameHeaderSize+ZSTDv05_blockHeaderSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3388:13): [True: 0, False: 1.97k]
  ------------------
 3389|  1.97k|        ip += frameHeaderSize; remainingSize -= frameHeaderSize;
 3390|  1.97k|        frameHeaderSize = ZSTDv05_decodeFrameHeader_Part2(dctx, src, frameHeaderSize);
 3391|  1.97k|        if (ZSTDv05_isError(frameHeaderSize)) return frameHeaderSize;
  ------------------
  |  Branch (3391:13): [True: 68, False: 1.91k]
  ------------------
 3392|  1.97k|    }
 3393|       |
 3394|       |    /* Loop on each block */
 3395|  2.73k|    while (1)
  ------------------
  |  Branch (3395:12): [True: 2.73k, Folded]
  ------------------
 3396|  2.73k|    {
 3397|  2.73k|        size_t decodedSize=0;
 3398|  2.73k|        size_t cBlockSize = ZSTDv05_getcBlockSize(ip, iend-ip, &blockProperties);
 3399|  2.73k|        if (ZSTDv05_isError(cBlockSize)) return cBlockSize;
  ------------------
  |  Branch (3399:13): [True: 0, False: 2.73k]
  ------------------
 3400|       |
 3401|  2.73k|        ip += ZSTDv05_blockHeaderSize;
 3402|  2.73k|        remainingSize -= ZSTDv05_blockHeaderSize;
 3403|  2.73k|        if (cBlockSize > remainingSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3403:13): [True: 0, False: 2.73k]
  ------------------
 3404|       |
 3405|  2.73k|        switch(blockProperties.blockType)
 3406|  2.73k|        {
 3407|    910|        case bt_compressed:
  ------------------
  |  Branch (3407:9): [True: 910, False: 1.82k]
  ------------------
 3408|    910|            decodedSize = ZSTDv05_decompressBlock_internal(dctx, op, oend-op, ip, cBlockSize);
 3409|    910|            break;
 3410|  1.04k|        case bt_raw :
  ------------------
  |  Branch (3410:9): [True: 1.04k, False: 1.69k]
  ------------------
 3411|  1.04k|            decodedSize = ZSTDv05_copyRawBlock(op, oend-op, ip, cBlockSize);
 3412|  1.04k|            break;
 3413|     12|        case bt_rle :
  ------------------
  |  Branch (3413:9): [True: 12, False: 2.72k]
  ------------------
 3414|     12|            return ERROR(GENERIC);   /* not yet supported */
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3415|      0|            break;
 3416|    768|        case bt_end :
  ------------------
  |  Branch (3416:9): [True: 768, False: 1.97k]
  ------------------
 3417|       |            /* end of frame */
 3418|    768|            if (remainingSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3418:17): [True: 0, False: 768]
  ------------------
 3419|    768|            break;
 3420|    768|        default:
  ------------------
  |  Branch (3420:9): [True: 0, False: 2.73k]
  ------------------
 3421|      0|            return ERROR(GENERIC);   /* impossible */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3422|  2.73k|        }
 3423|  2.72k|        if (cBlockSize == 0) break;   /* bt_end */
  ------------------
  |  Branch (3423:13): [True: 1.12k, False: 1.60k]
  ------------------
 3424|       |
 3425|  1.60k|        if (ZSTDv05_isError(decodedSize)) return decodedSize;
  ------------------
  |  Branch (3425:13): [True: 776, False: 829]
  ------------------
 3426|    829|        op += decodedSize;
 3427|    829|        ip += cBlockSize;
 3428|    829|        remainingSize -= cBlockSize;
 3429|    829|    }
 3430|       |
 3431|  1.12k|    return op-ostart;
 3432|  1.91k|}
zstd_v05.c:ZSTD_errorFrameSizeInfoLegacy:
 3479|     64|{
 3480|     64|    *cSize = ret;
 3481|     64|    *dBound = ZSTD_CONTENTSIZE_ERROR;
  ------------------
  |  |  443|     64|#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
  ------------------
 3482|     64|}
zstd_v05.c:ZSTDv05_getcBlockSize:
 2779|  6.67k|{
 2780|  6.67k|    const BYTE* const in = (const BYTE*)src;
 2781|  6.67k|    BYTE headerFlags;
 2782|  6.67k|    U32 cSize;
 2783|       |
 2784|  6.67k|    if (srcSize < 3)
  ------------------
  |  Branch (2784:9): [True: 4, False: 6.66k]
  ------------------
 2785|      4|        return ERROR(srcSize_wrong);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2786|       |
 2787|  6.66k|    headerFlags = *in;
 2788|  6.66k|    cSize = in[2] + (in[1]<<8) + ((in[0] & 7)<<16);
 2789|       |
 2790|  6.66k|    bpPtr->blockType = (blockType_t)(headerFlags >> 6);
 2791|  6.66k|    bpPtr->origSize = (bpPtr->blockType == bt_rle) ? cSize : 0;
  ------------------
  |  Branch (2791:23): [True: 228, False: 6.43k]
  ------------------
 2792|       |
 2793|  6.66k|    if (bpPtr->blockType == bt_end) return 0;
  ------------------
  |  Branch (2793:9): [True: 2.19k, False: 4.47k]
  ------------------
 2794|  4.47k|    if (bpPtr->blockType == bt_rle) return 1;
  ------------------
  |  Branch (2794:9): [True: 228, False: 4.24k]
  ------------------
 2795|  4.24k|    return cSize;
 2796|  4.47k|}
zstd_v05.c:ZSTDv05_decodeFrameHeader_Part1:
 2740|  1.97k|{
 2741|  1.97k|    U32 magicNumber;
 2742|  1.97k|    if (srcSize != ZSTDv05_frameHeaderSize_min)
  ------------------
  |  Branch (2742:9): [True: 0, False: 1.97k]
  ------------------
 2743|      0|        return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2744|  1.97k|    magicNumber = MEM_readLE32(src);
 2745|  1.97k|    if (magicNumber != ZSTDv05_MAGICNUMBER) return ERROR(prefix_unknown);
  ------------------
  |  |  153|  1.97k|#define ZSTDv05_MAGICNUMBER 0xFD2FB525   /* v0.5 */
  ------------------
                  if (magicNumber != ZSTDv05_MAGICNUMBER) return ERROR(prefix_unknown);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2745:9): [True: 0, False: 1.97k]
  ------------------
 2746|  1.97k|    zc->headerSize = ZSTDv05_frameHeaderSize_min;
 2747|  1.97k|    return zc->headerSize;
 2748|  1.97k|}
zstd_v05.c:ZSTDv05_decodeFrameHeader_Part2:
 2768|  1.97k|{
 2769|  1.97k|    size_t result;
 2770|  1.97k|    if (srcSize != zc->headerSize)
  ------------------
  |  Branch (2770:9): [True: 0, False: 1.97k]
  ------------------
 2771|      0|        return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2772|  1.97k|    result = ZSTDv05_getFrameParams(&(zc->params), src, srcSize);
 2773|  1.97k|    if ((MEM_32bits()) && (zc->params.windowLog > 25)) return ERROR(frameParameter_unsupported);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2773:9): [True: 0, False: 1.97k]
  |  Branch (2773:27): [True: 0, False: 0]
  ------------------
 2774|  1.97k|    return result;
 2775|  1.97k|}
zstd_v05.c:ZSTDv05_copyRawBlock:
 2800|  1.04k|{
 2801|  1.04k|    if (dst==NULL) 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 (2801:9): [True: 0, False: 1.04k]
  ------------------
 2802|  1.04k|    if (srcSize > maxDstSize) 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 (2802:9): [True: 0, False: 1.04k]
  ------------------
 2803|  1.04k|    memcpy(dst, src, srcSize);
 2804|  1.04k|    return srcSize;
 2805|  1.04k|}
zstd_v05.c:ZSTDv05_decompress_insertDictionary:
 3663|  1.25k|{
 3664|  1.25k|    size_t eSize;
 3665|  1.25k|    U32 magic = MEM_readLE32(dict);
 3666|  1.25k|    if (magic != ZSTDv05_DICT_MAGIC) {
  ------------------
  |  |  390|  1.25k|#define ZSTDv05_DICT_MAGIC  0xEC30A435
  ------------------
  |  Branch (3666:9): [True: 86, False: 1.17k]
  ------------------
 3667|       |        /* pure content mode */
 3668|     86|        ZSTDv05_refDictContent(dctx, dict, dictSize);
 3669|     86|        return 0;
 3670|     86|    }
 3671|       |    /* load entropy tables */
 3672|  1.17k|    dict = (const char*)dict + 4;
 3673|  1.17k|    dictSize -= 4;
 3674|  1.17k|    eSize = ZSTDv05_loadEntropy(dctx, dict, dictSize);
 3675|  1.17k|    if (ZSTDv05_isError(eSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|  1.05k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  1.05k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  1.05k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3675:9): [True: 1.05k, False: 121]
  ------------------
 3676|       |
 3677|       |    /* reference dictionary content */
 3678|    121|    dict = (const char*)dict + eSize;
 3679|    121|    dictSize -= eSize;
 3680|    121|    ZSTDv05_refDictContent(dctx, dict, dictSize);
 3681|       |
 3682|    121|    return 0;
 3683|  1.17k|}
zstd_v05.c:ZSTDv05_refDictContent:
 3614|    207|{
 3615|    207|    dctx->dictEnd = dctx->previousDstEnd;
 3616|    207|    dctx->vBase = (const char*)dict - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->base));
 3617|    207|    dctx->base = dict;
 3618|    207|    dctx->previousDstEnd = (const char*)dict + dictSize;
 3619|    207|}
zstd_v05.c:ZSTDv05_loadEntropy:
 3622|  1.17k|{
 3623|  1.17k|    size_t hSize, offcodeHeaderSize, matchlengthHeaderSize, errorCode, litlengthHeaderSize;
 3624|  1.17k|    short offcodeNCount[MaxOff+1];
 3625|  1.17k|    unsigned offcodeMaxValue=MaxOff, offcodeLog;
  ------------------
  |  |  424|  1.17k|#define MaxOff ((1<<Offbits)- 1)
  |  |  ------------------
  |  |  |  |  420|  1.17k|#define Offbits  5
  |  |  ------------------
  ------------------
 3626|  1.17k|    short matchlengthNCount[MaxML+1];
 3627|  1.17k|    unsigned matchlengthMaxValue = MaxML, matchlengthLog;
  ------------------
  |  |  422|  1.17k|#define MaxML  ((1<<MLbits) - 1)
  |  |  ------------------
  |  |  |  |  418|  1.17k|#define MLbits   7
  |  |  ------------------
  ------------------
 3628|  1.17k|    short litlengthNCount[MaxLL+1];
 3629|  1.17k|    unsigned litlengthMaxValue = MaxLL, litlengthLog;
  ------------------
  |  |  423|  1.17k|#define MaxLL  ((1<<LLbits) - 1)
  |  |  ------------------
  |  |  |  |  419|  1.17k|#define LLbits   6
  |  |  ------------------
  ------------------
 3630|       |
 3631|  1.17k|    hSize = HUFv05_readDTableX4(dctx->hufTableX4, dict, dictSize);
 3632|  1.17k|    if (HUFv05_isError(hSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|    858|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    858|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    858|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3632:9): [True: 858, False: 314]
  ------------------
 3633|    314|    dict = (const char*)dict + hSize;
 3634|    314|    dictSize -= hSize;
 3635|       |
 3636|    314|    offcodeHeaderSize = FSEv05_readNCount(offcodeNCount, &offcodeMaxValue, &offcodeLog, dict, dictSize);
 3637|    314|    if (FSEv05_isError(offcodeHeaderSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3637:9): [True: 60, False: 254]
  ------------------
 3638|    254|    if (offcodeLog > OffFSEv05Log) return ERROR(dictionary_corrupted);
  ------------------
  |  |  427|    254|#define OffFSEv05Log   9
  ------------------
                  if (offcodeLog > OffFSEv05Log) return ERROR(dictionary_corrupted);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3638:9): [True: 24, False: 230]
  ------------------
 3639|    230|    errorCode = FSEv05_buildDTable(dctx->OffTable, offcodeNCount, offcodeMaxValue, offcodeLog);
 3640|    230|    if (FSEv05_isError(errorCode)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3640:9): [True: 0, False: 230]
  ------------------
 3641|    230|    dict = (const char*)dict + offcodeHeaderSize;
 3642|    230|    dictSize -= offcodeHeaderSize;
 3643|       |
 3644|    230|    matchlengthHeaderSize = FSEv05_readNCount(matchlengthNCount, &matchlengthMaxValue, &matchlengthLog, dict, dictSize);
 3645|    230|    if (FSEv05_isError(matchlengthHeaderSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|     40|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     40|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     40|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3645:9): [True: 40, False: 190]
  ------------------
 3646|    190|    if (matchlengthLog > MLFSEv05Log) return ERROR(dictionary_corrupted);
  ------------------
  |  |  425|    190|#define MLFSEv05Log   10
  ------------------
                  if (matchlengthLog > MLFSEv05Log) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|     22|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     22|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     22|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3646:9): [True: 22, False: 168]
  ------------------
 3647|    168|    errorCode = FSEv05_buildDTable(dctx->MLTable, matchlengthNCount, matchlengthMaxValue, matchlengthLog);
 3648|    168|    if (FSEv05_isError(errorCode)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3648:9): [True: 0, False: 168]
  ------------------
 3649|    168|    dict = (const char*)dict + matchlengthHeaderSize;
 3650|    168|    dictSize -= matchlengthHeaderSize;
 3651|       |
 3652|    168|    litlengthHeaderSize = FSEv05_readNCount(litlengthNCount, &litlengthMaxValue, &litlengthLog, dict, dictSize);
 3653|    168|    if (litlengthLog > LLFSEv05Log) return ERROR(dictionary_corrupted);
  ------------------
  |  |  426|    168|#define LLFSEv05Log   10
  ------------------
                  if (litlengthLog > LLFSEv05Log) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|     41|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     41|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     41|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3653:9): [True: 41, False: 127]
  ------------------
 3654|    127|    if (FSEv05_isError(litlengthHeaderSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   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 (3654:9): [True: 6, False: 121]
  ------------------
 3655|    121|    errorCode = FSEv05_buildDTable(dctx->LLTable, litlengthNCount, litlengthMaxValue, litlengthLog);
 3656|    121|    if (FSEv05_isError(errorCode)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3656:9): [True: 0, False: 121]
  ------------------
 3657|       |
 3658|    121|    dctx->flagStaticTables = 1;
 3659|    121|    return hSize + offcodeHeaderSize + matchlengthHeaderSize + litlengthHeaderSize;
 3660|    121|}

FSEv06_readNCount:
 1209|  2.11k|{
 1210|  2.11k|    const BYTE* const istart = (const BYTE*) headerBuffer;
 1211|  2.11k|    const BYTE* const iend = istart + hbSize;
 1212|  2.11k|    const BYTE* ip = istart;
 1213|  2.11k|    int nbBits;
 1214|  2.11k|    int remaining;
 1215|  2.11k|    int threshold;
 1216|  2.11k|    U32 bitStream;
 1217|  2.11k|    int bitCount;
 1218|  2.11k|    unsigned charnum = 0;
 1219|  2.11k|    int previous0 = 0;
 1220|       |
 1221|  2.11k|    if (hbSize < 4) return ERROR(srcSize_wrong);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1221:9): [True: 21, False: 2.09k]
  ------------------
 1222|  2.09k|    bitStream = MEM_readLE32(ip);
 1223|  2.09k|    nbBits = (bitStream & 0xF) + FSEv06_MIN_TABLELOG;   /* extract tableLog */
  ------------------
  |  | 1138|  2.09k|#define FSEv06_MIN_TABLELOG 5
  ------------------
 1224|  2.09k|    if (nbBits > FSEv06_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  | 1140|  2.09k|#define FSEv06_TABLELOG_ABSOLUTE_MAX 15
  ------------------
                  if (nbBits > FSEv06_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   49|     84|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     84|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     84|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1224:9): [True: 84, False: 2.00k]
  ------------------
 1225|  2.00k|    bitStream >>= 4;
 1226|  2.00k|    bitCount = 4;
 1227|  2.00k|    *tableLogPtr = nbBits;
 1228|  2.00k|    remaining = (1<<nbBits)+1;
 1229|  2.00k|    threshold = 1<<nbBits;
 1230|  2.00k|    nbBits++;
 1231|       |
 1232|  27.9k|    while ((remaining>1) && (charnum<=*maxSVPtr)) {
  ------------------
  |  Branch (1232:12): [True: 26.0k, False: 1.95k]
  |  Branch (1232:29): [True: 25.9k, False: 18]
  ------------------
 1233|  25.9k|        if (previous0) {
  ------------------
  |  Branch (1233:13): [True: 2.82k, False: 23.1k]
  ------------------
 1234|  2.82k|            unsigned n0 = charnum;
 1235|  2.93k|            while ((bitStream & 0xFFFF) == 0xFFFF) {
  ------------------
  |  Branch (1235:20): [True: 108, False: 2.82k]
  ------------------
 1236|    108|                n0+=24;
 1237|    108|                if (ip < iend-5) {
  ------------------
  |  Branch (1237:21): [True: 76, False: 32]
  ------------------
 1238|     76|                    ip+=2;
 1239|     76|                    bitStream = MEM_readLE32(ip) >> bitCount;
 1240|     76|                } else {
 1241|     32|                    bitStream >>= 16;
 1242|     32|                    bitCount+=16;
 1243|     32|            }   }
 1244|  3.62k|            while ((bitStream & 3) == 3) {
  ------------------
  |  Branch (1244:20): [True: 800, False: 2.82k]
  ------------------
 1245|    800|                n0+=3;
 1246|    800|                bitStream>>=2;
 1247|    800|                bitCount+=2;
 1248|    800|            }
 1249|  2.82k|            n0 += bitStream & 3;
 1250|  2.82k|            bitCount += 2;
 1251|  2.82k|            if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall);
  ------------------
  |  |   49|     30|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     30|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     30|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1251:17): [True: 30, False: 2.79k]
  ------------------
 1252|  7.97k|            while (charnum < n0) normalizedCounter[charnum++] = 0;
  ------------------
  |  Branch (1252:20): [True: 5.17k, False: 2.79k]
  ------------------
 1253|  2.79k|            if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
  ------------------
  |  Branch (1253:17): [True: 1.59k, False: 1.20k]
  |  Branch (1253:35): [True: 225, False: 977]
  ------------------
 1254|  1.81k|                ip += bitCount>>3;
 1255|  1.81k|                bitCount &= 7;
 1256|  1.81k|                bitStream = MEM_readLE32(ip) >> bitCount;
 1257|  1.81k|            }
 1258|    977|            else
 1259|    977|                bitStream >>= 2;
 1260|  2.79k|        }
 1261|  25.9k|        {   short const max = (short)((2*threshold-1)-remaining);
 1262|  25.9k|            short count;
 1263|       |
 1264|  25.9k|            if ((bitStream & (threshold-1)) < (U32)max) {
  ------------------
  |  Branch (1264:17): [True: 18.3k, False: 7.57k]
  ------------------
 1265|  18.3k|                count = (short)(bitStream & (threshold-1));
 1266|  18.3k|                bitCount   += nbBits-1;
 1267|  18.3k|            } else {
 1268|  7.57k|                count = (short)(bitStream & (2*threshold-1));
 1269|  7.57k|                if (count >= threshold) count -= max;
  ------------------
  |  Branch (1269:21): [True: 2.94k, False: 4.63k]
  ------------------
 1270|  7.57k|                bitCount   += nbBits;
 1271|  7.57k|            }
 1272|       |
 1273|  25.9k|            count--;   /* extra accuracy */
 1274|  25.9k|            remaining -= FSEv06_abs(count);
 1275|  25.9k|            normalizedCounter[charnum++] = count;
 1276|  25.9k|            previous0 = !count;
 1277|  39.8k|            while (remaining < threshold) {
  ------------------
  |  Branch (1277:20): [True: 13.8k, False: 25.9k]
  ------------------
 1278|  13.8k|                nbBits--;
 1279|  13.8k|                threshold >>= 1;
 1280|  13.8k|            }
 1281|       |
 1282|  25.9k|            if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
  ------------------
  |  Branch (1282:17): [True: 20.6k, False: 5.29k]
  |  Branch (1282:35): [True: 1.41k, False: 3.88k]
  ------------------
 1283|  22.0k|                ip += bitCount>>3;
 1284|  22.0k|                bitCount &= 7;
 1285|  22.0k|            } else {
 1286|  3.88k|                bitCount -= (int)(8 * (iend - 4 - ip));
 1287|  3.88k|                ip = iend - 4;
 1288|  3.88k|            }
 1289|  25.9k|            bitStream = MEM_readLE32(ip) >> (bitCount & 31);
 1290|  25.9k|    }   }   /* while ((remaining>1) && (charnum<=*maxSVPtr)) */
 1291|  1.97k|    if (remaining != 1) return ERROR(GENERIC);
  ------------------
  |  |   49|     18|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     18|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     18|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1291:9): [True: 18, False: 1.95k]
  ------------------
 1292|  1.95k|    *maxSVPtr = charnum-1;
 1293|       |
 1294|  1.95k|    ip += (bitCount+7)>>3;
 1295|  1.95k|    if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1295:9): [True: 31, False: 1.92k]
  ------------------
 1296|  1.92k|    return ip-istart;
 1297|  1.95k|}
FSEv06_buildDTable:
 1403|  2.17k|{
 1404|  2.17k|    void* const tdPtr = dt+1;   /* because *dt is unsigned, 32-bits aligned on 32-bits */
 1405|  2.17k|    FSEv06_DECODE_TYPE* const tableDecode = (FSEv06_DECODE_TYPE*) (tdPtr);
  ------------------
  |  | 1125|  2.17k|#define FSEv06_DECODE_TYPE FSEv06_decode_t
  ------------------
 1406|  2.17k|    U16 symbolNext[FSEv06_MAX_SYMBOL_VALUE+1];
 1407|       |
 1408|  2.17k|    U32 const maxSV1 = maxSymbolValue + 1;
 1409|  2.17k|    U32 const tableSize = 1 << tableLog;
 1410|  2.17k|    U32 highThreshold = tableSize-1;
 1411|       |
 1412|       |    /* Sanity Checks */
 1413|  2.17k|    if (maxSymbolValue > FSEv06_MAX_SYMBOL_VALUE) return ERROR(maxSymbolValue_tooLarge);
  ------------------
  |  | 1117|  2.17k|#define FSEv06_MAX_SYMBOL_VALUE 255
  ------------------
                  if (maxSymbolValue > FSEv06_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 (1413:9): [True: 0, False: 2.17k]
  ------------------
 1414|  2.17k|    if (tableLog > FSEv06_MAX_TABLELOG) return ERROR(tableLog_tooLarge);
  ------------------
  |  | 1134|  2.17k|#define FSEv06_MAX_TABLELOG  (FSEv06_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  | 1111|  2.17k|#define FSEv06_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
                  if (tableLog > FSEv06_MAX_TABLELOG) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   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 (1414:9): [True: 14, False: 2.16k]
  ------------------
 1415|       |
 1416|       |    /* Init, lay down lowprob symbols */
 1417|  2.16k|    {   FSEv06_DTableHeader DTableH;
 1418|  2.16k|        DTableH.tableLog = (U16)tableLog;
 1419|  2.16k|        DTableH.fastMode = 1;
 1420|  2.16k|        {   S16 const largeLimit= (S16)(1 << (tableLog-1));
 1421|  2.16k|            U32 s;
 1422|  38.7k|            for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (1422:23): [True: 36.5k, False: 2.16k]
  ------------------
 1423|  36.5k|                if (normalizedCounter[s]==-1) {
  ------------------
  |  Branch (1423:21): [True: 11.7k, False: 24.7k]
  ------------------
 1424|  11.7k|                    tableDecode[highThreshold--].symbol = (FSEv06_FUNCTION_TYPE)s;
 1425|  11.7k|                    symbolNext[s] = 1;
 1426|  24.7k|                } else {
 1427|  24.7k|                    if (normalizedCounter[s] >= largeLimit) DTableH.fastMode=0;
  ------------------
  |  Branch (1427:25): [True: 1.08k, False: 23.6k]
  ------------------
 1428|  24.7k|                    symbolNext[s] = normalizedCounter[s];
 1429|  24.7k|        }   }   }
 1430|  2.16k|        memcpy(dt, &DTableH, sizeof(DTableH));
 1431|  2.16k|    }
 1432|       |
 1433|       |    /* Spread symbols */
 1434|  2.16k|    {   U32 const tableMask = tableSize-1;
 1435|  2.16k|        U32 const step = FSEv06_TABLESTEP(tableSize);
  ------------------
  |  | 1145|  2.16k|#define FSEv06_TABLESTEP(tableSize) ((tableSize>>1) + (tableSize>>3) + 3)
  ------------------
 1436|  2.16k|        U32 s, position = 0;
 1437|  38.7k|        for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (1437:19): [True: 36.5k, False: 2.16k]
  ------------------
 1438|  36.5k|            int i;
 1439|   815k|            for (i=0; i<normalizedCounter[s]; i++) {
  ------------------
  |  Branch (1439:23): [True: 779k, False: 36.5k]
  ------------------
 1440|   779k|                tableDecode[position].symbol = (FSEv06_FUNCTION_TYPE)s;
 1441|   779k|                position = (position + step) & tableMask;
 1442|   790k|                while (position > highThreshold) position = (position + step) & tableMask;   /* lowprob area */
  ------------------
  |  Branch (1442:24): [True: 11.7k, False: 779k]
  ------------------
 1443|   779k|        }   }
 1444|       |
 1445|  2.16k|        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 (1445:13): [True: 0, False: 2.16k]
  ------------------
 1446|  2.16k|    }
 1447|       |
 1448|       |    /* Build Decoding table */
 1449|  2.16k|    {   U32 u;
 1450|   793k|        for (u=0; u<tableSize; u++) {
  ------------------
  |  Branch (1450:19): [True: 790k, False: 2.16k]
  ------------------
 1451|   790k|            FSEv06_FUNCTION_TYPE const symbol = (FSEv06_FUNCTION_TYPE)(tableDecode[u].symbol);
  ------------------
  |  | 1123|   790k|#define FSEv06_FUNCTION_TYPE BYTE
  ------------------
 1452|   790k|            U16 nextState = symbolNext[symbol]++;
 1453|   790k|            tableDecode[u].nbBits = (BYTE) (tableLog - BITv06_highbit32 ((U32)nextState) );
 1454|   790k|            tableDecode[u].newState = (U16) ( (nextState << tableDecode[u].nbBits) - tableSize);
 1455|   790k|    }   }
 1456|       |
 1457|  2.16k|    return 0;
 1458|  2.16k|}
FSEv06_buildDTable_rle:
 1468|    141|{
 1469|    141|    void* ptr = dt;
 1470|    141|    FSEv06_DTableHeader* const DTableH = (FSEv06_DTableHeader*)ptr;
 1471|    141|    void* dPtr = dt + 1;
 1472|    141|    FSEv06_decode_t* const cell = (FSEv06_decode_t*)dPtr;
 1473|       |
 1474|    141|    DTableH->tableLog = 0;
 1475|    141|    DTableH->fastMode = 0;
 1476|       |
 1477|    141|    cell->newState = 0;
 1478|    141|    cell->symbol = symbolValue;
 1479|    141|    cell->nbBits = 0;
 1480|       |
 1481|    141|    return 0;
 1482|    141|}
FSEv06_decompress_usingDTable:
 1582|    785|{
 1583|    785|    const void* ptr = dt;
 1584|    785|    const FSEv06_DTableHeader* DTableH = (const FSEv06_DTableHeader*)ptr;
 1585|    785|    const U32 fastMode = DTableH->fastMode;
 1586|       |
 1587|       |    /* select fast mode (static) */
 1588|    785|    if (fastMode) return FSEv06_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 1);
  ------------------
  |  Branch (1588:9): [True: 264, False: 521]
  ------------------
 1589|    521|    return FSEv06_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 0);
 1590|    785|}
FSEv06_decompress:
 1594|    853|{
 1595|    853|    const BYTE* const istart = (const BYTE*)cSrc;
 1596|    853|    const BYTE* ip = istart;
 1597|    853|    short counting[FSEv06_MAX_SYMBOL_VALUE+1];
 1598|    853|    DTable_max_t dt;   /* Static analyzer seems unable to understand this table will be properly initialized later */
 1599|    853|    unsigned tableLog;
 1600|    853|    unsigned maxSymbolValue = FSEv06_MAX_SYMBOL_VALUE;
  ------------------
  |  | 1117|    853|#define FSEv06_MAX_SYMBOL_VALUE 255
  ------------------
 1601|       |
 1602|    853|    if (cSrcSize<2) return ERROR(srcSize_wrong);   /* too small input size */
  ------------------
  |  |   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 (1602:9): [True: 10, False: 843]
  ------------------
 1603|       |
 1604|       |    /* normal FSE decoding mode */
 1605|    843|    {   size_t const NCountLength = FSEv06_readNCount (counting, &maxSymbolValue, &tableLog, istart, cSrcSize);
 1606|    843|        if (FSEv06_isError(NCountLength)) return NCountLength;
  ------------------
  |  | 1357|    843|#define FSEv06_isError ERR_isError
  ------------------
  |  Branch (1606:13): [True: 34, False: 809]
  ------------------
 1607|    809|        if (NCountLength >= cSrcSize) return ERROR(srcSize_wrong);   /* too small input size */
  ------------------
  |  |   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 (1607:13): [True: 10, False: 799]
  ------------------
 1608|    799|        ip += NCountLength;
 1609|    799|        cSrcSize -= NCountLength;
 1610|    799|    }
 1611|       |
 1612|      0|    { size_t const errorCode = FSEv06_buildDTable (dt, counting, maxSymbolValue, tableLog);
 1613|    799|      if (FSEv06_isError(errorCode)) return errorCode; }
  ------------------
  |  | 1357|    799|#define FSEv06_isError ERR_isError
  ------------------
  |  Branch (1613:11): [True: 14, False: 785]
  ------------------
 1614|       |
 1615|    785|    return FSEv06_decompress_usingDTable (dst, maxDstSize, ip, cSrcSize, dt);   /* always return, even if it is an error code */
 1616|    799|}
HUFv06_readDTableX2:
 1949|    419|{
 1950|    419|    BYTE huffWeight[HUFv06_MAX_SYMBOL_VALUE + 1];
 1951|    419|    U32 rankVal[HUFv06_ABSOLUTEMAX_TABLELOG + 1];   /* large enough for values from 0 to 16 */
 1952|    419|    U32 tableLog = 0;
 1953|    419|    size_t iSize;
 1954|    419|    U32 nbSymbols = 0;
 1955|    419|    U32 n;
 1956|    419|    U32 nextRankStart;
 1957|    419|    void* const dtPtr = DTable + 1;
 1958|    419|    HUFv06_DEltX2* const dt = (HUFv06_DEltX2*)dtPtr;
 1959|       |
 1960|    419|    HUFv06_STATIC_ASSERT(sizeof(HUFv06_DEltX2) == sizeof(U16));   /* if compilation fails here, assertion is false */
  ------------------
  |  | 1929|    419|#define HUFv06_STATIC_ASSERT(c) { enum { HUFv06_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
 1961|       |    /* memset(huffWeight, 0, sizeof(huffWeight)); */   /* is not necessary, even though some analyzer complain ... */
 1962|       |
 1963|    419|    iSize = HUFv06_readStats(huffWeight, HUFv06_MAX_SYMBOL_VALUE + 1, rankVal, &nbSymbols, &tableLog, src, srcSize);
  ------------------
  |  | 1786|    419|#define HUFv06_MAX_SYMBOL_VALUE 255
  ------------------
 1964|    419|    if (HUFv06_isError(iSize)) return iSize;
  ------------------
  |  Branch (1964:9): [True: 109, False: 310]
  ------------------
 1965|       |
 1966|       |    /* check result */
 1967|    310|    if (tableLog > DTable[0]) return ERROR(tableLog_tooLarge);   /* DTable is too small */
  ------------------
  |  |   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 (1967:9): [True: 1, False: 309]
  ------------------
 1968|    309|    DTable[0] = (U16)tableLog;   /* maybe should separate sizeof allocated DTable, from used size of DTable, in case of re-use */
 1969|       |
 1970|       |    /* Prepare ranks */
 1971|    309|    nextRankStart = 0;
 1972|  2.08k|    for (n=1; n<tableLog+1; n++) {
  ------------------
  |  Branch (1972:15): [True: 1.77k, False: 309]
  ------------------
 1973|  1.77k|        U32 current = nextRankStart;
 1974|  1.77k|        nextRankStart += (rankVal[n] << (n-1));
 1975|  1.77k|        rankVal[n] = current;
 1976|  1.77k|    }
 1977|       |
 1978|       |    /* fill DTable */
 1979|  17.4k|    for (n=0; n<nbSymbols; n++) {
  ------------------
  |  Branch (1979:15): [True: 17.0k, False: 309]
  ------------------
 1980|  17.0k|        const U32 w = huffWeight[n];
 1981|  17.0k|        const U32 length = (1 << w) >> 1;
 1982|  17.0k|        U32 i;
 1983|  17.0k|        HUFv06_DEltX2 D;
 1984|  17.0k|        D.byte = (BYTE)n; D.nbBits = (BYTE)(tableLog + 1 - w);
 1985|  72.0k|        for (i = rankVal[w]; i < rankVal[w] + length; i++)
  ------------------
  |  Branch (1985:30): [True: 54.9k, False: 17.0k]
  ------------------
 1986|  54.9k|            dt[i] = D;
 1987|  17.0k|        rankVal[w] += length;
 1988|  17.0k|    }
 1989|       |
 1990|    309|    return iSize;
 1991|    310|}
HUFv06_decompress1X2_usingDTable:
 2040|     93|{
 2041|     93|    BYTE* op = (BYTE*)dst;
 2042|     93|    BYTE* const oend = op + dstSize;
 2043|     93|    const U32 dtLog = DTable[0];
 2044|     93|    const void* dtPtr = DTable;
 2045|     93|    const HUFv06_DEltX2* const dt = ((const HUFv06_DEltX2*)dtPtr)+1;
 2046|     93|    BITv06_DStream_t bitD;
 2047|       |
 2048|     93|    { size_t const errorCode = BITv06_initDStream(&bitD, cSrc, cSrcSize);
 2049|     93|      if (HUFv06_isError(errorCode)) return errorCode; }
  ------------------
  |  Branch (2049:11): [True: 24, False: 69]
  ------------------
 2050|       |
 2051|     69|    HUFv06_decodeStreamX2(op, &bitD, oend, dt, dtLog);
 2052|       |
 2053|       |    /* check */
 2054|     69|    if (!BITv06_endOfDStream(&bitD)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     68|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     68|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     68|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2054:9): [True: 68, False: 1]
  ------------------
 2055|       |
 2056|      1|    return dstSize;
 2057|     69|}
HUFv06_decompress1X2:
 2060|    109|{
 2061|    109|    HUFv06_CREATE_STATIC_DTABLEX2(DTable, HUFv06_MAX_TABLELOG);
  ------------------
  |  | 1743|    109|        unsigned short DTable[HUFv06_DTABLE_SIZE(maxTableLog)] = { maxTableLog }
  ------------------
 2062|    109|    const BYTE* ip = (const BYTE*) cSrc;
 2063|       |
 2064|    109|    size_t const errorCode = HUFv06_readDTableX2 (DTable, cSrc, cSrcSize);
 2065|    109|    if (HUFv06_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (2065:9): [True: 15, False: 94]
  ------------------
 2066|     94|    if (errorCode >= cSrcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2066:9): [True: 1, False: 93]
  ------------------
 2067|     93|    ip += errorCode;
 2068|     93|    cSrcSize -= errorCode;
 2069|       |
 2070|     93|    return HUFv06_decompress1X2_usingDTable (dst, dstSize, ip, cSrcSize, DTable);
 2071|     94|}
HUFv06_decompress4X2_usingDTable:
 2078|    213|{
 2079|       |    /* Check */
 2080|    213|    if (cSrcSize < 10) return ERROR(corruption_detected);  /* strict minimum : jump table + 1 byte per stream */
  ------------------
  |  |   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 (2080:9): [True: 7, False: 206]
  ------------------
 2081|       |
 2082|    206|    {   const BYTE* const istart = (const BYTE*) cSrc;
 2083|    206|        BYTE* const ostart = (BYTE*) dst;
 2084|    206|        BYTE* const oend = ostart + dstSize;
 2085|    206|        const void* const dtPtr = DTable;
 2086|    206|        const HUFv06_DEltX2* const dt = ((const HUFv06_DEltX2*)dtPtr) +1;
 2087|    206|        const U32 dtLog = DTable[0];
 2088|    206|        size_t errorCode;
 2089|       |
 2090|       |        /* Init */
 2091|    206|        BITv06_DStream_t bitD1;
 2092|    206|        BITv06_DStream_t bitD2;
 2093|    206|        BITv06_DStream_t bitD3;
 2094|    206|        BITv06_DStream_t bitD4;
 2095|    206|        const size_t length1 = MEM_readLE16(istart);
 2096|    206|        const size_t length2 = MEM_readLE16(istart+2);
 2097|    206|        const size_t length3 = MEM_readLE16(istart+4);
 2098|    206|        size_t length4;
 2099|    206|        const BYTE* const istart1 = istart + 6;  /* jumpTable */
 2100|    206|        const BYTE* const istart2 = istart1 + length1;
 2101|    206|        const BYTE* const istart3 = istart2 + length2;
 2102|    206|        const BYTE* const istart4 = istart3 + length3;
 2103|    206|        const size_t segmentSize = (dstSize+3) / 4;
 2104|    206|        BYTE* const opStart2 = ostart + segmentSize;
 2105|    206|        BYTE* const opStart3 = opStart2 + segmentSize;
 2106|    206|        BYTE* const opStart4 = opStart3 + segmentSize;
 2107|    206|        BYTE* op1 = ostart;
 2108|    206|        BYTE* op2 = opStart2;
 2109|    206|        BYTE* op3 = opStart3;
 2110|    206|        BYTE* op4 = opStart4;
 2111|    206|        U32 endSignal;
 2112|       |
 2113|    206|        length4 = cSrcSize - (length1 + length2 + length3 + 6);
 2114|    206|        if (length4 > cSrcSize) return ERROR(corruption_detected);   /* overflow */
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2114:13): [True: 29, False: 177]
  ------------------
 2115|    177|        errorCode = BITv06_initDStream(&bitD1, istart1, length1);
 2116|    177|        if (HUFv06_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (2116:13): [True: 23, False: 154]
  ------------------
 2117|    154|        errorCode = BITv06_initDStream(&bitD2, istart2, length2);
 2118|    154|        if (HUFv06_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (2118:13): [True: 32, False: 122]
  ------------------
 2119|    122|        errorCode = BITv06_initDStream(&bitD3, istart3, length3);
 2120|    122|        if (HUFv06_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (2120:13): [True: 29, False: 93]
  ------------------
 2121|     93|        errorCode = BITv06_initDStream(&bitD4, istart4, length4);
 2122|     93|        if (HUFv06_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (2122:13): [True: 7, False: 86]
  ------------------
 2123|       |
 2124|       |        /* 16-32 symbols per loop (4-8 symbols per stream) */
 2125|     86|        endSignal = BITv06_reloadDStream(&bitD1) | BITv06_reloadDStream(&bitD2) | BITv06_reloadDStream(&bitD3) | BITv06_reloadDStream(&bitD4);
 2126|  1.07k|        for ( ; (endSignal==BITv06_DStream_unfinished) && (op4<(oend-7)) ; ) {
  ------------------
  |  Branch (2126:17): [True: 992, False: 81]
  |  Branch (2126:59): [True: 987, False: 5]
  ------------------
 2127|    987|            HUFv06_DECODE_SYMBOLX2_2(op1, &bitD1);
  ------------------
  |  | 2010|    987|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2010:9): [True: 987, False: 0]
  |  |  ------------------
  |  | 2011|    987|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|    987|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2128|    987|            HUFv06_DECODE_SYMBOLX2_2(op2, &bitD2);
  ------------------
  |  | 2010|    987|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2010:9): [True: 987, False: 0]
  |  |  ------------------
  |  | 2011|    987|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|    987|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2129|    987|            HUFv06_DECODE_SYMBOLX2_2(op3, &bitD3);
  ------------------
  |  | 2010|    987|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2010:9): [True: 987, False: 0]
  |  |  ------------------
  |  | 2011|    987|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|    987|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2130|    987|            HUFv06_DECODE_SYMBOLX2_2(op4, &bitD4);
  ------------------
  |  | 2010|    987|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2010:9): [True: 987, False: 0]
  |  |  ------------------
  |  | 2011|    987|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|    987|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2131|    987|            HUFv06_DECODE_SYMBOLX2_1(op1, &bitD1);
  ------------------
  |  | 2006|    987|    if (MEM_64bits() || (HUFv06_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1784|      0|#define HUFv06_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv06_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (2006:9): [True: 987, False: 0]
  |  |  |  Branch (2006:25): [True: 0, Folded]
  |  |  ------------------
  |  | 2007|    987|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|    987|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2132|    987|            HUFv06_DECODE_SYMBOLX2_1(op2, &bitD2);
  ------------------
  |  | 2006|    987|    if (MEM_64bits() || (HUFv06_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1784|      0|#define HUFv06_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv06_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (2006:9): [True: 987, False: 0]
  |  |  |  Branch (2006:25): [True: 0, Folded]
  |  |  ------------------
  |  | 2007|    987|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|    987|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2133|    987|            HUFv06_DECODE_SYMBOLX2_1(op3, &bitD3);
  ------------------
  |  | 2006|    987|    if (MEM_64bits() || (HUFv06_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1784|      0|#define HUFv06_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv06_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (2006:9): [True: 987, False: 0]
  |  |  |  Branch (2006:25): [True: 0, Folded]
  |  |  ------------------
  |  | 2007|    987|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|    987|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2134|    987|            HUFv06_DECODE_SYMBOLX2_1(op4, &bitD4);
  ------------------
  |  | 2006|    987|    if (MEM_64bits() || (HUFv06_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1784|      0|#define HUFv06_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv06_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (2006:9): [True: 987, False: 0]
  |  |  |  Branch (2006:25): [True: 0, Folded]
  |  |  ------------------
  |  | 2007|    987|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|    987|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2135|    987|            HUFv06_DECODE_SYMBOLX2_2(op1, &bitD1);
  ------------------
  |  | 2010|    987|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2010:9): [True: 987, False: 0]
  |  |  ------------------
  |  | 2011|    987|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|    987|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2136|    987|            HUFv06_DECODE_SYMBOLX2_2(op2, &bitD2);
  ------------------
  |  | 2010|    987|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2010:9): [True: 987, False: 0]
  |  |  ------------------
  |  | 2011|    987|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|    987|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2137|    987|            HUFv06_DECODE_SYMBOLX2_2(op3, &bitD3);
  ------------------
  |  | 2010|    987|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2010:9): [True: 987, False: 0]
  |  |  ------------------
  |  | 2011|    987|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|    987|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2138|    987|            HUFv06_DECODE_SYMBOLX2_2(op4, &bitD4);
  ------------------
  |  | 2010|    987|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2010:9): [True: 987, False: 0]
  |  |  ------------------
  |  | 2011|    987|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|    987|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2139|    987|            HUFv06_DECODE_SYMBOLX2_0(op1, &bitD1);
  ------------------
  |  | 2003|    987|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2140|    987|            HUFv06_DECODE_SYMBOLX2_0(op2, &bitD2);
  ------------------
  |  | 2003|    987|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2141|    987|            HUFv06_DECODE_SYMBOLX2_0(op3, &bitD3);
  ------------------
  |  | 2003|    987|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2142|    987|            HUFv06_DECODE_SYMBOLX2_0(op4, &bitD4);
  ------------------
  |  | 2003|    987|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2143|    987|            endSignal = BITv06_reloadDStream(&bitD1) | BITv06_reloadDStream(&bitD2) | BITv06_reloadDStream(&bitD3) | BITv06_reloadDStream(&bitD4);
 2144|    987|        }
 2145|       |
 2146|       |        /* check corruption */
 2147|     86|        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 (2147:13): [True: 0, False: 86]
  ------------------
 2148|     86|        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 (2148:13): [True: 0, False: 86]
  ------------------
 2149|     86|        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 (2149:13): [True: 0, False: 86]
  ------------------
 2150|       |        /* note : op4 supposed already verified within main loop */
 2151|       |
 2152|       |        /* finish bitStreams one by one */
 2153|     86|        HUFv06_decodeStreamX2(op1, &bitD1, opStart2, dt, dtLog);
 2154|     86|        HUFv06_decodeStreamX2(op2, &bitD2, opStart3, dt, dtLog);
 2155|     86|        HUFv06_decodeStreamX2(op3, &bitD3, opStart4, dt, dtLog);
 2156|     86|        HUFv06_decodeStreamX2(op4, &bitD4, oend,     dt, dtLog);
 2157|       |
 2158|       |        /* check */
 2159|     86|        endSignal = BITv06_endOfDStream(&bitD1) & BITv06_endOfDStream(&bitD2) & BITv06_endOfDStream(&bitD3) & BITv06_endOfDStream(&bitD4);
 2160|     86|        if (!endSignal) return ERROR(corruption_detected);
  ------------------
  |  |   49|     86|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     86|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     86|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2160:13): [True: 86, False: 0]
  ------------------
 2161|       |
 2162|       |        /* decoded size */
 2163|      0|        return dstSize;
 2164|     86|    }
 2165|     86|}
HUFv06_decompress4X2:
 2169|    310|{
 2170|    310|    HUFv06_CREATE_STATIC_DTABLEX2(DTable, HUFv06_MAX_TABLELOG);
  ------------------
  |  | 1743|    310|        unsigned short DTable[HUFv06_DTABLE_SIZE(maxTableLog)] = { maxTableLog }
  ------------------
 2171|    310|    const BYTE* ip = (const BYTE*) cSrc;
 2172|       |
 2173|    310|    size_t const errorCode = HUFv06_readDTableX2 (DTable, cSrc, cSrcSize);
 2174|    310|    if (HUFv06_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (2174:9): [True: 95, False: 215]
  ------------------
 2175|    215|    if (errorCode >= 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 (2175:9): [True: 2, False: 213]
  ------------------
 2176|    213|    ip += errorCode;
 2177|    213|    cSrcSize -= errorCode;
 2178|       |
 2179|    213|    return HUFv06_decompress4X2_usingDTable (dst, dstSize, ip, cSrcSize, DTable);
 2180|    215|}
HUFv06_readDTableX4:
 2272|    655|{
 2273|    655|    BYTE weightList[HUFv06_MAX_SYMBOL_VALUE + 1];
 2274|    655|    sortedSymbol_t sortedSymbol[HUFv06_MAX_SYMBOL_VALUE + 1];
 2275|    655|    U32 rankStats[HUFv06_ABSOLUTEMAX_TABLELOG + 1] = { 0 };
 2276|    655|    U32 rankStart0[HUFv06_ABSOLUTEMAX_TABLELOG + 2] = { 0 };
 2277|    655|    U32* const rankStart = rankStart0+1;
 2278|    655|    rankVal_t rankVal;
 2279|    655|    U32 tableLog, maxW, sizeOfSort, nbSymbols;
 2280|    655|    const U32 memLog = DTable[0];
 2281|    655|    size_t iSize;
 2282|    655|    void* dtPtr = DTable;
 2283|    655|    HUFv06_DEltX4* const dt = ((HUFv06_DEltX4*)dtPtr) + 1;
 2284|       |
 2285|    655|    HUFv06_STATIC_ASSERT(sizeof(HUFv06_DEltX4) == sizeof(U32));   /* if compilation fails here, assertion is false */
  ------------------
  |  | 1929|    655|#define HUFv06_STATIC_ASSERT(c) { enum { HUFv06_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
 2286|    655|    if (memLog > HUFv06_ABSOLUTEMAX_TABLELOG) return ERROR(tableLog_tooLarge);
  ------------------
  |  | 1783|    655|#define HUFv06_ABSOLUTEMAX_TABLELOG  16   /* absolute limit of HUFv06_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
                  if (memLog > HUFv06_ABSOLUTEMAX_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 (2286:9): [True: 0, False: 655]
  ------------------
 2287|       |    /* memset(weightList, 0, sizeof(weightList)); */   /* is not necessary, even though some analyzer complain ... */
 2288|       |
 2289|    655|    iSize = HUFv06_readStats(weightList, HUFv06_MAX_SYMBOL_VALUE + 1, rankStats, &nbSymbols, &tableLog, src, srcSize);
  ------------------
  |  | 1786|    655|#define HUFv06_MAX_SYMBOL_VALUE 255
  ------------------
 2290|    655|    if (HUFv06_isError(iSize)) return iSize;
  ------------------
  |  Branch (2290:9): [True: 325, False: 330]
  ------------------
 2291|       |
 2292|       |    /* check result */
 2293|    330|    if (tableLog > memLog) return ERROR(tableLog_tooLarge);   /* DTable can't fit code depth */
  ------------------
  |  |   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 (2293:9): [True: 10, False: 320]
  ------------------
 2294|       |
 2295|       |    /* find maxWeight */
 2296|    623|    for (maxW = tableLog; rankStats[maxW]==0; maxW--) {}  /* necessarily finds a solution before 0 */
  ------------------
  |  Branch (2296:27): [True: 303, False: 320]
  ------------------
 2297|       |
 2298|       |    /* Get start index of each weight */
 2299|    320|    {   U32 w, nextRankStart = 0;
 2300|  1.73k|        for (w=1; w<maxW+1; w++) {
  ------------------
  |  Branch (2300:19): [True: 1.41k, False: 320]
  ------------------
 2301|  1.41k|            U32 current = nextRankStart;
 2302|  1.41k|            nextRankStart += rankStats[w];
 2303|  1.41k|            rankStart[w] = current;
 2304|  1.41k|        }
 2305|    320|        rankStart[0] = nextRankStart;   /* put all 0w symbols at the end of sorted list*/
 2306|    320|        sizeOfSort = nextRankStart;
 2307|    320|    }
 2308|       |
 2309|       |    /* sort symbols by weight */
 2310|    320|    {   U32 s;
 2311|  17.2k|        for (s=0; s<nbSymbols; s++) {
  ------------------
  |  Branch (2311:19): [True: 16.9k, False: 320]
  ------------------
 2312|  16.9k|            U32 const w = weightList[s];
 2313|  16.9k|            U32 const r = rankStart[w]++;
 2314|  16.9k|            sortedSymbol[r].symbol = (BYTE)s;
 2315|  16.9k|            sortedSymbol[r].weight = (BYTE)w;
 2316|  16.9k|        }
 2317|    320|        rankStart[0] = 0;   /* forget 0w symbols; this is beginning of weight(1) */
 2318|    320|    }
 2319|       |
 2320|       |    /* Build rankVal */
 2321|    320|    {   U32* const rankVal0 = rankVal[0];
 2322|    320|        {   int const rescale = (memLog-tableLog) - 1;   /* tableLog <= memLog */
 2323|    320|            U32 nextRankVal = 0;
 2324|    320|            U32 w;
 2325|  1.73k|            for (w=1; w<maxW+1; w++) {
  ------------------
  |  Branch (2325:23): [True: 1.41k, False: 320]
  ------------------
 2326|  1.41k|                U32 current = nextRankVal;
 2327|  1.41k|                nextRankVal += rankStats[w] << (w+rescale);
 2328|  1.41k|                rankVal0[w] = current;
 2329|  1.41k|        }   }
 2330|    320|        {   U32 const minBits = tableLog+1 - maxW;
 2331|    320|            U32 consumed;
 2332|  3.24k|            for (consumed = minBits; consumed < memLog - minBits + 1; consumed++) {
  ------------------
  |  Branch (2332:38): [True: 2.92k, False: 320]
  ------------------
 2333|  2.92k|                U32* const rankValPtr = rankVal[consumed];
 2334|  2.92k|                U32 w;
 2335|  16.2k|                for (w = 1; w < maxW+1; w++) {
  ------------------
  |  Branch (2335:29): [True: 13.2k, False: 2.92k]
  ------------------
 2336|  13.2k|                    rankValPtr[w] = rankVal0[w] >> consumed;
 2337|  13.2k|    }   }   }   }
 2338|       |
 2339|    320|    HUFv06_fillDTableX4(dt, memLog,
 2340|    320|                   sortedSymbol, sizeOfSort,
 2341|    320|                   rankStart0, rankVal, maxW,
 2342|    320|                   tableLog+1);
 2343|       |
 2344|    320|    return iSize;
 2345|    330|}
HUFv06_decompress1X4_usingDTable:
 2412|     65|{
 2413|     65|    const BYTE* const istart = (const BYTE*) cSrc;
 2414|     65|    BYTE* const ostart = (BYTE*) dst;
 2415|     65|    BYTE* const oend = ostart + dstSize;
 2416|       |
 2417|     65|    const U32 dtLog = DTable[0];
 2418|     65|    const void* const dtPtr = DTable;
 2419|     65|    const HUFv06_DEltX4* const dt = ((const HUFv06_DEltX4*)dtPtr) +1;
 2420|       |
 2421|       |    /* Init */
 2422|     65|    BITv06_DStream_t bitD;
 2423|     65|    { size_t const errorCode = BITv06_initDStream(&bitD, istart, cSrcSize);
 2424|     65|      if (HUFv06_isError(errorCode)) return errorCode; }
  ------------------
  |  Branch (2424:11): [True: 15, False: 50]
  ------------------
 2425|       |
 2426|       |    /* decode */
 2427|     50|    HUFv06_decodeStreamX4(ostart, &bitD, oend, dt, dtLog);
 2428|       |
 2429|       |    /* check */
 2430|     50|    if (!BITv06_endOfDStream(&bitD)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     47|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     47|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     47|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2430:9): [True: 47, False: 3]
  ------------------
 2431|       |
 2432|       |    /* decoded size */
 2433|      3|    return dstSize;
 2434|     50|}
HUFv06_decompress:
 2590|    338|{
 2591|    338|    static const decompressionAlgo decompress[3] = { HUFv06_decompress4X2, HUFv06_decompress4X4, NULL };
 2592|    338|    U32 Dtime[3];   /* decompression time estimation */
 2593|       |
 2594|       |    /* validation checks */
 2595|    338|    if (dstSize == 0) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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 (2595:9): [True: 1, False: 337]
  ------------------
 2596|    337|    if (cSrcSize > dstSize) return ERROR(corruption_detected);   /* invalid */
  ------------------
  |  |   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 (2596:9): [True: 7, False: 330]
  ------------------
 2597|    330|    if (cSrcSize == dstSize) { memcpy(dst, cSrc, dstSize); return dstSize; }   /* not compressed */
  ------------------
  |  Branch (2597:9): [True: 0, False: 330]
  ------------------
 2598|    330|    if (cSrcSize == 1) { memset(dst, *(const BYTE*)cSrc, dstSize); return dstSize; }   /* RLE */
  ------------------
  |  Branch (2598:9): [True: 20, False: 310]
  ------------------
 2599|       |
 2600|       |    /* decoder timing evaluation */
 2601|    310|    {   U32 const Q = (U32)(cSrcSize * 16 / dstSize);   /* Q < 16 since dstSize > cSrcSize */
 2602|    310|        U32 const D256 = (U32)(dstSize >> 8);
 2603|  1.24k|        U32 n; for (n=0; n<3; n++)
  ------------------
  |  Branch (2603:26): [True: 930, False: 310]
  ------------------
 2604|    930|            Dtime[n] = algoTime[Q][n].tableTime + (algoTime[Q][n].decode256Time * D256);
 2605|    310|    }
 2606|       |
 2607|    310|    Dtime[1] += Dtime[1] >> 4; Dtime[2] += Dtime[2] >> 3; /* advantage to algorithms using less memory, for cache eviction */
 2608|       |
 2609|    310|    {   U32 algoNb = 0;
 2610|    310|        if (Dtime[1] < Dtime[0]) algoNb = 1;
  ------------------
  |  Branch (2610:13): [True: 0, False: 310]
  ------------------
 2611|       |        /* if (Dtime[2] < Dtime[algoNb]) algoNb = 2; */   /* current speed of HUFv06_decompress4X6 is not good */
 2612|    310|        return decompress[algoNb](dst, dstSize, cSrc, cSrcSize);
 2613|    330|    }
 2614|       |
 2615|       |    /* return HUFv06_decompress4X2(dst, dstSize, cSrc, cSrcSize); */   /* multi-streams single-symbol decoding */
 2616|       |    /* return HUFv06_decompress4X4(dst, dstSize, cSrc, cSrcSize); */   /* multi-streams double-symbols decoding */
 2617|       |    /* return HUFv06_decompress4X6(dst, dstSize, cSrc, cSrcSize); */   /* multi-streams quad-symbols decoding */
 2618|    330|}
ZSTDv06_decompressBegin:
 2774|  3.25k|{
 2775|  3.25k|    dctx->expected = ZSTDv06_frameHeaderSize_min;
 2776|  3.25k|    dctx->stage = ZSTDds_getFrameHeaderSize;
 2777|  3.25k|    dctx->previousDstEnd = NULL;
 2778|  3.25k|    dctx->base = NULL;
 2779|  3.25k|    dctx->vBase = NULL;
 2780|  3.25k|    dctx->dictEnd = NULL;
 2781|  3.25k|    dctx->hufTableX4[0] = ZSTD_HUFFDTABLE_CAPACITY_LOG;
  ------------------
  |  |  426|  3.25k|#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
  ------------------
 2782|  3.25k|    dctx->flagRepeatTable = 0;
 2783|  3.25k|    return 0;
 2784|  3.25k|}
ZSTDv06_createDCtx:
 2787|  1.62k|{
 2788|  1.62k|    ZSTDv06_DCtx* dctx = (ZSTDv06_DCtx*)malloc(sizeof(ZSTDv06_DCtx));
 2789|  1.62k|    if (dctx==NULL) return NULL;
  ------------------
  |  Branch (2789:9): [True: 0, False: 1.62k]
  ------------------
 2790|  1.62k|    ZSTDv06_decompressBegin(dctx);
 2791|  1.62k|    return dctx;
 2792|  1.62k|}
ZSTDv06_freeDCtx:
 2795|  1.62k|{
 2796|  1.62k|    free(dctx);
 2797|  1.62k|    return 0;   /* reserved as a potential error code in the future */
 2798|  1.62k|}
ZSTDv06_getFrameParams:
 2925|  2.31k|{
 2926|  2.31k|    const BYTE* ip = (const BYTE*)src;
 2927|       |
 2928|  2.31k|    if (srcSize < ZSTDv06_frameHeaderSize_min) return ZSTDv06_frameHeaderSize_min;
  ------------------
  |  Branch (2928:9): [True: 0, False: 2.31k]
  ------------------
 2929|  2.31k|    if (MEM_readLE32(src) != ZSTDv06_MAGICNUMBER) return ERROR(prefix_unknown);
  ------------------
  |  |  164|  2.31k|#define ZSTDv06_MAGICNUMBER 0xFD2FB526   /* v0.6 */
  ------------------
                  if (MEM_readLE32(src) != ZSTDv06_MAGICNUMBER) return ERROR(prefix_unknown);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2929:9): [True: 0, False: 2.31k]
  ------------------
 2930|       |
 2931|       |    /* ensure there is enough `srcSize` to fully read/decode frame header */
 2932|  2.31k|    { size_t const fhsize = ZSTDv06_frameHeaderSize(src, srcSize);
 2933|  2.31k|      if (srcSize < fhsize) return fhsize; }
  ------------------
  |  Branch (2933:11): [True: 0, False: 2.31k]
  ------------------
 2934|       |
 2935|  2.31k|    memset(fparamsPtr, 0, sizeof(*fparamsPtr));
 2936|  2.31k|    {   BYTE const frameDesc = ip[4];
 2937|  2.31k|        fparamsPtr->windowLog = (frameDesc & 0xF) + ZSTDv06_WINDOWLOG_ABSOLUTEMIN;
  ------------------
  |  |  416|  2.31k|#define ZSTDv06_WINDOWLOG_ABSOLUTEMIN 12
  ------------------
 2938|  2.31k|        if ((frameDesc & 0x20) != 0) return ERROR(frameParameter_unsupported);   /* reserved 1 bit */
  ------------------
  |  |   49|     23|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     23|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     23|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2938:13): [True: 23, False: 2.29k]
  ------------------
 2939|  2.29k|        switch(frameDesc >> 6)  /* fcsId */
 2940|  2.29k|        {
 2941|      0|            default:   /* impossible */
  ------------------
  |  Branch (2941:13): [True: 0, False: 2.29k]
  ------------------
 2942|  1.92k|            case 0 : fparamsPtr->frameContentSize = 0; break;
  ------------------
  |  Branch (2942:13): [True: 1.92k, False: 371]
  ------------------
 2943|     23|            case 1 : fparamsPtr->frameContentSize = ip[5]; break;
  ------------------
  |  Branch (2943:13): [True: 23, False: 2.26k]
  ------------------
 2944|    228|            case 2 : fparamsPtr->frameContentSize = MEM_readLE16(ip+5)+256; break;
  ------------------
  |  Branch (2944:13): [True: 228, False: 2.06k]
  ------------------
 2945|    120|            case 3 : fparamsPtr->frameContentSize = MEM_readLE64(ip+5); break;
  ------------------
  |  Branch (2945:13): [True: 120, False: 2.17k]
  ------------------
 2946|  2.29k|    }   }
 2947|  2.29k|    return 0;
 2948|  2.29k|}
ZSTDv06_decompress_usingDict:
 3581|  1.62k|{
 3582|  1.62k|    ZSTDv06_decompressBegin_usingDict(dctx, dict, dictSize);
 3583|  1.62k|    ZSTDv06_checkContinuity(dctx, dst);
 3584|  1.62k|    return ZSTDv06_decompressFrame(dctx, dst, dstCapacity, src, srcSize);
 3585|  1.62k|}
ZSTDv06_findFrameSizeInfoLegacy:
 3618|  1.70k|{
 3619|  1.70k|    const BYTE* ip = (const BYTE*)src;
 3620|  1.70k|    size_t remainingSize = srcSize;
 3621|  1.70k|    size_t nbBlocks = 0;
 3622|  1.70k|    blockProperties_t blockProperties = { bt_compressed, 0 };
 3623|       |
 3624|       |    /* Frame Header */
 3625|  1.70k|    {   size_t const frameHeaderSize = ZSTDv06_frameHeaderSize(src, srcSize);
 3626|  1.70k|        if (ZSTDv06_isError(frameHeaderSize)) {
  ------------------
  |  | 2731|  1.70k|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3626:13): [True: 0, False: 1.70k]
  ------------------
 3627|      0|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, frameHeaderSize);
 3628|      0|            return;
 3629|      0|        }
 3630|  1.70k|        if (MEM_readLE32(src) != ZSTDv06_MAGICNUMBER) {
  ------------------
  |  |  164|  1.70k|#define ZSTDv06_MAGICNUMBER 0xFD2FB526   /* v0.6 */
  ------------------
  |  Branch (3630:13): [True: 0, False: 1.70k]
  ------------------
 3631|      0|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(prefix_unknown));
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3632|      0|            return;
 3633|      0|        }
 3634|  1.70k|        if (srcSize < frameHeaderSize+ZSTDv06_blockHeaderSize) {
  ------------------
  |  Branch (3634:13): [True: 1, False: 1.70k]
  ------------------
 3635|      1|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(srcSize_wrong));
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3636|      1|            return;
 3637|      1|        }
 3638|  1.70k|        ip += frameHeaderSize; remainingSize -= frameHeaderSize;
 3639|  1.70k|    }
 3640|       |
 3641|       |    /* Loop on each block */
 3642|  3.89k|    while (1) {
  ------------------
  |  Branch (3642:12): [True: 3.89k, Folded]
  ------------------
 3643|  3.89k|        size_t const cBlockSize = ZSTDv06_getcBlockSize(ip, remainingSize, &blockProperties);
 3644|  3.89k|        if (ZSTDv06_isError(cBlockSize)) {
  ------------------
  |  | 2731|  3.89k|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3644:13): [True: 2, False: 3.89k]
  ------------------
 3645|      2|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, cBlockSize);
 3646|      2|            return;
 3647|      2|        }
 3648|       |
 3649|  3.89k|        ip += ZSTDv06_blockHeaderSize;
 3650|  3.89k|        remainingSize -= ZSTDv06_blockHeaderSize;
 3651|  3.89k|        if (cBlockSize > remainingSize) {
  ------------------
  |  Branch (3651:13): [True: 74, False: 3.81k]
  ------------------
 3652|     74|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(srcSize_wrong));
  ------------------
  |  |   49|     74|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     74|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     74|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3653|     74|            return;
 3654|     74|        }
 3655|       |
 3656|  3.81k|        if (cBlockSize == 0) break;   /* bt_end */
  ------------------
  |  Branch (3656:13): [True: 1.62k, False: 2.18k]
  ------------------
 3657|       |
 3658|  2.18k|        ip += cBlockSize;
 3659|  2.18k|        remainingSize -= cBlockSize;
 3660|  2.18k|        nbBlocks++;
 3661|  2.18k|    }
 3662|       |
 3663|  1.62k|    *cSize = ip - (const BYTE*)src;
 3664|  1.62k|    *dBound = nbBlocks * ZSTDv06_BLOCKSIZE_MAX;
  ------------------
  |  |  344|  1.62k|#define ZSTDv06_BLOCKSIZE_MAX (128 * 1024)   /* define, for static allocation */
  ------------------
 3665|  1.62k|}
ZSTDv06_decompressBegin_usingDict:
 3827|  1.62k|{
 3828|  1.62k|    { size_t const errorCode = ZSTDv06_decompressBegin(dctx);
 3829|  1.62k|      if (ZSTDv06_isError(errorCode)) return errorCode; }
  ------------------
  |  | 2731|  1.62k|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3829:11): [True: 0, False: 1.62k]
  ------------------
 3830|       |
 3831|  1.62k|    if (dict && dictSize) {
  ------------------
  |  Branch (3831:9): [True: 1.62k, False: 0]
  |  Branch (3831:17): [True: 732, False: 897]
  ------------------
 3832|    732|        size_t const errorCode = ZSTDv06_decompress_insertDictionary(dctx, dict, dictSize);
 3833|    732|        if (ZSTDv06_isError(errorCode)) return ERROR(dictionary_corrupted);
  ------------------
  |  | 2731|    732|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
                      if (ZSTDv06_isError(errorCode)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|    509|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    509|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    509|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3833:13): [True: 509, False: 223]
  ------------------
 3834|    732|    }
 3835|       |
 3836|  1.12k|    return 0;
 3837|  1.62k|}
zstd_v06.c:MEM_readLE32:
  190|  34.6k|{
  191|  34.6k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (191:9): [True: 34.6k, False: 0]
  ------------------
  192|  34.6k|        return MEM_read32(memPtr);
  193|      0|    else
  194|      0|        return MEM_swap32(MEM_read32(memPtr));
  195|  34.6k|}
zstd_v06.c:MEM_isLittleEndian:
  108|   253k|{
  109|   253k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  110|   253k|    return one.c[0];
  111|   253k|}
zstd_v06.c:MEM_read32:
  119|  34.6k|{
  120|  34.6k|    U32 val; memcpy(&val, memPtr, sizeof(val)); return val;
  121|  34.6k|}
zstd_v06.c:FSEv06_abs:
 1205|  25.9k|static short FSEv06_abs(short a) { return a<0 ? -a : a; }
  ------------------
  |  Branch (1205:43): [True: 12.6k, False: 13.3k]
  ------------------
zstd_v06.c:BITv06_highbit32:
  802|   794k|{
  803|       |#   if defined(_MSC_VER)   /* Visual */
  804|       |    unsigned long r;
  805|       |    return _BitScanReverse(&r, val) ? (unsigned)r : 0;
  806|       |#   elif defined(__GNUC__) && (__GNUC__ >= 3)   /* Use GCC Intrinsic */
  807|       |    return __builtin_clz (val) ^ 31;
  808|       |#   else   /* Software version */
  809|       |    static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 };
  810|       |    U32 v = val;
  811|       |    unsigned r;
  812|       |    v |= v >> 1;
  813|       |    v |= v >> 2;
  814|       |    v |= v >> 4;
  815|       |    v |= v >> 8;
  816|       |    v |= v >> 16;
  817|       |    r = DeBruijnClz[ (U32) (v * 0x07C4ACDDU) >> 27];
  818|       |    return r;
  819|       |#   endif
  820|   794k|}
zstd_v06.c:FSEv06_decompress_usingDTable_generic:
 1515|    785|{
 1516|    785|    BYTE* const ostart = (BYTE*) dst;
 1517|    785|    BYTE* op = ostart;
 1518|    785|    BYTE* const omax = op + maxDstSize;
 1519|    785|    BYTE* const olimit = omax-3;
 1520|       |
 1521|    785|    BITv06_DStream_t bitD;
 1522|    785|    FSEv06_DState_t state1;
 1523|    785|    FSEv06_DState_t state2;
 1524|       |
 1525|       |    /* Init */
 1526|    785|    { size_t const errorCode = BITv06_initDStream(&bitD, cSrc, cSrcSize);   /* replaced last arg by maxCompressed Size */
 1527|    785|      if (FSEv06_isError(errorCode)) return errorCode; }
  ------------------
  |  | 1357|    785|#define FSEv06_isError ERR_isError
  ------------------
  |  Branch (1527:11): [True: 50, False: 735]
  ------------------
 1528|       |
 1529|    735|    FSEv06_initDState(&state1, &bitD, dt);
 1530|    735|    FSEv06_initDState(&state2, &bitD, dt);
 1531|       |
 1532|    735|#define FSEv06_GETSYMBOL(statePtr) fast ? FSEv06_decodeSymbolFast(statePtr, &bitD) : FSEv06_decodeSymbol(statePtr, &bitD)
 1533|       |
 1534|       |    /* 4 symbols per loop */
 1535|  7.75k|    for ( ; (BITv06_reloadDStream(&bitD)==BITv06_DStream_unfinished) && (op<olimit) ; op+=4) {
  ------------------
  |  Branch (1535:13): [True: 7.06k, False: 688]
  |  Branch (1535:73): [True: 7.02k, False: 47]
  ------------------
 1536|  7.02k|        op[0] = FSEv06_GETSYMBOL(&state1);
  ------------------
  |  | 1532|  7.02k|#define FSEv06_GETSYMBOL(statePtr) fast ? FSEv06_decodeSymbolFast(statePtr, &bitD) : FSEv06_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1532:36): [True: 2.72k, False: 4.29k]
  |  |  ------------------
  ------------------
 1537|       |
 1538|  7.02k|        if (FSEv06_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  | 1134|  7.02k|#define FSEv06_MAX_TABLELOG  (FSEv06_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  | 1111|  7.02k|#define FSEv06_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (1538:13): [Folded, False: 7.02k]
  ------------------
 1539|      0|            BITv06_reloadDStream(&bitD);
 1540|       |
 1541|  7.02k|        op[1] = FSEv06_GETSYMBOL(&state2);
  ------------------
  |  | 1532|  7.02k|#define FSEv06_GETSYMBOL(statePtr) fast ? FSEv06_decodeSymbolFast(statePtr, &bitD) : FSEv06_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1532:36): [True: 2.72k, False: 4.29k]
  |  |  ------------------
  ------------------
 1542|       |
 1543|  7.02k|        if (FSEv06_MAX_TABLELOG*4+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  | 1134|  7.02k|#define FSEv06_MAX_TABLELOG  (FSEv06_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  | 1111|  7.02k|#define FSEv06_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (1543:13): [Folded, False: 7.02k]
  ------------------
 1544|      0|            { if (BITv06_reloadDStream(&bitD) > BITv06_DStream_unfinished) { op+=2; break; } }
  ------------------
  |  Branch (1544:19): [True: 0, False: 0]
  ------------------
 1545|       |
 1546|  7.02k|        op[2] = FSEv06_GETSYMBOL(&state1);
  ------------------
  |  | 1532|  7.02k|#define FSEv06_GETSYMBOL(statePtr) fast ? FSEv06_decodeSymbolFast(statePtr, &bitD) : FSEv06_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1532:36): [True: 2.72k, False: 4.29k]
  |  |  ------------------
  ------------------
 1547|       |
 1548|  7.02k|        if (FSEv06_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  | 1134|  7.02k|#define FSEv06_MAX_TABLELOG  (FSEv06_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  | 1111|  7.02k|#define FSEv06_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (1548:13): [Folded, False: 7.02k]
  ------------------
 1549|      0|            BITv06_reloadDStream(&bitD);
 1550|       |
 1551|  7.02k|        op[3] = FSEv06_GETSYMBOL(&state2);
  ------------------
  |  | 1532|  7.02k|#define FSEv06_GETSYMBOL(statePtr) fast ? FSEv06_decodeSymbolFast(statePtr, &bitD) : FSEv06_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1532:36): [True: 2.72k, False: 4.29k]
  |  |  ------------------
  ------------------
 1552|  7.02k|    }
 1553|       |
 1554|       |    /* tail */
 1555|       |    /* note : BITv06_reloadDStream(&bitD) >= FSEv06_DStream_partiallyFilled; Ends at exactly BITv06_DStream_completed */
 1556|  10.0k|    while (1) {
  ------------------
  |  Branch (1556:12): [True: 10.0k, Folded]
  ------------------
 1557|  10.0k|        if (op>(omax-2)) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1557:13): [True: 60, False: 9.95k]
  ------------------
 1558|       |
 1559|  9.95k|        *op++ = FSEv06_GETSYMBOL(&state1);
  ------------------
  |  | 1532|  9.95k|#define FSEv06_GETSYMBOL(statePtr) fast ? FSEv06_decodeSymbolFast(statePtr, &bitD) : FSEv06_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1532:36): [True: 2.03k, False: 7.91k]
  |  |  ------------------
  ------------------
 1560|       |
 1561|  9.95k|        if (BITv06_reloadDStream(&bitD)==BITv06_DStream_overflow) {
  ------------------
  |  Branch (1561:13): [True: 397, False: 9.55k]
  ------------------
 1562|    397|            *op++ = FSEv06_GETSYMBOL(&state2);
  ------------------
  |  | 1532|    397|#define FSEv06_GETSYMBOL(statePtr) fast ? FSEv06_decodeSymbolFast(statePtr, &bitD) : FSEv06_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1532:36): [True: 123, False: 274]
  |  |  ------------------
  ------------------
 1563|    397|            break;
 1564|    397|        }
 1565|       |
 1566|  9.55k|        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 (1566:13): [True: 0, False: 9.55k]
  ------------------
 1567|       |
 1568|  9.55k|        *op++ = FSEv06_GETSYMBOL(&state2);
  ------------------
  |  | 1532|  9.55k|#define FSEv06_GETSYMBOL(statePtr) fast ? FSEv06_decodeSymbolFast(statePtr, &bitD) : FSEv06_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1532:36): [True: 1.91k, False: 7.64k]
  |  |  ------------------
  ------------------
 1569|       |
 1570|  9.55k|        if (BITv06_reloadDStream(&bitD)==BITv06_DStream_overflow) {
  ------------------
  |  Branch (1570:13): [True: 278, False: 9.27k]
  ------------------
 1571|    278|            *op++ = FSEv06_GETSYMBOL(&state1);
  ------------------
  |  | 1532|    278|#define FSEv06_GETSYMBOL(statePtr) fast ? FSEv06_decodeSymbolFast(statePtr, &bitD) : FSEv06_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1532:36): [True: 88, False: 190]
  |  |  ------------------
  ------------------
 1572|    278|            break;
 1573|    278|    }   }
 1574|       |
 1575|    675|    return op-ostart;
 1576|    735|}
zstd_v06.c:FSEv06_initDState:
 1053|  2.23k|{
 1054|  2.23k|    const void* ptr = dt;
 1055|  2.23k|    const FSEv06_DTableHeader* const DTableH = (const FSEv06_DTableHeader*)ptr;
 1056|  2.23k|    DStatePtr->state = BITv06_readBits(bitD, DTableH->tableLog);
 1057|  2.23k|    BITv06_reloadDStream(bitD);
 1058|  2.23k|    DStatePtr->table = dt + 1;
 1059|  2.23k|}
zstd_v06.c:BITv06_readBits:
  888|   318k|{
  889|   318k|    size_t const value = BITv06_lookBits(bitD, nbBits);
  890|   318k|    BITv06_skipBits(bitD, nbBits);
  891|   318k|    return value;
  892|   318k|}
zstd_v06.c:BITv06_lookBits:
  869|   318k|{
  870|   318k|    U32 const bitMask = sizeof(bitD->bitContainer)*8 - 1;
  871|   318k|    return ((bitD->bitContainer << (bitD->bitsConsumed & bitMask)) >> 1) >> ((bitMask-nbBits) & bitMask);
  872|   318k|}
zstd_v06.c:BITv06_skipBits:
  883|  4.49M|{
  884|  4.49M|    bitD->bitsConsumed += nbBits;
  885|  4.49M|}
zstd_v06.c:FSEv06_decodeSymbolFast:
 1089|  15.0k|{
 1090|  15.0k|    FSEv06_decode_t const DInfo = ((const FSEv06_decode_t*)(DStatePtr->table))[DStatePtr->state];
 1091|  15.0k|    U32 const nbBits = DInfo.nbBits;
 1092|  15.0k|    BYTE const symbol = DInfo.symbol;
 1093|  15.0k|    size_t const lowBits = BITv06_readBitsFast(bitD, nbBits);
 1094|       |
 1095|  15.0k|    DStatePtr->state = DInfo.newState + lowBits;
 1096|  15.0k|    return symbol;
 1097|  15.0k|}
zstd_v06.c:BITv06_readBitsFast:
  897|  15.0k|{
  898|  15.0k|    size_t const value = BITv06_lookBitsFast(bitD, nbBits);
  899|  15.0k|    BITv06_skipBits(bitD, nbBits);
  900|  15.0k|    return value;
  901|  15.0k|}
zstd_v06.c:BITv06_lookBitsFast:
  877|  4.17M|{
  878|  4.17M|    U32 const bitMask = sizeof(bitD->bitContainer)*8 - 1;
  879|  4.17M|    return (bitD->bitContainer << (bitD->bitsConsumed & bitMask)) >> (((bitMask+1)-nbBits) & bitMask);
  880|  4.17M|}
zstd_v06.c:FSEv06_decodeSymbol:
 1076|  33.2k|{
 1077|  33.2k|    FSEv06_decode_t const DInfo = ((const FSEv06_decode_t*)(DStatePtr->table))[DStatePtr->state];
 1078|  33.2k|    U32 const nbBits = DInfo.nbBits;
 1079|  33.2k|    BYTE const symbol = DInfo.symbol;
 1080|  33.2k|    size_t const lowBits = BITv06_readBits(bitD, nbBits);
 1081|       |
 1082|  33.2k|    DStatePtr->state = DInfo.newState + lowBits;
 1083|  33.2k|    return symbol;
 1084|  33.2k|}
zstd_v06.c:HUFv06_readStats:
 1801|  1.07k|{
 1802|  1.07k|    U32 weightTotal;
 1803|  1.07k|    const BYTE* ip = (const BYTE*) src;
 1804|  1.07k|    size_t iSize;
 1805|  1.07k|    size_t oSize;
 1806|       |
 1807|  1.07k|    if (!srcSize) 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 (1807:9): [True: 14, False: 1.06k]
  ------------------
 1808|  1.06k|    iSize = ip[0];
 1809|       |    /* memset(huffWeight, 0, hwSize); */   /* is not necessary, even though some analyzer complain ... */
 1810|       |
 1811|  1.06k|    if (iSize >= 128)  { /* special header */
  ------------------
  |  Branch (1811:9): [True: 200, False: 860]
  ------------------
 1812|    200|        if (iSize >= (242)) {  /* RLE */
  ------------------
  |  Branch (1812:13): [True: 171, False: 29]
  ------------------
 1813|    171|            static U32 l[14] = { 1, 2, 3, 4, 7, 8, 15, 16, 31, 32, 63, 64, 127, 128 };
 1814|    171|            oSize = l[iSize-242];
 1815|    171|            memset(huffWeight, 1, hwSize);
 1816|    171|            iSize = 0;
 1817|    171|        }
 1818|     29|        else {   /* Incompressible */
 1819|     29|            oSize = iSize - 127;
 1820|     29|            iSize = ((oSize+1)/2);
 1821|     29|            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 (1821:17): [True: 11, False: 18]
  ------------------
 1822|     18|            if (oSize >= hwSize) return ERROR(corruption_detected);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1822:17): [True: 0, False: 18]
  ------------------
 1823|     18|            ip += 1;
 1824|     18|            {   U32 n;
 1825|    332|                for (n=0; n<oSize; n+=2) {
  ------------------
  |  Branch (1825:27): [True: 314, False: 18]
  ------------------
 1826|    314|                    huffWeight[n]   = ip[n/2] >> 4;
 1827|    314|                    huffWeight[n+1] = ip[n/2] & 15;
 1828|    314|    }   }   }   }
 1829|    860|    else  {   /* header compressed with FSE (normal case) */
 1830|    860|        if (iSize+1 > srcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      7|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      7|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      7|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1830:13): [True: 7, False: 853]
  ------------------
 1831|    853|        oSize = FSEv06_decompress(huffWeight, hwSize-1, ip+1, iSize);   /* max (hwSize-1) values decoded, as last one is implied */
 1832|    853|        if (FSEv06_isError(oSize)) return oSize;
  ------------------
  |  | 1357|    853|#define FSEv06_isError ERR_isError
  ------------------
  |  Branch (1832:13): [True: 178, False: 675]
  ------------------
 1833|    853|    }
 1834|       |
 1835|       |    /* collect weight stats */
 1836|    864|    memset(rankStats, 0, (HUFv06_ABSOLUTEMAX_TABLELOG + 1) * sizeof(U32));
  ------------------
  |  | 1783|    864|#define HUFv06_ABSOLUTEMAX_TABLELOG  16   /* absolute limit of HUFv06_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
 1837|    864|    weightTotal = 0;
 1838|  43.4k|    {   U32 n; for (n=0; n<oSize; n++) {
  ------------------
  |  Branch (1838:26): [True: 42.6k, False: 808]
  ------------------
 1839|  42.6k|            if (huffWeight[n] >= HUFv06_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected);
  ------------------
  |  | 1783|  42.6k|#define HUFv06_ABSOLUTEMAX_TABLELOG  16   /* absolute limit of HUFv06_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
                          if (huffWeight[n] >= HUFv06_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected);
  ------------------
  |  |   49|     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 (1839:17): [True: 56, False: 42.6k]
  ------------------
 1840|  42.6k|            rankStats[huffWeight[n]]++;
 1841|  42.6k|            weightTotal += (1 << huffWeight[n]) >> 1;
 1842|  42.6k|    }   }
 1843|    808|    if (weightTotal == 0) return ERROR(corruption_detected);
  ------------------
  |  |   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 (1843:9): [True: 11, False: 797]
  ------------------
 1844|       |
 1845|       |    /* get last non-null symbol weight (implied, total must be 2^n) */
 1846|    797|    {   U32 const tableLog = BITv06_highbit32(weightTotal) + 1;
 1847|    797|        if (tableLog > HUFv06_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected);
  ------------------
  |  | 1783|    797|#define HUFv06_ABSOLUTEMAX_TABLELOG  16   /* absolute limit of HUFv06_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
                      if (tableLog > HUFv06_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected);
  ------------------
  |  |   49|     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 (1847:13): [True: 14, False: 783]
  ------------------
 1848|    783|        *tableLogPtr = tableLog;
 1849|       |        /* determine last weight */
 1850|    783|        {   U32 const total = 1 << tableLog;
 1851|    783|            U32 const rest = total - weightTotal;
 1852|    783|            U32 const verif = 1 << BITv06_highbit32(rest);
 1853|    783|            U32 const lastWeight = BITv06_highbit32(rest) + 1;
 1854|    783|            if (verif != rest) return ERROR(corruption_detected);    /* last value must be a clean power of 2 */
  ------------------
  |  |   49|    116|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    116|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    116|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1854:17): [True: 116, False: 667]
  ------------------
 1855|    667|            huffWeight[oSize] = (BYTE)lastWeight;
 1856|    667|            rankStats[lastWeight]++;
 1857|    667|    }   }
 1858|       |
 1859|       |    /* check tree construction validity */
 1860|    667|    if ((rankStats[1] < 2) || (rankStats[1] & 1)) return ERROR(corruption_detected);   /* by construction : at least 2 elts of rank 1, must be even */
  ------------------
  |  |   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 (1860:9): [True: 27, False: 640]
  |  Branch (1860:31): [True: 0, False: 640]
  ------------------
 1861|       |
 1862|       |    /* results */
 1863|    640|    *nbSymbolsPtr = (U32)(oSize+1);
 1864|    640|    return iSize+1;
 1865|    667|}
zstd_v06.c:HUFv06_isError:
 1199|  2.19k|static unsigned HUFv06_isError(size_t code) { return ERR_isError(code); }
zstd_v06.c:BITv06_initDStream:
  834|  1.77k|{
  835|  1.77k|    if (srcSize < 1) { memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (835:9): [True: 12, False: 1.76k]
  ------------------
  836|       |
  837|  1.76k|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (837:9): [True: 1.22k, False: 537]
  ------------------
  838|  1.22k|        bitD->start = (const char*)srcBuffer;
  839|  1.22k|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  840|  1.22k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  841|  1.22k|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  842|  1.22k|          if (lastByte == 0) return ERROR(GENERIC);   /* endMark not present */
  ------------------
  |  |   49|    148|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    148|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    148|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (842:15): [True: 148, False: 1.07k]
  ------------------
  843|  1.07k|          bitD->bitsConsumed = 8 - BITv06_highbit32(lastByte); }
  844|  1.07k|    } else {
  845|    537|        bitD->start = (const char*)srcBuffer;
  846|    537|        bitD->ptr   = bitD->start;
  847|    537|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  848|    537|        switch(srcSize)
  849|    537|        {
  850|     43|            case 7: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);/* fall-through */
  ------------------
  |  Branch (850:13): [True: 43, False: 494]
  ------------------
  851|     81|            case 6: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);/* fall-through */
  ------------------
  |  Branch (851:13): [True: 38, False: 499]
  ------------------
  852|    175|            case 5: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);/* fall-through */
  ------------------
  |  Branch (852:13): [True: 94, False: 443]
  ------------------
  853|    318|            case 4: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[3]) << 24; /* fall-through */
  ------------------
  |  Branch (853:13): [True: 143, False: 394]
  ------------------
  854|    382|            case 3: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[2]) << 16; /* fall-through */
  ------------------
  |  Branch (854:13): [True: 64, False: 473]
  ------------------
  855|    473|            case 2: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[1]) <<  8; /* fall-through */
  ------------------
  |  Branch (855:13): [True: 91, False: 446]
  ------------------
  856|    537|            default: break;
  ------------------
  |  Branch (856:13): [True: 64, False: 473]
  ------------------
  857|    537|        }
  858|    537|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  859|    537|          if (lastByte == 0) return ERROR(GENERIC);   /* endMark not present */
  ------------------
  |  |   49|     49|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     49|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     49|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (859:15): [True: 49, False: 488]
  ------------------
  860|    488|          bitD->bitsConsumed = 8 - BITv06_highbit32(lastByte); }
  861|      0|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  862|    488|    }
  863|       |
  864|  1.56k|    return srcSize;
  865|  1.76k|}
zstd_v06.c:MEM_readLEST:
  208|   109k|{
  209|   109k|    if (MEM_32bits())
  ------------------
  |  Branch (209:9): [True: 0, False: 109k]
  ------------------
  210|      0|        return (size_t)MEM_readLE32(memPtr);
  211|   109k|    else
  212|   109k|        return (size_t)MEM_readLE64(memPtr);
  213|   109k|}
zstd_v06.c:MEM_32bits:
  104|   390k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_v06.c:HUFv06_decodeStreamX2:
 2014|    413|{
 2015|    413|    BYTE* const pStart = p;
 2016|       |
 2017|       |    /* up to 4 symbols at a time */
 2018|  5.06k|    while ((BITv06_reloadDStream(bitDPtr) == BITv06_DStream_unfinished) && (p <= pEnd-4)) {
  ------------------
  |  Branch (2018:12): [True: 4.69k, False: 367]
  |  Branch (2018:76): [True: 4.64k, False: 46]
  ------------------
 2019|  4.64k|        HUFv06_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 2010|  4.64k|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2010:9): [True: 4.64k, False: 0]
  |  |  ------------------
  |  | 2011|  4.64k|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|  4.64k|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2020|  4.64k|        HUFv06_DECODE_SYMBOLX2_1(p, bitDPtr);
  ------------------
  |  | 2006|  4.64k|    if (MEM_64bits() || (HUFv06_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1784|      0|#define HUFv06_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv06_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (2006:9): [True: 4.64k, False: 0]
  |  |  |  Branch (2006:25): [True: 0, Folded]
  |  |  ------------------
  |  | 2007|  4.64k|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|  4.64k|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2021|  4.64k|        HUFv06_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 2010|  4.64k|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2010:9): [True: 4.64k, False: 0]
  |  |  ------------------
  |  | 2011|  4.64k|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|  4.64k|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2022|  4.64k|        HUFv06_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 2003|  4.64k|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2023|  4.64k|    }
 2024|       |
 2025|       |    /* closer to the end */
 2026|    478|    while ((BITv06_reloadDStream(bitDPtr) == BITv06_DStream_unfinished) && (p < pEnd))
  ------------------
  |  Branch (2026:12): [True: 100, False: 378]
  |  Branch (2026:76): [True: 65, False: 35]
  ------------------
 2027|     65|        HUFv06_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 2003|     65|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2028|       |
 2029|       |    /* no more data to retrieve from bitstream, hence no need to reload */
 2030|  4.12M|    while (p < pEnd)
  ------------------
  |  Branch (2030:12): [True: 4.12M, False: 413]
  ------------------
 2031|  4.12M|        HUFv06_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 2003|  4.12M|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2032|       |
 2033|    413|    return pEnd-pStart;
 2034|    413|}
zstd_v06.c:BITv06_endOfDStream:
  935|    463|{
  936|    463|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (936:13): [True: 414, False: 49]
  |  Branch (936:49): [True: 6, False: 408]
  ------------------
  937|    463|}
zstd_v06.c:MEM_readLE16:
  169|    895|{
  170|    895|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (170:9): [True: 895, False: 0]
  ------------------
  171|    895|        return MEM_read16(memPtr);
  172|      0|    else {
  173|      0|        const BYTE* p = (const BYTE*)memPtr;
  174|      0|        return (U16)(p[0] + (p[1]<<8));
  175|      0|    }
  176|    895|}
zstd_v06.c:MEM_read16:
  114|    895|{
  115|    895|    U16 val; memcpy(&val, memPtr, sizeof(val)); return val;
  116|    895|}
zstd_v06.c:BITv06_reloadDStream:
  904|   131k|{
  905|   131k|    if (bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))  /* should never happen */
  ------------------
  |  Branch (905:9): [True: 1.06k, False: 130k]
  ------------------
  906|  1.06k|        return BITv06_DStream_overflow;
  907|       |
  908|   130k|    if (bitD->ptr >= bitD->start + sizeof(bitD->bitContainer)) {
  ------------------
  |  Branch (908:9): [True: 102k, False: 27.7k]
  ------------------
  909|   102k|        bitD->ptr -= bitD->bitsConsumed >> 3;
  910|   102k|        bitD->bitsConsumed &= 7;
  911|   102k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  912|   102k|        return BITv06_DStream_unfinished;
  913|   102k|    }
  914|  27.7k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (914:9): [True: 21.8k, False: 5.86k]
  ------------------
  915|  21.8k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BITv06_DStream_endOfBuffer;
  ------------------
  |  Branch (915:13): [True: 21.2k, False: 612]
  ------------------
  916|    612|        return BITv06_DStream_completed;
  917|  21.8k|    }
  918|  5.86k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  919|  5.86k|        BITv06_DStream_status result = BITv06_DStream_unfinished;
  920|  5.86k|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (920:13): [True: 253, False: 5.60k]
  ------------------
  921|    253|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  922|    253|            result = BITv06_DStream_endOfBuffer;
  923|    253|        }
  924|  5.86k|        bitD->ptr -= nbBytes;
  925|  5.86k|        bitD->bitsConsumed -= nbBytes*8;
  926|  5.86k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD) */
  927|  5.86k|        return result;
  928|  27.7k|    }
  929|  27.7k|}
zstd_v06.c:MEM_64bits:
  105|  26.9k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_v06.c:HUFv06_decodeSymbolX2:
 1995|  4.15M|{
 1996|  4.15M|    const size_t val = BITv06_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */
 1997|  4.15M|    const BYTE c = dt[val].byte;
 1998|  4.15M|    BITv06_skipBits(Dstream, dt[val].nbBits);
 1999|  4.15M|    return c;
 2000|  4.15M|}
zstd_v06.c:HUFv06_fillDTableX4:
 2233|    320|{
 2234|    320|    U32 rankVal[HUFv06_ABSOLUTEMAX_TABLELOG + 1];
 2235|    320|    const int scaleLog = nbBitsBaseline - targetLog;   /* note : targetLog >= srcLog, hence scaleLog <= 1 */
 2236|    320|    const U32 minBits  = nbBitsBaseline - maxWeight;
 2237|    320|    U32 s;
 2238|       |
 2239|    320|    memcpy(rankVal, rankValOrigin, sizeof(rankVal));
 2240|       |
 2241|       |    /* fill DTable */
 2242|  15.2k|    for (s=0; s<sortedListSize; s++) {
  ------------------
  |  Branch (2242:15): [True: 14.9k, False: 320]
  ------------------
 2243|  14.9k|        const U16 symbol = sortedList[s].symbol;
 2244|  14.9k|        const U32 weight = sortedList[s].weight;
 2245|  14.9k|        const U32 nbBits = nbBitsBaseline - weight;
 2246|  14.9k|        const U32 start = rankVal[weight];
 2247|  14.9k|        const U32 length = 1 << (targetLog-nbBits);
 2248|       |
 2249|  14.9k|        if (targetLog-nbBits >= minBits) {   /* enough room for a second symbol */
  ------------------
  |  Branch (2249:13): [True: 11.0k, False: 3.84k]
  ------------------
 2250|  11.0k|            U32 sortedRank;
 2251|  11.0k|            int minWeight = nbBits + scaleLog;
 2252|  11.0k|            if (minWeight < 1) minWeight = 1;
  ------------------
  |  Branch (2252:17): [True: 1.39k, False: 9.69k]
  ------------------
 2253|  11.0k|            sortedRank = rankStart[minWeight];
 2254|  11.0k|            HUFv06_fillDTableX4Level2(DTable+start, targetLog-nbBits, nbBits,
 2255|  11.0k|                           rankValOrigin[nbBits], minWeight,
 2256|  11.0k|                           sortedList+sortedRank, sortedListSize-sortedRank,
 2257|  11.0k|                           nbBitsBaseline, symbol);
 2258|  11.0k|        } else {
 2259|  3.84k|            HUFv06_DEltX4 DElt;
 2260|  3.84k|            MEM_writeLE16(&(DElt.sequence), symbol);
 2261|  3.84k|            DElt.nbBits = (BYTE)(nbBits);
 2262|  3.84k|            DElt.length = 1;
 2263|  3.84k|            {   U32 u;
 2264|  3.84k|                const U32 end = start + length;
 2265|  98.9k|                for (u = start; u < end; u++) DTable[u] = DElt;
  ------------------
  |  Branch (2265:33): [True: 95.1k, False: 3.84k]
  ------------------
 2266|  3.84k|        }   }
 2267|  14.9k|        rankVal[weight] += length;
 2268|  14.9k|    }
 2269|    320|}
zstd_v06.c:HUFv06_fillDTableX4Level2:
 2191|  11.0k|{
 2192|  11.0k|    HUFv06_DEltX4 DElt;
 2193|  11.0k|    U32 rankVal[HUFv06_ABSOLUTEMAX_TABLELOG + 1];
 2194|       |
 2195|       |    /* get pre-calculated rankVal */
 2196|  11.0k|    memcpy(rankVal, rankValOrigin, sizeof(rankVal));
 2197|       |
 2198|       |    /* fill skipped values */
 2199|  11.0k|    if (minWeight>1) {
  ------------------
  |  Branch (2199:9): [True: 9.21k, False: 1.87k]
  ------------------
 2200|  9.21k|        U32 i, skipSize = rankVal[minWeight];
 2201|  9.21k|        MEM_writeLE16(&(DElt.sequence), baseSeq);
 2202|  9.21k|        DElt.nbBits   = (BYTE)(consumed);
 2203|  9.21k|        DElt.length   = 1;
 2204|   143k|        for (i = 0; i < skipSize; i++)
  ------------------
  |  Branch (2204:21): [True: 134k, False: 9.21k]
  ------------------
 2205|   134k|            DTable[i] = DElt;
 2206|  9.21k|    }
 2207|       |
 2208|       |    /* fill DTable */
 2209|   105k|    { U32 s; for (s=0; s<sortedListSize; s++) {   /* note : sortedSymbols already skipped */
  ------------------
  |  Branch (2209:24): [True: 94.5k, False: 11.0k]
  ------------------
 2210|  94.5k|        const U32 symbol = sortedSymbols[s].symbol;
 2211|  94.5k|        const U32 weight = sortedSymbols[s].weight;
 2212|  94.5k|        const U32 nbBits = nbBitsBaseline - weight;
 2213|  94.5k|        const U32 length = 1 << (sizeLog-nbBits);
 2214|  94.5k|        const U32 start = rankVal[weight];
 2215|  94.5k|        U32 i = start;
 2216|  94.5k|        const U32 end = start + length;
 2217|       |
 2218|  94.5k|        MEM_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8)));
 2219|  94.5k|        DElt.nbBits = (BYTE)(nbBits + consumed);
 2220|  94.5k|        DElt.length = 2;
 2221|  1.08M|        do { DTable[i++] = DElt; } while (i<end);   /* since length >= 1 */
  ------------------
  |  Branch (2221:43): [True: 986k, False: 94.5k]
  ------------------
 2222|       |
 2223|  94.5k|        rankVal[weight] += length;
 2224|  94.5k|    }}
 2225|  11.0k|}
zstd_v06.c:MEM_writeLE16:
  179|   107k|{
  180|   107k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (180:9): [True: 107k, False: 0]
  ------------------
  181|   107k|        MEM_write16(memPtr, val);
  182|   107k|    } else {
  183|      0|        BYTE* p = (BYTE*)memPtr;
  184|      0|        p[0] = (BYTE)val;
  185|      0|        p[1] = (BYTE)(val>>8);
  186|      0|    }
  187|   107k|}
zstd_v06.c:MEM_write16:
  129|   107k|{
  130|   107k|    memcpy(memPtr, &value, sizeof(value));
  131|   107k|}
zstd_v06.c:HUFv06_decodeStreamX4:
 2383|     50|{
 2384|     50|    BYTE* const pStart = p;
 2385|       |
 2386|       |    /* up to 8 symbols at a time */
 2387|    433|    while ((BITv06_reloadDStream(bitDPtr) == BITv06_DStream_unfinished) && (p < pEnd-7)) {
  ------------------
  |  Branch (2387:12): [True: 404, False: 29]
  |  Branch (2387:76): [True: 383, False: 21]
  ------------------
 2388|    383|        HUFv06_DECODE_SYMBOLX4_2(p, bitDPtr);
  ------------------
  |  | 2379|    383|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2379:9): [True: 383, False: 0]
  |  |  ------------------
  |  | 2380|    383|        ptr += HUFv06_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2389|    383|        HUFv06_DECODE_SYMBOLX4_1(p, bitDPtr);
  ------------------
  |  | 2375|    383|    if (MEM_64bits() || (HUFv06_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1784|      0|#define HUFv06_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv06_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (2375:9): [True: 383, False: 0]
  |  |  |  Branch (2375:25): [True: 0, Folded]
  |  |  ------------------
  |  | 2376|    383|        ptr += HUFv06_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2390|    383|        HUFv06_DECODE_SYMBOLX4_2(p, bitDPtr);
  ------------------
  |  | 2379|    383|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2379:9): [True: 383, False: 0]
  |  |  ------------------
  |  | 2380|    383|        ptr += HUFv06_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2391|    383|        HUFv06_DECODE_SYMBOLX4_0(p, bitDPtr);
  ------------------
  |  | 2372|    383|    ptr += HUFv06_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2392|    383|    }
 2393|       |
 2394|       |    /* closer to the end */
 2395|     88|    while ((BITv06_reloadDStream(bitDPtr) == BITv06_DStream_unfinished) && (p <= pEnd-2))
  ------------------
  |  Branch (2395:12): [True: 55, False: 33]
  |  Branch (2395:76): [True: 38, False: 17]
  ------------------
 2396|     38|        HUFv06_DECODE_SYMBOLX4_0(p, bitDPtr);
  ------------------
  |  | 2372|     38|    ptr += HUFv06_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2397|       |
 2398|  1.88k|    while (p <= pEnd-2)
  ------------------
  |  Branch (2398:12): [True: 1.83k, False: 50]
  ------------------
 2399|  1.83k|        HUFv06_DECODE_SYMBOLX4_0(p, bitDPtr);   /* no need to reload : reached the end of DStream */
  ------------------
  |  | 2372|  1.83k|    ptr += HUFv06_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2400|       |
 2401|     50|    if (p < pEnd)
  ------------------
  |  Branch (2401:9): [True: 30, False: 20]
  ------------------
 2402|     30|        p += HUFv06_decodeLastSymbolX4(p, bitDPtr, dt, dtLog);
 2403|       |
 2404|     50|    return p-pStart;
 2405|     50|}
zstd_v06.c:HUFv06_decodeLastSymbolX4:
 2357|     30|{
 2358|     30|    const size_t val = BITv06_lookBitsFast(DStream, dtLog);   /* note : dtLog >= 1 */
 2359|     30|    memcpy(op, dt+val, 1);
 2360|     30|    if (dt[val].length==1) BITv06_skipBits(DStream, dt[val].nbBits);
  ------------------
  |  Branch (2360:9): [True: 13, False: 17]
  ------------------
 2361|     17|    else {
 2362|     17|        if (DStream->bitsConsumed < (sizeof(DStream->bitContainer)*8)) {
  ------------------
  |  Branch (2362:13): [True: 13, False: 4]
  ------------------
 2363|     13|            BITv06_skipBits(DStream, dt[val].nbBits);
 2364|     13|            if (DStream->bitsConsumed > (sizeof(DStream->bitContainer)*8))
  ------------------
  |  Branch (2364:17): [True: 2, False: 11]
  ------------------
 2365|      2|                DStream->bitsConsumed = (sizeof(DStream->bitContainer)*8);   /* ugly hack; works only because it's the last symbol. Note : can't easily extract nbBits from just this symbol */
 2366|     13|    }   }
 2367|     30|    return 1;
 2368|     30|}
zstd_v06.c:HUFv06_decodeSymbolX4:
 2349|  3.40k|{
 2350|  3.40k|    const size_t val = BITv06_lookBitsFast(DStream, dtLog);   /* note : dtLog >= 1 */
 2351|  3.40k|    memcpy(op, dt+val, 2);
 2352|  3.40k|    BITv06_skipBits(DStream, dt[val].nbBits);
 2353|  3.40k|    return dt[val].length;
 2354|  3.40k|}
zstd_v06.c:ZSTDv06_frameHeaderSize:
 2912|  5.64k|{
 2913|  5.64k|    if (srcSize < ZSTDv06_frameHeaderSize_min) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2913:9): [True: 0, False: 5.64k]
  ------------------
 2914|  5.64k|    { U32 const fcsId = (((const BYTE*)src)[4]) >> 6;
 2915|  5.64k|      return ZSTDv06_frameHeaderSize_min + ZSTDv06_fcs_fieldSize[fcsId]; }
 2916|  5.64k|}
zstd_v06.c:MEM_readLE64:
  199|   109k|{
  200|   109k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (200:9): [True: 109k, False: 0]
  ------------------
  201|   109k|        return MEM_read64(memPtr);
  202|      0|    else
  203|      0|        return MEM_swap64(MEM_read64(memPtr));
  204|   109k|}
zstd_v06.c:MEM_read64:
  124|   109k|{
  125|   109k|    U64 val; memcpy(&val, memPtr, sizeof(val)); return val;
  126|   109k|}
zstd_v06.c:ZSTDv06_checkContinuity:
 3465|  1.62k|{
 3466|  1.62k|    if (dst != dctx->previousDstEnd) {   /* not contiguous */
  ------------------
  |  Branch (3466:9): [True: 1.62k, False: 0]
  ------------------
 3467|  1.62k|        dctx->dictEnd = dctx->previousDstEnd;
 3468|  1.62k|        dctx->vBase = (const char*)dst - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->base));
 3469|  1.62k|        dctx->base = dst;
 3470|  1.62k|        dctx->previousDstEnd = dst;
 3471|  1.62k|    }
 3472|  1.62k|}
zstd_v06.c:ZSTDv06_decompressBlock_internal:
 3478|  1.15k|{   /* blockType == blockCompressed */
 3479|  1.15k|    const BYTE* ip = (const BYTE*)src;
 3480|       |
 3481|  1.15k|    if (srcSize >= ZSTDv06_BLOCKSIZE_MAX) return ERROR(srcSize_wrong);
  ------------------
  |  |  344|  1.15k|#define ZSTDv06_BLOCKSIZE_MAX (128 * 1024)   /* define, for static allocation */
  ------------------
                  if (srcSize >= ZSTDv06_BLOCKSIZE_MAX) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3481:9): [True: 0, False: 1.15k]
  ------------------
 3482|       |
 3483|       |    /* Decode literals sub-block */
 3484|  1.15k|    {   size_t const litCSize = ZSTDv06_decodeLiteralsBlock(dctx, src, srcSize);
 3485|  1.15k|        if (ZSTDv06_isError(litCSize)) return litCSize;
  ------------------
  |  | 2731|  1.15k|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3485:13): [True: 777, False: 382]
  ------------------
 3486|    382|        ip += litCSize;
 3487|    382|        srcSize -= litCSize;
 3488|    382|    }
 3489|      0|    return ZSTDv06_decompressSequences(dctx, dst, dstCapacity, ip, srcSize);
 3490|  1.15k|}
zstd_v06.c:ZSTDv06_decodeLiteralsBlock:
 3000|  1.15k|{
 3001|  1.15k|    const BYTE* const istart = (const BYTE*) src;
 3002|       |
 3003|       |    /* any compressed block with literals segment must be at least this size */
 3004|  1.15k|    if (srcSize < MIN_CBLOCK_SIZE) return ERROR(corruption_detected);
  ------------------
  |  |  424|  1.15k|#define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */ + MIN_SEQUENCES_SIZE /* nbSeq==0 */)   /* for a non-null block */
  |  |  ------------------
  |  |  |  |  423|  1.15k|#define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */
  |  |  ------------------
  ------------------
                  if (srcSize < MIN_CBLOCK_SIZE) return ERROR(corruption_detected);
  ------------------
  |  |   49|    213|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    213|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    213|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3004:9): [True: 213, False: 946]
  ------------------
 3005|       |
 3006|    946|    switch(istart[0]>> 6)
 3007|    946|    {
 3008|    488|    case IS_HUF:
  ------------------
  |  |  428|    488|#define IS_HUF 0
  ------------------
  |  Branch (3008:5): [True: 488, False: 458]
  ------------------
 3009|    488|        {   size_t litSize, litCSize, singleStream=0;
 3010|    488|            U32 lhSize = ((istart[0]) >> 4) & 3;
 3011|    488|            if (srcSize < 5) return ERROR(corruption_detected);   /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for lhSize, + cSize (+nbSeq) */
  ------------------
  |  |   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 (3011:17): [True: 2, False: 486]
  ------------------
 3012|    486|            switch(lhSize)
 3013|    486|            {
 3014|    233|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (3014:13): [True: 120, False: 366]
  |  Branch (3014:21): [True: 113, False: 373]
  |  Branch (3014:29): [True: 0, False: 486]
  ------------------
 3015|       |                /* 2 - 2 - 10 - 10 */
 3016|    233|                lhSize=3;
 3017|    233|                singleStream = istart[0] & 16;
 3018|    233|                litSize  = ((istart[0] & 15) << 6) + (istart[1] >> 2);
 3019|    233|                litCSize = ((istart[1] &  3) << 8) + istart[2];
 3020|    233|                break;
 3021|     57|            case 2:
  ------------------
  |  Branch (3021:13): [True: 57, False: 429]
  ------------------
 3022|       |                /* 2 - 2 - 14 - 14 */
 3023|     57|                lhSize=4;
 3024|     57|                litSize  = ((istart[0] & 15) << 10) + (istart[1] << 2) + (istart[2] >> 6);
 3025|     57|                litCSize = ((istart[2] & 63) <<  8) + istart[3];
 3026|     57|                break;
 3027|    196|            case 3:
  ------------------
  |  Branch (3027:13): [True: 196, False: 290]
  ------------------
 3028|       |                /* 2 - 2 - 18 - 18 */
 3029|    196|                lhSize=5;
 3030|    196|                litSize  = ((istart[0] & 15) << 14) + (istart[1] << 6) + (istart[2] >> 2);
 3031|    196|                litCSize = ((istart[2] &  3) << 16) + (istart[3] << 8) + istart[4];
 3032|    196|                break;
 3033|    486|            }
 3034|    486|            if (litSize > ZSTDv06_BLOCKSIZE_MAX) return ERROR(corruption_detected);
  ------------------
  |  |  344|    486|#define ZSTDv06_BLOCKSIZE_MAX (128 * 1024)   /* define, for static allocation */
  ------------------
                          if (litSize > ZSTDv06_BLOCKSIZE_MAX) 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 (3034:17): [True: 1, False: 485]
  ------------------
 3035|    485|            if (litCSize + lhSize > srcSize) return ERROR(corruption_detected);
  ------------------
  |  |   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 (3035:17): [True: 38, False: 447]
  ------------------
 3036|       |
 3037|    447|            if (HUFv06_isError(singleStream ?
  ------------------
  |  | 2733|    447|#define HUFv06_isError  ERR_isError
  ------------------
  |  Branch (3037:17): [True: 426, False: 21]
  |  Branch (3037:32): [True: 109, False: 338]
  ------------------
 3038|    109|                            HUFv06_decompress1X2(dctx->litBuffer, litSize, istart+lhSize, litCSize) :
 3039|    447|                            HUFv06_decompress   (dctx->litBuffer, litSize, istart+lhSize, litCSize) ))
 3040|    426|                return ERROR(corruption_detected);
  ------------------
  |  |   49|    426|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    426|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    426|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3041|       |
 3042|     21|            dctx->litPtr = dctx->litBuffer;
 3043|     21|            dctx->litSize = litSize;
 3044|     21|            memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |  487|     21|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3045|     21|            return litCSize + lhSize;
 3046|    447|        }
 3047|     77|    case IS_PCH:
  ------------------
  |  |  429|     77|#define IS_PCH 1
  ------------------
  |  Branch (3047:5): [True: 77, False: 869]
  ------------------
 3048|     77|        {   size_t litSize, litCSize;
 3049|     77|            U32 lhSize = ((istart[0]) >> 4) & 3;
 3050|     77|            if (lhSize != 1)  /* only case supported for now : small litSize, single stream */
  ------------------
  |  Branch (3050:17): [True: 1, False: 76]
  ------------------
 3051|      1|                return ERROR(corruption_detected);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3052|     76|            if (!dctx->flagRepeatTable)
  ------------------
  |  Branch (3052:17): [True: 9, False: 67]
  ------------------
 3053|      9|                return ERROR(dictionary_corrupted);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3054|       |
 3055|       |            /* 2 - 2 - 10 - 10 */
 3056|     67|            lhSize=3;
 3057|     67|            litSize  = ((istart[0] & 15) << 6) + (istart[1] >> 2);
 3058|     67|            litCSize = ((istart[1] &  3) << 8) + istart[2];
 3059|     67|            if (litCSize + lhSize > srcSize) 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 (3059:17): [True: 2, False: 65]
  ------------------
 3060|       |
 3061|     65|            {   size_t const errorCode = HUFv06_decompress1X4_usingDTable(dctx->litBuffer, litSize, istart+lhSize, litCSize, dctx->hufTableX4);
 3062|     65|                if (HUFv06_isError(errorCode)) return ERROR(corruption_detected);
  ------------------
  |  | 2733|     65|#define HUFv06_isError  ERR_isError
  ------------------
                              if (HUFv06_isError(errorCode)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     62|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     62|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     62|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3062:21): [True: 62, False: 3]
  ------------------
 3063|     65|            }
 3064|      3|            dctx->litPtr = dctx->litBuffer;
 3065|      3|            dctx->litSize = litSize;
 3066|      3|            memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |  487|      3|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3067|      3|            return litCSize + lhSize;
 3068|     65|        }
 3069|     48|    case IS_RAW:
  ------------------
  |  |  430|     48|#define IS_RAW 2
  ------------------
  |  Branch (3069:5): [True: 48, False: 898]
  ------------------
 3070|     48|        {   size_t litSize;
 3071|     48|            U32 lhSize = ((istart[0]) >> 4) & 3;
 3072|     48|            switch(lhSize)
 3073|     48|            {
 3074|     25|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (3074:13): [True: 11, False: 37]
  |  Branch (3074:21): [True: 14, False: 34]
  |  Branch (3074:29): [True: 0, False: 48]
  ------------------
 3075|     25|                lhSize=1;
 3076|     25|                litSize = istart[0] & 31;
 3077|     25|                break;
 3078|      9|            case 2:
  ------------------
  |  Branch (3078:13): [True: 9, False: 39]
  ------------------
 3079|      9|                litSize = ((istart[0] & 15) << 8) + istart[1];
 3080|      9|                break;
 3081|     14|            case 3:
  ------------------
  |  Branch (3081:13): [True: 14, False: 34]
  ------------------
 3082|     14|                litSize = ((istart[0] & 15) << 16) + (istart[1] << 8) + istart[2];
 3083|     14|                break;
 3084|     48|            }
 3085|       |
 3086|     48|            if (lhSize+litSize+WILDCOPY_OVERLENGTH > srcSize) {  /* risk reading beyond src buffer with wildcopy */
  ------------------
  |  |  487|     48|#define WILDCOPY_OVERLENGTH 8
  ------------------
  |  Branch (3086:17): [True: 26, False: 22]
  ------------------
 3087|     26|                if (litSize+lhSize > srcSize) return ERROR(corruption_detected);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3087:21): [True: 21, False: 5]
  ------------------
 3088|      5|                memcpy(dctx->litBuffer, istart+lhSize, litSize);
 3089|      5|                dctx->litPtr = dctx->litBuffer;
 3090|      5|                dctx->litSize = litSize;
 3091|      5|                memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |  487|      5|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3092|      5|                return lhSize+litSize;
 3093|     26|            }
 3094|       |            /* direct reference into compressed stream */
 3095|     22|            dctx->litPtr = istart+lhSize;
 3096|     22|            dctx->litSize = litSize;
 3097|     22|            return lhSize+litSize;
 3098|     48|        }
 3099|    333|    case IS_RLE:
  ------------------
  |  |  431|    333|#define IS_RLE 3
  ------------------
  |  Branch (3099:5): [True: 333, False: 613]
  ------------------
 3100|    333|        {   size_t litSize;
 3101|    333|            U32 lhSize = ((istart[0]) >> 4) & 3;
 3102|    333|            switch(lhSize)
 3103|    333|            {
 3104|     27|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (3104:13): [True: 10, False: 323]
  |  Branch (3104:21): [True: 17, False: 316]
  |  Branch (3104:29): [True: 0, False: 333]
  ------------------
 3105|     27|                lhSize = 1;
 3106|     27|                litSize = istart[0] & 31;
 3107|     27|                break;
 3108|    259|            case 2:
  ------------------
  |  Branch (3108:13): [True: 259, False: 74]
  ------------------
 3109|    259|                litSize = ((istart[0] & 15) << 8) + istart[1];
 3110|    259|                break;
 3111|     47|            case 3:
  ------------------
  |  Branch (3111:13): [True: 47, False: 286]
  ------------------
 3112|     47|                litSize = ((istart[0] & 15) << 16) + (istart[1] << 8) + istart[2];
 3113|     47|                if (srcSize<4) return ERROR(corruption_detected);   /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need lhSize+1 = 4 */
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3113:21): [True: 1, False: 46]
  ------------------
 3114|     46|                break;
 3115|    333|            }
 3116|    332|            if (litSize > ZSTDv06_BLOCKSIZE_MAX) return ERROR(corruption_detected);
  ------------------
  |  |  344|    332|#define ZSTDv06_BLOCKSIZE_MAX (128 * 1024)   /* define, for static allocation */
  ------------------
                          if (litSize > ZSTDv06_BLOCKSIZE_MAX) 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 (3116:17): [True: 1, False: 331]
  ------------------
 3117|    331|            memset(dctx->litBuffer, istart[lhSize], litSize + WILDCOPY_OVERLENGTH);
  ------------------
  |  |  487|    331|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3118|    331|            dctx->litPtr = dctx->litBuffer;
 3119|    331|            dctx->litSize = litSize;
 3120|    331|            return lhSize+1;
 3121|    332|        }
 3122|      0|    default:
  ------------------
  |  Branch (3122:5): [True: 0, False: 946]
  ------------------
 3123|      0|        return ERROR(corruption_detected);   /* impossible */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3124|    946|    }
 3125|    946|}
zstd_v06.c:ZSTDv06_decompressSequences:
 3391|    382|{
 3392|    382|    const BYTE* ip = (const BYTE*)seqStart;
 3393|    382|    const BYTE* const iend = ip + seqSize;
 3394|    382|    BYTE* const ostart = (BYTE*)dst;
 3395|    382|    BYTE* const oend = ostart + maxDstSize;
 3396|    382|    BYTE* op = ostart;
 3397|    382|    const BYTE* litPtr = dctx->litPtr;
 3398|    382|    const BYTE* const litEnd = litPtr + dctx->litSize;
 3399|    382|    FSEv06_DTable* DTableLL = dctx->LLTable;
 3400|    382|    FSEv06_DTable* DTableML = dctx->MLTable;
 3401|    382|    FSEv06_DTable* DTableOffb = dctx->OffTable;
 3402|    382|    const BYTE* const base = (const BYTE*) (dctx->base);
 3403|    382|    const BYTE* const vBase = (const BYTE*) (dctx->vBase);
 3404|    382|    const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd);
 3405|    382|    int nbSeq;
 3406|       |
 3407|       |    /* Build Decoding Tables */
 3408|    382|    {   size_t const seqHSize = ZSTDv06_decodeSeqHeaders(&nbSeq, DTableLL, DTableML, DTableOffb, dctx->flagRepeatTable, ip, seqSize);
 3409|    382|        if (ZSTDv06_isError(seqHSize)) return seqHSize;
  ------------------
  |  | 2731|    382|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3409:13): [True: 65, False: 317]
  ------------------
 3410|    317|        ip += seqHSize;
 3411|    317|        dctx->flagRepeatTable = 0;
 3412|    317|    }
 3413|       |
 3414|       |    /* Regen sequences */
 3415|    317|    if (nbSeq) {
  ------------------
  |  Branch (3415:9): [True: 284, False: 33]
  ------------------
 3416|    284|        seq_t sequence;
 3417|    284|        seqState_t seqState;
 3418|       |
 3419|    284|        memset(&sequence, 0, sizeof(sequence));
 3420|    284|        sequence.offset = REPCODE_STARTVALUE;
  ------------------
  |  |  437|    284|#define REPCODE_STARTVALUE 1
  ------------------
 3421|  1.13k|        { U32 i; for (i=0; i<ZSTDv06_REP_INIT; i++) seqState.prevOffset[i] = REPCODE_STARTVALUE; }
  ------------------
  |  |  402|  1.13k|#define ZSTDv06_REP_INIT   ZSTDv06_REP_NUM
  |  |  ------------------
  |  |  |  |  401|  1.13k|#define ZSTDv06_REP_NUM    3
  |  |  ------------------
  ------------------
                      { U32 i; for (i=0; i<ZSTDv06_REP_INIT; i++) seqState.prevOffset[i] = REPCODE_STARTVALUE; }
  ------------------
  |  |  437|    852|#define REPCODE_STARTVALUE 1
  ------------------
  |  Branch (3421:28): [True: 852, False: 284]
  ------------------
 3422|    284|        { size_t const errorCode = BITv06_initDStream(&(seqState.DStream), ip, iend-ip);
 3423|    284|          if (ERR_isError(errorCode)) return ERROR(corruption_detected); }
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3423:15): [True: 29, False: 255]
  ------------------
 3424|    255|        FSEv06_initDState(&(seqState.stateLL), &(seqState.DStream), DTableLL);
 3425|    255|        FSEv06_initDState(&(seqState.stateOffb), &(seqState.DStream), DTableOffb);
 3426|    255|        FSEv06_initDState(&(seqState.stateML), &(seqState.DStream), DTableML);
 3427|       |
 3428|  91.5k|        for ( ; (BITv06_reloadDStream(&(seqState.DStream)) <= BITv06_DStream_completed) && nbSeq ; ) {
  ------------------
  |  Branch (3428:17): [True: 91.4k, False: 91]
  |  Branch (3428:92): [True: 91.4k, False: 12]
  ------------------
 3429|  91.4k|            nbSeq--;
 3430|  91.4k|            ZSTDv06_decodeSequence(&sequence, &seqState);
 3431|       |
 3432|       |#if 0  /* debug */
 3433|       |            static BYTE* start = NULL;
 3434|       |            if (start==NULL) start = op;
 3435|       |            size_t pos = (size_t)(op-start);
 3436|       |            if ((pos >= 5810037) && (pos < 5810400))
 3437|       |                printf("Dpos %6u :%5u literals & match %3u bytes at distance %6u \n",
 3438|       |                       pos, (U32)sequence.litLength, (U32)sequence.matchLength, (U32)sequence.offset);
 3439|       |#endif
 3440|       |
 3441|  91.4k|            {   size_t const oneSeqSize = ZSTDv06_execSequence(op, oend, sequence, &litPtr, litEnd, base, vBase, dictEnd);
 3442|  91.4k|                if (ZSTDv06_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  | 2731|  91.4k|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3442:21): [True: 152, False: 91.3k]
  ------------------
 3443|  91.3k|                op += oneSeqSize;
 3444|  91.3k|        }   }
 3445|       |
 3446|       |        /* check if reached exact end */
 3447|    103|        if (nbSeq) return ERROR(corruption_detected);
  ------------------
  |  |   49|     87|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     87|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     87|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3447:13): [True: 87, False: 16]
  ------------------
 3448|    103|    }
 3449|       |
 3450|       |    /* last literal segment */
 3451|     49|    {   size_t const lastLLSize = litEnd - litPtr;
 3452|     49|        if (litPtr > litEnd) return ERROR(corruption_detected);   /* too many literals already used */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3452:13): [True: 0, False: 49]
  ------------------
 3453|     49|        if (op+lastLLSize > oend) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   49|      4|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      4|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      4|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3453:13): [True: 4, False: 45]
  ------------------
 3454|     45|        if (lastLLSize > 0) {
  ------------------
  |  Branch (3454:13): [True: 41, False: 4]
  ------------------
 3455|     41|            memcpy(op, litPtr, lastLLSize);
 3456|     41|            op += lastLLSize;
 3457|     41|        }
 3458|     45|    }
 3459|       |
 3460|      0|    return op-ostart;
 3461|     49|}
zstd_v06.c:ZSTDv06_decodeSeqHeaders:
 3165|    382|{
 3166|    382|    const BYTE* const istart = (const BYTE*)src;
 3167|    382|    const BYTE* const iend = istart + srcSize;
 3168|    382|    const BYTE* ip = istart;
 3169|       |
 3170|       |    /* check */
 3171|    382|    if (srcSize < MIN_SEQUENCES_SIZE) return ERROR(srcSize_wrong);
  ------------------
  |  |  423|    382|#define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */
  ------------------
                  if (srcSize < MIN_SEQUENCES_SIZE) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3171:9): [True: 1, False: 381]
  ------------------
 3172|       |
 3173|       |    /* SeqHead */
 3174|    381|    {   int nbSeq = *ip++;
 3175|    381|        if (!nbSeq) { *nbSeqPtr=0; return 1; }
  ------------------
  |  Branch (3175:13): [True: 28, False: 353]
  ------------------
 3176|    353|        if (nbSeq > 0x7F) {
  ------------------
  |  Branch (3176:13): [True: 164, False: 189]
  ------------------
 3177|    164|            if (nbSeq == 0xFF) {
  ------------------
  |  Branch (3177:17): [True: 52, False: 112]
  ------------------
 3178|     52|                if (ip+2 > iend) 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 (3178:21): [True: 3, False: 49]
  ------------------
 3179|     49|                nbSeq = MEM_readLE16(ip) + LONGNBSEQ, ip+=2;
  ------------------
  |  |  433|     49|#define LONGNBSEQ 0x7F00
  ------------------
 3180|    112|            } else {
 3181|    112|                if (ip >= iend) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3181:21): [True: 1, False: 111]
  ------------------
 3182|    111|                nbSeq = ((nbSeq-0x80)<<8) + *ip++;
 3183|    111|            }
 3184|    164|        }
 3185|    349|        *nbSeqPtr = nbSeq;
 3186|    349|    }
 3187|       |
 3188|       |    /* FSE table descriptors */
 3189|    349|    if (ip + 4 > iend) return ERROR(srcSize_wrong); /* min : header byte + all 3 are "raw", hence no header, but at least xxLog bits per type */
  ------------------
  |  |   49|      4|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      4|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      4|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3189:9): [True: 4, False: 345]
  ------------------
 3190|    345|    {   U32 const LLtype  = *ip >> 6;
 3191|    345|        U32 const Offtype = (*ip >> 4) & 3;
 3192|    345|        U32 const MLtype  = (*ip >> 2) & 3;
 3193|    345|        ip++;
 3194|       |
 3195|       |        /* Build DTables */
 3196|    345|        {   size_t const bhSize = ZSTDv06_buildSeqTable(DTableLL, LLtype, MaxLL, LLFSELog, ip, iend-ip, LL_defaultNorm, LL_defaultNormLog, flagRepeatTable);
  ------------------
  |  |  442|    345|#define MaxLL  35
  ------------------
                      {   size_t const bhSize = ZSTDv06_buildSeqTable(DTableLL, LLtype, MaxLL, LLFSELog, ip, iend-ip, LL_defaultNorm, LL_defaultNormLog, flagRepeatTable);
  ------------------
  |  |  446|    345|#define LLFSELog    9
  ------------------
 3197|    345|            if (ZSTDv06_isError(bhSize)) return ERROR(corruption_detected);
  ------------------
  |  | 2731|    345|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
                          if (ZSTDv06_isError(bhSize)) return ERROR(corruption_detected);
  ------------------
  |  |   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 (3197:17): [True: 13, False: 332]
  ------------------
 3198|    332|            ip += bhSize;
 3199|    332|        }
 3200|    332|        {   size_t const bhSize = ZSTDv06_buildSeqTable(DTableOffb, Offtype, MaxOff, OffFSELog, ip, iend-ip, OF_defaultNorm, OF_defaultNormLog, flagRepeatTable);
  ------------------
  |  |  443|    332|#define MaxOff 28
  ------------------
                      {   size_t const bhSize = ZSTDv06_buildSeqTable(DTableOffb, Offtype, MaxOff, OffFSELog, ip, iend-ip, OF_defaultNorm, OF_defaultNormLog, flagRepeatTable);
  ------------------
  |  |  447|    332|#define OffFSELog   8
  ------------------
 3201|    332|            if (ZSTDv06_isError(bhSize)) return ERROR(corruption_detected);
  ------------------
  |  | 2731|    332|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
                          if (ZSTDv06_isError(bhSize)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     23|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     23|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     23|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3201:17): [True: 23, False: 309]
  ------------------
 3202|    309|            ip += bhSize;
 3203|    309|        }
 3204|    309|        {   size_t const bhSize = ZSTDv06_buildSeqTable(DTableML, MLtype, MaxML, MLFSELog, ip, iend-ip, ML_defaultNorm, ML_defaultNormLog, flagRepeatTable);
  ------------------
  |  |  441|    309|#define MaxML  52
  ------------------
                      {   size_t const bhSize = ZSTDv06_buildSeqTable(DTableML, MLtype, MaxML, MLFSELog, ip, iend-ip, ML_defaultNorm, ML_defaultNormLog, flagRepeatTable);
  ------------------
  |  |  445|    309|#define MLFSELog    9
  ------------------
 3205|    309|            if (ZSTDv06_isError(bhSize)) return ERROR(corruption_detected);
  ------------------
  |  | 2731|    309|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
                          if (ZSTDv06_isError(bhSize)) return ERROR(corruption_detected);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3205:17): [True: 20, False: 289]
  ------------------
 3206|    289|            ip += bhSize;
 3207|    289|    }   }
 3208|       |
 3209|      0|    return ip-istart;
 3210|    309|}
zstd_v06.c:ZSTDv06_buildSeqTable:
 3135|    986|{
 3136|    986|    switch(type)
 3137|    986|    {
 3138|    150|    case FSEv06_ENCODING_RLE :
  ------------------
  |  |  450|    150|#define FSEv06_ENCODING_RLE     1
  ------------------
  |  Branch (3138:5): [True: 150, False: 836]
  ------------------
 3139|    150|        if (!srcSize) 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 (3139:13): [True: 2, False: 148]
  ------------------
 3140|    148|        if ( (*(const BYTE*)src) > max) return ERROR(corruption_detected);
  ------------------
  |  |   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 (3140:14): [True: 7, False: 141]
  ------------------
 3141|    141|        FSEv06_buildDTable_rle(DTable, *(const BYTE*)src);   /* if *src > max, data is corrupted */
 3142|    141|        return 1;
 3143|    323|    case FSEv06_ENCODING_RAW :
  ------------------
  |  |  449|    323|#define FSEv06_ENCODING_RAW     0
  ------------------
  |  Branch (3143:5): [True: 323, False: 663]
  ------------------
 3144|    323|        FSEv06_buildDTable(DTable, defaultNorm, max, defaultLog);
 3145|    323|        return 0;
 3146|     10|    case FSEv06_ENCODING_STATIC:
  ------------------
  |  |  451|     10|#define FSEv06_ENCODING_STATIC  2
  ------------------
  |  Branch (3146:5): [True: 10, False: 976]
  ------------------
 3147|     10|        if (!flagRepeatTable) return ERROR(corruption_detected);
  ------------------
  |  |   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 (3147:13): [True: 7, False: 3]
  ------------------
 3148|      3|        return 0;
 3149|      0|    default :   /* impossible */
  ------------------
  |  Branch (3149:5): [True: 0, False: 986]
  ------------------
 3150|    503|    case FSEv06_ENCODING_DYNAMIC :
  ------------------
  |  |  452|    503|#define FSEv06_ENCODING_DYNAMIC 3
  ------------------
  |  Branch (3150:5): [True: 503, False: 483]
  ------------------
 3151|    503|        {   U32 tableLog;
 3152|    503|            S16 norm[MaxSeq+1];
 3153|    503|            size_t const headerSize = FSEv06_readNCount(norm, &max, &tableLog, src, srcSize);
 3154|    503|            if (FSEv06_isError(headerSize)) return ERROR(corruption_detected);
  ------------------
  |  | 2732|    503|#define FSEv06_isError  ERR_isError
  ------------------
                          if (FSEv06_isError(headerSize)) return ERROR(corruption_detected);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3154:17): [True: 24, False: 479]
  ------------------
 3155|    479|            if (tableLog > maxLog) return ERROR(corruption_detected);
  ------------------
  |  |   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 (3155:17): [True: 16, False: 463]
  ------------------
 3156|    463|            FSEv06_buildDTable(DTable, norm, max, tableLog);
 3157|    463|            return headerSize;
 3158|    479|    }   }
 3159|    986|}
zstd_v06.c:ZSTDv06_decodeSequence:
 3230|  91.4k|{
 3231|       |    /* Literal length */
 3232|  91.4k|    U32 const llCode = FSEv06_peekSymbol(&(seqState->stateLL));
 3233|  91.4k|    U32 const mlCode = FSEv06_peekSymbol(&(seqState->stateML));
 3234|  91.4k|    U32 const ofCode = FSEv06_peekSymbol(&(seqState->stateOffb));   /* <= maxOff, by table construction */
 3235|       |
 3236|  91.4k|    U32 const llBits = LL_bits[llCode];
 3237|  91.4k|    U32 const mlBits = ML_bits[mlCode];
 3238|  91.4k|    U32 const ofBits = ofCode;
 3239|  91.4k|    U32 const totalBits = llBits+mlBits+ofBits;
 3240|       |
 3241|  91.4k|    static const U32 LL_base[MaxLL+1] = {
 3242|  91.4k|                             0,  1,  2,  3,  4,  5,  6,  7,  8,  9,   10,    11,    12,    13,    14,     15,
 3243|  91.4k|                            16, 18, 20, 22, 24, 28, 32, 40, 48, 64, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000,
 3244|  91.4k|                            0x2000, 0x4000, 0x8000, 0x10000 };
 3245|       |
 3246|  91.4k|    static const U32 ML_base[MaxML+1] = {
 3247|  91.4k|                             0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,   11,    12,    13,    14,    15,
 3248|  91.4k|                            16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,   27,    28,    29,    30,    31,
 3249|  91.4k|                            32, 34, 36, 38, 40, 44, 48, 56, 64, 80, 96, 0x80, 0x100, 0x200, 0x400, 0x800,
 3250|  91.4k|                            0x1000, 0x2000, 0x4000, 0x8000, 0x10000 };
 3251|       |
 3252|  91.4k|    static const U32 OF_base[MaxOff+1] = {
 3253|  91.4k|                 0,        1,       3,       7,     0xF,     0x1F,     0x3F,     0x7F,
 3254|  91.4k|                 0xFF,   0x1FF,   0x3FF,   0x7FF,   0xFFF,   0x1FFF,   0x3FFF,   0x7FFF,
 3255|  91.4k|                 0xFFFF, 0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF, 0x7FFFFF,
 3256|  91.4k|                 0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, /*fake*/ 1, 1 };
 3257|       |
 3258|       |    /* sequence */
 3259|  91.4k|    {   size_t offset;
 3260|  91.4k|        if (!ofCode)
  ------------------
  |  Branch (3260:13): [True: 86.6k, False: 4.79k]
  ------------------
 3261|  86.6k|            offset = 0;
 3262|  4.79k|        else {
 3263|  4.79k|            offset = OF_base[ofCode] + BITv06_readBits(&(seqState->DStream), ofBits);   /* <=  26 bits */
 3264|  4.79k|            if (MEM_32bits()) BITv06_reloadDStream(&(seqState->DStream));
  ------------------
  |  Branch (3264:17): [True: 0, False: 4.79k]
  ------------------
 3265|  4.79k|        }
 3266|       |
 3267|  91.4k|        if (offset < ZSTDv06_REP_NUM) {
  ------------------
  |  |  401|  91.4k|#define ZSTDv06_REP_NUM    3
  ------------------
  |  Branch (3267:13): [True: 89.5k, False: 1.89k]
  ------------------
 3268|  89.5k|            if (llCode == 0 && offset <= 1) offset = 1-offset;
  ------------------
  |  Branch (3268:17): [True: 84.8k, False: 4.75k]
  |  Branch (3268:32): [True: 84.4k, False: 404]
  ------------------
 3269|       |
 3270|  89.5k|            if (offset != 0) {
  ------------------
  |  Branch (3270:17): [True: 86.0k, False: 3.51k]
  ------------------
 3271|  86.0k|                size_t temp = seqState->prevOffset[offset];
 3272|  86.0k|                if (offset != 1) {
  ------------------
  |  Branch (3272:21): [True: 1.10k, False: 84.9k]
  ------------------
 3273|  1.10k|                    seqState->prevOffset[2] = seqState->prevOffset[1];
 3274|  1.10k|                }
 3275|  86.0k|                seqState->prevOffset[1] = seqState->prevOffset[0];
 3276|  86.0k|                seqState->prevOffset[0] = offset = temp;
 3277|       |
 3278|  86.0k|            } else {
 3279|  3.51k|                offset = seqState->prevOffset[0];
 3280|  3.51k|            }
 3281|  89.5k|        } else {
 3282|  1.89k|            offset -= ZSTDv06_REP_MOVE;
  ------------------
  |  |  403|  1.89k|#define ZSTDv06_REP_MOVE   (ZSTDv06_REP_NUM-1)
  |  |  ------------------
  |  |  |  |  401|  1.89k|#define ZSTDv06_REP_NUM    3
  |  |  ------------------
  ------------------
 3283|  1.89k|            seqState->prevOffset[2] = seqState->prevOffset[1];
 3284|  1.89k|            seqState->prevOffset[1] = seqState->prevOffset[0];
 3285|  1.89k|            seqState->prevOffset[0] = offset;
 3286|  1.89k|        }
 3287|  91.4k|        seq->offset = offset;
 3288|  91.4k|    }
 3289|       |
 3290|  91.4k|    seq->matchLength = ML_base[mlCode] + MINMATCH + ((mlCode>31) ? BITv06_readBits(&(seqState->DStream), mlBits) : 0);   /* <=  16 bits */
  ------------------
  |  |  435|  91.4k|#define MINMATCH 3
  ------------------
  |  Branch (3290:54): [True: 1.77k, False: 89.7k]
  ------------------
 3291|  91.4k|    if (MEM_32bits() && (mlBits+llBits>24)) BITv06_reloadDStream(&(seqState->DStream));
  ------------------
  |  Branch (3291:9): [True: 0, False: 91.4k]
  |  Branch (3291:25): [True: 0, False: 0]
  ------------------
 3292|       |
 3293|  91.4k|    seq->litLength = LL_base[llCode] + ((llCode>15) ? BITv06_readBits(&(seqState->DStream), llBits) : 0);   /* <=  16 bits */
  ------------------
  |  Branch (3293:41): [True: 2.27k, False: 89.2k]
  ------------------
 3294|  91.4k|    if (MEM_32bits() ||
  ------------------
  |  Branch (3294:9): [True: 0, False: 91.4k]
  ------------------
 3295|  91.4k|       (totalBits > 64 - 7 - (LLFSELog+MLFSELog+OffFSELog)) ) BITv06_reloadDStream(&(seqState->DStream));
  ------------------
  |  |  446|  91.4k|#define LLFSELog    9
  ------------------
                     (totalBits > 64 - 7 - (LLFSELog+MLFSELog+OffFSELog)) ) BITv06_reloadDStream(&(seqState->DStream));
  ------------------
  |  |  445|  91.4k|#define MLFSELog    9
  ------------------
                     (totalBits > 64 - 7 - (LLFSELog+MLFSELog+OffFSELog)) ) BITv06_reloadDStream(&(seqState->DStream));
  ------------------
  |  |  447|  91.4k|#define OffFSELog   8
  ------------------
  |  Branch (3295:8): [True: 100, False: 91.3k]
  ------------------
 3296|       |
 3297|       |    /* ANS state update */
 3298|  91.4k|    FSEv06_updateState(&(seqState->stateLL), &(seqState->DStream));   /* <=  9 bits */
 3299|  91.4k|    FSEv06_updateState(&(seqState->stateML), &(seqState->DStream));   /* <=  9 bits */
 3300|  91.4k|    if (MEM_32bits()) BITv06_reloadDStream(&(seqState->DStream));     /* <= 18 bits */
  ------------------
  |  Branch (3300:9): [True: 0, False: 91.4k]
  ------------------
 3301|  91.4k|    FSEv06_updateState(&(seqState->stateOffb), &(seqState->DStream)); /* <=  8 bits */
 3302|  91.4k|}
zstd_v06.c:FSEv06_peekSymbol:
 1062|   274k|{
 1063|   274k|    FSEv06_decode_t const DInfo = ((const FSEv06_decode_t*)(DStatePtr->table))[DStatePtr->state];
 1064|   274k|    return DInfo.symbol;
 1065|   274k|}
zstd_v06.c:FSEv06_updateState:
 1068|   274k|{
 1069|   274k|    FSEv06_decode_t const DInfo = ((const FSEv06_decode_t*)(DStatePtr->table))[DStatePtr->state];
 1070|   274k|    U32 const nbBits = DInfo.nbBits;
 1071|   274k|    size_t const lowBits = BITv06_readBits(bitD, nbBits);
 1072|   274k|    DStatePtr->state = DInfo.newState + lowBits;
 1073|   274k|}
zstd_v06.c:ZSTDv06_execSequence:
 3309|  91.4k|{
 3310|  91.4k|    BYTE* const oLitEnd = op + sequence.litLength;
 3311|  91.4k|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
 3312|  91.4k|    BYTE* const oMatchEnd = op + sequenceLength;   /* risk : address space overflow (32-bits) */
 3313|  91.4k|    BYTE* const oend_8 = oend-8;
 3314|  91.4k|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
 3315|  91.4k|    const BYTE* match = oLitEnd - sequence.offset;
 3316|       |
 3317|       |    /* checks */
 3318|  91.4k|    size_t const seqLength = sequence.litLength + sequence.matchLength;
 3319|       |
 3320|  91.4k|    if (seqLength > (size_t)(oend - op)) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   49|     28|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     28|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     28|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3320:9): [True: 28, False: 91.4k]
  ------------------
 3321|  91.4k|    if (sequence.litLength > (size_t)(litLimit - *litPtr)) 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 (3321:9): [True: 51, False: 91.4k]
  ------------------
 3322|       |    /* Now we know there are no overflow in literal nor match lengths, can use pointer checks */
 3323|  91.4k|    if (oLitEnd > oend_8) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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 (3323:9): [True: 3, False: 91.3k]
  ------------------
 3324|       |
 3325|  91.3k|    if (oMatchEnd > oend) return ERROR(dstSize_tooSmall);   /* overwrite beyond dst buffer */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3325:9): [True: 0, False: 91.3k]
  ------------------
 3326|  91.3k|    if (iLitEnd > litLimit) return ERROR(corruption_detected);   /* overRead beyond lit buffer */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3326:9): [True: 0, False: 91.3k]
  ------------------
 3327|       |
 3328|       |    /* copy Literals */
 3329|  91.3k|    ZSTDv06_wildcopy(op, *litPtr, (ptrdiff_t)sequence.litLength);   /* note : oLitEnd <= oend-8 : no risk of overwrite beyond oend */
 3330|  91.3k|    op = oLitEnd;
 3331|  91.3k|    *litPtr = iLitEnd;   /* update for next sequence */
 3332|       |
 3333|       |    /* copy Match */
 3334|  91.3k|    if (sequence.offset > (size_t)(oLitEnd - base)) {
  ------------------
  |  Branch (3334:9): [True: 150, False: 91.2k]
  ------------------
 3335|       |        /* offset beyond prefix */
 3336|    150|        if (sequence.offset > (size_t)(oLitEnd - vBase)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     70|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     70|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     70|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3336:13): [True: 70, False: 80]
  ------------------
 3337|     80|        match = dictEnd - (base-match);
 3338|     80|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (3338:13): [True: 52, False: 28]
  ------------------
 3339|     52|            memmove(oLitEnd, match, sequence.matchLength);
 3340|     52|            return sequenceLength;
 3341|     52|        }
 3342|       |        /* span extDict & currentPrefixSegment */
 3343|     28|        {   size_t const length1 = dictEnd - match;
 3344|     28|            memmove(oLitEnd, match, length1);
 3345|     28|            op = oLitEnd + length1;
 3346|     28|            sequence.matchLength -= length1;
 3347|     28|            match = base;
 3348|     28|            if (op > oend_8 || sequence.matchLength < MINMATCH) {
  ------------------
  |  |  435|     28|#define MINMATCH 3
  ------------------
  |  Branch (3348:17): [True: 0, False: 28]
  |  Branch (3348:32): [True: 14, False: 14]
  ------------------
 3349|     40|              while (op < oMatchEnd) *op++ = *match++;
  ------------------
  |  Branch (3349:22): [True: 26, False: 14]
  ------------------
 3350|     14|              return sequenceLength;
 3351|     14|            }
 3352|     28|    }   }
 3353|       |    /* Requirement: op <= oend_8 */
 3354|       |
 3355|       |    /* match within prefix */
 3356|  91.2k|    if (sequence.offset < 8) {
  ------------------
  |  Branch (3356:9): [True: 89.4k, False: 1.83k]
  ------------------
 3357|       |        /* close range match, overlap */
 3358|  89.4k|        static const U32 dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 };   /* added */
 3359|  89.4k|        static const int dec64table[] = { 8, 8, 8, 7, 8, 9,10,11 };   /* subtracted */
 3360|  89.4k|        int const sub2 = dec64table[sequence.offset];
 3361|  89.4k|        op[0] = match[0];
 3362|  89.4k|        op[1] = match[1];
 3363|  89.4k|        op[2] = match[2];
 3364|  89.4k|        op[3] = match[3];
 3365|  89.4k|        match += dec32table[sequence.offset];
 3366|  89.4k|        ZSTDv06_copy4(op+4, match);
 3367|  89.4k|        match -= sub2;
 3368|  89.4k|    } else {
 3369|  1.83k|        ZSTDv06_copy8(op, match);
 3370|  1.83k|    }
 3371|  91.2k|    op += 8; match += 8;
 3372|       |
 3373|  91.2k|    if (oMatchEnd > oend-(16-MINMATCH)) {
  ------------------
  |  |  435|  91.2k|#define MINMATCH 3
  ------------------
  |  Branch (3373:9): [True: 26, False: 91.2k]
  ------------------
 3374|     26|        if (op < oend_8) {
  ------------------
  |  Branch (3374:13): [True: 17, False: 9]
  ------------------
 3375|     17|            ZSTDv06_wildcopy(op, match, oend_8 - op);
 3376|     17|            match += oend_8 - op;
 3377|     17|            op = oend_8;
 3378|     17|        }
 3379|     91|        while (op < oMatchEnd) *op++ = *match++;
  ------------------
  |  Branch (3379:16): [True: 65, False: 26]
  ------------------
 3380|  91.2k|    } else {
 3381|  91.2k|        ZSTDv06_wildcopy(op, match, (ptrdiff_t)sequence.matchLength-8);   /* works even if matchLength < 8 */
 3382|  91.2k|    }
 3383|  91.2k|    return sequenceLength;
 3384|  91.3k|}
zstd_v06.c:ZSTDv06_wildcopy:
  489|   182k|{
  490|   182k|    const BYTE* ip = (const BYTE*)src;
  491|   182k|    BYTE* op = (BYTE*)dst;
  492|   182k|    BYTE* const oend = op + length;
  493|   182k|    do
  494|  3.40M|        COPY8(op, ip)
  ------------------
  |  |  483|  3.40M|#define COPY8(d,s) { ZSTDv06_copy8(d,s); d+=8; s+=8; }
  ------------------
  495|  3.40M|    while (op < oend);
  ------------------
  |  Branch (495:12): [True: 3.22M, False: 182k]
  ------------------
  496|   182k|}
zstd_v06.c:ZSTDv06_copy4:
 2739|  89.4k|static void ZSTDv06_copy4(void* dst, const void* src) { memcpy(dst, src, 4); }
zstd_v06.c:ZSTDv06_copy8:
  482|  3.40M|static void ZSTDv06_copy8(void* dst, const void* src) { memcpy(dst, src, 8); }
zstd_v06.c:ZSTDv06_decompressFrame:
 3507|  1.62k|{
 3508|  1.62k|    const BYTE* ip = (const BYTE*)src;
 3509|  1.62k|    const BYTE* const iend = ip + srcSize;
 3510|  1.62k|    BYTE* const ostart = (BYTE*)dst;
 3511|  1.62k|    BYTE* op = ostart;
 3512|  1.62k|    BYTE* const oend = ostart + dstCapacity;
 3513|  1.62k|    size_t remainingSize = srcSize;
 3514|  1.62k|    blockProperties_t blockProperties = { bt_compressed, 0 };
 3515|       |
 3516|       |    /* check */
 3517|  1.62k|    if (srcSize < ZSTDv06_frameHeaderSize_min+ZSTDv06_blockHeaderSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3517:9): [True: 0, False: 1.62k]
  ------------------
 3518|       |
 3519|       |    /* Frame Header */
 3520|  1.62k|    {   size_t const frameHeaderSize = ZSTDv06_frameHeaderSize(src, ZSTDv06_frameHeaderSize_min);
 3521|  1.62k|        if (ZSTDv06_isError(frameHeaderSize)) return frameHeaderSize;
  ------------------
  |  | 2731|  1.62k|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3521:13): [True: 0, False: 1.62k]
  ------------------
 3522|  1.62k|        if (srcSize < frameHeaderSize+ZSTDv06_blockHeaderSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3522:13): [True: 0, False: 1.62k]
  ------------------
 3523|  1.62k|        if (ZSTDv06_decodeFrameHeader(dctx, src, frameHeaderSize)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     23|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     23|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     23|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3523:13): [True: 23, False: 1.60k]
  ------------------
 3524|  1.60k|        ip += frameHeaderSize; remainingSize -= frameHeaderSize;
 3525|  1.60k|    }
 3526|       |
 3527|       |    /* Loop on each block */
 3528|  2.40k|    while (1) {
  ------------------
  |  Branch (3528:12): [True: 2.40k, Folded]
  ------------------
 3529|  2.40k|        size_t decodedSize=0;
 3530|  2.40k|        size_t const cBlockSize = ZSTDv06_getcBlockSize(ip, iend-ip, &blockProperties);
 3531|  2.40k|        if (ZSTDv06_isError(cBlockSize)) return cBlockSize;
  ------------------
  |  | 2731|  2.40k|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3531:13): [True: 0, False: 2.40k]
  ------------------
 3532|       |
 3533|  2.40k|        ip += ZSTDv06_blockHeaderSize;
 3534|  2.40k|        remainingSize -= ZSTDv06_blockHeaderSize;
 3535|  2.40k|        if (cBlockSize > remainingSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3535:13): [True: 0, False: 2.40k]
  ------------------
 3536|       |
 3537|  2.40k|        switch(blockProperties.blockType)
 3538|  2.40k|        {
 3539|  1.15k|        case bt_compressed:
  ------------------
  |  Branch (3539:9): [True: 1.15k, False: 1.25k]
  ------------------
 3540|  1.15k|            decodedSize = ZSTDv06_decompressBlock_internal(dctx, op, oend-op, ip, cBlockSize);
 3541|  1.15k|            break;
 3542|  1.05k|        case bt_raw :
  ------------------
  |  Branch (3542:9): [True: 1.05k, False: 1.35k]
  ------------------
 3543|  1.05k|            decodedSize = ZSTDv06_copyRawBlock(op, oend-op, ip, cBlockSize);
 3544|  1.05k|            break;
 3545|     18|        case bt_rle :
  ------------------
  |  Branch (3545:9): [True: 18, False: 2.39k]
  ------------------
 3546|     18|            return ERROR(GENERIC);   /* not yet supported */
  ------------------
  |  |   49|     18|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     18|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     18|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3547|      0|            break;
 3548|    182|        case bt_end :
  ------------------
  |  Branch (3548:9): [True: 182, False: 2.22k]
  ------------------
 3549|       |            /* end of frame */
 3550|    182|            if (remainingSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3550:17): [True: 0, False: 182]
  ------------------
 3551|    182|            break;
 3552|    182|        default:
  ------------------
  |  Branch (3552:9): [True: 0, False: 2.40k]
  ------------------
 3553|      0|            return ERROR(GENERIC);   /* impossible */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3554|  2.40k|        }
 3555|  2.39k|        if (cBlockSize == 0) break;   /* bt_end */
  ------------------
  |  Branch (3555:13): [True: 685, False: 1.70k]
  ------------------
 3556|       |
 3557|  1.70k|        if (ZSTDv06_isError(decodedSize)) return decodedSize;
  ------------------
  |  | 2731|  1.70k|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3557:13): [True: 903, False: 803]
  ------------------
 3558|    803|        op += decodedSize;
 3559|    803|        ip += cBlockSize;
 3560|    803|        remainingSize -= cBlockSize;
 3561|    803|    }
 3562|       |
 3563|    685|    return op-ostart;
 3564|  1.60k|}
zstd_v06.c:ZSTD_errorFrameSizeInfoLegacy:
 3612|     77|{
 3613|     77|    *cSize = ret;
 3614|     77|    *dBound = ZSTD_CONTENTSIZE_ERROR;
  ------------------
  |  |  454|     77|#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
  ------------------
 3615|     77|}
zstd_v06.c:ZSTDv06_getcBlockSize:
 2971|  6.30k|{
 2972|  6.30k|    const BYTE* const in = (const BYTE*)src;
 2973|  6.30k|    U32 cSize;
 2974|       |
 2975|  6.30k|    if (srcSize < ZSTDv06_blockHeaderSize) 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 (2975:9): [True: 2, False: 6.29k]
  ------------------
 2976|       |
 2977|  6.29k|    bpPtr->blockType = (blockType_t)((*in) >> 6);
 2978|  6.29k|    cSize = in[2] + (in[1]<<8) + ((in[0] & 7)<<16);
 2979|  6.29k|    bpPtr->origSize = (bpPtr->blockType == bt_rle) ? cSize : 0;
  ------------------
  |  Branch (2979:23): [True: 405, False: 5.89k]
  ------------------
 2980|       |
 2981|  6.29k|    if (bpPtr->blockType == bt_end) return 0;
  ------------------
  |  Branch (2981:9): [True: 1.06k, False: 5.23k]
  ------------------
 2982|  5.23k|    if (bpPtr->blockType == bt_rle) return 1;
  ------------------
  |  Branch (2982:9): [True: 405, False: 4.83k]
  ------------------
 2983|  4.83k|    return cSize;
 2984|  5.23k|}
zstd_v06.c:ZSTDv06_decodeFrameHeader:
 2955|  1.62k|{
 2956|  1.62k|    size_t const result = ZSTDv06_getFrameParams(&(zc->fParams), src, srcSize);
 2957|  1.62k|    if ((MEM_32bits()) && (zc->fParams.windowLog > 25)) return ERROR(frameParameter_unsupported);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2957:9): [True: 0, False: 1.62k]
  |  Branch (2957:27): [True: 0, False: 0]
  ------------------
 2958|  1.62k|    return result;
 2959|  1.62k|}
zstd_v06.c:ZSTDv06_copyRawBlock:
 2988|  1.05k|{
 2989|  1.05k|    if (dst==NULL) 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 (2989:9): [True: 0, False: 1.05k]
  ------------------
 2990|  1.05k|    if (srcSize > dstCapacity) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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 (2990:9): [True: 1, False: 1.04k]
  ------------------
 2991|  1.04k|    memcpy(dst, src, srcSize);
 2992|  1.04k|    return srcSize;
 2993|  1.05k|}
zstd_v06.c:ZSTDv06_decompress_insertDictionary:
 3803|    732|{
 3804|    732|    size_t eSize;
 3805|    732|    U32 const magic = MEM_readLE32(dict);
 3806|    732|    if (magic != ZSTDv06_DICT_MAGIC) {
  ------------------
  |  |  399|    732|#define ZSTDv06_DICT_MAGIC  0xEC30A436
  ------------------
  |  Branch (3806:9): [True: 77, False: 655]
  ------------------
 3807|       |        /* pure content mode */
 3808|     77|        ZSTDv06_refDictContent(dctx, dict, dictSize);
 3809|     77|        return 0;
 3810|     77|    }
 3811|       |    /* load entropy tables */
 3812|    655|    dict = (const char*)dict + 4;
 3813|    655|    dictSize -= 4;
 3814|    655|    eSize = ZSTDv06_loadEntropy(dctx, dict, dictSize);
 3815|    655|    if (ZSTDv06_isError(eSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  | 2731|    655|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
                  if (ZSTDv06_isError(eSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|    509|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    509|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    509|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3815:9): [True: 509, False: 146]
  ------------------
 3816|       |
 3817|       |    /* reference dictionary content */
 3818|    146|    dict = (const char*)dict + eSize;
 3819|    146|    dictSize -= eSize;
 3820|    146|    ZSTDv06_refDictContent(dctx, dict, dictSize);
 3821|       |
 3822|    146|    return 0;
 3823|    655|}
zstd_v06.c:ZSTDv06_refDictContent:
 3751|    223|{
 3752|    223|    dctx->dictEnd = dctx->previousDstEnd;
 3753|    223|    dctx->vBase = (const char*)dict - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->base));
 3754|    223|    dctx->base = dict;
 3755|    223|    dctx->previousDstEnd = (const char*)dict + dictSize;
 3756|    223|}
zstd_v06.c:ZSTDv06_loadEntropy:
 3759|    655|{
 3760|    655|    size_t hSize, offcodeHeaderSize, matchlengthHeaderSize, litlengthHeaderSize;
 3761|       |
 3762|    655|    hSize = HUFv06_readDTableX4(dctx->hufTableX4, dict, dictSize);
 3763|    655|    if (HUFv06_isError(hSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  | 2733|    655|#define HUFv06_isError  ERR_isError
  ------------------
                  if (HUFv06_isError(hSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|    335|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    335|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    335|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3763:9): [True: 335, False: 320]
  ------------------
 3764|    320|    dict = (const char*)dict + hSize;
 3765|    320|    dictSize -= hSize;
 3766|       |
 3767|    320|    {   short offcodeNCount[MaxOff+1];
 3768|    320|        U32 offcodeMaxValue=MaxOff, offcodeLog;
  ------------------
  |  |  443|    320|#define MaxOff 28
  ------------------
 3769|    320|        offcodeHeaderSize = FSEv06_readNCount(offcodeNCount, &offcodeMaxValue, &offcodeLog, dict, dictSize);
 3770|    320|        if (FSEv06_isError(offcodeHeaderSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  | 2732|    320|#define FSEv06_isError  ERR_isError
  ------------------
                      if (FSEv06_isError(offcodeHeaderSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   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 (3770:13): [True: 48, False: 272]
  ------------------
 3771|    272|        if (offcodeLog > OffFSELog) return ERROR(dictionary_corrupted);
  ------------------
  |  |  447|    272|#define OffFSELog   8
  ------------------
                      if (offcodeLog > OffFSELog) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|     17|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     17|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     17|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3771:13): [True: 17, False: 255]
  ------------------
 3772|    255|        { size_t const errorCode = FSEv06_buildDTable(dctx->OffTable, offcodeNCount, offcodeMaxValue, offcodeLog);
 3773|    255|          if (FSEv06_isError(errorCode)) return ERROR(dictionary_corrupted); }
  ------------------
  |  | 2732|    255|#define FSEv06_isError  ERR_isError
  ------------------
                        if (FSEv06_isError(errorCode)) return ERROR(dictionary_corrupted); }
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3773:15): [True: 0, False: 255]
  ------------------
 3774|    255|        dict = (const char*)dict + offcodeHeaderSize;
 3775|    255|        dictSize -= offcodeHeaderSize;
 3776|    255|    }
 3777|       |
 3778|      0|    {   short matchlengthNCount[MaxML+1];
 3779|    255|        unsigned matchlengthMaxValue = MaxML, matchlengthLog;
  ------------------
  |  |  441|    255|#define MaxML  52
  ------------------
 3780|    255|        matchlengthHeaderSize = FSEv06_readNCount(matchlengthNCount, &matchlengthMaxValue, &matchlengthLog, dict, dictSize);
 3781|    255|        if (FSEv06_isError(matchlengthHeaderSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  | 2732|    255|#define FSEv06_isError  ERR_isError
  ------------------
                      if (FSEv06_isError(matchlengthHeaderSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   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 (3781:13): [True: 48, False: 207]
  ------------------
 3782|    207|        if (matchlengthLog > MLFSELog) return ERROR(dictionary_corrupted);
  ------------------
  |  |  445|    207|#define MLFSELog    9
  ------------------
                      if (matchlengthLog > MLFSELog) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|     17|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     17|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     17|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3782:13): [True: 17, False: 190]
  ------------------
 3783|    190|        { size_t const errorCode = FSEv06_buildDTable(dctx->MLTable, matchlengthNCount, matchlengthMaxValue, matchlengthLog);
 3784|    190|          if (FSEv06_isError(errorCode)) return ERROR(dictionary_corrupted); }
  ------------------
  |  | 2732|    190|#define FSEv06_isError  ERR_isError
  ------------------
                        if (FSEv06_isError(errorCode)) return ERROR(dictionary_corrupted); }
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3784:15): [True: 0, False: 190]
  ------------------
 3785|    190|        dict = (const char*)dict + matchlengthHeaderSize;
 3786|    190|        dictSize -= matchlengthHeaderSize;
 3787|    190|    }
 3788|       |
 3789|      0|    {   short litlengthNCount[MaxLL+1];
 3790|    190|        unsigned litlengthMaxValue = MaxLL, litlengthLog;
  ------------------
  |  |  442|    190|#define MaxLL  35
  ------------------
 3791|    190|        litlengthHeaderSize = FSEv06_readNCount(litlengthNCount, &litlengthMaxValue, &litlengthLog, dict, dictSize);
 3792|    190|        if (FSEv06_isError(litlengthHeaderSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  | 2732|    190|#define FSEv06_isError  ERR_isError
  ------------------
                      if (FSEv06_isError(litlengthHeaderSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|     30|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     30|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     30|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3792:13): [True: 30, False: 160]
  ------------------
 3793|    160|        if (litlengthLog > LLFSELog) return ERROR(dictionary_corrupted);
  ------------------
  |  |  446|    160|#define LLFSELog    9
  ------------------
                      if (litlengthLog > LLFSELog) return ERROR(dictionary_corrupted);
  ------------------
  |  |   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 (3793:13): [True: 14, False: 146]
  ------------------
 3794|    146|        { size_t const errorCode = FSEv06_buildDTable(dctx->LLTable, litlengthNCount, litlengthMaxValue, litlengthLog);
 3795|    146|          if (FSEv06_isError(errorCode)) return ERROR(dictionary_corrupted); }
  ------------------
  |  | 2732|    146|#define FSEv06_isError  ERR_isError
  ------------------
                        if (FSEv06_isError(errorCode)) return ERROR(dictionary_corrupted); }
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3795:15): [True: 0, False: 146]
  ------------------
 3796|    146|    }
 3797|       |
 3798|    146|    dctx->flagRepeatTable = 1;
 3799|    146|    return hSize + offcodeHeaderSize + matchlengthHeaderSize + litlengthHeaderSize;
 3800|    146|}

FSEv07_isError:
 1134|    167|unsigned FSEv07_isError(size_t code) { return ERR_isError(code); }
HUFv07_isError:
 1142|  1.21k|unsigned HUFv07_isError(size_t code) { return ERR_isError(code); }
FSEv07_readNCount:
 1154|    616|{
 1155|    616|    const BYTE* const istart = (const BYTE*) headerBuffer;
 1156|    616|    const BYTE* const iend = istart + hbSize;
 1157|    616|    const BYTE* ip = istart;
 1158|    616|    int nbBits;
 1159|    616|    int remaining;
 1160|    616|    int threshold;
 1161|    616|    U32 bitStream;
 1162|    616|    int bitCount;
 1163|    616|    unsigned charnum = 0;
 1164|    616|    int previous0 = 0;
 1165|       |
 1166|    616|    if (hbSize < 4) 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 (1166:9): [True: 3, False: 613]
  ------------------
 1167|    613|    bitStream = MEM_readLE32(ip);
 1168|    613|    nbBits = (bitStream & 0xF) + FSEv07_MIN_TABLELOG;   /* extract tableLog */
  ------------------
  |  |  903|    613|#define FSEv07_MIN_TABLELOG 5
  ------------------
 1169|    613|    if (nbBits > FSEv07_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  |  905|    613|#define FSEv07_TABLELOG_ABSOLUTE_MAX 15
  ------------------
                  if (nbBits > FSEv07_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   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 (1169:9): [True: 6, False: 607]
  ------------------
 1170|    607|    bitStream >>= 4;
 1171|    607|    bitCount = 4;
 1172|    607|    *tableLogPtr = nbBits;
 1173|    607|    remaining = (1<<nbBits)+1;
 1174|    607|    threshold = 1<<nbBits;
 1175|    607|    nbBits++;
 1176|       |
 1177|  8.72k|    while ((remaining>1) && (charnum<=*maxSVPtr)) {
  ------------------
  |  Branch (1177:12): [True: 8.13k, False: 595]
  |  Branch (1177:29): [True: 8.12k, False: 3]
  ------------------
 1178|  8.12k|        if (previous0) {
  ------------------
  |  Branch (1178:13): [True: 1.03k, False: 7.09k]
  ------------------
 1179|  1.03k|            unsigned n0 = charnum;
 1180|  1.11k|            while ((bitStream & 0xFFFF) == 0xFFFF) {
  ------------------
  |  Branch (1180:20): [True: 84, False: 1.03k]
  ------------------
 1181|     84|                n0+=24;
 1182|     84|                if (ip < iend-5) {
  ------------------
  |  Branch (1182:21): [True: 75, False: 9]
  ------------------
 1183|     75|                    ip+=2;
 1184|     75|                    bitStream = MEM_readLE32(ip) >> bitCount;
 1185|     75|                } else {
 1186|      9|                    bitStream >>= 16;
 1187|      9|                    bitCount+=16;
 1188|      9|            }   }
 1189|  1.43k|            while ((bitStream & 3) == 3) {
  ------------------
  |  Branch (1189:20): [True: 402, False: 1.03k]
  ------------------
 1190|    402|                n0+=3;
 1191|    402|                bitStream>>=2;
 1192|    402|                bitCount+=2;
 1193|    402|            }
 1194|  1.03k|            n0 += bitStream & 3;
 1195|  1.03k|            bitCount += 2;
 1196|  1.03k|            if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall);
  ------------------
  |  |   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 (1196:17): [True: 9, False: 1.02k]
  ------------------
 1197|  3.39k|            while (charnum < n0) normalizedCounter[charnum++] = 0;
  ------------------
  |  Branch (1197:20): [True: 2.37k, False: 1.02k]
  ------------------
 1198|  1.02k|            if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
  ------------------
  |  Branch (1198:17): [True: 493, False: 533]
  |  Branch (1198:35): [True: 33, False: 500]
  ------------------
 1199|    526|                ip += bitCount>>3;
 1200|    526|                bitCount &= 7;
 1201|    526|                bitStream = MEM_readLE32(ip) >> bitCount;
 1202|    526|            }
 1203|    500|            else
 1204|    500|                bitStream >>= 2;
 1205|  1.02k|        }
 1206|  8.12k|        {   short const max = (short)((2*threshold-1)-remaining);
 1207|  8.12k|            short count;
 1208|       |
 1209|  8.12k|            if ((bitStream & (threshold-1)) < (U32)max) {
  ------------------
  |  Branch (1209:17): [True: 5.78k, False: 2.33k]
  ------------------
 1210|  5.78k|                count = (short)(bitStream & (threshold-1));
 1211|  5.78k|                bitCount   += nbBits-1;
 1212|  5.78k|            } else {
 1213|  2.33k|                count = (short)(bitStream & (2*threshold-1));
 1214|  2.33k|                if (count >= threshold) count -= max;
  ------------------
  |  Branch (1214:21): [True: 896, False: 1.44k]
  ------------------
 1215|  2.33k|                bitCount   += nbBits;
 1216|  2.33k|            }
 1217|       |
 1218|  8.12k|            count--;   /* extra accuracy */
 1219|  8.12k|            remaining -= FSEv07_abs(count);
 1220|  8.12k|            normalizedCounter[charnum++] = count;
 1221|  8.12k|            previous0 = !count;
 1222|  12.3k|            while (remaining < threshold) {
  ------------------
  |  Branch (1222:20): [True: 4.27k, False: 8.12k]
  ------------------
 1223|  4.27k|                nbBits--;
 1224|  4.27k|                threshold >>= 1;
 1225|  4.27k|            }
 1226|       |
 1227|  8.12k|            if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
  ------------------
  |  Branch (1227:17): [True: 6.18k, False: 1.93k]
  |  Branch (1227:35): [True: 337, False: 1.59k]
  ------------------
 1228|  6.52k|                ip += bitCount>>3;
 1229|  6.52k|                bitCount &= 7;
 1230|  6.52k|            } else {
 1231|  1.59k|                bitCount -= (int)(8 * (iend - 4 - ip));
 1232|  1.59k|                ip = iend - 4;
 1233|  1.59k|            }
 1234|  8.12k|            bitStream = MEM_readLE32(ip) >> (bitCount & 31);
 1235|  8.12k|    }   }   /* while ((remaining>1) && (charnum<=*maxSVPtr)) */
 1236|    598|    if (remaining != 1) return ERROR(GENERIC);
  ------------------
  |  |   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 (1236:9): [True: 3, False: 595]
  ------------------
 1237|    595|    *maxSVPtr = charnum-1;
 1238|       |
 1239|    595|    ip += (bitCount+7)>>3;
 1240|    595|    if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1240:9): [True: 12, False: 583]
  ------------------
 1241|    583|    return ip-istart;
 1242|    595|}
HUFv07_readStats:
 1254|    352|{
 1255|    352|    U32 weightTotal;
 1256|    352|    const BYTE* ip = (const BYTE*) src;
 1257|    352|    size_t iSize;
 1258|    352|    size_t oSize;
 1259|       |
 1260|    352|    if (!srcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1260:9): [True: 1, False: 351]
  ------------------
 1261|    351|    iSize = ip[0];
 1262|       |    /* memset(huffWeight, 0, hwSize); */   /* is not necessary, even though some analyzer complain ... */
 1263|       |
 1264|    351|    if (iSize >= 128)  { /* special header */
  ------------------
  |  Branch (1264:9): [True: 182, False: 169]
  ------------------
 1265|    182|        if (iSize >= (242)) {  /* RLE */
  ------------------
  |  Branch (1265:13): [True: 25, False: 157]
  ------------------
 1266|     25|            static U32 l[14] = { 1, 2, 3, 4, 7, 8, 15, 16, 31, 32, 63, 64, 127, 128 };
 1267|     25|            oSize = l[iSize-242];
 1268|     25|            memset(huffWeight, 1, hwSize);
 1269|     25|            iSize = 0;
 1270|     25|        }
 1271|    157|        else {   /* Incompressible */
 1272|    157|            oSize = iSize - 127;
 1273|    157|            iSize = ((oSize+1)/2);
 1274|    157|            if (iSize+1 > srcSize) 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 (1274:17): [True: 2, False: 155]
  ------------------
 1275|    155|            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 (1275:17): [True: 0, False: 155]
  ------------------
 1276|    155|            ip += 1;
 1277|    155|            {   U32 n;
 1278|    593|                for (n=0; n<oSize; n+=2) {
  ------------------
  |  Branch (1278:27): [True: 438, False: 155]
  ------------------
 1279|    438|                    huffWeight[n]   = ip[n/2] >> 4;
 1280|    438|                    huffWeight[n+1] = ip[n/2] & 15;
 1281|    438|    }   }   }   }
 1282|    169|    else  {   /* header compressed with FSE (normal case) */
 1283|    169|        if (iSize+1 > srcSize) 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 (1283:13): [True: 2, False: 167]
  ------------------
 1284|    167|        oSize = FSEv07_decompress(huffWeight, hwSize-1, ip+1, iSize);   /* max (hwSize-1) values decoded, as last one is implied */
 1285|    167|        if (FSEv07_isError(oSize)) return oSize;
  ------------------
  |  Branch (1285:13): [True: 29, False: 138]
  ------------------
 1286|    167|    }
 1287|       |
 1288|       |    /* collect weight stats */
 1289|    318|    memset(rankStats, 0, (HUFv07_TABLELOG_ABSOLUTEMAX + 1) * sizeof(U32));
  ------------------
  |  |  996|    318|#define HUFv07_TABLELOG_ABSOLUTEMAX  16   /* absolute limit of HUFv07_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
 1290|    318|    weightTotal = 0;
 1291|  11.2k|    {   U32 n; for (n=0; n<oSize; n++) {
  ------------------
  |  Branch (1291:26): [True: 10.9k, False: 304]
  ------------------
 1292|  10.9k|            if (huffWeight[n] >= HUFv07_TABLELOG_ABSOLUTEMAX) return ERROR(corruption_detected);
  ------------------
  |  |  996|  10.9k|#define HUFv07_TABLELOG_ABSOLUTEMAX  16   /* absolute limit of HUFv07_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
                          if (huffWeight[n] >= HUFv07_TABLELOG_ABSOLUTEMAX) return ERROR(corruption_detected);
  ------------------
  |  |   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 (1292:17): [True: 14, False: 10.9k]
  ------------------
 1293|  10.9k|            rankStats[huffWeight[n]]++;
 1294|  10.9k|            weightTotal += (1 << huffWeight[n]) >> 1;
 1295|  10.9k|    }   }
 1296|    304|    if (weightTotal == 0) return ERROR(corruption_detected);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1296:9): [True: 1, False: 303]
  ------------------
 1297|       |
 1298|       |    /* get last non-null symbol weight (implied, total must be 2^n) */
 1299|    303|    {   U32 const tableLog = BITv07_highbit32(weightTotal) + 1;
 1300|    303|        if (tableLog > HUFv07_TABLELOG_ABSOLUTEMAX) return ERROR(corruption_detected);
  ------------------
  |  |  996|    303|#define HUFv07_TABLELOG_ABSOLUTEMAX  16   /* absolute limit of HUFv07_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
                      if (tableLog > HUFv07_TABLELOG_ABSOLUTEMAX) return ERROR(corruption_detected);
  ------------------
  |  |   49|      5|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      5|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      5|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1300:13): [True: 5, False: 298]
  ------------------
 1301|    298|        *tableLogPtr = tableLog;
 1302|       |        /* determine last weight */
 1303|    298|        {   U32 const total = 1 << tableLog;
 1304|    298|            U32 const rest = total - weightTotal;
 1305|    298|            U32 const verif = 1 << BITv07_highbit32(rest);
 1306|    298|            U32 const lastWeight = BITv07_highbit32(rest) + 1;
 1307|    298|            if (verif != rest) return ERROR(corruption_detected);    /* last value must be a clean power of 2 */
  ------------------
  |  |   49|     37|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     37|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     37|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1307:17): [True: 37, False: 261]
  ------------------
 1308|    261|            huffWeight[oSize] = (BYTE)lastWeight;
 1309|    261|            rankStats[lastWeight]++;
 1310|    261|    }   }
 1311|       |
 1312|       |    /* check tree construction validity */
 1313|    261|    if ((rankStats[1] < 2) || (rankStats[1] & 1)) return ERROR(corruption_detected);   /* by construction : at least 2 elts of rank 1, must be even */
  ------------------
  |  |   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 (1313:9): [True: 3, False: 258]
  |  Branch (1313:31): [True: 0, False: 258]
  ------------------
 1314|       |
 1315|       |    /* results */
 1316|    258|    *nbSymbolsPtr = (U32)(oSize+1);
 1317|    258|    return iSize+1;
 1318|    261|}
FSEv07_buildDTable:
 1424|  1.05k|{
 1425|  1.05k|    void* const tdPtr = dt+1;   /* because *dt is unsigned, 32-bits aligned on 32-bits */
 1426|  1.05k|    FSEv07_DECODE_TYPE* const tableDecode = (FSEv07_DECODE_TYPE*) (tdPtr);
  ------------------
  |  |  890|  1.05k|#define FSEv07_DECODE_TYPE FSEv07_decode_t
  ------------------
 1427|  1.05k|    U16 symbolNext[FSEv07_MAX_SYMBOL_VALUE+1];
 1428|       |
 1429|  1.05k|    U32 const maxSV1 = maxSymbolValue + 1;
 1430|  1.05k|    U32 const tableSize = 1 << tableLog;
 1431|  1.05k|    U32 highThreshold = tableSize-1;
 1432|       |
 1433|       |    /* Sanity Checks */
 1434|  1.05k|    if (maxSymbolValue > FSEv07_MAX_SYMBOL_VALUE) return ERROR(maxSymbolValue_tooLarge);
  ------------------
  |  |  882|  1.05k|#define FSEv07_MAX_SYMBOL_VALUE 255
  ------------------
                  if (maxSymbolValue > FSEv07_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 (1434:9): [True: 0, False: 1.05k]
  ------------------
 1435|  1.05k|    if (tableLog > FSEv07_MAX_TABLELOG) return ERROR(tableLog_tooLarge);
  ------------------
  |  |  899|  1.05k|#define FSEv07_MAX_TABLELOG  (FSEv07_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  876|  1.05k|#define FSEv07_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
                  if (tableLog > FSEv07_MAX_TABLELOG) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   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 (1435:9): [True: 1, False: 1.05k]
  ------------------
 1436|       |
 1437|       |    /* Init, lay down lowprob symbols */
 1438|  1.05k|    {   FSEv07_DTableHeader DTableH;
 1439|  1.05k|        DTableH.tableLog = (U16)tableLog;
 1440|  1.05k|        DTableH.fastMode = 1;
 1441|  1.05k|        {   S16 const largeLimit= (S16)(1 << (tableLog-1));
 1442|  1.05k|            U32 s;
 1443|  29.3k|            for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (1443:23): [True: 28.3k, False: 1.05k]
  ------------------
 1444|  28.3k|                if (normalizedCounter[s]==-1) {
  ------------------
  |  Branch (1444:21): [True: 5.62k, False: 22.6k]
  ------------------
 1445|  5.62k|                    tableDecode[highThreshold--].symbol = (FSEv07_FUNCTION_TYPE)s;
 1446|  5.62k|                    symbolNext[s] = 1;
 1447|  22.6k|                } else {
 1448|  22.6k|                    if (normalizedCounter[s] >= largeLimit) DTableH.fastMode=0;
  ------------------
  |  Branch (1448:25): [True: 325, False: 22.3k]
  ------------------
 1449|  22.6k|                    symbolNext[s] = normalizedCounter[s];
 1450|  22.6k|        }   }   }
 1451|  1.05k|        memcpy(dt, &DTableH, sizeof(DTableH));
 1452|  1.05k|    }
 1453|       |
 1454|       |    /* Spread symbols */
 1455|  1.05k|    {   U32 const tableMask = tableSize-1;
 1456|  1.05k|        U32 const step = FSEv07_TABLESTEP(tableSize);
  ------------------
  |  |  910|  1.05k|#define FSEv07_TABLESTEP(tableSize) ((tableSize>>1) + (tableSize>>3) + 3)
  ------------------
 1457|  1.05k|        U32 s, position = 0;
 1458|  29.3k|        for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (1458:19): [True: 28.3k, False: 1.05k]
  ------------------
 1459|  28.3k|            int i;
 1460|   222k|            for (i=0; i<normalizedCounter[s]; i++) {
  ------------------
  |  Branch (1460:23): [True: 193k, False: 28.3k]
  ------------------
 1461|   193k|                tableDecode[position].symbol = (FSEv07_FUNCTION_TYPE)s;
 1462|   193k|                position = (position + step) & tableMask;
 1463|   199k|                while (position > highThreshold) position = (position + step) & tableMask;   /* lowprob area */
  ------------------
  |  Branch (1463:24): [True: 5.59k, False: 193k]
  ------------------
 1464|   193k|        }   }
 1465|       |
 1466|  1.05k|        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 (1466:13): [True: 0, False: 1.05k]
  ------------------
 1467|  1.05k|    }
 1468|       |
 1469|       |    /* Build Decoding table */
 1470|  1.05k|    {   U32 u;
 1471|   200k|        for (u=0; u<tableSize; u++) {
  ------------------
  |  Branch (1471:19): [True: 199k, False: 1.05k]
  ------------------
 1472|   199k|            FSEv07_FUNCTION_TYPE const symbol = (FSEv07_FUNCTION_TYPE)(tableDecode[u].symbol);
  ------------------
  |  |  888|   199k|#define FSEv07_FUNCTION_TYPE BYTE
  ------------------
 1473|   199k|            U16 nextState = symbolNext[symbol]++;
 1474|   199k|            tableDecode[u].nbBits = (BYTE) (tableLog - BITv07_highbit32 ((U32)nextState) );
 1475|   199k|            tableDecode[u].newState = (U16) ( (nextState << tableDecode[u].nbBits) - tableSize);
 1476|   199k|    }   }
 1477|       |
 1478|  1.05k|    return 0;
 1479|  1.05k|}
FSEv07_buildDTable_rle:
 1489|    146|{
 1490|    146|    void* ptr = dt;
 1491|    146|    FSEv07_DTableHeader* const DTableH = (FSEv07_DTableHeader*)ptr;
 1492|    146|    void* dPtr = dt + 1;
 1493|    146|    FSEv07_decode_t* const cell = (FSEv07_decode_t*)dPtr;
 1494|       |
 1495|    146|    DTableH->tableLog = 0;
 1496|    146|    DTableH->fastMode = 0;
 1497|       |
 1498|    146|    cell->newState = 0;
 1499|    146|    cell->symbol = symbolValue;
 1500|    146|    cell->nbBits = 0;
 1501|       |
 1502|    146|    return 0;
 1503|    146|}
FSEv07_decompress_usingDTable:
 1603|    149|{
 1604|    149|    const void* ptr = dt;
 1605|    149|    const FSEv07_DTableHeader* DTableH = (const FSEv07_DTableHeader*)ptr;
 1606|    149|    const U32 fastMode = DTableH->fastMode;
 1607|       |
 1608|       |    /* select fast mode (static) */
 1609|    149|    if (fastMode) return FSEv07_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 1);
  ------------------
  |  Branch (1609:9): [True: 63, False: 86]
  ------------------
 1610|     86|    return FSEv07_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 0);
 1611|    149|}
FSEv07_decompress:
 1615|    167|{
 1616|    167|    const BYTE* const istart = (const BYTE*)cSrc;
 1617|    167|    const BYTE* ip = istart;
 1618|    167|    short counting[FSEv07_MAX_SYMBOL_VALUE+1];
 1619|    167|    DTable_max_t dt;   /* Static analyzer seems unable to understand this table will be properly initialized later */
 1620|    167|    unsigned tableLog;
 1621|    167|    unsigned maxSymbolValue = FSEv07_MAX_SYMBOL_VALUE;
  ------------------
  |  |  882|    167|#define FSEv07_MAX_SYMBOL_VALUE 255
  ------------------
 1622|       |
 1623|    167|    if (cSrcSize<2) return ERROR(srcSize_wrong);   /* too small input size */
  ------------------
  |  |   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 (1623:9): [True: 2, False: 165]
  ------------------
 1624|       |
 1625|       |    /* normal FSE decoding mode */
 1626|    165|    {   size_t const NCountLength = FSEv07_readNCount (counting, &maxSymbolValue, &tableLog, istart, cSrcSize);
 1627|    165|        if (FSEv07_isError(NCountLength)) return NCountLength;
  ------------------
  |  | 1378|    165|#define FSEv07_isError ERR_isError
  ------------------
  |  Branch (1627:13): [True: 14, False: 151]
  ------------------
 1628|    151|        if (NCountLength >= cSrcSize) return ERROR(srcSize_wrong);   /* too small input size */
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1628:13): [True: 1, False: 150]
  ------------------
 1629|    150|        ip += NCountLength;
 1630|    150|        cSrcSize -= NCountLength;
 1631|    150|    }
 1632|       |
 1633|      0|    { size_t const errorCode = FSEv07_buildDTable (dt, counting, maxSymbolValue, tableLog);
 1634|    150|      if (FSEv07_isError(errorCode)) return errorCode; }
  ------------------
  |  | 1378|    150|#define FSEv07_isError ERR_isError
  ------------------
  |  Branch (1634:11): [True: 1, False: 149]
  ------------------
 1635|       |
 1636|    149|    return FSEv07_decompress_usingDTable (dst, maxDstSize, ip, cSrcSize, dt);   /* always return, even if it is an error code */
 1637|    150|}
HUFv07_readDTableX2:
 1722|    352|{
 1723|    352|    BYTE huffWeight[HUFv07_SYMBOLVALUE_MAX + 1];
 1724|    352|    U32 rankVal[HUFv07_TABLELOG_ABSOLUTEMAX + 1];   /* large enough for values from 0 to 16 */
 1725|    352|    U32 tableLog = 0;
 1726|    352|    U32 nbSymbols = 0;
 1727|    352|    size_t iSize;
 1728|    352|    void* const dtPtr = DTable + 1;
 1729|    352|    HUFv07_DEltX2* const dt = (HUFv07_DEltX2*)dtPtr;
 1730|       |
 1731|    352|    HUFv07_STATIC_ASSERT(sizeof(DTableDesc) == sizeof(HUFv07_DTable));
  ------------------
  |  | 1698|    352|#define HUFv07_STATIC_ASSERT(c) { enum { HUFv07_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
 1732|       |    /* memset(huffWeight, 0, sizeof(huffWeight)); */   /* is not necessary, even though some analyzer complain ... */
 1733|       |
 1734|    352|    iSize = HUFv07_readStats(huffWeight, HUFv07_SYMBOLVALUE_MAX + 1, rankVal, &nbSymbols, &tableLog, src, srcSize);
  ------------------
  |  |  999|    352|#define HUFv07_SYMBOLVALUE_MAX 255
  ------------------
 1735|    352|    if (HUFv07_isError(iSize)) return iSize;
  ------------------
  |  Branch (1735:9): [True: 94, False: 258]
  ------------------
 1736|       |
 1737|       |    /* Table header */
 1738|    258|    {   DTableDesc dtd = HUFv07_getDTableDesc(DTable);
 1739|    258|        if (tableLog > (U32)(dtd.maxTableLog+1)) return ERROR(tableLog_tooLarge);   /* DTable too small, huffman tree cannot fit in */
  ------------------
  |  |   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 (1739:13): [True: 1, False: 257]
  ------------------
 1740|    257|        dtd.tableType = 0;
 1741|    257|        dtd.tableLog = (BYTE)tableLog;
 1742|    257|        memcpy(DTable, &dtd, sizeof(dtd));
 1743|    257|    }
 1744|       |
 1745|       |    /* Prepare ranks */
 1746|      0|    {   U32 n, nextRankStart = 0;
 1747|  1.18k|        for (n=1; n<tableLog+1; n++) {
  ------------------
  |  Branch (1747:19): [True: 932, False: 257]
  ------------------
 1748|    932|            U32 current = nextRankStart;
 1749|    932|            nextRankStart += (rankVal[n] << (n-1));
 1750|    932|            rankVal[n] = current;
 1751|    932|    }   }
 1752|       |
 1753|       |    /* fill DTable */
 1754|    257|    {   U32 n;
 1755|  8.04k|        for (n=0; n<nbSymbols; n++) {
  ------------------
  |  Branch (1755:19): [True: 7.78k, False: 257]
  ------------------
 1756|  7.78k|            U32 const w = huffWeight[n];
 1757|  7.78k|            U32 const length = (1 << w) >> 1;
 1758|  7.78k|            U32 i;
 1759|  7.78k|            HUFv07_DEltX2 D;
 1760|  7.78k|            D.byte = (BYTE)n; D.nbBits = (BYTE)(tableLog + 1 - w);
 1761|  34.4k|            for (i = rankVal[w]; i < rankVal[w] + length; i++)
  ------------------
  |  Branch (1761:34): [True: 26.6k, False: 7.78k]
  ------------------
 1762|  26.6k|                dt[i] = D;
 1763|  7.78k|            rankVal[w] += length;
 1764|  7.78k|    }   }
 1765|       |
 1766|    257|    return iSize;
 1767|    258|}
HUFv07_decompress1X2_DCtx:
 1847|     86|{
 1848|     86|    const BYTE* ip = (const BYTE*) cSrc;
 1849|       |
 1850|     86|    size_t const hSize = HUFv07_readDTableX2 (DCtx, cSrc, cSrcSize);
 1851|     86|    if (HUFv07_isError(hSize)) return hSize;
  ------------------
  |  Branch (1851:9): [True: 9, False: 77]
  ------------------
 1852|     77|    if (hSize >= cSrcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1852:9): [True: 1, False: 76]
  ------------------
 1853|     76|    ip += hSize; cSrcSize -= hSize;
 1854|       |
 1855|     76|    return HUFv07_decompress1X2_usingDTable_internal (dst, dstSize, ip, cSrcSize, DCtx);
 1856|     77|}
HUFv07_decompress4X2_DCtx:
 1970|    266|{
 1971|    266|    const BYTE* ip = (const BYTE*) cSrc;
 1972|       |
 1973|    266|    size_t const hSize = HUFv07_readDTableX2 (dctx, cSrc, cSrcSize);
 1974|    266|    if (HUFv07_isError(hSize)) return hSize;
  ------------------
  |  Branch (1974:9): [True: 86, False: 180]
  ------------------
 1975|    180|    if (hSize >= cSrcSize) 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 (1975:9): [True: 3, False: 177]
  ------------------
 1976|    177|    ip += hSize; cSrcSize -= hSize;
 1977|       |
 1978|    177|    return HUFv07_decompress4X2_usingDTable_internal (dst, dstSize, ip, cSrcSize, dctx);
 1979|    180|}
HUFv07_selectDecoder:
 2450|    266|{
 2451|       |    /* decoder timing evaluation */
 2452|    266|    U32 const Q = (U32)(cSrcSize * 16 / dstSize);   /* Q < 16 since dstSize > cSrcSize */
 2453|    266|    U32 const D256 = (U32)(dstSize >> 8);
 2454|    266|    U32 const DTime0 = algoTime[Q][0].tableTime + (algoTime[Q][0].decode256Time * D256);
 2455|    266|    U32 DTime1 = algoTime[Q][1].tableTime + (algoTime[Q][1].decode256Time * D256);
 2456|    266|    DTime1 += DTime1 >> 3;  /* advantage to algorithm using less memory, for cache eviction */
 2457|       |
 2458|    266|    return DTime1 < DTime0;
 2459|    266|}
HUFv07_decompress4X_hufOnly:
 2497|    271|{
 2498|       |    /* validation checks */
 2499|    271|    if (dstSize == 0) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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 (2499:9): [True: 1, False: 270]
  ------------------
 2500|    270|    if ((cSrcSize >= dstSize) || (cSrcSize <= 1)) return ERROR(corruption_detected);   /* invalid */
  ------------------
  |  |   49|      4|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      4|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      4|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2500:9): [True: 1, False: 269]
  |  Branch (2500:34): [True: 3, False: 266]
  ------------------
 2501|       |
 2502|    266|    {   U32 const algoNb = HUFv07_selectDecoder(dstSize, cSrcSize);
 2503|    266|        return algoNb ? HUFv07_decompress4X4_DCtx(dctx, dst, dstSize, cSrc, cSrcSize) :
  ------------------
  |  Branch (2503:16): [True: 0, False: 266]
  ------------------
 2504|    266|                        HUFv07_decompress4X2_DCtx(dctx, dst, dstSize, cSrc, cSrcSize) ;
 2505|    270|    }
 2506|    270|}
ZSTDv07_decompressBegin:
 2908|  1.96k|{
 2909|  1.96k|    dctx->expected = ZSTDv07_frameHeaderSize_min;
 2910|  1.96k|    dctx->stage = ZSTDds_getFrameHeaderSize;
 2911|  1.96k|    dctx->previousDstEnd = NULL;
 2912|  1.96k|    dctx->base = NULL;
 2913|  1.96k|    dctx->vBase = NULL;
 2914|  1.96k|    dctx->dictEnd = NULL;
 2915|  1.96k|    dctx->hufTable[0] = (HUFv07_DTable)((ZSTD_HUFFDTABLE_CAPACITY_LOG)*0x1000001);
  ------------------
  |  | 2665|  1.96k|#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
  ------------------
 2916|  1.96k|    dctx->litEntropy = dctx->fseEntropy = 0;
 2917|  1.96k|    dctx->dictID = 0;
 2918|  7.84k|    { int i; for (i=0; i<ZSTDv07_REP_NUM; i++) dctx->rep[i] = repStartValue[i]; }
  ------------------
  |  | 2638|  7.84k|#define ZSTDv07_REP_NUM    3
  ------------------
  |  Branch (2918:24): [True: 5.88k, False: 1.96k]
  ------------------
 2919|  1.96k|    return 0;
 2920|  1.96k|}
ZSTDv07_createDCtx_advanced:
 2923|    981|{
 2924|    981|    ZSTDv07_DCtx* dctx;
 2925|       |
 2926|    981|    if (!customMem.customAlloc && !customMem.customFree)
  ------------------
  |  Branch (2926:9): [True: 0, False: 981]
  |  Branch (2926:35): [True: 0, False: 0]
  ------------------
 2927|      0|        customMem = defaultCustomMem;
 2928|       |
 2929|    981|    if (!customMem.customAlloc || !customMem.customFree)
  ------------------
  |  Branch (2929:9): [True: 0, False: 981]
  |  Branch (2929:35): [True: 0, False: 981]
  ------------------
 2930|      0|        return NULL;
 2931|       |
 2932|    981|    dctx = (ZSTDv07_DCtx*) customMem.customAlloc(customMem.opaque, sizeof(ZSTDv07_DCtx));
 2933|    981|    if (!dctx) return NULL;
  ------------------
  |  Branch (2933:9): [True: 0, False: 981]
  ------------------
 2934|    981|    memcpy(&dctx->customMem, &customMem, sizeof(ZSTDv07_customMem));
 2935|    981|    ZSTDv07_decompressBegin(dctx);
 2936|    981|    return dctx;
 2937|    981|}
ZSTDv07_createDCtx:
 2940|    981|{
 2941|    981|    return ZSTDv07_createDCtx_advanced(defaultCustomMem);
 2942|    981|}
ZSTDv07_freeDCtx:
 2945|    981|{
 2946|    981|    if (dctx==NULL) return 0;   /* support free on NULL */
  ------------------
  |  Branch (2946:9): [True: 0, False: 981]
  ------------------
 2947|    981|    dctx->customMem.customFree(dctx->customMem.opaque, dctx);
 2948|    981|    return 0;   /* reserved as a potential error code in the future */
 2949|    981|}
ZSTDv07_getFrameParams:
 3096|  1.12k|{
 3097|  1.12k|    const BYTE* ip = (const BYTE*)src;
 3098|       |
 3099|  1.12k|    if (srcSize < ZSTDv07_frameHeaderSize_min) return ZSTDv07_frameHeaderSize_min;
  ------------------
  |  Branch (3099:9): [True: 0, False: 1.12k]
  ------------------
 3100|  1.12k|    memset(fparamsPtr, 0, sizeof(*fparamsPtr));
 3101|  1.12k|    if (MEM_readLE32(src) != ZSTDv07_MAGICNUMBER) {
  ------------------
  |  |  180|  1.12k|#define ZSTDv07_MAGICNUMBER            0xFD2FB527   /* v0.7 */
  ------------------
  |  Branch (3101:9): [True: 0, False: 1.12k]
  ------------------
 3102|      0|        if ((MEM_readLE32(src) & 0xFFFFFFF0U) == ZSTDv07_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |   41|      0|#define ZSTDv07_MAGIC_SKIPPABLE_START  0x184D2A50U
  ------------------
  |  Branch (3102:13): [True: 0, False: 0]
  ------------------
 3103|      0|            if (srcSize < ZSTDv07_skippableHeaderSize) return ZSTDv07_skippableHeaderSize; /* magic number + skippable frame length */
  ------------------
  |  Branch (3103:17): [True: 0, False: 0]
  ------------------
 3104|      0|            fparamsPtr->frameContentSize = MEM_readLE32((const char *)src + 4);
 3105|      0|            fparamsPtr->windowSize = 0; /* windowSize==0 means a frame is skippable */
 3106|      0|            return 0;
 3107|      0|        }
 3108|      0|        return ERROR(prefix_unknown);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3109|      0|    }
 3110|       |
 3111|       |    /* ensure there is enough `srcSize` to fully read/decode frame header */
 3112|  1.12k|    { size_t const fhsize = ZSTDv07_frameHeaderSize(src, srcSize);
 3113|  1.12k|      if (srcSize < fhsize) return fhsize; }
  ------------------
  |  Branch (3113:11): [True: 0, False: 1.12k]
  ------------------
 3114|       |
 3115|  1.12k|    {   BYTE const fhdByte = ip[4];
 3116|  1.12k|        size_t pos = 5;
 3117|  1.12k|        U32 const dictIDSizeCode = fhdByte&3;
 3118|  1.12k|        U32 const checksumFlag = (fhdByte>>2)&1;
 3119|  1.12k|        U32 const directMode = (fhdByte>>5)&1;
 3120|  1.12k|        U32 const fcsID = fhdByte>>6;
 3121|  1.12k|        U32 const windowSizeMax = 1U << ZSTDv07_WINDOWLOG_MAX;
  ------------------
  |  |   45|  1.12k|#define ZSTDv07_WINDOWLOG_MAX    ((U32)(MEM_32bits() ? ZSTDv07_WINDOWLOG_MAX_32 : ZSTDv07_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  |   43|      0|#define ZSTDv07_WINDOWLOG_MAX_32  25
  |  |  ------------------
  |  |               #define ZSTDv07_WINDOWLOG_MAX    ((U32)(MEM_32bits() ? ZSTDv07_WINDOWLOG_MAX_32 : ZSTDv07_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  |   44|  1.12k|#define ZSTDv07_WINDOWLOG_MAX_64  27
  |  |  ------------------
  |  |  |  Branch (45:41): [True: 0, False: 1.12k]
  |  |  ------------------
  ------------------
 3122|  1.12k|        U32 windowSize = 0;
 3123|  1.12k|        U32 dictID = 0;
 3124|  1.12k|        U64 frameContentSize = 0;
 3125|  1.12k|        if ((fhdByte & 0x08) != 0)   /* reserved bits, which must be zero */
  ------------------
  |  Branch (3125:13): [True: 8, False: 1.11k]
  ------------------
 3126|      8|            return ERROR(frameParameter_unsupported);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3127|  1.11k|        if (!directMode) {
  ------------------
  |  Branch (3127:13): [True: 898, False: 216]
  ------------------
 3128|    898|            BYTE const wlByte = ip[pos++];
 3129|    898|            U32 const windowLog = (wlByte >> 3) + ZSTDv07_WINDOWLOG_ABSOLUTEMIN;
  ------------------
  |  | 2654|    898|#define ZSTDv07_WINDOWLOG_ABSOLUTEMIN 10
  ------------------
 3130|    898|            if (windowLog > ZSTDv07_WINDOWLOG_MAX)
  ------------------
  |  |   45|    898|#define ZSTDv07_WINDOWLOG_MAX    ((U32)(MEM_32bits() ? ZSTDv07_WINDOWLOG_MAX_32 : ZSTDv07_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  |   43|      0|#define ZSTDv07_WINDOWLOG_MAX_32  25
  |  |  ------------------
  |  |               #define ZSTDv07_WINDOWLOG_MAX    ((U32)(MEM_32bits() ? ZSTDv07_WINDOWLOG_MAX_32 : ZSTDv07_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  |   44|    898|#define ZSTDv07_WINDOWLOG_MAX_64  27
  |  |  ------------------
  |  |  |  Branch (45:41): [True: 0, False: 898]
  |  |  ------------------
  ------------------
  |  Branch (3130:17): [True: 4, False: 894]
  ------------------
 3131|      4|                return ERROR(frameParameter_unsupported);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3132|    894|            windowSize = (1U << windowLog);
 3133|    894|            windowSize += (windowSize >> 3) * (wlByte&7);
 3134|    894|        }
 3135|       |
 3136|  1.11k|        switch(dictIDSizeCode)
 3137|  1.11k|        {
 3138|      0|            default:   /* impossible */
  ------------------
  |  Branch (3138:13): [True: 0, False: 1.11k]
  ------------------
 3139|    234|            case 0 : break;
  ------------------
  |  Branch (3139:13): [True: 234, False: 876]
  ------------------
 3140|    832|            case 1 : dictID = ip[pos]; pos++; break;
  ------------------
  |  Branch (3140:13): [True: 832, False: 278]
  ------------------
 3141|     11|            case 2 : dictID = MEM_readLE16(ip+pos); pos+=2; break;
  ------------------
  |  Branch (3141:13): [True: 11, False: 1.09k]
  ------------------
 3142|     33|            case 3 : dictID = MEM_readLE32(ip+pos); pos+=4; break;
  ------------------
  |  Branch (3142:13): [True: 33, False: 1.07k]
  ------------------
 3143|  1.11k|        }
 3144|  1.11k|        switch(fcsID)
 3145|  1.11k|        {
 3146|      0|            default:   /* impossible */
  ------------------
  |  Branch (3146:13): [True: 0, False: 1.11k]
  ------------------
 3147|    363|            case 0 : if (directMode) frameContentSize = ip[pos]; break;
  ------------------
  |  Branch (3147:13): [True: 363, False: 747]
  |  Branch (3147:26): [True: 23, False: 340]
  ------------------
 3148|    323|            case 1 : frameContentSize = MEM_readLE16(ip+pos)+256; break;
  ------------------
  |  Branch (3148:13): [True: 323, False: 787]
  ------------------
 3149|    329|            case 2 : frameContentSize = MEM_readLE32(ip+pos); break;
  ------------------
  |  Branch (3149:13): [True: 329, False: 781]
  ------------------
 3150|     95|            case 3 : frameContentSize = MEM_readLE64(ip+pos); break;
  ------------------
  |  Branch (3150:13): [True: 95, False: 1.01k]
  ------------------
 3151|  1.11k|        }
 3152|  1.11k|        if (!windowSize) windowSize = (U32)frameContentSize;
  ------------------
  |  Branch (3152:13): [True: 216, False: 894]
  ------------------
 3153|  1.11k|        if (windowSize > windowSizeMax)
  ------------------
  |  Branch (3153:13): [True: 17, False: 1.09k]
  ------------------
 3154|     17|            return ERROR(frameParameter_unsupported);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3155|  1.09k|        fparamsPtr->frameContentSize = frameContentSize;
 3156|  1.09k|        fparamsPtr->windowSize = windowSize;
 3157|  1.09k|        fparamsPtr->dictID = dictID;
 3158|  1.09k|        fparamsPtr->checksumFlag = checksumFlag;
 3159|  1.09k|    }
 3160|      0|    return 0;
 3161|  1.11k|}
ZSTDv07_decompress_usingDict:
 3824|    981|{
 3825|    981|    ZSTDv07_decompressBegin_usingDict(dctx, dict, dictSize);
 3826|    981|    ZSTDv07_checkContinuity(dctx, dst);
 3827|    981|    return ZSTDv07_decompressFrame(dctx, dst, dstCapacity, src, srcSize);
 3828|    981|}
ZSTDv07_findFrameSizeInfoLegacy:
 3861|  1.01k|{
 3862|  1.01k|    const BYTE* ip = (const BYTE*)src;
 3863|  1.01k|    size_t remainingSize = srcSize;
 3864|  1.01k|    size_t nbBlocks = 0;
 3865|       |
 3866|       |    /* check */
 3867|  1.01k|    if (srcSize < ZSTDv07_frameHeaderSize_min+ZSTDv07_blockHeaderSize) {
  ------------------
  |  Branch (3867:9): [True: 1, False: 1.01k]
  ------------------
 3868|      1|        ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(srcSize_wrong));
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3869|      1|        return;
 3870|      1|    }
 3871|       |
 3872|       |    /* Frame Header */
 3873|  1.01k|    {   size_t const frameHeaderSize = ZSTDv07_frameHeaderSize(src, srcSize);
 3874|  1.01k|        if (ZSTDv07_isError(frameHeaderSize)) {
  ------------------
  |  | 2856|  1.01k|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3874:13): [True: 0, False: 1.01k]
  ------------------
 3875|      0|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, frameHeaderSize);
 3876|      0|            return;
 3877|      0|        }
 3878|  1.01k|        if (MEM_readLE32(src) != ZSTDv07_MAGICNUMBER) {
  ------------------
  |  |  180|  1.01k|#define ZSTDv07_MAGICNUMBER            0xFD2FB527   /* v0.7 */
  ------------------
  |  Branch (3878:13): [True: 0, False: 1.01k]
  ------------------
 3879|      0|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(prefix_unknown));
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3880|      0|            return;
 3881|      0|        }
 3882|  1.01k|        if (srcSize < frameHeaderSize+ZSTDv07_blockHeaderSize) {
  ------------------
  |  Branch (3882:13): [True: 1, False: 1.01k]
  ------------------
 3883|      1|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(srcSize_wrong));
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3884|      1|            return;
 3885|      1|        }
 3886|  1.01k|        ip += frameHeaderSize; remainingSize -= frameHeaderSize;
 3887|  1.01k|    }
 3888|       |
 3889|       |    /* Loop on each block */
 3890|  2.83k|    while (1) {
  ------------------
  |  Branch (3890:12): [True: 2.83k, Folded]
  ------------------
 3891|  2.83k|        blockProperties_t blockProperties;
 3892|  2.83k|        size_t const cBlockSize = ZSTDv07_getcBlockSize(ip, remainingSize, &blockProperties);
 3893|  2.83k|        if (ZSTDv07_isError(cBlockSize)) {
  ------------------
  |  | 2856|  2.83k|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3893:13): [True: 1, False: 2.83k]
  ------------------
 3894|      1|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, cBlockSize);
 3895|      1|            return;
 3896|      1|        }
 3897|       |
 3898|  2.83k|        ip += ZSTDv07_blockHeaderSize;
 3899|  2.83k|        remainingSize -= ZSTDv07_blockHeaderSize;
 3900|       |
 3901|  2.83k|        if (blockProperties.blockType == bt_end) break;
  ------------------
  |  Branch (3901:13): [True: 981, False: 1.85k]
  ------------------
 3902|       |
 3903|  1.85k|        if (cBlockSize > remainingSize) {
  ------------------
  |  Branch (3903:13): [True: 31, False: 1.81k]
  ------------------
 3904|     31|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(srcSize_wrong));
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3905|     31|            return;
 3906|     31|        }
 3907|       |
 3908|  1.81k|        ip += cBlockSize;
 3909|  1.81k|        remainingSize -= cBlockSize;
 3910|  1.81k|        nbBlocks++;
 3911|  1.81k|    }
 3912|       |
 3913|    981|    *cSize = ip - (const BYTE*)src;
 3914|    981|    *dBound = nbBlocks * ZSTDv07_BLOCKSIZE_ABSOLUTEMAX;
  ------------------
  |  |  175|    981|#define ZSTDv07_BLOCKSIZE_ABSOLUTEMAX (128 * 1024)   /* define, for static allocation */
  ------------------
 3915|    981|}
ZSTDv07_decompressBegin_usingDict:
 4115|    981|{
 4116|    981|    { size_t const errorCode = ZSTDv07_decompressBegin(dctx);
 4117|    981|      if (ZSTDv07_isError(errorCode)) return errorCode; }
  ------------------
  |  | 2856|    981|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (4117:11): [True: 0, False: 981]
  ------------------
 4118|       |
 4119|    981|    if (dict && dictSize) {
  ------------------
  |  Branch (4119:9): [True: 981, False: 0]
  |  Branch (4119:17): [True: 330, False: 651]
  ------------------
 4120|    330|        size_t const errorCode = ZSTDv07_decompress_insertDictionary(dctx, dict, dictSize);
 4121|    330|        if (ZSTDv07_isError(errorCode)) return ERROR(dictionary_corrupted);
  ------------------
  |  | 2856|    330|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
                      if (ZSTDv07_isError(errorCode)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4121:13): [True: 0, False: 330]
  ------------------
 4122|    330|    }
 4123|       |
 4124|    981|    return 0;
 4125|    981|}
zstd_v07.c:MEM_readLE32:
  350|  12.1k|{
  351|  12.1k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (351:9): [True: 12.1k, False: 0]
  ------------------
  352|  12.1k|        return MEM_read32(memPtr);
  353|      0|    else
  354|      0|        return MEM_swap32(MEM_read32(memPtr));
  355|  12.1k|}
zstd_v07.c:MEM_isLittleEndian:
  268|  86.2k|{
  269|  86.2k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  270|  86.2k|    return one.c[0];
  271|  86.2k|}
zstd_v07.c:MEM_read32:
  279|  12.1k|{
  280|  12.1k|    U32 val; memcpy(&val, memPtr, sizeof(val)); return val;
  281|  12.1k|}
zstd_v07.c:FSEv07_abs:
 1150|  8.12k|static short FSEv07_abs(short a) { return (short)(a<0 ? -a : a); }
  ------------------
  |  Branch (1150:51): [True: 3.88k, False: 4.24k]
  ------------------
zstd_v07.c:BITv07_highbit32:
  473|   201k|{
  474|       |#   if defined(_MSC_VER)   /* Visual */
  475|       |    unsigned long r;
  476|       |    return _BitScanReverse(&r, val) ? (unsigned)r : 0;
  477|       |#   elif defined(__GNUC__) && (__GNUC__ >= 3)   /* Use GCC Intrinsic */
  478|       |    return __builtin_clz (val) ^ 31;
  479|       |#   else   /* Software version */
  480|       |    static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 };
  481|       |    U32 v = val;
  482|       |    v |= v >> 1;
  483|       |    v |= v >> 2;
  484|       |    v |= v >> 4;
  485|       |    v |= v >> 8;
  486|       |    v |= v >> 16;
  487|       |    return DeBruijnClz[ (U32) (v * 0x07C4ACDDU) >> 27];
  488|       |#   endif
  489|   201k|}
zstd_v07.c:FSEv07_decompress_usingDTable_generic:
 1536|    149|{
 1537|    149|    BYTE* const ostart = (BYTE*) dst;
 1538|    149|    BYTE* op = ostart;
 1539|    149|    BYTE* const omax = op + maxDstSize;
 1540|    149|    BYTE* const olimit = omax-3;
 1541|       |
 1542|    149|    BITv07_DStream_t bitD;
 1543|    149|    FSEv07_DState_t state1;
 1544|    149|    FSEv07_DState_t state2;
 1545|       |
 1546|       |    /* Init */
 1547|    149|    { size_t const errorCode = BITv07_initDStream(&bitD, cSrc, cSrcSize);   /* replaced last arg by maxCompressed Size */
 1548|    149|      if (FSEv07_isError(errorCode)) return errorCode; }
  ------------------
  |  | 1378|    149|#define FSEv07_isError ERR_isError
  ------------------
  |  Branch (1548:11): [True: 5, False: 144]
  ------------------
 1549|       |
 1550|    144|    FSEv07_initDState(&state1, &bitD, dt);
 1551|    144|    FSEv07_initDState(&state2, &bitD, dt);
 1552|       |
 1553|    144|#define FSEv07_GETSYMBOL(statePtr) fast ? FSEv07_decodeSymbolFast(statePtr, &bitD) : FSEv07_decodeSymbol(statePtr, &bitD)
 1554|       |
 1555|       |    /* 4 symbols per loop */
 1556|  1.27k|    for ( ; (BITv07_reloadDStream(&bitD)==BITv07_DStream_unfinished) && (op<olimit) ; op+=4) {
  ------------------
  |  Branch (1556:13): [True: 1.13k, False: 142]
  |  Branch (1556:73): [True: 1.13k, False: 2]
  ------------------
 1557|  1.13k|        op[0] = FSEv07_GETSYMBOL(&state1);
  ------------------
  |  | 1553|  1.13k|#define FSEv07_GETSYMBOL(statePtr) fast ? FSEv07_decodeSymbolFast(statePtr, &bitD) : FSEv07_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1553:36): [True: 525, False: 608]
  |  |  ------------------
  ------------------
 1558|       |
 1559|  1.13k|        if (FSEv07_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  |  899|  1.13k|#define FSEv07_MAX_TABLELOG  (FSEv07_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  876|  1.13k|#define FSEv07_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (1559:13): [Folded, False: 1.13k]
  ------------------
 1560|      0|            BITv07_reloadDStream(&bitD);
 1561|       |
 1562|  1.13k|        op[1] = FSEv07_GETSYMBOL(&state2);
  ------------------
  |  | 1553|  1.13k|#define FSEv07_GETSYMBOL(statePtr) fast ? FSEv07_decodeSymbolFast(statePtr, &bitD) : FSEv07_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1553:36): [True: 525, False: 608]
  |  |  ------------------
  ------------------
 1563|       |
 1564|  1.13k|        if (FSEv07_MAX_TABLELOG*4+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  |  899|  1.13k|#define FSEv07_MAX_TABLELOG  (FSEv07_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  876|  1.13k|#define FSEv07_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (1564:13): [Folded, False: 1.13k]
  ------------------
 1565|      0|            { if (BITv07_reloadDStream(&bitD) > BITv07_DStream_unfinished) { op+=2; break; } }
  ------------------
  |  Branch (1565:19): [True: 0, False: 0]
  ------------------
 1566|       |
 1567|  1.13k|        op[2] = FSEv07_GETSYMBOL(&state1);
  ------------------
  |  | 1553|  1.13k|#define FSEv07_GETSYMBOL(statePtr) fast ? FSEv07_decodeSymbolFast(statePtr, &bitD) : FSEv07_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1553:36): [True: 525, False: 608]
  |  |  ------------------
  ------------------
 1568|       |
 1569|  1.13k|        if (FSEv07_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  |  899|  1.13k|#define FSEv07_MAX_TABLELOG  (FSEv07_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  876|  1.13k|#define FSEv07_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (1569:13): [Folded, False: 1.13k]
  ------------------
 1570|      0|            BITv07_reloadDStream(&bitD);
 1571|       |
 1572|  1.13k|        op[3] = FSEv07_GETSYMBOL(&state2);
  ------------------
  |  | 1553|  1.13k|#define FSEv07_GETSYMBOL(statePtr) fast ? FSEv07_decodeSymbolFast(statePtr, &bitD) : FSEv07_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1553:36): [True: 525, False: 608]
  |  |  ------------------
  ------------------
 1573|  1.13k|    }
 1574|       |
 1575|       |    /* tail */
 1576|       |    /* note : BITv07_reloadDStream(&bitD) >= FSEv07_DStream_partiallyFilled; Ends at exactly BITv07_DStream_completed */
 1577|  2.63k|    while (1) {
  ------------------
  |  Branch (1577:12): [True: 2.63k, Folded]
  ------------------
 1578|  2.63k|        if (op>(omax-2)) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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 (1578:13): [True: 6, False: 2.62k]
  ------------------
 1579|       |
 1580|  2.62k|        *op++ = FSEv07_GETSYMBOL(&state1);
  ------------------
  |  | 1553|  2.62k|#define FSEv07_GETSYMBOL(statePtr) fast ? FSEv07_decodeSymbolFast(statePtr, &bitD) : FSEv07_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1553:36): [True: 691, False: 1.93k]
  |  |  ------------------
  ------------------
 1581|       |
 1582|  2.62k|        if (BITv07_reloadDStream(&bitD)==BITv07_DStream_overflow) {
  ------------------
  |  Branch (1582:13): [True: 84, False: 2.54k]
  ------------------
 1583|     84|            *op++ = FSEv07_GETSYMBOL(&state2);
  ------------------
  |  | 1553|     84|#define FSEv07_GETSYMBOL(statePtr) fast ? FSEv07_decodeSymbolFast(statePtr, &bitD) : FSEv07_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1553:36): [True: 33, False: 51]
  |  |  ------------------
  ------------------
 1584|     84|            break;
 1585|     84|        }
 1586|       |
 1587|  2.54k|        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 (1587:13): [True: 0, False: 2.54k]
  ------------------
 1588|       |
 1589|  2.54k|        *op++ = FSEv07_GETSYMBOL(&state2);
  ------------------
  |  | 1553|  2.54k|#define FSEv07_GETSYMBOL(statePtr) fast ? FSEv07_decodeSymbolFast(statePtr, &bitD) : FSEv07_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1553:36): [True: 658, False: 1.88k]
  |  |  ------------------
  ------------------
 1590|       |
 1591|  2.54k|        if (BITv07_reloadDStream(&bitD)==BITv07_DStream_overflow) {
  ------------------
  |  Branch (1591:13): [True: 54, False: 2.48k]
  ------------------
 1592|     54|            *op++ = FSEv07_GETSYMBOL(&state1);
  ------------------
  |  | 1553|     54|#define FSEv07_GETSYMBOL(statePtr) fast ? FSEv07_decodeSymbolFast(statePtr, &bitD) : FSEv07_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1553:36): [True: 27, False: 27]
  |  |  ------------------
  ------------------
 1593|     54|            break;
 1594|     54|    }   }
 1595|       |
 1596|    138|    return op-ostart;
 1597|    144|}
zstd_v07.c:BITv07_initDStream:
  503|    987|{
  504|    987|    if (srcSize < 1) { memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   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 (504:9): [True: 13, False: 974]
  ------------------
  505|       |
  506|    974|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (506:9): [True: 648, False: 326]
  ------------------
  507|    648|        bitD->start = (const char*)srcBuffer;
  508|    648|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  509|    648|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  510|    648|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  511|    648|          bitD->bitsConsumed = lastByte ? 8 - BITv07_highbit32(lastByte) : 0;
  ------------------
  |  Branch (511:32): [True: 545, False: 103]
  ------------------
  512|    648|          if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
  ------------------
  |  |   49|    103|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    103|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    103|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (512:15): [True: 103, False: 545]
  ------------------
  513|    648|    } else {
  514|    326|        bitD->start = (const char*)srcBuffer;
  515|    326|        bitD->ptr   = bitD->start;
  516|    326|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  517|    326|        switch(srcSize)
  518|    326|        {
  519|     29|            case 7: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);/* fall-through */
  ------------------
  |  Branch (519:13): [True: 29, False: 297]
  ------------------
  520|    102|            case 6: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);/* fall-through */
  ------------------
  |  Branch (520:13): [True: 73, False: 253]
  ------------------
  521|    130|            case 5: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);/* fall-through */
  ------------------
  |  Branch (521:13): [True: 28, False: 298]
  ------------------
  522|    162|            case 4: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[3]) << 24; /* fall-through */
  ------------------
  |  Branch (522:13): [True: 32, False: 294]
  ------------------
  523|    190|            case 3: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[2]) << 16; /* fall-through */
  ------------------
  |  Branch (523:13): [True: 28, False: 298]
  ------------------
  524|    286|            case 2: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[1]) <<  8; /* fall-through */
  ------------------
  |  Branch (524:13): [True: 96, False: 230]
  ------------------
  525|    326|            default: break;
  ------------------
  |  Branch (525:13): [True: 40, False: 286]
  ------------------
  526|    326|        }
  527|    326|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  528|    326|          bitD->bitsConsumed = lastByte ? 8 - BITv07_highbit32(lastByte) : 0;
  ------------------
  |  Branch (528:32): [True: 299, False: 27]
  ------------------
  529|    326|          if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
  ------------------
  |  |   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 (529:15): [True: 27, False: 299]
  ------------------
  530|    299|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  531|    299|    }
  532|       |
  533|    844|    return srcSize;
  534|    974|}
zstd_v07.c:MEM_readLEST:
  367|  73.1k|{
  368|  73.1k|    if (MEM_32bits())
  ------------------
  |  Branch (368:9): [True: 0, False: 73.1k]
  ------------------
  369|      0|        return (size_t)MEM_readLE32(memPtr);
  370|  73.1k|    else
  371|  73.1k|        return (size_t)MEM_readLE64(memPtr);
  372|  73.1k|}
zstd_v07.c:FSEv07_initDState:
  818|  1.20k|{
  819|  1.20k|    const void* ptr = dt;
  820|  1.20k|    const FSEv07_DTableHeader* const DTableH = (const FSEv07_DTableHeader*)ptr;
  821|  1.20k|    DStatePtr->state = BITv07_readBits(bitD, DTableH->tableLog);
  822|  1.20k|    BITv07_reloadDStream(bitD);
  823|  1.20k|    DStatePtr->table = dt + 1;
  824|  1.20k|}
zstd_v07.c:BITv07_readBits:
  557|   223k|{
  558|   223k|    size_t const value = BITv07_lookBits(bitD, nbBits);
  559|   223k|    BITv07_skipBits(bitD, nbBits);
  560|   223k|    return value;
  561|   223k|}
zstd_v07.c:BITv07_lookBits:
  538|   223k|{
  539|   223k|    U32 const bitMask = sizeof(bitD->bitContainer)*8 - 1;
  540|   223k|    return ((bitD->bitContainer << (bitD->bitsConsumed & bitMask)) >> 1) >> ((bitMask-nbBits) & bitMask);
  541|   223k|}
zstd_v07.c:BITv07_skipBits:
  552|   278k|{
  553|   278k|    bitD->bitsConsumed += nbBits;
  554|   278k|}
zstd_v07.c:BITv07_reloadDStream:
  573|  80.0k|{
  574|  80.0k|    if (bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))  /* should not happen => corruption detected */
  ------------------
  |  Branch (574:9): [True: 288, False: 79.7k]
  ------------------
  575|    288|        return BITv07_DStream_overflow;
  576|       |
  577|  79.7k|    if (bitD->ptr >= bitD->start + sizeof(bitD->bitContainer)) {
  ------------------
  |  Branch (577:9): [True: 6.31k, False: 73.4k]
  ------------------
  578|  6.31k|        bitD->ptr -= bitD->bitsConsumed >> 3;
  579|  6.31k|        bitD->bitsConsumed &= 7;
  580|  6.31k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  581|  6.31k|        return BITv07_DStream_unfinished;
  582|  6.31k|    }
  583|  73.4k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (583:9): [True: 7.28k, False: 66.1k]
  ------------------
  584|  7.28k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BITv07_DStream_endOfBuffer;
  ------------------
  |  Branch (584:13): [True: 6.98k, False: 299]
  ------------------
  585|    299|        return BITv07_DStream_completed;
  586|  7.28k|    }
  587|  66.1k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  588|  66.1k|        BITv07_DStream_status result = BITv07_DStream_unfinished;
  589|  66.1k|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (589:13): [True: 86, False: 66.0k]
  ------------------
  590|     86|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  591|     86|            result = BITv07_DStream_endOfBuffer;
  592|     86|        }
  593|  66.1k|        bitD->ptr -= nbBytes;
  594|  66.1k|        bitD->bitsConsumed -= nbBytes*8;
  595|  66.1k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD) */
  596|  66.1k|        return result;
  597|  73.4k|    }
  598|  73.4k|}
zstd_v07.c:FSEv07_decodeSymbolFast:
  854|  3.50k|{
  855|  3.50k|    FSEv07_decode_t const DInfo = ((const FSEv07_decode_t*)(DStatePtr->table))[DStatePtr->state];
  856|  3.50k|    U32 const nbBits = DInfo.nbBits;
  857|  3.50k|    BYTE const symbol = DInfo.symbol;
  858|  3.50k|    size_t const lowBits = BITv07_readBitsFast(bitD, nbBits);
  859|       |
  860|  3.50k|    DStatePtr->state = DInfo.newState + lowBits;
  861|  3.50k|    return symbol;
  862|  3.50k|}
zstd_v07.c:BITv07_readBitsFast:
  566|  3.50k|{
  567|  3.50k|    size_t const value = BITv07_lookBitsFast(bitD, nbBits);
  568|  3.50k|    BITv07_skipBits(bitD, nbBits);
  569|  3.50k|    return value;
  570|  3.50k|}
zstd_v07.c:BITv07_lookBitsFast:
  546|  54.9k|{
  547|  54.9k|    U32 const bitMask = sizeof(bitD->bitContainer)*8 - 1;
  548|  54.9k|    return (bitD->bitContainer << (bitD->bitsConsumed & bitMask)) >> (((bitMask+1)-nbBits) & bitMask);
  549|  54.9k|}
zstd_v07.c:FSEv07_decodeSymbol:
  841|  6.32k|{
  842|  6.32k|    FSEv07_decode_t const DInfo = ((const FSEv07_decode_t*)(DStatePtr->table))[DStatePtr->state];
  843|  6.32k|    U32 const nbBits = DInfo.nbBits;
  844|  6.32k|    BYTE const symbol = DInfo.symbol;
  845|  6.32k|    size_t const lowBits = BITv07_readBits(bitD, nbBits);
  846|       |
  847|  6.32k|    DStatePtr->state = DInfo.newState + lowBits;
  848|  6.32k|    return symbol;
  849|  6.32k|}
zstd_v07.c:HUFv07_getDTableDesc:
 1708|    508|{
 1709|    508|    DTableDesc dtd;
 1710|    508|    memcpy(&dtd, table, sizeof(dtd));
 1711|    508|    return dtd;
 1712|    508|}
zstd_v07.c:HUFv07_decompress1X2_usingDTable_internal:
 1816|     76|{
 1817|     76|    BYTE* op = (BYTE*)dst;
 1818|     76|    BYTE* const oend = op + dstSize;
 1819|     76|    const void* dtPtr = DTable + 1;
 1820|     76|    const HUFv07_DEltX2* const dt = (const HUFv07_DEltX2*)dtPtr;
 1821|     76|    BITv07_DStream_t bitD;
 1822|     76|    DTableDesc const dtd = HUFv07_getDTableDesc(DTable);
 1823|     76|    U32 const dtLog = dtd.tableLog;
 1824|       |
 1825|     76|    { size_t const errorCode = BITv07_initDStream(&bitD, cSrc, cSrcSize);
 1826|     76|      if (HUFv07_isError(errorCode)) return errorCode; }
  ------------------
  |  Branch (1826:11): [True: 21, False: 55]
  ------------------
 1827|       |
 1828|     55|    HUFv07_decodeStreamX2(op, &bitD, oend, dt, dtLog);
 1829|       |
 1830|       |    /* check */
 1831|     55|    if (!BITv07_endOfDStream(&bitD)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     52|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     52|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     52|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1831:9): [True: 52, False: 3]
  ------------------
 1832|       |
 1833|      3|    return dstSize;
 1834|     55|}
zstd_v07.c:HUFv07_decodeStreamX2:
 1790|    283|{
 1791|    283|    BYTE* const pStart = p;
 1792|       |
 1793|       |    /* up to 4 symbols at a time */
 1794|  1.41k|    while ((BITv07_reloadDStream(bitDPtr) == BITv07_DStream_unfinished) && (p <= pEnd-4)) {
  ------------------
  |  Branch (1794:12): [True: 1.18k, False: 230]
  |  Branch (1794:76): [True: 1.13k, False: 53]
  ------------------
 1795|  1.13k|        HUFv07_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 1786|  1.13k|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1786:9): [True: 1.13k, False: 0]
  |  |  ------------------
  |  | 1787|  1.13k|        HUFv07_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1779|  1.13k|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1796|  1.13k|        HUFv07_DECODE_SYMBOLX2_1(p, bitDPtr);
  ------------------
  |  | 1782|  1.13k|    if (MEM_64bits() || (HUFv07_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |  997|      0|#define HUFv07_TABLELOG_MAX  12           /* max configured tableLog (for static allocation); can be modified up to HUFv07_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (1782:9): [True: 1.13k, False: 0]
  |  |  |  Branch (1782:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1783|  1.13k|        HUFv07_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1779|  1.13k|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1797|  1.13k|        HUFv07_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 1786|  1.13k|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1786:9): [True: 1.13k, False: 0]
  |  |  ------------------
  |  | 1787|  1.13k|        HUFv07_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1779|  1.13k|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1798|  1.13k|        HUFv07_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1779|  1.13k|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 1799|  1.13k|    }
 1800|       |
 1801|       |    /* closer to the end */
 1802|    363|    while ((BITv07_reloadDStream(bitDPtr) == BITv07_DStream_unfinished) && (p < pEnd))
  ------------------
  |  Branch (1802:12): [True: 124, False: 239]
  |  Branch (1802:76): [True: 80, False: 44]
  ------------------
 1803|     80|        HUFv07_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1779|     80|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 1804|       |
 1805|       |    /* no more data to retrieve from bitstream, hence no need to reload */
 1806|  47.1k|    while (p < pEnd)
  ------------------
  |  Branch (1806:12): [True: 46.8k, False: 283]
  ------------------
 1807|  46.8k|        HUFv07_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1779|  46.8k|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 1808|       |
 1809|    283|    return pEnd-pStart;
 1810|    283|}
zstd_v07.c:MEM_64bits:
  265|  3.39k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_v07.c:HUFv07_decodeSymbolX2:
 1771|  51.4k|{
 1772|  51.4k|    size_t const val = BITv07_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */
 1773|  51.4k|    BYTE const c = dt[val].byte;
 1774|  51.4k|    BITv07_skipBits(Dstream, dt[val].nbBits);
 1775|  51.4k|    return c;
 1776|  51.4k|}
zstd_v07.c:BITv07_endOfDStream:
  604|    283|{
  605|    283|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (605:13): [True: 240, False: 43]
  |  Branch (605:49): [True: 8, False: 232]
  ------------------
  606|    283|}
zstd_v07.c:HUFv07_decompress4X2_usingDTable_internal:
 1869|    177|{
 1870|       |    /* Check */
 1871|    177|    if (cSrcSize < 10) return ERROR(corruption_detected);  /* strict minimum : jump table + 1 byte per stream */
  ------------------
  |  |   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 (1871:9): [True: 3, False: 174]
  ------------------
 1872|       |
 1873|    174|    {   const BYTE* const istart = (const BYTE*) cSrc;
 1874|    174|        BYTE* const ostart = (BYTE*) dst;
 1875|    174|        BYTE* const oend = ostart + dstSize;
 1876|    174|        const void* const dtPtr = DTable + 1;
 1877|    174|        const HUFv07_DEltX2* const dt = (const HUFv07_DEltX2*)dtPtr;
 1878|       |
 1879|       |        /* Init */
 1880|    174|        BITv07_DStream_t bitD1;
 1881|    174|        BITv07_DStream_t bitD2;
 1882|    174|        BITv07_DStream_t bitD3;
 1883|    174|        BITv07_DStream_t bitD4;
 1884|    174|        size_t const length1 = MEM_readLE16(istart);
 1885|    174|        size_t const length2 = MEM_readLE16(istart+2);
 1886|    174|        size_t const length3 = MEM_readLE16(istart+4);
 1887|    174|        size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6);
 1888|    174|        const BYTE* const istart1 = istart + 6;  /* jumpTable */
 1889|    174|        const BYTE* const istart2 = istart1 + length1;
 1890|    174|        const BYTE* const istart3 = istart2 + length2;
 1891|    174|        const BYTE* const istart4 = istart3 + length3;
 1892|    174|        const size_t segmentSize = (dstSize+3) / 4;
 1893|    174|        BYTE* const opStart2 = ostart + segmentSize;
 1894|    174|        BYTE* const opStart3 = opStart2 + segmentSize;
 1895|    174|        BYTE* const opStart4 = opStart3 + segmentSize;
 1896|    174|        BYTE* op1 = ostart;
 1897|    174|        BYTE* op2 = opStart2;
 1898|    174|        BYTE* op3 = opStart3;
 1899|    174|        BYTE* op4 = opStart4;
 1900|    174|        U32 endSignal;
 1901|    174|        DTableDesc const dtd = HUFv07_getDTableDesc(DTable);
 1902|    174|        U32 const dtLog = dtd.tableLog;
 1903|       |
 1904|    174|        if (length4 > cSrcSize) return ERROR(corruption_detected);   /* overflow */
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1904:13): [True: 24, False: 150]
  ------------------
 1905|    150|        { size_t const errorCode = BITv07_initDStream(&bitD1, istart1, length1);
 1906|    150|          if (HUFv07_isError(errorCode)) return errorCode; }
  ------------------
  |  Branch (1906:15): [True: 28, False: 122]
  ------------------
 1907|    122|        { size_t const errorCode = BITv07_initDStream(&bitD2, istart2, length2);
 1908|    122|          if (HUFv07_isError(errorCode)) return errorCode; }
  ------------------
  |  Branch (1908:15): [True: 27, False: 95]
  ------------------
 1909|     95|        { size_t const errorCode = BITv07_initDStream(&bitD3, istart3, length3);
 1910|     95|          if (HUFv07_isError(errorCode)) return errorCode; }
  ------------------
  |  Branch (1910:15): [True: 28, False: 67]
  ------------------
 1911|     67|        { size_t const errorCode = BITv07_initDStream(&bitD4, istart4, length4);
 1912|     67|          if (HUFv07_isError(errorCode)) return errorCode; }
  ------------------
  |  Branch (1912:15): [True: 10, False: 57]
  ------------------
 1913|       |
 1914|       |        /* 16-32 symbols per loop (4-8 symbols per stream) */
 1915|     57|        endSignal = BITv07_reloadDStream(&bitD1) | BITv07_reloadDStream(&bitD2) | BITv07_reloadDStream(&bitD3) | BITv07_reloadDStream(&bitD4);
 1916|     57|        for ( ; (endSignal==BITv07_DStream_unfinished) && (op4<(oend-7)) ; ) {
  ------------------
  |  Branch (1916:17): [True: 0, False: 57]
  |  Branch (1916:59): [True: 0, False: 0]
  ------------------
 1917|      0|            HUFv07_DECODE_SYMBOLX2_2(op1, &bitD1);
  ------------------
  |  | 1786|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1786:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1787|      0|        HUFv07_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1779|      0|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1918|      0|            HUFv07_DECODE_SYMBOLX2_2(op2, &bitD2);
  ------------------
  |  | 1786|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1786:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1787|      0|        HUFv07_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1779|      0|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1919|      0|            HUFv07_DECODE_SYMBOLX2_2(op3, &bitD3);
  ------------------
  |  | 1786|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1786:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1787|      0|        HUFv07_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1779|      0|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1920|      0|            HUFv07_DECODE_SYMBOLX2_2(op4, &bitD4);
  ------------------
  |  | 1786|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1786:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1787|      0|        HUFv07_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1779|      0|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1921|      0|            HUFv07_DECODE_SYMBOLX2_1(op1, &bitD1);
  ------------------
  |  | 1782|      0|    if (MEM_64bits() || (HUFv07_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |  997|      0|#define HUFv07_TABLELOG_MAX  12           /* max configured tableLog (for static allocation); can be modified up to HUFv07_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (1782:9): [True: 0, False: 0]
  |  |  |  Branch (1782:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1783|      0|        HUFv07_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1779|      0|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1922|      0|            HUFv07_DECODE_SYMBOLX2_1(op2, &bitD2);
  ------------------
  |  | 1782|      0|    if (MEM_64bits() || (HUFv07_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |  997|      0|#define HUFv07_TABLELOG_MAX  12           /* max configured tableLog (for static allocation); can be modified up to HUFv07_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (1782:9): [True: 0, False: 0]
  |  |  |  Branch (1782:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1783|      0|        HUFv07_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1779|      0|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1923|      0|            HUFv07_DECODE_SYMBOLX2_1(op3, &bitD3);
  ------------------
  |  | 1782|      0|    if (MEM_64bits() || (HUFv07_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |  997|      0|#define HUFv07_TABLELOG_MAX  12           /* max configured tableLog (for static allocation); can be modified up to HUFv07_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (1782:9): [True: 0, False: 0]
  |  |  |  Branch (1782:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1783|      0|        HUFv07_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1779|      0|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1924|      0|            HUFv07_DECODE_SYMBOLX2_1(op4, &bitD4);
  ------------------
  |  | 1782|      0|    if (MEM_64bits() || (HUFv07_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |  997|      0|#define HUFv07_TABLELOG_MAX  12           /* max configured tableLog (for static allocation); can be modified up to HUFv07_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (1782:9): [True: 0, False: 0]
  |  |  |  Branch (1782:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1783|      0|        HUFv07_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1779|      0|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1925|      0|            HUFv07_DECODE_SYMBOLX2_2(op1, &bitD1);
  ------------------
  |  | 1786|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1786:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1787|      0|        HUFv07_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1779|      0|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1926|      0|            HUFv07_DECODE_SYMBOLX2_2(op2, &bitD2);
  ------------------
  |  | 1786|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1786:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1787|      0|        HUFv07_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1779|      0|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1927|      0|            HUFv07_DECODE_SYMBOLX2_2(op3, &bitD3);
  ------------------
  |  | 1786|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1786:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1787|      0|        HUFv07_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1779|      0|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1928|      0|            HUFv07_DECODE_SYMBOLX2_2(op4, &bitD4);
  ------------------
  |  | 1786|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1786:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1787|      0|        HUFv07_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1779|      0|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1929|      0|            HUFv07_DECODE_SYMBOLX2_0(op1, &bitD1);
  ------------------
  |  | 1779|      0|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 1930|      0|            HUFv07_DECODE_SYMBOLX2_0(op2, &bitD2);
  ------------------
  |  | 1779|      0|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 1931|      0|            HUFv07_DECODE_SYMBOLX2_0(op3, &bitD3);
  ------------------
  |  | 1779|      0|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 1932|      0|            HUFv07_DECODE_SYMBOLX2_0(op4, &bitD4);
  ------------------
  |  | 1779|      0|    *ptr++ = HUFv07_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 1933|      0|            endSignal = BITv07_reloadDStream(&bitD1) | BITv07_reloadDStream(&bitD2) | BITv07_reloadDStream(&bitD3) | BITv07_reloadDStream(&bitD4);
 1934|      0|        }
 1935|       |
 1936|       |        /* check corruption */
 1937|     57|        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 (1937:13): [True: 0, False: 57]
  ------------------
 1938|     57|        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 (1938:13): [True: 0, False: 57]
  ------------------
 1939|     57|        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 (1939:13): [True: 0, False: 57]
  ------------------
 1940|       |        /* note : op4 supposed already verified within main loop */
 1941|       |
 1942|       |        /* finish bitStreams one by one */
 1943|     57|        HUFv07_decodeStreamX2(op1, &bitD1, opStart2, dt, dtLog);
 1944|     57|        HUFv07_decodeStreamX2(op2, &bitD2, opStart3, dt, dtLog);
 1945|     57|        HUFv07_decodeStreamX2(op3, &bitD3, opStart4, dt, dtLog);
 1946|     57|        HUFv07_decodeStreamX2(op4, &bitD4, oend,     dt, dtLog);
 1947|       |
 1948|       |        /* check */
 1949|     57|        endSignal = BITv07_endOfDStream(&bitD1) & BITv07_endOfDStream(&bitD2) & BITv07_endOfDStream(&bitD3) & BITv07_endOfDStream(&bitD4);
 1950|     57|        if (!endSignal) return ERROR(corruption_detected);
  ------------------
  |  |   49|     57|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     57|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     57|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1950:13): [True: 57, False: 0]
  ------------------
 1951|       |
 1952|       |        /* decoded size */
 1953|      0|        return dstSize;
 1954|     57|    }
 1955|     57|}
zstd_v07.c:ZSTDv07_defaultAllocFunction:
 2577|    981|{
 2578|    981|    void* address = malloc(size);
 2579|    981|    (void)opaque;
 2580|       |    /* printf("alloc %p, %d opaque=%p \n", address, (int)size, opaque); */
 2581|    981|    return address;
 2582|    981|}
zstd_v07.c:ZSTDv07_defaultFreeFunction:
 2585|    981|{
 2586|    981|    (void)opaque;
 2587|       |    /* if (address) printf("free %p opaque=%p \n", address, opaque); */
 2588|    981|    free(address);
 2589|    981|}
zstd_v07.c:ZSTDv07_frameHeaderSize:
 3078|  3.11k|{
 3079|  3.11k|    if (srcSize < ZSTDv07_frameHeaderSize_min) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3079:9): [True: 0, False: 3.11k]
  ------------------
 3080|  3.11k|    {   BYTE const fhd = ((const BYTE*)src)[4];
 3081|  3.11k|        U32 const dictID= fhd & 3;
 3082|  3.11k|        U32 const directMode = (fhd >> 5) & 1;
 3083|  3.11k|        U32 const fcsId = fhd >> 6;
 3084|  3.11k|        return ZSTDv07_frameHeaderSize_min + !directMode + ZSTDv07_did_fieldSize[dictID] + ZSTDv07_fcs_fieldSize[fcsId]
 3085|  3.11k|                + (directMode && !ZSTDv07_fcs_fieldSize[fcsId]);
  ------------------
  |  Branch (3085:20): [True: 623, False: 2.49k]
  |  Branch (3085:34): [True: 70, False: 553]
  ------------------
 3086|  3.11k|    }
 3087|  3.11k|}
zstd_v07.c:MEM_32bits:
  264|   289k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_v07.c:MEM_readLE16:
  329|    889|{
  330|    889|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (330:9): [True: 889, False: 0]
  ------------------
  331|    889|        return MEM_read16(memPtr);
  332|      0|    else {
  333|      0|        const BYTE* p = (const BYTE*)memPtr;
  334|      0|        return (U16)(p[0] + (p[1]<<8));
  335|      0|    }
  336|    889|}
zstd_v07.c:MEM_read16:
  274|    889|{
  275|    889|    U16 val; memcpy(&val, memPtr, sizeof(val)); return val;
  276|    889|}
zstd_v07.c:MEM_readLE64:
  359|  73.2k|{
  360|  73.2k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (360:9): [True: 73.2k, False: 0]
  ------------------
  361|  73.2k|        return MEM_read64(memPtr);
  362|      0|    else
  363|      0|        return MEM_swap64(MEM_read64(memPtr));
  364|  73.2k|}
zstd_v07.c:MEM_read64:
  284|  73.2k|{
  285|  73.2k|    U64 val; memcpy(&val, memPtr, sizeof(val)); return val;
  286|  73.2k|}
zstd_v07.c:ZSTDv07_checkContinuity:
 3678|    981|{
 3679|    981|    if (dst != dctx->previousDstEnd) {   /* not contiguous */
  ------------------
  |  Branch (3679:9): [True: 981, False: 0]
  ------------------
 3680|    981|        dctx->dictEnd = dctx->previousDstEnd;
 3681|    981|        dctx->vBase = (const char*)dst - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->base));
 3682|    981|        dctx->base = dst;
 3683|    981|        dctx->previousDstEnd = dst;
 3684|    981|    }
 3685|    981|}
zstd_v07.c:ZSTDv07_decompressBlock_internal:
 3691|    833|{   /* blockType == blockCompressed */
 3692|    833|    const BYTE* ip = (const BYTE*)src;
 3693|       |
 3694|    833|    if (srcSize >= ZSTDv07_BLOCKSIZE_ABSOLUTEMAX) return ERROR(srcSize_wrong);
  ------------------
  |  |  175|    833|#define ZSTDv07_BLOCKSIZE_ABSOLUTEMAX (128 * 1024)   /* define, for static allocation */
  ------------------
                  if (srcSize >= ZSTDv07_BLOCKSIZE_ABSOLUTEMAX) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3694:9): [True: 0, False: 833]
  ------------------
 3695|       |
 3696|       |    /* Decode literals sub-block */
 3697|    833|    {   size_t const litCSize = ZSTDv07_decodeLiteralsBlock(dctx, src, srcSize);
 3698|    833|        if (ZSTDv07_isError(litCSize)) return litCSize;
  ------------------
  |  | 2856|    833|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3698:13): [True: 410, False: 423]
  ------------------
 3699|    423|        ip += litCSize;
 3700|    423|        srcSize -= litCSize;
 3701|    423|    }
 3702|      0|    return ZSTDv07_decompressSequences(dctx, dst, dstCapacity, ip, srcSize);
 3703|    833|}
zstd_v07.c:ZSTDv07_decodeLiteralsBlock:
 3231|    833|{
 3232|    833|    const BYTE* const istart = (const BYTE*) src;
 3233|       |
 3234|    833|    if (srcSize < MIN_CBLOCK_SIZE) return ERROR(corruption_detected);
  ------------------
  |  | 2663|    833|#define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */ + MIN_SEQUENCES_SIZE /* nbSeq==0 */)   /* for a non-null block */
  |  |  ------------------
  |  |  |  | 2662|    833|#define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */
  |  |  ------------------
  ------------------
                  if (srcSize < MIN_CBLOCK_SIZE) return ERROR(corruption_detected);
  ------------------
  |  |   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 (3234:9): [True: 7, False: 826]
  ------------------
 3235|       |
 3236|    826|    switch((litBlockType_t)(istart[0]>> 6))
 3237|    826|    {
 3238|    387|    case lbt_huffman:
  ------------------
  |  Branch (3238:5): [True: 387, False: 439]
  ------------------
 3239|    387|        {   size_t litSize, litCSize, singleStream=0;
 3240|    387|            U32 lhSize = (istart[0] >> 4) & 3;
 3241|    387|            if (srcSize < 5) return ERROR(corruption_detected);   /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for lhSize, + cSize (+nbSeq) */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3241:17): [True: 0, False: 387]
  ------------------
 3242|    387|            switch(lhSize)
 3243|    387|            {
 3244|    358|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (3244:13): [True: 267, False: 120]
  |  Branch (3244:21): [True: 91, False: 296]
  |  Branch (3244:29): [True: 0, False: 387]
  ------------------
 3245|       |                /* 2 - 2 - 10 - 10 */
 3246|    358|                lhSize=3;
 3247|    358|                singleStream = istart[0] & 16;
 3248|    358|                litSize  = ((istart[0] & 15) << 6) + (istart[1] >> 2);
 3249|    358|                litCSize = ((istart[1] &  3) << 8) + istart[2];
 3250|    358|                break;
 3251|      9|            case 2:
  ------------------
  |  Branch (3251:13): [True: 9, False: 378]
  ------------------
 3252|       |                /* 2 - 2 - 14 - 14 */
 3253|      9|                lhSize=4;
 3254|      9|                litSize  = ((istart[0] & 15) << 10) + (istart[1] << 2) + (istart[2] >> 6);
 3255|      9|                litCSize = ((istart[2] & 63) <<  8) + istart[3];
 3256|      9|                break;
 3257|     20|            case 3:
  ------------------
  |  Branch (3257:13): [True: 20, False: 367]
  ------------------
 3258|       |                /* 2 - 2 - 18 - 18 */
 3259|     20|                lhSize=5;
 3260|     20|                litSize  = ((istart[0] & 15) << 14) + (istart[1] << 6) + (istart[2] >> 2);
 3261|     20|                litCSize = ((istart[2] &  3) << 16) + (istart[3] << 8) + istart[4];
 3262|     20|                break;
 3263|    387|            }
 3264|    387|            if (litSize > ZSTDv07_BLOCKSIZE_ABSOLUTEMAX) return ERROR(corruption_detected);
  ------------------
  |  |  175|    387|#define ZSTDv07_BLOCKSIZE_ABSOLUTEMAX (128 * 1024)   /* define, for static allocation */
  ------------------
                          if (litSize > ZSTDv07_BLOCKSIZE_ABSOLUTEMAX) 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 (3264:17): [True: 1, False: 386]
  ------------------
 3265|    386|            if (litCSize + lhSize > srcSize) return ERROR(corruption_detected);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3265:17): [True: 29, False: 357]
  ------------------
 3266|       |
 3267|    357|            if (HUFv07_isError(singleStream ?
  ------------------
  |  | 2858|    357|#define HUFv07_isError  ERR_isError
  ------------------
  |  Branch (3267:17): [True: 354, False: 3]
  |  Branch (3267:32): [True: 86, False: 271]
  ------------------
 3268|     86|                            HUFv07_decompress1X2_DCtx(dctx->hufTable, dctx->litBuffer, litSize, istart+lhSize, litCSize) :
 3269|    357|                            HUFv07_decompress4X_hufOnly (dctx->hufTable, dctx->litBuffer, litSize, istart+lhSize, litCSize) ))
 3270|    354|                return ERROR(corruption_detected);
  ------------------
  |  |   49|    354|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    354|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    354|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3271|       |
 3272|      3|            dctx->litPtr = dctx->litBuffer;
 3273|      3|            dctx->litSize = litSize;
 3274|      3|            dctx->litEntropy = 1;
 3275|      3|            memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  | 2721|      3|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3276|      3|            return litCSize + lhSize;
 3277|    357|        }
 3278|      3|    case lbt_repeat:
  ------------------
  |  Branch (3278:5): [True: 3, False: 823]
  ------------------
 3279|      3|        {   size_t litSize, litCSize;
 3280|      3|            U32 lhSize = ((istart[0]) >> 4) & 3;
 3281|      3|            if (lhSize != 1)  /* only case supported for now : small litSize, single stream */
  ------------------
  |  Branch (3281:17): [True: 2, False: 1]
  ------------------
 3282|      2|                return ERROR(corruption_detected);
  ------------------
  |  |   49|      2|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      2|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      2|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3283|      1|            if (dctx->litEntropy==0)
  ------------------
  |  Branch (3283:17): [True: 1, False: 0]
  ------------------
 3284|      1|                return ERROR(dictionary_corrupted);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3285|       |
 3286|       |            /* 2 - 2 - 10 - 10 */
 3287|      0|            lhSize=3;
 3288|      0|            litSize  = ((istart[0] & 15) << 6) + (istart[1] >> 2);
 3289|      0|            litCSize = ((istart[1] &  3) << 8) + istart[2];
 3290|      0|            if (litCSize + lhSize > srcSize) return ERROR(corruption_detected);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3290:17): [True: 0, False: 0]
  ------------------
 3291|       |
 3292|      0|            {   size_t const errorCode = HUFv07_decompress1X4_usingDTable(dctx->litBuffer, litSize, istart+lhSize, litCSize, dctx->hufTable);
 3293|      0|                if (HUFv07_isError(errorCode)) return ERROR(corruption_detected);
  ------------------
  |  | 2858|      0|#define HUFv07_isError  ERR_isError
  ------------------
                              if (HUFv07_isError(errorCode)) return ERROR(corruption_detected);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3293:21): [True: 0, False: 0]
  ------------------
 3294|      0|            }
 3295|      0|            dctx->litPtr = dctx->litBuffer;
 3296|      0|            dctx->litSize = litSize;
 3297|      0|            memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  | 2721|      0|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3298|      0|            return litCSize + lhSize;
 3299|      0|        }
 3300|     59|    case lbt_raw:
  ------------------
  |  Branch (3300:5): [True: 59, False: 767]
  ------------------
 3301|     59|        {   size_t litSize;
 3302|     59|            U32 lhSize = ((istart[0]) >> 4) & 3;
 3303|     59|            switch(lhSize)
 3304|     59|            {
 3305|     46|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (3305:13): [True: 31, False: 28]
  |  Branch (3305:21): [True: 15, False: 44]
  |  Branch (3305:29): [True: 0, False: 59]
  ------------------
 3306|     46|                lhSize=1;
 3307|     46|                litSize = istart[0] & 31;
 3308|     46|                break;
 3309|      3|            case 2:
  ------------------
  |  Branch (3309:13): [True: 3, False: 56]
  ------------------
 3310|      3|                litSize = ((istart[0] & 15) << 8) + istart[1];
 3311|      3|                break;
 3312|     10|            case 3:
  ------------------
  |  Branch (3312:13): [True: 10, False: 49]
  ------------------
 3313|     10|                litSize = ((istart[0] & 15) << 16) + (istart[1] << 8) + istart[2];
 3314|     10|                break;
 3315|     59|            }
 3316|       |
 3317|     59|            if (lhSize+litSize+WILDCOPY_OVERLENGTH > srcSize) {  /* risk reading beyond src buffer with wildcopy */
  ------------------
  |  | 2721|     59|#define WILDCOPY_OVERLENGTH 8
  ------------------
  |  Branch (3317:17): [True: 16, False: 43]
  ------------------
 3318|     16|                if (litSize+lhSize > srcSize) return ERROR(corruption_detected);
  ------------------
  |  |   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 (3318:21): [True: 13, False: 3]
  ------------------
 3319|      3|                memcpy(dctx->litBuffer, istart+lhSize, litSize);
 3320|      3|                dctx->litPtr = dctx->litBuffer;
 3321|      3|                dctx->litSize = litSize;
 3322|      3|                memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  | 2721|      3|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3323|      3|                return lhSize+litSize;
 3324|     16|            }
 3325|       |            /* direct reference into compressed stream */
 3326|     43|            dctx->litPtr = istart+lhSize;
 3327|     43|            dctx->litSize = litSize;
 3328|     43|            return lhSize+litSize;
 3329|     59|        }
 3330|    377|    case lbt_rle:
  ------------------
  |  Branch (3330:5): [True: 377, False: 449]
  ------------------
 3331|    377|        {   size_t litSize;
 3332|    377|            U32 lhSize = ((istart[0]) >> 4) & 3;
 3333|    377|            switch(lhSize)
 3334|    377|            {
 3335|     29|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (3335:13): [True: 18, False: 359]
  |  Branch (3335:21): [True: 11, False: 366]
  |  Branch (3335:29): [True: 0, False: 377]
  ------------------
 3336|     29|                lhSize = 1;
 3337|     29|                litSize = istart[0] & 31;
 3338|     29|                break;
 3339|    154|            case 2:
  ------------------
  |  Branch (3339:13): [True: 154, False: 223]
  ------------------
 3340|    154|                litSize = ((istart[0] & 15) << 8) + istart[1];
 3341|    154|                break;
 3342|    194|            case 3:
  ------------------
  |  Branch (3342:13): [True: 194, False: 183]
  ------------------
 3343|    194|                litSize = ((istart[0] & 15) << 16) + (istart[1] << 8) + istart[2];
 3344|    194|                if (srcSize<4) return ERROR(corruption_detected);   /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need lhSize+1 = 4 */
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3344:21): [True: 1, False: 193]
  ------------------
 3345|    193|                break;
 3346|    377|            }
 3347|    376|            if (litSize > ZSTDv07_BLOCKSIZE_ABSOLUTEMAX) return ERROR(corruption_detected);
  ------------------
  |  |  175|    376|#define ZSTDv07_BLOCKSIZE_ABSOLUTEMAX (128 * 1024)   /* define, for static allocation */
  ------------------
                          if (litSize > ZSTDv07_BLOCKSIZE_ABSOLUTEMAX) 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 (3347:17): [True: 2, False: 374]
  ------------------
 3348|    374|            memset(dctx->litBuffer, istart[lhSize], litSize + WILDCOPY_OVERLENGTH);
  ------------------
  |  | 2721|    374|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3349|    374|            dctx->litPtr = dctx->litBuffer;
 3350|    374|            dctx->litSize = litSize;
 3351|    374|            return lhSize+1;
 3352|    376|        }
 3353|      0|    default:
  ------------------
  |  Branch (3353:5): [True: 0, False: 826]
  ------------------
 3354|      0|        return ERROR(corruption_detected);   /* impossible */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3355|    826|    }
 3356|    826|}
zstd_v07.c:ZSTDv07_decompressSequences:
 3616|    423|{
 3617|    423|    const BYTE* ip = (const BYTE*)seqStart;
 3618|    423|    const BYTE* const iend = ip + seqSize;
 3619|    423|    BYTE* const ostart = (BYTE*)dst;
 3620|    423|    BYTE* const oend = ostart + maxDstSize;
 3621|    423|    BYTE* op = ostart;
 3622|    423|    const BYTE* litPtr = dctx->litPtr;
 3623|    423|    const BYTE* const litEnd = litPtr + dctx->litSize;
 3624|    423|    FSEv07_DTable* DTableLL = dctx->LLTable;
 3625|    423|    FSEv07_DTable* DTableML = dctx->MLTable;
 3626|    423|    FSEv07_DTable* DTableOffb = dctx->OffTable;
 3627|    423|    const BYTE* const base = (const BYTE*) (dctx->base);
 3628|    423|    const BYTE* const vBase = (const BYTE*) (dctx->vBase);
 3629|    423|    const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd);
 3630|    423|    int nbSeq;
 3631|       |
 3632|       |    /* Build Decoding Tables */
 3633|    423|    {   size_t const seqHSize = ZSTDv07_decodeSeqHeaders(&nbSeq, DTableLL, DTableML, DTableOffb, dctx->fseEntropy, ip, seqSize);
 3634|    423|        if (ZSTDv07_isError(seqHSize)) return seqHSize;
  ------------------
  |  | 2856|    423|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3634:13): [True: 56, False: 367]
  ------------------
 3635|    367|        ip += seqHSize;
 3636|    367|    }
 3637|       |
 3638|       |    /* Regen sequences */
 3639|    367|    if (nbSeq) {
  ------------------
  |  Branch (3639:9): [True: 328, False: 39]
  ------------------
 3640|    328|        seqState_t seqState;
 3641|    328|        dctx->fseEntropy = 1;
 3642|  1.31k|        { U32 i; for (i=0; i<ZSTDv07_REP_INIT; i++) seqState.prevOffset[i] = dctx->rep[i]; }
  ------------------
  |  | 2639|  1.31k|#define ZSTDv07_REP_INIT   ZSTDv07_REP_NUM
  |  |  ------------------
  |  |  |  | 2638|  1.31k|#define ZSTDv07_REP_NUM    3
  |  |  ------------------
  ------------------
  |  Branch (3642:28): [True: 984, False: 328]
  ------------------
 3643|    328|        { size_t const errorCode = BITv07_initDStream(&(seqState.DStream), ip, iend-ip);
 3644|    328|          if (ERR_isError(errorCode)) return ERROR(corruption_detected); }
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3644:15): [True: 24, False: 304]
  ------------------
 3645|    304|        FSEv07_initDState(&(seqState.stateLL), &(seqState.DStream), DTableLL);
 3646|    304|        FSEv07_initDState(&(seqState.stateOffb), &(seqState.DStream), DTableOffb);
 3647|    304|        FSEv07_initDState(&(seqState.stateML), &(seqState.DStream), DTableML);
 3648|       |
 3649|  70.3k|        for ( ; (BITv07_reloadDStream(&(seqState.DStream)) <= BITv07_DStream_completed) && nbSeq ; ) {
  ------------------
  |  Branch (3649:17): [True: 70.2k, False: 107]
  |  Branch (3649:92): [True: 70.2k, False: 30]
  ------------------
 3650|  70.2k|            nbSeq--;
 3651|  70.2k|            {   seq_t const sequence = ZSTDv07_decodeSequence(&seqState);
 3652|  70.2k|                size_t const oneSeqSize = ZSTDv07_execSequence(op, oend, sequence, &litPtr, litEnd, base, vBase, dictEnd);
 3653|  70.2k|                if (ZSTDv07_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  | 2856|  70.2k|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3653:21): [True: 167, False: 70.0k]
  ------------------
 3654|  70.0k|                op += oneSeqSize;
 3655|  70.0k|        }   }
 3656|       |
 3657|       |        /* check if reached exact end */
 3658|    137|        if (nbSeq) return ERROR(corruption_detected);
  ------------------
  |  |   49|    102|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    102|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    102|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3658:13): [True: 102, False: 35]
  ------------------
 3659|       |        /* save reps for next block */
 3660|    140|        { U32 i; for (i=0; i<ZSTDv07_REP_INIT; i++) dctx->rep[i] = (U32)(seqState.prevOffset[i]); }
  ------------------
  |  | 2639|    140|#define ZSTDv07_REP_INIT   ZSTDv07_REP_NUM
  |  |  ------------------
  |  |  |  | 2638|    140|#define ZSTDv07_REP_NUM    3
  |  |  ------------------
  ------------------
  |  Branch (3660:28): [True: 105, False: 35]
  ------------------
 3661|     35|    }
 3662|       |
 3663|       |    /* last literal segment */
 3664|     74|    {   size_t const lastLLSize = litEnd - litPtr;
 3665|       |        /* if (litPtr > litEnd) return ERROR(corruption_detected); */   /* too many literals already used */
 3666|     74|        if (lastLLSize > (size_t)(oend-op)) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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 (3666:13): [True: 9, False: 65]
  ------------------
 3667|     65|        if (lastLLSize > 0) {
  ------------------
  |  Branch (3667:13): [True: 62, False: 3]
  ------------------
 3668|     62|            memcpy(op, litPtr, lastLLSize);
 3669|     62|            op += lastLLSize;
 3670|     62|        }
 3671|     65|    }
 3672|       |
 3673|      0|    return op-ostart;
 3674|     74|}
zstd_v07.c:ZSTDv07_decodeSeqHeaders:
 3396|    423|{
 3397|    423|    const BYTE* const istart = (const BYTE*)src;
 3398|    423|    const BYTE* const iend = istart + srcSize;
 3399|    423|    const BYTE* ip = istart;
 3400|       |
 3401|       |    /* check */
 3402|    423|    if (srcSize < MIN_SEQUENCES_SIZE) return ERROR(srcSize_wrong);
  ------------------
  |  | 2662|    423|#define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */
  ------------------
                  if (srcSize < MIN_SEQUENCES_SIZE) 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 (3402:9): [True: 0, False: 423]
  ------------------
 3403|       |
 3404|       |    /* SeqHead */
 3405|    423|    {   int nbSeq = *ip++;
 3406|    423|        if (!nbSeq) { *nbSeqPtr=0; return 1; }
  ------------------
  |  Branch (3406:13): [True: 32, False: 391]
  ------------------
 3407|    391|        if (nbSeq > 0x7F) {
  ------------------
  |  Branch (3407:13): [True: 190, False: 201]
  ------------------
 3408|    190|            if (nbSeq == 0xFF) {
  ------------------
  |  Branch (3408:17): [True: 34, False: 156]
  ------------------
 3409|     34|                if (ip+2 > iend) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3409:21): [True: 1, False: 33]
  ------------------
 3410|     33|                nbSeq = MEM_readLE16(ip) + LONGNBSEQ, ip+=2;
  ------------------
  |  | 2668|     33|#define LONGNBSEQ 0x7F00
  ------------------
 3411|    156|            } else {
 3412|    156|                if (ip >= iend) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3412:21): [True: 0, False: 156]
  ------------------
 3413|    156|                nbSeq = ((nbSeq-0x80)<<8) + *ip++;
 3414|    156|            }
 3415|    190|        }
 3416|    390|        *nbSeqPtr = nbSeq;
 3417|    390|    }
 3418|       |
 3419|       |    /* FSE table descriptors */
 3420|    390|    if (ip + 4 > iend) return ERROR(srcSize_wrong); /* min : header byte + all 3 are "raw", hence no header, but at least xxLog bits per type */
  ------------------
  |  |   49|      4|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      4|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      4|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3420:9): [True: 4, False: 386]
  ------------------
 3421|    386|    {   U32 const LLtype  = *ip >> 6;
 3422|    386|        U32 const OFtype = (*ip >> 4) & 3;
 3423|    386|        U32 const MLtype  = (*ip >> 2) & 3;
 3424|    386|        ip++;
 3425|       |
 3426|       |        /* Build DTables */
 3427|    386|        {   size_t const llhSize = ZSTDv07_buildSeqTable(DTableLL, LLtype, MaxLL, LLFSELog, ip, iend-ip, LL_defaultNorm, LL_defaultNormLog, flagRepeatTable);
  ------------------
  |  | 2676|    386|#define MaxLL  35
  ------------------
                      {   size_t const llhSize = ZSTDv07_buildSeqTable(DTableLL, LLtype, MaxLL, LLFSELog, ip, iend-ip, LL_defaultNorm, LL_defaultNormLog, flagRepeatTable);
  ------------------
  |  | 2680|    386|#define LLFSELog    9
  ------------------
 3428|    386|            if (ZSTDv07_isError(llhSize)) return ERROR(corruption_detected);
  ------------------
  |  | 2856|    386|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
                          if (ZSTDv07_isError(llhSize)) return ERROR(corruption_detected);
  ------------------
  |  |   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 (3428:17): [True: 14, False: 372]
  ------------------
 3429|    372|            ip += llhSize;
 3430|    372|        }
 3431|    372|        {   size_t const ofhSize = ZSTDv07_buildSeqTable(DTableOffb, OFtype, MaxOff, OffFSELog, ip, iend-ip, OF_defaultNorm, OF_defaultNormLog, flagRepeatTable);
  ------------------
  |  | 2677|    372|#define MaxOff 28
  ------------------
                      {   size_t const ofhSize = ZSTDv07_buildSeqTable(DTableOffb, OFtype, MaxOff, OffFSELog, ip, iend-ip, OF_defaultNorm, OF_defaultNormLog, flagRepeatTable);
  ------------------
  |  | 2681|    372|#define OffFSELog   8
  ------------------
 3432|    372|            if (ZSTDv07_isError(ofhSize)) return ERROR(corruption_detected);
  ------------------
  |  | 2856|    372|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
                          if (ZSTDv07_isError(ofhSize)) return ERROR(corruption_detected);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3432:17): [True: 20, False: 352]
  ------------------
 3433|    352|            ip += ofhSize;
 3434|    352|        }
 3435|    352|        {   size_t const mlhSize = ZSTDv07_buildSeqTable(DTableML, MLtype, MaxML, MLFSELog, ip, iend-ip, ML_defaultNorm, ML_defaultNormLog, flagRepeatTable);
  ------------------
  |  | 2675|    352|#define MaxML  52
  ------------------
                      {   size_t const mlhSize = ZSTDv07_buildSeqTable(DTableML, MLtype, MaxML, MLFSELog, ip, iend-ip, ML_defaultNorm, ML_defaultNormLog, flagRepeatTable);
  ------------------
  |  | 2679|    352|#define MLFSELog    9
  ------------------
 3436|    352|            if (ZSTDv07_isError(mlhSize)) return ERROR(corruption_detected);
  ------------------
  |  | 2856|    352|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
                          if (ZSTDv07_isError(mlhSize)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     17|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     17|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     17|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3436:17): [True: 17, False: 335]
  ------------------
 3437|    335|            ip += mlhSize;
 3438|    335|    }   }
 3439|       |
 3440|      0|    return ip-istart;
 3441|    352|}
zstd_v07.c:ZSTDv07_buildSeqTable:
 3366|  1.11k|{
 3367|  1.11k|    switch(type)
 3368|  1.11k|    {
 3369|    153|    case FSEv07_ENCODING_RLE :
  ------------------
  |  | 2684|    153|#define FSEv07_ENCODING_RLE     1
  ------------------
  |  Branch (3369:5): [True: 153, False: 957]
  ------------------
 3370|    153|        if (!srcSize) 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 (3370:13): [True: 2, False: 151]
  ------------------
 3371|    151|        if ( (*(const BYTE*)src) > max) return ERROR(corruption_detected);
  ------------------
  |  |   49|      5|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      5|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      5|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3371:14): [True: 5, False: 146]
  ------------------
 3372|    146|        FSEv07_buildDTable_rle(DTable, *(const BYTE*)src);   /* if *src > max, data is corrupted */
 3373|    146|        return 1;
 3374|    490|    case FSEv07_ENCODING_RAW :
  ------------------
  |  | 2683|    490|#define FSEv07_ENCODING_RAW     0
  ------------------
  |  Branch (3374:5): [True: 490, False: 620]
  ------------------
 3375|    490|        FSEv07_buildDTable(DTable, defaultNorm, max, defaultLog);
 3376|    490|        return 0;
 3377|     16|    case FSEv07_ENCODING_STATIC:
  ------------------
  |  | 2685|     16|#define FSEv07_ENCODING_STATIC  2
  ------------------
  |  Branch (3377:5): [True: 16, False: 1.09k]
  ------------------
 3378|     16|        if (!flagRepeatTable) return ERROR(corruption_detected);
  ------------------
  |  |   49|      9|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      9|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      9|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3378:13): [True: 9, False: 7]
  ------------------
 3379|      7|        return 0;
 3380|      0|    default :   /* impossible */
  ------------------
  |  Branch (3380:5): [True: 0, False: 1.11k]
  ------------------
 3381|    451|    case FSEv07_ENCODING_DYNAMIC :
  ------------------
  |  | 2686|    451|#define FSEv07_ENCODING_DYNAMIC 3
  ------------------
  |  Branch (3381:5): [True: 451, False: 659]
  ------------------
 3382|    451|        {   U32 tableLog;
 3383|    451|            S16 norm[MaxSeq+1];
 3384|    451|            size_t const headerSize = FSEv07_readNCount(norm, &max, &tableLog, src, srcSize);
 3385|    451|            if (FSEv07_isError(headerSize)) return ERROR(corruption_detected);
  ------------------
  |  | 2857|    451|#define FSEv07_isError  ERR_isError
  ------------------
                          if (FSEv07_isError(headerSize)) 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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3385:17): [True: 19, False: 432]
  ------------------
 3386|    432|            if (tableLog > maxLog) return ERROR(corruption_detected);
  ------------------
  |  |   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 (3386:17): [True: 16, False: 416]
  ------------------
 3387|    416|            FSEv07_buildDTable(DTable, norm, max, tableLog);
 3388|    416|            return headerSize;
 3389|    432|    }   }
 3390|  1.11k|}
zstd_v07.c:ZSTDv07_decodeSequence:
 3460|  70.2k|{
 3461|  70.2k|    seq_t seq;
 3462|       |
 3463|  70.2k|    U32 const llCode = FSEv07_peekSymbol(&(seqState->stateLL));
 3464|  70.2k|    U32 const mlCode = FSEv07_peekSymbol(&(seqState->stateML));
 3465|  70.2k|    U32 const ofCode = FSEv07_peekSymbol(&(seqState->stateOffb));   /* <= maxOff, by table construction */
 3466|       |
 3467|  70.2k|    U32 const llBits = LL_bits[llCode];
 3468|  70.2k|    U32 const mlBits = ML_bits[mlCode];
 3469|  70.2k|    U32 const ofBits = ofCode;
 3470|  70.2k|    U32 const totalBits = llBits+mlBits+ofBits;
 3471|       |
 3472|  70.2k|    static const U32 LL_base[MaxLL+1] = {
 3473|  70.2k|                             0,  1,  2,  3,  4,  5,  6,  7,  8,  9,   10,    11,    12,    13,    14,     15,
 3474|  70.2k|                            16, 18, 20, 22, 24, 28, 32, 40, 48, 64, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000,
 3475|  70.2k|                            0x2000, 0x4000, 0x8000, 0x10000 };
 3476|       |
 3477|  70.2k|    static const U32 ML_base[MaxML+1] = {
 3478|  70.2k|                             3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13,   14,    15,    16,    17,    18,
 3479|  70.2k|                            19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,   30,    31,    32,    33,    34,
 3480|  70.2k|                            35, 37, 39, 41, 43, 47, 51, 59, 67, 83, 99, 0x83, 0x103, 0x203, 0x403, 0x803,
 3481|  70.2k|                            0x1003, 0x2003, 0x4003, 0x8003, 0x10003 };
 3482|       |
 3483|  70.2k|    static const U32 OF_base[MaxOff+1] = {
 3484|  70.2k|                 0,        1,       1,       5,     0xD,     0x1D,     0x3D,     0x7D,
 3485|  70.2k|                 0xFD,   0x1FD,   0x3FD,   0x7FD,   0xFFD,   0x1FFD,   0x3FFD,   0x7FFD,
 3486|  70.2k|                 0xFFFD, 0x1FFFD, 0x3FFFD, 0x7FFFD, 0xFFFFD, 0x1FFFFD, 0x3FFFFD, 0x7FFFFD,
 3487|  70.2k|                 0xFFFFFD, 0x1FFFFFD, 0x3FFFFFD, 0x7FFFFFD, 0xFFFFFFD };
 3488|       |
 3489|       |    /* sequence */
 3490|  70.2k|    {   size_t offset;
 3491|  70.2k|        if (!ofCode)
  ------------------
  |  Branch (3491:13): [True: 66.8k, False: 3.36k]
  ------------------
 3492|  66.8k|            offset = 0;
 3493|  3.36k|        else {
 3494|  3.36k|            offset = OF_base[ofCode] + BITv07_readBits(&(seqState->DStream), ofBits);   /* <=  (ZSTDv07_WINDOWLOG_MAX-1) bits */
 3495|  3.36k|            if (MEM_32bits()) BITv07_reloadDStream(&(seqState->DStream));
  ------------------
  |  Branch (3495:17): [True: 0, False: 3.36k]
  ------------------
 3496|  3.36k|        }
 3497|       |
 3498|  70.2k|        if (ofCode <= 1) {
  ------------------
  |  Branch (3498:13): [True: 68.6k, False: 1.63k]
  ------------------
 3499|  68.6k|            if ((llCode == 0) & (offset <= 1)) offset = 1-offset;
  ------------------
  |  Branch (3499:17): [True: 64.6k, False: 3.96k]
  ------------------
 3500|  68.6k|            if (offset) {
  ------------------
  |  Branch (3500:17): [True: 65.2k, False: 3.33k]
  ------------------
 3501|  65.2k|                size_t const temp = seqState->prevOffset[offset];
 3502|  65.2k|                if (offset != 1) seqState->prevOffset[2] = seqState->prevOffset[1];
  ------------------
  |  Branch (3502:21): [True: 718, False: 64.5k]
  ------------------
 3503|  65.2k|                seqState->prevOffset[1] = seqState->prevOffset[0];
 3504|  65.2k|                seqState->prevOffset[0] = offset = temp;
 3505|  65.2k|            } else {
 3506|  3.33k|                offset = seqState->prevOffset[0];
 3507|  3.33k|            }
 3508|  68.6k|        } else {
 3509|  1.63k|            seqState->prevOffset[2] = seqState->prevOffset[1];
 3510|  1.63k|            seqState->prevOffset[1] = seqState->prevOffset[0];
 3511|  1.63k|            seqState->prevOffset[0] = offset;
 3512|  1.63k|        }
 3513|  70.2k|        seq.offset = offset;
 3514|  70.2k|    }
 3515|       |
 3516|  70.2k|    seq.matchLength = ML_base[mlCode] + ((mlCode>31) ? BITv07_readBits(&(seqState->DStream), mlBits) : 0);   /* <=  16 bits */
  ------------------
  |  Branch (3516:42): [True: 1.16k, False: 69.0k]
  ------------------
 3517|  70.2k|    if (MEM_32bits() && (mlBits+llBits>24)) BITv07_reloadDStream(&(seqState->DStream));
  ------------------
  |  Branch (3517:9): [True: 0, False: 70.2k]
  |  Branch (3517:25): [True: 0, False: 0]
  ------------------
 3518|       |
 3519|  70.2k|    seq.litLength = LL_base[llCode] + ((llCode>15) ? BITv07_readBits(&(seqState->DStream), llBits) : 0);   /* <=  16 bits */
  ------------------
  |  Branch (3519:40): [True: 1.12k, False: 69.1k]
  ------------------
 3520|  70.2k|    if (MEM_32bits() ||
  ------------------
  |  Branch (3520:9): [True: 0, False: 70.2k]
  ------------------
 3521|  70.2k|       (totalBits > 64 - 7 - (LLFSELog+MLFSELog+OffFSELog)) ) BITv07_reloadDStream(&(seqState->DStream));
  ------------------
  |  | 2680|  70.2k|#define LLFSELog    9
  ------------------
                     (totalBits > 64 - 7 - (LLFSELog+MLFSELog+OffFSELog)) ) BITv07_reloadDStream(&(seqState->DStream));
  ------------------
  |  | 2679|  70.2k|#define MLFSELog    9
  ------------------
                     (totalBits > 64 - 7 - (LLFSELog+MLFSELog+OffFSELog)) ) BITv07_reloadDStream(&(seqState->DStream));
  ------------------
  |  | 2681|  70.2k|#define OffFSELog   8
  ------------------
  |  Branch (3521:8): [True: 55, False: 70.1k]
  ------------------
 3522|       |
 3523|       |    /* ANS state update */
 3524|  70.2k|    FSEv07_updateState(&(seqState->stateLL), &(seqState->DStream));   /* <=  9 bits */
 3525|  70.2k|    FSEv07_updateState(&(seqState->stateML), &(seqState->DStream));   /* <=  9 bits */
 3526|  70.2k|    if (MEM_32bits()) BITv07_reloadDStream(&(seqState->DStream));     /* <= 18 bits */
  ------------------
  |  Branch (3526:9): [True: 0, False: 70.2k]
  ------------------
 3527|  70.2k|    FSEv07_updateState(&(seqState->stateOffb), &(seqState->DStream)); /* <=  8 bits */
 3528|       |
 3529|  70.2k|    return seq;
 3530|  70.2k|}
zstd_v07.c:FSEv07_peekSymbol:
  827|   210k|{
  828|   210k|    FSEv07_decode_t const DInfo = ((const FSEv07_decode_t*)(DStatePtr->table))[DStatePtr->state];
  829|   210k|    return DInfo.symbol;
  830|   210k|}
zstd_v07.c:FSEv07_updateState:
  833|   210k|{
  834|   210k|    FSEv07_decode_t const DInfo = ((const FSEv07_decode_t*)(DStatePtr->table))[DStatePtr->state];
  835|   210k|    U32 const nbBits = DInfo.nbBits;
  836|   210k|    size_t const lowBits = BITv07_readBits(bitD, nbBits);
  837|   210k|    DStatePtr->state = DInfo.newState + lowBits;
  838|   210k|}
zstd_v07.c:ZSTDv07_execSequence:
 3538|  70.2k|{
 3539|  70.2k|    BYTE* const oLitEnd = op + sequence.litLength;
 3540|  70.2k|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
 3541|  70.2k|    BYTE* const oMatchEnd = op + sequenceLength;   /* risk : address space overflow (32-bits) */
 3542|  70.2k|    BYTE* const oend_w = oend-WILDCOPY_OVERLENGTH;
  ------------------
  |  | 2721|  70.2k|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3543|  70.2k|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
 3544|  70.2k|    const BYTE* match = oLitEnd - sequence.offset;
 3545|       |
 3546|       |    /* check */
 3547|  70.2k|    assert(oend >= op);
  ------------------
  |  |   70|  70.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3548|  70.2k|    if (sequence.litLength + WILDCOPY_OVERLENGTH > (size_t)(oend - op)) return ERROR(dstSize_tooSmall);
  ------------------
  |  | 2721|  70.2k|#define WILDCOPY_OVERLENGTH 8
  ------------------
                  if (sequence.litLength + WILDCOPY_OVERLENGTH > (size_t)(oend - op)) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   49|     28|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     28|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     28|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3548:9): [True: 28, False: 70.2k]
  ------------------
 3549|  70.2k|    if (sequenceLength > (size_t)(oend - op)) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3549:9): [True: 21, False: 70.1k]
  ------------------
 3550|  70.1k|    assert(litLimit >= *litPtr);
  ------------------
  |  |   70|  70.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3551|  70.1k|    if (sequence.litLength > (size_t)(litLimit - *litPtr)) return ERROR(corruption_detected);;
  ------------------
  |  |   49|     37|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     37|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     37|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3551:9): [True: 37, False: 70.1k]
  ------------------
 3552|       |
 3553|       |    /* copy Literals */
 3554|  70.1k|    ZSTDv07_wildcopy(op, *litPtr, (ptrdiff_t)sequence.litLength);   /* note : since oLitEnd <= oend-WILDCOPY_OVERLENGTH, no risk of overwrite beyond oend */
 3555|  70.1k|    op = oLitEnd;
 3556|  70.1k|    *litPtr = iLitEnd;   /* update for next sequence */
 3557|       |
 3558|       |    /* copy Match */
 3559|  70.1k|    if (sequence.offset > (size_t)(oLitEnd - base)) {
  ------------------
  |  Branch (3559:9): [True: 208, False: 69.9k]
  ------------------
 3560|       |        /* offset beyond prefix */
 3561|    208|        if (sequence.offset > (size_t)(oLitEnd - vBase)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     81|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     81|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     81|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3561:13): [True: 81, False: 127]
  ------------------
 3562|    127|        match = dictEnd - (base-match);
 3563|    127|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (3563:13): [True: 86, False: 41]
  ------------------
 3564|     86|            memmove(oLitEnd, match, sequence.matchLength);
 3565|     86|            return sequenceLength;
 3566|     86|        }
 3567|       |        /* span extDict & currentPrefixSegment */
 3568|     41|        {   size_t const length1 = (size_t)(dictEnd - match);
 3569|     41|            memmove(oLitEnd, match, length1);
 3570|     41|            op = oLitEnd + length1;
 3571|     41|            sequence.matchLength -= length1;
 3572|     41|            match = base;
 3573|     41|            if (op > oend_w || sequence.matchLength < MINMATCH) {
  ------------------
  |  | 2670|     41|#define MINMATCH 3
  ------------------
  |  Branch (3573:17): [True: 0, False: 41]
  |  Branch (3573:32): [True: 21, False: 20]
  ------------------
 3574|     56|              while (op < oMatchEnd) *op++ = *match++;
  ------------------
  |  Branch (3574:22): [True: 35, False: 21]
  ------------------
 3575|     21|              return sequenceLength;
 3576|     21|            }
 3577|     41|    }   }
 3578|       |    /* Requirement: op <= oend_w */
 3579|       |
 3580|       |    /* match within prefix */
 3581|  69.9k|    if (sequence.offset < 8) {
  ------------------
  |  Branch (3581:9): [True: 67.8k, False: 2.13k]
  ------------------
 3582|       |        /* close range match, overlap */
 3583|  67.8k|        static const U32 dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 };   /* added */
 3584|  67.8k|        static const int dec64table[] = { 8, 8, 8, 7, 8, 9,10,11 };   /* subtracted */
 3585|  67.8k|        int const sub2 = dec64table[sequence.offset];
 3586|  67.8k|        op[0] = match[0];
 3587|  67.8k|        op[1] = match[1];
 3588|  67.8k|        op[2] = match[2];
 3589|  67.8k|        op[3] = match[3];
 3590|  67.8k|        match += dec32table[sequence.offset];
 3591|  67.8k|        ZSTDv07_copy4(op+4, match);
 3592|  67.8k|        match -= sub2;
 3593|  67.8k|    } else {
 3594|  2.13k|        ZSTDv07_copy8(op, match);
 3595|  2.13k|    }
 3596|  69.9k|    op += 8; match += 8;
 3597|       |
 3598|  69.9k|    if (oMatchEnd > oend-(16-MINMATCH)) {
  ------------------
  |  | 2670|  69.9k|#define MINMATCH 3
  ------------------
  |  Branch (3598:9): [True: 25, False: 69.9k]
  ------------------
 3599|     25|        if (op < oend_w) {
  ------------------
  |  Branch (3599:13): [True: 16, False: 9]
  ------------------
 3600|     16|            ZSTDv07_wildcopy(op, match, oend_w - op);
 3601|     16|            match += oend_w - op;
 3602|     16|            op = oend_w;
 3603|     16|        }
 3604|     75|        while (op < oMatchEnd) *op++ = *match++;
  ------------------
  |  Branch (3604:16): [True: 50, False: 25]
  ------------------
 3605|  69.9k|    } else {
 3606|  69.9k|        ZSTDv07_wildcopy(op, match, (ptrdiff_t)sequence.matchLength-8);   /* works even if matchLength < 8 */
 3607|  69.9k|    }
 3608|  69.9k|    return sequenceLength;
 3609|  70.1k|}
zstd_v07.c:ZSTDv07_wildcopy:
 2723|   140k|{
 2724|   140k|    const BYTE* ip = (const BYTE*)src;
 2725|   140k|    BYTE* op = (BYTE*)dst;
 2726|   140k|    BYTE* const oend = op + length;
 2727|   140k|    do
 2728|  1.47M|        COPY8(op, ip)
  ------------------
  |  | 2717|  1.47M|#define COPY8(d,s) { ZSTDv07_copy8(d,s); d+=8; s+=8; }
  ------------------
 2729|  1.47M|    while (op < oend);
  ------------------
  |  Branch (2729:12): [True: 1.33M, False: 140k]
  ------------------
 2730|   140k|}
zstd_v07.c:ZSTDv07_copy4:
 2864|  67.8k|static void ZSTDv07_copy4(void* dst, const void* src) { memcpy(dst, src, 4); }
zstd_v07.c:ZSTDv07_copy8:
 2716|  1.47M|static void ZSTDv07_copy8(void* dst, const void* src) { memcpy(dst, src, 8); }
zstd_v07.c:ZSTDv07_decompressFrame:
 3743|    981|{
 3744|    981|    const BYTE* ip = (const BYTE*)src;
 3745|    981|    const BYTE* const iend = ip + srcSize;
 3746|    981|    BYTE* const ostart = (BYTE*)dst;
 3747|    981|    BYTE* const oend = ostart + dstCapacity;
 3748|    981|    BYTE* op = ostart;
 3749|    981|    size_t remainingSize = srcSize;
 3750|       |
 3751|       |    /* check */
 3752|    981|    if (srcSize < ZSTDv07_frameHeaderSize_min+ZSTDv07_blockHeaderSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3752:9): [True: 0, False: 981]
  ------------------
 3753|       |
 3754|       |    /* Frame Header */
 3755|    981|    {   size_t const frameHeaderSize = ZSTDv07_frameHeaderSize(src, ZSTDv07_frameHeaderSize_min);
 3756|    981|        if (ZSTDv07_isError(frameHeaderSize)) return frameHeaderSize;
  ------------------
  |  | 2856|    981|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3756:13): [True: 0, False: 981]
  ------------------
 3757|    981|        if (srcSize < frameHeaderSize+ZSTDv07_blockHeaderSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3757:13): [True: 0, False: 981]
  ------------------
 3758|    981|        if (ZSTDv07_decodeFrameHeader(dctx, src, frameHeaderSize)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     65|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     65|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     65|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3758:13): [True: 65, False: 916]
  ------------------
 3759|    916|        ip += frameHeaderSize; remainingSize -= frameHeaderSize;
 3760|    916|    }
 3761|       |
 3762|       |    /* Loop on each block */
 3763|  1.43k|    while (1) {
  ------------------
  |  Branch (3763:12): [True: 1.43k, Folded]
  ------------------
 3764|  1.43k|        size_t decodedSize;
 3765|  1.43k|        blockProperties_t blockProperties;
 3766|  1.43k|        size_t const cBlockSize = ZSTDv07_getcBlockSize(ip, iend-ip, &blockProperties);
 3767|  1.43k|        if (ZSTDv07_isError(cBlockSize)) return cBlockSize;
  ------------------
  |  | 2856|  1.43k|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3767:13): [True: 0, False: 1.43k]
  ------------------
 3768|       |
 3769|  1.43k|        ip += ZSTDv07_blockHeaderSize;
 3770|  1.43k|        remainingSize -= ZSTDv07_blockHeaderSize;
 3771|  1.43k|        if (cBlockSize > remainingSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3771:13): [True: 0, False: 1.43k]
  ------------------
 3772|       |
 3773|  1.43k|        switch(blockProperties.blockType)
 3774|  1.43k|        {
 3775|    833|        case bt_compressed:
  ------------------
  |  Branch (3775:9): [True: 833, False: 601]
  ------------------
 3776|    833|            decodedSize = ZSTDv07_decompressBlock_internal(dctx, op, oend-op, ip, cBlockSize);
 3777|    833|            break;
 3778|     16|        case bt_raw :
  ------------------
  |  Branch (3778:9): [True: 16, False: 1.41k]
  ------------------
 3779|     16|            decodedSize = ZSTDv07_copyRawBlock(op, oend-op, ip, cBlockSize);
 3780|     16|            break;
 3781|    444|        case bt_rle :
  ------------------
  |  Branch (3781:9): [True: 444, False: 990]
  ------------------
 3782|    444|            decodedSize = ZSTDv07_generateNxBytes(op, oend-op, *ip, blockProperties.origSize);
 3783|    444|            break;
 3784|    141|        case bt_end :
  ------------------
  |  Branch (3784:9): [True: 141, False: 1.29k]
  ------------------
 3785|       |            /* end of frame */
 3786|    141|            if (remainingSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3786:17): [True: 0, False: 141]
  ------------------
 3787|    141|            decodedSize = 0;
 3788|    141|            break;
 3789|      0|        default:
  ------------------
  |  Branch (3789:9): [True: 0, False: 1.43k]
  ------------------
 3790|      0|            return ERROR(GENERIC);   /* impossible */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3791|  1.43k|        }
 3792|  1.43k|        if (blockProperties.blockType == bt_end) break;   /* bt_end */
  ------------------
  |  Branch (3792:13): [True: 141, False: 1.29k]
  ------------------
 3793|       |
 3794|  1.29k|        if (ZSTDv07_isError(decodedSize)) return decodedSize;
  ------------------
  |  | 2856|  1.29k|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3794:13): [True: 775, False: 518]
  ------------------
 3795|    518|        if (dctx->fParams.checksumFlag) XXH64_update(&dctx->xxhState, op, decodedSize);
  ------------------
  |  |  460|     31|#  define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update)
  |  |  ------------------
  |  |  |  |  443|     31|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|     31|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3795:13): [True: 31, False: 487]
  ------------------
 3796|    518|        op += decodedSize;
 3797|    518|        ip += cBlockSize;
 3798|    518|        remainingSize -= cBlockSize;
 3799|    518|    }
 3800|       |
 3801|    141|    return op-ostart;
 3802|    916|}
zstd_v07.c:ZSTDv07_generateNxBytes:
 3729|    444|{
 3730|    444|    if (length > dstCapacity) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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 (3730:9): [True: 6, False: 438]
  ------------------
 3731|    438|    if (length > 0) {
  ------------------
  |  Branch (3731:9): [True: 428, False: 10]
  ------------------
 3732|    428|        memset(dst, byte, length);
 3733|    428|    }
 3734|    438|    return length;
 3735|    444|}
zstd_v07.c:ZSTD_errorFrameSizeInfoLegacy:
 3855|     34|{
 3856|     34|    *cSize = ret;
 3857|     34|    *dBound = ZSTD_CONTENTSIZE_ERROR;
  ------------------
  |  | 2688|     34|#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
  ------------------
 3858|     34|}
zstd_v07.c:ZSTDv07_getcBlockSize:
 3201|  4.26k|{
 3202|  4.26k|    const BYTE* const in = (const BYTE*)src;
 3203|  4.26k|    U32 cSize;
 3204|       |
 3205|  4.26k|    if (srcSize < ZSTDv07_blockHeaderSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3205:9): [True: 1, False: 4.26k]
  ------------------
 3206|       |
 3207|  4.26k|    bpPtr->blockType = (blockType_t)((*in) >> 6);
 3208|  4.26k|    cSize = in[2] + (in[1]<<8) + ((in[0] & 7)<<16);
 3209|  4.26k|    bpPtr->origSize = (bpPtr->blockType == bt_rle) ? cSize : 0;
  ------------------
  |  Branch (3209:23): [True: 1.06k, False: 3.20k]
  ------------------
 3210|       |
 3211|  4.26k|    if (bpPtr->blockType == bt_end) return 0;
  ------------------
  |  Branch (3211:9): [True: 1.12k, False: 3.14k]
  ------------------
 3212|  3.14k|    if (bpPtr->blockType == bt_rle) return 1;
  ------------------
  |  Branch (3212:9): [True: 1.06k, False: 2.08k]
  ------------------
 3213|  2.08k|    return cSize;
 3214|  3.14k|}
zstd_v07.c:ZSTDv07_decodeFrameHeader:
 3184|    981|{
 3185|    981|    size_t const result = ZSTDv07_getFrameParams(&(dctx->fParams), src, srcSize);
 3186|    981|    if (dctx->fParams.dictID && (dctx->dictID != dctx->fParams.dictID)) return ERROR(dictionary_wrong);
  ------------------
  |  |   49|     36|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     36|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     36|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3186:9): [True: 36, False: 945]
  |  Branch (3186:33): [True: 36, False: 0]
  ------------------
 3187|    945|    if (dctx->fParams.checksumFlag) XXH64_reset(&dctx->xxhState, 0);
  ------------------
  |  |  459|     38|#  define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset)
  |  |  ------------------
  |  |  |  |  443|     38|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|     38|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3187:9): [True: 38, False: 907]
  ------------------
 3188|    945|    return result;
 3189|    981|}
zstd_v07.c:ZSTDv07_copyRawBlock:
 3218|     16|{
 3219|     16|    if (srcSize > dstCapacity) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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 (3219:9): [True: 1, False: 15]
  ------------------
 3220|     15|    if (srcSize > 0) {
  ------------------
  |  Branch (3220:9): [True: 9, False: 6]
  ------------------
 3221|      9|        memcpy(dst, src, srcSize);
 3222|      9|    }
 3223|     15|    return srcSize;
 3224|     16|}
zstd_v07.c:ZSTDv07_decompress_insertDictionary:
 4092|    330|{
 4093|    330|    if (dictSize < 8) return ZSTDv07_refDictContent(dctx, dict, dictSize);
  ------------------
  |  Branch (4093:9): [True: 12, False: 318]
  ------------------
 4094|    318|    {   U32 const magic = MEM_readLE32(dict);
 4095|    318|        if (magic != ZSTDv07_DICT_MAGIC) {
  ------------------
  |  | 2636|    318|#define ZSTDv07_DICT_MAGIC  0xEC30A437   /* v0.7 */
  ------------------
  |  Branch (4095:13): [True: 318, False: 0]
  ------------------
 4096|    318|            return ZSTDv07_refDictContent(dctx, dict, dictSize);   /* pure content mode */
 4097|    318|    }   }
 4098|      0|    dctx->dictID = MEM_readLE32((const char*)dict + 4);
 4099|       |
 4100|       |    /* load entropy tables */
 4101|      0|    dict = (const char*)dict + 8;
 4102|      0|    dictSize -= 8;
 4103|      0|    {   size_t const eSize = ZSTDv07_loadEntropy(dctx, dict, dictSize);
 4104|      0|        if (ZSTDv07_isError(eSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  | 2856|      0|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
                      if (ZSTDv07_isError(eSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4104:13): [True: 0, False: 0]
  ------------------
 4105|      0|        dict = (const char*)dict + eSize;
 4106|      0|        dictSize -= eSize;
 4107|      0|    }
 4108|       |
 4109|       |    /* reference dictionary content */
 4110|      0|    return ZSTDv07_refDictContent(dctx, dict, dictSize);
 4111|      0|}
zstd_v07.c:ZSTDv07_refDictContent:
 4033|    330|{
 4034|    330|    dctx->dictEnd = dctx->previousDstEnd;
 4035|    330|    dctx->vBase = (const char*)dict - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->base));
 4036|    330|    dctx->base = dict;
 4037|    330|    dctx->previousDstEnd = (const char*)dict + dictSize;
 4038|    330|    return 0;
 4039|    330|}

bshuf_trans_byte_bitrow_AVX:
  117|  10.7k|                                    const size_t elem_size) {
  118|       |
  119|  10.7k|  size_t hh, ii, jj, kk, mm;
  120|  10.7k|  const char* in_b = (const char*) in;
  121|  10.7k|  char* out_b = (char*) out;
  122|       |
  123|  10.7k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  10.7k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 10.7k]
  |  |  ------------------
  ------------------
  124|       |
  125|  10.7k|  size_t nrows = 8 * elem_size;
  126|  10.7k|  size_t nbyte_row = size / 8;
  127|       |
  128|  10.7k|  if (elem_size % 4) return bshuf_trans_byte_bitrow_SSE(in, out, size,
  ------------------
  |  Branch (128:7): [True: 7.04k, False: 3.68k]
  ------------------
  129|  7.04k|                                                        elem_size);
  130|       |
  131|  3.68k|  __m256i ymm_0[8];
  132|  3.68k|  __m256i ymm_1[8];
  133|  3.68k|  __m256i ymm_storeage[8][4];
  134|       |
  135|   703k|  for (jj = 0; jj + 31 < nbyte_row; jj += 32) {
  ------------------
  |  Branch (135:16): [True: 699k, False: 3.68k]
  ------------------
  136|  1.66M|    for (ii = 0; ii + 3 < elem_size; ii += 4) {
  ------------------
  |  Branch (136:18): [True: 965k, False: 699k]
  ------------------
  137|  4.82M|      for (hh = 0; hh < 4; hh ++) {
  ------------------
  |  Branch (137:20): [True: 3.86M, False: 965k]
  ------------------
  138|       |
  139|  34.7M|        for (kk = 0; kk < 8; kk ++){
  ------------------
  |  Branch (139:22): [True: 30.8M, False: 3.86M]
  ------------------
  140|  30.8M|          ymm_0[kk] = _mm256_loadu_si256((__m256i *) &in_b[
  141|  30.8M|              (ii * 8 + hh * 8 + kk) * nbyte_row + jj]);
  142|  30.8M|        }
  143|       |
  144|  19.3M|        for (kk = 0; kk < 4; kk ++){
  ------------------
  |  Branch (144:22): [True: 15.4M, False: 3.86M]
  ------------------
  145|  15.4M|          ymm_1[kk] = _mm256_unpacklo_epi8(ymm_0[kk * 2],
  146|  15.4M|                                           ymm_0[kk * 2 + 1]);
  147|  15.4M|          ymm_1[kk + 4] = _mm256_unpackhi_epi8(ymm_0[kk * 2],
  148|  15.4M|                                               ymm_0[kk * 2 + 1]);
  149|  15.4M|        }
  150|       |
  151|  11.5M|        for (kk = 0; kk < 2; kk ++){
  ------------------
  |  Branch (151:22): [True: 7.72M, False: 3.86M]
  ------------------
  152|  23.1M|          for (mm = 0; mm < 2; mm ++){
  ------------------
  |  Branch (152:24): [True: 15.4M, False: 7.72M]
  ------------------
  153|  15.4M|            ymm_0[kk * 4 + mm] = _mm256_unpacklo_epi16(
  154|  15.4M|                ymm_1[kk * 4 + mm * 2],
  155|  15.4M|                ymm_1[kk * 4 + mm * 2 + 1]);
  156|  15.4M|            ymm_0[kk * 4 + mm + 2] = _mm256_unpackhi_epi16(
  157|  15.4M|                ymm_1[kk * 4 + mm * 2],
  158|  15.4M|                ymm_1[kk * 4 + mm * 2 + 1]);
  159|  15.4M|          }
  160|  7.72M|        }
  161|       |
  162|  19.3M|        for (kk = 0; kk < 4; kk ++){
  ------------------
  |  Branch (162:22): [True: 15.4M, False: 3.86M]
  ------------------
  163|  15.4M|          ymm_1[kk * 2] = _mm256_unpacklo_epi32(ymm_0[kk * 2],
  164|  15.4M|                                                ymm_0[kk * 2 + 1]);
  165|  15.4M|          ymm_1[kk * 2 + 1] = _mm256_unpackhi_epi32(ymm_0[kk * 2],
  166|  15.4M|                                                    ymm_0[kk * 2 + 1]);
  167|  15.4M|        }
  168|       |
  169|  34.7M|        for (kk = 0; kk < 8; kk ++){
  ------------------
  |  Branch (169:22): [True: 30.8M, False: 3.86M]
  ------------------
  170|  30.8M|          ymm_storeage[kk][hh] = ymm_1[kk];
  171|  30.8M|        }
  172|  3.86M|      }
  173|       |
  174|  8.68M|      for (mm = 0; mm < 8; mm ++) {
  ------------------
  |  Branch (174:20): [True: 7.72M, False: 965k]
  ------------------
  175|       |
  176|  38.6M|        for (kk = 0; kk < 4; kk ++){
  ------------------
  |  Branch (176:22): [True: 30.8M, False: 7.72M]
  ------------------
  177|  30.8M|          ymm_0[kk] = ymm_storeage[mm][kk];
  178|  30.8M|        }
  179|       |
  180|  7.72M|        ymm_1[0] = _mm256_unpacklo_epi64(ymm_0[0], ymm_0[1]);
  181|  7.72M|        ymm_1[1] = _mm256_unpacklo_epi64(ymm_0[2], ymm_0[3]);
  182|  7.72M|        ymm_1[2] = _mm256_unpackhi_epi64(ymm_0[0], ymm_0[1]);
  183|  7.72M|        ymm_1[3] = _mm256_unpackhi_epi64(ymm_0[2], ymm_0[3]);
  184|       |
  185|  7.72M|        ymm_0[0] = _mm256_permute2x128_si256(ymm_1[0], ymm_1[1], 32);
  186|  7.72M|        ymm_0[1] = _mm256_permute2x128_si256(ymm_1[2], ymm_1[3], 32);
  187|  7.72M|        ymm_0[2] = _mm256_permute2x128_si256(ymm_1[0], ymm_1[1], 49);
  188|  7.72M|        ymm_0[3] = _mm256_permute2x128_si256(ymm_1[2], ymm_1[3], 49);
  189|       |
  190|  7.72M|        _mm256_storeu_si256((__m256i *) &out_b[
  191|  7.72M|            (jj + mm * 2 + 0 * 16) * nrows + ii * 8], ymm_0[0]);
  192|  7.72M|        _mm256_storeu_si256((__m256i *) &out_b[
  193|  7.72M|            (jj + mm * 2 + 0 * 16 + 1) * nrows + ii * 8], ymm_0[1]);
  194|  7.72M|        _mm256_storeu_si256((__m256i *) &out_b[
  195|  7.72M|            (jj + mm * 2 + 1 * 16) * nrows + ii * 8], ymm_0[2]);
  196|  7.72M|        _mm256_storeu_si256((__m256i *) &out_b[
  197|  7.72M|            (jj + mm * 2 + 1 * 16 + 1) * nrows + ii * 8], ymm_0[3]);
  198|  7.72M|      }
  199|   965k|    }
  200|   699k|  }
  201|   245k|  for (ii = 0; ii < nrows; ii ++ ) {
  ------------------
  |  Branch (201:16): [True: 241k, False: 3.68k]
  ------------------
  202|  3.41M|    for (jj = nbyte_row - nbyte_row % 32; jj < nbyte_row; jj ++) {
  ------------------
  |  Branch (202:43): [True: 3.17M, False: 241k]
  ------------------
  203|  3.17M|      out_b[jj * nrows + ii] = in_b[ii * nbyte_row + jj];
  204|  3.17M|    }
  205|   241k|  }
  206|  3.68k|  return size * elem_size;
  207|  10.7k|}
bshuf_shuffle_bit_eightelem_AVX:
  212|  10.7k|                                        const size_t elem_size) {
  213|       |
  214|  10.7k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  10.7k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 10.7k]
  |  |  ------------------
  ------------------
  215|       |
  216|       |  // With a bit of care, this could be written such that such that it is
  217|       |  // in_buf = out_buf safe.
  218|  10.7k|  const char* in_b = (const char*) in;
  219|  10.7k|  char* out_b = (char*) out;
  220|       |
  221|  10.7k|  size_t ii, jj, kk;
  222|  10.7k|  size_t nbyte = elem_size * size;
  223|       |
  224|  10.7k|  __m256i ymm;
  225|  10.7k|  int32_t bt;
  226|       |
  227|  10.7k|  if (elem_size % 4) {
  ------------------
  |  Branch (227:7): [True: 7.04k, False: 3.68k]
  ------------------
  228|  7.04k|    return bshuf_shuffle_bit_eightelem_SSE(in, out, size, elem_size);
  229|  7.04k|  } else {
  230|  11.2k|    for (jj = 0; jj + 31 < 8 * elem_size; jj += 32) {
  ------------------
  |  Branch (230:18): [True: 7.55k, False: 3.68k]
  ------------------
  231|  30.9M|      for (ii = 0; ii + 8 * elem_size - 1 < nbyte;
  ------------------
  |  Branch (231:20): [True: 30.9M, False: 7.55k]
  ------------------
  232|  30.9M|           ii += 8 * elem_size) {
  233|  30.9M|        ymm = _mm256_loadu_si256((__m256i *) &in_b[ii + jj]);
  234|   278M|        for (kk = 0; kk < 8; kk++) {
  ------------------
  |  Branch (234:22): [True: 247M, False: 30.9M]
  ------------------
  235|   247M|          bt = _mm256_movemask_epi8(ymm);
  236|   247M|          ymm = _mm256_slli_epi16(ymm, 1);
  237|   247M|          size_t ind = (ii + jj / 8 + (7 - kk) * elem_size);
  238|   247M|          * (int32_t *) &out_b[ind] = bt;
  239|   247M|        }
  240|  30.9M|      }
  241|  7.55k|    }
  242|  3.68k|  }
  243|  3.68k|  return size * elem_size;
  244|  10.7k|}
bshuf_untrans_bit_elem_AVX:
  249|  10.7k|                                   const size_t elem_size) {
  250|       |
  251|  10.7k|  int64_t count;
  252|       |
  253|  10.7k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  10.7k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 10.7k]
  |  |  ------------------
  ------------------
  254|       |
  255|  10.7k|  void* tmp_buf = malloc(size * elem_size);
  256|  10.7k|  if (tmp_buf == NULL) return -1;
  ------------------
  |  Branch (256:7): [True: 0, False: 10.7k]
  ------------------
  257|       |
  258|  10.7k|  count = bshuf_trans_byte_bitrow_AVX(in, tmp_buf, size, elem_size);
  259|  10.7k|  CHECK_ERR_FREE(count, tmp_buf);
  ------------------
  |  |   45|  10.7k|#define CHECK_ERR_FREE(count, buf) if (count < 0) { free(buf); return count; }
  |  |  ------------------
  |  |  |  Branch (45:40): [True: 0, False: 10.7k]
  |  |  ------------------
  ------------------
  260|  10.7k|  count =  bshuf_shuffle_bit_eightelem_AVX(tmp_buf, out, size, elem_size);
  261|       |
  262|  10.7k|  free(tmp_buf);
  263|  10.7k|  return count;
  264|  10.7k|}

bshuf_shuffle_bit_eightelem_scal:
  200|  4.60k|        const size_t size, const size_t elem_size) {
  201|       |
  202|  4.60k|  const char *in_b;
  203|  4.60k|  char *out_b;
  204|  4.60k|  uint64_t x, t;
  205|  4.60k|  size_t ii, jj, kk;
  206|  4.60k|  size_t nbyte, out_index;
  207|       |
  208|  4.60k|  uint64_t e=1;
  209|  4.60k|  const int little_endian = *(uint8_t *) &e == 1;
  210|  4.60k|  const size_t elem_skip = little_endian ? elem_size : -elem_size;
  ------------------
  |  Branch (210:28): [True: 4.60k, False: 0]
  ------------------
  211|  4.60k|  const uint64_t elem_offset = little_endian ? 0 : 7 * elem_size;
  ------------------
  |  Branch (211:32): [True: 4.60k, False: 0]
  ------------------
  212|       |
  213|  4.60k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  4.60k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 4.60k]
  |  |  ------------------
  ------------------
  214|       |
  215|  4.60k|  in_b = (const char*) in;
  216|  4.60k|  out_b = (char*) out;
  217|       |
  218|  4.60k|  nbyte = elem_size * size;
  219|       |
  220|  36.9k|  for (jj = 0; jj < 8 * elem_size; jj += 8) {
  ------------------
  |  Branch (220:16): [True: 32.2k, False: 4.60k]
  ------------------
  221|  51.9M|    for (ii = 0; ii + 8 * elem_size - 1 < nbyte; ii += 8 * elem_size) {
  ------------------
  |  Branch (221:18): [True: 51.8M, False: 32.2k]
  ------------------
  222|  51.8M|      x = *((uint64_t*) &in_b[ii + jj]);
  223|  51.8M|      if (little_endian) {
  ------------------
  |  Branch (223:11): [True: 51.8M, False: 0]
  ------------------
  224|  51.8M|        TRANS_BIT_8X8(x, t);
  ------------------
  |  |   56|  51.8M|#define TRANS_BIT_8X8(x, t) {                                               \
  |  |   57|  51.8M|        t = (x ^ (x >> 7)) & 0x00AA00AA00AA00AALL;                          \
  |  |   58|  51.8M|        x = x ^ t ^ (t << 7);                                               \
  |  |   59|  51.8M|        t = (x ^ (x >> 14)) & 0x0000CCCC0000CCCCLL;                         \
  |  |   60|  51.8M|        x = x ^ t ^ (t << 14);                                              \
  |  |   61|  51.8M|        t = (x ^ (x >> 28)) & 0x00000000F0F0F0F0LL;                         \
  |  |   62|  51.8M|        x = x ^ t ^ (t << 28);                                              \
  |  |   63|  51.8M|    }
  ------------------
  225|  51.8M|      } else {
  226|      0|        TRANS_BIT_8X8_BE(x, t);
  ------------------
  |  |   67|      0|#define TRANS_BIT_8X8_BE(x, t) {                                            \
  |  |   68|      0|        t = (x ^ (x >> 9)) & 0x0055005500550055LL;                          \
  |  |   69|      0|        x = x ^ t ^ (t << 9);                                               \
  |  |   70|      0|        t = (x ^ (x >> 18)) & 0x0000333300003333LL;                         \
  |  |   71|      0|        x = x ^ t ^ (t << 18);                                              \
  |  |   72|      0|        t = (x ^ (x >> 36)) & 0x000000000F0F0F0FLL;                         \
  |  |   73|      0|        x = x ^ t ^ (t << 36);                                              \
  |  |   74|      0|    }
  ------------------
  227|      0|      }
  228|   466M|      for (kk = 0; kk < 8; kk++) {
  ------------------
  |  Branch (228:20): [True: 415M, False: 51.8M]
  ------------------
  229|   415M|        out_index = ii + jj / 8 + elem_offset + kk * elem_skip;
  230|   415M|        *((uint8_t*) &out_b[out_index]) = x;
  231|   415M|        x = x >> 8;
  232|   415M|      }
  233|  51.8M|    }
  234|  32.2k|  }
  235|  4.60k|  return size * elem_size;
  236|  4.60k|}

bshuf_trans_byte_bitrow_SSE:
  324|  7.04k|                                    const size_t elem_size) {
  325|       |
  326|  7.04k|  size_t ii, jj;
  327|  7.04k|  const char* in_b = (const char*) in;
  328|  7.04k|  char* out_b = (char*) out;
  329|       |
  330|  7.04k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  7.04k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 7.04k]
  |  |  ------------------
  ------------------
  331|       |
  332|  7.04k|  size_t nrows = 8 * elem_size;
  333|  7.04k|  size_t nbyte_row = size / 8;
  334|       |
  335|  7.04k|  __m128i a0, b0, c0, d0, e0, f0, g0, h0;
  336|  7.04k|  __m128i a1, b1, c1, d1, e1, f1, g1, h1;
  337|  7.04k|  __m128 *as, *bs, *cs, *ds, *es, *fs, *gs, *hs;
  338|       |
  339|  54.0k|  for (ii = 0; ii + 7 < nrows; ii += 8) {
  ------------------
  |  Branch (339:16): [True: 47.0k, False: 7.04k]
  ------------------
  340|  3.29M|    for (jj = 0; jj + 15 < nbyte_row; jj += 16) {
  ------------------
  |  Branch (340:18): [True: 3.25M, False: 47.0k]
  ------------------
  341|  3.25M|      a0 = _mm_loadu_si128((__m128i *) &in_b[(ii + 0)*nbyte_row + jj]);
  342|  3.25M|      b0 = _mm_loadu_si128((__m128i *) &in_b[(ii + 1)*nbyte_row + jj]);
  343|  3.25M|      c0 = _mm_loadu_si128((__m128i *) &in_b[(ii + 2)*nbyte_row + jj]);
  344|  3.25M|      d0 = _mm_loadu_si128((__m128i *) &in_b[(ii + 3)*nbyte_row + jj]);
  345|  3.25M|      e0 = _mm_loadu_si128((__m128i *) &in_b[(ii + 4)*nbyte_row + jj]);
  346|  3.25M|      f0 = _mm_loadu_si128((__m128i *) &in_b[(ii + 5)*nbyte_row + jj]);
  347|  3.25M|      g0 = _mm_loadu_si128((__m128i *) &in_b[(ii + 6)*nbyte_row + jj]);
  348|  3.25M|      h0 = _mm_loadu_si128((__m128i *) &in_b[(ii + 7)*nbyte_row + jj]);
  349|       |
  350|       |
  351|  3.25M|      a1 = _mm_unpacklo_epi8(a0, b0);
  352|  3.25M|      b1 = _mm_unpacklo_epi8(c0, d0);
  353|  3.25M|      c1 = _mm_unpacklo_epi8(e0, f0);
  354|  3.25M|      d1 = _mm_unpacklo_epi8(g0, h0);
  355|  3.25M|      e1 = _mm_unpackhi_epi8(a0, b0);
  356|  3.25M|      f1 = _mm_unpackhi_epi8(c0, d0);
  357|  3.25M|      g1 = _mm_unpackhi_epi8(e0, f0);
  358|  3.25M|      h1 = _mm_unpackhi_epi8(g0, h0);
  359|       |
  360|       |
  361|  3.25M|      a0 = _mm_unpacklo_epi16(a1, b1);
  362|  3.25M|      b0 = _mm_unpacklo_epi16(c1, d1);
  363|  3.25M|      c0 = _mm_unpackhi_epi16(a1, b1);
  364|  3.25M|      d0 = _mm_unpackhi_epi16(c1, d1);
  365|       |
  366|  3.25M|      e0 = _mm_unpacklo_epi16(e1, f1);
  367|  3.25M|      f0 = _mm_unpacklo_epi16(g1, h1);
  368|  3.25M|      g0 = _mm_unpackhi_epi16(e1, f1);
  369|  3.25M|      h0 = _mm_unpackhi_epi16(g1, h1);
  370|       |
  371|       |
  372|  3.25M|      a1 = _mm_unpacklo_epi32(a0, b0);
  373|  3.25M|      b1 = _mm_unpackhi_epi32(a0, b0);
  374|       |
  375|  3.25M|      c1 = _mm_unpacklo_epi32(c0, d0);
  376|  3.25M|      d1 = _mm_unpackhi_epi32(c0, d0);
  377|       |
  378|  3.25M|      e1 = _mm_unpacklo_epi32(e0, f0);
  379|  3.25M|      f1 = _mm_unpackhi_epi32(e0, f0);
  380|       |
  381|  3.25M|      g1 = _mm_unpacklo_epi32(g0, h0);
  382|  3.25M|      h1 = _mm_unpackhi_epi32(g0, h0);
  383|       |
  384|       |      // We don't have a storeh instruction for integers, so interpret
  385|       |      // as a float. Have a storel (_mm_storel_epi64).
  386|  3.25M|      as = (__m128 *) &a1;
  387|  3.25M|      bs = (__m128 *) &b1;
  388|  3.25M|      cs = (__m128 *) &c1;
  389|  3.25M|      ds = (__m128 *) &d1;
  390|  3.25M|      es = (__m128 *) &e1;
  391|  3.25M|      fs = (__m128 *) &f1;
  392|  3.25M|      gs = (__m128 *) &g1;
  393|  3.25M|      hs = (__m128 *) &h1;
  394|       |
  395|  3.25M|      _mm_storel_pi((__m64 *) &out_b[(jj + 0) * nrows + ii], *as);
  396|  3.25M|      _mm_storel_pi((__m64 *) &out_b[(jj + 2) * nrows + ii], *bs);
  397|  3.25M|      _mm_storel_pi((__m64 *) &out_b[(jj + 4) * nrows + ii], *cs);
  398|  3.25M|      _mm_storel_pi((__m64 *) &out_b[(jj + 6) * nrows + ii], *ds);
  399|  3.25M|      _mm_storel_pi((__m64 *) &out_b[(jj + 8) * nrows + ii], *es);
  400|  3.25M|      _mm_storel_pi((__m64 *) &out_b[(jj + 10) * nrows + ii], *fs);
  401|  3.25M|      _mm_storel_pi((__m64 *) &out_b[(jj + 12) * nrows + ii], *gs);
  402|  3.25M|      _mm_storel_pi((__m64 *) &out_b[(jj + 14) * nrows + ii], *hs);
  403|       |
  404|  3.25M|      _mm_storeh_pi((__m64 *) &out_b[(jj + 1) * nrows + ii], *as);
  405|  3.25M|      _mm_storeh_pi((__m64 *) &out_b[(jj + 3) * nrows + ii], *bs);
  406|  3.25M|      _mm_storeh_pi((__m64 *) &out_b[(jj + 5) * nrows + ii], *cs);
  407|  3.25M|      _mm_storeh_pi((__m64 *) &out_b[(jj + 7) * nrows + ii], *ds);
  408|  3.25M|      _mm_storeh_pi((__m64 *) &out_b[(jj + 9) * nrows + ii], *es);
  409|  3.25M|      _mm_storeh_pi((__m64 *) &out_b[(jj + 11) * nrows + ii], *fs);
  410|  3.25M|      _mm_storeh_pi((__m64 *) &out_b[(jj + 13) * nrows + ii], *gs);
  411|  3.25M|      _mm_storeh_pi((__m64 *) &out_b[(jj + 15) * nrows + ii], *hs);
  412|  3.25M|    }
  413|   297k|    for (jj = nbyte_row - nbyte_row % 16; jj < nbyte_row; jj ++) {
  ------------------
  |  Branch (413:43): [True: 250k, False: 47.0k]
  ------------------
  414|   250k|      out_b[jj * nrows + ii + 0] = in_b[(ii + 0)*nbyte_row + jj];
  415|   250k|      out_b[jj * nrows + ii + 1] = in_b[(ii + 1)*nbyte_row + jj];
  416|   250k|      out_b[jj * nrows + ii + 2] = in_b[(ii + 2)*nbyte_row + jj];
  417|   250k|      out_b[jj * nrows + ii + 3] = in_b[(ii + 3)*nbyte_row + jj];
  418|   250k|      out_b[jj * nrows + ii + 4] = in_b[(ii + 4)*nbyte_row + jj];
  419|   250k|      out_b[jj * nrows + ii + 5] = in_b[(ii + 5)*nbyte_row + jj];
  420|   250k|      out_b[jj * nrows + ii + 6] = in_b[(ii + 6)*nbyte_row + jj];
  421|   250k|      out_b[jj * nrows + ii + 7] = in_b[(ii + 7)*nbyte_row + jj];
  422|   250k|    }
  423|  47.0k|  }
  424|  7.04k|  return size * elem_size;
  425|  7.04k|}
bshuf_shuffle_bit_eightelem_SSE:
  430|  7.04k|                                        const size_t elem_size) {
  431|       |
  432|  7.04k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  7.04k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 7.04k]
  |  |  ------------------
  ------------------
  433|       |
  434|       |  // With a bit of care, this could be written such that such that it is
  435|       |  // in_buf = out_buf safe.
  436|  7.04k|  const char* in_b = (const char*) in;
  437|  7.04k|  uint16_t* out_ui16 = (uint16_t*) out;
  438|       |
  439|  7.04k|  size_t ii, jj, kk;
  440|  7.04k|  size_t nbyte = elem_size * size;
  441|       |
  442|  7.04k|  __m128i xmm;
  443|  7.04k|  int32_t bt;
  444|       |
  445|  7.04k|  if (elem_size % 2) {
  ------------------
  |  Branch (445:7): [True: 4.60k, False: 2.44k]
  ------------------
  446|  4.60k|    bshuf_shuffle_bit_eightelem_scal(in, out, size, elem_size);
  447|  4.60k|  } else {
  448|  75.3k|    for (ii = 0; ii + 8 * elem_size - 1 < nbyte;
  ------------------
  |  Branch (448:18): [True: 72.9k, False: 2.44k]
  ------------------
  449|  72.9k|         ii += 8 * elem_size) {
  450|   280k|      for (jj = 0; jj + 15 < 8 * elem_size; jj += 16) {
  ------------------
  |  Branch (450:20): [True: 207k, False: 72.9k]
  ------------------
  451|   207k|        xmm = _mm_loadu_si128((__m128i *) &in_b[ii + jj]);
  452|  1.86M|        for (kk = 0; kk < 8; kk++) {
  ------------------
  |  Branch (452:22): [True: 1.66M, False: 207k]
  ------------------
  453|  1.66M|          bt = _mm_movemask_epi8(xmm);
  454|  1.66M|          xmm = _mm_slli_epi16(xmm, 1);
  455|  1.66M|          size_t ind = (ii + jj / 8 + (7 - kk) * elem_size);
  456|  1.66M|          out_ui16[ind / 2] = bt;
  457|  1.66M|        }
  458|   207k|      }
  459|  72.9k|    }
  460|  2.44k|  }
  461|  7.04k|  return size * elem_size;
  462|  7.04k|}

blosc2.c:is_little_endian:
   42|   335k|static bool is_little_endian(void) {
   43|   335k|  static const int i = 1;
   44|   335k|  char* p = (char*)&i;
   45|       |
   46|   335k|  if (p[0] == 1) {
  ------------------
  |  Branch (46:7): [True: 335k, False: 0]
  ------------------
   47|   335k|    return true;
   48|   335k|  }
   49|      0|  else {
   50|       |    return false;
   51|      0|  }
   52|   335k|}
blosc2.c:load_lib:
  317|      1|static inline void* load_lib(char *plugin_name, char *libpath) {
  318|      1|  if (!blosc2_valid_plugin_name(plugin_name)) {
  ------------------
  |  Branch (318:7): [True: 0, False: 1]
  ------------------
  319|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  320|      0|    return NULL;
  321|      0|  }
  322|       |    // Attempt to directly load the library by name
  323|       |#if defined(_WIN32)
  324|       |    // Windows dynamic library (DLL) format
  325|       |    snprintf(libpath, PATH_MAX, "blosc2_%s.dll", plugin_name);
  326|       |#else
  327|       |    // Unix/Linux/Mac OS dynamic library (.so) format
  328|      1|    snprintf(libpath, PATH_MAX, "libblosc2_%s.so", plugin_name);
  329|      1|#endif
  330|      1|    void* loaded_lib = dlopen(libpath, RTLD_LAZY);
  331|      1|    if (loaded_lib != NULL) {
  ------------------
  |  Branch (331:9): [True: 0, False: 1]
  ------------------
  332|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  333|      0|        return loaded_lib;
  334|      1|    } else {
  335|       |#if defined(_WIN32)
  336|       |        BLOSC_TRACE_INFO("Failed to load %s directly, error: %lu\n", libpath, GetLastError());
  337|       |#else
  338|      1|        BLOSC_TRACE_INFO("Failed to load %s directly, error: %s\n", libpath, dlerror());
  ------------------
  |  |   95|      1|#define BLOSC_TRACE_INFO(msg, ...) BLOSC_TRACE(info, 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  339|      1|#endif
  340|      1|    }
  341|       |    // If direct loading fails, fallback to using Python to find the library path
  342|      1|    if (get_libpath(plugin_name, libpath, "") < 0 && get_libpath(plugin_name, libpath, "3") < 0) {
  ------------------
  |  Branch (342:9): [True: 1, False: 0]
  |  Branch (342:54): [True: 1, False: 0]
  ------------------
  343|      1|        BLOSC_TRACE_ERROR("Problems when running python or python3 for getting plugin path");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  344|      1|        return NULL;
  345|      1|    }
  346|       |
  347|      0|    if (strlen(libpath) == 0) {
  ------------------
  |  Branch (347:9): [True: 0, False: 0]
  ------------------
  348|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  349|      0|        return NULL;
  350|      0|    }
  351|       |
  352|       |    // Try to load the library again with the path from Python
  353|      0|    loaded_lib = dlopen(libpath, RTLD_LAZY);
  354|      0|    if (loaded_lib == NULL) {
  ------------------
  |  Branch (354:9): [True: 0, False: 0]
  ------------------
  355|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  356|      0|    } else {
  357|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  358|      0|    }
  359|       |
  360|      0|    return loaded_lib;
  361|      0|}
blosc2.c:blosc2_valid_plugin_name:
  275|      3|static inline bool blosc2_valid_plugin_name(const char *plugin_name) {
  276|      3|  if (plugin_name == NULL || plugin_name[0] == '\0') {
  ------------------
  |  Branch (276:7): [True: 0, False: 3]
  |  Branch (276:30): [True: 0, False: 3]
  ------------------
  277|      0|    return false;
  278|      0|  }
  279|     21|  for (const unsigned char *p = (const unsigned char *)plugin_name; *p != '\0'; ++p) {
  ------------------
  |  Branch (279:69): [True: 18, False: 3]
  ------------------
  280|     18|    if (!isalnum(*p) && *p != '_') {
  ------------------
  |  Branch (280:9): [True: 0, False: 18]
  |  Branch (280:25): [True: 0, False: 0]
  ------------------
  281|      0|      return false;
  282|      0|    }
  283|     18|  }
  284|      3|  return true;
  285|      3|}
blosc2.c:get_libpath:
  288|      2|static inline int get_libpath(char *plugin_name, char *libpath, char *python_version) {
  289|      2|  BLOSC_TRACE_INFO("Trying to get plugin path with python%s\n", python_version);
  ------------------
  |  |   95|      2|#define BLOSC_TRACE_INFO(msg, ...) BLOSC_TRACE(info, 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  290|      2|  char python_cmd[PATH_MAX] = {0};
  291|      2|  if (!blosc2_valid_plugin_name(plugin_name)) {
  ------------------
  |  Branch (291:7): [True: 0, False: 2]
  ------------------
  292|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  293|      0|    return BLOSC2_ERROR_INVALID_PARAM;
  294|      0|  }
  295|      2|  int written = snprintf(python_cmd, sizeof(python_cmd),
  296|      2|                         "python%s -c \"import blosc2_%s; blosc2_%s.print_libpath()\"",
  297|      2|                         python_version, plugin_name, plugin_name);
  298|      2|  if (written < 0 || (size_t)written >= sizeof(python_cmd)) {
  ------------------
  |  Branch (298:7): [True: 0, False: 2]
  |  Branch (298:22): [True: 0, False: 2]
  ------------------
  299|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  300|      0|    return BLOSC2_ERROR_FAILURE;
  301|      0|  }
  302|      2|  FILE *fp = popen(python_cmd, "r");
  303|      2|  if (fp == NULL) {
  ------------------
  |  Branch (303:7): [True: 0, False: 2]
  ------------------
  304|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  305|      0|    return BLOSC2_ERROR_FAILURE;
  306|      0|  }
  307|      2|  if (fgets(libpath, PATH_MAX, fp) == NULL) {
  ------------------
  |  Branch (307:7): [True: 2, False: 0]
  ------------------
  308|      2|    BLOSC_TRACE_ERROR("Could not read python output");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  309|      2|    pclose(fp);
  310|      2|    return BLOSC2_ERROR_FAILURE;
  311|      2|  }
  312|      0|  pclose(fp);
  313|       |
  314|      0|  return BLOSC2_ERROR_SUCCESS;
  315|      2|}
blosc2.c:sw32_:
  115|  60.3k|static inline int32_t sw32_(const void* pa) {
  116|  60.3k|  int32_t idest;
  117|       |
  118|  60.3k|  bool little_endian = is_little_endian();
  119|  60.3k|  if (little_endian) {
  ------------------
  |  Branch (119:7): [True: 60.3k, False: 0]
  ------------------
  120|  60.3k|    memcpy(&idest, pa, sizeof(idest));
  121|  60.3k|  }
  122|      0|  else {
  123|      0|#if defined (__GNUC__)
  124|      0|    return __builtin_bswap32(*(unsigned int *)pa);
  125|       |#elif defined (_MSC_VER) /* Visual Studio */
  126|       |    return _byteswap_ulong(*(unsigned int *)pa);
  127|       |#else
  128|       |    const uint8_t *pa_ = (const uint8_t *)pa;
  129|       |    uint8_t *dest = (uint8_t *)&idest;
  130|       |    dest[0] = pa_[3];
  131|       |    dest[1] = pa_[2];
  132|       |    dest[2] = pa_[1];
  133|       |    dest[3] = pa_[0];
  134|       |#endif
  135|      0|  }
  136|  60.3k|  return idest;
  137|  60.3k|}
frame.c:endian_handler:
   56|   173k|{
   57|   173k|  bool little_endian = is_little_endian();
   58|   173k|  if (little_endian == little) {
  ------------------
  |  Branch (58:7): [True: 0, False: 173k]
  ------------------
   59|      0|    memcpy(dest, pa, size);
   60|      0|  }
   61|   173k|  else {
   62|   173k|    uint8_t* pa_ = (uint8_t*)pa;
   63|   173k|    uint8_t pa2_[8];
   64|   173k|    switch (size) {
   65|  71.0k|      case 8:
  ------------------
  |  Branch (65:7): [True: 71.0k, False: 102k]
  ------------------
   66|  71.0k|        pa2_[0] = pa_[7];
   67|  71.0k|        pa2_[1] = pa_[6];
   68|  71.0k|        pa2_[2] = pa_[5];
   69|  71.0k|        pa2_[3] = pa_[4];
   70|  71.0k|        pa2_[4] = pa_[3];
   71|  71.0k|        pa2_[5] = pa_[2];
   72|  71.0k|        pa2_[6] = pa_[1];
   73|  71.0k|        pa2_[7] = pa_[0];
   74|  71.0k|        break;
   75|  91.3k|      case 4:
  ------------------
  |  Branch (75:7): [True: 91.3k, False: 82.3k]
  ------------------
   76|  91.3k|        pa2_[0] = pa_[3];
   77|  91.3k|        pa2_[1] = pa_[2];
   78|  91.3k|        pa2_[2] = pa_[1];
   79|  91.3k|        pa2_[3] = pa_[0];
   80|  91.3k|        break;
   81|  1.80k|      case 2:
  ------------------
  |  Branch (81:7): [True: 1.80k, False: 171k]
  ------------------
   82|  1.80k|        pa2_[0] = pa_[1];
   83|  1.80k|        pa2_[1] = pa_[0];
   84|  1.80k|        break;
   85|  9.48k|      case 1:
  ------------------
  |  Branch (85:7): [True: 9.48k, False: 164k]
  ------------------
   86|  9.48k|        pa2_[0] = pa_[0];
   87|  9.48k|        break;
   88|      0|      default:
  ------------------
  |  Branch (88:7): [True: 0, False: 173k]
  ------------------
   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|   173k|    }
   91|   173k|    memcpy(dest, pa2_, size);
   92|   173k|  }
   93|   173k|}
frame.c:is_little_endian:
   42|   173k|static bool is_little_endian(void) {
   43|   173k|  static const int i = 1;
   44|   173k|  char* p = (char*)&i;
   45|       |
   46|   173k|  if (p[0] == 1) {
  ------------------
  |  Branch (46:7): [True: 173k, False: 0]
  ------------------
   47|   173k|    return true;
   48|   173k|  }
   49|      0|  else {
   50|       |    return false;
   51|      0|  }
   52|   173k|}
frame.c:blosc2_nchunks_to_offsets_nbytes:
  103|  49.3k|static inline bool blosc2_nchunks_to_offsets_nbytes(int64_t nchunks, int32_t *off_nbytes) {
  104|  49.3k|  const int64_t max_nchunks = INT32_MAX / (int64_t)sizeof(int64_t);
  105|  49.3k|  if (nchunks < 0 || nchunks > max_nchunks) {
  ------------------
  |  Branch (105:7): [True: 0, False: 49.3k]
  |  Branch (105:22): [True: 3, False: 49.3k]
  ------------------
  106|      3|    return false;
  107|      3|  }
  108|  49.3k|  if (off_nbytes != NULL) {
  ------------------
  |  Branch (108:7): [True: 49.3k, False: 0]
  ------------------
  109|  49.3k|    *off_nbytes = (int32_t)(nchunks * (int64_t)sizeof(int64_t));
  110|  49.3k|  }
  111|       |  return true;
  112|  49.3k|}

blosc2_stdio_open:
  139|     30|void *blosc2_stdio_open(const char *urlpath, const char *mode, void *params) {
  140|     30|  BLOSC_UNUSED_PARAM(params);
  ------------------
  |  |   28|     30|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  141|     30|  if (urlpath == NULL || mode == NULL) {
  ------------------
  |  Branch (141:7): [True: 30, False: 0]
  |  Branch (141:26): [True: 0, False: 0]
  ------------------
  142|     30|    BLOSC_TRACE_ERROR("Invalid arguments for stdio open.");
  ------------------
  |  |   93|     30|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     30|    do {                                            \
  |  |  |  |   98|     30|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     30|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 30, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     30|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  143|     30|    return NULL;
  144|     30|  }
  145|      0|  FILE *file = fopen(urlpath, mode);
  146|      0|  if (file == NULL) {
  ------------------
  |  Branch (146:7): [True: 0, False: 0]
  ------------------
  147|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  148|      0|    return NULL;
  149|      0|  }
  150|      0|  blosc2_stdio_file *my_fp = malloc(sizeof(blosc2_stdio_file));
  151|      0|  if (my_fp == NULL) {
  ------------------
  |  Branch (151:7): [True: 0, False: 0]
  ------------------
  152|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  153|      0|    fclose(file);
  154|      0|    return NULL;
  155|      0|  }
  156|      0|  my_fp->file = file;
  157|      0|  return my_fp;
  158|      0|}
blosc2_stdio_destroy:
  304|  9.24k|int blosc2_stdio_destroy(void* params) {
  305|  9.24k|  BLOSC_UNUSED_PARAM(params);
  ------------------
  |  |   28|  9.24k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  306|  9.24k|  return 0;
  307|  9.24k|}

do_nothing:
  632|   308k|int do_nothing(uint8_t filter, char cmode) {
  633|   308k|  if (cmode == 'c') {
  ------------------
  |  Branch (633:7): [True: 0, False: 308k]
  ------------------
  634|      0|    return (filter == BLOSC_NOFILTER);
  635|   308k|  } else {
  636|       |    // TRUNC_PREC do not have to be applied during decompression
  637|   308k|    return ((filter == BLOSC_NOFILTER) || (filter == BLOSC_TRUNC_PREC));
  ------------------
  |  Branch (637:13): [True: 101k, False: 206k]
  |  Branch (637:43): [True: 23.8k, False: 182k]
  ------------------
  638|   308k|  }
  639|   308k|}
next_filter:
  642|  85.1k|int next_filter(const uint8_t* filters, int current_filter, char cmode) {
  643|   139k|  for (int i = current_filter - 1; i >= 0; i--) {
  ------------------
  |  Branch (643:36): [True: 139k, False: 0]
  ------------------
  644|   139k|    if (!do_nothing(filters[i], cmode)) {
  ------------------
  |  Branch (644:9): [True: 85.1k, False: 54.1k]
  ------------------
  645|  85.1k|      return filters[i];
  646|  85.1k|    }
  647|   139k|  }
  648|      0|  return BLOSC_NOFILTER;
  649|  85.1k|}
last_filter:
  652|  28.1k|int last_filter(const uint8_t* filters, char cmode) {
  653|  28.1k|  int last_index = -1;
  654|   197k|  for (int i = BLOSC2_MAX_FILTERS - 1; i >= 0; i--) {
  ------------------
  |  Branch (654:40): [True: 169k, False: 28.1k]
  ------------------
  655|   169k|    if (!do_nothing(filters[i], cmode))  {
  ------------------
  |  Branch (655:9): [True: 97.8k, False: 71.1k]
  ------------------
  656|  97.8k|      last_index = i;
  657|  97.8k|    }
  658|   169k|  }
  659|  28.1k|  return last_index;
  660|  28.1k|}
read_chunk_header:
  739|   274k|{
  740|   274k|  memset(header, 0, sizeof(blosc_header));
  741|       |
  742|   274k|  if (srcsize < BLOSC_MIN_HEADER_LENGTH) {
  ------------------
  |  Branch (742:7): [True: 0, False: 274k]
  ------------------
  743|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  744|      0|    return BLOSC2_ERROR_READ_BUFFER;
  745|      0|  }
  746|       |
  747|   274k|  memcpy(header, src, BLOSC_MIN_HEADER_LENGTH);
  748|       |
  749|   274k|  bool little_endian = is_little_endian();
  750|       |
  751|   274k|  if (!little_endian) {
  ------------------
  |  Branch (751:7): [True: 0, False: 274k]
  ------------------
  752|      0|    header->nbytes = bswap32_(header->nbytes);
  753|      0|    header->blocksize = bswap32_(header->blocksize);
  754|      0|    header->cbytes = bswap32_(header->cbytes);
  755|      0|  }
  756|       |
  757|   274k|  if (header->cbytes < BLOSC_MIN_HEADER_LENGTH) {
  ------------------
  |  Branch (757:7): [True: 5, False: 274k]
  ------------------
  758|      5|    BLOSC_TRACE_ERROR("`cbytes` is too small to read min header.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  759|      5|    return BLOSC2_ERROR_INVALID_HEADER;
  760|      5|  }
  761|   274k|  if (header->blocksize <= 0) {
  ------------------
  |  Branch (761:7): [True: 3, False: 274k]
  ------------------
  762|      3|    BLOSC_TRACE_ERROR("`blocksize` is zero");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  763|      3|    return BLOSC2_ERROR_INVALID_HEADER;
  764|      3|  }
  765|   274k|  if (header->blocksize > BLOSC2_MAXBLOCKSIZE) {
  ------------------
  |  Branch (765:7): [True: 4, False: 274k]
  ------------------
  766|      4|    BLOSC_TRACE_ERROR("`blocksize` greater than maximum allowed");
  ------------------
  |  |   93|      4|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      4|    do {                                            \
  |  |  |  |   98|      4|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      4|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      4|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  767|      4|    return BLOSC2_ERROR_INVALID_HEADER;
  768|      4|  }
  769|   274k|  if (header->typesize == 0) {
  ------------------
  |  Branch (769:7): [True: 1, False: 274k]
  ------------------
  770|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  771|      1|    return BLOSC2_ERROR_INVALID_HEADER;
  772|      1|  }
  773|       |
  774|       |  /* Read extended header if it is wanted */
  775|   274k|  if ((extended_header) && (header->flags & BLOSC_DOSHUFFLE) && (header->flags & BLOSC_DOBITSHUFFLE)) {
  ------------------
  |  Branch (775:7): [True: 29.2k, False: 245k]
  |  Branch (775:28): [True: 28.9k, False: 316]
  |  Branch (775:65): [True: 28.6k, False: 328]
  ------------------
  776|  28.6k|    if (header->cbytes < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (776:9): [True: 0, False: 28.6k]
  ------------------
  777|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  778|      0|      return BLOSC2_ERROR_INVALID_HEADER;
  779|      0|    }
  780|  28.6k|    if (srcsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (780:9): [True: 0, False: 28.6k]
  ------------------
  781|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  782|      0|      return BLOSC2_ERROR_READ_BUFFER;
  783|      0|    }
  784|       |
  785|  28.6k|    memcpy((uint8_t *)header + BLOSC_MIN_HEADER_LENGTH, src + BLOSC_MIN_HEADER_LENGTH,
  786|  28.6k|      BLOSC_EXTENDED_HEADER_LENGTH - BLOSC_MIN_HEADER_LENGTH);
  787|       |
  788|  28.6k|    if ((header->blosc2_flags2 & BLOSC2_VL_BLOCKS) && (header->blosc2_flags != 0)) {
  ------------------
  |  Branch (788:9): [True: 54, False: 28.5k]
  |  Branch (788:55): [True: 31, False: 23]
  ------------------
  789|     31|      int32_t special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
  790|     31|      if (special_type != 0) {
  ------------------
  |  Branch (790:11): [True: 0, False: 31]
  ------------------
  791|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  792|      0|        return BLOSC2_ERROR_INVALID_HEADER;
  793|      0|      }
  794|     31|    }
  795|       |
  796|  28.6k|    int32_t special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
  797|  28.6k|    if (special_type != 0) {
  ------------------
  |  Branch (797:9): [True: 4.49k, False: 24.1k]
  ------------------
  798|  4.49k|      if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (798:11): [True: 23, False: 4.47k]
  ------------------
  799|       |        // In this case, the actual type size must be derived from the cbytes
  800|     23|        int32_t typesize = header->cbytes - BLOSC_EXTENDED_HEADER_LENGTH;
  801|     23|        if (typesize <= 0) {
  ------------------
  |  Branch (801:13): [True: 0, False: 23]
  ------------------
  802|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  803|      0|          return BLOSC2_ERROR_INVALID_HEADER;
  804|      0|        }
  805|     23|        if (typesize > BLOSC2_MAXTYPESIZE) {
  ------------------
  |  Branch (805:13): [True: 0, False: 23]
  ------------------
  806|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  807|      0|          return BLOSC2_ERROR_INVALID_HEADER;
  808|      0|        }
  809|     23|        if (typesize > header->nbytes) {
  ------------------
  |  Branch (809:13): [True: 0, False: 23]
  ------------------
  810|      0|          BLOSC_TRACE_ERROR("`typesize` is greater than `nbytes`");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  811|      0|          return BLOSC2_ERROR_INVALID_HEADER;
  812|      0|        }
  813|     23|        if (header->nbytes % typesize != 0) {
  ------------------
  |  Branch (813:13): [True: 6, False: 17]
  ------------------
  814|      6|          BLOSC_TRACE_ERROR("`nbytes` is not a multiple of typesize");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  815|      6|          return BLOSC2_ERROR_INVALID_HEADER;
  816|      6|        }
  817|     23|      }
  818|  4.47k|      else {
  819|       |        // All-zero chunks fill with memset, which works regardless of element alignment.
  820|  4.47k|        if (special_type != BLOSC2_SPECIAL_ZERO
  ------------------
  |  Branch (820:13): [True: 600, False: 3.87k]
  ------------------
  821|    600|            && header->nbytes % header->typesize != 0) {
  ------------------
  |  Branch (821:16): [True: 0, False: 600]
  ------------------
  822|      0|          BLOSC_TRACE_ERROR("`nbytes` is not a multiple of typesize");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  823|      0|          return BLOSC2_ERROR_INVALID_HEADER;
  824|      0|        }
  825|  4.47k|      }
  826|  4.49k|    }
  827|       |    // The number of filters depends on the version of the header. Blosc2 alpha series
  828|       |    // did not initialize filters to zero beyond the max supported.
  829|  28.6k|    if (header->version == BLOSC2_VERSION_FORMAT_ALPHA) {
  ------------------
  |  Branch (829:9): [True: 3.43k, False: 25.1k]
  ------------------
  830|  3.43k|      header->filters[5] = 0;
  831|  3.43k|      header->filters_meta[5] = 0;
  832|  3.43k|    }
  833|  28.6k|  }
  834|   246k|  else {
  835|   246k|    flags_to_filters(header->flags, header->filters);
  836|   246k|  }
  837|   274k|  if (header->version > BLOSC2_VERSION_FORMAT &&
  ------------------
  |  Branch (837:7): [True: 61.2k, False: 213k]
  ------------------
  838|  61.2k|      (header->blosc2_flags2 & (uint8_t)~BLOSC2_VL_BLOCKS) != 0) {
  ------------------
  |  Branch (838:7): [True: 0, False: 61.2k]
  ------------------
  839|       |    /* Version from future with unsupported chunk features. */
  840|      0|    return BLOSC2_ERROR_VERSION_SUPPORT;
  841|      0|  }
  842|   274k|  if ((header->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0 &&
  ------------------
  |  Branch (842:7): [True: 54, False: 274k]
  ------------------
  843|     54|      (header->flags & (uint8_t)BLOSC_MEMCPYED) != 0) {
  ------------------
  |  Branch (843:7): [True: 0, False: 54]
  ------------------
  844|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  845|      0|    return BLOSC2_ERROR_INVALID_HEADER;
  846|      0|  }
  847|   274k|  if ((header->blosc2_flags2 & BLOSC2_VL_BLOCKS) == 0 &&
  ------------------
  |  Branch (847:7): [True: 274k, False: 54]
  ------------------
  848|   274k|      header->nbytes > 0 && header->blocksize > header->nbytes) {
  ------------------
  |  Branch (848:7): [True: 271k, False: 2.81k]
  |  Branch (848:29): [True: 30.8k, False: 241k]
  ------------------
  849|  30.8k|    header->blocksize = header->nbytes;
  850|  30.8k|  }
  851|   274k|  return 0;
  852|   274k|}
fill_codec:
  935|      1|int fill_codec(blosc2_codec *codec) {
  936|      1|  char libpath[PATH_MAX];
  937|      1|  void *lib = load_lib(codec->compname, libpath);
  938|      1|  if(lib == NULL) {
  ------------------
  |  Branch (938:6): [True: 1, False: 0]
  ------------------
  939|      1|    BLOSC_TRACE_ERROR("Error while loading the library for codec `%s`", codec->compname);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  940|      1|    return BLOSC2_ERROR_FAILURE;
  941|      1|  }
  942|       |
  943|      0|  codec_info *info = dlsym(lib, "info");
  944|      0|  if (info == NULL) {
  ------------------
  |  Branch (944:7): [True: 0, False: 0]
  ------------------
  945|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  946|      0|    dlclose(lib);
  947|      0|    return BLOSC2_ERROR_FAILURE;
  948|      0|  }
  949|      0|  codec->encoder = dlsym(lib, info->encoder);
  950|      0|  codec->decoder = dlsym(lib, info->decoder);
  951|       |
  952|      0|  if (codec->encoder == NULL || codec->decoder == NULL) {
  ------------------
  |  Branch (952:7): [True: 0, False: 0]
  |  Branch (952:33): [True: 0, False: 0]
  ------------------
  953|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  954|      0|    dlclose(lib);
  955|      0|    return BLOSC2_ERROR_FAILURE;
  956|      0|  }
  957|       |
  958|       |  /* If ever add .free function in future for codec params
  959|       |  codecparams_info *info2 = dlsym(lib, "info2");
  960|       |  if (info2 != NULL) {
  961|       |    // New plugin (e.g. openzl) with free function for codec_params defined
  962|       |    // will be used when destroying context in blosc2_free_ctx
  963|       |      codec->free = dlsym(lib, info2->free);
  964|       |  }
  965|       |  else{
  966|       |    codec->free = NULL;
  967|       |  }
  968|       |  */
  969|       |
  970|      0|  return BLOSC2_ERROR_SUCCESS;
  971|      0|}
_cycle_buffers:
 1048|  62.4k|void _cycle_buffers(uint8_t **src, uint8_t **dest, uint8_t **tmp) {
 1049|  62.4k|  uint8_t *tmp2 = *src;
 1050|  62.4k|  *src = *dest;
 1051|  62.4k|  *dest = *tmp;
 1052|  62.4k|  *tmp = tmp2;
 1053|  62.4k|}
pipeline_backward:
 1475|  19.1k|                      uint8_t* tmp2, int last_filter_index, int32_t nblock) {
 1476|  19.1k|  blosc2_context* context = thread_context->parent_context;
 1477|  19.1k|  int32_t typesize = context->typesize;
 1478|  19.1k|  uint8_t* filters = context->filters;
 1479|  19.1k|  uint8_t* filters_meta = context->filters_meta;
 1480|  19.1k|  uint8_t* _src = src;
 1481|  19.1k|  uint8_t* _dest = tmp;
 1482|  19.1k|  uint8_t* _tmp = tmp2;
 1483|  19.1k|  int errcode = 0;
 1484|       |
 1485|  91.1k|  for (int i = BLOSC2_MAX_FILTERS - 1; i >= 0; i--) {
  ------------------
  |  Branch (1485:40): [True: 91.1k, False: 0]
  ------------------
 1486|       |    // Delta filter requires the whole chunk ready
 1487|  91.1k|    int last_copy_filter = (last_filter_index == i) || (filters[i] == BLOSC_DELTA) ||
  ------------------
  |  Branch (1487:28): [True: 19.1k, False: 72.0k]
  |  Branch (1487:56): [True: 13.3k, False: 58.6k]
  ------------------
 1488|  58.6k|                           (next_filter(filters, i, 'd') == BLOSC_DELTA);
  ------------------
  |  Branch (1488:28): [True: 15.5k, False: 43.1k]
  ------------------
 1489|  91.1k|    if (last_copy_filter && context->postfilter == NULL &&
  ------------------
  |  Branch (1489:9): [True: 48.0k, False: 43.1k]
  |  Branch (1489:29): [True: 48.0k, False: 0]
  ------------------
 1490|  48.0k|        (filters[i] == BLOSC_DELTA || _src != dest + offset)) {
  ------------------
  |  Branch (1490:10): [True: 15.7k, False: 32.3k]
  |  Branch (1490:39): [True: 23.3k, False: 9.03k]
  ------------------
 1491|  39.0k|      _dest = dest + offset;
 1492|  39.0k|    }
 1493|  91.1k|    int rc = BLOSC2_ERROR_SUCCESS;
 1494|  91.1k|    if (filters[i] <= BLOSC2_DEFINED_FILTERS_STOP) {
  ------------------
  |  Branch (1494:9): [True: 71.3k, False: 19.8k]
  ------------------
 1495|  71.3k|      switch (filters[i]) {
 1496|  16.1k|        case BLOSC_SHUFFLE:
  ------------------
  |  Branch (1496:9): [True: 16.1k, False: 55.2k]
  ------------------
 1497|       |        // if filters_meta is not 0, interpret as number of bytes to be grouped together for shuffle
 1498|  16.1k|          blosc2_unshuffle(filters_meta[i] == 0 ? typesize : filters_meta[i], bsize, _src, _dest);
  ------------------
  |  Branch (1498:28): [True: 1.74k, False: 14.4k]
  ------------------
 1499|  16.1k|          break;
 1500|  10.7k|        case BLOSC_BITSHUFFLE:
  ------------------
  |  Branch (1500:9): [True: 10.7k, False: 60.6k]
  ------------------
 1501|  10.7k|          if (bitunshuffle(typesize, bsize, _src, _dest, context->src[BLOSC2_CHUNK_VERSION]) < 0) {
  ------------------
  |  Branch (1501:15): [True: 0, False: 10.7k]
  ------------------
 1502|      0|            return BLOSC2_ERROR_FILTER_PIPELINE;
 1503|      0|          }
 1504|  10.7k|          break;
 1505|  15.7k|        case BLOSC_DELTA:
  ------------------
  |  Branch (1505:9): [True: 15.7k, False: 55.6k]
  ------------------
 1506|  15.7k|          if (context->nthreads == 1) {
  ------------------
  |  Branch (1506:15): [True: 15.7k, False: 0]
  ------------------
 1507|       |            /* Serial mode */
 1508|  15.7k|            delta_decoder(dest, offset, bsize, typesize, _dest);
 1509|  15.7k|          } else {
 1510|      0|            struct blosc_job_group *job = context->job;
 1511|      0|            blosc2_pthread_mutex_t *delta_mutex = job != NULL ? &job->delta_mutex : &context->delta_mutex;
  ------------------
  |  |   89|      0|#define blosc2_pthread_mutex_t pthread_mutex_t
  ------------------
  |  Branch (1511:51): [True: 0, False: 0]
  ------------------
 1512|      0|            blosc2_pthread_cond_t *delta_cv = job != NULL ? &job->delta_cv : &context->delta_cv;
  ------------------
  |  |   95|      0|#define blosc2_pthread_cond_t pthread_cond_t
  ------------------
  |  Branch (1512:47): [True: 0, False: 0]
  ------------------
 1513|      0|            int *dref_not_init = job != NULL ? &job->dref_not_init : &context->dref_not_init;
  ------------------
  |  Branch (1513:34): [True: 0, False: 0]
  ------------------
 1514|       |            /* Force the thread in charge of the block 0 to go first */
 1515|      0|            blosc2_pthread_mutex_lock(delta_mutex);
  ------------------
  |  |   92|      0|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
 1516|      0|            if (*dref_not_init) {
  ------------------
  |  Branch (1516:17): [True: 0, False: 0]
  ------------------
 1517|      0|              if (offset != 0) {
  ------------------
  |  Branch (1517:19): [True: 0, False: 0]
  ------------------
 1518|      0|                blosc2_pthread_cond_wait(delta_cv, delta_mutex);
  ------------------
  |  |   98|      0|#define blosc2_pthread_cond_wait(a, b) pthread_cond_wait((a), (b))
  ------------------
 1519|      0|              } else {
 1520|      0|                delta_decoder(dest, offset, bsize, typesize, _dest);
 1521|      0|                *dref_not_init = 0;
 1522|      0|                blosc2_pthread_cond_broadcast(delta_cv);
  ------------------
  |  |  100|      0|#define blosc2_pthread_cond_broadcast(a) pthread_cond_broadcast((a))
  ------------------
 1523|      0|              }
 1524|      0|            }
 1525|      0|            blosc2_pthread_mutex_unlock(delta_mutex);
  ------------------
  |  |   93|      0|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 1526|      0|            if (offset != 0) {
  ------------------
  |  Branch (1526:17): [True: 0, False: 0]
  ------------------
 1527|      0|              delta_decoder(dest, offset, bsize, typesize, _dest);
 1528|      0|            }
 1529|      0|          }
 1530|  15.7k|          break;
 1531|  7.23k|        case BLOSC_TRUNC_PREC:
  ------------------
  |  Branch (1531:9): [True: 7.23k, False: 64.1k]
  ------------------
 1532|       |          // TRUNC_PREC filter does not need to be undone
 1533|  7.23k|          break;
 1534|  21.4k|        default:
  ------------------
  |  Branch (1534:9): [True: 21.4k, False: 49.8k]
  ------------------
 1535|  21.4k|          if (filters[i] != BLOSC_NOFILTER) {
  ------------------
  |  Branch (1535:15): [True: 0, False: 21.4k]
  ------------------
 1536|      0|            BLOSC_TRACE_ERROR("Filter %d not handled during decompression.",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1537|      0|                              filters[i]);
 1538|      0|            errcode = -1;
 1539|      0|          }
 1540|  71.3k|      }
 1541|  71.3k|    } else {
 1542|       |        // Look for the filters_meta in user filters and run it
 1543|  70.0k|        for (uint64_t j = 0; j < g_nfilters; ++j) {
  ------------------
  |  Branch (1543:30): [True: 70.0k, False: 3]
  ------------------
 1544|  70.0k|          if (g_filters[j].id == filters[i]) {
  ------------------
  |  Branch (1544:15): [True: 19.8k, False: 50.2k]
  ------------------
 1545|  19.8k|            if (g_filters[j].backward == NULL) {
  ------------------
  |  Branch (1545:17): [True: 0, False: 19.8k]
  ------------------
 1546|       |              // Dynamically load filter
 1547|      0|              if (fill_filter(&g_filters[j]) < 0) {
  ------------------
  |  Branch (1547:19): [True: 0, False: 0]
  ------------------
 1548|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1549|      0|                return BLOSC2_ERROR_FILTER_PIPELINE;
 1550|      0|              }
 1551|      0|            }
 1552|  19.8k|            if (g_filters[j].backward != NULL) {
  ------------------
  |  Branch (1552:17): [True: 19.8k, False: 0]
  ------------------
 1553|  19.8k|              blosc2_dparams dparams;
 1554|  19.8k|              blosc2_ctx_get_dparams(context, &dparams);
 1555|  19.8k|              rc = g_filters[j].backward(_src, _dest, bsize, filters_meta[i], &dparams, g_filters[j].id);
 1556|  19.8k|            } else {
 1557|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1558|      0|              return BLOSC2_ERROR_FILTER_PIPELINE;
 1559|      0|            }
 1560|  19.8k|            if (rc != BLOSC2_ERROR_SUCCESS) {
  ------------------
  |  Branch (1560:17): [True: 1, False: 19.8k]
  ------------------
 1561|      1|              BLOSC_TRACE_ERROR("User-defined filter %d failed during decompression.", filters[i]);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1562|      1|              return rc;
 1563|      1|            }
 1564|  19.8k|            goto urfiltersuccess;
 1565|  19.8k|          }
 1566|  70.0k|        }
 1567|      3|      BLOSC_TRACE_ERROR("User-defined filter %d not found during decompression.", filters[i]);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1568|      3|      return BLOSC2_ERROR_FILTER_PIPELINE;
 1569|  19.8k|      urfiltersuccess:;
 1570|  19.8k|    }
 1571|       |
 1572|       |    // Cycle buffers when required
 1573|  91.1k|    if ((filters[i] != BLOSC_NOFILTER) && (filters[i] != BLOSC_TRUNC_PREC)) {
  ------------------
  |  Branch (1573:9): [True: 69.7k, False: 21.4k]
  |  Branch (1573:43): [True: 62.4k, False: 7.23k]
  ------------------
 1574|  62.4k|      _cycle_buffers(&_src, &_dest, &_tmp);
 1575|  62.4k|    }
 1576|  91.1k|    if (last_filter_index == i) {
  ------------------
  |  Branch (1576:9): [True: 19.1k, False: 72.0k]
  ------------------
 1577|  19.1k|      break;
 1578|  19.1k|    }
 1579|  91.1k|  }
 1580|       |
 1581|  19.1k|  if (context->postfilter == NULL && _src != dest + offset) {
  ------------------
  |  Branch (1581:7): [True: 19.1k, False: 0]
  |  Branch (1581:38): [True: 4.56k, False: 14.5k]
  ------------------
 1582|  4.56k|    memcpy(dest + offset, _src, (unsigned int)bsize);
 1583|  4.56k|  }
 1584|       |
 1585|       |  /* Postfilter function */
 1586|  19.1k|  if (context->postfilter != NULL) {
  ------------------
  |  Branch (1586:7): [True: 0, False: 19.1k]
  ------------------
 1587|       |    // Create new postfilter parameters for this block (must be private for each thread)
 1588|      0|    blosc2_postfilter_params postparams;
 1589|      0|    memcpy(&postparams, context->postparams, sizeof(postparams));
 1590|      0|    postparams.input = _src;
 1591|      0|    postparams.output = dest + offset;
 1592|      0|    postparams.size = bsize;
 1593|      0|    postparams.typesize = typesize;
 1594|      0|    postparams.offset = nblock * context->blocksize;
 1595|      0|    postparams.nchunk = context->schunk != NULL ? context->schunk->current_nchunk : -1;
  ------------------
  |  Branch (1595:25): [True: 0, False: 0]
  ------------------
 1596|      0|    postparams.nblock = nblock;
 1597|      0|    postparams.tid = thread_context->tid;
 1598|      0|    postparams.ttmp = thread_context->tmp;
 1599|      0|    postparams.ttmp_nbytes = thread_context->tmp_nbytes;
 1600|      0|    postparams.ctx = context;
 1601|       |
 1602|      0|    if (context->postfilter(&postparams) != 0) {
  ------------------
  |  Branch (1602:9): [True: 0, False: 0]
  ------------------
 1603|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1604|      0|      return BLOSC2_ERROR_POSTFILTER;
 1605|      0|    }
 1606|      0|  }
 1607|       |
 1608|  19.1k|  return errcode;
 1609|  19.1k|}
free_thread_context:
 2294|  19.7k|void free_thread_context(struct thread_context* thread_context) {
 2295|  19.7k|  destroy_thread_context(thread_context);
 2296|  19.7k|  my_free(thread_context);
 2297|  19.7k|}
check_nthreads:
 2300|  18.5k|int check_nthreads(blosc2_context* context) {
 2301|  18.5k|  if (context->new_nthreads != context->nthreads && context->new_nthreads <= 0) {
  ------------------
  |  Branch (2301:7): [True: 0, False: 18.5k]
  |  Branch (2301:53): [True: 0, False: 0]
  ------------------
 2302|      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__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2302|      0|    BLOSC_TRACE_ERROR("nthreads must be >= 1 and <= %d", INT16_MAX);
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2303|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2304|      0|  }
 2305|  18.5k|  if (context->nthreads <= 0) {
  ------------------
  |  Branch (2305:7): [True: 0, False: 18.5k]
  ------------------
 2306|      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__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2306|      0|    BLOSC_TRACE_ERROR("nthreads must be >= 1 and <= %d", INT16_MAX);
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2307|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2308|      0|  }
 2309|       |
 2310|       |  /* Detect a pool that was torn down by blosc2_destroy() while this context
 2311|       |   * was still alive.  The epoch mismatch tells us the pool pointer is dangling;
 2312|       |   * clear it so the re-attach logic below creates a fresh one. */
 2313|  18.5k|  if (context->thread_backend == BLOSC_BACKEND_SHARED_POOL &&
  ------------------
  |  |   33|  37.1k|#define BLOSC_BACKEND_SHARED_POOL 1
  ------------------
  |  Branch (2313:7): [True: 0, False: 18.5k]
  ------------------
 2314|      0|      context->pool_epoch != g_destroy_count) {
  ------------------
  |  Branch (2314:7): [True: 0, False: 0]
  ------------------
 2315|      0|    context->thread_pool = NULL;
 2316|      0|    context->threads_started = 0;
 2317|      0|    context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   32|      0|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 2318|      0|  }
 2319|       |
 2320|  18.5k|  if (context->new_nthreads != context->nthreads) {
  ------------------
  |  Branch (2320:7): [True: 0, False: 18.5k]
  ------------------
 2321|      0|    release_thread_backend(context);
 2322|      0|    context->nthreads = context->new_nthreads;
 2323|      0|  }
 2324|  18.5k|  if (context->nthreads > 1 && context->threads_started == 0) {
  ------------------
  |  Branch (2324:7): [True: 0, False: 18.5k]
  |  Branch (2324:32): [True: 0, False: 0]
  ------------------
 2325|      0|    int rc;
 2326|      0|    if (threads_callback) {
  ------------------
  |  Branch (2326:9): [True: 0, False: 0]
  ------------------
 2327|      0|      rc = init_callback_threads(context);
 2328|      0|    }
 2329|      0|    else {
 2330|       |#if defined(_WIN32)
 2331|       |      rc = init_threadpool(context);
 2332|       |#else
 2333|      0|      rc = attach_shared_pool(context);
 2334|      0|#endif
 2335|      0|    }
 2336|      0|    if (rc < 0) {
  ------------------
  |  Branch (2336:9): [True: 0, False: 0]
  ------------------
 2337|      0|      return rc;
 2338|      0|    }
 2339|      0|  }
 2340|  18.5k|  if (context->nthreads <= 1) {
  ------------------
  |  Branch (2340:7): [True: 18.5k, False: 0]
  ------------------
 2341|  18.5k|    context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   32|  18.5k|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 2342|  18.5k|  }
 2343|       |
 2344|  18.5k|  return context->nthreads;
 2345|  18.5k|}
build_filters:
 3687|  11.1k|                   const int32_t typesize, uint8_t* filters) {
 3688|       |
 3689|       |  /* Fill the end part of the filter pipeline */
 3690|  11.1k|  if ((doshuffle == BLOSC_SHUFFLE) && (typesize > 1))
  ------------------
  |  Branch (3690:7): [True: 0, False: 11.1k]
  |  Branch (3690:39): [True: 0, False: 0]
  ------------------
 3691|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_SHUFFLE;
 3692|  11.1k|  if (doshuffle == BLOSC_BITSHUFFLE)
  ------------------
  |  Branch (3692:7): [True: 0, False: 11.1k]
  ------------------
 3693|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_BITSHUFFLE;
 3694|  11.1k|  if (doshuffle == BLOSC_NOSHUFFLE)
  ------------------
  |  Branch (3694:7): [True: 0, False: 11.1k]
  ------------------
 3695|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_NOSHUFFLE;
 3696|  11.1k|  if (delta)
  ------------------
  |  Branch (3696:7): [True: 0, False: 11.1k]
  ------------------
 3697|      0|    filters[BLOSC2_MAX_FILTERS - 2] = BLOSC_DELTA;
 3698|  11.1k|}
blosc2_decompress_ctx:
 3944|  18.8k|                          void* dest, int32_t destsize) {
 3945|  18.8k|  int result;
 3946|       |
 3947|  18.8k|  if (context->do_compress != 0) {
  ------------------
  |  Branch (3947:7): [True: 0, False: 18.8k]
  ------------------
 3948|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3949|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 3950|      0|  }
 3951|       |
 3952|  18.8k|  result = blosc_run_decompression_with_context(context, src, srcsize, dest, destsize);
 3953|       |
 3954|       |  // Reset a possible block_maskout
 3955|  18.8k|  if (context->block_maskout != NULL) {
  ------------------
  |  Branch (3955:7): [True: 0, False: 18.8k]
  ------------------
 3956|      0|    free(context->block_maskout);
 3957|      0|    context->block_maskout = NULL;
 3958|      0|  }
 3959|  18.8k|  context->block_maskout_nitems = 0;
 3960|       |
 3961|  18.8k|  return result;
 3962|  18.8k|}
_blosc_getitem:
 4266|  10.3k|                   int start, int nitems, void* dest, int32_t destsize) {
 4267|  10.3k|  uint8_t* _src = (uint8_t*)(src);  /* current pos for source buffer */
 4268|  10.3k|  uint8_t* _dest = (uint8_t*)(dest);
 4269|  10.3k|  int32_t ntbytes = 0;              /* the number of uncompressed bytes */
 4270|  10.3k|  int32_t bsize, bsize2, ebsize, leftoverblock;
 4271|  10.3k|  int32_t startb, stopb;
 4272|  10.3k|  int32_t stop;
 4273|  10.3k|  int32_t nitems_bytes;
 4274|  10.3k|  int64_t start64 = (int64_t)start;
 4275|  10.3k|  int64_t nitems64 = (int64_t)nitems;
 4276|  10.3k|  int64_t typesize64 = (int64_t)header->typesize;
 4277|  10.3k|  int64_t stop64;
 4278|  10.3k|  int64_t nitems_bytes64;
 4279|  10.3k|  int64_t start_bytes64;
 4280|  10.3k|  int64_t stop_bytes64;
 4281|  10.3k|  int j, rc;
 4282|       |
 4283|  10.3k|  if (nitems == 0) {
  ------------------
  |  Branch (4283:7): [True: 0, False: 10.3k]
  ------------------
 4284|       |    // We have nothing to do
 4285|      0|    return 0;
 4286|      0|  }
 4287|  10.3k|  if (nitems < 0) {
  ------------------
  |  Branch (4287:7): [True: 0, False: 10.3k]
  ------------------
 4288|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4289|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4290|      0|  }
 4291|       |
 4292|  10.3k|  nitems_bytes64 = nitems64 * typesize64;
 4293|  10.3k|  if (nitems_bytes64 < 0 || nitems_bytes64 > INT32_MAX || nitems_bytes64 > destsize) {
  ------------------
  |  Branch (4293:7): [True: 0, False: 10.3k]
  |  Branch (4293:29): [True: 0, False: 10.3k]
  |  Branch (4293:59): [True: 18, False: 10.3k]
  ------------------
 4294|     18|    BLOSC_TRACE_ERROR("`nitems`*`typesize` out of dest bounds.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4295|     18|    return BLOSC2_ERROR_WRITE_BUFFER;
 4296|     18|  }
 4297|  10.3k|  nitems_bytes = (int32_t)nitems_bytes64;
 4298|       |
 4299|  10.3k|  int32_t* bstarts = (int32_t*)(_src + context->header_overhead);
 4300|       |
 4301|       |  /* Check region boundaries */
 4302|  10.3k|  start_bytes64 = start64 * typesize64;
 4303|  10.3k|  if ((start < 0) || (start_bytes64 < 0) || (start_bytes64 > header->nbytes)) {
  ------------------
  |  Branch (4303:7): [True: 0, False: 10.3k]
  |  Branch (4303:22): [True: 0, False: 10.3k]
  |  Branch (4303:45): [True: 0, False: 10.3k]
  ------------------
 4304|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4305|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4306|      0|  }
 4307|       |
 4308|  10.3k|  stop64 = start64 + nitems64;
 4309|  10.3k|  if ((stop64 < 0) || (stop64 > INT32_MAX)) {
  ------------------
  |  Branch (4309:7): [True: 0, False: 10.3k]
  |  Branch (4309:23): [True: 0, False: 10.3k]
  ------------------
 4310|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4311|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4312|      0|  }
 4313|  10.3k|  stop = (int32_t)stop64;
 4314|       |
 4315|  10.3k|  stop_bytes64 = stop64 * typesize64;
 4316|  10.3k|  if ((stop_bytes64 < 0) || (stop_bytes64 > header->nbytes)) {
  ------------------
  |  Branch (4316:7): [True: 0, False: 10.3k]
  |  Branch (4316:29): [True: 0, False: 10.3k]
  ------------------
 4317|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4318|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4319|      0|  }
 4320|       |
 4321|  10.3k|  bool chunk_memcpyed = (header->flags & (uint8_t)BLOSC_MEMCPYED) != 0;
 4322|  10.3k|  if (!context->special_type && !chunk_memcpyed &&
  ------------------
  |  Branch (4322:7): [True: 8.97k, False: 1.40k]
  |  Branch (4322:33): [True: 7.90k, False: 1.07k]
  ------------------
 4323|  7.90k|      ((uint8_t *)(_src + srcsize) < (uint8_t *)(bstarts + context->nblocks))) {
  ------------------
  |  Branch (4323:7): [True: 0, False: 7.90k]
  ------------------
 4324|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4325|      0|    return BLOSC2_ERROR_READ_BUFFER;
 4326|      0|  }
 4327|       |
 4328|  10.3k|  bool memcpyed = header->flags & (uint8_t)BLOSC_MEMCPYED;
 4329|  10.3k|  if (context->special_type) {
  ------------------
  |  Branch (4329:7): [True: 1.40k, False: 8.97k]
  ------------------
 4330|       |    // Fake a runlen as if its a memcpyed chunk
 4331|  1.40k|    memcpyed = true;
 4332|  1.40k|  }
 4333|       |
 4334|  10.3k|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (4334:19): [True: 10.2k, False: 177]
  ------------------
 4335|  10.2k|                  (context->blosc2_flags & 0x08u) && !context->special_type);
  ------------------
  |  Branch (4335:19): [True: 606, False: 9.59k]
  |  Branch (4335:54): [True: 0, False: 606]
  ------------------
 4336|  10.3k|  if (memcpyed && !is_lazy && !context->postfilter) {
  ------------------
  |  Branch (4336:7): [True: 2.47k, False: 7.90k]
  |  Branch (4336:19): [True: 2.47k, False: 0]
  |  Branch (4336:31): [True: 2.47k, False: 0]
  ------------------
 4337|       |    // Short-circuit for (non-lazy) memcpyed or special values
 4338|  2.47k|    ntbytes = nitems_bytes;
 4339|  2.47k|    switch (context->special_type) {
 4340|      2|      case BLOSC2_SPECIAL_VALUE: {
  ------------------
  |  Branch (4340:7): [True: 2, False: 2.47k]
  ------------------
 4341|       |        // The repeated value's width is cbytes minus the header, not the header
 4342|       |        // typesize byte (which is left unconstrained for special-value chunks).
 4343|       |        // Derive it the same way blosc_d() does so a crafted typesize cannot make
 4344|       |        // set_values() read past the end of the chunk.
 4345|      2|        int32_t value_typesize = header->cbytes - context->header_overhead;
 4346|      2|        rc = set_values(value_typesize, _src, _dest, ntbytes);
 4347|      2|        if (rc < 0) {
  ------------------
  |  Branch (4347:13): [True: 0, False: 2]
  ------------------
 4348|      0|          BLOSC_TRACE_ERROR("set_values failed");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4349|      0|          return BLOSC2_ERROR_DATA;
 4350|      0|        }
 4351|      2|        break;
 4352|      2|      }
 4353|      5|      case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (4353:7): [True: 5, False: 2.46k]
  ------------------
 4354|      5|        rc = set_nans(context->typesize, _dest, ntbytes);
 4355|      5|        if (rc < 0) {
  ------------------
  |  Branch (4355:13): [True: 0, False: 5]
  ------------------
 4356|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4357|      0|          return BLOSC2_ERROR_DATA;
 4358|      0|        }
 4359|      5|        break;
 4360|  1.38k|      case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (4360:7): [True: 1.38k, False: 1.08k]
  ------------------
 4361|  1.38k|        memset(_dest, 0, ntbytes);
 4362|  1.38k|        break;
 4363|      5|      case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (4363:7): [True: 5, False: 2.46k]
  ------------------
 4364|       |        // We do nothing here
 4365|      5|        break;
 4366|  1.07k|      case BLOSC2_NO_SPECIAL:
  ------------------
  |  Branch (4366:7): [True: 1.07k, False: 1.40k]
  ------------------
 4367|  1.07k|        {
 4368|  1.07k|          int64_t src_offset64 = (int64_t)context->header_overhead + start_bytes64;
 4369|  1.07k|          int64_t src_stop64 = src_offset64 + nitems_bytes64;
 4370|  1.07k|          if ((src_offset64 < 0) || (src_stop64 < src_offset64) || (src_stop64 > srcsize)) {
  ------------------
  |  Branch (4370:15): [True: 0, False: 1.07k]
  |  Branch (4370:37): [True: 0, False: 1.07k]
  |  Branch (4370:68): [True: 0, False: 1.07k]
  ------------------
 4371|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4372|      0|            return BLOSC2_ERROR_READ_BUFFER;
 4373|      0|          }
 4374|  1.07k|          _src += (int32_t)src_offset64;
 4375|  1.07k|        }
 4376|      0|        memcpy(_dest, _src, ntbytes);
 4377|  1.07k|        break;
 4378|      0|      default:
  ------------------
  |  Branch (4378:7): [True: 0, False: 2.47k]
  ------------------
 4379|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4380|      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]
  |  |  ------------------
  ------------------
 4381|  2.47k|    }
 4382|  2.47k|    return ntbytes;
 4383|  2.47k|  }
 4384|       |
 4385|  7.90k|  ebsize = header->blocksize + header->typesize * (signed)sizeof(int32_t);
 4386|  7.90k|  struct thread_context* scontext = context->serial_context;
 4387|       |  /* Resize the temporaries in serial context if needed */
 4388|  7.90k|  if (header->blocksize > scontext->tmp_blocksize) {
  ------------------
  |  Branch (4388:7): [True: 0, False: 7.90k]
  ------------------
 4389|      0|    my_free(scontext->tmp);
 4390|      0|    scontext->tmp_nbytes = (size_t)4 * ebsize;
 4391|      0|    scontext->tmp = my_malloc(scontext->tmp_nbytes);
 4392|      0|    BLOSC_ERROR_NULL(scontext->tmp, 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]
  |  |  ------------------
  ------------------
 4393|      0|    scontext->tmp2 = scontext->tmp + ebsize;
 4394|      0|    scontext->tmp3 = scontext->tmp2 + ebsize;
 4395|      0|    scontext->tmp4 = scontext->tmp3 + ebsize;
 4396|      0|    scontext->tmp_blocksize = (int32_t)header->blocksize;
 4397|      0|  }
 4398|       |
 4399|  15.8k|  for (j = 0; j < context->nblocks; j++) {
  ------------------
  |  Branch (4399:15): [True: 13.2k, False: 2.65k]
  ------------------
 4400|  13.2k|    bsize = header->blocksize;
 4401|  13.2k|    leftoverblock = 0;
 4402|  13.2k|    if ((j == context->nblocks - 1) && (context->leftover > 0)) {
  ------------------
  |  Branch (4402:9): [True: 7.90k, False: 5.30k]
  |  Branch (4402:40): [True: 5.30k, False: 2.60k]
  ------------------
 4403|  5.30k|      bsize = context->leftover;
 4404|  5.30k|      leftoverblock = 1;
 4405|  5.30k|    }
 4406|       |
 4407|       |    /* Compute start & stop for each block */
 4408|  13.2k|    startb = start * header->typesize - j * header->blocksize;
 4409|  13.2k|    stopb = stop * header->typesize - j * header->blocksize;
 4410|  13.2k|    if (stopb <= 0) {
  ------------------
  |  Branch (4410:9): [True: 5.25k, False: 7.95k]
  ------------------
 4411|       |      // We can exit as soon as this block is beyond stop
 4412|  5.25k|      break;
 4413|  5.25k|    }
 4414|  7.95k|    if (startb >= header->blocksize) {
  ------------------
  |  Branch (4414:9): [True: 37, False: 7.91k]
  ------------------
 4415|     37|      continue;
 4416|     37|    }
 4417|  7.91k|    if (startb < 0) {
  ------------------
  |  Branch (4417:9): [True: 12, False: 7.90k]
  ------------------
 4418|     12|      startb = 0;
 4419|     12|    }
 4420|  7.91k|    if (stopb > header->blocksize) {
  ------------------
  |  Branch (4420:9): [True: 12, False: 7.90k]
  ------------------
 4421|     12|      stopb = header->blocksize;
 4422|     12|    }
 4423|  7.91k|    bsize2 = stopb - startb;
 4424|       |
 4425|  7.91k|#if defined(HAVE_ZFP)
 4426|  7.91k|    if (context->compcode == BLOSC_CODEC_ZFP_FIXED_RATE) {
  ------------------
  |  Branch (4426:9): [True: 1.94k, False: 5.97k]
  ------------------
 4427|  1.94k|      scontext->zfp_cell_start = startb / context->typesize;
 4428|  1.94k|      scontext->zfp_cell_nitems = nitems;
 4429|  1.94k|    }
 4430|  7.91k|#endif /* HAVE_ZFP */
 4431|       |
 4432|       |    /* Do the actual data copy */
 4433|       |    // Regular decompression.  Put results in tmp2.
 4434|       |    // If the block is aligned and the worst case fits in destination, let's avoid a copy
 4435|  7.91k|    bool get_single_block = ((startb == 0) && (bsize == nitems_bytes));
  ------------------
  |  Branch (4435:30): [True: 257, False: 7.66k]
  |  Branch (4435:47): [True: 4, False: 253]
  ------------------
 4436|  7.91k|    uint8_t* tmp2 = get_single_block ? dest : scontext->tmp2;
  ------------------
  |  Branch (4436:21): [True: 4, False: 7.91k]
  ------------------
 4437|       |
 4438|       |    // If memcpyed we don't have a bstarts section (because it is not needed)
 4439|  7.91k|    int32_t src_offset = memcpyed ?
  ------------------
  |  Branch (4439:26): [True: 0, False: 7.91k]
  ------------------
 4440|  7.91k|      context->header_overhead + j * header->blocksize : sw32_(bstarts + j);
 4441|       |
 4442|  7.91k|    int32_t cbytes = blosc_d(context->serial_context, bsize, leftoverblock, memcpyed,
 4443|  7.91k|                             src, srcsize, src_offset, j,
 4444|  7.91k|                             tmp2, 0, scontext->tmp, scontext->tmp3);
 4445|  7.91k|    if (cbytes < 0) {
  ------------------
  |  Branch (4445:9): [True: 0, False: 7.91k]
  ------------------
 4446|      0|      ntbytes = cbytes;
 4447|      0|      break;
 4448|      0|    }
 4449|  7.91k|    if (scontext->zfp_cell_nitems > 0) {
  ------------------
  |  Branch (4449:9): [True: 1.94k, False: 5.97k]
  ------------------
 4450|  1.94k|      if (cbytes == bsize2) {
  ------------------
  |  Branch (4450:11): [True: 0, False: 1.94k]
  ------------------
 4451|      0|        memcpy((uint8_t *) dest, tmp2, (unsigned int) bsize2);
 4452|  1.94k|      } else if (cbytes == context->blocksize) {
  ------------------
  |  Branch (4452:18): [True: 1.94k, False: 5]
  ------------------
 4453|  1.94k|        memcpy((uint8_t *) dest, tmp2 + scontext->zfp_cell_start * context->typesize, (unsigned int) bsize2);
 4454|  1.94k|        cbytes = bsize2;
 4455|  1.94k|      }
 4456|  5.97k|    } else if (!get_single_block) {
  ------------------
  |  Branch (4456:16): [True: 5.96k, False: 4]
  ------------------
 4457|       |      /* Copy to destination */
 4458|  5.96k|      memcpy((uint8_t *) dest + ntbytes, tmp2 + startb, (unsigned int) bsize2);
 4459|  5.96k|    }
 4460|  7.91k|    ntbytes += bsize2;
 4461|  7.91k|  }
 4462|       |
 4463|  7.90k|  scontext->zfp_cell_nitems = 0;
 4464|       |
 4465|  7.90k|  if (ntbytes >= 0 && ntbytes != nitems_bytes) {
  ------------------
  |  Branch (4465:7): [True: 7.90k, False: 0]
  |  Branch (4465:23): [True: 0, False: 7.90k]
  ------------------
 4466|       |    // A partial decode must not look like a success: callers that only test for
 4467|       |    // a negative return would silently keep hold of an incompletely filled dest.
 4468|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4469|      0|                      ntbytes, nitems_bytes);
 4470|      0|    return BLOSC2_ERROR_DATA;
 4471|      0|  }
 4472|       |
 4473|  7.90k|  return ntbytes;
 4474|  7.90k|}
blosc2_getitem:
 4476|  10.3k|int blosc2_getitem(const void* src, int32_t srcsize, int start, int nitems, void* dest, int32_t destsize) {
 4477|  10.3k|  blosc2_context context;
 4478|  10.3k|  int result;
 4479|       |
 4480|       |  /* Minimally populate the context */
 4481|  10.3k|  memset(&context, 0, sizeof(blosc2_context));
 4482|       |
 4483|  10.3k|  context.schunk = g_schunk;
 4484|  10.3k|  context.nthreads = 1;  // force a serial decompression; fixes #95
 4485|       |
 4486|       |  /* Call the actual getitem function */
 4487|  10.3k|  result = blosc2_getitem_ctx(&context, src, srcsize, start, nitems, dest, destsize);
 4488|       |
 4489|       |  /* Release resources */
 4490|  10.3k|  if (context.serial_context != NULL) {
  ------------------
  |  Branch (4490:7): [True: 10.3k, False: 0]
  ------------------
 4491|  10.3k|    free_thread_context(context.serial_context);
 4492|  10.3k|  }
 4493|  10.3k|  return result;
 4494|  10.3k|}
blosc2_getitem_ctx:
 4542|  10.3k|    int start, int nitems, void* dest, int32_t destsize) {
 4543|  10.3k|  blosc_header header;
 4544|  10.3k|  int result = getitem_read_header(src, srcsize, &header);
 4545|  10.3k|  if (result < 0) {
  ------------------
  |  Branch (4545:7): [True: 0, False: 10.3k]
  ------------------
 4546|      0|    return result;
 4547|      0|  }
 4548|       |
 4549|  10.3k|  return getitem_with_header(context, &header, src, srcsize, start, nitems, dest, destsize);
 4550|  10.3k|}
blosc2_get_nthreads:
 5608|  18.4k|{
 5609|  18.4k|  int16_t nthreads;
 5610|  18.4k|  if (!g_initlib) {
  ------------------
  |  Branch (5610:7): [True: 0, False: 18.4k]
  ------------------
 5611|      0|    blosc2_init();
 5612|      0|  }
 5613|  18.4k|  blosc2_pthread_mutex_lock(&global_comp_mutex);
  ------------------
  |  |   92|  18.4k|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
 5614|  18.4k|  nthreads = g_nthreads;
 5615|  18.4k|  blosc2_pthread_mutex_unlock(&global_comp_mutex);
  ------------------
  |  |   93|  18.4k|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 5616|  18.4k|  return nthreads;
 5617|  18.4k|}
blosc2_set_nthreads:
 5619|  9.34k|int16_t blosc2_set_nthreads(int16_t nthreads) {
 5620|  9.34k|  int16_t ret;          /* the previous number of threads */
 5621|       |
 5622|       |  /* Check whether the library should be initialized */
 5623|  9.34k|  if (!g_initlib) blosc2_init();
  ------------------
  |  Branch (5623:7): [True: 0, False: 9.34k]
  ------------------
 5624|       |
 5625|  9.34k|  blosc2_pthread_mutex_lock(&global_comp_mutex);
  ------------------
  |  |   92|  9.34k|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
 5626|  9.34k|  ret = g_nthreads;
 5627|  9.34k|  if (nthreads != ret) {
  ------------------
  |  Branch (5627:7): [True: 0, False: 9.34k]
  ------------------
 5628|      0|    int16_t old_new_nthreads = g_global_context->new_nthreads;
 5629|      0|    int16_t old_nthreads = g_global_context->nthreads;
 5630|      0|    g_nthreads = nthreads;
 5631|      0|    g_global_context->new_nthreads = nthreads;
 5632|      0|    int16_t ret2 = check_nthreads(g_global_context);
 5633|      0|    if (ret2 < 0) {
  ------------------
  |  Branch (5633:9): [True: 0, False: 0]
  ------------------
 5634|      0|      g_nthreads = ret;
 5635|      0|      g_global_context->new_nthreads = old_new_nthreads;
 5636|      0|      g_global_context->nthreads = old_nthreads;
 5637|      0|      check_nthreads(g_global_context);
 5638|      0|      blosc2_pthread_mutex_unlock(&global_comp_mutex);
  ------------------
  |  |   93|      0|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 5639|      0|      return ret2;
 5640|      0|    }
 5641|      0|  }
 5642|  9.34k|  blosc2_pthread_mutex_unlock(&global_comp_mutex);
  ------------------
  |  |   93|  9.34k|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 5643|       |
 5644|  9.34k|  return ret;
 5645|  9.34k|}
blosc2_cbuffer_sizes:
 5797|   245k|int blosc2_cbuffer_sizes(const void* cbuffer, int32_t* nbytes, int32_t* cbytes, int32_t* blocksize) {
 5798|   245k|  blosc_header header;
 5799|   245k|  int rc = read_chunk_header((uint8_t *) cbuffer, BLOSC_MIN_HEADER_LENGTH, false, &header);
 5800|   245k|  if (rc < 0) {
  ------------------
  |  Branch (5800:7): [True: 13, False: 245k]
  ------------------
 5801|       |    /* Return zeros if error reading header */
 5802|     13|    memset(&header, 0, sizeof(header));
 5803|     13|  }
 5804|       |
 5805|       |  /* Read the interesting values */
 5806|   245k|  if (nbytes != NULL)
  ------------------
  |  Branch (5806:7): [True: 237k, False: 8.33k]
  ------------------
 5807|   237k|    *nbytes = header.nbytes;
 5808|   245k|  if (cbytes != NULL)
  ------------------
  |  Branch (5808:7): [True: 245k, False: 0]
  ------------------
 5809|   245k|    *cbytes = header.cbytes;
 5810|   245k|  if (blocksize != NULL)
  ------------------
  |  Branch (5810:7): [True: 19.6k, False: 225k]
  ------------------
 5811|  19.6k|    *blocksize = header.blocksize;
 5812|   245k|  return rc;
 5813|   245k|}
blosc2_init:
 5948|  9.34k|void blosc2_init(void) {
 5949|       |  /* Return if Blosc is already initialized */
 5950|  9.34k|  if (g_initlib) return;
  ------------------
  |  Branch (5950:7): [True: 0, False: 9.34k]
  ------------------
 5951|       |
 5952|  9.34k|  BLOSC2_IO_CB_DEFAULTS.id = BLOSC2_IO_FILESYSTEM;
 5953|  9.34k|  BLOSC2_IO_CB_DEFAULTS.name = "filesystem";
 5954|  9.34k|  BLOSC2_IO_CB_DEFAULTS.is_allocation_necessary = true;
 5955|  9.34k|  BLOSC2_IO_CB_DEFAULTS.open = (blosc2_open_cb) blosc2_stdio_open;
 5956|  9.34k|  BLOSC2_IO_CB_DEFAULTS.close = (blosc2_close_cb) blosc2_stdio_close;
 5957|  9.34k|  BLOSC2_IO_CB_DEFAULTS.size = (blosc2_size_cb) blosc2_stdio_size;
 5958|  9.34k|  BLOSC2_IO_CB_DEFAULTS.write = (blosc2_write_cb) blosc2_stdio_write;
 5959|  9.34k|  BLOSC2_IO_CB_DEFAULTS.read = (blosc2_read_cb) blosc2_stdio_read;
 5960|  9.34k|  BLOSC2_IO_CB_DEFAULTS.truncate = (blosc2_truncate_cb) blosc2_stdio_truncate;
 5961|  9.34k|  BLOSC2_IO_CB_DEFAULTS.destroy = (blosc2_destroy_cb) blosc2_stdio_destroy;
 5962|       |
 5963|  9.34k|  _blosc2_register_io_cb(&BLOSC2_IO_CB_DEFAULTS);
 5964|       |
 5965|  9.34k|  BLOSC2_IO_CB_MMAP.id = BLOSC2_IO_FILESYSTEM_MMAP;
 5966|  9.34k|  BLOSC2_IO_CB_MMAP.name = "filesystem_mmap";
 5967|  9.34k|  BLOSC2_IO_CB_MMAP.is_allocation_necessary = false;
 5968|  9.34k|  BLOSC2_IO_CB_MMAP.open = (blosc2_open_cb) blosc2_stdio_mmap_open;
 5969|  9.34k|  BLOSC2_IO_CB_MMAP.close = (blosc2_close_cb) blosc2_stdio_mmap_close;
 5970|  9.34k|  BLOSC2_IO_CB_MMAP.read = (blosc2_read_cb) blosc2_stdio_mmap_read;
 5971|  9.34k|  BLOSC2_IO_CB_MMAP.size = (blosc2_size_cb) blosc2_stdio_mmap_size;
 5972|  9.34k|  BLOSC2_IO_CB_MMAP.write = (blosc2_write_cb) blosc2_stdio_mmap_write;
 5973|  9.34k|  BLOSC2_IO_CB_MMAP.truncate = (blosc2_truncate_cb) blosc2_stdio_mmap_truncate;
 5974|  9.34k|  BLOSC2_IO_CB_MMAP.destroy = (blosc2_destroy_cb) blosc2_stdio_mmap_destroy;
 5975|       |
 5976|  9.34k|  _blosc2_register_io_cb(&BLOSC2_IO_CB_MMAP);
 5977|       |
 5978|  9.34k|  g_ncodecs = 0;
 5979|  9.34k|  g_nfilters = 0;
 5980|  9.34k|  g_ntuners = 0;
 5981|       |
 5982|  9.34k|#if defined(HAVE_PLUGINS)
 5983|  9.34k|  #include "blosc2/blosc2-common.h"
 5984|  9.34k|  #include "blosc2/blosc2-stdio.h"
 5985|  9.34k|  register_codecs();
 5986|  9.34k|  register_filters();
 5987|  9.34k|  register_tuners();
 5988|  9.34k|#endif
 5989|  9.34k|  blosc2_pthread_mutex_init(&global_comp_mutex, NULL);
  ------------------
  |  |   90|  9.34k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 5990|  9.34k|  blosc2_pthread_mutex_init(&pool_registry_mutex, NULL);
  ------------------
  |  |   90|  9.34k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 5991|       |  /* Create a global context */
 5992|  9.34k|  g_global_context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 5993|  9.34k|  memset(g_global_context, 0, sizeof(blosc2_context));
 5994|  9.34k|  g_global_context->nthreads = g_nthreads;
 5995|  9.34k|  g_global_context->new_nthreads = g_nthreads;
 5996|  9.34k|  blosc2_pthread_mutex_init(&g_global_context->nchunk_mutex, NULL);
  ------------------
  |  |   90|  9.34k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 5997|  9.34k|  g_initlib = 1;
 5998|  9.34k|}
blosc2_free_resources:
 6001|  9.34k|int blosc2_free_resources(void) {
 6002|       |  /* Return if Blosc is not initialized */
 6003|  9.34k|  if (!g_initlib) return BLOSC2_ERROR_FAILURE;
  ------------------
  |  Branch (6003:7): [True: 0, False: 9.34k]
  ------------------
 6004|       |
 6005|  9.34k|  return release_thread_backend(g_global_context);
 6006|  9.34k|}
blosc2_destroy:
 6009|  9.34k|void blosc2_destroy(void) {
 6010|       |  /* Return if Blosc is not initialized */
 6011|  9.34k|  if (!g_initlib) return;
  ------------------
  |  Branch (6011:7): [True: 0, False: 9.34k]
  ------------------
 6012|       |
 6013|  9.34k|  blosc2_free_resources();
 6014|  9.34k|  g_initlib = 0;
 6015|  9.34k|  blosc2_free_ctx(g_global_context);
 6016|       |
 6017|       |  /* Bump the epoch so any live context can detect its pool is now stale.
 6018|       |   * Do this before freeing the pools so that release_thread_backend callers
 6019|       |   * that race with us will take the "skip" path rather than locking the
 6020|       |   * soon-to-be-destroyed pool_registry_mutex. */
 6021|  9.34k|  g_destroy_count++;
 6022|       |
 6023|       |  /* Tear down any remaining shared pools */
 6024|  9.34k|  struct blosc_shared_pool *pool = shared_pools;
 6025|  9.34k|  while (pool != NULL) {
  ------------------
  |  Branch (6025:10): [True: 0, False: 9.34k]
  ------------------
 6026|      0|    struct blosc_shared_pool *next = pool->next;
 6027|      0|    destroy_shared_pool(pool);
 6028|      0|    pool = next;
 6029|      0|  }
 6030|  9.34k|  shared_pools = NULL;
 6031|  9.34k|  blosc2_pthread_mutex_destroy(&pool_registry_mutex);
  ------------------
  |  |   91|  9.34k|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 6032|       |
 6033|  9.34k|  blosc2_pthread_mutex_destroy(&global_comp_mutex);
  ------------------
  |  |   91|  9.34k|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 6034|  9.34k|}
blosc2_create_cctx:
 6040|  11.1k|blosc2_context* blosc2_create_cctx(blosc2_cparams cparams) {
 6041|  11.1k|  blosc2_context* context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 6042|  11.1k|  BLOSC_ERROR_NULL(context, NULL);
  ------------------
  |  |  104|  11.1k|    do {                                            \
  |  |  105|  11.1k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 11.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|  11.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 11.1k]
  |  |  ------------------
  ------------------
 6043|       |
 6044|       |  /* Populate the context, using zeros as default values */
 6045|  11.1k|  memset(context, 0, sizeof(blosc2_context));
 6046|  11.1k|  context->do_compress = 1;   /* meant for compression */
 6047|  11.1k|  context->use_dict = cparams.use_dict;
 6048|  11.1k|  if (cparams.instr_codec) {
  ------------------
  |  Branch (6048:7): [True: 0, False: 11.1k]
  ------------------
 6049|      0|    context->blosc2_flags = BLOSC2_INSTR_CODEC;
 6050|      0|  }
 6051|       |
 6052|  77.7k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (6052:19): [True: 66.6k, False: 11.1k]
  ------------------
 6053|  66.6k|    context->filters[i] = cparams.filters[i];
 6054|  66.6k|    context->filters_meta[i] = cparams.filters_meta[i];
 6055|       |
 6056|  66.6k|    if (context->filters[i] >= BLOSC_LAST_FILTER && context->filters[i] <= BLOSC2_DEFINED_FILTERS_STOP) {
  ------------------
  |  Branch (6056:9): [True: 2.80k, False: 63.8k]
  |  Branch (6056:53): [True: 2, False: 2.80k]
  ------------------
 6057|      2|      BLOSC_TRACE_ERROR("filter (%d) is not yet defined",
  ------------------
  |  |   93|      2|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      2|    do {                                            \
  |  |  |  |   98|      2|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      2|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 2, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      2|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6058|      2|                        context->filters[i]);
 6059|      2|      free(context);
 6060|      2|      return NULL;
 6061|      2|    }
 6062|  66.6k|    if (context->filters[i] > BLOSC_LAST_REGISTERED_FILTER && context->filters[i] <= BLOSC2_GLOBAL_REGISTERED_FILTERS_STOP) {
  ------------------
  |  Branch (6062:9): [True: 2.36k, False: 64.3k]
  |  Branch (6062:63): [True: 2, False: 2.36k]
  ------------------
 6063|      2|      BLOSC_TRACE_ERROR("filter (%d) is not yet defined",
  ------------------
  |  |   93|      2|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      2|    do {                                            \
  |  |  |  |   98|      2|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      2|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 2, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      2|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6064|      2|                        context->filters[i]);
 6065|      2|      free(context);
 6066|      2|      return NULL;
 6067|      2|    }
 6068|  66.6k|  }
 6069|       |
 6070|  11.1k|#if defined(HAVE_ZFP)
 6071|  11.1k|#include "blosc2/codecs-registry.h"
 6072|  11.1k|  if ((context->compcode >= BLOSC_CODEC_ZFP_FIXED_ACCURACY) && (context->compcode <= BLOSC_CODEC_ZFP_FIXED_RATE)) {
  ------------------
  |  Branch (6072:7): [True: 0, False: 11.1k]
  |  Branch (6072:64): [True: 0, False: 0]
  ------------------
 6073|      0|    for (int i = 0; i < BLOSC2_MAX_FILTERS; ++i) {
  ------------------
  |  Branch (6073:21): [True: 0, False: 0]
  ------------------
 6074|      0|      if ((context->filters[i] == BLOSC_SHUFFLE) || (context->filters[i] == BLOSC_BITSHUFFLE)) {
  ------------------
  |  Branch (6074:11): [True: 0, False: 0]
  |  Branch (6074:53): [True: 0, False: 0]
  ------------------
 6075|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6076|      0|        return NULL;
 6077|      0|      }
 6078|      0|    }
 6079|      0|  }
 6080|  11.1k|#endif /* HAVE_ZFP */
 6081|       |
 6082|       |  /* Check for a BLOSC_SHUFFLE environment variable */
 6083|  11.1k|  int doshuffle = -1;
 6084|  11.1k|  char* envvar = getenv("BLOSC_SHUFFLE");
 6085|  11.1k|  if (envvar != NULL) {
  ------------------
  |  Branch (6085:7): [True: 0, False: 11.1k]
  ------------------
 6086|      0|    if (strcmp(envvar, "NOSHUFFLE") == 0) {
  ------------------
  |  Branch (6086:9): [True: 0, False: 0]
  ------------------
 6087|      0|      doshuffle = BLOSC_NOSHUFFLE;
 6088|      0|    }
 6089|      0|    else if (strcmp(envvar, "SHUFFLE") == 0) {
  ------------------
  |  Branch (6089:14): [True: 0, False: 0]
  ------------------
 6090|      0|      doshuffle = BLOSC_SHUFFLE;
 6091|      0|    }
 6092|      0|    else if (strcmp(envvar, "BITSHUFFLE") == 0) {
  ------------------
  |  Branch (6092:14): [True: 0, False: 0]
  ------------------
 6093|      0|      doshuffle = BLOSC_BITSHUFFLE;
 6094|      0|    }
 6095|      0|    else {
 6096|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6097|      0|    }
 6098|      0|  }
 6099|       |  /* Check for a BLOSC_DELTA environment variable */
 6100|  11.1k|  int dodelta = BLOSC_NOFILTER;
 6101|  11.1k|  envvar = getenv("BLOSC_DELTA");
 6102|  11.1k|  if (envvar != NULL) {
  ------------------
  |  Branch (6102:7): [True: 0, False: 11.1k]
  ------------------
 6103|      0|    if (strcmp(envvar, "1") == 0) {
  ------------------
  |  Branch (6103:9): [True: 0, False: 0]
  ------------------
 6104|      0|      dodelta = BLOSC_DELTA;
 6105|      0|    } else if (strcmp(envvar, "0") == 0){
  ------------------
  |  Branch (6105:16): [True: 0, False: 0]
  ------------------
 6106|      0|      dodelta = BLOSC_NOFILTER;
 6107|      0|    }
 6108|      0|    else {
 6109|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6110|      0|    }
 6111|      0|  }
 6112|       |  /* Check for a BLOSC_TYPESIZE environment variable */
 6113|  11.1k|  context->typesize = cparams.typesize;
 6114|  11.1k|  envvar = getenv("BLOSC_TYPESIZE");
 6115|  11.1k|  if (envvar != NULL) {
  ------------------
  |  Branch (6115:7): [True: 0, False: 11.1k]
  ------------------
 6116|      0|    int32_t value;
 6117|      0|    errno = 0; /* To distinguish success/failure after call */
 6118|      0|    value = (int32_t) strtol(envvar, NULL, 10);
 6119|      0|    if ((errno != EINVAL) && (value > 0)) {
  ------------------
  |  Branch (6119:9): [True: 0, False: 0]
  |  Branch (6119:30): [True: 0, False: 0]
  ------------------
 6120|      0|      context->typesize = value;
 6121|      0|    }
 6122|      0|    else {
 6123|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6124|      0|    }
 6125|      0|  }
 6126|  11.1k|  build_filters(doshuffle, dodelta, context->typesize, context->filters);
 6127|       |
 6128|  11.1k|  context->clevel = cparams.clevel;
 6129|       |  /* Check for a BLOSC_CLEVEL environment variable */
 6130|  11.1k|  envvar = getenv("BLOSC_CLEVEL");
 6131|  11.1k|  if (envvar != NULL) {
  ------------------
  |  Branch (6131:7): [True: 0, False: 11.1k]
  ------------------
 6132|      0|    int value;
 6133|      0|    errno = 0; /* To distinguish success/failure after call */
 6134|      0|    value = (int)strtol(envvar, NULL, 10);
 6135|      0|    if ((errno != EINVAL) && (value >= 0)) {
  ------------------
  |  Branch (6135:9): [True: 0, False: 0]
  |  Branch (6135:30): [True: 0, False: 0]
  ------------------
 6136|      0|      context->clevel = value;
 6137|      0|    }
 6138|      0|    else {
 6139|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6140|      0|    }
 6141|      0|  }
 6142|       |
 6143|  11.1k|  context->compcode = cparams.compcode;
 6144|       |  /* Check for a BLOSC_COMPRESSOR environment variable */
 6145|  11.1k|  envvar = getenv("BLOSC_COMPRESSOR");
 6146|  11.1k|  if (envvar != NULL) {
  ------------------
  |  Branch (6146:7): [True: 0, False: 11.1k]
  ------------------
 6147|      0|    int codec = blosc2_compname_to_compcode(envvar);
 6148|      0|    if (codec >= BLOSC_LAST_CODEC) {
  ------------------
  |  Branch (6148:9): [True: 0, False: 0]
  ------------------
 6149|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6150|      0|      return NULL;
 6151|      0|    }
 6152|      0|    context->compcode = codec;
 6153|      0|  }
 6154|  11.1k|  context->compcode_meta = cparams.compcode_meta;
 6155|       |
 6156|  11.1k|  context->blocksize = cparams.blocksize;
 6157|       |  /* Check for a BLOSC_BLOCKSIZE environment variable */
 6158|  11.1k|  envvar = getenv("BLOSC_BLOCKSIZE");
 6159|  11.1k|  if (envvar != NULL) {
  ------------------
  |  Branch (6159:7): [True: 0, False: 11.1k]
  ------------------
 6160|      0|    int32_t blocksize;
 6161|      0|    errno = 0; /* To distinguish success/failure after call */
 6162|      0|    blocksize = (int32_t) strtol(envvar, NULL, 10);
 6163|      0|    if ((errno != EINVAL) && (blocksize > 0)) {
  ------------------
  |  Branch (6163:9): [True: 0, False: 0]
  |  Branch (6163:30): [True: 0, False: 0]
  ------------------
 6164|      0|      context->blocksize = blocksize;
 6165|      0|    }
 6166|      0|    else {
 6167|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6168|      0|    }
 6169|      0|  }
 6170|       |
 6171|  11.1k|  context->nthreads = cparams.nthreads;
 6172|       |  /* Check for a BLOSC_NTHREADS environment variable */
 6173|  11.1k|  envvar = getenv("BLOSC_NTHREADS");
 6174|  11.1k|  if (envvar != NULL) {
  ------------------
  |  Branch (6174:7): [True: 0, False: 11.1k]
  ------------------
 6175|      0|    errno = 0; /* To distinguish success/failure after call */
 6176|      0|    int16_t nthreads = (int16_t) strtol(envvar, NULL, 10);
 6177|      0|    if ((errno != EINVAL) && (nthreads > 0)) {
  ------------------
  |  Branch (6177:9): [True: 0, False: 0]
  |  Branch (6177:30): [True: 0, False: 0]
  ------------------
 6178|      0|      context->nthreads = nthreads;
 6179|      0|    }
 6180|      0|    else {
 6181|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6182|      0|    }
 6183|      0|  }
 6184|  11.1k|  context->new_nthreads = context->nthreads;
 6185|       |
 6186|  11.1k|  context->splitmode = cparams.splitmode;
 6187|       |  /* Check for a BLOSC_SPLITMODE environment variable */
 6188|  11.1k|  envvar = getenv("BLOSC_SPLITMODE");
 6189|  11.1k|  if (envvar != NULL) {
  ------------------
  |  Branch (6189:7): [True: 0, False: 11.1k]
  ------------------
 6190|      0|    int32_t splitmode = -1;
 6191|      0|    if (strcmp(envvar, "ALWAYS") == 0) {
  ------------------
  |  Branch (6191:9): [True: 0, False: 0]
  ------------------
 6192|      0|      splitmode = BLOSC_ALWAYS_SPLIT;
 6193|      0|    }
 6194|      0|    else if (strcmp(envvar, "NEVER") == 0) {
  ------------------
  |  Branch (6194:14): [True: 0, False: 0]
  ------------------
 6195|      0|      splitmode = BLOSC_NEVER_SPLIT;
 6196|      0|    }
 6197|      0|    else if (strcmp(envvar, "AUTO") == 0) {
  ------------------
  |  Branch (6197:14): [True: 0, False: 0]
  ------------------
 6198|      0|      splitmode = BLOSC_AUTO_SPLIT;
 6199|      0|    }
 6200|      0|    else if (strcmp(envvar, "FORWARD_COMPAT") == 0) {
  ------------------
  |  Branch (6200:14): [True: 0, False: 0]
  ------------------
 6201|      0|      splitmode = BLOSC_FORWARD_COMPAT_SPLIT;
 6202|      0|    }
 6203|      0|    else {
 6204|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6205|      0|    }
 6206|      0|    if (splitmode >= 0) {
  ------------------
  |  Branch (6206:9): [True: 0, False: 0]
  ------------------
 6207|      0|      context->splitmode = splitmode;
 6208|      0|    }
 6209|      0|  }
 6210|       |
 6211|  11.1k|  context->threads_started = 0;
 6212|  11.1k|  blosc2_pthread_mutex_init(&context->nchunk_mutex, NULL);
  ------------------
  |  |   90|  11.1k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 6213|  11.1k|  context->schunk = cparams.schunk;
 6214|       |
 6215|  11.1k|  if (cparams.prefilter != NULL) {
  ------------------
  |  Branch (6215:7): [True: 0, False: 11.1k]
  ------------------
 6216|      0|    context->prefilter = cparams.prefilter;
 6217|      0|    context->preparams = (blosc2_prefilter_params*)my_malloc(sizeof(blosc2_prefilter_params));
 6218|      0|    BLOSC_ERROR_NULL(context->preparams, NULL);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
 6219|      0|    memcpy(context->preparams, cparams.preparams, sizeof(blosc2_prefilter_params));
 6220|      0|  }
 6221|       |
 6222|  11.1k|  if (cparams.tuner_id <= 0) {
  ------------------
  |  Branch (6222:7): [True: 11.1k, False: 0]
  ------------------
 6223|  11.1k|    cparams.tuner_id = g_tuner;
 6224|  11.1k|  } else {
 6225|      0|    for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (6225:21): [True: 0, False: 0]
  ------------------
 6226|      0|      if (g_tuners[i].id == cparams.tuner_id) {
  ------------------
  |  Branch (6226:11): [True: 0, False: 0]
  ------------------
 6227|      0|        if (g_tuners[i].init == NULL) {
  ------------------
  |  Branch (6227:13): [True: 0, False: 0]
  ------------------
 6228|      0|          if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (6228:15): [True: 0, False: 0]
  ------------------
 6229|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6230|      0|            return NULL;
 6231|      0|          }
 6232|      0|        }
 6233|      0|        if (g_tuners[i].init(cparams.tuner_params, context, NULL) < 0) {
  ------------------
  |  Branch (6233:13): [True: 0, False: 0]
  ------------------
 6234|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6235|      0|          return NULL;
 6236|      0|        }
 6237|      0|        goto urtunersuccess;
 6238|      0|      }
 6239|      0|    }
 6240|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6241|      0|    return NULL;
 6242|      0|  }
 6243|  11.1k|  urtunersuccess:;
 6244|       |
 6245|  11.1k|  context->tuner_id = cparams.tuner_id;
 6246|       |
 6247|  11.1k|  context->codec_params = cparams.codec_params;
 6248|  11.1k|  memcpy(context->filter_params, cparams.filter_params, BLOSC2_MAX_FILTERS * sizeof(void*));
 6249|       |
 6250|  11.1k|  return context;
 6251|  11.1k|}
blosc2_create_dctx:
 6254|  18.4k|blosc2_context* blosc2_create_dctx(blosc2_dparams dparams) {
 6255|  18.4k|  blosc2_context* context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 6256|  18.4k|  BLOSC_ERROR_NULL(context, NULL);
  ------------------
  |  |  104|  18.4k|    do {                                            \
  |  |  105|  18.4k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 18.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|  18.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 18.4k]
  |  |  ------------------
  ------------------
 6257|       |
 6258|       |  /* Populate the context, using zeros as default values */
 6259|  18.4k|  memset(context, 0, sizeof(blosc2_context));
 6260|  18.4k|  context->do_compress = 0;   /* Meant for decompression */
 6261|       |
 6262|  18.4k|  context->nthreads = dparams.nthreads;
 6263|  18.4k|  char* envvar = getenv("BLOSC_NTHREADS");
 6264|  18.4k|  if (envvar != NULL) {
  ------------------
  |  Branch (6264:7): [True: 0, False: 18.4k]
  ------------------
 6265|      0|    errno = 0; /* To distinguish success/failure after call */
 6266|      0|    long nthreads = strtol(envvar, NULL, 10);
 6267|      0|    if ((errno != EINVAL) && (nthreads > 0)) {
  ------------------
  |  Branch (6267:9): [True: 0, False: 0]
  |  Branch (6267:30): [True: 0, False: 0]
  ------------------
 6268|      0|      context->nthreads = (int16_t) nthreads;
 6269|      0|    }
 6270|      0|  }
 6271|  18.4k|  context->new_nthreads = context->nthreads;
 6272|       |
 6273|  18.4k|  context->threads_started = 0;
 6274|  18.4k|  context->block_maskout = NULL;
 6275|  18.4k|  context->block_maskout_nitems = 0;
 6276|  18.4k|  blosc2_pthread_mutex_init(&context->nchunk_mutex, NULL);
  ------------------
  |  |   90|  18.4k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 6277|  18.4k|  context->schunk = dparams.schunk;
 6278|       |
 6279|  18.4k|  if (dparams.postfilter != NULL) {
  ------------------
  |  Branch (6279:7): [True: 0, False: 18.4k]
  ------------------
 6280|      0|    context->postfilter = dparams.postfilter;
 6281|      0|    context->postparams = (blosc2_postfilter_params*)my_malloc(sizeof(blosc2_postfilter_params));
 6282|      0|    BLOSC_ERROR_NULL(context->postparams, NULL);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
 6283|      0|    memcpy(context->postparams, dparams.postparams, sizeof(blosc2_postfilter_params));
 6284|      0|  }
 6285|       |
 6286|  18.4k|  return context;
 6287|  18.4k|}
blosc2_free_ctx:
 6290|  38.9k|void blosc2_free_ctx(blosc2_context* context) {
 6291|  38.9k|  if (g_initlib ||
  ------------------
  |  Branch (6291:7): [True: 29.5k, False: 9.34k]
  ------------------
 6292|  9.34k|      context->thread_backend == BLOSC_BACKEND_PER_CONTEXT ||
  ------------------
  |  |   35|  48.2k|#define BLOSC_BACKEND_PER_CONTEXT 3   /* per-context threads; used on Windows */
  ------------------
  |  Branch (6292:7): [True: 0, False: 9.34k]
  ------------------
 6293|  29.5k|      context->thread_backend == BLOSC_BACKEND_CALLBACK) {
  ------------------
  |  |   34|  9.34k|#define BLOSC_BACKEND_CALLBACK 2
  ------------------
  |  Branch (6293:7): [True: 0, False: 9.34k]
  ------------------
 6294|  29.5k|    release_thread_backend(context);
 6295|  29.5k|  }
 6296|  38.9k|  if (context->serial_context != NULL) {
  ------------------
  |  Branch (6296:7): [True: 9.29k, False: 29.6k]
  ------------------
 6297|  9.29k|    free_thread_context(context->serial_context);
 6298|  9.29k|  }
 6299|  38.9k|  blosc2_pthread_mutex_destroy(&context->nchunk_mutex);
  ------------------
  |  |   91|  38.9k|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 6300|  38.9k|  release_context_dict_buffer(context);
 6301|  38.9k|  if (context->dict_cdict != NULL) {
  ------------------
  |  Branch (6301:7): [True: 0, False: 38.9k]
  ------------------
 6302|      0|    if (context->compcode == BLOSC_LZ4) {
  ------------------
  |  Branch (6302:9): [True: 0, False: 0]
  ------------------
 6303|      0|      LZ4_freeStream((LZ4_stream_t*)context->dict_cdict);
 6304|      0|    } else if (context->compcode == BLOSC_LZ4HC) {
  ------------------
  |  Branch (6304:16): [True: 0, False: 0]
  ------------------
 6305|      0|      LZ4_freeStreamHC((LZ4_streamHC_t*)context->dict_cdict);
 6306|      0|    }
 6307|      0|#ifdef HAVE_ZSTD
 6308|      0|    else if (context->compcode == BLOSC_ZSTD) {
  ------------------
  |  Branch (6308:14): [True: 0, False: 0]
  ------------------
 6309|      0|      ZSTD_freeCDict(context->dict_cdict);
 6310|      0|    }
 6311|      0|#endif
 6312|      0|  }
 6313|  38.9k|  if (context->dict_ddict != NULL) {
  ------------------
  |  Branch (6313:7): [True: 2.32k, False: 36.5k]
  ------------------
 6314|  2.32k|#ifdef HAVE_ZSTD
 6315|  2.32k|    ZSTD_freeDDict(context->dict_ddict);
 6316|  2.32k|#endif
 6317|  2.32k|  }
 6318|  38.9k|  if (context->tuner_params != NULL) {
  ------------------
  |  Branch (6318:7): [True: 0, False: 38.9k]
  ------------------
 6319|      0|    int rc;
 6320|      0|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|      0|#define BLOSC_STUNE 0
  ------------------
  |  Branch (6320:9): [True: 0, False: 0]
  |  Branch (6320:49): [True: 0, False: 0]
  ------------------
 6321|      0|      rc = blosc_stune_free(context);
 6322|      0|    } else {
 6323|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (6323:23): [True: 0, False: 0]
  ------------------
 6324|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (6324:13): [True: 0, False: 0]
  ------------------
 6325|      0|          if (g_tuners[i].free == NULL) {
  ------------------
  |  Branch (6325:15): [True: 0, False: 0]
  ------------------
 6326|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (6326:17): [True: 0, False: 0]
  ------------------
 6327|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6328|      0|              return;
 6329|      0|            }
 6330|      0|          }
 6331|      0|          rc = g_tuners[i].free(context);
 6332|      0|          goto urtunersuccess;
 6333|      0|        }
 6334|      0|      }
 6335|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6336|      0|      return;
 6337|      0|      urtunersuccess:;
 6338|      0|    }
 6339|      0|    if (rc < 0) {
  ------------------
  |  Branch (6339:9): [True: 0, False: 0]
  ------------------
 6340|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6341|      0|      return;
 6342|      0|    }
 6343|      0|  }
 6344|       |  /* May be needed if codec_params ever contains nested objects
 6345|       |  if (context->codec_params != NULL) {
 6346|       |    int rc;
 6347|       |    for (int i = 0; i < g_ncodecs; ++i) {
 6348|       |      if (g_codecs[i].compcode == context->compcode) {
 6349|       |        if (g_codecs[i].free == NULL) {
 6350|       |          // Dynamically load codec plugin
 6351|       |          if (fill_codec(&g_codecs[i]) < 0) {
 6352|       |            BLOSC_TRACE_ERROR("Could not load codec %d.", g_codecs[i].compcode);
 6353|       |            return BLOSC2_ERROR_CODEC_SUPPORT;
 6354|       |          }
 6355|       |        }
 6356|       |        if (g_codecs[i].free == NULL){
 6357|       |          // no free func, codec_params is simple
 6358|       |          my_free(context->codec_params);
 6359|       |        }
 6360|       |        else{ // has free function for codec_params (e.g. openzl)
 6361|       |        rc = g_codecs[i].free(context->codec_params);
 6362|       |          goto urcodecsuccess;
 6363|       |        }
 6364|       |      }
 6365|       |    }
 6366|       |      BLOSC_TRACE_ERROR("User-defined compressor codec %d not found", context->compcode);
 6367|       |      return BLOSC2_ERROR_CODEC_SUPPORT;
 6368|       |    urcodecsuccess:;
 6369|       |    if (rc < 0) {
 6370|       |      BLOSC_TRACE_ERROR("Error in user-defined codec free function\n");
 6371|       |      return;
 6372|       |    }
 6373|       |  }
 6374|       |  */
 6375|  38.9k|  if (context->prefilter != NULL) {
  ------------------
  |  Branch (6375:7): [True: 0, False: 38.9k]
  ------------------
 6376|      0|    my_free(context->preparams);
 6377|      0|  }
 6378|  38.9k|  if (context->postfilter != NULL) {
  ------------------
  |  Branch (6378:7): [True: 0, False: 38.9k]
  ------------------
 6379|      0|    my_free(context->postparams);
 6380|      0|  }
 6381|       |
 6382|  38.9k|  if (context->block_maskout != NULL) {
  ------------------
  |  Branch (6382:7): [True: 0, False: 38.9k]
  ------------------
 6383|      0|    free(context->block_maskout);
 6384|      0|  }
 6385|  38.9k|  if (context->blocknbytes != NULL) {
  ------------------
  |  Branch (6385:7): [True: 38, False: 38.8k]
  ------------------
 6386|     38|    free(context->blocknbytes);
 6387|     38|  }
 6388|  38.9k|  if (context->blockoffsets != NULL) {
  ------------------
  |  Branch (6388:7): [True: 38, False: 38.8k]
  ------------------
 6389|     38|    free(context->blockoffsets);
 6390|     38|  }
 6391|  38.9k|  if (context->blockcbytes != NULL) {
  ------------------
  |  Branch (6391:7): [True: 38, False: 38.8k]
  ------------------
 6392|     38|    free(context->blockcbytes);
 6393|     38|  }
 6394|  38.9k|  my_free(context);
 6395|  38.9k|}
blosc2_ctx_get_dparams:
 6422|  20.2k|int blosc2_ctx_get_dparams(blosc2_context *ctx, blosc2_dparams *dparams) {
 6423|  20.2k|  dparams->nthreads = ctx->nthreads;
 6424|  20.2k|  dparams->schunk = ctx->schunk;
 6425|  20.2k|  dparams->postfilter = ctx->postfilter;
 6426|  20.2k|  dparams->postparams = ctx->postparams;
 6427|  20.2k|  dparams->typesize = ctx->typesize;
 6428|       |
 6429|  20.2k|  return BLOSC2_ERROR_SUCCESS;
 6430|  20.2k|}
blosc2_chunk_zeros:
 6452|  1.21k|int blosc2_chunk_zeros(blosc2_cparams cparams, const int32_t nbytes, void* dest, int32_t destsize) {
 6453|  1.21k|  if (destsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (6453:7): [True: 0, False: 1.21k]
  ------------------
 6454|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6455|      0|    return BLOSC2_ERROR_DATA;
 6456|      0|  }
 6457|       |
 6458|  1.21k|  if ((nbytes > 0) && (nbytes % cparams.typesize)) {
  ------------------
  |  Branch (6458:7): [True: 255, False: 958]
  |  Branch (6458:23): [True: 3, False: 252]
  ------------------
 6459|      3|    BLOSC_TRACE_ERROR("nbytes must be a multiple of typesize");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6460|      3|    return BLOSC2_ERROR_DATA;
 6461|      3|  }
 6462|       |
 6463|  1.21k|  blosc_header header;
 6464|  1.21k|  blosc2_context* context = blosc2_create_cctx(cparams);
 6465|  1.21k|  if (context == NULL) {
  ------------------
  |  Branch (6465:7): [True: 0, False: 1.21k]
  ------------------
 6466|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6467|      0|    return BLOSC2_ERROR_NULL_POINTER;
 6468|      0|  }
 6469|       |
 6470|  1.21k|  int error = initialize_context_compression(
 6471|  1.21k|          context, NULL, nbytes, dest, destsize,
 6472|  1.21k|          context->clevel, context->filters, context->filters_meta,
 6473|  1.21k|          context->typesize, context->compcode, context->blocksize,
 6474|  1.21k|          context->new_nthreads, context->nthreads, context->splitmode,
 6475|  1.21k|          context->tuner_id, context->tuner_params, context->schunk);
 6476|  1.21k|  if (error <= 0) {
  ------------------
  |  Branch (6476:7): [True: 0, False: 1.21k]
  ------------------
 6477|      0|    blosc2_free_ctx(context);
 6478|      0|    return error;
 6479|      0|  }
 6480|       |
 6481|  1.21k|  memset(&header, 0, sizeof(header));
 6482|  1.21k|  header.version = BLOSC2_VERSION_FORMAT_STABLE;
 6483|  1.21k|  header.versionlz = BLOSC_BLOSCLZ_VERSION_FORMAT;
 6484|  1.21k|  header.flags = BLOSC_DOSHUFFLE | BLOSC_DOBITSHUFFLE;  // extended header
 6485|  1.21k|  header.typesize = context->typesize;
 6486|  1.21k|  header.nbytes = (int32_t)nbytes;
 6487|  1.21k|  header.blocksize = context->blocksize;
 6488|  1.21k|  header.cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 6489|  1.21k|  header.blosc2_flags = BLOSC2_SPECIAL_ZERO << 4;  // mark chunk as all zeros
 6490|  1.21k|  memcpy((uint8_t *)dest, &header, sizeof(header));
 6491|       |
 6492|  1.21k|  blosc2_free_ctx(context);
 6493|       |
 6494|  1.21k|  return BLOSC_EXTENDED_HEADER_LENGTH;
 6495|  1.21k|}
blosc2_chunk_uninit:
 6499|    535|int blosc2_chunk_uninit(blosc2_cparams cparams, const int32_t nbytes, void* dest, int32_t destsize) {
 6500|    535|  if (destsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (6500:7): [True: 0, False: 535]
  ------------------
 6501|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6502|      0|    return BLOSC2_ERROR_DATA;
 6503|      0|  }
 6504|       |
 6505|    535|  if (nbytes % cparams.typesize) {
  ------------------
  |  Branch (6505:7): [True: 2, False: 533]
  ------------------
 6506|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6507|      2|    return BLOSC2_ERROR_DATA;
 6508|      2|  }
 6509|       |
 6510|    533|  blosc_header header;
 6511|    533|  blosc2_context* context = blosc2_create_cctx(cparams);
 6512|    533|  if (context == NULL) {
  ------------------
  |  Branch (6512:7): [True: 0, False: 533]
  ------------------
 6513|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6514|      0|    return BLOSC2_ERROR_NULL_POINTER;
 6515|      0|  }
 6516|    533|  int error = initialize_context_compression(
 6517|    533|          context, NULL, nbytes, dest, destsize,
 6518|    533|          context->clevel, context->filters, context->filters_meta,
 6519|    533|          context->typesize, context->compcode, context->blocksize,
 6520|    533|          context->new_nthreads, context->nthreads, context->splitmode,
 6521|    533|          context->tuner_id, context->tuner_params, context->schunk);
 6522|    533|  if (error <= 0) {
  ------------------
  |  Branch (6522:7): [True: 0, False: 533]
  ------------------
 6523|      0|    blosc2_free_ctx(context);
 6524|      0|    return error;
 6525|      0|  }
 6526|       |
 6527|    533|  memset(&header, 0, sizeof(header));
 6528|    533|  header.version = BLOSC2_VERSION_FORMAT_STABLE;
 6529|    533|  header.versionlz = BLOSC_BLOSCLZ_VERSION_FORMAT;
 6530|    533|  header.flags = BLOSC_DOSHUFFLE | BLOSC_DOBITSHUFFLE;  // extended header
 6531|    533|  header.typesize = context->typesize;
 6532|    533|  header.nbytes = (int32_t)nbytes;
 6533|    533|  header.blocksize = context->blocksize;
 6534|    533|  header.cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 6535|    533|  header.blosc2_flags = BLOSC2_SPECIAL_UNINIT << 4;  // mark chunk as uninitialized
 6536|    533|  memcpy((uint8_t *)dest, &header, sizeof(header));
 6537|       |
 6538|    533|  blosc2_free_ctx(context);
 6539|       |
 6540|    533|  return BLOSC_EXTENDED_HEADER_LENGTH;
 6541|    533|}
blosc2_chunk_nans:
 6545|    125|int blosc2_chunk_nans(blosc2_cparams cparams, const int32_t nbytes, void* dest, int32_t destsize) {
 6546|    125|  if (destsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (6546:7): [True: 0, False: 125]
  ------------------
 6547|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6548|      0|    return BLOSC2_ERROR_DATA;
 6549|      0|  }
 6550|       |
 6551|    125|  if (nbytes % cparams.typesize) {
  ------------------
  |  Branch (6551:7): [True: 2, False: 123]
  ------------------
 6552|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6553|      2|    return BLOSC2_ERROR_DATA;
 6554|      2|  }
 6555|       |
 6556|    123|  blosc_header header;
 6557|    123|  blosc2_context* context = blosc2_create_cctx(cparams);
 6558|    123|  if (context == NULL) {
  ------------------
  |  Branch (6558:7): [True: 0, False: 123]
  ------------------
 6559|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6560|      0|    return BLOSC2_ERROR_NULL_POINTER;
 6561|      0|  }
 6562|       |
 6563|    123|  int error = initialize_context_compression(
 6564|    123|          context, NULL, nbytes, dest, destsize,
 6565|    123|          context->clevel, context->filters, context->filters_meta,
 6566|    123|          context->typesize, context->compcode, context->blocksize,
 6567|    123|          context->new_nthreads, context->nthreads, context->splitmode,
 6568|    123|          context->tuner_id, context->tuner_params, context->schunk);
 6569|    123|  if (error <= 0) {
  ------------------
  |  Branch (6569:7): [True: 0, False: 123]
  ------------------
 6570|      0|    blosc2_free_ctx(context);
 6571|      0|    return error;
 6572|      0|  }
 6573|       |
 6574|    123|  memset(&header, 0, sizeof(header));
 6575|    123|  header.version = BLOSC2_VERSION_FORMAT_STABLE;
 6576|    123|  header.versionlz = BLOSC_BLOSCLZ_VERSION_FORMAT;
 6577|    123|  header.flags = BLOSC_DOSHUFFLE | BLOSC_DOBITSHUFFLE;  // extended header
 6578|    123|  header.typesize = context->typesize;
 6579|    123|  header.nbytes = (int32_t)nbytes;
 6580|    123|  header.blocksize = context->blocksize;
 6581|    123|  header.cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 6582|    123|  header.blosc2_flags = BLOSC2_SPECIAL_NAN << 4;  // mark chunk as all NaNs
 6583|    123|  memcpy((uint8_t *)dest, &header, sizeof(header));
 6584|       |
 6585|    123|  blosc2_free_ctx(context);
 6586|       |
 6587|    123|  return BLOSC_EXTENDED_HEADER_LENGTH;
 6588|    123|}
register_filter_private:
 6642|  46.7k|int register_filter_private(blosc2_filter *filter) {
 6643|  46.7k|    BLOSC_ERROR_NULL(filter, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  104|  46.7k|    do {                                            \
  |  |  105|  46.7k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 46.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|  46.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 46.7k]
  |  |  ------------------
  ------------------
 6644|  46.7k|    if (g_nfilters == UINT8_MAX) {
  ------------------
  |  Branch (6644:9): [True: 0, False: 46.7k]
  ------------------
 6645|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6646|      0|        return BLOSC2_ERROR_CODEC_SUPPORT;
 6647|      0|    }
 6648|  46.7k|    if (filter->id < BLOSC2_GLOBAL_REGISTERED_FILTERS_START) {
  ------------------
  |  Branch (6648:9): [True: 0, False: 46.7k]
  ------------------
 6649|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6650|      0|        return BLOSC2_ERROR_FAILURE;
 6651|      0|    }
 6652|       |    /* This condition can never be fulfilled
 6653|       |    if (filter->id > BLOSC2_USER_REGISTERED_FILTERS_STOP) {
 6654|       |        BLOSC_TRACE_ERROR("The id must be less than or equal to %d", BLOSC2_USER_REGISTERED_FILTERS_STOP);
 6655|       |        return BLOSC2_ERROR_FAILURE;
 6656|       |    }
 6657|       |    */
 6658|       |
 6659|   140k|    for (uint64_t i = 0; i < g_nfilters; ++i) {
  ------------------
  |  Branch (6659:26): [True: 93.4k, False: 46.7k]
  ------------------
 6660|  93.4k|      if (g_filters[i].id == filter->id) {
  ------------------
  |  Branch (6660:11): [True: 0, False: 93.4k]
  ------------------
 6661|      0|        if (strcmp(g_filters[i].name, filter->name) != 0) {
  ------------------
  |  Branch (6661:13): [True: 0, False: 0]
  ------------------
 6662|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6663|      0|                            "  Choose another one !", filter->id, g_filters[i].name);
 6664|      0|          return BLOSC2_ERROR_FAILURE;
 6665|      0|        }
 6666|      0|        else {
 6667|       |          // Already registered, so no more actions needed
 6668|      0|          return BLOSC2_ERROR_SUCCESS;
 6669|      0|        }
 6670|      0|      }
 6671|  93.4k|    }
 6672|       |
 6673|  46.7k|    blosc2_filter *filter_new = &g_filters[g_nfilters++];
 6674|  46.7k|    memcpy(filter_new, filter, sizeof(blosc2_filter));
 6675|       |
 6676|  46.7k|    return BLOSC2_ERROR_SUCCESS;
 6677|  46.7k|}
register_codec_private:
 6692|  84.0k|int register_codec_private(blosc2_codec *codec) {
 6693|  84.0k|    BLOSC_ERROR_NULL(codec, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  104|  84.0k|    do {                                            \
  |  |  105|  84.0k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 84.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|  84.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 84.0k]
  |  |  ------------------
  ------------------
 6694|  84.0k|    if (g_ncodecs == UINT8_MAX) {
  ------------------
  |  Branch (6694:9): [True: 0, False: 84.0k]
  ------------------
 6695|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6696|      0|      return BLOSC2_ERROR_CODEC_SUPPORT;
 6697|      0|    }
 6698|  84.0k|    if (codec->compcode < BLOSC2_GLOBAL_REGISTERED_CODECS_START) {
  ------------------
  |  Branch (6698:9): [True: 0, False: 84.0k]
  ------------------
 6699|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6700|      0|      return BLOSC2_ERROR_FAILURE;
 6701|      0|    }
 6702|       |    /* This condition can never be fulfilled
 6703|       |    if (codec->compcode > BLOSC2_USER_REGISTERED_CODECS_STOP) {
 6704|       |      BLOSC_TRACE_ERROR("The id must be less or equal to %d", BLOSC2_USER_REGISTERED_CODECS_STOP);
 6705|       |      return BLOSC2_ERROR_FAILURE;
 6706|       |    }
 6707|       |     */
 6708|       |
 6709|   420k|    for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (6709:21): [True: 336k, False: 84.0k]
  ------------------
 6710|   336k|      if (g_codecs[i].compcode == codec->compcode) {
  ------------------
  |  Branch (6710:11): [True: 0, False: 336k]
  ------------------
 6711|      0|        if (strcmp(g_codecs[i].compname, codec->compname) != 0) {
  ------------------
  |  Branch (6711:13): [True: 0, False: 0]
  ------------------
 6712|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6713|      0|                            "  Choose another one !", codec->compcode, codec->compname);
 6714|      0|          return BLOSC2_ERROR_CODEC_PARAM;
 6715|      0|        }
 6716|      0|        else {
 6717|       |          // Already registered, so no more actions needed
 6718|      0|          return BLOSC2_ERROR_SUCCESS;
 6719|      0|        }
 6720|      0|      }
 6721|   336k|    }
 6722|       |
 6723|  84.0k|    blosc2_codec *codec_new = &g_codecs[g_ncodecs++];
 6724|  84.0k|    memcpy(codec_new, codec, sizeof(blosc2_codec));
 6725|       |
 6726|  84.0k|    return BLOSC2_ERROR_SUCCESS;
 6727|  84.0k|}
register_tuner_private:
 6742|  9.34k|int register_tuner_private(blosc2_tuner *tuner) {
 6743|  9.34k|  BLOSC_ERROR_NULL(tuner, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  104|  9.34k|    do {                                            \
  |  |  105|  9.34k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 9.34k]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|  9.34k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 9.34k]
  |  |  ------------------
  ------------------
 6744|  9.34k|  if (g_ntuners == UINT8_MAX) {
  ------------------
  |  Branch (6744:7): [True: 0, False: 9.34k]
  ------------------
 6745|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6746|      0|    return BLOSC2_ERROR_CODEC_SUPPORT;
 6747|      0|  }
 6748|  9.34k|  if (tuner->id < BLOSC2_GLOBAL_REGISTERED_TUNER_START) {
  ------------------
  |  Branch (6748:7): [True: 0, False: 9.34k]
  ------------------
 6749|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6750|      0|    return BLOSC2_ERROR_FAILURE;
 6751|      0|  }
 6752|       |
 6753|  9.34k|  for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (6753:19): [True: 0, False: 9.34k]
  ------------------
 6754|      0|    if (g_tuners[i].id == tuner->id) {
  ------------------
  |  Branch (6754:9): [True: 0, False: 0]
  ------------------
 6755|      0|      if (strcmp(g_tuners[i].name, tuner->name) != 0) {
  ------------------
  |  Branch (6755:11): [True: 0, False: 0]
  ------------------
 6756|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6757|      0|                          "  Choose another one !", tuner->id, g_tuners[i].name);
 6758|      0|        return BLOSC2_ERROR_FAILURE;
 6759|      0|      }
 6760|      0|      else {
 6761|       |        // Already registered, so no more actions needed
 6762|      0|        return BLOSC2_ERROR_SUCCESS;
 6763|      0|      }
 6764|      0|    }
 6765|      0|  }
 6766|       |
 6767|  9.34k|  blosc2_tuner *tuner_new = &g_tuners[g_ntuners++];
 6768|  9.34k|  memcpy(tuner_new, tuner, sizeof(blosc2_tuner));
 6769|       |
 6770|  9.34k|  return BLOSC2_ERROR_SUCCESS;
 6771|  9.34k|}
_blosc2_register_io_cb:
 6784|  18.6k|int _blosc2_register_io_cb(const blosc2_io_cb *io) {
 6785|       |
 6786|  28.0k|  for (uint64_t i = 0; i < g_nio; ++i) {
  ------------------
  |  Branch (6786:24): [True: 28.0k, False: 2]
  ------------------
 6787|  28.0k|    if (g_ios[i].id == io->id) {
  ------------------
  |  Branch (6787:9): [True: 18.6k, False: 9.34k]
  ------------------
 6788|  18.6k|      if (strcmp(g_ios[i].name, io->name) != 0) {
  ------------------
  |  Branch (6788:11): [True: 0, False: 18.6k]
  ------------------
 6789|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6790|      0|                          "  Choose another one !", io->id, g_ios[i].name);
 6791|      0|        return BLOSC2_ERROR_PLUGIN_IO;
 6792|      0|      }
 6793|  18.6k|      else {
 6794|       |        // Already registered, so no more actions needed
 6795|  18.6k|        return BLOSC2_ERROR_SUCCESS;
 6796|  18.6k|      }
 6797|  18.6k|    }
 6798|  28.0k|  }
 6799|       |
 6800|      2|  blosc2_io_cb *io_new = &g_ios[g_nio++];
 6801|      2|  memcpy(io_new, io, sizeof(blosc2_io_cb));
 6802|       |
 6803|      2|  return BLOSC2_ERROR_SUCCESS;
 6804|  18.6k|}
blosc2_get_io_cb:
 6821|  38.2k|blosc2_io_cb *blosc2_get_io_cb(uint8_t id) {
 6822|       |  // If g_initlib is not set by blosc2_init() this function will try to read
 6823|       |  // uninitialized memory. We should therefore always return NULL in that case
 6824|  38.2k|  if (!g_initlib) {
  ------------------
  |  Branch (6824:7): [True: 0, False: 38.2k]
  ------------------
 6825|      0|    return NULL;
 6826|      0|  }
 6827|  38.2k|  for (uint64_t i = 0; i < g_nio; ++i) {
  ------------------
  |  Branch (6827:24): [True: 38.2k, False: 0]
  ------------------
 6828|  38.2k|    if (g_ios[i].id == id) {
  ------------------
  |  Branch (6828:9): [True: 38.2k, False: 0]
  ------------------
 6829|  38.2k|      return &g_ios[i];
 6830|  38.2k|    }
 6831|  38.2k|  }
 6832|      0|  if (id == BLOSC2_IO_FILESYSTEM) {
  ------------------
  |  Branch (6832:7): [True: 0, False: 0]
  ------------------
 6833|      0|    if (_blosc2_register_io_cb(&BLOSC2_IO_CB_DEFAULTS) < 0) {
  ------------------
  |  Branch (6833:9): [True: 0, False: 0]
  ------------------
 6834|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6835|      0|      return NULL;
 6836|      0|    }
 6837|      0|    return blosc2_get_io_cb(id);
 6838|      0|  }
 6839|      0|  else if (id == BLOSC2_IO_FILESYSTEM_MMAP) {
  ------------------
  |  Branch (6839:12): [True: 0, False: 0]
  ------------------
 6840|      0|    if (_blosc2_register_io_cb(&BLOSC2_IO_CB_MMAP) < 0) {
  ------------------
  |  Branch (6840:9): [True: 0, False: 0]
  ------------------
 6841|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6842|      0|      return NULL;
 6843|      0|    }
 6844|      0|    return blosc2_get_io_cb(id);
 6845|      0|  }
 6846|      0|  return NULL;
 6847|      0|}
blosc2.c:flags_to_filters:
  687|   246k|static void flags_to_filters(const uint8_t flags, uint8_t* filters) {
  688|       |  /* Initialize the filter pipeline */
  689|   246k|  memset(filters, 0, BLOSC2_MAX_FILTERS);
  690|       |  /* Fill the filter pipeline */
  691|   246k|  if (flags & BLOSC_DOSHUFFLE)
  ------------------
  |  Branch (691:7): [True: 245k, False: 1.46k]
  ------------------
  692|   245k|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_SHUFFLE;
  693|   246k|  if (flags & BLOSC_DOBITSHUFFLE)
  ------------------
  |  Branch (693:7): [True: 244k, False: 2.49k]
  ------------------
  694|   244k|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_BITSHUFFLE;
  695|   246k|  if (flags & BLOSC_DODELTA)
  ------------------
  |  Branch (695:7): [True: 58.9k, False: 187k]
  ------------------
  696|  58.9k|    filters[BLOSC2_MAX_FILTERS - 2] = BLOSC_DELTA;
  697|   246k|}
blosc2.c:destroy_thread_context:
 2276|  19.7k|static void destroy_thread_context(struct thread_context* thread_context) {
 2277|  19.7k|  my_free(thread_context->tmp);
 2278|  19.7k|#if defined(HAVE_ZSTD)
 2279|  19.7k|  if (thread_context->zstd_cctx != NULL) {
  ------------------
  |  Branch (2279:7): [True: 0, False: 19.7k]
  ------------------
 2280|      0|    ZSTD_freeCCtx(thread_context->zstd_cctx);
 2281|      0|  }
 2282|  19.7k|  if (thread_context->zstd_dctx != NULL) {
  ------------------
  |  Branch (2282:7): [True: 6.47k, False: 13.2k]
  ------------------
 2283|  6.47k|    ZSTD_freeDCtx(thread_context->zstd_dctx);
 2284|  6.47k|  }
 2285|  19.7k|#endif
 2286|  19.7k|  if (thread_context->lz4_cstream != NULL) {
  ------------------
  |  Branch (2286:7): [True: 0, False: 19.7k]
  ------------------
 2287|      0|    LZ4_freeStream((LZ4_stream_t*)thread_context->lz4_cstream);
 2288|      0|  }
 2289|  19.7k|  if (thread_context->lz4hc_cstream != NULL) {
  ------------------
  |  Branch (2289:7): [True: 0, False: 19.7k]
  ------------------
 2290|      0|    LZ4_freeStreamHC((LZ4_streamHC_t*)thread_context->lz4hc_cstream);
 2291|      0|  }
 2292|  19.7k|}
blosc2.c:my_free:
  272|  78.4k|static void my_free(void* block) {
  273|       |#if defined(_WIN32)
  274|       |  _aligned_free(block);
  275|       |#else
  276|  78.4k|  free(block);
  277|  78.4k|#endif  /* _WIN32 */
  278|  78.4k|}
blosc2.c:initialize_context_compression:
 2392|  1.86k|        blosc2_schunk* schunk) {
 2393|       |
 2394|       |  /* Set parameters */
 2395|  1.86k|  context->do_compress = 1;
 2396|  1.86k|  context->src = (const uint8_t*)src;
 2397|  1.86k|  context->srcsize = srcsize;
 2398|  1.86k|  context->dest = (uint8_t*)dest;
 2399|  1.86k|  context->output_bytes = 0;
 2400|  1.86k|  context->destsize = destsize;
 2401|  1.86k|  context->sourcesize = srcsize;
 2402|  1.86k|  context->typesize = typesize;
 2403|  1.86k|  context->filter_flags = filters_to_flags(filters);
 2404|  13.0k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (2404:19): [True: 11.1k, False: 1.86k]
  ------------------
 2405|  11.1k|    context->filters[i] = filters[i];
 2406|  11.1k|    context->filters_meta[i] = filters_meta[i];
 2407|  11.1k|  }
 2408|  1.86k|  context->compcode = compressor;
 2409|  1.86k|  context->nthreads = nthreads;
 2410|  1.86k|  context->new_nthreads = new_nthreads;
 2411|  1.86k|  context->clevel = clevel;
 2412|  1.86k|  context->schunk = schunk;
 2413|  1.86k|  context->tuner_params = tuner_params;
 2414|  1.86k|  context->tuner_id = tuner_id;
 2415|  1.86k|  context->splitmode = splitmode;
 2416|  1.86k|  context->header_blocksize = (int32_t)blocksize;
 2417|  1.86k|  context->blosc2_flags2 = 0;
 2418|  1.86k|  if (context->blocknbytes != NULL) {
  ------------------
  |  Branch (2418:7): [True: 0, False: 1.86k]
  ------------------
 2419|      0|    free(context->blocknbytes);
 2420|      0|    context->blocknbytes = NULL;
 2421|      0|  }
 2422|  1.86k|  if (context->blockoffsets != NULL) {
  ------------------
  |  Branch (2422:7): [True: 0, False: 1.86k]
  ------------------
 2423|      0|    free(context->blockoffsets);
 2424|      0|    context->blockoffsets = NULL;
 2425|      0|  }
 2426|  1.86k|  if (context->blockcbytes != NULL) {
  ------------------
  |  Branch (2426:7): [True: 0, False: 1.86k]
  ------------------
 2427|      0|    free(context->blockcbytes);
 2428|      0|    context->blockcbytes = NULL;
 2429|      0|  }
 2430|  1.86k|  context->vlblock_sources = NULL;
 2431|  1.86k|  context->vlblock_dests = NULL;
 2432|       |  /* tuner some compression parameters */
 2433|  1.86k|  context->blocksize = (int32_t)blocksize;
 2434|  1.86k|  int rc = 0;
 2435|  1.86k|  if (context->tuner_params != NULL) {
  ------------------
  |  Branch (2435:7): [True: 0, False: 1.86k]
  ------------------
 2436|      0|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|      0|#define BLOSC_STUNE 0
  ------------------
  |  Branch (2436:9): [True: 0, False: 0]
  |  Branch (2436:49): [True: 0, False: 0]
  ------------------
 2437|      0|      if (blosc_stune_next_cparams(context) < 0) {
  ------------------
  |  Branch (2437:11): [True: 0, False: 0]
  ------------------
 2438|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2439|      0|        return BLOSC2_ERROR_TUNER;
 2440|      0|      }
 2441|      0|    } else {
 2442|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (2442:23): [True: 0, False: 0]
  ------------------
 2443|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (2443:13): [True: 0, False: 0]
  ------------------
 2444|      0|          if (g_tuners[i].next_cparams == NULL) {
  ------------------
  |  Branch (2444:15): [True: 0, False: 0]
  ------------------
 2445|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (2445:17): [True: 0, False: 0]
  ------------------
 2446|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2447|      0|              return BLOSC2_ERROR_FAILURE;
 2448|      0|            }
 2449|      0|          }
 2450|      0|          if (g_tuners[i].next_cparams(context) < 0) {
  ------------------
  |  Branch (2450:15): [True: 0, False: 0]
  ------------------
 2451|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2452|      0|            return BLOSC2_ERROR_TUNER;
 2453|      0|          }
 2454|      0|          if (g_tuners[i].id == BLOSC_BTUNE && context->blocksize == 0) {
  ------------------
  |  Branch (2454:15): [True: 0, False: 0]
  |  Branch (2454:48): [True: 0, False: 0]
  ------------------
 2455|       |            // Call stune for initializing blocksize
 2456|      0|            if (blosc_stune_next_blocksize(context) < 0) {
  ------------------
  |  Branch (2456:17): [True: 0, False: 0]
  ------------------
 2457|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2458|      0|              return BLOSC2_ERROR_TUNER;
 2459|      0|            }
 2460|      0|          }
 2461|      0|          goto urtunersuccess;
 2462|      0|        }
 2463|      0|      }
 2464|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2465|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 2466|      0|    }
 2467|  1.86k|  } else {
 2468|  1.86k|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|  1.86k|#define BLOSC_STUNE 0
  ------------------
  |  Branch (2468:9): [True: 1.86k, False: 0]
  |  Branch (2468:49): [True: 1.86k, False: 0]
  ------------------
 2469|  1.86k|      rc = blosc_stune_next_blocksize(context);
 2470|  1.86k|    } else {
 2471|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (2471:23): [True: 0, False: 0]
  ------------------
 2472|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (2472:13): [True: 0, False: 0]
  ------------------
 2473|      0|          if (g_tuners[i].next_blocksize == NULL) {
  ------------------
  |  Branch (2473:15): [True: 0, False: 0]
  ------------------
 2474|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (2474:17): [True: 0, False: 0]
  ------------------
 2475|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2476|      0|              return BLOSC2_ERROR_FAILURE;
 2477|      0|            }
 2478|      0|          }
 2479|      0|          rc = g_tuners[i].next_blocksize(context);
 2480|      0|          goto urtunersuccess;
 2481|      0|        }
 2482|      0|      }
 2483|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2484|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 2485|      0|    }
 2486|  1.86k|  }
 2487|  1.86k|  urtunersuccess:;
 2488|  1.86k|  if (rc < 0) {
  ------------------
  |  Branch (2488:7): [True: 0, False: 1.86k]
  ------------------
 2489|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2490|      0|    return BLOSC2_ERROR_TUNER;
 2491|      0|  }
 2492|       |
 2493|       |
 2494|       |  /* Check buffer size limits */
 2495|  1.86k|  if (srcsize > BLOSC2_MAX_BUFFERSIZE) {
  ------------------
  |  Branch (2495:7): [True: 0, False: 1.86k]
  ------------------
 2496|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2497|      0|                      BLOSC2_MAX_BUFFERSIZE);
 2498|      0|    return BLOSC2_ERROR_MAX_BUFSIZE_EXCEEDED;
 2499|      0|  }
 2500|       |
 2501|  1.86k|  if (destsize < BLOSC2_MAX_OVERHEAD) {
  ------------------
  |  Branch (2501:7): [True: 0, False: 1.86k]
  ------------------
 2502|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2503|      0|                      BLOSC2_MAX_OVERHEAD);
 2504|      0|    return BLOSC2_ERROR_MAX_BUFSIZE_EXCEEDED;
 2505|      0|  }
 2506|       |
 2507|       |  /* Compression level */
 2508|  1.86k|  if (clevel < 0 || clevel > 9) {
  ------------------
  |  Branch (2508:7): [True: 0, False: 1.86k]
  |  Branch (2508:21): [True: 0, False: 1.86k]
  ------------------
 2509|       |    /* If clevel not in 0..9, print an error */
 2510|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2511|      0|    return BLOSC2_ERROR_CODEC_PARAM;
 2512|      0|  }
 2513|       |
 2514|       |  /* Dictionary support is only available for ZSTD, LZ4, and LZ4HC.
 2515|       |   * Skip the check when src is NULL (special-value chunks): no compression
 2516|       |   * will actually happen, so codec compatibility is irrelevant. */
 2517|  1.86k|  if (src != NULL && context->use_dict && context->compcode != BLOSC_ZSTD &&
  ------------------
  |  Branch (2517:7): [True: 0, False: 1.86k]
  |  Branch (2517:22): [True: 0, False: 0]
  |  Branch (2517:43): [True: 0, False: 0]
  ------------------
 2518|      0|      context->compcode != BLOSC_LZ4 && context->compcode != BLOSC_LZ4HC) {
  ------------------
  |  Branch (2518:7): [True: 0, False: 0]
  |  Branch (2518:41): [True: 0, False: 0]
  ------------------
 2519|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2520|      0|    return BLOSC2_ERROR_CODEC_PARAM;
 2521|      0|  }
 2522|       |
 2523|       |  /* Check typesize limits */
 2524|  1.86k|  if (context->typesize > BLOSC2_MAXTYPESIZE) {
  ------------------
  |  Branch (2524:7): [True: 0, False: 1.86k]
  ------------------
 2525|       |    // If typesize is too large for Blosc2, return an error
 2526|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2527|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2528|      0|  }
 2529|       |  /* Now, cap typesize so that blosc2 split machinery can continue to work */
 2530|  1.86k|  if (context->typesize > BLOSC_MAX_TYPESIZE) {
  ------------------
  |  Branch (2530:7): [True: 1.32k, False: 540]
  ------------------
 2531|       |    /* If typesize is too large, treat buffer as an 1-byte stream. */
 2532|  1.32k|    context->typesize = 1;
 2533|  1.32k|  }
 2534|       |
 2535|  1.86k|  blosc2_calculate_blocks(context);
 2536|       |
 2537|  1.86k|  return 1;
 2538|  1.86k|}
blosc2.c:filters_to_flags:
  664|  30.4k|static uint8_t filters_to_flags(const uint8_t* filters) {
  665|  30.4k|  uint8_t flags = 0;
  666|       |
  667|   213k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (667:19): [True: 182k, False: 30.4k]
  ------------------
  668|   182k|    switch (filters[i]) {
  669|  20.5k|      case BLOSC_SHUFFLE:
  ------------------
  |  Branch (669:7): [True: 20.5k, False: 162k]
  ------------------
  670|  20.5k|        flags |= BLOSC_DOSHUFFLE;
  671|  20.5k|        break;
  672|  10.2k|      case BLOSC_BITSHUFFLE:
  ------------------
  |  Branch (672:7): [True: 10.2k, False: 172k]
  ------------------
  673|  10.2k|        flags |= BLOSC_DOBITSHUFFLE;
  674|  10.2k|        break;
  675|  14.4k|      case BLOSC_DELTA:
  ------------------
  |  Branch (675:7): [True: 14.4k, False: 168k]
  ------------------
  676|  14.4k|        flags |= BLOSC_DODELTA;
  677|  14.4k|        break;
  678|   137k|      default :
  ------------------
  |  Branch (678:7): [True: 137k, False: 45.2k]
  ------------------
  679|   137k|        break;
  680|   182k|    }
  681|   182k|  }
  682|  30.4k|  return flags;
  683|  30.4k|}
blosc2.c:blosc2_calculate_blocks:
  854|  31.0k|static inline void blosc2_calculate_blocks(blosc2_context* context) {
  855|       |  /* Compute number of blocks in buffer */
  856|  31.0k|  context->nblocks = context->sourcesize / context->blocksize;
  857|  31.0k|  context->leftover = context->sourcesize % context->blocksize;
  858|  31.0k|  context->nblocks = (context->leftover > 0) ?
  ------------------
  |  Branch (858:22): [True: 17.3k, False: 13.7k]
  ------------------
  859|  17.3k|                     (context->nblocks + 1) : context->nblocks;
  860|  31.0k|}
blosc2.c:clibcode_to_clibname:
  305|      1|static const char* clibcode_to_clibname(int clibcode) {
  306|      1|  if (clibcode == BLOSC_BLOSCLZ_LIB) return BLOSC_BLOSCLZ_LIBNAME;
  ------------------
  |  |  367|      0|#define BLOSC_BLOSCLZ_LIBNAME   "BloscLZ"
  ------------------
  |  Branch (306:7): [True: 0, False: 1]
  ------------------
  307|      1|  if (clibcode == BLOSC_LZ4_LIB) return BLOSC_LZ4_LIBNAME;
  ------------------
  |  |  368|      0|#define BLOSC_LZ4_LIBNAME       "LZ4"
  ------------------
  |  Branch (307:7): [True: 0, False: 1]
  ------------------
  308|      1|  if (clibcode == BLOSC_ZLIB_LIB) return BLOSC_ZLIB_LIBNAME;
  ------------------
  |  |  369|      0|#define BLOSC_ZLIB_LIBNAME      "Zlib"
  ------------------
  |  Branch (308:7): [True: 0, False: 1]
  ------------------
  309|      1|  if (clibcode == BLOSC_ZSTD_LIB) return BLOSC_ZSTD_LIBNAME;
  ------------------
  |  |  370|      0|#define BLOSC_ZSTD_LIBNAME      "Zstd"
  ------------------
  |  Branch (309:7): [True: 0, False: 1]
  ------------------
  310|     10|  for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (310:19): [True: 9, False: 1]
  ------------------
  311|      9|    if (clibcode == g_codecs[i].complib)
  ------------------
  |  Branch (311:9): [True: 0, False: 9]
  ------------------
  312|      0|      return g_codecs[i].compname;
  313|      9|  }
  314|      1|  return NULL;                  /* should never happen */
  315|      1|}
blosc2.c:blosc_run_decompression_with_context:
 3911|  18.8k|                                                void* dest, int32_t destsize) {
 3912|  18.8k|  blosc_header header;
 3913|  18.8k|  int32_t ntbytes;
 3914|  18.8k|  int rc;
 3915|       |
 3916|  18.8k|  rc = read_chunk_header(src, srcsize, true, &header);
 3917|  18.8k|  if (rc < 0) {
  ------------------
  |  Branch (3917:7): [True: 6, False: 18.8k]
  ------------------
 3918|      6|    return rc;
 3919|      6|  }
 3920|       |
 3921|  18.8k|  if (header.nbytes > destsize) {
  ------------------
  |  Branch (3921:7): [True: 0, False: 18.8k]
  ------------------
 3922|       |    // Not enough space for writing into the destination
 3923|      0|    return BLOSC2_ERROR_WRITE_BUFFER;
 3924|      0|  }
 3925|       |
 3926|  18.8k|  rc = initialize_context_decompression(context, &header, src, srcsize, dest, destsize);
 3927|  18.8k|  if (rc < 0) {
  ------------------
  |  Branch (3927:7): [True: 310, False: 18.5k]
  ------------------
 3928|    310|    return rc;
 3929|    310|  }
 3930|       |
 3931|       |  /* Do the actual decompression */
 3932|  18.5k|  ntbytes = do_job(context);
 3933|  18.5k|  if (ntbytes < 0) {
  ------------------
  |  Branch (3933:7): [True: 8.45k, False: 10.1k]
  ------------------
 3934|  8.45k|    return ntbytes;
 3935|  8.45k|  }
 3936|       |
 3937|  18.5k|  assert(ntbytes <= (int32_t)destsize);
 3938|  10.1k|  return ntbytes;
 3939|  18.5k|}
blosc2.c:initialize_context_decompression:
 2689|  18.8k|                                            int32_t srcsize, void* dest, int32_t destsize) {
 2690|  18.8k|  int32_t bstarts_end;
 2691|  18.8k|  bool vlblocks;
 2692|       |
 2693|  18.8k|  context->do_compress = 0;
 2694|  18.8k|  context->src = (const uint8_t*)src;
 2695|  18.8k|  context->srcsize = srcsize;
 2696|  18.8k|  context->dest = (uint8_t*)dest;
 2697|  18.8k|  context->destsize = destsize;
 2698|  18.8k|  context->output_bytes = 0;
 2699|  18.8k|  context->vlblock_sources = NULL;
 2700|  18.8k|  context->vlblock_dests = NULL;
 2701|  18.8k|  if (context->blocknbytes != NULL) {
  ------------------
  |  Branch (2701:7): [True: 0, False: 18.8k]
  ------------------
 2702|      0|    free(context->blocknbytes);
 2703|      0|    context->blocknbytes = NULL;
 2704|      0|  }
 2705|  18.8k|  if (context->blockoffsets != NULL) {
  ------------------
  |  Branch (2705:7): [True: 0, False: 18.8k]
  ------------------
 2706|      0|    free(context->blockoffsets);
 2707|      0|    context->blockoffsets = NULL;
 2708|      0|  }
 2709|  18.8k|  if (context->blockcbytes != NULL) {
  ------------------
  |  Branch (2709:7): [True: 0, False: 18.8k]
  ------------------
 2710|      0|    free(context->blockcbytes);
 2711|      0|    context->blockcbytes = NULL;
 2712|      0|  }
 2713|       |
 2714|  18.8k|  int rc = blosc2_initialize_context_from_header(context, header);
 2715|  18.8k|  if (rc < 0) {
  ------------------
  |  Branch (2715:7): [True: 0, False: 18.8k]
  ------------------
 2716|      0|    return rc;
 2717|      0|  }
 2718|  18.8k|  clear_context_decompression_dict(context);
 2719|  18.8k|  vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 2720|  18.8k|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (2720:19): [True: 18.4k, False: 467]
  ------------------
 2721|  18.4k|                  (context->blosc2_flags & 0x08u));
  ------------------
  |  Branch (2721:19): [True: 668, False: 17.7k]
  ------------------
 2722|       |
 2723|       |  /* Check that we have enough space to decompress */
 2724|  18.8k|  if (context->sourcesize > (int32_t)context->destsize) {
  ------------------
  |  Branch (2724:7): [True: 0, False: 18.8k]
  ------------------
 2725|      0|    return BLOSC2_ERROR_WRITE_BUFFER;
 2726|      0|  }
 2727|       |
 2728|  18.8k|  if (context->block_maskout != NULL && context->block_maskout_nitems != context->nblocks) {
  ------------------
  |  Branch (2728:7): [True: 0, False: 18.8k]
  |  Branch (2728:41): [True: 0, False: 0]
  ------------------
 2729|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2730|      0|                      " of blocks in chunk (%d).",
 2731|      0|                      context->block_maskout_nitems, context->nblocks);
 2732|      0|    return BLOSC2_ERROR_DATA;
 2733|      0|  }
 2734|       |
 2735|  18.8k|  context->special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
 2736|  18.8k|  if (context->special_type > BLOSC2_SPECIAL_LASTID) {
  ------------------
  |  Branch (2736:7): [True: 0, False: 18.8k]
  ------------------
 2737|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2738|      0|                      context->special_type);
 2739|      0|    return BLOSC2_ERROR_DATA;
 2740|      0|  }
 2741|       |
 2742|  18.8k|  int memcpyed = (context->header_flags & (uint8_t) BLOSC_MEMCPYED);
 2743|  18.8k|  if (memcpyed && (header->cbytes != header->nbytes + context->header_overhead)) {
  ------------------
  |  Branch (2743:7): [True: 421, False: 18.4k]
  |  Branch (2743:19): [True: 27, False: 394]
  ------------------
 2744|     27|    BLOSC_TRACE_ERROR("Wrong header info for this memcpyed chunk");
  ------------------
  |  |   93|     27|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     27|    do {                                            \
  |  |  |  |   98|     27|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     27|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 27, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     27|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2745|     27|    return BLOSC2_ERROR_DATA;
 2746|     27|  }
 2747|       |
 2748|  18.8k|  if ((header->nbytes == 0) && (header->cbytes == context->header_overhead) &&
  ------------------
  |  Branch (2748:7): [True: 1.31k, False: 17.5k]
  |  Branch (2748:32): [True: 1.31k, False: 7]
  ------------------
 2749|  1.31k|      !context->special_type) {
  ------------------
  |  Branch (2749:7): [True: 0, False: 1.31k]
  ------------------
 2750|       |    // A compressed buffer with only a header can only contain a zero-length buffer
 2751|      0|    return 0;
 2752|      0|  }
 2753|       |
 2754|  18.8k|  context->bstarts = (int32_t *) (context->src + context->header_overhead);
 2755|  18.8k|  bstarts_end = context->header_overhead;
 2756|  18.8k|  if (!context->special_type && !memcpyed) {
  ------------------
  |  Branch (2756:7): [True: 15.7k, False: 3.08k]
  |  Branch (2756:33): [True: 15.4k, False: 357]
  ------------------
 2757|  15.4k|    size_t bstarts_end_tmp;
 2758|  15.4k|    size_t bstarts_nbytes;
 2759|  15.4k|    if (context->nblocks < 0 ||
  ------------------
  |  Branch (2759:9): [True: 13, False: 15.3k]
  ------------------
 2760|  15.3k|        !checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &bstarts_nbytes) ||
  ------------------
  |  Branch (2760:9): [True: 0, False: 15.3k]
  ------------------
 2761|  15.3k|        !checked_add_size((size_t)context->header_overhead, bstarts_nbytes, &bstarts_end_tmp) ||
  ------------------
  |  Branch (2761:9): [True: 0, False: 15.3k]
  ------------------
 2762|  15.3k|        bstarts_end_tmp > (size_t)INT32_MAX) {
  ------------------
  |  Branch (2762:9): [True: 0, False: 15.3k]
  ------------------
 2763|     13|      BLOSC_TRACE_ERROR("Invalid bstarts size in chunk header.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2764|     13|      return BLOSC2_ERROR_INVALID_HEADER;
 2765|     13|    }
 2766|       |    /* If chunk is not special or a memcpyed, we do have a bstarts section */
 2767|  15.3k|    bstarts_end = (int32_t)bstarts_end_tmp;
 2768|  15.3k|  }
 2769|       |
 2770|  18.8k|  if (srcsize < bstarts_end) {
  ------------------
  |  Branch (2770:7): [True: 15, False: 18.8k]
  ------------------
 2771|     15|    BLOSC_TRACE_ERROR("`bstarts` exceeds length of source buffer.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2772|     15|    return BLOSC2_ERROR_READ_BUFFER;
 2773|     15|  }
 2774|       |
 2775|  18.8k|  if (vlblocks && is_lazy && !context->special_type && !memcpyed) {
  ------------------
  |  Branch (2775:7): [True: 40, False: 18.7k]
  |  Branch (2775:19): [True: 23, False: 17]
  |  Branch (2775:30): [True: 23, False: 0]
  |  Branch (2775:56): [True: 23, False: 0]
  ------------------
 2776|     23|    size_t block_csizes_nbytes;
 2777|     23|    size_t trailer_meta_nbytes;
 2778|     23|    size_t lazy_trailer_end;
 2779|     23|    if (context->srcsize < 0 || context->nblocks < 0 ||
  ------------------
  |  Branch (2779:9): [True: 0, False: 23]
  |  Branch (2779:33): [True: 0, False: 23]
  ------------------
 2780|     23|        !checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &block_csizes_nbytes) ||
  ------------------
  |  Branch (2780:9): [True: 0, False: 23]
  ------------------
 2781|     23|        !checked_add_size(sizeof(int32_t) + sizeof(int64_t), block_csizes_nbytes, &trailer_meta_nbytes) ||
  ------------------
  |  Branch (2781:9): [True: 0, False: 23]
  ------------------
 2782|     23|        !checked_add_size((size_t)bstarts_end, trailer_meta_nbytes, &lazy_trailer_end) ||
  ------------------
  |  Branch (2782:9): [True: 0, False: 23]
  ------------------
 2783|     23|        (size_t)context->srcsize < lazy_trailer_end) {
  ------------------
  |  Branch (2783:9): [True: 1, False: 22]
  ------------------
 2784|      1|      BLOSC_TRACE_ERROR("Lazy trailer exceeds source buffer.");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2785|      1|      return BLOSC2_ERROR_READ_BUFFER;
 2786|      1|    }
 2787|     23|  }
 2788|  18.8k|  srcsize -= bstarts_end;
 2789|       |
 2790|       |  /* Read optional dictionary if flag set */
 2791|  18.8k|  if ((context->blosc2_flags & BLOSC2_USEDICT) && !is_lazy) {
  ------------------
  |  Branch (2791:7): [True: 3.73k, False: 15.0k]
  |  Branch (2791:51): [True: 3.68k, False: 50]
  ------------------
 2792|  3.68k|    context->use_dict = 1;
 2793|       |    // The dictionary section is after the bstarts block: [int32 size | raw bytes]
 2794|  3.68k|    if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (2794:9): [True: 0, False: 3.68k]
  ------------------
 2795|      0|      BLOSC_TRACE_ERROR("Not enough space to read size of dictionary.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2796|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2797|      0|    }
 2798|  3.68k|    srcsize -= sizeof(int32_t);
 2799|       |    // Read dictionary size
 2800|  3.68k|    context->dict_size = sw32_(context->src + bstarts_end);
 2801|  3.68k|    if (context->dict_size <= 0 || context->dict_size > BLOSC2_MAXDICTSIZE) {
  ------------------
  |  Branch (2801:9): [True: 4, False: 3.68k]
  |  Branch (2801:36): [True: 8, False: 3.67k]
  ------------------
 2802|     12|      BLOSC_TRACE_ERROR("Dictionary size is smaller than minimum or larger than maximum allowed.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2803|     12|      return BLOSC2_ERROR_CODEC_DICT;
 2804|     12|    }
 2805|  3.67k|    if (srcsize < (int32_t)context->dict_size) {
  ------------------
  |  Branch (2805:9): [True: 5, False: 3.67k]
  ------------------
 2806|      5|      BLOSC_TRACE_ERROR("Not enough space to read entire dictionary.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2807|      5|      return BLOSC2_ERROR_READ_BUFFER;
 2808|      5|    }
 2809|  3.67k|    srcsize -= context->dict_size;
 2810|       |    // dict_buffer points directly into the source chunk — no copy needed
 2811|  3.67k|    context->dict_buffer = (void*)(context->src + bstarts_end + sizeof(int32_t));
 2812|  3.67k|    context->dict_buffer_owned = false;
 2813|  3.67k|#if defined(HAVE_ZSTD)
 2814|       |    // context->compcode during decompression holds the format code (flags >> 5),
 2815|       |    // so compare against BLOSC_ZSTD_FORMAT (not BLOSC_ZSTD).
 2816|  3.67k|    if (context->compcode == BLOSC_ZSTD_FORMAT) {
  ------------------
  |  Branch (2816:9): [True: 2.99k, False: 679]
  ------------------
 2817|  2.99k|      context->dict_ddict = ZSTD_createDDict(context->dict_buffer, context->dict_size);
 2818|  2.99k|      if (context->dict_ddict == NULL) {
  ------------------
  |  Branch (2818:11): [True: 152, False: 2.84k]
  ------------------
 2819|    152|        BLOSC_TRACE_ERROR("Cannot create ZSTD dictionary for chunk.");
  ------------------
  |  |   93|    152|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    152|    do {                                            \
  |  |  |  |   98|    152|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    152|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 152, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    152|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2820|    152|        return BLOSC2_ERROR_CODEC_DICT;
 2821|    152|      }
 2822|  2.99k|    }
 2823|  3.67k|#endif   // HAVE_ZSTD
 2824|       |    // For LZ4/LZ4HC: dict_buffer and dict_size are sufficient; no digested object needed.
 2825|  3.67k|  }
 2826|  15.1k|  else if ((context->blosc2_flags & BLOSC2_USEDICT) && is_lazy) {
  ------------------
  |  Branch (2826:12): [True: 50, False: 15.0k]
  |  Branch (2826:56): [True: 50, False: 0]
  ------------------
 2827|     50|    rc = load_lazy_chunk_dict(context, header, bstarts_end);
 2828|     50|    if (rc < 0) {
  ------------------
  |  Branch (2828:9): [True: 50, False: 0]
  ------------------
 2829|     50|      return rc;
 2830|     50|    }
 2831|     50|  }
 2832|       |
 2833|  18.6k|  if (vlblocks && !context->special_type && !memcpyed) {
  ------------------
  |  Branch (2833:7): [True: 38, False: 18.5k]
  |  Branch (2833:19): [True: 38, False: 0]
  |  Branch (2833:45): [True: 38, False: 0]
  ------------------
 2834|     38|    context->blocknbytes = malloc((size_t)context->nblocks * sizeof(int32_t));
 2835|     38|    BLOSC_ERROR_NULL(context->blocknbytes, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|     38|    do {                                            \
  |  |  105|     38|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 38]
  |  |  ------------------
  |  |  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|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 38]
  |  |  ------------------
  ------------------
 2836|     38|    context->blockoffsets = malloc((size_t)context->nblocks * sizeof(int32_t));
 2837|     38|    BLOSC_ERROR_NULL(context->blockoffsets, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|     38|    do {                                            \
  |  |  105|     38|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 38]
  |  |  ------------------
  |  |  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|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 38]
  |  |  ------------------
  ------------------
 2838|     38|    context->blockcbytes = malloc((size_t)context->nblocks * sizeof(int32_t));
 2839|     38|    BLOSC_ERROR_NULL(context->blockcbytes, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|     38|    do {                                            \
  |  |  105|     38|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 38]
  |  |  ------------------
  |  |  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|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 38]
  |  |  ------------------
  ------------------
 2840|       |
 2841|     38|    if (is_lazy) {
  ------------------
  |  Branch (2841:9): [True: 21, False: 17]
  ------------------
 2842|       |      // Lazy VL: block data is on disk, so blocknbytes is unknown at this point.
 2843|       |      // Populate blockcbytes from bstarts differences; blocksize gets max(blockcbytes)
 2844|       |      // as a safe upper bound so tmp buffers are large enough for the lazy block read.
 2845|     21|      int32_t max_csize = 0;
 2846|     29|      for (int32_t i = 0; i < context->nblocks; ++i) {
  ------------------
  |  Branch (2846:27): [True: 26, False: 3]
  ------------------
 2847|     26|        int32_t bstart = sw32_(context->bstarts + i);
 2848|     26|        int32_t next_bstart = (i + 1 < context->nblocks) ?
  ------------------
  |  Branch (2848:31): [True: 23, False: 3]
  ------------------
 2849|     23|            sw32_(context->bstarts + i + 1) : header->cbytes;
 2850|     26|        if (bstart < bstarts_end || next_bstart <= bstart ||
  ------------------
  |  Branch (2850:13): [True: 1, False: 25]
  |  Branch (2850:37): [True: 2, False: 23]
  ------------------
 2851|     23|            next_bstart > header->cbytes) {
  ------------------
  |  Branch (2851:13): [True: 15, False: 8]
  ------------------
 2852|     18|          BLOSC_TRACE_ERROR("Invalid VL-block offsets in lazy chunk.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2853|     18|          return BLOSC2_ERROR_INVALID_HEADER;
 2854|     18|        }
 2855|      8|        context->blocknbytes[i] = 0;   // unknown until block is read from disk
 2856|      8|        context->blockoffsets[i] = 0;  // unknown
 2857|      8|        context->blockcbytes[i] = next_bstart - bstart;
 2858|      8|        if (context->blockcbytes[i] > max_csize) {
  ------------------
  |  Branch (2858:13): [True: 7, False: 1]
  ------------------
 2859|      7|          max_csize = context->blockcbytes[i];
 2860|      7|        }
 2861|      8|      }
 2862|      3|      context->blocksize = max_csize;
 2863|      3|      context->leftover = 0;
 2864|      3|    }
 2865|     17|    else {
 2866|     17|      int32_t max_blocksize = 0;
 2867|     17|      int64_t total_nbytes = 0;
 2868|     17|      int32_t prev_bstart = 0;
 2869|     25|      for (int32_t i = 0; i < context->nblocks; ++i) {
  ------------------
  |  Branch (2869:27): [True: 20, False: 5]
  ------------------
 2870|     20|        int32_t bstart = sw32_(context->bstarts + i);
 2871|     20|        int32_t next_bstart = (i + 1 < context->nblocks) ?
  ------------------
  |  Branch (2871:31): [True: 15, False: 5]
  ------------------
 2872|     15|            sw32_(context->bstarts + i + 1) : header->cbytes;
 2873|     20|        if (bstart < bstarts_end || bstart <= prev_bstart || next_bstart <= bstart ||
  ------------------
  |  Branch (2873:13): [True: 0, False: 20]
  |  Branch (2873:37): [True: 0, False: 20]
  |  Branch (2873:62): [True: 1, False: 19]
  ------------------
 2874|     19|            next_bstart > header->cbytes || bstart > context->srcsize - (int32_t)sizeof(int32_t)) {
  ------------------
  |  Branch (2874:13): [True: 11, False: 8]
  |  Branch (2874:45): [True: 0, False: 8]
  ------------------
 2875|     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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2876|     12|          return BLOSC2_ERROR_INVALID_HEADER;
 2877|     12|        }
 2878|      8|        context->blocknbytes[i] = sw32_(context->src + bstart);
 2879|      8|        context->blockcbytes[i] = next_bstart - bstart;
 2880|      8|        if (context->blocknbytes[i] <= 0) {
  ------------------
  |  Branch (2880:13): [True: 0, False: 8]
  ------------------
 2881|      0|          BLOSC_TRACE_ERROR("Invalid VL-block uncompressed size in chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2882|      0|          return BLOSC2_ERROR_INVALID_HEADER;
 2883|      0|        }
 2884|      8|        if (total_nbytes > INT32_MAX) {
  ------------------
  |  Branch (2884:13): [True: 0, False: 8]
  ------------------
 2885|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2886|      0|          return BLOSC2_ERROR_INVALID_HEADER;
 2887|      0|        }
 2888|      8|        context->blockoffsets[i] = (int32_t)total_nbytes;
 2889|      8|        total_nbytes += context->blocknbytes[i];
 2890|      8|        if (total_nbytes > context->sourcesize) {
  ------------------
  |  Branch (2890:13): [True: 0, False: 8]
  ------------------
 2891|      0|          BLOSC_TRACE_ERROR("VL-block sizes exceed chunk nbytes.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2892|      0|          return BLOSC2_ERROR_INVALID_HEADER;
 2893|      0|        }
 2894|      8|        if (context->blocknbytes[i] > max_blocksize) {
  ------------------
  |  Branch (2894:13): [True: 7, False: 1]
  ------------------
 2895|      7|          max_blocksize = context->blocknbytes[i];
 2896|      7|        }
 2897|      8|        prev_bstart = bstart;
 2898|      8|      }
 2899|      5|      if (total_nbytes != context->sourcesize) {
  ------------------
  |  Branch (2899:11): [True: 5, False: 0]
  ------------------
 2900|      5|        BLOSC_TRACE_ERROR("VL-block sizes do not add up to chunk nbytes.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2901|      5|        return BLOSC2_ERROR_INVALID_HEADER;
 2902|      5|      }
 2903|      0|      context->blocksize = max_blocksize;
 2904|      0|      context->leftover = 0;
 2905|      0|    }
 2906|     38|  }
 2907|       |
 2908|  18.5k|  return 0;
 2909|  18.6k|}
blosc2.c:load_lazy_chunk_dict:
 2635|     50|static int load_lazy_chunk_dict(blosc2_context* context, blosc_header* header, int32_t bstarts_end) {
 2636|     50|  int32_t dict_offset = bstarts_end;
 2637|     50|  if (header->cbytes < dict_offset + (int32_t)sizeof(int32_t)) {
  ------------------
  |  Branch (2637:7): [True: 0, False: 50]
  ------------------
 2638|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2639|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 2640|      0|  }
 2641|       |
 2642|     50|  uint8_t dict_size_buf[sizeof(int32_t)];
 2643|     50|  int rc = read_lazy_chunk_bytes(context, dict_offset, dict_size_buf, (int32_t)sizeof(dict_size_buf),
 2644|     50|                                 "Cannot open frame file for lazy chunk dictionary read.",
 2645|     50|                                 "Cannot read lazy chunk dictionary size from disk.");
 2646|     50|  if (rc < 0) {
  ------------------
  |  Branch (2646:7): [True: 50, False: 0]
  ------------------
 2647|     50|    return rc;
 2648|     50|  }
 2649|       |
 2650|      0|  context->dict_size = sw32_(dict_size_buf);
 2651|      0|  if (context->dict_size <= 0 || context->dict_size > BLOSC2_MAXDICTSIZE) {
  ------------------
  |  Branch (2651:7): [True: 0, False: 0]
  |  Branch (2651:34): [True: 0, False: 0]
  ------------------
 2652|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2653|      0|    return BLOSC2_ERROR_CODEC_DICT;
 2654|      0|  }
 2655|      0|  if (header->cbytes < dict_offset + (int32_t)sizeof(int32_t) + context->dict_size) {
  ------------------
  |  Branch (2655:7): [True: 0, False: 0]
  ------------------
 2656|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2657|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 2658|      0|  }
 2659|       |
 2660|      0|  context->dict_buffer = malloc((size_t)context->dict_size);
 2661|      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]
  |  |  ------------------
  ------------------
 2662|      0|  context->dict_buffer_owned = true;
 2663|      0|  rc = read_lazy_chunk_bytes(context, dict_offset + (int32_t)sizeof(int32_t),
 2664|      0|                             context->dict_buffer, context->dict_size,
 2665|      0|                             "Cannot open frame file for lazy chunk dictionary read.",
 2666|      0|                             "Cannot read lazy chunk dictionary from disk.");
 2667|      0|  if (rc < 0) {
  ------------------
  |  Branch (2667:7): [True: 0, False: 0]
  ------------------
 2668|      0|    release_context_dict_buffer(context);
 2669|      0|    return rc;
 2670|      0|  }
 2671|       |
 2672|      0|  context->use_dict = 1;
 2673|      0|#if defined(HAVE_ZSTD)
 2674|      0|  if (context->compcode == BLOSC_ZSTD_FORMAT) {
  ------------------
  |  Branch (2674:7): [True: 0, False: 0]
  ------------------
 2675|      0|    context->dict_ddict = ZSTD_createDDict(context->dict_buffer, context->dict_size);
 2676|      0|    if (context->dict_ddict == NULL) {
  ------------------
  |  Branch (2676:9): [True: 0, False: 0]
  ------------------
 2677|      0|      release_context_dict_buffer(context);
 2678|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2679|      0|      return BLOSC2_ERROR_CODEC_DICT;
 2680|      0|    }
 2681|      0|  }
 2682|      0|#endif
 2683|       |
 2684|      0|  return 0;
 2685|      0|}
blosc2.c:read_lazy_chunk_bytes:
 2565|     50|                                 const char* open_error, const char* read_error) {
 2566|     50|  if (context->schunk == NULL || context->schunk->frame == NULL) {
  ------------------
  |  Branch (2566:7): [True: 3, False: 47]
  |  Branch (2566:34): [True: 0, False: 47]
  ------------------
 2567|      3|    BLOSC_TRACE_ERROR("Lazy chunk needs an associated super-chunk with a frame.");
  ------------------
  |  |   93|      3|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      3|    do {                                            \
  |  |  |  |   98|      3|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      3|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      3|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2568|      3|    return BLOSC2_ERROR_INVALID_PARAM;
 2569|      3|  }
 2570|       |
 2571|     47|  blosc2_frame_s* frame = (blosc2_frame_s*)context->schunk->frame;
 2572|     47|  blosc2_io_cb* io_cb = blosc2_get_io_cb(context->schunk->storage->io->id);
 2573|     47|  if (io_cb == NULL) {
  ------------------
  |  Branch (2573:7): [True: 0, False: 47]
  ------------------
 2574|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2575|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 2576|      0|  }
 2577|       |
 2578|     47|  int32_t trailer_offset = BLOSC_EXTENDED_HEADER_LENGTH +
 2579|     47|                           context->nblocks * (int32_t)sizeof(int32_t);
 2580|     47|  int32_t nchunk_lazy;
 2581|     47|  int64_t chunk_offset;
 2582|     47|  memcpy(&nchunk_lazy, context->src + trailer_offset, sizeof(nchunk_lazy));
 2583|     47|  memcpy(&chunk_offset, context->src + trailer_offset + (int32_t)sizeof(int32_t), sizeof(chunk_offset));
 2584|       |
 2585|     47|  void* fp = NULL;
 2586|     47|  int64_t io_pos;
 2587|     47|  if (frame->sframe) {
  ------------------
  |  Branch (2587:7): [True: 0, False: 47]
  ------------------
 2588|      0|    fp = sframe_open_chunk(frame->urlpath, nchunk_lazy, "rb", context->schunk->storage->io);
 2589|      0|    io_pos = offset;
 2590|      0|  }
 2591|     47|  else {
 2592|     47|    if (chunk_offset < 0 || offset < 0) {
  ------------------
  |  Branch (2592:9): [True: 32, False: 15]
  |  Branch (2592:29): [True: 0, False: 15]
  ------------------
 2593|     32|      BLOSC_TRACE_ERROR("Lazy chunk offset cannot be negative.");
  ------------------
  |  |   93|     32|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     32|    do {                                            \
  |  |  |  |   98|     32|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     32|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 32, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     32|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2594|     32|      return BLOSC2_ERROR_INVALID_HEADER;
 2595|     32|    }
 2596|     15|    fp = frame_reader_acquire(frame, context->schunk->storage->io);
 2597|     15|    if (frame->file_offset > INT64_MAX - chunk_offset) {
  ------------------
  |  Branch (2597:9): [True: 0, False: 15]
  ------------------
 2598|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2599|      0|      if (fp != NULL) {
  ------------------
  |  Branch (2599:11): [True: 0, False: 0]
  ------------------
 2600|      0|        frame_reader_release(frame, io_cb, fp);
 2601|      0|      }
 2602|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 2603|      0|    }
 2604|     15|    io_pos = frame->file_offset + chunk_offset;
 2605|     15|    if (io_pos > INT64_MAX - offset) {
  ------------------
  |  Branch (2605:9): [True: 0, False: 15]
  ------------------
 2606|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2607|      0|      if (fp != NULL) {
  ------------------
  |  Branch (2607:11): [True: 0, False: 0]
  ------------------
 2608|      0|        frame_reader_release(frame, io_cb, fp);
 2609|      0|      }
 2610|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 2611|      0|    }
 2612|     15|    io_pos += offset;
 2613|     15|  }
 2614|     15|  if (fp == NULL) {
  ------------------
  |  Branch (2614:7): [True: 15, False: 0]
  ------------------
 2615|     15|    BLOSC_TRACE_ERROR("%s", open_error);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2616|     15|    return BLOSC2_ERROR_FILE_OPEN;
 2617|     15|  }
 2618|       |
 2619|      0|  uint8_t* read_buffer = buffer;
 2620|      0|  int64_t rbytes = io_cb->read((void**)&read_buffer, 1, nbytes, io_pos, fp);
 2621|      0|  frame_reader_release(frame, io_cb, fp);
 2622|      0|  if (read_buffer != buffer) {
  ------------------
  |  Branch (2622:7): [True: 0, False: 0]
  ------------------
 2623|      0|    memcpy(buffer, read_buffer, (size_t)nbytes);
 2624|      0|    free(read_buffer);
 2625|      0|  }
 2626|      0|  if (rbytes != nbytes) {
  ------------------
  |  Branch (2626:7): [True: 0, False: 0]
  ------------------
 2627|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2628|      0|    return BLOSC2_ERROR_FILE_READ;
 2629|      0|  }
 2630|       |
 2631|      0|  return 0;
 2632|      0|}
blosc2.c:do_job:
 2349|  18.5k|static int do_job(blosc2_context* context) {
 2350|  18.5k|  int32_t ntbytes;
 2351|       |
 2352|       |  /* Set sentinels */
 2353|  18.5k|  context->dref_not_init = 1;
 2354|       |
 2355|       |  /* Check whether we need to restart threads.  If the thread backend could
 2356|       |     not be set up (e.g. shared-pool creation failed under thread/resource
 2357|       |     exhaustion), rc < 0 and context->thread_pool stays NULL; fall back to the
 2358|       |     serial path below instead of dereferencing a NULL pool in parallel_blosc.
 2359|       |     The failed pool creation already emitted a TRACE_ERROR, and the next
 2360|       |     do_job() re-attempts the attach, so the fallback is self-healing. */
 2361|  18.5k|  int rc = check_nthreads(context);
 2362|       |
 2363|       |  /* Run the serial version when nthreads is 1, when the buffers are not larger
 2364|       |     than blocksize, or when the parallel backend failed to start */
 2365|  18.5k|  if (context->nthreads == 1 || (context->sourcesize / context->blocksize) <= 1 || rc < 0) {
  ------------------
  |  Branch (2365:7): [True: 18.5k, False: 0]
  |  Branch (2365:33): [True: 0, False: 0]
  |  Branch (2365:84): [True: 0, False: 0]
  ------------------
 2366|       |    /* The context for this 'thread' has no been initialized yet */
 2367|  18.5k|    if (context->serial_context == NULL) {
  ------------------
  |  Branch (2367:9): [True: 9.29k, False: 9.26k]
  ------------------
 2368|  9.29k|      context->serial_context = create_thread_context(context, 0);
 2369|  9.29k|    }
 2370|  9.26k|    else if (context->blocksize != context->serial_context->tmp_blocksize) {
  ------------------
  |  Branch (2370:14): [True: 80, False: 9.18k]
  ------------------
 2371|     80|      free_thread_context(context->serial_context);
 2372|     80|      context->serial_context = create_thread_context(context, 0);
 2373|     80|    }
 2374|  18.5k|    BLOSC_ERROR_NULL(context->serial_context, BLOSC2_ERROR_THREAD_CREATE);
  ------------------
  |  |  104|  18.5k|    do {                                            \
  |  |  105|  18.5k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 18.5k]
  |  |  ------------------
  |  |  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|  18.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 18.5k]
  |  |  ------------------
  ------------------
 2375|  18.5k|    ntbytes = serial_blosc(context->serial_context);
 2376|  18.5k|  }
 2377|      0|  else {
 2378|      0|    ntbytes = parallel_blosc(context);
 2379|      0|  }
 2380|       |
 2381|  18.5k|  return ntbytes;
 2382|  18.5k|}
blosc2.c:serial_blosc:
 2161|  18.5k|static int serial_blosc(struct thread_context* thread_context) {
 2162|  18.5k|  blosc2_context* context = thread_context->parent_context;
 2163|  18.5k|  bool vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 2164|  18.5k|  int32_t j, bsize, leftoverblock;
 2165|  18.5k|  int32_t cbytes;
 2166|  18.5k|  int32_t ntbytes = context->output_bytes;
 2167|  18.5k|  int32_t* bstarts = context->bstarts;
 2168|  18.5k|  uint8_t* tmp = thread_context->tmp;
 2169|  18.5k|  uint8_t* tmp2 = thread_context->tmp2;
 2170|  18.5k|  int dict_training = context->use_dict && (context->dict_cdict == NULL);
  ------------------
  |  Branch (2170:23): [True: 3.51k, False: 15.0k]
  |  Branch (2170:44): [True: 3.51k, False: 0]
  ------------------
 2171|  18.5k|  bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;
 2172|  18.5k|  if (!context->do_compress && context->special_type) {
  ------------------
  |  Branch (2172:7): [True: 18.5k, False: 0]
  |  Branch (2172:32): [True: 2.97k, False: 15.5k]
  ------------------
 2173|       |    // Fake a runlen as if it was a memcpyed chunk
 2174|  2.97k|    memcpyed = true;
 2175|  2.97k|  }
 2176|       |
 2177|   204k|  for (j = 0; j < context->nblocks; j++) {
  ------------------
  |  Branch (2177:15): [True: 194k, False: 10.1k]
  ------------------
 2178|   194k|    if (context->do_compress && !memcpyed && !dict_training) {
  ------------------
  |  Branch (2178:9): [True: 0, False: 194k]
  |  Branch (2178:33): [True: 0, False: 0]
  |  Branch (2178:46): [True: 0, False: 0]
  ------------------
 2179|      0|      _sw32(bstarts + j, ntbytes);
 2180|      0|    }
 2181|   194k|    bsize = vlblocks ? context->blocknbytes[j] : context->blocksize;
  ------------------
  |  Branch (2181:13): [True: 3, False: 194k]
  ------------------
 2182|   194k|    leftoverblock = 0;
 2183|   194k|    if (!vlblocks && (j == context->nblocks - 1) && (context->leftover > 0)) {
  ------------------
  |  Branch (2183:9): [True: 194k, False: 3]
  |  Branch (2183:22): [True: 11.1k, False: 183k]
  |  Branch (2183:53): [True: 5.41k, False: 5.75k]
  ------------------
 2184|  5.41k|      bsize = context->leftover;
 2185|  5.41k|      leftoverblock = 1;
 2186|  5.41k|    }
 2187|   194k|    if (context->do_compress) {
  ------------------
  |  Branch (2187:9): [True: 0, False: 194k]
  ------------------
 2188|      0|      if (memcpyed && !context->prefilter) {
  ------------------
  |  Branch (2188:11): [True: 0, False: 0]
  |  Branch (2188:23): [True: 0, False: 0]
  ------------------
 2189|       |        /* We want to memcpy only */
 2190|      0|        memcpy(context->dest + context->header_overhead + j * context->blocksize,
 2191|      0|               context->src + j * context->blocksize, (unsigned int)bsize);
 2192|      0|        cbytes = (int32_t)bsize;
 2193|      0|      }
 2194|      0|      else {
 2195|       |        /* Regular compression */
 2196|      0|        cbytes = blosc_c(thread_context, bsize, leftoverblock, ntbytes,
 2197|      0|                         context->destsize,
 2198|      0|                         vlblocks ? context->vlblock_sources[j] : context->src,
  ------------------
  |  Branch (2198:26): [True: 0, False: 0]
  ------------------
 2199|      0|                         vlblocks ? 0 : j * context->blocksize,
  ------------------
  |  Branch (2199:26): [True: 0, False: 0]
  ------------------
 2200|      0|                         context->dest + ntbytes, tmp, tmp2);
 2201|      0|        if (cbytes == 0) {
  ------------------
  |  Branch (2201:13): [True: 0, False: 0]
  ------------------
 2202|      0|          ntbytes = 0;              /* incompressible data */
 2203|      0|          break;
 2204|      0|        }
 2205|      0|      }
 2206|      0|    }
 2207|   194k|    else {
 2208|       |      /* Regular decompression */
 2209|       |      // If memcpyed we don't have a bstarts section (because it is not needed)
 2210|   194k|      int32_t src_offset = memcpyed ?
  ------------------
  |  Branch (2210:28): [True: 174k, False: 20.2k]
  ------------------
 2211|   174k|          context->header_overhead + j * context->blocksize : sw32_(bstarts + j);
 2212|   194k|      uint8_t *dest_block = (vlblocks && context->vlblock_dests != NULL) ? context->vlblock_dests[j] : context->dest;
  ------------------
  |  Branch (2212:30): [True: 3, False: 194k]
  |  Branch (2212:42): [True: 0, False: 3]
  ------------------
 2213|   194k|      int32_t dest_offset = (vlblocks && context->vlblock_dests != NULL) ? 0 :
  ------------------
  |  Branch (2213:30): [True: 3, False: 194k]
  |  Branch (2213:42): [True: 0, False: 3]
  ------------------
 2214|   194k|                            (vlblocks ? context->blockoffsets[j] : j * context->blocksize);
  ------------------
  |  Branch (2214:30): [True: 3, False: 194k]
  ------------------
 2215|   194k|      cbytes = blosc_d(thread_context, bsize, leftoverblock, memcpyed,
 2216|   194k|                       context->src, context->srcsize, src_offset, j,
 2217|   194k|                       dest_block, dest_offset, tmp, tmp2);
 2218|   194k|    }
 2219|       |
 2220|   194k|    if (cbytes < 0) {
  ------------------
  |  Branch (2220:9): [True: 8.45k, False: 186k]
  ------------------
 2221|  8.45k|      ntbytes = cbytes;         /* error in blosc_c or blosc_d */
 2222|  8.45k|      break;
 2223|  8.45k|    }
 2224|   186k|    ntbytes += cbytes;
 2225|   186k|  }
 2226|       |
 2227|  18.5k|  return ntbytes;
 2228|  18.5k|}
blosc2.c:set_values:
 1644|     23|static int32_t set_values(int32_t typesize, const uint8_t* src, uint8_t* dest, int32_t destsize) {
 1645|       |#if defined(BLOSC_STRICT_ALIGN)
 1646|       |  if (destsize % typesize != 0) {
 1647|       |    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
 1648|       |  }
 1649|       |  int32_t nitems = destsize / typesize;
 1650|       |  if (nitems == 0) {
 1651|       |    return 0;
 1652|       |  }
 1653|       |  for (int i = 0; i < nitems; i++) {
 1654|       |    memcpy(dest + i * typesize, src + BLOSC_EXTENDED_HEADER_LENGTH, typesize);
 1655|       |  }
 1656|       |#else
 1657|     23|  if (destsize % typesize != 0) {
  ------------------
  |  Branch (1657:7): [True: 0, False: 23]
  ------------------
 1658|      0|    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1659|      0|  }
 1660|     23|  int32_t nitems = destsize / typesize;
 1661|     23|  if (nitems == 0) {
  ------------------
  |  Branch (1661:7): [True: 0, False: 23]
  ------------------
 1662|      0|    return 0;
 1663|      0|  }
 1664|       |
 1665|     23|  switch (typesize) {
 1666|      0|    case 8: {
  ------------------
  |  Branch (1666:5): [True: 0, False: 23]
  ------------------
 1667|      0|      int64_t val8 = ((int64_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 1668|      0|      int64_t* dest8 = (int64_t*)dest;
 1669|      0|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (1669:23): [True: 0, False: 0]
  ------------------
 1670|      0|        dest8[i] = val8;
 1671|      0|      }
 1672|      0|      break;
 1673|      0|    }
 1674|      9|    case 4: {
  ------------------
  |  Branch (1674:5): [True: 9, False: 14]
  ------------------
 1675|      9|      int32_t val4 = ((int32_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 1676|      9|      int32_t* dest4 = (int32_t*)dest;
 1677|   450k|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (1677:23): [True: 450k, False: 9]
  ------------------
 1678|   450k|        dest4[i] = val4;
 1679|   450k|      }
 1680|      9|      break;
 1681|      0|    }
 1682|      3|    case 2: {
  ------------------
  |  Branch (1682:5): [True: 3, False: 20]
  ------------------
 1683|      3|      int16_t val2 = ((int16_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 1684|      3|      int16_t* dest2 = (int16_t*)dest;
 1685|  52.6M|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (1685:23): [True: 52.6M, False: 3]
  ------------------
 1686|  52.6M|        dest2[i] = val2;
 1687|  52.6M|      }
 1688|      3|      break;
 1689|      0|    }
 1690|      8|    case 1: {
  ------------------
  |  Branch (1690:5): [True: 8, False: 15]
  ------------------
 1691|      8|      int8_t val1 = ((int8_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 1692|      8|      int8_t* dest1 = (int8_t*)dest;
 1693|   520M|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (1693:23): [True: 520M, False: 8]
  ------------------
 1694|   520M|        dest1[i] = val1;
 1695|   520M|      }
 1696|      8|      break;
 1697|      0|    }
 1698|      3|    default:
  ------------------
  |  Branch (1698:5): [True: 3, False: 20]
  ------------------
 1699|  27.3k|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (1699:23): [True: 27.2k, False: 3]
  ------------------
 1700|  27.2k|        memcpy(dest + i * typesize, src + BLOSC_EXTENDED_HEADER_LENGTH, typesize);
 1701|  27.2k|      }
 1702|     23|  }
 1703|     23|#endif
 1704|       |
 1705|     23|  return nitems;
 1706|     23|}
blosc2.c:set_nans:
 1612|  92.4k|static int32_t set_nans(int32_t typesize, uint8_t* dest, int32_t destsize) {
 1613|  92.4k|  if (destsize % typesize != 0) {
  ------------------
  |  Branch (1613:7): [True: 0, False: 92.4k]
  ------------------
 1614|      0|    BLOSC_TRACE_ERROR("destsize can only be a multiple of typesize");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1615|      0|    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1616|      0|  }
 1617|  92.4k|  int32_t nitems = destsize / typesize;
 1618|  92.4k|  if (nitems == 0) {
  ------------------
  |  Branch (1618:7): [True: 0, False: 92.4k]
  ------------------
 1619|      0|    return 0;
 1620|      0|  }
 1621|       |
 1622|  92.4k|  if (typesize == 4) {
  ------------------
  |  Branch (1622:7): [True: 84.1k, False: 8.35k]
  ------------------
 1623|  84.1k|    float* dest_ = (float*)dest;
 1624|  84.1k|    float val = nanf("");
 1625|  9.70M|    for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (1625:21): [True: 9.62M, False: 84.1k]
  ------------------
 1626|  9.62M|      dest_[i] = val;
 1627|  9.62M|    }
 1628|  84.1k|    return nitems;
 1629|  84.1k|  }
 1630|  8.35k|  else if (typesize == 8) {
  ------------------
  |  Branch (1630:12): [True: 8.35k, False: 3]
  ------------------
 1631|  8.35k|    double* dest_ = (double*)dest;
 1632|  8.35k|    double val = nan("");
 1633|   118M|    for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (1633:21): [True: 118M, False: 8.35k]
  ------------------
 1634|   118M|      dest_[i] = val;
 1635|   118M|    }
 1636|  8.35k|    return nitems;
 1637|  8.35k|  }
 1638|       |
 1639|      3|  BLOSC_TRACE_ERROR("Unsupported typesize for NaN");
  ------------------
  |  |   93|      3|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      3|    do {                                            \
  |  |  |  |   98|      3|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      3|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      3|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1640|      3|  return BLOSC2_ERROR_DATA;
 1641|  92.4k|}
blosc2.c:my_malloc:
  243|  78.4k|static uint8_t* my_malloc(size_t size) {
  244|  78.4k|  void* block = NULL;
  245|  78.4k|  int res = 0;
  246|       |  /* Keep aligned allocations valid under Valgrind and POSIX wrappers. */
  247|  78.4k|  if (size == 0) {
  ------------------
  |  Branch (247:7): [True: 0, False: 78.4k]
  ------------------
  248|      0|    size = 1;
  249|      0|  }
  250|       |
  251|       |/* Do an alignment to 32 bytes because AVX2 is supported */
  252|       |#if defined(_WIN32)
  253|       |  /* A (void *) cast needed for avoiding a warning with MINGW :-/ */
  254|       |  block = (void *)_aligned_malloc(size, 32);
  255|       |#elif _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600
  256|       |  /* Platform does have an implementation of posix_memalign */
  257|  78.4k|  res = posix_memalign(&block, 32, size);
  258|       |#else
  259|       |  block = malloc(size);
  260|       |#endif  /* _WIN32 */
  261|       |
  262|  78.4k|  if (block == NULL || res != 0) {
  ------------------
  |  Branch (262:7): [True: 0, False: 78.4k]
  |  Branch (262:24): [True: 0, False: 78.4k]
  ------------------
  263|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  264|      0|    return NULL;
  265|      0|  }
  266|       |
  267|  78.4k|  return (uint8_t*)block;
  268|  78.4k|}
blosc2.c:blosc_d:
 1713|   202k|    int32_t nblock, uint8_t* dest, int32_t dest_offset, uint8_t* tmp, uint8_t* tmp2) {
 1714|   202k|  blosc2_context* context = thread_context->parent_context;
 1715|   202k|  uint8_t* filters = context->filters;
 1716|   202k|  uint8_t *tmp3 = thread_context->tmp4;
 1717|   202k|  bool vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 1718|   202k|  int32_t compformat = (context->header_flags & (uint8_t)0xe0) >> 5u;
 1719|   202k|  int dont_split = (context->header_flags & 0x10) >> 4;
 1720|   202k|  int32_t chunk_nbytes;
 1721|   202k|  int32_t chunk_cbytes;
 1722|   202k|  int nstreams;
 1723|   202k|  int32_t neblock;
 1724|   202k|  int32_t nbytes;                /* number of decompressed bytes in split */
 1725|   202k|  int32_t cbytes;                /* number of compressed bytes in split */
 1726|       |  // int32_t ctbytes = 0;           /* number of compressed bytes in block */
 1727|   202k|  int32_t ntbytes = 0;           /* number of uncompressed bytes in block */
 1728|   202k|  uint8_t* _dest;
 1729|   202k|  int32_t typesize = context->typesize;
 1730|   202k|  bool instr_codec = context->blosc2_flags & BLOSC2_INSTR_CODEC;
 1731|   202k|  const char* compname;
 1732|   202k|  int rc;
 1733|       |
 1734|   202k|  if (context->block_maskout != NULL && context->block_maskout[nblock]) {
  ------------------
  |  Branch (1734:7): [True: 0, False: 202k]
  |  Branch (1734:41): [True: 0, False: 0]
  ------------------
 1735|       |    // Do not decompress, but act as if we successfully decompressed everything
 1736|      0|    return bsize;
 1737|      0|  }
 1738|       |
 1739|   202k|  rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 1740|   202k|  if (rc < 0) {
  ------------------
  |  Branch (1740:7): [True: 0, False: 202k]
  ------------------
 1741|      0|    return rc;
 1742|      0|  }
 1743|   202k|  if (context->special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (1743:7): [True: 21, False: 202k]
  ------------------
 1744|       |    // We need the actual typesize in this case, but it cannot be encoded in the header, so derive it from cbytes
 1745|     21|    typesize = chunk_cbytes - context->header_overhead;
 1746|     21|  }
 1747|       |
 1748|       |  // In some situations (lazychunks) the context can arrive uninitialized
 1749|       |  // (but BITSHUFFLE needs it for accessing the format of the chunk)
 1750|   202k|  if (context->src == NULL) {
  ------------------
  |  Branch (1750:7): [True: 0, False: 202k]
  ------------------
 1751|      0|    context->src = src;
 1752|      0|  }
 1753|       |
 1754|       |  // Chunks with special values cannot be lazy
 1755|   202k|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (1755:19): [True: 202k, False: 626]
  ------------------
 1756|   202k|          (context->blosc2_flags & 0x08u) && !context->special_type);
  ------------------
  |  Branch (1756:11): [True: 629, False: 201k]
  |  Branch (1756:46): [True: 15, False: 614]
  ------------------
 1757|   202k|  if (is_lazy) {
  ------------------
  |  Branch (1757:7): [True: 15, False: 202k]
  ------------------
 1758|       |    // The chunk is on disk, so just lazily load the block
 1759|     15|    if (context->schunk == NULL) {
  ------------------
  |  Branch (1759:9): [True: 3, False: 12]
  ------------------
 1760|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1761|      3|      return BLOSC2_ERROR_INVALID_PARAM;
 1762|      3|    }
 1763|     12|    if (context->schunk->frame == NULL) {
  ------------------
  |  Branch (1763:9): [True: 0, False: 12]
  ------------------
 1764|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1765|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 1766|      0|    }
 1767|     12|    blosc2_frame_s* frame = (blosc2_frame_s*)context->schunk->frame;
 1768|     12|    size_t bstarts_nbytes;
 1769|     12|    size_t trailer_offset;
 1770|     12|    size_t block_csizes_nbytes;
 1771|     12|    size_t trailer_meta_nbytes;
 1772|     12|    size_t lazy_trailer_end;
 1773|     12|    if (srcsize < 0 || context->nblocks < 0 ||
  ------------------
  |  Branch (1773:9): [True: 0, False: 12]
  |  Branch (1773:24): [True: 0, False: 12]
  ------------------
 1774|     12|        !checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &bstarts_nbytes) ||
  ------------------
  |  Branch (1774:9): [True: 0, False: 12]
  ------------------
 1775|     12|        !checked_add_size((size_t)BLOSC_EXTENDED_HEADER_LENGTH, bstarts_nbytes, &trailer_offset) ||
  ------------------
  |  Branch (1775:9): [True: 0, False: 12]
  ------------------
 1776|     12|        !checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &block_csizes_nbytes) ||
  ------------------
  |  Branch (1776:9): [True: 0, False: 12]
  ------------------
 1777|     12|        !checked_add_size(sizeof(int32_t) + sizeof(int64_t), block_csizes_nbytes, &trailer_meta_nbytes) ||
  ------------------
  |  Branch (1777:9): [True: 0, False: 12]
  ------------------
 1778|     12|        !checked_add_size(trailer_offset, trailer_meta_nbytes, &lazy_trailer_end) ||
  ------------------
  |  Branch (1778:9): [True: 0, False: 12]
  ------------------
 1779|     12|        (size_t)srcsize < lazy_trailer_end) {
  ------------------
  |  Branch (1779:9): [True: 1, False: 11]
  ------------------
 1780|      1|      BLOSC_TRACE_ERROR("Lazy trailer exceeds source buffer.");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1781|      1|      return BLOSC2_ERROR_READ_BUFFER;
 1782|      1|    }
 1783|     11|    int32_t nchunk;
 1784|     11|    int64_t chunk_offset;
 1785|       |    // The nchunk and the offset of the current chunk are in the trailer
 1786|     11|    memcpy(&nchunk, src + trailer_offset, sizeof(nchunk));
 1787|     11|    memcpy(&chunk_offset, src + trailer_offset + sizeof(int32_t), sizeof(chunk_offset));
 1788|       |    // Get the csize of the nblock
 1789|     11|    if (nblock < 0 || nblock >= context->nblocks) {
  ------------------
  |  Branch (1789:9): [True: 0, False: 11]
  |  Branch (1789:23): [True: 0, False: 11]
  ------------------
 1790|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1791|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 1792|      0|    }
 1793|     11|    int32_t *block_csizes = (int32_t *)(src + trailer_offset + sizeof(int32_t) + sizeof(int64_t));
 1794|     11|    int32_t block_csize = block_csizes[nblock];
 1795|     11|    int32_t max_lazy_block_csize = context->blocksize + context->typesize * (signed)sizeof(int32_t);
 1796|     11|    if (block_csize <= 0 || block_csize > max_lazy_block_csize) {
  ------------------
  |  Branch (1796:9): [True: 3, False: 8]
  |  Branch (1796:29): [True: 8, False: 0]
  ------------------
 1797|     11|      BLOSC_TRACE_ERROR("Invalid lazy block size in trailer.");
  ------------------
  |  |   93|     11|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     11|    do {                                            \
  |  |  |  |   98|     11|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     11|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 11, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     11|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1798|     11|      return BLOSC2_ERROR_INVALID_HEADER;
 1799|     11|    }
 1800|      0|    if (vlblocks && block_csize <= (int32_t)sizeof(int32_t)) {
  ------------------
  |  Branch (1800:9): [True: 0, False: 0]
  |  Branch (1800:21): [True: 0, False: 0]
  ------------------
 1801|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1802|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 1803|      0|    }
 1804|       |    // Read the lazy block on disk
 1805|      0|    void* fp = NULL;
 1806|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(context->schunk->storage->io->id);
 1807|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (1807:9): [True: 0, False: 0]
  ------------------
 1808|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1809|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 1810|      0|    }
 1811|       |
 1812|      0|    int64_t io_pos = 0;
 1813|      0|    if (frame->sframe) {
  ------------------
  |  Branch (1813:9): [True: 0, False: 0]
  ------------------
 1814|       |      // The chunk is not in the frame
 1815|      0|      fp = sframe_open_chunk(frame->urlpath, nchunk, "rb", context->schunk->storage->io);
 1816|      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]
  |  |  ------------------
  ------------------
 1817|       |      // The offset of the block is src_offset
 1818|      0|      if (src_offset < 0) {
  ------------------
  |  Branch (1818:11): [True: 0, False: 0]
  ------------------
 1819|      0|        frame_reader_release(frame, io_cb, fp);
 1820|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1821|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 1822|      0|      }
 1823|      0|      io_pos = src_offset;
 1824|      0|    }
 1825|      0|    else {
 1826|      0|      fp = frame_reader_acquire(frame, context->schunk->storage->io);
 1827|      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]
  |  |  ------------------
  ------------------
 1828|       |      // The offset of the block is src_offset
 1829|      0|      if (src_offset < 0) {
  ------------------
  |  Branch (1829:11): [True: 0, False: 0]
  ------------------
 1830|      0|        frame_reader_release(frame, io_cb, fp);
 1831|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1832|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 1833|      0|      }
 1834|      0|      if (chunk_offset < 0) {
  ------------------
  |  Branch (1834:11): [True: 0, False: 0]
  ------------------
 1835|      0|        frame_reader_release(frame, io_cb, fp);
 1836|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1837|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 1838|      0|      }
 1839|      0|      if (frame->file_offset > INT64_MAX - chunk_offset) {
  ------------------
  |  Branch (1839:11): [True: 0, False: 0]
  ------------------
 1840|      0|        frame_reader_release(frame, io_cb, fp);
 1841|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1842|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 1843|      0|      }
 1844|      0|      io_pos = frame->file_offset + chunk_offset;
 1845|      0|      if (io_pos > INT64_MAX - src_offset) {
  ------------------
  |  Branch (1845:11): [True: 0, False: 0]
  ------------------
 1846|      0|        frame_reader_release(frame, io_cb, fp);
 1847|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1848|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 1849|      0|      }
 1850|      0|      io_pos += src_offset;
 1851|      0|    }
 1852|       |    // We can make use of tmp3 because it will be used after src is not needed anymore
 1853|      0|    int64_t rbytes = io_cb->read((void**)&tmp3, 1, block_csize, io_pos, fp);
 1854|      0|    frame_reader_release(frame, io_cb, fp);
 1855|      0|    if ((int32_t)rbytes != block_csize) {
  ------------------
  |  Branch (1855:9): [True: 0, False: 0]
  ------------------
 1856|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1857|      0|      return BLOSC2_ERROR_READ_BUFFER;
 1858|      0|    }
 1859|      0|    src = tmp3;
 1860|      0|    src_offset = 0;
 1861|      0|    srcsize = block_csize;
 1862|      0|  }
 1863|       |
 1864|       |  // If the chunk is memcpyed, we just have to copy the block to dest and return
 1865|   202k|  if (memcpyed) {
  ------------------
  |  Branch (1865:7): [True: 174k, False: 28.1k]
  ------------------
 1866|   174k|    int bsize_ = leftoverblock ? chunk_nbytes % context->blocksize : bsize;
  ------------------
  |  Branch (1866:18): [True: 353, False: 174k]
  ------------------
 1867|   174k|    if (!context->special_type) {
  ------------------
  |  Branch (1867:9): [True: 694, False: 173k]
  ------------------
 1868|    694|      if (chunk_nbytes + context->header_overhead != chunk_cbytes) {
  ------------------
  |  Branch (1868:11): [True: 0, False: 694]
  ------------------
 1869|      0|        return BLOSC2_ERROR_WRITE_BUFFER;
 1870|      0|      }
 1871|    694|      if (chunk_cbytes < context->header_overhead + (nblock * context->blocksize) + bsize_) {
  ------------------
  |  Branch (1871:11): [True: 0, False: 694]
  ------------------
 1872|       |        /* Not enough input to copy block */
 1873|      0|        return BLOSC2_ERROR_READ_BUFFER;
 1874|      0|      }
 1875|    694|    }
 1876|   174k|    if (!is_lazy) {
  ------------------
  |  Branch (1876:9): [True: 174k, False: 0]
  ------------------
 1877|   174k|      src += context->header_overhead + nblock * context->blocksize;
 1878|   174k|    }
 1879|   174k|    _dest = dest + dest_offset;
 1880|   174k|    if (context->postfilter != NULL) {
  ------------------
  |  Branch (1880:9): [True: 0, False: 174k]
  ------------------
 1881|       |      // We are making use of a postfilter, so use a temp for destination
 1882|      0|      _dest = tmp;
 1883|      0|    }
 1884|   174k|    rc = 0;
 1885|   174k|    switch (context->special_type) {
 1886|     21|      case BLOSC2_SPECIAL_VALUE:
  ------------------
  |  Branch (1886:7): [True: 21, False: 174k]
  ------------------
 1887|       |        // All repeated values
 1888|     21|        rc = set_values(typesize, context->src, _dest, bsize_);
 1889|     21|        if (rc < 0) {
  ------------------
  |  Branch (1889:13): [True: 0, False: 21]
  ------------------
 1890|      0|          BLOSC_TRACE_ERROR("set_values failed");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1891|      0|          return BLOSC2_ERROR_DATA;
 1892|      0|        }
 1893|     21|        break;
 1894|  92.4k|      case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (1894:7): [True: 92.4k, False: 82.0k]
  ------------------
 1895|  92.4k|        rc = set_nans(context->typesize, _dest, bsize_);
 1896|  92.4k|        if (rc < 0) {
  ------------------
  |  Branch (1896:13): [True: 3, False: 92.4k]
  ------------------
 1897|      3|          BLOSC_TRACE_ERROR("set_nans failed");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1898|      3|          return BLOSC2_ERROR_DATA;
 1899|      3|        }
 1900|  92.4k|        break;
 1901|  92.4k|      case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (1901:7): [True: 73.3k, False: 101k]
  ------------------
 1902|  73.3k|        memset(_dest, 0, bsize_);
 1903|  73.3k|        break;
 1904|  8.03k|      case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (1904:7): [True: 8.03k, False: 166k]
  ------------------
 1905|       |        // We do nothing here
 1906|  8.03k|        break;
 1907|    694|      default:
  ------------------
  |  Branch (1907:7): [True: 694, False: 173k]
  ------------------
 1908|    694|        memcpy(_dest, src, bsize_);
 1909|   174k|    }
 1910|   174k|    if (context->postfilter != NULL) {
  ------------------
  |  Branch (1910:9): [True: 0, False: 174k]
  ------------------
 1911|       |      // Create new postfilter parameters for this block (must be private for each thread)
 1912|      0|      blosc2_postfilter_params postparams;
 1913|      0|      memcpy(&postparams, context->postparams, sizeof(postparams));
 1914|      0|      postparams.input = tmp;
 1915|      0|      postparams.output = dest + dest_offset;
 1916|      0|      postparams.size = bsize;
 1917|      0|      postparams.typesize = typesize;
 1918|      0|      postparams.offset = nblock * context->blocksize;
 1919|      0|      postparams.nchunk = context->schunk != NULL ? context->schunk->current_nchunk : -1;
  ------------------
  |  Branch (1919:27): [True: 0, False: 0]
  ------------------
 1920|      0|      postparams.nblock = nblock;
 1921|      0|      postparams.tid = thread_context->tid;
 1922|      0|      postparams.ttmp = thread_context->tmp;
 1923|      0|      postparams.ttmp_nbytes = thread_context->tmp_nbytes;
 1924|      0|      postparams.ctx = context;
 1925|       |
 1926|       |      // Execute the postfilter (the processed block will be copied to dest)
 1927|      0|      if (context->postfilter(&postparams) != 0) {
  ------------------
  |  Branch (1927:11): [True: 0, False: 0]
  ------------------
 1928|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1929|      0|        return BLOSC2_ERROR_POSTFILTER;
 1930|      0|      }
 1931|      0|    }
 1932|   174k|    thread_context->zfp_cell_nitems = 0;
 1933|       |
 1934|   174k|    return bsize_;
 1935|   174k|  }
 1936|       |
 1937|  28.1k|  if (!is_lazy && (src_offset <= 0 || src_offset >= srcsize)) {
  ------------------
  |  Branch (1937:7): [True: 28.1k, False: 0]
  |  Branch (1937:20): [True: 14, False: 28.1k]
  |  Branch (1937:39): [True: 9, False: 28.1k]
  ------------------
 1938|       |    /* Invalid block src offset encountered */
 1939|     23|    return BLOSC2_ERROR_DATA;
 1940|     23|  }
 1941|       |
 1942|  28.1k|  src += src_offset;
 1943|  28.1k|  if (vlblocks) {
  ------------------
  |  Branch (1943:7): [True: 0, False: 28.1k]
  ------------------
 1944|      0|    if (context->blockcbytes == NULL || nblock >= context->nblocks ||
  ------------------
  |  Branch (1944:9): [True: 0, False: 0]
  |  Branch (1944:41): [True: 0, False: 0]
  ------------------
 1945|      0|        context->blockcbytes[nblock] <= (int32_t)sizeof(int32_t) ||
  ------------------
  |  Branch (1945:9): [True: 0, False: 0]
  ------------------
 1946|      0|        src_offset > srcsize - context->blockcbytes[nblock]) {
  ------------------
  |  Branch (1946:9): [True: 0, False: 0]
  ------------------
 1947|      0|      return BLOSC2_ERROR_DATA;
 1948|      0|    }
 1949|      0|    srcsize = context->blockcbytes[nblock];
 1950|      0|  }
 1951|  28.1k|  else {
 1952|  28.1k|    srcsize -= src_offset;
 1953|  28.1k|  }
 1954|       |
 1955|  28.1k|  int last_filter_index = last_filter(filters, 'd');
 1956|  28.1k|  if (instr_codec) {
  ------------------
  |  Branch (1956:7): [True: 962, False: 27.2k]
  ------------------
 1957|       |    // If instrumented, we don't want to run the filters
 1958|    962|    _dest = dest + dest_offset;
 1959|    962|  }
 1960|  27.2k|  else if (((last_filter_index >= 0) &&
  ------------------
  |  Branch (1960:13): [True: 26.4k, False: 723]
  ------------------
 1961|  26.4k|       (next_filter(filters, BLOSC2_MAX_FILTERS, 'd') != BLOSC_DELTA)) ||
  ------------------
  |  Branch (1961:8): [True: 21.2k, False: 5.23k]
  ------------------
 1962|  21.2k|    context->postfilter != NULL) {
  ------------------
  |  Branch (1962:5): [True: 0, False: 5.96k]
  ------------------
 1963|       |    // We are making use of some filter, so use a temp for destination
 1964|  21.2k|    _dest = tmp;
 1965|  21.2k|  }
 1966|  5.96k|  else {
 1967|       |    // If no filters, or only DELTA in pipeline
 1968|  5.96k|    _dest = dest + dest_offset;
 1969|  5.96k|  }
 1970|       |
 1971|       |  /* The number of compressed data streams for this block */
 1972|  28.1k|  if (vlblocks) {
  ------------------
  |  Branch (1972:7): [True: 0, False: 28.1k]
  ------------------
 1973|      0|    nstreams = 1;
 1974|      0|  }
 1975|  28.1k|  else if (!dont_split && !leftoverblock) {
  ------------------
  |  Branch (1975:12): [True: 1.38k, False: 26.7k]
  |  Branch (1975:27): [True: 1.37k, False: 5]
  ------------------
 1976|  1.37k|    nstreams = context->typesize;
 1977|  1.37k|  }
 1978|  26.7k|  else {
 1979|  26.7k|    nstreams = 1;
 1980|  26.7k|  }
 1981|       |
 1982|  28.1k|  neblock = bsize / nstreams;
 1983|  28.1k|  if (neblock == 0) {
  ------------------
  |  Branch (1983:7): [True: 0, False: 28.1k]
  ------------------
 1984|       |    /* Not enough space to output bytes */
 1985|      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]
  |  |  ------------------
  ------------------
 1986|      0|  }
 1987|  48.1k|  for (int j = 0; j < nstreams; j++) {
  ------------------
  |  Branch (1987:19): [True: 28.3k, False: 19.7k]
  ------------------
 1988|  28.3k|    if (vlblocks) {
  ------------------
  |  Branch (1988:9): [True: 0, False: 28.3k]
  ------------------
 1989|      0|      if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (1989:11): [True: 0, False: 0]
  ------------------
 1990|       |        /* Not enough input to read compressed bytes */
 1991|      0|        return BLOSC2_ERROR_READ_BUFFER;
 1992|      0|      }
 1993|      0|      neblock = sw32_(src);
 1994|      0|      if (neblock != bsize) {
  ------------------
  |  Branch (1994:11): [True: 0, False: 0]
  ------------------
 1995|      0|        return BLOSC2_ERROR_DATA;
 1996|      0|      }
 1997|      0|      src += sizeof(int32_t);
 1998|      0|      cbytes = srcsize - (int32_t)sizeof(int32_t);
 1999|      0|      srcsize = 0;
 2000|      0|    }
 2001|  28.3k|    else {
 2002|  28.3k|      if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (2002:11): [True: 0, False: 28.3k]
  ------------------
 2003|       |        /* Not enough input to read compressed size */
 2004|      0|        return BLOSC2_ERROR_READ_BUFFER;
 2005|      0|      }
 2006|  28.3k|      srcsize -= sizeof(int32_t);
 2007|  28.3k|      cbytes = sw32_(src);      /* amount of compressed bytes */
 2008|  28.3k|      if (cbytes > 0) {
  ------------------
  |  Branch (2008:11): [True: 8.95k, False: 19.4k]
  ------------------
 2009|  8.95k|        if (srcsize < cbytes) {
  ------------------
  |  Branch (2009:13): [True: 5, False: 8.94k]
  ------------------
 2010|       |          /* Not enough input to read compressed bytes */
 2011|      5|          return BLOSC2_ERROR_READ_BUFFER;
 2012|      5|        }
 2013|  8.94k|        srcsize -= cbytes;
 2014|  8.94k|      }
 2015|  28.3k|      src += sizeof(int32_t);
 2016|  28.3k|    }
 2017|       |    // ctbytes += (signed)sizeof(int32_t);
 2018|       |
 2019|       |    /* Uncompress */
 2020|  28.3k|    if (!vlblocks && cbytes == 0) {
  ------------------
  |  Branch (2020:9): [True: 28.3k, False: 0]
  |  Branch (2020:22): [True: 14.4k, False: 13.9k]
  ------------------
 2021|       |      // A run of 0's
 2022|  14.4k|      memset(_dest, 0, (unsigned int)neblock);
 2023|  14.4k|      nbytes = neblock;
 2024|  14.4k|    }
 2025|  13.9k|    else if (!vlblocks && cbytes < 0) {
  ------------------
  |  Branch (2025:14): [True: 13.9k, False: 0]
  |  Branch (2025:27): [True: 5.01k, False: 8.94k]
  ------------------
 2026|       |      // A negative number means some encoding depending on the token that comes next
 2027|  5.01k|      uint8_t token;
 2028|       |
 2029|  5.01k|      if (srcsize < (signed)sizeof(uint8_t)) {
  ------------------
  |  Branch (2029:11): [True: 0, False: 5.01k]
  ------------------
 2030|       |        // Not enough input to read token */
 2031|      0|        return BLOSC2_ERROR_READ_BUFFER;
 2032|      0|      }
 2033|  5.01k|      srcsize -= sizeof(uint8_t);
 2034|       |
 2035|  5.01k|      token = src[0];
 2036|  5.01k|      src += 1;
 2037|       |      // ctbytes += 1;
 2038|       |
 2039|  5.01k|      if (token & 0x1) {
  ------------------
  |  Branch (2039:11): [True: 5.01k, False: 0]
  ------------------
 2040|       |        // A run of bytes that are different than 0
 2041|  5.01k|        if (cbytes < -255) {
  ------------------
  |  Branch (2041:13): [True: 12, False: 5.00k]
  ------------------
 2042|       |          // Runs can only encode a byte
 2043|     12|          return BLOSC2_ERROR_RUN_LENGTH;
 2044|     12|        }
 2045|  5.00k|        uint8_t value = -cbytes;
 2046|  5.00k|        memset(_dest, value, (unsigned int)neblock);
 2047|  5.00k|      } else {
 2048|      0|        BLOSC_TRACE_ERROR("Invalid or unsupported compressed stream token value - %d", token);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2049|      0|        return BLOSC2_ERROR_RUN_LENGTH;
 2050|      0|      }
 2051|  5.00k|      nbytes = neblock;
 2052|  5.00k|      cbytes = 0;  // everything is encoded in the cbytes token
 2053|  5.00k|    }
 2054|  8.94k|    else if (cbytes == neblock) {
  ------------------
  |  Branch (2054:14): [True: 269, False: 8.67k]
  ------------------
 2055|    269|      memcpy(_dest, src, (unsigned int)neblock);
 2056|    269|      nbytes = (int32_t)neblock;
 2057|    269|    }
 2058|  8.67k|    else {
 2059|  8.67k|      if (compformat == BLOSC_BLOSCLZ_FORMAT) {
  ------------------
  |  Branch (2059:11): [True: 233, False: 8.44k]
  ------------------
 2060|    233|        nbytes = blosclz_decompress(src, cbytes, _dest, (int)neblock);
 2061|    233|      }
 2062|  8.44k|      else if (compformat == BLOSC_LZ4_FORMAT) {
  ------------------
  |  Branch (2062:16): [True: 715, False: 7.73k]
  ------------------
 2063|    715|        nbytes = lz4_wrap_decompress((char*)src, (size_t)cbytes,
 2064|    715|                                     (char*)_dest, (size_t)neblock,
 2065|    715|                                     thread_context);
 2066|    715|      }
 2067|  7.73k|  #if defined(HAVE_ZLIB)
 2068|  7.73k|      else if (compformat == BLOSC_ZLIB_FORMAT) {
  ------------------
  |  Branch (2068:16): [True: 751, False: 6.97k]
  ------------------
 2069|    751|        nbytes = zlib_wrap_decompress((char*)src, (size_t)cbytes,
 2070|    751|                                      (char*)_dest, (size_t)neblock);
 2071|    751|      }
 2072|  6.97k|  #endif /*  HAVE_ZLIB */
 2073|  6.97k|  #if defined(HAVE_ZSTD)
 2074|  6.97k|      else if (compformat == BLOSC_ZSTD_FORMAT) {
  ------------------
  |  Branch (2074:16): [True: 6.52k, False: 459]
  ------------------
 2075|  6.52k|        nbytes = zstd_wrap_decompress(thread_context,
 2076|  6.52k|                                      (char*)src, (size_t)cbytes,
 2077|  6.52k|                                      (char*)_dest, (size_t)neblock);
 2078|  6.52k|      }
 2079|    459|  #endif /*  HAVE_ZSTD */
 2080|    459|      else if (compformat == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (2080:16): [True: 458, False: 1]
  ------------------
 2081|    458|        bool getcell = false;
 2082|       |
 2083|    458|#if defined(HAVE_ZFP)
 2084|    458|        if ((context->compcode == BLOSC_CODEC_ZFP_FIXED_RATE) &&
  ------------------
  |  Branch (2084:13): [True: 0, False: 458]
  ------------------
 2085|      0|            (thread_context->zfp_cell_nitems > 0)) {
  ------------------
  |  Branch (2085:13): [True: 0, False: 0]
  ------------------
 2086|      0|          nbytes = zfp_getcell(thread_context, src, cbytes, _dest, neblock);
 2087|      0|          if (nbytes < 0) {
  ------------------
  |  Branch (2087:15): [True: 0, False: 0]
  ------------------
 2088|      0|            return BLOSC2_ERROR_DATA;
 2089|      0|          }
 2090|      0|          if (nbytes == thread_context->zfp_cell_nitems * typesize) {
  ------------------
  |  Branch (2090:15): [True: 0, False: 0]
  ------------------
 2091|      0|            getcell = true;
 2092|      0|          }
 2093|      0|        }
 2094|    458|#endif /* HAVE_ZFP */
 2095|    458|        if (!getcell) {
  ------------------
  |  Branch (2095:13): [True: 458, False: 0]
  ------------------
 2096|    458|          thread_context->zfp_cell_nitems = 0;
 2097|    473|          for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (2097:27): [True: 472, False: 1]
  ------------------
 2098|    472|            if (g_codecs[i].compcode == context->compcode) {
  ------------------
  |  Branch (2098:17): [True: 457, False: 15]
  ------------------
 2099|    457|              if (g_codecs[i].decoder == NULL) {
  ------------------
  |  Branch (2099:19): [True: 1, False: 456]
  ------------------
 2100|       |                // Dynamically load codec plugin
 2101|      1|                if (fill_codec(&g_codecs[i]) < 0) {
  ------------------
  |  Branch (2101:21): [True: 1, False: 0]
  ------------------
 2102|      1|                  BLOSC_TRACE_ERROR("Could not load codec %d.", g_codecs[i].compcode);
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2103|      1|                  return BLOSC2_ERROR_CODEC_SUPPORT;
 2104|      1|                }
 2105|      1|              }
 2106|    456|              blosc2_dparams dparams;
 2107|    456|              blosc2_ctx_get_dparams(context, &dparams);
 2108|    456|              nbytes = g_codecs[i].decoder(src,
 2109|    456|                                           cbytes,
 2110|    456|                                           _dest,
 2111|    456|                                           neblock,
 2112|    456|                                           context->compcode_meta,
 2113|    456|                                           &dparams,
 2114|    456|                                           context->src);
 2115|    456|              goto urcodecsuccess;
 2116|    457|            }
 2117|    472|          }
 2118|      1|          BLOSC_TRACE_ERROR("User-defined compressor codec %d not found during decompression", context->compcode);
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2119|      1|          return BLOSC2_ERROR_CODEC_SUPPORT;
 2120|    458|        }
 2121|    456|      urcodecsuccess:
 2122|    456|        ;
 2123|    456|      }
 2124|      1|      else {
 2125|      1|        compname = clibcode_to_clibname(compformat);
 2126|      1|        BLOSC_TRACE_ERROR(
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2127|      1|                "Blosc has not been compiled with decompression "
 2128|      1|                "support for '%s' format.  "
 2129|      1|                "Please recompile for adding this support.", compname);
 2130|      1|        return BLOSC2_ERROR_CODEC_SUPPORT;
 2131|      1|      }
 2132|       |
 2133|       |      /* Check that decompressed bytes number is correct */
 2134|  8.67k|      if ((nbytes != neblock) && (thread_context->zfp_cell_nitems == 0)) {
  ------------------
  |  Branch (2134:11): [True: 8.39k, False: 284]
  |  Branch (2134:34): [True: 8.39k, False: 0]
  ------------------
 2135|  8.39k|        return BLOSC2_ERROR_DATA;
 2136|  8.39k|      }
 2137|       |
 2138|  8.67k|    }
 2139|  19.9k|    src += cbytes;
 2140|       |    // ctbytes += cbytes;
 2141|  19.9k|    _dest += nbytes;
 2142|  19.9k|    ntbytes += nbytes;
 2143|  19.9k|  } /* Closes j < nstreams */
 2144|       |
 2145|  19.7k|  if (!instr_codec) {
  ------------------
  |  Branch (2145:7): [True: 19.7k, False: 1]
  ------------------
 2146|  19.7k|    if (last_filter_index >= 0 || context->postfilter != NULL) {
  ------------------
  |  Branch (2146:9): [True: 19.1k, False: 601]
  |  Branch (2146:35): [True: 0, False: 601]
  ------------------
 2147|       |      /* Apply regular filter pipeline */
 2148|  19.1k|      int errcode = pipeline_backward(thread_context, bsize, dest, dest_offset, tmp, tmp2, tmp3,
 2149|  19.1k|                                      last_filter_index, nblock);
 2150|  19.1k|      if (errcode < 0)
  ------------------
  |  Branch (2150:11): [True: 4, False: 19.1k]
  ------------------
 2151|      4|        return errcode;
 2152|  19.1k|    }
 2153|  19.7k|  }
 2154|       |
 2155|       |  /* Return the number of uncompressed bytes */
 2156|  19.7k|  return (int)ntbytes;
 2157|  19.7k|}
blosc2.c:lz4_wrap_decompress:
  501|    715|                               struct thread_context* thread_context) {
  502|    715|  int nbytes;
  503|    715|  blosc2_context* context = thread_context->parent_context;
  504|    715|  if (context->use_dict && context->dict_buffer != NULL && context->dict_size > 0) {
  ------------------
  |  Branch (504:7): [True: 363, False: 352]
  |  Branch (504:28): [True: 363, False: 0]
  |  Branch (504:60): [True: 363, False: 0]
  ------------------
  505|    363|    nbytes = LZ4_decompress_safe_usingDict(input, output,
  506|    363|                                           (int)compressed_length, (int)maxout,
  507|    363|                                           (const char*)context->dict_buffer,
  508|    363|                                           (int)context->dict_size);
  509|    363|  } else {
  510|    352|    nbytes = LZ4_decompress_safe(input, output, (int)compressed_length, (int)maxout);
  511|    352|  }
  512|    715|  if (nbytes != (int)maxout) {
  ------------------
  |  Branch (512:7): [True: 632, False: 83]
  ------------------
  513|    632|    return 0;
  514|    632|  }
  515|     83|  return (int)maxout;
  516|    715|}
blosc2.c:zlib_wrap_decompress:
  540|    751|                                char* output, size_t maxout) {
  541|    751|  int status;
  542|    751|#if defined(HAVE_ZLIB_NG) && ! defined(ZLIB_COMPAT)
  543|    751|  size_t ul = maxout;
  544|    751|  status = zng_uncompress(
  545|    751|      (uint8_t*)output, &ul, (uint8_t*)input, compressed_length);
  546|       |#else
  547|       |  uLongf ul = (uLongf)maxout;
  548|       |  status = uncompress(
  549|       |      (Bytef*)output, &ul, (Bytef*)input, (uLong)compressed_length);
  550|       |#endif
  551|    751|  if (status != Z_OK) {
  ------------------
  |  |  180|    751|#define Z_OK            0
  ------------------
  |  Branch (551:7): [True: 683, False: 68]
  ------------------
  552|    683|    return 0;
  553|    683|  }
  554|     68|  return (int)ul;
  555|    751|}
blosc2.c:zstd_wrap_decompress:
  592|  6.52k|                                char* output, size_t maxout) {
  593|  6.52k|  size_t code;
  594|  6.52k|  blosc2_context* context = thread_context->parent_context;
  595|       |
  596|  6.52k|  if (thread_context->zstd_dctx == NULL) {
  ------------------
  |  Branch (596:7): [True: 6.47k, False: 46]
  ------------------
  597|  6.47k|    thread_context->zstd_dctx = ZSTD_createDCtx();
  598|  6.47k|  }
  599|       |
  600|  6.52k|  if (context->use_dict) {
  ------------------
  |  Branch (600:7): [True: 2.31k, False: 4.20k]
  ------------------
  601|  2.31k|    assert(context->dict_ddict != NULL);
  602|  2.31k|    code = ZSTD_decompress_usingDDict(
  603|  2.31k|            thread_context->zstd_dctx, (void*)output, maxout, (void*)input,
  604|  2.31k|            compressed_length, context->dict_ddict);
  605|  4.20k|  } else {
  606|  4.20k|    code = ZSTD_decompressDCtx(thread_context->zstd_dctx,
  607|  4.20k|        (void*)output, maxout, (void*)input, compressed_length);
  608|  4.20k|  }
  609|  6.52k|  if (ZSTD_isError(code) != ZSTD_error_no_error) {
  ------------------
  |  Branch (609:7): [True: 6.41k, False: 110]
  ------------------
  610|  6.41k|    BLOSC_TRACE_ERROR("Error in ZSTD decompression: '%s'.  Giving up.",
  ------------------
  |  |   93|  6.41k|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|  6.41k|    do {                                            \
  |  |  |  |   98|  6.41k|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|  6.41k|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 6.41k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|  6.41k|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  611|  6.41k|                      ZDICT_getErrorName(code));
  612|  6.41k|    return 0;
  613|  6.41k|  }
  614|    110|  return (int)code;
  615|  6.52k|}
blosc2.c:getitem_read_header:
 4505|  10.3k|static int getitem_read_header(const void* src, int32_t srcsize, blosc_header* header) {
 4506|  10.3k|  int result = read_chunk_header((uint8_t *) src, srcsize, true, header);
 4507|  10.3k|  if (result < 0) {
  ------------------
  |  Branch (4507:7): [True: 0, False: 10.3k]
  ------------------
 4508|      0|    return result;
 4509|      0|  }
 4510|  10.3k|  if (header->blosc2_flags2 & BLOSC2_VL_BLOCKS) {
  ------------------
  |  Branch (4510:7): [True: 0, False: 10.3k]
  ------------------
 4511|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4512|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4513|      0|  }
 4514|  10.3k|  return 0;
 4515|  10.3k|}
blosc2.c:getitem_with_header:
 4521|  10.3k|                               int start, int nitems, void* dest, int32_t destsize) {
 4522|       |  /* Minimally populate the context */
 4523|  10.3k|  context->src = src;
 4524|  10.3k|  context->srcsize = srcsize;
 4525|  10.3k|  context->dest = dest;
 4526|  10.3k|  context->destsize = destsize;
 4527|       |
 4528|  10.3k|  int result = blosc2_initialize_context_from_header(context, header);
 4529|  10.3k|  if (result < 0) {
  ------------------
  |  Branch (4529:7): [True: 0, False: 10.3k]
  ------------------
 4530|      0|    return result;
 4531|      0|  }
 4532|       |
 4533|  10.3k|  if (context->serial_context == NULL) {
  ------------------
  |  Branch (4533:7): [True: 10.3k, False: 0]
  ------------------
 4534|  10.3k|    context->serial_context = create_thread_context(context, 0);
 4535|  10.3k|  }
 4536|  10.3k|  BLOSC_ERROR_NULL(context->serial_context, BLOSC2_ERROR_THREAD_CREATE);
  ------------------
  |  |  104|  10.3k|    do {                                            \
  |  |  105|  10.3k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 10.3k]
  |  |  ------------------
  |  |  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|  10.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 10.3k]
  |  |  ------------------
  ------------------
 4537|       |  /* Call the actual getitem function */
 4538|  10.3k|  return _blosc_getitem(context, header, src, srcsize, start, nitems, dest, destsize);
 4539|  10.3k|}
blosc2.c:blosc2_initialize_context_from_header:
  862|  29.2k|static int blosc2_initialize_context_from_header(blosc2_context* context, blosc_header* header) {
  863|  29.2k|  context->header_flags = header->flags;
  864|  29.2k|  context->typesize = header->typesize;
  865|  29.2k|  context->sourcesize = header->nbytes;
  866|  29.2k|  context->header_blocksize = header->blocksize;
  867|  29.2k|  context->blocksize = header->blocksize;
  868|  29.2k|  context->blosc2_flags2 = header->blosc2_flags2;
  869|  29.2k|  context->blosc2_flags = header->blosc2_flags;
  870|  29.2k|  context->compcode = header->flags >> 5;
  871|  29.2k|  if (context->compcode == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (871:7): [True: 15.1k, False: 14.0k]
  ------------------
  872|  15.1k|    context->compcode = header->udcompcode;
  873|  15.1k|  }
  874|  29.2k|  if (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) {
  ------------------
  |  Branch (874:7): [True: 54, False: 29.2k]
  ------------------
  875|     54|    context->nblocks = header->blocksize;
  876|     54|    context->leftover = 0;
  877|     54|    context->blocksize = 0;
  878|     54|  }
  879|  29.2k|  else {
  880|  29.2k|    blosc2_calculate_blocks(context);
  881|  29.2k|  }
  882|       |
  883|  29.2k|  bool is_lazy = false;
  884|  29.2k|  if ((context->header_flags & BLOSC_DOSHUFFLE) &&
  ------------------
  |  Branch (884:7): [True: 28.9k, False: 316]
  ------------------
  885|  28.9k|      (context->header_flags & BLOSC_DOBITSHUFFLE)) {
  ------------------
  |  Branch (885:7): [True: 28.6k, False: 328]
  ------------------
  886|       |    /* Extended header */
  887|  28.6k|    context->header_overhead = BLOSC_EXTENDED_HEADER_LENGTH;
  888|       |
  889|  28.6k|    memcpy(context->filters, header->filters, BLOSC2_MAX_FILTERS);
  890|  28.6k|    memcpy(context->filters_meta, header->filters_meta, BLOSC2_MAX_FILTERS);
  891|  28.6k|    context->compcode_meta = header->compcode_meta;
  892|       |
  893|  28.6k|    context->filter_flags = filters_to_flags(header->filters);
  894|  28.6k|    context->special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
  895|       |
  896|  28.6k|    is_lazy = (context->blosc2_flags & 0x08u);
  897|  28.6k|  }
  898|    644|  else {
  899|    644|    context->header_overhead = BLOSC_MIN_HEADER_LENGTH;
  900|    644|    context->filter_flags = get_filter_flags(context->header_flags, context->typesize);
  901|    644|    flags_to_filters(context->header_flags, context->filters);
  902|    644|  }
  903|       |
  904|       |  // Some checks for malformed headers
  905|  29.2k|  if (!is_lazy && header->cbytes > context->srcsize) {
  ------------------
  |  Branch (905:7): [True: 27.9k, False: 1.27k]
  |  Branch (905:19): [True: 0, False: 27.9k]
  ------------------
  906|      0|    return BLOSC2_ERROR_INVALID_HEADER;
  907|      0|  }
  908|       |
  909|  29.2k|  return 0;
  910|  29.2k|}
blosc2.c:get_filter_flags:
  702|    644|                                const int32_t typesize) {
  703|    644|  uint8_t flags = 0;
  704|       |
  705|    644|  if ((header_flags & BLOSC_DOSHUFFLE) && (typesize > 1)) {
  ------------------
  |  Branch (705:7): [True: 328, False: 316]
  |  Branch (705:43): [True: 297, False: 31]
  ------------------
  706|    297|    flags |= BLOSC_DOSHUFFLE;
  707|    297|  }
  708|    644|  if (header_flags & BLOSC_DOBITSHUFFLE) {
  ------------------
  |  Branch (708:7): [True: 101, False: 543]
  ------------------
  709|    101|    flags |= BLOSC_DOBITSHUFFLE;
  710|    101|  }
  711|    644|  if (header_flags & BLOSC_DODELTA) {
  ------------------
  |  Branch (711:7): [True: 317, False: 327]
  ------------------
  712|    317|    flags |= BLOSC_DODELTA;
  713|    317|  }
  714|    644|  if (header_flags & BLOSC_MEMCPYED) {
  ------------------
  |  Branch (714:7): [True: 18, False: 626]
  ------------------
  715|     18|    flags |= BLOSC_MEMCPYED;
  716|     18|  }
  717|    644|  return flags;
  718|    644|}
blosc2.c:clear_context_decompression_dict:
 2550|  18.8k|static void clear_context_decompression_dict(blosc2_context* context) {
 2551|  18.8k|  context->use_dict = 0;
 2552|  18.8k|  release_context_dict_buffer(context);
 2553|  18.8k|#if defined(HAVE_ZSTD)
 2554|  18.8k|  if (context->dict_ddict != NULL) {
  ------------------
  |  Branch (2554:7): [True: 514, False: 18.3k]
  ------------------
 2555|    514|    ZSTD_freeDDict(context->dict_ddict);
 2556|    514|    context->dict_ddict = NULL;
 2557|    514|  }
 2558|       |#else
 2559|       |  context->dict_ddict = NULL;
 2560|       |#endif
 2561|  18.8k|}
blosc2.c:checked_mul_size:
  152|  15.4k|static inline bool checked_mul_size(size_t a, size_t b, size_t* out) {
  153|  15.4k|  if (a != 0 && b > SIZE_MAX / a) {
  ------------------
  |  Branch (153:7): [True: 15.4k, False: 26]
  |  Branch (153:17): [True: 0, False: 15.4k]
  ------------------
  154|      0|    return false;
  155|      0|  }
  156|  15.4k|  *out = a * b;
  157|       |  return true;
  158|  15.4k|}
blosc2.c:checked_add_size:
  160|  15.4k|static inline bool checked_add_size(size_t a, size_t b, size_t* out) {
  161|  15.4k|  if (a > SIZE_MAX - b) {
  ------------------
  |  Branch (161:7): [True: 0, False: 15.4k]
  ------------------
  162|      0|    return false;
  163|      0|  }
  164|  15.4k|  *out = a + b;
  165|       |  return true;
  166|  15.4k|}
blosc2.c:create_thread_context:
 2264|  19.7k|create_thread_context(blosc2_context* context, int32_t tid) {
 2265|  19.7k|  struct thread_context* thread_context;
 2266|  19.7k|  thread_context = (struct thread_context*)my_malloc(sizeof(struct thread_context));
 2267|  19.7k|  BLOSC_ERROR_NULL(thread_context, NULL);
  ------------------
  |  |  104|  19.7k|    do {                                            \
  |  |  105|  19.7k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 19.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|  19.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 19.7k]
  |  |  ------------------
  ------------------
 2268|  19.7k|  int rc = init_thread_context(thread_context, context, tid);
 2269|  19.7k|  if (rc < 0) {
  ------------------
  |  Branch (2269:7): [True: 0, False: 19.7k]
  ------------------
 2270|      0|    return NULL;
 2271|      0|  }
 2272|  19.7k|  return thread_context;
 2273|  19.7k|}
blosc2.c:init_thread_context:
 2234|  19.7k|{
 2235|  19.7k|  int32_t ebsize;
 2236|       |
 2237|  19.7k|  thread_context->parent_context = context;
 2238|  19.7k|  thread_context->owner_pool = NULL;
 2239|  19.7k|  thread_context->tid = tid;
 2240|       |
 2241|  19.7k|  int32_t blocksize = context != NULL ? context->blocksize : 0;
  ------------------
  |  Branch (2241:23): [True: 19.7k, False: 0]
  ------------------
 2242|  19.7k|  int32_t typesize = context != NULL ? context->typesize : 0;
  ------------------
  |  Branch (2242:22): [True: 19.7k, False: 0]
  ------------------
 2243|  19.7k|  ebsize = blocksize + typesize * (signed)sizeof(int32_t);
 2244|  19.7k|  thread_context->tmp_nbytes = (size_t)4 * ebsize;
 2245|  19.7k|  thread_context->tmp = my_malloc(thread_context->tmp_nbytes);
 2246|  19.7k|  BLOSC_ERROR_NULL(thread_context->tmp, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|  19.7k|    do {                                            \
  |  |  105|  19.7k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 19.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|  19.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 19.7k]
  |  |  ------------------
  ------------------
 2247|  19.7k|  thread_context->tmp2 = thread_context->tmp + ebsize;
 2248|  19.7k|  thread_context->tmp3 = thread_context->tmp2 + ebsize;
 2249|  19.7k|  thread_context->tmp4 = thread_context->tmp3 + ebsize;
 2250|  19.7k|  thread_context->tmp_blocksize = blocksize;
 2251|  19.7k|  thread_context->zfp_cell_nitems = 0;
 2252|  19.7k|  thread_context->zfp_cell_start = 0;
 2253|  19.7k|  #if defined(HAVE_ZSTD)
 2254|  19.7k|  thread_context->zstd_cctx = NULL;
 2255|  19.7k|  thread_context->zstd_dctx = NULL;
 2256|  19.7k|  #endif
 2257|  19.7k|  thread_context->lz4_cstream = NULL;
 2258|  19.7k|  thread_context->lz4hc_cstream = NULL;
 2259|       |
 2260|  19.7k|  return 0;
 2261|  19.7k|}
blosc2.c:release_thread_backend:
 5416|  38.9k|static int release_thread_backend(blosc2_context *context) {
 5417|  38.9k|  if (context->thread_backend == BLOSC_BACKEND_CALLBACK && context->threads_started > 0) {
  ------------------
  |  |   34|  77.8k|#define BLOSC_BACKEND_CALLBACK 2
  ------------------
  |  Branch (5417:7): [True: 0, False: 38.9k]
  |  Branch (5417:60): [True: 0, False: 0]
  ------------------
 5418|      0|    for (int32_t t = 0; t < context->threads_started; t++) {
  ------------------
  |  Branch (5418:25): [True: 0, False: 0]
  ------------------
 5419|      0|      destroy_thread_context(context->thread_contexts + t);
 5420|      0|    }
 5421|      0|    my_free(context->thread_contexts);
 5422|      0|    context->thread_contexts = NULL;
 5423|      0|    blosc2_pthread_mutex_destroy(&context->count_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 5424|      0|    blosc2_pthread_mutex_destroy(&context->delta_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 5425|      0|    blosc2_pthread_cond_destroy(&context->delta_cv);
  ------------------
  |  |   97|      0|#define blosc2_pthread_cond_destroy(a) pthread_cond_destroy((a))
  ------------------
 5426|      0|  }
 5427|       |#if defined(_WIN32)
 5428|       |  else if (context->thread_backend == BLOSC_BACKEND_PER_CONTEXT && context->threads_started > 0) {
 5429|       |    /* Signal all workers to exit. */
 5430|       |    blosc2_pthread_mutex_lock(&context->jobs_mutex);
 5431|       |    context->end_threads = 1;
 5432|       |    blosc2_pthread_cond_broadcast(&context->jobs_ready);
 5433|       |    blosc2_pthread_mutex_unlock(&context->jobs_mutex);
 5434|       |
 5435|       |    for (int32_t t = 0; t < context->threads_started; t++) {
 5436|       |      blosc2_pthread_join(context->threads[t], NULL);
 5437|       |    }
 5438|       |    my_free(context->threads);
 5439|       |    context->threads = NULL;
 5440|       |    blosc2_pthread_cond_destroy(&context->jobs_done);
 5441|       |    blosc2_pthread_cond_destroy(&context->jobs_ready);
 5442|       |    blosc2_pthread_mutex_destroy(&context->jobs_mutex);
 5443|       |    blosc2_pthread_cond_destroy(&context->delta_cv);
 5444|       |    blosc2_pthread_mutex_destroy(&context->delta_mutex);
 5445|       |    blosc2_pthread_mutex_destroy(&context->count_mutex);
 5446|       |  }
 5447|       |#endif  /* _WIN32 */
 5448|  38.9k|  else if (context->thread_backend == BLOSC_BACKEND_SHARED_POOL && context->thread_pool != NULL) {
  ------------------
  |  |   33|  77.8k|#define BLOSC_BACKEND_SHARED_POOL 1
  ------------------
  |  Branch (5448:12): [True: 0, False: 38.9k]
  |  Branch (5448:68): [True: 0, False: 0]
  ------------------
 5449|      0|    struct blosc_shared_pool *pool = context->thread_pool;
 5450|      0|    struct blosc_shared_pool **prev;
 5451|      0|    bool destroy_pool = false;
 5452|       |
 5453|      0|    if (context->pool_epoch != g_destroy_count) {
  ------------------
  |  Branch (5453:9): [True: 0, False: 0]
  ------------------
 5454|       |      /* blosc2_destroy() already freed this pool and tore down pool_registry_mutex.
 5455|       |       * Just clear the dangling pointer; nothing else to do. */
 5456|      0|      context->thread_pool = NULL;
 5457|      0|      context->threads_started = 0;
 5458|      0|      context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   32|      0|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 5459|      0|      return 0;
 5460|      0|    }
 5461|       |
 5462|      0|    blosc2_pthread_mutex_lock(&pool_registry_mutex);
  ------------------
  |  |   92|      0|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
 5463|      0|    pool->context_refs--;
 5464|      0|    if (pool->context_refs == 0) {
  ------------------
  |  Branch (5464:9): [True: 0, False: 0]
  ------------------
 5465|       |      /* Check pool-internal state under the pool's own mutex */
 5466|      0|      blosc2_pthread_mutex_lock(&pool->mutex);
  ------------------
  |  |   92|      0|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
 5467|      0|      bool idle = (pool->active_jobs == 0 && pool->job_queue_head == NULL);
  ------------------
  |  Branch (5467:20): [True: 0, False: 0]
  |  Branch (5467:46): [True: 0, False: 0]
  ------------------
 5468|      0|      blosc2_pthread_mutex_unlock(&pool->mutex);
  ------------------
  |  |   93|      0|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 5469|      0|      if (idle) {
  ------------------
  |  Branch (5469:11): [True: 0, False: 0]
  ------------------
 5470|      0|        prev = &shared_pools;
 5471|      0|        while (*prev != NULL && *prev != pool) {
  ------------------
  |  Branch (5471:16): [True: 0, False: 0]
  |  Branch (5471:33): [True: 0, False: 0]
  ------------------
 5472|      0|          prev = &(*prev)->next;
 5473|      0|        }
 5474|      0|        if (*prev == pool) {
  ------------------
  |  Branch (5474:13): [True: 0, False: 0]
  ------------------
 5475|      0|          *prev = pool->next;
 5476|      0|        }
 5477|      0|        destroy_pool = true;
 5478|      0|      }
 5479|      0|    }
 5480|      0|    blosc2_pthread_mutex_unlock(&pool_registry_mutex);
  ------------------
  |  |   93|      0|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 5481|      0|    if (destroy_pool) {
  ------------------
  |  Branch (5481:9): [True: 0, False: 0]
  ------------------
 5482|      0|      destroy_shared_pool(pool);
 5483|      0|    }
 5484|      0|    context->thread_pool = NULL;
 5485|      0|  }
 5486|       |
 5487|  38.9k|  context->threads_started = 0;
 5488|  38.9k|  context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   32|  38.9k|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 5489|  38.9k|  return 0;
 5490|  38.9k|}
blosc2.c:release_context_dict_buffer:
 2540|  57.7k|static void release_context_dict_buffer(blosc2_context* context) {
 2541|  57.7k|  if (context->dict_buffer_owned && context->dict_buffer != NULL) {
  ------------------
  |  Branch (2541:7): [True: 0, False: 57.7k]
  |  Branch (2541:37): [True: 0, False: 0]
  ------------------
 2542|      0|    free(context->dict_buffer);
 2543|      0|  }
 2544|  57.7k|  context->dict_buffer = NULL;
 2545|       |  context->dict_buffer_owned = false;
 2546|  57.7k|  context->dict_size = 0;
 2547|  57.7k|}

blosclz_decompress:
  685|    233|int blosclz_decompress(const void* input, int length, void* output, int maxout) {
  686|    233|  const uint8_t* ip = (const uint8_t*)input;
  687|    233|  const uint8_t* ip_limit = ip + length;
  688|    233|  uint8_t* op = (uint8_t*)output;
  689|    233|  uint32_t ctrl;
  690|    233|  uint8_t* op_limit = op + maxout;
  691|    233|  if (BLOSCLZ_UNLIKELY(length == 0)) {
  ------------------
  |  |   35|    233|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 0, False: 233]
  |  |  ------------------
  ------------------
  692|      0|    return 0;
  693|      0|  }
  694|    233|  ctrl = (*ip++) & 31U;
  695|       |
  696|  31.1k|  while (1) {
  ------------------
  |  Branch (696:10): [True: 31.1k, Folded]
  ------------------
  697|  31.1k|    if (ctrl >= 32) {
  ------------------
  |  Branch (697:9): [True: 16.9k, False: 14.1k]
  ------------------
  698|       |      // match
  699|  16.9k|      int32_t len = (int32_t)(ctrl >> 5U) - 1 ;
  700|  16.9k|      int32_t ofs = (int32_t)(ctrl & 31U) << 8U;
  701|  16.9k|      uint8_t code;
  702|  16.9k|      const uint8_t* ref = op - ofs;
  703|       |
  704|  16.9k|      if (len == 7 - 1) {
  ------------------
  |  Branch (704:11): [True: 12.5k, False: 4.40k]
  ------------------
  705|  29.5k|        do {
  706|  29.5k|          if (BLOSCLZ_UNLIKELY(ip + 1 >= ip_limit)) {
  ------------------
  |  |   35|  29.5k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 1, False: 29.5k]
  |  |  ------------------
  ------------------
  707|      1|            return 0;
  708|      1|          }
  709|  29.5k|          code = *ip++;
  710|  29.5k|          len += code;
  711|  29.5k|          if (BLOSCLZ_UNLIKELY(len > maxout)) {
  ------------------
  |  |   35|  29.5k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 2, False: 29.5k]
  |  |  ------------------
  ------------------
  712|      2|            return 0;
  713|      2|          }
  714|  29.5k|        } while (code == 255);
  ------------------
  |  Branch (714:18): [True: 16.9k, False: 12.5k]
  ------------------
  715|  12.5k|      }
  716|  4.40k|      else {
  717|  4.40k|        if (BLOSCLZ_UNLIKELY(ip + 1 >= ip_limit)) {
  ------------------
  |  |   35|  4.40k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 14, False: 4.38k]
  |  |  ------------------
  ------------------
  718|     14|          return 0;
  719|     14|        }
  720|  4.40k|      }
  721|  16.9k|      code = *ip++;
  722|  16.9k|      len += 3;
  723|  16.9k|      ref -= code;
  724|       |
  725|       |      /* match from 16-bit distance */
  726|  16.9k|      if (BLOSCLZ_UNLIKELY(code == 255)) {
  ------------------
  |  |   35|  16.9k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 3.28k, False: 13.6k]
  |  |  ------------------
  ------------------
  727|  3.28k|        if (ofs == (31U << 8U)) {
  ------------------
  |  Branch (727:13): [True: 2.97k, False: 309]
  ------------------
  728|  2.97k|          if (ip + 1 >= ip_limit) {
  ------------------
  |  Branch (728:15): [True: 0, False: 2.97k]
  ------------------
  729|      0|            return 0;
  730|      0|          }
  731|  2.97k|          ofs = (*ip++) << 8U;
  732|  2.97k|          ofs += *ip++;
  733|  2.97k|          ref = op - ofs - MAX_DISTANCE;
  ------------------
  |  |   46|  2.97k|#define MAX_DISTANCE 8191
  ------------------
  734|  2.97k|        }
  735|  3.28k|      }
  736|       |
  737|  16.9k|      if (BLOSCLZ_UNLIKELY(len > op_limit - op)) {
  ------------------
  |  |   35|  16.9k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 23, False: 16.9k]
  |  |  ------------------
  ------------------
  738|     23|        return 0;
  739|     23|      }
  740|       |
  741|  16.9k|      if (BLOSCLZ_UNLIKELY(ref <= (uint8_t*)output)) {
  ------------------
  |  |   35|  16.9k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 87, False: 16.8k]
  |  |  ------------------
  ------------------
  742|     87|        return 0;
  743|     87|      }
  744|       |
  745|  16.8k|      if (BLOSCLZ_UNLIKELY(ip >= ip_limit)) break;
  ------------------
  |  |   35|  16.8k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 2, False: 16.8k]
  |  |  ------------------
  ------------------
  746|  16.8k|      ctrl = *ip++;
  747|       |
  748|  16.8k|      ref--;
  749|  16.8k|      if (ref == op - 1) {
  ------------------
  |  Branch (749:11): [True: 6.73k, False: 10.1k]
  ------------------
  750|       |        /* optimized copy for a run */
  751|  6.73k|        memset(op, *ref, len);
  752|  6.73k|        op += len;
  753|  6.73k|      }
  754|  10.1k|      else if ((op - ref >= 8) && (op_limit - op >= len + 8)) {
  ------------------
  |  Branch (754:16): [True: 8.80k, False: 1.33k]
  |  Branch (754:35): [True: 8.71k, False: 88]
  ------------------
  755|       |        // copy with an overlap not larger than 8
  756|  8.71k|        wild_copy(op, ref, op + len);
  757|  8.71k|        op += len;
  758|  8.71k|      }
  759|  1.41k|      else {
  760|       |        // general copy with any overlap
  761|       |#if 0 && defined(__AVX2__)
  762|       |        if (op - ref <= 16) {
  763|       |          // This is not faster on a combination of compilers (clang, gcc, icc) or machines, but
  764|       |          // it is not too slower either.
  765|       |          op = copy_match_16(op, ref, len);
  766|       |        }
  767|       |        else {
  768|       |#endif
  769|  1.41k|          op = copy_match(op, ref, (unsigned) len);
  770|       |#if 0 && defined(__AVX2__)
  771|       |        }
  772|       |#endif
  773|  1.41k|      }
  774|  16.8k|    }
  775|  14.1k|    else {
  776|       |      // literal
  777|  14.1k|      ctrl++;
  778|  14.1k|      if (BLOSCLZ_UNLIKELY(ctrl > op_limit - op)) {
  ------------------
  |  |   35|  14.1k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 17, False: 14.1k]
  |  |  ------------------
  ------------------
  779|     17|        return 0;
  780|     17|      }
  781|  14.1k|      if (BLOSCLZ_UNLIKELY(ctrl > ip_limit - ip)) {
  ------------------
  |  |   35|  14.1k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 14, False: 14.0k]
  |  |  ------------------
  ------------------
  782|     14|        return 0;
  783|     14|      }
  784|       |
  785|  14.0k|      memcpy(op, ip, ctrl); op += ctrl; ip += ctrl;
  786|       |      // On GCC-6, fastcopy this is still faster than plain memcpy
  787|       |      // However, using recent CLANG/LLVM 9.0, there is almost no difference
  788|       |      // in performance.
  789|       |      // And starting on CLANG/LLVM 10 and GCC 9, memcpy is generally faster.
  790|       |      // op = fastcopy(op, ip, (unsigned) ctrl); ip += ctrl;
  791|       |
  792|  14.0k|      if (BLOSCLZ_UNLIKELY(ip >= ip_limit)) break;
  ------------------
  |  |   35|  14.0k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 73, False: 14.0k]
  |  |  ------------------
  ------------------
  793|  14.0k|      ctrl = *ip++;
  794|  14.0k|    }
  795|  31.1k|  }
  796|       |
  797|     75|  return (int)(op - (uint8_t*)output);
  798|    233|}
blosclz.c:wild_copy:
  677|  8.71k|static inline void wild_copy(uint8_t *out, const uint8_t* from, uint8_t* end) {
  678|  8.71k|  uint8_t* d = out;
  679|  8.71k|  const uint8_t* s = from;
  680|  8.71k|  uint8_t* const e = end;
  681|       |
  682|   221k|  do { memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  Branch (682:44): [True: 212k, False: 8.71k]
  ------------------
  683|  8.71k|}

delta_decoder:
   97|  27.1k|                   int32_t typesize, uint8_t* dest) {
   98|  27.1k|  int32_t i;
   99|       |
  100|  27.1k|  if (offset == 0) {
  ------------------
  |  Branch (100:7): [True: 19.2k, False: 7.90k]
  ------------------
  101|       |    /* Decode delta for the reference block */
  102|  19.2k|    switch (typesize) {
  103|  8.19k|      case 1:
  ------------------
  |  Branch (103:7): [True: 8.19k, False: 11.0k]
  ------------------
  104|   922M|        for (i = 1; i < nbytes; i++) {
  ------------------
  |  Branch (104:21): [True: 922M, False: 8.19k]
  ------------------
  105|   922M|          dest[i] ^= dref[i-1];
  106|   922M|        }
  107|  8.19k|        break;
  108|     54|      case 2:
  ------------------
  |  Branch (108:7): [True: 54, False: 19.1k]
  ------------------
  109|  4.16M|        for (i = 1; i < nbytes / 2; i++) {
  ------------------
  |  Branch (109:21): [True: 4.16M, False: 54]
  ------------------
  110|  4.16M|          ((uint16_t *)dest)[i] ^= ((uint16_t *)dref)[i-1];
  111|  4.16M|        }
  112|     54|        break;
  113|     24|      case 4:
  ------------------
  |  Branch (113:7): [True: 24, False: 19.2k]
  ------------------
  114|   167M|        for (i = 1; i < nbytes / 4; i++) {
  ------------------
  |  Branch (114:21): [True: 167M, False: 24]
  ------------------
  115|   167M|          ((uint32_t *)dest)[i] ^= ((uint32_t *)dref)[i-1];
  116|   167M|        }
  117|     24|        break;
  118|  2.80k|      case 8:
  ------------------
  |  Branch (118:7): [True: 2.80k, False: 16.4k]
  ------------------
  119|   248M|        for (i = 1; i < nbytes / 8; i++) {
  ------------------
  |  Branch (119:21): [True: 248M, False: 2.80k]
  ------------------
  120|   248M|          ((uint64_t *)dest)[i] ^= ((uint64_t *)dref)[i-1];
  121|   248M|        }
  122|  2.80k|        break;
  123|  8.16k|      default:
  ------------------
  |  Branch (123:7): [True: 8.16k, False: 11.0k]
  ------------------
  124|  8.16k|        if ((typesize % 8) == 0) {
  ------------------
  |  Branch (124:13): [True: 23, False: 8.14k]
  ------------------
  125|     23|          delta_decoder(dref, offset, nbytes, 8, dest);
  126|  8.14k|        } else {
  127|  8.14k|          delta_decoder(dref, offset, nbytes, 1, dest);
  128|  8.14k|        }
  129|  19.2k|    }
  130|  19.2k|  } else {
  131|       |    /* Decode delta for the non-reference blocks */
  132|  7.90k|    switch (typesize) {
  133|  3.23k|      case 1:
  ------------------
  |  Branch (133:7): [True: 3.23k, False: 4.66k]
  ------------------
  134|  70.5M|        for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (134:21): [True: 70.5M, False: 3.23k]
  ------------------
  135|  70.5M|          dest[i] ^= dref[i];
  136|  70.5M|        }
  137|  3.23k|        break;
  138|     21|      case 2:
  ------------------
  |  Branch (138:7): [True: 21, False: 7.88k]
  ------------------
  139|  3.93M|        for (i = 0; i < nbytes / 2; i++) {
  ------------------
  |  Branch (139:21): [True: 3.93M, False: 21]
  ------------------
  140|  3.93M|          ((uint16_t *)dest)[i] ^= ((uint16_t *)dref)[i];
  141|  3.93M|        }
  142|     21|        break;
  143|      8|      case 4:
  ------------------
  |  Branch (143:7): [True: 8, False: 7.89k]
  ------------------
  144|  67.0M|        for (i = 0; i < nbytes / 4; i++) {
  ------------------
  |  Branch (144:21): [True: 67.0M, False: 8]
  ------------------
  145|  67.0M|          ((uint32_t *)dest)[i] ^= ((uint32_t *)dref)[i];
  146|  67.0M|        }
  147|      8|        break;
  148|  1.39k|      case 8:
  ------------------
  |  Branch (148:7): [True: 1.39k, False: 6.50k]
  ------------------
  149|   108M|        for (i = 0; i < nbytes / 8; i++) {
  ------------------
  |  Branch (149:21): [True: 108M, False: 1.39k]
  ------------------
  150|   108M|          ((uint64_t *)dest)[i] ^= ((uint64_t *)dref)[i];
  151|   108M|        }
  152|  1.39k|        break;
  153|  3.23k|      default:
  ------------------
  |  Branch (153:7): [True: 3.23k, False: 4.66k]
  ------------------
  154|  3.23k|        if ((typesize % 8) == 0) {
  ------------------
  |  Branch (154:13): [True: 22, False: 3.21k]
  ------------------
  155|     22|          delta_decoder(dref, offset, nbytes, 8, dest);
  156|  3.21k|        } else {
  157|  3.21k|          delta_decoder(dref, offset, nbytes, 1, dest);
  158|  3.21k|        }
  159|  7.90k|    }
  160|  7.90k|  }
  161|  27.1k|}

fastcopy:
  504|     81|unsigned char *fastcopy(unsigned char *out, const unsigned char *from, unsigned len) {
  505|     81|  switch (len) {
  506|      1|    case 32:
  ------------------
  |  Branch (506:5): [True: 1, False: 80]
  ------------------
  507|      1|      return copy_32_bytes(out, from);
  508|      0|    case 16:
  ------------------
  |  Branch (508:5): [True: 0, False: 81]
  ------------------
  509|      0|      return copy_16_bytes(out, from);
  510|      2|    case 8:
  ------------------
  |  Branch (510:5): [True: 2, False: 79]
  ------------------
  511|      2|      return copy_8_bytes(out, from);
  512|     78|    default: {
  ------------------
  |  Branch (512:5): [True: 78, False: 3]
  ------------------
  513|     78|    }
  514|     81|  }
  515|     78|  if (len < 8) {
  ------------------
  |  Branch (515:7): [True: 23, False: 55]
  ------------------
  516|     23|    return copy_bytes(out, from, len);
  517|     23|  }
  518|     55|#if defined(__SSE2__)
  519|     55|  if (len < 16) {
  ------------------
  |  Branch (519:7): [True: 1, False: 54]
  ------------------
  520|      1|    return chunk_memcpy(out, from, len);
  521|      1|  }
  522|     54|#if !defined(__AVX2__)
  523|     54|  return chunk_memcpy_unaligned(out, from, len);
  524|       |#else
  525|       |  if (len < 32) {
  526|       |    return chunk_memcpy_16(out, from, len);
  527|       |  }
  528|       |  return chunk_memcpy_unaligned(out, from, len);
  529|       |#endif  // !__AVX2__
  530|       |#else
  531|       |  return chunk_memcpy(out, from, len);
  532|       |#endif  // __SSE2__
  533|     55|}
copy_match:
  537|  1.41k|unsigned char* copy_match(unsigned char *out, const unsigned char *from, unsigned len) {
  538|       |#if defined(__AVX2__)
  539|       |  unsigned sz = sizeof(__m256i);
  540|       |#elif defined(__SSE2__)
  541|       |  unsigned sz = sizeof(__m128i);
  542|       |#else
  543|       |  unsigned sz = sizeof(uint64_t);
  544|       |#endif
  545|       |
  546|       |#if ((defined(__GNUC__) && BLOSC_GCC_VERSION < 800) && !defined(__clang__) && !defined(__ICC) && !defined(__ICL))
  547|       |  // GCC < 8 in fully optimization mode seems to have problems with the code further below so stop here
  548|       |  for (; len > 0; len--) {
  549|       |    *out++ = *from++;
  550|       |  }
  551|       |  return out;
  552|       |#endif
  553|       |
  554|       |  // If out and from are away more than the size of the copy, then a fastcopy is safe
  555|  1.41k|  unsigned overlap_dist = (unsigned) (out - from);
  556|  1.41k|  if (overlap_dist > sz) {
  ------------------
  |  Branch (556:7): [True: 81, False: 1.33k]
  ------------------
  557|     81|    return fastcopy(out, from, len);
  558|     81|  }
  559|       |
  560|       |  // Otherwise we need to be more careful so as not to overwrite destination
  561|  1.33k|  switch (overlap_dist) {
  562|      0|    case 32:
  ------------------
  |  Branch (562:5): [True: 0, False: 1.33k]
  ------------------
  563|      0|      for (; len >= 32; len -= 32) {
  ------------------
  |  Branch (563:14): [True: 0, False: 0]
  ------------------
  564|      0|        out = copy_32_bytes(out, from);
  565|      0|      }
  566|      0|      break;
  567|      0|    case 30:
  ------------------
  |  Branch (567:5): [True: 0, False: 1.33k]
  ------------------
  568|      0|      for (; len >= 30; len -= 30) {
  ------------------
  |  Branch (568:14): [True: 0, False: 0]
  ------------------
  569|      0|        out = copy_16_bytes(out, from);
  570|      0|        out = copy_8_bytes(out, from + 16);
  571|      0|        out = copy_4_bytes(out, from + 24);
  572|      0|        out = copy_2_bytes(out, from + 28);
  573|      0|      }
  574|      0|      break;
  575|      0|    case 28:
  ------------------
  |  Branch (575:5): [True: 0, False: 1.33k]
  ------------------
  576|      0|      for (; len >= 28; len -= 28) {
  ------------------
  |  Branch (576:14): [True: 0, False: 0]
  ------------------
  577|      0|        out = copy_16_bytes(out, from);
  578|      0|        out = copy_8_bytes(out, from + 16);
  579|      0|        out = copy_4_bytes(out, from + 24);
  580|      0|      }
  581|      0|      break;
  582|      0|    case 26:
  ------------------
  |  Branch (582:5): [True: 0, False: 1.33k]
  ------------------
  583|      0|      for (; len >= 26; len -= 26) {
  ------------------
  |  Branch (583:14): [True: 0, False: 0]
  ------------------
  584|      0|        out = copy_16_bytes(out, from);
  585|      0|        out = copy_8_bytes(out, from + 16);
  586|      0|        out = copy_2_bytes(out, from + 24);
  587|      0|      }
  588|      0|      break;
  589|      0|    case 24:
  ------------------
  |  Branch (589:5): [True: 0, False: 1.33k]
  ------------------
  590|      0|      for (; len >= 24; len -= 24) {
  ------------------
  |  Branch (590:14): [True: 0, False: 0]
  ------------------
  591|      0|        out = copy_16_bytes(out, from);
  592|      0|        out = copy_8_bytes(out, from + 16);
  593|      0|      }
  594|      0|      break;
  595|      0|    case 22:
  ------------------
  |  Branch (595:5): [True: 0, False: 1.33k]
  ------------------
  596|      0|      for (; len >= 22; len -= 22) {
  ------------------
  |  Branch (596:14): [True: 0, False: 0]
  ------------------
  597|      0|        out = copy_16_bytes(out, from);
  598|      0|        out = copy_4_bytes(out, from + 16);
  599|      0|        out = copy_2_bytes(out, from + 20);
  600|      0|      }
  601|      0|      break;
  602|      0|    case 20:
  ------------------
  |  Branch (602:5): [True: 0, False: 1.33k]
  ------------------
  603|      0|      for (; len >= 20; len -= 20) {
  ------------------
  |  Branch (603:14): [True: 0, False: 0]
  ------------------
  604|      0|        out = copy_16_bytes(out, from);
  605|      0|        out = copy_4_bytes(out, from + 16);
  606|      0|      }
  607|      0|      break;
  608|      0|    case 18:
  ------------------
  |  Branch (608:5): [True: 0, False: 1.33k]
  ------------------
  609|      0|      for (; len >= 18; len -= 18) {
  ------------------
  |  Branch (609:14): [True: 0, False: 0]
  ------------------
  610|      0|        out = copy_16_bytes(out, from);
  611|      0|        out = copy_2_bytes(out, from + 16);
  612|      0|      }
  613|      0|      break;
  614|      3|    case 16:
  ------------------
  |  Branch (614:5): [True: 3, False: 1.33k]
  ------------------
  615|    528|      for (; len >= 16; len -= 16) {
  ------------------
  |  Branch (615:14): [True: 525, False: 3]
  ------------------
  616|    525|        out = copy_16_bytes(out, from);
  617|    525|      }
  618|      3|      break;
  619|      4|    case 8:
  ------------------
  |  Branch (619:5): [True: 4, False: 1.33k]
  ------------------
  620|  2.19k|      for (; len >= 8; len -= 8) {
  ------------------
  |  Branch (620:14): [True: 2.19k, False: 4]
  ------------------
  621|  2.19k|        out = copy_8_bytes(out, from);
  622|  2.19k|      }
  623|      4|      break;
  624|    425|    case 4:
  ------------------
  |  Branch (624:5): [True: 425, False: 912]
  ------------------
  625|   147k|      for (; len >= 4; len -= 4) {
  ------------------
  |  Branch (625:14): [True: 147k, False: 425]
  ------------------
  626|   147k|        out = copy_4_bytes(out, from);
  627|   147k|      }
  628|    425|      break;
  629|    629|    case 2:
  ------------------
  |  Branch (629:5): [True: 629, False: 708]
  ------------------
  630|  67.6k|      for (; len >= 2; len -= 2) {
  ------------------
  |  Branch (630:14): [True: 66.9k, False: 629]
  ------------------
  631|  66.9k|        out = copy_2_bytes(out, from);
  632|  66.9k|      }
  633|    629|      break;
  634|    276|    default:
  ------------------
  |  Branch (634:5): [True: 276, False: 1.06k]
  ------------------
  635|   131k|      for (; len > 0; len--) {
  ------------------
  |  Branch (635:14): [True: 131k, False: 276]
  ------------------
  636|   131k|        *out++ = *from++;
  637|   131k|      }
  638|  1.33k|  }
  639|       |
  640|       |  // Copy the leftovers
  641|  2.28k|  for (; len > 0; len--) {
  ------------------
  |  Branch (641:10): [True: 949, False: 1.33k]
  ------------------
  642|    949|    *out++ = *from++;
  643|    949|  }
  644|       |
  645|  1.33k|  return out;
  646|  1.33k|}
fastcopy.c:copy_32_bytes:
  118|      1|static inline unsigned char *copy_32_bytes(unsigned char *out, const unsigned char *from) {
  119|       |#if defined(__AVX2__)
  120|       |  __m256i chunk;
  121|       |  chunk = _mm256_loadu_si256((__m256i*)from);
  122|       |  _mm256_storeu_si256((__m256i*)out, chunk);
  123|       |  out += 32;
  124|       |#elif defined(__SSE2__)
  125|       |  __m128i chunk;
  126|      1|  chunk = _mm_loadu_si128((__m128i*)from);
  127|      1|  _mm_storeu_si128((__m128i*)out, chunk);
  128|      1|  from += 16; out += 16;
  129|      1|  chunk = _mm_loadu_si128((__m128i*)from);
  130|      1|  _mm_storeu_si128((__m128i*)out, chunk);
  131|      1|  out += 16;
  132|       |#elif !defined(BLOSC_STRICT_ALIGN)
  133|       |  *(uint64_t*)out = *(uint64_t*)from;
  134|       |  from += 8; out += 8;
  135|       |  *(uint64_t*)out = *(uint64_t*)from;
  136|       |  from += 8; out += 8;
  137|       |  *(uint64_t*)out = *(uint64_t*)from;
  138|       |  from += 8; out += 8;
  139|       |  *(uint64_t*)out = *(uint64_t*)from;
  140|       |  from += 8; out += 8;
  141|       |#else
  142|       |  int i;
  143|       |  for (i = 0; i < 32; i++) {
  144|       |    *out++ = *from++;
  145|       |  }
  146|       |#endif
  147|      1|  return out;
  148|      1|}
fastcopy.c:copy_16_bytes:
   98|  99.1k|static inline unsigned char *copy_16_bytes(unsigned char *out, const unsigned char *from) {
   99|  99.1k|#if defined(__SSE2__)
  100|  99.1k|  __m128i chunk;
  101|  99.1k|  chunk = _mm_loadu_si128((__m128i*)from);
  102|  99.1k|  _mm_storeu_si128((__m128i*)out, chunk);
  103|  99.1k|  out += 16;
  104|       |#elif !defined(BLOSC_STRICT_ALIGN)
  105|       |  *(uint64_t*)out = *(uint64_t*)from;
  106|       |   from += 8; out += 8;
  107|       |   *(uint64_t*)out = *(uint64_t*)from;
  108|       |   from += 8; out += 8;
  109|       |#else
  110|       |   int i;
  111|       |   for (i = 0; i < 16; i++) {
  112|       |     *out++ = *from++;
  113|       |   }
  114|       |#endif
  115|  99.1k|  return out;
  116|  99.1k|}
fastcopy.c:copy_8_bytes:
   86|  2.19k|static inline unsigned char *copy_8_bytes(unsigned char *out, const unsigned char *from) {
   87|       |#if defined(BLOSC_STRICT_ALIGN)
   88|       |  uint64_t chunk;
   89|       |  memcpy(&chunk, from, 8);
   90|       |  memcpy(out, &chunk, 8);
   91|       |#else
   92|  2.19k|  *(uint64_t *) out = *(uint64_t *) from;
   93|  2.19k|#endif
   94|  2.19k|  return out + 8;
   95|  2.19k|}
fastcopy.c:copy_bytes:
  161|     23|static inline unsigned char *copy_bytes(unsigned char *out, const unsigned char *from, unsigned len) {
  162|     23|  assert(len < 8);
  163|       |
  164|       |#ifdef BLOSC_STRICT_ALIGN
  165|       |  while (len--) {
  166|       |    *out++ = *from++;
  167|       |  }
  168|       |#else
  169|     23|  switch (len) {
  170|      5|    case 7:
  ------------------
  |  Branch (170:5): [True: 5, False: 18]
  ------------------
  171|      5|      return copy_7_bytes(out, from);
  172|      4|    case 6:
  ------------------
  |  Branch (172:5): [True: 4, False: 19]
  ------------------
  173|      4|      return copy_6_bytes(out, from);
  174|      3|    case 5:
  ------------------
  |  Branch (174:5): [True: 3, False: 20]
  ------------------
  175|      3|      return copy_5_bytes(out, from);
  176|      3|    case 4:
  ------------------
  |  Branch (176:5): [True: 3, False: 20]
  ------------------
  177|      3|      return copy_4_bytes(out, from);
  178|      8|    case 3:
  ------------------
  |  Branch (178:5): [True: 8, False: 15]
  ------------------
  179|      8|      return copy_3_bytes(out, from);
  180|      0|    case 2:
  ------------------
  |  Branch (180:5): [True: 0, False: 23]
  ------------------
  181|      0|      return copy_2_bytes(out, from);
  182|      0|    case 1:
  ------------------
  |  Branch (182:5): [True: 0, False: 23]
  ------------------
  183|      0|      return copy_1_bytes(out, from);
  184|      0|    case 0:
  ------------------
  |  Branch (184:5): [True: 0, False: 23]
  ------------------
  185|      0|      return out;
  186|      0|    default:
  ------------------
  |  Branch (186:5): [True: 0, False: 23]
  ------------------
  187|      0|      assert(0);
  188|     23|  }
  189|      0|#endif /* BLOSC_STRICT_ALIGN */
  190|      0|  return out;
  191|     23|}
fastcopy.c:copy_7_bytes:
   80|      5|static inline unsigned char *copy_7_bytes(unsigned char *out, const unsigned char *from) {
   81|      5|  out = copy_3_bytes(out, from);
   82|      5|  return copy_4_bytes(out, from + 3);
   83|      5|}
fastcopy.c:copy_6_bytes:
   75|      4|static inline unsigned char *copy_6_bytes(unsigned char *out, const unsigned char *from) {
   76|      4|  out = copy_2_bytes(out, from);
   77|      4|  return copy_4_bytes(out, from + 2);
   78|      4|}
fastcopy.c:copy_5_bytes:
   70|      3|static inline unsigned char *copy_5_bytes(unsigned char *out, const unsigned char *from) {
   71|      3|  out = copy_1_bytes(out, from);
   72|      3|  return copy_4_bytes(out, from + 1);
   73|      3|}
fastcopy.c:copy_3_bytes:
   65|     13|static inline unsigned char *copy_3_bytes(unsigned char *out, const unsigned char *from) {
   66|     13|  out = copy_1_bytes(out, from);
   67|     13|  return copy_2_bytes(out, from + 1);
   68|     13|}
fastcopy.c:copy_1_bytes:
   60|     16|static inline unsigned char *copy_1_bytes(unsigned char *out, const unsigned char *from) {
   61|     16|  *out++ = *from;
   62|     16|  return out;
   63|     16|}
fastcopy.c:chunk_memcpy:
  200|      1|static inline unsigned char *chunk_memcpy(unsigned char *out, const unsigned char *from, unsigned len) {
  201|      1|  unsigned sz = sizeof(uint64_t);
  202|      1|  unsigned rem = len % sz;
  203|      1|  unsigned by8;
  204|       |
  205|      1|  assert(len >= sz);
  206|       |
  207|       |  /* Copy a few bytes to make sure the loop below has a multiple of SZ bytes to be copied. */
  208|      1|  copy_8_bytes(out, from);
  209|       |
  210|      1|  len /= sz;
  211|      1|  out += rem;
  212|      1|  from += rem;
  213|       |
  214|      1|  by8 = len % 8;
  215|      1|  len -= by8;
  216|      1|  switch (by8) {
  217|      0|    case 7:
  ------------------
  |  Branch (217:5): [True: 0, False: 1]
  ------------------
  218|      0|      out = copy_8_bytes(out, from);
  219|      0|      from += sz;
  220|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  221|       |      __attribute__ ((fallthrough));  // Shut-up -Wimplicit-fallthrough warning in GCC
  222|       |      #endif
  223|      0|    case 6:
  ------------------
  |  Branch (223:5): [True: 0, False: 1]
  ------------------
  224|      0|      out = copy_8_bytes(out, from);
  225|      0|      from += sz;
  226|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  227|       |      __attribute__ ((fallthrough));
  228|       |      #endif
  229|      0|    case 5:
  ------------------
  |  Branch (229:5): [True: 0, False: 1]
  ------------------
  230|      0|      out = copy_8_bytes(out, from);
  231|      0|      from += sz;
  232|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  233|       |      __attribute__ ((fallthrough));
  234|       |      #endif
  235|      0|    case 4:
  ------------------
  |  Branch (235:5): [True: 0, False: 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 3:
  ------------------
  |  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 2:
  ------------------
  |  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|      1|    case 1:
  ------------------
  |  Branch (253:5): [True: 1, False: 0]
  ------------------
  254|      1|      out = copy_8_bytes(out, from);
  255|      1|      from += sz;
  256|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  257|       |      __attribute__ ((fallthrough));
  258|       |      #endif
  259|      1|    default:
  ------------------
  |  Branch (259:5): [True: 0, False: 1]
  ------------------
  260|      1|      break;
  261|      1|  }
  262|       |
  263|      1|  while (len) {
  ------------------
  |  Branch (263:10): [True: 0, False: 1]
  ------------------
  264|      0|    out = copy_8_bytes(out, from);
  265|      0|    from += sz;
  266|      0|    out = copy_8_bytes(out, from);
  267|      0|    from += sz;
  268|      0|    out = copy_8_bytes(out, from);
  269|      0|    from += sz;
  270|      0|    out = copy_8_bytes(out, from);
  271|      0|    from += sz;
  272|      0|    out = copy_8_bytes(out, from);
  273|      0|    from += sz;
  274|      0|    out = copy_8_bytes(out, from);
  275|      0|    from += sz;
  276|      0|    out = copy_8_bytes(out, from);
  277|      0|    from += sz;
  278|      0|    out = copy_8_bytes(out, from);
  279|      0|    from += sz;
  280|       |
  281|      0|    len -= 8;
  282|      0|  }
  283|       |
  284|      1|  return out;
  285|      1|}
fastcopy.c:chunk_memcpy_unaligned:
  410|     54|static inline unsigned char *chunk_memcpy_unaligned(unsigned char *out, const unsigned char *from, unsigned len) {
  411|       |#if defined(__AVX2__)
  412|       |  unsigned sz = sizeof(__m256i);
  413|       |#elif defined(__SSE2__)
  414|       |  unsigned sz = sizeof(__m128i);
  415|     54|#endif
  416|     54|  unsigned rem = len % sz;
  417|     54|  unsigned ilen;
  418|       |
  419|     54|  assert(len >= sz);
  420|       |
  421|       |  /* Copy a few bytes to make sure the loop below has a multiple of SZ bytes to be copied. */
  422|       |#if defined(__AVX2__)
  423|       |  copy_32_bytes(out, from);
  424|       |#elif defined(__SSE2__)
  425|       |  copy_16_bytes(out, from);
  426|     54|#endif
  427|       |
  428|     54|  len /= sz;
  429|     54|  out += rem;
  430|     54|  from += rem;
  431|       |
  432|  98.6k|  for (ilen = 0; ilen < len; ilen++) {
  ------------------
  |  Branch (432:18): [True: 98.6k, False: 54]
  ------------------
  433|       |#if defined(__AVX2__)
  434|       |    copy_32_bytes(out, from);
  435|       |#elif defined(__SSE2__)
  436|       |    copy_16_bytes(out, from);
  437|  98.6k|#endif
  438|  98.6k|    out += sz;
  439|  98.6k|    from += sz;
  440|  98.6k|  }
  441|       |
  442|     54|  return out;
  443|     54|}
fastcopy.c:copy_4_bytes:
   48|   147k|static inline unsigned char *copy_4_bytes(unsigned char *out, const unsigned char *from) {
   49|       |#if defined(BLOSC_STRICT_ALIGN)
   50|       |  uint32_t chunk;
   51|       |  memcpy(&chunk, from, 4);
   52|       |  memcpy(out, &chunk, 4);
   53|       |#else
   54|   147k|  *(uint32_t *) out = *(uint32_t *) from;
   55|   147k|#endif
   56|   147k|  return out + 4;
   57|   147k|}
fastcopy.c:copy_2_bytes:
   37|  66.9k|static inline unsigned char *copy_2_bytes(unsigned char *out, const unsigned char *from) {
   38|       |#if defined(BLOSC_STRICT_ALIGN)
   39|       |  uint16_t chunk;
   40|       |  memcpy(&chunk, from, 2);
   41|       |  memcpy(out, &chunk, 2);
   42|       |#else
   43|  66.9k|  *(uint16_t *) out = *(uint16_t *) from;
   44|  66.9k|#endif
   45|  66.9k|  return out + 2;
   46|  66.9k|}

frame_reader_acquire:
  157|     15|void* frame_reader_acquire(blosc2_frame_s* frame, const blosc2_io* io) {
  158|     15|  blosc2_io_cb *io_cb = blosc2_get_io_cb(io->id);
  159|     15|  if (io_cb == NULL) {
  ------------------
  |  Branch (159:7): [True: 0, False: 15]
  ------------------
  160|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  161|      0|    return NULL;
  162|      0|  }
  163|     15|  if (io->id != BLOSC2_IO_FILESYSTEM) {
  ------------------
  |  Branch (163:7): [True: 0, False: 15]
  ------------------
  164|       |    // Third-party backends keep the documented one-handle-per-reader contract
  165|       |    // (and the mmap one already makes open() a cheap pointer return).
  166|      0|    return io_cb->open(frame->urlpath, "rb", io->params);
  167|      0|  }
  168|       |#if defined(_WIN32)
  169|       |  // No handle caching on Windows.  The CRT opens files without
  170|       |  // FILE_SHARE_DELETE, so a cached handle turns every unlink or rename of the
  171|       |  // frame file into a sharing violation.  Callers that replace a frame rather
  172|       |  // than rewrite it in place -- python-blosc2 does, both via os.replace and via
  173|       |  // remove-then-recreate for mode="w" -- would get hard errors instead of the
  174|       |  // stale read that frame_reader_revalidate() handles elsewhere.  Caching here
  175|       |  // needs CreateFileW(..., FILE_SHARE_DELETE) plus POSIX-semantics deletion
  176|       |  // (Win10 1709+), which is only worth its cost once measured on Windows.
  177|       |  return io_cb->open(frame->urlpath, "rb", io->params);
  178|       |#else
  179|       |  // The cached handle pins the inode it was opened on, so a frame file that is
  180|       |  // replaced instead of rewritten in place would keep serving the old bytes.
  181|       |  // frame_reader_revalidate() catches that ahead of each header read.
  182|       |  //
  183|       |  // No unlocked fast path on read_fp: reading it outside the mutex races the
  184|       |  // store below (C11 data race, and TSan says so).  An uncontended lock is a
  185|       |  // handful of ns against the ~600 ns pread this hands a handle to.
  186|     15|  blosc2_pthread_mutex_lock(&frame->read_fp_mutex);
  ------------------
  |  |   92|     15|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  187|     15|  if (frame->read_fp == NULL && !frame->read_fp_nocache) {
  ------------------
  |  Branch (187:7): [True: 15, False: 0]
  |  Branch (187:33): [True: 15, False: 0]
  ------------------
  188|     15|    if (reader_cache_claim()) {
  ------------------
  |  Branch (188:9): [True: 15, False: 0]
  ------------------
  189|     15|      frame->read_fp = io_cb->open(frame->urlpath, "rb", io->params);
  190|     15|      if (frame->read_fp == NULL) {
  ------------------
  |  Branch (190:11): [True: 15, False: 0]
  ------------------
  191|     15|        reader_cache_return();
  192|     15|      }
  193|     15|    }
  194|      0|    else {
  195|       |      // Remember that this frame goes uncached, so the process-wide cache mutex
  196|       |      // is asked once rather than on every read for the rest of its life
  197|      0|      frame->read_fp_nocache = true;
  198|      0|    }
  199|     15|  }
  200|     15|  void* fp = frame->read_fp;
  201|     15|  if (fp != NULL) {
  ------------------
  |  Branch (201:7): [True: 0, False: 15]
  ------------------
  202|       |    // Held until the matching release, so nothing can close it underneath a
  203|       |    // caller that keeps it across several reads (frame_to_schunk does)
  204|      0|    frame->read_fp_refs++;
  205|      0|  }
  206|     15|  blosc2_pthread_mutex_unlock(&frame->read_fp_mutex);
  ------------------
  |  |   93|     15|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  207|     15|  if (fp == NULL) {
  ------------------
  |  Branch (207:7): [True: 15, False: 0]
  ------------------
  208|       |    // Cache full (or the cached open failed): hand out a private handle, which
  209|       |    // the matching frame_reader_release() closes since it is not frame->read_fp
  210|     15|    fp = io_cb->open(frame->urlpath, "rb", io->params);
  211|     15|  }
  212|     15|  return fp;
  213|     15|#endif
  214|     15|}
frame_reader_invalidate:
  265|  9.27k|void frame_reader_invalidate(blosc2_frame_s* frame) {
  266|  9.27k|  blosc2_pthread_mutex_lock(&frame->read_fp_mutex);
  ------------------
  |  |   92|  9.27k|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  267|  9.27k|  frame_reader_close_locked(frame, true);
  268|  9.27k|  blosc2_pthread_mutex_unlock(&frame->read_fp_mutex);
  ------------------
  |  |   93|  9.27k|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  269|  9.27k|}
frame_lock:
  481|  9.79k|int frame_lock(blosc2_frame_s* frame, bool exclusive) {
  482|  9.79k|  if (frame == NULL || !frame->locking) {
  ------------------
  |  Branch (482:7): [True: 0, False: 9.79k]
  |  Branch (482:24): [True: 9.79k, False: 0]
  ------------------
  483|  9.79k|    return BLOSC2_ERROR_SUCCESS;
  484|  9.79k|  }
  485|      0|  if (frame->lock_depth > 0) {
  ------------------
  |  Branch (485:7): [True: 0, False: 0]
  ------------------
  486|       |    // Already held by this handle (a nested call); the outer lock covers us
  487|      0|    frame->lock_depth++;
  488|      0|    return BLOSC2_ERROR_SUCCESS;
  489|      0|  }
  490|      0|  if (frame->lock_fd == -1) {
  ------------------
  |  Branch (490:7): [True: 0, False: 0]
  ------------------
  491|       |    // Lazily open the sidecar, kept for the frame's lifetime
  492|      0|    char* path = frame_lock_path(frame);
  493|      0|    if (path == NULL) {
  ------------------
  |  Branch (493:9): [True: 0, False: 0]
  ------------------
  494|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
  495|      0|    }
  496|       |#if defined(_WIN32)
  497|       |    HANDLE h = CreateFileA(path, GENERIC_READ | GENERIC_WRITE,
  498|       |                           FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
  499|       |                           NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
  500|       |    if (h == INVALID_HANDLE_VALUE) {
  501|       |      BLOSC_TRACE_ERROR("Cannot open the lock file in: %s", path);
  502|       |      free(path);
  503|       |      return BLOSC2_ERROR_LOCK;
  504|       |    }
  505|       |    frame->lock_fd = (intptr_t)h;
  506|       |#else
  507|      0|    int fd = open(path, O_CREAT | O_RDWR | O_CLOEXEC, 0666);
  508|      0|    if (fd < 0) {
  ------------------
  |  Branch (508:9): [True: 0, False: 0]
  ------------------
  509|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  510|      0|      free(path);
  511|      0|      return BLOSC2_ERROR_LOCK;
  512|      0|    }
  513|      0|    frame->lock_fd = fd;
  514|      0|#endif
  515|      0|    free(path);
  516|      0|  }
  517|      0|  if (frame_os_lock(frame, exclusive) < 0) {
  ------------------
  |  Branch (517:7): [True: 0, False: 0]
  ------------------
  518|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  519|      0|    return BLOSC2_ERROR_LOCK;
  520|      0|  }
  521|       |  // Generation counter: writers bump it, everyone compares it with the last
  522|       |  // value it saw.  This detects mutations by other handles exactly, even when
  523|       |  // the frame length on disk ends up unchanged (which the length-based
  524|       |  // staleness check in frame_refresh_if_stale() cannot see).
  525|      0|  uint64_t seq;
  526|      0|  if (frame_lock_read_seq(frame, &seq) < 0 ||
  ------------------
  |  Branch (526:7): [True: 0, False: 0]
  ------------------
  527|      0|      (exclusive && frame_lock_write_seq(frame, seq + 1) < 0)) {
  ------------------
  |  Branch (527:8): [True: 0, False: 0]
  |  Branch (527:21): [True: 0, False: 0]
  ------------------
  528|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  529|      0|    frame_os_unlock(frame);
  530|      0|    return BLOSC2_ERROR_LOCK;
  531|      0|  }
  532|      0|  if (seq != frame->lock_seq) {
  ------------------
  |  Branch (532:7): [True: 0, False: 0]
  ------------------
  533|      0|    frame->force_refresh = true;
  534|      0|  }
  535|      0|  if (exclusive) {
  ------------------
  |  Branch (535:7): [True: 0, False: 0]
  ------------------
  536|      0|    seq++;
  537|      0|  }
  538|      0|  frame->lock_seq = seq;
  539|      0|  frame->lock_depth = 1;
  540|      0|  return BLOSC2_ERROR_SUCCESS;
  541|      0|}
frame_unlock:
  544|  9.79k|int frame_unlock(blosc2_frame_s* frame) {
  545|  9.79k|  if (frame == NULL || !frame->locking || frame->lock_depth == 0) {
  ------------------
  |  Branch (545:7): [True: 0, False: 9.79k]
  |  Branch (545:24): [True: 9.79k, False: 0]
  |  Branch (545:43): [True: 0, False: 0]
  ------------------
  546|  9.79k|    return BLOSC2_ERROR_SUCCESS;
  547|  9.79k|  }
  548|      0|  if (--frame->lock_depth > 0) {
  ------------------
  |  Branch (548:7): [True: 0, False: 0]
  ------------------
  549|      0|    return BLOSC2_ERROR_SUCCESS;
  550|      0|  }
  551|      0|  if (frame_os_unlock(frame) < 0) {
  ------------------
  |  Branch (551:7): [True: 0, False: 0]
  ------------------
  552|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  553|      0|    return BLOSC2_ERROR_LOCK;
  554|      0|  }
  555|      0|  return BLOSC2_ERROR_SUCCESS;
  556|      0|}
frame_free:
  560|  9.27k|int frame_free(blosc2_frame_s* frame) {
  561|       |
  562|  9.27k|  frame_reader_invalidate(frame);
  563|  9.27k|  blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|  9.27k|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
  564|       |
  565|  9.27k|  if (frame->locking && frame->lock_fd != -1) {
  ------------------
  |  Branch (565:7): [True: 0, False: 9.27k]
  |  Branch (565:25): [True: 0, False: 0]
  ------------------
  566|       |#if defined(_WIN32)
  567|       |    CloseHandle((HANDLE)frame->lock_fd);
  568|       |#else
  569|      0|    close((int)frame->lock_fd);
  570|      0|#endif
  571|      0|  }
  572|       |
  573|  9.27k|  if (frame->cframe != NULL && !frame->avoid_cframe_free) {
  ------------------
  |  Branch (573:7): [True: 9.27k, False: 0]
  |  Branch (573:32): [True: 0, False: 9.27k]
  ------------------
  574|      0|    free(frame->cframe);
  575|      0|  }
  576|       |
  577|  9.27k|  if (frame->coffsets != NULL && frame->coffsets_needs_free) {
  ------------------
  |  Branch (577:7): [True: 0, False: 9.27k]
  |  Branch (577:34): [True: 0, False: 0]
  ------------------
  578|      0|    free(frame->coffsets);
  579|      0|  }
  580|       |
  581|  9.27k|  if (frame->urlpath != NULL) {
  ------------------
  |  Branch (581:7): [True: 0, False: 9.27k]
  ------------------
  582|      0|    free(frame->urlpath);
  583|      0|  }
  584|       |
  585|  9.27k|  free(frame);
  586|       |
  587|  9.27k|  return 0;
  588|  9.27k|}
get_header_info:
  898|  20.5k|                    uint8_t *splitmode, uint8_t *use_dict, const blosc2_io *io) {
  899|  20.5k|  uint8_t* framep = frame->cframe;
  900|  20.5k|  uint8_t* header_ptr;
  901|  20.5k|  uint8_t header[FRAME_HEADER_MINLEN];
  902|       |
  903|  20.5k|  blosc2_io_cb *io_cb = blosc2_get_io_cb(io->id);
  904|  20.5k|  if (io_cb == NULL) {
  ------------------
  |  Branch (904:7): [True: 0, False: 20.5k]
  ------------------
  905|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  906|      0|    return BLOSC2_ERROR_PLUGIN_IO;
  907|      0|  }
  908|       |
  909|  20.5k|  if (frame->len <= 0) {
  ------------------
  |  Branch (909:7): [True: 0, False: 20.5k]
  ------------------
  910|      0|    return BLOSC2_ERROR_READ_BUFFER;
  911|      0|  }
  912|       |
  913|  20.5k|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (913:7): [True: 0, False: 20.5k]
  ------------------
  914|      0|    int64_t rbytes = 0;
  915|      0|    void* fp = NULL;
  916|      0|    int64_t io_pos = 0;
  917|      0|    if (frame->sframe) {
  ------------------
  |  Branch (917:9): [True: 0, False: 0]
  ------------------
  918|      0|      fp = sframe_open_index(frame->urlpath, "rb", io);
  919|      0|      if (fp == NULL) {
  ------------------
  |  Branch (919:11): [True: 0, False: 0]
  ------------------
  920|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  921|      0|        return BLOSC2_ERROR_FILE_OPEN;
  922|      0|      }
  923|      0|    }
  924|      0|    else {
  925|       |      /* Ahead of the header read, not after it: everything downstream (and
  926|       |         frame_refresh_if_stale in particular) trusts the length this read
  927|       |         returns, so a stale handle here would pair old metadata with the
  928|       |         replacement's bytes. */
  929|      0|      frame_reader_revalidate(frame);
  930|      0|      fp = frame_reader_acquire(frame, io);
  931|      0|      if (fp == NULL) {
  ------------------
  |  Branch (931:11): [True: 0, False: 0]
  ------------------
  932|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  933|      0|        return BLOSC2_ERROR_FILE_OPEN;
  934|      0|      }
  935|      0|      io_pos = frame->file_offset;
  936|      0|    }
  937|      0|    if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (937:9): [True: 0, False: 0]
  ------------------
  938|      0|      header_ptr = header;
  939|      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
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  940|      0|    frame_reader_release(frame, io_cb, fp);
  941|      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 (941:9): [True: 0, False: 0]
  ------------------
  942|      0|      return BLOSC2_ERROR_FILE_READ;
  943|      0|    }
  944|      0|    framep = header_ptr;
  945|      0|  }
  946|       |
  947|       |  // Consistency check for frame type
  948|  20.5k|  uint8_t frame_type = framep[FRAME_TYPE];
  ------------------
  |  |   33|  20.5k|#define FRAME_TYPE (FRAME_FLAGS + 1)  // 26
  |  |  ------------------
  |  |  |  |   32|  20.5k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  20.5k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  20.5k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  20.5k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  949|  20.5k|  uint8_t frame_version = framep[FRAME_FLAGS] & 0x0fu;
  ------------------
  |  |   32|  20.5k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|  20.5k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|  20.5k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|  20.5k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  950|  20.5k|  if (frame_version > BLOSC2_VERSION_FRAME_FORMAT) {
  ------------------
  |  Branch (950:7): [True: 0, False: 20.5k]
  ------------------
  951|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  952|      0|    return BLOSC2_ERROR_VERSION_SUPPORT;
  953|      0|  }
  954|  20.5k|  if (frame->sframe) {
  ------------------
  |  Branch (954:7): [True: 0, False: 20.5k]
  ------------------
  955|      0|    if (frame_type != FRAME_DIRECTORY_TYPE) {
  ------------------
  |  |   22|      0|#define FRAME_DIRECTORY_TYPE 1
  ------------------
  |  Branch (955:9): [True: 0, False: 0]
  ------------------
  956|      0|      return BLOSC2_ERROR_FRAME_TYPE;
  957|      0|    }
  958|  20.5k|  } else {
  959|  20.5k|    if (frame_type != FRAME_CONTIGUOUS_TYPE) {
  ------------------
  |  |   21|  20.5k|#define FRAME_CONTIGUOUS_TYPE 0
  ------------------
  |  Branch (959:9): [True: 0, False: 20.5k]
  ------------------
  960|      0|      return BLOSC2_ERROR_FRAME_TYPE;
  961|      0|    }
  962|  20.5k|  }
  963|       |
  964|       |  // Fetch some internal lengths
  965|  20.5k|  from_big(header_len, framep + FRAME_HEADER_LEN, sizeof(*header_len));
  ------------------
  |  |   38|  20.5k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  966|  20.5k|  if (*header_len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  20.5k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  20.5k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  20.5k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  20.5k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  20.5k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  20.5k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  20.5k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  20.5k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  20.5k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  20.5k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  20.5k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  20.5k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  20.5k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  20.5k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (966:7): [True: 3, False: 20.5k]
  ------------------
  967|      3|    BLOSC_TRACE_ERROR("Header length is zero or smaller than min allowed.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  968|      3|    return BLOSC2_ERROR_INVALID_HEADER;
  969|      3|  }
  970|  20.5k|  from_big(frame_len, framep + FRAME_LEN, sizeof(*frame_len));
  ------------------
  |  |   38|  20.5k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  971|  20.5k|  if (*header_len > *frame_len) {
  ------------------
  |  Branch (971:7): [True: 2, False: 20.5k]
  ------------------
  972|      2|    BLOSC_TRACE_ERROR("Header length exceeds length of the frame.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  973|      2|    return BLOSC2_ERROR_INVALID_HEADER;
  974|      2|  }
  975|  20.5k|  from_big(nbytes, framep + FRAME_NBYTES, sizeof(*nbytes));
  ------------------
  |  |   38|  20.5k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  976|  20.5k|  from_big(cbytes, framep + FRAME_CBYTES, sizeof(*cbytes));
  ------------------
  |  |   38|  20.5k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  977|  20.5k|  from_big(blocksize, framep + FRAME_BLOCKSIZE, sizeof(*blocksize));
  ------------------
  |  |   38|  20.5k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  978|  20.5k|  if (chunksize != NULL) {
  ------------------
  |  Branch (978:7): [True: 20.5k, False: 0]
  ------------------
  979|  20.5k|    from_big(chunksize, framep + FRAME_CHUNKSIZE, sizeof(*chunksize));
  ------------------
  |  |   38|  20.5k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  980|  20.5k|  }
  981|  20.5k|  if (typesize != NULL) {
  ------------------
  |  Branch (981:7): [True: 19.6k, False: 911]
  ------------------
  982|  19.6k|    from_big(typesize, framep + FRAME_TYPESIZE, sizeof(*typesize));
  ------------------
  |  |   38|  19.6k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  983|  19.6k|    if (*typesize <= 0) {
  ------------------
  |  Branch (983:9): [True: 2, False: 19.6k]
  ------------------
  984|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  985|      2|      return BLOSC2_ERROR_INVALID_HEADER;
  986|      2|    }
  987|  19.6k|  }
  988|       |
  989|       |  // Codecs
  990|  20.5k|  uint8_t frame_codecs = framep[FRAME_CODECS];
  ------------------
  |  |   34|  20.5k|#define FRAME_CODECS (FRAME_FLAGS + 2)  // 27
  |  |  ------------------
  |  |  |  |   32|  20.5k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  20.5k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  20.5k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  20.5k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  991|  20.5k|  if (clevel != NULL) {
  ------------------
  |  Branch (991:7): [True: 9.27k, False: 11.3k]
  ------------------
  992|  9.27k|    *clevel = frame_codecs >> 4u;
  993|  9.27k|  }
  994|  20.5k|  if (compcode != NULL) {
  ------------------
  |  Branch (994:7): [True: 9.27k, False: 11.3k]
  ------------------
  995|  9.27k|    *compcode = frame_codecs & 0xFu;
  996|  9.27k|    if (*compcode == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (996:9): [True: 208, False: 9.06k]
  ------------------
  997|    208|      from_big(compcode, framep + FRAME_UDCODEC, sizeof(*compcode));
  ------------------
  |  |   38|    208|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  998|    208|    }
  999|  9.27k|  }
 1000|       |
 1001|       |  // Other flags
 1002|  20.5k|  uint8_t other_flags = framep[FRAME_OTHER_FLAGS];
  ------------------
  |  |   35|  20.5k|#define FRAME_OTHER_FLAGS (FRAME_FLAGS + 3)  // 28
  |  |  ------------------
  |  |  |  |   32|  20.5k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  20.5k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  20.5k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  20.5k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1003|  20.5k|  if (splitmode != NULL) {
  ------------------
  |  Branch (1003:7): [True: 9.27k, False: 11.3k]
  ------------------
 1004|  9.27k|    *splitmode = (other_flags & 0x03u) + 1;
 1005|  9.27k|  }
 1006|       |
 1007|       |  // Other flags 2: bit 0 = use_dict
 1008|  20.5k|  if (use_dict != NULL) {
  ------------------
  |  Branch (1008:7): [True: 9.27k, False: 11.3k]
  ------------------
 1009|  9.27k|    *use_dict = (framep[FRAME_OTHER_FLAGS2] & FRAME_USE_DICT) ? 1 : 0;
  ------------------
  |  |   47|  9.27k|#define FRAME_OTHER_FLAGS2 (FRAME_FILTER_PIPELINE + 1 + 14)  // 85
  |  |  ------------------
  |  |  |  |   44|  9.27k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  9.27k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  9.27k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  9.27k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  9.27k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  9.27k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  9.27k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  9.27k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  9.27k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  9.27k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  9.27k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  9.27k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  9.27k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  *use_dict = (framep[FRAME_OTHER_FLAGS2] & FRAME_USE_DICT) ? 1 : 0;
  ------------------
  |  |   48|  9.27k|#define FRAME_USE_DICT (1U << 0)   //!< bit 0 of other_flags2: use dictionary compression
  ------------------
  |  Branch (1009:17): [True: 3.14k, False: 6.12k]
  ------------------
 1010|  9.27k|  }
 1011|       |
 1012|  20.5k|  if (compcode_meta != NULL) {
  ------------------
  |  Branch (1012:7): [True: 9.27k, False: 11.3k]
  ------------------
 1013|  9.27k|    from_big(compcode_meta, framep + FRAME_CODEC_META, sizeof(*compcode_meta));
  ------------------
  |  |   38|  9.27k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1014|  9.27k|  }
 1015|       |
 1016|       |  // Filters
 1017|  20.5k|  if (filters != NULL && filters_meta != NULL) {
  ------------------
  |  Branch (1017:7): [True: 9.27k, False: 11.3k]
  |  Branch (1017:26): [True: 9.27k, False: 0]
  ------------------
 1018|  9.27k|    uint8_t nfilters = framep[FRAME_FILTER_PIPELINE];
  ------------------
  |  |   44|  9.27k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|  9.27k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  9.27k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|  9.27k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|  9.27k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|  9.27k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  9.27k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  9.27k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  9.27k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  9.27k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  9.27k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  9.27k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  9.27k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1019|  9.27k|    if (nfilters > BLOSC2_MAX_FILTERS) {
  ------------------
  |  Branch (1019:9): [True: 0, False: 9.27k]
  ------------------
 1020|      0|      BLOSC_TRACE_ERROR("The number of filters in frame header are too large for Blosc2.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1021|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 1022|      0|    }
 1023|  9.27k|    uint8_t *filters_ = framep + FRAME_FILTER_PIPELINE + 1;
  ------------------
  |  |   44|  9.27k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|  9.27k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  9.27k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|  9.27k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|  9.27k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|  9.27k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  9.27k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  9.27k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  9.27k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  9.27k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  9.27k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  9.27k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  9.27k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1024|  9.27k|    uint8_t *filters_meta_ = framep + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   44|  9.27k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|  9.27k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  9.27k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|  9.27k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|  9.27k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|  9.27k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  9.27k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  9.27k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  9.27k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  9.27k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  9.27k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  9.27k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  9.27k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  uint8_t *filters_meta_ = framep + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   53|  9.27k|#define FRAME_FILTER_PIPELINE_MAX (8)  // the maximum number of filters that can be stored in header
  ------------------
 1025|  15.7k|    for (int i = 0; i < nfilters; i++) {
  ------------------
  |  Branch (1025:21): [True: 6.52k, False: 9.27k]
  ------------------
 1026|  6.52k|      filters[i] = filters_[i];
 1027|  6.52k|      filters_meta[i] = filters_meta_[i];
 1028|  6.52k|    }
 1029|  9.27k|  }
 1030|       |
 1031|  20.5k|  if (*nbytes > 0) {
  ------------------
  |  Branch (1031:7): [True: 20.5k, False: 54]
  ------------------
 1032|  20.5k|    if (*chunksize > 0) {
  ------------------
  |  Branch (1032:9): [True: 15.3k, False: 5.14k]
  ------------------
 1033|       |      // We can compute the number of chunks directly when there is a fixed chunk size.
 1034|  15.3k|      *nchunks = *nbytes / *chunksize;
 1035|  15.3k|      if (*nbytes % *chunksize > 0) {
  ------------------
  |  Branch (1035:11): [True: 12.0k, False: 3.32k]
  ------------------
 1036|  12.0k|        *nchunks += 1;
 1037|  12.0k|      }
 1038|       |
 1039|       |      // Sanity check for compressed sizes
 1040|  15.3k|      if ((*cbytes < 0) || ((int64_t)*nchunks * *chunksize < *nbytes)) {
  ------------------
  |  Branch (1040:11): [True: 0, False: 15.3k]
  |  Branch (1040:28): [True: 0, False: 15.3k]
  ------------------
 1041|      0|        BLOSC_TRACE_ERROR("Invalid compressed size in frame header.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1042|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 1043|      0|      }
 1044|  15.3k|    }
 1045|  5.14k|    else if (*chunksize == 0) {
  ------------------
  |  Branch (1045:14): [True: 5.14k, False: 1]
  ------------------
 1046|  5.14k|      int32_t coffsets_nbytes;
 1047|  5.14k|      int rc2 = get_coffsets_nbytes(frame, *header_len, *cbytes, &coffsets_nbytes, io);
 1048|  5.14k|      if (rc2 < 0) {
  ------------------
  |  Branch (1048:11): [True: 15, False: 5.12k]
  ------------------
 1049|     15|        return rc2;
 1050|     15|      }
 1051|  5.12k|      if (coffsets_nbytes < 0 || coffsets_nbytes % (int32_t)sizeof(int64_t) != 0) {
  ------------------
  |  Branch (1051:11): [True: 3, False: 5.12k]
  |  Branch (1051:34): [True: 0, False: 5.12k]
  ------------------
 1052|      3|        BLOSC_TRACE_ERROR("Invalid offsets chunk in frame header.");
  ------------------
  |  |   93|      3|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      3|    do {                                            \
  |  |  |  |   98|      3|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      3|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      3|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1053|      3|        return BLOSC2_ERROR_INVALID_HEADER;
 1054|      3|      }
 1055|  5.12k|      *nchunks = coffsets_nbytes / (int32_t)sizeof(int64_t);
 1056|  5.12k|    }
 1057|      1|    else {
 1058|      1|      BLOSC_TRACE_ERROR("Invalid chunk size in frame header.");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1059|      1|      return BLOSC2_ERROR_INVALID_HEADER;
 1060|      1|    }
 1061|  20.5k|  } else {
 1062|     54|    *nchunks = 0;
 1063|     54|  }
 1064|       |
 1065|  20.5k|  if (*nchunks > 0) {
  ------------------
  |  Branch (1065:7): [True: 20.5k, False: 60]
  ------------------
 1066|  20.5k|    int32_t off_nbytes;
 1067|  20.5k|    if (!blosc2_nchunks_to_offsets_nbytes(*nchunks, &off_nbytes)) {
  ------------------
  |  Branch (1067:9): [True: 3, False: 20.4k]
  ------------------
 1068|      3|      BLOSC_TRACE_ERROR("Invalid number of chunks in frame header.");
  ------------------
  |  |   93|      3|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      3|    do {                                            \
  |  |  |  |   98|      3|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      3|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      3|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1069|      3|      return BLOSC2_ERROR_INVALID_HEADER;
 1070|      3|    }
 1071|  20.5k|  }
 1072|       |
 1073|  20.5k|  return 0;
 1074|  20.5k|}
get_trailer_offset:
 1077|    449|int64_t get_trailer_offset(blosc2_frame_s *frame, int32_t header_len, bool has_coffsets) {
 1078|    449|  if (!has_coffsets) {
  ------------------
  |  Branch (1078:7): [True: 14, False: 435]
  ------------------
 1079|       |    // No data chunks yet
 1080|     14|    return header_len;
 1081|     14|  }
 1082|    435|  return frame->len - frame->trailer_len;
 1083|    449|}
frame_from_cframe:
 1880|  9.29k|blosc2_frame_s* frame_from_cframe(uint8_t *cframe, int64_t len, bool copy) {
 1881|       |  // Get the length of the frame
 1882|  9.29k|  const uint8_t* header = cframe;
 1883|  9.29k|  int64_t frame_len;
 1884|  9.29k|  if (len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  9.29k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  9.29k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  9.29k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  9.29k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  9.29k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  9.29k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  9.29k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  9.29k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  9.29k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  9.29k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  9.29k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  9.29k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  9.29k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  9.29k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1884:7): [True: 0, False: 9.29k]
  ------------------
 1885|      0|    return NULL;
 1886|      0|  }
 1887|       |
 1888|  9.29k|  from_big(&frame_len, header + FRAME_LEN, sizeof(frame_len));
  ------------------
  |  |   38|  9.29k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1889|  9.29k|  if (frame_len != len) {   // sanity check
  ------------------
  |  Branch (1889:7): [True: 7, False: 9.28k]
  ------------------
 1890|      7|    return NULL;
 1891|      7|  }
 1892|       |
 1893|  9.28k|  blosc2_frame_s* frame = frame_alloc();
 1894|  9.28k|  if (frame == NULL) {
  ------------------
  |  Branch (1894:7): [True: 0, False: 9.28k]
  ------------------
 1895|      0|    return NULL;
 1896|      0|  }
 1897|  9.28k|  frame->len = frame_len;
 1898|  9.28k|  frame->file_offset = 0;
 1899|       |
 1900|       |  // Now, the trailer length
 1901|  9.28k|  const uint8_t* trailer = cframe + frame_len - FRAME_TRAILER_MINLEN;
  ------------------
  |  |   58|  9.28k|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
 1902|  9.28k|  int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   58|  9.28k|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
                int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   59|  9.28k|#define FRAME_TRAILER_LEN_OFFSET (22)  // offset to trailer length (counting from the end)
  ------------------
 1903|  9.28k|  if (trailer[trailer_offset - 1] != 0xce) {
  ------------------
  |  Branch (1903:7): [True: 0, False: 9.28k]
  ------------------
 1904|      0|    blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 1905|      0|    free(frame);
 1906|      0|    return NULL;
 1907|      0|  }
 1908|  9.28k|  uint32_t trailer_len;
 1909|  9.28k|  from_big(&trailer_len, trailer + trailer_offset, sizeof(trailer_len));
  ------------------
  |  |   38|  9.28k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1910|  9.28k|  if (trailer_len < FRAME_TRAILER_MINLEN || trailer_len > INT32_MAX ||
  ------------------
  |  |   58|  18.5k|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (1910:7): [True: 0, False: 9.28k]
  |  Branch (1910:45): [True: 2, False: 9.28k]
  ------------------
 1911|  9.28k|      (int64_t)trailer_len > frame_len ||
  ------------------
  |  Branch (1911:7): [True: 1, False: 9.28k]
  ------------------
 1912|  9.28k|      (int64_t)trailer_len > frame_len - FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  9.28k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  9.28k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  9.28k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  9.28k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  9.28k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  9.28k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  9.28k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  9.28k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  9.28k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  9.28k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  9.28k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  9.28k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  9.28k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  9.28k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1912:7): [True: 1, False: 9.27k]
  ------------------
 1913|      4|    blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|      4|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 1914|      4|    free(frame);
 1915|      4|    return NULL;
 1916|      4|  }
 1917|  9.27k|  frame->trailer_len = trailer_len;
 1918|       |
 1919|  9.27k|  if (copy) {
  ------------------
  |  Branch (1919:7): [True: 0, False: 9.27k]
  ------------------
 1920|      0|    frame->cframe = malloc((size_t)len);
 1921|      0|    memcpy(frame->cframe, cframe, (size_t)len);
 1922|      0|  }
 1923|  9.27k|  else {
 1924|  9.27k|    frame->cframe = cframe;
 1925|  9.27k|    frame->avoid_cframe_free = true;
 1926|  9.27k|  }
 1927|       |
 1928|  9.27k|  return frame;
 1929|  9.28k|}
get_coffsets:
 2110|  19.6k|                      int64_t nchunks, int32_t *off_cbytes) {
 2111|  19.6k|  int32_t chunk_cbytes;
 2112|  19.6k|  int rc;
 2113|       |
 2114|  19.6k|  if (frame->coffsets != NULL) {
  ------------------
  |  Branch (2114:7): [True: 0, False: 19.6k]
  ------------------
 2115|      0|    if (off_cbytes != NULL) {
  ------------------
  |  Branch (2115:9): [True: 0, False: 0]
  ------------------
 2116|      0|      rc = blosc2_cbuffer_sizes(frame->coffsets, NULL, &chunk_cbytes, NULL);
 2117|      0|      if (rc < 0) {
  ------------------
  |  Branch (2117:11): [True: 0, False: 0]
  ------------------
 2118|      0|        return NULL;
 2119|      0|      }
 2120|      0|      *off_cbytes = (int32_t)chunk_cbytes;
 2121|      0|    }
 2122|      0|    return frame->coffsets;
 2123|      0|  }
 2124|  19.6k|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (2124:7): [True: 19.6k, False: 0]
  ------------------
 2125|  19.6k|    int64_t off_pos = header_len;
 2126|  19.6k|    if (cbytes < INT64_MAX - header_len) {
  ------------------
  |  Branch (2126:9): [True: 1.56k, False: 18.0k]
  ------------------
 2127|  1.56k|      off_pos += cbytes;
 2128|  1.56k|    }
 2129|       |    // Check that there is enough room to read Blosc header
 2130|  19.6k|    if (off_pos < 0 || off_pos > INT64_MAX - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (2130:9): [True: 0, False: 19.6k]
  |  Branch (2130:24): [True: 0, False: 19.6k]
  ------------------
 2131|  19.6k|        off_pos + BLOSC_EXTENDED_HEADER_LENGTH > frame->len) {
  ------------------
  |  Branch (2131:9): [True: 5, False: 19.6k]
  ------------------
 2132|      5|      BLOSC_TRACE_ERROR("Cannot read the offsets outside of frame boundary.");
  ------------------
  |  |   93|      5|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      5|    do {                                            \
  |  |  |  |   98|      5|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      5|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 5, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      5|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2133|      5|      return NULL;
 2134|      5|    }
 2135|       |    // For in-memory frames, the coffset is just one pointer away
 2136|  19.6k|    uint8_t* off_start = frame->cframe + off_pos;
 2137|  19.6k|    if (off_cbytes != NULL) {
  ------------------
  |  Branch (2137:9): [True: 19.6k, False: 0]
  ------------------
 2138|  19.6k|      int32_t chunk_nbytes;
 2139|  19.6k|      int32_t chunk_blocksize;
 2140|  19.6k|      rc = blosc2_cbuffer_sizes(off_start, &chunk_nbytes, &chunk_cbytes, &chunk_blocksize);
 2141|  19.6k|      if (rc < 0) {
  ------------------
  |  Branch (2141:11): [True: 2, False: 19.6k]
  ------------------
 2142|      2|        return NULL;
 2143|      2|      }
 2144|  19.6k|      *off_cbytes = (int32_t)chunk_cbytes;
 2145|  19.6k|      if (*off_cbytes < 0 || off_pos + *off_cbytes > frame->len) {
  ------------------
  |  Branch (2145:11): [True: 0, False: 19.6k]
  |  Branch (2145:30): [True: 6, False: 19.6k]
  ------------------
 2146|      6|        BLOSC_TRACE_ERROR("Cannot read the cbytes outside of frame boundary.");
  ------------------
  |  |   93|      6|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      6|    do {                                            \
  |  |  |  |   98|      6|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      6|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 6, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      6|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2147|      6|        return NULL;
 2148|      6|      }
 2149|  19.6k|      int32_t expected_off_nbytes;
 2150|  19.6k|      if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &expected_off_nbytes)) {
  ------------------
  |  Branch (2150:11): [True: 0, False: 19.6k]
  ------------------
 2151|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2152|      0|        return NULL;
 2153|      0|      }
 2154|  19.6k|      if (chunk_nbytes != expected_off_nbytes) {
  ------------------
  |  Branch (2154:11): [True: 9, False: 19.5k]
  ------------------
 2155|      9|        BLOSC_TRACE_ERROR("The number of chunks in offset idx "
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2156|      9|                          "does not match the ones in the header frame.");
 2157|      9|        return NULL;
 2158|      9|      }
 2159|       |
 2160|  19.6k|    }
 2161|  19.5k|    return off_start;
 2162|  19.6k|  }
 2163|       |
 2164|      0|  int64_t trailer_offset = get_trailer_offset(frame, header_len, true);
 2165|       |
 2166|      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 (2166:7): [True: 0, False: 0]
  |  Branch (2166:56): [True: 0, False: 0]
  ------------------
 2167|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2168|      0|    return NULL;
 2169|      0|  }
 2170|       |
 2171|      0|  int64_t coffsets_cbytes64;
 2172|      0|  if (frame->sframe) {
  ------------------
  |  Branch (2172:7): [True: 0, False: 0]
  ------------------
 2173|      0|    coffsets_cbytes64 = trailer_offset - header_len;
 2174|      0|  }
 2175|      0|  else {
 2176|      0|    coffsets_cbytes64 = trailer_offset - (header_len + cbytes);
 2177|      0|  }
 2178|      0|  if (coffsets_cbytes64 <= 0 || coffsets_cbytes64 > INT32_MAX) {
  ------------------
  |  Branch (2178:7): [True: 0, False: 0]
  |  Branch (2178:33): [True: 0, False: 0]
  ------------------
 2179|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2180|      0|    return NULL;
 2181|      0|  }
 2182|      0|  int32_t coffsets_cbytes = (int32_t)coffsets_cbytes64;
 2183|       |
 2184|      0|  if (off_cbytes != NULL) {
  ------------------
  |  Branch (2184:7): [True: 0, False: 0]
  ------------------
 2185|      0|    *off_cbytes = coffsets_cbytes;
 2186|      0|  }
 2187|       |
 2188|      0|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 2189|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (2189:7): [True: 0, False: 0]
  ------------------
 2190|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2191|      0|    return NULL;
 2192|      0|  }
 2193|       |
 2194|      0|  void* fp = NULL;
 2195|      0|  uint8_t* coffsets;
 2196|      0|  if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (2196:7): [True: 0, False: 0]
  ------------------
 2197|      0|    coffsets = malloc((size_t)coffsets_cbytes);
 2198|      0|    frame->coffsets_needs_free = true;
 2199|      0|  }
 2200|      0|  else {
 2201|      0|    frame->coffsets_needs_free = false;
 2202|      0|  }
 2203|       |
 2204|      0|  int64_t io_pos = 0;
 2205|      0|  if (frame->sframe) {
  ------------------
  |  Branch (2205:7): [True: 0, False: 0]
  ------------------
 2206|      0|    fp = sframe_open_index(frame->urlpath, "rb",
 2207|      0|                           frame->schunk->storage->io);
 2208|      0|    if (fp == NULL) {
  ------------------
  |  Branch (2208:9): [True: 0, False: 0]
  ------------------
 2209|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2210|      0|      return NULL;
 2211|      0|    }
 2212|      0|    io_pos = header_len + 0;
 2213|      0|  }
 2214|      0|  else {
 2215|      0|    fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 2216|      0|    if (fp == NULL) {
  ------------------
  |  Branch (2216:9): [True: 0, False: 0]
  ------------------
 2217|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2218|      0|      return NULL;
 2219|      0|    }
 2220|      0|    io_pos = frame->file_offset + header_len + cbytes;
 2221|      0|  }
 2222|      0|  int64_t rbytes = io_cb->read((void**)&coffsets, 1, coffsets_cbytes, io_pos, fp);
 2223|      0|  frame_reader_release(frame, io_cb, fp);
 2224|      0|  if (rbytes != coffsets_cbytes) {
  ------------------
  |  Branch (2224:7): [True: 0, False: 0]
  ------------------
 2225|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2226|      0|    if (frame->coffsets_needs_free)
  ------------------
  |  Branch (2226:9): [True: 0, False: 0]
  ------------------
 2227|      0|      free(coffsets);
 2228|      0|    return NULL;
 2229|      0|  }
 2230|      0|  frame->coffsets = coffsets;
 2231|      0|  return coffsets;
 2232|      0|}
frame_get_metalayers:
 2521|    462|int frame_get_metalayers(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 2522|    462|  int32_t header_len;
 2523|    462|  int64_t frame_len;
 2524|    462|  int64_t nbytes;
 2525|    462|  int64_t cbytes;
 2526|    462|  int32_t blocksize;
 2527|    462|  int32_t chunksize;
 2528|    462|  int64_t nchunks;
 2529|    462|  int ret = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 2530|    462|                            &blocksize, &chunksize, &nchunks,
 2531|    462|                            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 2532|    462|                            schunk->storage->io);
 2533|    462|  if (ret < 0) {
  ------------------
  |  Branch (2533:7): [True: 0, False: 462]
  ------------------
 2534|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2535|      0|    return ret;
 2536|      0|  }
 2537|       |
 2538|       |  // Get the header
 2539|    462|  uint8_t* header = NULL;
 2540|    462|  bool needs_free = false;
 2541|    462|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (2541:7): [True: 462, False: 0]
  ------------------
 2542|    462|    header = frame->cframe;
 2543|    462|  } else {
 2544|      0|    int64_t rbytes = 0;
 2545|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 2546|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (2546:9): [True: 0, False: 0]
  ------------------
 2547|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2548|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 2549|      0|    }
 2550|       |
 2551|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (2551:9): [True: 0, False: 0]
  ------------------
 2552|      0|      header = malloc(header_len);
 2553|      0|      needs_free = true;
 2554|      0|    }
 2555|      0|    else {
 2556|      0|      needs_free = false;
 2557|      0|    }
 2558|       |
 2559|      0|    void* fp = NULL;
 2560|      0|    int64_t io_pos = 0;
 2561|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2561:9): [True: 0, False: 0]
  ------------------
 2562|      0|      fp = sframe_open_index(frame->urlpath, "rb",
 2563|      0|                             frame->schunk->storage->io);
 2564|      0|      if (fp == NULL) {
  ------------------
  |  Branch (2564:11): [True: 0, False: 0]
  ------------------
 2565|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2566|      0|        return BLOSC2_ERROR_FILE_OPEN;
 2567|      0|      }
 2568|      0|    }
 2569|      0|    else {
 2570|      0|      fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 2571|      0|      if (fp == NULL) {
  ------------------
  |  Branch (2571:11): [True: 0, False: 0]
  ------------------
 2572|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2573|      0|        return BLOSC2_ERROR_FILE_OPEN;
 2574|      0|      }
 2575|      0|      io_pos = frame->file_offset;
 2576|      0|    }
 2577|      0|    if (fp != NULL) {
  ------------------
  |  Branch (2577:9): [True: 0, False: 0]
  ------------------
 2578|      0|      rbytes = io_cb->read((void**)&header, 1, header_len, io_pos, fp);
 2579|      0|      frame_reader_release(frame, io_cb, fp);
 2580|      0|    }
 2581|      0|    if (rbytes != header_len) {
  ------------------
  |  Branch (2581:9): [True: 0, False: 0]
  ------------------
 2582|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2583|      0|      if (needs_free)
  ------------------
  |  Branch (2583:11): [True: 0, False: 0]
  ------------------
 2584|      0|        free(header);
 2585|      0|      return BLOSC2_ERROR_FILE_READ;
 2586|      0|    }
 2587|      0|  }
 2588|       |
 2589|    462|  ret = get_meta_from_header(frame, schunk, header, header_len);
 2590|       |
 2591|    462|  if (frame->cframe == NULL && needs_free) {
  ------------------
  |  Branch (2591:7): [True: 0, False: 462]
  |  Branch (2591:32): [True: 0, False: 0]
  ------------------
 2592|      0|    free(header);
 2593|      0|  }
 2594|       |
 2595|    462|  return ret;
 2596|    462|}
frame_get_vlmetalayers:
 2732|    449|int frame_get_vlmetalayers(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 2733|    449|  int32_t header_len;
 2734|    449|  int64_t frame_len;
 2735|    449|  int64_t nbytes;
 2736|    449|  int64_t cbytes;
 2737|    449|  int32_t blocksize;
 2738|    449|  int32_t chunksize;
 2739|    449|  int64_t nchunks;
 2740|    449|  int ret = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 2741|    449|                            &blocksize, &chunksize, &nchunks,
 2742|    449|                            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 2743|    449|                            schunk->storage->io);
 2744|    449|  if (ret < 0) {
  ------------------
  |  Branch (2744:7): [True: 0, False: 449]
  ------------------
 2745|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2746|      0|    return ret;
 2747|      0|  }
 2748|       |
 2749|    449|  int64_t trailer_offset = get_trailer_offset(frame, header_len, nbytes > 0);
 2750|    449|  int32_t trailer_len = (int32_t) frame->trailer_len;
 2751|       |
 2752|    449|  if (trailer_offset < BLOSC_EXTENDED_HEADER_LENGTH || trailer_offset + trailer_len > frame->len) {
  ------------------
  |  Branch (2752:7): [True: 0, False: 449]
  |  Branch (2752:56): [True: 2, False: 447]
  ------------------
 2753|      2|    BLOSC_TRACE_ERROR("Cannot access the trailer out of the frame.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2754|      2|    return BLOSC2_ERROR_READ_BUFFER;
 2755|      2|  }
 2756|       |
 2757|       |  // Get the trailer
 2758|    447|  uint8_t* trailer = NULL;
 2759|    447|  bool needs_free = false;
 2760|    447|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (2760:7): [True: 447, False: 0]
  ------------------
 2761|    447|    trailer = frame->cframe + trailer_offset;
 2762|    447|  } else {
 2763|      0|    int64_t rbytes = 0;
 2764|       |
 2765|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 2766|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (2766:9): [True: 0, False: 0]
  ------------------
 2767|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2768|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 2769|      0|    }
 2770|       |
 2771|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (2771:9): [True: 0, False: 0]
  ------------------
 2772|      0|      trailer = malloc(trailer_len);
 2773|      0|      needs_free = true;
 2774|      0|    }
 2775|      0|    else {
 2776|      0|      needs_free = false;
 2777|      0|    }
 2778|       |
 2779|      0|    void* fp = NULL;
 2780|      0|    int64_t io_pos = 0;
 2781|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2781:9): [True: 0, False: 0]
  ------------------
 2782|       |      // Check for overflow before calculating length
 2783|      0|      if (strlen(frame->urlpath) > SIZE_MAX - strlen("/chunks.b2frame") - 1) {
  ------------------
  |  Branch (2783:11): [True: 0, False: 0]
  ------------------
 2784|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2785|      0|        if (needs_free) free(trailer);
  ------------------
  |  Branch (2785:13): [True: 0, False: 0]
  ------------------
 2786|      0|        return BLOSC2_ERROR_INVALID_PARAM;
 2787|      0|      }
 2788|      0|      size_t _len = strlen(frame->urlpath) + strlen("/chunks.b2frame") + 1;
 2789|      0|      char* eframe_name = malloc(_len);
 2790|      0|      if (eframe_name == NULL) {
  ------------------
  |  Branch (2790:11): [True: 0, False: 0]
  ------------------
 2791|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2792|      0|        if (needs_free) free(trailer);
  ------------------
  |  Branch (2792:13): [True: 0, False: 0]
  ------------------
 2793|      0|        return BLOSC2_ERROR_MEMORY_ALLOC;
 2794|      0|      }
 2795|      0|      int _w = snprintf(eframe_name, _len, "%s/chunks.b2frame", frame->urlpath);
 2796|      0|      if (_w < 0 || (size_t)_w >= _len) {
  ------------------
  |  Branch (2796:11): [True: 0, False: 0]
  |  Branch (2796:21): [True: 0, False: 0]
  ------------------
 2797|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2798|      0|        free(eframe_name);
 2799|      0|        if (needs_free) free(trailer);
  ------------------
  |  Branch (2799:13): [True: 0, False: 0]
  ------------------
 2800|      0|        return BLOSC2_ERROR_INVALID_PARAM;
 2801|      0|      }
 2802|      0|      fp = io_cb->open(eframe_name, "rb", frame->schunk->storage->io->params);
 2803|      0|      if (fp == NULL) {
  ------------------
  |  Branch (2803:11): [True: 0, False: 0]
  ------------------
 2804|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2805|      0|        free(eframe_name);
 2806|      0|        return BLOSC2_ERROR_FILE_OPEN;
 2807|      0|      }
 2808|      0|      free(eframe_name);
 2809|      0|      io_pos = trailer_offset;
 2810|      0|    }
 2811|      0|    else {
 2812|      0|      fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 2813|      0|      if (fp == NULL) {
  ------------------
  |  Branch (2813:11): [True: 0, False: 0]
  ------------------
 2814|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2815|      0|        return BLOSC2_ERROR_FILE_OPEN;
 2816|      0|      }
 2817|      0|      io_pos = frame->file_offset + trailer_offset;
 2818|      0|    }
 2819|      0|    if (fp != NULL) {
  ------------------
  |  Branch (2819:9): [True: 0, False: 0]
  ------------------
 2820|      0|      rbytes = io_cb->read((void**)&trailer, 1, trailer_len, io_pos, fp);
 2821|      0|      frame_reader_release(frame, io_cb, fp);
 2822|      0|    }
 2823|      0|    if (rbytes != trailer_len) {
  ------------------
  |  Branch (2823:9): [True: 0, False: 0]
  ------------------
 2824|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2825|      0|      if (needs_free)
  ------------------
  |  Branch (2825:11): [True: 0, False: 0]
  ------------------
 2826|      0|        free(trailer);
 2827|      0|      return BLOSC2_ERROR_FILE_READ;
 2828|      0|    }
 2829|      0|  }
 2830|       |
 2831|    447|  ret = get_vlmeta_from_trailer(frame, schunk, trailer, trailer_len);
 2832|       |
 2833|    447|  if (frame->cframe == NULL && needs_free) {
  ------------------
  |  Branch (2833:7): [True: 0, False: 447]
  |  Branch (2833:32): [True: 0, False: 0]
  ------------------
 2834|      0|    free(trailer);
 2835|      0|  }
 2836|       |
 2837|    447|  return ret;
 2838|    447|}
get_new_storage:
 2844|  9.24k|                                const blosc2_io* iodefaults) {
 2845|       |
 2846|  9.24k|  blosc2_storage* new_storage = (blosc2_storage*)calloc(1, sizeof(blosc2_storage));
 2847|  9.24k|  memcpy(new_storage, storage, sizeof(blosc2_storage));
 2848|  9.24k|  if (storage->urlpath != NULL) {
  ------------------
  |  Branch (2848:7): [True: 0, False: 9.24k]
  ------------------
 2849|      0|    char* urlpath = normalize_urlpath(storage->urlpath);
 2850|      0|    new_storage->urlpath = malloc(strlen(urlpath) + 1);
 2851|      0|    strcpy(new_storage->urlpath, urlpath);
 2852|      0|  }
 2853|       |
 2854|       |  // cparams
 2855|  9.24k|  blosc2_cparams* cparams = malloc(sizeof(blosc2_cparams));
 2856|  9.24k|  if (storage->cparams != NULL) {
  ------------------
  |  Branch (2856:7): [True: 0, False: 9.24k]
  ------------------
 2857|      0|    memcpy(cparams, storage->cparams, sizeof(blosc2_cparams));
 2858|  9.24k|  } else {
 2859|  9.24k|    memcpy(cparams, cdefaults, sizeof(blosc2_cparams));
 2860|  9.24k|  }
 2861|  9.24k|  new_storage->cparams = cparams;
 2862|       |
 2863|       |  // dparams
 2864|  9.24k|  blosc2_dparams* dparams = malloc(sizeof(blosc2_dparams));
 2865|  9.24k|  if (storage->dparams != NULL) {
  ------------------
  |  Branch (2865:7): [True: 0, False: 9.24k]
  ------------------
 2866|      0|    memcpy(dparams, storage->dparams, sizeof(blosc2_dparams));
 2867|      0|  }
 2868|  9.24k|  else {
 2869|  9.24k|    memcpy(dparams, ddefaults, sizeof(blosc2_dparams));
 2870|  9.24k|  }
 2871|  9.24k|  new_storage->dparams = dparams;
 2872|       |
 2873|       |  // iodefaults
 2874|  9.24k|  blosc2_io* udio = malloc(sizeof(blosc2_io));
 2875|  9.24k|  if (storage->io != NULL) {
  ------------------
  |  Branch (2875:7): [True: 0, False: 9.24k]
  ------------------
 2876|      0|    memcpy(udio, storage->io, sizeof(blosc2_io));
 2877|      0|  }
 2878|  9.24k|  else {
 2879|  9.24k|    memcpy(udio, iodefaults, sizeof(blosc2_io));
 2880|  9.24k|  }
 2881|  9.24k|  new_storage->io = udio;
 2882|       |
 2883|  9.24k|  return new_storage;
 2884|  9.24k|}
frame_to_schunk:
 2948|  9.27k|blosc2_schunk* frame_to_schunk(blosc2_frame_s* frame, bool copy, const blosc2_io *udio) {
 2949|  9.27k|  int32_t header_len;
 2950|  9.27k|  int64_t frame_len;
 2951|  9.27k|  int rc;
 2952|  9.27k|  bool frame_attached = true;
 2953|  9.27k|  blosc2_schunk* schunk = calloc(1, sizeof(blosc2_schunk));
 2954|  9.27k|  blosc2_cparams *cparams = NULL;
 2955|  9.27k|  blosc2_dparams *dparams = NULL;
 2956|  9.27k|  int64_t *offsets = NULL;
 2957|  9.27k|  if (schunk == NULL) {
  ------------------
  |  Branch (2957:7): [True: 0, False: 9.27k]
  ------------------
 2958|      0|    return NULL;
 2959|      0|  }
 2960|  9.27k|  schunk->frame = (blosc2_frame*)frame;
 2961|  9.27k|  frame->schunk = schunk;
 2962|       |
 2963|  9.27k|  rc = get_header_info(frame, &header_len, &frame_len, &schunk->nbytes,
 2964|  9.27k|                       &schunk->cbytes, &schunk->blocksize,
 2965|  9.27k|                       &schunk->chunksize, &schunk->nchunks, &schunk->typesize,
 2966|  9.27k|                       &schunk->compcode, &schunk->compcode_meta, &schunk->clevel, schunk->filters,
 2967|  9.27k|                       schunk->filters_meta, &schunk->splitmode, &schunk->use_dict, udio);
 2968|  9.27k|  if (rc < 0) {
  ------------------
  |  Branch (2968:7): [True: 29, False: 9.25k]
  ------------------
 2969|     29|    BLOSC_TRACE_ERROR("Unable to get meta info from frame.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2970|     29|    goto error;
 2971|     29|  }
 2972|  9.25k|  int64_t nchunks = schunk->nchunks;
 2973|  9.25k|  int64_t nbytes = schunk->nbytes;
 2974|  9.25k|  (void) nbytes;
 2975|  9.25k|  int64_t cbytes = schunk->cbytes;
 2976|       |
 2977|       |  // Compression and decompression contexts
 2978|  9.25k|  blosc2_schunk_get_cparams(schunk, &cparams);
 2979|  9.25k|  schunk->cctx = blosc2_create_cctx(*cparams);
 2980|  9.25k|  if (schunk->cctx == NULL) {
  ------------------
  |  Branch (2980:7): [True: 4, False: 9.24k]
  ------------------
 2981|      4|    BLOSC_TRACE_ERROR("Error while creating the compression context");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2982|      4|    goto error;
 2983|      4|  }
 2984|  9.24k|  blosc2_schunk_get_dparams(schunk, &dparams);
 2985|  9.24k|  schunk->dctx = blosc2_create_dctx(*dparams);
 2986|  9.24k|  if (schunk->dctx == NULL) {
  ------------------
  |  Branch (2986:7): [True: 0, False: 9.24k]
  ------------------
 2987|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2988|      0|    goto error;
 2989|      0|  }
 2990|  9.24k|  blosc2_storage storage = {.contiguous = copy ? false : true};
  ------------------
  |  Branch (2990:43): [True: 0, False: 9.24k]
  ------------------
 2991|  9.24k|  schunk->storage = get_new_storage(&storage, cparams, dparams, udio);
 2992|  9.24k|  free(cparams);
 2993|  9.24k|  cparams = NULL;
 2994|  9.24k|  free(dparams);
 2995|  9.24k|  dparams = NULL;
 2996|  9.24k|  if (nchunks > 0) {
  ------------------
  |  Branch (2996:7): [True: 9.22k, False: 22]
  ------------------
 2997|  9.22k|    rc = validate_offsets_chunk(frame, header_len, cbytes, nchunks);
 2998|  9.22k|    if (rc < 0) {
  ------------------
  |  Branch (2998:9): [True: 8.62k, False: 602]
  ------------------
 2999|  8.62k|      BLOSC_TRACE_ERROR("Cannot validate frame offsets.");
  ------------------
  |  |   93|  8.62k|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|  8.62k|    do {                                            \
  |  |  |  |   98|  8.62k|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|  8.62k|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 8.62k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|  8.62k|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3000|  8.62k|      goto error;
 3001|  8.62k|    }
 3002|  9.22k|  }
 3003|    624|  if (nchunks > 0) {
  ------------------
  |  Branch (3003:7): [True: 602, False: 22]
  ------------------
 3004|    602|    uint8_t *chunk;
 3005|    602|    bool needs_free;
 3006|       |    // A lazy chunk is enough here: only the header is needed for the flags2 byte
 3007|    602|    rc = frame_get_lazychunk(frame, 0, &chunk, &needs_free);
 3008|    602|    if (rc < 0) {
  ------------------
  |  Branch (3008:9): [True: 162, False: 440]
  ------------------
 3009|    162|      BLOSC_TRACE_ERROR("Cannot inspect the first chunk in frame.");
  ------------------
  |  |   93|    162|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    162|    do {                                            \
  |  |  |  |   98|    162|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    162|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 162, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    162|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3010|    162|      goto error;
 3011|    162|    }
 3012|    440|    schunk->flags2 = chunk[BLOSC2_CHUNK_BLOSC2_FLAGS2];
 3013|    440|    if (needs_free) {
  ------------------
  |  Branch (3013:9): [True: 277, False: 163]
  ------------------
 3014|    277|      free(chunk);
 3015|    277|    }
 3016|    440|  }
 3017|    462|  if (!copy) {
  ------------------
  |  Branch (3017:7): [True: 462, False: 0]
  ------------------
 3018|    462|    goto out;
 3019|    462|  }
 3020|       |
 3021|       |  // We are not attached to a frame anymore
 3022|      0|  schunk->frame = NULL;
 3023|      0|  frame_attached = false;
 3024|       |
 3025|      0|  if (nchunks == 0) {
  ------------------
  |  Branch (3025:7): [True: 0, False: 0]
  ------------------
 3026|      0|    frame->schunk = NULL;
 3027|      0|    goto out;
 3028|      0|  }
 3029|       |
 3030|       |  // Get the compressed offsets
 3031|      0|  int32_t coffsets_cbytes = 0;
 3032|      0|  uint8_t* coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &coffsets_cbytes);
 3033|      0|  if (coffsets == NULL) {
  ------------------
  |  Branch (3033:7): [True: 0, False: 0]
  ------------------
 3034|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3035|      0|    goto error;
 3036|      0|  }
 3037|       |
 3038|       |  // Decompress offsets
 3039|      0|  blosc2_dparams off_dparams = BLOSC2_DPARAMS_DEFAULTS;
 3040|      0|  blosc2_context *dctx = blosc2_create_dctx(off_dparams);
 3041|      0|  if (dctx == NULL) {
  ------------------
  |  Branch (3041:7): [True: 0, False: 0]
  ------------------
 3042|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3043|      0|    goto error;
 3044|      0|  }
 3045|      0|  int32_t offsets_nbytes;
 3046|      0|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &offsets_nbytes)) {
  ------------------
  |  Branch (3046:7): [True: 0, False: 0]
  ------------------
 3047|      0|    blosc2_free_ctx(dctx);
 3048|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3049|      0|    goto error;
 3050|      0|  }
 3051|      0|  offsets = (int64_t *) malloc((size_t)offsets_nbytes);
 3052|      0|  if (offsets == NULL) {
  ------------------
  |  Branch (3052:7): [True: 0, False: 0]
  ------------------
 3053|      0|    blosc2_free_ctx(dctx);
 3054|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3055|      0|    goto error;
 3056|      0|  }
 3057|      0|  int32_t off_nbytes = blosc2_decompress_ctx(dctx, coffsets, coffsets_cbytes,
 3058|      0|                                             offsets, offsets_nbytes);
 3059|      0|  blosc2_free_ctx(dctx);
 3060|      0|  if (off_nbytes < 0) {
  ------------------
  |  Branch (3060:7): [True: 0, False: 0]
  ------------------
 3061|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3062|      0|    goto error;
 3063|      0|  }
 3064|       |
 3065|       |  // We want the contiguous schunk, so create the actual data chunks (and, while doing this,
 3066|       |  // get a guess at the blocksize used in this frame)
 3067|      0|  int64_t acc_nbytes = 0;
 3068|      0|  int64_t acc_cbytes = 0;
 3069|      0|  int32_t blocksize = 0;
 3070|      0|  int32_t chunk_nbytes;
 3071|      0|  int32_t chunk_cbytes;
 3072|      0|  int32_t chunk_blocksize;
 3073|      0|  size_t prev_alloc = BLOSC_EXTENDED_HEADER_LENGTH;
 3074|      0|  uint8_t* data_chunk = NULL;
 3075|      0|  bool needs_free = false;
 3076|      0|  const blosc2_io_cb *io_cb = blosc2_get_io_cb(udio->id);
 3077|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (3077:7): [True: 0, False: 0]
  ------------------
 3078|      0|    blosc2_schunk_free(schunk);
 3079|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3080|      0|    return NULL;
 3081|      0|  }
 3082|       |
 3083|      0|  void* fp = NULL;
 3084|      0|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3084:7): [True: 0, False: 0]
  ------------------
 3085|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (3085:9): [True: 0, False: 0]
  ------------------
 3086|      0|      data_chunk = malloc((size_t)prev_alloc);
 3087|      0|      needs_free = true;
 3088|      0|    }
 3089|      0|    else {
 3090|      0|      needs_free = false;
 3091|      0|    }
 3092|       |
 3093|      0|    if (!frame->sframe) {
  ------------------
  |  Branch (3093:9): [True: 0, False: 0]
  ------------------
 3094|       |      // If not the chunks won't be in the frame
 3095|      0|      fp = frame_reader_acquire(frame, udio);
 3096|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3096:11): [True: 0, False: 0]
  ------------------
 3097|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3098|      0|        rc = BLOSC2_ERROR_FILE_OPEN;
 3099|      0|        goto end;
 3100|      0|      }
 3101|      0|    }
 3102|      0|  }
 3103|      0|  schunk->data = malloc(nchunks * sizeof(void*));
 3104|      0|  for (int64_t i = 0; i < nchunks; i++) {
  ------------------
  |  Branch (3104:23): [True: 0, False: 0]
  ------------------
 3105|      0|    if (frame->cframe != NULL) {
  ------------------
  |  Branch (3105:9): [True: 0, False: 0]
  ------------------
 3106|      0|      if (needs_free) {
  ------------------
  |  Branch (3106:11): [True: 0, False: 0]
  ------------------
 3107|      0|        free(data_chunk);
 3108|      0|      }
 3109|      0|      if (offsets[i] < 0) {
  ------------------
  |  Branch (3109:11): [True: 0, False: 0]
  ------------------
 3110|      0|        int64_t rbytes = frame_get_chunk(frame, i, &data_chunk, &needs_free);
 3111|      0|        if (rbytes < 0) {
  ------------------
  |  Branch (3111:13): [True: 0, False: 0]
  ------------------
 3112|      0|          break;
 3113|      0|        }
 3114|      0|      }
 3115|      0|      else {
 3116|      0|        if (offsets[i] > INT64_MAX - header_len ||
  ------------------
  |  Branch (3116:13): [True: 0, False: 0]
  ------------------
 3117|      0|            header_len + offsets[i] > frame->len - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3117:13): [True: 0, False: 0]
  ------------------
 3118|      0|            offsets[i] > cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3118:13): [True: 0, False: 0]
  ------------------
 3119|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 3120|      0|          break;
 3121|      0|        }
 3122|      0|        data_chunk = frame->cframe + header_len + offsets[i];
 3123|      0|        needs_free = false;
 3124|      0|      }
 3125|      0|      rc = blosc2_cbuffer_sizes(data_chunk, NULL, &chunk_cbytes, NULL);
 3126|      0|      if (rc < 0) {
  ------------------
  |  Branch (3126:11): [True: 0, False: 0]
  ------------------
 3127|      0|        break;
 3128|      0|      }
 3129|      0|      if (offsets[i] >= 0 &&
  ------------------
  |  Branch (3129:11): [True: 0, False: 0]
  ------------------
 3130|      0|          (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3130:12): [True: 0, False: 0]
  ------------------
 3131|      0|           offsets[i] > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (3131:12): [True: 0, False: 0]
  ------------------
 3132|      0|           offsets[i] + chunk_cbytes > cbytes)) {
  ------------------
  |  Branch (3132:12): [True: 0, False: 0]
  ------------------
 3133|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3134|      0|        break;
 3135|      0|      }
 3136|      0|    }
 3137|      0|    else {
 3138|      0|      int64_t rbytes;
 3139|      0|      if (offsets[i] < 0 || frame->sframe) {
  ------------------
  |  Branch (3139:11): [True: 0, False: 0]
  |  Branch (3139:29): [True: 0, False: 0]
  ------------------
 3140|      0|        if (needs_free) {
  ------------------
  |  Branch (3140:13): [True: 0, False: 0]
  ------------------
 3141|      0|          free(data_chunk);
 3142|      0|        }
 3143|      0|        rbytes = frame_get_chunk(frame, i, &data_chunk, &needs_free);
 3144|      0|        if (rbytes < 0) {
  ------------------
  |  Branch (3144:13): [True: 0, False: 0]
  ------------------
 3145|      0|          break;
 3146|      0|        }
 3147|      0|      }
 3148|      0|      else {
 3149|      0|        if (offsets[i] > INT64_MAX - header_len ||
  ------------------
  |  Branch (3149:13): [True: 0, False: 0]
  ------------------
 3150|      0|            header_len + offsets[i] > frame->len - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3150:13): [True: 0, False: 0]
  ------------------
 3151|      0|            offsets[i] > cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3151:13): [True: 0, False: 0]
  ------------------
 3152|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 3153|      0|          break;
 3154|      0|        }
 3155|      0|        int64_t io_pos = frame->file_offset + header_len + offsets[i];
 3156|      0|        rbytes = io_cb->read((void**)&data_chunk, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, fp);
 3157|      0|      }
 3158|      0|      if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3158:11): [True: 0, False: 0]
  ------------------
 3159|      0|        rc = BLOSC2_ERROR_READ_BUFFER;
 3160|      0|        break;
 3161|      0|      }
 3162|      0|      rc = blosc2_cbuffer_sizes(data_chunk, NULL, &chunk_cbytes, NULL);
 3163|      0|      if (rc < 0) {
  ------------------
  |  Branch (3163:11): [True: 0, False: 0]
  ------------------
 3164|      0|        break;
 3165|      0|      }
 3166|      0|      if (offsets[i] >= 0 &&
  ------------------
  |  Branch (3166:11): [True: 0, False: 0]
  ------------------
 3167|      0|          (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3167:12): [True: 0, False: 0]
  ------------------
 3168|      0|           offsets[i] > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (3168:12): [True: 0, False: 0]
  ------------------
 3169|      0|           offsets[i] + chunk_cbytes > cbytes)) {
  ------------------
  |  Branch (3169:12): [True: 0, False: 0]
  ------------------
 3170|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3171|      0|        break;
 3172|      0|      }
 3173|      0|      if (chunk_cbytes > (int32_t)prev_alloc) {
  ------------------
  |  Branch (3173:11): [True: 0, False: 0]
  ------------------
 3174|      0|        if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (3174:13): [True: 0, False: 0]
  ------------------
 3175|      0|          data_chunk = realloc(data_chunk, chunk_cbytes);
 3176|      0|        if (data_chunk == NULL) {
  ------------------
  |  Branch (3176:13): [True: 0, False: 0]
  ------------------
 3177|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3178|      0|          rc = BLOSC2_ERROR_MEMORY_ALLOC;
 3179|      0|          break;
 3180|      0|        }
 3181|      0|        prev_alloc = chunk_cbytes;
 3182|      0|      }
 3183|      0|      if (!frame->sframe) {
  ------------------
  |  Branch (3183:11): [True: 0, False: 0]
  ------------------
 3184|      0|        int64_t io_pos = frame->file_offset + header_len + offsets[i];
 3185|      0|        rbytes = io_cb->read((void**)&data_chunk, 1, chunk_cbytes, io_pos, fp);
 3186|      0|        if (rbytes != chunk_cbytes) {
  ------------------
  |  Branch (3186:13): [True: 0, False: 0]
  ------------------
 3187|      0|          rc = BLOSC2_ERROR_READ_BUFFER;
 3188|      0|          break;
 3189|      0|        }
 3190|      0|      }
 3191|      0|    }
 3192|      0|    uint8_t* new_chunk = malloc(chunk_cbytes);
 3193|      0|    memcpy(new_chunk, data_chunk, chunk_cbytes);
 3194|      0|    schunk->data[i] = new_chunk;
 3195|      0|    rc = blosc2_cbuffer_sizes(data_chunk, &chunk_nbytes, NULL, &chunk_blocksize);
 3196|      0|    if (rc < 0) {
  ------------------
  |  Branch (3196:9): [True: 0, False: 0]
  ------------------
 3197|      0|      break;
 3198|      0|    }
 3199|      0|    acc_nbytes += chunk_nbytes;
 3200|      0|    acc_cbytes += chunk_cbytes;
 3201|      0|    if (i == 0) {
  ------------------
  |  Branch (3201:9): [True: 0, False: 0]
  ------------------
 3202|      0|      blocksize = chunk_blocksize;
 3203|      0|    }
 3204|      0|    else if (blocksize != chunk_blocksize) {
  ------------------
  |  Branch (3204:14): [True: 0, False: 0]
  ------------------
 3205|       |      // Blocksize varies
 3206|      0|      blocksize = 0;
 3207|      0|    }
 3208|      0|  }
 3209|       |
 3210|       |  // We are not attached to a schunk anymore
 3211|      0|  frame->schunk = NULL;
 3212|       |
 3213|      0|  end:
 3214|      0|  if (needs_free) {
  ------------------
  |  Branch (3214:7): [True: 0, False: 0]
  ------------------
 3215|      0|    free(data_chunk);
 3216|      0|  }
 3217|      0|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3217:7): [True: 0, False: 0]
  ------------------
 3218|      0|    if (!frame->sframe) {
  ------------------
  |  Branch (3218:9): [True: 0, False: 0]
  ------------------
 3219|      0|      frame_reader_release(frame, io_cb, fp);
 3220|      0|    }
 3221|      0|  }
 3222|      0|  free(offsets);
 3223|       |  // Avoid a double-free in the `error:` cleanup below, which is reached
 3224|       |  // when frame_get_metalayers / frame_get_vlmetalayers reject a malformed
 3225|       |  // metalayer index after we've already freed `offsets` here.
 3226|      0|  offsets = NULL;
 3227|       |
 3228|       |  // cframes and sframes have different ways to store chunks with special values:
 3229|       |  // 1) cframes represent special chunks as negative offsets
 3230|       |  // 2) sframes does not have the concept of offsets, but rather of data pointers (.data)
 3231|       |  //    so they always have a pointer to a special chunk
 3232|       |  // This is why cframes and sframes have different cbytes and hence, we cannot enforce acc_bytes == schunk->cbytes
 3233|       |  // In the future, maybe we could provide special meanings for .data[i] > 0x7FFFFFFF, but not there yet
 3234|       |  // if (rc < 0 || acc_nbytes != nbytes || acc_cbytes != cbytes) {
 3235|      0|  if (rc < 0 || acc_nbytes != nbytes) {
  ------------------
  |  Branch (3235:7): [True: 0, False: 0]
  |  Branch (3235:17): [True: 0, False: 0]
  ------------------
 3236|      0|    goto error;
 3237|      0|  }
 3238|       |  // Update counters
 3239|      0|  schunk->cbytes = acc_cbytes;
 3240|      0|  schunk->blocksize = blocksize;
 3241|       |
 3242|    462|  out:
 3243|    462|  rc = frame_get_metalayers(frame, schunk);
 3244|    462|  if (rc < 0) {
  ------------------
  |  Branch (3244:7): [True: 13, False: 449]
  ------------------
 3245|     13|    BLOSC_TRACE_ERROR("Cannot access the metalayers.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3246|     13|    goto error;
 3247|     13|  }
 3248|       |
 3249|    449|  rc = frame_get_vlmetalayers(frame, schunk);
 3250|    449|  if (rc < 0) {
  ------------------
  |  Branch (3250:7): [True: 70, False: 379]
  ------------------
 3251|     70|    BLOSC_TRACE_ERROR("Cannot access the vlmetalayers.");
  ------------------
  |  |   93|     70|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     70|    do {                                            \
  |  |  |  |   98|     70|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     70|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 70, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     70|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3252|     70|    goto error;
 3253|     70|  }
 3254|       |
 3255|    379|  return schunk;
 3256|       |
 3257|  8.90k|error:
 3258|  8.90k|  free(cparams);
 3259|  8.90k|  free(dparams);
 3260|  8.90k|  free(offsets);
 3261|  8.90k|  if (schunk != NULL) {
  ------------------
  |  Branch (3261:7): [True: 8.90k, False: 0]
  ------------------
 3262|  8.90k|    blosc2_schunk_free(schunk);
 3263|  8.90k|  }
 3264|  8.90k|  if (!frame_attached) {
  ------------------
  |  Branch (3264:7): [True: 0, False: 8.90k]
  ------------------
 3265|      0|    frame->schunk = NULL;
 3266|      0|    frame_free(frame);
 3267|      0|  }
 3268|       |  return NULL;
 3269|    449|}
get_coffset:
 3291|  10.3k|                int64_t nchunk, int64_t nchunks, int64_t *offset) {
 3292|  10.3k|  int32_t off_cbytes;
 3293|       |  // Get the offset to nchunk
 3294|  10.3k|  uint8_t *coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &off_cbytes);
 3295|  10.3k|  if (coffsets == NULL) {
  ------------------
  |  Branch (3295:7): [True: 0, False: 10.3k]
  ------------------
 3296|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3297|      0|    return BLOSC2_ERROR_DATA;
 3298|      0|  }
 3299|       |
 3300|       |  // Get the 64-bit offset
 3301|  10.3k|  int rc = blosc2_getitem(coffsets, off_cbytes, (int32_t)nchunk, 1, offset, (int32_t)sizeof(int64_t));
 3302|  10.3k|  if (rc < 0) {
  ------------------
  |  Branch (3302:7): [True: 18, False: 10.3k]
  ------------------
 3303|     18|    BLOSC_TRACE_ERROR("Problems retrieving a chunk offset.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3304|  10.3k|  } else if (!frame->sframe && *offset >= 0) {
  ------------------
  |  Branch (3304:14): [True: 10.3k, False: 0]
  |  Branch (3304:32): [True: 8.50k, False: 1.87k]
  ------------------
 3305|  8.50k|    if (cbytes < 0 || cbytes > INT64_MAX - header_len) {
  ------------------
  |  Branch (3305:9): [True: 0, False: 8.50k]
  |  Branch (3305:23): [True: 14, False: 8.48k]
  ------------------
 3306|     14|      BLOSC_TRACE_ERROR("Invalid compressed size in frame header.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3307|     14|      return BLOSC2_ERROR_INVALID_HEADER;
 3308|     14|    }
 3309|  8.48k|    if (*offset > INT64_MAX - header_len) {
  ------------------
  |  Branch (3309:9): [True: 0, False: 8.48k]
  ------------------
 3310|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3311|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3312|      0|    }
 3313|  8.48k|    int64_t chunk_pos = header_len + *offset;
 3314|  8.48k|    int64_t data_limit = header_len + cbytes;
 3315|  8.48k|    if (chunk_pos < header_len ||
  ------------------
  |  Branch (3315:9): [True: 0, False: 8.48k]
  ------------------
 3316|  8.48k|        chunk_pos > data_limit - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3316:9): [True: 55, False: 8.43k]
  ------------------
 3317|  8.43k|        chunk_pos > frame->len - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3317:9): [True: 99, False: 8.33k]
  ------------------
 3318|    154|      BLOSC_TRACE_ERROR("Cannot read chunk %" PRId64 " outside of frame boundary.", nchunk);
  ------------------
  |  |   93|    154|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    154|    do {                                            \
  |  |  |  |   98|    154|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    154|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 154, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    154|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3319|    154|      return BLOSC2_ERROR_INVALID_HEADER;
 3320|    154|    }
 3321|  8.48k|  }
 3322|       |
 3323|  10.2k|  return rc;
 3324|  10.3k|}
frame_special_chunk:
 3329|  1.87k|                        uint8_t** chunk, int32_t cbytes, bool *needs_free) {
 3330|  1.87k|  int rc = 0;
 3331|  1.87k|  *chunk = malloc(cbytes);
 3332|  1.87k|  *needs_free = true;
 3333|       |
 3334|       |  // Detect the kind of special value
 3335|  1.87k|  uint64_t zeros_mask = (uint64_t) BLOSC2_SPECIAL_ZERO << (8 * 7);  // chunk of zeros
 3336|  1.87k|  uint64_t nans_mask = (uint64_t) BLOSC2_SPECIAL_NAN << (8 * 7);  // chunk of NaNs
 3337|  1.87k|  uint64_t uninit_mask = (uint64_t) BLOSC2_SPECIAL_UNINIT << (8 * 7);  // chunk of uninit values
 3338|       |
 3339|  1.87k|  blosc2_cparams cparams = BLOSC2_CPARAMS_DEFAULTS;
 3340|  1.87k|  cparams.typesize = typesize;
 3341|  1.87k|  cparams.blocksize = blocksize;
 3342|  1.87k|  if (special_value & zeros_mask) {
  ------------------
  |  Branch (3342:7): [True: 1.21k, False: 663]
  ------------------
 3343|  1.21k|    rc = blosc2_chunk_zeros(cparams, nbytes, *chunk, cbytes);
 3344|  1.21k|    if (rc < 0) {
  ------------------
  |  Branch (3344:9): [True: 3, False: 1.21k]
  ------------------
 3345|      3|      BLOSC_TRACE_ERROR("Error creating a zero 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3346|      3|    }
 3347|  1.21k|  }
 3348|    663|  else if (special_value & uninit_mask) {
  ------------------
  |  Branch (3348:12): [True: 535, False: 128]
  ------------------
 3349|    535|    rc = blosc2_chunk_uninit(cparams, nbytes, *chunk, cbytes);
 3350|    535|    if (rc < 0) {
  ------------------
  |  Branch (3350:9): [True: 2, False: 533]
  ------------------
 3351|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3352|      2|    }
 3353|    535|  }
 3354|    128|  else if (special_value & nans_mask) {
  ------------------
  |  Branch (3354:12): [True: 125, False: 3]
  ------------------
 3355|    125|    rc = blosc2_chunk_nans(cparams, nbytes, *chunk, cbytes);
 3356|    125|    if (rc < 0) {
  ------------------
  |  Branch (3356:9): [True: 2, False: 123]
  ------------------
 3357|      2|      BLOSC_TRACE_ERROR("Error creating a nan 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3358|      2|    }
 3359|    125|  }
 3360|      3|  else {
 3361|      3|    BLOSC_TRACE_ERROR("Special value not recognized: %" PRId64 "", special_value);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3362|      3|    rc = BLOSC2_ERROR_DATA;
 3363|      3|  }
 3364|       |
 3365|  1.87k|  if (rc < 0) {
  ------------------
  |  Branch (3365:7): [True: 10, False: 1.86k]
  ------------------
 3366|     10|    free(*chunk);
 3367|     10|    *needs_free = false;
 3368|     10|    *chunk = NULL;
 3369|     10|  }
 3370|       |
 3371|  1.87k|  return rc;
 3372|  1.87k|}
frame_get_chunk:
 3385|  9.79k|int frame_get_chunk(blosc2_frame_s *frame, int64_t nchunk, uint8_t **chunk, bool *needs_free) {
 3386|  9.79k|  int32_t header_len;
 3387|  9.79k|  int64_t frame_len;
 3388|  9.79k|  int64_t nbytes;
 3389|  9.79k|  int64_t cbytes;
 3390|  9.79k|  int32_t blocksize;
 3391|  9.79k|  int32_t chunksize;
 3392|  9.79k|  int64_t nchunks;
 3393|  9.79k|  int32_t typesize;
 3394|  9.79k|  int64_t offset;
 3395|  9.79k|  int32_t chunk_cbytes;
 3396|  9.79k|  int rc;
 3397|       |
 3398|  9.79k|  *chunk = NULL;
 3399|  9.79k|  *needs_free = false;
 3400|  9.79k|  rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 3401|  9.79k|                       &blocksize, &chunksize, &nchunks,
 3402|  9.79k|                       &typesize, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 3403|  9.79k|                       frame->schunk->storage->io);
 3404|  9.79k|  if (rc < 0) {
  ------------------
  |  Branch (3404:7): [True: 0, False: 9.79k]
  ------------------
 3405|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3406|      0|    return rc;
 3407|      0|  }
 3408|  9.79k|  rc = frame_refresh_if_stale(frame, frame_len);
 3409|  9.79k|  if (rc < 0) {
  ------------------
  |  Branch (3409:7): [True: 0, False: 9.79k]
  ------------------
 3410|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3411|      0|    return rc;
 3412|      0|  }
 3413|  9.79k|  if (rc > 0) {
  ------------------
  |  Branch (3413:7): [True: 0, False: 9.79k]
  ------------------
 3414|       |    // Keep the schunk-level counters in sync with the refreshed on-disk state.
 3415|       |    // Mutating ops (update/delete) read a chunk before adjusting the counters,
 3416|       |    // so this also gives them a fresh base to apply their deltas on.
 3417|      0|    frame->schunk->nbytes = nbytes;
 3418|      0|    frame->schunk->cbytes = cbytes;
 3419|      0|    frame->schunk->nchunks = nchunks;
 3420|      0|  }
 3421|       |
 3422|  9.79k|  if ((nchunks > 0) && (nchunk >= nchunks)) {
  ------------------
  |  Branch (3422:7): [True: 9.79k, False: 0]
  |  Branch (3422:24): [True: 0, False: 9.79k]
  ------------------
 3423|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3424|      0|                    "('%" PRId64 "') in frame.", nchunk, nchunks);
 3425|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 3426|      0|  }
 3427|       |
 3428|       |  // Get the offset to nchunk
 3429|  9.79k|  rc = get_coffset(frame, header_len, cbytes, nchunk, nchunks, &offset);
 3430|  9.79k|  if (rc < 0) {
  ------------------
  |  Branch (3430:7): [True: 40, False: 9.75k]
  ------------------
 3431|     40|    BLOSC_TRACE_ERROR("Unable to get offset to chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3432|     40|    return rc;
 3433|     40|  }
 3434|       |
 3435|  9.75k|  if (offset < 0) {
  ------------------
  |  Branch (3435:7): [True: 1.59k, False: 8.15k]
  ------------------
 3436|       |    // Special value
 3437|  1.59k|    chunk_cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 3438|  1.59k|    int32_t chunksize_ = chunksize;
 3439|  1.59k|    if ((nchunk == nchunks - 1) && (nbytes % chunksize)) {
  ------------------
  |  Branch (3439:9): [True: 0, False: 1.59k]
  |  Branch (3439:36): [True: 0, False: 0]
  ------------------
 3440|       |      // Last chunk is incomplete.  Compute its actual size.
 3441|      0|      chunksize_ = (int32_t) (nbytes % chunksize);
 3442|      0|    }
 3443|  1.59k|    rc = frame_special_chunk(offset, chunksize_, typesize, blocksize, chunk, chunk_cbytes, needs_free);
 3444|  1.59k|    if (rc < 0) {
  ------------------
  |  Branch (3444:9): [True: 6, False: 1.58k]
  ------------------
 3445|      6|      return rc;
 3446|      6|    }
 3447|  1.58k|    goto end;
 3448|  1.59k|  }
 3449|       |
 3450|  8.15k|  if (frame->sframe) {
  ------------------
  |  Branch (3450:7): [True: 0, False: 8.15k]
  ------------------
 3451|       |    // Sparse on-disk
 3452|      0|    nchunk = offset;
 3453|      0|    return sframe_get_chunk(frame, nchunk, chunk, needs_free);
 3454|      0|  }
 3455|       |
 3456|  8.15k|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 3457|  8.15k|  if (io_cb == NULL) {
  ------------------
  |  Branch (3457:7): [True: 0, False: 8.15k]
  ------------------
 3458|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3459|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 3460|      0|  }
 3461|       |
 3462|  8.15k|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3462:7): [True: 0, False: 8.15k]
  ------------------
 3463|      0|    uint8_t* header_ptr;
 3464|      0|    uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 3465|      0|    void* fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 3466|      0|    if (fp == NULL) {
  ------------------
  |  Branch (3466:9): [True: 0, False: 0]
  ------------------
 3467|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3468|      0|      return BLOSC2_ERROR_FILE_OPEN;
 3469|      0|    }
 3470|      0|    if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (3470:9): [True: 0, False: 0]
  ------------------
 3471|      0|      header_ptr = header;
 3472|      0|    int64_t io_pos = frame->file_offset + header_len + offset;
 3473|      0|    int64_t rbytes = io_cb->read((void**)&header_ptr, 1, sizeof(header), io_pos, fp);
 3474|      0|    if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3474:9): [True: 0, False: 0]
  ------------------
 3475|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3476|      0|      frame_reader_release(frame, io_cb, fp);
 3477|      0|      return BLOSC2_ERROR_FILE_READ;
 3478|      0|    }
 3479|      0|    rc = blosc2_cbuffer_sizes(header_ptr, NULL, &chunk_cbytes, NULL);
 3480|      0|    if (rc < 0) {
  ------------------
  |  Branch (3480:9): [True: 0, False: 0]
  ------------------
 3481|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3482|      0|      frame_reader_release(frame, io_cb, fp);
 3483|      0|      return rc;
 3484|      0|    }
 3485|      0|    if (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3485:9): [True: 0, False: 0]
  ------------------
 3486|      0|        offset > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (3486:9): [True: 0, False: 0]
  ------------------
 3487|      0|        offset + chunk_cbytes > cbytes) {
  ------------------
  |  Branch (3487:9): [True: 0, False: 0]
  ------------------
 3488|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3489|      0|      frame_reader_release(frame, io_cb, fp);
 3490|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3491|      0|    }
 3492|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (3492:9): [True: 0, False: 0]
  ------------------
 3493|      0|      *chunk = malloc(chunk_cbytes);
 3494|      0|      *needs_free = true;
 3495|      0|    }
 3496|      0|    else {
 3497|      0|      *needs_free = false;
 3498|      0|    }
 3499|       |
 3500|      0|    io_pos = frame->file_offset + header_len + offset;
 3501|      0|    rbytes = io_cb->read((void**)chunk, 1, chunk_cbytes, io_pos, fp);
 3502|      0|    frame_reader_release(frame, io_cb, fp);
 3503|      0|    if (rbytes != chunk_cbytes) {
  ------------------
  |  Branch (3503:9): [True: 0, False: 0]
  ------------------
 3504|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3505|      0|      return BLOSC2_ERROR_FILE_READ;
 3506|      0|    }
 3507|       |
 3508|  8.15k|  } else {
 3509|       |    // The chunk is in memory and just one pointer away
 3510|  8.15k|    *chunk = frame->cframe + header_len + offset;
 3511|  8.15k|    rc = blosc2_cbuffer_sizes(*chunk, NULL, &chunk_cbytes, NULL);
 3512|  8.15k|    if (rc < 0) {
  ------------------
  |  Branch (3512:9): [True: 8, False: 8.15k]
  ------------------
 3513|      8|      return rc;
 3514|      8|    }
 3515|  8.15k|    if (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3515:9): [True: 1, False: 8.15k]
  ------------------
 3516|  8.15k|        offset > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (3516:9): [True: 0, False: 8.15k]
  ------------------
 3517|  8.15k|        offset + chunk_cbytes > cbytes) {
  ------------------
  |  Branch (3517:9): [True: 45, False: 8.10k]
  ------------------
 3518|     46|      BLOSC_TRACE_ERROR("Invalid chunk size in frame for chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|     46|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     46|    do {                                            \
  |  |  |  |   98|     46|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     46|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 46, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     46|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3519|     46|      return BLOSC2_ERROR_INVALID_HEADER;
 3520|     46|    }
 3521|  8.15k|  }
 3522|       |
 3523|  9.69k|  end:
 3524|  9.69k|  return (int32_t)chunk_cbytes;
 3525|  8.15k|}
frame_get_lazychunk:
 3538|    602|int frame_get_lazychunk(blosc2_frame_s *frame, int64_t nchunk, uint8_t **chunk, bool *needs_free) {
 3539|    602|  int32_t header_len;
 3540|    602|  int64_t frame_len;
 3541|    602|  int64_t nbytes;
 3542|    602|  int64_t cbytes;
 3543|    602|  int32_t blocksize;
 3544|    602|  int32_t chunksize;
 3545|    602|  int64_t nchunks;
 3546|    602|  int32_t typesize;
 3547|    602|  int32_t lazychunk_cbytes;
 3548|    602|  int64_t offset;
 3549|    602|  void* fp = NULL;
 3550|    602|  int32_t* block_csizes = NULL;
 3551|    602|  struct csize_idx *csize_idx = NULL;
 3552|       |
 3553|    602|  *chunk = NULL;
 3554|    602|  *needs_free = false;
 3555|    602|  int rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 3556|    602|                           &blocksize, &chunksize, &nchunks,
 3557|    602|                           &typesize, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 3558|    602|                           frame->schunk->storage->io);
 3559|    602|  if (rc < 0) {
  ------------------
  |  Branch (3559:7): [True: 0, False: 602]
  ------------------
 3560|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3561|      0|    return rc;
 3562|      0|  }
 3563|    602|  rc = frame_refresh_if_stale(frame, frame_len);
 3564|    602|  if (rc < 0) {
  ------------------
  |  Branch (3564:7): [True: 0, False: 602]
  ------------------
 3565|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3566|      0|    return rc;
 3567|      0|  }
 3568|    602|  if (rc > 0) {
  ------------------
  |  Branch (3568:7): [True: 0, False: 602]
  ------------------
 3569|       |    // Keep the schunk-level counters in sync with the refreshed on-disk state
 3570|       |    // (see frame_get_chunk).
 3571|      0|    frame->schunk->nbytes = nbytes;
 3572|      0|    frame->schunk->cbytes = cbytes;
 3573|      0|    frame->schunk->nchunks = nchunks;
 3574|      0|  }
 3575|       |
 3576|    602|  if (nchunk >= nchunks) {
  ------------------
  |  Branch (3576:7): [True: 0, False: 602]
  ------------------
 3577|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3578|      0|                      "('%" PRId64 "') in frame.", nchunk, nchunks);
 3579|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 3580|      0|  }
 3581|       |
 3582|       |  // Get the offset to nchunk
 3583|    602|  rc = get_coffset(frame, header_len, cbytes, nchunk, nchunks, &offset);
 3584|    602|  if (rc < 0) {
  ------------------
  |  Branch (3584:7): [True: 146, False: 456]
  ------------------
 3585|    146|    BLOSC_TRACE_ERROR("Unable to get offset to chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|    146|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    146|    do {                                            \
  |  |  |  |   98|    146|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    146|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 146, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    146|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3586|    146|    return rc;
 3587|    146|  }
 3588|       |
 3589|    456|  if (offset < 0) {
  ------------------
  |  Branch (3589:7): [True: 281, False: 175]
  ------------------
 3590|       |    // Special value
 3591|    281|    lazychunk_cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 3592|    281|    int32_t chunksize_ = chunksize;
 3593|    281|    if ((nchunk == nchunks - 1) && (nbytes % chunksize)) {
  ------------------
  |  Branch (3593:9): [True: 4, False: 277]
  |  Branch (3593:36): [True: 4, False: 0]
  ------------------
 3594|       |      // Last chunk is incomplete.  Compute its actual size.
 3595|      4|      chunksize_ = (int32_t) (nbytes % chunksize);
 3596|      4|    }
 3597|    281|    rc = frame_special_chunk(offset, chunksize_, typesize, blocksize, chunk,
 3598|    281|                             (int32_t)lazychunk_cbytes, needs_free);
 3599|    281|    goto end;
 3600|    281|  }
 3601|       |
 3602|    175|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 3603|    175|  if (io_cb == NULL) {
  ------------------
  |  Branch (3603:7): [True: 0, False: 175]
  ------------------
 3604|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3605|      0|    rc = BLOSC2_ERROR_PLUGIN_IO;
 3606|      0|    goto end;
 3607|      0|  }
 3608|       |
 3609|    175|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3609:7): [True: 0, False: 175]
  ------------------
 3610|       |    // TODO: make this portable across different endianness
 3611|       |    // Get info for building a lazy chunk
 3612|      0|    int32_t chunk_nbytes;
 3613|      0|    int32_t chunk_cbytes;
 3614|      0|    int32_t chunk_blocksize;
 3615|      0|    uint8_t* header_ptr;
 3616|      0|    uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 3617|      0|    int64_t io_pos = 0;
 3618|      0|    if (frame->sframe) {
  ------------------
  |  Branch (3618:9): [True: 0, False: 0]
  ------------------
 3619|       |      // The chunk is not in the frame
 3620|      0|      fp = sframe_open_chunk(frame->urlpath, offset, "rb",
 3621|      0|                             frame->schunk->storage->io);
 3622|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3622:11): [True: 0, False: 0]
  ------------------
 3623|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3624|      0|        return BLOSC2_ERROR_FILE_OPEN;
 3625|      0|      }
 3626|      0|    }
 3627|      0|    else {
 3628|      0|      fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 3629|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3629:11): [True: 0, False: 0]
  ------------------
 3630|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3631|      0|        return BLOSC2_ERROR_FILE_OPEN;
 3632|      0|      }
 3633|      0|      io_pos = frame->file_offset + header_len + offset;
 3634|      0|    }
 3635|      0|    if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (3635:9): [True: 0, False: 0]
  ------------------
 3636|      0|      header_ptr = header;
 3637|      0|    int64_t rbytes = io_cb->read((void**)&header_ptr, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, fp);
 3638|      0|    if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3638:9): [True: 0, False: 0]
  ------------------
 3639|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3640|      0|      rc = BLOSC2_ERROR_FILE_READ;
 3641|      0|      goto end;
 3642|      0|    }
 3643|      0|    rc = blosc2_cbuffer_sizes(header_ptr, &chunk_nbytes, &chunk_cbytes, &chunk_blocksize);
 3644|      0|    if (rc < 0) {
  ------------------
  |  Branch (3644:9): [True: 0, False: 0]
  ------------------
 3645|      0|      goto end;
 3646|      0|    }
 3647|      0|    if (chunk_nbytes < 0 || chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH || chunk_blocksize <= 0) {
  ------------------
  |  Branch (3647:9): [True: 0, False: 0]
  |  Branch (3647:29): [True: 0, False: 0]
  |  Branch (3647:76): [True: 0, False: 0]
  ------------------
 3648|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 3649|      0|      goto end;
 3650|      0|    }
 3651|      0|    bool vlblocks = (header_ptr[BLOSC2_CHUNK_BLOSC2_FLAGS2] & BLOSC2_VL_BLOCKS) != 0;
 3652|      0|    size_t nblocks;
 3653|      0|    size_t leftover_block = 0;
 3654|      0|    if (vlblocks) {
  ------------------
  |  Branch (3654:9): [True: 0, False: 0]
  ------------------
 3655|      0|      nblocks = (size_t)chunk_blocksize;
 3656|      0|    }
 3657|      0|    else {
 3658|      0|      nblocks = (size_t)chunk_nbytes / (size_t)chunk_blocksize;
 3659|      0|      leftover_block = (size_t)chunk_nbytes % (size_t)chunk_blocksize;
 3660|      0|      if (leftover_block) {
  ------------------
  |  Branch (3660:11): [True: 0, False: 0]
  ------------------
 3661|      0|        if (nblocks == SIZE_MAX) {
  ------------------
  |  Branch (3661:13): [True: 0, False: 0]
  ------------------
 3662|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 3663|      0|          goto end;
 3664|      0|        }
 3665|      0|        nblocks += 1;
 3666|      0|      }
 3667|      0|    }
 3668|      0|    if (nblocks == 0 || nblocks > (size_t)INT_MAX) {
  ------------------
  |  Branch (3668:9): [True: 0, False: 0]
  |  Branch (3668:25): [True: 0, False: 0]
  ------------------
 3669|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 3670|      0|      goto end;
 3671|      0|    }
 3672|       |    // Allocate space for the lazy chunk
 3673|      0|    int32_t special_type = (header_ptr[BLOSC2_CHUNK_BLOSC2_FLAGS] >> 4) & BLOSC2_SPECIAL_MASK;
 3674|      0|    int memcpyed = header_ptr[BLOSC2_CHUNK_FLAGS] & (uint8_t) BLOSC_MEMCPYED;
 3675|       |
 3676|      0|    int32_t trailer_offset;
 3677|      0|    size_t streams_offset = BLOSC_EXTENDED_HEADER_LENGTH;
 3678|      0|    size_t trailer_offset_sz = BLOSC_EXTENDED_HEADER_LENGTH;
 3679|      0|    size_t trailer_len_sz = 0;
 3680|      0|    size_t lazychunk_cbytes_sz = 0;
 3681|      0|    size_t bstarts_nbytes = 0;
 3682|      0|    if (special_type == 0) {
  ------------------
  |  Branch (3682:9): [True: 0, False: 0]
  ------------------
 3683|      0|      if (nblocks > SIZE_MAX / sizeof(int32_t)) {
  ------------------
  |  Branch (3683:11): [True: 0, False: 0]
  ------------------
 3684|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3685|      0|        goto end;
 3686|      0|      }
 3687|      0|      bstarts_nbytes = nblocks * sizeof(int32_t);
 3688|       |
 3689|      0|      if (!memcpyed) {
  ------------------
  |  Branch (3689:11): [True: 0, False: 0]
  ------------------
 3690|      0|        if ((size_t)chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3690:13): [True: 0, False: 0]
  ------------------
 3691|      0|            bstarts_nbytes > (size_t)chunk_cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3691:13): [True: 0, False: 0]
  ------------------
 3692|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 3693|      0|          goto end;
 3694|      0|        }
 3695|      0|      }
 3696|       |
 3697|      0|      if (bstarts_nbytes > SIZE_MAX - trailer_offset_sz) {
  ------------------
  |  Branch (3697:11): [True: 0, False: 0]
  ------------------
 3698|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3699|      0|        goto end;
 3700|      0|      }
 3701|      0|      trailer_offset_sz += bstarts_nbytes;
 3702|       |      // Regular values have offsets for blocks
 3703|      0|      if (!memcpyed) {
  ------------------
  |  Branch (3703:11): [True: 0, False: 0]
  ------------------
 3704|      0|        if (bstarts_nbytes > SIZE_MAX - streams_offset) {
  ------------------
  |  Branch (3704:13): [True: 0, False: 0]
  ------------------
 3705|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 3706|      0|          goto end;
 3707|      0|        }
 3708|      0|        streams_offset += bstarts_nbytes;
 3709|      0|      }
 3710|       |
 3711|      0|      if (bstarts_nbytes > SIZE_MAX - (sizeof(int32_t) + sizeof(int64_t))) {
  ------------------
  |  Branch (3711:11): [True: 0, False: 0]
  ------------------
 3712|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3713|      0|        goto end;
 3714|      0|      }
 3715|      0|      trailer_len_sz = sizeof(int32_t) + sizeof(int64_t) + bstarts_nbytes;
 3716|      0|      if (trailer_len_sz > SIZE_MAX - trailer_offset_sz) {
  ------------------
  |  Branch (3716:11): [True: 0, False: 0]
  ------------------
 3717|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3718|      0|        goto end;
 3719|      0|      }
 3720|      0|      lazychunk_cbytes_sz = trailer_offset_sz + trailer_len_sz;
 3721|      0|    }
 3722|      0|    else if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (3722:14): [True: 0, False: 0]
  ------------------
 3723|      0|      if (typesize <= 0) {
  ------------------
  |  Branch (3723:11): [True: 0, False: 0]
  ------------------
 3724|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3725|      0|        goto end;
 3726|      0|      }
 3727|      0|      if ((size_t)typesize > SIZE_MAX - trailer_offset_sz ||
  ------------------
  |  Branch (3727:11): [True: 0, False: 0]
  ------------------
 3728|      0|          (size_t)typesize > SIZE_MAX - streams_offset) {
  ------------------
  |  Branch (3728:11): [True: 0, False: 0]
  ------------------
 3729|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3730|      0|        goto end;
 3731|      0|      }
 3732|      0|      trailer_offset_sz += (size_t)typesize;
 3733|      0|      streams_offset += (size_t)typesize;
 3734|      0|      lazychunk_cbytes_sz = trailer_offset_sz;
 3735|      0|    }
 3736|      0|    else {
 3737|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 3738|      0|      goto end;
 3739|      0|    }
 3740|       |
 3741|      0|    if (streams_offset > (size_t)chunk_cbytes ||
  ------------------
  |  Branch (3741:9): [True: 0, False: 0]
  ------------------
 3742|      0|        trailer_offset_sz > INT32_MAX ||
  ------------------
  |  Branch (3742:9): [True: 0, False: 0]
  ------------------
 3743|      0|        trailer_len_sz > INT32_MAX ||
  ------------------
  |  Branch (3743:9): [True: 0, False: 0]
  ------------------
 3744|      0|        lazychunk_cbytes_sz > INT32_MAX) {
  ------------------
  |  Branch (3744:9): [True: 0, False: 0]
  ------------------
 3745|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 3746|      0|      goto end;
 3747|      0|    }
 3748|       |
 3749|      0|    trailer_offset = (int32_t)trailer_offset_sz;
 3750|      0|    lazychunk_cbytes = (int32_t)lazychunk_cbytes_sz;
 3751|       |
 3752|       |    // Read just the full header and bstarts section too (lazy partial length)
 3753|      0|    if (frame->sframe) {
  ------------------
  |  Branch (3753:9): [True: 0, False: 0]
  ------------------
 3754|      0|      io_pos = 0;
 3755|      0|    }
 3756|      0|    else {
 3757|      0|      io_pos = frame->file_offset + header_len + offset;
 3758|      0|    }
 3759|       |
 3760|       |    // The case here is a bit special because more memory is allocated than read from the file
 3761|       |    // and the chunk is modified after reading. Due to the modification, we cannot directly use
 3762|       |    // the memory provided by the io
 3763|      0|    *chunk = malloc((size_t)lazychunk_cbytes);
 3764|      0|    if (*chunk == NULL) {
  ------------------
  |  Branch (3764:9): [True: 0, False: 0]
  ------------------
 3765|      0|      rc = BLOSC2_ERROR_MEMORY_ALLOC;
 3766|      0|      goto end;
 3767|      0|    }
 3768|      0|    *needs_free = true;
 3769|       |
 3770|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (3770:9): [True: 0, False: 0]
  ------------------
 3771|      0|      rbytes = io_cb->read((void**)chunk, 1, (int64_t)streams_offset, io_pos, fp);
 3772|      0|    }
 3773|      0|    else {
 3774|      0|      uint8_t* chunk_ptr;
 3775|      0|      rbytes = io_cb->read((void**)&chunk_ptr, 1, (int64_t)streams_offset, io_pos, fp);
 3776|      0|      memcpy(*chunk, chunk_ptr, streams_offset);
 3777|      0|    }
 3778|       |
 3779|      0|    if (rbytes != (int64_t)streams_offset) {
  ------------------
  |  Branch (3779:9): [True: 0, False: 0]
  ------------------
 3780|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3781|      0|      rc = BLOSC2_ERROR_FILE_READ;
 3782|      0|      goto end;
 3783|      0|    }
 3784|      0|    if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (3784:9): [True: 0, False: 0]
  ------------------
 3785|       |      // Value runlen is not returning a lazy chunk.  We are done.
 3786|      0|      goto end;
 3787|      0|    }
 3788|       |
 3789|       |    // Mark chunk as lazy
 3790|      0|    uint8_t* blosc2_flags = *chunk + BLOSC2_CHUNK_BLOSC2_FLAGS;
 3791|      0|    *blosc2_flags |= 0x08U;
 3792|       |
 3793|       |    // Add the trailer (currently, nchunk + offset + block_csizes)
 3794|      0|    if (frame->sframe) {
  ------------------
  |  Branch (3794:9): [True: 0, False: 0]
  ------------------
 3795|      0|      *(int32_t*)(*chunk + trailer_offset) = (int32_t)offset;   // offset is nchunk for sframes
 3796|      0|      *(int64_t*)(*chunk + trailer_offset + sizeof(int32_t)) = offset;
 3797|      0|    }
 3798|      0|    else {
 3799|      0|      *(int32_t*)(*chunk + trailer_offset) = (int32_t)nchunk;
 3800|      0|      *(int64_t*)(*chunk + trailer_offset + sizeof(int32_t)) = header_len + offset;
 3801|      0|    }
 3802|       |
 3803|      0|    block_csizes = malloc(nblocks * sizeof(int32_t));
 3804|      0|    if (block_csizes == NULL) {
  ------------------
  |  Branch (3804:9): [True: 0, False: 0]
  ------------------
 3805|      0|      rc = BLOSC2_ERROR_MEMORY_ALLOC;
 3806|      0|      goto end;
 3807|      0|    }
 3808|       |
 3809|      0|    if (memcpyed) {
  ------------------
  |  Branch (3809:9): [True: 0, False: 0]
  ------------------
 3810|       |      // When memcpyed the blocksizes are trivial to compute
 3811|      0|      for (size_t i = 0; i + 1 < nblocks; i++) {
  ------------------
  |  Branch (3811:26): [True: 0, False: 0]
  ------------------
 3812|      0|        block_csizes[i] = (int)chunk_blocksize;
 3813|      0|      }
 3814|       |      // The last block could be incomplete, mainly due to the fact that the block size is not divisible
 3815|       |      // by the typesize
 3816|      0|      block_csizes[nblocks - 1] = (int32_t)leftover_block ? (int32_t)leftover_block : chunk_blocksize;
  ------------------
  |  Branch (3816:35): [True: 0, False: 0]
  ------------------
 3817|      0|    }
 3818|      0|    else {
 3819|       |      // In regular, compressed chunks, we need to sort the bstarts (they can be out
 3820|       |      // of order because of multi-threading), and get a reverse index too.
 3821|      0|      memcpy(block_csizes, *chunk + BLOSC_EXTENDED_HEADER_LENGTH, nblocks * sizeof(int32_t));
 3822|       |      // Helper structure to keep track of original indexes
 3823|      0|      csize_idx = malloc(nblocks * sizeof(struct csize_idx));
 3824|      0|      if (csize_idx == NULL) {
  ------------------
  |  Branch (3824:11): [True: 0, False: 0]
  ------------------
 3825|      0|        rc = BLOSC2_ERROR_MEMORY_ALLOC;
 3826|      0|        goto end;
 3827|      0|      }
 3828|      0|      for (size_t n = 0; n < nblocks; n++) {
  ------------------
  |  Branch (3828:26): [True: 0, False: 0]
  ------------------
 3829|      0|        csize_idx[n].val = block_csizes[n];
 3830|      0|        csize_idx[n].idx = (int)n;
 3831|      0|      }
 3832|      0|      qsort(csize_idx, nblocks, sizeof(struct csize_idx), &sort_offset);
 3833|       |      // Compute the actual csizes
 3834|      0|      int idx;
 3835|      0|      for (size_t n = 0; n + 1 < nblocks; n++) {
  ------------------
  |  Branch (3835:26): [True: 0, False: 0]
  ------------------
 3836|      0|        idx = csize_idx[n].idx;
 3837|      0|        block_csizes[idx] = csize_idx[n + 1].val - csize_idx[n].val;
 3838|      0|      }
 3839|      0|      idx = csize_idx[nblocks - 1].idx;
 3840|      0|      block_csizes[idx] = chunk_cbytes - csize_idx[nblocks - 1].val;
 3841|      0|      free(csize_idx);
 3842|      0|      csize_idx = NULL;
 3843|      0|    }
 3844|       |    // Copy the csizes at the end of the trailer
 3845|      0|    void *trailer_csizes = *chunk + lazychunk_cbytes - nblocks * sizeof(int32_t);
 3846|      0|    memcpy(trailer_csizes, block_csizes, nblocks * sizeof(int32_t));
 3847|      0|    free(block_csizes);
 3848|      0|    block_csizes = NULL;
 3849|    175|  } else {
 3850|       |    // The chunk is in memory and just one pointer away
 3851|    175|    int64_t chunk_header_offset = header_len + offset;
 3852|    175|    int64_t chunk_cbytes_offset = chunk_header_offset + BLOSC_MIN_HEADER_LENGTH;
 3853|       |
 3854|    175|    *chunk = frame->cframe + chunk_header_offset;
 3855|       |
 3856|    175|    if (chunk_header_offset < 0 ||
  ------------------
  |  Branch (3856:9): [True: 0, False: 175]
  ------------------
 3857|    175|        chunk_cbytes_offset < chunk_header_offset ||
  ------------------
  |  Branch (3857:9): [True: 0, False: 175]
  ------------------
 3858|    175|        chunk_cbytes_offset > frame->len) {
  ------------------
  |  Branch (3858:9): [True: 0, False: 175]
  ------------------
 3859|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3860|      0|      rc = BLOSC2_ERROR_READ_BUFFER;
 3861|    175|    } else {
 3862|    175|      rc = blosc2_cbuffer_sizes(*chunk, NULL, &lazychunk_cbytes, NULL);
 3863|    175|      if (rc < 0) {
  ------------------
  |  Branch (3863:11): [True: 0, False: 175]
  ------------------
 3864|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3865|      0|        rc = BLOSC2_ERROR_READ_BUFFER;
 3866|      0|      }
 3867|    175|      else if (lazychunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3867:16): [True: 2, False: 173]
  ------------------
 3868|    173|               chunk_header_offset > INT64_MAX - lazychunk_cbytes ||
  ------------------
  |  Branch (3868:16): [True: 0, False: 173]
  ------------------
 3869|    173|               chunk_header_offset + lazychunk_cbytes > frame_len) {
  ------------------
  |  Branch (3869:16): [True: 10, False: 163]
  ------------------
 3870|     12|        BLOSC_TRACE_ERROR("Compressed bytes exceed beyond frame length.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3871|     12|        rc = BLOSC2_ERROR_READ_BUFFER;
 3872|     12|      }
 3873|    175|    }
 3874|    175|  }
 3875|       |
 3876|    456|  end:
 3877|    456|  if (csize_idx != NULL) {
  ------------------
  |  Branch (3877:7): [True: 0, False: 456]
  ------------------
 3878|      0|    free(csize_idx);
 3879|      0|  }
 3880|    456|  if (block_csizes != NULL) {
  ------------------
  |  Branch (3880:7): [True: 0, False: 456]
  ------------------
 3881|      0|    free(block_csizes);
 3882|      0|  }
 3883|    456|  if (fp != NULL) {
  ------------------
  |  Branch (3883:7): [True: 0, False: 456]
  ------------------
 3884|      0|    frame_reader_release(frame, io_cb, fp);
 3885|      0|  }
 3886|    456|  if (rc < 0) {
  ------------------
  |  Branch (3886:7): [True: 16, False: 440]
  ------------------
 3887|     16|    if (*needs_free) {
  ------------------
  |  Branch (3887:9): [True: 0, False: 16]
  ------------------
 3888|      0|      free(*chunk);
 3889|      0|      *chunk = NULL;
 3890|      0|      *needs_free = false;
 3891|      0|    }
 3892|     16|    return rc;
 3893|     16|  }
 3894|       |
 3895|    440|  return (int)lazychunk_cbytes;
 3896|    456|}
frame_decompress_chunk:
 5389|  9.79k|int frame_decompress_chunk(blosc2_context *dctx, blosc2_frame_s* frame, int64_t nchunk, void *dest, int32_t nbytes) {
 5390|  9.79k|  uint8_t* src;
 5391|  9.79k|  bool needs_free;
 5392|  9.79k|  int32_t chunk_nbytes;
 5393|  9.79k|  int32_t chunk_cbytes;
 5394|  9.79k|  int rc;
 5395|       |
 5396|  9.79k|  rc = frame_get_chunk(frame, nchunk, &src, &needs_free);
 5397|  9.79k|  if (rc < 0) {
  ------------------
  |  Branch (5397:7): [True: 100, False: 9.69k]
  ------------------
 5398|    100|    BLOSC_TRACE_ERROR("Cannot get the chunk in position %" PRId64 ".", nchunk);
  ------------------
  |  |   93|    100|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    100|    do {                                            \
  |  |  |  |   98|    100|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    100|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 100, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    100|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5399|    100|    goto end;
 5400|    100|  }
 5401|  9.69k|  chunk_cbytes = rc;
 5402|  9.69k|  if (chunk_cbytes < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (5402:7): [True: 0, False: 9.69k]
  ------------------
 5403|       |    /* Not enough input to read `nbytes` */
 5404|      0|    rc = BLOSC2_ERROR_READ_BUFFER;
 5405|      0|  }
 5406|       |
 5407|  9.69k|  rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 5408|  9.69k|  if (rc < 0) {
  ------------------
  |  Branch (5408:7): [True: 2, False: 9.69k]
  ------------------
 5409|      2|    goto end;
 5410|      2|  }
 5411|       |
 5412|       |  /* Create a buffer for destination */
 5413|  9.69k|  if (chunk_nbytes > nbytes) {
  ------------------
  |  Branch (5413:7): [True: 13, False: 9.67k]
  ------------------
 5414|     13|    BLOSC_TRACE_ERROR("Not enough space for decompressing in dest.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5415|     13|    rc = BLOSC2_ERROR_WRITE_BUFFER;
 5416|     13|    goto end;
 5417|     13|  }
 5418|       |  /* And decompress it */
 5419|  9.67k|  dctx->header_overhead = BLOSC_EXTENDED_HEADER_LENGTH;
 5420|  9.67k|  int chunksize = rc = blosc2_decompress_ctx(dctx, src, chunk_cbytes, dest, nbytes);
 5421|  9.67k|  if (chunksize < 0 || chunksize != chunk_nbytes) {
  ------------------
  |  Branch (5421:7): [True: 193, False: 9.48k]
  |  Branch (5421:24): [True: 27, False: 9.45k]
  ------------------
 5422|    220|    BLOSC_TRACE_ERROR("Error in decompressing chunk.");
  ------------------
  |  |   93|    220|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    220|    do {                                            \
  |  |  |  |   98|    220|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    220|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 220, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    220|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5423|    220|    if (chunksize >= 0)
  ------------------
  |  Branch (5423:9): [True: 27, False: 193]
  ------------------
 5424|     27|      rc = BLOSC2_ERROR_FAILURE;
 5425|    220|  }
 5426|  9.79k|  end:
 5427|  9.79k|  if (needs_free) {
  ------------------
  |  Branch (5427:7): [True: 1.58k, False: 8.20k]
  ------------------
 5428|  1.58k|    free(src);
 5429|  1.58k|  }
 5430|  9.79k|  return rc;
 5431|  9.67k|}
frame.c:reader_cache_claim:
  125|     15|static bool reader_cache_claim(void) {
  126|     15|  bool claimed = false;
  127|     15|  blosc2_pthread_mutex_lock(&reader_cache_mutex);
  ------------------
  |  |   92|     15|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  128|     15|  if (reader_cache_count < reader_cache_max()) {
  ------------------
  |  Branch (128:7): [True: 15, False: 0]
  ------------------
  129|     15|    reader_cache_count++;
  130|     15|    claimed = true;
  131|     15|  }
  132|     15|  blosc2_pthread_mutex_unlock(&reader_cache_mutex);
  ------------------
  |  |   93|     15|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  133|     15|  return claimed;
  134|     15|}
frame.c:reader_cache_max:
   97|     15|static int reader_cache_max(void) {
   98|     15|  static int cached_max = -1;
   99|     15|  if (cached_max >= 0) {
  ------------------
  |  Branch (99:7): [True: 14, False: 1]
  ------------------
  100|     14|    return cached_max;
  101|     14|  }
  102|      1|  char* envvar = getenv("BLOSC_MAX_CACHED_READERS");
  103|      1|  if (envvar != NULL && envvar[0] != '\0') {
  ------------------
  |  Branch (103:7): [True: 0, False: 1]
  |  Branch (103:25): [True: 0, False: 0]
  ------------------
  104|      0|    long value = strtol(envvar, NULL, 10);
  105|      0|    if (value >= 0 && value <= INT_MAX) {
  ------------------
  |  Branch (105:9): [True: 0, False: 0]
  |  Branch (105:23): [True: 0, False: 0]
  ------------------
  106|      0|      cached_max = (int)value;
  107|      0|      return cached_max;
  108|      0|    }
  109|      0|  }
  110|      1|  cached_max = FRAME_READER_CACHE_MAX;
  ------------------
  |  |   86|      1|#define FRAME_READER_CACHE_MAX 96
  ------------------
  111|      1|  struct rlimit rl;
  112|      1|  if (getrlimit(RLIMIT_NOFILE, &rl) == 0 && rl.rlim_cur != RLIM_INFINITY) {
  ------------------
  |  Branch (112:7): [True: 1, False: 0]
  |  Branch (112:45): [True: 1, False: 0]
  ------------------
  113|      1|    rlim_t share = rl.rlim_cur / FRAME_READER_CACHE_SHARE;
  ------------------
  |  |   87|      1|#define FRAME_READER_CACHE_SHARE 16
  ------------------
  114|      1|    if (share < (rlim_t)cached_max) {
  ------------------
  |  Branch (114:9): [True: 1, False: 0]
  ------------------
  115|      1|      cached_max = (int)share;
  116|      1|    }
  117|      1|  }
  118|       |  /* A budget below FRAME_READER_CACHE_SHARE lands on 0, i.e. no caching at all;
  119|       |     that is the right answer there -- a descriptor held for a frame's lifetime
  120|       |     is exactly what such a process cannot spare. */
  121|      1|  return cached_max;
  122|      1|}
frame.c:reader_cache_return:
  136|     15|static void reader_cache_return(void) {
  137|     15|  blosc2_pthread_mutex_lock(&reader_cache_mutex);
  ------------------
  |  |   92|     15|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  138|     15|  if (reader_cache_count > 0) {
  ------------------
  |  Branch (138:7): [True: 15, False: 0]
  ------------------
  139|     15|    reader_cache_count--;
  140|     15|  }
  141|     15|  blosc2_pthread_mutex_unlock(&reader_cache_mutex);
  ------------------
  |  |   93|     15|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  142|     15|}
frame.c:frame_reader_close_locked:
  238|  9.27k|static bool frame_reader_close_locked(blosc2_frame_s* frame, bool force) {
  239|  9.27k|  if (frame->read_fp == NULL) {
  ------------------
  |  Branch (239:7): [True: 9.27k, False: 0]
  ------------------
  240|  9.27k|    return true;
  241|  9.27k|  }
  242|      0|  if (frame->read_fp_refs > 0 && !force) {
  ------------------
  |  Branch (242:7): [True: 0, False: 0]
  |  Branch (242:34): [True: 0, False: 0]
  ------------------
  243|       |    /* A caller up the stack is reading through it (frame_to_schunk holds it
  244|       |       across its whole chunk loop, and that loop re-enters get_header_info).
  245|       |       Closing it here would hand that caller a dangling handle, and its own
  246|       |       release would then close it a second time.  Leave it: the operation in
  247|       |       flight finishes on the file it started on, and the next revalidate --
  248|       |       past that release -- drops it. */
  249|      0|    return false;
  250|      0|  }
  251|       |  /* read_fp only ever comes from the filesystem backend, so close it directly:
  252|       |     blosc2_get_io_cb() would return NULL after a blosc2_destroy(), and then the
  253|       |     descriptor would leak while its cache slot got handed back anyway. */
  254|      0|  blosc2_stdio_close(frame->read_fp);
  255|      0|  frame->read_fp = NULL;
  256|      0|  frame->read_fp_refs = 0;
  257|      0|#if !defined(_WIN32)
  258|      0|  reader_cache_return();
  259|      0|#endif
  260|       |  return true;
  261|      0|}
frame.c:frame_alloc:
  147|  9.28k|static blosc2_frame_s* frame_alloc(void) {
  148|  9.28k|  blosc2_frame_s* frame = calloc(1, sizeof(blosc2_frame_s));
  149|  9.28k|  if (frame != NULL) {
  ------------------
  |  Branch (149:7): [True: 9.28k, False: 0]
  ------------------
  150|  9.28k|    blosc2_pthread_mutex_init(&frame->read_fp_mutex, NULL);
  ------------------
  |  |   90|  9.28k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
  151|  9.28k|  }
  152|  9.28k|  return frame;
  153|  9.28k|}
frame.c:frame_refresh_if_stale:
 1092|  10.3k|static int frame_refresh_if_stale(blosc2_frame_s *frame, int64_t frame_len_on_disk) {
 1093|  10.3k|  if (frame->cframe != NULL || frame->schunk == NULL ||
  ------------------
  |  Branch (1093:7): [True: 10.3k, False: 0]
  |  Branch (1093:32): [True: 0, False: 0]
  ------------------
 1094|  10.3k|      (!frame->force_refresh && frame_len_on_disk == frame->len)) {
  ------------------
  |  Branch (1094:8): [True: 0, False: 0]
  |  Branch (1094:33): [True: 0, False: 0]
  ------------------
 1095|  10.3k|    return 0;
 1096|  10.3k|  }
 1097|       |  // Saved so the metalayer-reload retry loop below can roll back to a fully
 1098|       |  // consistent state on exhaustion, rather than leaving frame->len/trailer_len
 1099|       |  // committed to the new value with no metalayers to match it.
 1100|      0|  int64_t old_len = frame->len;
 1101|      0|  uint32_t old_trailer_len = frame->trailer_len;
 1102|       |
 1103|      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 (1103:7): [True: 0, False: 0]
  ------------------
 1104|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1105|      0|    return BLOSC2_ERROR_FILE_READ;
 1106|      0|  }
 1107|       |
 1108|       |  // Read and validate the trailer *before* mutating any frame state below,
 1109|       |  // so a transient torn read (a writer without locking has no coordination
 1110|       |  // preventing a reader from landing mid-rewrite here -- the documented
 1111|       |  // SWMR-without-locking tradeoff) can be handled opportunistically: keep
 1112|       |  // the old cached view and let the next access retry, the same way
 1113|       |  // frame_check_stale()'s header read already does a few lines up in the
 1114|       |  // caller. Once frame->len/coffsets are overwritten below, a failure
 1115|       |  // partway through would leave the frame in a self-inconsistent state
 1116|       |  // (new length, stale trailer/offsets), so those mutations only happen
 1117|       |  // after the trailer is confirmed good.
 1118|      0|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 1119|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (1119:7): [True: 0, False: 0]
  ------------------
 1120|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1121|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 1122|      0|  }
 1123|      0|  void* fp;
 1124|      0|  if (frame->sframe) {
  ------------------
  |  Branch (1124:7): [True: 0, False: 0]
  ------------------
 1125|      0|    fp = sframe_open_index(frame->urlpath, "rb", frame->schunk->storage->io);
 1126|      0|  }
 1127|      0|  else {
 1128|      0|    fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 1129|      0|  }
 1130|      0|  if (fp == NULL) {
  ------------------
  |  Branch (1130:7): [True: 0, False: 0]
  ------------------
 1131|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1132|      0|    return BLOSC2_ERROR_FILE_OPEN;
 1133|      0|  }
 1134|      0|  uint8_t trailer[FRAME_TRAILER_MINLEN];
 1135|      0|  uint8_t* trailer_ptr = trailer;
 1136|      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)
  ------------------
 1137|      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)
  ------------------
 1138|      0|  frame_reader_release(frame, io_cb, fp);
 1139|      0|  if (rbytes != FRAME_TRAILER_MINLEN) {
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (1139:7): [True: 0, False: 0]
  ------------------
 1140|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1141|      0|    return 0;  // opportunistic: transient, keep the cached view, retry later
 1142|      0|  }
 1143|      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)
  ------------------
 1144|      0|  if (trailer_ptr[trailer_offset - 1] != 0xce) {
  ------------------
  |  Branch (1144:7): [True: 0, False: 0]
  ------------------
 1145|       |    // Not a valid trailer; most likely we are reading a frame in the middle of
 1146|       |    // being rewritten by another handle without locking (locked handles
 1147|       |    // fully serialize, so this only happens under the no-locking contract).
 1148|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1149|      0|    return 0;  // opportunistic, same reasoning as above
 1150|      0|  }
 1151|      0|  uint32_t trailer_len;
 1152|      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)
  ------------------
 1153|      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 (1153:7): [True: 0, False: 0]
  |  Branch (1153:45): [True: 0, False: 0]
  ------------------
 1154|      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 (1154:7): [True: 0, False: 0]
  ------------------
 1155|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1156|      0|    return 0;  // opportunistic, same reasoning as above
 1157|      0|  }
 1158|       |
 1159|       |  // Trailer confirmed good: now safe to commit the new length. The lock
 1160|       |  // generation counter (see frame_lock) may have flagged a mutation that
 1161|       |  // left the frame length unchanged; only clear that flag here, once a
 1162|       |  // refresh has actually happened -- clearing it earlier and then bailing
 1163|       |  // out opportunistically above would permanently lose a same-length
 1164|       |  // mutation notification on a torn-read retry. The cached offsets index is
 1165|       |  // dropped further down, only once the metalayer/vlmetalayer reload below
 1166|       |  // has actually succeeded -- neither of those touches frame->coffsets, so
 1167|       |  // deferring this keeps the old view of it fully intact for the
 1168|       |  // opportunistic rollback path below, exactly as strong as the trailer
 1169|       |  // read's own bail-outs above.
 1170|      0|  frame->force_refresh = false;
 1171|      0|  frame->len = frame_len_on_disk;
 1172|      0|  frame->trailer_len = trailer_len;
 1173|       |
 1174|       |  // The header metalayers and trailer vlmetalayers were cached at open time;
 1175|       |  // reload them so metadata changes made by another handle (e.g. a b2nd shape
 1176|       |  // update) become visible too.  The guard protects against re-entering from
 1177|       |  // the reload path itself (get_header_info does not refresh, but cheap
 1178|       |  // insurance against future changes there).
 1179|       |  //
 1180|       |  // frame_get_metalayers()/frame_get_vlmetalayers() each do their own fully
 1181|       |  // independent header/trailer re-read (separate from the trailer read
 1182|       |  // above), so without locking they can hit the same transient torn-read
 1183|       |  // window. Unlike that trailer read, there's no way to validate first and
 1184|       |  // commit after: schunk_free_metalayers()/schunk_free_vlmetalayers() must
 1185|       |  // run before a reload attempt (the parsers write straight into
 1186|       |  // schunk->metalayers[]/vlmetalayers[] as they go), so a single failed
 1187|       |  // attempt already discards the old cached set. Retry a bounded number of
 1188|       |  // times -- both free helpers are NULL-safe and re-run cleanly against a
 1189|       |  // partial prior attempt, and each attempt is a fresh independent read, so
 1190|       |  // this self-heals once the writer's rewrite stabilizes.
 1191|       |  //
 1192|       |  // This reasoning only holds without locking, though: frame_check_stale()
 1193|       |  // (the only caller) holds the shared frame lock across this entire call
 1194|       |  // when frame->locking is set, which fully excludes writers for its
 1195|       |  // duration -- so under locking a reload failure here cannot be a torn
 1196|       |  // read, it is a genuine problem (corruption or a real I/O error), and
 1197|       |  // retrying 50 times would just waste ~50ms holding that shared lock
 1198|       |  // before silently masking it. Retry once (i.e. don't retry) and propagate
 1199|       |  // the error under locking; keep the opportunistic bounded retry + silent
 1200|       |  // rollback for the no-locking case only.
 1201|       |  //
 1202|       |  // On exhaustion in the no-locking case, roll back frame->len/trailer_len
 1203|       |  // to what they were before this call and force a full retry on the next
 1204|       |  // poll (frame->force_refresh = true) -- otherwise frame_len_on_disk ==
 1205|       |  // frame->len would short-circuit every subsequent call at the top of this
 1206|       |  // function, permanently stranding this handle with an empty metalayer set.
 1207|      0|  if (!frame->refreshing) {
  ------------------
  |  Branch (1207:7): [True: 0, False: 0]
  ------------------
 1208|      0|    frame->refreshing = true;
 1209|      0|    int rc = -1;
 1210|      0|    const int max_attempts = frame->locking ? 1 : 50;
  ------------------
  |  Branch (1210:30): [True: 0, False: 0]
  ------------------
 1211|      0|    for (int attempt = 0; attempt < max_attempts; attempt++) {
  ------------------
  |  Branch (1211:27): [True: 0, False: 0]
  ------------------
 1212|      0|      schunk_free_metalayers(frame->schunk);
 1213|      0|      rc = frame_get_metalayers(frame, frame->schunk);
 1214|      0|      if (rc >= 0) {
  ------------------
  |  Branch (1214:11): [True: 0, False: 0]
  ------------------
 1215|      0|        schunk_free_vlmetalayers(frame->schunk);
 1216|      0|        rc = frame_get_vlmetalayers(frame, frame->schunk);
 1217|      0|      }
 1218|      0|      if (rc >= 0 || attempt + 1 == max_attempts) {
  ------------------
  |  Branch (1218:11): [True: 0, False: 0]
  |  Branch (1218:22): [True: 0, False: 0]
  ------------------
 1219|      0|        break;
 1220|      0|      }
 1221|       |#if defined(_WIN32)
 1222|       |      Sleep(1);
 1223|       |#else
 1224|      0|      usleep(1000);
 1225|      0|#endif
 1226|      0|    }
 1227|      0|    frame->refreshing = false;
 1228|      0|    if (rc < 0) {
  ------------------
  |  Branch (1228:9): [True: 0, False: 0]
  ------------------
 1229|      0|      if (frame->locking) {
  ------------------
  |  Branch (1229:11): [True: 0, False: 0]
  ------------------
 1230|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1231|      0|                          "(locked handle: this is not a transient race).");
 1232|      0|        return rc;
 1233|      0|      }
 1234|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1235|      0|                        "after retries; rolling back to the previous cached view.");
 1236|      0|      frame->len = old_len;
 1237|      0|      frame->trailer_len = old_trailer_len;
 1238|      0|      frame->force_refresh = true;
 1239|      0|      return 0;
 1240|      0|    }
 1241|      0|  }
 1242|      0|  frame->schunk->change_tick++;
 1243|       |
 1244|       |  // Cached offsets index invalidated only now, after a fully successful
 1245|       |  // refresh: recomputed lazily from the fresh trailer on demand.
 1246|      0|  if (frame->coffsets != NULL) {
  ------------------
  |  Branch (1246:7): [True: 0, False: 0]
  ------------------
 1247|      0|    if (frame->coffsets_needs_free) {
  ------------------
  |  Branch (1247:9): [True: 0, False: 0]
  ------------------
 1248|      0|      free(frame->coffsets);
 1249|      0|    }
 1250|      0|    frame->coffsets = NULL;
 1251|      0|  }
 1252|       |
 1253|      0|  return 1;
 1254|      0|}
frame.c:get_coffsets_nbytes:
 1301|  5.14k|                               int32_t *coffsets_nbytes, const blosc2_io *io) {
 1302|  5.14k|  int32_t chunk_cbytes;
 1303|  5.14k|  int rc;
 1304|  5.14k|  int64_t off_pos = header_len;
 1305|  5.14k|  if (!frame->sframe) {
  ------------------
  |  Branch (1305:7): [True: 5.14k, False: 0]
  ------------------
 1306|  5.14k|    if (cbytes < INT64_MAX - header_len) {
  ------------------
  |  Branch (1306:9): [True: 55, False: 5.08k]
  ------------------
 1307|     55|      off_pos += cbytes;
 1308|     55|    }
 1309|  5.14k|  }
 1310|       |
 1311|  5.14k|  if (off_pos < 0 || off_pos > INT64_MAX - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (1311:7): [True: 6, False: 5.13k]
  |  Branch (1311:22): [True: 0, False: 5.13k]
  ------------------
 1312|  5.13k|      off_pos + BLOSC_EXTENDED_HEADER_LENGTH > frame->len) {
  ------------------
  |  Branch (1312:7): [True: 2, False: 5.13k]
  ------------------
 1313|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1314|      8|    return BLOSC2_ERROR_INVALID_HEADER;
 1315|      8|  }
 1316|       |
 1317|  5.13k|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (1317:7): [True: 5.13k, False: 0]
  ------------------
 1318|  5.13k|    uint8_t *off_start = frame->cframe + off_pos;
 1319|  5.13k|    rc = blosc2_cbuffer_sizes(off_start, coffsets_nbytes, &chunk_cbytes, NULL);
 1320|  5.13k|    if (rc < 0) {
  ------------------
  |  Branch (1320:9): [True: 1, False: 5.13k]
  ------------------
 1321|      1|      return rc;
 1322|      1|    }
 1323|  5.13k|    if (chunk_cbytes < 0 || off_pos + chunk_cbytes > frame->len) {
  ------------------
  |  Branch (1323:9): [True: 0, False: 5.13k]
  |  Branch (1323:29): [True: 6, False: 5.12k]
  ------------------
 1324|      6|      BLOSC_TRACE_ERROR("Cannot read the cbytes outside of frame boundary.");
  ------------------
  |  |   93|      6|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      6|    do {                                            \
  |  |  |  |   98|      6|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      6|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 6, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      6|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1325|      6|      return BLOSC2_ERROR_INVALID_HEADER;
 1326|      6|    }
 1327|  5.12k|    return 0;
 1328|  5.13k|  }
 1329|       |
 1330|      0|  int64_t trailer_offset = get_trailer_offset(frame, header_len, true);
 1331|      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 (1331:7): [True: 0, False: 0]
  |  Branch (1331:56): [True: 0, False: 0]
  ------------------
 1332|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1333|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 1334|      0|  }
 1335|       |
 1336|      0|  blosc2_io_cb *io_cb = blosc2_get_io_cb(io->id);
 1337|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (1337:7): [True: 0, False: 0]
  ------------------
 1338|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1339|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 1340|      0|  }
 1341|       |
 1342|      0|  uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 1343|      0|  uint8_t *header_ptr = header;
 1344|      0|  void *fp = NULL;
 1345|      0|  int64_t io_pos = 0;
 1346|      0|  if (frame->sframe) {
  ------------------
  |  Branch (1346:7): [True: 0, False: 0]
  ------------------
 1347|      0|    fp = sframe_open_index(frame->urlpath, "rb", io);
 1348|      0|    if (fp == NULL) {
  ------------------
  |  Branch (1348:9): [True: 0, False: 0]
  ------------------
 1349|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1350|      0|      return BLOSC2_ERROR_FILE_OPEN;
 1351|      0|    }
 1352|      0|    io_pos = off_pos;
 1353|      0|  }
 1354|      0|  else {
 1355|      0|    fp = frame_reader_acquire(frame, io);
 1356|      0|    if (fp == NULL) {
  ------------------
  |  Branch (1356:9): [True: 0, False: 0]
  ------------------
 1357|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1358|      0|      return BLOSC2_ERROR_FILE_OPEN;
 1359|      0|    }
 1360|      0|    io_pos = frame->file_offset + off_pos;
 1361|      0|  }
 1362|      0|  int64_t rbytes = io_cb->read((void**)&header_ptr, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, fp);
 1363|      0|  frame_reader_release(frame, io_cb, fp);
 1364|      0|  if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (1364:7): [True: 0, False: 0]
  ------------------
 1365|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1366|      0|    return BLOSC2_ERROR_FILE_READ;
 1367|      0|  }
 1368|       |
 1369|      0|  rc = blosc2_cbuffer_sizes(header_ptr, coffsets_nbytes, &chunk_cbytes, NULL);
 1370|      0|  if (rc < 0) {
  ------------------
  |  Branch (1370:7): [True: 0, False: 0]
  ------------------
 1371|      0|    return rc;
 1372|      0|  }
 1373|       |
 1374|      0|  if (chunk_cbytes < 0 || off_pos + chunk_cbytes > trailer_offset) {
  ------------------
  |  Branch (1374:7): [True: 0, False: 0]
  |  Branch (1374:27): [True: 0, False: 0]
  ------------------
 1375|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1376|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 1377|      0|  }
 1378|       |
 1379|      0|  return 0;
 1380|      0|}
frame.c:get_meta_from_header:
 2396|    462|                                int32_t header_len) {
 2397|    462|  BLOSC_UNUSED_PARAM(frame);
  ------------------
  |  |   28|    462|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
 2398|    462|  int64_t header_pos = FRAME_IDX_SIZE;
  ------------------
  |  |   51|    462|#define FRAME_IDX_SIZE (FRAME_METALAYERS + 1 + 1)  // 89
  |  |  ------------------
  |  |  |  |   50|    462|#define FRAME_METALAYERS (FRAME_HEADER_MINLEN)  // 87
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|    462|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|    462|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|    462|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   42|    462|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   41|    462|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   40|    462|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    462|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    462|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    462|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    462|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    462|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    462|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    462|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    462|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2399|       |
 2400|       |  // Get the size for the index of metalayers
 2401|    462|  uint16_t idx_size;
 2402|    462|  header_pos += sizeof(idx_size);
 2403|    462|  if (header_len < header_pos) {
  ------------------
  |  Branch (2403:7): [True: 0, False: 462]
  ------------------
 2404|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2405|      0|  }
 2406|    462|  from_big(&idx_size, header + FRAME_IDX_SIZE, sizeof(idx_size));
  ------------------
  |  |   38|    462|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2407|       |
 2408|       |  // Get the actual index of metalayers
 2409|    462|  uint8_t* metalayers_idx = header + FRAME_IDX_SIZE + 2;
  ------------------
  |  |   51|    462|#define FRAME_IDX_SIZE (FRAME_METALAYERS + 1 + 1)  // 89
  |  |  ------------------
  |  |  |  |   50|    462|#define FRAME_METALAYERS (FRAME_HEADER_MINLEN)  // 87
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|    462|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|    462|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|    462|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   42|    462|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   41|    462|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   40|    462|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    462|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    462|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    462|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    462|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    462|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    462|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    462|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    462|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2410|    462|  header_pos += 1;
 2411|    462|  if (header_len < header_pos) {
  ------------------
  |  Branch (2411:7): [True: 0, False: 462]
  ------------------
 2412|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2413|      0|  }
 2414|    462|  if (metalayers_idx[0] != 0xde) {   // sanity check
  ------------------
  |  Branch (2414:7): [True: 4, False: 458]
  ------------------
 2415|      4|    return BLOSC2_ERROR_DATA;
 2416|      4|  }
 2417|    458|  uint8_t* idxp = metalayers_idx + 1;
 2418|    458|  uint16_t nmetalayers;
 2419|    458|  header_pos += sizeof(nmetalayers);
 2420|    458|  if (header_len < header_pos) {
  ------------------
  |  Branch (2420:7): [True: 0, False: 458]
  ------------------
 2421|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2422|      0|  }
 2423|    458|  from_big(&nmetalayers, idxp, sizeof(uint16_t));
  ------------------
  |  |   38|    458|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2424|    458|  idxp += 2;
 2425|    458|  if (nmetalayers > BLOSC2_MAX_METALAYERS) {
  ------------------
  |  | 1744|    458|#define BLOSC2_MAX_METALAYERS 16
  ------------------
  |  Branch (2425:7): [True: 2, False: 456]
  ------------------
 2426|      2|    return BLOSC2_ERROR_DATA;
 2427|      2|  }
 2428|    456|  schunk->nmetalayers = nmetalayers;
 2429|       |
 2430|       |  // Populate the metalayers and its serialized values
 2431|    456|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2431:28): [True: 7, False: 449]
  ------------------
 2432|      7|    header_pos += 1;
 2433|      7|    if (header_len < header_pos) {
  ------------------
  |  Branch (2433:9): [True: 0, False: 7]
  ------------------
 2434|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2435|      0|    }
 2436|      7|    if ((*idxp & 0xe0u) != 0xa0u) {   // sanity check
  ------------------
  |  Branch (2436:9): [True: 1, False: 6]
  ------------------
 2437|      1|      return BLOSC2_ERROR_DATA;
 2438|      1|    }
 2439|      6|    blosc2_metalayer* metalayer = calloc(1, sizeof(blosc2_metalayer));
 2440|      6|    if (metalayer == NULL) {
  ------------------
  |  Branch (2440:9): [True: 0, False: 6]
  ------------------
 2441|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2442|      0|    }
 2443|      6|    schunk->metalayers[nmetalayer] = metalayer;
 2444|       |
 2445|       |    // Populate the metalayer string
 2446|      6|    uint8_t nslen = *idxp & (uint8_t)0x1F;
 2447|      6|    idxp += 1;
 2448|      6|    header_pos += nslen;
 2449|      6|    if (header_len < header_pos) {
  ------------------
  |  Branch (2449:9): [True: 0, False: 6]
  ------------------
 2450|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2451|      0|    }
 2452|      6|    char* ns = malloc((size_t)nslen + 1);
 2453|      6|    if (ns == NULL) {
  ------------------
  |  Branch (2453:9): [True: 0, False: 6]
  ------------------
 2454|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2455|      0|    }
 2456|      6|    memcpy(ns, idxp, nslen);
 2457|      6|    ns[nslen] = '\0';
 2458|      6|    idxp += nslen;
 2459|      6|    metalayer->name = ns;
 2460|       |
 2461|       |    // Populate the serialized value for this metalayer
 2462|       |    // Get the offset
 2463|      6|    header_pos += 1;
 2464|      6|    if (header_len < header_pos) {
  ------------------
  |  Branch (2464:9): [True: 0, False: 6]
  ------------------
 2465|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2466|      0|    }
 2467|      6|    if ((*idxp & 0xffu) != 0xd2u) {   // sanity check
  ------------------
  |  Branch (2467:9): [True: 0, False: 6]
  ------------------
 2468|      0|      return BLOSC2_ERROR_DATA;
 2469|      0|    }
 2470|      6|    idxp += 1;
 2471|      6|    int32_t offset;
 2472|      6|    header_pos += sizeof(offset);
 2473|      6|    if (header_len < header_pos) {
  ------------------
  |  Branch (2473:9): [True: 0, False: 6]
  ------------------
 2474|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2475|      0|    }
 2476|      6|    from_big(&offset, idxp, sizeof(offset));
  ------------------
  |  |   38|      6|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2477|      6|    idxp += 4;
 2478|      6|    if (offset < 0 || offset >= header_len) {
  ------------------
  |  Branch (2478:9): [True: 1, False: 5]
  |  Branch (2478:23): [True: 4, False: 1]
  ------------------
 2479|       |      // Offset is less than zero or exceeds header length
 2480|      5|      return BLOSC2_ERROR_DATA;
 2481|      5|    }
 2482|       |    // Go to offset and see if we have the correct marker
 2483|      1|    uint8_t* content_marker = header + offset;
 2484|      1|    if ((int64_t)header_len < (int64_t)offset + 1 + 4) {
  ------------------
  |  Branch (2484:9): [True: 0, False: 1]
  ------------------
 2485|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2486|      0|    }
 2487|      1|    if (*content_marker != 0xc6) {
  ------------------
  |  Branch (2487:9): [True: 0, False: 1]
  ------------------
 2488|      0|      return BLOSC2_ERROR_DATA;
 2489|      0|    }
 2490|       |
 2491|       |    // Read the size of the content
 2492|      1|    int32_t content_len;
 2493|      1|    from_big(&content_len, content_marker + 1, sizeof(content_len));
  ------------------
  |  |   38|      1|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2494|      1|    if (content_len < 0) {
  ------------------
  |  Branch (2494:9): [True: 0, False: 1]
  ------------------
 2495|      0|      return BLOSC2_ERROR_DATA;
 2496|      0|    }
 2497|      1|    metalayer->content_len = content_len;
 2498|       |
 2499|       |    // Finally, read the content. Use 64-bit arithmetic so a malicious
 2500|       |    // (offset, content_len) pair near INT32_MAX cannot wrap and bypass the
 2501|       |    // bounds check, which would let memcpy below read past the header buffer.
 2502|      1|    if ((int64_t)header_len < (int64_t)offset + 1 + 4 + (int64_t)content_len) {
  ------------------
  |  Branch (2502:9): [True: 1, False: 0]
  ------------------
 2503|      1|      return BLOSC2_ERROR_READ_BUFFER;
 2504|      1|    }
 2505|      0|    char* content = malloc((size_t)content_len);
 2506|       |    // malloc(0) is allowed to return NULL, and blosc2_meta_add accepts
 2507|       |    // content_len == 0, so only treat NULL as an allocation failure when
 2508|       |    // a non-zero allocation was requested.
 2509|      0|    if (content_len > 0 && content == NULL) {
  ------------------
  |  Branch (2509:9): [True: 0, False: 0]
  |  Branch (2509:28): [True: 0, False: 0]
  ------------------
 2510|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2511|      0|    }
 2512|      0|    if (content_len > 0) {
  ------------------
  |  Branch (2512:9): [True: 0, False: 0]
  ------------------
 2513|      0|      memcpy(content, content_marker + 1 + 4, (size_t)content_len);
 2514|      0|    }
 2515|      0|    metalayer->content = (uint8_t*)content;
 2516|      0|  }
 2517|       |
 2518|    449|  return 1;
 2519|    456|}
frame.c:get_vlmeta_from_trailer:
 2599|    447|                                   int32_t trailer_len) {
 2600|       |
 2601|    447|  BLOSC_UNUSED_PARAM(frame);
  ------------------
  |  |   28|    447|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
 2602|    447|  int64_t trailer_pos = FRAME_TRAILER_VLMETALAYERS + 2;
  ------------------
  |  |   60|    447|#define FRAME_TRAILER_VLMETALAYERS (2)
  ------------------
 2603|    447|  uint8_t* idxp = trailer + trailer_pos;
 2604|       |
 2605|       |  // Get the size for the index of metalayers
 2606|    447|  trailer_pos += 2;
 2607|    447|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2607:7): [True: 0, False: 447]
  ------------------
 2608|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2609|      0|  }
 2610|    447|  uint16_t idx_size;
 2611|    447|  from_big(&idx_size, idxp, sizeof(idx_size));
  ------------------
  |  |   38|    447|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2612|    447|  idxp += 2;
 2613|       |
 2614|    447|  trailer_pos += 1;
 2615|       |  // Get the actual index of metalayers
 2616|    447|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2616:7): [True: 0, False: 447]
  ------------------
 2617|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2618|      0|  }
 2619|    447|  if (idxp[0] != 0xde) {   // sanity check
  ------------------
  |  Branch (2619:7): [True: 12, False: 435]
  ------------------
 2620|     12|    return BLOSC2_ERROR_DATA;
 2621|     12|  }
 2622|    435|  idxp += 1;
 2623|       |
 2624|       |  // The on-wire encoding is unsigned (uint16 follows the msgpack `0xde`
 2625|       |  // map16 marker), but `schunk->nvlmetalayers` is int16_t. Decoding into a
 2626|       |  // signed local would let raw bytes like 0xff 0xff slip past the
 2627|       |  // `> BLOSC2_MAX_VLMETALAYERS` ceiling as a negative count, after which
 2628|       |  // a later `blosc2_vlmeta_add` would write through `vlmetalayers[-1]`
 2629|       |  // and corrupt adjacent schunk fields. Decode unsigned, then narrow.
 2630|    435|  uint16_t nmetalayers;
 2631|    435|  trailer_pos += sizeof(nmetalayers);
 2632|    435|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2632:7): [True: 0, False: 435]
  ------------------
 2633|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2634|      0|  }
 2635|    435|  from_big(&nmetalayers, idxp, sizeof(uint16_t));
  ------------------
  |  |   38|    435|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2636|    435|  idxp += 2;
 2637|    435|  if (nmetalayers > BLOSC2_MAX_VLMETALAYERS) {
  ------------------
  |  | 1750|    435|#define BLOSC2_MAX_VLMETALAYERS (8 * 1024)
  ------------------
  |  Branch (2637:7): [True: 4, False: 431]
  ------------------
 2638|      4|    return BLOSC2_ERROR_DATA;
 2639|      4|  }
 2640|    431|  schunk->nvlmetalayers = (int16_t)nmetalayers;
 2641|       |
 2642|       |  // Populate the metalayers and its serialized values
 2643|    719|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2643:28): [True: 340, False: 379]
  ------------------
 2644|    340|    trailer_pos += 1;
 2645|    340|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2645:9): [True: 0, False: 340]
  ------------------
 2646|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2647|      0|    }
 2648|    340|    if ((*idxp & 0xe0u) != 0xa0u) {   // sanity check
  ------------------
  |  Branch (2648:9): [True: 7, False: 333]
  ------------------
 2649|      7|      return BLOSC2_ERROR_DATA;
 2650|      7|    }
 2651|    333|    blosc2_metalayer* metalayer = calloc(1, sizeof(blosc2_metalayer));
 2652|    333|    if (metalayer == NULL) {
  ------------------
  |  Branch (2652:9): [True: 0, False: 333]
  ------------------
 2653|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2654|      0|    }
 2655|    333|    schunk->vlmetalayers[nmetalayer] = metalayer;
 2656|       |
 2657|       |    // Populate the metalayer string
 2658|    333|    uint8_t nslen = *idxp & (uint8_t)0x1F;
 2659|    333|    idxp += 1;
 2660|    333|    trailer_pos += nslen;
 2661|    333|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2661:9): [True: 0, False: 333]
  ------------------
 2662|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2663|      0|    }
 2664|    333|    char* ns = malloc((size_t)nslen + 1);
 2665|    333|    if (ns == NULL) {
  ------------------
  |  Branch (2665:9): [True: 0, False: 333]
  ------------------
 2666|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2667|      0|    }
 2668|    333|    memcpy(ns, idxp, nslen);
 2669|    333|    ns[nslen] = '\0';
 2670|    333|    idxp += nslen;
 2671|    333|    metalayer->name = ns;
 2672|       |
 2673|       |    // Populate the serialized value for this metalayer
 2674|       |    // Get the offset
 2675|    333|    trailer_pos += 1;
 2676|    333|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2676:9): [True: 0, False: 333]
  ------------------
 2677|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2678|      0|    }
 2679|    333|    if ((*idxp & 0xffu) != 0xd2u) {   // sanity check
  ------------------
  |  Branch (2679:9): [True: 3, False: 330]
  ------------------
 2680|      3|      return BLOSC2_ERROR_DATA;
 2681|      3|    }
 2682|    330|    idxp += 1;
 2683|    330|    int32_t offset;
 2684|    330|    trailer_pos += sizeof(offset);
 2685|    330|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2685:9): [True: 0, False: 330]
  ------------------
 2686|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2687|      0|    }
 2688|    330|    from_big(&offset, idxp, sizeof(offset));
  ------------------
  |  |   38|    330|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2689|    330|    idxp += 4;
 2690|    330|    if (offset < 0 || offset >= trailer_len) {
  ------------------
  |  Branch (2690:9): [True: 9, False: 321]
  |  Branch (2690:23): [True: 23, False: 298]
  ------------------
 2691|       |      // Offset is less than zero or exceeds trailer length
 2692|     32|      return BLOSC2_ERROR_DATA;
 2693|     32|    }
 2694|       |    // Go to offset and see if we have the correct marker
 2695|    298|    uint8_t* content_marker = trailer + offset;
 2696|    298|    if ((int64_t)trailer_len < (int64_t)offset + 1 + 4) {
  ------------------
  |  Branch (2696:9): [True: 0, False: 298]
  ------------------
 2697|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2698|      0|    }
 2699|    298|    if (*content_marker != 0xc6) {
  ------------------
  |  Branch (2699:9): [True: 5, False: 293]
  ------------------
 2700|      5|      return BLOSC2_ERROR_DATA;
 2701|      5|    }
 2702|       |
 2703|       |    // Read the size of the content
 2704|    293|    int32_t content_len;
 2705|    293|    from_big(&content_len, content_marker + 1, sizeof(content_len));
  ------------------
  |  |   38|    293|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2706|    293|    if (content_len < 0) {
  ------------------
  |  Branch (2706:9): [True: 4, False: 289]
  ------------------
 2707|      4|      return BLOSC2_ERROR_DATA;
 2708|      4|    }
 2709|    289|    metalayer->content_len = content_len;
 2710|       |
 2711|       |    // Finally, read the content. Use 64-bit arithmetic so a malicious
 2712|       |    // (offset, content_len) pair near INT32_MAX cannot wrap and bypass the
 2713|       |    // bounds check, which would let memcpy below read past the trailer buffer.
 2714|    289|    if ((int64_t)trailer_len < (int64_t)offset + 1 + 4 + (int64_t)content_len) {
  ------------------
  |  Branch (2714:9): [True: 1, False: 288]
  ------------------
 2715|      1|      return BLOSC2_ERROR_READ_BUFFER;
 2716|      1|    }
 2717|    288|    char* content = malloc((size_t)content_len);
 2718|       |    // Same zero-length carve-out as in get_meta_from_header: malloc(0) may
 2719|       |    // return NULL on some platforms, and the public API allows
 2720|       |    // content_len == 0, so don't reject a valid empty vlmetalayer.
 2721|    288|    if (content_len > 0 && content == NULL) {
  ------------------
  |  Branch (2721:9): [True: 287, False: 1]
  |  Branch (2721:28): [True: 0, False: 287]
  ------------------
 2722|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2723|      0|    }
 2724|    288|    if (content_len > 0) {
  ------------------
  |  Branch (2724:9): [True: 287, False: 1]
  ------------------
 2725|    287|      memcpy(content, content_marker + 1 + 4, (size_t)content_len);
 2726|    287|    }
 2727|    288|    metalayer->content = (uint8_t*)content;
 2728|    288|  }
 2729|    379|  return 1;
 2730|    431|}
frame.c:validate_offsets_chunk:
 2888|  9.22k|                                  int64_t nchunks) {
 2889|  9.22k|  int32_t coffsets_cbytes = 0;
 2890|  9.22k|  uint8_t* coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &coffsets_cbytes);
 2891|  9.22k|  if (coffsets == NULL) {
  ------------------
  |  Branch (2891:7): [True: 22, False: 9.20k]
  ------------------
 2892|     22|    BLOSC_TRACE_ERROR("Cannot get compressed offsets from frame.");
  ------------------
  |  |   93|     22|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     22|    do {                                            \
  |  |  |  |   98|     22|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     22|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 22, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     22|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2893|     22|    return BLOSC2_ERROR_DATA;
 2894|     22|  }
 2895|       |
 2896|  9.20k|  int32_t offsets_nbytes;
 2897|  9.20k|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &offsets_nbytes)) {
  ------------------
  |  Branch (2897:7): [True: 0, False: 9.20k]
  ------------------
 2898|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2899|      0|    return BLOSC2_ERROR_FAILURE;
 2900|      0|  }
 2901|       |
 2902|  9.20k|  int64_t* offsets = (int64_t*)malloc((size_t)offsets_nbytes);
 2903|  9.20k|  if (offsets == NULL) {
  ------------------
  |  Branch (2903:7): [True: 0, False: 9.20k]
  ------------------
 2904|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2905|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2906|      0|  }
 2907|       |
 2908|  9.20k|  blosc2_dparams off_dparams = BLOSC2_DPARAMS_DEFAULTS;
 2909|  9.20k|  blosc2_context* dctx = blosc2_create_dctx(off_dparams);
 2910|  9.20k|  if (dctx == NULL) {
  ------------------
  |  Branch (2910:7): [True: 0, False: 9.20k]
  ------------------
 2911|      0|    free(offsets);
 2912|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2913|      0|    return BLOSC2_ERROR_FAILURE;
 2914|      0|  }
 2915|       |
 2916|  9.20k|  int32_t off_nbytes = blosc2_decompress_ctx(dctx, coffsets, coffsets_cbytes,
 2917|  9.20k|                                             offsets, offsets_nbytes);
 2918|  9.20k|  blosc2_free_ctx(dctx);
 2919|  9.20k|  if (off_nbytes != offsets_nbytes) {
  ------------------
  |  Branch (2919:7): [True: 8.57k, False: 623]
  ------------------
 2920|  8.57k|    free(offsets);
 2921|  8.57k|    BLOSC_TRACE_ERROR("Cannot decompress offsets chunk.");
  ------------------
  |  |   93|  8.57k|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|  8.57k|    do {                                            \
  |  |  |  |   98|  8.57k|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|  8.57k|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 8.57k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|  8.57k|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2922|  8.57k|    return BLOSC2_ERROR_DATA;
 2923|  8.57k|  }
 2924|       |
 2925|   581M|  for (int64_t i = 0; i < nchunks; ++i) {
  ------------------
  |  Branch (2925:23): [True: 581M, False: 602]
  ------------------
 2926|   581M|    int64_t offset = offsets[i];
 2927|   581M|    if (offset < 0) {
  ------------------
  |  Branch (2927:9): [True: 45.0M, False: 536M]
  ------------------
 2928|  45.0M|      continue;
 2929|  45.0M|    }
 2930|   536M|    if (offset > INT64_MAX - header_len || offset > cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (2930:9): [True: 0, False: 536M]
  |  Branch (2930:44): [True: 21, False: 536M]
  ------------------
 2931|     21|      free(offsets);
 2932|     21|      BLOSC_TRACE_ERROR("Offset for chunk %" PRId64 " is out of bounds.", i);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2933|     21|      return BLOSC2_ERROR_INVALID_HEADER;
 2934|     21|    }
 2935|       |    /* Offsets do not need to be monotonic.  Frame mutations like insert can append
 2936|       |     * chunk payloads at the end of the cframe while updating the logical chunk order
 2937|       |     * only in the offsets table, so a valid frame may legitimately contain
 2938|       |     * non-monotonic non-negative offsets.
 2939|       |     */
 2940|   536M|  }
 2941|       |
 2942|    602|  free(offsets);
 2943|    602|  return 0;
 2944|    623|}

blosc2_schunk_get_cparams:
   70|  9.25k|int blosc2_schunk_get_cparams(blosc2_schunk *schunk, blosc2_cparams **cparams) {
   71|  9.25k|  *cparams = calloc(1, sizeof(blosc2_cparams));
   72|  9.25k|  (*cparams)->schunk = schunk;
   73|  64.7k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (73:19): [True: 55.5k, False: 9.25k]
  ------------------
   74|  55.5k|    (*cparams)->filters[i] = schunk->filters[i];
   75|  55.5k|    (*cparams)->filters_meta[i] = schunk->filters_meta[i];
   76|  55.5k|  }
   77|  9.25k|  (*cparams)->compcode = schunk->compcode;
   78|  9.25k|  (*cparams)->compcode_meta = schunk->compcode_meta;
   79|  9.25k|  (*cparams)->clevel = schunk->clevel;
   80|  9.25k|  (*cparams)->typesize = schunk->typesize;
   81|  9.25k|  (*cparams)->blocksize = schunk->blocksize;
   82|  9.25k|  (*cparams)->splitmode = schunk->splitmode;
   83|  9.25k|  (*cparams)->use_dict = schunk->use_dict;
   84|  9.25k|  if (schunk->cctx == NULL) {
  ------------------
  |  Branch (84:7): [True: 9.25k, False: 0]
  ------------------
   85|  9.25k|    (*cparams)->nthreads = blosc2_get_nthreads();
   86|  9.25k|  }
   87|      0|  else {
   88|      0|    (*cparams)->nthreads = (int16_t)schunk->cctx->nthreads;
   89|      0|  }
   90|  9.25k|  return 0;
   91|  9.25k|}
blosc2_schunk_get_dparams:
   95|  9.24k|int blosc2_schunk_get_dparams(blosc2_schunk *schunk, blosc2_dparams **dparams) {
   96|  9.24k|  *dparams = calloc(1, sizeof(blosc2_dparams));
   97|  9.24k|  (*dparams)->schunk = schunk;
   98|  9.24k|  if (schunk->dctx == NULL) {
  ------------------
  |  Branch (98:7): [True: 9.24k, False: 0]
  ------------------
   99|  9.24k|    (*dparams)->nthreads = blosc2_get_nthreads();
  100|  9.24k|  }
  101|      0|  else {
  102|      0|    (*dparams)->nthreads = schunk->dctx->nthreads;
  103|      0|  }
  104|  9.24k|  return 0;
  105|  9.24k|}
schunk_free_metalayers:
  653|  9.27k|void schunk_free_metalayers(blosc2_schunk *schunk) {
  654|  9.29k|  for (int i = 0; i < schunk->nmetalayers; i++) {
  ------------------
  |  Branch (654:19): [True: 16, False: 9.27k]
  ------------------
  655|     16|    if (schunk->metalayers[i] != NULL) {
  ------------------
  |  Branch (655:9): [True: 6, False: 10]
  ------------------
  656|      6|      free(schunk->metalayers[i]->name);
  657|      6|      free(schunk->metalayers[i]->content);
  658|      6|      free(schunk->metalayers[i]);
  659|       |      schunk->metalayers[i] = NULL;
  660|      6|    }
  661|     16|  }
  662|  9.27k|  schunk->nmetalayers = 0;
  663|  9.27k|}
schunk_free_vlmetalayers:
  666|  9.27k|void schunk_free_vlmetalayers(blosc2_schunk *schunk) {
  667|  40.2k|  for (int i = 0; i < schunk->nvlmetalayers; i++) {
  ------------------
  |  Branch (667:19): [True: 30.9k, False: 9.27k]
  ------------------
  668|  30.9k|    if (schunk->vlmetalayers[i] != NULL) {
  ------------------
  |  Branch (668:9): [True: 333, False: 30.6k]
  ------------------
  669|    333|      free(schunk->vlmetalayers[i]->name);
  670|    333|      free(schunk->vlmetalayers[i]->content);
  671|    333|      free(schunk->vlmetalayers[i]);
  672|       |      schunk->vlmetalayers[i] = NULL;
  673|    333|    }
  674|  30.9k|  }
  675|  9.27k|  schunk->nvlmetalayers = 0;
  676|  9.27k|}
blosc2_schunk_free:
  679|  9.27k|int blosc2_schunk_free(blosc2_schunk *schunk) {
  680|  9.27k|  int err = 0;
  681|       |
  682|       |  // If it is a view, the data belongs to original array and should not be freed
  683|  9.27k|  if (schunk->data != NULL && !schunk->view) {
  ------------------
  |  Branch (683:7): [True: 0, False: 9.27k]
  |  Branch (683:31): [True: 0, False: 0]
  ------------------
  684|      0|    for (int i = 0; i < schunk->nchunks; i++) {
  ------------------
  |  Branch (684:21): [True: 0, False: 0]
  ------------------
  685|      0|      free(schunk->data[i]);
  686|      0|    }
  687|      0|    free(schunk->data);
  688|      0|  }
  689|  9.27k|  if (schunk->cctx != NULL)
  ------------------
  |  Branch (689:7): [True: 9.24k, False: 33]
  ------------------
  690|  9.24k|    blosc2_free_ctx(schunk->cctx);
  691|  9.27k|  if (schunk->dctx != NULL)
  ------------------
  |  Branch (691:7): [True: 9.24k, False: 33]
  ------------------
  692|  9.24k|    blosc2_free_ctx(schunk->dctx);
  693|  9.27k|  if (schunk->blockshape != NULL)
  ------------------
  |  Branch (693:7): [True: 0, False: 9.27k]
  ------------------
  694|      0|    free(schunk->blockshape);
  695|       |
  696|  9.27k|  schunk_free_metalayers(schunk);
  697|       |
  698|  9.27k|  if (schunk->storage != NULL) {
  ------------------
  |  Branch (698:7): [True: 9.24k, False: 33]
  ------------------
  699|  9.24k|    blosc2_io_cb *io_cb = blosc2_get_io_cb(schunk->storage->io->id);
  700|  9.24k|    if (io_cb != NULL) {
  ------------------
  |  Branch (700:9): [True: 9.24k, False: 0]
  ------------------
  701|  9.24k|      int rc = io_cb->destroy(schunk->storage->io->params);
  702|  9.24k|      if (rc < 0) {
  ------------------
  |  Branch (702:11): [True: 0, False: 9.24k]
  ------------------
  703|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  704|      0|        err = 1;
  705|      0|      }
  706|  9.24k|    }
  707|       |
  708|  9.24k|    if (schunk->storage->urlpath != NULL) {
  ------------------
  |  Branch (708:9): [True: 0, False: 9.24k]
  ------------------
  709|      0|      free(schunk->storage->urlpath);
  710|      0|    }
  711|  9.24k|    free(schunk->storage->cparams);
  712|  9.24k|    free(schunk->storage->dparams);
  713|  9.24k|    free(schunk->storage->io);
  714|  9.24k|    free(schunk->storage);
  715|  9.24k|  }
  716|       |
  717|       |  // If it is a view, the frame belongs to original array and should not be freed
  718|  9.27k|  if (schunk->frame != NULL && !schunk->view) {
  ------------------
  |  Branch (718:7): [True: 9.27k, False: 0]
  |  Branch (718:32): [True: 9.27k, False: 0]
  ------------------
  719|  9.27k|    frame_free((blosc2_frame_s *) schunk->frame);
  720|  9.27k|  }
  721|       |
  722|  9.27k|  schunk_free_vlmetalayers(schunk);
  723|       |
  724|  9.27k|  free(schunk);
  725|       |
  726|  9.27k|  return err;
  727|  9.27k|}
blosc2_schunk_from_buffer:
  731|  9.34k|blosc2_schunk* blosc2_schunk_from_buffer(uint8_t *cframe, int64_t len, bool copy) {
  732|       |  // Check that the buffer actually comes from a cframe
  733|  9.34k|  if (cframe == NULL || len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  9.34k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  9.34k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  9.34k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  9.34k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  9.34k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  9.34k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  9.34k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  9.34k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  9.34k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  9.34k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  9.34k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  9.34k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  9.34k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  9.34k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (733:7): [True: 0, False: 9.34k]
  |  Branch (733:25): [True: 0, False: 9.34k]
  ------------------
  734|      0|    return NULL;
  735|      0|  }
  736|  9.34k|  char *magic_number = (char *)cframe + FRAME_HEADER_MAGIC;
  ------------------
  |  |   29|  9.34k|#define FRAME_HEADER_MAGIC 2
  ------------------
  737|  9.34k|  if (memcmp(magic_number, "b2frame", sizeof("b2frame")) != 0) {
  ------------------
  |  Branch (737:7): [True: 52, False: 9.29k]
  ------------------
  738|     52|    return NULL;
  739|     52|  }
  740|  9.29k|  blosc2_frame_s* frame = frame_from_cframe(cframe, len, false);
  741|  9.29k|  if (frame == NULL) {
  ------------------
  |  Branch (741:7): [True: 11, False: 9.27k]
  ------------------
  742|     11|    return NULL;
  743|     11|  }
  744|  9.27k|  blosc2_schunk* schunk = frame_to_schunk(frame, copy, &BLOSC2_IO_DEFAULTS);
  745|  9.27k|  if (schunk && copy) {
  ------------------
  |  Branch (745:7): [True: 379, False: 8.90k]
  |  Branch (745:17): [True: 0, False: 379]
  ------------------
  746|       |    // Super-chunk has its own copy of frame
  747|      0|    frame_free(frame);
  748|      0|  }
  749|  9.27k|  return schunk;
  750|  9.29k|}
blosc2_schunk_decompress_chunk:
 1482|  9.79k|                                   void *dest, int32_t nbytes) {
 1483|  9.79k|  int rc = validate_nchunk(schunk, nchunk, false, "blosc2_schunk_decompress_chunk");
 1484|  9.79k|  if (rc < 0) {
  ------------------
  |  Branch (1484:7): [True: 0, False: 9.79k]
  ------------------
 1485|      0|    return rc;
 1486|      0|  }
 1487|       |
 1488|  9.79k|  int32_t chunk_nbytes;
 1489|  9.79k|  int32_t chunk_cbytes;
 1490|  9.79k|  int chunksize;
 1491|  9.79k|  blosc2_frame_s* frame = (blosc2_frame_s*)schunk->frame;
 1492|       |
 1493|  9.79k|  schunk->current_nchunk = nchunk;
 1494|  9.79k|  if (frame == NULL) {
  ------------------
  |  Branch (1494:7): [True: 0, False: 9.79k]
  ------------------
 1495|      0|    uint8_t* src = schunk->data[nchunk];
 1496|      0|    if (src == 0) {
  ------------------
  |  Branch (1496:9): [True: 0, False: 0]
  ------------------
 1497|      0|      return 0;
 1498|      0|    }
 1499|       |
 1500|      0|    rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 1501|      0|    if (rc < 0) {
  ------------------
  |  Branch (1501:9): [True: 0, False: 0]
  ------------------
 1502|      0|      return rc;
 1503|      0|    }
 1504|       |
 1505|      0|    if (nbytes < chunk_nbytes) {
  ------------------
  |  Branch (1505:9): [True: 0, False: 0]
  ------------------
 1506|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1507|      0|                        "('%d' bytes, but '%d' are needed).", nbytes, chunk_nbytes);
 1508|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 1509|      0|    }
 1510|       |
 1511|      0|    chunksize = blosc2_decompress_ctx(schunk->dctx, src, chunk_cbytes, dest, nbytes);
 1512|      0|    if (chunksize < 0 || chunksize != chunk_nbytes) {
  ------------------
  |  Branch (1512:9): [True: 0, False: 0]
  |  Branch (1512:26): [True: 0, False: 0]
  ------------------
 1513|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1514|      0|      if (chunksize < 0)
  ------------------
  |  Branch (1514:11): [True: 0, False: 0]
  ------------------
 1515|      0|        return chunksize;
 1516|      0|      return BLOSC2_ERROR_FAILURE;
 1517|      0|    }
 1518|  9.79k|  } else {
 1519|  9.79k|    rc = frame_lock(frame, false);
 1520|  9.79k|    if (rc < 0) {
  ------------------
  |  Branch (1520:9): [True: 0, False: 9.79k]
  ------------------
 1521|      0|      return rc;
 1522|      0|    }
 1523|  9.79k|    chunksize = frame_decompress_chunk(schunk->dctx, frame, nchunk, dest, nbytes);
 1524|  9.79k|    frame_unlock(frame);
 1525|  9.79k|    if (chunksize < 0) {
  ------------------
  |  Branch (1525:9): [True: 335, False: 9.45k]
  ------------------
 1526|    335|      return chunksize;
 1527|    335|    }
 1528|  9.79k|  }
 1529|  9.45k|  return chunksize;
 1530|  9.79k|}
schunk.c:validate_nchunk:
   44|  9.79k|static int validate_nchunk(blosc2_schunk *schunk, int64_t nchunk, bool allow_end, const char *func_name) {
   45|  9.79k|  if (nchunk < 0) {
  ------------------
  |  Branch (45:7): [True: 0, False: 9.79k]
  ------------------
   46|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   47|      0|    return BLOSC2_ERROR_INVALID_PARAM;
   48|      0|  }
   49|       |
   50|  9.79k|  if (allow_end) {
  ------------------
  |  Branch (50:7): [True: 0, False: 9.79k]
  ------------------
   51|      0|    if (nchunk > schunk->nchunks) {
  ------------------
  |  Branch (51:9): [True: 0, False: 0]
  ------------------
   52|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   53|      0|                        nchunk, schunk->nchunks, func_name);
   54|      0|      return BLOSC2_ERROR_INVALID_PARAM;
   55|      0|    }
   56|      0|  }
   57|  9.79k|  else {
   58|  9.79k|    if (nchunk >= schunk->nchunks) {
  ------------------
  |  Branch (58:9): [True: 0, False: 9.79k]
  ------------------
   59|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   60|      0|                        "('%" PRId64 "') in %s.", nchunk, schunk->nchunks, func_name);
   61|      0|      return BLOSC2_ERROR_INVALID_PARAM;
   62|      0|    }
   63|  9.79k|  }
   64|       |
   65|  9.79k|  return BLOSC2_ERROR_SUCCESS;
   66|  9.79k|}

unshuffle_avx2:
  784|  16.1k|               const uint8_t *_src, uint8_t *_dest) {
  785|  16.1k|  const int32_t vectorized_chunk_size = bytesoftype * (int32_t)sizeof(__m256i);
  786|       |
  787|       |  /* If the block size is too small to be vectorized,
  788|       |     use the generic implementation. */
  789|  16.1k|  if (blocksize < vectorized_chunk_size) {
  ------------------
  |  Branch (789:7): [True: 7.49k, False: 8.67k]
  ------------------
  790|  7.49k|    unshuffle_generic(bytesoftype, blocksize, _src, _dest);
  791|  7.49k|    return;
  792|  7.49k|  }
  793|       |
  794|       |  /* If the blocksize is not a multiple of both the typesize and
  795|       |     the vector size, round the blocksize down to the next value
  796|       |     which is a multiple of both. The vectorized unshuffle can be
  797|       |     used for that portion of the data, and the naive implementation
  798|       |     can be used for the remaining portion. */
  799|  8.67k|  const int32_t vectorizable_bytes = blocksize - (blocksize % vectorized_chunk_size);
  800|       |
  801|  8.67k|  const int32_t vectorizable_elements = vectorizable_bytes / bytesoftype;
  802|  8.67k|  const int32_t total_elements = blocksize / bytesoftype;
  803|       |
  804|       |  /* Optimized unshuffle implementations */
  805|  8.67k|  switch (bytesoftype) {
  806|    594|    case 2:
  ------------------
  |  Branch (806:5): [True: 594, False: 8.07k]
  ------------------
  807|    594|      unshuffle2_avx2(_dest, _src, vectorizable_elements, total_elements);
  808|    594|      break;
  809|  1.78k|    case 4:
  ------------------
  |  Branch (809:5): [True: 1.78k, False: 6.88k]
  ------------------
  810|  1.78k|      unshuffle4_avx2(_dest, _src, vectorizable_elements, total_elements);
  811|  1.78k|      break;
  812|  1.01k|    case 8:
  ------------------
  |  Branch (812:5): [True: 1.01k, False: 7.65k]
  ------------------
  813|  1.01k|      unshuffle8_avx2(_dest, _src, vectorizable_elements, total_elements);
  814|  1.01k|      break;
  815|    765|    case 12:
  ------------------
  |  Branch (815:5): [True: 765, False: 7.90k]
  ------------------
  816|    765|      unshuffle12_avx2(_dest, _src, vectorizable_elements, total_elements);
  817|    765|      break;
  818|     12|    case 16:
  ------------------
  |  Branch (818:5): [True: 12, False: 8.66k]
  ------------------
  819|     12|      unshuffle16_avx2(_dest, _src, vectorizable_elements, total_elements);
  820|     12|      break;
  821|  4.50k|    default:
  ------------------
  |  Branch (821:5): [True: 4.50k, False: 4.17k]
  ------------------
  822|       |      /* For types larger than 16 bytes, use the AVX2 tiled unshuffle. */
  823|  4.50k|      if (bytesoftype > (int32_t)sizeof(__m128i)) {
  ------------------
  |  Branch (823:11): [True: 3.83k, False: 668]
  ------------------
  824|  3.83k|        unshuffle16_tiled_avx2(_dest, _src, vectorizable_elements, total_elements, bytesoftype);
  825|  3.83k|      }
  826|    668|      else {
  827|       |        /* Non-optimized unshuffle */
  828|    668|        unshuffle_generic(bytesoftype, blocksize, _src, _dest);
  829|       |        /* The non-optimized function covers the whole buffer,
  830|       |           so we're done processing here. */
  831|    668|        return;
  832|    668|      }
  833|  8.67k|  }
  834|       |
  835|       |  /* If the buffer had any bytes at the end which couldn't be handled
  836|       |     by the vectorized implementations, use the non-optimized version
  837|       |     to finish them up. */
  838|  8.00k|  if (vectorizable_bytes < blocksize) {
  ------------------
  |  Branch (838:7): [True: 6.53k, False: 1.46k]
  ------------------
  839|  6.53k|    unshuffle_generic_inline(bytesoftype, vectorizable_bytes, blocksize, _src, _dest);
  840|  6.53k|  }
  841|  8.00k|}
shuffle-avx2.c:unshuffle2_avx2:
  338|    594|                const int32_t vectorizable_elements, const int32_t total_elements) {
  339|    594|  static const int32_t bytesoftype = 2;
  340|    594|  int32_t i;
  341|    594|  int j;
  342|    594|  __m256i ymm0[2], ymm1[2];
  343|       |
  344|   264k|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (344:15): [True: 263k, False: 594]
  ------------------
  345|       |    /* Load 32 elements (64 bytes) into 2 YMM registers. */
  346|   263k|    const uint8_t* const src_for_ith_element = src + i;
  347|   791k|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (347:17): [True: 527k, False: 263k]
  ------------------
  348|   527k|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  349|   527k|    }
  350|       |    /* Shuffle bytes */
  351|   791k|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (351:17): [True: 527k, False: 263k]
  ------------------
  352|   527k|      ymm0[j] = _mm256_permute4x64_epi64(ymm0[j], 0xd8);
  353|   527k|    }
  354|       |    /* Compute the low 64 bytes */
  355|   263k|    ymm1[0] = _mm256_unpacklo_epi8(ymm0[0], ymm0[1]);
  356|       |    /* Compute the hi 64 bytes */
  357|   263k|    ymm1[1] = _mm256_unpackhi_epi8(ymm0[0], ymm0[1]);
  358|       |    /* Store the result vectors in proper order */
  359|   263k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * sizeof(__m256i))), ymm1[0]);
  360|   263k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * sizeof(__m256i))), ymm1[1]);
  361|   263k|  }
  362|    594|}
shuffle-avx2.c:unshuffle4_avx2:
  367|  1.78k|                const int32_t vectorizable_elements, const int32_t total_elements) {
  368|  1.78k|  static const int32_t bytesoftype = 4;
  369|  1.78k|  int32_t i;
  370|  1.78k|  int j;
  371|  1.78k|  __m256i ymm0[4], ymm1[4];
  372|       |
  373|   351k|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (373:15): [True: 349k, False: 1.78k]
  ------------------
  374|       |    /* Load 32 elements (128 bytes) into 4 YMM registers. */
  375|   349k|    const uint8_t* const src_for_ith_element = src + i;
  376|  1.74M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (376:17): [True: 1.39M, False: 349k]
  ------------------
  377|  1.39M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  378|  1.39M|    }
  379|       |    /* Shuffle bytes */
  380|  1.04M|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (380:17): [True: 698k, False: 349k]
  ------------------
  381|       |      /* Compute the low 64 bytes */
  382|   698k|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  383|       |      /* Compute the hi 64 bytes */
  384|   698k|      ymm1[2 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  385|   698k|    }
  386|       |    /* Shuffle 2-byte words */
  387|  1.04M|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (387:17): [True: 698k, False: 349k]
  ------------------
  388|       |      /* Compute the low 64 bytes */
  389|   698k|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  390|       |      /* Compute the hi 64 bytes */
  391|   698k|      ymm0[2 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  392|   698k|    }
  393|   349k|    ymm1[0] = _mm256_permute2x128_si256(ymm0[0], ymm0[2], 0x20);
  394|   349k|    ymm1[1] = _mm256_permute2x128_si256(ymm0[1], ymm0[3], 0x20);
  395|   349k|    ymm1[2] = _mm256_permute2x128_si256(ymm0[0], ymm0[2], 0x31);
  396|   349k|    ymm1[3] = _mm256_permute2x128_si256(ymm0[1], ymm0[3], 0x31);
  397|       |
  398|       |    /* Store the result vectors in proper order */
  399|  1.74M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (399:17): [True: 1.39M, False: 349k]
  ------------------
  400|  1.39M|      _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (j * sizeof(__m256i))), ymm1[j]);
  401|  1.39M|    }
  402|   349k|  }
  403|  1.78k|}
shuffle-avx2.c:unshuffle8_avx2:
  408|  1.01k|                const int32_t vectorizable_elements, const int32_t total_elements) {
  409|  1.01k|  static const int32_t bytesoftype = 8;
  410|  1.01k|  int32_t i;
  411|  1.01k|  int j;
  412|  1.01k|  __m256i ymm0[8], ymm1[8];
  413|       |
  414|   266k|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (414:15): [True: 265k, False: 1.01k]
  ------------------
  415|       |    /* Fetch 32 elements (256 bytes) into 8 YMM registers. */
  416|   265k|    const uint8_t* const src_for_ith_element = src + i;
  417|  2.39M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (417:17): [True: 2.12M, False: 265k]
  ------------------
  418|  2.12M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  419|  2.12M|    }
  420|       |    /* Shuffle bytes */
  421|  1.32M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (421:17): [True: 1.06M, False: 265k]
  ------------------
  422|       |      /* Compute the low 32 bytes */
  423|  1.06M|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  424|       |      /* Compute the hi 32 bytes */
  425|  1.06M|      ymm1[4 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  426|  1.06M|    }
  427|       |    /* Shuffle words */
  428|  1.32M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (428:17): [True: 1.06M, False: 265k]
  ------------------
  429|       |      /* Compute the low 32 bytes */
  430|  1.06M|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  431|       |      /* Compute the hi 32 bytes */
  432|  1.06M|      ymm0[4 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  433|  1.06M|    }
  434|  2.39M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (434:17): [True: 2.12M, False: 265k]
  ------------------
  435|  2.12M|      ymm0[j] = _mm256_permute4x64_epi64(ymm0[j], 0xd8);
  436|  2.12M|    }
  437|       |
  438|       |    /* Shuffle 4-byte dwords */
  439|  1.32M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (439:17): [True: 1.06M, False: 265k]
  ------------------
  440|       |      /* Compute the low 32 bytes */
  441|  1.06M|      ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  442|       |      /* Compute the hi 32 bytes */
  443|  1.06M|      ymm1[4 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  444|  1.06M|    }
  445|       |
  446|       |    /* Store the result vectors in proper order */
  447|   265k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * sizeof(__m256i))), ymm1[0]);
  448|   265k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * sizeof(__m256i))), ymm1[2]);
  449|   265k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (2 * sizeof(__m256i))), ymm1[1]);
  450|   265k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (3 * sizeof(__m256i))), ymm1[3]);
  451|   265k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (4 * sizeof(__m256i))), ymm1[4]);
  452|   265k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (5 * sizeof(__m256i))), ymm1[6]);
  453|   265k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (6 * sizeof(__m256i))), ymm1[5]);
  454|   265k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (7 * sizeof(__m256i))), ymm1[7]);
  455|   265k|  }
  456|  1.01k|}
shuffle-avx2.c:unshuffle12_avx2:
  533|    765|    const int32_t vectorizable_elements, const int32_t total_elements) {
  534|    765|  static const int32_t bytesoftype = 12;
  535|    765|  int32_t i;
  536|    765|  int j;
  537|    765|  __m256i ymm0[16], ymm1[16];
  538|       |
  539|    765|  __m256i permute = _mm256_set_epi32(0,0,6,5,4,2,1,0);
  540|    765|  __m256i store_mask = _mm256_set_epi32(0x0, 0x0, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
  541|    765|  int32_t jump = 2*bytesoftype;
  542|  3.36k|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (542:15): [True: 2.59k, False: 765]
  ------------------
  543|       |    /* Fetch 24 elements (384 bytes) into 12 YMM registers. */
  544|  2.59k|    const uint8_t* const src_for_ith_element = src + i;
  545|  33.7k|    for (j = 0; j < bytesoftype; j++) {
  ------------------
  |  Branch (545:17): [True: 31.1k, False: 2.59k]
  ------------------
  546|  31.1k|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  547|  31.1k|    }
  548|       |    /* Initialize the last 4 registers (128 bytes) to null */
  549|  12.9k|    for (j = bytesoftype; j < 16; j++) {
  ------------------
  |  Branch (549:27): [True: 10.3k, False: 2.59k]
  ------------------
  550|  10.3k|      ymm0[j] = _mm256_setzero_si256();
  551|  10.3k|    }
  552|       |
  553|       |    /* Shuffle bytes */
  554|  23.3k|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (554:17): [True: 20.7k, False: 2.59k]
  ------------------
  555|       |      /* Compute the low 32 bytes */
  556|  20.7k|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  557|       |      /* Compute the hi 32 bytes */
  558|  20.7k|      ymm1[8 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  559|  20.7k|    }
  560|       |    /* Shuffle 2-byte words */
  561|  23.3k|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (561:17): [True: 20.7k, False: 2.59k]
  ------------------
  562|       |      /* Compute the low 32 bytes */
  563|  20.7k|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  564|       |      /* Compute the hi 32 bytes */
  565|  20.7k|      ymm0[8 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  566|  20.7k|    }
  567|       |    /* Shuffle 4-byte dwords */
  568|  23.3k|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (568:17): [True: 20.7k, False: 2.59k]
  ------------------
  569|       |      /* Compute the low 32 bytes */
  570|  20.7k|      ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  571|       |      /* Compute the hi 32 bytes */
  572|  20.7k|      ymm1[8 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  573|  20.7k|    }
  574|       |
  575|       |    /* Shuffle 8-byte qwords */
  576|  23.3k|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (576:17): [True: 20.7k, False: 2.59k]
  ------------------
  577|       |      /* Compute the low 32 bytes */
  578|  20.7k|      ymm0[j] = _mm256_unpacklo_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  579|       |      /* Compute the hi 32 bytes */
  580|  20.7k|      ymm0[8 + j] = _mm256_unpackhi_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  581|  20.7k|    }
  582|       |
  583|       |
  584|  23.3k|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (584:17): [True: 20.7k, False: 2.59k]
  ------------------
  585|  20.7k|      ymm1[j] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x20);
  586|  20.7k|      ymm1[j + 8] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x31);
  587|  20.7k|      ymm1[j] = _mm256_permutevar8x32_epi32(ymm1[j], permute);
  588|  20.7k|      ymm1[j+8] = _mm256_permutevar8x32_epi32(ymm1[j+8], permute);
  589|       |
  590|       |
  591|  20.7k|    }
  592|  2.59k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * jump)), ymm1[0]);
  593|  2.59k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * jump)), ymm1[4]);
  594|  2.59k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (2 * jump)), ymm1[2]);
  595|  2.59k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (3 * jump)), ymm1[6]);
  596|  2.59k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (4 * jump)), ymm1[1]);
  597|  2.59k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (5 * jump)), ymm1[5]);
  598|  2.59k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (6 * jump)), ymm1[3]);
  599|  2.59k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (7 * jump)), ymm1[7]);
  600|  2.59k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (8 * jump)), ymm1[8]);
  601|  2.59k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (9 * jump)), ymm1[12]);
  602|  2.59k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (10 * jump)), ymm1[10]);
  603|  2.59k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (11 * jump)), ymm1[14]);
  604|  2.59k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (12 * jump)), ymm1[9]);
  605|  2.59k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (13 * jump)), ymm1[13]);
  606|  2.59k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (14 * jump)), ymm1[11]);
  607|  2.59k|    _mm256_maskstore_epi32((int *)(dest + (i * bytesoftype) + (15 * jump)), store_mask, ymm1[15]);
  608|  2.59k|  }
  609|    765|}
shuffle-avx2.c:unshuffle16_avx2:
  461|     12|                 const int32_t vectorizable_elements, const int32_t total_elements) {
  462|     12|  static const int32_t bytesoftype = 16;
  463|     12|  int32_t i;
  464|     12|  int j;
  465|     12|  __m256i ymm0[16], ymm1[16];
  466|       |
  467|  2.09M|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (467:15): [True: 2.09M, False: 12]
  ------------------
  468|       |    /* Fetch 32 elements (512 bytes) into 16 YMM registers. */
  469|  2.09M|    const uint8_t* const src_for_ith_element = src + i;
  470|  35.6M|    for (j = 0; j < 16; j++) {
  ------------------
  |  Branch (470:17): [True: 33.5M, False: 2.09M]
  ------------------
  471|  33.5M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  472|  33.5M|    }
  473|       |
  474|       |    /* Shuffle bytes */
  475|  18.8M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (475:17): [True: 16.7M, False: 2.09M]
  ------------------
  476|       |      /* Compute the low 32 bytes */
  477|  16.7M|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  478|       |      /* Compute the hi 32 bytes */
  479|  16.7M|      ymm1[8 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  480|  16.7M|    }
  481|       |    /* Shuffle 2-byte words */
  482|  18.8M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (482:17): [True: 16.7M, False: 2.09M]
  ------------------
  483|       |      /* Compute the low 32 bytes */
  484|  16.7M|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  485|       |      /* Compute the hi 32 bytes */
  486|  16.7M|      ymm0[8 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  487|  16.7M|    }
  488|       |    /* Shuffle 4-byte dwords */
  489|  18.8M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (489:17): [True: 16.7M, False: 2.09M]
  ------------------
  490|       |      /* Compute the low 32 bytes */
  491|  16.7M|      ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  492|       |      /* Compute the hi 32 bytes */
  493|  16.7M|      ymm1[8 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  494|  16.7M|    }
  495|       |
  496|       |    /* Shuffle 8-byte qwords */
  497|  18.8M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (497:17): [True: 16.7M, False: 2.09M]
  ------------------
  498|       |      /* Compute the low 32 bytes */
  499|  16.7M|      ymm0[j] = _mm256_unpacklo_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  500|       |      /* Compute the hi 32 bytes */
  501|  16.7M|      ymm0[8 + j] = _mm256_unpackhi_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  502|  16.7M|    }
  503|       |
  504|  18.8M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (504:17): [True: 16.7M, False: 2.09M]
  ------------------
  505|  16.7M|      ymm1[j] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x20);
  506|  16.7M|      ymm1[j + 8] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x31);
  507|  16.7M|    }
  508|       |
  509|       |    /* Store the result vectors in proper order */
  510|  2.09M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * sizeof(__m256i))), ymm1[0]);
  511|  2.09M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * sizeof(__m256i))), ymm1[4]);
  512|  2.09M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (2 * sizeof(__m256i))), ymm1[2]);
  513|  2.09M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (3 * sizeof(__m256i))), ymm1[6]);
  514|  2.09M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (4 * sizeof(__m256i))), ymm1[1]);
  515|  2.09M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (5 * sizeof(__m256i))), ymm1[5]);
  516|  2.09M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (6 * sizeof(__m256i))), ymm1[3]);
  517|  2.09M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (7 * sizeof(__m256i))), ymm1[7]);
  518|  2.09M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (8 * sizeof(__m256i))), ymm1[8]);
  519|  2.09M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (9 * sizeof(__m256i))), ymm1[12]);
  520|  2.09M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (10 * sizeof(__m256i))), ymm1[10]);
  521|  2.09M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (11 * sizeof(__m256i))), ymm1[14]);
  522|  2.09M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (12 * sizeof(__m256i))), ymm1[9]);
  523|  2.09M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (13 * sizeof(__m256i))), ymm1[13]);
  524|  2.09M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (14 * sizeof(__m256i))), ymm1[11]);
  525|  2.09M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (15 * sizeof(__m256i))), ymm1[15]);
  526|  2.09M|  }
  527|     12|}
shuffle-avx2.c:unshuffle16_tiled_avx2:
  613|  3.83k|                       const int32_t vectorizable_elements, const int32_t total_elements, const int32_t bytesoftype) {
  614|  3.83k|  int32_t i;
  615|  3.83k|  int j;
  616|  3.83k|  __m256i ymm0[16], ymm1[16];
  617|       |
  618|  3.83k|  const lldiv_t vecs_per_el = lldiv(bytesoftype, sizeof(__m128i));
  619|  3.83k|  const int32_t vecs_rem = (int32_t)vecs_per_el.rem;
  620|       |
  621|       |  /* The unshuffle loops are inverted (compared to shuffle_tiled16_avx2)
  622|       |     to optimize cache utilization. */
  623|  3.83k|  int32_t offset_into_type;
  624|  15.8k|  for (offset_into_type = 0; offset_into_type < bytesoftype;
  ------------------
  |  Branch (624:30): [True: 11.9k, False: 3.83k]
  ------------------
  625|  11.9k|       offset_into_type += (offset_into_type == 0 && vecs_rem > 0 ? vecs_rem : (int32_t)sizeof(__m128i))) {
  ------------------
  |  Branch (625:29): [True: 3.83k, False: 8.15k]
  |  Branch (625:54): [True: 3.07k, False: 763]
  ------------------
  626|  5.68M|    for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (626:17): [True: 5.66M, False: 11.9k]
  ------------------
  627|       |      /* Load the first 16 bytes of 32 adjacent elements (512 bytes) into 16 YMM registers */
  628|  5.66M|      const uint8_t* const src_for_ith_element = src + i;
  629|  96.3M|      for (j = 0; j < 16; j++) {
  ------------------
  |  Branch (629:19): [True: 90.7M, False: 5.66M]
  ------------------
  630|  90.7M|        ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (total_elements * (offset_into_type + j))));
  631|  90.7M|      }
  632|       |
  633|       |      /* Shuffle bytes */
  634|  51.0M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (634:19): [True: 45.3M, False: 5.66M]
  ------------------
  635|       |        /* Compute the low 32 bytes */
  636|  45.3M|        ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  637|       |        /* Compute the hi 32 bytes */
  638|  45.3M|        ymm1[8 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  639|  45.3M|      }
  640|       |      /* Shuffle 2-byte words */
  641|  51.0M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (641:19): [True: 45.3M, False: 5.66M]
  ------------------
  642|       |        /* Compute the low 32 bytes */
  643|  45.3M|        ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  644|       |        /* Compute the hi 32 bytes */
  645|  45.3M|        ymm0[8 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  646|  45.3M|      }
  647|       |      /* Shuffle 4-byte dwords */
  648|  51.0M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (648:19): [True: 45.3M, False: 5.66M]
  ------------------
  649|       |        /* Compute the low 32 bytes */
  650|  45.3M|        ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  651|       |        /* Compute the hi 32 bytes */
  652|  45.3M|        ymm1[8 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  653|  45.3M|      }
  654|       |
  655|       |      /* Shuffle 8-byte qwords */
  656|  51.0M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (656:19): [True: 45.3M, False: 5.66M]
  ------------------
  657|       |        /* Compute the low 32 bytes */
  658|  45.3M|        ymm0[j] = _mm256_unpacklo_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  659|       |        /* Compute the hi 32 bytes */
  660|  45.3M|        ymm0[8 + j] = _mm256_unpackhi_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  661|  45.3M|      }
  662|       |
  663|  51.0M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (663:19): [True: 45.3M, False: 5.66M]
  ------------------
  664|  45.3M|        ymm1[j] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x20);
  665|  45.3M|        ymm1[j + 8] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x31);
  666|  45.3M|      }
  667|       |
  668|       |      /* Store the result vectors in proper order */
  669|  5.66M|      const uint8_t* const dest_with_offset = dest + offset_into_type;
  670|  5.66M|      _mm256_storeu2_m128i(
  671|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x01) * bytesoftype),
  672|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x00) * bytesoftype), ymm1[0]);
  673|  5.66M|      _mm256_storeu2_m128i(
  674|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x03) * bytesoftype),
  675|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x02) * bytesoftype), ymm1[4]);
  676|  5.66M|      _mm256_storeu2_m128i(
  677|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x05) * bytesoftype),
  678|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x04) * bytesoftype), ymm1[2]);
  679|  5.66M|      _mm256_storeu2_m128i(
  680|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x07) * bytesoftype),
  681|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x06) * bytesoftype), ymm1[6]);
  682|  5.66M|      _mm256_storeu2_m128i(
  683|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x09) * bytesoftype),
  684|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x08) * bytesoftype), ymm1[1]);
  685|  5.66M|      _mm256_storeu2_m128i(
  686|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x0b) * bytesoftype),
  687|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x0a) * bytesoftype), ymm1[5]);
  688|  5.66M|      _mm256_storeu2_m128i(
  689|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x0d) * bytesoftype),
  690|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x0c) * bytesoftype), ymm1[3]);
  691|  5.66M|      _mm256_storeu2_m128i(
  692|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x0f) * bytesoftype),
  693|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x0e) * bytesoftype), ymm1[7]);
  694|  5.66M|      _mm256_storeu2_m128i(
  695|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x11) * bytesoftype),
  696|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x10) * bytesoftype), ymm1[8]);
  697|  5.66M|      _mm256_storeu2_m128i(
  698|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x13) * bytesoftype),
  699|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x12) * bytesoftype), ymm1[12]);
  700|  5.66M|      _mm256_storeu2_m128i(
  701|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x15) * bytesoftype),
  702|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x14) * bytesoftype), ymm1[10]);
  703|  5.66M|      _mm256_storeu2_m128i(
  704|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x17) * bytesoftype),
  705|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x16) * bytesoftype), ymm1[14]);
  706|  5.66M|      _mm256_storeu2_m128i(
  707|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x19) * bytesoftype),
  708|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x18) * bytesoftype), ymm1[9]);
  709|  5.66M|      _mm256_storeu2_m128i(
  710|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x1b) * bytesoftype),
  711|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x1a) * bytesoftype), ymm1[13]);
  712|  5.66M|      _mm256_storeu2_m128i(
  713|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x1d) * bytesoftype),
  714|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x1c) * bytesoftype), ymm1[11]);
  715|  5.66M|      _mm256_storeu2_m128i(
  716|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x1f) * bytesoftype),
  717|  5.66M|          (__m128i*)(dest_with_offset + (i + 0x1e) * bytesoftype), ymm1[15]);
  718|  5.66M|    }
  719|  11.9k|  }
  720|  3.83k|}

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

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

blosc2_unshuffle:
  436|  16.1k|                 const void* src, void* dest) {
  437|       |  /* Initialize the shuffle implementation if necessary. */
  438|  16.1k|  init_shuffle_implementation();
  439|       |
  440|  16.1k|  if (typesize < 1 || typesize > 256 || blocksize < 0) {
  ------------------
  |  Branch (440:7): [True: 0, False: 16.1k]
  |  Branch (440:23): [True: 0, False: 16.1k]
  |  Branch (440:41): [True: 0, False: 16.1k]
  ------------------
  441|      0|    return BLOSC2_ERROR_INVALID_PARAM;
  442|      0|  }
  443|       |
  444|       |  /* The implementation is initialized.
  445|       |     Dispatch to it's unshuffle routine. */
  446|  16.1k|  (host_implementation.unshuffle)(typesize, blocksize, src, dest);
  447|       |
  448|  16.1k|  return blocksize;
  449|  16.1k|}
bitunshuffle:
  484|  10.7k|                     const uint8_t format_version) {
  485|       |  /* Initialize the shuffle implementation if necessary. */
  486|  10.7k|  init_shuffle_implementation();
  487|  10.7k|  size_t size = blocksize / typesize;
  488|       |
  489|  10.7k|  if (format_version == 2) {
  ------------------
  |  Branch (489:7): [True: 560, False: 10.1k]
  ------------------
  490|       |    /* Starting from version 3, bitshuffle() works differently */
  491|    560|    if ((size % 8) == 0) {
  ------------------
  |  Branch (491:9): [True: 544, False: 16]
  ------------------
  492|       |      /* The number of elems is a multiple of 8 which is supported by
  493|       |         bitshuffle. */
  494|    544|      int ret = (int) (host_implementation.bitunshuffle)
  495|    544|          ((const void *) src, (void *) dest, blocksize / typesize, typesize);
  496|    544|      if (ret < 0) {
  ------------------
  |  Branch (496:11): [True: 0, False: 544]
  ------------------
  497|       |        // Some error in bitshuffle (should not happen)
  498|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  499|      0|        return ret;
  500|      0|      }
  501|    544|    }
  502|     16|    else {
  503|     16|      memcpy(dest, src, blocksize);
  504|     16|    }
  505|    560|  }
  506|  10.1k|  else {
  507|       |    /* bitshuffle only supports a number of bytes that is a multiple of 8. */
  508|  10.1k|    size -= size % 8;
  509|  10.1k|    int ret = (int) (host_implementation.bitunshuffle)(src, dest, size, typesize);
  510|  10.1k|    if (ret < 0) {
  ------------------
  |  Branch (510:9): [True: 0, False: 10.1k]
  ------------------
  511|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  512|      0|      return ret;
  513|      0|    }
  514|       |
  515|       |    /* Copy the leftovers */
  516|  10.1k|    size_t offset = size * typesize;
  517|  10.1k|    memcpy((uint8_t *) dest + offset, (const uint8_t *) src + offset, blocksize - offset);
  518|  10.1k|  }
  519|       |
  520|  10.7k|  return blocksize;
  521|  10.7k|}
shuffle.c:init_shuffle_implementation:
  391|  26.9k|void init_shuffle_implementation(void) {
  392|       |  /* Initialization could (in rare cases) take place concurrently on
  393|       |     multiple threads, but it shouldn't matter because the
  394|       |     initialization should return the same result on each thread (so
  395|       |     the implementation will be the same). Since that's the case we
  396|       |     can avoid complicated synchronization here and get a small
  397|       |     performance benefit because we don't need to perform a volatile
  398|       |     load on the initialization variable each time this function is
  399|       |     called. */
  400|  26.9k|#if defined(__GNUC__) || defined(__clang__)
  401|  26.9k|  if (__builtin_expect(!implementation_initialized, 0)) {
  ------------------
  |  Branch (401:7): [True: 1, False: 26.9k]
  ------------------
  402|       |#else
  403|       |    if (!implementation_initialized) {
  404|       |#endif
  405|       |    /* Initialize the implementation. */
  406|      1|    host_implementation = get_shuffle_implementation();
  407|       |
  408|       |    /* Set the flag indicating the implementation has been initialized. */
  409|      1|    implementation_initialized = 1;
  410|      1|  }
  411|  26.9k|}
shuffle.c:get_shuffle_implementation:
  290|      1|static shuffle_implementation_t get_shuffle_implementation(void) {
  291|      1|#if defined(SHUFFLE_AVX512_ENABLED) || defined(SHUFFLE_AVX2_ENABLED) || defined(SHUFFLE_SSE2_ENABLED) || defined(SHUFFLE_NEON_ENABLED) || defined(SHUFFLE_ALTIVEC_ENABLED)
  292|      1|  blosc_cpu_features cpu_features = blosc_get_cpu_features();
  293|      1|#endif
  294|      1|#if defined(SHUFFLE_AVX512_ENABLED)
  295|      1|  if (cpu_features & BLOSC_HAVE_AVX512 && is_shuffle_avx2 && is_bshuf_AVX512) {
  ------------------
  |  Branch (295:7): [True: 0, False: 1]
  |  Branch (295:43): [True: 0, False: 0]
  |  Branch (295:62): [True: 0, False: 0]
  ------------------
  296|      0|    shuffle_implementation_t impl_avx512;
  297|      0|    impl_avx512.name = "avx512";
  298|      0|    impl_avx512.shuffle = (shuffle_func)shuffle_avx2;
  299|      0|    impl_avx512.unshuffle = (unshuffle_func)unshuffle_avx2;
  300|      0|    impl_avx512.bitshuffle = (bitshuffle_func) bshuf_trans_bit_elem_AVX512;
  301|      0|    impl_avx512.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_AVX512;
  302|      0|    return impl_avx512;
  303|      0|  }
  304|      1|#endif  /* defined(SHUFFLE_AVX512_ENABLED) */
  305|       |
  306|      1|#if defined(SHUFFLE_AVX2_ENABLED)
  307|      1|  if (cpu_features & BLOSC_HAVE_AVX2 && is_shuffle_avx2 && is_bshuf_AVX) {
  ------------------
  |  Branch (307:7): [True: 1, False: 0]
  |  Branch (307:41): [True: 1, False: 0]
  |  Branch (307:60): [True: 1, False: 0]
  ------------------
  308|      1|    shuffle_implementation_t impl_avx2;
  309|      1|    impl_avx2.name = "avx2";
  310|      1|    impl_avx2.shuffle = (shuffle_func)shuffle_avx2;
  311|      1|    impl_avx2.unshuffle = (unshuffle_func)unshuffle_avx2;
  312|      1|    impl_avx2.bitshuffle = (bitshuffle_func) bshuf_trans_bit_elem_AVX;
  313|      1|    impl_avx2.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_AVX;
  314|      1|    return impl_avx2;
  315|      1|  }
  316|      0|#endif  /* defined(SHUFFLE_AVX2_ENABLED) */
  317|       |
  318|      0|#if defined(SHUFFLE_SSE2_ENABLED)
  319|      0|  if (cpu_features & BLOSC_HAVE_SSE2 && is_shuffle_sse2 && is_bshuf_SSE) {
  ------------------
  |  Branch (319:7): [True: 0, False: 0]
  |  Branch (319:41): [True: 0, False: 0]
  |  Branch (319:60): [True: 0, False: 0]
  ------------------
  320|      0|    shuffle_implementation_t impl_sse2;
  321|      0|    impl_sse2.name = "sse2";
  322|      0|    impl_sse2.shuffle = (shuffle_func)shuffle_sse2;
  323|      0|    impl_sse2.unshuffle = (unshuffle_func)unshuffle_sse2;
  324|      0|    impl_sse2.bitshuffle = (bitshuffle_func)bshuf_trans_bit_elem_SSE;
  325|      0|    impl_sse2.bitunshuffle = (bitunshuffle_func) bshuf_untrans_bit_elem_SSE;
  326|      0|    return impl_sse2;
  327|      0|  }
  328|      0|#endif  /* defined(SHUFFLE_SSE2_ENABLED) */
  329|       |
  330|       |#if defined(SHUFFLE_NEON_ENABLED)
  331|       |  if (cpu_features & BLOSC_HAVE_NEON && is_shuffle_neon) { // && is_bshuf_NEON if using NEON bitshuffle
  332|       |    shuffle_implementation_t impl_neon;
  333|       |    impl_neon.name = "neon";
  334|       |    impl_neon.shuffle = (shuffle_func)shuffle_neon;
  335|       |    impl_neon.unshuffle = (unshuffle_func)unshuffle_neon;
  336|       |    //impl_neon.shuffle = (shuffle_func)shuffle_generic;
  337|       |    //impl_neon.unshuffle = (unshuffle_func)unshuffle_generic;
  338|       |    //impl_neon.bitshuffle = (bitshuffle_func)bshuf_trans_bit_elem_NEON;
  339|       |    //impl_neon.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_NEON;
  340|       |    // The current bitshuffle optimized for NEON is not any faster
  341|       |    // (in fact, it is pretty much slower) than the scalar implementation.
  342|       |    // So, let's use the scalar one, which is pretty fast, at least on a M1 CPU.
  343|       |    impl_neon.bitshuffle = (bitshuffle_func)bshuf_trans_bit_elem_scal;
  344|       |    impl_neon.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_scal;
  345|       |    return impl_neon;
  346|       |  }
  347|       |#endif  /* defined(SHUFFLE_NEON_ENABLED) */
  348|       |
  349|       |#if defined(SHUFFLE_ALTIVEC_ENABLED)
  350|       |  if (cpu_features & BLOSC_HAVE_ALTIVEC && is_shuffle_altivec && is_bshuf_altivec) {
  351|       |    shuffle_implementation_t impl_altivec;
  352|       |    impl_altivec.name = "altivec";
  353|       |    impl_altivec.shuffle = (shuffle_func)shuffle_altivec;
  354|       |    impl_altivec.unshuffle = (unshuffle_func)unshuffle_altivec;
  355|       |    impl_altivec.bitshuffle = (bitshuffle_func)bshuf_trans_bit_elem_altivec;
  356|       |    impl_altivec.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_altivec;
  357|       |    return impl_altivec;
  358|       |  }
  359|       |#endif  /* defined(SHUFFLE_ALTIVEC_ENABLED) */
  360|       |
  361|       |  /* Processor doesn't support any of the hardware-accelerated implementations,
  362|       |     so use the generic implementation. */
  363|      0|  shuffle_implementation_t impl_generic;
  364|      0|  impl_generic.name = "generic";
  365|      0|  impl_generic.shuffle = (shuffle_func)shuffle_generic;
  366|      0|  impl_generic.unshuffle = (unshuffle_func)unshuffle_generic;
  367|      0|  impl_generic.bitshuffle = (bitshuffle_func)bshuf_trans_bit_elem_scal;
  368|      0|  impl_generic.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_scal;
  369|      0|  return impl_generic;
  370|      0|}
shuffle.c:blosc_get_cpu_features:
  100|      1|static blosc_cpu_features blosc_get_cpu_features(void) {
  101|      1|  blosc_cpu_features cpu_features = BLOSC_HAVE_NOTHING;
  102|      1|  if (__builtin_cpu_supports("sse2")) {
  ------------------
  |  Branch (102:7): [True: 1, False: 0]
  ------------------
  103|      1|    cpu_features |= BLOSC_HAVE_SSE2;
  104|      1|  }
  105|      1|  if (__builtin_cpu_supports("avx2")) {
  ------------------
  |  Branch (105:7): [True: 1, False: 0]
  ------------------
  106|      1|    cpu_features |= BLOSC_HAVE_AVX2;
  107|      1|  }
  108|      1|  if (__builtin_cpu_supports("avx512f") && __builtin_cpu_supports("avx512bw")) {
  ------------------
  |  Branch (108:7): [True: 0, False: 1]
  |  Branch (108:44): [True: 0, False: 0]
  ------------------
  109|      0|    cpu_features |= BLOSC_HAVE_AVX512;
  110|      0|  }
  111|      1|  return cpu_features;
  112|      1|}

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

ndcell.c:blosc2_meta_get:
 2447|      1|                                  int32_t *content_len) {
 2448|      1|  if (schunk == NULL || name == NULL || content == NULL || content_len == NULL) {
  ------------------
  |  Branch (2448:7): [True: 0, False: 1]
  |  Branch (2448:25): [True: 0, False: 1]
  |  Branch (2448:41): [True: 0, False: 1]
  |  Branch (2448:60): [True: 0, False: 1]
  ------------------
 2449|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2450|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2451|      0|  }
 2452|       |
 2453|      1|  int nmetalayer = blosc2_meta_exists(schunk, name);
 2454|      1|  if (nmetalayer < 0) {
  ------------------
  |  Branch (2454:7): [True: 1, False: 0]
  ------------------
 2455|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2456|      1|    return nmetalayer;
 2457|      1|  }
 2458|      0|  int32_t len = schunk->metalayers[nmetalayer]->content_len;
 2459|      0|  if (len < 0) {
  ------------------
  |  Branch (2459:7): [True: 0, False: 0]
  ------------------
 2460|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2461|      0|    return BLOSC2_ERROR_DATA;
 2462|      0|  }
 2463|      0|  *content_len = len;
 2464|      0|  if (len == 0) {
  ------------------
  |  Branch (2464:7): [True: 0, False: 0]
  ------------------
 2465|      0|    *content = NULL;
 2466|      0|    return nmetalayer;
 2467|      0|  }
 2468|      0|  *content = (uint8_t*)malloc((size_t)len);
 2469|      0|  if (*content == NULL) {
  ------------------
  |  Branch (2469:7): [True: 0, False: 0]
  ------------------
 2470|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2471|      0|    *content_len = 0;
 2472|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2473|      0|  }
 2474|      0|  if (len > 0 && schunk->metalayers[nmetalayer]->content == NULL) {
  ------------------
  |  Branch (2474:7): [True: 0, False: 0]
  |  Branch (2474:18): [True: 0, False: 0]
  ------------------
 2475|      0|    free(*content);
 2476|      0|    *content = NULL;
 2477|      0|    *content_len = 0;
 2478|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2479|      0|    return BLOSC2_ERROR_DATA;
 2480|      0|  }
 2481|      0|  memcpy(*content, schunk->metalayers[nmetalayer]->content, (size_t)len);
 2482|      0|  return nmetalayer;
 2483|      0|}
ndcell.c:blosc2_meta_exists:
 2378|      1|static inline int blosc2_meta_exists(blosc2_schunk *schunk, const char *name) {
 2379|      1|  if (strlen(name) > BLOSC2_METALAYER_NAME_MAXLEN) {
  ------------------
  |  | 1745|      1|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  ------------------
  |  Branch (2379:7): [True: 0, False: 1]
  ------------------
 2380|      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__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2380|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1745|      0|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2381|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2382|      0|  }
 2383|       |
 2384|      1|  if (schunk == NULL) {
  ------------------
  |  Branch (2384:7): [True: 0, False: 1]
  ------------------
 2385|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2386|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2387|      0|  }
 2388|       |
 2389|      1|  for (int nmetalayer = 0; nmetalayer < schunk->nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2389:28): [True: 0, False: 1]
  ------------------
 2390|      0|    if (strcmp(name, schunk->metalayers[nmetalayer]->name) == 0) {
  ------------------
  |  Branch (2390:9): [True: 0, False: 0]
  ------------------
 2391|      0|      return nmetalayer;
 2392|      0|    }
 2393|      0|  }
 2394|      1|  return BLOSC2_ERROR_NOT_FOUND;
 2395|      1|}

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

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

ndlz4_decompress:
  526|    261|                     uint8_t meta, blosc2_dparams *dparams) {
  527|    261|  BLOSC_UNUSED_PARAM(meta);
  ------------------
  |  |   28|    261|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  528|    261|  BLOSC_UNUSED_PARAM(dparams);
  ------------------
  |  |   28|    261|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  529|    261|  BLOSC_ERROR_NULL(input, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    261|    do {                                            \
  |  |  105|    261|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 261]
  |  |  ------------------
  |  |  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|    261|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 261]
  |  |  ------------------
  ------------------
  530|    261|  BLOSC_ERROR_NULL(output, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    261|    do {                                            \
  |  |  105|    261|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 261]
  |  |  ------------------
  |  |  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|    261|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 261]
  |  |  ------------------
  ------------------
  531|       |
  532|    261|  uint8_t *ip = (uint8_t *) input;
  533|    261|  uint8_t *op = (uint8_t *) output;
  534|    261|  uint8_t ndim;
  535|    261|  int32_t blockshape[2];
  536|    261|  int32_t eshape[2];
  537|    261|  uint8_t *buffercpy;
  538|    261|  uint8_t local_buffer[16];
  539|    261|  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|    261|  if (NDLZ_UNEXPECT_CONDITIONAL(input_len < (int32_t) (1 + 2 * sizeof(int32_t)))) {
  ------------------
  |  |   30|    261|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 1, False: 260]
  |  |  ------------------
  ------------------
  546|      1|    return 0;
  547|      1|  }
  548|    260|  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|    260|#define NDLZ4_CHECK_RANGE(pos, len)                                              \
  560|    260|  do {                                                                           \
  561|    260|    int64_t _pos = (int64_t) (pos);                                              \
  562|    260|    int64_t _len = (int64_t) (len);                                              \
  563|    260|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  564|    260|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  565|    260|      return BLOSC2_ERROR_FAILURE;                                               \
  566|    260|    }                                                                            \
  567|    260|  } while (0)
  568|       |
  569|       |  /* we start with literal copy */
  570|    260|  ndim = *ip;
  571|    260|  ip++;
  572|    260|  if (ndim != 2) {
  ------------------
  |  Branch (572:7): [True: 2, False: 258]
  ------------------
  573|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  574|      2|    return BLOSC2_ERROR_FAILURE;
  575|      2|  }
  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: 27, False: 231]
  |  Branch (582:46): [True: 21, False: 210]
  ------------------
  583|     48|    BLOSC_TRACE_ERROR("Output length or blockshape is negative");
  ------------------
  |  |   93|     48|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     48|    do {                                            \
  |  |  |  |   98|     48|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     48|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 48, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     48|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  584|     48|    return BLOSC2_ERROR_FAILURE;
  585|     48|  }
  586|       |
  587|    210|  eshape[0] = ((blockshape[0] + 3) / 4) * 4;
  588|    210|  eshape[1] = ((blockshape[1] + 3) / 4) * 4;
  589|       |
  590|    210|  if (NDLZ_UNEXPECT_CONDITIONAL((int64_t)output_len < (int64_t)blockshape[0] * (int64_t)blockshape[1])) {
  ------------------
  |  |   30|    210|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 62, False: 148]
  |  |  ------------------
  ------------------
  591|     62|    BLOSC_TRACE_ERROR("The blockshape is bigger than the output buffer");
  ------------------
  |  |   93|     62|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     62|    do {                                            \
  |  |  |  |   98|     62|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     62|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 62, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     62|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  592|     62|    return 0;
  593|     62|  }
  594|    148|  memset(op, 0, blockshape[0] * blockshape[1]);
  595|       |
  596|    148|  uint32_t i_stop[2];
  597|    444|  for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (597:19): [True: 296, False: 148]
  ------------------
  598|    296|    i_stop[i] = eshape[i] / 4;
  599|    296|  }
  600|       |
  601|       |  /* main loop */
  602|    148|  uint32_t ii[2];
  603|    148|  uint32_t padding[2] = {0};
  604|    148|  uint32_t ind = 0;
  605|    148|  uint8_t cell_aux[16];
  606|   939M|  for (ii[0] = 0; ii[0] < i_stop[0]; ++ii[0]) {
  ------------------
  |  Branch (606:19): [True: 939M, False: 9]
  ------------------
  607|   939M|    for (ii[1] = 0; ii[1] < i_stop[1]; ++ii[1]) {      // for each cell
  ------------------
  |  Branch (607:21): [True: 1.47k, False: 939M]
  ------------------
  608|  1.47k|      if (NDLZ_UNEXPECT_CONDITIONAL(ip > ip_limit)) {
  ------------------
  |  |   30|  1.47k|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 0, False: 1.47k]
  |  |  ------------------
  ------------------
  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|  1.47k|      if (ii[0] == i_stop[0] - 1) {
  ------------------
  |  Branch (612:11): [True: 394, False: 1.08k]
  ------------------
  613|    394|        padding[0] = (blockshape[0] % 4 == 0) ? 4 : blockshape[0] % 4;
  ------------------
  |  Branch (613:22): [True: 44, False: 350]
  ------------------
  614|  1.08k|      } else {
  615|  1.08k|        padding[0] = 4;
  616|  1.08k|      }
  617|  1.47k|      if (ii[1] == i_stop[1] - 1) {
  ------------------
  |  Branch (617:11): [True: 1.07k, False: 402]
  ------------------
  618|  1.07k|        padding[1] = (blockshape[1] % 4 == 0) ? 4 : blockshape[1] % 4;
  ------------------
  |  Branch (618:22): [True: 30, False: 1.04k]
  ------------------
  619|  1.07k|      } else {
  620|    402|        padding[1] = 4;
  621|    402|      }
  622|  1.47k|      int64_t cur = ip - (const uint8_t *) input;   // in-range: ip is within [input, ip_limit]
  623|  1.47k|      NDLZ4_CHECK_RANGE(cur, 1);
  ------------------
  |  |  560|  1.47k|  do {                                                                           \
  |  |  561|  1.47k|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|  1.47k|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|  1.47k|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 1.47k]
  |  |  |  Branch (563:21): [True: 0, False: 1.47k]
  |  |  |  Branch (563:33): [True: 1, False: 1.47k]
  |  |  ------------------
  |  |  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|  1.47k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 1.47k]
  |  |  ------------------
  ------------------
  624|  1.47k|      token = *ip++;
  625|  1.47k|      if (token == 0) {    // no match
  ------------------
  |  Branch (625:11): [True: 705, False: 770]
  ------------------
  626|    705|        NDLZ4_CHECK_RANGE(cur + 1, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  560|    705|  do {                                                                           \
  |  |  561|    705|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    705|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    705|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 705]
  |  |  |  Branch (563:21): [True: 0, False: 705]
  |  |  |  Branch (563:33): [True: 2, False: 703]
  |  |  ------------------
  |  |  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|    705|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 703]
  |  |  ------------------
  ------------------
  627|    703|        buffercpy = ip;
  628|    703|        ip += padding[0] * padding[1];
  629|    770|      } else if (token == (uint8_t) ((1U << 7U) | (1U << 6U))) {  // cell match
  ------------------
  |  Branch (629:18): [True: 81, False: 689]
  ------------------
  630|     81|        NDLZ4_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  560|     81|  do {                                                                           \
  |  |  561|     81|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|     81|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|     81|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 81]
  |  |  |  Branch (563:21): [True: 0, False: 81]
  |  |  |  Branch (563:33): [True: 1, False: 80]
  |  |  ------------------
  |  |  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|     81|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 80]
  |  |  ------------------
  ------------------
  631|     80|        uint16_t offset;
  632|     80|        memcpy(&offset, ip, sizeof(offset));
  633|     80|        int64_t bpos = (cur + 1) - (int64_t) offset - 1;   // back-reference start offset
  634|     80|        NDLZ4_CHECK_RANGE(bpos, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  560|     80|  do {                                                                           \
  |  |  561|     80|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|     80|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|     80|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 13, False: 67]
  |  |  |  Branch (563:21): [True: 0, False: 67]
  |  |  |  Branch (563:33): [True: 1, False: 66]
  |  |  ------------------
  |  |  564|     14|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|     14|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|     14|    }                                                                            \
  |  |  567|     80|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 66]
  |  |  ------------------
  ------------------
  635|     66|        buffercpy = (uint8_t *) input + bpos;
  636|     66|        ip += 2;
  637|    689|      } else if (token == (uint8_t) (1U << 6U)) { // whole cell of same element
  ------------------
  |  Branch (637:18): [True: 92, False: 597]
  ------------------
  638|     92|        NDLZ4_CHECK_RANGE(cur + 1, 1);
  ------------------
  |  |  560|     92|  do {                                                                           \
  |  |  561|     92|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|     92|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|     92|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 92]
  |  |  |  Branch (563:21): [True: 0, False: 92]
  |  |  |  Branch (563:33): [True: 1, False: 91]
  |  |  ------------------
  |  |  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|     92|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 91]
  |  |  ------------------
  ------------------
  639|     91|        buffercpy = cell_aux;
  640|     91|        memset(buffercpy, *ip, 16);
  641|     91|        ip++;
  642|    597|      } else if (token >= 224) { // three rows match
  ------------------
  |  Branch (642:18): [True: 183, False: 414]
  ------------------
  643|    183|        buffercpy = local_buffer;
  644|    183|        NDLZ4_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  560|    183|  do {                                                                           \
  |  |  561|    183|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    183|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    183|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 183]
  |  |  |  Branch (563:21): [True: 0, False: 183]
  |  |  |  Branch (563:33): [True: 1, False: 182]
  |  |  ------------------
  |  |  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|    183|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 182]
  |  |  ------------------
  ------------------
  645|    182|        uint16_t offset;
  646|    182|        memcpy(&offset, ip, sizeof(offset));
  647|    182|        offset += 3;
  648|    182|        ip += 2;
  649|    182|        int i, j, k;
  650|    182|        if ((token >> 3U) == 28) {
  ------------------
  |  Branch (650:13): [True: 16, False: 166]
  ------------------
  651|     16|          i = 1;
  652|     16|          j = 2;
  653|     16|          k = 3;
  654|    166|        } else {
  655|    166|          i = 0;
  656|    166|          if ((token >> 3U) < 30) {
  ------------------
  |  Branch (656:15): [True: 28, False: 138]
  ------------------
  657|     28|            j = 1;
  658|     28|            k = 2;
  659|    138|          } else {
  660|    138|            k = 3;
  661|    138|            if ((token >> 3U) == 30) {
  ------------------
  |  Branch (661:17): [True: 27, False: 111]
  ------------------
  662|     27|              j = 1;
  663|    111|            } else {
  664|    111|              j = 2;
  665|    111|            }
  666|    138|          }
  667|    166|        }
  668|    182|        int64_t bpos = (cur + 3) - (int64_t) offset;   // == (ip - offset) as an offset
  669|    182|        NDLZ4_CHECK_RANGE(bpos, 12);
  ------------------
  |  |  560|    182|  do {                                                                           \
  |  |  561|    182|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    182|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    182|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 17, False: 165]
  |  |  |  Branch (563:21): [True: 0, False: 165]
  |  |  |  Branch (563:33): [True: 2, False: 163]
  |  |  ------------------
  |  |  564|     19|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|     19|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|     19|    }                                                                            \
  |  |  567|    182|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 163]
  |  |  ------------------
  ------------------
  670|    163|        const uint8_t *ref = (const uint8_t *) input + bpos;
  671|    163|        memcpy(&buffercpy[i * 4], ref, 4);
  672|    163|        memcpy(&buffercpy[j * 4], ref + 4, 4);
  673|    163|        memcpy(&buffercpy[k * 4], ref + 8, 4);
  674|    391|        for (int l = 0; l < 4; l++) {
  ------------------
  |  Branch (674:25): [True: 391, False: 0]
  ------------------
  675|    391|          if ((l != i) && (l != j) && (l != k)) {
  ------------------
  |  Branch (675:15): [True: 242, False: 149]
  |  Branch (675:27): [True: 190, False: 52]
  |  Branch (675:39): [True: 163, False: 27]
  ------------------
  676|    163|            NDLZ4_CHECK_RANGE(ip - (const uint8_t *) input, 4);
  ------------------
  |  |  560|    163|  do {                                                                           \
  |  |  561|    163|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    163|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    163|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 163]
  |  |  |  Branch (563:21): [True: 0, False: 163]
  |  |  |  Branch (563:33): [True: 1, False: 162]
  |  |  ------------------
  |  |  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|    163|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 162]
  |  |  ------------------
  ------------------
  677|    162|            memcpy(&buffercpy[l * 4], ip, 4);
  678|    162|            ip += 4;
  679|    162|            break;
  680|    163|          }
  681|    391|        }
  682|       |
  683|    414|      } else if ((token >= 128) && (token <= 191)) { // rows pair match
  ------------------
  |  Branch (683:18): [True: 294, False: 120]
  |  Branch (683:36): [True: 291, False: 3]
  ------------------
  684|    291|        buffercpy = local_buffer;
  685|    291|        NDLZ4_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  560|    291|  do {                                                                           \
  |  |  561|    291|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    291|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    291|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 291]
  |  |  |  Branch (563:21): [True: 0, False: 291]
  |  |  |  Branch (563:33): [True: 1, False: 290]
  |  |  ------------------
  |  |  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|    291|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 290]
  |  |  ------------------
  ------------------
  686|    290|        uint16_t offset;
  687|    290|        memcpy(&offset, ip, sizeof(offset));
  688|    290|        offset += 3;
  689|    290|        ip += 2;
  690|    290|        int i, j;
  691|    290|        if (token == 128) {
  ------------------
  |  Branch (691:13): [True: 63, False: 227]
  ------------------
  692|     63|          i = 2;
  693|     63|          j = 3;
  694|    227|        } else {
  695|    227|          i = (token - 128) >> 5U;
  696|    227|          j = ((token - 128) >> 3U) - (i << 2U);
  697|    227|        }
  698|    290|        int64_t bpos = (cur + 3) - (int64_t) offset;
  699|    290|        NDLZ4_CHECK_RANGE(bpos, 8);
  ------------------
  |  |  560|    290|  do {                                                                           \
  |  |  561|    290|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    290|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    290|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 25, False: 265]
  |  |  |  Branch (563:21): [True: 0, False: 265]
  |  |  |  Branch (563:33): [True: 0, False: 265]
  |  |  ------------------
  |  |  564|     25|      BLOSC_TRACE_ERROR("ndlz4: 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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|     25|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|     25|    }                                                                            \
  |  |  567|    290|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 265]
  |  |  ------------------
  ------------------
  700|    265|        const uint8_t *ref = (const uint8_t *) input + bpos;
  701|    265|        memcpy(&buffercpy[i * 4], ref, 4);
  702|    265|        memcpy(&buffercpy[j * 4], ref + 4, 4);
  703|  1.31k|        for (int k = 0; k < 4; k++) {
  ------------------
  |  Branch (703:25): [True: 1.05k, False: 260]
  ------------------
  704|  1.05k|          if ((k != i) && (k != j)) {
  ------------------
  |  Branch (704:15): [True: 791, False: 263]
  |  Branch (704:27): [True: 607, False: 184]
  ------------------
  705|    607|            NDLZ4_CHECK_RANGE(ip - (const uint8_t *) input, 4);
  ------------------
  |  |  560|    607|  do {                                                                           \
  |  |  561|    607|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    607|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    607|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 607]
  |  |  |  Branch (563:21): [True: 0, False: 607]
  |  |  |  Branch (563:33): [True: 5, False: 602]
  |  |  ------------------
  |  |  564|      5|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      5|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      5|    }                                                                            \
  |  |  567|    607|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 602]
  |  |  ------------------
  ------------------
  706|    602|            memcpy(&buffercpy[k * 4], ip, 4);
  707|    602|            ip += 4;
  708|    602|          }
  709|  1.05k|        }
  710|    265|      } else if ((token >= 40) && (token <= 63)) {  // 2 rows pair matches
  ------------------
  |  Branch (710:18): [True: 114, False: 9]
  |  Branch (710:35): [True: 104, False: 10]
  ------------------
  711|    104|        buffercpy = local_buffer;
  712|    104|        NDLZ4_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  560|    104|  do {                                                                           \
  |  |  561|    104|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    104|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    104|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 104]
  |  |  |  Branch (563:21): [True: 0, False: 104]
  |  |  |  Branch (563:33): [True: 1, False: 103]
  |  |  ------------------
  |  |  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|    104|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 103]
  |  |  ------------------
  ------------------
  713|    103|        uint16_t offset_1;
  714|    103|        memcpy(&offset_1, ip, sizeof(offset_1));
  715|    103|        offset_1 += 5;
  716|    103|        ip += 2;
  717|    103|        NDLZ4_CHECK_RANGE(cur + 3, 2);
  ------------------
  |  |  560|    103|  do {                                                                           \
  |  |  561|    103|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    103|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    103|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 103]
  |  |  |  Branch (563:21): [True: 0, False: 103]
  |  |  |  Branch (563:33): [True: 1, False: 102]
  |  |  ------------------
  |  |  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|    103|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 102]
  |  |  ------------------
  ------------------
  718|    102|        uint16_t offset_2;
  719|    102|        memcpy(&offset_2, ip, sizeof(offset_2));
  720|    102|        offset_2 += 5;
  721|    102|        ip += 2;
  722|    102|        int i, j, k, l, m;
  723|    102|        i = 0;
  724|    102|        j = ((token - 32) >> 3U);
  725|    102|        l = -1;
  726|    408|        for (k = 1; k < 4; k++) {
  ------------------
  |  Branch (726:21): [True: 306, False: 102]
  ------------------
  727|    306|          if ((k != i) && (k != j)) {
  ------------------
  |  Branch (727:15): [True: 306, False: 0]
  |  Branch (727:27): [True: 204, False: 102]
  ------------------
  728|    204|            if (l == -1) {
  ------------------
  |  Branch (728:17): [True: 102, False: 102]
  ------------------
  729|    102|              l = k;
  730|    102|            } else {
  731|    102|              m = k;
  732|    102|            }
  733|    204|          }
  734|    306|        }
  735|    102|        int64_t bpos1 = (cur + 5) - (int64_t) offset_1;
  736|    102|        NDLZ4_CHECK_RANGE(bpos1, 8);
  ------------------
  |  |  560|    102|  do {                                                                           \
  |  |  561|    102|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    102|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    102|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 28, False: 74]
  |  |  |  Branch (563:21): [True: 0, False: 74]
  |  |  |  Branch (563:33): [True: 1, False: 73]
  |  |  ------------------
  |  |  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|    102|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 73]
  |  |  ------------------
  ------------------
  737|     73|        const uint8_t *ref1 = (const uint8_t *) input + bpos1;
  738|     73|        memcpy(&buffercpy[i * 4], ref1, 4);
  739|     73|        memcpy(&buffercpy[j * 4], ref1 + 4, 4);
  740|     73|        int64_t bpos2 = (cur + 5) - (int64_t) offset_2;
  741|     73|        NDLZ4_CHECK_RANGE(bpos2, 8);
  ------------------
  |  |  560|     73|  do {                                                                           \
  |  |  561|     73|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|     73|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|     73|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 17, False: 56]
  |  |  |  Branch (563:21): [True: 0, False: 56]
  |  |  |  Branch (563:33): [True: 1, False: 55]
  |  |  ------------------
  |  |  564|     18|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|     18|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|     18|    }                                                                            \
  |  |  567|     73|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 55]
  |  |  ------------------
  ------------------
  742|     55|        const uint8_t *ref2 = (const uint8_t *) input + bpos2;
  743|     55|        memcpy(&buffercpy[l * 4], ref2, 4);
  744|     55|        memcpy(&buffercpy[m * 4], ref2 + 4, 4);
  745|       |
  746|     55|      } else {
  747|     19|        BLOSC_TRACE_ERROR("Invalid token: %u at cell [%d, %d]\n", token, ii[0], ii[1]);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  748|     19|        return BLOSC2_ERROR_FAILURE;
  749|     19|      }
  750|       |      // fill op with buffercpy
  751|  1.33k|      uint32_t orig = ii[0] * 4 * blockshape[1] + ii[1] * 4;
  752|  6.68k|      for (uint32_t i = 0; i < 4; i++) {
  ------------------
  |  Branch (752:28): [True: 5.34k, False: 1.33k]
  ------------------
  753|  5.34k|        if (i < padding[0]) {
  ------------------
  |  Branch (753:13): [True: 4.73k, False: 614]
  ------------------
  754|  4.73k|          ind = orig + i * blockshape[1];
  755|  4.73k|          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|  4.73k|          buffercpy += padding[1];
  762|  4.73k|        }
  763|  5.34k|      }
  764|  1.33k|      if (ind > (uint32_t) output_len) {
  ------------------
  |  Branch (764:11): [True: 0, False: 1.33k]
  ------------------
  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|  1.33k|    }
  769|   939M|  }
  770|      9|  ind += padding[1];
  771|       |
  772|      9|  if ((int32_t)ind != (blockshape[0] * blockshape[1])) {
  ------------------
  |  Branch (772:7): [True: 0, False: 9]
  ------------------
  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|      9|  if (ind > (uint32_t) output_len) {
  ------------------
  |  Branch (776:7): [True: 0, False: 9]
  ------------------
  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|      9|  return (int) ind;
  782|      9|#undef NDLZ4_CHECK_RANGE
  783|      9|}

ndlz8_decompress:
  444|    193|                     uint8_t meta, blosc2_dparams *dparams) {
  445|    193|  BLOSC_UNUSED_PARAM(meta);
  ------------------
  |  |   28|    193|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  446|    193|  BLOSC_UNUSED_PARAM(dparams);
  ------------------
  |  |   28|    193|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  447|    193|  BLOSC_ERROR_NULL(input, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    193|    do {                                            \
  |  |  105|    193|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 193]
  |  |  ------------------
  |  |  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|    193|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 193]
  |  |  ------------------
  ------------------
  448|    193|  BLOSC_ERROR_NULL(output, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    193|    do {                                            \
  |  |  105|    193|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 193]
  |  |  ------------------
  |  |  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|    193|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 193]
  |  |  ------------------
  ------------------
  449|       |
  450|    193|  const int cell_shape = 8;
  451|    193|  const int cell_size = 64;
  452|    193|  uint8_t *ip = (uint8_t *) input;
  453|    193|  uint8_t *op = (uint8_t *) output;
  454|    193|  uint8_t ndim;
  455|    193|  int32_t blockshape[2];
  456|    193|  int32_t eshape[2];
  457|    193|  uint8_t *buffercpy;
  458|    193|  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|    193|  if (NDLZ_UNEXPECT_CONDITIONAL(input_len < (int32_t) (1 + 2 * sizeof(int32_t)))) {
  ------------------
  |  |   30|    193|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 0, False: 193]
  |  |  ------------------
  ------------------
  465|      0|    return 0;
  466|      0|  }
  467|    193|  uint8_t *ip_limit = ip + input_len;
  468|       |
  469|       |  /* we start with literal copy */
  470|    193|  ndim = *ip;
  471|    193|  ip++;
  472|    193|  if (ndim != 2) {
  ------------------
  |  Branch (472:7): [True: 2, False: 191]
  ------------------
  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|    191|  memcpy(&blockshape[0], ip, 4);
  477|    191|  ip += 4;
  478|    191|  memcpy(&blockshape[1], ip, 4);
  479|    191|  ip += 4;
  480|       |
  481|       |  // Sanity check.  See https://www.cve.org/CVERecord?id=CVE-2024-3203
  482|    191|  if (output_len < 0 || blockshape[0] < 0 || blockshape[1] < 0) {
  ------------------
  |  Branch (482:7): [True: 0, False: 191]
  |  Branch (482:25): [True: 17, False: 174]
  |  Branch (482:46): [True: 15, False: 159]
  ------------------
  483|     32|    BLOSC_TRACE_ERROR("Output length or blockshape is negative");
  ------------------
  |  |   93|     32|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     32|    do {                                            \
  |  |  |  |   98|     32|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     32|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 32, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     32|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  484|     32|    return BLOSC2_ERROR_FAILURE;
  485|     32|  }
  486|       |
  487|    159|  eshape[0] = ((blockshape[0] + 7) / cell_shape) * cell_shape;
  488|    159|  eshape[1] = ((blockshape[1] + 7) / cell_shape) * cell_shape;
  489|       |
  490|    159|  if (NDLZ_UNEXPECT_CONDITIONAL((int64_t)output_len < (int64_t)blockshape[0] * (int64_t)blockshape[1])) {
  ------------------
  |  |   30|    159|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 12, False: 147]
  |  |  ------------------
  ------------------
  491|     12|    BLOSC_TRACE_ERROR("The blockshape is bigger than the output buffer");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  492|     12|    return 0;
  493|     12|  }
  494|    147|  memset(op, 0, blockshape[0] * blockshape[1]);
  495|       |
  496|    147|  int32_t i_stop[2];
  497|    441|  for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (497:19): [True: 294, False: 147]
  ------------------
  498|    294|    i_stop[i] = eshape[i] / cell_shape;
  499|    294|  }
  500|       |
  501|       |  /* main loop */
  502|    147|  int32_t ii[2];
  503|    147|  int32_t padding[2] = {0};
  504|    147|  int32_t ind = 0;
  505|    147|  uint8_t *local_buffer = malloc(cell_size);
  506|    147|  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|    147|#define NDLZ8_CHECK_RANGE(pos, len)                                              \
  518|    147|  do {                                                                           \
  519|    147|    int64_t _pos = (int64_t) (pos);                                              \
  520|    147|    int64_t _len = (int64_t) (len);                                              \
  521|    147|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  522|    147|      free(local_buffer);                                                        \
  523|    147|      free(cell_aux);                                                            \
  524|    147|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  525|    147|      return BLOSC2_ERROR_FAILURE;                                               \
  526|    147|    }                                                                            \
  527|    147|  } while (0)
  528|       |
  529|  1.48G|  for (ii[0] = 0; ii[0] < i_stop[0]; ++ii[0]) {
  ------------------
  |  Branch (529:19): [True: 1.48G, False: 19]
  ------------------
  530|  1.48G|    for (ii[1] = 0; ii[1] < i_stop[1]; ++ii[1]) {      // for each cell
  ------------------
  |  Branch (530:21): [True: 1.01k, False: 1.48G]
  ------------------
  531|  1.01k|      if (NDLZ_UNEXPECT_CONDITIONAL(ip > ip_limit)) {
  ------------------
  |  |   30|  1.01k|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 0, False: 1.01k]
  |  |  ------------------
  ------------------
  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.01k|      if (ii[0] == i_stop[0] - 1) {
  ------------------
  |  Branch (537:11): [True: 811, False: 208]
  ------------------
  538|    811|        padding[0] = (blockshape[0] % cell_shape == 0) ? cell_shape : blockshape[0] % cell_shape;
  ------------------
  |  Branch (538:22): [True: 3, False: 808]
  ------------------
  539|    811|      } else {
  540|    208|        padding[0] = cell_shape;
  541|    208|      }
  542|  1.01k|      if (ii[1] == i_stop[1] - 1) {
  ------------------
  |  Branch (542:11): [True: 146, False: 873]
  ------------------
  543|    146|        padding[1] = (blockshape[1] % cell_shape == 0) ? cell_shape : blockshape[1] % cell_shape;
  ------------------
  |  Branch (543:22): [True: 55, False: 91]
  ------------------
  544|    873|      } else {
  545|    873|        padding[1] = cell_shape;
  546|    873|      }
  547|  1.01k|      int64_t cur = ip - (const uint8_t *) input;   // in-range: ip is within [input, ip_limit]
  548|  1.01k|      NDLZ8_CHECK_RANGE(cur, 1);
  ------------------
  |  |  518|  1.01k|  do {                                                                           \
  |  |  519|  1.01k|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|  1.01k|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|  1.01k|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 1.01k]
  |  |  |  Branch (521:21): [True: 0, False: 1.01k]
  |  |  |  Branch (521:33): [True: 5, False: 1.01k]
  |  |  ------------------
  |  |  522|      5|      free(local_buffer);                                                        \
  |  |  523|      5|      free(cell_aux);                                                            \
  |  |  524|      5|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      5|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      5|    }                                                                            \
  |  |  527|  1.01k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 1.01k]
  |  |  ------------------
  ------------------
  549|  1.01k|      token = *ip++;
  550|  1.01k|      uint8_t match_type = (token >> 3U);
  551|  1.01k|      if (token == 0) {    // no match
  ------------------
  |  Branch (551:11): [True: 222, False: 792]
  ------------------
  552|    222|        NDLZ8_CHECK_RANGE(cur + 1, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  518|    222|  do {                                                                           \
  |  |  519|    222|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    222|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    222|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 222]
  |  |  |  Branch (521:21): [True: 0, False: 222]
  |  |  |  Branch (521:33): [True: 5, False: 217]
  |  |  ------------------
  |  |  522|      5|      free(local_buffer);                                                        \
  |  |  523|      5|      free(cell_aux);                                                            \
  |  |  524|      5|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      5|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      5|    }                                                                            \
  |  |  527|    222|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 217]
  |  |  ------------------
  ------------------
  553|    217|        buffercpy = ip;
  554|    217|        ip += padding[0] * padding[1];
  555|    792|      } else if (token == (uint8_t) ((1U << 7U) | (1U << 6U))) {  // cell match
  ------------------
  |  Branch (555:18): [True: 25, False: 767]
  ------------------
  556|     25|        NDLZ8_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  518|     25|  do {                                                                           \
  |  |  519|     25|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     25|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     25|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 25]
  |  |  |  Branch (521:21): [True: 0, False: 25]
  |  |  |  Branch (521:33): [True: 1, False: 24]
  |  |  ------------------
  |  |  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|     25|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 24]
  |  |  ------------------
  ------------------
  557|     24|        uint16_t offset;
  558|     24|        memcpy(&offset, ip, sizeof(offset));
  559|     24|        int64_t bpos = (cur + 1) - (int64_t) offset - 1;
  560|     24|        NDLZ8_CHECK_RANGE(bpos, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  518|     24|  do {                                                                           \
  |  |  519|     24|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     24|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     24|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 13, False: 11]
  |  |  |  Branch (521:21): [True: 0, False: 11]
  |  |  |  Branch (521:33): [True: 1, False: 10]
  |  |  ------------------
  |  |  522|     14|      free(local_buffer);                                                        \
  |  |  523|     14|      free(cell_aux);                                                            \
  |  |  524|     14|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|     14|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|     14|    }                                                                            \
  |  |  527|     24|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 10]
  |  |  ------------------
  ------------------
  561|     10|        buffercpy = (uint8_t *) input + bpos;
  562|     10|        ip += 2;
  563|    767|      } else if (token == (uint8_t) (1U << 6U)) { // whole cell of same element
  ------------------
  |  Branch (563:18): [True: 560, False: 207]
  ------------------
  564|    560|        NDLZ8_CHECK_RANGE(cur + 1, 1);
  ------------------
  |  |  518|    560|  do {                                                                           \
  |  |  519|    560|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    560|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    560|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 560]
  |  |  |  Branch (521:21): [True: 0, False: 560]
  |  |  |  Branch (521:33): [True: 2, False: 558]
  |  |  ------------------
  |  |  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|    560|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 558]
  |  |  ------------------
  ------------------
  565|    558|        buffercpy = cell_aux;
  566|    558|        memset(buffercpy, *ip, cell_size);
  567|    558|        ip++;
  568|    558|      } else if (match_type == 21) {    // triple match
  ------------------
  |  Branch (568:18): [True: 73, False: 134]
  ------------------
  569|     73|        buffercpy = local_buffer;
  570|     73|        int row = (int) (token & 7);
  571|     73|        if (row + 2 >= cell_shape) {
  ------------------
  |  Branch (571:13): [True: 2, False: 71]
  ------------------
  572|      2|          free(local_buffer);
  573|      2|          free(cell_aux);
  574|      2|          BLOSC_TRACE_ERROR("Triple match row out of bounds");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  575|      2|          return BLOSC2_ERROR_FAILURE;
  576|      2|        }
  577|     71|        NDLZ8_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  518|     71|  do {                                                                           \
  |  |  519|     71|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     71|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     71|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 71]
  |  |  |  Branch (521:21): [True: 0, False: 71]
  |  |  |  Branch (521:33): [True: 1, False: 70]
  |  |  ------------------
  |  |  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|     71|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 70]
  |  |  ------------------
  ------------------
  578|     70|        uint16_t offset;
  579|     70|        memcpy(&offset, ip, sizeof(offset));
  580|     70|        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|     70|        int64_t bpos = cur - (int64_t) offset;
  584|     70|        NDLZ8_CHECK_RANGE(bpos, 3 * cell_shape);
  ------------------
  |  |  518|     70|  do {                                                                           \
  |  |  519|     70|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     70|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     70|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 14, False: 56]
  |  |  |  Branch (521:21): [True: 0, False: 56]
  |  |  |  Branch (521:33): [True: 1, False: 55]
  |  |  ------------------
  |  |  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|     70|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 55]
  |  |  ------------------
  ------------------
  585|     55|        const uint8_t *ref = (const uint8_t *) input + bpos;
  586|    220|        for (int l = 0; l < 3; l++) {
  ------------------
  |  Branch (586:25): [True: 165, False: 55]
  ------------------
  587|    165|          memcpy(&buffercpy[(row + l) * cell_shape], ref + l * cell_shape, cell_shape);
  588|    165|        }
  589|    466|        for (int l = 0; l < cell_shape; l++) {
  ------------------
  |  Branch (589:25): [True: 419, False: 47]
  ------------------
  590|    419|          if ((l < row) || (l > row + 2)) {
  ------------------
  |  Branch (590:15): [True: 193, False: 226]
  |  Branch (590:28): [True: 73, False: 153]
  ------------------
  591|    266|            NDLZ8_CHECK_RANGE(ip - (const uint8_t *) input, cell_shape);
  ------------------
  |  |  518|    266|  do {                                                                           \
  |  |  519|    266|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    266|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    266|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 266]
  |  |  |  Branch (521:21): [True: 0, False: 266]
  |  |  |  Branch (521:33): [True: 8, False: 258]
  |  |  ------------------
  |  |  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|    266|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 258]
  |  |  ------------------
  ------------------
  592|    258|            memcpy(&buffercpy[l * cell_shape], ip, cell_shape);
  593|    258|            ip += cell_shape;
  594|    258|          }
  595|    419|        }
  596|    134|      } else if (match_type == 17) {    // pair match
  ------------------
  |  Branch (596:18): [True: 88, False: 46]
  ------------------
  597|     88|        buffercpy = local_buffer;
  598|     88|        int row = (int) (token & 7);
  599|     88|        if (row + 1 >= cell_shape) {
  ------------------
  |  Branch (599:13): [True: 2, False: 86]
  ------------------
  600|      2|          free(local_buffer);
  601|      2|          free(cell_aux);
  602|      2|          BLOSC_TRACE_ERROR("Pair match row out of bounds");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  603|      2|          return BLOSC2_ERROR_FAILURE;
  604|      2|        }
  605|     86|        NDLZ8_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  518|     86|  do {                                                                           \
  |  |  519|     86|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     86|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     86|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 86]
  |  |  |  Branch (521:21): [True: 0, False: 86]
  |  |  |  Branch (521:33): [True: 1, False: 85]
  |  |  ------------------
  |  |  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|     86|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 85]
  |  |  ------------------
  ------------------
  606|     85|        uint16_t offset;
  607|     85|        memcpy(&offset, ip, sizeof(offset));
  608|     85|        ip += 2;
  609|       |        // back-reference base == cur - offset (see triple-match note above).
  610|     85|        int64_t bpos = cur - (int64_t) offset;
  611|     85|        NDLZ8_CHECK_RANGE(bpos, 2 * cell_shape);
  ------------------
  |  |  518|     85|  do {                                                                           \
  |  |  519|     85|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     85|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     85|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 15, False: 70]
  |  |  |  Branch (521:21): [True: 0, False: 70]
  |  |  |  Branch (521:33): [True: 2, False: 68]
  |  |  ------------------
  |  |  522|     17|      free(local_buffer);                                                        \
  |  |  523|     17|      free(cell_aux);                                                            \
  |  |  524|     17|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|     17|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|     17|    }                                                                            \
  |  |  527|     85|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 68]
  |  |  ------------------
  ------------------
  612|     68|        const uint8_t *ref = (const uint8_t *) input + bpos;
  613|    204|        for (int l = 0; l < 2; l++) {
  ------------------
  |  Branch (613:25): [True: 136, False: 68]
  ------------------
  614|    136|          memcpy(&buffercpy[(row + l) * cell_shape], ref + l * cell_shape, cell_shape);
  615|    136|        }
  616|    572|        for (int l = 0; l < cell_shape; l++) {
  ------------------
  |  Branch (616:25): [True: 513, False: 59]
  ------------------
  617|    513|          if ((l < row) || (l > row + 1)) {
  ------------------
  |  Branch (617:15): [True: 226, False: 287]
  |  Branch (617:28): [True: 161, False: 126]
  ------------------
  618|    387|            NDLZ8_CHECK_RANGE(ip - (const uint8_t *) input, cell_shape);
  ------------------
  |  |  518|    387|  do {                                                                           \
  |  |  519|    387|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    387|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    387|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 387]
  |  |  |  Branch (521:21): [True: 0, False: 387]
  |  |  |  Branch (521:33): [True: 9, False: 378]
  |  |  ------------------
  |  |  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|    387|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 378]
  |  |  ------------------
  ------------------
  619|    378|            memcpy(&buffercpy[l * cell_shape], ip, cell_shape);
  620|    378|            ip += cell_shape;
  621|    378|          }
  622|    513|        }
  623|     68|      } else {
  624|     46|        free(local_buffer);
  625|     46|        free(cell_aux);
  626|     46|        BLOSC_TRACE_ERROR("Invalid token: %u at cell [%d, %d]\n", token, ii[0], ii[1]);
  ------------------
  |  |   93|     46|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     46|    do {                                            \
  |  |  |  |   98|     46|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     46|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 46, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     46|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  627|     46|        return BLOSC2_ERROR_FAILURE;
  628|     46|      }
  629|       |
  630|    891|      int32_t orig = ii[0] * cell_shape * blockshape[1] + ii[1] * cell_shape;
  631|  8.01k|      for (int32_t i = 0; i < (int32_t) cell_shape; i++) {
  ------------------
  |  Branch (631:27): [True: 7.12k, False: 891]
  ------------------
  632|  7.12k|        if (i < padding[0]) {
  ------------------
  |  Branch (632:13): [True: 3.51k, False: 3.61k]
  ------------------
  633|  3.51k|          ind = orig + i * blockshape[1];
  634|  3.51k|          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|  3.51k|          buffercpy += padding[1];
  641|  3.51k|        }
  642|  7.12k|      }
  643|    891|      if (ind > output_len) {
  ------------------
  |  Branch (643:11): [True: 0, False: 891]
  ------------------
  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|    891|    }
  650|  1.48G|  }
  651|     19|  ind += padding[1];
  652|       |
  653|     19|  free(cell_aux);
  654|     19|  free(local_buffer);
  655|       |
  656|     19|  if (ind != (blockshape[0] * blockshape[1])) {
  ------------------
  |  Branch (656:7): [True: 0, False: 19]
  ------------------
  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|     19|  if (ind > output_len) {
  ------------------
  |  Branch (660:7): [True: 0, False: 19]
  ------------------
  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|     19|  return (int) ind;
  666|     19|#undef NDLZ8_CHECK_RANGE
  667|     19|}

simd_load:
   34|   219M|bytes16 simd_load(const void* ptr) { return _mm_loadu_si128((const __m128i*)ptr); }
simd_store:
   35|   219M|void simd_store(void* ptr, bytes16 x) { _mm_storeu_si128((__m128i*)ptr, x); }
simd_add:
   38|   219M|bytes16 simd_add(bytes16 a, bytes16 b) { return _mm_add_epi8(a, b); }
simd_duplane15:
   40|   219M|bytes16 simd_duplane15(bytes16 x) { return _mm_shuffle_epi8(x, _mm_set1_epi8(15)); }
simd_prefix_sum:
   43|   219M|{
   44|       |  // Sklansky-style sum from https://gist.github.com/rygorous/4212be0cd009584e4184e641ca210528
   45|   219M|  x = _mm_add_epi8(x, _mm_slli_epi64(x, 8));
   46|   219M|  x = _mm_add_epi8(x, _mm_slli_epi64(x, 16));
   47|   219M|  x = _mm_add_epi8(x, _mm_slli_epi64(x, 32));
   48|   219M|  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|   219M|  return x;
   50|   219M|}
simd_get_last:
   52|  56.4k|uint8_t simd_get_last(bytes16 x) { return (_mm_extract_epi16(x, 7) >> 8) & 0xFF; }
bytedelta_backward:
  139|  8.44k|                       blosc2_dparams *dparams, uint8_t id) {
  140|  8.44k|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|  8.44k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  141|       |
  142|  8.44k|  int typesize = meta;
  143|  8.44k|  if (typesize == 0) {
  ------------------
  |  Branch (143:7): [True: 1, False: 8.44k]
  ------------------
  144|      1|    if (dparams->schunk == NULL) {
  ------------------
  |  Branch (144:9): [True: 0, False: 1]
  ------------------
  145|      0|      BLOSC_TRACE_ERROR("When meta is 0, you need to be on a schunk!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  146|      0|      BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  147|      0|    }
  148|      1|    blosc2_schunk* schunk = (blosc2_schunk*)(dparams->schunk);
  149|      1|    typesize = schunk->typesize;
  150|      1|  }
  151|       |
  152|  8.44k|  const int stream_len = length / typesize;
  153|  7.30M|  for (int ich = 0; ich < typesize; ++ich) {
  ------------------
  |  Branch (153:21): [True: 7.30M, False: 8.44k]
  ------------------
  154|  7.30M|    int ip = 0;
  155|  7.30M|    uint8_t _v2 = 0;
  156|       |    // SIMD fetch 16 bytes from each channel, prefix-sum un-delta
  157|  7.30M|#if defined(CPU_HAS_SIMD)
  158|  7.30M|    bytes16 v2 = {0};
  159|   136M|    for (; ip < stream_len - 15; ip += 16) {
  ------------------
  |  Branch (159:12): [True: 129M, False: 7.30M]
  ------------------
  160|   129M|      bytes16 v = simd_load(input);
  161|   129M|      input += 16;
  162|       |      // un-delta via prefix sum
  163|   129M|      v2 = simd_add(simd_prefix_sum(v), simd_duplane15(v2));
  164|   129M|      simd_store(output, v2);
  165|   129M|      output += 16;
  166|   129M|    }
  167|  7.30M|    if (stream_len > 15) {
  ------------------
  |  Branch (167:9): [True: 56.4k, False: 7.24M]
  ------------------
  168|  56.4k|      _v2 = simd_get_last(v2);
  169|  56.4k|    }
  170|  7.30M|#endif // #if defined(CPU_HAS_SIMD)
  171|       |    // scalar leftover
  172|  12.7M|    for (; ip < stream_len; ip++) {
  ------------------
  |  Branch (172:12): [True: 5.41M, False: 7.30M]
  ------------------
  173|  5.41M|      uint8_t v = *input + _v2;
  174|  5.41M|      input++;
  175|  5.41M|      *output = v;
  176|  5.41M|      output++;
  177|  5.41M|      _v2 = v;
  178|  5.41M|    }
  179|  7.30M|  }
  180|       |
  181|       |  // Mirror of the forward pass: restore the trailing bytes verbatim.
  182|  8.44k|  memcpy(output, input, (size_t)(length - stream_len * typesize));
  183|       |
  184|  8.44k|  return BLOSC2_ERROR_SUCCESS;
  185|  8.44k|}
bytedelta_backward_buggy:
  235|  10.3k|                             uint8_t meta, blosc2_dparams *dparams, uint8_t id) {
  236|  10.3k|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|  10.3k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  237|       |
  238|  10.3k|  int typesize = meta;
  239|  10.3k|  if (typesize == 0) {
  ------------------
  |  Branch (239:7): [True: 0, False: 10.3k]
  ------------------
  240|      0|    if (dparams->schunk == NULL) {
  ------------------
  |  Branch (240:9): [True: 0, False: 0]
  ------------------
  241|      0|      BLOSC_TRACE_ERROR("When meta is 0, you need to be on a schunk!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  242|      0|      BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  243|      0|    }
  244|      0|    blosc2_schunk* schunk = (blosc2_schunk*)(dparams->schunk);
  245|      0|    typesize = schunk->typesize;
  246|      0|  }
  247|       |
  248|  10.3k|  const int stream_len = length / typesize;
  249|  1.47M|  for (int ich = 0; ich < typesize; ++ich) {
  ------------------
  |  Branch (249:21): [True: 1.46M, False: 10.3k]
  ------------------
  250|  1.46M|    int ip = 0;
  251|       |    // SIMD fetch 16 bytes from each channel, prefix-sum un-delta
  252|  1.46M|#if defined(CPU_HAS_SIMD)
  253|  1.46M|    bytes16 v2 = {0};
  254|  91.5M|    for (; ip < stream_len - 15; ip += 16) {
  ------------------
  |  Branch (254:12): [True: 90.1M, False: 1.46M]
  ------------------
  255|  90.1M|      bytes16 v = simd_load(input);
  256|  90.1M|      input += 16;
  257|       |      // un-delta via prefix sum
  258|  90.1M|      v2 = simd_add(simd_prefix_sum(v), simd_duplane15(v2));
  259|  90.1M|      simd_store(output, v2);
  260|  90.1M|      output += 16;
  261|  90.1M|    }
  262|  1.46M|#endif // #if defined(CPU_HAS_SIMD)
  263|       |    // scalar leftover
  264|  1.46M|    uint8_t _v2 = 0;
  265|  11.5M|    for (; ip < stream_len; ip++) {
  ------------------
  |  Branch (265:12): [True: 10.0M, False: 1.46M]
  ------------------
  266|  10.0M|      uint8_t v = *input + _v2;
  267|  10.0M|      input++;
  268|  10.0M|      *output = v;
  269|  10.0M|      output++;
  270|  10.0M|      _v2 = v;
  271|  10.0M|    }
  272|  1.46M|  }
  273|       |
  274|  10.3k|  return BLOSC2_ERROR_SUCCESS;
  275|  10.3k|}

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

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

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

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

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

