LZ4_decompress_safe:
 2452|    419|{
 2453|    419|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2454|    419|                                  decode_full_block, noDict,
 2455|       |                                  (BYTE*)dest, NULL, 0);
 2456|    419|}
LZ4_decompress_safe_forceExtDict:
 2526|    361|{
 2527|    361|    DEBUGLOG(5, "LZ4_decompress_safe_forceExtDict");
  ------------------
  |  |  289|    361|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2528|    361|    return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
 2529|    361|                                  decode_full_block, usingExtDict,
 2530|    361|                                  (BYTE*)dest, (const BYTE*)dictStart, dictSize);
 2531|    361|}
LZ4_decompress_safe_usingDict:
 2720|    361|{
 2721|    361|    if (dictSize==0)
  ------------------
  |  Branch (2721:9): [True: 0, False: 361]
  ------------------
 2722|      0|        return LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize);
 2723|    361|    if (dictStart+dictSize == dest) {
  ------------------
  |  Branch (2723:9): [True: 0, False: 361]
  ------------------
 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|    361|    assert(dictSize >= 0);
  ------------------
  |  |  273|    361|#    define assert(condition) ((void)0)
  ------------------
 2731|    361|    return LZ4_decompress_safe_forceExtDict(source, dest, compressedSize, maxOutputSize, dictStart, (size_t)dictSize);
 2732|    361|}
lz4.c:LZ4_wildCopy8:
  466|  7.70k|{
  467|  7.70k|    BYTE* d = (BYTE*)dstPtr;
  468|  7.70k|    const BYTE* s = (const BYTE*)srcPtr;
  469|  7.70k|    BYTE* const e = (BYTE*)dstEnd;
  470|       |
  471|  1.01M|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  349|  1.01M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (471:50): [True: 1.00M, False: 7.70k]
  ------------------
  472|  7.70k|}
lz4.c:LZ4_isLittleEndian:
  364|  78.4k|{
  365|  78.4k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  366|  78.4k|    return one.c[0];
  367|  78.4k|}
lz4.c:LZ4_read16:
  393|  78.4k|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  398|  6.66k|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_decompress_generic:
 2035|    780|{
 2036|    780|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (2036:9): [True: 0, False: 780]
  |  Branch (2036:26): [True: 0, False: 780]
  ------------------
 2037|       |
 2038|    780|    {   const BYTE* ip = (const BYTE*) src;
 2039|    780|        const BYTE* const iend = ip + srcSize;
 2040|       |
 2041|    780|        BYTE* op = (BYTE*) dst;
 2042|    780|        BYTE* const oend = op + outputSize;
 2043|    780|        BYTE* cpy;
 2044|       |
 2045|    780|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (2045:37): [True: 419, False: 361]
  ------------------
 2046|       |
 2047|    780|        const int checkOffset = (dictSize < (int)(64 KB));
  ------------------
  |  |  251|    780|#define KB *(1 <<10)
  ------------------
 2048|       |
 2049|       |
 2050|       |        /* Set up the "end" pointers for the shortcut. */
 2051|    780|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 2052|    780|        const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/;
 2053|       |
 2054|    780|        const BYTE* match;
 2055|    780|        size_t offset;
 2056|    780|        unsigned token;
 2057|    780|        size_t length;
 2058|       |
 2059|       |
 2060|    780|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  289|    780|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2061|       |
 2062|       |        /* Special cases */
 2063|    780|        assert(lowPrefix <= op);
  ------------------
  |  |  273|    780|#    define assert(condition) ((void)0)
  ------------------
 2064|    780|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  180|    780|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    780|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 780]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 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|    780|        if (unlikely(srcSize==0)) { return -1; }
  ------------------
  |  |  180|    780|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    780|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 780]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 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|    780|#if LZ4_FAST_DEC_LOOP
 2076|    780|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|    780|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2076:13): [True: 12, False: 768]
  ------------------
 2077|     12|            DEBUGLOG(6, "move to safe decode loop");
  ------------------
  |  |  289|     12|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2078|     12|            goto safe_decode;
 2079|     12|        }
 2080|       |
 2081|       |        /* Fast loop : decode sequences as long as output < oend-FASTLOOP_SAFE_DISTANCE */
 2082|    768|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  289|    768|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2083|  78.0k|        while (1) {
  ------------------
  |  Branch (2083:16): [True: 78.0k, Folded]
  ------------------
 2084|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2085|  78.0k|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  |  273|  78.0k|#    define assert(condition) ((void)0)
  ------------------
 2086|  78.0k|            assert(ip < iend);
  ------------------
  |  |  273|  78.0k|#    define assert(condition) ((void)0)
  ------------------
 2087|  78.0k|            token = *ip++;
 2088|  78.0k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  260|  78.0k|#define ML_BITS  4
  ------------------
 2089|  78.0k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  289|  78.0k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2090|       |
 2091|       |            /* decode literal length */
 2092|  78.0k|            if (length == RUN_MASK) {
  ------------------
  |  |  263|  78.0k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|  78.0k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|  78.0k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2092:17): [True: 2.33k, False: 75.7k]
  ------------------
 2093|  2.33k|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  263|  2.33k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|  2.33k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|  2.33k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2094|  2.33k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2094:21): [True: 7, False: 2.32k]
  ------------------
 2095|      7|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  289|      7|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2096|      7|                    goto _output_error;
 2097|      7|                }
 2098|  2.32k|                length += addl;
 2099|  2.32k|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  2.32k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  2.32k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 2.32k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2100|  2.32k|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  2.32k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  2.32k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 2.32k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2101|       |
 2102|       |                /* copy literals */
 2103|  2.32k|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  277|  2.32k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2104|  2.32k|                if ((op+length>oend-32) || (ip+length>iend-32)) { goto safe_literal_copy; }
  ------------------
  |  Branch (2104:21): [True: 15, False: 2.30k]
  |  Branch (2104:44): [True: 353, False: 1.95k]
  ------------------
 2105|  1.95k|                LZ4_wildCopy32(op, ip, op+length);
 2106|  1.95k|                ip += length; op += length;
 2107|  75.7k|            } else if (ip <= iend-(16 + 1/*max lit + offset + nextToken*/)) {
  ------------------
  |  Branch (2107:24): [True: 75.6k, False: 50]
  ------------------
 2108|       |                /* We don't need to check oend, since we check it once for each loop below */
 2109|  75.6k|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)length);
  ------------------
  |  |  289|  75.6k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2110|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2111|  75.6k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  349|  75.6k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2112|  75.6k|                ip += length; op += length;
 2113|  75.6k|            } else {
 2114|     50|                goto safe_literal_copy;
 2115|     50|            }
 2116|       |
 2117|       |            /* get offset */
 2118|  77.6k|            offset = LZ4_readLE16(ip); ip+=2;
 2119|  77.6k|            DEBUGLOG(6, "blockPos%6u: offset = %u", (unsigned)(op-(BYTE*)dst), (unsigned)offset);
  ------------------
  |  |  289|  77.6k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2120|  77.6k|            match = op - offset;
 2121|  77.6k|            assert(match <= op);  /* overflow check */
  ------------------
  |  |  273|  77.6k|#    define assert(condition) ((void)0)
  ------------------
 2122|       |
 2123|       |            /* get matchlength */
 2124|  77.6k|            length = token & ML_MASK;
  ------------------
  |  |  261|  77.6k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  77.6k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2125|  77.6k|            DEBUGLOG(7, "  match length token = %u (len==%u)", (unsigned)length, (unsigned)length+MINMATCH);
  ------------------
  |  |  289|  77.6k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2126|       |
 2127|  77.6k|            if (length == ML_MASK) {
  ------------------
  |  |  261|  77.6k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  77.6k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2127:17): [True: 51.1k, False: 26.4k]
  ------------------
 2128|  51.1k|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  245|  51.1k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2129|  51.1k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2129:21): [True: 5, False: 51.1k]
  ------------------
 2130|      5|                    DEBUGLOG(5, "error reading long match length");
  ------------------
  |  |  289|      5|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2131|      5|                    goto _output_error;
 2132|      5|                }
 2133|  51.1k|                length += addl;
 2134|  51.1k|                length += MINMATCH;
  ------------------
  |  |  242|  51.1k|#define MINMATCH 4
  ------------------
 2135|  51.1k|                DEBUGLOG(7, "  long match length == %u", (unsigned)length);
  ------------------
  |  |  289|  51.1k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2136|  51.1k|                if (unlikely((uptrval)(op)+length<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  51.1k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  51.1k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 51.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2137|  51.1k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|  51.1k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2137:21): [True: 184, False: 50.9k]
  ------------------
 2138|    184|                    goto safe_match_copy;
 2139|    184|                }
 2140|  51.1k|            } else {
 2141|  26.4k|                length += MINMATCH;
  ------------------
  |  |  242|  26.4k|#define MINMATCH 4
  ------------------
 2142|  26.4k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|  26.4k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2142:21): [True: 23, False: 26.4k]
  ------------------
 2143|     23|                    DEBUGLOG(7, "moving to safe_match_copy (ml==%u)", (unsigned)length);
  ------------------
  |  |  289|     23|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2144|     23|                    goto safe_match_copy;
 2145|     23|                }
 2146|       |
 2147|       |                /* Fastpath check: skip LZ4_wildCopy32 when true */
 2148|  26.4k|                if ((dict == withPrefix64k) || (match >= lowPrefix)) {
  ------------------
  |  Branch (2148:21): [True: 0, False: 26.4k]
  |  Branch (2148:48): [True: 25.5k, False: 911]
  ------------------
 2149|  25.5k|                    if (offset >= 8) {
  ------------------
  |  Branch (2149:25): [True: 16.7k, False: 8.79k]
  ------------------
 2150|  16.7k|                        assert(match >= lowPrefix);
  ------------------
  |  |  273|  16.7k|#    define assert(condition) ((void)0)
  ------------------
 2151|  16.7k|                        assert(match <= op);
  ------------------
  |  |  273|  16.7k|#    define assert(condition) ((void)0)
  ------------------
 2152|  16.7k|                        assert(op + 18 <= oend);
  ------------------
  |  |  273|  16.7k|#    define assert(condition) ((void)0)
  ------------------
 2153|       |
 2154|  16.7k|                        LZ4_memcpy(op, match, 8);
  ------------------
  |  |  349|  16.7k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2155|  16.7k|                        LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  349|  16.7k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2156|  16.7k|                        LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  349|  16.7k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2157|  16.7k|                        op += length;
 2158|  16.7k|                        continue;
 2159|  16.7k|            }   }   }
 2160|       |
 2161|  60.6k|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  180|  60.6k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  60.6k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2161:18): [True: 60.6k, False: 0]
  |  Branch (2161:33): [True: 131, False: 60.5k]
  ------------------
 2162|    131|                DEBUGLOG(5, "Error : pos=%zi, offset=%zi => outside buffers", op-lowPrefix, op-match);
  ------------------
  |  |  289|    131|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2163|    131|                goto _output_error;
 2164|    131|            }
 2165|       |            /* match starting within external dictionary */
 2166|  60.5k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2166:17): [True: 22.3k, False: 38.1k]
  |  Branch (2166:41): [True: 1.28k, False: 21.1k]
  ------------------
 2167|  1.28k|                assert(dictEnd != NULL);
  ------------------
  |  |  273|  1.28k|#    define assert(condition) ((void)0)
  ------------------
 2168|  1.28k|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  180|  1.28k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  1.28k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 1.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 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.28k|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2177:21): [True: 1.14k, False: 145]
  ------------------
 2178|       |                    /* match fits entirely within external dictionary : just copy */
 2179|  1.14k|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  357|  1.14k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2180|  1.14k|                    op += length;
 2181|  1.14k|                } else {
 2182|       |                    /* match stretches into both external dictionary and current block */
 2183|    145|                    size_t const copySize = (size_t)(lowPrefix - match);
 2184|    145|                    size_t const restSize = length - copySize;
 2185|    145|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  349|    145|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2186|    145|                    op += copySize;
 2187|    145|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2187:25): [True: 96, False: 49]
  ------------------
 2188|     96|                        BYTE* const endOfMatch = op + restSize;
 2189|     96|                        const BYTE* copyFrom = lowPrefix;
 2190|   609k|                        while (op < endOfMatch) { *op++ = *copyFrom++; }
  ------------------
  |  Branch (2190:32): [True: 609k, False: 96]
  ------------------
 2191|     96|                    } else {
 2192|     49|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  349|     49|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2193|     49|                        op += restSize;
 2194|     49|                }   }
 2195|  1.28k|                continue;
 2196|  1.28k|            }
 2197|       |
 2198|       |            /* copy match within block */
 2199|  59.2k|            cpy = op + length;
 2200|       |
 2201|  59.2k|            assert((op <= oend) && (oend-op >= 32));
  ------------------
  |  |  273|  59.2k|#    define assert(condition) ((void)0)
  ------------------
 2202|  59.2k|            if (unlikely(offset<16)) {
  ------------------
  |  |  180|  59.2k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  59.2k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 38.5k, False: 20.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2203|  38.5k|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2204|  38.5k|            } else {
 2205|  20.6k|                LZ4_wildCopy32(op, match, cpy);
 2206|  20.6k|            }
 2207|       |
 2208|  59.2k|            op = cpy;   /* wildcopy correction */
 2209|  59.2k|        }
 2210|     12|    safe_decode:
 2211|     12|#endif
 2212|       |
 2213|       |        /* Main Loop : decode remaining sequences where output < FASTLOOP_SAFE_DISTANCE */
 2214|     12|        DEBUGLOG(6, "using safe decode loop");
  ------------------
  |  |  289|     12|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2215|    936|        while (1) {
  ------------------
  |  Branch (2215:16): [True: 936, Folded]
  ------------------
 2216|    936|            assert(ip < iend);
  ------------------
  |  |  273|    936|#    define assert(condition) ((void)0)
  ------------------
 2217|    936|            token = *ip++;
 2218|    936|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  260|    936|#define ML_BITS  4
  ------------------
 2219|    936|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  289|    936|#  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|    936|            if ( (length != RUN_MASK)
  ------------------
  |  |  263|    936|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    936|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    936|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2230:18): [True: 765, False: 171]
  ------------------
 2231|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2232|    765|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  177|    765|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|    765|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 330, False: 435]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2233|       |                /* Copy the literals */
 2234|    330|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  349|    330|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2235|    330|                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|    330|                length = token & ML_MASK; /* match length */
  ------------------
  |  |  261|    330|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    330|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2240|    330|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u (len=%u)", (unsigned)(op-(BYTE*)dst), (unsigned)length, (unsigned)length + 4);
  ------------------
  |  |  289|    330|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2241|    330|                offset = LZ4_readLE16(ip); ip += 2;
 2242|    330|                match = op - offset;
 2243|    330|                assert(match <= op); /* check overflow */
  ------------------
  |  |  273|    330|#    define assert(condition) ((void)0)
  ------------------
 2244|       |
 2245|       |                /* Do not deal with overlapping matches. */
 2246|    330|                if ( (length != ML_MASK)
  ------------------
  |  |  261|    330|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    330|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2246:22): [True: 261, False: 69]
  ------------------
 2247|    261|                  && (offset >= 8)
  ------------------
  |  Branch (2247:22): [True: 143, False: 118]
  ------------------
 2248|    143|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2248:23): [True: 0, False: 143]
  |  Branch (2248:46): [True: 98, False: 45]
  ------------------
 2249|       |                    /* Copy the match. */
 2250|     98|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  349|     98|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2251|     98|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  349|     98|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2252|     98|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  349|     98|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2253|     98|                    op += length + MINMATCH;
  ------------------
  |  |  242|     98|#define MINMATCH 4
  ------------------
 2254|       |                    /* Both stages worked, load the next token. */
 2255|     98|                    continue;
 2256|     98|                }
 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|    232|                goto _copy_match;
 2261|    330|            }
 2262|       |
 2263|       |            /* decode literal length */
 2264|    606|            if (length == RUN_MASK) {
  ------------------
  |  |  263|    606|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    606|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    606|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2264:17): [True: 171, False: 435]
  ------------------
 2265|    171|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  263|    171|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    171|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    171|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2266|    171|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2266:21): [True: 34, False: 137]
  ------------------
 2267|    137|                length += addl;
 2268|    137|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|    137|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    137|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 137]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2269|    137|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|    137|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    137|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 137]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2270|    137|            }
 2271|       |
 2272|    572|#if LZ4_FAST_DEC_LOOP
 2273|    990|        safe_literal_copy:
 2274|    990|#endif
 2275|       |            /* copy literals */
 2276|    990|            cpy = op+length;
 2277|       |
 2278|    990|            LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  277|    990|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2279|    990|            if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  246|    990|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  245|    787|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2279:17): [True: 203, False: 787]
  |  Branch (2279:39): [True: 257, False: 530]
  ------------------
 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|    460|                if (partialDecoding) {
  ------------------
  |  Branch (2285:21): [True: 0, False: 460]
  ------------------
 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|    460|                } 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|    460|                    if ((ip+length != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2312:25): [True: 333, False: 127]
  |  Branch (2312:48): [True: 2, False: 125]
  ------------------
 2313|    335|                        DEBUGLOG(5, "should have been last run of literals")
  ------------------
  |  |  289|    335|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2314|    335|                        DEBUGLOG(5, "ip(%p) + length(%i) = %p != iend (%p)", ip, (int)length, ip+length, iend);
  ------------------
  |  |  289|    335|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2315|    335|                        DEBUGLOG(5, "or cpy(%p) > (oend-MFLIMIT)(%p)", cpy, oend-MFLIMIT);
  ------------------
  |  |  289|    335|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2316|    335|                        DEBUGLOG(5, "after writing %u bytes / %i bytes available", (unsigned)(op-(BYTE*)dst), outputSize);
  ------------------
  |  |  289|    335|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2317|    335|                        goto _output_error;
 2318|    335|                    }
 2319|    460|                }
 2320|    125|                LZ4_memmove(op, ip, length);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  357|    125|#    define LZ4_memmove __builtin_memmove
  ------------------
 2321|    125|                ip += length;
 2322|    125|                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|    125|                if (!partialDecoding || (cpy == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2328:21): [True: 125, False: 0]
  |  Branch (2328:41): [True: 0, False: 0]
  |  Branch (2328:58): [True: 0, False: 0]
  ------------------
 2329|    125|                    break;
 2330|    125|                }
 2331|    530|            } else {
 2332|    530|                LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2333|    530|                ip += length; op = cpy;
 2334|    530|            }
 2335|       |
 2336|       |            /* get offset */
 2337|    530|            offset = LZ4_readLE16(ip); ip+=2;
 2338|    530|            match = op - offset;
 2339|       |
 2340|       |            /* get matchlength */
 2341|    530|            length = token & ML_MASK;
  ------------------
  |  |  261|    530|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    530|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2342|    530|            DEBUGLOG(7, "blockPos%6u: matchLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  289|    530|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2343|       |
 2344|    762|    _copy_match:
 2345|    762|            if (length == ML_MASK) {
  ------------------
  |  |  261|    762|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    762|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2345:17): [True: 396, False: 366]
  ------------------
 2346|    396|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  245|    396|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2347|    396|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2347:21): [True: 5, False: 391]
  ------------------
 2348|    391|                length += addl;
 2349|    391|                if (unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  180|    391|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    391|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 391]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2350|    391|            }
 2351|    757|            length += MINMATCH;
  ------------------
  |  |  242|    757|#define MINMATCH 4
  ------------------
 2352|       |
 2353|    757|#if LZ4_FAST_DEC_LOOP
 2354|    964|        safe_match_copy:
 2355|    964|#endif
 2356|    964|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error;   /* Error : offset outside buffers */
  ------------------
  |  |  180|    964|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    964|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2356:17): [True: 964, False: 0]
  |  Branch (2356:34): [True: 113, False: 851]
  ------------------
 2357|       |            /* match starting within external dictionary */
 2358|    851|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2358:17): [True: 397, False: 454]
  |  Branch (2358:41): [True: 59, False: 338]
  ------------------
 2359|     59|                assert(dictEnd != NULL);
  ------------------
  |  |  273|     59|#    define assert(condition) ((void)0)
  ------------------
 2360|     59|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  180|     59|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|     59|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 3, False: 56]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2361|      3|                    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: 3]
  ------------------
 2362|      3|                    else goto _output_error;   /* doesn't respect parsing restriction */
 2363|      3|                }
 2364|       |
 2365|     56|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2365:21): [True: 15, False: 41]
  ------------------
 2366|       |                    /* match fits entirely within external dictionary : just copy */
 2367|     15|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  357|     15|#    define LZ4_memmove __builtin_memmove
  ------------------
 2368|     15|                    op += length;
 2369|     41|                } else {
 2370|       |                    /* match stretches into both external dictionary and current block */
 2371|     41|                    size_t const copySize = (size_t)(lowPrefix - match);
 2372|     41|                    size_t const restSize = length - copySize;
 2373|     41|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  349|     41|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2374|     41|                    op += copySize;
 2375|     41|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2375:25): [True: 37, False: 4]
  ------------------
 2376|     37|                        BYTE* const endOfMatch = op + restSize;
 2377|     37|                        const BYTE* copyFrom = lowPrefix;
 2378|   109k|                        while (op < endOfMatch) *op++ = *copyFrom++;
  ------------------
  |  Branch (2378:32): [True: 109k, False: 37]
  ------------------
 2379|     37|                    } else {
 2380|      4|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  349|      4|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2381|      4|                        op += restSize;
 2382|      4|                }   }
 2383|     56|                continue;
 2384|     59|            }
 2385|    792|            assert(match >= lowPrefix);
  ------------------
  |  |  273|    792|#    define assert(condition) ((void)0)
  ------------------
 2386|       |
 2387|       |            /* copy match within block */
 2388|    792|            cpy = op + length;
 2389|       |
 2390|       |            /* partialDecoding : may end anywhere within the block */
 2391|    792|            assert(op<=oend);
  ------------------
  |  |  273|    792|#    define assert(condition) ((void)0)
  ------------------
 2392|    792|            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: 792]
  |  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|    792|            if (unlikely(offset<8)) {
  ------------------
  |  |  180|    792|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    792|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 450, False: 342]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2407|    450|                LZ4_write32(op, 0);   /* silence msan warning when offset==0 */
 2408|    450|                op[0] = match[0];
 2409|    450|                op[1] = match[1];
 2410|    450|                op[2] = match[2];
 2411|    450|                op[3] = match[3];
 2412|    450|                match += inc32table[offset];
 2413|    450|                LZ4_memcpy(op+4, match, 4);
  ------------------
  |  |  349|    450|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2414|    450|                match -= dec64table[offset];
 2415|    450|            } else {
 2416|    342|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  349|    342|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2417|    342|                match += 8;
 2418|    342|            }
 2419|    792|            op += 8;
 2420|       |
 2421|    792|            if (unlikely(cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  180|    792|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    792|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 189, False: 603]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2422|    189|                BYTE* const oCopyLimit = oend - (WILDCOPYLENGTH-1);
  ------------------
  |  |  244|    189|#define WILDCOPYLENGTH 8
  ------------------
 2423|    189|                if (cpy > oend-LASTLITERALS) { goto _output_error; } /* Error : last LASTLITERALS bytes must be literals (uncompressed) */
  ------------------
  |  |  245|    189|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2423:21): [True: 22, False: 167]
  ------------------
 2424|    167|                if (op < oCopyLimit) {
  ------------------
  |  Branch (2424:21): [True: 160, False: 7]
  ------------------
 2425|    160|                    LZ4_wildCopy8(op, match, oCopyLimit);
 2426|    160|                    match += oCopyLimit - op;
 2427|    160|                    op = oCopyLimit;
 2428|    160|                }
 2429|    406|                while (op < cpy) { *op++ = *match++; }
  ------------------
  |  Branch (2429:24): [True: 239, False: 167]
  ------------------
 2430|    603|            } else {
 2431|    603|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  349|    603|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2432|    603|                if (length > 16) { LZ4_wildCopy8(op+8, match+8, cpy); }
  ------------------
  |  Branch (2432:21): [True: 335, False: 268]
  ------------------
 2433|    603|            }
 2434|    770|            op = cpy;   /* wildcopy correction */
 2435|    770|        }
 2436|       |
 2437|       |        /* end of decoding */
 2438|    125|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  289|    125|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2439|    125|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2440|       |
 2441|       |        /* Overflow error detected */
 2442|    655|    _output_error:
 2443|    655|        return (int) (-(((const char*)ip)-src))-1;
 2444|     12|    }
 2445|     12|}
lz4.c:read_variable_length:
 1981|  54.0k|{
 1982|  54.0k|    Rvl_t s, length = 0;
 1983|  54.0k|    assert(ip != NULL);
  ------------------
  |  |  273|  54.0k|#    define assert(condition) ((void)0)
  ------------------
 1984|  54.0k|    assert(*ip !=  NULL);
  ------------------
  |  |  273|  54.0k|#    define assert(condition) ((void)0)
  ------------------
 1985|  54.0k|    assert(ilimit != NULL);
  ------------------
  |  |  273|  54.0k|#    define assert(condition) ((void)0)
  ------------------
 1986|  54.0k|    if (initial_check && unlikely((*ip) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  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: 32, False: 2.46k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1986:9): [True: 2.50k, False: 51.5k]
  ------------------
 1987|     32|        return rvl_error;
 1988|     32|    }
 1989|  53.9k|    s = **ip;
 1990|  53.9k|    (*ip)++;
 1991|  53.9k|    length += s;
 1992|  53.9k|    if (unlikely((*ip) > ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|  53.9k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  53.9k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 5, False: 53.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1993|      5|        return rvl_error;
 1994|      5|    }
 1995|       |    /* accumulator overflow detection (32-bit mode only) */
 1996|  53.9k|    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: 53.9k]
  ------------------
 1997|      0|        return rvl_error;
 1998|      0|    }
 1999|  53.9k|    if (likely(s != 255)) return length;
  ------------------
  |  |  177|  53.9k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|  53.9k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 52.1k, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2000|  83.6k|    do {
 2001|  83.6k|        s = **ip;
 2002|  83.6k|        (*ip)++;
 2003|  83.6k|        length += s;
 2004|  83.6k|        if (unlikely((*ip) > ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|  83.6k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  83.6k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 14, False: 83.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2005|     14|            return rvl_error;
 2006|     14|        }
 2007|       |        /* accumulator overflow detection (32-bit mode only) */
 2008|  83.6k|        if ((sizeof(length) < 8) && unlikely(length > ((Rvl_t)(-1)/2)) ) {
  ------------------
  |  |  180|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2008:13): [Folded, False: 83.6k]
  ------------------
 2009|      0|            return rvl_error;
 2010|      0|        }
 2011|  83.6k|    } while (s == 255);
  ------------------
  |  Branch (2011:14): [True: 81.8k, False: 1.81k]
  ------------------
 2012|       |
 2013|  1.81k|    return length;
 2014|  1.83k|}
lz4.c:LZ4_wildCopy32:
  523|  22.5k|{
  524|  22.5k|    BYTE* d = (BYTE*)dstPtr;
  525|  22.5k|    const BYTE* s = (const BYTE*)srcPtr;
  526|  22.5k|    BYTE* const e = (BYTE*)dstEnd;
  527|       |
  528|   263k|    do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  349|   263k|#    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|   263k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (528:79): [True: 241k, False: 22.5k]
  ------------------
  529|  22.5k|}
lz4.c:LZ4_readLE16:
  431|  78.4k|{
  432|  78.4k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (432:9): [True: 78.4k, False: 0]
  ------------------
  433|  78.4k|        return LZ4_read16(memPtr);
  434|  78.4k|    } else {
  435|      0|        const BYTE* p = (const BYTE*)memPtr;
  436|      0|        return (U16)((U16)p[0] | (p[1]<<8));
  437|      0|    }
  438|  78.4k|}
lz4.c:LZ4_memcpy_using_offset:
  536|  38.5k|{
  537|  38.5k|    BYTE v[8];
  538|       |
  539|  38.5k|    assert(dstEnd >= dstPtr + MINMATCH);
  ------------------
  |  |  273|  38.5k|#    define assert(condition) ((void)0)
  ------------------
  540|       |
  541|  38.5k|    switch(offset) {
  542|  31.2k|    case 1:
  ------------------
  |  Branch (542:5): [True: 31.2k, False: 7.37k]
  ------------------
  543|  31.2k|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  236|  31.2k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  234|  31.2k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  544|  31.2k|        break;
  545|    332|    case 2:
  ------------------
  |  Branch (545:5): [True: 332, False: 38.2k]
  ------------------
  546|    332|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  349|    332|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  547|    332|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  349|    332|#    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|    332|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  349|    332|#    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|    332|        break;
  557|    366|    case 4:
  ------------------
  |  Branch (557:5): [True: 366, False: 38.2k]
  ------------------
  558|    366|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  349|    366|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  559|    366|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  349|    366|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  560|    366|        break;
  561|  6.67k|    default:
  ------------------
  |  Branch (561:5): [True: 6.67k, False: 31.9k]
  ------------------
  562|  6.67k|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  563|  6.67k|        return;
  564|  38.5k|    }
  565|       |
  566|  31.9k|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  349|  31.9k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  567|  31.9k|    dstPtr += 8;
  568|  1.05M|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (568:12): [True: 1.02M, False: 31.9k]
  ------------------
  569|  1.02M|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  349|  1.02M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  570|  1.02M|        dstPtr += 8;
  571|  1.02M|    }
  572|  31.9k|}
lz4.c:LZ4_memcpy_using_offset_base:
  497|  6.67k|{
  498|  6.67k|    assert(srcPtr + offset == dstPtr);
  ------------------
  |  |  273|  6.67k|#    define assert(condition) ((void)0)
  ------------------
  499|  6.67k|    if (offset < 8) {
  ------------------
  |  Branch (499:9): [True: 6.21k, False: 466]
  ------------------
  500|  6.21k|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  501|  6.21k|        dstPtr[0] = srcPtr[0];
  502|  6.21k|        dstPtr[1] = srcPtr[1];
  503|  6.21k|        dstPtr[2] = srcPtr[2];
  504|  6.21k|        dstPtr[3] = srcPtr[3];
  505|  6.21k|        srcPtr += inc32table[offset];
  506|  6.21k|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  349|  6.21k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  507|  6.21k|        srcPtr -= dec64table[offset];
  508|  6.21k|        dstPtr += 8;
  509|  6.21k|    } else {
  510|    466|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  349|    466|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  511|    466|        dstPtr += 8;
  512|    466|        srcPtr += 8;
  513|    466|    }
  514|       |
  515|  6.67k|    LZ4_wildCopy8(dstPtr, srcPtr, dstEnd);
  516|  6.67k|}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

chunkset_avx2.c:zng_memread_2:
   12|  2.08k|static inline uint16_t zng_memread_2(const void *ptr) {
   13|  2.08k|#if defined(HAVE_MAY_ALIAS)
   14|  2.08k|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   15|  2.08k|    return ((const unaligned_uint16_t *)ptr)->val;
   16|       |#else
   17|       |    uint16_t val;
   18|       |    memcpy(&val, ptr, sizeof(val));
   19|       |    return val;
   20|       |#endif
   21|  2.08k|}
chunkset_avx2.c:zng_memread_4:
   23|  1.64k|static inline uint32_t zng_memread_4(const void *ptr) {
   24|  1.64k|#if defined(HAVE_MAY_ALIAS)
   25|  1.64k|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  1.64k|    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.64k|}
chunkset_avx2.c:zng_memread_8:
   34|   261k|static inline uint64_t zng_memread_8(const void *ptr) {
   35|   261k|#if defined(HAVE_MAY_ALIAS)
   36|   261k|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   37|   261k|    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|   261k|}

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

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

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

zstd_decompress_block.c:ZSTD_highbit32:
  175|   340k|{
  176|   340k|    assert(val != 0);
  ------------------
  |  |   70|   340k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|   340k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|   340k|}
zstd_decompress_block.c:ZSTD_countLeadingZeros32:
   70|   340k|{
   71|   340k|    assert(val != 0);
  ------------------
  |  |   70|   340k|#    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|   340k|}
entropy_common.c:ZSTD_countTrailingZeros32:
   29|  6.24k|{
   30|  6.24k|    assert(val != 0);
  ------------------
  |  |   70|  6.24k|#    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|  6.24k|}
entropy_common.c:ZSTD_highbit32:
  175|  15.7k|{
  176|  15.7k|    assert(val != 0);
  ------------------
  |  |   70|  15.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  15.7k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  15.7k|}
entropy_common.c:ZSTD_countLeadingZeros32:
   70|  15.7k|{
   71|  15.7k|    assert(val != 0);
  ------------------
  |  |   70|  15.7k|#    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|  15.7k|}
fse_decompress.c:ZSTD_highbit32:
  175|  48.4k|{
  176|  48.4k|    assert(val != 0);
  ------------------
  |  |   70|  48.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  48.4k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  48.4k|}
fse_decompress.c:ZSTD_countLeadingZeros32:
   70|  48.4k|{
   71|  48.4k|    assert(val != 0);
  ------------------
  |  |   70|  48.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   72|       |#if defined(_MSC_VER)
   73|       |#  if STATIC_BMI2
   74|       |    return (unsigned)_lzcnt_u32(val);
   75|       |#  else
   76|       |    if (val != 0) {
   77|       |        unsigned long r;
   78|       |        _BitScanReverse(&r, val);
   79|       |        return (unsigned)(31 - r);
   80|       |    } else {
   81|       |        __assume(0); /* Should not reach this code path */
   82|       |    }
   83|       |#  endif
   84|       |#elif defined(__GNUC__) && (__GNUC__ >= 4)
   85|       |    return (unsigned)__builtin_clz(val);
   86|       |#elif defined(__ICCARM__)
   87|       |    return (unsigned)__builtin_clz(val);
   88|       |#else
   89|       |    return ZSTD_countLeadingZeros32_fallback(val);
   90|       |#endif
   91|  48.4k|}
huf_decompress.c:ZSTD_highbit32:
  175|  1.29k|{
  176|  1.29k|    assert(val != 0);
  ------------------
  |  |   70|  1.29k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  1.29k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  1.29k|}
huf_decompress.c:ZSTD_countLeadingZeros32:
   70|  1.29k|{
   71|  1.29k|    assert(val != 0);
  ------------------
  |  |   70|  1.29k|#    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.29k|}
huf_decompress.c:ZSTD_countTrailingZeros64:
   94|    356|{
   95|    356|    assert(val != 0);
  ------------------
  |  |   70|    356|#    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|    356|}

zstd_decompress_block.c:BIT_initDStream:
  255|  2.20k|{
  256|  2.20k|    if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   46|      3|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
                  if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   49|      3|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      3|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      3|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (256:9): [True: 3, False: 2.20k]
  ------------------
  257|       |
  258|  2.20k|    bitD->start = (const char*)srcBuffer;
  259|  2.20k|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|  2.20k|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 2.13k, False: 66]
  ------------------
  262|  2.13k|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|  2.13k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|  2.13k|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|  2.13k|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 2.01k, False: 124]
  ------------------
  266|  2.13k|          if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
  ------------------
  |  |   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 (266:15): [True: 124, False: 2.01k]
  ------------------
  267|  2.13k|    } else {
  268|     66|        bitD->ptr   = bitD->start;
  269|     66|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|     66|        switch(srcSize)
  271|     66|        {
  272|      6|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 6, False: 60]
  ------------------
  273|      6|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|      6|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|     13|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 7, False: 59]
  ------------------
  276|     13|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     13|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|     18|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 5, False: 61]
  ------------------
  279|     18|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     18|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|     24|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 6, False: 60]
  ------------------
  282|     24|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     24|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|     35|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 11, False: 55]
  ------------------
  285|     35|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     35|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|     52|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 17, False: 49]
  ------------------
  288|     52|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     52|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|     66|        default: break;
  ------------------
  |  Branch (290:9): [True: 14, False: 52]
  ------------------
  291|     66|        }
  292|     66|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|     66|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 55, False: 11]
  ------------------
  294|     66|            if (lastByte == 0) return ERROR(corruption_detected);  /* 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 (294:17): [True: 11, False: 55]
  ------------------
  295|     66|        }
  296|     55|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|     55|    }
  298|       |
  299|  2.06k|    return srcSize;
  300|  2.20k|}
zstd_decompress_block.c:BIT_readBits:
  363|  8.70M|{
  364|  8.70M|    BitContainerType const value = BIT_lookBits(bitD, nbBits);
  365|  8.70M|    BIT_skipBits(bitD, nbBits);
  366|  8.70M|    return value;
  367|  8.70M|}
zstd_decompress_block.c:BIT_lookBits:
  331|  8.70M|{
  332|       |    /* arbitrate between double-shift and shift+mask */
  333|  8.70M|#if 1
  334|       |    /* if bitD->bitsConsumed + nbBits > sizeof(bitD->bitContainer)*8,
  335|       |     * bitstream is likely corrupted, and result is undefined */
  336|  8.70M|    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|  8.70M|}
zstd_decompress_block.c:BIT_getMiddleBits:
  308|  8.70M|{
  309|  8.70M|    U32 const regMask = sizeof(bitContainer)*8 - 1;
  310|       |    /* if start > regMask, bitstream is corrupted, and result is undefined */
  311|  8.70M|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  8.70M|#    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|  8.70M|#if defined(__x86_64__) || defined(_M_X64)
  318|  8.70M|    return (bitContainer >> (start & regMask)) & ((((U64)1) << nbBits) - 1);
  319|       |#else
  320|       |    return (bitContainer >> (start & regMask)) & BIT_mask[nbBits];
  321|       |#endif
  322|  8.70M|}
zstd_decompress_block.c:BIT_skipBits:
  354|  10.6M|{
  355|  10.6M|    bitD->bitsConsumed += nbBits;
  356|  10.6M|}
zstd_decompress_block.c:BIT_reloadDStream:
  413|  2.90M|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|  2.90M|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  188|  2.90M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 2.76M, False: 138k]
  |  |  ------------------
  ------------------
  416|  2.76M|        static const BitContainerType zeroFilled = 0;
  417|  2.76M|        bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
  418|       |        /* overflow detected, erroneous scenario or end of stream: no update */
  419|  2.76M|        return BIT_DStream_overflow;
  420|  2.76M|    }
  421|       |
  422|   138k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|   138k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|   138k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 102k, False: 36.0k]
  ------------------
  425|   102k|        return BIT_reloadDStream_internal(bitD);
  426|   102k|    }
  427|  36.0k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 18.4k, False: 17.5k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|  18.4k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 18.2k, False: 172]
  ------------------
  430|    172|        return BIT_DStream_completed;
  431|  18.4k|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  17.5k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  17.5k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  17.5k|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (435:13): [True: 892, False: 16.6k]
  ------------------
  436|    892|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|    892|            result = BIT_DStream_endOfBuffer;
  438|    892|        }
  439|  17.5k|        bitD->ptr -= nbBytes;
  440|  17.5k|        bitD->bitsConsumed -= nbBytes*8;
  441|  17.5k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  17.5k|        return result;
  443|  36.0k|    }
  444|  36.0k|}
zstd_decompress_block.c:BIT_reloadDStream_internal:
  385|   102k|{
  386|   102k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|   102k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|   102k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|   102k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|   102k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|   102k|    bitD->bitsConsumed &= 7;
  390|   102k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|   102k|    return BIT_DStream_unfinished;
  392|   102k|}
zstd_decompress_block.c:BIT_readBitsFast:
  372|  1.94M|{
  373|  1.94M|    BitContainerType const value = BIT_lookBitsFast(bitD, nbBits);
  374|  1.94M|    assert(nbBits >= 1);
  ------------------
  |  |   70|  1.94M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  375|  1.94M|    BIT_skipBits(bitD, nbBits);
  376|  1.94M|    return value;
  377|  1.94M|}
zstd_decompress_block.c:BIT_lookBitsFast:
  347|  1.94M|{
  348|  1.94M|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|  1.94M|    assert(nbBits >= 1);
  ------------------
  |  |   70|  1.94M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|  1.94M|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|  1.94M|}
zstd_decompress_block.c:BIT_endOfDStream:
  450|    439|{
  451|    439|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (451:13): [True: 408, False: 31]
  |  Branch (451:49): [True: 396, False: 12]
  ------------------
  452|    439|}
fse_decompress.c:BIT_initDStream:
  255|    907|{
  256|    907|    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: 903]
  ------------------
  257|       |
  258|    903|    bitD->start = (const char*)srcBuffer;
  259|    903|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|    903|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 765, False: 138]
  ------------------
  262|    765|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|    765|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|    765|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|    765|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 727, False: 38]
  ------------------
  266|    765|          if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
  ------------------
  |  |   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 (266:15): [True: 38, False: 727]
  ------------------
  267|    765|    } else {
  268|    138|        bitD->ptr   = bitD->start;
  269|    138|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|    138|        switch(srcSize)
  271|    138|        {
  272|     10|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 10, False: 128]
  ------------------
  273|     10|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     10|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|     17|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 7, False: 131]
  ------------------
  276|     17|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     17|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|     35|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 18, False: 120]
  ------------------
  279|     35|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     35|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|     69|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 34, False: 104]
  ------------------
  282|     69|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     69|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|    104|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 35, False: 103]
  ------------------
  285|    104|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|    104|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|    130|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 26, False: 112]
  ------------------
  288|    130|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|    130|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|    138|        default: break;
  ------------------
  |  Branch (290:9): [True: 8, False: 130]
  ------------------
  291|    138|        }
  292|    138|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|    138|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 131, False: 7]
  ------------------
  294|    138|            if (lastByte == 0) return ERROR(corruption_detected);  /* endMark not present */
  ------------------
  |  |   49|      7|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      7|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      7|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (294:17): [True: 7, False: 131]
  ------------------
  295|    138|        }
  296|    131|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|    131|    }
  298|       |
  299|    858|    return srcSize;
  300|    903|}
fse_decompress.c:BIT_readBits:
  363|  86.0k|{
  364|  86.0k|    BitContainerType const value = BIT_lookBits(bitD, nbBits);
  365|  86.0k|    BIT_skipBits(bitD, nbBits);
  366|  86.0k|    return value;
  367|  86.0k|}
fse_decompress.c:BIT_lookBits:
  331|  86.0k|{
  332|       |    /* arbitrate between double-shift and shift+mask */
  333|  86.0k|#if 1
  334|       |    /* if bitD->bitsConsumed + nbBits > sizeof(bitD->bitContainer)*8,
  335|       |     * bitstream is likely corrupted, and result is undefined */
  336|  86.0k|    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|  86.0k|}
fse_decompress.c:BIT_getMiddleBits:
  308|  86.0k|{
  309|  86.0k|    U32 const regMask = sizeof(bitContainer)*8 - 1;
  310|       |    /* if start > regMask, bitstream is corrupted, and result is undefined */
  311|  86.0k|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  86.0k|#    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|  86.0k|#if defined(__x86_64__) || defined(_M_X64)
  318|  86.0k|    return (bitContainer >> (start & regMask)) & ((((U64)1) << nbBits) - 1);
  319|       |#else
  320|       |    return (bitContainer >> (start & regMask)) & BIT_mask[nbBits];
  321|       |#endif
  322|  86.0k|}
fse_decompress.c:BIT_skipBits:
  354|   104k|{
  355|   104k|    bitD->bitsConsumed += nbBits;
  356|   104k|}
fse_decompress.c:BIT_reloadDStream:
  413|  51.3k|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|  51.3k|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  188|  51.3k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 847, False: 50.4k]
  |  |  ------------------
  ------------------
  416|    847|        static const BitContainerType zeroFilled = 0;
  417|    847|        bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
  418|       |        /* overflow detected, erroneous scenario or end of stream: no update */
  419|    847|        return BIT_DStream_overflow;
  420|    847|    }
  421|       |
  422|  50.4k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  50.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|  50.4k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 12.9k, False: 37.4k]
  ------------------
  425|  12.9k|        return BIT_reloadDStream_internal(bitD);
  426|  12.9k|    }
  427|  37.4k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 30.0k, False: 7.45k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|  30.0k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 29.2k, False: 834]
  ------------------
  430|    834|        return BIT_DStream_completed;
  431|  30.0k|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  7.45k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  7.45k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  7.45k|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (435:13): [True: 70, False: 7.38k]
  ------------------
  436|     70|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|     70|            result = BIT_DStream_endOfBuffer;
  438|     70|        }
  439|  7.45k|        bitD->ptr -= nbBytes;
  440|  7.45k|        bitD->bitsConsumed -= nbBytes*8;
  441|  7.45k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  7.45k|        return result;
  443|  37.4k|    }
  444|  37.4k|}
fse_decompress.c:BIT_reloadDStream_internal:
  385|  12.9k|{
  386|  12.9k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|  12.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|  12.9k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|  12.9k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  12.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|  12.9k|    bitD->bitsConsumed &= 7;
  390|  12.9k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|  12.9k|    return BIT_DStream_unfinished;
  392|  12.9k|}
fse_decompress.c:BIT_readBitsFast:
  372|  18.8k|{
  373|  18.8k|    BitContainerType const value = BIT_lookBitsFast(bitD, nbBits);
  374|  18.8k|    assert(nbBits >= 1);
  ------------------
  |  |   70|  18.8k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  375|  18.8k|    BIT_skipBits(bitD, nbBits);
  376|  18.8k|    return value;
  377|  18.8k|}
fse_decompress.c:BIT_lookBitsFast:
  347|  18.8k|{
  348|  18.8k|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|  18.8k|    assert(nbBits >= 1);
  ------------------
  |  |   70|  18.8k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|  18.8k|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|  18.8k|}
huf_decompress.c:BIT_initDStream:
  255|    984|{
  256|    984|    if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   46|     11|# 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|     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 (256:9): [True: 11, False: 973]
  ------------------
  257|       |
  258|    973|    bitD->start = (const char*)srcBuffer;
  259|    973|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|    973|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 789, False: 184]
  ------------------
  262|    789|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|    789|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|    789|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|    789|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 774, False: 15]
  ------------------
  266|    789|          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: 774]
  ------------------
  267|    789|    } else {
  268|    184|        bitD->ptr   = bitD->start;
  269|    184|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|    184|        switch(srcSize)
  271|    184|        {
  272|     15|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 15, False: 169]
  ------------------
  273|     15|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     15|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|     26|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 11, False: 173]
  ------------------
  276|     26|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     26|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|     43|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 17, False: 167]
  ------------------
  279|     43|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     43|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|     63|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 20, False: 164]
  ------------------
  282|     63|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     63|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|     92|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 29, False: 155]
  ------------------
  285|     92|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     92|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|    121|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 29, False: 155]
  ------------------
  288|    121|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|    121|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|    184|        default: break;
  ------------------
  |  Branch (290:9): [True: 63, False: 121]
  ------------------
  291|    184|        }
  292|    184|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|    184|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 170, False: 14]
  ------------------
  294|    184|            if (lastByte == 0) return ERROR(corruption_detected);  /* endMark not present */
  ------------------
  |  |   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 (294:17): [True: 14, False: 170]
  ------------------
  295|    184|        }
  296|    170|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|    170|    }
  298|       |
  299|    944|    return srcSize;
  300|    973|}
huf_decompress.c:BIT_reloadDStream:
  413|  51.2k|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|  51.2k|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  188|  51.2k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 99, False: 51.1k]
  |  |  ------------------
  ------------------
  416|     99|        static const BitContainerType zeroFilled = 0;
  417|     99|        bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
  418|       |        /* overflow detected, erroneous scenario or end of stream: no update */
  419|     99|        return BIT_DStream_overflow;
  420|     99|    }
  421|       |
  422|  51.1k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  51.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|  51.1k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 47.6k, False: 3.51k]
  ------------------
  425|  47.6k|        return BIT_reloadDStream_internal(bitD);
  426|  47.6k|    }
  427|  3.51k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 797, False: 2.72k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|    797|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 787, False: 10]
  ------------------
  430|     10|        return BIT_DStream_completed;
  431|    797|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  2.72k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  2.72k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  2.72k|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (435:13): [True: 421, False: 2.29k]
  ------------------
  436|    421|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|    421|            result = BIT_DStream_endOfBuffer;
  438|    421|        }
  439|  2.72k|        bitD->ptr -= nbBytes;
  440|  2.72k|        bitD->bitsConsumed -= nbBytes*8;
  441|  2.72k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  2.72k|        return result;
  443|  3.51k|    }
  444|  3.51k|}
huf_decompress.c:BIT_reloadDStream_internal:
  385|  74.0k|{
  386|  74.0k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|  74.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|  74.0k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|  74.0k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  74.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|  74.0k|    bitD->bitsConsumed &= 7;
  390|  74.0k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|  74.0k|    return BIT_DStream_unfinished;
  392|  74.0k|}
huf_decompress.c:BIT_lookBitsFast:
  347|  1.09M|{
  348|  1.09M|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|  1.09M|    assert(nbBits >= 1);
  ------------------
  |  |   70|  1.09M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|  1.09M|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|  1.09M|}
huf_decompress.c:BIT_skipBits:
  354|  1.09M|{
  355|  1.09M|    bitD->bitsConsumed += nbBits;
  356|  1.09M|}
huf_decompress.c:BIT_endOfDStream:
  450|    887|{
  451|    887|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (451:13): [True: 648, False: 239]
  |  Branch (451:49): [True: 7, False: 641]
  ------------------
  452|    887|}
huf_decompress.c:BIT_reloadDStreamFast:
  401|  26.6k|{
  402|  26.6k|    if (UNLIKELY(bitD->ptr < bitD->limitPtr))
  ------------------
  |  |  188|  26.6k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 265, False: 26.3k]
  |  |  ------------------
  ------------------
  403|    265|        return BIT_DStream_overflow;
  404|  26.3k|    return BIT_reloadDStream_internal(bitD);
  405|  26.6k|}

zstd_decompress_block.c:ZSTD_maybeNullPtrAdd:
  386|  4.19k|{
  387|  4.19k|    return add > 0 ? ptr + add : ptr;
  ------------------
  |  Branch (387:12): [True: 4.19k, False: 2]
  ------------------
  388|  4.19k|}
zstd_decompress_block.c:ZSTD_wrappedPtrSub:
  374|   760k|{
  375|   760k|    return ptr - sub;
  376|   760k|}
zstd_decompress_block.c:ZSTD_wrappedPtrAdd:
  361|   760k|{
  362|   760k|    return ptr + add;
  363|   760k|}
huf_decompress.c:ZSTD_maybeNullPtrAdd:
  386|    901|{
  387|    901|    return add > 0 ? ptr + add : ptr;
  ------------------
  |  Branch (387:12): [True: 900, False: 1]
  ------------------
  388|    901|}

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

FSE_isError:
   31|  1.24k|unsigned FSE_isError(size_t code) { return ERR_isError(code); }
FSE_readNCount_bmi2:
  209|  4.33k|{
  210|  4.33k|#if DYNAMIC_BMI2
  211|  4.33k|    if (bmi2) {
  ------------------
  |  Branch (211:9): [True: 634, False: 3.70k]
  ------------------
  212|    634|        return FSE_readNCount_body_bmi2(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
  213|    634|    }
  214|  3.70k|#endif
  215|  3.70k|    (void)bmi2;
  216|  3.70k|    return FSE_readNCount_body_default(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
  217|  4.33k|}
FSE_readNCount:
  222|  3.33k|{
  223|  3.33k|    return FSE_readNCount_bmi2(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize, /* bmi2 */ 0);
  224|  3.33k|}
HUF_readStats_wksp:
  332|  1.06k|{
  333|  1.06k|#if DYNAMIC_BMI2
  334|  1.06k|    if (flags & HUF_flags_bmi2) {
  ------------------
  |  Branch (334:9): [True: 684, False: 380]
  ------------------
  335|    684|        return HUF_readStats_body_bmi2(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize);
  336|    684|    }
  337|    380|#endif
  338|    380|    (void)flags;
  339|    380|    return HUF_readStats_body_default(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize);
  340|  1.06k|}
entropy_common.c:FSE_readNCount_body_bmi2:
  201|    634|{
  202|    634|    return FSE_readNCount_body(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
  203|    634|}
entropy_common.c:FSE_readNCount_body:
   44|  4.33k|{
   45|  4.33k|    const BYTE* const istart = (const BYTE*) headerBuffer;
   46|  4.33k|    const BYTE* const iend = istart + hbSize;
   47|  4.33k|    const BYTE* ip = istart;
   48|  4.33k|    int nbBits;
   49|  4.33k|    int remaining;
   50|  4.33k|    int threshold;
   51|  4.33k|    U32 bitStream;
   52|  4.33k|    int bitCount;
   53|  4.33k|    unsigned charnum = 0;
   54|  4.33k|    unsigned const maxSV1 = *maxSVPtr + 1;
   55|  4.33k|    int previous0 = 0;
   56|       |
   57|  4.33k|    if (hbSize < 8) {
  ------------------
  |  Branch (57:9): [True: 253, False: 4.08k]
  ------------------
   58|       |        /* This function only works when hbSize >= 8 */
   59|    253|        char buffer[8] = {0};
   60|    253|        ZSTD_memcpy(buffer, headerBuffer, hbSize);
  ------------------
  |  |   44|    253|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
   61|    253|        {   size_t const countSize = FSE_readNCount(normalizedCounter, maxSVPtr, tableLogPtr,
   62|    253|                                                    buffer, sizeof(buffer));
   63|    253|            if (FSE_isError(countSize)) return countSize;
  ------------------
  |  Branch (63:17): [True: 55, False: 198]
  ------------------
   64|    198|            if (countSize > hbSize) 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 (64:17): [True: 47, False: 151]
  ------------------
   65|    151|            return countSize;
   66|    198|    }   }
   67|  4.08k|    assert(hbSize >= 8);
  ------------------
  |  |   70|  4.08k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   68|       |
   69|       |    /* init */
   70|  4.08k|    ZSTD_memset(normalizedCounter, 0, (*maxSVPtr+1) * sizeof(normalizedCounter[0]));   /* all symbols not present in NCount have a frequency of 0 */
  ------------------
  |  |   46|  4.08k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
   71|  4.08k|    bitStream = MEM_readLE32(ip);
   72|  4.08k|    nbBits = (bitStream & 0xF) + FSE_MIN_TABLELOG;   /* extract tableLog */
  ------------------
  |  |  616|  4.08k|#define FSE_MIN_TABLELOG 5
  ------------------
   73|  4.08k|    if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  |  618|  4.08k|#define FSE_TABLELOG_ABSOLUTE_MAX 15
  ------------------
                  if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   49|     46|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     46|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     46|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (73:9): [True: 46, False: 4.03k]
  ------------------
   74|  4.03k|    bitStream >>= 4;
   75|  4.03k|    bitCount = 4;
   76|  4.03k|    *tableLogPtr = nbBits;
   77|  4.03k|    remaining = (1<<nbBits)+1;
   78|  4.03k|    threshold = 1<<nbBits;
   79|  4.03k|    nbBits++;
   80|       |
   81|  49.7k|    for (;;) {
   82|  49.7k|        if (previous0) {
  ------------------
  |  Branch (82:13): [True: 5.92k, False: 43.7k]
  ------------------
   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|  5.92k|            int repeats = ZSTD_countTrailingZeros32(~bitStream | 0x80000000) >> 1;
   89|  6.24k|            while (repeats >= 12) {
  ------------------
  |  Branch (89:20): [True: 328, False: 5.92k]
  ------------------
   90|    328|                charnum += 3 * 12;
   91|    328|                if (LIKELY(ip <= iend-7)) {
  ------------------
  |  |  187|    328|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (187:19): [True: 298, False: 30]
  |  |  ------------------
  ------------------
   92|    298|                    ip += 3;
   93|    298|                } else {
   94|     30|                    bitCount -= (int)(8 * (iend - 7 - ip));
   95|     30|                    bitCount &= 31;
   96|     30|                    ip = iend - 4;
   97|     30|                }
   98|    328|                bitStream = MEM_readLE32(ip) >> bitCount;
   99|    328|                repeats = ZSTD_countTrailingZeros32(~bitStream | 0x80000000) >> 1;
  100|    328|            }
  101|  5.92k|            charnum += 3 * repeats;
  102|  5.92k|            bitStream >>= 2 * repeats;
  103|  5.92k|            bitCount += 2 * repeats;
  104|       |
  105|       |            /* Add the final repeat which isn't 0b11. */
  106|  5.92k|            assert((bitStream & 3) < 3);
  ------------------
  |  |   70|  5.92k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  107|  5.92k|            charnum += bitStream & 3;
  108|  5.92k|            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|  5.92k|            if (charnum >= maxSV1) break;
  ------------------
  |  Branch (114:17): [True: 24, False: 5.89k]
  ------------------
  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|  5.89k|            if (LIKELY(ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
  ------------------
  |  |  187|  11.7k|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (187:19): [True: 4.33k, False: 1.55k]
  |  |  ------------------
  ------------------
  |  Branch (120:41): [True: 349, False: 1.21k]
  ------------------
  121|  4.68k|                assert((bitCount >> 3) <= 3); /* For first condition to work */
  ------------------
  |  |   70|  4.68k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  122|  4.68k|                ip += bitCount>>3;
  123|  4.68k|                bitCount &= 7;
  124|  4.68k|            } else {
  125|  1.21k|                bitCount -= (int)(8 * (iend - 4 - ip));
  126|  1.21k|                bitCount &= 31;
  127|  1.21k|                ip = iend - 4;
  128|  1.21k|            }
  129|  5.89k|            bitStream = MEM_readLE32(ip) >> bitCount;
  130|  5.89k|        }
  131|  49.6k|        {
  132|  49.6k|            int const max = (2*threshold-1) - remaining;
  133|  49.6k|            int count;
  134|       |
  135|  49.6k|            if ((bitStream & (threshold-1)) < (U32)max) {
  ------------------
  |  Branch (135:17): [True: 35.8k, False: 13.8k]
  ------------------
  136|  35.8k|                count = bitStream & (threshold-1);
  137|  35.8k|                bitCount += nbBits-1;
  138|  35.8k|            } else {
  139|  13.8k|                count = bitStream & (2*threshold-1);
  140|  13.8k|                if (count >= threshold) count -= max;
  ------------------
  |  Branch (140:21): [True: 4.96k, False: 8.86k]
  ------------------
  141|  13.8k|                bitCount += nbBits;
  142|  13.8k|            }
  143|       |
  144|  49.6k|            count--;   /* extra accuracy */
  145|       |            /* When it matters (small blocks), this is a
  146|       |             * predictable branch, because we don't use -1.
  147|       |             */
  148|  49.6k|            if (count >= 0) {
  ------------------
  |  Branch (148:17): [True: 25.8k, False: 23.8k]
  ------------------
  149|  25.8k|                remaining -= count;
  150|  25.8k|            } else {
  151|  23.8k|                assert(count == -1);
  ------------------
  |  |   70|  23.8k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  152|  23.8k|                remaining += count;
  153|  23.8k|            }
  154|  49.6k|            normalizedCounter[charnum++] = (short)count;
  155|  49.6k|            previous0 = !count;
  156|       |
  157|  49.6k|            assert(threshold > 1);
  ------------------
  |  |   70|  49.6k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  158|  49.6k|            if (remaining < threshold) {
  ------------------
  |  Branch (158:17): [True: 17.3k, False: 32.3k]
  ------------------
  159|       |                /* This branch can be folded into the
  160|       |                 * threshold update condition because we
  161|       |                 * know that threshold > 1.
  162|       |                 */
  163|  17.3k|                if (remaining <= 1) break;
  ------------------
  |  Branch (163:21): [True: 3.97k, False: 13.3k]
  ------------------
  164|  13.3k|                nbBits = ZSTD_highbit32(remaining) + 1;
  165|  13.3k|                threshold = 1 << (nbBits - 1);
  166|  13.3k|            }
  167|  45.7k|            if (charnum >= maxSV1) break;
  ------------------
  |  Branch (167:17): [True: 40, False: 45.6k]
  ------------------
  168|       |
  169|  45.6k|            if (LIKELY(ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
  ------------------
  |  |  187|  91.3k|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (187:19): [True: 35.3k, False: 10.2k]
  |  |  ------------------
  ------------------
  |  Branch (169:41): [True: 1.51k, False: 8.75k]
  ------------------
  170|  36.9k|                ip += bitCount>>3;
  171|  36.9k|                bitCount &= 7;
  172|  36.9k|            } else {
  173|  8.75k|                bitCount -= (int)(8 * (iend - 4 - ip));
  174|  8.75k|                bitCount &= 31;
  175|  8.75k|                ip = iend - 4;
  176|  8.75k|            }
  177|  45.6k|            bitStream = MEM_readLE32(ip) >> bitCount;
  178|  45.6k|    }   }
  179|  4.03k|    if (remaining != 1) 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 (179:9): [True: 64, False: 3.97k]
  ------------------
  180|       |    /* Only possible when there are too many zeros. */
  181|  3.97k|    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.97k]
  ------------------
  182|  3.97k|    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.97k]
  ------------------
  183|  3.97k|    *maxSVPtr = charnum-1;
  184|       |
  185|  3.97k|    ip += (bitCount+7)>>3;
  186|  3.97k|    return ip-istart;
  187|  3.97k|}
entropy_common.c:FSE_readNCount_body_default:
  193|  3.70k|{
  194|  3.70k|    return FSE_readNCount_body(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
  195|  3.70k|}
entropy_common.c:HUF_readStats_body_bmi2:
  322|    684|{
  323|    684|    return HUF_readStats_body(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize, 1);
  324|    684|}
entropy_common.c:HUF_readStats_body:
  248|  1.06k|{
  249|  1.06k|    U32 weightTotal;
  250|  1.06k|    const BYTE* ip = (const BYTE*) src;
  251|  1.06k|    size_t iSize;
  252|  1.06k|    size_t oSize;
  253|       |
  254|  1.06k|    if (!srcSize) 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 (254:9): [True: 13, False: 1.05k]
  ------------------
  255|  1.05k|    iSize = ip[0];
  256|       |    /* ZSTD_memset(huffWeight, 0, hwSize);   *//* is not necessary, even though some analyzer complain ... */
  257|       |
  258|  1.05k|    if (iSize >= 128) {  /* special header */
  ------------------
  |  Branch (258:9): [True: 45, False: 1.00k]
  ------------------
  259|     45|        oSize = iSize - 127;
  260|     45|        iSize = ((oSize+1)/2);
  261|     45|        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 (261:13): [True: 11, False: 34]
  ------------------
  262|     34|        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: 34]
  ------------------
  263|     34|        ip += 1;
  264|     34|        {   U32 n;
  265|    573|            for (n=0; n<oSize; n+=2) {
  ------------------
  |  Branch (265:23): [True: 539, False: 34]
  ------------------
  266|    539|                huffWeight[n]   = ip[n/2] >> 4;
  267|    539|                huffWeight[n+1] = ip[n/2] & 15;
  268|    539|    }   }   }
  269|  1.00k|    else  {   /* header compressed with FSE (normal case) */
  270|  1.00k|        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: 996]
  ------------------
  271|       |        /* max (hwSize-1) values decoded, as last one is implied */
  272|    996|        oSize = FSE_decompress_wksp_bmi2(huffWeight, hwSize-1, ip+1, iSize, 6, workSpace, wkspSize, bmi2);
  273|    996|        if (FSE_isError(oSize)) return oSize;
  ------------------
  |  Branch (273:13): [True: 164, False: 832]
  ------------------
  274|    996|    }
  275|       |
  276|       |    /* collect weight stats */
  277|    866|    ZSTD_memset(rankStats, 0, (HUF_TABLELOG_MAX + 1) * sizeof(U32));
  ------------------
  |  |   46|    866|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  278|    866|    weightTotal = 0;
  279|  98.1k|    {   U32 n; for (n=0; n<oSize; n++) {
  ------------------
  |  Branch (279:26): [True: 97.3k, False: 804]
  ------------------
  280|  97.3k|            if (huffWeight[n] > HUF_TABLELOG_MAX) return ERROR(corruption_detected);
  ------------------
  |  |   37|  97.3k|#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|     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 (280:17): [True: 62, False: 97.2k]
  ------------------
  281|  97.2k|            rankStats[huffWeight[n]]++;
  282|  97.2k|            weightTotal += (1 << huffWeight[n]) >> 1;
  283|  97.2k|    }   }
  284|    804|    if (weightTotal == 0) return ERROR(corruption_detected);
  ------------------
  |  |   49|      2|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      2|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      2|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (284:9): [True: 2, False: 802]
  ------------------
  285|       |
  286|       |    /* get last non-null symbol weight (implied, total must be 2^n) */
  287|    802|    {   U32 const tableLog = ZSTD_highbit32(weightTotal) + 1;
  288|    802|        if (tableLog > HUF_TABLELOG_MAX) return ERROR(corruption_detected);
  ------------------
  |  |   37|    802|#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|     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 (288:13): [True: 10, False: 792]
  ------------------
  289|    792|        *tableLogPtr = tableLog;
  290|       |        /* determine last weight */
  291|    792|        {   U32 const total = 1 << tableLog;
  292|    792|            U32 const rest = total - weightTotal;
  293|    792|            U32 const verif = 1 << ZSTD_highbit32(rest);
  294|    792|            U32 const lastWeight = ZSTD_highbit32(rest) + 1;
  295|    792|            if (verif != rest) return ERROR(corruption_detected);    /* last value must be a clean power of 2 */
  ------------------
  |  |   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 (295:17): [True: 62, False: 730]
  ------------------
  296|    730|            huffWeight[oSize] = (BYTE)lastWeight;
  297|    730|            rankStats[lastWeight]++;
  298|    730|    }   }
  299|       |
  300|       |    /* check tree construction validity */
  301|    730|    if ((rankStats[1] < 2) || (rankStats[1] & 1)) return ERROR(corruption_detected);   /* by construction : at least 2 elts of rank 1, must be even */
  ------------------
  |  |   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 (301:9): [True: 5, False: 725]
  |  Branch (301:31): [True: 0, False: 725]
  ------------------
  302|       |
  303|       |    /* results */
  304|    725|    *nbSymbolsPtr = (U32)(oSize+1);
  305|    725|    return iSize+1;
  306|    730|}
entropy_common.c:HUF_readStats_body_default:
  313|    380|{
  314|    380|    return HUF_readStats_body(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize, 0);
  315|    380|}

zstd_common.c:ERR_isError:
   52|  11.0k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  11.0k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  11.0k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  11.0k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_common.c:ERR_getErrorCode:
   54|  3.95k|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: 264, False: 3.69k]
  ------------------
zstd_ddict.c:ERR_isError:
   52|  11.8k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  11.8k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  11.8k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  11.8k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_decompress.c:ERR_isError:
   52|  48.6k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  48.6k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  48.6k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  48.6k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_decompress_block.c:ERR_isError:
   52|  2.91M|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  2.91M|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  2.91M|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  2.91M|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_v05.c:ERR_isError:
   52|   127k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|   127k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|   127k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|   127k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_v06.c:ERR_isError:
   52|  34.9k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  34.9k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  34.9k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  34.9k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_v07.c:ERR_isError:
   52|  57.8k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  57.8k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  57.8k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  57.8k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
entropy_common.c:ERR_isError:
   52|  1.24k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  1.24k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  1.24k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  1.24k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
fse_decompress.c:ERR_isError:
   52|  2.81k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  2.81k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  2.81k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  2.81k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
huf_decompress.c:ERR_isError:
   52|  3.54k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  3.54k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  3.54k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  3.54k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------

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

FSE_decompress_wksp_bmi2:
  305|    996|{
  306|    996|#if DYNAMIC_BMI2
  307|    996|    if (bmi2) {
  ------------------
  |  Branch (307:9): [True: 634, False: 362]
  ------------------
  308|    634|        return FSE_decompress_wksp_body_bmi2(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize);
  309|    634|    }
  310|    362|#endif
  311|    362|    (void)bmi2;
  312|    362|    return FSE_decompress_wksp_body_default(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize);
  313|    996|}
fse_decompress.c:FSE_buildDTable_internal:
   59|    907|{
   60|    907|    void* const tdPtr = dt+1;   /* because *dt is unsigned, 32-bits aligned on 32-bits */
   61|    907|    FSE_DECODE_TYPE* const tableDecode = (FSE_DECODE_TYPE*) (tdPtr);
  ------------------
  |  |  603|    907|#define FSE_DECODE_TYPE FSE_decode_t
  ------------------
   62|    907|    U16* symbolNext = (U16*)workSpace;
   63|    907|    BYTE* spread = (BYTE*)(symbolNext + maxSymbolValue + 1);
   64|       |
   65|    907|    U32 const maxSV1 = maxSymbolValue + 1;
   66|    907|    U32 const tableSize = 1 << tableLog;
   67|    907|    U32 highThreshold = tableSize-1;
   68|       |
   69|       |    /* Sanity Checks */
   70|    907|    if (FSE_BUILD_DTABLE_WKSP_SIZE(tableLog, maxSymbolValue) > wkspSize) return ERROR(maxSymbolValue_tooLarge);
  ------------------
  |  |  267|    907|#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: 907]
  ------------------
   71|    907|    if (maxSymbolValue > FSE_MAX_SYMBOL_VALUE) return ERROR(maxSymbolValue_tooLarge);
  ------------------
  |  |  595|    907|#  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: 907]
  ------------------
   72|    907|    if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge);
  ------------------
  |  |  612|    907|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|    907|#  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: 907]
  ------------------
   73|       |
   74|       |    /* Init, lay down lowprob symbols */
   75|    907|    {   FSE_DTableHeader DTableH;
   76|    907|        DTableH.tableLog = (U16)tableLog;
   77|    907|        DTableH.fastMode = 1;
   78|    907|        {   S16 const largeLimit= (S16)(1 << (tableLog-1));
   79|    907|            U32 s;
   80|  9.73k|            for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (80:23): [True: 8.83k, False: 907]
  ------------------
   81|  8.83k|                if (normalizedCounter[s]==-1) {
  ------------------
  |  Branch (81:21): [True: 2.56k, False: 6.27k]
  ------------------
   82|  2.56k|                    tableDecode[highThreshold--].symbol = (FSE_FUNCTION_TYPE)s;
   83|  2.56k|                    symbolNext[s] = 1;
   84|  6.27k|                } else {
   85|  6.27k|                    if (normalizedCounter[s] >= largeLimit) DTableH.fastMode=0;
  ------------------
  |  Branch (85:25): [True: 630, False: 5.64k]
  ------------------
   86|  6.27k|                    symbolNext[s] = (U16)normalizedCounter[s];
   87|  6.27k|        }   }   }
   88|    907|        ZSTD_memcpy(dt, &DTableH, sizeof(DTableH));
  ------------------
  |  |   44|    907|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
   89|    907|    }
   90|       |
   91|       |    /* Spread symbols */
   92|    907|    if (highThreshold == tableSize - 1) {
  ------------------
  |  Branch (92:9): [True: 193, False: 714]
  ------------------
   93|    193|        size_t const tableMask = tableSize-1;
   94|    193|        size_t const step = FSE_TABLESTEP(tableSize);
  ------------------
  |  |  623|    193|#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|    193|        {   U64 const add = 0x0101010101010101ull;
  102|    193|            size_t pos = 0;
  103|    193|            U64 sv = 0;
  104|    193|            U32 s;
  105|  1.18k|            for (s=0; s<maxSV1; ++s, sv += add) {
  ------------------
  |  Branch (105:23): [True: 994, False: 193]
  ------------------
  106|    994|                int i;
  107|    994|                int const n = normalizedCounter[s];
  108|    994|                MEM_write64(spread + pos, sv);
  109|  1.85k|                for (i = 8; i < n; i += 8) {
  ------------------
  |  Branch (109:29): [True: 860, False: 994]
  ------------------
  110|    860|                    MEM_write64(spread + pos + i, sv);
  111|    860|                }
  112|    994|                pos += (size_t)n;
  113|    994|        }   }
  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|    193|        {
  121|    193|            size_t position = 0;
  122|    193|            size_t s;
  123|    193|            size_t const unroll = 2;
  124|    193|            assert(tableSize % unroll == 0); /* FSE_MIN_TABLELOG is 5 */
  ------------------
  |  |   70|    193|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  125|  5.00k|            for (s = 0; s < (size_t)tableSize; s += unroll) {
  ------------------
  |  Branch (125:25): [True: 4.81k, False: 193]
  ------------------
  126|  4.81k|                size_t u;
  127|  14.4k|                for (u = 0; u < unroll; ++u) {
  ------------------
  |  Branch (127:29): [True: 9.63k, False: 4.81k]
  ------------------
  128|  9.63k|                    size_t const uPosition = (position + (u * step)) & tableMask;
  129|  9.63k|                    tableDecode[uPosition].symbol = spread[s + u];
  130|  9.63k|                }
  131|  4.81k|                position = (position + (unroll * step)) & tableMask;
  132|  4.81k|            }
  133|    193|            assert(position == 0);
  ------------------
  |  |   70|    193|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  134|    193|        }
  135|    714|    } else {
  136|    714|        U32 const tableMask = tableSize-1;
  137|    714|        U32 const step = FSE_TABLESTEP(tableSize);
  ------------------
  |  |  623|    714|#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
  ------------------
  138|    714|        U32 s, position = 0;
  139|  8.55k|        for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (139:19): [True: 7.83k, False: 714]
  ------------------
  140|  7.83k|            int i;
  141|  43.1k|            for (i=0; i<normalizedCounter[s]; i++) {
  ------------------
  |  Branch (141:23): [True: 35.3k, False: 7.83k]
  ------------------
  142|  35.3k|                tableDecode[position].symbol = (FSE_FUNCTION_TYPE)s;
  143|  35.3k|                position = (position + step) & tableMask;
  144|  37.8k|                while (position > highThreshold) position = (position + step) & tableMask;   /* lowprob area */
  ------------------
  |  Branch (144:24): [True: 2.52k, False: 35.3k]
  ------------------
  145|  35.3k|        }   }
  146|    714|        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: 714]
  ------------------
  147|    714|    }
  148|       |
  149|       |    /* Build Decoding table */
  150|    907|    {   U32 u;
  151|  48.4k|        for (u=0; u<tableSize; u++) {
  ------------------
  |  Branch (151:19): [True: 47.5k, False: 907]
  ------------------
  152|  47.5k|            FSE_FUNCTION_TYPE const symbol = (FSE_FUNCTION_TYPE)(tableDecode[u].symbol);
  ------------------
  |  |  601|  47.5k|#define FSE_FUNCTION_TYPE BYTE
  ------------------
  153|  47.5k|            U32 const nextState = symbolNext[symbol]++;
  154|  47.5k|            tableDecode[u].nbBits = (BYTE) (tableLog - ZSTD_highbit32(nextState) );
  155|  47.5k|            tableDecode[u].newState = (U16) ( (nextState << tableDecode[u].nbBits) - tableSize);
  156|  47.5k|    }   }
  157|       |
  158|    907|    return 0;
  159|    907|}
fse_decompress.c:FSE_decompress_wksp_body_bmi2:
  299|    634|{
  300|    634|    return FSE_decompress_wksp_body(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize, 1);
  301|    634|}
fse_decompress.c:FSE_decompress_wksp_body:
  248|    996|{
  249|    996|    const BYTE* const istart = (const BYTE*)cSrc;
  250|    996|    const BYTE* ip = istart;
  251|    996|    unsigned tableLog;
  252|    996|    unsigned maxSymbolValue = FSE_MAX_SYMBOL_VALUE;
  ------------------
  |  |  595|    996|#  define FSE_MAX_SYMBOL_VALUE 255
  ------------------
  253|    996|    FSE_DecompressWksp* const wksp = (FSE_DecompressWksp*)workSpace;
  254|    996|    size_t const dtablePos = sizeof(FSE_DecompressWksp) / sizeof(FSE_DTable);
  255|    996|    FSE_DTable* const dtable = (FSE_DTable*)workSpace + dtablePos;
  256|       |
  257|    996|    FSE_STATIC_ASSERT((FSE_MAX_SYMBOL_VALUE + 1) % 2 == 0);
  ------------------
  |  |   33|    996|#define FSE_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)   /* use only *after* variable declarations */
  |  |  ------------------
  |  |  |  |   39|    996|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  258|    996|    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: 996]
  ------------------
  259|       |
  260|       |    /* correct offset to dtable depends on this property */
  261|    996|    FSE_STATIC_ASSERT(sizeof(FSE_DecompressWksp) % sizeof(FSE_DTable) == 0);
  ------------------
  |  |   33|    996|#define FSE_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)   /* use only *after* variable declarations */
  |  |  ------------------
  |  |  |  |   39|    996|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  262|       |
  263|       |    /* normal FSE decoding mode */
  264|    996|    {   size_t const NCountLength =
  265|    996|            FSE_readNCount_bmi2(wksp->ncount, &maxSymbolValue, &tableLog, istart, cSrcSize, bmi2);
  266|    996|        if (FSE_isError(NCountLength)) return NCountLength;
  ------------------
  |  |   32|    996|#define FSE_isError ERR_isError
  ------------------
  |  Branch (266:13): [True: 38, False: 958]
  ------------------
  267|    958|        if (tableLog > maxLog) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   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 (267:13): [True: 36, False: 922]
  ------------------
  268|    922|        assert(NCountLength <= cSrcSize);
  ------------------
  |  |   70|    922|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  269|    922|        ip += NCountLength;
  270|    922|        cSrcSize -= NCountLength;
  271|    922|    }
  272|       |
  273|    922|    if (FSE_DECOMPRESS_WKSP_SIZE(tableLog, maxSymbolValue) > wkspSize) return ERROR(tableLog_tooLarge);
  ------------------
  |  |  273|    922|#define FSE_DECOMPRESS_WKSP_SIZE(maxTableLog, maxSymbolValue) (FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) * sizeof(unsigned))
  |  |  ------------------
  |  |  |  |  272|    922|#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|    922|#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|    922|#define FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) ((FSE_BUILD_DTABLE_WKSP_SIZE(maxTableLog, maxSymbolValue) + sizeof(unsigned) - 1) / sizeof(unsigned))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  267|    922|#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|    922|#  define FSE_MAX_SYMBOL_VALUE 255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  if (FSE_DECOMPRESS_WKSP_SIZE(tableLog, maxSymbolValue) > wkspSize) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   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 (273:9): [True: 15, False: 907]
  ------------------
  274|    907|    assert(sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog) <= wkspSize);
  ------------------
  |  |   70|    907|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  275|    907|    workSpace = (BYTE*)workSpace + sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog);
  ------------------
  |  |  245|    907|#define FSE_DTABLE_SIZE(maxTableLog)                   (FSE_DTABLE_SIZE_U32(maxTableLog) * sizeof(FSE_DTable))
  |  |  ------------------
  |  |  |  |  241|    907|#define FSE_DTABLE_SIZE_U32(maxTableLog)                   (1 + (1<<(maxTableLog)))
  |  |  ------------------
  ------------------
  276|    907|    wkspSize -= sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog);
  ------------------
  |  |  245|    907|#define FSE_DTABLE_SIZE(maxTableLog)                   (FSE_DTABLE_SIZE_U32(maxTableLog) * sizeof(FSE_DTable))
  |  |  ------------------
  |  |  |  |  241|    907|#define FSE_DTABLE_SIZE_U32(maxTableLog)                   (1 + (1<<(maxTableLog)))
  |  |  ------------------
  ------------------
  277|       |
  278|    907|    CHECK_F( FSE_buildDTable_internal(dtable, wksp->ncount, maxSymbolValue, tableLog, workSpace, wkspSize) );
  ------------------
  |  |   63|    907|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|    907|    size_t const e = f;     \
  |  |  |  |   59|    907|    do {                    \
  |  |  |  |   60|    907|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 0, False: 907]
  |  |  |  |  ------------------
  |  |  |  |   61|    907|            return e;       \
  |  |  |  |   62|    907|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 907]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 907]
  |  |  ------------------
  ------------------
  279|       |
  280|    907|    {
  281|    907|        const void* ptr = dtable;
  282|    907|        const FSE_DTableHeader* DTableH = (const FSE_DTableHeader*)ptr;
  283|    907|        const U32 fastMode = DTableH->fastMode;
  284|       |
  285|       |        /* select fast mode (static) */
  286|    907|        if (fastMode) return FSE_decompress_usingDTable_generic(dst, dstCapacity, ip, cSrcSize, dtable, 1);
  ------------------
  |  Branch (286:13): [True: 278, False: 629]
  ------------------
  287|    629|        return FSE_decompress_usingDTable_generic(dst, dstCapacity, ip, cSrcSize, dtable, 0);
  288|    907|    }
  289|    907|}
fse_decompress.c:FSE_decompress_usingDTable_generic:
  177|    907|{
  178|    907|    BYTE* const ostart = (BYTE*) dst;
  179|    907|    BYTE* op = ostart;
  180|    907|    BYTE* const omax = op + maxDstSize;
  181|    907|    BYTE* const olimit = omax-3;
  182|       |
  183|    907|    BIT_DStream_t bitD;
  184|    907|    FSE_DState_t state1;
  185|    907|    FSE_DState_t state2;
  186|       |
  187|       |    /* Init */
  188|    907|    CHECK_F(BIT_initDStream(&bitD, cSrc, cSrcSize));
  ------------------
  |  |   63|    907|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|    907|    size_t const e = f;     \
  |  |  |  |   59|    907|    do {                    \
  |  |  |  |   60|    907|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 49, False: 858]
  |  |  |  |  ------------------
  |  |  |  |   61|    907|            return e;       \
  |  |  |  |   62|    907|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 858]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 858]
  |  |  ------------------
  ------------------
  189|       |
  190|    858|    FSE_initDState(&state1, &bitD, dt);
  191|    858|    FSE_initDState(&state2, &bitD, dt);
  192|       |
  193|    858|    RETURN_ERROR_IF(BIT_reloadDStream(&bitD)==BIT_DStream_overflow, corruption_detected, "");
  ------------------
  |  |  114|    858|    do {                                                                       \
  |  |  115|    858|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 7, False: 851]
  |  |  ------------------
  |  |  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|    858|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 851]
  |  |  ------------------
  ------------------
  194|       |
  195|    851|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  196|       |
  197|       |    /* 4 symbols per loop */
  198|  19.0k|    for ( ; (BIT_reloadDStream(&bitD)==BIT_DStream_unfinished) & (op<olimit) ; op+=4) {
  ------------------
  |  Branch (198:13): [True: 18.1k, False: 851]
  ------------------
  199|  18.1k|        op[0] = FSE_GETSYMBOL(&state1);
  ------------------
  |  |  195|  18.1k|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (195:33): [True: 3.28k, False: 14.8k]
  |  |  ------------------
  ------------------
  200|       |
  201|  18.1k|        if (FSE_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  |  612|  18.1k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|  18.1k|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (201:13): [Folded, False: 18.1k]
  ------------------
  202|      0|            BIT_reloadDStream(&bitD);
  203|       |
  204|  18.1k|        op[1] = FSE_GETSYMBOL(&state2);
  ------------------
  |  |  195|  18.1k|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (195:33): [True: 3.28k, False: 14.8k]
  |  |  ------------------
  ------------------
  205|       |
  206|  18.1k|        if (FSE_MAX_TABLELOG*4+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  |  612|  18.1k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|  18.1k|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (206:13): [Folded, False: 18.1k]
  ------------------
  207|      0|            { if (BIT_reloadDStream(&bitD) > BIT_DStream_unfinished) { op+=2; break; } }
  ------------------
  |  Branch (207:19): [True: 0, False: 0]
  ------------------
  208|       |
  209|  18.1k|        op[2] = FSE_GETSYMBOL(&state1);
  ------------------
  |  |  195|  18.1k|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (195:33): [True: 3.28k, False: 14.8k]
  |  |  ------------------
  ------------------
  210|       |
  211|  18.1k|        if (FSE_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  |  612|  18.1k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|  18.1k|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (211:13): [Folded, False: 18.1k]
  ------------------
  212|      0|            BIT_reloadDStream(&bitD);
  213|       |
  214|  18.1k|        op[3] = FSE_GETSYMBOL(&state2);
  ------------------
  |  |  195|  18.1k|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (195:33): [True: 3.28k, False: 14.8k]
  |  |  ------------------
  ------------------
  215|  18.1k|    }
  216|       |
  217|       |    /* tail */
  218|       |    /* note : BIT_reloadDStream(&bitD) >= FSE_DStream_partiallyFilled; Ends at exactly BIT_DStream_completed */
  219|  15.1k|    while (1) {
  ------------------
  |  Branch (219:12): [True: 15.1k, Folded]
  ------------------
  220|  15.1k|        if (op>(omax-2)) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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 (220:13): [True: 19, False: 15.0k]
  ------------------
  221|  15.0k|        *op++ = FSE_GETSYMBOL(&state1);
  ------------------
  |  |  195|  15.0k|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (195:33): [True: 2.80k, False: 12.2k]
  |  |  ------------------
  ------------------
  222|  15.0k|        if (BIT_reloadDStream(&bitD)==BIT_DStream_overflow) {
  ------------------
  |  Branch (222:13): [True: 450, False: 14.6k]
  ------------------
  223|    450|            *op++ = FSE_GETSYMBOL(&state2);
  ------------------
  |  |  195|    450|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (195:33): [True: 102, False: 348]
  |  |  ------------------
  ------------------
  224|    450|            break;
  225|    450|        }
  226|       |
  227|  14.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: 14.6k]
  ------------------
  228|  14.6k|        *op++ = FSE_GETSYMBOL(&state2);
  ------------------
  |  |  195|  14.6k|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (195:33): [True: 2.70k, False: 11.9k]
  |  |  ------------------
  ------------------
  229|  14.6k|        if (BIT_reloadDStream(&bitD)==BIT_DStream_overflow) {
  ------------------
  |  Branch (229:13): [True: 382, False: 14.2k]
  ------------------
  230|    382|            *op++ = FSE_GETSYMBOL(&state1);
  ------------------
  |  |  195|    382|#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (195:33): [True: 121, False: 261]
  |  |  ------------------
  ------------------
  231|    382|            break;
  232|    382|    }   }
  233|       |
  234|    832|    assert(op >= ostart);
  ------------------
  |  |   70|    832|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  235|    832|    return (size_t)(op-ostart);
  236|    851|}
fse_decompress.c:FSE_decompress_wksp_body_default:
  293|    362|{
  294|    362|    return FSE_decompress_wksp_body(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize, 0);
  295|    362|}

zstd_ddict.c:MEM_readLE32:
  322|  4.77k|{
  323|  4.77k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 4.77k, False: 0]
  ------------------
  324|  4.77k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  4.77k|}
zstd_ddict.c:MEM_isLittleEndian:
  141|  4.77k|{
  142|  4.77k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  4.77k|    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|  4.77k|}
zstd_ddict.c:MEM_read32:
  183|  4.77k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress.c:MEM_readLE32:
  322|  31.2k|{
  323|  31.2k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 31.2k, False: 0]
  ------------------
  324|  31.2k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  31.2k|}
zstd_decompress.c:MEM_isLittleEndian:
  141|  32.3k|{
  142|  32.3k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  32.3k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  32.3k|}
zstd_decompress.c:MEM_read32:
  183|  31.2k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress.c:MEM_readLE16:
  290|    588|{
  291|    588|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 588, False: 0]
  ------------------
  292|    588|        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|    588|}
zstd_decompress.c:MEM_read16:
  182|    588|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_decompress.c:MEM_readLE64:
  338|    606|{
  339|    606|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 606, False: 0]
  ------------------
  340|    606|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|    606|}
zstd_decompress.c:MEM_read64:
  184|    606|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
zstd_decompress_block.c:MEM_readLE24:
  311|  6.91k|{
  312|  6.91k|    return (U32)MEM_readLE16(memPtr) + ((U32)(((const BYTE*)memPtr)[2]) << 16);
  313|  6.91k|}
zstd_decompress_block.c:MEM_readLE32:
  322|    748|{
  323|    748|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 748, False: 0]
  ------------------
  324|    748|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|    748|}
zstd_decompress_block.c:MEM_isLittleEndian:
  141|   130k|{
  142|   130k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   130k|    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|   130k|}
zstd_decompress_block.c:MEM_read32:
  183|    748|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress_block.c:MEM_write64:
  189|  21.8k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
zstd_decompress_block.c:MEM_readLE16:
  290|  7.11k|{
  291|  7.11k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 7.11k, False: 0]
  ------------------
  292|  7.11k|        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.11k|}
zstd_decompress_block.c:MEM_read16:
  182|  7.11k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_decompress_block.c:MEM_32bits:
  137|  13.4M|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_decompress_block.c:MEM_64bits:
  138|  2.90M|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_decompress_block.c:MEM_readLEST:
  354|   122k|{
  355|   122k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 122k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|   122k|    else
  358|   122k|        return (size_t)MEM_readLE64(memPtr);
  359|   122k|}
zstd_decompress_block.c:MEM_readLE64:
  338|   122k|{
  339|   122k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 122k, False: 0]
  ------------------
  340|   122k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|   122k|}
zstd_decompress_block.c:MEM_read64:
  184|   122k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
zstd_v05.c:MEM_readLE32:
  322|  48.3k|{
  323|  48.3k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 48.3k, False: 0]
  ------------------
  324|  48.3k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  48.3k|}
zstd_v05.c:MEM_isLittleEndian:
  141|   320k|{
  142|   320k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   320k|    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|   320k|}
zstd_v05.c:MEM_read32:
  183|  48.3k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_v05.c:MEM_readLEST:
  354|   117k|{
  355|   117k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 117k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|   117k|    else
  358|   117k|        return (size_t)MEM_readLE64(memPtr);
  359|   117k|}
zstd_v05.c:MEM_32bits:
  137|   316k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_v05.c:MEM_readLE64:
  338|   117k|{
  339|   117k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 117k, False: 0]
  ------------------
  340|   117k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|   117k|}
zstd_v05.c:MEM_read64:
  184|   117k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
zstd_v05.c:MEM_readLE16:
  290|    851|{
  291|    851|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 851, False: 0]
  ------------------
  292|    851|        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|    851|}
zstd_v05.c:MEM_read16:
  182|    851|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_v05.c:MEM_64bits:
  138|  22.7k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_v05.c:MEM_writeLE16:
  300|   153k|{
  301|   153k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (301:9): [True: 153k, False: 0]
  ------------------
  302|   153k|        MEM_write16(memPtr, val);
  303|   153k|    } else {
  304|      0|        BYTE* p = (BYTE*)memPtr;
  305|      0|        p[0] = (BYTE)val;
  306|      0|        p[1] = (BYTE)(val>>8);
  307|      0|    }
  308|   153k|}
zstd_v05.c:MEM_write16:
  187|   153k|MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(unalign16*)memPtr = value; }
entropy_common.c:MEM_readLE32:
  322|  55.9k|{
  323|  55.9k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 55.9k, False: 0]
  ------------------
  324|  55.9k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  55.9k|}
entropy_common.c:MEM_isLittleEndian:
  141|  55.9k|{
  142|  55.9k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  55.9k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  55.9k|}
entropy_common.c:MEM_read32:
  183|  55.9k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
fse_decompress.c:MEM_write64:
  189|  1.85k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
fse_decompress.c:MEM_readLEST:
  354|  21.1k|{
  355|  21.1k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 21.1k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|  21.1k|    else
  358|  21.1k|        return (size_t)MEM_readLE64(memPtr);
  359|  21.1k|}
fse_decompress.c:MEM_32bits:
  137|  21.1k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
fse_decompress.c:MEM_isLittleEndian:
  141|  21.1k|{
  142|  21.1k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  21.1k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  21.1k|}
fse_decompress.c:MEM_readLE64:
  338|  21.1k|{
  339|  21.1k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 21.1k, False: 0]
  ------------------
  340|  21.1k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  21.1k|}
fse_decompress.c:MEM_read64:
  184|  21.1k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
huf_decompress.c:MEM_isLittleEndian:
  141|   240k|{
  142|   240k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   240k|    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|   240k|}
huf_decompress.c:MEM_write64:
  189|   165k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
huf_decompress.c:MEM_readLEST:
  354|  78.3k|{
  355|  78.3k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 78.3k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|  78.3k|    else
  358|  78.3k|        return (size_t)MEM_readLE64(memPtr);
  359|  78.3k|}
huf_decompress.c:MEM_32bits:
  137|  79.3k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
huf_decompress.c:MEM_readLE64:
  338|  78.3k|{
  339|  78.3k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 78.3k, False: 0]
  ------------------
  340|  78.3k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  78.3k|}
huf_decompress.c:MEM_read64:
  184|  78.3k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
huf_decompress.c:MEM_64bits:
  138|   186k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
huf_decompress.c:MEM_readLE16:
  290|  1.61k|{
  291|  1.61k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 1.61k, False: 0]
  ------------------
  292|  1.61k|        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.61k|}
huf_decompress.c:MEM_read16:
  182|  1.61k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }

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

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

zstd_decompress.c:ZSTD_cpuSupportsBmi2:
  319|  7.08k|{
  320|  7.08k|    ZSTD_cpuid_t cpuid = ZSTD_cpuid();
  321|  7.08k|    return ZSTD_cpuid_bmi1(cpuid) && ZSTD_cpuid_bmi2(cpuid);
  ------------------
  |  Branch (321:12): [True: 7.08k, False: 0]
  |  Branch (321:38): [True: 7.08k, False: 0]
  ------------------
  322|  7.08k|}
zstd_decompress_block.c:ZSTD_wildcopy:
  217|  1.43M|{
  218|  1.43M|    ptrdiff_t diff = (BYTE*)dst - (const BYTE*)src;
  219|  1.43M|    const BYTE* ip = (const BYTE*)src;
  220|  1.43M|    BYTE* op = (BYTE*)dst;
  221|  1.43M|    BYTE* const oend = op + length;
  222|       |
  223|  1.43M|    if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) {
  ------------------
  |  |  200|   289k|#define WILDCOPY_VECLEN 16
  ------------------
  |  Branch (223:9): [True: 289k, False: 1.14M]
  |  Branch (223:50): [True: 289k, False: 195]
  ------------------
  224|       |        /* Handle short offset copies. */
  225|  6.32M|        do {
  226|  6.32M|            COPY8(op, ip);
  ------------------
  |  |  177|  6.32M|#define COPY8(d,s) do { ZSTD_copy8(d,s); d+=8; s+=8; } while (0)
  |  |  ------------------
  |  |  |  Branch (177:63): [Folded, False: 6.32M]
  |  |  ------------------
  ------------------
  227|  6.32M|        } while (op < oend);
  ------------------
  |  Branch (227:18): [True: 6.03M, False: 289k]
  ------------------
  228|  1.14M|    } else {
  229|  1.14M|        assert(diff >= WILDCOPY_VECLEN || diff <= -WILDCOPY_VECLEN);
  ------------------
  |  |   70|  1.14M|#    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|  1.14M|        ZSTD_copy16(op, ip);
  237|  1.14M|        if (16 >= length) return;
  ------------------
  |  Branch (237:13): [True: 963k, False: 181k]
  ------------------
  238|   181k|        op += 16;
  239|   181k|        ip += 16;
  240|  3.40M|        do {
  241|  3.40M|            COPY16(op, ip);
  ------------------
  |  |  197|  3.40M|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (197:67): [Folded, False: 3.40M]
  |  |  ------------------
  ------------------
  242|  3.40M|            COPY16(op, ip);
  ------------------
  |  |  197|  3.40M|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (197:67): [Folded, False: 3.40M]
  |  |  ------------------
  ------------------
  243|  3.40M|        }
  244|  3.40M|        while (op < oend);
  ------------------
  |  Branch (244:16): [True: 3.22M, False: 181k]
  ------------------
  245|   181k|    }
  246|  1.43M|}
zstd_decompress_block.c:ZSTD_copy8:
  170|  6.74M|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.74M|    ZSTD_memcpy(dst, src, 8);
  ------------------
  |  |   44|  6.74M|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  175|  6.74M|#endif
  176|  6.74M|}
zstd_decompress_block.c:ZSTD_copy16:
  183|  10.5M|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|  10.5M|}

HUF_readDTableX1_wksp:
  386|    451|{
  387|    451|    U32 tableLog = 0;
  388|    451|    U32 nbSymbols = 0;
  389|    451|    size_t iSize;
  390|    451|    void* const dtPtr = DTable + 1;
  391|    451|    HUF_DEltX1* const dt = (HUF_DEltX1*)dtPtr;
  392|    451|    HUF_ReadDTableX1_Workspace* wksp = (HUF_ReadDTableX1_Workspace*)workSpace;
  393|       |
  394|    451|    DEBUG_STATIC_ASSERT(HUF_DECOMPRESS_WORKSPACE_SIZE >= sizeof(*wksp));
  ------------------
  |  |   39|    451|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  395|    451|    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: 451]
  ------------------
  396|       |
  397|    451|    DEBUG_STATIC_ASSERT(sizeof(DTableDesc) == sizeof(HUF_DTable));
  ------------------
  |  |   39|    451|#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|    451|    iSize = HUF_readStats_wksp(wksp->huffWeight, HUF_SYMBOLVALUE_MAX + 1, wksp->rankVal, &nbSymbols, &tableLog, src, srcSize, wksp->statsWksp, sizeof(wksp->statsWksp), flags);
  ------------------
  |  |   39|    451|#define HUF_SYMBOLVALUE_MAX  255
  ------------------
  401|    451|    if (HUF_isError(iSize)) return iSize;
  ------------------
  |  |   78|    451|#define HUF_isError ERR_isError
  ------------------
  |  Branch (401:9): [True: 184, False: 267]
  ------------------
  402|       |
  403|       |
  404|       |    /* Table header */
  405|    267|    {   DTableDesc dtd = HUF_getDTableDesc(DTable);
  406|    267|        U32 const maxTableLog = dtd.maxTableLog + 1;
  407|    267|        U32 const targetTableLog = MIN(maxTableLog, HUF_DECODER_FAST_TABLELOG);
  ------------------
  |  |   54|    267|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 267]
  |  |  ------------------
  ------------------
  408|    267|        tableLog = HUF_rescaleStats(wksp->huffWeight, wksp->rankVal, nbSymbols, tableLog, targetTableLog);
  409|    267|        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: 267]
  ------------------
  410|    267|        dtd.tableType = 0;
  411|    267|        dtd.tableLog = (BYTE)tableLog;
  412|    267|        ZSTD_memcpy(DTable, &dtd, sizeof(dtd));
  ------------------
  |  |   44|    267|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  413|    267|    }
  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|    267|        U32 nextRankStart = 0;
  429|    267|        int const unroll = 4;
  430|    267|        int const nLimit = (int)nbSymbols - unroll + 1;
  431|  3.53k|        for (n=0; n<(int)tableLog+1; n++) {
  ------------------
  |  Branch (431:19): [True: 3.26k, False: 267]
  ------------------
  432|  3.26k|            U32 const curr = nextRankStart;
  433|  3.26k|            nextRankStart += wksp->rankVal[n];
  434|  3.26k|            wksp->rankStart[n] = curr;
  435|  3.26k|        }
  436|  7.93k|        for (n=0; n < nLimit; n += unroll) {
  ------------------
  |  Branch (436:19): [True: 7.67k, False: 267]
  ------------------
  437|  7.67k|            int u;
  438|  38.3k|            for (u=0; u < unroll; ++u) {
  ------------------
  |  Branch (438:23): [True: 30.6k, False: 7.67k]
  ------------------
  439|  30.6k|                size_t const w = wksp->huffWeight[n+u];
  440|  30.6k|                wksp->symbols[wksp->rankStart[w]++] = (BYTE)(n+u);
  441|  30.6k|            }
  442|  7.67k|        }
  443|    620|        for (; n < (int)nbSymbols; ++n) {
  ------------------
  |  Branch (443:16): [True: 353, False: 267]
  ------------------
  444|    353|            size_t const w = wksp->huffWeight[n];
  445|    353|            wksp->symbols[wksp->rankStart[w]++] = (BYTE)n;
  446|    353|        }
  447|    267|    }
  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|    267|    {   U32 w;
  456|    267|        int symbol = wksp->rankVal[0];
  457|    267|        int rankStart = 0;
  458|  3.26k|        for (w=1; w<tableLog+1; ++w) {
  ------------------
  |  Branch (458:19): [True: 3.00k, False: 267]
  ------------------
  459|  3.00k|            int const symbolCount = wksp->rankVal[w];
  460|  3.00k|            int const length = (1 << w) >> 1;
  461|  3.00k|            int uStart = rankStart;
  462|  3.00k|            BYTE const nbBits = (BYTE)(tableLog + 1 - w);
  463|  3.00k|            int s;
  464|  3.00k|            int u;
  465|  3.00k|            switch (length) {
  466|    267|            case 1:
  ------------------
  |  Branch (466:13): [True: 267, False: 2.73k]
  ------------------
  467|  9.40k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (467:27): [True: 9.13k, False: 267]
  ------------------
  468|  9.13k|                    HUF_DEltX1 D;
  469|  9.13k|                    D.byte = wksp->symbols[symbol + s];
  470|  9.13k|                    D.nbBits = nbBits;
  471|  9.13k|                    dt[uStart] = D;
  472|  9.13k|                    uStart += 1;
  473|  9.13k|                }
  474|    267|                break;
  475|    267|            case 2:
  ------------------
  |  Branch (475:13): [True: 267, False: 2.73k]
  ------------------
  476|  4.37k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (476:27): [True: 4.10k, False: 267]
  ------------------
  477|  4.10k|                    HUF_DEltX1 D;
  478|  4.10k|                    D.byte = wksp->symbols[symbol + s];
  479|  4.10k|                    D.nbBits = nbBits;
  480|  4.10k|                    dt[uStart+0] = D;
  481|  4.10k|                    dt[uStart+1] = D;
  482|  4.10k|                    uStart += 2;
  483|  4.10k|                }
  484|    267|                break;
  485|    267|            case 4:
  ------------------
  |  Branch (485:13): [True: 267, False: 2.73k]
  ------------------
  486|  1.59k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (486:27): [True: 1.32k, False: 267]
  ------------------
  487|  1.32k|                    U64 const D4 = HUF_DEltX1_set4(wksp->symbols[symbol + s], nbBits);
  488|  1.32k|                    MEM_write64(dt + uStart, D4);
  489|  1.32k|                    uStart += 4;
  490|  1.32k|                }
  491|    267|                break;
  492|    267|            case 8:
  ------------------
  |  Branch (492:13): [True: 267, False: 2.73k]
  ------------------
  493|  2.18k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (493:27): [True: 1.91k, False: 267]
  ------------------
  494|  1.91k|                    U64 const D4 = HUF_DEltX1_set4(wksp->symbols[symbol + s], nbBits);
  495|  1.91k|                    MEM_write64(dt + uStart, D4);
  496|  1.91k|                    MEM_write64(dt + uStart + 4, D4);
  497|  1.91k|                    uStart += 8;
  498|  1.91k|                }
  499|    267|                break;
  500|  1.93k|            default:
  ------------------
  |  Branch (500:13): [True: 1.93k, False: 1.06k]
  ------------------
  501|  8.22k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (501:27): [True: 6.29k, False: 1.93k]
  ------------------
  502|  6.29k|                    U64 const D4 = HUF_DEltX1_set4(wksp->symbols[symbol + s], nbBits);
  503|  46.2k|                    for (u=0; u < length; u += 16) {
  ------------------
  |  Branch (503:31): [True: 39.9k, False: 6.29k]
  ------------------
  504|  39.9k|                        MEM_write64(dt + uStart + u + 0, D4);
  505|  39.9k|                        MEM_write64(dt + uStart + u + 4, D4);
  506|  39.9k|                        MEM_write64(dt + uStart + u + 8, D4);
  507|  39.9k|                        MEM_write64(dt + uStart + u + 12, D4);
  508|  39.9k|                    }
  509|  6.29k|                    assert(u == length);
  ------------------
  |  |   70|  6.29k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  510|  6.29k|                    uStart += length;
  511|  6.29k|                }
  512|  1.93k|                break;
  513|  3.00k|            }
  514|  3.00k|            symbol += symbolCount;
  515|  3.00k|            rankStart += symbolCount * length;
  516|  3.00k|        }
  517|    267|    }
  518|    267|    return iSize;
  519|    267|}
HUF_readDTableX2_wksp:
 1182|    613|{
 1183|    613|    U32 tableLog, maxW, nbSymbols;
 1184|    613|    DTableDesc dtd = HUF_getDTableDesc(DTable);
 1185|    613|    U32 maxTableLog = dtd.maxTableLog;
 1186|    613|    size_t iSize;
 1187|    613|    void* dtPtr = DTable+1;   /* force compiler to avoid strict-aliasing */
 1188|    613|    HUF_DEltX2* const dt = (HUF_DEltX2*)dtPtr;
 1189|    613|    U32 *rankStart;
 1190|       |
 1191|    613|    HUF_ReadDTableX2_Workspace* const wksp = (HUF_ReadDTableX2_Workspace*)workSpace;
 1192|       |
 1193|    613|    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: 613]
  ------------------
 1194|       |
 1195|    613|    rankStart = wksp->rankStart0 + 1;
 1196|    613|    ZSTD_memset(wksp->rankStats, 0, sizeof(wksp->rankStats));
  ------------------
  |  |   46|    613|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 1197|    613|    ZSTD_memset(wksp->rankStart0, 0, sizeof(wksp->rankStart0));
  ------------------
  |  |   46|    613|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 1198|       |
 1199|    613|    DEBUG_STATIC_ASSERT(sizeof(HUF_DEltX2) == sizeof(HUF_DTable));   /* if compiler fails here, assertion is wrong */
  ------------------
  |  |   39|    613|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
 1200|    613|    if (maxTableLog > HUF_TABLELOG_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   37|    613|#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: 613]
  ------------------
 1201|       |    /* ZSTD_memset(weightList, 0, sizeof(weightList)); */  /* is not necessary, even though some analyzer complain ... */
 1202|       |
 1203|    613|    iSize = HUF_readStats_wksp(wksp->weightList, HUF_SYMBOLVALUE_MAX + 1, wksp->rankStats, &nbSymbols, &tableLog, src, srcSize, wksp->calleeWksp, sizeof(wksp->calleeWksp), flags);
  ------------------
  |  |   39|    613|#define HUF_SYMBOLVALUE_MAX  255
  ------------------
 1204|    613|    if (HUF_isError(iSize)) return iSize;
  ------------------
  |  |   78|    613|#define HUF_isError ERR_isError
  ------------------
  |  Branch (1204:9): [True: 155, False: 458]
  ------------------
 1205|       |
 1206|       |    /* check result */
 1207|    458|    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: 458]
  ------------------
 1208|    458|    if (tableLog <= HUF_DECODER_FAST_TABLELOG && maxTableLog > HUF_DECODER_FAST_TABLELOG) maxTableLog = HUF_DECODER_FAST_TABLELOG;
  ------------------
  |  |   31|    916|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
                  if (tableLog <= HUF_DECODER_FAST_TABLELOG && maxTableLog > HUF_DECODER_FAST_TABLELOG) maxTableLog = HUF_DECODER_FAST_TABLELOG;
  ------------------
  |  |   31|    362|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
                  if (tableLog <= HUF_DECODER_FAST_TABLELOG && maxTableLog > HUF_DECODER_FAST_TABLELOG) maxTableLog = HUF_DECODER_FAST_TABLELOG;
  ------------------
  |  |   31|    362|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
  |  Branch (1208:9): [True: 362, False: 96]
  |  Branch (1208:50): [True: 362, False: 0]
  ------------------
 1209|       |
 1210|       |    /* find maxWeight */
 1211|    958|    for (maxW = tableLog; wksp->rankStats[maxW]==0; maxW--) {}  /* necessarily finds a solution before 0 */
  ------------------
  |  Branch (1211:27): [True: 500, False: 458]
  ------------------
 1212|       |
 1213|       |    /* Get start index of each weight */
 1214|    458|    {   U32 w, nextRankStart = 0;
 1215|  3.89k|        for (w=1; w<maxW+1; w++) {
  ------------------
  |  Branch (1215:19): [True: 3.43k, False: 458]
  ------------------
 1216|  3.43k|            U32 curr = nextRankStart;
 1217|  3.43k|            nextRankStart += wksp->rankStats[w];
 1218|  3.43k|            rankStart[w] = curr;
 1219|  3.43k|        }
 1220|    458|        rankStart[0] = nextRankStart;   /* put all 0w symbols at the end of sorted list*/
 1221|    458|        rankStart[maxW+1] = nextRankStart;
 1222|    458|    }
 1223|       |
 1224|       |    /* sort symbols by weight */
 1225|    458|    {   U32 s;
 1226|  61.1k|        for (s=0; s<nbSymbols; s++) {
  ------------------
  |  Branch (1226:19): [True: 60.7k, False: 458]
  ------------------
 1227|  60.7k|            U32 const w = wksp->weightList[s];
 1228|  60.7k|            U32 const r = rankStart[w]++;
 1229|  60.7k|            wksp->sortedSymbol[r].symbol = (BYTE)s;
 1230|  60.7k|        }
 1231|    458|        rankStart[0] = 0;   /* forget 0w symbols; this is beginning of weight(1) */
 1232|    458|    }
 1233|       |
 1234|       |    /* Build rankVal */
 1235|    458|    {   U32* const rankVal0 = wksp->rankVal[0];
 1236|    458|        {   int const rescale = (maxTableLog-tableLog) - 1;   /* tableLog <= maxTableLog */
 1237|    458|            U32 nextRankVal = 0;
 1238|    458|            U32 w;
 1239|  3.89k|            for (w=1; w<maxW+1; w++) {
  ------------------
  |  Branch (1239:23): [True: 3.43k, False: 458]
  ------------------
 1240|  3.43k|                U32 curr = nextRankVal;
 1241|  3.43k|                nextRankVal += wksp->rankStats[w] << (w+rescale);
 1242|  3.43k|                rankVal0[w] = curr;
 1243|  3.43k|        }   }
 1244|    458|        {   U32 const minBits = tableLog+1 - maxW;
 1245|    458|            U32 consumed;
 1246|  4.14k|            for (consumed = minBits; consumed < maxTableLog - minBits + 1; consumed++) {
  ------------------
  |  Branch (1246:38): [True: 3.68k, False: 458]
  ------------------
 1247|  3.68k|                U32* const rankValPtr = wksp->rankVal[consumed];
 1248|  3.68k|                U32 w;
 1249|  34.3k|                for (w = 1; w < maxW+1; w++) {
  ------------------
  |  Branch (1249:29): [True: 30.6k, False: 3.68k]
  ------------------
 1250|  30.6k|                    rankValPtr[w] = rankVal0[w] >> consumed;
 1251|  30.6k|    }   }   }   }
 1252|       |
 1253|    458|    HUF_fillDTableX2(dt, maxTableLog,
 1254|    458|                   wksp->sortedSymbol,
 1255|    458|                   wksp->rankStart0, wksp->rankVal, maxW,
 1256|    458|                   tableLog+1);
 1257|       |
 1258|    458|    dtd.tableLog = (BYTE)maxTableLog;
 1259|    458|    dtd.tableType = 1;
 1260|    458|    ZSTD_memcpy(DTable, &dtd, sizeof(dtd));
  ------------------
  |  |   44|    458|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1261|    458|    return iSize;
 1262|    458|}
HUF_selectDecoder:
 1822|    513|{
 1823|    513|    assert(dstSize > 0);
  ------------------
  |  |   70|    513|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1824|    513|    assert(dstSize <= 128*1024);
  ------------------
  |  |   70|    513|#    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|    513|    {   U32 const Q = (cSrcSize >= dstSize) ? 15 : (U32)(cSrcSize * 16 / dstSize);   /* Q < 16 */
  ------------------
  |  Branch (1835:23): [True: 21, False: 492]
  ------------------
 1836|    513|        U32 const D256 = (U32)(dstSize >> 8);
 1837|    513|        U32 const DTime0 = algoTime[Q][0].tableTime + (algoTime[Q][0].decode256Time * D256);
 1838|    513|        U32 DTime1 = algoTime[Q][1].tableTime + (algoTime[Q][1].decode256Time * D256);
 1839|    513|        DTime1 += DTime1 >> 5;  /* small advantage to algorithm using less memory, to reduce cache eviction */
 1840|    513|        return DTime1 < DTime0;
 1841|    513|    }
 1842|    513|#endif
 1843|    513|}
HUF_decompress1X1_DCtx_wksp:
 1895|    171|{
 1896|    171|    const BYTE* ip = (const BYTE*) cSrc;
 1897|       |
 1898|    171|    size_t const hSize = HUF_readDTableX1_wksp(dctx, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1899|    171|    if (HUF_isError(hSize)) return hSize;
  ------------------
  |  |   78|    171|#define HUF_isError ERR_isError
  ------------------
  |  Branch (1899:9): [True: 117, False: 54]
  ------------------
 1900|     54|    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: 53]
  ------------------
 1901|     53|    ip += hSize; cSrcSize -= hSize;
 1902|       |
 1903|     53|    return HUF_decompress1X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, flags);
 1904|     54|}
HUF_decompress4X_hufOnly_wksp:
 1925|    526|{
 1926|       |    /* validation checks */
 1927|    526|    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: 526]
  ------------------
 1928|    526|    if (cSrcSize == 0) 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 (1928:9): [True: 13, False: 513]
  ------------------
 1929|       |
 1930|    513|    {   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|    513|        return algoNb ? HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags) :
  ------------------
  |  Branch (1940:16): [True: 233, False: 280]
  ------------------
 1941|    513|                        HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1942|    526|#endif
 1943|    526|    }
 1944|    526|}
huf_decompress.c:HUF_getDTableDesc:
  144|  1.62k|{
  145|  1.62k|    DTableDesc dtd;
  146|  1.62k|    ZSTD_memcpy(&dtd, table, sizeof(dtd));
  ------------------
  |  |   44|  1.62k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  147|  1.62k|    return dtd;
  148|  1.62k|}
huf_decompress.c:HUF_rescaleStats:
  353|    267|{
  354|    267|    if (tableLog > targetTableLog)
  ------------------
  |  Branch (354:9): [True: 64, False: 203]
  ------------------
  355|     64|        return tableLog;
  356|    203|    if (tableLog < targetTableLog) {
  ------------------
  |  Branch (356:9): [True: 149, False: 54]
  ------------------
  357|    149|        U32 const scale = targetTableLog - tableLog;
  358|    149|        U32 s;
  359|       |        /* Increase the weight for all non-zero probability symbols by scale. */
  360|  14.6k|        for (s = 0; s < nbSymbols; ++s) {
  ------------------
  |  Branch (360:21): [True: 14.5k, False: 149]
  ------------------
  361|  14.5k|            huffWeight[s] += (BYTE)((huffWeight[s] == 0) ? 0 : scale);
  ------------------
  |  Branch (361:37): [True: 5.94k, False: 8.57k]
  ------------------
  362|  14.5k|        }
  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|  1.13k|        for (s = targetTableLog; s > scale; --s) {
  ------------------
  |  Branch (367:34): [True: 989, False: 149]
  ------------------
  368|    989|            rankVal[s] = rankVal[s - scale];
  369|    989|        }
  370|    799|        for (s = scale; s > 0; --s) {
  ------------------
  |  Branch (370:25): [True: 650, False: 149]
  ------------------
  371|    650|            rankVal[s] = 0;
  372|    650|        }
  373|    149|    }
  374|    203|    return targetTableLog;
  375|    267|}
huf_decompress.c:HUF_DEltX1_set4:
  335|  9.53k|static U64 HUF_DEltX1_set4(BYTE symbol, BYTE nbBits) {
  336|  9.53k|    U64 D4;
  337|  9.53k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (337:9): [True: 9.53k, False: 0]
  ------------------
  338|  9.53k|        D4 = (U64)((symbol << 8) + nbBits);
  339|  9.53k|    } else {
  340|      0|        D4 = (U64)(symbol + (nbBits << 8));
  341|      0|    }
  342|  9.53k|    assert(D4 < (1U << 16));
  ------------------
  |  |   70|  9.53k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  343|  9.53k|    D4 *= 0x0001000100010001ULL;
  344|  9.53k|    return D4;
  345|  9.53k|}
huf_decompress.c:HUF_fillDTableX2:
 1128|    458|{
 1129|    458|    U32* const rankVal = rankValOrigin[0];
 1130|    458|    const int scaleLog = nbBitsBaseline - targetLog;   /* note : targetLog >= srcLog, hence scaleLog <= 1 */
 1131|    458|    const U32 minBits  = nbBitsBaseline - maxWeight;
 1132|    458|    int w;
 1133|    458|    int const wEnd = (int)maxWeight + 1;
 1134|       |
 1135|       |    /* Fill DTable in order of weight. */
 1136|  3.89k|    for (w = 1; w < wEnd; ++w) {
  ------------------
  |  Branch (1136:17): [True: 3.43k, False: 458]
  ------------------
 1137|  3.43k|        int const begin = (int)rankStart[w];
 1138|  3.43k|        int const end = (int)rankStart[w+1];
 1139|  3.43k|        U32 const nbBits = nbBitsBaseline - w;
 1140|       |
 1141|  3.43k|        if (targetLog-nbBits >= minBits) {
  ------------------
  |  Branch (1141:13): [True: 3.06k, False: 367]
  ------------------
 1142|       |            /* Enough room for a second symbol. */
 1143|  3.06k|            int start = rankVal[w];
 1144|  3.06k|            U32 const length = 1U << ((targetLog - nbBits) & 0x1F /* quiet static-analyzer */);
 1145|  3.06k|            int minWeight = nbBits + scaleLog;
 1146|  3.06k|            int s;
 1147|  3.06k|            if (minWeight < 1) minWeight = 1;
  ------------------
  |  Branch (1147:17): [True: 441, False: 2.62k]
  ------------------
 1148|       |            /* Fill the DTable for every symbol of weight w.
 1149|       |             * These symbols get at least 1 second symbol.
 1150|       |             */
 1151|  22.5k|            for (s = begin; s != end; ++s) {
  ------------------
  |  Branch (1151:29): [True: 19.5k, False: 3.06k]
  ------------------
 1152|  19.5k|                HUF_fillDTableX2Level2(
 1153|  19.5k|                    DTable + start, targetLog, nbBits,
 1154|  19.5k|                    rankValOrigin[nbBits], minWeight, wEnd,
 1155|  19.5k|                    sortedList, rankStart,
 1156|  19.5k|                    nbBitsBaseline, sortedList[s].symbol);
 1157|  19.5k|                start += length;
 1158|  19.5k|            }
 1159|  3.06k|        } else {
 1160|       |            /* Only a single symbol. */
 1161|    367|            HUF_fillDTableX2ForWeight(
 1162|    367|                DTable + rankVal[w],
 1163|    367|                sortedList + begin, sortedList + end,
 1164|    367|                nbBits, targetLog,
 1165|    367|                /* baseSeq */ 0, /* level */ 1);
 1166|    367|        }
 1167|  3.43k|    }
 1168|    458|}
huf_decompress.c:HUF_fillDTableX2Level2:
 1073|  19.5k|{
 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|  19.5k|    if (minWeight>1) {
  ------------------
  |  Branch (1078:9): [True: 18.3k, False: 1.19k]
  ------------------
 1079|  18.3k|        U32 const length = 1U << ((targetLog - consumedBits) & 0x1F /* quiet static-analyzer */);
 1080|  18.3k|        U64 const DEltX2 = HUF_buildDEltX2U64(baseSeq, consumedBits, /* baseSeq */ 0, /* level */ 1);
 1081|  18.3k|        int const skipSize = rankVal[minWeight];
 1082|  18.3k|        assert(length > 1);
  ------------------
  |  |   70|  18.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1083|  18.3k|        assert((U32)skipSize < length);
  ------------------
  |  |   70|  18.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1084|  18.3k|        switch (length) {
 1085|  4.82k|        case 2:
  ------------------
  |  Branch (1085:9): [True: 4.82k, False: 13.4k]
  ------------------
 1086|  4.82k|            assert(skipSize == 1);
  ------------------
  |  |   70|  4.82k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1087|  4.82k|            ZSTD_memcpy(DTable, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  4.82k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1088|  4.82k|            break;
 1089|    828|        case 4:
  ------------------
  |  Branch (1089:9): [True: 828, False: 17.4k]
  ------------------
 1090|    828|            assert(skipSize <= 4);
  ------------------
  |  |   70|    828|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1091|    828|            ZSTD_memcpy(DTable + 0, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|    828|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1092|    828|            ZSTD_memcpy(DTable + 2, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|    828|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1093|    828|            break;
 1094|  12.6k|        default:
  ------------------
  |  Branch (1094:9): [True: 12.6k, False: 5.64k]
  ------------------
 1095|  12.6k|            {
 1096|  12.6k|                int i;
 1097|  34.9k|                for (i = 0; i < skipSize; i += 8) {
  ------------------
  |  Branch (1097:29): [True: 22.2k, False: 12.6k]
  ------------------
 1098|  22.2k|                    ZSTD_memcpy(DTable + i + 0, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  22.2k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1099|  22.2k|                    ZSTD_memcpy(DTable + i + 2, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  22.2k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1100|  22.2k|                    ZSTD_memcpy(DTable + i + 4, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  22.2k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1101|  22.2k|                    ZSTD_memcpy(DTable + i + 6, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  22.2k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1102|  22.2k|                }
 1103|  12.6k|            }
 1104|  18.3k|        }
 1105|  18.3k|    }
 1106|       |
 1107|       |    /* Fill each of the second level symbols by weight. */
 1108|  19.5k|    {
 1109|  19.5k|        int w;
 1110|  73.6k|        for (w = minWeight; w < maxWeight1; ++w) {
  ------------------
  |  Branch (1110:29): [True: 54.1k, False: 19.5k]
  ------------------
 1111|  54.1k|            int const begin = rankStart[w];
 1112|  54.1k|            int const end = rankStart[w+1];
 1113|  54.1k|            U32 const nbBits = nbBitsBaseline - w;
 1114|  54.1k|            U32 const totalBits = nbBits + consumedBits;
 1115|  54.1k|            HUF_fillDTableX2ForWeight(
 1116|  54.1k|                DTable + rankVal[w],
 1117|  54.1k|                sortedSymbols + begin, sortedSymbols + end,
 1118|  54.1k|                totalBits, targetLog,
 1119|  54.1k|                baseSeq, /* level */ 2);
 1120|  54.1k|        }
 1121|  19.5k|    }
 1122|  19.5k|}
huf_decompress.c:HUF_buildDEltX2U64:
  993|  68.1k|{
  994|  68.1k|    U32 DElt = HUF_buildDEltX2U32(symbol, nbBits, baseSeq, level);
  995|  68.1k|    return (U64)DElt + ((U64)DElt << 32);
  996|  68.1k|}
huf_decompress.c:HUF_buildDEltX2U32:
  962|   151k|{
  963|   151k|    U32 seq;
  964|   151k|    DEBUG_STATIC_ASSERT(offsetof(HUF_DEltX2, sequence) == 0);
  ------------------
  |  |   39|   151k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  965|   151k|    DEBUG_STATIC_ASSERT(offsetof(HUF_DEltX2, nbBits) == 2);
  ------------------
  |  |   39|   151k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  966|   151k|    DEBUG_STATIC_ASSERT(offsetof(HUF_DEltX2, length) == 3);
  ------------------
  |  |   39|   151k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  967|   151k|    DEBUG_STATIC_ASSERT(sizeof(HUF_DEltX2) == sizeof(U32));
  ------------------
  |  |   39|   151k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  968|   151k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (968:9): [True: 151k, False: 0]
  ------------------
  969|   151k|        seq = level == 1 ? symbol : (baseSeq + (symbol << 8));
  ------------------
  |  Branch (969:15): [True: 40.1k, False: 110k]
  ------------------
  970|   151k|        return seq + (nbBits << 16) + ((U32)level << 24);
  971|   151k|    } 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|   151k|}
huf_decompress.c:HUF_fillDTableX2ForWeight:
 1015|  54.4k|{
 1016|  54.4k|    U32 const length = 1U << ((tableLog - nbBits) & 0x1F /* quiet static-analyzer */);
 1017|  54.4k|    const sortedSymbol_t* ptr;
 1018|  54.4k|    assert(level >= 1 && level <= 2);
  ------------------
  |  |   70|  54.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1019|  54.4k|    switch (length) {
 1020|  18.7k|    case 1:
  ------------------
  |  Branch (1020:5): [True: 18.7k, False: 35.7k]
  ------------------
 1021|  71.0k|        for (ptr = begin; ptr != end; ++ptr) {
  ------------------
  |  Branch (1021:27): [True: 52.2k, False: 18.7k]
  ------------------
 1022|  52.2k|            HUF_DEltX2 const DElt = HUF_buildDEltX2(ptr->symbol, nbBits, baseSeq, level);
 1023|  52.2k|            *DTableRank++ = DElt;
 1024|  52.2k|        }
 1025|  18.7k|        break;
 1026|  12.2k|    case 2:
  ------------------
  |  Branch (1026:5): [True: 12.2k, False: 42.2k]
  ------------------
 1027|  42.8k|        for (ptr = begin; ptr != end; ++ptr) {
  ------------------
  |  Branch (1027:27): [True: 30.6k, False: 12.2k]
  ------------------
 1028|  30.6k|            HUF_DEltX2 const DElt = HUF_buildDEltX2(ptr->symbol, nbBits, baseSeq, level);
 1029|  30.6k|            DTableRank[0] = DElt;
 1030|  30.6k|            DTableRank[1] = DElt;
 1031|  30.6k|            DTableRank += 2;
 1032|  30.6k|        }
 1033|  12.2k|        break;
 1034|  9.65k|    case 4:
  ------------------
  |  Branch (1034:5): [True: 9.65k, False: 44.8k]
  ------------------
 1035|  33.0k|        for (ptr = begin; ptr != end; ++ptr) {
  ------------------
  |  Branch (1035:27): [True: 23.3k, False: 9.65k]
  ------------------
 1036|  23.3k|            U64 const DEltX2 = HUF_buildDEltX2U64(ptr->symbol, nbBits, baseSeq, level);
 1037|  23.3k|            ZSTD_memcpy(DTableRank + 0, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  23.3k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1038|  23.3k|            ZSTD_memcpy(DTableRank + 2, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  23.3k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1039|  23.3k|            DTableRank += 4;
 1040|  23.3k|        }
 1041|  9.65k|        break;
 1042|  6.69k|    case 8:
  ------------------
  |  Branch (1042:5): [True: 6.69k, False: 47.7k]
  ------------------
 1043|  21.7k|        for (ptr = begin; ptr != end; ++ptr) {
  ------------------
  |  Branch (1043:27): [True: 15.0k, False: 6.69k]
  ------------------
 1044|  15.0k|            U64 const DEltX2 = HUF_buildDEltX2U64(ptr->symbol, nbBits, baseSeq, level);
 1045|  15.0k|            ZSTD_memcpy(DTableRank + 0, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  15.0k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1046|  15.0k|            ZSTD_memcpy(DTableRank + 2, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  15.0k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1047|  15.0k|            ZSTD_memcpy(DTableRank + 4, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  15.0k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1048|  15.0k|            ZSTD_memcpy(DTableRank + 6, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  15.0k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1049|  15.0k|            DTableRank += 8;
 1050|  15.0k|        }
 1051|  6.69k|        break;
 1052|  7.15k|    default:
  ------------------
  |  Branch (1052:5): [True: 7.15k, False: 47.3k]
  ------------------
 1053|  18.5k|        for (ptr = begin; ptr != end; ++ptr) {
  ------------------
  |  Branch (1053:27): [True: 11.4k, False: 7.15k]
  ------------------
 1054|  11.4k|            U64 const DEltX2 = HUF_buildDEltX2U64(ptr->symbol, nbBits, baseSeq, level);
 1055|  11.4k|            HUF_DEltX2* const DTableRankEnd = DTableRank + length;
 1056|  93.5k|            for (; DTableRank != DTableRankEnd; DTableRank += 8) {
  ------------------
  |  Branch (1056:20): [True: 82.1k, False: 11.4k]
  ------------------
 1057|  82.1k|                ZSTD_memcpy(DTableRank + 0, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  82.1k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1058|  82.1k|                ZSTD_memcpy(DTableRank + 2, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  82.1k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1059|  82.1k|                ZSTD_memcpy(DTableRank + 4, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  82.1k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1060|  82.1k|                ZSTD_memcpy(DTableRank + 6, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  82.1k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1061|  82.1k|            }
 1062|  11.4k|        }
 1063|  7.15k|        break;
 1064|  54.4k|    }
 1065|  54.4k|}
huf_decompress.c:HUF_buildDEltX2:
  981|  82.8k|{
  982|  82.8k|    HUF_DEltX2 DElt;
  983|  82.8k|    U32 const val = HUF_buildDEltX2U32(symbol, nbBits, baseSeq, level);
  984|  82.8k|    DEBUG_STATIC_ASSERT(sizeof(DElt) == sizeof(val));
  ------------------
  |  |   39|  82.8k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  985|  82.8k|    ZSTD_memcpy(&DElt, &val, sizeof(val));
  ------------------
  |  |   44|  82.8k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  986|  82.8k|    return DElt;
  987|  82.8k|}
huf_decompress.c:HUF_decodeStreamX2:
 1310|    690|{
 1311|    690|    BYTE* const pStart = p;
 1312|       |
 1313|       |    /* up to 8 symbols at a time */
 1314|    690|    if ((size_t)(pEnd - p) >= sizeof(bitDPtr->bitContainer)) {
  ------------------
  |  Branch (1314:9): [True: 641, False: 49]
  ------------------
 1315|    641|        if (dtLog <= 11 && MEM_64bits()) {
  ------------------
  |  Branch (1315:13): [True: 380, False: 261]
  |  Branch (1315:28): [True: 380, False: 0]
  ------------------
 1316|       |            /* up to 10 symbols at a time */
 1317|  13.6k|            while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-9)) {
  ------------------
  |  Branch (1317:20): [True: 13.2k, False: 380]
  ------------------
 1318|  13.2k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1293|  13.2k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 13.2k]
  |  |  ------------------
  ------------------
 1319|  13.2k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1293|  13.2k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 13.2k]
  |  |  ------------------
  ------------------
 1320|  13.2k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1293|  13.2k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 13.2k]
  |  |  ------------------
  ------------------
 1321|  13.2k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1293|  13.2k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 13.2k]
  |  |  ------------------
  ------------------
 1322|  13.2k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1293|  13.2k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 13.2k]
  |  |  ------------------
  ------------------
 1323|  13.2k|            }
 1324|    380|        } else {
 1325|       |            /* up to 8 symbols at a time */
 1326|  5.66k|            while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-(sizeof(bitDPtr->bitContainer)-1))) {
  ------------------
  |  Branch (1326:20): [True: 5.40k, False: 261]
  ------------------
 1327|  5.40k|                HUF_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 1302|  5.40k|    do {                                                           \
  |  | 1303|  5.40k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 5.40k, False: 0]
  |  |  ------------------
  |  | 1304|  5.40k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  5.40k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 5.40k]
  |  |  ------------------
  ------------------
 1328|  5.40k|                HUF_DECODE_SYMBOLX2_1(p, bitDPtr);
  ------------------
  |  | 1296|  5.40k|    do {                                                           \
  |  | 1297|  5.40k|        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.40k, False: 0]
  |  |  |  Branch (1297:29): [True: 0, Folded]
  |  |  ------------------
  |  | 1298|  5.40k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1299|  5.40k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1299:14): [Folded, False: 5.40k]
  |  |  ------------------
  ------------------
 1329|  5.40k|                HUF_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 1302|  5.40k|    do {                                                           \
  |  | 1303|  5.40k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 5.40k, False: 0]
  |  |  ------------------
  |  | 1304|  5.40k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  5.40k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 5.40k]
  |  |  ------------------
  ------------------
 1330|  5.40k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1293|  5.40k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 5.40k]
  |  |  ------------------
  ------------------
 1331|  5.40k|            }
 1332|    261|        }
 1333|    641|    } else {
 1334|     49|        BIT_reloadDStream(bitDPtr);
 1335|     49|    }
 1336|       |
 1337|       |    /* closer to end : up to 2 symbols at a time */
 1338|    690|    if ((size_t)(pEnd - p) >= 2) {
  ------------------
  |  Branch (1338:9): [True: 646, False: 44]
  ------------------
 1339|  1.22k|        while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p <= pEnd-2))
  ------------------
  |  Branch (1339:16): [True: 575, False: 646]
  ------------------
 1340|    575|            HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1293|    575|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 575]
  |  |  ------------------
  ------------------
 1341|       |
 1342|   155k|        while (p <= pEnd-2)
  ------------------
  |  Branch (1342:16): [True: 155k, False: 646]
  ------------------
 1343|   155k|            HUF_DECODE_SYMBOLX2_0(p, bitDPtr);   /* no need to reload : reached the end of DStream */
  ------------------
  |  | 1293|   155k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 155k]
  |  |  ------------------
  ------------------
 1344|    646|    }
 1345|       |
 1346|    690|    if (p < pEnd)
  ------------------
  |  Branch (1346:9): [True: 443, False: 247]
  ------------------
 1347|    443|        p += HUF_decodeLastSymbolX2(p, bitDPtr, dt, dtLog);
 1348|       |
 1349|    690|    return p-pStart;
 1350|    690|}
huf_decompress.c:HUF_decodeSymbolX2:
 1267|   293k|{
 1268|   293k|    size_t const val = BIT_lookBitsFast(DStream, dtLog);   /* note : dtLog >= 1 */
 1269|   293k|    ZSTD_memcpy(op, &dt[val].sequence, 2);
  ------------------
  |  |   44|   293k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1270|   293k|    BIT_skipBits(DStream, dt[val].nbBits);
 1271|   293k|    return dt[val].length;
 1272|   293k|}
huf_decompress.c:HUF_decodeLastSymbolX2:
 1276|    443|{
 1277|    443|    size_t const val = BIT_lookBitsFast(DStream, dtLog);   /* note : dtLog >= 1 */
 1278|    443|    ZSTD_memcpy(op, &dt[val].sequence, 1);
  ------------------
  |  |   44|    443|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1279|    443|    if (dt[val].length==1) {
  ------------------
  |  Branch (1279:9): [True: 209, False: 234]
  ------------------
 1280|    209|        BIT_skipBits(DStream, dt[val].nbBits);
 1281|    234|    } else {
 1282|    234|        if (DStream->bitsConsumed < (sizeof(DStream->bitContainer)*8)) {
  ------------------
  |  Branch (1282:13): [True: 119, False: 115]
  ------------------
 1283|    119|            BIT_skipBits(DStream, dt[val].nbBits);
 1284|    119|            if (DStream->bitsConsumed > (sizeof(DStream->bitContainer)*8))
  ------------------
  |  Branch (1284:17): [True: 4, False: 115]
  ------------------
 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|    119|        }
 1288|    234|    }
 1289|    443|    return 1;
 1290|    443|}
huf_decompress.c:HUF_decompress1X1_usingDTable_internal:
  118|     53|    {                                                                       \
  119|     53|        if (flags & HUF_flags_bmi2) {                                       \
  ------------------
  |  Branch (119:13): [True: 53, False: 0]
  ------------------
  120|     53|            return fn##_bmi2(dst, dstSize, cSrc, cSrcSize, DTable);         \
  121|     53|        }                                                                   \
  122|     53|        return fn##_default(dst, dstSize, cSrc, cSrcSize, DTable);          \
  123|     53|    }
huf_decompress.c:HUF_decompress1X1_usingDTable_internal_bmi2:
  112|     53|    {                                                                       \
  113|     53|        return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable);             \
  114|     53|    }                                                                       \
huf_decompress.c:HUF_decompress1X1_usingDTable_internal_body:
  579|     53|{
  580|     53|    BYTE* op = (BYTE*)dst;
  581|     53|    BYTE* const oend = ZSTD_maybeNullPtrAdd(op, dstSize);
  582|     53|    const void* dtPtr = DTable + 1;
  583|     53|    const HUF_DEltX1* const dt = (const HUF_DEltX1*)dtPtr;
  584|     53|    BIT_DStream_t bitD;
  585|     53|    DTableDesc const dtd = HUF_getDTableDesc(DTable);
  586|     53|    U32 const dtLog = dtd.tableLog;
  587|       |
  588|     53|    CHECK_F( BIT_initDStream(&bitD, cSrc, cSrcSize) );
  ------------------
  |  |   63|     53|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|     53|    size_t const e = f;     \
  |  |  |  |   59|     53|    do {                    \
  |  |  |  |   60|     53|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 6, False: 47]
  |  |  |  |  ------------------
  |  |  |  |   61|     53|            return e;       \
  |  |  |  |   62|     53|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 47]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 47]
  |  |  ------------------
  ------------------
  589|       |
  590|     47|    HUF_decodeStreamX1(op, &bitD, oend, dt, dtLog);
  591|       |
  592|     47|    if (!BIT_endOfDStream(&bitD)) return ERROR(corruption_detected);
  ------------------
  |  |   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 (592:9): [True: 46, False: 1]
  ------------------
  593|       |
  594|      1|    return dstSize;
  595|     47|}
huf_decompress.c:HUF_decodeStreamX1:
  547|    553|{
  548|    553|    BYTE* const pStart = p;
  549|       |
  550|       |    /* up to 4 symbols at a time */
  551|    553|    if ((pEnd - p) > 3) {
  ------------------
  |  Branch (551:9): [True: 465, False: 88]
  ------------------
  552|  30.6k|        while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-3)) {
  ------------------
  |  Branch (552:16): [True: 30.1k, False: 465]
  ------------------
  553|  30.1k|            HUF_DECODE_SYMBOLX1_2(p, bitDPtr);
  ------------------
  |  |  540|  30.1k|    do {                                            \
  |  |  541|  30.1k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 30.1k, False: 0]
  |  |  ------------------
  |  |  542|  30.1k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  30.1k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 30.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  30.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 30.1k]
  |  |  ------------------
  ------------------
  554|  30.1k|            HUF_DECODE_SYMBOLX1_1(p, bitDPtr);
  ------------------
  |  |  534|  30.1k|    do {                                            \
  |  |  535|  30.1k|        if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |   37|      0|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  |  |  ------------------
  |  |  |  Branch (535:13): [True: 30.1k, False: 0]
  |  |  |  Branch (535:29): [True: 0, Folded]
  |  |  ------------------
  |  |  536|  30.1k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  30.1k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 30.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  537|  30.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (537:14): [Folded, False: 30.1k]
  |  |  ------------------
  ------------------
  555|  30.1k|            HUF_DECODE_SYMBOLX1_2(p, bitDPtr);
  ------------------
  |  |  540|  30.1k|    do {                                            \
  |  |  541|  30.1k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 30.1k, False: 0]
  |  |  ------------------
  |  |  542|  30.1k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  30.1k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 30.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  30.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 30.1k]
  |  |  ------------------
  ------------------
  556|  30.1k|            HUF_DECODE_SYMBOLX1_0(p, bitDPtr);
  ------------------
  |  |  531|  30.1k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (531:71): [Folded, False: 30.1k]
  |  |  ------------------
  ------------------
  557|  30.1k|        }
  558|    465|    } else {
  559|     88|        BIT_reloadDStream(bitDPtr);
  560|     88|    }
  561|       |
  562|       |    /* [0-3] symbols remaining */
  563|    553|    if (MEM_32bits())
  ------------------
  |  Branch (563:9): [True: 0, False: 553]
  ------------------
  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|   627k|    while (p < pEnd)
  ------------------
  |  Branch (568:12): [True: 626k, False: 553]
  ------------------
  569|   626k|        HUF_DECODE_SYMBOLX1_0(p, bitDPtr);
  ------------------
  |  |  531|   626k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (531:71): [Folded, False: 626k]
  |  |  ------------------
  ------------------
  570|       |
  571|    553|    return (size_t)(pEnd-pStart);
  572|    553|}
huf_decompress.c:HUF_decodeSymbolX1:
  523|   803k|{
  524|   803k|    size_t const val = BIT_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */
  525|   803k|    BYTE const c = dt[val].byte;
  526|   803k|    BIT_skipBits(Dstream, dt[val].nbBits);
  527|   803k|    return c;
  528|   803k|}
huf_decompress.c:HUF_decompress4X2_usingDTable_internal:
 1721|    215|{
 1722|    215|    HUF_DecompressUsingDTableFn fallbackFn = HUF_decompress4X2_usingDTable_internal_default;
 1723|    215|    HUF_DecompressFastLoopFn loopFn = HUF_decompress4X2_usingDTable_internal_fast_c_loop;
 1724|       |
 1725|    215|#if DYNAMIC_BMI2
 1726|    215|    if (flags & HUF_flags_bmi2) {
  ------------------
  |  Branch (1726:9): [True: 215, False: 0]
  ------------------
 1727|    215|        fallbackFn = HUF_decompress4X2_usingDTable_internal_bmi2;
 1728|    215|# if ZSTD_ENABLE_ASM_X86_64_BMI2
 1729|    215|        if (!(flags & HUF_flags_disableAsm)) {
  ------------------
  |  Branch (1729:13): [True: 215, False: 0]
  ------------------
 1730|    215|            loopFn = HUF_decompress4X2_usingDTable_internal_fast_asm_loop;
 1731|    215|        }
 1732|    215|# endif
 1733|    215|    } else {
 1734|      0|        return fallbackFn(dst, dstSize, cSrc, cSrcSize, DTable);
 1735|      0|    }
 1736|    215|#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|    215|    if (HUF_ENABLE_FAST_DECODE && !(flags & HUF_flags_disableFast)) {
  ------------------
  |  |   40|    430|# define HUF_ENABLE_FAST_DECODE 1
  |  |  ------------------
  |  |  |  Branch (40:33): [True: 215, Folded]
  |  |  ------------------
  ------------------
  |  Branch (1744:35): [True: 215, False: 0]
  ------------------
 1745|    215|        size_t const ret = HUF_decompress4X2_usingDTable_internal_fast(dst, dstSize, cSrc, cSrcSize, DTable, loopFn);
 1746|    215|        if (ret != 0)
  ------------------
  |  Branch (1746:13): [True: 62, False: 153]
  ------------------
 1747|     62|            return ret;
 1748|    215|    }
 1749|    153|    return fallbackFn(dst, dstSize, cSrc, cSrcSize, DTable);
 1750|    215|}
huf_decompress.c:HUF_decompress4X2_usingDTable_internal_body:
 1388|    153|{
 1389|    153|    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: 153]
  ------------------
 1390|    153|    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: 153]
  ------------------
 1391|       |
 1392|    153|    {   const BYTE* const istart = (const BYTE*) cSrc;
 1393|    153|        BYTE* const ostart = (BYTE*) dst;
 1394|    153|        BYTE* const oend = ostart + dstSize;
 1395|    153|        BYTE* const olimit = oend - (sizeof(size_t)-1);
 1396|    153|        const void* const dtPtr = DTable+1;
 1397|    153|        const HUF_DEltX2* const dt = (const HUF_DEltX2*)dtPtr;
 1398|       |
 1399|       |        /* Init */
 1400|    153|        BIT_DStream_t bitD1;
 1401|    153|        BIT_DStream_t bitD2;
 1402|    153|        BIT_DStream_t bitD3;
 1403|    153|        BIT_DStream_t bitD4;
 1404|    153|        size_t const length1 = MEM_readLE16(istart);
 1405|    153|        size_t const length2 = MEM_readLE16(istart+2);
 1406|    153|        size_t const length3 = MEM_readLE16(istart+4);
 1407|    153|        size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6);
 1408|    153|        const BYTE* const istart1 = istart + 6;  /* jumpTable */
 1409|    153|        const BYTE* const istart2 = istart1 + length1;
 1410|    153|        const BYTE* const istart3 = istart2 + length2;
 1411|    153|        const BYTE* const istart4 = istart3 + length3;
 1412|    153|        size_t const segmentSize = (dstSize+3) / 4;
 1413|    153|        BYTE* const opStart2 = ostart + segmentSize;
 1414|    153|        BYTE* const opStart3 = opStart2 + segmentSize;
 1415|    153|        BYTE* const opStart4 = opStart3 + segmentSize;
 1416|    153|        BYTE* op1 = ostart;
 1417|    153|        BYTE* op2 = opStart2;
 1418|    153|        BYTE* op3 = opStart3;
 1419|    153|        BYTE* op4 = opStart4;
 1420|    153|        U32 endSignal = 1;
 1421|    153|        DTableDesc const dtd = HUF_getDTableDesc(DTable);
 1422|    153|        U32 const dtLog = dtd.tableLog;
 1423|       |
 1424|    153|        if (length4 > cSrcSize) return ERROR(corruption_detected);  /* overflow */
  ------------------
  |  |   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 (1424:13): [True: 7, False: 146]
  ------------------
 1425|    146|        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: 146]
  ------------------
 1426|    146|        assert(dstSize >= 6 /* validated above */);
  ------------------
  |  |   70|    146|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1427|    146|        CHECK_F( BIT_initDStream(&bitD1, istart1, length1) );
  ------------------
  |  |   63|    146|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|    146|    size_t const e = f;     \
  |  |  |  |   59|    146|    do {                    \
  |  |  |  |   60|    146|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 4, False: 142]
  |  |  |  |  ------------------
  |  |  |  |   61|    146|            return e;       \
  |  |  |  |   62|    146|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 142]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 142]
  |  |  ------------------
  ------------------
 1428|    142|        CHECK_F( BIT_initDStream(&bitD2, istart2, length2) );
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 1429|    137|        CHECK_F( BIT_initDStream(&bitD3, istart3, length3) );
  ------------------
  |  |   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: 3, False: 134]
  |  |  |  |  ------------------
  |  |  |  |   61|    137|            return e;       \
  |  |  |  |   62|    137|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 134]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 134]
  |  |  ------------------
  ------------------
 1430|    134|        CHECK_F( BIT_initDStream(&bitD4, istart4, length4) );
  ------------------
  |  |   63|    134|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|    134|    size_t const e = f;     \
  |  |  |  |   59|    134|    do {                    \
  |  |  |  |   60|    134|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 2, False: 132]
  |  |  |  |  ------------------
  |  |  |  |   61|    134|            return e;       \
  |  |  |  |   62|    134|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 132]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 132]
  |  |  ------------------
  ------------------
 1431|       |
 1432|       |        /* 16-32 symbols per loop (4-8 symbols per stream) */
 1433|    132|        if ((size_t)(oend - op4) >= sizeof(size_t)) {
  ------------------
  |  Branch (1433:13): [True: 132, False: 0]
  ------------------
 1434|  3.26k|            for ( ; (endSignal) & (op4 < olimit); ) {
  ------------------
  |  Branch (1434:21): [True: 3.13k, False: 132]
  ------------------
 1435|  3.13k|#if defined(__clang__) && (defined(__x86_64__) || defined(__i386__))
 1436|  3.13k|                HUF_DECODE_SYMBOLX2_2(op1, &bitD1);
  ------------------
  |  | 1302|  3.13k|    do {                                                           \
  |  | 1303|  3.13k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 3.13k, False: 0]
  |  |  ------------------
  |  | 1304|  3.13k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  3.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1437|  3.13k|                HUF_DECODE_SYMBOLX2_1(op1, &bitD1);
  ------------------
  |  | 1296|  3.13k|    do {                                                           \
  |  | 1297|  3.13k|        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.13k, False: 0]
  |  |  |  Branch (1297:29): [True: 0, Folded]
  |  |  ------------------
  |  | 1298|  3.13k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1299|  3.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1299:14): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1438|  3.13k|                HUF_DECODE_SYMBOLX2_2(op1, &bitD1);
  ------------------
  |  | 1302|  3.13k|    do {                                                           \
  |  | 1303|  3.13k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 3.13k, False: 0]
  |  |  ------------------
  |  | 1304|  3.13k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  3.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1439|  3.13k|                HUF_DECODE_SYMBOLX2_0(op1, &bitD1);
  ------------------
  |  | 1293|  3.13k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1440|  3.13k|                HUF_DECODE_SYMBOLX2_2(op2, &bitD2);
  ------------------
  |  | 1302|  3.13k|    do {                                                           \
  |  | 1303|  3.13k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 3.13k, False: 0]
  |  |  ------------------
  |  | 1304|  3.13k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  3.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1441|  3.13k|                HUF_DECODE_SYMBOLX2_1(op2, &bitD2);
  ------------------
  |  | 1296|  3.13k|    do {                                                           \
  |  | 1297|  3.13k|        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.13k, False: 0]
  |  |  |  Branch (1297:29): [True: 0, Folded]
  |  |  ------------------
  |  | 1298|  3.13k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1299|  3.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1299:14): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1442|  3.13k|                HUF_DECODE_SYMBOLX2_2(op2, &bitD2);
  ------------------
  |  | 1302|  3.13k|    do {                                                           \
  |  | 1303|  3.13k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 3.13k, False: 0]
  |  |  ------------------
  |  | 1304|  3.13k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  3.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1443|  3.13k|                HUF_DECODE_SYMBOLX2_0(op2, &bitD2);
  ------------------
  |  | 1293|  3.13k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1444|  3.13k|                endSignal &= BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished;
 1445|  3.13k|                endSignal &= BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished;
 1446|  3.13k|                HUF_DECODE_SYMBOLX2_2(op3, &bitD3);
  ------------------
  |  | 1302|  3.13k|    do {                                                           \
  |  | 1303|  3.13k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 3.13k, False: 0]
  |  |  ------------------
  |  | 1304|  3.13k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  3.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1447|  3.13k|                HUF_DECODE_SYMBOLX2_1(op3, &bitD3);
  ------------------
  |  | 1296|  3.13k|    do {                                                           \
  |  | 1297|  3.13k|        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.13k, False: 0]
  |  |  |  Branch (1297:29): [True: 0, Folded]
  |  |  ------------------
  |  | 1298|  3.13k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1299|  3.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1299:14): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1448|  3.13k|                HUF_DECODE_SYMBOLX2_2(op3, &bitD3);
  ------------------
  |  | 1302|  3.13k|    do {                                                           \
  |  | 1303|  3.13k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 3.13k, False: 0]
  |  |  ------------------
  |  | 1304|  3.13k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  3.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1449|  3.13k|                HUF_DECODE_SYMBOLX2_0(op3, &bitD3);
  ------------------
  |  | 1293|  3.13k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1450|  3.13k|                HUF_DECODE_SYMBOLX2_2(op4, &bitD4);
  ------------------
  |  | 1302|  3.13k|    do {                                                           \
  |  | 1303|  3.13k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 3.13k, False: 0]
  |  |  ------------------
  |  | 1304|  3.13k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  3.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1451|  3.13k|                HUF_DECODE_SYMBOLX2_1(op4, &bitD4);
  ------------------
  |  | 1296|  3.13k|    do {                                                           \
  |  | 1297|  3.13k|        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.13k, False: 0]
  |  |  |  Branch (1297:29): [True: 0, Folded]
  |  |  ------------------
  |  | 1298|  3.13k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1299|  3.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1299:14): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1452|  3.13k|                HUF_DECODE_SYMBOLX2_2(op4, &bitD4);
  ------------------
  |  | 1302|  3.13k|    do {                                                           \
  |  | 1303|  3.13k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1303:13): [True: 3.13k, False: 0]
  |  |  ------------------
  |  | 1304|  3.13k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1305|  3.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1305:14): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1453|  3.13k|                HUF_DECODE_SYMBOLX2_0(op4, &bitD4);
  ------------------
  |  | 1293|  3.13k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1293:74): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
 1454|  3.13k|                endSignal &= BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished;
 1455|  3.13k|                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.13k|            }
 1480|    132|        }
 1481|       |
 1482|       |        /* check corruption */
 1483|    132|        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: 131]
  ------------------
 1484|    131|        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: 130]
  ------------------
 1485|    130|        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: 129]
  ------------------
 1486|       |        /* note : op4 already verified within main loop */
 1487|       |
 1488|       |        /* finish bitStreams one by one */
 1489|    129|        HUF_decodeStreamX2(op1, &bitD1, opStart2, dt, dtLog);
 1490|    129|        HUF_decodeStreamX2(op2, &bitD2, opStart3, dt, dtLog);
 1491|    129|        HUF_decodeStreamX2(op3, &bitD3, opStart4, dt, dtLog);
 1492|    129|        HUF_decodeStreamX2(op4, &bitD4, oend,     dt, dtLog);
 1493|       |
 1494|       |        /* check */
 1495|    129|        { U32 const endCheck = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4);
 1496|    129|          if (!endCheck) return ERROR(corruption_detected); }
  ------------------
  |  |   49|    129|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    129|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    129|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1496:15): [True: 129, False: 0]
  ------------------
 1497|       |
 1498|       |        /* decoded size */
 1499|      0|        return dstSize;
 1500|    129|    }
 1501|    129|}
huf_decompress.c:HUF_decompress4X2_usingDTable_internal_bmi2:
 1506|    153|                    size_t cSrcSize, HUF_DTable const* DTable) {
 1507|    153|    return HUF_decompress4X2_usingDTable_internal_body(dst, dstSize, cSrc, cSrcSize, DTable);
 1508|    153|}
huf_decompress.c:HUF_decompress4X2_usingDTable_internal_fast:
 1671|    215|    HUF_DecompressFastLoopFn loopFn) {
 1672|    215|    void const* dt = DTable + 1;
 1673|    215|    const BYTE* const ilowest = (const BYTE*)cSrc;
 1674|    215|    BYTE* const oend = ZSTD_maybeNullPtrAdd((BYTE*)dst, dstSize);
 1675|    215|    HUF_DecompressFastArgs args;
 1676|    215|    {
 1677|    215|        size_t const ret = HUF_DecompressFastArgs_init(&args, dst, dstSize, cSrc, cSrcSize, DTable);
 1678|    215|        FORWARD_IF_ERROR(ret, "Failed to init asm args");
  ------------------
  |  |  146|    215|    do {                                                                           \
  |  |  147|    215|        size_t const err_code = (err);                                             \
  |  |  148|    215|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 11, False: 204]
  |  |  ------------------
  |  |  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|    215|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 204]
  |  |  ------------------
  ------------------
 1679|    204|        if (ret == 0)
  ------------------
  |  Branch (1679:13): [True: 153, False: 51]
  ------------------
 1680|    153|            return 0;
 1681|    204|    }
 1682|       |
 1683|     51|    assert(args.ip[0] >= args.ilowest);
  ------------------
  |  |   70|     51|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1684|     51|    loopFn(&args);
 1685|       |
 1686|       |    /* note : op4 already verified within main loop */
 1687|     51|    assert(args.ip[0] >= ilowest);
  ------------------
  |  |   70|     51|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1688|     51|    assert(args.ip[1] >= ilowest);
  ------------------
  |  |   70|     51|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1689|     51|    assert(args.ip[2] >= ilowest);
  ------------------
  |  |   70|     51|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1690|     51|    assert(args.ip[3] >= ilowest);
  ------------------
  |  |   70|     51|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1691|     51|    assert(args.op[3] <= oend);
  ------------------
  |  |   70|     51|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1692|       |
 1693|     51|    assert(ilowest == args.ilowest);
  ------------------
  |  |   70|     51|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1694|     51|    assert(ilowest + 6 == args.iend[0]);
  ------------------
  |  |   70|     51|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1695|     51|    (void)ilowest;
 1696|       |
 1697|       |    /* finish bitStreams one by one */
 1698|     51|    {
 1699|     51|        size_t const segmentSize = (dstSize+3) / 4;
 1700|     51|        BYTE* segmentEnd = (BYTE*)dst;
 1701|     51|        int i;
 1702|    225|        for (i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1702:21): [True: 190, False: 35]
  ------------------
 1703|    190|            BIT_DStream_t bit;
 1704|    190|            if (segmentSize <= (size_t)(oend - segmentEnd))
  ------------------
  |  Branch (1704:17): [True: 174, False: 16]
  ------------------
 1705|    174|                segmentEnd += segmentSize;
 1706|     16|            else
 1707|     16|                segmentEnd = oend;
 1708|    190|            FORWARD_IF_ERROR(HUF_initRemainingDStream(&bit, &args, i, segmentEnd), "corruption");
  ------------------
  |  |  146|    190|    do {                                                                           \
  |  |  147|    190|        size_t const err_code = (err);                                             \
  |  |  148|    190|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 16, False: 174]
  |  |  ------------------
  |  |  149|     16|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|     16|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|     16|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|     16|    do {                                           \
  |  |  |  |   99|     16|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     16|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|     16|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|     16|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     16|            return err_code;                                                       \
  |  |  155|     16|        }                                                                          \
  |  |  156|    190|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 174]
  |  |  ------------------
  ------------------
 1709|    174|            args.op[i] += HUF_decodeStreamX2(args.op[i], &bit, segmentEnd, (HUF_DEltX2 const*)dt, HUF_DECODER_FAST_TABLELOG);
  ------------------
  |  |   31|    174|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
 1710|    174|            if (args.op[i] != segmentEnd)
  ------------------
  |  Branch (1710:17): [True: 0, False: 174]
  ------------------
 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|    174|        }
 1713|     51|    }
 1714|       |
 1715|       |    /* decoded size */
 1716|     35|    return dstSize;
 1717|     51|}
huf_decompress.c:HUF_DecompressFastArgs_init:
  192|    424|{
  193|    424|    void const* dt = DTable + 1;
  194|    424|    U32 const dtLog = HUF_getDTableDesc(DTable).tableLog;
  195|       |
  196|    424|    const BYTE* const istart = (const BYTE*)src;
  197|       |
  198|    424|    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|    424|    if (!MEM_isLittleEndian() || MEM_32bits())
  ------------------
  |  Branch (203:9): [True: 0, False: 424]
  |  Branch (203:34): [True: 0, False: 424]
  ------------------
  204|      0|        return 0;
  205|       |
  206|       |    /* Avoid nullptr addition */
  207|    424|    if (dstSize == 0)
  ------------------
  |  Branch (207:9): [True: 0, False: 424]
  ------------------
  208|      0|        return 0;
  209|    424|    assert(dst != NULL);
  ------------------
  |  |   70|    424|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  210|       |
  211|       |    /* strict minimum : jump table + 1 byte per stream */
  212|    424|    if (srcSize < 10)
  ------------------
  |  Branch (212:9): [True: 5, False: 419]
  ------------------
  213|      5|        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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  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|    419|    if (dtLog != HUF_DECODER_FAST_TABLELOG)
  ------------------
  |  |   31|    419|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
  |  Branch (219:9): [True: 152, False: 267]
  ------------------
  220|    152|        return 0;
  221|       |
  222|       |    /* Read the jump table. */
  223|    267|    {
  224|    267|        size_t const length1 = MEM_readLE16(istart);
  225|    267|        size_t const length2 = MEM_readLE16(istart+2);
  226|    267|        size_t const length3 = MEM_readLE16(istart+4);
  227|    267|        size_t const length4 = srcSize - (length1 + length2 + length3 + 6);
  228|    267|        args->iend[0] = istart + 6;  /* jumpTable */
  229|    267|        args->iend[1] = args->iend[0] + length1;
  230|    267|        args->iend[2] = args->iend[1] + length2;
  231|    267|        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|    267|        if (length1 < 8 || length2 < 8 || length3 < 8 || length4 < 8)
  ------------------
  |  Branch (236:13): [True: 37, False: 230]
  |  Branch (236:28): [True: 46, False: 184]
  |  Branch (236:43): [True: 30, False: 154]
  |  Branch (236:58): [True: 5, False: 149]
  ------------------
  237|    118|            return 0;
  238|    149|        if (length4 > srcSize) return ERROR(corruption_detected);   /* overflow */
  ------------------
  |  |   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 (238:13): [True: 44, False: 105]
  ------------------
  239|    149|    }
  240|       |    /* ip[] contains the position that is currently loaded into bits[]. */
  241|    105|    args->ip[0] = args->iend[1] - sizeof(U64);
  242|    105|    args->ip[1] = args->iend[2] - sizeof(U64);
  243|    105|    args->ip[2] = args->iend[3] - sizeof(U64);
  244|    105|    args->ip[3] = (BYTE const*)src + srcSize - sizeof(U64);
  245|       |
  246|       |    /* op[] contains the output pointers. */
  247|    105|    args->op[0] = (BYTE*)dst;
  248|    105|    args->op[1] = args->op[0] + (dstSize+3)/4;
  249|    105|    args->op[2] = args->op[1] + (dstSize+3)/4;
  250|    105|    args->op[3] = args->op[2] + (dstSize+3)/4;
  251|       |
  252|       |    /* No point to call the ASM loop for tiny outputs. */
  253|    105|    if (args->op[3] >= oend)
  ------------------
  |  Branch (253:9): [True: 1, False: 104]
  ------------------
  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|    104|    args->bits[0] = HUF_initFastDStream(args->ip[0]);
  264|    104|    args->bits[1] = HUF_initFastDStream(args->ip[1]);
  265|    104|    args->bits[2] = HUF_initFastDStream(args->ip[2]);
  266|    104|    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|    104|    args->ilowest = istart;
  274|       |
  275|    104|    args->oend = oend;
  276|    104|    args->dt = dt;
  277|       |
  278|    104|    return 1;
  279|    105|}
huf_decompress.c:HUF_initFastDStream:
  150|    416|static size_t HUF_initFastDStream(BYTE const* ip) {
  151|    416|    BYTE const lastByte = ip[7];
  152|    416|    size_t const bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (152:33): [True: 354, False: 62]
  ------------------
  153|    416|    size_t const value = MEM_readLEST(ip) | 1;
  154|    416|    assert(bitsConsumed <= 8);
  ------------------
  |  |   70|    416|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  155|    416|    assert(sizeof(size_t) == 8);
  ------------------
  |  |   70|    416|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  156|    416|    return value << bitsConsumed;
  157|    416|}
huf_decompress.c:HUF_initRemainingDStream:
  282|    388|{
  283|       |    /* Validate that we haven't overwritten. */
  284|    388|    if (args->op[stream] > segmentEnd)
  ------------------
  |  Branch (284:9): [True: 0, False: 388]
  ------------------
  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|    388|    if (args->ip[stream] < args->iend[stream] - 8)
  ------------------
  |  Branch (291:9): [True: 32, False: 356]
  ------------------
  292|     32|        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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  293|       |
  294|       |    /* Construct the BIT_DStream_t. */
  295|    356|    assert(sizeof(size_t) == 8);
  ------------------
  |  |   70|    356|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  296|    356|    bit->bitContainer = MEM_readLEST(args->ip[stream]);
  297|    356|    bit->bitsConsumed = ZSTD_countTrailingZeros64(args->bits[stream]);
  298|    356|    bit->start = (const char*)args->ilowest;
  299|    356|    bit->limitPtr = bit->start + sizeof(size_t);
  300|    356|    bit->ptr = (const char*)args->ip[stream];
  301|       |
  302|    356|    return 0;
  303|    388|}
huf_decompress.c:HUF_decompress4X1_usingDTable_internal:
  899|    209|{
  900|    209|    HUF_DecompressUsingDTableFn fallbackFn = HUF_decompress4X1_usingDTable_internal_default;
  901|    209|    HUF_DecompressFastLoopFn loopFn = HUF_decompress4X1_usingDTable_internal_fast_c_loop;
  902|       |
  903|    209|#if DYNAMIC_BMI2
  904|    209|    if (flags & HUF_flags_bmi2) {
  ------------------
  |  Branch (904:9): [True: 209, False: 0]
  ------------------
  905|    209|        fallbackFn = HUF_decompress4X1_usingDTable_internal_bmi2;
  906|    209|# if ZSTD_ENABLE_ASM_X86_64_BMI2
  907|    209|        if (!(flags & HUF_flags_disableAsm)) {
  ------------------
  |  Branch (907:13): [True: 209, False: 0]
  ------------------
  908|    209|            loopFn = HUF_decompress4X1_usingDTable_internal_fast_asm_loop;
  909|    209|        }
  910|    209|# endif
  911|    209|    } else {
  912|      0|        return fallbackFn(dst, dstSize, cSrc, cSrcSize, DTable);
  913|      0|    }
  914|    209|#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|    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 (922:35): [True: 209, False: 0]
  ------------------
  923|    209|        size_t const ret = HUF_decompress4X1_usingDTable_internal_fast(dst, dstSize, cSrc, cSrcSize, DTable, loopFn);
  924|    209|        if (ret != 0)
  ------------------
  |  Branch (924:13): [True: 91, False: 118]
  ------------------
  925|     91|            return ret;
  926|    209|    }
  927|    118|    return fallbackFn(dst, dstSize, cSrc, cSrcSize, DTable);
  928|    209|}
huf_decompress.c:HUF_decompress4X1_usingDTable_internal_body:
  606|    118|{
  607|       |    /* Check */
  608|    118|    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: 118]
  ------------------
  609|    118|    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: 118]
  ------------------
  610|       |
  611|    118|    {   const BYTE* const istart = (const BYTE*) cSrc;
  612|    118|        BYTE* const ostart = (BYTE*) dst;
  613|    118|        BYTE* const oend = ostart + dstSize;
  614|    118|        BYTE* const olimit = oend - 3;
  615|    118|        const void* const dtPtr = DTable + 1;
  616|    118|        const HUF_DEltX1* const dt = (const HUF_DEltX1*)dtPtr;
  617|       |
  618|       |        /* Init */
  619|    118|        BIT_DStream_t bitD1;
  620|    118|        BIT_DStream_t bitD2;
  621|    118|        BIT_DStream_t bitD3;
  622|    118|        BIT_DStream_t bitD4;
  623|    118|        size_t const length1 = MEM_readLE16(istart);
  624|    118|        size_t const length2 = MEM_readLE16(istart+2);
  625|    118|        size_t const length3 = MEM_readLE16(istart+4);
  626|    118|        size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6);
  627|    118|        const BYTE* const istart1 = istart + 6;  /* jumpTable */
  628|    118|        const BYTE* const istart2 = istart1 + length1;
  629|    118|        const BYTE* const istart3 = istart2 + length2;
  630|    118|        const BYTE* const istart4 = istart3 + length3;
  631|    118|        const size_t segmentSize = (dstSize+3) / 4;
  632|    118|        BYTE* const opStart2 = ostart + segmentSize;
  633|    118|        BYTE* const opStart3 = opStart2 + segmentSize;
  634|    118|        BYTE* const opStart4 = opStart3 + segmentSize;
  635|    118|        BYTE* op1 = ostart;
  636|    118|        BYTE* op2 = opStart2;
  637|    118|        BYTE* op3 = opStart3;
  638|    118|        BYTE* op4 = opStart4;
  639|    118|        DTableDesc const dtd = HUF_getDTableDesc(DTable);
  640|    118|        U32 const dtLog = dtd.tableLog;
  641|    118|        U32 endSignal = 1;
  642|       |
  643|    118|        if (length4 > cSrcSize) return ERROR(corruption_detected);   /* overflow */
  ------------------
  |  |   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 (643:13): [True: 17, False: 101]
  ------------------
  644|    101|        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: 101]
  ------------------
  645|    101|        assert(dstSize >= 6); /* validated above */
  ------------------
  |  |   70|    101|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  646|    101|        CHECK_F( BIT_initDStream(&bitD1, istart1, length1) );
  ------------------
  |  |   63|    101|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|    101|    size_t const e = f;     \
  |  |  |  |   59|    101|    do {                    \
  |  |  |  |   60|    101|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 7, False: 94]
  |  |  |  |  ------------------
  |  |  |  |   61|    101|            return e;       \
  |  |  |  |   62|    101|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 94]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 94]
  |  |  ------------------
  ------------------
  647|     94|        CHECK_F( BIT_initDStream(&bitD2, istart2, length2) );
  ------------------
  |  |   63|     94|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|     94|    size_t const e = f;     \
  |  |  |  |   59|     94|    do {                    \
  |  |  |  |   60|     94|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 4, False: 90]
  |  |  |  |  ------------------
  |  |  |  |   61|     94|            return e;       \
  |  |  |  |   62|     94|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 90]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 90]
  |  |  ------------------
  ------------------
  648|     90|        CHECK_F( BIT_initDStream(&bitD3, istart3, length3) );
  ------------------
  |  |   63|     90|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|     90|    size_t const e = f;     \
  |  |  |  |   59|     90|    do {                    \
  |  |  |  |   60|     90|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 3, False: 87]
  |  |  |  |  ------------------
  |  |  |  |   61|     90|            return e;       \
  |  |  |  |   62|     90|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 87]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 87]
  |  |  ------------------
  ------------------
  649|     87|        CHECK_F( BIT_initDStream(&bitD4, istart4, length4) );
  ------------------
  |  |   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: 6, False: 81]
  |  |  |  |  ------------------
  |  |  |  |   61|     87|            return e;       \
  |  |  |  |   62|     87|    } 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: 74, False: 7]
  ------------------
  653|  3.60k|            for ( ; (endSignal) & (op4 < olimit) ; ) {
  ------------------
  |  Branch (653:21): [True: 3.53k, False: 74]
  ------------------
  654|  3.53k|                HUF_DECODE_SYMBOLX1_2(op1, &bitD1);
  ------------------
  |  |  540|  3.53k|    do {                                            \
  |  |  541|  3.53k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 3.53k, False: 0]
  |  |  ------------------
  |  |  542|  3.53k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.53k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.53k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  3.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  655|  3.53k|                HUF_DECODE_SYMBOLX1_2(op2, &bitD2);
  ------------------
  |  |  540|  3.53k|    do {                                            \
  |  |  541|  3.53k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 3.53k, False: 0]
  |  |  ------------------
  |  |  542|  3.53k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.53k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.53k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  3.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  656|  3.53k|                HUF_DECODE_SYMBOLX1_2(op3, &bitD3);
  ------------------
  |  |  540|  3.53k|    do {                                            \
  |  |  541|  3.53k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 3.53k, False: 0]
  |  |  ------------------
  |  |  542|  3.53k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.53k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.53k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  3.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  657|  3.53k|                HUF_DECODE_SYMBOLX1_2(op4, &bitD4);
  ------------------
  |  |  540|  3.53k|    do {                                            \
  |  |  541|  3.53k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 3.53k, False: 0]
  |  |  ------------------
  |  |  542|  3.53k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.53k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.53k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  3.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  658|  3.53k|                HUF_DECODE_SYMBOLX1_1(op1, &bitD1);
  ------------------
  |  |  534|  3.53k|    do {                                            \
  |  |  535|  3.53k|        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.53k, False: 0]
  |  |  |  Branch (535:29): [True: 0, Folded]
  |  |  ------------------
  |  |  536|  3.53k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.53k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.53k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  537|  3.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (537:14): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  659|  3.53k|                HUF_DECODE_SYMBOLX1_1(op2, &bitD2);
  ------------------
  |  |  534|  3.53k|    do {                                            \
  |  |  535|  3.53k|        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.53k, False: 0]
  |  |  |  Branch (535:29): [True: 0, Folded]
  |  |  ------------------
  |  |  536|  3.53k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.53k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.53k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  537|  3.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (537:14): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  660|  3.53k|                HUF_DECODE_SYMBOLX1_1(op3, &bitD3);
  ------------------
  |  |  534|  3.53k|    do {                                            \
  |  |  535|  3.53k|        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.53k, False: 0]
  |  |  |  Branch (535:29): [True: 0, Folded]
  |  |  ------------------
  |  |  536|  3.53k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.53k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.53k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  537|  3.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (537:14): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  661|  3.53k|                HUF_DECODE_SYMBOLX1_1(op4, &bitD4);
  ------------------
  |  |  534|  3.53k|    do {                                            \
  |  |  535|  3.53k|        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.53k, False: 0]
  |  |  |  Branch (535:29): [True: 0, Folded]
  |  |  ------------------
  |  |  536|  3.53k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.53k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.53k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  537|  3.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (537:14): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  662|  3.53k|                HUF_DECODE_SYMBOLX1_2(op1, &bitD1);
  ------------------
  |  |  540|  3.53k|    do {                                            \
  |  |  541|  3.53k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 3.53k, False: 0]
  |  |  ------------------
  |  |  542|  3.53k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.53k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.53k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  3.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  663|  3.53k|                HUF_DECODE_SYMBOLX1_2(op2, &bitD2);
  ------------------
  |  |  540|  3.53k|    do {                                            \
  |  |  541|  3.53k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 3.53k, False: 0]
  |  |  ------------------
  |  |  542|  3.53k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.53k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.53k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  3.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  664|  3.53k|                HUF_DECODE_SYMBOLX1_2(op3, &bitD3);
  ------------------
  |  |  540|  3.53k|    do {                                            \
  |  |  541|  3.53k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 3.53k, False: 0]
  |  |  ------------------
  |  |  542|  3.53k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.53k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.53k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  3.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  665|  3.53k|                HUF_DECODE_SYMBOLX1_2(op4, &bitD4);
  ------------------
  |  |  540|  3.53k|    do {                                            \
  |  |  541|  3.53k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 3.53k, False: 0]
  |  |  ------------------
  |  |  542|  3.53k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  3.53k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 3.53k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  3.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  666|  3.53k|                HUF_DECODE_SYMBOLX1_0(op1, &bitD1);
  ------------------
  |  |  531|  3.53k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (531:71): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  667|  3.53k|                HUF_DECODE_SYMBOLX1_0(op2, &bitD2);
  ------------------
  |  |  531|  3.53k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (531:71): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  668|  3.53k|                HUF_DECODE_SYMBOLX1_0(op3, &bitD3);
  ------------------
  |  |  531|  3.53k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (531:71): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  669|  3.53k|                HUF_DECODE_SYMBOLX1_0(op4, &bitD4);
  ------------------
  |  |  531|  3.53k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (531:71): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  670|  3.53k|                endSignal &= BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished;
  671|  3.53k|                endSignal &= BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished;
  672|  3.53k|                endSignal &= BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished;
  673|  3.53k|                endSignal &= BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished;
  674|  3.53k|            }
  675|     74|        }
  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|    118|                    size_t cSrcSize, HUF_DTable const* DTable) {
  704|    118|    return HUF_decompress4X1_usingDTable_internal_body(dst, dstSize, cSrc, cSrcSize, DTable);
  705|    118|}
huf_decompress.c:HUF_decompress4X1_usingDTable_internal_fast:
  845|    209|{
  846|    209|    void const* dt = DTable + 1;
  847|    209|    BYTE const* const ilowest = (BYTE const*)cSrc;
  848|    209|    BYTE* const oend = ZSTD_maybeNullPtrAdd((BYTE*)dst, dstSize);
  849|    209|    HUF_DecompressFastArgs args;
  850|    209|    {   size_t const ret = HUF_DecompressFastArgs_init(&args, dst, dstSize, cSrc, cSrcSize, DTable);
  851|    209|        FORWARD_IF_ERROR(ret, "Failed to init fast loop args");
  ------------------
  |  |  146|    209|    do {                                                                           \
  |  |  147|    209|        size_t const err_code = (err);                                             \
  |  |  148|    209|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 38, False: 171]
  |  |  ------------------
  |  |  149|     38|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|     38|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 38]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|     38|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|     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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|     38|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|     38|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 38]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|     38|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|     38|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 38]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     38|            return err_code;                                                       \
  |  |  155|     38|        }                                                                          \
  |  |  156|    209|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 171]
  |  |  ------------------
  ------------------
  852|    171|        if (ret == 0)
  ------------------
  |  Branch (852:13): [True: 118, False: 53]
  ------------------
  853|    118|            return 0;
  854|    171|    }
  855|       |
  856|     53|    assert(args.ip[0] >= args.ilowest);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  857|     53|    loopFn(&args);
  858|       |
  859|       |    /* Our loop guarantees that ip[] >= ilowest and that we haven't
  860|       |    * overwritten any op[].
  861|       |    */
  862|     53|    assert(args.ip[0] >= ilowest);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  863|     53|    assert(args.ip[0] >= ilowest);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  864|     53|    assert(args.ip[1] >= ilowest);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  865|     53|    assert(args.ip[2] >= ilowest);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  866|     53|    assert(args.ip[3] >= ilowest);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  867|     53|    assert(args.op[3] <= oend);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  868|       |
  869|     53|    assert(ilowest == args.ilowest);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  870|     53|    assert(ilowest + 6 == args.iend[0]);
  ------------------
  |  |   70|     53|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  871|     53|    (void)ilowest;
  872|       |
  873|       |    /* finish bit streams one by one. */
  874|     53|    {   size_t const segmentSize = (dstSize+3) / 4;
  875|     53|        BYTE* segmentEnd = (BYTE*)dst;
  876|     53|        int i;
  877|    235|        for (i = 0; i < 4; ++i) {
  ------------------
  |  Branch (877:21): [True: 198, False: 37]
  ------------------
  878|    198|            BIT_DStream_t bit;
  879|    198|            if (segmentSize <= (size_t)(oend - segmentEnd))
  ------------------
  |  Branch (879:17): [True: 173, False: 25]
  ------------------
  880|    173|                segmentEnd += segmentSize;
  881|     25|            else
  882|     25|                segmentEnd = oend;
  883|    198|            FORWARD_IF_ERROR(HUF_initRemainingDStream(&bit, &args, i, segmentEnd), "corruption");
  ------------------
  |  |  146|    198|    do {                                                                           \
  |  |  147|    198|        size_t const err_code = (err);                                             \
  |  |  148|    198|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 16, False: 182]
  |  |  ------------------
  |  |  149|     16|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|     16|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|     16|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|     16|    do {                                           \
  |  |  |  |   99|     16|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     16|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|     16|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|     16|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     16|            return err_code;                                                       \
  |  |  155|     16|        }                                                                          \
  |  |  156|    198|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 182]
  |  |  ------------------
  ------------------
  884|       |            /* Decompress and validate that we've produced exactly the expected length. */
  885|    182|            args.op[i] += HUF_decodeStreamX1(args.op[i], &bit, segmentEnd, (HUF_DEltX1 const*)dt, HUF_DECODER_FAST_TABLELOG);
  ------------------
  |  |   31|    182|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
  886|    182|            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: 182]
  ------------------
  887|    182|        }
  888|     53|    }
  889|       |
  890|       |    /* decoded size */
  891|     37|    assert(dstSize != 0);
  ------------------
  |  |   70|     37|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  892|     37|    return dstSize;
  893|     53|}
huf_decompress.c:HUF_decompress4X2_DCtx_wksp:
 1772|    233|{
 1773|    233|    const BYTE* ip = (const BYTE*) cSrc;
 1774|       |
 1775|    233|    size_t hSize = HUF_readDTableX2_wksp(dctx, cSrc, cSrcSize,
 1776|    233|                                         workSpace, wkspSize, flags);
 1777|    233|    if (HUF_isError(hSize)) return hSize;
  ------------------
  |  |   78|    233|#define HUF_isError ERR_isError
  ------------------
  |  Branch (1777:9): [True: 18, False: 215]
  ------------------
 1778|    215|    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: 215]
  ------------------
 1779|    215|    ip += hSize; cSrcSize -= hSize;
 1780|       |
 1781|    215|    return HUF_decompress4X2_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, flags);
 1782|    215|}
huf_decompress.c:HUF_decompress4X1_DCtx_wksp:
  933|    280|{
  934|    280|    const BYTE* ip = (const BYTE*) cSrc;
  935|       |
  936|    280|    size_t const hSize = HUF_readDTableX1_wksp(dctx, cSrc, cSrcSize, workSpace, wkspSize, flags);
  937|    280|    if (HUF_isError(hSize)) return hSize;
  ------------------
  |  |   78|    280|#define HUF_isError ERR_isError
  ------------------
  |  Branch (937:9): [True: 67, False: 213]
  ------------------
  938|    213|    if (hSize >= cSrcSize) 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 (938:9): [True: 4, False: 209]
  ------------------
  939|    209|    ip += hSize; cSrcSize -= hSize;
  940|       |
  941|    209|    return HUF_decompress4X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, flags);
  942|    213|}

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

ZSTD_createDCtx:
  311|  7.08k|{
  312|  7.08k|    DEBUGLOG(3, "ZSTD_createDCtx");
  ------------------
  |  |  104|  7.08k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 7.08k]
  |  |  ------------------
  ------------------
  313|  7.08k|    return ZSTD_createDCtx_internal(ZSTD_defaultCMem);
  314|  7.08k|}
ZSTD_freeDCtx:
  325|  7.08k|{
  326|  7.08k|    if (dctx==NULL) return 0;   /* support free on NULL */
  ------------------
  |  Branch (326:9): [True: 0, False: 7.08k]
  ------------------
  327|  7.08k|    RETURN_ERROR_IF(dctx->staticSize, memory_allocation, "not compatible with static DCtx");
  ------------------
  |  |  114|  7.08k|    do {                                                                       \
  |  |  115|  7.08k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 7.08k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  7.08k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 7.08k]
  |  |  ------------------
  ------------------
  328|  7.08k|    {   ZSTD_customMem const cMem = dctx->customMem;
  329|  7.08k|        ZSTD_clearDict(dctx);
  330|  7.08k|        ZSTD_customFree(dctx->inBuff, cMem);
  331|  7.08k|        dctx->inBuff = NULL;
  332|  7.08k|#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1)
  333|  7.08k|        if (dctx->legacyContext)
  ------------------
  |  Branch (333:13): [True: 0, False: 7.08k]
  ------------------
  334|      0|            ZSTD_freeLegacyStreamContext(dctx->legacyContext, dctx->previousLegacyVersion);
  335|  7.08k|#endif
  336|  7.08k|        if (dctx->ddictSet) {
  ------------------
  |  Branch (336:13): [True: 0, False: 7.08k]
  ------------------
  337|      0|            ZSTD_freeDDictHashSet(dctx->ddictSet, cMem);
  338|       |            dctx->ddictSet = NULL;
  339|      0|        }
  340|  7.08k|        ZSTD_customFree(dctx, cMem);
  341|  7.08k|        return 0;
  342|  7.08k|    }
  343|  7.08k|}
ZSTD_getFrameHeader_advanced:
  448|  3.89k|{
  449|  3.89k|    const BYTE* ip = (const BYTE*)src;
  450|  3.89k|    size_t const minInputSize = ZSTD_startingInputLength(format);
  451|       |
  452|  3.89k|    DEBUGLOG(5, "ZSTD_getFrameHeader_advanced: minInputSize = %zu, srcSize = %zu", minInputSize, srcSize);
  ------------------
  |  |  104|  3.89k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.89k]
  |  |  ------------------
  ------------------
  453|       |
  454|  3.89k|    if (srcSize > 0) {
  ------------------
  |  Branch (454:9): [True: 3.89k, False: 0]
  ------------------
  455|       |        /* note : technically could be considered an assert(), since it's an invalid entry */
  456|  3.89k|        RETURN_ERROR_IF(src==NULL, GENERIC, "invalid parameter : src==NULL, but srcSize>0");
  ------------------
  |  |  114|  3.89k|    do {                                                                       \
  |  |  115|  3.89k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 3.89k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  3.89k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.89k]
  |  |  ------------------
  ------------------
  457|  3.89k|    }
  458|  3.89k|    if (srcSize < minInputSize) {
  ------------------
  |  Branch (458:9): [True: 0, False: 3.89k]
  ------------------
  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.89k|    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.89k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  480|  3.89k|    if ( (format != ZSTD_f_zstd1_magicless)
  ------------------
  |  Branch (480:10): [True: 3.89k, False: 0]
  ------------------
  481|  3.89k|      && (MEM_readLE32(src) != ZSTD_MAGICNUMBER) ) {
  ------------------
  |  |  142|  3.89k|#define ZSTD_MAGICNUMBER            0xFD2FB528    /* valid since v0.8.0 */
  ------------------
  |  Branch (481:10): [True: 446, False: 3.44k]
  ------------------
  482|    446|        if ((MEM_readLE32(src) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  145|    446|#define ZSTD_MAGIC_SKIPPABLE_MASK   0xFFFFFFF0
  ------------------
                      if ((MEM_readLE32(src) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  144|    446|#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: 446]
  ------------------
  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|    446|        RETURN_ERROR(prefix_unknown, "");
  ------------------
  |  |  131|    446|    do {                                                                     \
  |  |  132|    446|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|    446|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 446]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|    446|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|    446|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|    446|    do {                                           \
  |  |  |  |   99|    446|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 446]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    446|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 446]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|    446|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|    446|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 446]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|    446|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|    446|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 446]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|    446|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|    446|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    446|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    446|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|    446|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  494|    446|    }
  495|       |
  496|       |    /* ensure there is enough `srcSize` to fully read/decode frame header */
  497|  3.44k|    {   size_t const fhsize = ZSTD_frameHeaderSize_internal(src, srcSize, format);
  498|  3.44k|        if (srcSize < fhsize) return fhsize;
  ------------------
  |  Branch (498:13): [True: 0, False: 3.44k]
  ------------------
  499|  3.44k|        zfhPtr->headerSize = (U32)fhsize;
  500|  3.44k|    }
  501|       |
  502|      0|    {   BYTE const fhdByte = ip[minInputSize-1];
  503|  3.44k|        size_t pos = minInputSize;
  504|  3.44k|        U32 const dictIDSizeCode = fhdByte&3;
  505|  3.44k|        U32 const checksumFlag = (fhdByte>>2)&1;
  506|  3.44k|        U32 const singleSegment = (fhdByte>>5)&1;
  507|  3.44k|        U32 const fcsID = fhdByte>>6;
  508|  3.44k|        U64 windowSize = 0;
  509|  3.44k|        U32 dictID = 0;
  510|  3.44k|        U64 frameContentSize = ZSTD_CONTENTSIZE_UNKNOWN;
  ------------------
  |  |  203|  3.44k|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  511|  3.44k|        RETURN_ERROR_IF((fhdByte & 0x08) != 0, frameParameter_unsupported,
  ------------------
  |  |  114|  3.44k|    do {                                                                       \
  |  |  115|  3.44k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 4, False: 3.44k]
  |  |  ------------------
  |  |  116|      4|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      4|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      4|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      4|    do {                                           \
  |  |  |  |   99|      4|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      4|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      4|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      4|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      4|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      4|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      4|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      4|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      4|        }                                                                      \
  |  |  123|  3.44k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.44k]
  |  |  ------------------
  ------------------
  512|  3.44k|                        "reserved bits, must be zero");
  513|       |
  514|  3.44k|        if (!singleSegment) {
  ------------------
  |  Branch (514:13): [True: 2.69k, False: 750]
  ------------------
  515|  2.69k|            BYTE const wlByte = ip[pos++];
  516|  2.69k|            U32 const windowLog = (wlByte >> 3) + ZSTD_WINDOWLOG_ABSOLUTEMIN;
  ------------------
  |  |   78|  2.69k|#define ZSTD_WINDOWLOG_ABSOLUTEMIN 10
  ------------------
  517|  2.69k|            RETURN_ERROR_IF(windowLog > ZSTD_WINDOWLOG_MAX, frameParameter_windowTooLarge, "");
  ------------------
  |  |  114|  2.69k|    do {                                                                       \
  |  |  115|  8.07k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [Folded, False: 2.69k]
  |  |  |  Branch (115:13): [True: 1, False: 2.69k]
  |  |  ------------------
  |  |  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.69k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.69k]
  |  |  ------------------
  ------------------
  518|  2.69k|            windowSize = (1ULL << windowLog);
  519|  2.69k|            windowSize += (windowSize >> 3) * (wlByte&7);
  520|  2.69k|        }
  521|  3.44k|        switch(dictIDSizeCode)
  522|  3.44k|        {
  523|      0|            default:
  ------------------
  |  Branch (523:13): [True: 0, False: 3.44k]
  ------------------
  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|    138|            case 0 : break;
  ------------------
  |  Branch (526:13): [True: 138, False: 3.30k]
  ------------------
  527|  2.69k|            case 1 : dictID = ip[pos]; pos++; break;
  ------------------
  |  Branch (527:13): [True: 2.69k, False: 747]
  ------------------
  528|    541|            case 2 : dictID = MEM_readLE16(ip+pos); pos+=2; break;
  ------------------
  |  Branch (528:13): [True: 541, False: 2.89k]
  ------------------
  529|     68|            case 3 : dictID = MEM_readLE32(ip+pos); pos+=4; break;
  ------------------
  |  Branch (529:13): [True: 68, False: 3.37k]
  ------------------
  530|  3.44k|        }
  531|  3.44k|        switch(fcsID)
  532|  3.44k|        {
  533|      0|            default:
  ------------------
  |  Branch (533:13): [True: 0, False: 3.44k]
  ------------------
  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.68k|            case 0 : if (singleSegment) frameContentSize = ip[pos]; break;
  ------------------
  |  Branch (536:13): [True: 2.68k, False: 754]
  |  Branch (536:26): [True: 27, False: 2.65k]
  ------------------
  537|     47|            case 1 : frameContentSize = MEM_readLE16(ip+pos)+256; break;
  ------------------
  |  Branch (537:13): [True: 47, False: 3.39k]
  ------------------
  538|    101|            case 2 : frameContentSize = MEM_readLE32(ip+pos); break;
  ------------------
  |  Branch (538:13): [True: 101, False: 3.33k]
  ------------------
  539|    606|            case 3 : frameContentSize = MEM_readLE64(ip+pos); break;
  ------------------
  |  Branch (539:13): [True: 606, False: 2.83k]
  ------------------
  540|  3.44k|        }
  541|  3.44k|        if (singleSegment) windowSize = frameContentSize;
  ------------------
  |  Branch (541:13): [True: 750, False: 2.69k]
  ------------------
  542|       |
  543|  3.44k|        zfhPtr->frameType = ZSTD_frame;
  544|  3.44k|        zfhPtr->frameContentSize = frameContentSize;
  545|  3.44k|        zfhPtr->windowSize = windowSize;
  546|  3.44k|        zfhPtr->blockSizeMax = (unsigned) MIN(windowSize, ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   54|  3.44k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 237, False: 3.20k]
  |  |  ------------------
  ------------------
  547|  3.44k|        zfhPtr->dictID = dictID;
  548|  3.44k|        zfhPtr->checksumFlag = checksumFlag;
  549|  3.44k|    }
  550|      0|    return 0;
  551|  3.44k|}
ZSTD_getFrameContentSize:
  570|  1.97k|{
  571|  1.97k|#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1)
  572|  1.97k|    if (ZSTD_isLegacy(src, srcSize)) {
  ------------------
  |  Branch (572:9): [True: 1.97k, False: 0]
  ------------------
  573|  1.97k|        unsigned long long const ret = ZSTD_getDecompressedSize_legacy(src, srcSize);
  574|  1.97k|        return ret == 0 ? ZSTD_CONTENTSIZE_UNKNOWN : ret;
  ------------------
  |  |  203|  1.76k|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (574:16): [True: 1.76k, False: 207]
  ------------------
  575|  1.97k|    }
  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.61k|{
 1199|  4.61k|    return ZSTD_decompress_usingDDict(dctx, dst, dstCapacity, src, srcSize, ZSTD_getDDict(dctx));
 1200|  4.61k|}
ZSTD_loadDEntropy:
 1454|    381|{
 1455|    381|    const BYTE* dictPtr = (const BYTE*)dict;
 1456|    381|    const BYTE* const dictEnd = dictPtr + dictSize;
 1457|       |
 1458|    381|    RETURN_ERROR_IF(dictSize <= 8, dictionary_corrupted, "dict is too small");
  ------------------
  |  |  114|    381|    do {                                                                       \
  |  |  115|    381|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 380]
  |  |  ------------------
  |  |  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|    381|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 380]
  |  |  ------------------
  ------------------
 1459|    380|    assert(MEM_readLE32(dict) == ZSTD_MAGIC_DICTIONARY);   /* dict must be valid */
  ------------------
  |  |   70|    380|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1460|    380|    dictPtr += 8;   /* skip header = magic + dictID */
 1461|       |
 1462|    380|    ZSTD_STATIC_ASSERT(offsetof(ZSTD_entropyDTables_t, OFTable) == offsetof(ZSTD_entropyDTables_t, LLTable) + sizeof(entropy->LLTable));
  ------------------
  |  |   43|    380|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|    380|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1463|    380|    ZSTD_STATIC_ASSERT(offsetof(ZSTD_entropyDTables_t, MLTable) == offsetof(ZSTD_entropyDTables_t, OFTable) + sizeof(entropy->OFTable));
  ------------------
  |  |   43|    380|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|    380|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1464|    380|    ZSTD_STATIC_ASSERT(sizeof(entropy->LLTable) + sizeof(entropy->OFTable) + sizeof(entropy->MLTable) >= HUF_DECOMPRESS_WORKSPACE_SIZE);
  ------------------
  |  |   43|    380|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|    380|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1465|    380|    {   void* const workspace = &entropy->LLTable;   /* use fse tables as temporary workspace; implies fse tables are grouped together */
 1466|    380|        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|    380|        size_t const hSize = HUF_readDTableX2_wksp(entropy->hufTable,
 1474|    380|                                                dictPtr, (size_t)(dictEnd - dictPtr),
 1475|    380|                                                workspace, workspaceSize, /* flags */ 0);
 1476|    380|#endif
 1477|    380|        RETURN_ERROR_IF(HUF_isError(hSize), dictionary_corrupted, "");
  ------------------
  |  |  114|    380|    do {                                                                       \
  |  |  115|    380|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 137, False: 243]
  |  |  ------------------
  |  |  116|    137|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    137|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 137]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    137|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    137|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    137|    do {                                           \
  |  |  |  |   99|    137|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 137]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    137|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 137]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    137|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    137|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 137]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    137|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    137|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 137]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    137|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    137|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    137|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    137|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    137|        }                                                                      \
  |  |  123|    380|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 243]
  |  |  ------------------
  ------------------
 1478|    243|        dictPtr += hSize;
 1479|    243|    }
 1480|       |
 1481|      0|    {   short offcodeNCount[MaxOff+1];
 1482|    243|        unsigned offcodeMaxValue = MaxOff, offcodeLog;
  ------------------
  |  |  106|    243|#define MaxOff  31
  ------------------
 1483|    243|        size_t const offcodeHeaderSize = FSE_readNCount(offcodeNCount, &offcodeMaxValue, &offcodeLog, dictPtr, (size_t)(dictEnd-dictPtr));
 1484|    243|        RETURN_ERROR_IF(FSE_isError(offcodeHeaderSize), dictionary_corrupted, "");
  ------------------
  |  |  114|    243|    do {                                                                       \
  |  |  115|    243|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 42, False: 201]
  |  |  ------------------
  |  |  116|     42|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     42|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 42]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     42|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     42|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     42|    do {                                           \
  |  |  |  |   99|     42|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 42]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     42|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 42]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     42|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     42|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 42]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     42|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     42|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 42]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     42|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     42|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     42|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     42|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     42|        }                                                                      \
  |  |  123|    243|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 201]
  |  |  ------------------
  ------------------
 1485|    201|        RETURN_ERROR_IF(offcodeMaxValue > MaxOff, dictionary_corrupted, "");
  ------------------
  |  |  114|    201|    do {                                                                       \
  |  |  115|    201|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 201]
  |  |  ------------------
  |  |  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|    201|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 201]
  |  |  ------------------
  ------------------
 1486|    201|        RETURN_ERROR_IF(offcodeLog > OffFSELog, dictionary_corrupted, "");
  ------------------
  |  |  114|    201|    do {                                                                       \
  |  |  115|    201|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 14, False: 187]
  |  |  ------------------
  |  |  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|    201|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 187]
  |  |  ------------------
  ------------------
 1487|    187|        ZSTD_buildFSETable( entropy->OFTable,
 1488|    187|                            offcodeNCount, offcodeMaxValue,
 1489|    187|                            OF_base, OF_bits,
 1490|    187|                            offcodeLog,
 1491|    187|                            entropy->workspace, sizeof(entropy->workspace),
 1492|    187|                            /* bmi2 */0);
 1493|    187|        dictPtr += offcodeHeaderSize;
 1494|    187|    }
 1495|       |
 1496|      0|    {   short matchlengthNCount[MaxML+1];
 1497|    187|        unsigned matchlengthMaxValue = MaxML, matchlengthLog;
  ------------------
  |  |  103|    187|#define MaxML   52
  ------------------
 1498|    187|        size_t const matchlengthHeaderSize = FSE_readNCount(matchlengthNCount, &matchlengthMaxValue, &matchlengthLog, dictPtr, (size_t)(dictEnd-dictPtr));
 1499|    187|        RETURN_ERROR_IF(FSE_isError(matchlengthHeaderSize), dictionary_corrupted, "");
  ------------------
  |  |  114|    187|    do {                                                                       \
  |  |  115|    187|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 38, False: 149]
  |  |  ------------------
  |  |  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|    187|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 149]
  |  |  ------------------
  ------------------
 1500|    149|        RETURN_ERROR_IF(matchlengthMaxValue > MaxML, dictionary_corrupted, "");
  ------------------
  |  |  114|    149|    do {                                                                       \
  |  |  115|    149|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 149]
  |  |  ------------------
  |  |  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|    149|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 149]
  |  |  ------------------
  ------------------
 1501|    149|        RETURN_ERROR_IF(matchlengthLog > MLFSELog, dictionary_corrupted, "");
  ------------------
  |  |  114|    149|    do {                                                                       \
  |  |  115|    149|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 10, False: 139]
  |  |  ------------------
  |  |  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|    149|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 139]
  |  |  ------------------
  ------------------
 1502|    139|        ZSTD_buildFSETable( entropy->MLTable,
 1503|    139|                            matchlengthNCount, matchlengthMaxValue,
 1504|    139|                            ML_base, ML_bits,
 1505|    139|                            matchlengthLog,
 1506|    139|                            entropy->workspace, sizeof(entropy->workspace),
 1507|    139|                            /* bmi2 */ 0);
 1508|    139|        dictPtr += matchlengthHeaderSize;
 1509|    139|    }
 1510|       |
 1511|      0|    {   short litlengthNCount[MaxLL+1];
 1512|    139|        unsigned litlengthMaxValue = MaxLL, litlengthLog;
  ------------------
  |  |  104|    139|#define MaxLL   35
  ------------------
 1513|    139|        size_t const litlengthHeaderSize = FSE_readNCount(litlengthNCount, &litlengthMaxValue, &litlengthLog, dictPtr, (size_t)(dictEnd-dictPtr));
 1514|    139|        RETURN_ERROR_IF(FSE_isError(litlengthHeaderSize), dictionary_corrupted, "");
  ------------------
  |  |  114|    139|    do {                                                                       \
  |  |  115|    139|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 26, False: 113]
  |  |  ------------------
  |  |  116|     26|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     26|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 26]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     26|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     26|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     26|    do {                                           \
  |  |  |  |   99|     26|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 26]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     26|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 26]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     26|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     26|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 26]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     26|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     26|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 26]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     26|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     26|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     26|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     26|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     26|        }                                                                      \
  |  |  123|    139|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 113]
  |  |  ------------------
  ------------------
 1515|    113|        RETURN_ERROR_IF(litlengthMaxValue > MaxLL, dictionary_corrupted, "");
  ------------------
  |  |  114|    113|    do {                                                                       \
  |  |  115|    113|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 113]
  |  |  ------------------
  |  |  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|    113|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 113]
  |  |  ------------------
  ------------------
 1516|    113|        RETURN_ERROR_IF(litlengthLog > LLFSELog, dictionary_corrupted, "");
  ------------------
  |  |  114|    113|    do {                                                                       \
  |  |  115|    113|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 5, False: 108]
  |  |  ------------------
  |  |  116|      5|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      5|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      5|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      5|    do {                                           \
  |  |  |  |   99|      5|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      5|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      5|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      5|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      5|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      5|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      5|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      5|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      5|        }                                                                      \
  |  |  123|    113|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 108]
  |  |  ------------------
  ------------------
 1517|    108|        ZSTD_buildFSETable( entropy->LLTable,
 1518|    108|                            litlengthNCount, litlengthMaxValue,
 1519|    108|                            LL_base, LL_bits,
 1520|    108|                            litlengthLog,
 1521|    108|                            entropy->workspace, sizeof(entropy->workspace),
 1522|    108|                            /* bmi2 */ 0);
 1523|    108|        dictPtr += litlengthHeaderSize;
 1524|    108|    }
 1525|       |
 1526|    108|    RETURN_ERROR_IF(dictPtr+12 > dictEnd, dictionary_corrupted, "");
  ------------------
  |  |  114|    108|    do {                                                                       \
  |  |  115|    108|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 28, False: 80]
  |  |  ------------------
  |  |  116|     28|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     28|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     28|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     28|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     28|    do {                                           \
  |  |  |  |   99|     28|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 28]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     28|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     28|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     28|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     28|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     28|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     28|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     28|        }                                                                      \
  |  |  123|    108|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 80]
  |  |  ------------------
  ------------------
 1527|     80|    {   int i;
 1528|     80|        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: 74, False: 52]
  |  |  ------------------
  |  |  116|     79|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     79|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 79]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     79|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     79|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     79|    do {                                           \
  |  |  |  |   99|     79|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 79]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     79|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 79]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     79|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     79|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 79]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     79|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     79|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 79]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     79|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     79|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     79|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     79|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     79|        }                                                                      \
  |  |  123|    131|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 52]
  |  |  ------------------
  ------------------
 1532|    131|                            dictionary_corrupted, "");
 1533|     52|            entropy->rep[i] = rep;
 1534|     52|    }   }
 1535|       |
 1536|      1|    return (size_t)(dictPtr - (const BYTE*)dict);
 1537|     80|}
ZSTD_decompressBegin:
 1561|  3.95k|{
 1562|  3.95k|    assert(dctx != NULL);
  ------------------
  |  |   70|  3.95k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1563|  3.95k|#if ZSTD_TRACE
 1564|  3.95k|    dctx->traceCtx = (ZSTD_trace_decompress_begin != NULL) ? ZSTD_trace_decompress_begin(dctx) : 0;
  ------------------
  |  Branch (1564:22): [True: 0, False: 3.95k]
  ------------------
 1565|  3.95k|#endif
 1566|  3.95k|    dctx->expected = ZSTD_startingInputLength(dctx->format);  /* dctx->format must be properly set */
 1567|  3.95k|    dctx->stage = ZSTDds_getFrameHeaderSize;
 1568|  3.95k|    dctx->processedCSize = 0;
 1569|  3.95k|    dctx->decodedSize = 0;
 1570|  3.95k|    dctx->previousDstEnd = NULL;
 1571|  3.95k|    dctx->prefixStart = NULL;
 1572|  3.95k|    dctx->virtualStart = NULL;
 1573|  3.95k|    dctx->dictEnd = NULL;
 1574|  3.95k|    dctx->entropy.hufTable[0] = (HUF_DTable)((ZSTD_HUFFDTABLE_CAPACITY_LOG)*0x1000001);  /* cover both little and big endian */
  ------------------
  |  |   78|  3.95k|#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
  ------------------
 1575|  3.95k|    dctx->litEntropy = dctx->fseEntropy = 0;
 1576|  3.95k|    dctx->dictID = 0;
 1577|  3.95k|    dctx->bType = bt_reserved;
 1578|  3.95k|    dctx->isFrameDecompression = 1;
 1579|  3.95k|    ZSTD_STATIC_ASSERT(sizeof(dctx->entropy.rep) == sizeof(repStartValue));
  ------------------
  |  |   43|  3.95k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  3.95k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1580|  3.95k|    ZSTD_memcpy(dctx->entropy.rep, repStartValue, sizeof(repStartValue));  /* initial repcodes */
  ------------------
  |  |   44|  3.95k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1581|  3.95k|    dctx->LLTptr = dctx->entropy.LLTable;
 1582|  3.95k|    dctx->MLTptr = dctx->entropy.MLTable;
 1583|  3.95k|    dctx->OFTptr = dctx->entropy.OFTable;
 1584|  3.95k|    dctx->HUFptr = dctx->entropy.hufTable;
 1585|  3.95k|    return 0;
 1586|  3.95k|}
ZSTD_decompressBegin_usingDict:
 1589|  2.46k|{
 1590|  2.46k|    FORWARD_IF_ERROR( ZSTD_decompressBegin(dctx) , "");
  ------------------
  |  |  146|  2.46k|    do {                                                                           \
  |  |  147|  2.46k|        size_t const err_code = (err);                                             \
  |  |  148|  2.46k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 2.46k]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|  2.46k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 2.46k]
  |  |  ------------------
  ------------------
 1591|  2.46k|    if (dict && dictSize)
  ------------------
  |  Branch (1591:9): [True: 0, False: 2.46k]
  |  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|  2.46k|            ZSTD_isError(ZSTD_decompress_insertDictionary(dctx, dict, dictSize)),
 1594|  2.46k|            dictionary_corrupted, "");
 1595|  2.46k|    return 0;
 1596|  2.46k|}
ZSTD_decompressBegin_usingDDict:
 1602|  1.49k|{
 1603|  1.49k|    DEBUGLOG(4, "ZSTD_decompressBegin_usingDDict");
  ------------------
  |  |  104|  1.49k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.49k]
  |  |  ------------------
  ------------------
 1604|  1.49k|    assert(dctx != NULL);
  ------------------
  |  |   70|  1.49k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1605|  1.49k|    if (ddict) {
  ------------------
  |  Branch (1605:9): [True: 1.49k, False: 0]
  ------------------
 1606|  1.49k|        const char* const dictStart = (const char*)ZSTD_DDict_dictContent(ddict);
 1607|  1.49k|        size_t const dictSize = ZSTD_DDict_dictSize(ddict);
 1608|  1.49k|        const void* const dictEnd = dictStart + dictSize;
 1609|  1.49k|        dctx->ddictIsCold = (dctx->dictEnd != dictEnd);
 1610|  1.49k|        DEBUGLOG(4, "DDict is %s",
  ------------------
  |  |  104|  1.49k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.49k]
  |  |  ------------------
  ------------------
 1611|  1.49k|                    dctx->ddictIsCold ? "~cold~" : "hot!");
 1612|  1.49k|    }
 1613|  1.49k|    FORWARD_IF_ERROR( ZSTD_decompressBegin(dctx) , "");
  ------------------
  |  |  146|  1.49k|    do {                                                                           \
  |  |  147|  1.49k|        size_t const err_code = (err);                                             \
  |  |  148|  1.49k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 1.49k]
  |  |  ------------------
  |  |  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.49k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 1.49k]
  |  |  ------------------
  ------------------
 1614|  1.49k|    if (ddict) {   /* NULL ddict is equivalent to no dictionary */
  ------------------
  |  Branch (1614:9): [True: 1.49k, False: 0]
  ------------------
 1615|  1.49k|        ZSTD_copyDDictParameters(dctx, ddict);
 1616|  1.49k|    }
 1617|  1.49k|    return 0;
 1618|  1.49k|}
ZSTD_decompress_usingDDict:
 1660|  7.12k|{
 1661|       |    /* pass content and size in case legacy frames are encountered */
 1662|  7.12k|    return ZSTD_decompressMultiFrame(dctx, dst, dstCapacity, src, srcSize,
 1663|       |                                     NULL, 0,
 1664|  7.12k|                                     ddict);
 1665|  7.12k|}
zstd_decompress.c:ZSTD_initDCtx_internal:
  253|  7.08k|{
  254|  7.08k|    dctx->staticSize  = 0;
  255|  7.08k|    dctx->ddict       = NULL;
  256|  7.08k|    dctx->ddictLocal  = NULL;
  257|  7.08k|    dctx->dictEnd     = NULL;
  258|  7.08k|    dctx->ddictIsCold = 0;
  259|  7.08k|    dctx->dictUses = ZSTD_dont_use;
  260|  7.08k|    dctx->inBuff      = NULL;
  261|  7.08k|    dctx->inBuffSize  = 0;
  262|  7.08k|    dctx->outBuffSize = 0;
  263|  7.08k|    dctx->streamStage = zdss_init;
  264|  7.08k|#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1)
  265|  7.08k|    dctx->legacyContext = NULL;
  266|  7.08k|    dctx->previousLegacyVersion = 0;
  267|  7.08k|#endif
  268|  7.08k|    dctx->noForwardProgress = 0;
  269|  7.08k|    dctx->oversizedDuration = 0;
  270|  7.08k|    dctx->isFrameDecompression = 1;
  271|  7.08k|#if DYNAMIC_BMI2
  272|  7.08k|    dctx->bmi2 = ZSTD_cpuSupportsBmi2();
  273|  7.08k|#endif
  274|  7.08k|    dctx->ddictSet = NULL;
  275|  7.08k|    ZSTD_DCtx_resetParameters(dctx);
  276|  7.08k|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  277|       |    dctx->dictContentEndForFuzzing = NULL;
  278|  7.08k|#endif
  279|  7.08k|}
zstd_decompress.c:ZSTD_createDCtx_internal:
  294|  7.08k|static ZSTD_DCtx* ZSTD_createDCtx_internal(ZSTD_customMem customMem) {
  295|  7.08k|    if ((!customMem.customAlloc) ^ (!customMem.customFree)) return NULL;
  ------------------
  |  Branch (295:9): [True: 0, False: 7.08k]
  ------------------
  296|       |
  297|  7.08k|    {   ZSTD_DCtx* const dctx = (ZSTD_DCtx*)ZSTD_customMalloc(sizeof(*dctx), customMem);
  298|  7.08k|        if (!dctx) return NULL;
  ------------------
  |  Branch (298:13): [True: 0, False: 7.08k]
  ------------------
  299|  7.08k|        dctx->customMem = customMem;
  300|  7.08k|        ZSTD_initDCtx_internal(dctx);
  301|  7.08k|        return dctx;
  302|  7.08k|    }
  303|  7.08k|}
zstd_decompress.c:ZSTD_clearDict:
  317|  11.6k|{
  318|  11.6k|    ZSTD_freeDDict(dctx->ddictLocal);
  319|  11.6k|    dctx->ddictLocal = NULL;
  320|       |    dctx->ddict = NULL;
  321|  11.6k|    dctx->dictUses = ZSTD_dont_use;
  322|  11.6k|}
zstd_decompress.c:ZSTD_frameHeaderSize_internal:
  417|  7.35k|{
  418|  7.35k|    size_t const minInputSize = ZSTD_startingInputLength(format);
  419|  7.35k|    RETURN_ERROR_IF(srcSize < minInputSize, srcSize_wrong, "");
  ------------------
  |  |  114|  7.35k|    do {                                                                       \
  |  |  115|  7.35k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 7.35k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  7.35k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 7.35k]
  |  |  ------------------
  ------------------
  420|       |
  421|  7.35k|    {   BYTE const fhd = ((const BYTE*)src)[minInputSize-1];
  422|  7.35k|        U32 const dictID= fhd & 3;
  423|  7.35k|        U32 const singleSegment = (fhd >> 5) & 1;
  424|  7.35k|        U32 const fcsId = fhd >> 6;
  425|  7.35k|        return minInputSize + !singleSegment
  426|  7.35k|             + ZSTD_did_fieldSize[dictID] + ZSTD_fcs_fieldSize[fcsId]
  427|  7.35k|             + (singleSegment && !fcsId);
  ------------------
  |  Branch (427:17): [True: 1.67k, False: 5.68k]
  |  Branch (427:34): [True: 128, False: 1.54k]
  ------------------
  428|  7.35k|    }
  429|  7.35k|}
zstd_decompress.c:ZSTD_startingInputLength:
  233|  24.3k|{
  234|  24.3k|    size_t const startingInputLength = ZSTD_FRAMEHEADERSIZE_PREFIX(format);
  ------------------
  |  | 1257|  24.3k|#define ZSTD_FRAMEHEADERSIZE_PREFIX(format) ((format) == ZSTD_f_zstd1 ? 5 : 1)   /* minimum input size required to query frame header size */
  |  |  ------------------
  |  |  |  Branch (1257:46): [True: 24.3k, False: 0]
  |  |  ------------------
  ------------------
  235|       |    /* only supports formats ZSTD_f_zstd1 and ZSTD_f_zstd1_magicless */
  236|  24.3k|    assert( (format == ZSTD_f_zstd1) || (format == ZSTD_f_zstd1_magicless) );
  ------------------
  |  |   70|  24.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  237|  24.3k|    return startingInputLength;
  238|  24.3k|}
zstd_decompress.c:readSkippableFrameSize:
  588|     42|{
  589|     42|    size_t const skippableHeaderSize = ZSTD_SKIPPABLEHEADERSIZE;
  ------------------
  |  | 1260|     42|#define ZSTD_SKIPPABLEHEADERSIZE    8
  ------------------
  590|     42|    U32 sizeU32;
  591|       |
  592|     42|    RETURN_ERROR_IF(srcSize < ZSTD_SKIPPABLEHEADERSIZE, srcSize_wrong, "");
  ------------------
  |  |  114|     42|    do {                                                                       \
  |  |  115|     42|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 41]
  |  |  ------------------
  |  |  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|     42|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 41]
  |  |  ------------------
  ------------------
  593|       |
  594|     41|    sizeU32 = MEM_readLE32((BYTE const*)src + ZSTD_FRAMEIDSIZE);
  ------------------
  |  |   82|     41|#define ZSTD_FRAMEIDSIZE 4   /* magic number size */
  ------------------
  595|     41|    RETURN_ERROR_IF((U32)(sizeU32 + ZSTD_SKIPPABLEHEADERSIZE) < sizeU32,
  ------------------
  |  |  114|     41|    do {                                                                       \
  |  |  115|     41|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 40]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|     41|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 40]
  |  |  ------------------
  ------------------
  596|     41|                    frameParameter_unsupported, "");
  597|     40|    {   size_t const skippableSize = skippableHeaderSize + sizeU32;
  598|     40|        RETURN_ERROR_IF(skippableSize > srcSize, srcSize_wrong, "");
  ------------------
  |  |  114|     40|    do {                                                                       \
  |  |  115|     40|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 38, False: 2]
  |  |  ------------------
  |  |  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|     40|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2]
  |  |  ------------------
  ------------------
  599|      2|        return skippableSize;
  600|     40|    }
  601|     40|}
zstd_decompress.c:ZSTD_decompressMultiFrame:
 1075|  7.12k|{
 1076|  7.12k|    void* const dststart = dst;
 1077|  7.12k|    int moreThan1Frame = 0;
 1078|       |
 1079|  7.12k|    DEBUGLOG(5, "ZSTD_decompressMultiFrame");
  ------------------
  |  |  104|  7.12k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 7.12k]
  |  |  ------------------
  ------------------
 1080|  7.12k|    assert(dict==NULL || ddict==NULL);  /* either dict or ddict set, not both */
  ------------------
  |  |   70|  7.12k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1081|       |
 1082|  7.12k|    if (ddict) {
  ------------------
  |  Branch (1082:9): [True: 2.51k, False: 4.61k]
  ------------------
 1083|  2.51k|        dict = ZSTD_DDict_dictContent(ddict);
 1084|  2.51k|        dictSize = ZSTD_DDict_dictSize(ddict);
 1085|  2.51k|    }
 1086|       |
 1087|  9.15k|    while (srcSize >= ZSTD_startingInputLength(dctx->format)) {
  ------------------
  |  Branch (1087:12): [True: 8.90k, False: 258]
  ------------------
 1088|       |
 1089|  8.90k|#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1)
 1090|  8.90k|        if (dctx->format == ZSTD_f_zstd1 && ZSTD_isLegacy(src, srcSize)) {
  ------------------
  |  Branch (1090:13): [True: 8.90k, False: 0]
  |  Branch (1090:45): [True: 4.90k, False: 3.99k]
  ------------------
 1091|  4.90k|            size_t decodedSize;
 1092|  4.90k|            size_t const frameSize = ZSTD_findFrameCompressedSizeLegacy(src, srcSize);
 1093|  4.90k|            if (ZSTD_isError(frameSize)) return frameSize;
  ------------------
  |  |   44|  4.90k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1093:17): [True: 159, False: 4.74k]
  ------------------
 1094|  4.74k|            RETURN_ERROR_IF(dctx->staticSize, memory_allocation,
  ------------------
  |  |  114|  4.74k|    do {                                                                       \
  |  |  115|  4.74k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.74k]
  |  |  ------------------
  |  |  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.74k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.74k]
  |  |  ------------------
  ------------------
 1095|  4.74k|                "legacy support is not compatible with static dctx");
 1096|       |
 1097|  4.74k|            decodedSize = ZSTD_decompressLegacy(dst, dstCapacity, src, frameSize, dict, dictSize);
 1098|  4.74k|            if (ZSTD_isError(decodedSize)) return decodedSize;
  ------------------
  |  |   44|  4.74k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1098:17): [True: 2.77k, False: 1.97k]
  ------------------
 1099|       |
 1100|  1.97k|            {
 1101|  1.97k|                unsigned long long const expectedSize = ZSTD_getFrameContentSize(src, srcSize);
 1102|  1.97k|                RETURN_ERROR_IF(expectedSize == ZSTD_CONTENTSIZE_ERROR, corruption_detected, "Corrupted frame header!");
  ------------------
  |  |  114|  1.97k|    do {                                                                       \
  |  |  115|  1.97k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 1.97k]
  |  |  ------------------
  |  |  116|      0|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      0|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      0|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      0|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      0|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      0|        }                                                                      \
  |  |  123|  1.97k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.97k]
  |  |  ------------------
  ------------------
 1103|  1.97k|                if (expectedSize != ZSTD_CONTENTSIZE_UNKNOWN) {
  ------------------
  |  |  203|  1.97k|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (1103:21): [True: 207, False: 1.76k]
  ------------------
 1104|    207|                    RETURN_ERROR_IF(expectedSize != decodedSize, corruption_detected,
  ------------------
  |  |  114|    207|    do {                                                                       \
  |  |  115|    207|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 206, False: 1]
  |  |  ------------------
  |  |  116|    206|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    206|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 206]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    206|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    206|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    206|    do {                                           \
  |  |  |  |   99|    206|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 206]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    206|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 206]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    206|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    206|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 206]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    206|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    206|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 206]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    206|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    206|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    206|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    206|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    206|        }                                                                      \
  |  |  123|    207|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
 1105|    207|                        "Frame header size does not match decoded size!");
 1106|    207|                }
 1107|  1.97k|            }
 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.97k|        }
 1118|  3.99k|#endif
 1119|       |
 1120|  3.99k|        if (dctx->format == ZSTD_f_zstd1 && srcSize >= 4) {
  ------------------
  |  Branch (1120:13): [True: 3.99k, False: 0]
  |  Branch (1120:45): [True: 3.99k, False: 0]
  ------------------
 1121|  3.99k|            U32 const magicNumber = MEM_readLE32(src);
 1122|  3.99k|            DEBUGLOG(5, "reading magic number %08X", (unsigned)magicNumber);
  ------------------
  |  |  104|  3.99k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.99k]
  |  |  ------------------
  ------------------
 1123|  3.99k|            if ((magicNumber & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  145|  3.99k|#define ZSTD_MAGIC_SKIPPABLE_MASK   0xFFFFFFF0
  ------------------
                          if ((magicNumber & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  144|  3.99k|#define ZSTD_MAGIC_SKIPPABLE_START  0x184D2A50    /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */
  ------------------
  |  Branch (1123:17): [True: 42, False: 3.95k]
  ------------------
 1124|       |                /* skippable frame detected : skip it */
 1125|     42|                size_t const skippableSize = readSkippableFrameSize(src, srcSize);
 1126|     42|                FORWARD_IF_ERROR(skippableSize, "invalid skippable frame");
  ------------------
  |  |  146|     42|    do {                                                                           \
  |  |  147|     42|        size_t const err_code = (err);                                             \
  |  |  148|     42|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 40, False: 2]
  |  |  ------------------
  |  |  149|     40|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|     40|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 40]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|     40|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|     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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|     40|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|     40|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 40]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|     40|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|     40|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 40]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     40|            return err_code;                                                       \
  |  |  155|     40|        }                                                                          \
  |  |  156|     42|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 2]
  |  |  ------------------
  ------------------
 1127|      2|                assert(skippableSize <= srcSize);
  ------------------
  |  |   70|      2|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1128|       |
 1129|      2|                src = (const BYTE *)src + skippableSize;
 1130|      2|                srcSize -= skippableSize;
 1131|      2|                continue; /* check next frame */
 1132|     42|        }   }
 1133|       |
 1134|  3.95k|        if (ddict) {
  ------------------
  |  Branch (1134:13): [True: 1.49k, False: 2.46k]
  ------------------
 1135|       |            /* we were called from ZSTD_decompress_usingDDict */
 1136|  1.49k|            FORWARD_IF_ERROR(ZSTD_decompressBegin_usingDDict(dctx, ddict), "");
  ------------------
  |  |  146|  1.49k|    do {                                                                           \
  |  |  147|  1.49k|        size_t const err_code = (err);                                             \
  |  |  148|  1.49k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 1.49k]
  |  |  ------------------
  |  |  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.49k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 1.49k]
  |  |  ------------------
  ------------------
 1137|  2.46k|        } else {
 1138|       |            /* this will initialize correctly with no dict if dict == NULL, so
 1139|       |             * use this in all cases but ddict */
 1140|  2.46k|            FORWARD_IF_ERROR(ZSTD_decompressBegin_usingDict(dctx, dict, dictSize), "");
  ------------------
  |  |  146|  2.46k|    do {                                                                           \
  |  |  147|  2.46k|        size_t const err_code = (err);                                             \
  |  |  148|  2.46k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 2.46k]
  |  |  ------------------
  |  |  149|      0|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      0|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      0|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      0|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      0|            return err_code;                                                       \
  |  |  155|      0|        }                                                                          \
  |  |  156|  2.46k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 2.46k]
  |  |  ------------------
  ------------------
 1141|  2.46k|        }
 1142|  3.95k|        ZSTD_checkContinuity(dctx, dst, dstCapacity);
 1143|       |
 1144|  3.95k|        {   const size_t res = ZSTD_decompressFrame(dctx, dst, dstCapacity,
 1145|  3.95k|                                                    &src, &srcSize);
 1146|  3.95k|            RETURN_ERROR_IF(
  ------------------
  |  |  114|  3.95k|    do {                                                                       \
  |  |  115|  8.36k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 446, False: 3.51k]
  |  |  |  Branch (115:13): [True: 36, False: 410]
  |  |  ------------------
  |  |  116|     36|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     36|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 36]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     36|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     36|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     36|    do {                                           \
  |  |  |  |   99|     36|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 36]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     36|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 36]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     36|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     36|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 36]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     36|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     36|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 36]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     36|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     36|        }                                                                      \
  |  |  123|  3.95k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.92k]
  |  |  ------------------
  ------------------
 1147|  3.95k|                (ZSTD_getErrorCode(res) == ZSTD_error_prefix_unknown)
 1148|  3.95k|             && (moreThan1Frame==1),
 1149|  3.95k|                srcSize_wrong,
 1150|  3.95k|                "At least one frame successfully completed, "
 1151|  3.95k|                "but following bytes are garbage: "
 1152|  3.95k|                "it's more likely to be a srcSize error, "
 1153|  3.95k|                "specifying more input bytes than size of frame(s). "
 1154|  3.95k|                "Note: one could be unlucky, it might be a corruption error instead, "
 1155|  3.95k|                "happening right at the place where we expect zstd magic bytes. "
 1156|  3.95k|                "But this is _much_ less likely than a srcSize field error.");
 1157|  3.92k|            if (ZSTD_isError(res)) return res;
  ------------------
  |  |   44|  3.92k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1157:17): [True: 3.65k, False: 264]
  ------------------
 1158|    264|            assert(res <= dstCapacity);
  ------------------
  |  |   70|    264|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1159|    264|            if (res != 0)
  ------------------
  |  Branch (1159:17): [True: 259, False: 5]
  ------------------
 1160|    259|                dst = (BYTE*)dst + res;
 1161|    264|            dstCapacity -= res;
 1162|    264|        }
 1163|      0|        moreThan1Frame = 1;
 1164|    264|    }  /* while (srcSize >= ZSTD_frameHeaderSize_prefix) */
 1165|       |
 1166|    258|    RETURN_ERROR_IF(srcSize, srcSize_wrong, "input not entirely consumed");
  ------------------
  |  |  114|    258|    do {                                                                       \
  |  |  115|    258|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 151, False: 107]
  |  |  ------------------
  |  |  116|    151|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    151|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 151]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    151|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    151|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    151|    do {                                           \
  |  |  |  |   99|    151|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 151]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    151|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 151]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    151|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    151|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 151]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    151|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    151|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 151]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    151|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    151|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    151|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    151|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    151|        }                                                                      \
  |  |  123|    258|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 107]
  |  |  ------------------
  ------------------
 1167|       |
 1168|    107|    return (size_t)((BYTE*)dst - (BYTE*)dststart);
 1169|    258|}
zstd_decompress.c:ZSTD_decompressFrame:
  956|  3.95k|{
  957|  3.95k|    const BYTE* const istart = (const BYTE*)(*srcPtr);
  958|  3.95k|    const BYTE* ip = istart;
  959|  3.95k|    BYTE* const ostart = (BYTE*)dst;
  960|  3.95k|    BYTE* const oend = dstCapacity != 0 ? ostart + dstCapacity : ostart;
  ------------------
  |  Branch (960:24): [True: 3.95k, False: 1]
  ------------------
  961|  3.95k|    BYTE* op = ostart;
  962|  3.95k|    size_t remainingSrcSize = *srcSizePtr;
  963|       |
  964|  3.95k|    DEBUGLOG(4, "ZSTD_decompressFrame (srcSize:%i)", (int)*srcSizePtr);
  ------------------
  |  |  104|  3.95k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.95k]
  |  |  ------------------
  ------------------
  965|       |
  966|       |    /* check */
  967|  3.95k|    RETURN_ERROR_IF(
  ------------------
  |  |  114|  3.95k|    do {                                                                       \
  |  |  115|  11.8k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3.95k, False: 0]
  |  |  |  Branch (115:13): [True: 43, False: 3.91k]
  |  |  ------------------
  |  |  116|     43|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     43|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 43]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     43|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     43|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     43|    do {                                           \
  |  |  |  |   99|     43|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 43]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     43|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 43]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     43|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     43|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 43]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     43|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     43|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 43]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     43|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     43|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     43|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     43|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     43|        }                                                                      \
  |  |  123|  3.95k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.91k]
  |  |  ------------------
  ------------------
  968|  3.95k|        remainingSrcSize < ZSTD_FRAMEHEADERSIZE_MIN(dctx->format)+ZSTD_blockHeaderSize,
  969|  3.95k|        srcSize_wrong, "");
  970|       |
  971|       |    /* Frame Header */
  972|  3.91k|    {   size_t const frameHeaderSize = ZSTD_frameHeaderSize_internal(
  973|  3.91k|                ip, ZSTD_FRAMEHEADERSIZE_PREFIX(dctx->format), dctx->format);
  ------------------
  |  | 1257|  3.91k|#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.91k, False: 0]
  |  |  ------------------
  ------------------
  974|  3.91k|        if (ZSTD_isError(frameHeaderSize)) return frameHeaderSize;
  ------------------
  |  |   44|  3.91k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (974:13): [True: 0, False: 3.91k]
  ------------------
  975|  3.91k|        RETURN_ERROR_IF(remainingSrcSize < frameHeaderSize+ZSTD_blockHeaderSize,
  ------------------
  |  |  114|  3.91k|    do {                                                                       \
  |  |  115|  3.91k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 23, False: 3.89k]
  |  |  ------------------
  |  |  116|     23|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     23|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 23]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     23|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     23|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     23|    do {                                           \
  |  |  |  |   99|     23|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 23]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     23|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 23]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     23|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     23|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 23]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     23|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     23|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 23]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     23|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     23|        }                                                                      \
  |  |  123|  3.91k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.89k]
  |  |  ------------------
  ------------------
  976|  3.91k|                        srcSize_wrong, "");
  977|  3.89k|        FORWARD_IF_ERROR( ZSTD_decodeFrameHeader(dctx, ip, frameHeaderSize) , "");
  ------------------
  |  |  146|  3.89k|    do {                                                                           \
  |  |  147|  3.89k|        size_t const err_code = (err);                                             \
  |  |  148|  3.89k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 451, False: 3.44k]
  |  |  ------------------
  |  |  149|    451|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|    451|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 451]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|    451|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|    451|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|    451|    do {                                           \
  |  |  |  |   99|    451|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 451]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    451|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 451]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|    451|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|    451|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 451]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|    451|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|    451|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 451]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|    451|            return err_code;                                                       \
  |  |  155|    451|        }                                                                          \
  |  |  156|  3.89k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 3.44k]
  |  |  ------------------
  ------------------
  978|  3.44k|        ip += frameHeaderSize; remainingSrcSize -= frameHeaderSize;
  979|  3.44k|    }
  980|       |
  981|       |    /* Shrink the blockSizeMax if enabled */
  982|  3.44k|    if (dctx->maxBlockSizeParam != 0)
  ------------------
  |  Branch (982:9): [True: 0, False: 3.44k]
  ------------------
  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.85k|    while (1) {
  ------------------
  |  Branch (986:12): [True: 4.85k, Folded]
  ------------------
  987|  4.85k|        BYTE* oBlockEnd = oend;
  988|  4.85k|        size_t decodedSize;
  989|  4.85k|        blockProperties_t blockProperties;
  990|  4.85k|        size_t const cBlockSize = ZSTD_getcBlockSize(ip, remainingSrcSize, &blockProperties);
  991|  4.85k|        if (ZSTD_isError(cBlockSize)) return cBlockSize;
  ------------------
  |  |   44|  4.85k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (991:13): [True: 40, False: 4.81k]
  ------------------
  992|       |
  993|  4.81k|        ip += ZSTD_blockHeaderSize;
  994|  4.81k|        remainingSrcSize -= ZSTD_blockHeaderSize;
  995|  4.81k|        RETURN_ERROR_IF(cBlockSize > remainingSrcSize, srcSize_wrong, "");
  ------------------
  |  |  114|  4.81k|    do {                                                                       \
  |  |  115|  4.81k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 94, False: 4.71k]
  |  |  ------------------
  |  |  116|     94|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     94|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 94]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     94|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     94|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     94|    do {                                           \
  |  |  |  |   99|     94|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 94]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     94|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 94]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     94|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     94|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 94]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     94|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     94|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 94]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     94|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     94|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     94|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     94|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     94|        }                                                                      \
  |  |  123|  4.81k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.71k]
  |  |  ------------------
  ------------------
  996|       |
  997|  4.71k|        if (ip >= op && ip < oBlockEnd) {
  ------------------
  |  Branch (997:13): [True: 3, False: 4.71k]
  |  Branch (997:25): [True: 0, False: 3]
  ------------------
  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.71k|        switch(blockProperties.blockType)
 1015|  4.71k|        {
 1016|  3.16k|        case bt_compressed:
  ------------------
  |  Branch (1016:9): [True: 3.16k, False: 1.55k]
  ------------------
 1017|  3.16k|            assert(dctx->isFrameDecompression == 1);
  ------------------
  |  |   70|  3.16k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1018|  3.16k|            decodedSize = ZSTD_decompressBlock_internal(dctx, op, (size_t)(oBlockEnd-op), ip, cBlockSize, not_streaming);
 1019|  3.16k|            break;
 1020|  1.16k|        case bt_raw :
  ------------------
  |  Branch (1020:9): [True: 1.16k, False: 3.55k]
  ------------------
 1021|       |            /* Use oend instead of oBlockEnd because this function is safe to overlap. It uses memmove. */
 1022|  1.16k|            decodedSize = ZSTD_copyRawBlock(op, (size_t)(oend-op), ip, cBlockSize);
 1023|  1.16k|            break;
 1024|    390|        case bt_rle :
  ------------------
  |  Branch (1024:9): [True: 390, False: 4.32k]
  ------------------
 1025|    390|            decodedSize = ZSTD_setRleBlock(op, (size_t)(oBlockEnd-op), *ip, blockProperties.origSize);
 1026|    390|            break;
 1027|      0|        case bt_reserved :
  ------------------
  |  Branch (1027:9): [True: 0, False: 4.71k]
  ------------------
 1028|      0|        default:
  ------------------
  |  Branch (1028:9): [True: 0, False: 4.71k]
  ------------------
 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.71k|        }
 1031|  4.71k|        FORWARD_IF_ERROR(decodedSize, "Block decompression failure");
  ------------------
  |  |  146|  4.71k|    do {                                                                           \
  |  |  147|  4.71k|        size_t const err_code = (err);                                             \
  |  |  148|  4.71k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 2.86k, False: 1.85k]
  |  |  ------------------
  |  |  149|  2.86k|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|  2.86k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2.86k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|  2.86k|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|  2.86k|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|  2.86k|    do {                                           \
  |  |  |  |   99|  2.86k|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 2.86k]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|  2.86k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 2.86k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|  2.86k|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|  2.86k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2.86k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  2.86k|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|  2.86k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2.86k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  2.86k|            return err_code;                                                       \
  |  |  155|  2.86k|        }                                                                          \
  |  |  156|  4.71k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 1.85k]
  |  |  ------------------
  ------------------
 1032|  1.85k|        DEBUGLOG(5, "Decompressed block of dSize = %u", (unsigned)decodedSize);
  ------------------
  |  |  104|  1.85k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.85k]
  |  |  ------------------
  ------------------
 1033|  1.85k|        if (dctx->validateChecksum) {
  ------------------
  |  Branch (1033:13): [True: 1.14k, False: 714]
  ------------------
 1034|  1.14k|            XXH64_update(&dctx->xxhState, op, decodedSize);
  ------------------
  |  |  460|  1.14k|#  define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update)
  |  |  ------------------
  |  |  |  |  443|  1.14k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|  1.14k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1035|  1.14k|        }
 1036|  1.85k|        if (decodedSize) /* support dst = NULL,0 */ {
  ------------------
  |  Branch (1036:13): [True: 871, False: 985]
  ------------------
 1037|    871|            op += decodedSize;
 1038|    871|        }
 1039|  1.85k|        assert(ip != NULL);
  ------------------
  |  |   70|  1.85k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1040|  1.85k|        ip += cBlockSize;
 1041|  1.85k|        remainingSrcSize -= cBlockSize;
 1042|  1.85k|        if (blockProperties.lastBlock) break;
  ------------------
  |  Branch (1042:13): [True: 445, False: 1.41k]
  ------------------
 1043|  1.85k|    }
 1044|       |
 1045|    445|    if (dctx->fParams.frameContentSize != ZSTD_CONTENTSIZE_UNKNOWN) {
  ------------------
  |  |  203|    445|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (1045:9): [True: 222, False: 223]
  ------------------
 1046|    222|        RETURN_ERROR_IF((U64)(op-ostart) != dctx->fParams.frameContentSize,
  ------------------
  |  |  114|    222|    do {                                                                       \
  |  |  115|    222|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 139, False: 83]
  |  |  ------------------
  |  |  116|    139|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    139|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 139]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    139|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    139|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    139|    do {                                           \
  |  |  |  |   99|    139|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 139]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    139|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 139]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    139|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    139|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 139]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    139|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    139|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 139]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    139|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    139|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    139|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    139|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    139|        }                                                                      \
  |  |  123|    222|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 83]
  |  |  ------------------
  ------------------
 1047|    222|                        corruption_detected, "");
 1048|    222|    }
 1049|    306|    if (dctx->fParams.checksumFlag) { /* Frame content checksum verification */
  ------------------
  |  Branch (1049:9): [True: 43, False: 263]
  ------------------
 1050|     43|        RETURN_ERROR_IF(remainingSrcSize<4, checksum_wrong, "");
  ------------------
  |  |  114|     43|    do {                                                                       \
  |  |  115|     43|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 42]
  |  |  ------------------
  |  |  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|     43|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 42]
  |  |  ------------------
  ------------------
 1051|     42|        if (!dctx->forceIgnoreChecksum) {
  ------------------
  |  Branch (1051:13): [True: 42, False: 0]
  ------------------
 1052|     42|            U32 const checkCalc = (U32)XXH64_digest(&dctx->xxhState);
  ------------------
  |  |  461|     42|#  define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest)
  |  |  ------------------
  |  |  |  |  443|     42|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|     42|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1053|     42|            U32 checkRead;
 1054|     42|            checkRead = MEM_readLE32(ip);
 1055|     42|            RETURN_ERROR_IF(checkRead != checkCalc, checksum_wrong, "");
  ------------------
  |  |  114|     42|    do {                                                                       \
  |  |  115|     42|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 41, False: 1]
  |  |  ------------------
  |  |  116|     41|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     41|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 41]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     41|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     41|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     41|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 41]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     41|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     41|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 41]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     41|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     41|        }                                                                      \
  |  |  123|     42|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
 1056|     42|        }
 1057|      1|        ip += 4;
 1058|      1|        remainingSrcSize -= 4;
 1059|      1|    }
 1060|    264|    ZSTD_DCtx_trace_end(dctx, (U64)(op-ostart), (U64)(ip-istart), /* streaming */ 0);
 1061|       |    /* Allow caller to get size read */
 1062|    264|    DEBUGLOG(4, "ZSTD_decompressFrame: decompressed frame of size %i, consuming %i bytes of input", (int)(op-ostart), (int)(ip - (const BYTE*)*srcPtr));
  ------------------
  |  |  104|    264|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 264]
  |  |  ------------------
  ------------------
 1063|    264|    *srcPtr = ip;
 1064|    264|    *srcSizePtr = remainingSrcSize;
 1065|    264|    return (size_t)(op-ostart);
 1066|    306|}
zstd_decompress.c:ZSTD_getDDict:
 1181|  4.61k|{
 1182|  4.61k|    switch (dctx->dictUses) {
 1183|      0|    default:
  ------------------
  |  Branch (1183:5): [True: 0, False: 4.61k]
  ------------------
 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.61k|    case ZSTD_dont_use:
  ------------------
  |  Branch (1186:5): [True: 4.61k, False: 0]
  ------------------
 1187|  4.61k|        ZSTD_clearDict(dctx);
 1188|  4.61k|        return NULL;
 1189|      0|    case ZSTD_use_indefinitely:
  ------------------
  |  Branch (1189:5): [True: 0, False: 4.61k]
  ------------------
 1190|      0|        return dctx->ddict;
 1191|      0|    case ZSTD_use_once:
  ------------------
  |  Branch (1191:5): [True: 0, False: 4.61k]
  ------------------
 1192|      0|        dctx->dictUses = ZSTD_dont_use;
 1193|      0|        return dctx->ddict;
 1194|  4.61k|    }
 1195|  4.61k|}
zstd_decompress.c:ZSTD_decodeFrameHeader:
  703|  3.89k|{
  704|  3.89k|    size_t const result = ZSTD_getFrameHeader_advanced(&(dctx->fParams), src, headerSize, dctx->format);
  705|  3.89k|    if (ZSTD_isError(result)) return result;    /* invalid header */
  ------------------
  |  |   44|  3.89k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (705:9): [True: 451, False: 3.44k]
  ------------------
  706|  3.44k|    RETURN_ERROR_IF(result>0, srcSize_wrong, "headerSize too small");
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
  707|       |
  708|       |    /* Reference DDict requested by frame if dctx references multiple ddicts */
  709|  3.44k|    if (dctx->refMultipleDDicts == ZSTD_rmd_refMultipleDDicts && dctx->ddictSet) {
  ------------------
  |  Branch (709:9): [True: 0, False: 3.44k]
  |  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.44k|    dctx->validateChecksum = (dctx->fParams.checksumFlag && !dctx->forceIgnoreChecksum) ? 1 : 0;
  ------------------
  |  Branch (720:31): [True: 705, False: 2.73k]
  |  Branch (720:61): [True: 705, False: 0]
  ------------------
  721|  3.44k|    if (dctx->validateChecksum) XXH64_reset(&dctx->xxhState, 0);
  ------------------
  |  |  459|    705|#  define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset)
  |  |  ------------------
  |  |  |  |  443|    705|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|    705|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (721:9): [True: 705, False: 2.73k]
  ------------------
  722|  3.44k|    dctx->processedCSize += headerSize;
  723|  3.44k|    return 0;
  724|  3.44k|}
zstd_decompress.c:ZSTD_copyRawBlock:
  898|  1.16k|{
  899|  1.16k|    DEBUGLOG(5, "ZSTD_copyRawBlock");
  ------------------
  |  |  104|  1.16k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  900|  1.16k|    RETURN_ERROR_IF(srcSize > dstCapacity, dstSize_tooSmall, "");
  ------------------
  |  |  114|  1.16k|    do {                                                                       \
  |  |  115|  1.16k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 6, False: 1.16k]
  |  |  ------------------
  |  |  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|  1.16k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  901|  1.16k|    if (dst == NULL) {
  ------------------
  |  Branch (901:9): [True: 0, False: 1.16k]
  ------------------
  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.16k|    ZSTD_memmove(dst, src, srcSize);
  ------------------
  |  |   45|  1.16k|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  906|  1.16k|    return srcSize;
  907|  1.16k|}
zstd_decompress.c:ZSTD_setRleBlock:
  912|    390|{
  913|    390|    RETURN_ERROR_IF(regenSize > dstCapacity, dstSize_tooSmall, "");
  ------------------
  |  |  114|    390|    do {                                                                       \
  |  |  115|    390|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 6, False: 384]
  |  |  ------------------
  |  |  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|    390|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 384]
  |  |  ------------------
  ------------------
  914|    384|    if (dst == NULL) {
  ------------------
  |  Branch (914:9): [True: 0, False: 384]
  ------------------
  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|    384|    ZSTD_memset(dst, b, regenSize);
  ------------------
  |  |   46|    384|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  919|    384|    return regenSize;
  920|    384|}
zstd_decompress.c:ZSTD_DCtx_trace_end:
  923|    264|{
  924|    264|#if ZSTD_TRACE
  925|    264|    if (dctx->traceCtx && ZSTD_trace_decompress_end != NULL) {
  ------------------
  |  Branch (925:9): [True: 0, False: 264]
  |  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|    264|}
zstd_decompress.c:ZSTD_DCtx_resetParameters:
  241|  7.08k|{
  242|  7.08k|    assert(dctx->streamStage == zdss_init);
  ------------------
  |  |   70|  7.08k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  243|  7.08k|    dctx->format = ZSTD_f_zstd1;
  244|  7.08k|    dctx->maxWindowSize = ZSTD_MAXWINDOWSIZE_DEFAULT;
  ------------------
  |  |   40|  7.08k|#  define ZSTD_MAXWINDOWSIZE_DEFAULT (((U32)1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT) + 1)
  |  |  ------------------
  |  |  |  | 1287|  7.08k|#define ZSTD_WINDOWLOG_LIMIT_DEFAULT 27   /* by default, the streaming decoder will refuse any frame
  |  |  ------------------
  ------------------
  245|  7.08k|    dctx->outBufferMode = ZSTD_bm_buffered;
  246|  7.08k|    dctx->forceIgnoreChecksum = ZSTD_d_validateChecksum;
  247|  7.08k|    dctx->refMultipleDDicts = ZSTD_rmd_refSingleDDict;
  248|  7.08k|    dctx->disableHufAsm = 0;
  249|  7.08k|    dctx->maxBlockSizeParam = 0;
  250|  7.08k|}

ZSTD_getcBlockSize:
   65|  4.85k|{
   66|  4.85k|    RETURN_ERROR_IF(srcSize < ZSTD_blockHeaderSize, srcSize_wrong, "");
  ------------------
  |  |  114|  4.85k|    do {                                                                       \
  |  |  115|  4.85k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 8, False: 4.84k]
  |  |  ------------------
  |  |  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|  4.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.84k]
  |  |  ------------------
  ------------------
   67|       |
   68|  4.84k|    {   U32 const cBlockHeader = MEM_readLE24(src);
   69|  4.84k|        U32 const cSize = cBlockHeader >> 3;
   70|  4.84k|        bpPtr->lastBlock = cBlockHeader & 1;
   71|  4.84k|        bpPtr->blockType = (blockType_e)((cBlockHeader >> 1) & 3);
   72|  4.84k|        bpPtr->origSize = cSize;   /* only useful for RLE */
   73|  4.84k|        if (bpPtr->blockType == bt_rle) return 1;
  ------------------
  |  Branch (73:13): [True: 390, False: 4.45k]
  ------------------
   74|  4.45k|        RETURN_ERROR_IF(bpPtr->blockType == bt_reserved, corruption_detected, "");
  ------------------
  |  |  114|  4.45k|    do {                                                                       \
  |  |  115|  4.45k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 32, False: 4.42k]
  |  |  ------------------
  |  |  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|  4.45k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.42k]
  |  |  ------------------
  ------------------
   75|  4.42k|        return cSize;
   76|  4.45k|    }
   77|  4.45k|}
ZSTD_buildFSETable:
  630|  2.92k|{
  631|  2.92k|#if DYNAMIC_BMI2
  632|  2.92k|    if (bmi2) {
  ------------------
  |  Branch (632:9): [True: 2.49k, False: 434]
  ------------------
  633|  2.49k|        ZSTD_buildFSETable_body_bmi2(dt, normalizedCounter, maxSymbolValue,
  634|  2.49k|                baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  635|  2.49k|        return;
  636|  2.49k|    }
  637|    434|#endif
  638|    434|    (void)bmi2;
  639|    434|    ZSTD_buildFSETable_body_default(dt, normalizedCounter, maxSymbolValue,
  640|    434|            baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  641|    434|}
ZSTD_decodeSeqHeaders:
  697|  2.38k|{
  698|  2.38k|    const BYTE* const istart = (const BYTE*)src;
  699|  2.38k|    const BYTE* const iend = istart + srcSize;
  700|  2.38k|    const BYTE* ip = istart;
  701|  2.38k|    int nbSeq;
  702|  2.38k|    DEBUGLOG(5, "ZSTD_decodeSeqHeaders");
  ------------------
  |  |  104|  2.38k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.38k]
  |  |  ------------------
  ------------------
  703|       |
  704|       |    /* check */
  705|  2.38k|    RETURN_ERROR_IF(srcSize < MIN_SEQUENCES_SIZE, srcSize_wrong, "");
  ------------------
  |  |  114|  2.38k|    do {                                                                       \
  |  |  115|  2.38k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 2.38k]
  |  |  ------------------
  |  |  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.38k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.38k]
  |  |  ------------------
  ------------------
  706|       |
  707|       |    /* SeqHead */
  708|  2.38k|    nbSeq = *ip++;
  709|  2.38k|    if (nbSeq > 0x7F) {
  ------------------
  |  Branch (709:9): [True: 1.76k, False: 628]
  ------------------
  710|  1.76k|        if (nbSeq == 0xFF) {
  ------------------
  |  Branch (710:13): [True: 46, False: 1.71k]
  ------------------
  711|     46|            RETURN_ERROR_IF(ip+2 > iend, srcSize_wrong, "");
  ------------------
  |  |  114|     46|    do {                                                                       \
  |  |  115|     46|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2, False: 44]
  |  |  ------------------
  |  |  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|     46|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 44]
  |  |  ------------------
  ------------------
  712|     44|            nbSeq = MEM_readLE16(ip) + LONGNBSEQ;
  ------------------
  |  |   96|     44|#define LONGNBSEQ 0x7F00
  ------------------
  713|     44|            ip+=2;
  714|  1.71k|        } else {
  715|  1.71k|            RETURN_ERROR_IF(ip >= iend, srcSize_wrong, "");
  ------------------
  |  |  114|  1.71k|    do {                                                                       \
  |  |  115|  1.71k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 1.71k]
  |  |  ------------------
  |  |  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.71k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.71k]
  |  |  ------------------
  ------------------
  716|  1.71k|            nbSeq = ((nbSeq-0x80)<<8) + *ip++;
  717|  1.71k|        }
  718|  1.76k|    }
  719|  2.38k|    *nbSeqPtr = nbSeq;
  720|       |
  721|  2.38k|    if (nbSeq == 0) {
  ------------------
  |  Branch (721:9): [True: 97, False: 2.28k]
  ------------------
  722|       |        /* No sequence : section ends immediately */
  723|     97|        RETURN_ERROR_IF(ip != iend, corruption_detected,
  ------------------
  |  |  114|     97|    do {                                                                       \
  |  |  115|     97|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 29, False: 68]
  |  |  ------------------
  |  |  116|     29|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     29|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     29|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     29|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     29|    do {                                           \
  |  |  |  |   99|     29|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     29|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     29|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     29|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     29|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     29|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     29|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     29|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     29|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     29|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     29|        }                                                                      \
  |  |  123|     97|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 68]
  |  |  ------------------
  ------------------
  724|     97|            "extraneous data present in the Sequences section");
  725|     68|        return (size_t)(ip - istart);
  726|     97|    }
  727|       |
  728|       |    /* FSE table descriptors */
  729|  2.28k|    RETURN_ERROR_IF(ip+1 > iend, srcSize_wrong, ""); /* minimum possible size: 1 byte for symbol encoding types */
  ------------------
  |  |  114|  2.28k|    do {                                                                       \
  |  |  115|  2.28k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 2.28k]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|  2.28k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.28k]
  |  |  ------------------
  ------------------
  730|  2.28k|    RETURN_ERROR_IF(*ip & 3, corruption_detected, ""); /* The last field, Reserved, must be all-zeroes. */
  ------------------
  |  |  114|  2.28k|    do {                                                                       \
  |  |  115|  2.28k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 37, False: 2.25k]
  |  |  ------------------
  |  |  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|  2.28k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.25k]
  |  |  ------------------
  ------------------
  731|  2.25k|    {   SymbolEncodingType_e const LLtype = (SymbolEncodingType_e)(*ip >> 6);
  732|  2.25k|        SymbolEncodingType_e const OFtype = (SymbolEncodingType_e)((*ip >> 4) & 3);
  733|  2.25k|        SymbolEncodingType_e const MLtype = (SymbolEncodingType_e)((*ip >> 2) & 3);
  734|  2.25k|        ip++;
  735|       |
  736|       |        /* Build DTables */
  737|  2.25k|        {   size_t const llhSize = ZSTD_buildSeqTable(dctx->entropy.LLTable, &dctx->LLTptr,
  738|  2.25k|                                                      LLtype, MaxLL, LLFSELog,
  ------------------
  |  |  104|  2.25k|#define MaxLL   35
  ------------------
                                                                    LLtype, MaxLL, LLFSELog,
  ------------------
  |  |  109|  2.25k|#define LLFSELog    9
  ------------------
  739|  2.25k|                                                      ip, iend-ip,
  740|  2.25k|                                                      LL_base, LL_bits,
  741|  2.25k|                                                      LL_defaultDTable, dctx->fseEntropy,
  742|  2.25k|                                                      dctx->ddictIsCold, nbSeq,
  743|  2.25k|                                                      dctx->workspace, sizeof(dctx->workspace),
  744|  2.25k|                                                      ZSTD_DCtx_get_bmi2(dctx));
  745|  2.25k|            RETURN_ERROR_IF(ZSTD_isError(llhSize), corruption_detected, "ZSTD_buildSeqTable failed");
  ------------------
  |  |  114|  2.25k|    do {                                                                       \
  |  |  115|  2.25k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 10, False: 2.24k]
  |  |  ------------------
  |  |  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.25k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.24k]
  |  |  ------------------
  ------------------
  746|  2.24k|            ip += llhSize;
  747|  2.24k|        }
  748|       |
  749|      0|        {   size_t const ofhSize = ZSTD_buildSeqTable(dctx->entropy.OFTable, &dctx->OFTptr,
  750|  2.24k|                                                      OFtype, MaxOff, OffFSELog,
  ------------------
  |  |  106|  2.24k|#define MaxOff  31
  ------------------
                                                                    OFtype, MaxOff, OffFSELog,
  ------------------
  |  |  110|  2.24k|#define OffFSELog   8
  ------------------
  751|  2.24k|                                                      ip, iend-ip,
  752|  2.24k|                                                      OF_base, OF_bits,
  753|  2.24k|                                                      OF_defaultDTable, dctx->fseEntropy,
  754|  2.24k|                                                      dctx->ddictIsCold, nbSeq,
  755|  2.24k|                                                      dctx->workspace, sizeof(dctx->workspace),
  756|  2.24k|                                                      ZSTD_DCtx_get_bmi2(dctx));
  757|  2.24k|            RETURN_ERROR_IF(ZSTD_isError(ofhSize), corruption_detected, "ZSTD_buildSeqTable failed");
  ------------------
  |  |  114|  2.24k|    do {                                                                       \
  |  |  115|  2.24k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 19, False: 2.22k]
  |  |  ------------------
  |  |  116|     19|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     19|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     19|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     19|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     19|    do {                                           \
  |  |  |  |   99|     19|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 19]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     19|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     19|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     19|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     19|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     19|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     19|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     19|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     19|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     19|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     19|        }                                                                      \
  |  |  123|  2.24k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.22k]
  |  |  ------------------
  ------------------
  758|  2.22k|            ip += ofhSize;
  759|  2.22k|        }
  760|       |
  761|      0|        {   size_t const mlhSize = ZSTD_buildSeqTable(dctx->entropy.MLTable, &dctx->MLTptr,
  762|  2.22k|                                                      MLtype, MaxML, MLFSELog,
  ------------------
  |  |  103|  2.22k|#define MaxML   52
  ------------------
                                                                    MLtype, MaxML, MLFSELog,
  ------------------
  |  |  108|  2.22k|#define MLFSELog    9
  ------------------
  763|  2.22k|                                                      ip, iend-ip,
  764|  2.22k|                                                      ML_base, ML_bits,
  765|  2.22k|                                                      ML_defaultDTable, dctx->fseEntropy,
  766|  2.22k|                                                      dctx->ddictIsCold, nbSeq,
  767|  2.22k|                                                      dctx->workspace, sizeof(dctx->workspace),
  768|  2.22k|                                                      ZSTD_DCtx_get_bmi2(dctx));
  769|  2.22k|            RETURN_ERROR_IF(ZSTD_isError(mlhSize), corruption_detected, "ZSTD_buildSeqTable failed");
  ------------------
  |  |  114|  2.22k|    do {                                                                       \
  |  |  115|  2.22k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 15, False: 2.20k]
  |  |  ------------------
  |  |  116|     15|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     15|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     15|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     15|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     15|    do {                                           \
  |  |  |  |   99|     15|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     15|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     15|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     15|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     15|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     15|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     15|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     15|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     15|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     15|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     15|        }                                                                      \
  |  |  123|  2.22k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.20k]
  |  |  ------------------
  ------------------
  770|  2.20k|            ip += mlhSize;
  771|  2.20k|        }
  772|  2.20k|    }
  773|       |
  774|      0|    return ip-istart;
  775|  2.22k|}
ZSTD_decompressBlock_internal:
 2069|  3.16k|{   /* blockType == blockCompressed */
 2070|  3.16k|    const BYTE* ip = (const BYTE*)src;
 2071|  3.16k|    DEBUGLOG(5, "ZSTD_decompressBlock_internal (cSize : %u)", (unsigned)srcSize);
  ------------------
  |  |  104|  3.16k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.16k]
  |  |  ------------------
  ------------------
 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|  3.16k|    RETURN_ERROR_IF(srcSize > ZSTD_blockSizeMax(dctx), srcSize_wrong, "");
  ------------------
  |  |  114|  3.16k|    do {                                                                       \
  |  |  115|  3.16k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 3.16k]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|  3.16k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.16k]
  |  |  ------------------
  ------------------
 2082|       |
 2083|       |    /* Decode literals section */
 2084|  3.16k|    {   size_t const litCSize = ZSTD_decodeLiteralsBlock(dctx, src, srcSize, dst, dstCapacity, streaming);
 2085|  3.16k|        DEBUGLOG(5, "ZSTD_decodeLiteralsBlock : cSize=%u, nbLiterals=%zu", (U32)litCSize, dctx->litSize);
  ------------------
  |  |  104|  3.16k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.16k]
  |  |  ------------------
  ------------------
 2086|  3.16k|        if (ZSTD_isError(litCSize)) return litCSize;
  ------------------
  |  |   44|  3.16k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (2086:13): [True: 771, False: 2.38k]
  ------------------
 2087|  2.38k|        ip += litCSize;
 2088|  2.38k|        srcSize -= litCSize;
 2089|  2.38k|    }
 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.38k|        size_t const blockSizeMax = MIN(dstCapacity, ZSTD_blockSizeMax(dctx));
  ------------------
  |  |   54|  2.38k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 133, False: 2.25k]
  |  |  ------------------
  ------------------
 2097|  2.38k|        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.38k|        ZSTD_longOffset_e isLongOffset = (ZSTD_longOffset_e)(MEM_32bits() && (totalHistorySize > ZSTD_maxShortOffset()));
  ------------------
  |  Branch (2109:62): [True: 0, False: 2.38k]
  |  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.38k|#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \
 2115|  2.38k|    !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG)
 2116|  2.38k|        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.38k|        int nbSeq;
 2124|  2.38k|        size_t const seqHSize = ZSTD_decodeSeqHeaders(dctx, &nbSeq, ip, srcSize);
 2125|  2.38k|        if (ZSTD_isError(seqHSize)) return seqHSize;
  ------------------
  |  |   44|  2.38k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (2125:13): [True: 115, False: 2.27k]
  ------------------
 2126|  2.27k|        ip += seqHSize;
 2127|  2.27k|        srcSize -= seqHSize;
 2128|       |
 2129|  2.27k|        RETURN_ERROR_IF((dst == NULL || dstCapacity == 0) && nbSeq > 0, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|  2.27k|    do {                                                                       \
  |  |  115|  9.09k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 2.27k]
  |  |  |  Branch (115:13): [True: 2, False: 2.27k]
  |  |  |  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.27k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.27k]
  |  |  ------------------
  ------------------
 2130|  2.27k|        RETURN_ERROR_IF(MEM_64bits() && sizeof(size_t) == sizeof(void*) && (size_t)(-1) - (size_t)dst < (size_t)(1 << 20), dstSize_tooSmall,
  ------------------
  |  |  114|  2.27k|    do {                                                                       \
  |  |  115|  11.3k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2.27k, False: 0]
  |  |  |  Branch (115:13): [True: 0, Folded]
  |  |  |  Branch (115:13): [True: 0, False: 2.27k]
  |  |  ------------------
  |  |  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.27k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.27k]
  |  |  ------------------
  ------------------
 2131|  2.27k|                "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.27k|        if (isLongOffset || (!usePrefetchDecoder && (totalHistorySize > (1u << 24)) && (nbSeq > 8))) {
  ------------------
  |  Branch (2137:13): [True: 0, False: 2.27k]
  |  Branch (2137:30): [True: 1.30k, False: 969]
  |  Branch (2137:53): [True: 0, False: 1.30k]
  |  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.27k|        dctx->ddictIsCold = 0;
 2153|       |
 2154|  2.27k|#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \
 2155|  2.27k|    !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG)
 2156|  2.27k|        if (usePrefetchDecoder) {
  ------------------
  |  Branch (2156:13): [True: 969, False: 1.30k]
  ------------------
 2157|       |#else
 2158|       |        (void)usePrefetchDecoder;
 2159|       |        {
 2160|       |#endif
 2161|    969|#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
 2162|    969|            return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
 2163|    969|#endif
 2164|    969|        }
 2165|       |
 2166|  1.30k|#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG
 2167|       |        /* else */
 2168|  1.30k|        if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (2168:13): [True: 739, False: 564]
  ------------------
 2169|    739|            return ZSTD_decompressSequencesSplitLitBuffer(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
 2170|    564|        else
 2171|    564|            return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
 2172|  1.30k|#endif
 2173|  1.30k|    }
 2174|  1.30k|}
ZSTD_checkContinuity:
 2179|  3.95k|{
 2180|  3.95k|    if (dst != dctx->previousDstEnd && dstSize > 0) {   /* not contiguous */
  ------------------
  |  Branch (2180:9): [True: 3.95k, False: 0]
  |  Branch (2180:40): [True: 3.95k, False: 1]
  ------------------
 2181|  3.95k|        dctx->dictEnd = dctx->previousDstEnd;
 2182|  3.95k|        dctx->virtualStart = (const char*)dst - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->prefixStart));
 2183|  3.95k|        dctx->prefixStart = dst;
 2184|  3.95k|        dctx->previousDstEnd = dst;
 2185|  3.95k|    }
 2186|  3.95k|}
zstd_decompress_block.c:ZSTD_decodeLiteralsBlock:
  137|  3.16k|{
  138|  3.16k|    DEBUGLOG(5, "ZSTD_decodeLiteralsBlock");
  ------------------
  |  |  104|  3.16k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.16k]
  |  |  ------------------
  ------------------
  139|  3.16k|    RETURN_ERROR_IF(srcSize < MIN_CBLOCK_SIZE, corruption_detected, "");
  ------------------
  |  |  114|  3.16k|    do {                                                                       \
  |  |  115|  3.16k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 3.15k]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|  3.16k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.15k]
  |  |  ------------------
  ------------------
  140|       |
  141|  3.15k|    {   const BYTE* const istart = (const BYTE*) src;
  142|  3.15k|        SymbolEncodingType_e const litEncType = (SymbolEncodingType_e)(istart[0] & 3);
  143|  3.15k|        size_t const blockSizeMax = ZSTD_blockSizeMax(dctx);
  144|       |
  145|  3.15k|        switch(litEncType)
  146|  3.15k|        {
  147|      1|        case set_repeat:
  ------------------
  |  Branch (147:9): [True: 1, False: 3.15k]
  ------------------
  148|      1|            DEBUGLOG(5, "set_repeat flag : re-using stats from previous compressed literals block");
  ------------------
  |  |  104|      1|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1]
  |  |  ------------------
  ------------------
  149|      1|            RETURN_ERROR_IF(dctx->litEntropy==0, dictionary_corrupted, "");
  ------------------
  |  |  114|      1|    do {                                                                       \
  |  |  115|      1|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 0]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  150|      0|            ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  151|       |
  152|    749|        case set_compressed:
  ------------------
  |  Branch (152:9): [True: 749, False: 2.41k]
  ------------------
  153|    749|            RETURN_ERROR_IF(srcSize < 5, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need up to 5 for case 3");
  ------------------
  |  |  114|    749|    do {                                                                       \
  |  |  115|    749|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 748]
  |  |  ------------------
  |  |  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|    749|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 748]
  |  |  ------------------
  ------------------
  154|    748|            {   size_t lhSize, litSize, litCSize;
  155|    748|                U32 singleStream=0;
  156|    748|                U32 const lhlCode = (istart[0] >> 2) & 3;
  157|    748|                U32 const lhc = MEM_readLE32(istart);
  158|    748|                size_t hufSuccess;
  159|    748|                size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity);
  ------------------
  |  |   54|    748|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 622, False: 126]
  |  |  ------------------
  ------------------
  160|    748|                int const flags = 0
  161|    748|                    | (ZSTD_DCtx_get_bmi2(dctx) ? HUF_flags_bmi2 : 0)
  ------------------
  |  Branch (161:24): [True: 748, False: 0]
  ------------------
  162|    748|                    | (dctx->disableHufAsm ? HUF_flags_disableAsm : 0);
  ------------------
  |  Branch (162:24): [True: 0, False: 748]
  ------------------
  163|    748|                switch(lhlCode)
  164|    748|                {
  165|    218|                case 0: case 1: default:   /* note : default is impossible, since lhlCode into [0..3] */
  ------------------
  |  Branch (165:17): [True: 178, False: 570]
  |  Branch (165:25): [True: 40, False: 708]
  |  Branch (165:33): [True: 0, False: 748]
  ------------------
  166|       |                    /* 2 - 2 - 10 - 10 */
  167|    218|                    singleStream = !lhlCode;
  168|    218|                    lhSize = 3;
  169|    218|                    litSize  = (lhc >> 4) & 0x3FF;
  170|    218|                    litCSize = (lhc >> 14) & 0x3FF;
  171|    218|                    break;
  172|    444|                case 2:
  ------------------
  |  Branch (172:17): [True: 444, False: 304]
  ------------------
  173|       |                    /* 2 - 2 - 14 - 14 */
  174|    444|                    lhSize = 4;
  175|    444|                    litSize  = (lhc >> 4) & 0x3FFF;
  176|    444|                    litCSize = lhc >> 18;
  177|    444|                    break;
  178|     86|                case 3:
  ------------------
  |  Branch (178:17): [True: 86, False: 662]
  ------------------
  179|       |                    /* 2 - 2 - 18 - 18 */
  180|     86|                    lhSize = 5;
  181|     86|                    litSize  = (lhc >> 4) & 0x3FFFF;
  182|     86|                    litCSize = (lhc >> 22) + ((size_t)istart[4] << 10);
  183|     86|                    break;
  184|    748|                }
  185|    748|                RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|    748|    do {                                                                       \
  |  |  115|  2.23k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 740, False: 8]
  |  |  |  Branch (115:13): [True: 0, False: 740]
  |  |  ------------------
  |  |  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|    748|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 748]
  |  |  ------------------
  ------------------
  186|    748|                RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, "");
  ------------------
  |  |  114|    748|    do {                                                                       \
  |  |  115|    748|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 7, False: 741]
  |  |  ------------------
  |  |  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|    748|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 741]
  |  |  ------------------
  ------------------
  187|    741|                if (!singleStream)
  ------------------
  |  Branch (187:21): [True: 563, False: 178]
  ------------------
  188|    563|                    RETURN_ERROR_IF(litSize < MIN_LITERALS_FOR_4_STREAMS, literals_headerWrong,
  ------------------
  |  |  114|    563|    do {                                                                       \
  |  |  115|    563|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 560]
  |  |  ------------------
  |  |  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|    563|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 560]
  |  |  ------------------
  ------------------
  189|    741|                        "Not enough literals (%zu) for the 4-streams mode (min %u)",
  190|    741|                        litSize, MIN_LITERALS_FOR_4_STREAMS);
  191|    738|                RETURN_ERROR_IF(litCSize + lhSize > srcSize, corruption_detected, "");
  ------------------
  |  |  114|    738|    do {                                                                       \
  |  |  115|    738|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 40, False: 698]
  |  |  ------------------
  |  |  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|    738|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 698]
  |  |  ------------------
  ------------------
  192|    698|                RETURN_ERROR_IF(expectedWriteSize < litSize , dstSize_tooSmall, "");
  ------------------
  |  |  114|    698|    do {                                                                       \
  |  |  115|    698|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 697]
  |  |  ------------------
  |  |  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|    698|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 697]
  |  |  ------------------
  ------------------
  193|    697|                ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 0);
  194|       |
  195|       |                /* prefetch huffman table if cold */
  196|    697|                if (dctx->ddictIsCold && (litSize > 768 /* heuristic */)) {
  ------------------
  |  Branch (196:21): [True: 73, False: 624]
  |  Branch (196:42): [True: 62, False: 11]
  ------------------
  197|     62|                    PREFETCH_AREA(dctx->HUFptr, sizeof(dctx->entropy.hufTable));
  ------------------
  |  |  159|     62|    do {                                                 \
  |  |  160|     62|        const char* const _ptr = (const char*)(p);       \
  |  |  161|     62|        size_t const _size = (size_t)(s);                \
  |  |  162|     62|        size_t _pos;                                     \
  |  |  163|  15.9k|        for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \
  |  |  ------------------
  |  |  |  |  156|  15.9k|#define CACHELINE_SIZE 64
  |  |  ------------------
  |  |  |  Branch (163:22): [True: 15.9k, False: 62]
  |  |  ------------------
  |  |  164|  15.9k|            PREFETCH_L2(_ptr + _pos);                    \
  |  |  ------------------
  |  |  |  |  146|  15.9k|#    define PREFETCH_L2(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */)
  |  |  ------------------
  |  |  165|  15.9k|        }                                                \
  |  |  166|     62|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 62]
  |  |  ------------------
  ------------------
  198|     62|                }
  199|       |
  200|    697|                if (litEncType==set_repeat) {
  ------------------
  |  Branch (200:21): [True: 0, False: 697]
  ------------------
  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|    697|                } else {
  212|    697|                    if (singleStream) {
  ------------------
  |  Branch (212:25): [True: 171, False: 526]
  ------------------
  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|    171|                        hufSuccess = HUF_decompress1X1_DCtx_wksp(
  220|    171|                            dctx->entropy.hufTable, dctx->litBuffer, litSize,
  221|    171|                            istart+lhSize, litCSize, dctx->workspace,
  222|    171|                            sizeof(dctx->workspace), flags);
  223|    171|#endif
  224|    526|                    } else {
  225|    526|                        hufSuccess = HUF_decompress4X_hufOnly_wksp(
  226|    526|                            dctx->entropy.hufTable, dctx->litBuffer, litSize,
  227|    526|                            istart+lhSize, litCSize, dctx->workspace,
  228|    526|                            sizeof(dctx->workspace), flags);
  229|    526|                    }
  230|    697|                }
  231|    697|                if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (231:21): [True: 7, False: 690]
  ------------------
  232|      7|                {
  233|      7|                    assert(litSize > ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   70|      7|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  234|      7|                    ZSTD_memcpy(dctx->litExtraBuffer, dctx->litBufferEnd - ZSTD_LITBUFFEREXTRASIZE, ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   44|     42|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  |  |  ------------------
  |  |  |  Branch (44:51): [True: 0, Folded]
  |  |  |  Branch (44:51): [True: 7, Folded]
  |  |  |  Branch (44:51): [Folded, False: 7]
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [True: 7, Folded]
  |  |  |  Branch (44:55): [Folded, False: 7]
  |  |  ------------------
  ------------------
  235|      7|                    ZSTD_memmove(dctx->litBuffer + ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH, dctx->litBuffer, litSize - ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   45|     42|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  |  |  ------------------
  |  |  |  Branch (45:49): [True: 0, Folded]
  |  |  |  Branch (45:49): [True: 7, Folded]
  |  |  |  Branch (45:49): [Folded, False: 7]
  |  |  |  Branch (45:57): [True: 0, Folded]
  |  |  |  Branch (45:57): [True: 7, Folded]
  |  |  |  Branch (45:57): [Folded, False: 7]
  |  |  ------------------
  ------------------
  236|      7|                    dctx->litBuffer += ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  118|      7|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|      7|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|     14|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 7]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 7, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                  dctx->litBuffer += ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  199|      7|#define WILDCOPY_OVERLENGTH 32
  ------------------
  237|      7|                    dctx->litBufferEnd -= WILDCOPY_OVERLENGTH;
  ------------------
  |  |  199|      7|#define WILDCOPY_OVERLENGTH 32
  ------------------
  238|      7|                    assert(dctx->litBufferEnd <= (BYTE*)dst + blockSizeMax);
  ------------------
  |  |   70|      7|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  239|      7|                }
  240|       |
  241|    697|                RETURN_ERROR_IF(HUF_isError(hufSuccess), corruption_detected, "");
  ------------------
  |  |  114|    697|    do {                                                                       \
  |  |  115|    697|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 624, False: 73]
  |  |  ------------------
  |  |  116|    624|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    624|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 624]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    624|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    624|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    624|    do {                                           \
  |  |  |  |   99|    624|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 624]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    624|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 624]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    624|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    624|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 624]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    624|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    624|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 624]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    624|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    624|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    624|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    624|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    624|        }                                                                      \
  |  |  123|    697|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 73]
  |  |  ------------------
  ------------------
  242|       |
  243|     73|                dctx->litPtr = dctx->litBuffer;
  244|     73|                dctx->litSize = litSize;
  245|     73|                dctx->litEntropy = 1;
  246|     73|                if (litEncType==set_compressed) dctx->HUFptr = dctx->entropy.hufTable;
  ------------------
  |  Branch (246:21): [True: 73, False: 0]
  ------------------
  247|     73|                return litCSize + lhSize;
  248|    697|            }
  249|       |
  250|    328|        case set_basic:
  ------------------
  |  Branch (250:9): [True: 328, False: 2.83k]
  ------------------
  251|    328|            {   size_t litSize, lhSize;
  252|    328|                U32 const lhlCode = ((istart[0]) >> 2) & 3;
  253|    328|                size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity);
  ------------------
  |  |   54|    328|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 239, False: 89]
  |  |  ------------------
  ------------------
  254|    328|                switch(lhlCode)
  255|    328|                {
  256|    167|                case 0: case 2: default:   /* note : default is impossible, since lhlCode into [0..3] */
  ------------------
  |  Branch (256:17): [True: 152, False: 176]
  |  Branch (256:25): [True: 15, False: 313]
  |  Branch (256:33): [True: 0, False: 328]
  ------------------
  257|    167|                    lhSize = 1;
  258|    167|                    litSize = istart[0] >> 3;
  259|    167|                    break;
  260|    113|                case 1:
  ------------------
  |  Branch (260:17): [True: 113, False: 215]
  ------------------
  261|    113|                    lhSize = 2;
  262|    113|                    litSize = MEM_readLE16(istart) >> 4;
  263|    113|                    break;
  264|     48|                case 3:
  ------------------
  |  Branch (264:17): [True: 48, False: 280]
  ------------------
  265|     48|                    lhSize = 3;
  266|     48|                    RETURN_ERROR_IF(srcSize<3, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize = 3");
  ------------------
  |  |  114|     48|    do {                                                                       \
  |  |  115|     48|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 47]
  |  |  ------------------
  |  |  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|     48|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 47]
  |  |  ------------------
  ------------------
  267|     47|                    litSize = MEM_readLE24(istart) >> 4;
  268|     47|                    break;
  269|    328|                }
  270|       |
  271|    327|                RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|    327|    do {                                                                       \
  |  |  115|    906|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 252, False: 75]
  |  |  |  Branch (115:13): [True: 0, False: 252]
  |  |  ------------------
  |  |  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|    327|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 327]
  |  |  ------------------
  ------------------
  272|    327|                RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, "");
  ------------------
  |  |  114|    327|    do {                                                                       \
  |  |  115|    327|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 16, False: 311]
  |  |  ------------------
  |  |  116|     16|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     16|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     16|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     16|    do {                                           \
  |  |  |  |   99|     16|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     16|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     16|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     16|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     16|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     16|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     16|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     16|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     16|        }                                                                      \
  |  |  123|    327|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 311]
  |  |  ------------------
  ------------------
  273|    311|                RETURN_ERROR_IF(expectedWriteSize < litSize, dstSize_tooSmall, "");
  ------------------
  |  |  114|    311|    do {                                                                       \
  |  |  115|    311|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 310]
  |  |  ------------------
  |  |  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|    311|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 310]
  |  |  ------------------
  ------------------
  274|    310|                ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 1);
  275|    310|                if (lhSize+litSize+WILDCOPY_OVERLENGTH > srcSize) {  /* risk reading beyond src buffer with wildcopy */
  ------------------
  |  |  199|    310|#define WILDCOPY_OVERLENGTH 32
  ------------------
  |  Branch (275:21): [True: 176, False: 134]
  ------------------
  276|    176|                    RETURN_ERROR_IF(litSize+lhSize > srcSize, corruption_detected, "");
  ------------------
  |  |  114|    176|    do {                                                                       \
  |  |  115|    176|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 46, False: 130]
  |  |  ------------------
  |  |  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|    176|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 130]
  |  |  ------------------
  ------------------
  277|    130|                    if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (277:25): [True: 0, False: 130]
  ------------------
  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|    130|                    else
  283|    130|                    {
  284|    130|                        ZSTD_memcpy(dctx->litBuffer, istart + lhSize, litSize);
  ------------------
  |  |   44|    130|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  285|    130|                    }
  286|    130|                    dctx->litPtr = dctx->litBuffer;
  287|    130|                    dctx->litSize = litSize;
  288|    130|                    return lhSize+litSize;
  289|    176|                }
  290|       |                /* direct reference into compressed stream */
  291|    134|                dctx->litPtr = istart+lhSize;
  292|    134|                dctx->litSize = litSize;
  293|    134|                dctx->litBufferEnd = dctx->litPtr + litSize;
  294|    134|                dctx->litBufferLocation = ZSTD_not_in_dst;
  295|    134|                return lhSize+litSize;
  296|    310|            }
  297|       |
  298|  2.08k|        case set_rle:
  ------------------
  |  Branch (298:9): [True: 2.08k, False: 1.07k]
  ------------------
  299|  2.08k|            {   U32 const lhlCode = ((istart[0]) >> 2) & 3;
  300|  2.08k|                size_t litSize, lhSize;
  301|  2.08k|                size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity);
  ------------------
  |  |   54|  2.08k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 2.04k, False: 39]
  |  |  ------------------
  ------------------
  302|  2.08k|                switch(lhlCode)
  303|  2.08k|                {
  304|     11|                case 0: case 2: default:   /* note : default is impossible, since lhlCode into [0..3] */
  ------------------
  |  Branch (304:17): [True: 6, False: 2.07k]
  |  Branch (304:25): [True: 5, False: 2.07k]
  |  Branch (304:33): [True: 0, False: 2.08k]
  ------------------
  305|     11|                    lhSize = 1;
  306|     11|                    litSize = istart[0] >> 3;
  307|     11|                    break;
  308|     39|                case 1:
  ------------------
  |  Branch (308:17): [True: 39, False: 2.04k]
  ------------------
  309|     39|                    lhSize = 2;
  310|     39|                    RETURN_ERROR_IF(srcSize<3, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize+1 = 3");
  ------------------
  |  |  114|     39|    do {                                                                       \
  |  |  115|     39|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2, False: 37]
  |  |  ------------------
  |  |  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|     39|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 37]
  |  |  ------------------
  ------------------
  311|     37|                    litSize = MEM_readLE16(istart) >> 4;
  312|     37|                    break;
  313|  2.03k|                case 3:
  ------------------
  |  Branch (313:17): [True: 2.03k, False: 50]
  ------------------
  314|  2.03k|                    lhSize = 3;
  315|  2.03k|                    RETURN_ERROR_IF(srcSize<4, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize+1 = 4");
  ------------------
  |  |  114|  2.03k|    do {                                                                       \
  |  |  115|  2.03k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2, False: 2.02k]
  |  |  ------------------
  |  |  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.03k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.02k]
  |  |  ------------------
  ------------------
  316|  2.02k|                    litSize = MEM_readLE24(istart) >> 4;
  317|  2.02k|                    break;
  318|  2.08k|                }
  319|  2.07k|                RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|  2.07k|    do {                                                                       \
  |  |  115|  6.22k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2.07k, False: 3]
  |  |  |  Branch (115:13): [True: 0, False: 2.07k]
  |  |  ------------------
  |  |  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.07k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.07k]
  |  |  ------------------
  ------------------
  320|  2.07k|                RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, "");
  ------------------
  |  |  114|  2.07k|    do {                                                                       \
  |  |  115|  2.07k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 20, False: 2.05k]
  |  |  ------------------
  |  |  116|     20|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     20|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     20|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     20|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     20|    do {                                           \
  |  |  |  |   99|     20|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 20]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     20|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     20|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     20|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     20|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     20|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     20|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     20|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     20|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     20|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     20|        }                                                                      \
  |  |  123|  2.07k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.05k]
  |  |  ------------------
  ------------------
  321|  2.05k|                RETURN_ERROR_IF(expectedWriteSize < litSize, dstSize_tooSmall, "");
  ------------------
  |  |  114|  2.05k|    do {                                                                       \
  |  |  115|  2.05k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 5, False: 2.05k]
  |  |  ------------------
  |  |  116|      5|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      5|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      5|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      5|    do {                                           \
  |  |  |  |   99|      5|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      5|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      5|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      5|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      5|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      5|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      5|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      5|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      5|        }                                                                      \
  |  |  123|  2.05k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.05k]
  |  |  ------------------
  ------------------
  322|  2.05k|                ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 1);
  323|  2.05k|                if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (323:21): [True: 1.58k, False: 471]
  ------------------
  324|  1.58k|                {
  325|  1.58k|                    ZSTD_memset(dctx->litBuffer, istart[lhSize], litSize - ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   46|  9.48k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  |  |  ------------------
  |  |  |  Branch (46:55): [True: 0, Folded]
  |  |  |  Branch (46:55): [True: 1.58k, Folded]
  |  |  |  Branch (46:55): [Folded, False: 1.58k]
  |  |  ------------------
  ------------------
  326|  1.58k|                    ZSTD_memset(dctx->litExtraBuffer, istart[lhSize], ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   46|  9.48k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  |  |  ------------------
  |  |  |  Branch (46:55): [True: 0, Folded]
  |  |  |  Branch (46:55): [True: 1.58k, Folded]
  |  |  |  Branch (46:55): [Folded, False: 1.58k]
  |  |  ------------------
  ------------------
  327|  1.58k|                }
  328|    471|                else
  329|    471|                {
  330|    471|                    ZSTD_memset(dctx->litBuffer, istart[lhSize], litSize);
  ------------------
  |  |   46|    471|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  331|    471|                }
  332|  2.05k|                dctx->litPtr = dctx->litBuffer;
  333|  2.05k|                dctx->litSize = litSize;
  334|  2.05k|                return lhSize+1;
  335|  2.05k|            }
  336|      0|        default:
  ------------------
  |  Branch (336:9): [True: 0, False: 3.15k]
  ------------------
  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|  3.15k|        }
  339|  3.15k|    }
  340|  3.15k|}
zstd_decompress_block.c:ZSTD_allocateLiteralsBuffer:
   82|  3.05k|{
   83|  3.05k|    size_t const blockSizeMax = ZSTD_blockSizeMax(dctx);
   84|  3.05k|    assert(litSize <= blockSizeMax);
  ------------------
  |  |   70|  3.05k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   85|  3.05k|    assert(dctx->isFrameDecompression || streaming == not_streaming);
  ------------------
  |  |   70|  3.05k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   86|  3.05k|    assert(expectedWriteSize <= blockSizeMax);
  ------------------
  |  |   70|  3.05k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   87|  3.05k|    if (streaming == not_streaming && dstCapacity > blockSizeMax + WILDCOPY_OVERLENGTH + litSize + WILDCOPY_OVERLENGTH) {
  ------------------
  |  |  199|  3.05k|#define WILDCOPY_OVERLENGTH 32
  ------------------
                  if (streaming == not_streaming && dstCapacity > blockSizeMax + WILDCOPY_OVERLENGTH + litSize + WILDCOPY_OVERLENGTH) {
  ------------------
  |  |  199|  3.05k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  |  Branch (87:9): [True: 3.05k, False: 0]
  |  Branch (87:39): [True: 1.18k, False: 1.87k]
  ------------------
   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.18k|        dctx->litBuffer = (BYTE*)dst + blockSizeMax + WILDCOPY_OVERLENGTH;
  ------------------
  |  |  199|  1.18k|#define WILDCOPY_OVERLENGTH 32
  ------------------
   94|  1.18k|        dctx->litBufferEnd = dctx->litBuffer + litSize;
   95|  1.18k|        dctx->litBufferLocation = ZSTD_in_dst;
   96|  1.87k|    } else if (litSize <= ZSTD_LITBUFFEREXTRASIZE) {
  ------------------
  |  |  118|  1.87k|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|  1.87k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  3.74k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 1.87k]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 1.87k, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (96:16): [True: 276, False: 1.59k]
  ------------------
   97|       |        /* Literals fit entirely within the extra buffer, put them there to avoid
   98|       |         * having to split the literals.
   99|       |         */
  100|    276|        dctx->litBuffer = dctx->litExtraBuffer;
  101|    276|        dctx->litBufferEnd = dctx->litBuffer + litSize;
  102|    276|        dctx->litBufferLocation = ZSTD_not_in_dst;
  103|  1.59k|    } else {
  104|  1.59k|        assert(blockSizeMax > ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   70|  1.59k|#    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.59k|        if (splitImmediately) {
  ------------------
  |  Branch (112:13): [True: 1.59k, False: 7]
  ------------------
  113|       |            /* won't fit in litExtraBuffer, so it will be split between end of dst and extra buffer */
  114|  1.59k|            dctx->litBuffer = (BYTE*)dst + expectedWriteSize - litSize + ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  118|  1.59k|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|  1.59k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  3.18k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 1.59k]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 1.59k, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          dctx->litBuffer = (BYTE*)dst + expectedWriteSize - litSize + ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  199|  1.59k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  115|  1.59k|            dctx->litBufferEnd = dctx->litBuffer + litSize - ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|  1.59k|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|  1.59k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  3.18k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 1.59k]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 1.59k, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  116|  1.59k|        } else {
  117|       |            /* initially this will be stored entirely in dst during huffman decoding, it will partially be shifted to litExtraBuffer after */
  118|      7|            dctx->litBuffer = (BYTE*)dst + expectedWriteSize - litSize;
  119|      7|            dctx->litBufferEnd = (BYTE*)dst + expectedWriteSize;
  120|      7|        }
  121|  1.59k|        dctx->litBufferLocation = ZSTD_split;
  122|  1.59k|        assert(dctx->litBufferEnd <= (BYTE*)dst + expectedWriteSize);
  ------------------
  |  |   70|  1.59k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  123|  1.59k|    }
  124|  3.05k|}
zstd_decompress_block.c:ZSTD_buildFSETable_body_bmi2:
  620|  2.49k|{
  621|  2.49k|    ZSTD_buildFSETable_body(dt, normalizedCounter, maxSymbolValue,
  622|  2.49k|            baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  623|  2.49k|}
zstd_decompress_block.c:ZSTD_buildFSETable_body:
  489|  2.92k|{
  490|  2.92k|    ZSTD_seqSymbol* const tableDecode = dt+1;
  491|  2.92k|    U32 const maxSV1 = maxSymbolValue + 1;
  492|  2.92k|    U32 const tableSize = 1 << tableLog;
  493|       |
  494|  2.92k|    U16* symbolNext = (U16*)wksp;
  495|  2.92k|    BYTE* spread = (BYTE*)(symbolNext + MaxSeq + 1);
  ------------------
  |  |  107|  2.92k|#define MaxSeq MAX(MaxLL, MaxML)   /* Assumption : MaxOff < MaxLL,MaxML */
  |  |  ------------------
  |  |  |  |   55|  2.92k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [Folded, False: 2.92k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  496|  2.92k|    U32 highThreshold = tableSize - 1;
  497|       |
  498|       |
  499|       |    /* Sanity Checks */
  500|  2.92k|    assert(maxSymbolValue <= MaxSeq);
  ------------------
  |  |   70|  2.92k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  501|  2.92k|    assert(tableLog <= MaxFSELog);
  ------------------
  |  |   70|  2.92k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  502|  2.92k|    assert(wkspSize >= ZSTD_BUILD_FSE_TABLE_WKSP_SIZE);
  ------------------
  |  |   70|  2.92k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  503|  2.92k|    (void)wkspSize;
  504|       |    /* Init, lay down lowprob symbols */
  505|  2.92k|    {   ZSTD_seqSymbol_header DTableH;
  506|  2.92k|        DTableH.tableLog = tableLog;
  507|  2.92k|        DTableH.fastMode = 1;
  508|  2.92k|        {   S16 const largeLimit= (S16)(1 << (tableLog-1));
  509|  2.92k|            U32 s;
  510|  46.6k|            for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (510:23): [True: 43.6k, False: 2.92k]
  ------------------
  511|  43.6k|                if (normalizedCounter[s]==-1) {
  ------------------
  |  Branch (511:21): [True: 14.6k, False: 29.0k]
  ------------------
  512|  14.6k|                    tableDecode[highThreshold--].baseValue = s;
  513|  14.6k|                    symbolNext[s] = 1;
  514|  29.0k|                } else {
  515|  29.0k|                    if (normalizedCounter[s] >= largeLimit) DTableH.fastMode=0;
  ------------------
  |  Branch (515:25): [True: 1.54k, False: 27.5k]
  ------------------
  516|  29.0k|                    assert(normalizedCounter[s]>=0);
  ------------------
  |  |   70|  29.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  517|  29.0k|                    symbolNext[s] = (U16)normalizedCounter[s];
  518|  29.0k|        }   }   }
  519|  2.92k|        ZSTD_memcpy(dt, &DTableH, sizeof(DTableH));
  ------------------
  |  |   44|  2.92k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  520|  2.92k|    }
  521|       |
  522|       |    /* Spread symbols */
  523|  2.92k|    assert(tableSize <= 512);
  ------------------
  |  |   70|  2.92k|#    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.92k|    if (highThreshold == tableSize - 1) {
  ------------------
  |  Branch (529:9): [True: 690, False: 2.23k]
  ------------------
  530|    690|        size_t const tableMask = tableSize-1;
  531|    690|        size_t const step = FSE_TABLESTEP(tableSize);
  ------------------
  |  |  623|    690|#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|    690|        {
  539|    690|            U64 const add = 0x0101010101010101ull;
  540|    690|            size_t pos = 0;
  541|    690|            U64 sv = 0;
  542|    690|            U32 s;
  543|  12.1k|            for (s=0; s<maxSV1; ++s, sv += add) {
  ------------------
  |  Branch (543:23): [True: 11.5k, False: 690]
  ------------------
  544|  11.5k|                int i;
  545|  11.5k|                int const n = normalizedCounter[s];
  546|  11.5k|                MEM_write64(spread + pos, sv);
  547|  21.8k|                for (i = 8; i < n; i += 8) {
  ------------------
  |  Branch (547:29): [True: 10.3k, False: 11.5k]
  ------------------
  548|  10.3k|                    MEM_write64(spread + pos + i, sv);
  549|  10.3k|                }
  550|  11.5k|                assert(n>=0);
  ------------------
  |  |   70|  11.5k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  551|  11.5k|                pos += (size_t)n;
  552|  11.5k|            }
  553|    690|        }
  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|    690|        {
  561|    690|            size_t position = 0;
  562|    690|            size_t s;
  563|    690|            size_t const unroll = 2;
  564|    690|            assert(tableSize % unroll == 0); /* FSE_MIN_TABLELOG is 5 */
  ------------------
  |  |   70|    690|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  565|  46.9k|            for (s = 0; s < (size_t)tableSize; s += unroll) {
  ------------------
  |  Branch (565:25): [True: 46.3k, False: 690]
  ------------------
  566|  46.3k|                size_t u;
  567|   138k|                for (u = 0; u < unroll; ++u) {
  ------------------
  |  Branch (567:29): [True: 92.6k, False: 46.3k]
  ------------------
  568|  92.6k|                    size_t const uPosition = (position + (u * step)) & tableMask;
  569|  92.6k|                    tableDecode[uPosition].baseValue = spread[s + u];
  570|  92.6k|                }
  571|  46.3k|                position = (position + (unroll * step)) & tableMask;
  572|  46.3k|            }
  573|    690|            assert(position == 0);
  ------------------
  |  |   70|    690|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  574|    690|        }
  575|  2.23k|    } else {
  576|  2.23k|        U32 const tableMask = tableSize-1;
  577|  2.23k|        U32 const step = FSE_TABLESTEP(tableSize);
  ------------------
  |  |  623|  2.23k|#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
  ------------------
  578|  2.23k|        U32 s, position = 0;
  579|  34.4k|        for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (579:19): [True: 32.1k, False: 2.23k]
  ------------------
  580|  32.1k|            int i;
  581|  32.1k|            int const n = normalizedCounter[s];
  582|   263k|            for (i=0; i<n; i++) {
  ------------------
  |  Branch (582:23): [True: 231k, False: 32.1k]
  ------------------
  583|   231k|                tableDecode[position].baseValue = s;
  584|   231k|                position = (position + step) & tableMask;
  585|   245k|                while (UNLIKELY(position > highThreshold)) position = (position + step) & tableMask;   /* lowprob area */
  ------------------
  |  |  188|   245k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 14.5k, False: 231k]
  |  |  ------------------
  ------------------
  586|   231k|        }   }
  587|  2.23k|        assert(position == 0); /* position must reach all cells once, otherwise normalizedCounter is incorrect */
  ------------------
  |  |   70|  2.23k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  588|  2.23k|    }
  589|       |
  590|       |    /* Build Decoding table */
  591|  2.92k|    {
  592|  2.92k|        U32 u;
  593|   341k|        for (u=0; u<tableSize; u++) {
  ------------------
  |  Branch (593:19): [True: 338k, False: 2.92k]
  ------------------
  594|   338k|            U32 const symbol = tableDecode[u].baseValue;
  595|   338k|            U32 const nextState = symbolNext[symbol]++;
  596|   338k|            tableDecode[u].nbBits = (BYTE) (tableLog - ZSTD_highbit32(nextState) );
  597|   338k|            tableDecode[u].nextState = (U16) ( (nextState << tableDecode[u].nbBits) - tableSize);
  598|   338k|            assert(nbAdditionalBits[symbol] < 255);
  ------------------
  |  |   70|   338k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  599|   338k|            tableDecode[u].nbAdditionalBits = nbAdditionalBits[symbol];
  600|   338k|            tableDecode[u].baseValue = baseValue[symbol];
  601|   338k|        }
  602|  2.92k|    }
  603|  2.92k|}
zstd_decompress_block.c:ZSTD_buildFSETable_body_default:
  610|    434|{
  611|    434|    ZSTD_buildFSETable_body(dt, normalizedCounter, maxSymbolValue,
  612|    434|            baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  613|    434|}
zstd_decompress_block.c:ZSTD_buildSeqTable:
  654|  6.71k|{
  655|  6.71k|    switch(type)
  656|  6.71k|    {
  657|    234|    case set_rle :
  ------------------
  |  Branch (657:5): [True: 234, False: 6.47k]
  ------------------
  658|    234|        RETURN_ERROR_IF(!srcSize, srcSize_wrong, "");
  ------------------
  |  |  114|    234|    do {                                                                       \
  |  |  115|    234|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 231]
  |  |  ------------------
  |  |  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|    234|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 231]
  |  |  ------------------
  ------------------
  659|    231|        RETURN_ERROR_IF((*(const BYTE*)src) > max, corruption_detected, "");
  ------------------
  |  |  114|    231|    do {                                                                       \
  |  |  115|    231|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 7, False: 224]
  |  |  ------------------
  |  |  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|    231|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 224]
  |  |  ------------------
  ------------------
  660|    224|        {   U32 const symbol = *(const BYTE*)src;
  661|    224|            U32 const baseline = baseValue[symbol];
  662|    224|            U8 const nbBits = nbAdditionalBits[symbol];
  663|    224|            ZSTD_buildSeqTable_rle(DTableSpace, baseline, nbBits);
  664|    224|        }
  665|    224|        *DTablePtr = DTableSpace;
  666|    224|        return 1;
  667|  3.92k|    case set_basic :
  ------------------
  |  Branch (667:5): [True: 3.92k, False: 2.79k]
  ------------------
  668|  3.92k|        *DTablePtr = defaultTable;
  669|  3.92k|        return 0;
  670|     39|    case set_repeat:
  ------------------
  |  Branch (670:5): [True: 39, False: 6.67k]
  ------------------
  671|     39|        RETURN_ERROR_IF(!flagRepeatTable, corruption_detected, "");
  ------------------
  |  |  114|     39|    do {                                                                       \
  |  |  115|     39|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 7, False: 32]
  |  |  ------------------
  |  |  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|     39|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 32]
  |  |  ------------------
  ------------------
  672|       |        /* prefetch FSE table if used */
  673|     32|        if (ddictIsCold && (nbSeq > 24 /* heuristic */)) {
  ------------------
  |  Branch (673:13): [True: 0, False: 32]
  |  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|     32|        return 0;
  679|  2.51k|    case set_compressed :
  ------------------
  |  Branch (679:5): [True: 2.51k, False: 4.19k]
  ------------------
  680|  2.51k|        {   unsigned tableLog;
  681|  2.51k|            S16 norm[MaxSeq+1];
  682|  2.51k|            size_t const headerSize = FSE_readNCount(norm, &max, &tableLog, src, srcSize);
  683|  2.51k|            RETURN_ERROR_IF(FSE_isError(headerSize), corruption_detected, "");
  ------------------
  |  |  114|  2.51k|    do {                                                                       \
  |  |  115|  2.51k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 13, False: 2.50k]
  |  |  ------------------
  |  |  116|     13|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     13|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     13|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     13|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     13|    do {                                           \
  |  |  |  |   99|     13|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 13]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     13|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     13|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     13|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     13|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     13|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     13|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     13|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     13|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     13|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     13|        }                                                                      \
  |  |  123|  2.51k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.50k]
  |  |  ------------------
  ------------------
  684|  2.50k|            RETURN_ERROR_IF(tableLog > maxLog, corruption_detected, "");
  ------------------
  |  |  114|  2.50k|    do {                                                                       \
  |  |  115|  2.50k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 14, False: 2.49k]
  |  |  ------------------
  |  |  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|  2.50k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.49k]
  |  |  ------------------
  ------------------
  685|  2.49k|            ZSTD_buildFSETable(DTableSpace, norm, max, baseValue, nbAdditionalBits, tableLog, wksp, wkspSize, bmi2);
  686|  2.49k|            *DTablePtr = DTableSpace;
  687|  2.49k|            return headerSize;
  688|  2.50k|        }
  689|      0|    default :
  ------------------
  |  Branch (689:5): [True: 0, False: 6.71k]
  ------------------
  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.71k|    }
  693|  6.71k|}
zstd_decompress_block.c:ZSTD_buildSeqTable_rle:
  464|    224|{
  465|    224|    void* ptr = dt;
  466|    224|    ZSTD_seqSymbol_header* const DTableH = (ZSTD_seqSymbol_header*)ptr;
  467|    224|    ZSTD_seqSymbol* const cell = dt + 1;
  468|       |
  469|    224|    DTableH->tableLog = 0;
  470|    224|    DTableH->fastMode = 0;
  471|       |
  472|    224|    cell->nbBits = 0;
  473|    224|    cell->nextState = 0;
  474|    224|    assert(nbAddBits < 255);
  ------------------
  |  |   70|    224|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  475|    224|    cell->nbAdditionalBits = nbAddBits;
  476|    224|    cell->baseValue = baseValue;
  477|    224|}
zstd_decompress_block.c:ZSTD_blockSizeMax:
   55|  14.0k|{
   56|  14.0k|    size_t const blockSizeMax = dctx->isFrameDecompression ? dctx->fParams.blockSizeMax : ZSTD_BLOCKSIZE_MAX;
  ------------------
  |  |  148|  14.0k|#define ZSTD_BLOCKSIZE_MAX     (1<<ZSTD_BLOCKSIZELOG_MAX)
  |  |  ------------------
  |  |  |  |  147|      0|#define ZSTD_BLOCKSIZELOG_MAX  17
  |  |  ------------------
  ------------------
  |  Branch (56:33): [True: 14.0k, False: 0]
  ------------------
   57|  14.0k|    assert(blockSizeMax <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  14.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   58|  14.0k|    return blockSizeMax;
   59|  14.0k|}
zstd_decompress_block.c:ZSTD_totalHistorySize:
 1997|  2.38k|{
 1998|  2.38k|    return (size_t)(op - virtualStart);
 1999|  2.38k|}
zstd_decompress_block.c:ZSTD_decompressSequencesLong:
 1979|    969|{
 1980|    969|    DEBUGLOG(5, "ZSTD_decompressSequencesLong");
  ------------------
  |  |  104|    969|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 969]
  |  |  ------------------
  ------------------
 1981|    969|#if DYNAMIC_BMI2
 1982|    969|    if (ZSTD_DCtx_get_bmi2(dctx)) {
  ------------------
  |  Branch (1982:9): [True: 969, False: 0]
  ------------------
 1983|    969|        return ZSTD_decompressSequencesLong_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1984|    969|    }
 1985|      0|#endif
 1986|      0|  return ZSTD_decompressSequencesLong_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1987|    969|}
zstd_decompress_block.c:ZSTD_decompressSequencesLong_bmi2:
 1931|    969|{
 1932|    969|    return ZSTD_decompressSequencesLong_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1933|    969|}
zstd_decompress_block.c:ZSTD_decompressSequencesLong_body:
 1738|    969|{
 1739|    969|    const BYTE* ip = (const BYTE*)seqStart;
 1740|    969|    const BYTE* const iend = ip + seqSize;
 1741|    969|    BYTE* const ostart = (BYTE*)dst;
 1742|    969|    BYTE* const oend = dctx->litBufferLocation == ZSTD_in_dst ? dctx->litBuffer : ZSTD_maybeNullPtrAdd(ostart, maxDstSize);
  ------------------
  |  Branch (1742:24): [True: 110, False: 859]
  ------------------
 1743|    969|    BYTE* op = ostart;
 1744|    969|    const BYTE* litPtr = dctx->litPtr;
 1745|    969|    const BYTE* litBufferEnd = dctx->litBufferEnd;
 1746|    969|    const BYTE* const prefixStart = (const BYTE*) (dctx->prefixStart);
 1747|    969|    const BYTE* const dictStart = (const BYTE*) (dctx->virtualStart);
 1748|    969|    const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd);
 1749|       |
 1750|       |    /* Regen sequences */
 1751|    969|    if (nbSeq) {
  ------------------
  |  Branch (1751:9): [True: 968, False: 1]
  ------------------
 1752|    968|#define STORED_SEQS 8
 1753|    968|#define STORED_SEQS_MASK (STORED_SEQS-1)
 1754|    968|#define ADVANCED_SEQS STORED_SEQS
 1755|    968|        seq_t sequences[STORED_SEQS];
 1756|    968|        int const seqAdvance = MIN(nbSeq, ADVANCED_SEQS);
  ------------------
  |  |   54|    968|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 7, False: 961]
  |  |  ------------------
  ------------------
 1757|    968|        seqState_t seqState;
 1758|    968|        int seqNb;
 1759|    968|        size_t prefetchPos = (size_t)(op-prefixStart); /* track position relative to prefixStart */
 1760|       |
 1761|    968|        dctx->fseEntropy = 1;
 1762|  3.87k|        { int i; for (i=0; i<ZSTD_REP_NUM; i++) seqState.prevOffset[i] = dctx->entropy.rep[i]; }
  ------------------
  |  |   64|  3.87k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1762:28): [True: 2.90k, False: 968]
  ------------------
 1763|    968|        assert(dst != NULL);
  ------------------
  |  |   70|    968|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1764|    968|        assert(iend >= ip);
  ------------------
  |  |   70|    968|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1765|    968|        RETURN_ERROR_IF(
  ------------------
  |  |  114|    968|    do {                                                                       \
  |  |  115|    968|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 54, False: 914]
  |  |  ------------------
  |  |  116|     54|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     54|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 54]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     54|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     54|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     54|    do {                                           \
  |  |  |  |   99|     54|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 54]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     54|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 54]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     54|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     54|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 54]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     54|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     54|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 54]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     54|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     54|        }                                                                      \
  |  |  123|    968|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 914]
  |  |  ------------------
  ------------------
 1766|    968|            ERR_isError(BIT_initDStream(&seqState.DStream, ip, iend-ip)),
 1767|    968|            corruption_detected, "");
 1768|    914|        ZSTD_initFseState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr);
 1769|    914|        ZSTD_initFseState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr);
 1770|    914|        ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr);
 1771|       |
 1772|       |        /* prepare in advance */
 1773|  8.20k|        for (seqNb=0; seqNb<seqAdvance; seqNb++) {
  ------------------
  |  Branch (1773:23): [True: 7.28k, False: 914]
  ------------------
 1774|  7.28k|            seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset, seqNb == nbSeq-1);
 1775|  7.28k|            prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd);
 1776|  7.28k|            sequences[seqNb] = sequence;
 1777|  7.28k|        }
 1778|       |
 1779|       |        /* decompress without stomping litBuffer */
 1780|   754k|        for (; seqNb < nbSeq; seqNb++) {
  ------------------
  |  Branch (1780:16): [True: 753k, False: 275]
  ------------------
 1781|   753k|            seq_t sequence = ZSTD_decodeSequence(&seqState, isLongOffset, seqNb == nbSeq-1);
 1782|       |
 1783|   753k|            if (dctx->litBufferLocation == ZSTD_split && litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength > dctx->litBufferEnd) {
  ------------------
  |  | 1754|   416k|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1752|   416k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
                          if (dctx->litBufferLocation == ZSTD_split && litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength > dctx->litBufferEnd) {
  ------------------
  |  | 1753|   416k|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|   416k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
  |  Branch (1783:17): [True: 416k, False: 337k]
  |  Branch (1783:58): [True: 386, False: 415k]
  ------------------
 1784|       |                /* lit buffer is reaching split point, empty out the first buffer and transition to litExtraBuffer */
 1785|    386|                const size_t leftoverLit = dctx->litBufferEnd - litPtr;
 1786|    386|                if (leftoverLit)
  ------------------
  |  Branch (1786:21): [True: 381, False: 5]
  ------------------
 1787|    381|                {
 1788|    381|                    RETURN_ERROR_IF(leftoverLit > (size_t)(oend - op), dstSize_tooSmall, "remaining lit must fit within dstBuffer");
  ------------------
  |  |  114|    381|    do {                                                                       \
  |  |  115|    381|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 12, False: 369]
  |  |  ------------------
  |  |  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|    381|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 369]
  |  |  ------------------
  ------------------
 1789|    369|                    ZSTD_safecopyDstBeforeSrc(op, litPtr, leftoverLit);
 1790|    369|                    sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength -= leftoverLit;
  ------------------
  |  | 1754|    369|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1752|    369|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
                                  sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength -= leftoverLit;
  ------------------
  |  | 1753|    369|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|    369|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1791|    369|                    op += leftoverLit;
 1792|    369|                }
 1793|    374|                litPtr = dctx->litExtraBuffer;
 1794|    374|                litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|    374|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|    374|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    748|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 374]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 374, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1795|    374|                dctx->litBufferLocation = ZSTD_not_in_dst;
 1796|    374|                {   size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd);
  ------------------
  |  | 1754|    374|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1752|    374|#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|    374|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|    374|#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|    374|                    if (ZSTD_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  |   44|    374|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1801:25): [True: 61, False: 313]
  ------------------
 1802|       |
 1803|    313|                    prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd);
 1804|    313|                    sequences[seqNb & STORED_SEQS_MASK] = sequence;
  ------------------
  |  | 1753|    313|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|    313|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1805|    313|                    op += oneSeqSize;
 1806|    313|            }   }
 1807|   753k|            else
 1808|   753k|            {
 1809|       |                /* lit buffer is either wholly contained in first or second split, or not split at all*/
 1810|   753k|                size_t const oneSeqSize = dctx->litBufferLocation == ZSTD_split ?
  ------------------
  |  Branch (1810:43): [True: 415k, False: 337k]
  ------------------
 1811|   415k|                    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|   415k|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1752|   415k|#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|   415k|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|   415k|#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|   415k|#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|   415k|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1752|   415k|#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|   415k|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|   415k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1812|   753k|                    ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd);
  ------------------
  |  | 1754|   337k|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1752|   337k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
                                  ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd);
  ------------------
  |  | 1753|   337k|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|   337k|#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|   753k|                if (ZSTD_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  |   44|   753k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1817:21): [True: 566, False: 752k]
  ------------------
 1818|       |
 1819|   752k|                prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd);
 1820|   752k|                sequences[seqNb & STORED_SEQS_MASK] = sequence;
  ------------------
  |  | 1753|   752k|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|   752k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1821|   752k|                op += oneSeqSize;
 1822|   752k|            }
 1823|   753k|        }
 1824|    275|        RETURN_ERROR_IF(!BIT_endOfDStream(&seqState.DStream), corruption_detected, "");
  ------------------
  |  |  114|    275|    do {                                                                       \
  |  |  115|    275|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 23, False: 252]
  |  |  ------------------
  |  |  116|     23|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     23|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 23]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     23|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     23|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     23|    do {                                           \
  |  |  |  |   99|     23|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 23]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     23|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 23]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     23|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     23|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 23]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     23|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     23|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 23]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     23|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     23|        }                                                                      \
  |  |  123|    275|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 252]
  |  |  ------------------
  ------------------
 1825|       |
 1826|       |        /* finish queue */
 1827|    252|        seqNb -= seqAdvance;
 1828|  1.86k|        for ( ; seqNb<nbSeq ; seqNb++) {
  ------------------
  |  Branch (1828:17): [True: 1.72k, False: 138]
  ------------------
 1829|  1.72k|            seq_t *sequence = &(sequences[seqNb&STORED_SEQS_MASK]);
  ------------------
  |  | 1753|  1.72k|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1752|  1.72k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1830|  1.72k|            if (dctx->litBufferLocation == ZSTD_split && litPtr + sequence->litLength > dctx->litBufferEnd) {
  ------------------
  |  Branch (1830:17): [True: 939, False: 787]
  |  Branch (1830:58): [True: 106, False: 833]
  ------------------
 1831|    106|                const size_t leftoverLit = dctx->litBufferEnd - litPtr;
 1832|    106|                if (leftoverLit) {
  ------------------
  |  Branch (1832:21): [True: 105, False: 1]
  ------------------
 1833|    105|                    RETURN_ERROR_IF(leftoverLit > (size_t)(oend - op), dstSize_tooSmall, "remaining lit must fit within dstBuffer");
  ------------------
  |  |  114|    105|    do {                                                                       \
  |  |  115|    105|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 104]
  |  |  ------------------
  |  |  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|    105|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 104]
  |  |  ------------------
  ------------------
 1834|    104|                    ZSTD_safecopyDstBeforeSrc(op, litPtr, leftoverLit);
 1835|    104|                    sequence->litLength -= leftoverLit;
 1836|    104|                    op += leftoverLit;
 1837|    104|                }
 1838|    105|                litPtr = dctx->litExtraBuffer;
 1839|    105|                litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|    105|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|    105|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    210|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 105]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 105, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1840|    105|                dctx->litBufferLocation = ZSTD_not_in_dst;
 1841|    105|                {   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|    105|                    if (ZSTD_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  |   44|    105|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1846:25): [True: 16, False: 89]
  ------------------
 1847|     89|                    op += oneSeqSize;
 1848|     89|                }
 1849|     89|            }
 1850|  1.62k|            else
 1851|  1.62k|            {
 1852|  1.62k|                size_t const oneSeqSize = dctx->litBufferLocation == ZSTD_split ?
  ------------------
  |  Branch (1852:43): [True: 833, False: 787]
  ------------------
 1853|    833|                    ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequence->litLength - WILDCOPY_OVERLENGTH, *sequence, &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd) :
  ------------------
  |  |  199|    833|#define WILDCOPY_OVERLENGTH 32
  ------------------
 1854|  1.62k|                    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.62k|                if (ZSTD_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  |   44|  1.62k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1859:21): [True: 97, False: 1.52k]
  ------------------
 1860|  1.52k|                op += oneSeqSize;
 1861|  1.52k|            }
 1862|  1.72k|        }
 1863|       |
 1864|       |        /* save reps for next block */
 1865|    552|        { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) dctx->entropy.rep[i] = (U32)(seqState.prevOffset[i]); }
  ------------------
  |  |   64|    552|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1865:28): [True: 414, False: 138]
  ------------------
 1866|    138|    }
 1867|       |
 1868|       |    /* last literal segment */
 1869|    139|    if (dctx->litBufferLocation == ZSTD_split) { /* first deplete literal buffer in dst, then copy litExtraBuffer */
  ------------------
  |  Branch (1869:9): [True: 39, False: 100]
  ------------------
 1870|     39|        size_t const lastLLSize = litBufferEnd - litPtr;
 1871|     39|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend - op), dstSize_tooSmall, "");
  ------------------
  |  |  114|     39|    do {                                                                       \
  |  |  115|     39|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 8, False: 31]
  |  |  ------------------
  |  |  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|     39|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 31]
  |  |  ------------------
  ------------------
 1872|     31|        if (op != NULL) {
  ------------------
  |  Branch (1872:13): [True: 31, False: 0]
  ------------------
 1873|     31|            ZSTD_memmove(op, litPtr, lastLLSize);
  ------------------
  |  |   45|     31|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1874|     31|            op += lastLLSize;
 1875|     31|        }
 1876|     31|        litPtr = dctx->litExtraBuffer;
 1877|     31|        litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|     31|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|     31|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|     62|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 31]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 31, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1878|     31|    }
 1879|    131|    {   size_t const lastLLSize = litBufferEnd - litPtr;
 1880|    131|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall, "");
  ------------------
  |  |  114|    131|    do {                                                                       \
  |  |  115|    131|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 11, False: 120]
  |  |  ------------------
  |  |  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|    131|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 120]
  |  |  ------------------
  ------------------
 1881|    120|        if (op != NULL) {
  ------------------
  |  Branch (1881:13): [True: 120, False: 0]
  ------------------
 1882|    120|            ZSTD_memmove(op, litPtr, lastLLSize);
  ------------------
  |  |   45|    120|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1883|    120|            op += lastLLSize;
 1884|    120|        }
 1885|    120|    }
 1886|       |
 1887|      0|    return (size_t)(op - ostart);
 1888|    131|}
zstd_decompress_block.c:ZSTD_initFseState:
 1193|  6.19k|{
 1194|  6.19k|    const void* ptr = dt;
 1195|  6.19k|    const ZSTD_seqSymbol_header* const DTableH = (const ZSTD_seqSymbol_header*)ptr;
 1196|  6.19k|    DStatePtr->state = BIT_readBits(bitD, DTableH->tableLog);
 1197|  6.19k|    DEBUGLOG(6, "ZSTD_initFseState : val=%u using %u bits",
  ------------------
  |  |  104|  6.19k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 6.19k]
  |  |  ------------------
  ------------------
 1198|  6.19k|                (U32)DStatePtr->state, DTableH->tableLog);
 1199|  6.19k|    BIT_reloadDStream(bitD);
 1200|  6.19k|    DStatePtr->table = dt + 1;
 1201|  6.19k|}
zstd_decompress_block.c:ZSTD_decodeSequence:
 1230|  2.90M|{
 1231|  2.90M|    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.90M|    const ZSTD_seqSymbol* const llDInfo = seqState->stateLL.table + seqState->stateLL.state;
 1250|  2.90M|    const ZSTD_seqSymbol* const mlDInfo = seqState->stateML.table + seqState->stateML.state;
 1251|  2.90M|    const ZSTD_seqSymbol* const ofDInfo = seqState->stateOffb.table + seqState->stateOffb.state;
 1252|  2.90M|#endif
 1253|  2.90M|    seq.matchLength = mlDInfo->baseValue;
 1254|  2.90M|    seq.litLength = llDInfo->baseValue;
 1255|  2.90M|    {   U32 const ofBase = ofDInfo->baseValue;
 1256|  2.90M|        BYTE const llBits = llDInfo->nbAdditionalBits;
 1257|  2.90M|        BYTE const mlBits = mlDInfo->nbAdditionalBits;
 1258|  2.90M|        BYTE const ofBits = ofDInfo->nbAdditionalBits;
 1259|  2.90M|        BYTE const totalBits = llBits+mlBits+ofBits;
 1260|       |
 1261|  2.90M|        U16 const llNext = llDInfo->nextState;
 1262|  2.90M|        U16 const mlNext = mlDInfo->nextState;
 1263|  2.90M|        U16 const ofNext = ofDInfo->nextState;
 1264|  2.90M|        U32 const llnbBits = llDInfo->nbBits;
 1265|  2.90M|        U32 const mlnbBits = mlDInfo->nbBits;
 1266|  2.90M|        U32 const ofnbBits = ofDInfo->nbBits;
 1267|       |
 1268|  2.90M|        assert(llBits <= MaxLLBits);
  ------------------
  |  |   70|  2.90M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1269|  2.90M|        assert(mlBits <= MaxMLBits);
  ------------------
  |  |   70|  2.90M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1270|  2.90M|        assert(ofBits <= MaxOff);
  ------------------
  |  |   70|  2.90M|#    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.90M|        {   size_t offset;
 1279|  2.90M|            if (ofBits > 1) {
  ------------------
  |  Branch (1279:17): [True: 997k, False: 1.90M]
  ------------------
 1280|   997k|                ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1);
  ------------------
  |  |   43|   997k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|   997k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1281|   997k|                ZSTD_STATIC_ASSERT(LONG_OFFSETS_MAX_EXTRA_BITS_32 == 5);
  ------------------
  |  |   43|   997k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|   997k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1282|   997k|                ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 > LONG_OFFSETS_MAX_EXTRA_BITS_32);
  ------------------
  |  |   43|   997k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|   997k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1283|   997k|                ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 - LONG_OFFSETS_MAX_EXTRA_BITS_32 >= MaxMLBits);
  ------------------
  |  |   43|   997k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|   997k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1284|   997k|                if (MEM_32bits() && longOffsets && (ofBits >= STREAM_ACCUMULATOR_MIN_32)) {
  ------------------
  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  ------------------
  |  Branch (1284:21): [True: 0, False: 997k]
  |  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|   997k|                } else {
 1293|   997k|                    offset = ofBase + BIT_readBitsFast(&seqState->DStream, ofBits/*>0*/);   /* <=  (ZSTD_WINDOWLOG_MAX-1) bits */
 1294|   997k|                    if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream);
  ------------------
  |  Branch (1294:25): [True: 0, False: 997k]
  ------------------
 1295|   997k|                }
 1296|   997k|                seqState->prevOffset[2] = seqState->prevOffset[1];
 1297|   997k|                seqState->prevOffset[1] = seqState->prevOffset[0];
 1298|   997k|                seqState->prevOffset[0] = offset;
 1299|  1.90M|            } else {
 1300|  1.90M|                U32 const ll0 = (llDInfo->baseValue == 0);
 1301|  1.90M|                if (LIKELY((ofBits == 0))) {
  ------------------
  |  |  187|  1.90M|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (187:19): [True: 1.45M, False: 446k]
  |  |  ------------------
  ------------------
 1302|  1.45M|                    offset = seqState->prevOffset[ll0];
 1303|  1.45M|                    seqState->prevOffset[1] = seqState->prevOffset[!ll0];
 1304|  1.45M|                    seqState->prevOffset[0] = offset;
 1305|  1.45M|                } else {
 1306|   446k|                    offset = ofBase + ll0 + BIT_readBitsFast(&seqState->DStream, 1);
 1307|   446k|                    {   size_t temp = (offset==3) ? seqState->prevOffset[0] - 1 : seqState->prevOffset[offset];
  ------------------
  |  Branch (1307:39): [True: 30.1k, False: 416k]
  ------------------
 1308|   446k|                        temp -= !temp; /* 0 is not valid: input corrupted => force offset to -1 => corruption detected at execSequence */
 1309|   446k|                        if (offset != 1) seqState->prevOffset[2] = seqState->prevOffset[1];
  ------------------
  |  Branch (1309:29): [True: 282k, False: 164k]
  ------------------
 1310|   446k|                        seqState->prevOffset[1] = seqState->prevOffset[0];
 1311|   446k|                        seqState->prevOffset[0] = offset = temp;
 1312|   446k|            }   }   }
 1313|  2.90M|            seq.offset = offset;
 1314|  2.90M|        }
 1315|       |
 1316|  2.90M|        if (mlBits > 0)
  ------------------
  |  Branch (1316:13): [True: 116k, False: 2.78M]
  ------------------
 1317|   116k|            seq.matchLength += BIT_readBitsFast(&seqState->DStream, mlBits/*>0*/);
 1318|       |
 1319|  2.90M|        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.90M]
  |  Branch (1319:29): [True: 0, False: 0]
  ------------------
 1320|      0|            BIT_reloadDStream(&seqState->DStream);
 1321|  2.90M|        if (MEM_64bits() && UNLIKELY(totalBits >= STREAM_ACCUMULATOR_MIN_64-(LLFSELog+MLFSELog+OffFSELog)))
  ------------------
  |  |  188|  2.90M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 1.18k, False: 2.89M]
  |  |  ------------------
  ------------------
  |  Branch (1321:13): [True: 2.90M, False: 0]
  ------------------
 1322|  1.18k|            BIT_reloadDStream(&seqState->DStream);
 1323|       |        /* Ensure there are enough bits to read the rest of data in 64-bit mode. */
 1324|  2.90M|        ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64);
  ------------------
  |  |   43|  2.90M|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  2.90M|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1325|       |
 1326|  2.90M|        if (llBits > 0)
  ------------------
  |  Branch (1326:13): [True: 388k, False: 2.51M]
  ------------------
 1327|   388k|            seq.litLength += BIT_readBitsFast(&seqState->DStream, llBits/*>0*/);
 1328|       |
 1329|  2.90M|        if (MEM_32bits())
  ------------------
  |  Branch (1329:13): [True: 0, False: 2.90M]
  ------------------
 1330|      0|            BIT_reloadDStream(&seqState->DStream);
 1331|       |
 1332|  2.90M|        DEBUGLOG(6, "seq: litL=%u, matchL=%u, offset=%u",
  ------------------
  |  |  104|  2.90M|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.90M]
  |  |  ------------------
  ------------------
 1333|  2.90M|                    (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset);
 1334|       |
 1335|  2.90M|        if (!isLastSeq) {
  ------------------
  |  Branch (1335:13): [True: 2.89M, False: 441]
  ------------------
 1336|       |            /* don't update FSE state for last Sequence */
 1337|  2.89M|            ZSTD_updateFseStateWithDInfo(&seqState->stateLL, &seqState->DStream, llNext, llnbBits);    /* <=  9 bits */
 1338|  2.89M|            ZSTD_updateFseStateWithDInfo(&seqState->stateML, &seqState->DStream, mlNext, mlnbBits);    /* <=  9 bits */
 1339|  2.89M|            if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream);    /* <= 18 bits */
  ------------------
  |  Branch (1339:17): [True: 0, False: 2.89M]
  ------------------
 1340|  2.89M|            ZSTD_updateFseStateWithDInfo(&seqState->stateOffb, &seqState->DStream, ofNext, ofnbBits);  /* <=  8 bits */
 1341|  2.89M|            BIT_reloadDStream(&seqState->DStream);
 1342|  2.89M|        }
 1343|  2.90M|    }
 1344|       |
 1345|  2.90M|    return seq;
 1346|  2.90M|}
zstd_decompress_block.c:ZSTD_updateFseStateWithDInfo:
 1205|  8.69M|{
 1206|  8.69M|    size_t const lowBits = BIT_readBits(bitD, nbBits);
 1207|  8.69M|    DStatePtr->state = nextState + lowBits;
 1208|  8.69M|}
zstd_decompress_block.c:ZSTD_prefetchMatch:
 1717|   760k|{
 1718|   760k|    prefetchPos += sequence.litLength;
 1719|   760k|    {   const BYTE* const matchBase = (sequence.offset > prefetchPos) ? dictEnd : prefixStart;
  ------------------
  |  Branch (1719:39): [True: 2.39k, False: 758k]
  ------------------
 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|   760k|        const BYTE* const match = ZSTD_wrappedPtrSub(ZSTD_wrappedPtrAdd(matchBase, prefetchPos), sequence.offset);
 1723|   760k|        PREFETCH_L1(match); PREFETCH_L1(match+CACHELINE_SIZE);   /* note : it's safe to invoke PREFETCH() on any memory address, including invalid ones */
  ------------------
  |  |  145|   760k|#    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|   760k|#    define PREFETCH_L1(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
  ------------------
 1724|   760k|    }
 1725|   760k|    return prefetchPos + sequence.matchLength;
 1726|   760k|}
zstd_decompress_block.c:ZSTD_safecopyDstBeforeSrc:
  877|   264k|static void ZSTD_safecopyDstBeforeSrc(BYTE* op, const BYTE* ip, ptrdiff_t length) {
  878|   264k|    ptrdiff_t const diff = op - ip;
  879|   264k|    BYTE* const oend = op + length;
  880|       |
  881|   264k|    if (length < 8 || diff > -8) {
  ------------------
  |  Branch (881:9): [True: 215k, False: 49.7k]
  |  Branch (881:23): [True: 48.5k, False: 1.13k]
  ------------------
  882|       |        /* Handle short lengths, close overlaps, and dst not before src. */
  883|  4.59M|        while (op < oend) *op++ = *ip++;
  ------------------
  |  Branch (883:16): [True: 4.33M, False: 263k]
  ------------------
  884|   263k|        return;
  885|   263k|    }
  886|       |
  887|  1.13k|    if (op <= oend - WILDCOPY_OVERLENGTH && diff < -WILDCOPY_VECLEN) {
  ------------------
  |  |  199|  2.26k|#define WILDCOPY_OVERLENGTH 32
  ------------------
                  if (op <= oend - WILDCOPY_OVERLENGTH && diff < -WILDCOPY_VECLEN) {
  ------------------
  |  |  200|    833|#define WILDCOPY_VECLEN 16
  ------------------
  |  Branch (887:9): [True: 833, False: 299]
  |  Branch (887:45): [True: 767, False: 66]
  ------------------
  888|    767|        ZSTD_wildcopy(op, ip, oend - WILDCOPY_OVERLENGTH - op, ZSTD_no_overlap);
  ------------------
  |  |  199|    767|#define WILDCOPY_OVERLENGTH 32
  ------------------
  889|    767|        ip += oend - WILDCOPY_OVERLENGTH - op;
  ------------------
  |  |  199|    767|#define WILDCOPY_OVERLENGTH 32
  ------------------
  890|    767|        op += oend - WILDCOPY_OVERLENGTH - op;
  ------------------
  |  |  199|    767|#define WILDCOPY_OVERLENGTH 32
  ------------------
  891|    767|    }
  892|       |
  893|       |    /* Handle the leftovers. */
  894|   447k|    while (op < oend) *op++ = *ip++;
  ------------------
  |  Branch (894:12): [True: 446k, False: 1.13k]
  ------------------
  895|  1.13k|}
zstd_decompress_block.c:ZSTD_execSequence:
 1005|  1.63M|{
 1006|  1.63M|    BYTE* const oLitEnd = op + sequence.litLength;
 1007|  1.63M|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
 1008|  1.63M|    BYTE* const oMatchEnd = op + sequenceLength;   /* risk : address space overflow (32-bits) */
 1009|  1.63M|    BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH;   /* risk : address space underflow on oend=NULL */
  ------------------
  |  |  199|  1.63M|#define WILDCOPY_OVERLENGTH 32
  ------------------
 1010|  1.63M|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
 1011|  1.63M|    const BYTE* match = oLitEnd - sequence.offset;
 1012|       |
 1013|  1.63M|    assert(op != NULL /* Precondition */);
  ------------------
  |  |   70|  1.63M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1014|  1.63M|    assert(oend_w < oend /* No underflow */);
  ------------------
  |  |   70|  1.63M|#    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.63M|    if (UNLIKELY(
  ------------------
  |  |  188|  8.14M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 1.65k, False: 1.62M]
  |  |  |  Branch (188:40): [True: 211, False: 1.63M]
  |  |  |  Branch (188:40): [True: 1.44k, False: 1.62M]
  |  |  |  Branch (188:40): [True: 0, False: 1.62M]
  |  |  |  Branch (188:40): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1026|  1.63M|        iLitEnd > litLimit ||
 1027|  1.63M|        oMatchEnd > oend_w ||
 1028|  1.63M|        (MEM_32bits() && (size_t)(oend - op) < sequenceLength + WILDCOPY_OVERLENGTH)))
 1029|  1.65k|        return ZSTD_execSequenceEnd(op, oend, sequence, litPtr, litLimit, prefixStart, virtualStart, dictEnd);
 1030|       |
 1031|       |    /* Assumptions (everything else goes into ZSTD_execSequenceEnd()) */
 1032|  1.62M|    assert(op <= oLitEnd /* No overflow */);
  ------------------
  |  |   70|  1.62M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1033|  1.62M|    assert(oLitEnd < oMatchEnd /* Non-zero match & no overflow */);
  ------------------
  |  |   70|  1.62M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1034|  1.62M|    assert(oMatchEnd <= oend /* No underflow */);
  ------------------
  |  |   70|  1.62M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1035|  1.62M|    assert(iLitEnd <= litLimit /* Literal length is in bounds */);
  ------------------
  |  |   70|  1.62M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1036|  1.62M|    assert(oLitEnd <= oend_w /* Can wildcopy literals */);
  ------------------
  |  |   70|  1.62M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1037|  1.62M|    assert(oMatchEnd <= oend_w /* Can wildcopy matches */);
  ------------------
  |  |   70|  1.62M|#    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.62M|    assert(WILDCOPY_OVERLENGTH >= 16);
  ------------------
  |  |   70|  1.62M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1044|  1.62M|    ZSTD_copy16(op, (*litPtr));
 1045|  1.62M|    if (UNLIKELY(sequence.litLength > 16)) {
  ------------------
  |  |  188|  1.62M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 103k, False: 1.52M]
  |  |  ------------------
  ------------------
 1046|   103k|        ZSTD_wildcopy(op + 16, (*litPtr) + 16, sequence.litLength - 16, ZSTD_no_overlap);
 1047|   103k|    }
 1048|  1.62M|    op = oLitEnd;
 1049|  1.62M|    *litPtr = iLitEnd;   /* update for next sequence */
 1050|       |
 1051|       |    /* Copy Match */
 1052|  1.62M|    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
  ------------------
  |  Branch (1052:9): [True: 914, False: 1.62M]
  ------------------
 1053|       |        /* offset beyond prefix -> go into extDict */
 1054|    914|        RETURN_ERROR_IF(UNLIKELY(sequence.offset > (size_t)(oLitEnd - virtualStart)), corruption_detected, "");
  ------------------
  |  |  114|    914|    do {                                                                       \
  |  |  115|    914|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 457, False: 457]
  |  |  ------------------
  |  |  116|    457|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    457|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 457]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    457|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    457|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    457|    do {                                           \
  |  |  |  |   99|    457|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 457]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    457|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 457]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    457|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    457|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 457]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    457|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    457|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 457]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    457|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    457|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    457|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    457|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    457|        }                                                                      \
  |  |  123|    914|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 457]
  |  |  ------------------
  ------------------
 1055|    457|        match = dictEnd + (match - prefixStart);
 1056|    457|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (1056:13): [True: 409, False: 48]
  ------------------
 1057|    409|            ZSTD_memmove(oLitEnd, match, sequence.matchLength);
  ------------------
  |  |   45|    409|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1058|    409|            return sequenceLength;
 1059|    409|        }
 1060|       |        /* span extDict & currentPrefixSegment */
 1061|     48|        {   size_t const length1 = dictEnd - match;
 1062|     48|        ZSTD_memmove(oLitEnd, match, length1);
  ------------------
  |  |   45|     48|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1063|     48|        op = oLitEnd + length1;
 1064|     48|        sequence.matchLength -= length1;
 1065|     48|        match = prefixStart;
 1066|     48|        }
 1067|     48|    }
 1068|       |    /* Match within prefix of 1 or more bytes */
 1069|  1.62M|    assert(op <= oMatchEnd);
  ------------------
  |  |   70|  1.62M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1070|  1.62M|    assert(oMatchEnd <= oend_w);
  ------------------
  |  |   70|  1.62M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1071|  1.62M|    assert(match >= prefixStart);
  ------------------
  |  |   70|  1.62M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1072|  1.62M|    assert(sequence.matchLength >= 1);
  ------------------
  |  |   70|  1.62M|#    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.62M|    if (LIKELY(sequence.offset >= WILDCOPY_VECLEN)) {
  ------------------
  |  |  187|  1.62M|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (187:19): [True: 581k, False: 1.04M]
  |  |  ------------------
  ------------------
 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|   581k|        ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength, ZSTD_no_overlap);
 1083|   581k|        return sequenceLength;
 1084|   581k|    }
 1085|  1.04M|    assert(sequence.offset < WILDCOPY_VECLEN);
  ------------------
  |  |   70|  1.04M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1086|       |
 1087|       |    /* Copy 8 bytes and spread the offset to be >= 8. */
 1088|  1.04M|    ZSTD_overlapCopy8(&op, &match, sequence.offset);
 1089|       |
 1090|       |    /* If the match length is > 8 bytes, then continue with the wildcopy. */
 1091|  1.04M|    if (sequence.matchLength > 8) {
  ------------------
  |  Branch (1091:9): [True: 171k, False: 874k]
  ------------------
 1092|   171k|        assert(op < oMatchEnd);
  ------------------
  |  |   70|   171k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1093|   171k|        ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength - 8, ZSTD_overlap_src_before_dst);
 1094|   171k|    }
 1095|  1.04M|    return sequenceLength;
 1096|  1.62M|}
zstd_decompress_block.c:ZSTD_execSequenceEnd:
  911|  1.65k|{
  912|  1.65k|    BYTE* const oLitEnd = op + sequence.litLength;
  913|  1.65k|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
  914|  1.65k|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
  915|  1.65k|    const BYTE* match = oLitEnd - sequence.offset;
  916|  1.65k|    BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  199|  1.65k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  917|       |
  918|       |    /* bounds checks : careful of address space overflow in 32-bit mode */
  919|  1.65k|    RETURN_ERROR_IF(sequenceLength > (size_t)(oend - op), dstSize_tooSmall, "last match must fit within dstBuffer");
  ------------------
  |  |  114|  1.65k|    do {                                                                       \
  |  |  115|  1.65k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 599, False: 1.06k]
  |  |  ------------------
  |  |  116|    599|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    599|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 599]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    599|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    599|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    599|    do {                                           \
  |  |  |  |   99|    599|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 599]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    599|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 599]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    599|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    599|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 599]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    599|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    599|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 599]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    599|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    599|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    599|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    599|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    599|        }                                                                      \
  |  |  123|  1.65k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.06k]
  |  |  ------------------
  ------------------
  920|  1.06k|    RETURN_ERROR_IF(sequence.litLength > (size_t)(litLimit - *litPtr), corruption_detected, "try to read beyond literal buffer");
  ------------------
  |  |  114|  1.06k|    do {                                                                       \
  |  |  115|  1.06k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 145, False: 915]
  |  |  ------------------
  |  |  116|    145|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    145|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 145]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    145|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    145|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    145|    do {                                           \
  |  |  |  |   99|    145|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 145]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    145|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 145]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    145|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    145|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 145]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    145|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    145|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 145]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    145|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    145|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    145|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    145|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    145|        }                                                                      \
  |  |  123|  1.06k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 915]
  |  |  ------------------
  ------------------
  921|    915|    assert(op < op + sequenceLength);
  ------------------
  |  |   70|    915|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  922|    915|    assert(oLitEnd < op + sequenceLength);
  ------------------
  |  |   70|    915|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  923|       |
  924|       |    /* copy literals */
  925|    915|    ZSTD_safecopy(op, oend_w, *litPtr, sequence.litLength, ZSTD_no_overlap);
  926|    915|    op = oLitEnd;
  927|    915|    *litPtr = iLitEnd;
  928|       |
  929|       |    /* copy Match */
  930|    915|    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
  ------------------
  |  Branch (930:9): [True: 72, False: 843]
  ------------------
  931|       |        /* offset beyond prefix */
  932|     72|        RETURN_ERROR_IF(sequence.offset > (size_t)(oLitEnd - virtualStart), corruption_detected, "");
  ------------------
  |  |  114|     72|    do {                                                                       \
  |  |  115|     72|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 52, False: 20]
  |  |  ------------------
  |  |  116|     52|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     52|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 52]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     52|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     52|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     52|    do {                                           \
  |  |  |  |   99|     52|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 52]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     52|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 52]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     52|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     52|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 52]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     52|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     52|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 52]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     52|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     52|        }                                                                      \
  |  |  123|     72|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 20]
  |  |  ------------------
  ------------------
  933|     20|        match = dictEnd - (prefixStart - match);
  934|     20|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (934:13): [True: 18, False: 2]
  ------------------
  935|     18|            ZSTD_memmove(oLitEnd, match, sequence.matchLength);
  ------------------
  |  |   45|     18|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  936|     18|            return sequenceLength;
  937|     18|        }
  938|       |        /* span extDict & currentPrefixSegment */
  939|      2|        {   size_t const length1 = dictEnd - match;
  940|      2|        ZSTD_memmove(oLitEnd, match, length1);
  ------------------
  |  |   45|      2|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  941|      2|        op = oLitEnd + length1;
  942|      2|        sequence.matchLength -= length1;
  943|      2|        match = prefixStart;
  944|      2|        }
  945|      2|    }
  946|    845|    ZSTD_safecopy(op, oend_w, match, sequence.matchLength, ZSTD_overlap_src_before_dst);
  947|    845|    return sequenceLength;
  948|    915|}
zstd_decompress_block.c:ZSTD_safecopy:
  837|   265k|static void ZSTD_safecopy(BYTE* op, const BYTE* const oend_w, BYTE const* ip, ptrdiff_t length, ZSTD_overlap_e ovtype) {
  838|   265k|    ptrdiff_t const diff = op - ip;
  839|   265k|    BYTE* const oend = op + length;
  840|       |
  841|   265k|    assert((ovtype == ZSTD_no_overlap && (diff <= -8 || diff >= 8 || op >= oend_w)) ||
  ------------------
  |  |   70|   265k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  842|   265k|           (ovtype == ZSTD_overlap_src_before_dst && diff >= 0));
  843|       |
  844|   265k|    if (length < 8) {
  ------------------
  |  Branch (844:9): [True: 177k, False: 88.0k]
  ------------------
  845|       |        /* Handle short lengths. */
  846|   800k|        while (op < oend) *op++ = *ip++;
  ------------------
  |  Branch (846:16): [True: 623k, False: 177k]
  ------------------
  847|   177k|        return;
  848|   177k|    }
  849|  88.0k|    if (ovtype == ZSTD_overlap_src_before_dst) {
  ------------------
  |  Branch (849:9): [True: 87.7k, False: 235]
  ------------------
  850|       |        /* Copy 8 bytes and ensure the offset >= 8 when there can be overlap. */
  851|  87.7k|        assert(length >= 8);
  ------------------
  |  |   70|  87.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  852|  87.7k|        ZSTD_overlapCopy8(&op, &ip, diff);
  853|  87.7k|        length -= 8;
  854|  87.7k|        assert(op - ip >= 8);
  ------------------
  |  |   70|  87.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  855|  87.7k|        assert(op <= oend);
  ------------------
  |  |   70|  87.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  856|  87.7k|    }
  857|       |
  858|  88.0k|    if (oend <= oend_w) {
  ------------------
  |  Branch (858:9): [True: 76, False: 87.9k]
  ------------------
  859|       |        /* No risk of overwrite. */
  860|     76|        ZSTD_wildcopy(op, ip, length, ovtype);
  861|     76|        return;
  862|     76|    }
  863|  87.9k|    if (op <= oend_w) {
  ------------------
  |  Branch (863:9): [True: 570, False: 87.3k]
  ------------------
  864|       |        /* Wildcopy until we get close to the end. */
  865|    570|        assert(oend > oend_w);
  ------------------
  |  |   70|    570|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  866|    570|        ZSTD_wildcopy(op, ip, oend_w - op, ovtype);
  867|    570|        ip += oend_w - op;
  868|    570|        op += oend_w - op;
  869|    570|    }
  870|       |    /* Handle the leftovers. */
  871|  10.5M|    while (op < oend) *op++ = *ip++;
  ------------------
  |  Branch (871:12): [True: 10.5M, False: 87.9k]
  ------------------
  872|  87.9k|}
zstd_decompress_block.c:ZSTD_overlapCopy8:
  804|  1.76M|HINT_INLINE void ZSTD_overlapCopy8(BYTE** op, BYTE const** ip, size_t offset) {
  805|  1.76M|    assert(*ip <= *op);
  ------------------
  |  |   70|  1.76M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  806|  1.76M|    if (offset < 8) {
  ------------------
  |  Branch (806:9): [True: 1.34M, False: 413k]
  ------------------
  807|       |        /* close range match, overlap */
  808|  1.34M|        static const U32 dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 };   /* added */
  809|  1.34M|        static const int dec64table[] = { 8, 8, 8, 7, 8, 9,10,11 };   /* subtracted */
  810|  1.34M|        int const sub2 = dec64table[offset];
  811|  1.34M|        (*op)[0] = (*ip)[0];
  812|  1.34M|        (*op)[1] = (*ip)[1];
  813|  1.34M|        (*op)[2] = (*ip)[2];
  814|  1.34M|        (*op)[3] = (*ip)[3];
  815|  1.34M|        *ip += dec32table[offset];
  816|  1.34M|        ZSTD_copy4(*op+4, *ip);
  817|  1.34M|        *ip -= sub2;
  818|  1.34M|    } else {
  819|   413k|        ZSTD_copy8(*op, *ip);
  820|   413k|    }
  821|  1.76M|    *ip += 8;
  822|  1.76M|    *op += 8;
  823|  1.76M|    assert(*op - *ip >= 8);
  ------------------
  |  |   70|  1.76M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  824|  1.76M|}
zstd_decompress_block.c:ZSTD_copy4:
   47|  1.34M|static void ZSTD_copy4(void* dst, const void* src) { ZSTD_memcpy(dst, src, 4); }
  ------------------
  |  |   44|  1.34M|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
zstd_decompress_block.c:ZSTD_execSequenceSplitLitBuffer:
 1104|  1.26M|{
 1105|  1.26M|    BYTE* const oLitEnd = op + sequence.litLength;
 1106|  1.26M|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
 1107|  1.26M|    BYTE* const oMatchEnd = op + sequenceLength;   /* risk : address space overflow (32-bits) */
 1108|  1.26M|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
 1109|  1.26M|    const BYTE* match = oLitEnd - sequence.offset;
 1110|       |
 1111|  1.26M|    assert(op != NULL /* Precondition */);
  ------------------
  |  |   70|  1.26M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1112|  1.26M|    assert(oend_w < oend /* No underflow */);
  ------------------
  |  |   70|  1.26M|#    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.26M|    if (UNLIKELY(
  ------------------
  |  |  188|  5.79M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 264k, False: 1.00M]
  |  |  |  Branch (188:40): [True: 0, False: 1.26M]
  |  |  |  Branch (188:40): [True: 264k, False: 1.00M]
  |  |  |  Branch (188:40): [True: 0, False: 1.00M]
  |  |  |  Branch (188:40): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1119|  1.26M|            iLitEnd > litLimit ||
 1120|  1.26M|            oMatchEnd > oend_w ||
 1121|  1.26M|            (MEM_32bits() && (size_t)(oend - op) < sequenceLength + WILDCOPY_OVERLENGTH)))
 1122|   264k|        return ZSTD_execSequenceEndSplitLitBuffer(op, oend, oend_w, sequence, litPtr, litLimit, prefixStart, virtualStart, dictEnd);
 1123|       |
 1124|       |    /* Assumptions (everything else goes into ZSTD_execSequenceEnd()) */
 1125|  1.00M|    assert(op <= oLitEnd /* No overflow */);
  ------------------
  |  |   70|  1.00M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1126|  1.00M|    assert(oLitEnd < oMatchEnd /* Non-zero match & no overflow */);
  ------------------
  |  |   70|  1.00M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1127|  1.00M|    assert(oMatchEnd <= oend /* No underflow */);
  ------------------
  |  |   70|  1.00M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1128|  1.00M|    assert(iLitEnd <= litLimit /* Literal length is in bounds */);
  ------------------
  |  |   70|  1.00M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1129|  1.00M|    assert(oLitEnd <= oend_w /* Can wildcopy literals */);
  ------------------
  |  |   70|  1.00M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1130|  1.00M|    assert(oMatchEnd <= oend_w /* Can wildcopy matches */);
  ------------------
  |  |   70|  1.00M|#    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|  1.00M|    assert(WILDCOPY_OVERLENGTH >= 16);
  ------------------
  |  |   70|  1.00M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1137|  1.00M|    ZSTD_copy16(op, (*litPtr));
 1138|  1.00M|    if (UNLIKELY(sequence.litLength > 16)) {
  ------------------
  |  |  188|  1.00M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 88.2k, False: 911k]
  |  |  ------------------
  ------------------
 1139|  88.2k|        ZSTD_wildcopy(op+16, (*litPtr)+16, sequence.litLength-16, ZSTD_no_overlap);
 1140|  88.2k|    }
 1141|  1.00M|    op = oLitEnd;
 1142|  1.00M|    *litPtr = iLitEnd;   /* update for next sequence */
 1143|       |
 1144|       |    /* Copy Match */
 1145|  1.00M|    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
  ------------------
  |  Branch (1145:9): [True: 514, False: 999k]
  ------------------
 1146|       |        /* offset beyond prefix -> go into extDict */
 1147|    514|        RETURN_ERROR_IF(UNLIKELY(sequence.offset > (size_t)(oLitEnd - virtualStart)), corruption_detected, "");
  ------------------
  |  |  114|    514|    do {                                                                       \
  |  |  115|    514|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 242, False: 272]
  |  |  ------------------
  |  |  116|    242|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    242|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 242]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    242|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    242|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    242|    do {                                           \
  |  |  |  |   99|    242|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 242]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    242|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 242]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    242|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    242|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 242]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    242|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    242|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 242]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    242|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    242|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    242|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    242|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    242|        }                                                                      \
  |  |  123|    514|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 272]
  |  |  ------------------
  ------------------
 1148|    272|        match = dictEnd + (match - prefixStart);
 1149|    272|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (1149:13): [True: 207, False: 65]
  ------------------
 1150|    207|            ZSTD_memmove(oLitEnd, match, sequence.matchLength);
  ------------------
  |  |   45|    207|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1151|    207|            return sequenceLength;
 1152|    207|        }
 1153|       |        /* span extDict & currentPrefixSegment */
 1154|     65|        {   size_t const length1 = dictEnd - match;
 1155|     65|            ZSTD_memmove(oLitEnd, match, length1);
  ------------------
  |  |   45|     65|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1156|     65|            op = oLitEnd + length1;
 1157|     65|            sequence.matchLength -= length1;
 1158|     65|            match = prefixStart;
 1159|     65|    }   }
 1160|       |    /* Match within prefix of 1 or more bytes */
 1161|   999k|    assert(op <= oMatchEnd);
  ------------------
  |  |   70|   999k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1162|   999k|    assert(oMatchEnd <= oend_w);
  ------------------
  |  |   70|   999k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1163|   999k|    assert(match >= prefixStart);
  ------------------
  |  |   70|   999k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1164|   999k|    assert(sequence.matchLength >= 1);
  ------------------
  |  |   70|   999k|#    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|   999k|    if (LIKELY(sequence.offset >= WILDCOPY_VECLEN)) {
  ------------------
  |  |  187|   999k|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (187:19): [True: 370k, False: 629k]
  |  |  ------------------
  ------------------
 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|   370k|        ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength, ZSTD_no_overlap);
 1175|   370k|        return sequenceLength;
 1176|   370k|    }
 1177|   629k|    assert(sequence.offset < WILDCOPY_VECLEN);
  ------------------
  |  |   70|   629k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1178|       |
 1179|       |    /* Copy 8 bytes and spread the offset to be >= 8. */
 1180|   629k|    ZSTD_overlapCopy8(&op, &match, sequence.offset);
 1181|       |
 1182|       |    /* If the match length is > 8 bytes, then continue with the wildcopy. */
 1183|   629k|    if (sequence.matchLength > 8) {
  ------------------
  |  Branch (1183:9): [True: 117k, False: 511k]
  ------------------
 1184|   117k|        assert(op < oMatchEnd);
  ------------------
  |  |   70|   117k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1185|   117k|        ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength-8, ZSTD_overlap_src_before_dst);
 1186|   117k|    }
 1187|   629k|    return sequenceLength;
 1188|   999k|}
zstd_decompress_block.c:ZSTD_execSequenceEndSplitLitBuffer:
  959|   264k|{
  960|   264k|    BYTE* const oLitEnd = op + sequence.litLength;
  961|   264k|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
  962|   264k|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
  963|   264k|    const BYTE* match = oLitEnd - sequence.offset;
  964|       |
  965|       |
  966|       |    /* bounds checks : careful of address space overflow in 32-bit mode */
  967|   264k|    RETURN_ERROR_IF(sequenceLength > (size_t)(oend - op), dstSize_tooSmall, "last match must fit within dstBuffer");
  ------------------
  |  |  114|   264k|    do {                                                                       \
  |  |  115|   264k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 105, False: 263k]
  |  |  ------------------
  |  |  116|    105|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    105|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 105]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    105|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    105|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    105|    do {                                           \
  |  |  |  |   99|    105|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 105]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    105|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 105]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    105|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    105|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 105]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    105|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    105|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 105]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    105|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    105|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    105|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    105|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    105|        }                                                                      \
  |  |  123|   264k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 263k]
  |  |  ------------------
  ------------------
  968|   263k|    RETURN_ERROR_IF(sequence.litLength > (size_t)(litLimit - *litPtr), corruption_detected, "try to read beyond literal buffer");
  ------------------
  |  |  114|   263k|    do {                                                                       \
  |  |  115|   263k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 263k]
  |  |  ------------------
  |  |  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|   263k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 263k]
  |  |  ------------------
  ------------------
  969|   263k|    assert(op < op + sequenceLength);
  ------------------
  |  |   70|   263k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  970|   263k|    assert(oLitEnd < op + sequenceLength);
  ------------------
  |  |   70|   263k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  971|       |
  972|       |    /* copy literals */
  973|   263k|    RETURN_ERROR_IF(op > *litPtr && op < *litPtr + sequence.litLength, dstSize_tooSmall, "output should not catch up to and overwrite literal buffer");
  ------------------
  |  |  114|   263k|    do {                                                                       \
  |  |  115|   790k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 263k, False: 852]
  |  |  |  Branch (115:13): [True: 42, False: 263k]
  |  |  ------------------
  |  |  116|     42|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     42|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 42]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     42|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     42|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     42|    do {                                           \
  |  |  |  |   99|     42|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 42]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     42|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 42]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     42|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     42|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 42]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     42|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     42|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 42]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     42|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     42|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     42|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     42|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     42|        }                                                                      \
  |  |  123|   263k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 263k]
  |  |  ------------------
  ------------------
  974|   263k|    ZSTD_safecopyDstBeforeSrc(op, *litPtr, sequence.litLength);
  975|   263k|    op = oLitEnd;
  976|   263k|    *litPtr = iLitEnd;
  977|       |
  978|       |    /* copy Match */
  979|   263k|    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
  ------------------
  |  Branch (979:9): [True: 100, False: 263k]
  ------------------
  980|       |        /* offset beyond prefix */
  981|    100|        RETURN_ERROR_IF(sequence.offset > (size_t)(oLitEnd - virtualStart), corruption_detected, "");
  ------------------
  |  |  114|    100|    do {                                                                       \
  |  |  115|    100|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 70, False: 30]
  |  |  ------------------
  |  |  116|     70|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     70|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 70]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     70|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     70|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     70|    do {                                           \
  |  |  |  |   99|     70|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 70]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     70|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 70]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     70|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     70|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 70]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     70|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     70|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 70]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     70|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     70|        }                                                                      \
  |  |  123|    100|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 30]
  |  |  ------------------
  ------------------
  982|     30|        match = dictEnd - (prefixStart - match);
  983|     30|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (983:13): [True: 21, False: 9]
  ------------------
  984|     21|            ZSTD_memmove(oLitEnd, match, sequence.matchLength);
  ------------------
  |  |   45|     21|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  985|     21|            return sequenceLength;
  986|     21|        }
  987|       |        /* span extDict & currentPrefixSegment */
  988|      9|        {   size_t const length1 = dictEnd - match;
  989|      9|        ZSTD_memmove(oLitEnd, match, length1);
  ------------------
  |  |   45|      9|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  990|      9|        op = oLitEnd + length1;
  991|      9|        sequence.matchLength -= length1;
  992|      9|        match = prefixStart;
  993|      9|        }
  994|      9|    }
  995|   263k|    ZSTD_safecopy(op, oend_w, match, sequence.matchLength, ZSTD_overlap_src_before_dst);
  996|   263k|    return sequenceLength;
  997|   263k|}
zstd_decompress_block.c:ZSTD_decompressSequencesSplitLitBuffer:
 1956|    739|{
 1957|    739|    DEBUGLOG(5, "ZSTD_decompressSequencesSplitLitBuffer");
  ------------------
  |  |  104|    739|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 739]
  |  |  ------------------
  ------------------
 1958|    739|#if DYNAMIC_BMI2
 1959|    739|    if (ZSTD_DCtx_get_bmi2(dctx)) {
  ------------------
  |  Branch (1959:9): [True: 739, False: 0]
  ------------------
 1960|    739|        return ZSTD_decompressSequencesSplitLitBuffer_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1961|    739|    }
 1962|      0|#endif
 1963|      0|    return ZSTD_decompressSequencesSplitLitBuffer_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1964|    739|}
zstd_decompress_block.c:ZSTD_decompressSequencesSplitLitBuffer_bmi2:
 1920|    739|{
 1921|    739|    return ZSTD_decompressSequences_bodySplitLitBuffer(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1922|    739|}
zstd_decompress_block.c:ZSTD_decompressSequences_bodySplitLitBuffer:
 1407|    739|{
 1408|    739|    const BYTE* ip = (const BYTE*)seqStart;
 1409|    739|    const BYTE* const iend = ip + seqSize;
 1410|    739|    BYTE* const ostart = (BYTE*)dst;
 1411|    739|    BYTE* const oend = ZSTD_maybeNullPtrAdd(ostart, maxDstSize);
 1412|    739|    BYTE* op = ostart;
 1413|    739|    const BYTE* litPtr = dctx->litPtr;
 1414|    739|    const BYTE* litBufferEnd = dctx->litBufferEnd;
 1415|    739|    const BYTE* const prefixStart = (const BYTE*) (dctx->prefixStart);
 1416|    739|    const BYTE* const vBase = (const BYTE*) (dctx->virtualStart);
 1417|    739|    const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd);
 1418|    739|    DEBUGLOG(5, "ZSTD_decompressSequences_bodySplitLitBuffer (%i seqs)", nbSeq);
  ------------------
  |  |  104|    739|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 739]
  |  |  ------------------
  ------------------
 1419|       |
 1420|       |    /* Literals are split between internal buffer & output buffer */
 1421|    739|    if (nbSeq) {
  ------------------
  |  Branch (1421:9): [True: 738, False: 1]
  ------------------
 1422|    738|        seqState_t seqState;
 1423|    738|        dctx->fseEntropy = 1;
 1424|  2.95k|        { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) seqState.prevOffset[i] = dctx->entropy.rep[i]; }
  ------------------
  |  |   64|  2.95k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1424:28): [True: 2.21k, False: 738]
  ------------------
 1425|    738|        RETURN_ERROR_IF(
  ------------------
  |  |  114|    738|    do {                                                                       \
  |  |  115|    738|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 28, False: 710]
  |  |  ------------------
  |  |  116|     28|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     28|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     28|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     28|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     28|    do {                                           \
  |  |  |  |   99|     28|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 28]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     28|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     28|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     28|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     28|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     28|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     28|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     28|        }                                                                      \
  |  |  123|    738|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 710]
  |  |  ------------------
  ------------------
 1426|    738|            ERR_isError(BIT_initDStream(&seqState.DStream, ip, iend-ip)),
 1427|    738|            corruption_detected, "");
 1428|    710|        ZSTD_initFseState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr);
 1429|    710|        ZSTD_initFseState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr);
 1430|    710|        ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr);
 1431|    710|        assert(dst != NULL);
  ------------------
  |  |   70|    710|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1432|       |
 1433|    710|        ZSTD_STATIC_ASSERT(
  ------------------
  |  |   43|    710|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|    710|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1434|    710|                BIT_DStream_unfinished < BIT_DStream_completed &&
 1435|    710|                BIT_DStream_endOfBuffer < BIT_DStream_completed &&
 1436|    710|                BIT_DStream_completed < BIT_DStream_overflow);
 1437|       |
 1438|       |        /* decompress without overrunning litPtr begins */
 1439|    710|        {   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|    710|#if defined(__GNUC__) && defined(__x86_64__)
 1485|    710|            __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|    710|#endif
 1499|       |
 1500|       |            /* Handle the initial state where litBuffer is currently split between dst and litExtraBuffer */
 1501|   848k|            for ( ; nbSeq; nbSeq--) {
  ------------------
  |  Branch (1501:21): [True: 848k, False: 17]
  ------------------
 1502|   848k|                sequence = ZSTD_decodeSequence(&seqState, isLongOffset, nbSeq==1);
 1503|   848k|                if (litPtr + sequence.litLength > dctx->litBufferEnd) break;
  ------------------
  |  Branch (1503:21): [True: 474, False: 847k]
  ------------------
 1504|   847k|                {   size_t const oneSeqSize = ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequence.litLength - WILDCOPY_OVERLENGTH, sequence, &litPtr, litBufferEnd, prefixStart, vBase, dictEnd);
  ------------------
  |  |  199|   847k|#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|   847k|                    if (UNLIKELY(ZSTD_isError(oneSeqSize)))
  ------------------
  |  |  188|   847k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 219, False: 847k]
  |  |  ------------------
  ------------------
 1510|    219|                        return oneSeqSize;
 1511|   847k|                    DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize);
  ------------------
  |  |  104|   847k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 847k]
  |  |  ------------------
  ------------------
 1512|   847k|                    op += oneSeqSize;
 1513|   847k|            }   }
 1514|    491|            DEBUGLOG(6, "reached: (litPtr + sequence.litLength > dctx->litBufferEnd)");
  ------------------
  |  |  104|    491|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 491]
  |  |  ------------------
  ------------------
 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|    491|            if (nbSeq > 0) {
  ------------------
  |  Branch (1517:17): [True: 474, False: 17]
  ------------------
 1518|    474|                const size_t leftoverLit = dctx->litBufferEnd - litPtr;
 1519|    474|                DEBUGLOG(6, "There are %i sequences left, and %zu/%zu literals left in buffer", nbSeq, leftoverLit, sequence.litLength);
  ------------------
  |  |  104|    474|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 474]
  |  |  ------------------
  ------------------
 1520|    474|                if (leftoverLit) {
  ------------------
  |  Branch (1520:21): [True: 469, False: 5]
  ------------------
 1521|    469|                    RETURN_ERROR_IF(leftoverLit > (size_t)(oend - op), dstSize_tooSmall, "remaining lit must fit within dstBuffer");
  ------------------
  |  |  114|    469|    do {                                                                       \
  |  |  115|    469|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 16, False: 453]
  |  |  ------------------
  |  |  116|     16|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     16|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     16|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     16|    do {                                           \
  |  |  |  |   99|     16|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     16|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     16|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     16|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     16|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     16|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     16|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     16|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     16|        }                                                                      \
  |  |  123|    469|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 453]
  |  |  ------------------
  ------------------
 1522|    453|                    ZSTD_safecopyDstBeforeSrc(op, litPtr, leftoverLit);
 1523|    453|                    sequence.litLength -= leftoverLit;
 1524|    453|                    op += leftoverLit;
 1525|    453|                }
 1526|    458|                litPtr = dctx->litExtraBuffer;
 1527|    458|                litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|    458|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|    458|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    916|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 458]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 458, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1528|    458|                dctx->litBufferLocation = ZSTD_not_in_dst;
 1529|    458|                {   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|    458|                    if (UNLIKELY(ZSTD_isError(oneSeqSize)))
  ------------------
  |  |  188|    458|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 53, False: 405]
  |  |  ------------------
  ------------------
 1535|     53|                        return oneSeqSize;
 1536|    405|                    DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize);
  ------------------
  |  |  104|    405|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 405]
  |  |  ------------------
  ------------------
 1537|    405|                    op += oneSeqSize;
 1538|    405|                }
 1539|      0|                nbSeq--;
 1540|    405|            }
 1541|    491|        }
 1542|       |
 1543|    422|        if (nbSeq > 0) {
  ------------------
  |  Branch (1543:13): [True: 403, False: 19]
  ------------------
 1544|       |            /* there is remaining lit from extra buffer */
 1545|       |
 1546|    403|#if defined(__GNUC__) && defined(__x86_64__)
 1547|    403|            __asm__(".p2align 6");
 1548|    403|            __asm__("nop");
 1549|    403|#  if __GNUC__ != 7
 1550|       |            /* worse for gcc-7 better for gcc-8, gcc-9, and gcc-10 and clang */
 1551|    403|            __asm__(".p2align 4");
 1552|    403|            __asm__("nop");
 1553|    403|            __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|    403|#endif
 1562|       |
 1563|   583k|            for ( ; nbSeq ; nbSeq--) {
  ------------------
  |  Branch (1563:21): [True: 583k, False: 11]
  ------------------
 1564|   583k|                seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset, nbSeq==1);
 1565|   583k|                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|   583k|                if (UNLIKELY(ZSTD_isError(oneSeqSize)))
  ------------------
  |  |  188|   583k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 392, False: 582k]
  |  |  ------------------
  ------------------
 1571|    392|                    return oneSeqSize;
 1572|   582k|                DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize);
  ------------------
  |  |  104|   582k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 582k]
  |  |  ------------------
  ------------------
 1573|   582k|                op += oneSeqSize;
 1574|   582k|            }
 1575|    403|        }
 1576|       |
 1577|       |        /* check if reached exact end */
 1578|     30|        DEBUGLOG(5, "ZSTD_decompressSequences_bodySplitLitBuffer: after decode loop, remaining nbSeq : %i", nbSeq);
  ------------------
  |  |  104|     30|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 30]
  |  |  ------------------
  ------------------
 1579|     30|        RETURN_ERROR_IF(nbSeq, corruption_detected, "");
  ------------------
  |  |  114|     30|    do {                                                                       \
  |  |  115|     30|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 30]
  |  |  ------------------
  |  |  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|     30|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 30]
  |  |  ------------------
  ------------------
 1580|     30|        DEBUGLOG(5, "bitStream : start=%p, ptr=%p, bitsConsumed=%u", seqState.DStream.start, seqState.DStream.ptr, seqState.DStream.bitsConsumed);
  ------------------
  |  |  104|     30|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 30]
  |  |  ------------------
  ------------------
 1581|     30|        RETURN_ERROR_IF(!BIT_endOfDStream(&seqState.DStream), corruption_detected, "");
  ------------------
  |  |  114|     30|    do {                                                                       \
  |  |  115|     30|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 9, False: 21]
  |  |  ------------------
  |  |  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|     30|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 21]
  |  |  ------------------
  ------------------
 1582|       |        /* save reps for next block */
 1583|     84|        { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) dctx->entropy.rep[i] = (U32)(seqState.prevOffset[i]); }
  ------------------
  |  |   64|     84|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1583:28): [True: 63, False: 21]
  ------------------
 1584|     21|    }
 1585|       |
 1586|       |    /* last literal segment */
 1587|     22|    if (dctx->litBufferLocation == ZSTD_split) {
  ------------------
  |  Branch (1587:9): [True: 16, False: 6]
  ------------------
 1588|       |        /* split hasn't been reached yet, first get dst then copy litExtraBuffer */
 1589|     16|        size_t const lastLLSize = (size_t)(litBufferEnd - litPtr);
 1590|     16|        DEBUGLOG(6, "copy last literals from segment : %u", (U32)lastLLSize);
  ------------------
  |  |  104|     16|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 16]
  |  |  ------------------
  ------------------
 1591|     16|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend - op), dstSize_tooSmall, "");
  ------------------
  |  |  114|     16|    do {                                                                       \
  |  |  115|     16|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 5, False: 11]
  |  |  ------------------
  |  |  116|      5|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      5|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      5|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      5|    do {                                           \
  |  |  |  |   99|      5|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      5|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      5|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      5|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      5|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      5|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      5|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      5|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      5|        }                                                                      \
  |  |  123|     16|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 11]
  |  |  ------------------
  ------------------
 1592|     11|        if (op != NULL) {
  ------------------
  |  Branch (1592:13): [True: 11, False: 0]
  ------------------
 1593|     11|            ZSTD_memmove(op, litPtr, lastLLSize);
  ------------------
  |  |   45|     11|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1594|     11|            op += lastLLSize;
 1595|     11|        }
 1596|     11|        litPtr = dctx->litExtraBuffer;
 1597|     11|        litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|     11|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|     11|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|     22|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 11]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 11, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1598|     11|        dctx->litBufferLocation = ZSTD_not_in_dst;
 1599|     11|    }
 1600|       |    /* copy last literals from internal buffer */
 1601|     17|    {   size_t const lastLLSize = (size_t)(litBufferEnd - litPtr);
 1602|     17|        DEBUGLOG(6, "copy last literals from internal buffer : %u", (U32)lastLLSize);
  ------------------
  |  |  104|     17|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 17]
  |  |  ------------------
  ------------------
 1603|     17|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall, "");
  ------------------
  |  |  114|     17|    do {                                                                       \
  |  |  115|     17|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 7, False: 10]
  |  |  ------------------
  |  |  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|     17|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 10]
  |  |  ------------------
  ------------------
 1604|     10|        if (op != NULL) {
  ------------------
  |  Branch (1604:13): [True: 10, False: 0]
  ------------------
 1605|     10|            ZSTD_memcpy(op, litPtr, lastLLSize);
  ------------------
  |  |   44|     10|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1606|     10|            op += lastLLSize;
 1607|     10|    }   }
 1608|       |
 1609|     10|    DEBUGLOG(6, "decoded block of size %u bytes", (U32)(op - ostart));
  ------------------
  |  |  104|     10|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 10]
  |  |  ------------------
  ------------------
 1610|     10|    return (size_t)(op - ostart);
 1611|     17|}
zstd_decompress_block.c:ZSTD_decompressSequences:
 1943|    564|{
 1944|    564|    DEBUGLOG(5, "ZSTD_decompressSequences");
  ------------------
  |  |  104|    564|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 564]
  |  |  ------------------
  ------------------
 1945|    564|#if DYNAMIC_BMI2
 1946|    564|    if (ZSTD_DCtx_get_bmi2(dctx)) {
  ------------------
  |  Branch (1946:9): [True: 564, False: 0]
  ------------------
 1947|    564|        return ZSTD_decompressSequences_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1948|    564|    }
 1949|      0|#endif
 1950|      0|    return ZSTD_decompressSequences_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1951|    564|}
zstd_decompress_block.c:ZSTD_decompressSequences_bmi2:
 1911|    564|{
 1912|    564|    return ZSTD_decompressSequences_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1913|    564|}
zstd_decompress_block.c:ZSTD_decompressSequences_body:
 1619|    564|{
 1620|    564|    const BYTE* ip = (const BYTE*)seqStart;
 1621|    564|    const BYTE* const iend = ip + seqSize;
 1622|    564|    BYTE* const ostart = (BYTE*)dst;
 1623|    564|    BYTE* const oend = dctx->litBufferLocation == ZSTD_not_in_dst ? ZSTD_maybeNullPtrAdd(ostart, maxDstSize) : dctx->litBuffer;
  ------------------
  |  Branch (1623:24): [True: 208, False: 356]
  ------------------
 1624|    564|    BYTE* op = ostart;
 1625|    564|    const BYTE* litPtr = dctx->litPtr;
 1626|    564|    const BYTE* const litEnd = litPtr + dctx->litSize;
 1627|    564|    const BYTE* const prefixStart = (const BYTE*)(dctx->prefixStart);
 1628|    564|    const BYTE* const vBase = (const BYTE*)(dctx->virtualStart);
 1629|    564|    const BYTE* const dictEnd = (const BYTE*)(dctx->dictEnd);
 1630|    564|    DEBUGLOG(5, "ZSTD_decompressSequences_body: nbSeq = %d", nbSeq);
  ------------------
  |  |  104|    564|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 564]
  |  |  ------------------
  ------------------
 1631|       |
 1632|       |    /* Regen sequences */
 1633|    564|    if (nbSeq) {
  ------------------
  |  Branch (1633:9): [True: 498, False: 66]
  ------------------
 1634|    498|        seqState_t seqState;
 1635|    498|        dctx->fseEntropy = 1;
 1636|  1.99k|        { U32 i; for (i = 0; i < ZSTD_REP_NUM; i++) seqState.prevOffset[i] = dctx->entropy.rep[i]; }
  ------------------
  |  |   64|  1.99k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1636:30): [True: 1.49k, False: 498]
  ------------------
 1637|    498|        RETURN_ERROR_IF(
  ------------------
  |  |  114|    498|    do {                                                                       \
  |  |  115|    498|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 56, False: 442]
  |  |  ------------------
  |  |  116|     56|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     56|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 56]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     56|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     56|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     56|    do {                                           \
  |  |  |  |   99|     56|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 56]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     56|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 56]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     56|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     56|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 56]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     56|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     56|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 56]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     56|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     56|        }                                                                      \
  |  |  123|    498|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 442]
  |  |  ------------------
  ------------------
 1638|    498|            ERR_isError(BIT_initDStream(&seqState.DStream, ip, iend - ip)),
 1639|    498|            corruption_detected, "");
 1640|    442|        ZSTD_initFseState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr);
 1641|    442|        ZSTD_initFseState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr);
 1642|    442|        ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr);
 1643|    442|        assert(dst != NULL);
  ------------------
  |  |   70|    442|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1644|       |
 1645|    442|#if defined(__GNUC__) && defined(__x86_64__)
 1646|    442|            __asm__(".p2align 6");
 1647|    442|            __asm__("nop");
 1648|       |#  if __GNUC__ >= 7
 1649|       |            __asm__(".p2align 5");
 1650|       |            __asm__("nop");
 1651|       |            __asm__(".p2align 3");
 1652|       |#  else
 1653|    442|            __asm__(".p2align 4");
 1654|    442|            __asm__("nop");
 1655|    442|            __asm__(".p2align 3");
 1656|    442|#  endif
 1657|    442|#endif
 1658|       |
 1659|   708k|        for ( ; nbSeq ; nbSeq--) {
  ------------------
  |  Branch (1659:17): [True: 707k, False: 134]
  ------------------
 1660|   707k|            seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset, nbSeq==1);
 1661|   707k|            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|   707k|            if (UNLIKELY(ZSTD_isError(oneSeqSize)))
  ------------------
  |  |  188|   707k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 308, False: 707k]
  |  |  ------------------
  ------------------
 1667|    308|                return oneSeqSize;
 1668|   707k|            DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize);
  ------------------
  |  |  104|   707k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 707k]
  |  |  ------------------
  ------------------
 1669|   707k|            op += oneSeqSize;
 1670|   707k|        }
 1671|       |
 1672|       |        /* check if reached exact end */
 1673|    134|        assert(nbSeq == 0);
  ------------------
  |  |   70|    134|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1674|    134|        RETURN_ERROR_IF(!BIT_endOfDStream(&seqState.DStream), corruption_detected, "");
  ------------------
  |  |  114|    134|    do {                                                                       \
  |  |  115|    134|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 11, False: 123]
  |  |  ------------------
  |  |  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|    134|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 123]
  |  |  ------------------
  ------------------
 1675|       |        /* save reps for next block */
 1676|    492|        { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) dctx->entropy.rep[i] = (U32)(seqState.prevOffset[i]); }
  ------------------
  |  |   64|    492|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1676:28): [True: 369, False: 123]
  ------------------
 1677|    123|    }
 1678|       |
 1679|       |    /* last literal segment */
 1680|    189|    {   size_t const lastLLSize = (size_t)(litEnd - litPtr);
 1681|    189|        DEBUGLOG(6, "copy last literals : %u", (U32)lastLLSize);
  ------------------
  |  |  104|    189|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 189]
  |  |  ------------------
  ------------------
 1682|    189|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall, "");
  ------------------
  |  |  114|    189|    do {                                                                       \
  |  |  115|    189|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 7, False: 182]
  |  |  ------------------
  |  |  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|    189|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 182]
  |  |  ------------------
  ------------------
 1683|    182|        if (op != NULL) {
  ------------------
  |  Branch (1683:13): [True: 182, False: 0]
  ------------------
 1684|    182|            ZSTD_memcpy(op, litPtr, lastLLSize);
  ------------------
  |  |   44|    182|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1685|    182|            op += lastLLSize;
 1686|    182|    }   }
 1687|       |
 1688|    182|    DEBUGLOG(6, "decoded block of size %u bytes", (U32)(op - ostart));
  ------------------
  |  |  104|    182|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 182]
  |  |  ------------------
  ------------------
 1689|    182|    return (size_t)(op - ostart);
 1690|    189|}

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

zstd_decompress.c:ZSTD_isLegacy:
   57|  22.4k|{
   58|  22.4k|    U32 magicNumberLE;
   59|  22.4k|    if (srcSize<4) return 0;
  ------------------
  |  Branch (59:9): [True: 0, False: 22.4k]
  ------------------
   60|  22.4k|    magicNumberLE = MEM_readLE32(src);
   61|  22.4k|    switch(magicNumberLE)
   62|  22.4k|    {
   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.49k|        case ZSTDv05_MAGICNUMBER : return 5;
  ------------------
  |  |  153|  8.49k|#define ZSTDv05_MAGICNUMBER 0xFD2FB525   /* v0.5 */
  ------------------
  |  Branch (76:9): [True: 8.49k, False: 13.9k]
  ------------------
   77|      0|#endif
   78|      0|#if (ZSTD_LEGACY_SUPPORT <= 6)
   79|  6.55k|        case ZSTDv06_MAGICNUMBER : return 6;
  ------------------
  |  |  164|  6.55k|#define ZSTDv06_MAGICNUMBER 0xFD2FB526   /* v0.6 */
  ------------------
  |  Branch (79:9): [True: 6.55k, False: 15.9k]
  ------------------
   80|      0|#endif
   81|      0|#if (ZSTD_LEGACY_SUPPORT <= 7)
   82|  3.44k|        case ZSTDv07_MAGICNUMBER : return 7;
  ------------------
  |  |  180|  3.44k|#define ZSTDv07_MAGICNUMBER            0xFD2FB527   /* v0.7 */
  ------------------
  |  Branch (82:9): [True: 3.44k, False: 19.0k]
  ------------------
   83|      0|#endif
   84|  3.99k|        default : return 0;
  ------------------
  |  Branch (84:9): [True: 3.99k, False: 18.4k]
  ------------------
   85|  22.4k|    }
   86|  22.4k|}
zstd_decompress.c:ZSTD_getDecompressedSize_legacy:
   90|  1.97k|{
   91|  1.97k|    U32 const version = ZSTD_isLegacy(src, srcSize);
   92|  1.97k|    if (version < 5) return 0;  /* no decompressed size in frame header, or not a legacy format */
  ------------------
  |  Branch (92:9): [True: 0, False: 1.97k]
  ------------------
   93|  1.97k|#if (ZSTD_LEGACY_SUPPORT <= 5)
   94|  1.97k|    if (version==5) {
  ------------------
  |  Branch (94:9): [True: 1.11k, False: 854]
  ------------------
   95|  1.11k|        ZSTDv05_parameters fParams;
   96|  1.11k|        size_t const frResult = ZSTDv05_getFrameParams(&fParams, src, srcSize);
   97|  1.11k|        if (frResult != 0) return 0;
  ------------------
  |  Branch (97:13): [True: 0, False: 1.11k]
  ------------------
   98|  1.11k|        return fParams.srcSize;
   99|  1.11k|    }
  100|    854|#endif
  101|    854|#if (ZSTD_LEGACY_SUPPORT <= 6)
  102|    854|    if (version==6) {
  ------------------
  |  Branch (102:9): [True: 696, False: 158]
  ------------------
  103|    696|        ZSTDv06_frameParams fParams;
  104|    696|        size_t const frResult = ZSTDv06_getFrameParams(&fParams, src, srcSize);
  105|    696|        if (frResult != 0) return 0;
  ------------------
  |  Branch (105:13): [True: 0, False: 696]
  ------------------
  106|    696|        return fParams.frameContentSize;
  107|    696|    }
  108|    158|#endif
  109|    158|#if (ZSTD_LEGACY_SUPPORT <= 7)
  110|    158|    if (version==7) {
  ------------------
  |  Branch (110:9): [True: 158, False: 0]
  ------------------
  111|    158|        ZSTDv07_frameParams fParams;
  112|    158|        size_t const frResult = ZSTDv07_getFrameParams(&fParams, src, srcSize);
  113|    158|        if (frResult != 0) return 0;
  ------------------
  |  Branch (113:13): [True: 0, False: 158]
  ------------------
  114|    158|        return fParams.frameContentSize;
  115|    158|    }
  116|      0|#endif
  117|      0|    return 0;   /* should not be possible */
  118|    158|}
zstd_decompress.c:ZSTD_findFrameSizeInfoLegacy:
  196|  4.90k|{
  197|  4.90k|    ZSTD_frameSizeInfo frameSizeInfo;
  198|  4.90k|    U32 const version = ZSTD_isLegacy(src, srcSize);
  199|  4.90k|    switch(version)
  200|  4.90k|    {
  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.11k|        case 5 :
  ------------------
  |  Branch (230:9): [True: 2.11k, False: 2.79k]
  ------------------
  231|  2.11k|            ZSTDv05_findFrameSizeInfoLegacy(src, srcSize,
  232|  2.11k|                &frameSizeInfo.compressedSize,
  233|  2.11k|                &frameSizeInfo.decompressedBound);
  234|  2.11k|            break;
  235|      0|#endif
  236|      0|#if (ZSTD_LEGACY_SUPPORT <= 6)
  237|  1.74k|        case 6 :
  ------------------
  |  Branch (237:9): [True: 1.74k, False: 3.15k]
  ------------------
  238|  1.74k|            ZSTDv06_findFrameSizeInfoLegacy(src, srcSize,
  239|  1.74k|                &frameSizeInfo.compressedSize,
  240|  1.74k|                &frameSizeInfo.decompressedBound);
  241|  1.74k|            break;
  242|      0|#endif
  243|      0|#if (ZSTD_LEGACY_SUPPORT <= 7)
  244|  1.04k|        case 7 :
  ------------------
  |  Branch (244:9): [True: 1.04k, False: 3.85k]
  ------------------
  245|  1.04k|            ZSTDv07_findFrameSizeInfoLegacy(src, srcSize,
  246|  1.04k|                &frameSizeInfo.compressedSize,
  247|  1.04k|                &frameSizeInfo.decompressedBound);
  248|  1.04k|            break;
  249|      0|#endif
  250|      0|        default :
  ------------------
  |  Branch (250:9): [True: 0, False: 4.90k]
  ------------------
  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.90k|    }
  255|  4.90k|    if (!ZSTD_isError(frameSizeInfo.compressedSize) && frameSizeInfo.compressedSize > srcSize) {
  ------------------
  |  |   44|  4.90k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (255:9): [True: 4.74k, False: 159]
  |  Branch (255:56): [True: 0, False: 4.74k]
  ------------------
  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.90k|    if (frameSizeInfo.decompressedBound != ZSTD_CONTENTSIZE_ERROR) {
  ------------------
  |  |  204|  4.90k|#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
  ------------------
  |  Branch (262:9): [True: 4.74k, False: 159]
  ------------------
  263|  4.74k|        assert((frameSizeInfo.decompressedBound & (ZSTD_BLOCKSIZE_MAX - 1)) == 0);
  ------------------
  |  |   70|  4.74k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  264|  4.74k|        frameSizeInfo.nbBlocks = (size_t)(frameSizeInfo.decompressedBound / ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |  148|  4.74k|#define ZSTD_BLOCKSIZE_MAX     (1<<ZSTD_BLOCKSIZELOG_MAX)
  |  |  ------------------
  |  |  |  |  147|  4.74k|#define ZSTD_BLOCKSIZELOG_MAX  17
  |  |  ------------------
  ------------------
  265|  4.74k|    }
  266|  4.90k|    return frameSizeInfo;
  267|  4.90k|}
zstd_decompress.c:ZSTD_findFrameCompressedSizeLegacy:
  270|  4.90k|{
  271|  4.90k|    ZSTD_frameSizeInfo frameSizeInfo = ZSTD_findFrameSizeInfoLegacy(src, srcSize);
  272|  4.90k|    return frameSizeInfo.compressedSize;
  273|  4.90k|}
zstd_decompress.c:ZSTD_decompressLegacy:
  125|  4.74k|{
  126|  4.74k|    U32 const version = ZSTD_isLegacy(src, compressedSize);
  127|  4.74k|    char x;
  128|       |    /* Avoid passing NULL to legacy decoding. */
  129|  4.74k|    if (dst == NULL) {
  ------------------
  |  Branch (129:9): [True: 0, False: 4.74k]
  ------------------
  130|      0|        assert(dstCapacity == 0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  131|      0|        dst = &x;
  132|      0|    }
  133|  4.74k|    if (src == NULL) {
  ------------------
  |  Branch (133:9): [True: 0, False: 4.74k]
  ------------------
  134|      0|        assert(compressedSize == 0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  135|      0|        src = &x;
  136|      0|    }
  137|  4.74k|    if (dict == NULL) {
  ------------------
  |  Branch (137:9): [True: 2.19k, False: 2.54k]
  ------------------
  138|  2.19k|        assert(dictSize == 0);
  ------------------
  |  |   70|  2.19k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  139|  2.19k|        dict = &x;
  140|  2.19k|    }
  141|  4.74k|    (void)dst; (void)dstCapacity; (void)dict; (void)dictSize;  /* unused when ZSTD_LEGACY_SUPPORT >= 8 */
  142|  4.74k|    switch(version)
  143|  4.74k|    {
  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|  2.04k|        case 5 :
  ------------------
  |  Branch (161:9): [True: 2.04k, False: 2.70k]
  ------------------
  162|  2.04k|            {   size_t result;
  163|  2.04k|                ZSTDv05_DCtx* const zd = ZSTDv05_createDCtx();
  164|  2.04k|                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: 2.04k]
  ------------------
  165|  2.04k|                result = ZSTDv05_decompress_usingDict(zd, dst, dstCapacity, src, compressedSize, dict, dictSize);
  166|  2.04k|                ZSTDv05_freeDCtx(zd);
  167|  2.04k|                return result;
  168|  2.04k|            }
  169|      0|#endif
  170|      0|#if (ZSTD_LEGACY_SUPPORT <= 6)
  171|  1.67k|        case 6 :
  ------------------
  |  Branch (171:9): [True: 1.67k, False: 3.07k]
  ------------------
  172|  1.67k|            {   size_t result;
  173|  1.67k|                ZSTDv06_DCtx* const zd = ZSTDv06_createDCtx();
  174|  1.67k|                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.67k]
  ------------------
  175|  1.67k|                result = ZSTDv06_decompress_usingDict(zd, dst, dstCapacity, src, compressedSize, dict, dictSize);
  176|  1.67k|                ZSTDv06_freeDCtx(zd);
  177|  1.67k|                return result;
  178|  1.67k|            }
  179|      0|#endif
  180|      0|#if (ZSTD_LEGACY_SUPPORT <= 7)
  181|  1.03k|        case 7 :
  ------------------
  |  Branch (181:9): [True: 1.03k, False: 3.71k]
  ------------------
  182|  1.03k|            {   size_t result;
  183|  1.03k|                ZSTDv07_DCtx* const zd = ZSTDv07_createDCtx();
  184|  1.03k|                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: 1.03k]
  ------------------
  185|  1.03k|                result = ZSTDv07_decompress_usingDict(zd, dst, dstCapacity, src, compressedSize, dict, dictSize);
  186|  1.03k|                ZSTDv07_freeDCtx(zd);
  187|  1.03k|                return result;
  188|  1.03k|            }
  189|      0|#endif
  190|      0|        default :
  ------------------
  |  Branch (190:9): [True: 0, False: 4.74k]
  ------------------
  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.74k|    }
  193|  4.74k|}

FSEv05_buildDTable:
 1158|  2.00k|{
 1159|  2.00k|    FSEv05_DTableHeader DTableH;
 1160|  2.00k|    void* const tdPtr = dt+1;   /* because dt is unsigned, 32-bits aligned on 32-bits */
 1161|  2.00k|    FSEv05_DECODE_TYPE* const tableDecode = (FSEv05_DECODE_TYPE*) (tdPtr);
  ------------------
  |  | 1056|  2.00k|#define FSEv05_DECODE_TYPE FSEv05_decode_t
  ------------------
 1162|  2.00k|    const U32 tableSize = 1 << tableLog;
 1163|  2.00k|    const U32 tableMask = tableSize-1;
 1164|  2.00k|    const U32 step = FSEv05_tableStep(tableSize);
 1165|  2.00k|    U16 symbolNext[FSEv05_MAX_SYMBOL_VALUE+1];
 1166|  2.00k|    U32 position = 0;
 1167|  2.00k|    U32 highThreshold = tableSize-1;
 1168|  2.00k|    const S16 largeLimit= (S16)(1 << (tableLog-1));
 1169|  2.00k|    U32 noLarge = 1;
 1170|  2.00k|    U32 s;
 1171|       |
 1172|       |    /* Sanity Checks */
 1173|  2.00k|    if (maxSymbolValue > FSEv05_MAX_SYMBOL_VALUE) return ERROR(maxSymbolValue_tooLarge);
  ------------------
  |  | 1048|  2.00k|#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: 2.00k]
  ------------------
 1174|  2.00k|    if (tableLog > FSEv05_MAX_TABLELOG) return ERROR(tableLog_tooLarge);
  ------------------
  |  | 1094|  2.00k|#define FSEv05_MAX_TABLELOG  (FSEv05_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  | 1042|  2.00k|#define FSEv05_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
                  if (tableLog > FSEv05_MAX_TABLELOG) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   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 (1174:9): [True: 21, False: 1.98k]
  ------------------
 1175|       |
 1176|       |    /* Init, lay down lowprob symbols */
 1177|  1.98k|    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.98k|    DTableH.tableLog = (U16)tableLog;
 1179|  31.0k|    for (s=0; s<=maxSymbolValue; s++) {
  ------------------
  |  Branch (1179:15): [True: 29.0k, False: 1.98k]
  ------------------
 1180|  29.0k|        if (normalizedCounter[s]==-1) {
  ------------------
  |  Branch (1180:13): [True: 12.6k, False: 16.4k]
  ------------------
 1181|  12.6k|            tableDecode[highThreshold--].symbol = (FSEv05_FUNCTION_TYPE)s;
 1182|  12.6k|            symbolNext[s] = 1;
 1183|  16.4k|        } else {
 1184|  16.4k|            if (normalizedCounter[s] >= largeLimit) noLarge=0;
  ------------------
  |  Branch (1184:17): [True: 1.00k, False: 15.3k]
  ------------------
 1185|  16.4k|            symbolNext[s] = normalizedCounter[s];
 1186|  16.4k|    }   }
 1187|       |
 1188|       |    /* Spread symbols */
 1189|  31.0k|    for (s=0; s<=maxSymbolValue; s++) {
  ------------------
  |  Branch (1189:15): [True: 29.0k, False: 1.98k]
  ------------------
 1190|  29.0k|        int i;
 1191|   777k|        for (i=0; i<normalizedCounter[s]; i++) {
  ------------------
  |  Branch (1191:19): [True: 748k, False: 29.0k]
  ------------------
 1192|   748k|            tableDecode[position].symbol = (FSEv05_FUNCTION_TYPE)s;
 1193|   748k|            position = (position + step) & tableMask;
 1194|   761k|            while (position > highThreshold) position = (position + step) & tableMask;   /* lowprob area */
  ------------------
  |  Branch (1194:20): [True: 12.6k, False: 748k]
  ------------------
 1195|   748k|    }   }
 1196|       |
 1197|  1.98k|    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.98k]
  ------------------
 1198|       |
 1199|       |    /* Build Decoding table */
 1200|  1.98k|    {
 1201|  1.98k|        U32 i;
 1202|   763k|        for (i=0; i<tableSize; i++) {
  ------------------
  |  Branch (1202:19): [True: 761k, False: 1.98k]
  ------------------
 1203|   761k|            FSEv05_FUNCTION_TYPE symbol = (FSEv05_FUNCTION_TYPE)(tableDecode[i].symbol);
  ------------------
  |  | 1054|   761k|#define FSEv05_FUNCTION_TYPE BYTE
  ------------------
 1204|   761k|            U16 nextState = symbolNext[symbol]++;
 1205|   761k|            tableDecode[i].nbBits = (BYTE) (tableLog - BITv05_highbit32 ((U32)nextState) );
 1206|   761k|            tableDecode[i].newState = (U16) ( (nextState << tableDecode[i].nbBits) - tableSize);
 1207|   761k|    }   }
 1208|       |
 1209|  1.98k|    DTableH.fastMode = (U16)noLarge;
 1210|  1.98k|    memcpy(dt, &DTableH, sizeof(DTableH));
 1211|  1.98k|    return 0;
 1212|  1.98k|}
FSEv05_isError:
 1219|  5.71k|unsigned FSEv05_isError(size_t code) { return ERR_isError(code); }
FSEv05_readNCount:
 1232|  2.36k|{
 1233|  2.36k|    const BYTE* const istart = (const BYTE*) headerBuffer;
 1234|  2.36k|    const BYTE* const iend = istart + hbSize;
 1235|  2.36k|    const BYTE* ip = istart;
 1236|  2.36k|    int nbBits;
 1237|  2.36k|    int remaining;
 1238|  2.36k|    int threshold;
 1239|  2.36k|    U32 bitStream;
 1240|  2.36k|    int bitCount;
 1241|  2.36k|    unsigned charnum = 0;
 1242|  2.36k|    int previous0 = 0;
 1243|       |
 1244|  2.36k|    if (hbSize < 4) return ERROR(srcSize_wrong);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1244:9): [True: 33, False: 2.33k]
  ------------------
 1245|  2.33k|    bitStream = MEM_readLE32(ip);
 1246|  2.33k|    nbBits = (bitStream & 0xF) + FSEv05_MIN_TABLELOG;   /* extract tableLog */
  ------------------
  |  | 1098|  2.33k|#define FSEv05_MIN_TABLELOG 5
  ------------------
 1247|  2.33k|    if (nbBits > FSEv05_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  | 1100|  2.33k|#define FSEv05_TABLELOG_ABSOLUTE_MAX 15
  ------------------
                  if (nbBits > FSEv05_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   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 (1247:9): [True: 65, False: 2.27k]
  ------------------
 1248|  2.27k|    bitStream >>= 4;
 1249|  2.27k|    bitCount = 4;
 1250|  2.27k|    *tableLogPtr = nbBits;
 1251|  2.27k|    remaining = (1<<nbBits)+1;
 1252|  2.27k|    threshold = 1<<nbBits;
 1253|  2.27k|    nbBits++;
 1254|       |
 1255|  37.6k|    while ((remaining>1) && (charnum<=*maxSVPtr)) {
  ------------------
  |  Branch (1255:12): [True: 35.4k, False: 2.18k]
  |  Branch (1255:29): [True: 35.3k, False: 50]
  ------------------
 1256|  35.3k|        if (previous0) {
  ------------------
  |  Branch (1256:13): [True: 3.55k, False: 31.8k]
  ------------------
 1257|  3.55k|            unsigned n0 = charnum;
 1258|  3.71k|            while ((bitStream & 0xFFFF) == 0xFFFF) {
  ------------------
  |  Branch (1258:20): [True: 160, False: 3.55k]
  ------------------
 1259|    160|                n0+=24;
 1260|    160|                if (ip < iend-5) {
  ------------------
  |  Branch (1260:21): [True: 125, False: 35]
  ------------------
 1261|    125|                    ip+=2;
 1262|    125|                    bitStream = MEM_readLE32(ip) >> bitCount;
 1263|    125|                } else {
 1264|     35|                    bitStream >>= 16;
 1265|     35|                    bitCount+=16;
 1266|     35|            }   }
 1267|  4.53k|            while ((bitStream & 3) == 3) {
  ------------------
  |  Branch (1267:20): [True: 980, False: 3.55k]
  ------------------
 1268|    980|                n0+=3;
 1269|    980|                bitStream>>=2;
 1270|    980|                bitCount+=2;
 1271|    980|            }
 1272|  3.55k|            n0 += bitStream & 3;
 1273|  3.55k|            bitCount += 2;
 1274|  3.55k|            if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall);
  ------------------
  |  |   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 (1274:17): [True: 40, False: 3.51k]
  ------------------
 1275|  9.28k|            while (charnum < n0) normalizedCounter[charnum++] = 0;
  ------------------
  |  Branch (1275:20): [True: 5.76k, False: 3.51k]
  ------------------
 1276|  3.51k|            if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
  ------------------
  |  Branch (1276:17): [True: 1.72k, False: 1.79k]
  |  Branch (1276:35): [True: 195, False: 1.59k]
  ------------------
 1277|  1.91k|                ip += bitCount>>3;
 1278|  1.91k|                bitCount &= 7;
 1279|  1.91k|                bitStream = MEM_readLE32(ip) >> bitCount;
 1280|  1.91k|            }
 1281|  1.59k|            else
 1282|  1.59k|                bitStream >>= 2;
 1283|  3.51k|        }
 1284|  35.3k|        {
 1285|  35.3k|            const short max = (short)((2*threshold-1)-remaining);
 1286|  35.3k|            short count;
 1287|       |
 1288|  35.3k|            if ((bitStream & (threshold-1)) < (U32)max) {
  ------------------
  |  Branch (1288:17): [True: 25.8k, False: 9.44k]
  ------------------
 1289|  25.8k|                count = (short)(bitStream & (threshold-1));
 1290|  25.8k|                bitCount   += nbBits-1;
 1291|  25.8k|            } else {
 1292|  9.44k|                count = (short)(bitStream & (2*threshold-1));
 1293|  9.44k|                if (count >= threshold) count -= max;
  ------------------
  |  Branch (1293:21): [True: 3.08k, False: 6.36k]
  ------------------
 1294|  9.44k|                bitCount   += nbBits;
 1295|  9.44k|            }
 1296|       |
 1297|  35.3k|            count--;   /* extra accuracy */
 1298|  35.3k|            remaining -= FSEv05_abs(count);
 1299|  35.3k|            normalizedCounter[charnum++] = count;
 1300|  35.3k|            previous0 = !count;
 1301|  52.0k|            while (remaining < threshold) {
  ------------------
  |  Branch (1301:20): [True: 16.6k, False: 35.3k]
  ------------------
 1302|  16.6k|                nbBits--;
 1303|  16.6k|                threshold >>= 1;
 1304|  16.6k|            }
 1305|       |
 1306|  35.3k|            if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
  ------------------
  |  Branch (1306:17): [True: 25.7k, False: 9.60k]
  |  Branch (1306:35): [True: 1.88k, False: 7.72k]
  ------------------
 1307|  27.6k|                ip += bitCount>>3;
 1308|  27.6k|                bitCount &= 7;
 1309|  27.6k|            } else {
 1310|  7.72k|                bitCount -= (int)(8 * (iend - 4 - ip));
 1311|  7.72k|                ip = iend - 4;
 1312|  7.72k|            }
 1313|  35.3k|            bitStream = MEM_readLE32(ip) >> (bitCount & 31);
 1314|  35.3k|    }   }
 1315|  2.23k|    if (remaining != 1) return ERROR(GENERIC);
  ------------------
  |  |   49|     50|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     50|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     50|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1315:9): [True: 50, False: 2.18k]
  ------------------
 1316|  2.18k|    *maxSVPtr = charnum-1;
 1317|       |
 1318|  2.18k|    ip += (bitCount+7)>>3;
 1319|  2.18k|    if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|     61|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     61|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     61|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1319:9): [True: 61, False: 2.12k]
  ------------------
 1320|  2.12k|    return ip-istart;
 1321|  2.18k|}
FSEv05_buildDTable_rle:
 1329|    193|{
 1330|    193|    void* ptr = dt;
 1331|    193|    FSEv05_DTableHeader* const DTableH = (FSEv05_DTableHeader*)ptr;
 1332|    193|    void* dPtr = dt + 1;
 1333|    193|    FSEv05_decode_t* const cell = (FSEv05_decode_t*)dPtr;
 1334|       |
 1335|    193|    DTableH->tableLog = 0;
 1336|    193|    DTableH->fastMode = 0;
 1337|       |
 1338|    193|    cell->newState = 0;
 1339|    193|    cell->symbol = symbolValue;
 1340|    193|    cell->nbBits = 0;
 1341|       |
 1342|    193|    return 0;
 1343|    193|}
FSEv05_buildDTable_raw:
 1347|    499|{
 1348|    499|    void* ptr = dt;
 1349|    499|    FSEv05_DTableHeader* const DTableH = (FSEv05_DTableHeader*)ptr;
 1350|    499|    void* dPtr = dt + 1;
 1351|    499|    FSEv05_decode_t* const dinfo = (FSEv05_decode_t*)dPtr;
 1352|    499|    const unsigned tableSize = 1 << nbBits;
 1353|    499|    const unsigned tableMask = tableSize - 1;
 1354|    499|    const unsigned maxSymbolValue = tableMask;
 1355|    499|    unsigned s;
 1356|       |
 1357|       |    /* Sanity checks */
 1358|    499|    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: 499]
  ------------------
 1359|       |
 1360|       |    /* Build Decoding Table */
 1361|    499|    DTableH->tableLog = (U16)nbBits;
 1362|    499|    DTableH->fastMode = 1;
 1363|  42.1k|    for (s=0; s<=maxSymbolValue; s++) {
  ------------------
  |  Branch (1363:15): [True: 41.6k, False: 499]
  ------------------
 1364|  41.6k|        dinfo[s].newState = 0;
 1365|  41.6k|        dinfo[s].symbol = (BYTE)s;
 1366|  41.6k|        dinfo[s].nbBits = (BYTE)nbBits;
 1367|  41.6k|    }
 1368|       |
 1369|    499|    return 0;
 1370|    499|}
FSEv05_decompress_usingDTable:
 1443|    892|{
 1444|    892|    const void* ptr = dt;
 1445|    892|    const FSEv05_DTableHeader* DTableH = (const FSEv05_DTableHeader*)ptr;
 1446|    892|    const U32 fastMode = DTableH->fastMode;
 1447|       |
 1448|       |    /* select fast mode (static) */
 1449|    892|    if (fastMode) return FSEv05_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 1);
  ------------------
  |  Branch (1449:9): [True: 476, False: 416]
  ------------------
 1450|    416|    return FSEv05_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 0);
 1451|    892|}
FSEv05_decompress:
 1455|  1.01k|{
 1456|  1.01k|    const BYTE* const istart = (const BYTE*)cSrc;
 1457|  1.01k|    const BYTE* ip = istart;
 1458|  1.01k|    short counting[FSEv05_MAX_SYMBOL_VALUE+1];
 1459|  1.01k|    DTable_max_t dt;   /* Static analyzer seems unable to understand this table will be properly initialized later */
 1460|  1.01k|    unsigned tableLog;
 1461|  1.01k|    unsigned maxSymbolValue = FSEv05_MAX_SYMBOL_VALUE;
  ------------------
  |  | 1048|  1.01k|#define FSEv05_MAX_SYMBOL_VALUE 255
  ------------------
 1462|  1.01k|    size_t errorCode;
 1463|       |
 1464|  1.01k|    if (cSrcSize<2) return ERROR(srcSize_wrong);   /* too small input size */
  ------------------
  |  |   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 (1464:9): [True: 19, False: 992]
  ------------------
 1465|       |
 1466|       |    /* normal FSEv05 decoding mode */
 1467|    992|    errorCode = FSEv05_readNCount (counting, &maxSymbolValue, &tableLog, istart, cSrcSize);
 1468|    992|    if (FSEv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1468:9): [True: 51, False: 941]
  ------------------
 1469|    941|    if (errorCode >= cSrcSize) return ERROR(srcSize_wrong);   /* too small input size */
  ------------------
  |  |   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 (1469:9): [True: 28, False: 913]
  ------------------
 1470|    913|    ip += errorCode;
 1471|    913|    cSrcSize -= errorCode;
 1472|       |
 1473|    913|    errorCode = FSEv05_buildDTable (dt, counting, maxSymbolValue, tableLog);
 1474|    913|    if (FSEv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1474:9): [True: 21, False: 892]
  ------------------
 1475|       |
 1476|       |    /* always return, even if it is an error code */
 1477|    892|    return FSEv05_decompress_usingDTable (dst, maxDstSize, ip, cSrcSize, dt);
 1478|    913|}
HUFv05_isError:
 1723|  3.96k|unsigned HUFv05_isError(size_t code) { return ERR_isError(code); }
HUFv05_readDTableX2:
 1818|    291|{
 1819|    291|    BYTE huffWeight[HUFv05_MAX_SYMBOL_VALUE + 1];
 1820|    291|    U32 rankVal[HUFv05_ABSOLUTEMAX_TABLELOG + 1];   /* large enough for values from 0 to 16 */
 1821|    291|    U32 tableLog = 0;
 1822|    291|    size_t iSize;
 1823|    291|    U32 nbSymbols = 0;
 1824|    291|    U32 n;
 1825|    291|    U32 nextRankStart;
 1826|    291|    void* const dtPtr = DTable + 1;
 1827|    291|    HUFv05_DEltX2* const dt = (HUFv05_DEltX2*)dtPtr;
 1828|       |
 1829|    291|    HUFv05_STATIC_ASSERT(sizeof(HUFv05_DEltX2) == sizeof(U16));   /* if compilation fails here, assertion is false */
  ------------------
  |  | 1725|    291|#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|    291|    iSize = HUFv05_readStats(huffWeight, HUFv05_MAX_SYMBOL_VALUE + 1, rankVal, &nbSymbols, &tableLog, src, srcSize);
  ------------------
  |  | 1714|    291|#define HUFv05_MAX_SYMBOL_VALUE 255
  ------------------
 1833|    291|    if (HUFv05_isError(iSize)) return iSize;
  ------------------
  |  Branch (1833:9): [True: 57, False: 234]
  ------------------
 1834|       |
 1835|       |    /* check result */
 1836|    234|    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 (1836:9): [True: 1, 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.34k|    for (n=1; n<=tableLog; n++) {
  ------------------
  |  Branch (1841:15): [True: 1.11k, False: 233]
  ------------------
 1842|  1.11k|        U32 current = nextRankStart;
 1843|  1.11k|        nextRankStart += (rankVal[n] << (n-1));
 1844|  1.11k|        rankVal[n] = current;
 1845|  1.11k|    }
 1846|       |
 1847|       |    /* fill DTable */
 1848|  9.90k|    for (n=0; n<nbSymbols; n++) {
  ------------------
  |  Branch (1848:15): [True: 9.67k, False: 233]
  ------------------
 1849|  9.67k|        const U32 w = huffWeight[n];
 1850|  9.67k|        const U32 length = (1 << w) >> 1;
 1851|  9.67k|        U32 i;
 1852|  9.67k|        HUFv05_DEltX2 D;
 1853|  9.67k|        D.byte = (BYTE)n; D.nbBits = (BYTE)(tableLog + 1 - w);
 1854|  25.7k|        for (i = rankVal[w]; i < rankVal[w] + length; i++)
  ------------------
  |  Branch (1854:30): [True: 16.0k, False: 9.67k]
  ------------------
 1855|  16.0k|            dt[i] = D;
 1856|  9.67k|        rankVal[w] += length;
 1857|  9.67k|    }
 1858|       |
 1859|    233|    return iSize;
 1860|    234|}
HUFv05_decompress1X2_usingDTable:
 1908|     75|{
 1909|     75|    BYTE* op = (BYTE*)dst;
 1910|     75|    BYTE* const oend = op + dstSize;
 1911|     75|    const U32 dtLog = DTable[0];
 1912|     75|    const void* dtPtr = DTable;
 1913|     75|    const HUFv05_DEltX2* const dt = ((const HUFv05_DEltX2*)dtPtr)+1;
 1914|     75|    BITv05_DStream_t bitD;
 1915|       |
 1916|     75|    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: 74]
  ------------------
 1917|     74|    { size_t const errorCode = BITv05_initDStream(&bitD, cSrc, cSrcSize);
 1918|     74|      if (HUFv05_isError(errorCode)) return errorCode; }
  ------------------
  |  Branch (1918:11): [True: 15, False: 59]
  ------------------
 1919|       |
 1920|     59|    HUFv05_decodeStreamX2(op, &bitD, oend, dt, dtLog);
 1921|       |
 1922|       |    /* check */
 1923|     59|    if (!BITv05_endOfDStream(&bitD)) return ERROR(corruption_detected);
  ------------------
  |  |   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 (1923:9): [True: 58, False: 1]
  ------------------
 1924|       |
 1925|      1|    return dstSize;
 1926|     59|}
HUFv05_decompress1X2:
 1929|     79|{
 1930|     79|    HUFv05_CREATE_STATIC_DTABLEX2(DTable, HUFv05_MAX_TABLELOG);
  ------------------
  |  | 1604|     79|        unsigned short DTable[HUFv05_DTABLE_SIZE(maxTableLog)] = { maxTableLog }
  ------------------
 1931|     79|    const BYTE* ip = (const BYTE*) cSrc;
 1932|     79|    size_t errorCode;
 1933|       |
 1934|     79|    errorCode = HUFv05_readDTableX2 (DTable, cSrc, cSrcSize);
 1935|     79|    if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1935:9): [True: 3, False: 76]
  ------------------
 1936|     76|    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: 75]
  ------------------
 1937|     75|    ip += errorCode;
 1938|     75|    cSrcSize -= errorCode;
 1939|       |
 1940|     75|    return HUFv05_decompress1X2_usingDTable (dst, dstSize, ip, cSrcSize, DTable);
 1941|     76|}
HUFv05_decompress4X2_usingDTable:
 1948|    156|{
 1949|       |    /* Check */
 1950|    156|    if (cSrcSize < 10) return ERROR(corruption_detected);   /* strict minimum : jump table + 1 byte per stream */
  ------------------
  |  |   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 (1950:9): [True: 4, 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|     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 (1984:13): [True: 13, False: 139]
  ------------------
 1985|    139|        errorCode = BITv05_initDStream(&bitD1, istart1, length1);
 1986|    139|        if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1986:13): [True: 14, False: 125]
  ------------------
 1987|    125|        errorCode = BITv05_initDStream(&bitD2, istart2, length2);
 1988|    125|        if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1988:13): [True: 20, False: 105]
  ------------------
 1989|    105|        errorCode = BITv05_initDStream(&bitD3, istart3, length3);
 1990|    105|        if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1990:13): [True: 21, False: 84]
  ------------------
 1991|     84|        errorCode = BITv05_initDStream(&bitD4, istart4, length4);
 1992|     84|        if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1992:13): [True: 9, False: 75]
  ------------------
 1993|       |
 1994|       |        /* 16-32 symbols per loop (4-8 symbols per stream) */
 1995|     75|        endSignal = BITv05_reloadDStream(&bitD1) | BITv05_reloadDStream(&bitD2) | BITv05_reloadDStream(&bitD3) | BITv05_reloadDStream(&bitD4);
 1996|    581|        for ( ; (endSignal==BITv05_DStream_unfinished) && (op4<(oend-7)) ; ) {
  ------------------
  |  Branch (1996:17): [True: 513, False: 68]
  |  Branch (1996:59): [True: 506, False: 7]
  ------------------
 1997|    506|            HUFv05_DECODE_SYMBOLX2_2(op1, &bitD1);
  ------------------
  |  | 1878|    506|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 506, False: 0]
  |  |  ------------------
  |  | 1879|    506|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    506|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1998|    506|            HUFv05_DECODE_SYMBOLX2_2(op2, &bitD2);
  ------------------
  |  | 1878|    506|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 506, False: 0]
  |  |  ------------------
  |  | 1879|    506|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    506|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1999|    506|            HUFv05_DECODE_SYMBOLX2_2(op3, &bitD3);
  ------------------
  |  | 1878|    506|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 506, False: 0]
  |  |  ------------------
  |  | 1879|    506|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    506|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2000|    506|            HUFv05_DECODE_SYMBOLX2_2(op4, &bitD4);
  ------------------
  |  | 1878|    506|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 506, False: 0]
  |  |  ------------------
  |  | 1879|    506|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    506|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2001|    506|            HUFv05_DECODE_SYMBOLX2_1(op1, &bitD1);
  ------------------
  |  | 1874|    506|    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: 506, False: 0]
  |  |  |  Branch (1874:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1875|    506|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    506|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2002|    506|            HUFv05_DECODE_SYMBOLX2_1(op2, &bitD2);
  ------------------
  |  | 1874|    506|    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: 506, False: 0]
  |  |  |  Branch (1874:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1875|    506|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    506|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2003|    506|            HUFv05_DECODE_SYMBOLX2_1(op3, &bitD3);
  ------------------
  |  | 1874|    506|    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: 506, False: 0]
  |  |  |  Branch (1874:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1875|    506|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    506|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2004|    506|            HUFv05_DECODE_SYMBOLX2_1(op4, &bitD4);
  ------------------
  |  | 1874|    506|    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: 506, False: 0]
  |  |  |  Branch (1874:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1875|    506|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    506|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2005|    506|            HUFv05_DECODE_SYMBOLX2_2(op1, &bitD1);
  ------------------
  |  | 1878|    506|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 506, False: 0]
  |  |  ------------------
  |  | 1879|    506|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    506|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2006|    506|            HUFv05_DECODE_SYMBOLX2_2(op2, &bitD2);
  ------------------
  |  | 1878|    506|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 506, False: 0]
  |  |  ------------------
  |  | 1879|    506|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    506|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2007|    506|            HUFv05_DECODE_SYMBOLX2_2(op3, &bitD3);
  ------------------
  |  | 1878|    506|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 506, False: 0]
  |  |  ------------------
  |  | 1879|    506|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    506|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2008|    506|            HUFv05_DECODE_SYMBOLX2_2(op4, &bitD4);
  ------------------
  |  | 1878|    506|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 506, False: 0]
  |  |  ------------------
  |  | 1879|    506|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|    506|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2009|    506|            HUFv05_DECODE_SYMBOLX2_0(op1, &bitD1);
  ------------------
  |  | 1871|    506|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2010|    506|            HUFv05_DECODE_SYMBOLX2_0(op2, &bitD2);
  ------------------
  |  | 1871|    506|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2011|    506|            HUFv05_DECODE_SYMBOLX2_0(op3, &bitD3);
  ------------------
  |  | 1871|    506|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2012|    506|            HUFv05_DECODE_SYMBOLX2_0(op4, &bitD4);
  ------------------
  |  | 1871|    506|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2013|    506|            endSignal = BITv05_reloadDStream(&bitD1) | BITv05_reloadDStream(&bitD2) | BITv05_reloadDStream(&bitD3) | BITv05_reloadDStream(&bitD4);
 2014|    506|        }
 2015|       |
 2016|       |        /* check corruption */
 2017|     75|        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: 75]
  ------------------
 2018|     75|        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: 75]
  ------------------
 2019|     75|        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: 75]
  ------------------
 2020|       |        /* note : op4 supposed already verified within main loop */
 2021|       |
 2022|       |        /* finish bitStreams one by one */
 2023|     75|        HUFv05_decodeStreamX2(op1, &bitD1, opStart2, dt, dtLog);
 2024|     75|        HUFv05_decodeStreamX2(op2, &bitD2, opStart3, dt, dtLog);
 2025|     75|        HUFv05_decodeStreamX2(op3, &bitD3, opStart4, dt, dtLog);
 2026|     75|        HUFv05_decodeStreamX2(op4, &bitD4, oend,     dt, dtLog);
 2027|       |
 2028|       |        /* check */
 2029|     75|        endSignal = BITv05_endOfDStream(&bitD1) & BITv05_endOfDStream(&bitD2) & BITv05_endOfDStream(&bitD3) & BITv05_endOfDStream(&bitD4);
 2030|     75|        if (!endSignal) return ERROR(corruption_detected);
  ------------------
  |  |   49|     75|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     75|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     75|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2030:13): [True: 75, False: 0]
  ------------------
 2031|       |
 2032|       |        /* decoded size */
 2033|      0|        return dstSize;
 2034|     75|    }
 2035|     75|}
HUFv05_decompress4X2:
 2039|    212|{
 2040|    212|    HUFv05_CREATE_STATIC_DTABLEX2(DTable, HUFv05_MAX_TABLELOG);
  ------------------
  |  | 1604|    212|        unsigned short DTable[HUFv05_DTABLE_SIZE(maxTableLog)] = { maxTableLog }
  ------------------
 2041|    212|    const BYTE* ip = (const BYTE*) cSrc;
 2042|    212|    size_t errorCode;
 2043|       |
 2044|    212|    errorCode = HUFv05_readDTableX2 (DTable, cSrc, cSrcSize);
 2045|    212|    if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (2045:9): [True: 55, False: 157]
  ------------------
 2046|    157|    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: 156]
  ------------------
 2047|    156|    ip += errorCode;
 2048|    156|    cSrcSize -= errorCode;
 2049|       |
 2050|    156|    return HUFv05_decompress4X2_usingDTable (dst, dstSize, ip, cSrcSize, DTable);
 2051|    157|}
HUFv05_readDTableX4:
 2146|  1.21k|{
 2147|  1.21k|    BYTE weightList[HUFv05_MAX_SYMBOL_VALUE + 1];
 2148|  1.21k|    sortedSymbol_t sortedSymbol[HUFv05_MAX_SYMBOL_VALUE + 1];
 2149|  1.21k|    U32 rankStats[HUFv05_ABSOLUTEMAX_TABLELOG + 1] = { 0 };
 2150|  1.21k|    U32 rankStart0[HUFv05_ABSOLUTEMAX_TABLELOG + 2] = { 0 };
 2151|  1.21k|    U32* const rankStart = rankStart0+1;
 2152|  1.21k|    rankVal_t rankVal;
 2153|  1.21k|    U32 tableLog, maxW, sizeOfSort, nbSymbols;
 2154|  1.21k|    const U32 memLog = DTable[0];
 2155|  1.21k|    size_t iSize;
 2156|  1.21k|    void* dtPtr = DTable;
 2157|  1.21k|    HUFv05_DEltX4* const dt = ((HUFv05_DEltX4*)dtPtr) + 1;
 2158|       |
 2159|  1.21k|    HUFv05_STATIC_ASSERT(sizeof(HUFv05_DEltX4) == sizeof(unsigned));   /* if compilation fails here, assertion is false */
  ------------------
  |  | 1725|  1.21k|#define HUFv05_STATIC_ASSERT(c) { enum { HUFv05_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
 2160|  1.21k|    if (memLog > HUFv05_ABSOLUTEMAX_TABLELOG) return ERROR(tableLog_tooLarge);
  ------------------
  |  | 1711|  1.21k|#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.21k]
  ------------------
 2161|       |    /* memset(weightList, 0, sizeof(weightList)); */   /* is not necessary, even though some analyzer complain ... */
 2162|       |
 2163|  1.21k|    iSize = HUFv05_readStats(weightList, HUFv05_MAX_SYMBOL_VALUE + 1, rankStats, &nbSymbols, &tableLog, src, srcSize);
  ------------------
  |  | 1714|  1.21k|#define HUFv05_MAX_SYMBOL_VALUE 255
  ------------------
 2164|  1.21k|    if (HUFv05_isError(iSize)) return iSize;
  ------------------
  |  Branch (2164:9): [True: 844, False: 366]
  ------------------
 2165|       |
 2166|       |    /* check result */
 2167|    366|    if (tableLog > memLog) return ERROR(tableLog_tooLarge);   /* DTable can't fit code depth */
  ------------------
  |  |   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 (2167:9): [True: 3, False: 363]
  ------------------
 2168|       |
 2169|       |    /* find maxWeight */
 2170|  1.02k|    for (maxW = tableLog; rankStats[maxW]==0; maxW--) {}  /* necessarily finds a solution before 0 */
  ------------------
  |  Branch (2170:27): [True: 665, False: 363]
  ------------------
 2171|       |
 2172|       |    /* Get start index of each weight */
 2173|    363|    {
 2174|    363|        U32 w, nextRankStart = 0;
 2175|  2.18k|        for (w=1; w<=maxW; w++) {
  ------------------
  |  Branch (2175:19): [True: 1.81k, False: 363]
  ------------------
 2176|  1.81k|            U32 current = nextRankStart;
 2177|  1.81k|            nextRankStart += rankStats[w];
 2178|  1.81k|            rankStart[w] = current;
 2179|  1.81k|        }
 2180|    363|        rankStart[0] = nextRankStart;   /* put all 0w symbols at the end of sorted list*/
 2181|    363|        sizeOfSort = nextRankStart;
 2182|    363|    }
 2183|       |
 2184|       |    /* sort symbols by weight */
 2185|    363|    {
 2186|    363|        U32 s;
 2187|  37.7k|        for (s=0; s<nbSymbols; s++) {
  ------------------
  |  Branch (2187:19): [True: 37.3k, False: 363]
  ------------------
 2188|  37.3k|            U32 w = weightList[s];
 2189|  37.3k|            U32 r = rankStart[w]++;
 2190|  37.3k|            sortedSymbol[r].symbol = (BYTE)s;
 2191|  37.3k|            sortedSymbol[r].weight = (BYTE)w;
 2192|  37.3k|        }
 2193|    363|        rankStart[0] = 0;   /* forget 0w symbols; this is beginning of weight(1) */
 2194|    363|    }
 2195|       |
 2196|       |    /* Build rankVal */
 2197|    363|    {
 2198|    363|        const U32 minBits = tableLog+1 - maxW;
 2199|    363|        U32 nextRankVal = 0;
 2200|    363|        U32 w, consumed;
 2201|    363|        const int rescale = (memLog-tableLog) - 1;   /* tableLog <= memLog */
 2202|    363|        U32* rankVal0 = rankVal[0];
 2203|  2.18k|        for (w=1; w<=maxW; w++) {
  ------------------
  |  Branch (2203:19): [True: 1.81k, False: 363]
  ------------------
 2204|  1.81k|            U32 current = nextRankVal;
 2205|  1.81k|            nextRankVal += rankStats[w] << (w+rescale);
 2206|  1.81k|            rankVal0[w] = current;
 2207|  1.81k|        }
 2208|  3.11k|        for (consumed = minBits; consumed <= memLog - minBits; consumed++) {
  ------------------
  |  Branch (2208:34): [True: 2.75k, False: 363]
  ------------------
 2209|  2.75k|            U32* rankValPtr = rankVal[consumed];
 2210|  21.0k|            for (w = 1; w <= maxW; w++) {
  ------------------
  |  Branch (2210:25): [True: 18.3k, False: 2.75k]
  ------------------
 2211|  18.3k|                rankValPtr[w] = rankVal0[w] >> consumed;
 2212|  18.3k|    }   }   }
 2213|       |
 2214|    363|    HUFv05_fillDTableX4(dt, memLog,
 2215|    363|                   sortedSymbol, sizeOfSort,
 2216|    363|                   rankStart0, rankVal, maxW,
 2217|    363|                   tableLog+1);
 2218|       |
 2219|    363|    return iSize;
 2220|    366|}
HUFv05_decompress1X4_usingDTable:
 2287|     62|{
 2288|     62|    const BYTE* const istart = (const BYTE*) cSrc;
 2289|     62|    BYTE* const ostart = (BYTE*) dst;
 2290|     62|    BYTE* const oend = ostart + dstSize;
 2291|       |
 2292|     62|    const U32 dtLog = DTable[0];
 2293|     62|    const void* const dtPtr = DTable;
 2294|     62|    const HUFv05_DEltX4* const dt = ((const HUFv05_DEltX4*)dtPtr) +1;
 2295|     62|    size_t errorCode;
 2296|       |
 2297|       |    /* Init */
 2298|     62|    BITv05_DStream_t bitD;
 2299|     62|    errorCode = BITv05_initDStream(&bitD, istart, cSrcSize);
 2300|     62|    if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (2300:9): [True: 15, False: 47]
  ------------------
 2301|       |
 2302|       |    /* finish bitStreams one by one */
 2303|     47|    HUFv05_decodeStreamX4(ostart, &bitD, oend,     dt, dtLog);
 2304|       |
 2305|       |    /* check */
 2306|     47|    if (!BITv05_endOfDStream(&bitD)) return ERROR(corruption_detected);
  ------------------
  |  |   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 (2306:9): [True: 46, False: 1]
  ------------------
 2307|       |
 2308|       |    /* decoded size */
 2309|      1|    return dstSize;
 2310|     47|}
HUFv05_decompress:
 2465|    235|{
 2466|    235|    static const decompressionAlgo decompress[3] = { HUFv05_decompress4X2, HUFv05_decompress4X4, NULL };
 2467|       |    /* estimate decompression time */
 2468|    235|    U32 Q;
 2469|    235|    const U32 D256 = (U32)(dstSize >> 8);
 2470|    235|    U32 Dtime[3];
 2471|    235|    U32 algoNb = 0;
 2472|    235|    int n;
 2473|       |
 2474|       |    /* validation checks */
 2475|    235|    if (dstSize == 0) 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 (2475:9): [True: 6, False: 229]
  ------------------
 2476|    229|    if (cSrcSize >= dstSize) return ERROR(corruption_detected);   /* invalid, or not compressed, but not compressed already dealt with */
  ------------------
  |  |   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 (2476:9): [True: 1, False: 228]
  ------------------
 2477|    228|    if (cSrcSize == 1) { memset(dst, *(const BYTE*)cSrc, dstSize); return dstSize; }   /* RLE */
  ------------------
  |  Branch (2477:9): [True: 16, False: 212]
  ------------------
 2478|       |
 2479|       |    /* decoder timing evaluation */
 2480|    212|    Q = (U32)(cSrcSize * 16 / dstSize);   /* Q < 16 since dstSize > cSrcSize */
 2481|    848|    for (n=0; n<3; n++)
  ------------------
  |  Branch (2481:15): [True: 636, False: 212]
  ------------------
 2482|    636|        Dtime[n] = algoTime[Q][n].tableTime + (algoTime[Q][n].decode256Time * D256);
 2483|       |
 2484|    212|    Dtime[1] += Dtime[1] >> 4; Dtime[2] += Dtime[2] >> 3; /* advantage to algorithms using less memory, for cache eviction */
 2485|       |
 2486|    212|    if (Dtime[1] < Dtime[0]) algoNb = 1;
  ------------------
  |  Branch (2486:9): [True: 0, False: 212]
  ------------------
 2487|       |
 2488|    212|    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|    228|}
ZSTDv05_isError:
 2577|   117k|unsigned ZSTDv05_isError(size_t code) { return ERR_isError(code); }
ZSTDv05_decompressBegin:
 2617|  4.08k|{
 2618|  4.08k|    dctx->expected = ZSTDv05_frameHeaderSize_min;
 2619|  4.08k|    dctx->stage = ZSTDv05ds_getFrameHeaderSize;
 2620|  4.08k|    dctx->previousDstEnd = NULL;
 2621|  4.08k|    dctx->base = NULL;
 2622|  4.08k|    dctx->vBase = NULL;
 2623|  4.08k|    dctx->dictEnd = NULL;
 2624|  4.08k|    dctx->hufTableX4[0] = ZSTD_HUFFDTABLE_CAPACITY_LOG;
  ------------------
  |  |  436|  4.08k|#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
  ------------------
 2625|  4.08k|    dctx->flagStaticTables = 0;
 2626|  4.08k|    return 0;
 2627|  4.08k|}
ZSTDv05_createDCtx:
 2630|  2.04k|{
 2631|  2.04k|    ZSTDv05_DCtx* dctx = (ZSTDv05_DCtx*)malloc(sizeof(ZSTDv05_DCtx));
 2632|  2.04k|    if (dctx==NULL) return NULL;
  ------------------
  |  Branch (2632:9): [True: 0, False: 2.04k]
  ------------------
 2633|  2.04k|    ZSTDv05_decompressBegin(dctx);
 2634|  2.04k|    return dctx;
 2635|  2.04k|}
ZSTDv05_freeDCtx:
 2638|  2.04k|{
 2639|  2.04k|    free(dctx);
 2640|  2.04k|    return 0;   /* reserved as a potential error code in the future */
 2641|  2.04k|}
ZSTDv05_getFrameParams:
 2752|  3.15k|{
 2753|  3.15k|    U32 magicNumber;
 2754|  3.15k|    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.15k]
  ------------------
 2755|  3.15k|    magicNumber = MEM_readLE32(src);
 2756|  3.15k|    if (magicNumber != ZSTDv05_MAGICNUMBER) return ERROR(prefix_unknown);
  ------------------
  |  |  153|  3.15k|#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.15k]
  ------------------
 2757|  3.15k|    memset(params, 0, sizeof(*params));
 2758|  3.15k|    params->windowLog = (((const BYTE*)src)[4] & 15) + ZSTDv05_WINDOWLOG_ABSOLUTEMIN;
  ------------------
  |  |  256|  3.15k|#define ZSTDv05_WINDOWLOG_ABSOLUTEMIN 11
  ------------------
 2759|  3.15k|    if ((((const BYTE*)src)[4] >> 4) != 0) return ERROR(frameParameter_unsupported);   /* reserved bits */
  ------------------
  |  |   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 (2759:9): [True: 64, False: 3.09k]
  ------------------
 2760|  3.09k|    return 0;
 2761|  3.15k|}
ZSTDv05_decompress_usingDict:
 3449|  2.04k|{
 3450|  2.04k|    ZSTDv05_decompressBegin_usingDict(dctx, dict, dictSize);
 3451|  2.04k|    ZSTDv05_checkContinuity(dctx, dst);
 3452|  2.04k|    return ZSTDv05_decompress_continueDCtx(dctx, dst, maxDstSize, src, srcSize);
 3453|  2.04k|}
ZSTDv05_findFrameSizeInfoLegacy:
 3485|  2.11k|{
 3486|  2.11k|    const BYTE* ip = (const BYTE*)src;
 3487|  2.11k|    size_t remainingSize = srcSize;
 3488|  2.11k|    size_t nbBlocks = 0;
 3489|  2.11k|    blockProperties_t blockProperties;
 3490|       |
 3491|       |    /* Frame Header */
 3492|  2.11k|    if (srcSize < ZSTDv05_frameHeaderSize_min) {
  ------------------
  |  Branch (3492:9): [True: 0, False: 2.11k]
  ------------------
 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.11k|    if (MEM_readLE32(src) != ZSTDv05_MAGICNUMBER) {
  ------------------
  |  |  153|  2.11k|#define ZSTDv05_MAGICNUMBER 0xFD2FB525   /* v0.5 */
  ------------------
  |  Branch (3496:9): [True: 0, False: 2.11k]
  ------------------
 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.11k|    ip += ZSTDv05_frameHeaderSize_min; remainingSize -= ZSTDv05_frameHeaderSize_min;
 3501|       |
 3502|       |    /* Loop on each block */
 3503|  4.29k|    while (1)
  ------------------
  |  Branch (3503:12): [True: 4.29k, Folded]
  ------------------
 3504|  4.29k|    {
 3505|  4.29k|        size_t cBlockSize = ZSTDv05_getcBlockSize(ip, remainingSize, &blockProperties);
 3506|  4.29k|        if (ZSTDv05_isError(cBlockSize)) {
  ------------------
  |  Branch (3506:13): [True: 7, False: 4.29k]
  ------------------
 3507|      7|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, cBlockSize);
 3508|      7|            return;
 3509|      7|        }
 3510|       |
 3511|  4.29k|        ip += ZSTDv05_blockHeaderSize;
 3512|  4.29k|        remainingSize -= ZSTDv05_blockHeaderSize;
 3513|  4.29k|        if (cBlockSize > remainingSize) {
  ------------------
  |  Branch (3513:13): [True: 64, False: 4.22k]
  ------------------
 3514|     64|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(srcSize_wrong));
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3515|     64|            return;
 3516|     64|        }
 3517|       |
 3518|  4.22k|        if (cBlockSize == 0) break;   /* bt_end */
  ------------------
  |  Branch (3518:13): [True: 2.04k, False: 2.18k]
  ------------------
 3519|       |
 3520|  2.18k|        ip += cBlockSize;
 3521|  2.18k|        remainingSize -= cBlockSize;
 3522|  2.18k|        nbBlocks++;
 3523|  2.18k|    }
 3524|       |
 3525|  2.04k|    *cSize = ip - (const BYTE*)src;
 3526|  2.04k|    *dBound = nbBlocks * BLOCKSIZE;
  ------------------
  |  |  396|  2.04k|#define BLOCKSIZE (128 KB)                 /* define, for static allocation */
  |  |  ------------------
  |  |  |  |  392|  2.04k|#define KB *(1 <<10)
  |  |  ------------------
  ------------------
 3527|  2.04k|}
ZSTDv05_decompressBegin_usingDict:
 3687|  2.04k|{
 3688|  2.04k|    size_t errorCode;
 3689|  2.04k|    errorCode = ZSTDv05_decompressBegin(dctx);
 3690|  2.04k|    if (ZSTDv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (3690:9): [True: 0, False: 2.04k]
  ------------------
 3691|       |
 3692|  2.04k|    if (dict && dictSize) {
  ------------------
  |  Branch (3692:9): [True: 2.04k, False: 0]
  |  Branch (3692:17): [True: 1.32k, False: 714]
  ------------------
 3693|  1.32k|        errorCode = ZSTDv05_decompress_insertDictionary(dctx, dict, dictSize);
 3694|  1.32k|        if (ZSTDv05_isError(errorCode)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|  1.08k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  1.08k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  1.08k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3694:13): [True: 1.08k, False: 240]
  ------------------
 3695|  1.32k|    }
 3696|       |
 3697|    954|    return 0;
 3698|  2.04k|}
zstd_v05.c:FSEv05_tableStep:
 1142|  2.00k|static U32 FSEv05_tableStep(U32 tableSize) { return (tableSize>>1) + (tableSize>>3) + 3; }
zstd_v05.c:BITv05_highbit32:
  702|   765k|{
  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|   765k|}
zstd_v05.c:FSEv05_abs:
 1227|  35.3k|static short FSEv05_abs(short a) { return a<0 ? -a : a; }
  ------------------
  |  Branch (1227:43): [True: 18.7k, False: 16.5k]
  ------------------
zstd_v05.c:FSEv05_decompress_usingDTable_generic:
 1376|    892|{
 1377|    892|    BYTE* const ostart = (BYTE*) dst;
 1378|    892|    BYTE* op = ostart;
 1379|    892|    BYTE* const omax = op + maxDstSize;
 1380|    892|    BYTE* const olimit = omax-3;
 1381|       |
 1382|    892|    BITv05_DStream_t bitD;
 1383|    892|    FSEv05_DState_t state1;
 1384|    892|    FSEv05_DState_t state2;
 1385|    892|    size_t errorCode;
 1386|       |
 1387|       |    /* Init */
 1388|    892|    errorCode = BITv05_initDStream(&bitD, cSrc, cSrcSize);   /* replaced last arg by maxCompressed Size */
 1389|    892|    if (FSEv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1389:9): [True: 87, False: 805]
  ------------------
 1390|       |
 1391|    805|    FSEv05_initDState(&state1, &bitD, dt);
 1392|    805|    FSEv05_initDState(&state2, &bitD, dt);
 1393|       |
 1394|    805|#define FSEv05_GETSYMBOL(statePtr) fast ? FSEv05_decodeSymbolFast(statePtr, &bitD) : FSEv05_decodeSymbol(statePtr, &bitD)
 1395|       |
 1396|       |    /* 4 symbols per loop */
 1397|  9.89k|    for ( ; (BITv05_reloadDStream(&bitD)==BITv05_DStream_unfinished) && (op<olimit) ; op+=4) {
  ------------------
  |  Branch (1397:13): [True: 9.15k, False: 735]
  |  Branch (1397:73): [True: 9.08k, False: 70]
  ------------------
 1398|  9.08k|        op[0] = FSEv05_GETSYMBOL(&state1);
  ------------------
  |  | 1394|  9.08k|#define FSEv05_GETSYMBOL(statePtr) fast ? FSEv05_decodeSymbolFast(statePtr, &bitD) : FSEv05_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1394:36): [True: 2.29k, False: 6.79k]
  |  |  ------------------
  ------------------
 1399|       |
 1400|  9.08k|        if (FSEv05_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  | 1094|  9.08k|#define FSEv05_MAX_TABLELOG  (FSEv05_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  | 1042|  9.08k|#define FSEv05_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (1400:13): [Folded, False: 9.08k]
  ------------------
 1401|      0|            BITv05_reloadDStream(&bitD);
 1402|       |
 1403|  9.08k|        op[1] = FSEv05_GETSYMBOL(&state2);
  ------------------
  |  | 1394|  9.08k|#define FSEv05_GETSYMBOL(statePtr) fast ? FSEv05_decodeSymbolFast(statePtr, &bitD) : FSEv05_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1394:36): [True: 2.29k, False: 6.79k]
  |  |  ------------------
  ------------------
 1404|       |
 1405|  9.08k|        if (FSEv05_MAX_TABLELOG*4+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  | 1094|  9.08k|#define FSEv05_MAX_TABLELOG  (FSEv05_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  | 1042|  9.08k|#define FSEv05_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (1405:13): [Folded, False: 9.08k]
  ------------------
 1406|      0|            { if (BITv05_reloadDStream(&bitD) > BITv05_DStream_unfinished) { op+=2; break; } }
  ------------------
  |  Branch (1406:19): [True: 0, False: 0]
  ------------------
 1407|       |
 1408|  9.08k|        op[2] = FSEv05_GETSYMBOL(&state1);
  ------------------
  |  | 1394|  9.08k|#define FSEv05_GETSYMBOL(statePtr) fast ? FSEv05_decodeSymbolFast(statePtr, &bitD) : FSEv05_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1394:36): [True: 2.29k, False: 6.79k]
  |  |  ------------------
  ------------------
 1409|       |
 1410|  9.08k|        if (FSEv05_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8)    /* This test must be static */
  ------------------
  |  | 1094|  9.08k|#define FSEv05_MAX_TABLELOG  (FSEv05_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  | 1042|  9.08k|#define FSEv05_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (1410:13): [Folded, False: 9.08k]
  ------------------
 1411|      0|            BITv05_reloadDStream(&bitD);
 1412|       |
 1413|  9.08k|        op[3] = FSEv05_GETSYMBOL(&state2);
  ------------------
  |  | 1394|  9.08k|#define FSEv05_GETSYMBOL(statePtr) fast ? FSEv05_decodeSymbolFast(statePtr, &bitD) : FSEv05_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1394:36): [True: 2.29k, False: 6.79k]
  |  |  ------------------
  ------------------
 1414|  9.08k|    }
 1415|       |
 1416|       |    /* tail */
 1417|       |    /* note : BITv05_reloadDStream(&bitD) >= FSEv05_DStream_partiallyFilled; Ends at exactly BITv05_DStream_completed */
 1418|  11.6k|    while (1) {
  ------------------
  |  Branch (1418:12): [True: 11.6k, Folded]
  ------------------
 1419|  11.6k|        if ( (BITv05_reloadDStream(&bitD)>BITv05_DStream_completed) || (op==omax) || (BITv05_endOfDStream(&bitD) && (fast || FSEv05_endOfDState(&state1))) )
  ------------------
  |  Branch (1419:14): [True: 168, False: 11.5k]
  |  Branch (1419:72): [True: 0, False: 11.5k]
  |  Branch (1419:87): [True: 281, False: 11.2k]
  |  Branch (1419:118): [True: 62, False: 219]
  |  Branch (1419:126): [True: 71, False: 148]
  ------------------
 1420|    301|            break;
 1421|       |
 1422|  11.3k|        *op++ = FSEv05_GETSYMBOL(&state1);
  ------------------
  |  | 1394|  11.3k|#define FSEv05_GETSYMBOL(statePtr) fast ? FSEv05_decodeSymbolFast(statePtr, &bitD) : FSEv05_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1394:36): [True: 3.67k, False: 7.71k]
  |  |  ------------------
  ------------------
 1423|       |
 1424|  11.3k|        if ( (BITv05_reloadDStream(&bitD)>BITv05_DStream_completed) || (op==omax) || (BITv05_endOfDStream(&bitD) && (fast || FSEv05_endOfDState(&state2))) )
  ------------------
  |  Branch (1424:14): [True: 148, False: 11.2k]
  |  Branch (1424:72): [True: 107, False: 11.1k]
  |  Branch (1424:87): [True: 418, False: 10.7k]
  |  Branch (1424:118): [True: 206, False: 212]
  |  Branch (1424:126): [True: 43, False: 169]
  ------------------
 1425|    504|            break;
 1426|       |
 1427|  10.8k|        *op++ = FSEv05_GETSYMBOL(&state2);
  ------------------
  |  | 1394|  10.8k|#define FSEv05_GETSYMBOL(statePtr) fast ? FSEv05_decodeSymbolFast(statePtr, &bitD) : FSEv05_decodeSymbol(statePtr, &bitD)
  |  |  ------------------
  |  |  |  Branch (1394:36): [True: 3.37k, False: 7.51k]
  |  |  ------------------
  ------------------
 1428|  10.8k|    }
 1429|       |
 1430|       |    /* end ? */
 1431|    805|    if (BITv05_endOfDStream(&bitD) && FSEv05_endOfDState(&state1) && FSEv05_endOfDState(&state2))
  ------------------
  |  Branch (1431:9): [True: 392, False: 413]
  |  Branch (1431:39): [True: 286, False: 106]
  |  Branch (1431:70): [True: 246, False: 40]
  ------------------
 1432|    246|        return op-ostart;
 1433|       |
 1434|    559|    if (op==omax) return ERROR(dstSize_tooSmall);   /* dst buffer is full, but cSrc unfinished */
  ------------------
  |  |   49|    107|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    107|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    107|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1434:9): [True: 107, False: 452]
  ------------------
 1435|       |
 1436|    452|    return ERROR(corruption_detected);
  ------------------
  |  |   49|    452|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    452|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    452|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1437|    559|}
zstd_v05.c:FSEv05_initDState:
  951|  2.69k|{
  952|  2.69k|    const void* ptr = dt;
  953|  2.69k|    const FSEv05_DTableHeader* const DTableH = (const FSEv05_DTableHeader*)ptr;
  954|  2.69k|    DStatePtr->state = BITv05_readBits(bitD, DTableH->tableLog);
  955|  2.69k|    BITv05_reloadDStream(bitD);
  956|  2.69k|    DStatePtr->table = dt + 1;
  957|  2.69k|}
zstd_v05.c:BITv05_readBits:
  790|   438k|{
  791|   438k|    size_t value = BITv05_lookBits(bitD, nbBits);
  792|   438k|    BITv05_skipBits(bitD, nbBits);
  793|   438k|    return value;
  794|   438k|}
zstd_v05.c:BITv05_lookBits:
  771|   438k|{
  772|   438k|    const U32 bitMask = sizeof(bitD->bitContainer)*8 - 1;
  773|   438k|    return ((bitD->bitContainer << (bitD->bitsConsumed & bitMask)) >> 1) >> ((bitMask-nbBits) & bitMask);
  774|   438k|}
zstd_v05.c:BITv05_skipBits:
  785|  4.63M|{
  786|  4.63M|    bitD->bitsConsumed += nbBits;
  787|  4.63M|}
zstd_v05.c:FSEv05_decodeSymbolFast:
  977|  16.2k|{
  978|  16.2k|    const FSEv05_decode_t DInfo = ((const FSEv05_decode_t*)(DStatePtr->table))[DStatePtr->state];
  979|  16.2k|    const U32 nbBits = DInfo.nbBits;
  980|  16.2k|    BYTE symbol = DInfo.symbol;
  981|  16.2k|    size_t lowBits = BITv05_readBitsFast(bitD, nbBits);
  982|       |
  983|  16.2k|    DStatePtr->state = DInfo.newState + lowBits;
  984|  16.2k|    return symbol;
  985|  16.2k|}
zstd_v05.c:BITv05_readBitsFast:
  799|  16.2k|{
  800|  16.2k|    size_t value = BITv05_lookBitsFast(bitD, nbBits);
  801|  16.2k|    BITv05_skipBits(bitD, nbBits);
  802|  16.2k|    return value;
  803|  16.2k|}
zstd_v05.c:BITv05_lookBitsFast:
  779|  4.20M|{
  780|  4.20M|    const U32 bitMask = sizeof(bitD->bitContainer)*8 - 1;
  781|  4.20M|    return (bitD->bitContainer << (bitD->bitsConsumed & bitMask)) >> (((bitMask+1)-nbBits) & bitMask);
  782|  4.20M|}
zstd_v05.c:FSEv05_decodeSymbol:
  966|   337k|{
  967|   337k|    const FSEv05_decode_t DInfo = ((const FSEv05_decode_t*)(DStatePtr->table))[DStatePtr->state];
  968|   337k|    const U32  nbBits = DInfo.nbBits;
  969|   337k|    BYTE symbol = DInfo.symbol;
  970|   337k|    size_t lowBits = BITv05_readBits(bitD, nbBits);
  971|       |
  972|   337k|    DStatePtr->state = DInfo.newState + lowBits;
  973|   337k|    return symbol;
  974|   337k|}
zstd_v05.c:FSEv05_endOfDState:
  988|  1.10k|{
  989|  1.10k|    return DStatePtr->state == 0;
  990|  1.10k|}
zstd_v05.c:HUFv05_readStats:
 1745|  1.50k|{
 1746|  1.50k|    U32 weightTotal;
 1747|  1.50k|    U32 tableLog;
 1748|  1.50k|    const BYTE* ip = (const BYTE*) src;
 1749|  1.50k|    size_t iSize;
 1750|  1.50k|    size_t oSize;
 1751|  1.50k|    U32 n;
 1752|       |
 1753|  1.50k|    if (!srcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   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 (1753:9): [True: 16, False: 1.48k]
  ------------------
 1754|  1.48k|    iSize = ip[0];
 1755|       |    /* memset(huffWeight, 0, hwSize); */   /* is not necessary, even though some analyzer complain ... */
 1756|       |
 1757|  1.48k|    if (iSize >= 128)  { /* special header */
  ------------------
  |  Branch (1757:9): [True: 456, False: 1.02k]
  ------------------
 1758|    456|        if (iSize >= (242)) {  /* RLE */
  ------------------
  |  Branch (1758:13): [True: 392, False: 64]
  ------------------
 1759|    392|            static int l[14] = { 1, 2, 3, 4, 7, 8, 15, 16, 31, 32, 63, 64, 127, 128 };
 1760|    392|            oSize = l[iSize-242];
 1761|    392|            memset(huffWeight, 1, hwSize);
 1762|    392|            iSize = 0;
 1763|    392|        }
 1764|     64|        else {   /* Incompressible */
 1765|     64|            oSize = iSize - 127;
 1766|     64|            iSize = ((oSize+1)/2);
 1767|     64|            if (iSize+1 > srcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   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 (1767:17): [True: 22, False: 42]
  ------------------
 1768|     42|            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: 42]
  ------------------
 1769|     42|            ip += 1;
 1770|    669|            for (n=0; n<oSize; n+=2) {
  ------------------
  |  Branch (1770:23): [True: 627, False: 42]
  ------------------
 1771|    627|                huffWeight[n]   = ip[n/2] >> 4;
 1772|    627|                huffWeight[n+1] = ip[n/2] & 15;
 1773|    627|    }   }   }
 1774|  1.02k|    else  {   /* header compressed with FSEv05 (normal case) */
 1775|  1.02k|        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 (1775:13): [True: 18, False: 1.01k]
  ------------------
 1776|  1.01k|        oSize = FSEv05_decompress(huffWeight, hwSize-1, ip+1, iSize);   /* max (hwSize-1) values decoded, as last one is implied */
 1777|  1.01k|        if (FSEv05_isError(oSize)) return oSize;
  ------------------
  |  Branch (1777:13): [True: 765, False: 246]
  ------------------
 1778|  1.01k|    }
 1779|       |
 1780|       |    /* collect weight stats */
 1781|    680|    memset(rankStats, 0, (HUFv05_ABSOLUTEMAX_TABLELOG + 1) * sizeof(U32));
  ------------------
  |  | 1711|    680|#define HUFv05_ABSOLUTEMAX_TABLELOG  16   /* absolute limit of HUFv05_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
 1782|    680|    weightTotal = 0;
 1783|  50.0k|    for (n=0; n<oSize; n++) {
  ------------------
  |  Branch (1783:15): [True: 49.3k, False: 661]
  ------------------
 1784|  49.3k|        if (huffWeight[n] >= HUFv05_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected);
  ------------------
  |  | 1711|  49.3k|#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|     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 (1784:13): [True: 19, False: 49.3k]
  ------------------
 1785|  49.3k|        rankStats[huffWeight[n]]++;
 1786|  49.3k|        weightTotal += (1 << huffWeight[n]) >> 1;
 1787|  49.3k|    }
 1788|    661|    if (weightTotal == 0) 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 (1788:9): [True: 13, False: 648]
  ------------------
 1789|       |
 1790|       |    /* get last non-null symbol weight (implied, total must be 2^n) */
 1791|    648|    tableLog = BITv05_highbit32(weightTotal) + 1;
 1792|    648|    if (tableLog > HUFv05_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected);
  ------------------
  |  | 1711|    648|#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|     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 (1792:9): [True: 18, False: 630]
  ------------------
 1793|    630|    {   /* determine last weight */
 1794|    630|        U32 total = 1 << tableLog;
 1795|    630|        U32 rest = total - weightTotal;
 1796|    630|        U32 verif = 1 << BITv05_highbit32(rest);
 1797|    630|        U32 lastWeight = BITv05_highbit32(rest) + 1;
 1798|    630|        if (verif != rest) return ERROR(corruption_detected);    /* last value must be a clean power of 2 */
  ------------------
  |  |   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 (1798:13): [True: 23, False: 607]
  ------------------
 1799|    607|        huffWeight[oSize] = (BYTE)lastWeight;
 1800|    607|        rankStats[lastWeight]++;
 1801|    607|    }
 1802|       |
 1803|       |    /* check tree construction validity */
 1804|    607|    if ((rankStats[1] < 2) || (rankStats[1] & 1)) return ERROR(corruption_detected);   /* by construction : at least 2 elts of rank 1, must be even */
  ------------------
  |  |   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 (1804:9): [True: 7, False: 600]
  |  Branch (1804:31): [True: 0, False: 600]
  ------------------
 1805|       |
 1806|       |    /* results */
 1807|    600|    *nbSymbolsPtr = (U32)(oSize+1);
 1808|    600|    *tableLogPtr = tableLog;
 1809|    600|    return iSize+1;
 1810|    607|}
zstd_v05.c:BITv05_initDStream:
  735|  1.85k|{
  736|  1.85k|    if (srcSize < 1) { memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   49|      9|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      9|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      9|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (736:9): [True: 9, False: 1.84k]
  ------------------
  737|       |
  738|  1.84k|    if (srcSize >=  sizeof(size_t)) {  /* normal case */
  ------------------
  |  Branch (738:9): [True: 1.26k, False: 577]
  ------------------
  739|  1.26k|        U32 contain32;
  740|  1.26k|        bitD->start = (const char*)srcBuffer;
  741|  1.26k|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(size_t);
  742|  1.26k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  743|  1.26k|        contain32 = ((const BYTE*)srcBuffer)[srcSize-1];
  744|  1.26k|        if (contain32 == 0) return ERROR(GENERIC);   /* endMark not present */
  ------------------
  |  |   49|    113|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    113|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    113|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (744:13): [True: 113, False: 1.15k]
  ------------------
  745|  1.15k|        bitD->bitsConsumed = 8 - BITv05_highbit32(contain32);
  746|  1.15k|    } else {
  747|    577|        U32 contain32;
  748|    577|        bitD->start = (const char*)srcBuffer;
  749|    577|        bitD->ptr   = bitD->start;
  750|    577|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  751|    577|        switch(srcSize)
  752|    577|        {
  753|     69|            case 7: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[6]) << (sizeof(size_t)*8 - 16);/* fall-through */
  ------------------
  |  Branch (753:13): [True: 69, False: 508]
  ------------------
  754|    126|            case 6: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[5]) << (sizeof(size_t)*8 - 24);/* fall-through */
  ------------------
  |  Branch (754:13): [True: 57, False: 520]
  ------------------
  755|    321|            case 5: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[4]) << (sizeof(size_t)*8 - 32);/* fall-through */
  ------------------
  |  Branch (755:13): [True: 195, False: 382]
  ------------------
  756|    384|            case 4: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[3]) << 24; /* fall-through */
  ------------------
  |  Branch (756:13): [True: 63, False: 514]
  ------------------
  757|    469|            case 3: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[2]) << 16; /* fall-through */
  ------------------
  |  Branch (757:13): [True: 85, False: 492]
  ------------------
  758|    518|            case 2: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[1]) <<  8; /* fall-through */
  ------------------
  |  Branch (758:13): [True: 49, False: 528]
  ------------------
  759|    577|            default: break;
  ------------------
  |  Branch (759:13): [True: 59, False: 518]
  ------------------
  760|    577|        }
  761|    577|        contain32 = ((const BYTE*)srcBuffer)[srcSize-1];
  762|    577|        if (contain32 == 0) return ERROR(GENERIC);   /* endMark not present */
  ------------------
  |  |   49|     66|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     66|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     66|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (762:13): [True: 66, False: 511]
  ------------------
  763|    511|        bitD->bitsConsumed = 8 - BITv05_highbit32(contain32);
  764|    511|        bitD->bitsConsumed += (U32)(sizeof(size_t) - srcSize)*8;
  765|    511|    }
  766|       |
  767|  1.66k|    return srcSize;
  768|  1.84k|}
zstd_v05.c:HUFv05_decodeStreamX2:
 1882|    359|{
 1883|    359|    BYTE* const pStart = p;
 1884|       |
 1885|       |    /* up to 4 symbols at a time */
 1886|  5.72k|    while ((BITv05_reloadDStream(bitDPtr) == BITv05_DStream_unfinished) && (p <= pEnd-4)) {
  ------------------
  |  Branch (1886:12): [True: 5.41k, False: 302]
  |  Branch (1886:76): [True: 5.36k, False: 57]
  ------------------
 1887|  5.36k|        HUFv05_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 1878|  5.36k|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 5.36k, False: 0]
  |  |  ------------------
  |  | 1879|  5.36k|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|  5.36k|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1888|  5.36k|        HUFv05_DECODE_SYMBOLX2_1(p, bitDPtr);
  ------------------
  |  | 1874|  5.36k|    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: 5.36k, False: 0]
  |  |  |  Branch (1874:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1875|  5.36k|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|  5.36k|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1889|  5.36k|        HUFv05_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 1878|  5.36k|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 5.36k, False: 0]
  |  |  ------------------
  |  | 1879|  5.36k|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|  5.36k|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1890|  5.36k|        HUFv05_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1871|  5.36k|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 1891|  5.36k|    }
 1892|       |
 1893|       |    /* closer to the end */
 1894|    463|    while ((BITv05_reloadDStream(bitDPtr) == BITv05_DStream_unfinished) && (p < pEnd))
  ------------------
  |  Branch (1894:12): [True: 149, False: 314]
  |  Branch (1894:76): [True: 104, False: 45]
  ------------------
 1895|    104|        HUFv05_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1871|    104|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 1896|       |
 1897|       |    /* no more data to retrieve from bitstream, hence no need to reload */
 1898|  4.15M|    while (p < pEnd)
  ------------------
  |  Branch (1898:12): [True: 4.15M, False: 359]
  ------------------
 1899|  4.15M|        HUFv05_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1871|  4.15M|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 1900|       |
 1901|    359|    return pEnd-pStart;
 1902|    359|}
zstd_v05.c:BITv05_endOfDStream:
  838|  23.8k|{
  839|  23.8k|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (839:13): [True: 23.5k, False: 283]
  |  Branch (839:49): [True: 1.09k, False: 22.4k]
  ------------------
  840|  23.8k|}
zstd_v05.c:BITv05_reloadDStream:
  806|   143k|{
  807|   143k|    if (bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))  /* should never happen */
  ------------------
  |  Branch (807:9): [True: 549, False: 142k]
  ------------------
  808|    549|        return BITv05_DStream_overflow;
  809|       |
  810|   142k|    if (bitD->ptr >= bitD->start + sizeof(bitD->bitContainer)) {
  ------------------
  |  Branch (810:9): [True: 108k, False: 33.6k]
  ------------------
  811|   108k|        bitD->ptr -= bitD->bitsConsumed >> 3;
  812|   108k|        bitD->bitsConsumed &= 7;
  813|   108k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  814|   108k|        return BITv05_DStream_unfinished;
  815|   108k|    }
  816|  33.6k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (816:9): [True: 25.8k, False: 7.79k]
  ------------------
  817|  25.8k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BITv05_DStream_endOfBuffer;
  ------------------
  |  Branch (817:13): [True: 25.0k, False: 752]
  ------------------
  818|    752|        return BITv05_DStream_completed;
  819|  25.8k|    }
  820|  7.79k|    {
  821|  7.79k|        U32 nbBytes = bitD->bitsConsumed >> 3;
  822|  7.79k|        BITv05_DStream_status result = BITv05_DStream_unfinished;
  823|  7.79k|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (823:13): [True: 247, False: 7.54k]
  ------------------
  824|    247|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  825|    247|            result = BITv05_DStream_endOfBuffer;
  826|    247|        }
  827|  7.79k|        bitD->ptr -= nbBytes;
  828|  7.79k|        bitD->bitsConsumed -= nbBytes*8;
  829|  7.79k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD) */
  830|  7.79k|        return result;
  831|  33.6k|    }
  832|  33.6k|}
zstd_v05.c:HUFv05_decodeSymbolX2:
 1863|  4.18M|{
 1864|  4.18M|        const size_t val = BITv05_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */
 1865|  4.18M|        const BYTE c = dt[val].byte;
 1866|  4.18M|        BITv05_skipBits(Dstream, dt[val].nbBits);
 1867|  4.18M|        return c;
 1868|  4.18M|}
zstd_v05.c:HUFv05_fillDTableX4:
 2105|    363|{
 2106|    363|    U32 rankVal[HUFv05_ABSOLUTEMAX_TABLELOG + 1];
 2107|    363|    const int scaleLog = nbBitsBaseline - targetLog;   /* note : targetLog >= srcLog, hence scaleLog <= 1 */
 2108|    363|    const U32 minBits  = nbBitsBaseline - maxWeight;
 2109|    363|    U32 s;
 2110|       |
 2111|    363|    memcpy(rankVal, rankValOrigin, sizeof(rankVal));
 2112|       |
 2113|       |    /* fill DTable */
 2114|  37.5k|    for (s=0; s<sortedListSize; s++) {
  ------------------
  |  Branch (2114:15): [True: 37.2k, False: 363]
  ------------------
 2115|  37.2k|        const U16 symbol = sortedList[s].symbol;
 2116|  37.2k|        const U32 weight = sortedList[s].weight;
 2117|  37.2k|        const U32 nbBits = nbBitsBaseline - weight;
 2118|  37.2k|        const U32 start = rankVal[weight];
 2119|  37.2k|        const U32 length = 1 << (targetLog-nbBits);
 2120|       |
 2121|  37.2k|        if (targetLog-nbBits >= minBits) {   /* enough room for a second symbol */
  ------------------
  |  Branch (2121:13): [True: 25.3k, False: 11.8k]
  ------------------
 2122|  25.3k|            U32 sortedRank;
 2123|  25.3k|            int minWeight = nbBits + scaleLog;
 2124|  25.3k|            if (minWeight < 1) minWeight = 1;
  ------------------
  |  Branch (2124:17): [True: 1.42k, False: 23.8k]
  ------------------
 2125|  25.3k|            sortedRank = rankStart[minWeight];
 2126|  25.3k|            HUFv05_fillDTableX4Level2(DTable+start, targetLog-nbBits, nbBits,
 2127|  25.3k|                           rankValOrigin[nbBits], minWeight,
 2128|  25.3k|                           sortedList+sortedRank, sortedListSize-sortedRank,
 2129|  25.3k|                           nbBitsBaseline, symbol);
 2130|  25.3k|        } else {
 2131|  11.8k|            U32 i;
 2132|  11.8k|            const U32 end = start + length;
 2133|  11.8k|            HUFv05_DEltX4 DElt;
 2134|       |
 2135|  11.8k|            MEM_writeLE16(&(DElt.sequence), symbol);
 2136|  11.8k|            DElt.nbBits   = (BYTE)(nbBits);
 2137|  11.8k|            DElt.length   = 1;
 2138|   383k|            for (i = start; i < end; i++)
  ------------------
  |  Branch (2138:29): [True: 371k, False: 11.8k]
  ------------------
 2139|   371k|                DTable[i] = DElt;
 2140|  11.8k|        }
 2141|  37.2k|        rankVal[weight] += length;
 2142|  37.2k|    }
 2143|    363|}
zstd_v05.c:HUFv05_fillDTableX4Level2:
 2062|  25.3k|{
 2063|  25.3k|    HUFv05_DEltX4 DElt;
 2064|  25.3k|    U32 rankVal[HUFv05_ABSOLUTEMAX_TABLELOG + 1];
 2065|  25.3k|    U32 s;
 2066|       |
 2067|       |    /* get pre-calculated rankVal */
 2068|  25.3k|    memcpy(rankVal, rankValOrigin, sizeof(rankVal));
 2069|       |
 2070|       |    /* fill skipped values */
 2071|  25.3k|    if (minWeight>1) {
  ------------------
  |  Branch (2071:9): [True: 23.3k, False: 1.97k]
  ------------------
 2072|  23.3k|        U32 i, skipSize = rankVal[minWeight];
 2073|  23.3k|        MEM_writeLE16(&(DElt.sequence), baseSeq);
 2074|  23.3k|        DElt.nbBits   = (BYTE)(consumed);
 2075|  23.3k|        DElt.length   = 1;
 2076|   186k|        for (i = 0; i < skipSize; i++)
  ------------------
  |  Branch (2076:21): [True: 162k, False: 23.3k]
  ------------------
 2077|   162k|            DTable[i] = DElt;
 2078|  23.3k|    }
 2079|       |
 2080|       |    /* fill DTable */
 2081|   143k|    for (s=0; s<sortedListSize; s++) {   /* note : sortedSymbols already skipped */
  ------------------
  |  Branch (2081:15): [True: 118k, False: 25.3k]
  ------------------
 2082|   118k|        const U32 symbol = sortedSymbols[s].symbol;
 2083|   118k|        const U32 weight = sortedSymbols[s].weight;
 2084|   118k|        const U32 nbBits = nbBitsBaseline - weight;
 2085|   118k|        const U32 length = 1 << (sizeLog-nbBits);
 2086|   118k|        const U32 start = rankVal[weight];
 2087|   118k|        U32 i = start;
 2088|   118k|        const U32 end = start + length;
 2089|       |
 2090|   118k|        MEM_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8)));
 2091|   118k|        DElt.nbBits = (BYTE)(nbBits + consumed);
 2092|   118k|        DElt.length = 2;
 2093|   952k|        do { DTable[i++] = DElt; } while (i<end);   /* since length >= 1 */
  ------------------
  |  Branch (2093:43): [True: 833k, False: 118k]
  ------------------
 2094|       |
 2095|   118k|        rankVal[weight] += length;
 2096|   118k|    }
 2097|  25.3k|}
zstd_v05.c:HUFv05_decodeStreamX4:
 2258|     47|{
 2259|     47|    BYTE* const pStart = p;
 2260|       |
 2261|       |    /* up to 8 symbols at a time */
 2262|    233|    while ((BITv05_reloadDStream(bitDPtr) == BITv05_DStream_unfinished) && (p < pEnd-7)) {
  ------------------
  |  Branch (2262:12): [True: 209, False: 24]
  |  Branch (2262:76): [True: 186, False: 23]
  ------------------
 2263|    186|        HUFv05_DECODE_SYMBOLX4_2(p, bitDPtr);
  ------------------
  |  | 2254|    186|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2254:9): [True: 186, False: 0]
  |  |  ------------------
  |  | 2255|    186|        ptr += HUFv05_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2264|    186|        HUFv05_DECODE_SYMBOLX4_1(p, bitDPtr);
  ------------------
  |  | 2250|    186|    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: 186, False: 0]
  |  |  |  Branch (2250:25): [True: 0, Folded]
  |  |  ------------------
  |  | 2251|    186|        ptr += HUFv05_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2265|    186|        HUFv05_DECODE_SYMBOLX4_2(p, bitDPtr);
  ------------------
  |  | 2254|    186|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2254:9): [True: 186, False: 0]
  |  |  ------------------
  |  | 2255|    186|        ptr += HUFv05_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2266|    186|        HUFv05_DECODE_SYMBOLX4_0(p, bitDPtr);
  ------------------
  |  | 2247|    186|    ptr += HUFv05_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2267|    186|    }
 2268|       |
 2269|       |    /* closer to the end */
 2270|     69|    while ((BITv05_reloadDStream(bitDPtr) == BITv05_DStream_unfinished) && (p <= pEnd-2))
  ------------------
  |  Branch (2270:12): [True: 42, False: 27]
  |  Branch (2270:76): [True: 22, False: 20]
  ------------------
 2271|     22|        HUFv05_DECODE_SYMBOLX4_0(p, bitDPtr);
  ------------------
  |  | 2247|     22|    ptr += HUFv05_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2272|       |
 2273|  2.60k|    while (p <= pEnd-2)
  ------------------
  |  Branch (2273:12): [True: 2.56k, False: 47]
  ------------------
 2274|  2.56k|        HUFv05_DECODE_SYMBOLX4_0(p, bitDPtr);   /* no need to reload : reached the end of DStream */
  ------------------
  |  | 2247|  2.56k|    ptr += HUFv05_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
  ------------------
 2275|       |
 2276|     47|    if (p < pEnd)
  ------------------
  |  Branch (2276:9): [True: 23, False: 24]
  ------------------
 2277|     23|        p += HUFv05_decodeLastSymbolX4(p, bitDPtr, dt, dtLog);
 2278|       |
 2279|     47|    return p-pStart;
 2280|     47|}
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: 13, False: 10]
  ------------------
 2236|     10|    else {
 2237|     10|        if (DStream->bitsConsumed < (sizeof(DStream->bitContainer)*8)) {
  ------------------
  |  Branch (2237:13): [True: 6, False: 4]
  ------------------
 2238|      6|            BITv05_skipBits(DStream, dt[val].nbBits);
 2239|      6|            if (DStream->bitsConsumed > (sizeof(DStream->bitContainer)*8))
  ------------------
  |  Branch (2239:17): [True: 0, False: 6]
  ------------------
 2240|      0|                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|      6|    }   }
 2242|     23|    return 1;
 2243|     23|}
zstd_v05.c:HUFv05_decodeSymbolX4:
 2224|  3.32k|{
 2225|  3.32k|    const size_t val = BITv05_lookBitsFast(DStream, dtLog);   /* note : dtLog >= 1 */
 2226|  3.32k|    memcpy(op, dt+val, 2);
 2227|  3.32k|    BITv05_skipBits(DStream, dt[val].nbBits);
 2228|  3.32k|    return dt[val].length;
 2229|  3.32k|}
zstd_v05.c:ZSTDv05_checkContinuity:
 3330|  2.04k|{
 3331|  2.04k|    if (dst != dctx->previousDstEnd) {   /* not contiguous */
  ------------------
  |  Branch (3331:9): [True: 2.04k, False: 0]
  ------------------
 3332|  2.04k|        dctx->dictEnd = dctx->previousDstEnd;
 3333|  2.04k|        dctx->vBase = (const char*)dst - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->base));
 3334|  2.04k|        dctx->base = dst;
 3335|  2.04k|        dctx->previousDstEnd = dst;
 3336|  2.04k|    }
 3337|  2.04k|}
zstd_v05.c:ZSTDv05_decompressBlock_internal:
 3343|  1.03k|{   /* blockType == blockCompressed */
 3344|  1.03k|    const BYTE* ip = (const BYTE*)src;
 3345|  1.03k|    size_t litCSize;
 3346|       |
 3347|  1.03k|    if (srcSize >= BLOCKSIZE) return ERROR(srcSize_wrong);
  ------------------
  |  |  396|  1.03k|#define BLOCKSIZE (128 KB)                 /* define, for static allocation */
  |  |  ------------------
  |  |  |  |  392|  1.03k|#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: 1.03k]
  ------------------
 3348|       |
 3349|       |    /* Decode literals sub-block */
 3350|  1.03k|    litCSize = ZSTDv05_decodeLiteralsBlock(dctx, src, srcSize);
 3351|  1.03k|    if (ZSTDv05_isError(litCSize)) return litCSize;
  ------------------
  |  Branch (3351:9): [True: 563, False: 467]
  ------------------
 3352|    467|    ip += litCSize;
 3353|    467|    srcSize -= litCSize;
 3354|       |
 3355|    467|    return ZSTDv05_decompressSequences(dctx, dst, dstCapacity, ip, srcSize);
 3356|  1.03k|}
zstd_v05.c:ZSTDv05_decodeLiteralsBlock:
 2812|  1.03k|{
 2813|  1.03k|    const BYTE* const istart = (const BYTE*) src;
 2814|       |
 2815|       |    /* any compressed block with literals segment must be at least this size */
 2816|  1.03k|    if (srcSize < MIN_CBLOCK_SIZE) return ERROR(corruption_detected);
  ------------------
  |  |  439|  1.03k|#define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */ + MIN_SEQUENCES_SIZE /* nbSeq==0 */)   /* for a non-null block */
  |  |  ------------------
  |  |  |  |  438|  1.03k|#define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */
  |  |  ------------------
  ------------------
                  if (srcSize < MIN_CBLOCK_SIZE) return ERROR(corruption_detected);
  ------------------
  |  |   49|    128|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    128|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    128|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2816:9): [True: 128, False: 902]
  ------------------
 2817|       |
 2818|    902|    switch(istart[0]>> 6)
 2819|    902|    {
 2820|    355|    case IS_HUFv05:
  ------------------
  |  |  409|    355|#define IS_HUFv05 0
  ------------------
  |  Branch (2820:5): [True: 355, False: 547]
  ------------------
 2821|    355|        {
 2822|    355|            size_t litSize, litCSize, singleStream=0;
 2823|    355|            U32 lhSize = ((istart[0]) >> 4) & 3;
 2824|    355|            if (srcSize < 5) return ERROR(corruption_detected);   /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3 */
  ------------------
  |  |   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 (2824:17): [True: 1, False: 354]
  ------------------
 2825|    354|            switch(lhSize)
 2826|    354|            {
 2827|    151|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (2827:13): [True: 71, False: 283]
  |  Branch (2827:21): [True: 80, False: 274]
  |  Branch (2827:29): [True: 0, False: 354]
  ------------------
 2828|       |                /* 2 - 2 - 10 - 10 */
 2829|    151|                lhSize=3;
 2830|    151|                singleStream = istart[0] & 16;
 2831|    151|                litSize  = ((istart[0] & 15) << 6) + (istart[1] >> 2);
 2832|    151|                litCSize = ((istart[1] &  3) << 8) + istart[2];
 2833|    151|                break;
 2834|     18|            case 2:
  ------------------
  |  Branch (2834:13): [True: 18, False: 336]
  ------------------
 2835|       |                /* 2 - 2 - 14 - 14 */
 2836|     18|                lhSize=4;
 2837|     18|                litSize  = ((istart[0] & 15) << 10) + (istart[1] << 2) + (istart[2] >> 6);
 2838|     18|                litCSize = ((istart[2] & 63) <<  8) + istart[3];
 2839|     18|                break;
 2840|    185|            case 3:
  ------------------
  |  Branch (2840:13): [True: 185, False: 169]
  ------------------
 2841|       |                /* 2 - 2 - 18 - 18 */
 2842|    185|                lhSize=5;
 2843|    185|                litSize  = ((istart[0] & 15) << 14) + (istart[1] << 6) + (istart[2] >> 2);
 2844|    185|                litCSize = ((istart[2] &  3) << 16) + (istart[3] << 8) + istart[4];
 2845|    185|                break;
 2846|    354|            }
 2847|    354|            if (litSize > BLOCKSIZE) return ERROR(corruption_detected);
  ------------------
  |  |  396|    354|#define BLOCKSIZE (128 KB)                 /* define, for static allocation */
  |  |  ------------------
  |  |  |  |  392|    354|#define KB *(1 <<10)
  |  |  ------------------
  ------------------
                          if (litSize > BLOCKSIZE) 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 (2847:17): [True: 3, False: 351]
  ------------------
 2848|    351|            if (litCSize + lhSize > srcSize) 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 (2848:17): [True: 37, False: 314]
  ------------------
 2849|       |
 2850|    314|            if (HUFv05_isError(singleStream ?
  ------------------
  |  Branch (2850:17): [True: 297, False: 17]
  |  Branch (2850:32): [True: 79, False: 235]
  ------------------
 2851|     79|                            HUFv05_decompress1X2(dctx->litBuffer, litSize, istart+lhSize, litCSize) :
 2852|    314|                            HUFv05_decompress   (dctx->litBuffer, litSize, istart+lhSize, litCSize) ))
 2853|    297|                return ERROR(corruption_detected);
  ------------------
  |  |   49|    297|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    297|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    297|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2854|       |
 2855|     17|            dctx->litPtr = dctx->litBuffer;
 2856|     17|            dctx->litSize = litSize;
 2857|     17|            memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |  441|     17|#define WILDCOPY_OVERLENGTH 8
  ------------------
 2858|     17|            return litCSize + lhSize;
 2859|    314|        }
 2860|     75|    case IS_PCH:
  ------------------
  |  |  410|     75|#define IS_PCH 1
  ------------------
  |  Branch (2860:5): [True: 75, False: 827]
  ------------------
 2861|     75|        {
 2862|     75|            size_t errorCode;
 2863|     75|            size_t litSize, litCSize;
 2864|     75|            U32 lhSize = ((istart[0]) >> 4) & 3;
 2865|     75|            if (lhSize != 1)  /* only case supported for now : small litSize, single stream */
  ------------------
  |  Branch (2865:17): [True: 3, False: 72]
  ------------------
 2866|      3|                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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2867|     72|            if (!dctx->flagStaticTables)
  ------------------
  |  Branch (2867:17): [True: 7, False: 65]
  ------------------
 2868|      7|                return ERROR(dictionary_corrupted);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2869|       |
 2870|       |            /* 2 - 2 - 10 - 10 */
 2871|     65|            lhSize=3;
 2872|     65|            litSize  = ((istart[0] & 15) << 6) + (istart[1] >> 2);
 2873|     65|            litCSize = ((istart[1] &  3) << 8) + istart[2];
 2874|     65|            if (litCSize + lhSize > srcSize) 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 (2874:17): [True: 3, False: 62]
  ------------------
 2875|       |
 2876|     62|            errorCode = HUFv05_decompress1X4_usingDTable(dctx->litBuffer, litSize, istart+lhSize, litCSize, dctx->hufTableX4);
 2877|     62|            if (HUFv05_isError(errorCode)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     61|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     61|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     61|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2877:17): [True: 61, 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|     62|        }
 2884|     28|    case IS_RAW:
  ------------------
  |  |  411|     28|#define IS_RAW 2
  ------------------
  |  Branch (2884:5): [True: 28, False: 874]
  ------------------
 2885|     28|        {
 2886|     28|            size_t litSize;
 2887|     28|            U32 lhSize = ((istart[0]) >> 4) & 3;
 2888|     28|            switch(lhSize)
 2889|     28|            {
 2890|     16|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (2890:13): [True: 10, False: 18]
  |  Branch (2890:21): [True: 6, False: 22]
  |  Branch (2890:29): [True: 0, False: 28]
  ------------------
 2891|     16|                lhSize=1;
 2892|     16|                litSize = istart[0] & 31;
 2893|     16|                break;
 2894|      6|            case 2:
  ------------------
  |  Branch (2894:13): [True: 6, False: 22]
  ------------------
 2895|      6|                litSize = ((istart[0] & 15) << 8) + istart[1];
 2896|      6|                break;
 2897|      6|            case 3:
  ------------------
  |  Branch (2897:13): [True: 6, False: 22]
  ------------------
 2898|      6|                litSize = ((istart[0] & 15) << 16) + (istart[1] << 8) + istart[2];
 2899|      6|                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|     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 (2903:21): [True: 13, False: 5]
  ------------------
 2904|      5|                memcpy(dctx->litBuffer, istart+lhSize, litSize);
 2905|      5|                dctx->litPtr = dctx->litBuffer;
 2906|      5|                dctx->litSize = litSize;
 2907|      5|                memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |  441|      5|#define WILDCOPY_OVERLENGTH 8
  ------------------
 2908|      5|                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|    444|    case IS_RLE:
  ------------------
  |  |  412|    444|#define IS_RLE 3
  ------------------
  |  Branch (2915:5): [True: 444, False: 458]
  ------------------
 2916|    444|        {
 2917|    444|            size_t litSize;
 2918|    444|            U32 lhSize = ((istart[0]) >> 4) & 3;
 2919|    444|            switch(lhSize)
 2920|    444|            {
 2921|     88|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (2921:13): [True: 2, False: 442]
  |  Branch (2921:21): [True: 86, False: 358]
  |  Branch (2921:29): [True: 0, False: 444]
  ------------------
 2922|     88|                lhSize = 1;
 2923|     88|                litSize = istart[0] & 31;
 2924|     88|                break;
 2925|    274|            case 2:
  ------------------
  |  Branch (2925:13): [True: 274, False: 170]
  ------------------
 2926|    274|                litSize = ((istart[0] & 15) << 8) + istart[1];
 2927|    274|                break;
 2928|     82|            case 3:
  ------------------
  |  Branch (2928:13): [True: 82, False: 362]
  ------------------
 2929|     82|                litSize = ((istart[0] & 15) << 16) + (istart[1] << 8) + istart[2];
 2930|     82|                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: 81]
  ------------------
 2931|     81|                break;
 2932|    444|            }
 2933|    443|            if (litSize > BLOCKSIZE) return ERROR(corruption_detected);
  ------------------
  |  |  396|    443|#define BLOCKSIZE (128 KB)                 /* define, for static allocation */
  |  |  ------------------
  |  |  |  |  392|    443|#define KB *(1 <<10)
  |  |  ------------------
  ------------------
                          if (litSize > BLOCKSIZE) 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 (2933:17): [True: 9, False: 434]
  ------------------
 2934|    434|            memset(dctx->litBuffer, istart[lhSize], litSize + WILDCOPY_OVERLENGTH);
  ------------------
  |  |  441|    434|#define WILDCOPY_OVERLENGTH 8
  ------------------
 2935|    434|            dctx->litPtr = dctx->litBuffer;
 2936|    434|            dctx->litSize = litSize;
 2937|    434|            return lhSize+1;
 2938|    443|        }
 2939|      0|    default:
  ------------------
  |  Branch (2939:5): [True: 0, False: 902]
  ------------------
 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|    902|    }
 2942|    902|}
zstd_v05.c:ZSTDv05_decompressSequences:
 3260|    467|{
 3261|    467|    const BYTE* ip = (const BYTE*)seqStart;
 3262|    467|    const BYTE* const iend = ip + seqSize;
 3263|    467|    BYTE* const ostart = (BYTE*)dst;
 3264|    467|    BYTE* op = ostart;
 3265|    467|    BYTE* const oend = ostart + maxDstSize;
 3266|    467|    size_t errorCode, dumpsLength=0;
 3267|    467|    const BYTE* litPtr = dctx->litPtr;
 3268|    467|    const BYTE* const litEnd = litPtr + dctx->litSize;
 3269|    467|    int nbSeq=0;
 3270|    467|    const BYTE* dumps = NULL;
 3271|    467|    unsigned* DTableLL = dctx->LLTable;
 3272|    467|    unsigned* DTableML = dctx->MLTable;
 3273|    467|    unsigned* DTableOffb = dctx->OffTable;
 3274|    467|    const BYTE* const base = (const BYTE*) (dctx->base);
 3275|    467|    const BYTE* const vBase = (const BYTE*) (dctx->vBase);
 3276|    467|    const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd);
 3277|       |
 3278|       |    /* Build Decoding Tables */
 3279|    467|    errorCode = ZSTDv05_decodeSeqHeaders(&nbSeq, &dumps, &dumpsLength,
 3280|    467|                                      DTableLL, DTableML, DTableOffb,
 3281|    467|                                      ip, seqSize, dctx->flagStaticTables);
 3282|    467|    if (ZSTDv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (3282:9): [True: 67, False: 400]
  ------------------
 3283|    400|    ip += errorCode;
 3284|       |
 3285|       |    /* Regen sequences */
 3286|    400|    if (nbSeq) {
  ------------------
  |  Branch (3286:9): [True: 369, False: 31]
  ------------------
 3287|    369|        seq_t sequence;
 3288|    369|        seqState_t seqState;
 3289|       |
 3290|    369|        memset(&sequence, 0, sizeof(sequence));
 3291|    369|        sequence.offset = REPCODE_STARTVALUE;
  ------------------
  |  |  415|    369|#define REPCODE_STARTVALUE 1
  ------------------
 3292|    369|        seqState.dumps = dumps;
 3293|    369|        seqState.dumpsEnd = dumps + dumpsLength;
 3294|    369|        seqState.prevOffset = REPCODE_STARTVALUE;
  ------------------
  |  |  415|    369|#define REPCODE_STARTVALUE 1
  ------------------
 3295|    369|        errorCode = BITv05_initDStream(&(seqState.DStream), ip, iend-ip);
 3296|    369|        if (ERR_isError(errorCode)) 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 (3296:13): [True: 7, False: 362]
  ------------------
 3297|    362|        FSEv05_initDState(&(seqState.stateLL), &(seqState.DStream), DTableLL);
 3298|    362|        FSEv05_initDState(&(seqState.stateOffb), &(seqState.DStream), DTableOffb);
 3299|    362|        FSEv05_initDState(&(seqState.stateML), &(seqState.DStream), DTableML);
 3300|       |
 3301|  98.5k|        for ( ; (BITv05_reloadDStream(&(seqState.DStream)) <= BITv05_DStream_completed) && nbSeq ; ) {
  ------------------
  |  Branch (3301:17): [True: 98.4k, False: 94]
  |  Branch (3301:92): [True: 98.3k, False: 33]
  ------------------
 3302|  98.3k|            size_t oneSeqSize;
 3303|  98.3k|            nbSeq--;
 3304|  98.3k|            ZSTDv05_decodeSequence(&sequence, &seqState);
 3305|  98.3k|            oneSeqSize = ZSTDv05_execSequence(op, oend, sequence, &litPtr, litEnd, base, vBase, dictEnd);
 3306|  98.3k|            if (ZSTDv05_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  Branch (3306:17): [True: 235, False: 98.1k]
  ------------------
 3307|  98.1k|            op += oneSeqSize;
 3308|  98.1k|        }
 3309|       |
 3310|       |        /* check if reached exact end */
 3311|    127|        if (nbSeq) return ERROR(corruption_detected);
  ------------------
  |  |   49|     93|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     93|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     93|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3311:13): [True: 93, False: 34]
  ------------------
 3312|    127|    }
 3313|       |
 3314|       |    /* last literal segment */
 3315|     65|    {
 3316|     65|        size_t lastLLSize = litEnd - litPtr;
 3317|     65|        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: 65]
  ------------------
 3318|     65|        if (op+lastLLSize > oend) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   49|      2|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      2|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      2|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3318:13): [True: 2, False: 63]
  ------------------
 3319|     63|        if (lastLLSize > 0) {
  ------------------
  |  Branch (3319:13): [True: 61, False: 2]
  ------------------
 3320|     61|            memcpy(op, litPtr, lastLLSize);
 3321|     61|            op += lastLLSize;
 3322|     61|        }
 3323|     63|    }
 3324|       |
 3325|      0|    return op-ostart;
 3326|     65|}
zstd_v05.c:ZSTDv05_decodeSeqHeaders:
 2948|    467|{
 2949|    467|    const BYTE* const istart = (const BYTE*)src;
 2950|    467|    const BYTE* ip = istart;
 2951|    467|    const BYTE* const iend = istart + srcSize;
 2952|    467|    U32 LLtype, Offtype, MLtype;
 2953|    467|    unsigned LLlog, Offlog, MLlog;
 2954|    467|    size_t dumpsLength;
 2955|       |
 2956|       |    /* check */
 2957|    467|    if (srcSize < MIN_SEQUENCES_SIZE)
  ------------------
  |  |  438|    467|#define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */
  ------------------
  |  Branch (2957:9): [True: 1, False: 466]
  ------------------
 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|    466|    *nbSeq = *ip++;
 2962|    466|    if (*nbSeq==0) return 1;
  ------------------
  |  Branch (2962:9): [True: 26, False: 440]
  ------------------
 2963|    440|    if (*nbSeq >= 128) {
  ------------------
  |  Branch (2963:9): [True: 290, False: 150]
  ------------------
 2964|    290|        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: 289]
  ------------------
 2965|    289|        *nbSeq = ((nbSeq[0]-128)<<8) + *ip++;
 2966|    289|    }
 2967|       |
 2968|    439|    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: 438]
  ------------------
 2969|    438|    LLtype  = *ip >> 6;
 2970|    438|    Offtype = (*ip >> 4) & 3;
 2971|    438|    MLtype  = (*ip >> 2) & 3;
 2972|    438|    if (*ip & 2) {
  ------------------
  |  Branch (2972:9): [True: 121, False: 317]
  ------------------
 2973|    121|        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: 120]
  ------------------
 2974|    120|        dumpsLength  = ip[2];
 2975|    120|        dumpsLength += ip[1] << 8;
 2976|    120|        ip += 3;
 2977|    317|    } else {
 2978|    317|        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 (2978:13): [True: 1, False: 316]
  ------------------
 2979|    316|        dumpsLength  = ip[1];
 2980|    316|        dumpsLength += (ip[0] & 1) << 8;
 2981|    316|        ip += 2;
 2982|    316|    }
 2983|    436|    *dumpsPtr = ip;
 2984|    436|    ip += dumpsLength;
 2985|    436|    *dumpsLengthPtr = dumpsLength;
 2986|       |
 2987|       |    /* check */
 2988|    436|    if (ip > iend-3) return ERROR(srcSize_wrong); /* min : all 3 are "raw", hence no header, but at least xxLog bits per type */
  ------------------
  |  |   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 (2988:9): [True: 10, False: 426]
  ------------------
 2989|       |
 2990|       |    /* sequences */
 2991|    426|    {
 2992|    426|        S16 norm[MaxML+1];    /* assumption : MaxML >= MaxLL >= MaxOff */
 2993|    426|        size_t headerSize;
 2994|       |
 2995|       |        /* Build DTables */
 2996|    426|        switch(LLtype)
 2997|    426|        {
 2998|     22|        case FSEv05_ENCODING_RLE :
  ------------------
  |  |  431|     22|#define FSEv05_ENCODING_RLE     1
  ------------------
  |  Branch (2998:9): [True: 22, False: 404]
  ------------------
 2999|     22|            LLlog = 0;
 3000|     22|            FSEv05_buildDTable_rle(DTableLL, *ip++);
 3001|     22|            break;
 3002|    256|        case FSEv05_ENCODING_RAW :
  ------------------
  |  |  430|    256|#define FSEv05_ENCODING_RAW     0
  ------------------
  |  Branch (3002:9): [True: 256, False: 170]
  ------------------
 3003|    256|            LLlog = LLbits;
  ------------------
  |  |  419|    256|#define LLbits   6
  ------------------
 3004|    256|            FSEv05_buildDTable_raw(DTableLL, LLbits);
  ------------------
  |  |  419|    256|#define LLbits   6
  ------------------
 3005|    256|            break;
 3006|      3|        case FSEv05_ENCODING_STATIC:
  ------------------
  |  |  432|      3|#define FSEv05_ENCODING_STATIC  2
  ------------------
  |  Branch (3006:9): [True: 3, False: 423]
  ------------------
 3007|      3|            if (!flagStaticTable) 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 (3007:17): [True: 2, False: 1]
  ------------------
 3008|      1|            break;
 3009|    145|        case FSEv05_ENCODING_DYNAMIC :
  ------------------
  |  |  433|    145|#define FSEv05_ENCODING_DYNAMIC 3
  ------------------
  |  Branch (3009:9): [True: 145, False: 281]
  ------------------
 3010|    145|        default :   /* impossible */
  ------------------
  |  Branch (3010:9): [True: 0, False: 426]
  ------------------
 3011|    145|            {   unsigned max = MaxLL;
  ------------------
  |  |  423|    145|#define MaxLL  ((1<<LLbits) - 1)
  |  |  ------------------
  |  |  |  |  419|    145|#define LLbits   6
  |  |  ------------------
  ------------------
 3012|    145|                headerSize = FSEv05_readNCount(norm, &max, &LLlog, ip, iend-ip);
 3013|    145|                if (FSEv05_isError(headerSize)) return ERROR(GENERIC);
  ------------------
  |  |   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 (3013:21): [True: 2, False: 143]
  ------------------
 3014|    143|                if (LLlog > LLFSEv05Log) return ERROR(corruption_detected);
  ------------------
  |  |  426|    143|#define LLFSEv05Log   10
  ------------------
                              if (LLlog > LLFSEv05Log) 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 (3014:21): [True: 3, False: 140]
  ------------------
 3015|    140|                ip += headerSize;
 3016|    140|                FSEv05_buildDTable(DTableLL, norm, max, LLlog);
 3017|    140|        }   }
 3018|       |
 3019|    419|        switch(Offtype)
 3020|    419|        {
 3021|     67|        case FSEv05_ENCODING_RLE :
  ------------------
  |  |  431|     67|#define FSEv05_ENCODING_RLE     1
  ------------------
  |  Branch (3021:9): [True: 67, False: 352]
  ------------------
 3022|     67|            Offlog = 0;
 3023|     67|            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: 66]
  ------------------
 3024|     66|            FSEv05_buildDTable_rle(DTableOffb, *ip++ & MaxOff); /* if *ip > MaxOff, data is corrupted */
  ------------------
  |  |  424|     66|#define MaxOff ((1<<Offbits)- 1)
  |  |  ------------------
  |  |  |  |  420|     66|#define Offbits  5
  |  |  ------------------
  ------------------
 3025|     66|            break;
 3026|     61|        case FSEv05_ENCODING_RAW :
  ------------------
  |  |  430|     61|#define FSEv05_ENCODING_RAW     0
  ------------------
  |  Branch (3026:9): [True: 61, False: 358]
  ------------------
 3027|     61|            Offlog = Offbits;
  ------------------
  |  |  420|     61|#define Offbits  5
  ------------------
 3028|     61|            FSEv05_buildDTable_raw(DTableOffb, Offbits);
  ------------------
  |  |  420|     61|#define Offbits  5
  ------------------
 3029|     61|            break;
 3030|      2|        case FSEv05_ENCODING_STATIC:
  ------------------
  |  |  432|      2|#define FSEv05_ENCODING_STATIC  2
  ------------------
  |  Branch (3030:9): [True: 2, False: 417]
  ------------------
 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|    289|        case FSEv05_ENCODING_DYNAMIC :
  ------------------
  |  |  433|    289|#define FSEv05_ENCODING_DYNAMIC 3
  ------------------
  |  Branch (3033:9): [True: 289, False: 130]
  ------------------
 3034|    289|        default :   /* impossible */
  ------------------
  |  Branch (3034:9): [True: 0, False: 419]
  ------------------
 3035|    289|            {   unsigned max = MaxOff;
  ------------------
  |  |  424|    289|#define MaxOff ((1<<Offbits)- 1)
  |  |  ------------------
  |  |  |  |  420|    289|#define Offbits  5
  |  |  ------------------
  ------------------
 3036|    289|                headerSize = FSEv05_readNCount(norm, &max, &Offlog, ip, iend-ip);
 3037|    289|                if (FSEv05_isError(headerSize)) return ERROR(GENERIC);
  ------------------
  |  |   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 (3037:21): [True: 16, False: 273]
  ------------------
 3038|    273|                if (Offlog > OffFSEv05Log) return ERROR(corruption_detected);
  ------------------
  |  |  427|    273|#define OffFSEv05Log   9
  ------------------
                              if (Offlog > OffFSEv05Log) 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 (3038:21): [True: 6, False: 267]
  ------------------
 3039|    267|                ip += headerSize;
 3040|    267|                FSEv05_buildDTable(DTableOffb, norm, max, Offlog);
 3041|    267|        }   }
 3042|       |
 3043|    395|        switch(MLtype)
 3044|    395|        {
 3045|    106|        case FSEv05_ENCODING_RLE :
  ------------------
  |  |  431|    106|#define FSEv05_ENCODING_RLE     1
  ------------------
  |  Branch (3045:9): [True: 106, False: 289]
  ------------------
 3046|    106|            MLlog = 0;
 3047|    106|            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: 105]
  ------------------
 3048|    105|            FSEv05_buildDTable_rle(DTableML, *ip++);
 3049|    105|            break;
 3050|    182|        case FSEv05_ENCODING_RAW :
  ------------------
  |  |  430|    182|#define FSEv05_ENCODING_RAW     0
  ------------------
  |  Branch (3050:9): [True: 182, False: 213]
  ------------------
 3051|    182|            MLlog = MLbits;
  ------------------
  |  |  418|    182|#define MLbits   7
  ------------------
 3052|    182|            FSEv05_buildDTable_raw(DTableML, MLbits);
  ------------------
  |  |  418|    182|#define MLbits   7
  ------------------
 3053|    182|            break;
 3054|      5|        case FSEv05_ENCODING_STATIC:
  ------------------
  |  |  432|      5|#define FSEv05_ENCODING_STATIC  2
  ------------------
  |  Branch (3054:9): [True: 5, False: 390]
  ------------------
 3055|      5|            if (!flagStaticTable) return ERROR(corruption_detected);
  ------------------
  |  |   49|      4|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      4|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      4|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3055:17): [True: 4, False: 1]
  ------------------
 3056|      1|            break;
 3057|    102|        case FSEv05_ENCODING_DYNAMIC :
  ------------------
  |  |  433|    102|#define FSEv05_ENCODING_DYNAMIC 3
  ------------------
  |  Branch (3057:9): [True: 102, False: 293]
  ------------------
 3058|    102|        default :   /* impossible */
  ------------------
  |  Branch (3058:9): [True: 0, False: 395]
  ------------------
 3059|    102|            {   unsigned max = MaxML;
  ------------------
  |  |  422|    102|#define MaxML  ((1<<MLbits) - 1)
  |  |  ------------------
  |  |  |  |  418|    102|#define MLbits   7
  |  |  ------------------
  ------------------
 3060|    102|                headerSize = FSEv05_readNCount(norm, &max, &MLlog, ip, iend-ip);
 3061|    102|                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: 89]
  ------------------
 3062|     89|                if (MLlog > MLFSEv05Log) return ERROR(corruption_detected);
  ------------------
  |  |  425|     89|#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: 86]
  ------------------
 3063|     86|                ip += headerSize;
 3064|     86|                FSEv05_buildDTable(DTableML, norm, max, MLlog);
 3065|     86|    }   }   }
 3066|       |
 3067|    374|    return ip-istart;
 3068|    395|}
zstd_v05.c:ZSTDv05_decodeSequence:
 3090|  98.3k|{
 3091|  98.3k|    size_t litLength;
 3092|  98.3k|    size_t prevOffset;
 3093|  98.3k|    size_t offset;
 3094|  98.3k|    size_t matchLength;
 3095|  98.3k|    const BYTE* dumps = seqState->dumps;
 3096|  98.3k|    const BYTE* const de = seqState->dumpsEnd;
 3097|       |
 3098|       |    /* Literal length */
 3099|  98.3k|    litLength = FSEv05_peakSymbol(&(seqState->stateLL));
 3100|  98.3k|    prevOffset = litLength ? seq->offset : seqState->prevOffset;
  ------------------
  |  Branch (3100:18): [True: 15.3k, False: 83.0k]
  ------------------
 3101|  98.3k|    if (litLength == MaxLL) {
  ------------------
  |  |  423|  98.3k|#define MaxLL  ((1<<LLbits) - 1)
  |  |  ------------------
  |  |  |  |  419|  98.3k|#define LLbits   6
  |  |  ------------------
  ------------------
  |  Branch (3101:9): [True: 2.46k, False: 95.9k]
  ------------------
 3102|  2.46k|        const U32 add = *dumps++;
 3103|  2.46k|        if (add < 255) litLength += add;
  ------------------
  |  Branch (3103:13): [True: 1.94k, False: 515]
  ------------------
 3104|    515|        else if (dumps + 2 <= de) {
  ------------------
  |  Branch (3104:18): [True: 187, False: 328]
  ------------------
 3105|    187|            litLength = MEM_readLE16(dumps);
 3106|    187|            dumps += 2;
 3107|    187|            if ((litLength & 1) && dumps < de) {
  ------------------
  |  Branch (3107:17): [True: 64, False: 123]
  |  Branch (3107:36): [True: 61, False: 3]
  ------------------
 3108|     61|                litLength += *dumps << 16;
 3109|     61|                dumps += 1;
 3110|     61|            }
 3111|    187|            litLength>>=1;
 3112|    187|        }
 3113|  2.46k|        if (dumps >= de) { dumps = de-1; }  /* late correction, to avoid read overflow (data is now corrupted anyway) */
  ------------------
  |  Branch (3113:13): [True: 952, False: 1.50k]
  ------------------
 3114|  2.46k|    }
 3115|       |
 3116|       |    /* Offset */
 3117|  98.3k|    {
 3118|  98.3k|        static const U32 offsetPrefix[MaxOff+1] = {
 3119|  98.3k|                1 /*fake*/, 1, 2, 4, 8, 16, 32, 64, 128, 256,
 3120|  98.3k|                512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144,
 3121|  98.3k|                524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, /*fake*/ 1, 1, 1, 1, 1 };
 3122|  98.3k|        U32 offsetCode = FSEv05_peakSymbol(&(seqState->stateOffb));   /* <= maxOff, by table construction */
 3123|  98.3k|        U32 nbBits = offsetCode - 1;
 3124|  98.3k|        if (offsetCode==0) nbBits = 0;   /* cmove */
  ------------------
  |  Branch (3124:13): [True: 58.5k, False: 39.8k]
  ------------------
 3125|  98.3k|        offset = offsetPrefix[offsetCode] + BITv05_readBits(&(seqState->DStream), nbBits);
 3126|  98.3k|        if (MEM_32bits()) BITv05_reloadDStream(&(seqState->DStream));
  ------------------
  |  Branch (3126:13): [True: 0, False: 98.3k]
  ------------------
 3127|  98.3k|        if (offsetCode==0) offset = prevOffset;   /* repcode, cmove */
  ------------------
  |  Branch (3127:13): [True: 58.5k, False: 39.8k]
  ------------------
 3128|  98.3k|        if (offsetCode | !litLength) seqState->prevOffset = seq->offset;   /* cmove */
  ------------------
  |  Branch (3128:13): [True: 88.3k, False: 10.0k]
  ------------------
 3129|  98.3k|        FSEv05_decodeSymbol(&(seqState->stateOffb), &(seqState->DStream));    /* update */
 3130|  98.3k|    }
 3131|       |
 3132|       |    /* Literal length update */
 3133|  98.3k|    FSEv05_decodeSymbol(&(seqState->stateLL), &(seqState->DStream));   /* update */
 3134|  98.3k|    if (MEM_32bits()) BITv05_reloadDStream(&(seqState->DStream));
  ------------------
  |  Branch (3134:9): [True: 0, False: 98.3k]
  ------------------
 3135|       |
 3136|       |    /* MatchLength */
 3137|  98.3k|    matchLength = FSEv05_decodeSymbol(&(seqState->stateML), &(seqState->DStream));
 3138|  98.3k|    if (matchLength == MaxML) {
  ------------------
  |  |  422|  98.3k|#define MaxML  ((1<<MLbits) - 1)
  |  |  ------------------
  |  |  |  |  418|  98.3k|#define MLbits   7
  |  |  ------------------
  ------------------
  |  Branch (3138:9): [True: 2.41k, False: 95.9k]
  ------------------
 3139|  2.41k|        const U32 add = dumps<de ? *dumps++ : 0;
  ------------------
  |  Branch (3139:25): [True: 2.40k, False: 7]
  ------------------
 3140|  2.41k|        if (add < 255) matchLength += add;
  ------------------
  |  Branch (3140:13): [True: 1.88k, False: 525]
  ------------------
 3141|    525|        else if (dumps + 2 <= de) {
  ------------------
  |  Branch (3141:18): [True: 208, False: 317]
  ------------------
 3142|    208|            matchLength = MEM_readLE16(dumps);
 3143|    208|            dumps += 2;
 3144|    208|            if ((matchLength & 1) && dumps < de) {
  ------------------
  |  Branch (3144:17): [True: 117, False: 91]
  |  Branch (3144:38): [True: 116, False: 1]
  ------------------
 3145|    116|                matchLength += *dumps << 16;
 3146|    116|                dumps += 1;
 3147|    116|            }
 3148|    208|            matchLength >>= 1;
 3149|    208|        }
 3150|  2.41k|        if (dumps >= de) { dumps = de-1; }  /* late correction, to avoid read overflow (data is now corrupted anyway) */
  ------------------
  |  Branch (3150:13): [True: 965, False: 1.44k]
  ------------------
 3151|  2.41k|    }
 3152|  98.3k|    matchLength += MINMATCH;
  ------------------
  |  |  414|  98.3k|#define MINMATCH 4
  ------------------
 3153|       |
 3154|       |    /* save result */
 3155|  98.3k|    seq->litLength = litLength;
 3156|  98.3k|    seq->offset = offset;
 3157|  98.3k|    seq->matchLength = matchLength;
 3158|  98.3k|    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|  98.3k|}
zstd_v05.c:FSEv05_peakSymbol:
  960|   196k|{
  961|   196k|    const FSEv05_decode_t DInfo = ((const FSEv05_decode_t*)(DStatePtr->table))[DStatePtr->state];
  962|   196k|    return DInfo.symbol;
  963|   196k|}
zstd_v05.c:ZSTDv05_execSequence:
 3175|  98.3k|{
 3176|  98.3k|    static const int dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 };   /* added */
 3177|  98.3k|    static const int dec64table[] = { 8, 8, 8, 7, 8, 9,10,11 };   /* subtracted */
 3178|  98.3k|    BYTE* const oLitEnd = op + sequence.litLength;
 3179|  98.3k|    const size_t sequenceLength = sequence.litLength + sequence.matchLength;
 3180|  98.3k|    BYTE* const oMatchEnd = op + sequenceLength;   /* risk : address space overflow (32-bits) */
 3181|  98.3k|    BYTE* const oend_8 = oend-8;
 3182|  98.3k|    const BYTE* const litEnd = *litPtr + sequence.litLength;
 3183|  98.3k|    const BYTE* match = oLitEnd - sequence.offset;
 3184|       |
 3185|       |    /* checks */
 3186|  98.3k|    size_t const seqLength = sequence.litLength + sequence.matchLength;
 3187|       |
 3188|  98.3k|    if (seqLength > (size_t)(oend - op)) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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 (3188:9): [True: 46, False: 98.3k]
  ------------------
 3189|  98.3k|    if (sequence.litLength > (size_t)(litLimit - *litPtr)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     79|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     79|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     79|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3189:9): [True: 79, False: 98.2k]
  ------------------
 3190|       |    /* Now we know there are no overflow in literal nor match lengths, can use pointer checks */
 3191|  98.2k|    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: 98.2k]
  ------------------
 3192|       |
 3193|  98.2k|    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: 98.2k]
  ------------------
 3194|  98.2k|    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: 98.2k]
  ------------------
 3195|       |
 3196|       |    /* copy Literals */
 3197|  98.2k|    ZSTDv05_wildcopy(op, *litPtr, (ptrdiff_t)sequence.litLength);   /* note : oLitEnd <= oend-8 : no risk of overwrite beyond oend */
 3198|  98.2k|    op = oLitEnd;
 3199|  98.2k|    *litPtr = litEnd;   /* update for next sequence */
 3200|       |
 3201|       |    /* copy Match */
 3202|  98.2k|    if (sequence.offset > (size_t)(oLitEnd - base)) {
  ------------------
  |  Branch (3202:9): [True: 219, False: 98.0k]
  ------------------
 3203|       |        /* offset beyond prefix */
 3204|    219|        if (sequence.offset > (size_t)(oLitEnd - vBase))
  ------------------
  |  Branch (3204:13): [True: 109, False: 110]
  ------------------
 3205|    109|            return ERROR(corruption_detected);
  ------------------
  |  |   49|    109|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    109|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    109|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3206|    110|        match = dictEnd - (base-match);
 3207|    110|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (3207:13): [True: 76, False: 34]
  ------------------
 3208|     76|            memmove(oLitEnd, match, sequence.matchLength);
 3209|     76|            return sequenceLength;
 3210|     76|        }
 3211|       |        /* span extDict & currentPrefixSegment */
 3212|     34|        {
 3213|     34|            size_t length1 = dictEnd - match;
 3214|     34|            memmove(oLitEnd, match, length1);
 3215|     34|            op = oLitEnd + length1;
 3216|     34|            sequence.matchLength -= length1;
 3217|     34|            match = base;
 3218|     34|            if (op > oend_8 || sequence.matchLength < MINMATCH) {
  ------------------
  |  |  414|     34|#define MINMATCH 4
  ------------------
  |  Branch (3218:17): [True: 0, False: 34]
  |  Branch (3218:32): [True: 18, False: 16]
  ------------------
 3219|     60|              while (op < oMatchEnd) *op++ = *match++;
  ------------------
  |  Branch (3219:22): [True: 42, False: 18]
  ------------------
 3220|     18|              return sequenceLength;
 3221|     18|            }
 3222|     34|    }   }
 3223|       |    /* Requirement: op <= oend_8 */
 3224|       |
 3225|       |    /* match within prefix */
 3226|  98.0k|    if (sequence.offset < 8) {
  ------------------
  |  Branch (3226:9): [True: 94.3k, False: 3.68k]
  ------------------
 3227|       |        /* close range match, overlap */
 3228|  94.3k|        const int sub2 = dec64table[sequence.offset];
 3229|  94.3k|        op[0] = match[0];
 3230|  94.3k|        op[1] = match[1];
 3231|  94.3k|        op[2] = match[2];
 3232|  94.3k|        op[3] = match[3];
 3233|  94.3k|        match += dec32table[sequence.offset];
 3234|  94.3k|        ZSTDv05_copy4(op+4, match);
 3235|  94.3k|        match -= sub2;
 3236|  94.3k|    } else {
 3237|  3.68k|        ZSTDv05_copy8(op, match);
 3238|  3.68k|    }
 3239|  98.0k|    op += 8; match += 8;
 3240|       |
 3241|  98.0k|    if (oMatchEnd > oend-(16-MINMATCH)) {
  ------------------
  |  |  414|  98.0k|#define MINMATCH 4
  ------------------
  |  Branch (3241:9): [True: 26, False: 98.0k]
  ------------------
 3242|     26|        if (op < oend_8) {
  ------------------
  |  Branch (3242:13): [True: 21, False: 5]
  ------------------
 3243|     21|            ZSTDv05_wildcopy(op, match, oend_8 - op);
 3244|     21|            match += oend_8 - op;
 3245|     21|            op = oend_8;
 3246|     21|        }
 3247|    101|        while (op < oMatchEnd)
  ------------------
  |  Branch (3247:16): [True: 75, False: 26]
  ------------------
 3248|     75|            *op++ = *match++;
 3249|  98.0k|    } else {
 3250|  98.0k|        ZSTDv05_wildcopy(op, match, (ptrdiff_t)sequence.matchLength-8);   /* works even if matchLength < 8 */
 3251|  98.0k|    }
 3252|  98.0k|    return sequenceLength;
 3253|  98.2k|}
zstd_v05.c:ZSTDv05_wildcopy:
  458|   196k|{
  459|   196k|    const BYTE* ip = (const BYTE*)src;
  460|   196k|    BYTE* op = (BYTE*)dst;
  461|   196k|    BYTE* const oend = op + length;
  462|   196k|    do
  463|  54.4M|        COPY8(op, ip)
  ------------------
  |  |  453|  54.4M|#define COPY8(d,s) { ZSTDv05_copy8(d,s); d+=8; s+=8; }
  ------------------
  464|  54.4M|    while (op < oend);
  ------------------
  |  Branch (464:12): [True: 54.2M, False: 196k]
  ------------------
  465|   196k|}
zstd_v05.c:ZSTDv05_copy4:
 2569|  94.3k|static void ZSTDv05_copy4(void* dst, const void* src) { memcpy(dst, src, 4); }
zstd_v05.c:ZSTDv05_copy8:
  451|  54.4M|static void ZSTDv05_copy8(void* dst, const void* src) { memcpy(dst, src, 8); }
zstd_v05.c:ZSTDv05_decompress_continueDCtx:
 3373|  2.04k|{
 3374|  2.04k|    const BYTE* ip = (const BYTE*)src;
 3375|  2.04k|    const BYTE* iend = ip + srcSize;
 3376|  2.04k|    BYTE* const ostart = (BYTE*)dst;
 3377|  2.04k|    BYTE* op = ostart;
 3378|  2.04k|    BYTE* const oend = ostart + maxDstSize;
 3379|  2.04k|    size_t remainingSize = srcSize;
 3380|  2.04k|    blockProperties_t blockProperties;
 3381|  2.04k|    memset(&blockProperties, 0, sizeof(blockProperties));
 3382|       |
 3383|       |    /* Frame Header */
 3384|  2.04k|    {   size_t frameHeaderSize;
 3385|  2.04k|        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: 2.04k]
  ------------------
 3386|  2.04k|        frameHeaderSize = ZSTDv05_decodeFrameHeader_Part1(dctx, src, ZSTDv05_frameHeaderSize_min);
 3387|  2.04k|        if (ZSTDv05_isError(frameHeaderSize)) return frameHeaderSize;
  ------------------
  |  Branch (3387:13): [True: 0, False: 2.04k]
  ------------------
 3388|  2.04k|        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: 2.04k]
  ------------------
 3389|  2.04k|        ip += frameHeaderSize; remainingSize -= frameHeaderSize;
 3390|  2.04k|        frameHeaderSize = ZSTDv05_decodeFrameHeader_Part2(dctx, src, frameHeaderSize);
 3391|  2.04k|        if (ZSTDv05_isError(frameHeaderSize)) return frameHeaderSize;
  ------------------
  |  Branch (3391:13): [True: 64, False: 1.97k]
  ------------------
 3392|  2.04k|    }
 3393|       |
 3394|       |    /* Loop on each block */
 3395|  2.87k|    while (1)
  ------------------
  |  Branch (3395:12): [True: 2.87k, Folded]
  ------------------
 3396|  2.87k|    {
 3397|  2.87k|        size_t decodedSize=0;
 3398|  2.87k|        size_t cBlockSize = ZSTDv05_getcBlockSize(ip, iend-ip, &blockProperties);
 3399|  2.87k|        if (ZSTDv05_isError(cBlockSize)) return cBlockSize;
  ------------------
  |  Branch (3399:13): [True: 0, False: 2.87k]
  ------------------
 3400|       |
 3401|  2.87k|        ip += ZSTDv05_blockHeaderSize;
 3402|  2.87k|        remainingSize -= ZSTDv05_blockHeaderSize;
 3403|  2.87k|        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.87k]
  ------------------
 3404|       |
 3405|  2.87k|        switch(blockProperties.blockType)
 3406|  2.87k|        {
 3407|  1.03k|        case bt_compressed:
  ------------------
  |  Branch (3407:9): [True: 1.03k, False: 1.84k]
  ------------------
 3408|  1.03k|            decodedSize = ZSTDv05_decompressBlock_internal(dctx, op, oend-op, ip, cBlockSize);
 3409|  1.03k|            break;
 3410|  1.05k|        case bt_raw :
  ------------------
  |  Branch (3410:9): [True: 1.05k, False: 1.82k]
  ------------------
 3411|  1.05k|            decodedSize = ZSTDv05_copyRawBlock(op, oend-op, ip, cBlockSize);
 3412|  1.05k|            break;
 3413|     20|        case bt_rle :
  ------------------
  |  Branch (3413:9): [True: 20, False: 2.85k]
  ------------------
 3414|     20|            return ERROR(GENERIC);   /* not yet supported */
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3415|      0|            break;
 3416|    771|        case bt_end :
  ------------------
  |  Branch (3416:9): [True: 771, False: 2.10k]
  ------------------
 3417|       |            /* end of frame */
 3418|    771|            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: 771]
  ------------------
 3419|    771|            break;
 3420|    771|        default:
  ------------------
  |  Branch (3420:9): [True: 0, False: 2.87k]
  ------------------
 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.87k|        }
 3423|  2.85k|        if (cBlockSize == 0) break;   /* bt_end */
  ------------------
  |  Branch (3423:13): [True: 1.11k, False: 1.74k]
  ------------------
 3424|       |
 3425|  1.74k|        if (ZSTDv05_isError(decodedSize)) return decodedSize;
  ------------------
  |  Branch (3425:13): [True: 840, False: 902]
  ------------------
 3426|    902|        op += decodedSize;
 3427|    902|        ip += cBlockSize;
 3428|    902|        remainingSize -= cBlockSize;
 3429|    902|    }
 3430|       |
 3431|  1.11k|    return op-ostart;
 3432|  1.97k|}
zstd_v05.c:ZSTD_errorFrameSizeInfoLegacy:
 3479|     71|{
 3480|     71|    *cSize = ret;
 3481|     71|    *dBound = ZSTD_CONTENTSIZE_ERROR;
  ------------------
  |  |  443|     71|#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
  ------------------
 3482|     71|}
zstd_v05.c:ZSTDv05_getcBlockSize:
 2779|  7.17k|{
 2780|  7.17k|    const BYTE* const in = (const BYTE*)src;
 2781|  7.17k|    BYTE headerFlags;
 2782|  7.17k|    U32 cSize;
 2783|       |
 2784|  7.17k|    if (srcSize < 3)
  ------------------
  |  Branch (2784:9): [True: 7, False: 7.16k]
  ------------------
 2785|      7|        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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2786|       |
 2787|  7.16k|    headerFlags = *in;
 2788|  7.16k|    cSize = in[2] + (in[1]<<8) + ((in[0] & 7)<<16);
 2789|       |
 2790|  7.16k|    bpPtr->blockType = (blockType_t)(headerFlags >> 6);
 2791|  7.16k|    bpPtr->origSize = (bpPtr->blockType == bt_rle) ? cSize : 0;
  ------------------
  |  Branch (2791:23): [True: 367, False: 6.80k]
  ------------------
 2792|       |
 2793|  7.16k|    if (bpPtr->blockType == bt_end) return 0;
  ------------------
  |  Branch (2793:9): [True: 2.18k, False: 4.98k]
  ------------------
 2794|  4.98k|    if (bpPtr->blockType == bt_rle) return 1;
  ------------------
  |  Branch (2794:9): [True: 367, False: 4.61k]
  ------------------
 2795|  4.61k|    return cSize;
 2796|  4.98k|}
zstd_v05.c:ZSTDv05_decodeFrameHeader_Part1:
 2740|  2.04k|{
 2741|  2.04k|    U32 magicNumber;
 2742|  2.04k|    if (srcSize != ZSTDv05_frameHeaderSize_min)
  ------------------
  |  Branch (2742:9): [True: 0, False: 2.04k]
  ------------------
 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|  2.04k|    magicNumber = MEM_readLE32(src);
 2745|  2.04k|    if (magicNumber != ZSTDv05_MAGICNUMBER) return ERROR(prefix_unknown);
  ------------------
  |  |  153|  2.04k|#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: 2.04k]
  ------------------
 2746|  2.04k|    zc->headerSize = ZSTDv05_frameHeaderSize_min;
 2747|  2.04k|    return zc->headerSize;
 2748|  2.04k|}
zstd_v05.c:ZSTDv05_decodeFrameHeader_Part2:
 2768|  2.04k|{
 2769|  2.04k|    size_t result;
 2770|  2.04k|    if (srcSize != zc->headerSize)
  ------------------
  |  Branch (2770:9): [True: 0, False: 2.04k]
  ------------------
 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|  2.04k|    result = ZSTDv05_getFrameParams(&(zc->params), src, srcSize);
 2773|  2.04k|    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: 2.04k]
  |  Branch (2773:27): [True: 0, False: 0]
  ------------------
 2774|  2.04k|    return result;
 2775|  2.04k|}
zstd_v05.c:ZSTDv05_copyRawBlock:
 2800|  1.05k|{
 2801|  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 (2801:9): [True: 0, False: 1.05k]
  ------------------
 2802|  1.05k|    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.05k]
  ------------------
 2803|  1.05k|    memcpy(dst, src, srcSize);
 2804|  1.05k|    return srcSize;
 2805|  1.05k|}
zstd_v05.c:ZSTDv05_decompress_insertDictionary:
 3663|  1.32k|{
 3664|  1.32k|    size_t eSize;
 3665|  1.32k|    U32 magic = MEM_readLE32(dict);
 3666|  1.32k|    if (magic != ZSTDv05_DICT_MAGIC) {
  ------------------
  |  |  390|  1.32k|#define ZSTDv05_DICT_MAGIC  0xEC30A435
  ------------------
  |  Branch (3666:9): [True: 116, False: 1.21k]
  ------------------
 3667|       |        /* pure content mode */
 3668|    116|        ZSTDv05_refDictContent(dctx, dict, dictSize);
 3669|    116|        return 0;
 3670|    116|    }
 3671|       |    /* load entropy tables */
 3672|  1.21k|    dict = (const char*)dict + 4;
 3673|  1.21k|    dictSize -= 4;
 3674|  1.21k|    eSize = ZSTDv05_loadEntropy(dctx, dict, dictSize);
 3675|  1.21k|    if (ZSTDv05_isError(eSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|  1.08k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  1.08k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  1.08k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3675:9): [True: 1.08k, False: 124]
  ------------------
 3676|       |
 3677|       |    /* reference dictionary content */
 3678|    124|    dict = (const char*)dict + eSize;
 3679|    124|    dictSize -= eSize;
 3680|    124|    ZSTDv05_refDictContent(dctx, dict, dictSize);
 3681|       |
 3682|    124|    return 0;
 3683|  1.21k|}
zstd_v05.c:ZSTDv05_refDictContent:
 3614|    240|{
 3615|    240|    dctx->dictEnd = dctx->previousDstEnd;
 3616|    240|    dctx->vBase = (const char*)dict - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->base));
 3617|    240|    dctx->base = dict;
 3618|    240|    dctx->previousDstEnd = (const char*)dict + dictSize;
 3619|    240|}
zstd_v05.c:ZSTDv05_loadEntropy:
 3622|  1.21k|{
 3623|  1.21k|    size_t hSize, offcodeHeaderSize, matchlengthHeaderSize, errorCode, litlengthHeaderSize;
 3624|  1.21k|    short offcodeNCount[MaxOff+1];
 3625|  1.21k|    unsigned offcodeMaxValue=MaxOff, offcodeLog;
  ------------------
  |  |  424|  1.21k|#define MaxOff ((1<<Offbits)- 1)
  |  |  ------------------
  |  |  |  |  420|  1.21k|#define Offbits  5
  |  |  ------------------
  ------------------
 3626|  1.21k|    short matchlengthNCount[MaxML+1];
 3627|  1.21k|    unsigned matchlengthMaxValue = MaxML, matchlengthLog;
  ------------------
  |  |  422|  1.21k|#define MaxML  ((1<<MLbits) - 1)
  |  |  ------------------
  |  |  |  |  418|  1.21k|#define MLbits   7
  |  |  ------------------
  ------------------
 3628|  1.21k|    short litlengthNCount[MaxLL+1];
 3629|  1.21k|    unsigned litlengthMaxValue = MaxLL, litlengthLog;
  ------------------
  |  |  423|  1.21k|#define MaxLL  ((1<<LLbits) - 1)
  |  |  ------------------
  |  |  |  |  419|  1.21k|#define LLbits   6
  |  |  ------------------
  ------------------
 3630|       |
 3631|  1.21k|    hSize = HUFv05_readDTableX4(dctx->hufTableX4, dict, dictSize);
 3632|  1.21k|    if (HUFv05_isError(hSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|    847|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    847|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    847|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3632:9): [True: 847, False: 363]
  ------------------
 3633|    363|    dict = (const char*)dict + hSize;
 3634|    363|    dictSize -= hSize;
 3635|       |
 3636|    363|    offcodeHeaderSize = FSEv05_readNCount(offcodeNCount, &offcodeMaxValue, &offcodeLog, dict, dictSize);
 3637|    363|    if (FSEv05_isError(offcodeHeaderSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|     69|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     69|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     69|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3637:9): [True: 69, False: 294]
  ------------------
 3638|    294|    if (offcodeLog > OffFSEv05Log) return ERROR(dictionary_corrupted);
  ------------------
  |  |  427|    294|#define OffFSEv05Log   9
  ------------------
                  if (offcodeLog > OffFSEv05Log) return ERROR(dictionary_corrupted);
  ------------------
  |  |   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 (3638:9): [True: 20, False: 274]
  ------------------
 3639|    274|    errorCode = FSEv05_buildDTable(dctx->OffTable, offcodeNCount, offcodeMaxValue, offcodeLog);
 3640|    274|    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: 274]
  ------------------
 3641|    274|    dict = (const char*)dict + offcodeHeaderSize;
 3642|    274|    dictSize -= offcodeHeaderSize;
 3643|       |
 3644|    274|    matchlengthHeaderSize = FSEv05_readNCount(matchlengthNCount, &matchlengthMaxValue, &matchlengthLog, dict, dictSize);
 3645|    274|    if (FSEv05_isError(matchlengthHeaderSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|     45|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     45|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     45|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3645:9): [True: 45, False: 229]
  ------------------
 3646|    229|    if (matchlengthLog > MLFSEv05Log) return ERROR(dictionary_corrupted);
  ------------------
  |  |  425|    229|#define MLFSEv05Log   10
  ------------------
                  if (matchlengthLog > MLFSEv05Log) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|     25|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     25|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     25|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3646:9): [True: 25, False: 204]
  ------------------
 3647|    204|    errorCode = FSEv05_buildDTable(dctx->MLTable, matchlengthNCount, matchlengthMaxValue, matchlengthLog);
 3648|    204|    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: 204]
  ------------------
 3649|    204|    dict = (const char*)dict + matchlengthHeaderSize;
 3650|    204|    dictSize -= matchlengthHeaderSize;
 3651|       |
 3652|    204|    litlengthHeaderSize = FSEv05_readNCount(litlengthNCount, &litlengthMaxValue, &litlengthLog, dict, dictSize);
 3653|    204|    if (litlengthLog > LLFSEv05Log) return ERROR(dictionary_corrupted);
  ------------------
  |  |  426|    204|#define LLFSEv05Log   10
  ------------------
                  if (litlengthLog > LLFSEv05Log) return ERROR(dictionary_corrupted);
  ------------------
  |  |   49|     72|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     72|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     72|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3653:9): [True: 72, False: 132]
  ------------------
 3654|    132|    if (FSEv05_isError(litlengthHeaderSize)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   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 (3654:9): [True: 8, False: 124]
  ------------------
 3655|    124|    errorCode = FSEv05_buildDTable(dctx->LLTable, litlengthNCount, litlengthMaxValue, litlengthLog);
 3656|    124|    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: 124]
  ------------------
 3657|       |
 3658|    124|    dctx->flagStaticTables = 1;
 3659|    124|    return hSize + offcodeHeaderSize + matchlengthHeaderSize + litlengthHeaderSize;
 3660|    124|}

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

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

bshuf_trans_byte_bitrow_AVX:
  117|  69.7k|                                    const size_t elem_size) {
  118|       |
  119|  69.7k|  size_t hh, ii, jj, kk, mm;
  120|  69.7k|  const char* in_b = (const char*) in;
  121|  69.7k|  char* out_b = (char*) out;
  122|       |
  123|  69.7k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  69.7k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 69.7k]
  |  |  ------------------
  ------------------
  124|       |
  125|  69.7k|  size_t nrows = 8 * elem_size;
  126|  69.7k|  size_t nbyte_row = size / 8;
  127|       |
  128|  69.7k|  if (elem_size % 4) return bshuf_trans_byte_bitrow_SSE(in, out, size,
  ------------------
  |  Branch (128:7): [True: 44.3k, False: 25.4k]
  ------------------
  129|  44.3k|                                                        elem_size);
  130|       |
  131|  25.4k|  __m256i ymm_0[8];
  132|  25.4k|  __m256i ymm_1[8];
  133|  25.4k|  __m256i ymm_storeage[8][4];
  134|       |
  135|  4.50M|  for (jj = 0; jj + 31 < nbyte_row; jj += 32) {
  ------------------
  |  Branch (135:16): [True: 4.48M, False: 25.4k]
  ------------------
  136|  15.7M|    for (ii = 0; ii + 3 < elem_size; ii += 4) {
  ------------------
  |  Branch (136:18): [True: 11.3M, False: 4.48M]
  ------------------
  137|  56.5M|      for (hh = 0; hh < 4; hh ++) {
  ------------------
  |  Branch (137:20): [True: 45.2M, False: 11.3M]
  ------------------
  138|       |
  139|   407M|        for (kk = 0; kk < 8; kk ++){
  ------------------
  |  Branch (139:22): [True: 362M, False: 45.2M]
  ------------------
  140|   362M|          ymm_0[kk] = _mm256_loadu_si256((__m256i *) &in_b[
  141|   362M|              (ii * 8 + hh * 8 + kk) * nbyte_row + jj]);
  142|   362M|        }
  143|       |
  144|   226M|        for (kk = 0; kk < 4; kk ++){
  ------------------
  |  Branch (144:22): [True: 181M, False: 45.2M]
  ------------------
  145|   181M|          ymm_1[kk] = _mm256_unpacklo_epi8(ymm_0[kk * 2],
  146|   181M|                                           ymm_0[kk * 2 + 1]);
  147|   181M|          ymm_1[kk + 4] = _mm256_unpackhi_epi8(ymm_0[kk * 2],
  148|   181M|                                               ymm_0[kk * 2 + 1]);
  149|   181M|        }
  150|       |
  151|   135M|        for (kk = 0; kk < 2; kk ++){
  ------------------
  |  Branch (151:22): [True: 90.5M, False: 45.2M]
  ------------------
  152|   271M|          for (mm = 0; mm < 2; mm ++){
  ------------------
  |  Branch (152:24): [True: 181M, False: 90.5M]
  ------------------
  153|   181M|            ymm_0[kk * 4 + mm] = _mm256_unpacklo_epi16(
  154|   181M|                ymm_1[kk * 4 + mm * 2],
  155|   181M|                ymm_1[kk * 4 + mm * 2 + 1]);
  156|   181M|            ymm_0[kk * 4 + mm + 2] = _mm256_unpackhi_epi16(
  157|   181M|                ymm_1[kk * 4 + mm * 2],
  158|   181M|                ymm_1[kk * 4 + mm * 2 + 1]);
  159|   181M|          }
  160|  90.5M|        }
  161|       |
  162|   226M|        for (kk = 0; kk < 4; kk ++){
  ------------------
  |  Branch (162:22): [True: 181M, False: 45.2M]
  ------------------
  163|   181M|          ymm_1[kk * 2] = _mm256_unpacklo_epi32(ymm_0[kk * 2],
  164|   181M|                                                ymm_0[kk * 2 + 1]);
  165|   181M|          ymm_1[kk * 2 + 1] = _mm256_unpackhi_epi32(ymm_0[kk * 2],
  166|   181M|                                                    ymm_0[kk * 2 + 1]);
  167|   181M|        }
  168|       |
  169|   407M|        for (kk = 0; kk < 8; kk ++){
  ------------------
  |  Branch (169:22): [True: 362M, False: 45.2M]
  ------------------
  170|   362M|          ymm_storeage[kk][hh] = ymm_1[kk];
  171|   362M|        }
  172|  45.2M|      }
  173|       |
  174|   101M|      for (mm = 0; mm < 8; mm ++) {
  ------------------
  |  Branch (174:20): [True: 90.5M, False: 11.3M]
  ------------------
  175|       |
  176|   452M|        for (kk = 0; kk < 4; kk ++){
  ------------------
  |  Branch (176:22): [True: 362M, False: 90.5M]
  ------------------
  177|   362M|          ymm_0[kk] = ymm_storeage[mm][kk];
  178|   362M|        }
  179|       |
  180|  90.5M|        ymm_1[0] = _mm256_unpacklo_epi64(ymm_0[0], ymm_0[1]);
  181|  90.5M|        ymm_1[1] = _mm256_unpacklo_epi64(ymm_0[2], ymm_0[3]);
  182|  90.5M|        ymm_1[2] = _mm256_unpackhi_epi64(ymm_0[0], ymm_0[1]);
  183|  90.5M|        ymm_1[3] = _mm256_unpackhi_epi64(ymm_0[2], ymm_0[3]);
  184|       |
  185|  90.5M|        ymm_0[0] = _mm256_permute2x128_si256(ymm_1[0], ymm_1[1], 32);
  186|  90.5M|        ymm_0[1] = _mm256_permute2x128_si256(ymm_1[2], ymm_1[3], 32);
  187|  90.5M|        ymm_0[2] = _mm256_permute2x128_si256(ymm_1[0], ymm_1[1], 49);
  188|  90.5M|        ymm_0[3] = _mm256_permute2x128_si256(ymm_1[2], ymm_1[3], 49);
  189|       |
  190|  90.5M|        _mm256_storeu_si256((__m256i *) &out_b[
  191|  90.5M|            (jj + mm * 2 + 0 * 16) * nrows + ii * 8], ymm_0[0]);
  192|  90.5M|        _mm256_storeu_si256((__m256i *) &out_b[
  193|  90.5M|            (jj + mm * 2 + 0 * 16 + 1) * nrows + ii * 8], ymm_0[1]);
  194|  90.5M|        _mm256_storeu_si256((__m256i *) &out_b[
  195|  90.5M|            (jj + mm * 2 + 1 * 16) * nrows + ii * 8], ymm_0[2]);
  196|  90.5M|        _mm256_storeu_si256((__m256i *) &out_b[
  197|  90.5M|            (jj + mm * 2 + 1 * 16 + 1) * nrows + ii * 8], ymm_0[3]);
  198|  90.5M|      }
  199|  11.3M|    }
  200|  4.48M|  }
  201|  1.73M|  for (ii = 0; ii < nrows; ii ++ ) {
  ------------------
  |  Branch (201:16): [True: 1.70M, False: 25.4k]
  ------------------
  202|  27.8M|    for (jj = nbyte_row - nbyte_row % 32; jj < nbyte_row; jj ++) {
  ------------------
  |  Branch (202:43): [True: 26.1M, False: 1.70M]
  ------------------
  203|  26.1M|      out_b[jj * nrows + ii] = in_b[ii * nbyte_row + jj];
  204|  26.1M|    }
  205|  1.70M|  }
  206|  25.4k|  return size * elem_size;
  207|  69.7k|}
bshuf_shuffle_bit_eightelem_AVX:
  212|  69.7k|                                        const size_t elem_size) {
  213|       |
  214|  69.7k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  69.7k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 69.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|  69.7k|  const char* in_b = (const char*) in;
  219|  69.7k|  char* out_b = (char*) out;
  220|       |
  221|  69.7k|  size_t ii, jj, kk;
  222|  69.7k|  size_t nbyte = elem_size * size;
  223|       |
  224|  69.7k|  __m256i ymm;
  225|  69.7k|  int32_t bt;
  226|       |
  227|  69.7k|  if (elem_size % 4) {
  ------------------
  |  Branch (227:7): [True: 44.3k, False: 25.4k]
  ------------------
  228|  44.3k|    return bshuf_shuffle_bit_eightelem_SSE(in, out, size, elem_size);
  229|  44.3k|  } else {
  230|  78.7k|    for (jj = 0; jj + 31 < 8 * elem_size; jj += 32) {
  ------------------
  |  Branch (230:18): [True: 53.3k, False: 25.4k]
  ------------------
  231|   363M|      for (ii = 0; ii + 8 * elem_size - 1 < nbyte;
  ------------------
  |  Branch (231:20): [True: 363M, False: 53.3k]
  ------------------
  232|   363M|           ii += 8 * elem_size) {
  233|   363M|        ymm = _mm256_loadu_si256((__m256i *) &in_b[ii + jj]);
  234|  3.26G|        for (kk = 0; kk < 8; kk++) {
  ------------------
  |  Branch (234:22): [True: 2.90G, False: 363M]
  ------------------
  235|  2.90G|          bt = _mm256_movemask_epi8(ymm);
  236|  2.90G|          ymm = _mm256_slli_epi16(ymm, 1);
  237|  2.90G|          size_t ind = (ii + jj / 8 + (7 - kk) * elem_size);
  238|  2.90G|          * (int32_t *) &out_b[ind] = bt;
  239|  2.90G|        }
  240|   363M|      }
  241|  53.3k|    }
  242|  25.4k|  }
  243|  25.4k|  return size * elem_size;
  244|  69.7k|}
bshuf_untrans_bit_elem_AVX:
  249|  69.7k|                                   const size_t elem_size) {
  250|       |
  251|  69.7k|  int64_t count;
  252|       |
  253|  69.7k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  69.7k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 69.7k]
  |  |  ------------------
  ------------------
  254|       |
  255|  69.7k|  void* tmp_buf = malloc(size * elem_size);
  256|  69.7k|  if (tmp_buf == NULL) return -1;
  ------------------
  |  Branch (256:7): [True: 0, False: 69.7k]
  ------------------
  257|       |
  258|  69.7k|  count = bshuf_trans_byte_bitrow_AVX(in, tmp_buf, size, elem_size);
  259|  69.7k|  CHECK_ERR_FREE(count, tmp_buf);
  ------------------
  |  |   45|  69.7k|#define CHECK_ERR_FREE(count, buf) if (count < 0) { free(buf); return count; }
  |  |  ------------------
  |  |  |  Branch (45:40): [True: 0, False: 69.7k]
  |  |  ------------------
  ------------------
  260|  69.7k|  count =  bshuf_shuffle_bit_eightelem_AVX(tmp_buf, out, size, elem_size);
  261|       |
  262|  69.7k|  free(tmp_buf);
  263|  69.7k|  return count;
  264|  69.7k|}

bshuf_shuffle_bit_eightelem_scal:
  200|  28.1k|        const size_t size, const size_t elem_size) {
  201|       |
  202|  28.1k|  const char *in_b;
  203|  28.1k|  char *out_b;
  204|  28.1k|  uint64_t x, t;
  205|  28.1k|  size_t ii, jj, kk;
  206|  28.1k|  size_t nbyte, out_index;
  207|       |
  208|  28.1k|  uint64_t e=1;
  209|  28.1k|  const int little_endian = *(uint8_t *) &e == 1;
  210|  28.1k|  const size_t elem_skip = little_endian ? elem_size : -elem_size;
  ------------------
  |  Branch (210:28): [True: 28.1k, False: 0]
  ------------------
  211|  28.1k|  const uint64_t elem_offset = little_endian ? 0 : 7 * elem_size;
  ------------------
  |  Branch (211:32): [True: 28.1k, False: 0]
  ------------------
  212|       |
  213|  28.1k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  28.1k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 28.1k]
  |  |  ------------------
  ------------------
  214|       |
  215|  28.1k|  in_b = (const char*) in;
  216|  28.1k|  out_b = (char*) out;
  217|       |
  218|  28.1k|  nbyte = elem_size * size;
  219|       |
  220|   228k|  for (jj = 0; jj < 8 * elem_size; jj += 8) {
  ------------------
  |  Branch (220:16): [True: 200k, False: 28.1k]
  ------------------
  221|   639M|    for (ii = 0; ii + 8 * elem_size - 1 < nbyte; ii += 8 * elem_size) {
  ------------------
  |  Branch (221:18): [True: 638M, False: 200k]
  ------------------
  222|   638M|      x = *((uint64_t*) &in_b[ii + jj]);
  223|   638M|      if (little_endian) {
  ------------------
  |  Branch (223:11): [True: 638M, False: 0]
  ------------------
  224|   638M|        TRANS_BIT_8X8(x, t);
  ------------------
  |  |   56|   638M|#define TRANS_BIT_8X8(x, t) {                                               \
  |  |   57|   638M|        t = (x ^ (x >> 7)) & 0x00AA00AA00AA00AALL;                          \
  |  |   58|   638M|        x = x ^ t ^ (t << 7);                                               \
  |  |   59|   638M|        t = (x ^ (x >> 14)) & 0x0000CCCC0000CCCCLL;                         \
  |  |   60|   638M|        x = x ^ t ^ (t << 14);                                              \
  |  |   61|   638M|        t = (x ^ (x >> 28)) & 0x00000000F0F0F0F0LL;                         \
  |  |   62|   638M|        x = x ^ t ^ (t << 28);                                              \
  |  |   63|   638M|    }
  ------------------
  225|   638M|      } 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|  5.75G|      for (kk = 0; kk < 8; kk++) {
  ------------------
  |  Branch (228:20): [True: 5.11G, False: 638M]
  ------------------
  229|  5.11G|        out_index = ii + jj / 8 + elem_offset + kk * elem_skip;
  230|  5.11G|        *((uint8_t*) &out_b[out_index]) = x;
  231|  5.11G|        x = x >> 8;
  232|  5.11G|      }
  233|   638M|    }
  234|   200k|  }
  235|  28.1k|  return size * elem_size;
  236|  28.1k|}

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

blosc2.c:is_little_endian:
   42|  79.9M|static bool is_little_endian(void) {
   43|  79.9M|  static const int i = 1;
   44|  79.9M|  char* p = (char*)&i;
   45|       |
   46|  79.9M|  if (p[0] == 1) {
  ------------------
  |  Branch (46:7): [True: 79.9M, False: 0]
  ------------------
   47|  79.9M|    return true;
   48|  79.9M|  }
   49|      0|  else {
   50|       |    return false;
   51|      0|  }
   52|  79.9M|}
blosc2.c:load_lib:
  317|      5|static inline void* load_lib(char *plugin_name, char *libpath) {
  318|      5|  if (!blosc2_valid_plugin_name(plugin_name)) {
  ------------------
  |  Branch (318:7): [True: 0, False: 5]
  ------------------
  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|      5|    snprintf(libpath, PATH_MAX, "libblosc2_%s.so", plugin_name);
  329|      5|#endif
  330|      5|    void* loaded_lib = dlopen(libpath, RTLD_LAZY);
  331|      5|    if (loaded_lib != NULL) {
  ------------------
  |  Branch (331:9): [True: 0, False: 5]
  ------------------
  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|      5|    } else {
  335|       |#if defined(_WIN32)
  336|       |        BLOSC_TRACE_INFO("Failed to load %s directly, error: %lu\n", libpath, GetLastError());
  337|       |#else
  338|      5|        BLOSC_TRACE_INFO("Failed to load %s directly, error: %s\n", libpath, dlerror());
  ------------------
  |  |   95|      5|#define BLOSC_TRACE_INFO(msg, ...) BLOSC_TRACE(info, 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  339|      5|#endif
  340|      5|    }
  341|       |    // If direct loading fails, fallback to using Python to find the library path
  342|      5|    if (get_libpath(plugin_name, libpath, "") < 0 && get_libpath(plugin_name, libpath, "3") < 0) {
  ------------------
  |  Branch (342:9): [True: 5, False: 0]
  |  Branch (342:54): [True: 5, False: 0]
  ------------------
  343|      5|        BLOSC_TRACE_ERROR("Problems when running python or python3 for getting plugin path");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  344|      5|        return NULL;
  345|      5|    }
  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|     15|static inline bool blosc2_valid_plugin_name(const char *plugin_name) {
  276|     15|  if (plugin_name == NULL || plugin_name[0] == '\0') {
  ------------------
  |  Branch (276:7): [True: 0, False: 15]
  |  Branch (276:30): [True: 0, False: 15]
  ------------------
  277|      0|    return false;
  278|      0|  }
  279|     96|  for (const unsigned char *p = (const unsigned char *)plugin_name; *p != '\0'; ++p) {
  ------------------
  |  Branch (279:69): [True: 81, False: 15]
  ------------------
  280|     81|    if (!isalnum(*p) && *p != '_') {
  ------------------
  |  Branch (280:9): [True: 0, False: 81]
  |  Branch (280:25): [True: 0, False: 0]
  ------------------
  281|      0|      return false;
  282|      0|    }
  283|     81|  }
  284|     15|  return true;
  285|     15|}
blosc2.c:get_libpath:
  288|     10|static inline int get_libpath(char *plugin_name, char *libpath, char *python_version) {
  289|     10|  BLOSC_TRACE_INFO("Trying to get plugin path with python%s\n", python_version);
  ------------------
  |  |   95|     10|#define BLOSC_TRACE_INFO(msg, ...) BLOSC_TRACE(info, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     10|    do {                                            \
  |  |  |  |   98|     10|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     10|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 10, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     10|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  290|     10|  char python_cmd[PATH_MAX] = {0};
  291|     10|  if (!blosc2_valid_plugin_name(plugin_name)) {
  ------------------
  |  Branch (291:7): [True: 0, False: 10]
  ------------------
  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|     10|  int written = snprintf(python_cmd, sizeof(python_cmd),
  296|     10|                         "python%s -c \"import blosc2_%s; blosc2_%s.print_libpath()\"",
  297|     10|                         python_version, plugin_name, plugin_name);
  298|     10|  if (written < 0 || (size_t)written >= sizeof(python_cmd)) {
  ------------------
  |  Branch (298:7): [True: 0, False: 10]
  |  Branch (298:22): [True: 0, False: 10]
  ------------------
  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|     10|  FILE *fp = popen(python_cmd, "r");
  303|     10|  if (fp == NULL) {
  ------------------
  |  Branch (303:7): [True: 0, False: 10]
  ------------------
  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|     10|  if (fgets(libpath, PATH_MAX, fp) == NULL) {
  ------------------
  |  Branch (307:7): [True: 10, False: 0]
  ------------------
  308|     10|    BLOSC_TRACE_ERROR("Could not read python output");
  ------------------
  |  |   93|     10|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     10|    do {                                            \
  |  |  |  |   98|     10|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     10|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 10, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     10|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  309|     10|    pclose(fp);
  310|     10|    return BLOSC2_ERROR_FAILURE;
  311|     10|  }
  312|      0|  pclose(fp);
  313|       |
  314|      0|  return BLOSC2_ERROR_SUCCESS;
  315|     10|}
blosc2.c:sw32_:
  115|   300k|static inline int32_t sw32_(const void* pa) {
  116|   300k|  int32_t idest;
  117|       |
  118|   300k|  bool little_endian = is_little_endian();
  119|   300k|  if (little_endian) {
  ------------------
  |  Branch (119:7): [True: 300k, False: 0]
  ------------------
  120|   300k|    memcpy(&idest, pa, sizeof(idest));
  121|   300k|  }
  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|   300k|  return idest;
  137|   300k|}
frame.c:endian_handler:
   56|   591k|{
   57|   591k|  bool little_endian = is_little_endian();
   58|   591k|  if (little_endian == little) {
  ------------------
  |  Branch (58:7): [True: 0, False: 591k]
  ------------------
   59|      0|    memcpy(dest, pa, size);
   60|      0|  }
   61|   591k|  else {
   62|   591k|    uint8_t* pa_ = (uint8_t*)pa;
   63|   591k|    uint8_t pa2_[8];
   64|   591k|    switch (size) {
   65|   248k|      case 8:
  ------------------
  |  Branch (65:7): [True: 248k, False: 342k]
  ------------------
   66|   248k|        pa2_[0] = pa_[7];
   67|   248k|        pa2_[1] = pa_[6];
   68|   248k|        pa2_[2] = pa_[5];
   69|   248k|        pa2_[3] = pa_[4];
   70|   248k|        pa2_[4] = pa_[3];
   71|   248k|        pa2_[5] = pa_[2];
   72|   248k|        pa2_[6] = pa_[1];
   73|   248k|        pa2_[7] = pa_[0];
   74|   248k|        break;
   75|   324k|      case 4:
  ------------------
  |  Branch (75:7): [True: 324k, False: 266k]
  ------------------
   76|   324k|        pa2_[0] = pa_[3];
   77|   324k|        pa2_[1] = pa_[2];
   78|   324k|        pa2_[2] = pa_[1];
   79|   324k|        pa2_[3] = pa_[0];
   80|   324k|        break;
   81|  3.72k|      case 2:
  ------------------
  |  Branch (81:7): [True: 3.72k, False: 587k]
  ------------------
   82|  3.72k|        pa2_[0] = pa_[1];
   83|  3.72k|        pa2_[1] = pa_[0];
   84|  3.72k|        break;
   85|  14.1k|      case 1:
  ------------------
  |  Branch (85:7): [True: 14.1k, False: 576k]
  ------------------
   86|  14.1k|        pa2_[0] = pa_[0];
   87|  14.1k|        break;
   88|      0|      default:
  ------------------
  |  Branch (88:7): [True: 0, False: 591k]
  ------------------
   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|   591k|    }
   91|   591k|    memcpy(dest, pa2_, size);
   92|   591k|  }
   93|   591k|}
frame.c:is_little_endian:
   42|   591k|static bool is_little_endian(void) {
   43|   591k|  static const int i = 1;
   44|   591k|  char* p = (char*)&i;
   45|       |
   46|   591k|  if (p[0] == 1) {
  ------------------
  |  Branch (46:7): [True: 591k, False: 0]
  ------------------
   47|   591k|    return true;
   48|   591k|  }
   49|      0|  else {
   50|       |    return false;
   51|      0|  }
   52|   591k|}
frame.c:blosc2_nchunks_to_offsets_nbytes:
  103|   164k|static inline bool blosc2_nchunks_to_offsets_nbytes(int64_t nchunks, int32_t *off_nbytes) {
  104|   164k|  const int64_t max_nchunks = INT32_MAX / (int64_t)sizeof(int64_t);
  105|   164k|  if (nchunks < 0 || nchunks > max_nchunks) {
  ------------------
  |  Branch (105:7): [True: 0, False: 164k]
  |  Branch (105:22): [True: 72, False: 163k]
  ------------------
  106|     72|    return false;
  107|     72|  }
  108|   163k|  if (off_nbytes != NULL) {
  ------------------
  |  Branch (108:7): [True: 163k, False: 0]
  ------------------
  109|   163k|    *off_nbytes = (int32_t)(nchunks * (int64_t)sizeof(int64_t));
  110|   163k|  }
  111|       |  return true;
  112|   164k|}

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

do_nothing:
  632|  1.78M|int do_nothing(uint8_t filter, char cmode) {
  633|  1.78M|  if (cmode == 'c') {
  ------------------
  |  Branch (633:7): [True: 0, False: 1.78M]
  ------------------
  634|      0|    return (filter == BLOSC_NOFILTER);
  635|  1.78M|  } else {
  636|       |    // TRUNC_PREC do not have to be applied during decompression
  637|  1.78M|    return ((filter == BLOSC_NOFILTER) || (filter == BLOSC_TRUNC_PREC));
  ------------------
  |  Branch (637:13): [True: 577k, False: 1.20M]
  |  Branch (637:43): [True: 153k, False: 1.05M]
  ------------------
  638|  1.78M|  }
  639|  1.78M|}
next_filter:
  642|   558k|int next_filter(const uint8_t* filters, int current_filter, char cmode) {
  643|   902k|  for (int i = current_filter - 1; i >= 0; i--) {
  ------------------
  |  Branch (643:36): [True: 902k, False: 0]
  ------------------
  644|   902k|    if (!do_nothing(filters[i], cmode)) {
  ------------------
  |  Branch (644:9): [True: 558k, False: 344k]
  ------------------
  645|   558k|      return filters[i];
  646|   558k|    }
  647|   902k|  }
  648|      0|  return BLOSC_NOFILTER;
  649|   558k|}
last_filter:
  652|   146k|int last_filter(const uint8_t* filters, char cmode) {
  653|   146k|  int last_index = -1;
  654|  1.02M|  for (int i = BLOSC2_MAX_FILTERS - 1; i >= 0; i--) {
  ------------------
  |  Branch (654:40): [True: 879k, False: 146k]
  ------------------
  655|   879k|    if (!do_nothing(filters[i], cmode))  {
  ------------------
  |  Branch (655:9): [True: 491k, False: 387k]
  ------------------
  656|   491k|      last_index = i;
  657|   491k|    }
  658|   879k|  }
  659|   146k|  return last_index;
  660|   146k|}
read_chunk_header:
  739|  79.6M|{
  740|  79.6M|  memset(header, 0, sizeof(blosc_header));
  741|       |
  742|  79.6M|  if (srcsize < BLOSC_MIN_HEADER_LENGTH) {
  ------------------
  |  Branch (742:7): [True: 0, False: 79.6M]
  ------------------
  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|  79.6M|  memcpy(header, src, BLOSC_MIN_HEADER_LENGTH);
  748|       |
  749|  79.6M|  bool little_endian = is_little_endian();
  750|       |
  751|  79.6M|  if (!little_endian) {
  ------------------
  |  Branch (751:7): [True: 0, False: 79.6M]
  ------------------
  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|  79.6M|  if (header->cbytes < BLOSC_MIN_HEADER_LENGTH) {
  ------------------
  |  Branch (757:7): [True: 41, False: 79.6M]
  ------------------
  758|     41|    BLOSC_TRACE_ERROR("`cbytes` is too small to read min header.");
  ------------------
  |  |   93|     41|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     41|    do {                                            \
  |  |  |  |   98|     41|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     41|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 41, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     41|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  759|     41|    return BLOSC2_ERROR_INVALID_HEADER;
  760|     41|  }
  761|  79.6M|  if (header->blocksize <= 0) {
  ------------------
  |  Branch (761:7): [True: 31, False: 79.6M]
  ------------------
  762|     31|    BLOSC_TRACE_ERROR("`blocksize` is zero");
  ------------------
  |  |   93|     31|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     31|    do {                                            \
  |  |  |  |   98|     31|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     31|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 31, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     31|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  763|     31|    return BLOSC2_ERROR_INVALID_HEADER;
  764|     31|  }
  765|  79.6M|  if (header->blocksize > BLOSC2_MAXBLOCKSIZE) {
  ------------------
  |  Branch (765:7): [True: 6, False: 79.6M]
  ------------------
  766|      6|    BLOSC_TRACE_ERROR("`blocksize` greater than maximum allowed");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  767|      6|    return BLOSC2_ERROR_INVALID_HEADER;
  768|      6|  }
  769|  79.6M|  if (header->typesize == 0) {
  ------------------
  |  Branch (769:7): [True: 3, False: 79.6M]
  ------------------
  770|      3|    BLOSC_TRACE_ERROR("`typesize` 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  771|      3|    return BLOSC2_ERROR_INVALID_HEADER;
  772|      3|  }
  773|       |
  774|       |  /* Read extended header if it is wanted */
  775|  79.6M|  if ((extended_header) && (header->flags & BLOSC_DOSHUFFLE) && (header->flags & BLOSC_DOBITSHUFFLE)) {
  ------------------
  |  Branch (775:7): [True: 135k, False: 79.5M]
  |  Branch (775:28): [True: 134k, False: 567]
  |  Branch (775:65): [True: 134k, False: 403]
  ------------------
  776|   134k|    if (header->cbytes < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (776:9): [True: 5, False: 134k]
  ------------------
  777|      5|      BLOSC_TRACE_ERROR("`cbytes` is too small to read extended 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  778|      5|      return BLOSC2_ERROR_INVALID_HEADER;
  779|      5|    }
  780|   134k|    if (srcsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (780:9): [True: 0, False: 134k]
  ------------------
  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|   134k|    memcpy((uint8_t *)header + BLOSC_MIN_HEADER_LENGTH, src + BLOSC_MIN_HEADER_LENGTH,
  786|   134k|      BLOSC_EXTENDED_HEADER_LENGTH - BLOSC_MIN_HEADER_LENGTH);
  787|       |
  788|   134k|    if ((header->blosc2_flags2 & BLOSC2_VL_BLOCKS) && (header->blosc2_flags != 0)) {
  ------------------
  |  Branch (788:9): [True: 313, False: 133k]
  |  Branch (788:55): [True: 106, False: 207]
  ------------------
  789|    106|      int32_t special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
  790|    106|      if (special_type != 0) {
  ------------------
  |  Branch (790:11): [True: 7, False: 99]
  ------------------
  791|      7|        BLOSC_TRACE_ERROR("VL-block chunks cannot use special chunk encodings.");
  ------------------
  |  |   93|      7|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      7|    do {                                            \
  |  |  |  |   98|      7|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      7|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 7, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      7|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  792|      7|        return BLOSC2_ERROR_INVALID_HEADER;
  793|      7|      }
  794|    106|    }
  795|       |
  796|   134k|    int32_t special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
  797|   134k|    if (special_type != 0) {
  ------------------
  |  Branch (797:9): [True: 23.1k, False: 111k]
  ------------------
  798|  23.1k|      if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (798:11): [True: 466, False: 22.6k]
  ------------------
  799|       |        // In this case, the actual type size must be derived from the cbytes
  800|    466|        int32_t typesize = header->cbytes - BLOSC_EXTENDED_HEADER_LENGTH;
  801|    466|        if (typesize <= 0) {
  ------------------
  |  Branch (801:13): [True: 1, False: 465]
  ------------------
  802|      1|          BLOSC_TRACE_ERROR("`typesize` is zero or negative");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  803|      1|          return BLOSC2_ERROR_INVALID_HEADER;
  804|      1|        }
  805|    465|        if (typesize > BLOSC2_MAXTYPESIZE) {
  ------------------
  |  Branch (805:13): [True: 0, False: 465]
  ------------------
  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|    465|        if (typesize > header->nbytes) {
  ------------------
  |  Branch (809:13): [True: 5, False: 460]
  ------------------
  810|      5|          BLOSC_TRACE_ERROR("`typesize` is greater than `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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  811|      5|          return BLOSC2_ERROR_INVALID_HEADER;
  812|      5|        }
  813|    460|        if (header->nbytes % typesize != 0) {
  ------------------
  |  Branch (813:13): [True: 16, False: 444]
  ------------------
  814|     16|          BLOSC_TRACE_ERROR("`nbytes` is not a multiple of typesize");
  ------------------
  |  |   93|     16|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     16|    do {                                            \
  |  |  |  |   98|     16|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     16|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 16, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     16|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  815|     16|          return BLOSC2_ERROR_INVALID_HEADER;
  816|     16|        }
  817|    460|      }
  818|  22.6k|      else {
  819|       |        // All-zero chunks fill with memset, which works regardless of element alignment.
  820|  22.6k|        if (special_type != BLOSC2_SPECIAL_ZERO
  ------------------
  |  Branch (820:13): [True: 1.72k, False: 20.9k]
  ------------------
  821|  1.72k|            && header->nbytes % header->typesize != 0) {
  ------------------
  |  Branch (821:16): [True: 9, False: 1.71k]
  ------------------
  822|      9|          BLOSC_TRACE_ERROR("`nbytes` is not a multiple of typesize");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  823|      9|          return BLOSC2_ERROR_INVALID_HEADER;
  824|      9|        }
  825|  22.6k|      }
  826|  23.1k|    }
  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|   134k|    if (header->version == BLOSC2_VERSION_FORMAT_ALPHA) {
  ------------------
  |  Branch (829:9): [True: 4.56k, False: 129k]
  ------------------
  830|  4.56k|      header->filters[5] = 0;
  831|  4.56k|      header->filters_meta[5] = 0;
  832|  4.56k|    }
  833|   134k|  }
  834|  79.5M|  else {
  835|  79.5M|    flags_to_filters(header->flags, header->filters);
  836|  79.5M|  }
  837|  79.6M|  if (header->version > BLOSC2_VERSION_FORMAT &&
  ------------------
  |  Branch (837:7): [True: 45.2M, False: 34.4M]
  ------------------
  838|  45.2M|      (header->blosc2_flags2 & (uint8_t)~BLOSC2_VL_BLOCKS) != 0) {
  ------------------
  |  Branch (838:7): [True: 9, False: 45.2M]
  ------------------
  839|       |    /* Version from future with unsupported chunk features. */
  840|      9|    return BLOSC2_ERROR_VERSION_SUPPORT;
  841|      9|  }
  842|  79.6M|  if ((header->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0 &&
  ------------------
  |  Branch (842:7): [True: 301, False: 79.6M]
  ------------------
  843|    301|      (header->flags & (uint8_t)BLOSC_MEMCPYED) != 0) {
  ------------------
  |  Branch (843:7): [True: 2, False: 299]
  ------------------
  844|      2|    BLOSC_TRACE_ERROR("VL-block chunks cannot be memcpyed.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  845|      2|    return BLOSC2_ERROR_INVALID_HEADER;
  846|      2|  }
  847|  79.6M|  if ((header->blosc2_flags2 & BLOSC2_VL_BLOCKS) == 0 &&
  ------------------
  |  Branch (847:7): [True: 79.6M, False: 299]
  ------------------
  848|  79.6M|      header->nbytes > 0 && header->blocksize > header->nbytes) {
  ------------------
  |  Branch (848:7): [True: 79.6M, False: 24.4k]
  |  Branch (848:29): [True: 110k, False: 79.5M]
  ------------------
  849|   110k|    header->blocksize = header->nbytes;
  850|   110k|  }
  851|  79.6M|  return 0;
  852|  79.6M|}
fill_codec:
  935|      5|int fill_codec(blosc2_codec *codec) {
  936|      5|  char libpath[PATH_MAX];
  937|      5|  void *lib = load_lib(codec->compname, libpath);
  938|      5|  if(lib == NULL) {
  ------------------
  |  Branch (938:6): [True: 5, False: 0]
  ------------------
  939|      5|    BLOSC_TRACE_ERROR("Error while loading the library for codec `%s`", codec->compname);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  940|      5|    return BLOSC2_ERROR_FAILURE;
  941|      5|  }
  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|   453k|void _cycle_buffers(uint8_t **src, uint8_t **dest, uint8_t **tmp) {
 1049|   453k|  uint8_t *tmp2 = *src;
 1050|   453k|  *src = *dest;
 1051|   453k|  *dest = *tmp;
 1052|   453k|  *tmp = tmp2;
 1053|   453k|}
pipeline_backward:
 1475|   133k|                      uint8_t* tmp2, int last_filter_index, int32_t nblock) {
 1476|   133k|  blosc2_context* context = thread_context->parent_context;
 1477|   133k|  int32_t typesize = context->typesize;
 1478|   133k|  uint8_t* filters = context->filters;
 1479|   133k|  uint8_t* filters_meta = context->filters_meta;
 1480|   133k|  uint8_t* _src = src;
 1481|   133k|  uint8_t* _dest = tmp;
 1482|   133k|  uint8_t* _tmp = tmp2;
 1483|   133k|  int errcode = 0;
 1484|       |
 1485|   645k|  for (int i = BLOSC2_MAX_FILTERS - 1; i >= 0; i--) {
  ------------------
  |  Branch (1485:40): [True: 645k, False: 0]
  ------------------
 1486|       |    // Delta filter requires the whole chunk ready
 1487|   645k|    int last_copy_filter = (last_filter_index == i) || (filters[i] == BLOSC_DELTA) ||
  ------------------
  |  Branch (1487:28): [True: 133k, False: 511k]
  |  Branch (1487:56): [True: 94.0k, False: 417k]
  ------------------
 1488|   417k|                           (next_filter(filters, i, 'd') == BLOSC_DELTA);
  ------------------
  |  Branch (1488:28): [True: 111k, False: 306k]
  ------------------
 1489|   645k|    if (last_copy_filter && context->postfilter == NULL &&
  ------------------
  |  Branch (1489:9): [True: 338k, False: 306k]
  |  Branch (1489:29): [True: 338k, False: 0]
  ------------------
 1490|   338k|        (filters[i] == BLOSC_DELTA || _src != dest + offset)) {
  ------------------
  |  Branch (1490:10): [True: 112k, False: 226k]
  |  Branch (1490:39): [True: 171k, False: 54.9k]
  ------------------
 1491|   283k|      _dest = dest + offset;
 1492|   283k|    }
 1493|   645k|    int rc = BLOSC2_ERROR_SUCCESS;
 1494|   645k|    if (filters[i] <= BLOSC2_DEFINED_FILTERS_STOP) {
  ------------------
  |  Branch (1494:9): [True: 517k, False: 127k]
  ------------------
 1495|   517k|      switch (filters[i]) {
 1496|   143k|        case BLOSC_SHUFFLE:
  ------------------
  |  Branch (1496:9): [True: 143k, False: 374k]
  ------------------
 1497|       |        // if filters_meta is not 0, interpret as number of bytes to be grouped together for shuffle
 1498|   143k|          blosc2_unshuffle(filters_meta[i] == 0 ? typesize : filters_meta[i], bsize, _src, _dest);
  ------------------
  |  Branch (1498:28): [True: 16.1k, False: 127k]
  ------------------
 1499|   143k|          break;
 1500|  70.5k|        case BLOSC_BITSHUFFLE:
  ------------------
  |  Branch (1500:9): [True: 70.5k, False: 447k]
  ------------------
 1501|  70.5k|          if (bitunshuffle(typesize, bsize, _src, _dest, context->src[BLOSC2_CHUNK_VERSION]) < 0) {
  ------------------
  |  Branch (1501:15): [True: 0, False: 70.5k]
  ------------------
 1502|      0|            return BLOSC2_ERROR_FILTER_PIPELINE;
 1503|      0|          }
 1504|  70.5k|          break;
 1505|   112k|        case BLOSC_DELTA:
  ------------------
  |  Branch (1505:9): [True: 112k, False: 405k]
  ------------------
 1506|   112k|          if (context->nthreads == 1) {
  ------------------
  |  Branch (1506:15): [True: 112k, False: 0]
  ------------------
 1507|       |            /* Serial mode */
 1508|   112k|            delta_decoder(dest, offset, bsize, typesize, _dest);
 1509|   112k|          } 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|   112k|          break;
 1531|  50.7k|        case BLOSC_TRUNC_PREC:
  ------------------
  |  Branch (1531:9): [True: 50.7k, False: 467k]
  ------------------
 1532|       |          // TRUNC_PREC filter does not need to be undone
 1533|  50.7k|          break;
 1534|   141k|        default:
  ------------------
  |  Branch (1534:9): [True: 141k, False: 376k]
  ------------------
 1535|   141k|          if (filters[i] != BLOSC_NOFILTER) {
  ------------------
  |  Branch (1535:15): [True: 79, False: 140k]
  ------------------
 1536|     79|            BLOSC_TRACE_ERROR("Filter %d not handled during decompression.",
  ------------------
  |  |   93|     79|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     79|    do {                                            \
  |  |  |  |   98|     79|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     79|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 79, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     79|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1537|     79|                              filters[i]);
 1538|     79|            errcode = -1;
 1539|     79|          }
 1540|   517k|      }
 1541|   517k|    } else {
 1542|       |        // Look for the filters_meta in user filters and run it
 1543|   460k|        for (uint64_t j = 0; j < g_nfilters; ++j) {
  ------------------
  |  Branch (1543:30): [True: 460k, False: 169]
  ------------------
 1544|   460k|          if (g_filters[j].id == filters[i]) {
  ------------------
  |  Branch (1544:15): [True: 126k, False: 333k]
  ------------------
 1545|   126k|            if (g_filters[j].backward == NULL) {
  ------------------
  |  Branch (1545:17): [True: 0, False: 126k]
  ------------------
 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|   126k|            if (g_filters[j].backward != NULL) {
  ------------------
  |  Branch (1552:17): [True: 126k, False: 0]
  ------------------
 1553|   126k|              blosc2_dparams dparams;
 1554|   126k|              blosc2_ctx_get_dparams(context, &dparams);
 1555|   126k|              rc = g_filters[j].backward(_src, _dest, bsize, filters_meta[i], &dparams, g_filters[j].id);
 1556|   126k|            } 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|   126k|            if (rc != BLOSC2_ERROR_SUCCESS) {
  ------------------
  |  Branch (1560:17): [True: 40, False: 126k]
  ------------------
 1561|     40|              BLOSC_TRACE_ERROR("User-defined filter %d failed during decompression.", filters[i]);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1562|     40|              return rc;
 1563|     40|            }
 1564|   126k|            goto urfiltersuccess;
 1565|   126k|          }
 1566|   460k|        }
 1567|    169|      BLOSC_TRACE_ERROR("User-defined filter %d not found during decompression.", filters[i]);
  ------------------
  |  |   93|    169|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    169|    do {                                            \
  |  |  |  |   98|    169|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    169|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 169, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    169|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1568|    169|      return BLOSC2_ERROR_FILTER_PIPELINE;
 1569|   126k|      urfiltersuccess:;
 1570|   126k|    }
 1571|       |
 1572|       |    // Cycle buffers when required
 1573|   644k|    if ((filters[i] != BLOSC_NOFILTER) && (filters[i] != BLOSC_TRUNC_PREC)) {
  ------------------
  |  Branch (1573:9): [True: 503k, False: 140k]
  |  Branch (1573:43): [True: 453k, False: 50.7k]
  ------------------
 1574|   453k|      _cycle_buffers(&_src, &_dest, &_tmp);
 1575|   453k|    }
 1576|   644k|    if (last_filter_index == i) {
  ------------------
  |  Branch (1576:9): [True: 133k, False: 511k]
  ------------------
 1577|   133k|      break;
 1578|   133k|    }
 1579|   644k|  }
 1580|       |
 1581|   133k|  if (context->postfilter == NULL && _src != dest + offset) {
  ------------------
  |  Branch (1581:7): [True: 133k, False: 0]
  |  Branch (1581:38): [True: 29.8k, False: 103k]
  ------------------
 1582|  29.8k|    memcpy(dest + offset, _src, (unsigned int)bsize);
 1583|  29.8k|  }
 1584|       |
 1585|       |  /* Postfilter function */
 1586|   133k|  if (context->postfilter != NULL) {
  ------------------
  |  Branch (1586:7): [True: 0, False: 133k]
  ------------------
 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|   133k|  return errcode;
 1609|   133k|}
free_thread_context:
 2294|  74.5k|void free_thread_context(struct thread_context* thread_context) {
 2295|  74.5k|  destroy_thread_context(thread_context);
 2296|  74.5k|  my_free(thread_context);
 2297|  74.5k|}
check_nthreads:
 2300|  71.8k|int check_nthreads(blosc2_context* context) {
 2301|  71.8k|  if (context->new_nthreads != context->nthreads && context->new_nthreads <= 0) {
  ------------------
  |  Branch (2301:7): [True: 0, False: 71.8k]
  |  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|  71.8k|  if (context->nthreads <= 0) {
  ------------------
  |  Branch (2305:7): [True: 0, False: 71.8k]
  ------------------
 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|  71.8k|  if (context->thread_backend == BLOSC_BACKEND_SHARED_POOL &&
  ------------------
  |  |   33|   143k|#define BLOSC_BACKEND_SHARED_POOL 1
  ------------------
  |  Branch (2313:7): [True: 0, False: 71.8k]
  ------------------
 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|  71.8k|  if (context->new_nthreads != context->nthreads) {
  ------------------
  |  Branch (2320:7): [True: 0, False: 71.8k]
  ------------------
 2321|      0|    release_thread_backend(context);
 2322|      0|    context->nthreads = context->new_nthreads;
 2323|      0|  }
 2324|  71.8k|  if (context->nthreads > 1 && context->threads_started == 0) {
  ------------------
  |  Branch (2324:7): [True: 0, False: 71.8k]
  |  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|  71.8k|  if (context->nthreads <= 1) {
  ------------------
  |  Branch (2340:7): [True: 71.8k, False: 0]
  ------------------
 2341|  71.8k|    context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   32|  71.8k|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 2342|  71.8k|  }
 2343|       |
 2344|  71.8k|  return context->nthreads;
 2345|  71.8k|}
build_filters:
 3687|  26.4k|                   const int32_t typesize, uint8_t* filters) {
 3688|       |
 3689|       |  /* Fill the end part of the filter pipeline */
 3690|  26.4k|  if ((doshuffle == BLOSC_SHUFFLE) && (typesize > 1))
  ------------------
  |  Branch (3690:7): [True: 0, False: 26.4k]
  |  Branch (3690:39): [True: 0, False: 0]
  ------------------
 3691|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_SHUFFLE;
 3692|  26.4k|  if (doshuffle == BLOSC_BITSHUFFLE)
  ------------------
  |  Branch (3692:7): [True: 0, False: 26.4k]
  ------------------
 3693|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_BITSHUFFLE;
 3694|  26.4k|  if (doshuffle == BLOSC_NOSHUFFLE)
  ------------------
  |  Branch (3694:7): [True: 0, False: 26.4k]
  ------------------
 3695|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_NOSHUFFLE;
 3696|  26.4k|  if (delta)
  ------------------
  |  Branch (3696:7): [True: 0, False: 26.4k]
  ------------------
 3697|      0|    filters[BLOSC2_MAX_FILTERS - 2] = BLOSC_DELTA;
 3698|  26.4k|}
blosc2_decompress_ctx:
 3944|  72.7k|                          void* dest, int32_t destsize) {
 3945|  72.7k|  int result;
 3946|       |
 3947|  72.7k|  if (context->do_compress != 0) {
  ------------------
  |  Branch (3947:7): [True: 0, False: 72.7k]
  ------------------
 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|  72.7k|  result = blosc_run_decompression_with_context(context, src, srcsize, dest, destsize);
 3953|       |
 3954|       |  // Reset a possible block_maskout
 3955|  72.7k|  if (context->block_maskout != NULL) {
  ------------------
  |  Branch (3955:7): [True: 0, False: 72.7k]
  ------------------
 3956|      0|    free(context->block_maskout);
 3957|      0|    context->block_maskout = NULL;
 3958|      0|  }
 3959|  72.7k|  context->block_maskout_nitems = 0;
 3960|       |
 3961|  72.7k|  return result;
 3962|  72.7k|}
_blosc_getitem:
 4266|  62.4k|                   int start, int nitems, void* dest, int32_t destsize) {
 4267|  62.4k|  uint8_t* _src = (uint8_t*)(src);  /* current pos for source buffer */
 4268|  62.4k|  uint8_t* _dest = (uint8_t*)(dest);
 4269|  62.4k|  int32_t ntbytes = 0;              /* the number of uncompressed bytes */
 4270|  62.4k|  int32_t bsize, bsize2, ebsize, leftoverblock;
 4271|  62.4k|  int32_t startb, stopb;
 4272|  62.4k|  int32_t stop;
 4273|  62.4k|  int32_t nitems_bytes;
 4274|  62.4k|  int64_t start64 = (int64_t)start;
 4275|  62.4k|  int64_t nitems64 = (int64_t)nitems;
 4276|  62.4k|  int64_t typesize64 = (int64_t)header->typesize;
 4277|  62.4k|  int64_t stop64;
 4278|  62.4k|  int64_t nitems_bytes64;
 4279|  62.4k|  int64_t start_bytes64;
 4280|  62.4k|  int64_t stop_bytes64;
 4281|  62.4k|  int j, rc;
 4282|       |
 4283|  62.4k|  if (nitems == 0) {
  ------------------
  |  Branch (4283:7): [True: 0, False: 62.4k]
  ------------------
 4284|       |    // We have nothing to do
 4285|      0|    return 0;
 4286|      0|  }
 4287|  62.4k|  if (nitems < 0) {
  ------------------
  |  Branch (4287:7): [True: 0, False: 62.4k]
  ------------------
 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|  62.4k|  nitems_bytes64 = nitems64 * typesize64;
 4293|  62.4k|  if (nitems_bytes64 < 0 || nitems_bytes64 > INT32_MAX || nitems_bytes64 > destsize) {
  ------------------
  |  Branch (4293:7): [True: 0, False: 62.4k]
  |  Branch (4293:29): [True: 0, False: 62.4k]
  |  Branch (4293:59): [True: 188, False: 62.2k]
  ------------------
 4294|    188|    BLOSC_TRACE_ERROR("`nitems`*`typesize` out of dest bounds.");
  ------------------
  |  |   93|    188|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    188|    do {                                            \
  |  |  |  |   98|    188|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    188|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 188, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    188|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4295|    188|    return BLOSC2_ERROR_WRITE_BUFFER;
 4296|    188|  }
 4297|  62.2k|  nitems_bytes = (int32_t)nitems_bytes64;
 4298|       |
 4299|  62.2k|  int32_t* bstarts = (int32_t*)(_src + context->header_overhead);
 4300|       |
 4301|       |  /* Check region boundaries */
 4302|  62.2k|  start_bytes64 = start64 * typesize64;
 4303|  62.2k|  if ((start < 0) || (start_bytes64 < 0) || (start_bytes64 > header->nbytes)) {
  ------------------
  |  Branch (4303:7): [True: 0, False: 62.2k]
  |  Branch (4303:22): [True: 0, False: 62.2k]
  |  Branch (4303:45): [True: 0, False: 62.2k]
  ------------------
 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|  62.2k|  stop64 = start64 + nitems64;
 4309|  62.2k|  if ((stop64 < 0) || (stop64 > INT32_MAX)) {
  ------------------
  |  Branch (4309:7): [True: 0, False: 62.2k]
  |  Branch (4309:23): [True: 0, False: 62.2k]
  ------------------
 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|  62.2k|  stop = (int32_t)stop64;
 4314|       |
 4315|  62.2k|  stop_bytes64 = stop64 * typesize64;
 4316|  62.2k|  if ((stop_bytes64 < 0) || (stop_bytes64 > header->nbytes)) {
  ------------------
  |  Branch (4316:7): [True: 0, False: 62.2k]
  |  Branch (4316:29): [True: 0, False: 62.2k]
  ------------------
 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|  62.2k|  bool chunk_memcpyed = (header->flags & (uint8_t)BLOSC_MEMCPYED) != 0;
 4322|  62.2k|  if (!context->special_type && !chunk_memcpyed &&
  ------------------
  |  Branch (4322:7): [True: 57.6k, False: 4.66k]
  |  Branch (4322:33): [True: 56.5k, False: 1.05k]
  ------------------
 4323|  56.5k|      ((uint8_t *)(_src + srcsize) < (uint8_t *)(bstarts + context->nblocks))) {
  ------------------
  |  Branch (4323:7): [True: 0, False: 56.5k]
  ------------------
 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|  62.2k|  bool memcpyed = header->flags & (uint8_t)BLOSC_MEMCPYED;
 4329|  62.2k|  if (context->special_type) {
  ------------------
  |  Branch (4329:7): [True: 4.66k, False: 57.6k]
  ------------------
 4330|       |    // Fake a runlen as if its a memcpyed chunk
 4331|  4.66k|    memcpyed = true;
 4332|  4.66k|  }
 4333|       |
 4334|  62.2k|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (4334:19): [True: 61.9k, False: 337]
  ------------------
 4335|  61.9k|                  (context->blosc2_flags & 0x08u) && !context->special_type);
  ------------------
  |  Branch (4335:19): [True: 934, False: 61.0k]
  |  Branch (4335:54): [True: 0, False: 934]
  ------------------
 4336|  62.2k|  if (memcpyed && !is_lazy && !context->postfilter) {
  ------------------
  |  Branch (4336:7): [True: 5.71k, False: 56.5k]
  |  Branch (4336:19): [True: 5.71k, False: 0]
  |  Branch (4336:31): [True: 5.71k, False: 0]
  ------------------
 4337|       |    // Short-circuit for (non-lazy) memcpyed or special values
 4338|  5.71k|    ntbytes = nitems_bytes;
 4339|  5.71k|    switch (context->special_type) {
 4340|     75|      case BLOSC2_SPECIAL_VALUE: {
  ------------------
  |  Branch (4340:7): [True: 75, False: 5.63k]
  ------------------
 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|     75|        int32_t value_typesize = header->cbytes - context->header_overhead;
 4346|     75|        rc = set_values(value_typesize, _src, _dest, ntbytes);
 4347|     75|        if (rc < 0) {
  ------------------
  |  Branch (4347:13): [True: 29, False: 46]
  ------------------
 4348|     29|          BLOSC_TRACE_ERROR("set_values failed");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4349|     29|          return BLOSC2_ERROR_DATA;
 4350|     29|        }
 4351|     46|        break;
 4352|     75|      }
 4353|     63|      case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (4353:7): [True: 63, False: 5.65k]
  ------------------
 4354|     63|        rc = set_nans(context->typesize, _dest, ntbytes);
 4355|     63|        if (rc < 0) {
  ------------------
  |  Branch (4355:13): [True: 0, False: 63]
  ------------------
 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|     63|        break;
 4360|  4.51k|      case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (4360:7): [True: 4.51k, False: 1.20k]
  ------------------
 4361|  4.51k|        memset(_dest, 0, ntbytes);
 4362|  4.51k|        break;
 4363|     13|      case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (4363:7): [True: 13, False: 5.70k]
  ------------------
 4364|       |        // We do nothing here
 4365|     13|        break;
 4366|  1.05k|      case BLOSC2_NO_SPECIAL:
  ------------------
  |  Branch (4366:7): [True: 1.05k, False: 4.66k]
  ------------------
 4367|  1.05k|        {
 4368|  1.05k|          int64_t src_offset64 = (int64_t)context->header_overhead + start_bytes64;
 4369|  1.05k|          int64_t src_stop64 = src_offset64 + nitems_bytes64;
 4370|  1.05k|          if ((src_offset64 < 0) || (src_stop64 < src_offset64) || (src_stop64 > srcsize)) {
  ------------------
  |  Branch (4370:15): [True: 0, False: 1.05k]
  |  Branch (4370:37): [True: 0, False: 1.05k]
  |  Branch (4370:68): [True: 0, False: 1.05k]
  ------------------
 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.05k|          _src += (int32_t)src_offset64;
 4375|  1.05k|        }
 4376|      0|        memcpy(_dest, _src, ntbytes);
 4377|  1.05k|        break;
 4378|      0|      default:
  ------------------
  |  Branch (4378:7): [True: 0, False: 5.71k]
  ------------------
 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|  5.71k|    }
 4382|  5.68k|    return ntbytes;
 4383|  5.71k|  }
 4384|       |
 4385|  56.5k|  ebsize = header->blocksize + header->typesize * (signed)sizeof(int32_t);
 4386|  56.5k|  struct thread_context* scontext = context->serial_context;
 4387|       |  /* Resize the temporaries in serial context if needed */
 4388|  56.5k|  if (header->blocksize > scontext->tmp_blocksize) {
  ------------------
  |  Branch (4388:7): [True: 0, False: 56.5k]
  ------------------
 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|   115k|  for (j = 0; j < context->nblocks; j++) {
  ------------------
  |  Branch (4399:15): [True: 97.3k, False: 17.8k]
  ------------------
 4400|  97.3k|    bsize = header->blocksize;
 4401|  97.3k|    leftoverblock = 0;
 4402|  97.3k|    if ((j == context->nblocks - 1) && (context->leftover > 0)) {
  ------------------
  |  Branch (4402:9): [True: 56.5k, False: 40.8k]
  |  Branch (4402:40): [True: 40.6k, False: 15.8k]
  ------------------
 4403|  40.6k|      bsize = context->leftover;
 4404|  40.6k|      leftoverblock = 1;
 4405|  40.6k|    }
 4406|       |
 4407|       |    /* Compute start & stop for each block */
 4408|  97.3k|    startb = start * header->typesize - j * header->blocksize;
 4409|  97.3k|    stopb = stop * header->typesize - j * header->blocksize;
 4410|  97.3k|    if (stopb <= 0) {
  ------------------
  |  Branch (4410:9): [True: 38.6k, False: 58.7k]
  ------------------
 4411|       |      // We can exit as soon as this block is beyond stop
 4412|  38.6k|      break;
 4413|  38.6k|    }
 4414|  58.7k|    if (startb >= header->blocksize) {
  ------------------
  |  Branch (4414:9): [True: 2.01k, False: 56.6k]
  ------------------
 4415|  2.01k|      continue;
 4416|  2.01k|    }
 4417|  56.6k|    if (startb < 0) {
  ------------------
  |  Branch (4417:9): [True: 121, False: 56.5k]
  ------------------
 4418|    121|      startb = 0;
 4419|    121|    }
 4420|  56.6k|    if (stopb > header->blocksize) {
  ------------------
  |  Branch (4420:9): [True: 121, False: 56.5k]
  ------------------
 4421|    121|      stopb = header->blocksize;
 4422|    121|    }
 4423|  56.6k|    bsize2 = stopb - startb;
 4424|       |
 4425|  56.6k|#if defined(HAVE_ZFP)
 4426|  56.6k|    if (context->compcode == BLOSC_CODEC_ZFP_FIXED_RATE) {
  ------------------
  |  Branch (4426:9): [True: 10.3k, False: 46.3k]
  ------------------
 4427|  10.3k|      scontext->zfp_cell_start = startb / context->typesize;
 4428|  10.3k|      scontext->zfp_cell_nitems = nitems;
 4429|  10.3k|    }
 4430|  56.6k|#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|  56.6k|    bool get_single_block = ((startb == 0) && (bsize == nitems_bytes));
  ------------------
  |  Branch (4435:30): [True: 1.39k, False: 55.2k]
  |  Branch (4435:47): [True: 9, False: 1.38k]
  ------------------
 4436|  56.6k|    uint8_t* tmp2 = get_single_block ? dest : scontext->tmp2;
  ------------------
  |  Branch (4436:21): [True: 9, False: 56.6k]
  ------------------
 4437|       |
 4438|       |    // If memcpyed we don't have a bstarts section (because it is not needed)
 4439|  56.6k|    int32_t src_offset = memcpyed ?
  ------------------
  |  Branch (4439:26): [True: 0, False: 56.6k]
  ------------------
 4440|  56.6k|      context->header_overhead + j * header->blocksize : sw32_(bstarts + j);
 4441|       |
 4442|  56.6k|    int32_t cbytes = blosc_d(context->serial_context, bsize, leftoverblock, memcpyed,
 4443|  56.6k|                             src, srcsize, src_offset, j,
 4444|  56.6k|                             tmp2, 0, scontext->tmp, scontext->tmp3);
 4445|  56.6k|    if (cbytes < 0) {
  ------------------
  |  Branch (4445:9): [True: 0, False: 56.6k]
  ------------------
 4446|      0|      ntbytes = cbytes;
 4447|      0|      break;
 4448|      0|    }
 4449|  56.6k|    if (scontext->zfp_cell_nitems > 0) {
  ------------------
  |  Branch (4449:9): [True: 10.3k, False: 46.3k]
  ------------------
 4450|  10.3k|      if (cbytes == bsize2) {
  ------------------
  |  Branch (4450:11): [True: 0, False: 10.3k]
  ------------------
 4451|      0|        memcpy((uint8_t *) dest, tmp2, (unsigned int) bsize2);
 4452|  10.3k|      } else if (cbytes == context->blocksize) {
  ------------------
  |  Branch (4452:18): [True: 10.3k, False: 57]
  ------------------
 4453|  10.3k|        memcpy((uint8_t *) dest, tmp2 + scontext->zfp_cell_start * context->typesize, (unsigned int) bsize2);
 4454|  10.3k|        cbytes = bsize2;
 4455|  10.3k|      }
 4456|  46.3k|    } else if (!get_single_block) {
  ------------------
  |  Branch (4456:16): [True: 46.3k, False: 9]
  ------------------
 4457|       |      /* Copy to destination */
 4458|  46.3k|      memcpy((uint8_t *) dest + ntbytes, tmp2 + startb, (unsigned int) bsize2);
 4459|  46.3k|    }
 4460|  56.6k|    ntbytes += bsize2;
 4461|  56.6k|  }
 4462|       |
 4463|  56.5k|  scontext->zfp_cell_nitems = 0;
 4464|       |
 4465|  56.5k|  if (ntbytes >= 0 && ntbytes != nitems_bytes) {
  ------------------
  |  Branch (4465:7): [True: 56.5k, False: 0]
  |  Branch (4465:23): [True: 0, False: 56.5k]
  ------------------
 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|  56.5k|  return ntbytes;
 4474|  56.5k|}
blosc2_getitem:
 4476|  62.4k|int blosc2_getitem(const void* src, int32_t srcsize, int start, int nitems, void* dest, int32_t destsize) {
 4477|  62.4k|  blosc2_context context;
 4478|  62.4k|  int result;
 4479|       |
 4480|       |  /* Minimally populate the context */
 4481|  62.4k|  memset(&context, 0, sizeof(blosc2_context));
 4482|       |
 4483|  62.4k|  context.schunk = g_schunk;
 4484|  62.4k|  context.nthreads = 1;  // force a serial decompression; fixes #95
 4485|       |
 4486|       |  /* Call the actual getitem function */
 4487|  62.4k|  result = blosc2_getitem_ctx(&context, src, srcsize, start, nitems, dest, destsize);
 4488|       |
 4489|       |  /* Release resources */
 4490|  62.4k|  if (context.serial_context != NULL) {
  ------------------
  |  Branch (4490:7): [True: 62.4k, False: 0]
  ------------------
 4491|  62.4k|    free_thread_context(context.serial_context);
 4492|  62.4k|  }
 4493|  62.4k|  return result;
 4494|  62.4k|}
blosc2_getitem_ctx:
 4542|  62.4k|    int start, int nitems, void* dest, int32_t destsize) {
 4543|  62.4k|  blosc_header header;
 4544|  62.4k|  int result = getitem_read_header(src, srcsize, &header);
 4545|  62.4k|  if (result < 0) {
  ------------------
  |  Branch (4545:7): [True: 0, False: 62.4k]
  ------------------
 4546|      0|    return result;
 4547|      0|  }
 4548|       |
 4549|  62.4k|  return getitem_with_header(context, &header, src, srcsize, start, nitems, dest, destsize);
 4550|  62.4k|}
blosc2_get_nthreads:
 5608|  25.8k|{
 5609|  25.8k|  int16_t nthreads;
 5610|  25.8k|  if (!g_initlib) {
  ------------------
  |  Branch (5610:7): [True: 0, False: 25.8k]
  ------------------
 5611|      0|    blosc2_init();
 5612|      0|  }
 5613|  25.8k|  blosc2_pthread_mutex_lock(&global_comp_mutex);
  ------------------
  |  |   92|  25.8k|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
 5614|  25.8k|  nthreads = g_nthreads;
 5615|  25.8k|  blosc2_pthread_mutex_unlock(&global_comp_mutex);
  ------------------
  |  |   93|  25.8k|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 5616|  25.8k|  return nthreads;
 5617|  25.8k|}
blosc2_set_nthreads:
 5619|  14.1k|int16_t blosc2_set_nthreads(int16_t nthreads) {
 5620|  14.1k|  int16_t ret;          /* the previous number of threads */
 5621|       |
 5622|       |  /* Check whether the library should be initialized */
 5623|  14.1k|  if (!g_initlib) blosc2_init();
  ------------------
  |  Branch (5623:7): [True: 0, False: 14.1k]
  ------------------
 5624|       |
 5625|  14.1k|  blosc2_pthread_mutex_lock(&global_comp_mutex);
  ------------------
  |  |   92|  14.1k|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
 5626|  14.1k|  ret = g_nthreads;
 5627|  14.1k|  if (nthreads != ret) {
  ------------------
  |  Branch (5627:7): [True: 0, False: 14.1k]
  ------------------
 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|  14.1k|  blosc2_pthread_mutex_unlock(&global_comp_mutex);
  ------------------
  |  |   93|  14.1k|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 5643|       |
 5644|  14.1k|  return ret;
 5645|  14.1k|}
blosc2_cbuffer_sizes:
 5797|  79.5M|int blosc2_cbuffer_sizes(const void* cbuffer, int32_t* nbytes, int32_t* cbytes, int32_t* blocksize) {
 5798|  79.5M|  blosc_header header;
 5799|  79.5M|  int rc = read_chunk_header((uint8_t *) cbuffer, BLOSC_MIN_HEADER_LENGTH, false, &header);
 5800|  79.5M|  if (rc < 0) {
  ------------------
  |  Branch (5800:7): [True: 81, False: 79.5M]
  ------------------
 5801|       |    /* Return zeros if error reading header */
 5802|     81|    memset(&header, 0, sizeof(header));
 5803|     81|  }
 5804|       |
 5805|       |  /* Read the interesting values */
 5806|  79.5M|  if (nbytes != NULL)
  ------------------
  |  Branch (5806:7): [True: 79.4M, False: 47.8k]
  ------------------
 5807|  79.4M|    *nbytes = header.nbytes;
 5808|  79.5M|  if (cbytes != NULL)
  ------------------
  |  Branch (5808:7): [True: 79.5M, False: 0]
  ------------------
 5809|  79.5M|    *cbytes = header.cbytes;
 5810|  79.5M|  if (blocksize != NULL)
  ------------------
  |  Branch (5810:7): [True: 74.9k, False: 79.4M]
  ------------------
 5811|  74.9k|    *blocksize = header.blocksize;
 5812|  79.5M|  return rc;
 5813|  79.5M|}
blosc2_init:
 5948|  14.1k|void blosc2_init(void) {
 5949|       |  /* Return if Blosc is already initialized */
 5950|  14.1k|  if (g_initlib) return;
  ------------------
  |  Branch (5950:7): [True: 0, False: 14.1k]
  ------------------
 5951|       |
 5952|  14.1k|  BLOSC2_IO_CB_DEFAULTS.id = BLOSC2_IO_FILESYSTEM;
 5953|  14.1k|  BLOSC2_IO_CB_DEFAULTS.name = "filesystem";
 5954|  14.1k|  BLOSC2_IO_CB_DEFAULTS.is_allocation_necessary = true;
 5955|  14.1k|  BLOSC2_IO_CB_DEFAULTS.open = (blosc2_open_cb) blosc2_stdio_open;
 5956|  14.1k|  BLOSC2_IO_CB_DEFAULTS.close = (blosc2_close_cb) blosc2_stdio_close;
 5957|  14.1k|  BLOSC2_IO_CB_DEFAULTS.size = (blosc2_size_cb) blosc2_stdio_size;
 5958|  14.1k|  BLOSC2_IO_CB_DEFAULTS.write = (blosc2_write_cb) blosc2_stdio_write;
 5959|  14.1k|  BLOSC2_IO_CB_DEFAULTS.read = (blosc2_read_cb) blosc2_stdio_read;
 5960|  14.1k|  BLOSC2_IO_CB_DEFAULTS.truncate = (blosc2_truncate_cb) blosc2_stdio_truncate;
 5961|  14.1k|  BLOSC2_IO_CB_DEFAULTS.destroy = (blosc2_destroy_cb) blosc2_stdio_destroy;
 5962|       |
 5963|  14.1k|  _blosc2_register_io_cb(&BLOSC2_IO_CB_DEFAULTS);
 5964|       |
 5965|  14.1k|  BLOSC2_IO_CB_MMAP.id = BLOSC2_IO_FILESYSTEM_MMAP;
 5966|  14.1k|  BLOSC2_IO_CB_MMAP.name = "filesystem_mmap";
 5967|  14.1k|  BLOSC2_IO_CB_MMAP.is_allocation_necessary = false;
 5968|  14.1k|  BLOSC2_IO_CB_MMAP.open = (blosc2_open_cb) blosc2_stdio_mmap_open;
 5969|  14.1k|  BLOSC2_IO_CB_MMAP.close = (blosc2_close_cb) blosc2_stdio_mmap_close;
 5970|  14.1k|  BLOSC2_IO_CB_MMAP.read = (blosc2_read_cb) blosc2_stdio_mmap_read;
 5971|  14.1k|  BLOSC2_IO_CB_MMAP.size = (blosc2_size_cb) blosc2_stdio_mmap_size;
 5972|  14.1k|  BLOSC2_IO_CB_MMAP.write = (blosc2_write_cb) blosc2_stdio_mmap_write;
 5973|  14.1k|  BLOSC2_IO_CB_MMAP.truncate = (blosc2_truncate_cb) blosc2_stdio_mmap_truncate;
 5974|  14.1k|  BLOSC2_IO_CB_MMAP.destroy = (blosc2_destroy_cb) blosc2_stdio_mmap_destroy;
 5975|       |
 5976|  14.1k|  _blosc2_register_io_cb(&BLOSC2_IO_CB_MMAP);
 5977|       |
 5978|  14.1k|  g_ncodecs = 0;
 5979|  14.1k|  g_nfilters = 0;
 5980|  14.1k|  g_ntuners = 0;
 5981|       |
 5982|  14.1k|#if defined(HAVE_PLUGINS)
 5983|  14.1k|  #include "blosc2/blosc2-common.h"
 5984|  14.1k|  #include "blosc2/blosc2-stdio.h"
 5985|  14.1k|  register_codecs();
 5986|  14.1k|  register_filters();
 5987|  14.1k|  register_tuners();
 5988|  14.1k|#endif
 5989|  14.1k|  blosc2_pthread_mutex_init(&global_comp_mutex, NULL);
  ------------------
  |  |   90|  14.1k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 5990|  14.1k|  blosc2_pthread_mutex_init(&pool_registry_mutex, NULL);
  ------------------
  |  |   90|  14.1k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 5991|       |  /* Create a global context */
 5992|  14.1k|  g_global_context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 5993|  14.1k|  memset(g_global_context, 0, sizeof(blosc2_context));
 5994|  14.1k|  g_global_context->nthreads = g_nthreads;
 5995|  14.1k|  g_global_context->new_nthreads = g_nthreads;
 5996|  14.1k|  blosc2_pthread_mutex_init(&g_global_context->nchunk_mutex, NULL);
  ------------------
  |  |   90|  14.1k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 5997|  14.1k|  g_initlib = 1;
 5998|  14.1k|}
blosc2_free_resources:
 6001|  14.1k|int blosc2_free_resources(void) {
 6002|       |  /* Return if Blosc is not initialized */
 6003|  14.1k|  if (!g_initlib) return BLOSC2_ERROR_FAILURE;
  ------------------
  |  Branch (6003:7): [True: 0, False: 14.1k]
  ------------------
 6004|       |
 6005|  14.1k|  return release_thread_backend(g_global_context);
 6006|  14.1k|}
blosc2_destroy:
 6009|  14.1k|void blosc2_destroy(void) {
 6010|       |  /* Return if Blosc is not initialized */
 6011|  14.1k|  if (!g_initlib) return;
  ------------------
  |  Branch (6011:7): [True: 0, False: 14.1k]
  ------------------
 6012|       |
 6013|  14.1k|  blosc2_free_resources();
 6014|  14.1k|  g_initlib = 0;
 6015|  14.1k|  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|  14.1k|  g_destroy_count++;
 6022|       |
 6023|       |  /* Tear down any remaining shared pools */
 6024|  14.1k|  struct blosc_shared_pool *pool = shared_pools;
 6025|  14.1k|  while (pool != NULL) {
  ------------------
  |  Branch (6025:10): [True: 0, False: 14.1k]
  ------------------
 6026|      0|    struct blosc_shared_pool *next = pool->next;
 6027|      0|    destroy_shared_pool(pool);
 6028|      0|    pool = next;
 6029|      0|  }
 6030|  14.1k|  shared_pools = NULL;
 6031|  14.1k|  blosc2_pthread_mutex_destroy(&pool_registry_mutex);
  ------------------
  |  |   91|  14.1k|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 6032|       |
 6033|  14.1k|  blosc2_pthread_mutex_destroy(&global_comp_mutex);
  ------------------
  |  |   91|  14.1k|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 6034|  14.1k|}
blosc2_create_cctx:
 6040|  26.5k|blosc2_context* blosc2_create_cctx(blosc2_cparams cparams) {
 6041|  26.5k|  blosc2_context* context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 6042|  26.5k|  BLOSC_ERROR_NULL(context, NULL);
  ------------------
  |  |  104|  26.5k|    do {                                            \
  |  |  105|  26.5k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 26.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|  26.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 26.5k]
  |  |  ------------------
  ------------------
 6043|       |
 6044|       |  /* Populate the context, using zeros as default values */
 6045|  26.5k|  memset(context, 0, sizeof(blosc2_context));
 6046|  26.5k|  context->do_compress = 1;   /* meant for compression */
 6047|  26.5k|  context->use_dict = cparams.use_dict;
 6048|  26.5k|  if (cparams.instr_codec) {
  ------------------
  |  Branch (6048:7): [True: 0, False: 26.5k]
  ------------------
 6049|      0|    context->blosc2_flags = BLOSC2_INSTR_CODEC;
 6050|      0|  }
 6051|       |
 6052|   185k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (6052:19): [True: 159k, False: 26.4k]
  ------------------
 6053|   159k|    context->filters[i] = cparams.filters[i];
 6054|   159k|    context->filters_meta[i] = cparams.filters_meta[i];
 6055|       |
 6056|   159k|    if (context->filters[i] >= BLOSC_LAST_FILTER && context->filters[i] <= BLOSC2_DEFINED_FILTERS_STOP) {
  ------------------
  |  Branch (6056:9): [True: 2.06k, False: 157k]
  |  Branch (6056:53): [True: 25, False: 2.03k]
  ------------------
 6057|     25|      BLOSC_TRACE_ERROR("filter (%d) is not yet defined",
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6058|     25|                        context->filters[i]);
 6059|     25|      free(context);
 6060|     25|      return NULL;
 6061|     25|    }
 6062|   159k|    if (context->filters[i] > BLOSC_LAST_REGISTERED_FILTER && context->filters[i] <= BLOSC2_GLOBAL_REGISTERED_FILTERS_STOP) {
  ------------------
  |  Branch (6062:9): [True: 1.44k, False: 157k]
  |  Branch (6062:63): [True: 53, False: 1.39k]
  ------------------
 6063|     53|      BLOSC_TRACE_ERROR("filter (%d) is not yet defined",
  ------------------
  |  |   93|     53|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     53|    do {                                            \
  |  |  |  |   98|     53|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     53|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 53, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     53|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6064|     53|                        context->filters[i]);
 6065|     53|      free(context);
 6066|     53|      return NULL;
 6067|     53|    }
 6068|   159k|  }
 6069|       |
 6070|  26.4k|#if defined(HAVE_ZFP)
 6071|  26.4k|#include "blosc2/codecs-registry.h"
 6072|  26.4k|  if ((context->compcode >= BLOSC_CODEC_ZFP_FIXED_ACCURACY) && (context->compcode <= BLOSC_CODEC_ZFP_FIXED_RATE)) {
  ------------------
  |  Branch (6072:7): [True: 0, False: 26.4k]
  |  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|  26.4k|#endif /* HAVE_ZFP */
 6081|       |
 6082|       |  /* Check for a BLOSC_SHUFFLE environment variable */
 6083|  26.4k|  int doshuffle = -1;
 6084|  26.4k|  char* envvar = getenv("BLOSC_SHUFFLE");
 6085|  26.4k|  if (envvar != NULL) {
  ------------------
  |  Branch (6085:7): [True: 0, False: 26.4k]
  ------------------
 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|  26.4k|  int dodelta = BLOSC_NOFILTER;
 6101|  26.4k|  envvar = getenv("BLOSC_DELTA");
 6102|  26.4k|  if (envvar != NULL) {
  ------------------
  |  Branch (6102:7): [True: 0, False: 26.4k]
  ------------------
 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|  26.4k|  context->typesize = cparams.typesize;
 6114|  26.4k|  envvar = getenv("BLOSC_TYPESIZE");
 6115|  26.4k|  if (envvar != NULL) {
  ------------------
  |  Branch (6115:7): [True: 0, False: 26.4k]
  ------------------
 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|  26.4k|  build_filters(doshuffle, dodelta, context->typesize, context->filters);
 6127|       |
 6128|  26.4k|  context->clevel = cparams.clevel;
 6129|       |  /* Check for a BLOSC_CLEVEL environment variable */
 6130|  26.4k|  envvar = getenv("BLOSC_CLEVEL");
 6131|  26.4k|  if (envvar != NULL) {
  ------------------
  |  Branch (6131:7): [True: 0, False: 26.4k]
  ------------------
 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|  26.4k|  context->compcode = cparams.compcode;
 6144|       |  /* Check for a BLOSC_COMPRESSOR environment variable */
 6145|  26.4k|  envvar = getenv("BLOSC_COMPRESSOR");
 6146|  26.4k|  if (envvar != NULL) {
  ------------------
  |  Branch (6146:7): [True: 0, False: 26.4k]
  ------------------
 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|  26.4k|  context->compcode_meta = cparams.compcode_meta;
 6155|       |
 6156|  26.4k|  context->blocksize = cparams.blocksize;
 6157|       |  /* Check for a BLOSC_BLOCKSIZE environment variable */
 6158|  26.4k|  envvar = getenv("BLOSC_BLOCKSIZE");
 6159|  26.4k|  if (envvar != NULL) {
  ------------------
  |  Branch (6159:7): [True: 0, False: 26.4k]
  ------------------
 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|  26.4k|  context->nthreads = cparams.nthreads;
 6172|       |  /* Check for a BLOSC_NTHREADS environment variable */
 6173|  26.4k|  envvar = getenv("BLOSC_NTHREADS");
 6174|  26.4k|  if (envvar != NULL) {
  ------------------
  |  Branch (6174:7): [True: 0, False: 26.4k]
  ------------------
 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|  26.4k|  context->new_nthreads = context->nthreads;
 6185|       |
 6186|  26.4k|  context->splitmode = cparams.splitmode;
 6187|       |  /* Check for a BLOSC_SPLITMODE environment variable */
 6188|  26.4k|  envvar = getenv("BLOSC_SPLITMODE");
 6189|  26.4k|  if (envvar != NULL) {
  ------------------
  |  Branch (6189:7): [True: 0, False: 26.4k]
  ------------------
 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|  26.4k|  context->threads_started = 0;
 6212|  26.4k|  blosc2_pthread_mutex_init(&context->nchunk_mutex, NULL);
  ------------------
  |  |   90|  26.4k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 6213|  26.4k|  context->schunk = cparams.schunk;
 6214|       |
 6215|  26.4k|  if (cparams.prefilter != NULL) {
  ------------------
  |  Branch (6215:7): [True: 0, False: 26.4k]
  ------------------
 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|  26.4k|  if (cparams.tuner_id <= 0) {
  ------------------
  |  Branch (6222:7): [True: 26.4k, False: 0]
  ------------------
 6223|  26.4k|    cparams.tuner_id = g_tuner;
 6224|  26.4k|  } 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|  26.4k|  urtunersuccess:;
 6244|       |
 6245|  26.4k|  context->tuner_id = cparams.tuner_id;
 6246|       |
 6247|  26.4k|  context->codec_params = cparams.codec_params;
 6248|  26.4k|  memcpy(context->filter_params, cparams.filter_params, BLOSC2_MAX_FILTERS * sizeof(void*));
 6249|       |
 6250|  26.4k|  return context;
 6251|  26.4k|}
blosc2_create_dctx:
 6254|  25.2k|blosc2_context* blosc2_create_dctx(blosc2_dparams dparams) {
 6255|  25.2k|  blosc2_context* context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 6256|  25.2k|  BLOSC_ERROR_NULL(context, NULL);
  ------------------
  |  |  104|  25.2k|    do {                                            \
  |  |  105|  25.2k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 25.2k]
  |  |  ------------------
  |  |  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|  25.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 25.2k]
  |  |  ------------------
  ------------------
 6257|       |
 6258|       |  /* Populate the context, using zeros as default values */
 6259|  25.2k|  memset(context, 0, sizeof(blosc2_context));
 6260|  25.2k|  context->do_compress = 0;   /* Meant for decompression */
 6261|       |
 6262|  25.2k|  context->nthreads = dparams.nthreads;
 6263|  25.2k|  char* envvar = getenv("BLOSC_NTHREADS");
 6264|  25.2k|  if (envvar != NULL) {
  ------------------
  |  Branch (6264:7): [True: 0, False: 25.2k]
  ------------------
 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|  25.2k|  context->new_nthreads = context->nthreads;
 6272|       |
 6273|  25.2k|  context->threads_started = 0;
 6274|  25.2k|  context->block_maskout = NULL;
 6275|  25.2k|  context->block_maskout_nitems = 0;
 6276|  25.2k|  blosc2_pthread_mutex_init(&context->nchunk_mutex, NULL);
  ------------------
  |  |   90|  25.2k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 6277|  25.2k|  context->schunk = dparams.schunk;
 6278|       |
 6279|  25.2k|  if (dparams.postfilter != NULL) {
  ------------------
  |  Branch (6279:7): [True: 0, False: 25.2k]
  ------------------
 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|  25.2k|  return context;
 6287|  25.2k|}
blosc2_free_ctx:
 6290|  65.8k|void blosc2_free_ctx(blosc2_context* context) {
 6291|  65.8k|  if (g_initlib ||
  ------------------
  |  Branch (6291:7): [True: 51.7k, False: 14.1k]
  ------------------
 6292|  14.1k|      context->thread_backend == BLOSC_BACKEND_PER_CONTEXT ||
  ------------------
  |  |   35|  79.9k|#define BLOSC_BACKEND_PER_CONTEXT 3   /* per-context threads; used on Windows */
  ------------------
  |  Branch (6292:7): [True: 0, False: 14.1k]
  ------------------
 6293|  51.7k|      context->thread_backend == BLOSC_BACKEND_CALLBACK) {
  ------------------
  |  |   34|  14.1k|#define BLOSC_BACKEND_CALLBACK 2
  ------------------
  |  Branch (6293:7): [True: 0, False: 14.1k]
  ------------------
 6294|  51.7k|    release_thread_backend(context);
 6295|  51.7k|  }
 6296|  65.8k|  if (context->serial_context != NULL) {
  ------------------
  |  Branch (6296:7): [True: 12.0k, False: 53.7k]
  ------------------
 6297|  12.0k|    free_thread_context(context->serial_context);
 6298|  12.0k|  }
 6299|  65.8k|  blosc2_pthread_mutex_destroy(&context->nchunk_mutex);
  ------------------
  |  |   91|  65.8k|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 6300|  65.8k|  release_context_dict_buffer(context);
 6301|  65.8k|  if (context->dict_cdict != NULL) {
  ------------------
  |  Branch (6301:7): [True: 0, False: 65.8k]
  ------------------
 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|  65.8k|  if (context->dict_ddict != NULL) {
  ------------------
  |  Branch (6313:7): [True: 2.57k, False: 63.2k]
  ------------------
 6314|  2.57k|#ifdef HAVE_ZSTD
 6315|  2.57k|    ZSTD_freeDDict(context->dict_ddict);
 6316|  2.57k|#endif
 6317|  2.57k|  }
 6318|  65.8k|  if (context->tuner_params != NULL) {
  ------------------
  |  Branch (6318:7): [True: 0, False: 65.8k]
  ------------------
 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|  65.8k|  if (context->prefilter != NULL) {
  ------------------
  |  Branch (6375:7): [True: 0, False: 65.8k]
  ------------------
 6376|      0|    my_free(context->preparams);
 6377|      0|  }
 6378|  65.8k|  if (context->postfilter != NULL) {
  ------------------
  |  Branch (6378:7): [True: 0, False: 65.8k]
  ------------------
 6379|      0|    my_free(context->postparams);
 6380|      0|  }
 6381|       |
 6382|  65.8k|  if (context->block_maskout != NULL) {
  ------------------
  |  Branch (6382:7): [True: 0, False: 65.8k]
  ------------------
 6383|      0|    free(context->block_maskout);
 6384|      0|  }
 6385|  65.8k|  if (context->blocknbytes != NULL) {
  ------------------
  |  Branch (6385:7): [True: 254, False: 65.5k]
  ------------------
 6386|    254|    free(context->blocknbytes);
 6387|    254|  }
 6388|  65.8k|  if (context->blockoffsets != NULL) {
  ------------------
  |  Branch (6388:7): [True: 254, False: 65.5k]
  ------------------
 6389|    254|    free(context->blockoffsets);
 6390|    254|  }
 6391|  65.8k|  if (context->blockcbytes != NULL) {
  ------------------
  |  Branch (6391:7): [True: 254, False: 65.5k]
  ------------------
 6392|    254|    free(context->blockcbytes);
 6393|    254|  }
 6394|  65.8k|  my_free(context);
 6395|  65.8k|}
blosc2_ctx_get_dparams:
 6422|   127k|int blosc2_ctx_get_dparams(blosc2_context *ctx, blosc2_dparams *dparams) {
 6423|   127k|  dparams->nthreads = ctx->nthreads;
 6424|   127k|  dparams->schunk = ctx->schunk;
 6425|   127k|  dparams->postfilter = ctx->postfilter;
 6426|   127k|  dparams->postparams = ctx->postparams;
 6427|   127k|  dparams->typesize = ctx->typesize;
 6428|       |
 6429|   127k|  return BLOSC2_ERROR_SUCCESS;
 6430|   127k|}
blosc2_chunk_zeros:
 6452|  11.9k|int blosc2_chunk_zeros(blosc2_cparams cparams, const int32_t nbytes, void* dest, int32_t destsize) {
 6453|  11.9k|  if (destsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (6453:7): [True: 0, False: 11.9k]
  ------------------
 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|  11.9k|  if ((nbytes > 0) && (nbytes % cparams.typesize)) {
  ------------------
  |  Branch (6458:7): [True: 1.04k, False: 10.8k]
  |  Branch (6458:23): [True: 14, False: 1.03k]
  ------------------
 6459|     14|    BLOSC_TRACE_ERROR("nbytes must be a multiple of typesize");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6460|     14|    return BLOSC2_ERROR_DATA;
 6461|     14|  }
 6462|       |
 6463|  11.9k|  blosc_header header;
 6464|  11.9k|  blosc2_context* context = blosc2_create_cctx(cparams);
 6465|  11.9k|  if (context == NULL) {
  ------------------
  |  Branch (6465:7): [True: 0, False: 11.9k]
  ------------------
 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|  11.9k|  int error = initialize_context_compression(
 6471|  11.9k|          context, NULL, nbytes, dest, destsize,
 6472|  11.9k|          context->clevel, context->filters, context->filters_meta,
 6473|  11.9k|          context->typesize, context->compcode, context->blocksize,
 6474|  11.9k|          context->new_nthreads, context->nthreads, context->splitmode,
 6475|  11.9k|          context->tuner_id, context->tuner_params, context->schunk);
 6476|  11.9k|  if (error <= 0) {
  ------------------
  |  Branch (6476:7): [True: 9, False: 11.9k]
  ------------------
 6477|      9|    blosc2_free_ctx(context);
 6478|      9|    return error;
 6479|      9|  }
 6480|       |
 6481|  11.9k|  memset(&header, 0, sizeof(header));
 6482|  11.9k|  header.version = BLOSC2_VERSION_FORMAT_STABLE;
 6483|  11.9k|  header.versionlz = BLOSC_BLOSCLZ_VERSION_FORMAT;
 6484|  11.9k|  header.flags = BLOSC_DOSHUFFLE | BLOSC_DOBITSHUFFLE;  // extended header
 6485|  11.9k|  header.typesize = context->typesize;
 6486|  11.9k|  header.nbytes = (int32_t)nbytes;
 6487|  11.9k|  header.blocksize = context->blocksize;
 6488|  11.9k|  header.cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 6489|  11.9k|  header.blosc2_flags = BLOSC2_SPECIAL_ZERO << 4;  // mark chunk as all zeros
 6490|  11.9k|  memcpy((uint8_t *)dest, &header, sizeof(header));
 6491|       |
 6492|  11.9k|  blosc2_free_ctx(context);
 6493|       |
 6494|  11.9k|  return BLOSC_EXTENDED_HEADER_LENGTH;
 6495|  11.9k|}
blosc2_chunk_uninit:
 6499|  1.06k|int blosc2_chunk_uninit(blosc2_cparams cparams, const int32_t nbytes, void* dest, int32_t destsize) {
 6500|  1.06k|  if (destsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (6500:7): [True: 0, False: 1.06k]
  ------------------
 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|  1.06k|  if (nbytes % cparams.typesize) {
  ------------------
  |  Branch (6505:7): [True: 8, False: 1.05k]
  ------------------
 6506|      8|    BLOSC_TRACE_ERROR("nbytes must be a multiple of typesize");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6507|      8|    return BLOSC2_ERROR_DATA;
 6508|      8|  }
 6509|       |
 6510|  1.05k|  blosc_header header;
 6511|  1.05k|  blosc2_context* context = blosc2_create_cctx(cparams);
 6512|  1.05k|  if (context == NULL) {
  ------------------
  |  Branch (6512:7): [True: 0, False: 1.05k]
  ------------------
 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|  1.05k|  int error = initialize_context_compression(
 6517|  1.05k|          context, NULL, nbytes, dest, destsize,
 6518|  1.05k|          context->clevel, context->filters, context->filters_meta,
 6519|  1.05k|          context->typesize, context->compcode, context->blocksize,
 6520|  1.05k|          context->new_nthreads, context->nthreads, context->splitmode,
 6521|  1.05k|          context->tuner_id, context->tuner_params, context->schunk);
 6522|  1.05k|  if (error <= 0) {
  ------------------
  |  Branch (6522:7): [True: 7, False: 1.04k]
  ------------------
 6523|      7|    blosc2_free_ctx(context);
 6524|      7|    return error;
 6525|      7|  }
 6526|       |
 6527|  1.04k|  memset(&header, 0, sizeof(header));
 6528|  1.04k|  header.version = BLOSC2_VERSION_FORMAT_STABLE;
 6529|  1.04k|  header.versionlz = BLOSC_BLOSCLZ_VERSION_FORMAT;
 6530|  1.04k|  header.flags = BLOSC_DOSHUFFLE | BLOSC_DOBITSHUFFLE;  // extended header
 6531|  1.04k|  header.typesize = context->typesize;
 6532|  1.04k|  header.nbytes = (int32_t)nbytes;
 6533|  1.04k|  header.blocksize = context->blocksize;
 6534|  1.04k|  header.cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 6535|  1.04k|  header.blosc2_flags = BLOSC2_SPECIAL_UNINIT << 4;  // mark chunk as uninitialized
 6536|  1.04k|  memcpy((uint8_t *)dest, &header, sizeof(header));
 6537|       |
 6538|  1.04k|  blosc2_free_ctx(context);
 6539|       |
 6540|  1.04k|  return BLOSC_EXTENDED_HEADER_LENGTH;
 6541|  1.05k|}
blosc2_chunk_nans:
 6545|    614|int blosc2_chunk_nans(blosc2_cparams cparams, const int32_t nbytes, void* dest, int32_t destsize) {
 6546|    614|  if (destsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (6546:7): [True: 0, False: 614]
  ------------------
 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|    614|  if (nbytes % cparams.typesize) {
  ------------------
  |  Branch (6551:7): [True: 1, False: 613]
  ------------------
 6552|      1|    BLOSC_TRACE_ERROR("nbytes must be a multiple of typesize");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6553|      1|    return BLOSC2_ERROR_DATA;
 6554|      1|  }
 6555|       |
 6556|    613|  blosc_header header;
 6557|    613|  blosc2_context* context = blosc2_create_cctx(cparams);
 6558|    613|  if (context == NULL) {
  ------------------
  |  Branch (6558:7): [True: 0, False: 613]
  ------------------
 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|    613|  int error = initialize_context_compression(
 6564|    613|          context, NULL, nbytes, dest, destsize,
 6565|    613|          context->clevel, context->filters, context->filters_meta,
 6566|    613|          context->typesize, context->compcode, context->blocksize,
 6567|    613|          context->new_nthreads, context->nthreads, context->splitmode,
 6568|    613|          context->tuner_id, context->tuner_params, context->schunk);
 6569|    613|  if (error <= 0) {
  ------------------
  |  Branch (6569:7): [True: 2, False: 611]
  ------------------
 6570|      2|    blosc2_free_ctx(context);
 6571|      2|    return error;
 6572|      2|  }
 6573|       |
 6574|    611|  memset(&header, 0, sizeof(header));
 6575|    611|  header.version = BLOSC2_VERSION_FORMAT_STABLE;
 6576|    611|  header.versionlz = BLOSC_BLOSCLZ_VERSION_FORMAT;
 6577|    611|  header.flags = BLOSC_DOSHUFFLE | BLOSC_DOBITSHUFFLE;  // extended header
 6578|    611|  header.typesize = context->typesize;
 6579|    611|  header.nbytes = (int32_t)nbytes;
 6580|    611|  header.blocksize = context->blocksize;
 6581|    611|  header.cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 6582|    611|  header.blosc2_flags = BLOSC2_SPECIAL_NAN << 4;  // mark chunk as all NaNs
 6583|    611|  memcpy((uint8_t *)dest, &header, sizeof(header));
 6584|       |
 6585|    611|  blosc2_free_ctx(context);
 6586|       |
 6587|    611|  return BLOSC_EXTENDED_HEADER_LENGTH;
 6588|    613|}
register_filter_private:
 6642|  70.5k|int register_filter_private(blosc2_filter *filter) {
 6643|  70.5k|    BLOSC_ERROR_NULL(filter, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  104|  70.5k|    do {                                            \
  |  |  105|  70.5k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 70.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|  70.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 70.5k]
  |  |  ------------------
  ------------------
 6644|  70.5k|    if (g_nfilters == UINT8_MAX) {
  ------------------
  |  Branch (6644:9): [True: 0, False: 70.5k]
  ------------------
 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|  70.5k|    if (filter->id < BLOSC2_GLOBAL_REGISTERED_FILTERS_START) {
  ------------------
  |  Branch (6648:9): [True: 0, False: 70.5k]
  ------------------
 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|   211k|    for (uint64_t i = 0; i < g_nfilters; ++i) {
  ------------------
  |  Branch (6659:26): [True: 141k, False: 70.5k]
  ------------------
 6660|   141k|      if (g_filters[i].id == filter->id) {
  ------------------
  |  Branch (6660:11): [True: 0, False: 141k]
  ------------------
 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|   141k|    }
 6672|       |
 6673|  70.5k|    blosc2_filter *filter_new = &g_filters[g_nfilters++];
 6674|  70.5k|    memcpy(filter_new, filter, sizeof(blosc2_filter));
 6675|       |
 6676|  70.5k|    return BLOSC2_ERROR_SUCCESS;
 6677|  70.5k|}
register_codec_private:
 6692|   126k|int register_codec_private(blosc2_codec *codec) {
 6693|   126k|    BLOSC_ERROR_NULL(codec, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  104|   126k|    do {                                            \
  |  |  105|   126k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 126k]
  |  |  ------------------
  |  |  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|   126k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 126k]
  |  |  ------------------
  ------------------
 6694|   126k|    if (g_ncodecs == UINT8_MAX) {
  ------------------
  |  Branch (6694:9): [True: 0, False: 126k]
  ------------------
 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|   126k|    if (codec->compcode < BLOSC2_GLOBAL_REGISTERED_CODECS_START) {
  ------------------
  |  Branch (6698:9): [True: 0, False: 126k]
  ------------------
 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|   634k|    for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (6709:21): [True: 507k, False: 126k]
  ------------------
 6710|   507k|      if (g_codecs[i].compcode == codec->compcode) {
  ------------------
  |  Branch (6710:11): [True: 0, False: 507k]
  ------------------
 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|   507k|    }
 6722|       |
 6723|   126k|    blosc2_codec *codec_new = &g_codecs[g_ncodecs++];
 6724|   126k|    memcpy(codec_new, codec, sizeof(blosc2_codec));
 6725|       |
 6726|   126k|    return BLOSC2_ERROR_SUCCESS;
 6727|   126k|}
register_tuner_private:
 6742|  14.1k|int register_tuner_private(blosc2_tuner *tuner) {
 6743|  14.1k|  BLOSC_ERROR_NULL(tuner, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  104|  14.1k|    do {                                            \
  |  |  105|  14.1k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 14.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|  14.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 14.1k]
  |  |  ------------------
  ------------------
 6744|  14.1k|  if (g_ntuners == UINT8_MAX) {
  ------------------
  |  Branch (6744:7): [True: 0, False: 14.1k]
  ------------------
 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|  14.1k|  if (tuner->id < BLOSC2_GLOBAL_REGISTERED_TUNER_START) {
  ------------------
  |  Branch (6748:7): [True: 0, False: 14.1k]
  ------------------
 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|  14.1k|  for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (6753:19): [True: 0, False: 14.1k]
  ------------------
 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|  14.1k|  blosc2_tuner *tuner_new = &g_tuners[g_ntuners++];
 6768|  14.1k|  memcpy(tuner_new, tuner, sizeof(blosc2_tuner));
 6769|       |
 6770|  14.1k|  return BLOSC2_ERROR_SUCCESS;
 6771|  14.1k|}
_blosc2_register_io_cb:
 6784|  28.2k|int _blosc2_register_io_cb(const blosc2_io_cb *io) {
 6785|       |
 6786|  42.3k|  for (uint64_t i = 0; i < g_nio; ++i) {
  ------------------
  |  Branch (6786:24): [True: 42.3k, False: 2]
  ------------------
 6787|  42.3k|    if (g_ios[i].id == io->id) {
  ------------------
  |  Branch (6787:9): [True: 28.2k, False: 14.1k]
  ------------------
 6788|  28.2k|      if (strcmp(g_ios[i].name, io->name) != 0) {
  ------------------
  |  Branch (6788:11): [True: 0, False: 28.2k]
  ------------------
 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|  28.2k|      else {
 6794|       |        // Already registered, so no more actions needed
 6795|  28.2k|        return BLOSC2_ERROR_SUCCESS;
 6796|  28.2k|      }
 6797|  28.2k|    }
 6798|  42.3k|  }
 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|  28.2k|}
blosc2_get_io_cb:
 6821|   138k|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|   138k|  if (!g_initlib) {
  ------------------
  |  Branch (6824:7): [True: 0, False: 138k]
  ------------------
 6825|      0|    return NULL;
 6826|      0|  }
 6827|   138k|  for (uint64_t i = 0; i < g_nio; ++i) {
  ------------------
  |  Branch (6827:24): [True: 138k, False: 0]
  ------------------
 6828|   138k|    if (g_ios[i].id == id) {
  ------------------
  |  Branch (6828:9): [True: 138k, False: 0]
  ------------------
 6829|   138k|      return &g_ios[i];
 6830|   138k|    }
 6831|   138k|  }
 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_error_string:
 6916|     78|const char *blosc2_error_string(int error_code) {
 6917|     78|  switch (error_code) {
 6918|     77|    case BLOSC2_ERROR_FAILURE:
  ------------------
  |  Branch (6918:5): [True: 77, False: 1]
  ------------------
 6919|     77|      return "Generic failure";
 6920|      0|    case BLOSC2_ERROR_STREAM:
  ------------------
  |  Branch (6920:5): [True: 0, False: 78]
  ------------------
 6921|      0|      return "Bad stream";
 6922|      0|    case BLOSC2_ERROR_DATA:
  ------------------
  |  Branch (6922:5): [True: 0, False: 78]
  ------------------
 6923|      0|      return "Invalid data";
 6924|      0|    case BLOSC2_ERROR_MEMORY_ALLOC:
  ------------------
  |  Branch (6924:5): [True: 0, False: 78]
  ------------------
 6925|      0|      return "Memory alloc/realloc failure";
 6926|      0|    case BLOSC2_ERROR_READ_BUFFER:
  ------------------
  |  Branch (6926:5): [True: 0, False: 78]
  ------------------
 6927|      0|      return "Not enough space to read";
 6928|      1|    case BLOSC2_ERROR_WRITE_BUFFER:
  ------------------
  |  Branch (6928:5): [True: 1, False: 77]
  ------------------
 6929|      1|      return "Not enough space to write";
 6930|      0|    case BLOSC2_ERROR_CODEC_SUPPORT:
  ------------------
  |  Branch (6930:5): [True: 0, False: 78]
  ------------------
 6931|      0|      return "Codec not supported";
 6932|      0|    case BLOSC2_ERROR_CODEC_PARAM:
  ------------------
  |  Branch (6932:5): [True: 0, False: 78]
  ------------------
 6933|      0|      return "Invalid parameter supplied to codec";
 6934|      0|    case BLOSC2_ERROR_CODEC_DICT:
  ------------------
  |  Branch (6934:5): [True: 0, False: 78]
  ------------------
 6935|      0|      return "Codec dictionary error";
 6936|      0|    case BLOSC2_ERROR_VERSION_SUPPORT:
  ------------------
  |  Branch (6936:5): [True: 0, False: 78]
  ------------------
 6937|      0|      return "Version not supported";
 6938|      0|    case BLOSC2_ERROR_INVALID_HEADER:
  ------------------
  |  Branch (6938:5): [True: 0, False: 78]
  ------------------
 6939|      0|      return "Invalid value in header";
 6940|      0|    case BLOSC2_ERROR_INVALID_PARAM:
  ------------------
  |  Branch (6940:5): [True: 0, False: 78]
  ------------------
 6941|      0|      return "Invalid parameter supplied to function";
 6942|      0|    case BLOSC2_ERROR_FILE_READ:
  ------------------
  |  Branch (6942:5): [True: 0, False: 78]
  ------------------
 6943|      0|      return "File read failure";
 6944|      0|    case BLOSC2_ERROR_FILE_WRITE:
  ------------------
  |  Branch (6944:5): [True: 0, False: 78]
  ------------------
 6945|      0|      return "File write failure";
 6946|      0|    case BLOSC2_ERROR_FILE_OPEN:
  ------------------
  |  Branch (6946:5): [True: 0, False: 78]
  ------------------
 6947|      0|      return "File open failure";
 6948|      0|    case BLOSC2_ERROR_NOT_FOUND:
  ------------------
  |  Branch (6948:5): [True: 0, False: 78]
  ------------------
 6949|      0|      return "Not found";
 6950|      0|    case BLOSC2_ERROR_RUN_LENGTH:
  ------------------
  |  Branch (6950:5): [True: 0, False: 78]
  ------------------
 6951|      0|      return "Bad run length encoding";
 6952|      0|    case BLOSC2_ERROR_FILTER_PIPELINE:
  ------------------
  |  Branch (6952:5): [True: 0, False: 78]
  ------------------
 6953|      0|      return "Filter pipeline error";
 6954|      0|    case BLOSC2_ERROR_CHUNK_INSERT:
  ------------------
  |  Branch (6954:5): [True: 0, False: 78]
  ------------------
 6955|      0|      return "Chunk insert failure";
 6956|      0|    case BLOSC2_ERROR_CHUNK_APPEND:
  ------------------
  |  Branch (6956:5): [True: 0, False: 78]
  ------------------
 6957|      0|      return "Chunk append failure";
 6958|      0|    case BLOSC2_ERROR_CHUNK_UPDATE:
  ------------------
  |  Branch (6958:5): [True: 0, False: 78]
  ------------------
 6959|      0|      return "Chunk update failure";
 6960|      0|    case BLOSC2_ERROR_2GB_LIMIT:
  ------------------
  |  Branch (6960:5): [True: 0, False: 78]
  ------------------
 6961|      0|      return "Sizes larger than 2gb not supported";
 6962|      0|    case BLOSC2_ERROR_SCHUNK_COPY:
  ------------------
  |  Branch (6962:5): [True: 0, False: 78]
  ------------------
 6963|      0|      return "Super-chunk copy failure";
 6964|      0|    case BLOSC2_ERROR_FRAME_TYPE:
  ------------------
  |  Branch (6964:5): [True: 0, False: 78]
  ------------------
 6965|      0|      return "Wrong type for frame";
 6966|      0|    case BLOSC2_ERROR_FILE_TRUNCATE:
  ------------------
  |  Branch (6966:5): [True: 0, False: 78]
  ------------------
 6967|      0|      return "File truncate failure";
 6968|      0|    case BLOSC2_ERROR_LOCK:
  ------------------
  |  Branch (6968:5): [True: 0, False: 78]
  ------------------
 6969|      0|      return "Frame lock failure";
 6970|      0|    case BLOSC2_ERROR_THREAD_CREATE:
  ------------------
  |  Branch (6970:5): [True: 0, False: 78]
  ------------------
 6971|      0|      return "Thread or thread context creation failure";
 6972|      0|    case BLOSC2_ERROR_POSTFILTER:
  ------------------
  |  Branch (6972:5): [True: 0, False: 78]
  ------------------
 6973|      0|      return "Postfilter failure";
 6974|      0|    case BLOSC2_ERROR_FRAME_SPECIAL:
  ------------------
  |  Branch (6974:5): [True: 0, False: 78]
  ------------------
 6975|      0|      return "Special frame failure";
 6976|      0|    case BLOSC2_ERROR_SCHUNK_SPECIAL:
  ------------------
  |  Branch (6976:5): [True: 0, False: 78]
  ------------------
 6977|      0|      return "Special super-chunk failure";
 6978|      0|    case BLOSC2_ERROR_PLUGIN_IO:
  ------------------
  |  Branch (6978:5): [True: 0, False: 78]
  ------------------
 6979|      0|      return "IO plugin error";
 6980|      0|    case BLOSC2_ERROR_FILE_REMOVE:
  ------------------
  |  Branch (6980:5): [True: 0, False: 78]
  ------------------
 6981|      0|      return "Remove file failure";
 6982|      0|    case BLOSC2_ERROR_NULL_POINTER:
  ------------------
  |  Branch (6982:5): [True: 0, False: 78]
  ------------------
 6983|      0|      return "Pointer is null";
 6984|      0|    case BLOSC2_ERROR_INVALID_INDEX:
  ------------------
  |  Branch (6984:5): [True: 0, False: 78]
  ------------------
 6985|      0|      return "Invalid index";
 6986|      0|    case BLOSC2_ERROR_METALAYER_NOT_FOUND:
  ------------------
  |  Branch (6986:5): [True: 0, False: 78]
  ------------------
 6987|      0|      return "Metalayer has not been found";
 6988|      0|    case BLOSC2_ERROR_MAX_BUFSIZE_EXCEEDED:
  ------------------
  |  Branch (6988:5): [True: 0, False: 78]
  ------------------
 6989|      0|      return "Maximum buffersize exceeded";
 6990|      0|    case BLOSC2_ERROR_TUNER:
  ------------------
  |  Branch (6990:5): [True: 0, False: 78]
  ------------------
 6991|      0|      return "Tuner failure";
 6992|      0|    default:
  ------------------
  |  Branch (6992:5): [True: 0, False: 78]
  ------------------
 6993|      0|      return "Unknown error";
 6994|     78|  }
 6995|     78|}
blosc2.c:flags_to_filters:
  687|  79.5M|static void flags_to_filters(const uint8_t flags, uint8_t* filters) {
  688|       |  /* Initialize the filter pipeline */
  689|  79.5M|  memset(filters, 0, BLOSC2_MAX_FILTERS);
  690|       |  /* Fill the filter pipeline */
  691|  79.5M|  if (flags & BLOSC_DOSHUFFLE)
  ------------------
  |  Branch (691:7): [True: 79.5M, False: 2.65k]
  ------------------
  692|  79.5M|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_SHUFFLE;
  693|  79.5M|  if (flags & BLOSC_DOBITSHUFFLE)
  ------------------
  |  Branch (693:7): [True: 79.5M, False: 3.65k]
  ------------------
  694|  79.5M|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_BITSHUFFLE;
  695|  79.5M|  if (flags & BLOSC_DODELTA)
  ------------------
  |  Branch (695:7): [True: 47.2M, False: 32.2M]
  ------------------
  696|  47.2M|    filters[BLOSC2_MAX_FILTERS - 2] = BLOSC_DELTA;
  697|  79.5M|}
blosc2.c:destroy_thread_context:
 2276|  74.5k|static void destroy_thread_context(struct thread_context* thread_context) {
 2277|  74.5k|  my_free(thread_context->tmp);
 2278|  74.5k|#if defined(HAVE_ZSTD)
 2279|  74.5k|  if (thread_context->zstd_cctx != NULL) {
  ------------------
  |  Branch (2279:7): [True: 0, False: 74.5k]
  ------------------
 2280|      0|    ZSTD_freeCCtx(thread_context->zstd_cctx);
 2281|      0|  }
 2282|  74.5k|  if (thread_context->zstd_dctx != NULL) {
  ------------------
  |  Branch (2282:7): [True: 7.08k, False: 67.4k]
  ------------------
 2283|  7.08k|    ZSTD_freeDCtx(thread_context->zstd_dctx);
 2284|  7.08k|  }
 2285|  74.5k|#endif
 2286|  74.5k|  if (thread_context->lz4_cstream != NULL) {
  ------------------
  |  Branch (2286:7): [True: 0, False: 74.5k]
  ------------------
 2287|      0|    LZ4_freeStream((LZ4_stream_t*)thread_context->lz4_cstream);
 2288|      0|  }
 2289|  74.5k|  if (thread_context->lz4hc_cstream != NULL) {
  ------------------
  |  Branch (2289:7): [True: 0, False: 74.5k]
  ------------------
 2290|      0|    LZ4_freeStreamHC((LZ4_streamHC_t*)thread_context->lz4hc_cstream);
 2291|      0|  }
 2292|  74.5k|}
blosc2.c:my_free:
  272|   214k|static void my_free(void* block) {
  273|       |#if defined(_WIN32)
  274|       |  _aligned_free(block);
  275|       |#else
  276|   214k|  free(block);
  277|   214k|#endif  /* _WIN32 */
  278|   214k|}
blosc2.c:initialize_context_compression:
 2392|  13.5k|        blosc2_schunk* schunk) {
 2393|       |
 2394|       |  /* Set parameters */
 2395|  13.5k|  context->do_compress = 1;
 2396|  13.5k|  context->src = (const uint8_t*)src;
 2397|  13.5k|  context->srcsize = srcsize;
 2398|  13.5k|  context->dest = (uint8_t*)dest;
 2399|  13.5k|  context->output_bytes = 0;
 2400|  13.5k|  context->destsize = destsize;
 2401|  13.5k|  context->sourcesize = srcsize;
 2402|  13.5k|  context->typesize = typesize;
 2403|  13.5k|  context->filter_flags = filters_to_flags(filters);
 2404|  95.1k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (2404:19): [True: 81.5k, False: 13.5k]
  ------------------
 2405|  81.5k|    context->filters[i] = filters[i];
 2406|  81.5k|    context->filters_meta[i] = filters_meta[i];
 2407|  81.5k|  }
 2408|  13.5k|  context->compcode = compressor;
 2409|  13.5k|  context->nthreads = nthreads;
 2410|  13.5k|  context->new_nthreads = new_nthreads;
 2411|  13.5k|  context->clevel = clevel;
 2412|  13.5k|  context->schunk = schunk;
 2413|  13.5k|  context->tuner_params = tuner_params;
 2414|  13.5k|  context->tuner_id = tuner_id;
 2415|  13.5k|  context->splitmode = splitmode;
 2416|  13.5k|  context->header_blocksize = (int32_t)blocksize;
 2417|  13.5k|  context->blosc2_flags2 = 0;
 2418|  13.5k|  if (context->blocknbytes != NULL) {
  ------------------
  |  Branch (2418:7): [True: 0, False: 13.5k]
  ------------------
 2419|      0|    free(context->blocknbytes);
 2420|      0|    context->blocknbytes = NULL;
 2421|      0|  }
 2422|  13.5k|  if (context->blockoffsets != NULL) {
  ------------------
  |  Branch (2422:7): [True: 0, False: 13.5k]
  ------------------
 2423|      0|    free(context->blockoffsets);
 2424|      0|    context->blockoffsets = NULL;
 2425|      0|  }
 2426|  13.5k|  if (context->blockcbytes != NULL) {
  ------------------
  |  Branch (2426:7): [True: 0, False: 13.5k]
  ------------------
 2427|      0|    free(context->blockcbytes);
 2428|      0|    context->blockcbytes = NULL;
 2429|      0|  }
 2430|  13.5k|  context->vlblock_sources = NULL;
 2431|  13.5k|  context->vlblock_dests = NULL;
 2432|       |  /* tuner some compression parameters */
 2433|  13.5k|  context->blocksize = (int32_t)blocksize;
 2434|  13.5k|  int rc = 0;
 2435|  13.5k|  if (context->tuner_params != NULL) {
  ------------------
  |  Branch (2435:7): [True: 0, False: 13.5k]
  ------------------
 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|  13.5k|  } else {
 2468|  13.5k|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|  13.5k|#define BLOSC_STUNE 0
  ------------------
  |  Branch (2468:9): [True: 13.5k, False: 0]
  |  Branch (2468:49): [True: 13.5k, False: 0]
  ------------------
 2469|  13.5k|      rc = blosc_stune_next_blocksize(context);
 2470|  13.5k|    } 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|  13.5k|  }
 2487|  13.5k|  urtunersuccess:;
 2488|  13.5k|  if (rc < 0) {
  ------------------
  |  Branch (2488:7): [True: 0, False: 13.5k]
  ------------------
 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|  13.5k|  if (srcsize > BLOSC2_MAX_BUFFERSIZE) {
  ------------------
  |  Branch (2495:7): [True: 0, False: 13.5k]
  ------------------
 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|  13.5k|  if (destsize < BLOSC2_MAX_OVERHEAD) {
  ------------------
  |  Branch (2501:7): [True: 0, False: 13.5k]
  ------------------
 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|  13.5k|  if (clevel < 0 || clevel > 9) {
  ------------------
  |  Branch (2508:7): [True: 0, False: 13.5k]
  |  Branch (2508:21): [True: 0, False: 13.5k]
  ------------------
 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|  13.5k|  if (src != NULL && context->use_dict && context->compcode != BLOSC_ZSTD &&
  ------------------
  |  Branch (2517:7): [True: 0, False: 13.5k]
  |  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|  13.5k|  if (context->typesize > BLOSC2_MAXTYPESIZE) {
  ------------------
  |  Branch (2524:7): [True: 18, False: 13.5k]
  ------------------
 2525|       |    // If typesize is too large for Blosc2, return an error
 2526|     18|    BLOSC_TRACE_ERROR("Typesize cannot exceed %d bytes.", BLOSC2_MAXTYPESIZE);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2527|     18|    return BLOSC2_ERROR_INVALID_PARAM;
 2528|     18|  }
 2529|       |  /* Now, cap typesize so that blosc2 split machinery can continue to work */
 2530|  13.5k|  if (context->typesize > BLOSC_MAX_TYPESIZE) {
  ------------------
  |  Branch (2530:7): [True: 11.7k, False: 1.82k]
  ------------------
 2531|       |    /* If typesize is too large, treat buffer as an 1-byte stream. */
 2532|  11.7k|    context->typesize = 1;
 2533|  11.7k|  }
 2534|       |
 2535|  13.5k|  blosc2_calculate_blocks(context);
 2536|       |
 2537|  13.5k|  return 1;
 2538|  13.5k|}
blosc2.c:filters_to_flags:
  664|   147k|static uint8_t filters_to_flags(const uint8_t* filters) {
  665|   147k|  uint8_t flags = 0;
  666|       |
  667|  1.03M|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (667:19): [True: 886k, False: 147k]
  ------------------
  668|   886k|    switch (filters[i]) {
  669|   135k|      case BLOSC_SHUFFLE:
  ------------------
  |  Branch (669:7): [True: 135k, False: 751k]
  ------------------
  670|   135k|        flags |= BLOSC_DOSHUFFLE;
  671|   135k|        break;
  672|  61.3k|      case BLOSC_BITSHUFFLE:
  ------------------
  |  Branch (672:7): [True: 61.3k, False: 825k]
  ------------------
  673|  61.3k|        flags |= BLOSC_DOBITSHUFFLE;
  674|  61.3k|        break;
  675|  83.9k|      case BLOSC_DELTA:
  ------------------
  |  Branch (675:7): [True: 83.9k, False: 802k]
  ------------------
  676|  83.9k|        flags |= BLOSC_DODELTA;
  677|  83.9k|        break;
  678|   606k|      default :
  ------------------
  |  Branch (678:7): [True: 606k, False: 280k]
  ------------------
  679|   606k|        break;
  680|   886k|    }
  681|   886k|  }
  682|   147k|  return flags;
  683|   147k|}
blosc2.c:blosc2_calculate_blocks:
  854|   148k|static inline void blosc2_calculate_blocks(blosc2_context* context) {
  855|       |  /* Compute number of blocks in buffer */
  856|   148k|  context->nblocks = context->sourcesize / context->blocksize;
  857|   148k|  context->leftover = context->sourcesize % context->blocksize;
  858|   148k|  context->nblocks = (context->leftover > 0) ?
  ------------------
  |  Branch (858:22): [True: 89.2k, False: 59.1k]
  ------------------
  859|  89.2k|                     (context->nblocks + 1) : context->nblocks;
  860|   148k|}
blosc2.c:clibcode_to_clibname:
  305|      4|static const char* clibcode_to_clibname(int clibcode) {
  306|      4|  if (clibcode == BLOSC_BLOSCLZ_LIB) return BLOSC_BLOSCLZ_LIBNAME;
  ------------------
  |  |  367|      0|#define BLOSC_BLOSCLZ_LIBNAME   "BloscLZ"
  ------------------
  |  Branch (306:7): [True: 0, False: 4]
  ------------------
  307|      4|  if (clibcode == BLOSC_LZ4_LIB) return BLOSC_LZ4_LIBNAME;
  ------------------
  |  |  368|      0|#define BLOSC_LZ4_LIBNAME       "LZ4"
  ------------------
  |  Branch (307:7): [True: 0, False: 4]
  ------------------
  308|      4|  if (clibcode == BLOSC_ZLIB_LIB) return BLOSC_ZLIB_LIBNAME;
  ------------------
  |  |  369|      0|#define BLOSC_ZLIB_LIBNAME      "Zlib"
  ------------------
  |  Branch (308:7): [True: 0, False: 4]
  ------------------
  309|      4|  if (clibcode == BLOSC_ZSTD_LIB) return BLOSC_ZSTD_LIBNAME;
  ------------------
  |  |  370|      0|#define BLOSC_ZSTD_LIBNAME      "Zstd"
  ------------------
  |  Branch (309:7): [True: 0, False: 4]
  ------------------
  310|     40|  for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (310:19): [True: 36, False: 4]
  ------------------
  311|     36|    if (clibcode == g_codecs[i].complib)
  ------------------
  |  Branch (311:9): [True: 0, False: 36]
  ------------------
  312|      0|      return g_codecs[i].compname;
  313|     36|  }
  314|      4|  return NULL;                  /* should never happen */
  315|      4|}
blosc2.c:blosc_run_decompression_with_context:
 3911|  72.7k|                                                void* dest, int32_t destsize) {
 3912|  72.7k|  blosc_header header;
 3913|  72.7k|  int32_t ntbytes;
 3914|  72.7k|  int rc;
 3915|       |
 3916|  72.7k|  rc = read_chunk_header(src, srcsize, true, &header);
 3917|  72.7k|  if (rc < 0) {
  ------------------
  |  Branch (3917:7): [True: 54, False: 72.6k]
  ------------------
 3918|     54|    return rc;
 3919|     54|  }
 3920|       |
 3921|  72.6k|  if (header.nbytes > destsize) {
  ------------------
  |  Branch (3921:7): [True: 0, False: 72.6k]
  ------------------
 3922|       |    // Not enough space for writing into the destination
 3923|      0|    return BLOSC2_ERROR_WRITE_BUFFER;
 3924|      0|  }
 3925|       |
 3926|  72.6k|  rc = initialize_context_decompression(context, &header, src, srcsize, dest, destsize);
 3927|  72.6k|  if (rc < 0) {
  ------------------
  |  Branch (3927:7): [True: 894, False: 71.8k]
  ------------------
 3928|    894|    return rc;
 3929|    894|  }
 3930|       |
 3931|       |  /* Do the actual decompression */
 3932|  71.8k|  ntbytes = do_job(context);
 3933|  71.8k|  if (ntbytes < 0) {
  ------------------
  |  Branch (3933:7): [True: 9.64k, False: 62.1k]
  ------------------
 3934|  9.64k|    return ntbytes;
 3935|  9.64k|  }
 3936|       |
 3937|  71.8k|  assert(ntbytes <= (int32_t)destsize);
 3938|  62.1k|  return ntbytes;
 3939|  71.8k|}
blosc2.c:initialize_context_decompression:
 2689|  72.6k|                                            int32_t srcsize, void* dest, int32_t destsize) {
 2690|  72.6k|  int32_t bstarts_end;
 2691|  72.6k|  bool vlblocks;
 2692|       |
 2693|  72.6k|  context->do_compress = 0;
 2694|  72.6k|  context->src = (const uint8_t*)src;
 2695|  72.6k|  context->srcsize = srcsize;
 2696|  72.6k|  context->dest = (uint8_t*)dest;
 2697|  72.6k|  context->destsize = destsize;
 2698|  72.6k|  context->output_bytes = 0;
 2699|  72.6k|  context->vlblock_sources = NULL;
 2700|  72.6k|  context->vlblock_dests = NULL;
 2701|  72.6k|  if (context->blocknbytes != NULL) {
  ------------------
  |  Branch (2701:7): [True: 0, False: 72.6k]
  ------------------
 2702|      0|    free(context->blocknbytes);
 2703|      0|    context->blocknbytes = NULL;
 2704|      0|  }
 2705|  72.6k|  if (context->blockoffsets != NULL) {
  ------------------
  |  Branch (2705:7): [True: 0, False: 72.6k]
  ------------------
 2706|      0|    free(context->blockoffsets);
 2707|      0|    context->blockoffsets = NULL;
 2708|      0|  }
 2709|  72.6k|  if (context->blockcbytes != NULL) {
  ------------------
  |  Branch (2709:7): [True: 0, False: 72.6k]
  ------------------
 2710|      0|    free(context->blockcbytes);
 2711|      0|    context->blockcbytes = NULL;
 2712|      0|  }
 2713|       |
 2714|  72.6k|  int rc = blosc2_initialize_context_from_header(context, header);
 2715|  72.6k|  if (rc < 0) {
  ------------------
  |  Branch (2715:7): [True: 0, False: 72.6k]
  ------------------
 2716|      0|    return rc;
 2717|      0|  }
 2718|  72.6k|  clear_context_decompression_dict(context);
 2719|  72.6k|  vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 2720|  72.6k|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (2720:19): [True: 72.0k, False: 629]
  ------------------
 2721|  72.0k|                  (context->blosc2_flags & 0x08u));
  ------------------
  |  Branch (2721:19): [True: 1.10k, False: 70.9k]
  ------------------
 2722|       |
 2723|       |  /* Check that we have enough space to decompress */
 2724|  72.6k|  if (context->sourcesize > (int32_t)context->destsize) {
  ------------------
  |  Branch (2724:7): [True: 0, False: 72.6k]
  ------------------
 2725|      0|    return BLOSC2_ERROR_WRITE_BUFFER;
 2726|      0|  }
 2727|       |
 2728|  72.6k|  if (context->block_maskout != NULL && context->block_maskout_nitems != context->nblocks) {
  ------------------
  |  Branch (2728:7): [True: 0, False: 72.6k]
  |  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|  72.6k|  context->special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
 2736|  72.6k|  if (context->special_type > BLOSC2_SPECIAL_LASTID) {
  ------------------
  |  Branch (2736:7): [True: 1, False: 72.6k]
  ------------------
 2737|      1|    BLOSC_TRACE_ERROR("Unknown special values ID (%d) ",
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2738|      1|                      context->special_type);
 2739|      1|    return BLOSC2_ERROR_DATA;
 2740|      1|  }
 2741|       |
 2742|  72.6k|  int memcpyed = (context->header_flags & (uint8_t) BLOSC_MEMCPYED);
 2743|  72.6k|  if (memcpyed && (header->cbytes != header->nbytes + context->header_overhead)) {
  ------------------
  |  Branch (2743:7): [True: 453, False: 72.2k]
  |  Branch (2743:19): [True: 36, False: 417]
  ------------------
 2744|     36|    BLOSC_TRACE_ERROR("Wrong header info for this memcpyed chunk");
  ------------------
  |  |   93|     36|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     36|    do {                                            \
  |  |  |  |   98|     36|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     36|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 36, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     36|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2745|     36|    return BLOSC2_ERROR_DATA;
 2746|     36|  }
 2747|       |
 2748|  72.6k|  if ((header->nbytes == 0) && (header->cbytes == context->header_overhead) &&
  ------------------
  |  Branch (2748:7): [True: 12.1k, False: 60.5k]
  |  Branch (2748:32): [True: 12.1k, False: 1]
  ------------------
 2749|  12.1k|      !context->special_type) {
  ------------------
  |  Branch (2749:7): [True: 0, False: 12.1k]
  ------------------
 2750|       |    // A compressed buffer with only a header can only contain a zero-length buffer
 2751|      0|    return 0;
 2752|      0|  }
 2753|       |
 2754|  72.6k|  context->bstarts = (int32_t *) (context->src + context->header_overhead);
 2755|  72.6k|  bstarts_end = context->header_overhead;
 2756|  72.6k|  if (!context->special_type && !memcpyed) {
  ------------------
  |  Branch (2756:7): [True: 54.2k, False: 18.3k]
  |  Branch (2756:33): [True: 53.9k, False: 375]
  ------------------
 2757|  53.9k|    size_t bstarts_end_tmp;
 2758|  53.9k|    size_t bstarts_nbytes;
 2759|  53.9k|    if (context->nblocks < 0 ||
  ------------------
  |  Branch (2759:9): [True: 18, False: 53.9k]
  ------------------
 2760|  53.9k|        !checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &bstarts_nbytes) ||
  ------------------
  |  Branch (2760:9): [True: 0, False: 53.9k]
  ------------------
 2761|  53.9k|        !checked_add_size((size_t)context->header_overhead, bstarts_nbytes, &bstarts_end_tmp) ||
  ------------------
  |  Branch (2761:9): [True: 0, False: 53.9k]
  ------------------
 2762|  53.9k|        bstarts_end_tmp > (size_t)INT32_MAX) {
  ------------------
  |  Branch (2762:9): [True: 4, False: 53.9k]
  ------------------
 2763|     22|      BLOSC_TRACE_ERROR("Invalid bstarts size in chunk header.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2764|     22|      return BLOSC2_ERROR_INVALID_HEADER;
 2765|     22|    }
 2766|       |    /* If chunk is not special or a memcpyed, we do have a bstarts section */
 2767|  53.9k|    bstarts_end = (int32_t)bstarts_end_tmp;
 2768|  53.9k|  }
 2769|       |
 2770|  72.6k|  if (srcsize < bstarts_end) {
  ------------------
  |  Branch (2770:7): [True: 82, False: 72.5k]
  ------------------
 2771|     82|    BLOSC_TRACE_ERROR("`bstarts` exceeds length of source buffer.");
  ------------------
  |  |   93|     82|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     82|    do {                                            \
  |  |  |  |   98|     82|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     82|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 82, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     82|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2772|     82|    return BLOSC2_ERROR_READ_BUFFER;
 2773|     82|  }
 2774|       |
 2775|  72.5k|  if (vlblocks && is_lazy && !context->special_type && !memcpyed) {
  ------------------
  |  Branch (2775:7): [True: 263, False: 72.2k]
  |  Branch (2775:19): [True: 83, False: 180]
  |  Branch (2775:30): [True: 83, False: 0]
  |  Branch (2775:56): [True: 83, False: 0]
  ------------------
 2776|     83|    size_t block_csizes_nbytes;
 2777|     83|    size_t trailer_meta_nbytes;
 2778|     83|    size_t lazy_trailer_end;
 2779|     83|    if (context->srcsize < 0 || context->nblocks < 0 ||
  ------------------
  |  Branch (2779:9): [True: 0, False: 83]
  |  Branch (2779:33): [True: 0, False: 83]
  ------------------
 2780|     83|        !checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &block_csizes_nbytes) ||
  ------------------
  |  Branch (2780:9): [True: 0, False: 83]
  ------------------
 2781|     83|        !checked_add_size(sizeof(int32_t) + sizeof(int64_t), block_csizes_nbytes, &trailer_meta_nbytes) ||
  ------------------
  |  Branch (2781:9): [True: 0, False: 83]
  ------------------
 2782|     83|        !checked_add_size((size_t)bstarts_end, trailer_meta_nbytes, &lazy_trailer_end) ||
  ------------------
  |  Branch (2782:9): [True: 0, False: 83]
  ------------------
 2783|     83|        (size_t)context->srcsize < lazy_trailer_end) {
  ------------------
  |  Branch (2783:9): [True: 7, False: 76]
  ------------------
 2784|      7|      BLOSC_TRACE_ERROR("Lazy trailer exceeds source buffer.");
  ------------------
  |  |   93|      7|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      7|    do {                                            \
  |  |  |  |   98|      7|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      7|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 7, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      7|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2785|      7|      return BLOSC2_ERROR_READ_BUFFER;
 2786|      7|    }
 2787|     83|  }
 2788|  72.5k|  srcsize -= bstarts_end;
 2789|       |
 2790|       |  /* Read optional dictionary if flag set */
 2791|  72.5k|  if ((context->blosc2_flags & BLOSC2_USEDICT) && !is_lazy) {
  ------------------
  |  Branch (2791:7): [True: 7.07k, False: 65.4k]
  |  Branch (2791:51): [True: 7.01k, False: 59]
  ------------------
 2792|  7.01k|    context->use_dict = 1;
 2793|       |    // The dictionary section is after the bstarts block: [int32 size | raw bytes]
 2794|  7.01k|    if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (2794:9): [True: 3, False: 7.01k]
  ------------------
 2795|      3|      BLOSC_TRACE_ERROR("Not enough space to read size of dictionary.");
  ------------------
  |  |   93|      3|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      3|    do {                                            \
  |  |  |  |   98|      3|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      3|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      3|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2796|      3|      return BLOSC2_ERROR_READ_BUFFER;
 2797|      3|    }
 2798|  7.01k|    srcsize -= sizeof(int32_t);
 2799|       |    // Read dictionary size
 2800|  7.01k|    context->dict_size = sw32_(context->src + bstarts_end);
 2801|  7.01k|    if (context->dict_size <= 0 || context->dict_size > BLOSC2_MAXDICTSIZE) {
  ------------------
  |  Branch (2801:9): [True: 19, False: 6.99k]
  |  Branch (2801:36): [True: 29, False: 6.96k]
  ------------------
 2802|     48|      BLOSC_TRACE_ERROR("Dictionary size is smaller than minimum or larger than maximum allowed.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2803|     48|      return BLOSC2_ERROR_CODEC_DICT;
 2804|     48|    }
 2805|  6.96k|    if (srcsize < (int32_t)context->dict_size) {
  ------------------
  |  Branch (2805:9): [True: 14, False: 6.95k]
  ------------------
 2806|     14|      BLOSC_TRACE_ERROR("Not enough space to read entire dictionary.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2807|     14|      return BLOSC2_ERROR_READ_BUFFER;
 2808|     14|    }
 2809|  6.95k|    srcsize -= context->dict_size;
 2810|       |    // dict_buffer points directly into the source chunk — no copy needed
 2811|  6.95k|    context->dict_buffer = (void*)(context->src + bstarts_end + sizeof(int32_t));
 2812|  6.95k|    context->dict_buffer_owned = false;
 2813|  6.95k|#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|  6.95k|    if (context->compcode == BLOSC_ZSTD_FORMAT) {
  ------------------
  |  Branch (2816:9): [True: 5.75k, False: 1.19k]
  ------------------
 2817|  5.75k|      context->dict_ddict = ZSTD_createDDict(context->dict_buffer, context->dict_size);
 2818|  5.75k|      if (context->dict_ddict == NULL) {
  ------------------
  |  Branch (2818:11): [True: 380, False: 5.37k]
  ------------------
 2819|    380|        BLOSC_TRACE_ERROR("Cannot create ZSTD dictionary for chunk.");
  ------------------
  |  |   93|    380|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    380|    do {                                            \
  |  |  |  |   98|    380|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    380|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 380, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    380|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2820|    380|        return BLOSC2_ERROR_CODEC_DICT;
 2821|    380|      }
 2822|  5.75k|    }
 2823|  6.95k|#endif   // HAVE_ZSTD
 2824|       |    // For LZ4/LZ4HC: dict_buffer and dict_size are sufficient; no digested object needed.
 2825|  6.95k|  }
 2826|  65.5k|  else if ((context->blosc2_flags & BLOSC2_USEDICT) && is_lazy) {
  ------------------
  |  Branch (2826:12): [True: 59, False: 65.4k]
  |  Branch (2826:56): [True: 59, False: 0]
  ------------------
 2827|     59|    rc = load_lazy_chunk_dict(context, header, bstarts_end);
 2828|     59|    if (rc < 0) {
  ------------------
  |  Branch (2828:9): [True: 59, False: 0]
  ------------------
 2829|     59|      return rc;
 2830|     59|    }
 2831|     59|  }
 2832|       |
 2833|  72.0k|  if (vlblocks && !context->special_type && !memcpyed) {
  ------------------
  |  Branch (2833:7): [True: 254, False: 71.7k]
  |  Branch (2833:19): [True: 254, False: 0]
  |  Branch (2833:45): [True: 254, False: 0]
  ------------------
 2834|    254|    context->blocknbytes = malloc((size_t)context->nblocks * sizeof(int32_t));
 2835|    254|    BLOSC_ERROR_NULL(context->blocknbytes, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|    254|    do {                                            \
  |  |  105|    254|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 254]
  |  |  ------------------
  |  |  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|    254|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 254]
  |  |  ------------------
  ------------------
 2836|    254|    context->blockoffsets = malloc((size_t)context->nblocks * sizeof(int32_t));
 2837|    254|    BLOSC_ERROR_NULL(context->blockoffsets, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|    254|    do {                                            \
  |  |  105|    254|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 254]
  |  |  ------------------
  |  |  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|    254|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 254]
  |  |  ------------------
  ------------------
 2838|    254|    context->blockcbytes = malloc((size_t)context->nblocks * sizeof(int32_t));
 2839|    254|    BLOSC_ERROR_NULL(context->blockcbytes, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|    254|    do {                                            \
  |  |  105|    254|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 254]
  |  |  ------------------
  |  |  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|    254|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 254]
  |  |  ------------------
  ------------------
 2840|       |
 2841|    254|    if (is_lazy) {
  ------------------
  |  Branch (2841:9): [True: 75, False: 179]
  ------------------
 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|     75|      int32_t max_csize = 0;
 2846|     90|      for (int32_t i = 0; i < context->nblocks; ++i) {
  ------------------
  |  Branch (2846:27): [True: 82, False: 8]
  ------------------
 2847|     82|        int32_t bstart = sw32_(context->bstarts + i);
 2848|     82|        int32_t next_bstart = (i + 1 < context->nblocks) ?
  ------------------
  |  Branch (2848:31): [True: 34, False: 48]
  ------------------
 2849|     48|            sw32_(context->bstarts + i + 1) : header->cbytes;
 2850|     82|        if (bstart < bstarts_end || next_bstart <= bstart ||
  ------------------
  |  Branch (2850:13): [True: 10, False: 72]
  |  Branch (2850:37): [True: 36, False: 36]
  ------------------
 2851|     67|            next_bstart > header->cbytes) {
  ------------------
  |  Branch (2851:13): [True: 21, False: 15]
  ------------------
 2852|     67|          BLOSC_TRACE_ERROR("Invalid VL-block offsets in lazy chunk.");
  ------------------
  |  |   93|     67|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     67|    do {                                            \
  |  |  |  |   98|     67|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     67|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 67, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     67|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2853|     67|          return BLOSC2_ERROR_INVALID_HEADER;
 2854|     67|        }
 2855|     15|        context->blocknbytes[i] = 0;   // unknown until block is read from disk
 2856|     15|        context->blockoffsets[i] = 0;  // unknown
 2857|     15|        context->blockcbytes[i] = next_bstart - bstart;
 2858|     15|        if (context->blockcbytes[i] > max_csize) {
  ------------------
  |  Branch (2858:13): [True: 14, False: 1]
  ------------------
 2859|     14|          max_csize = context->blockcbytes[i];
 2860|     14|        }
 2861|     15|      }
 2862|      8|      context->blocksize = max_csize;
 2863|      8|      context->leftover = 0;
 2864|      8|    }
 2865|    179|    else {
 2866|    179|      int32_t max_blocksize = 0;
 2867|    179|      int64_t total_nbytes = 0;
 2868|    179|      int32_t prev_bstart = 0;
 2869|    228|      for (int32_t i = 0; i < context->nblocks; ++i) {
  ------------------
  |  Branch (2869:27): [True: 182, False: 46]
  ------------------
 2870|    182|        int32_t bstart = sw32_(context->bstarts + i);
 2871|    182|        int32_t next_bstart = (i + 1 < context->nblocks) ?
  ------------------
  |  Branch (2871:31): [True: 43, False: 139]
  ------------------
 2872|    139|            sw32_(context->bstarts + i + 1) : header->cbytes;
 2873|    182|        if (bstart < bstarts_end || bstart <= prev_bstart || next_bstart <= bstart ||
  ------------------
  |  Branch (2873:13): [True: 6, False: 176]
  |  Branch (2873:37): [True: 0, False: 176]
  |  Branch (2873:62): [True: 35, False: 141]
  ------------------
 2874|    141|            next_bstart > header->cbytes || bstart > context->srcsize - (int32_t)sizeof(int32_t)) {
  ------------------
  |  Branch (2874:13): [True: 31, False: 110]
  |  Branch (2874:45): [True: 3, False: 107]
  ------------------
 2875|     75|          BLOSC_TRACE_ERROR("Invalid VL-block offsets in chunk.");
  ------------------
  |  |   93|     75|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     75|    do {                                            \
  |  |  |  |   98|     75|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     75|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 75, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     75|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2876|     75|          return BLOSC2_ERROR_INVALID_HEADER;
 2877|     75|        }
 2878|    107|        context->blocknbytes[i] = sw32_(context->src + bstart);
 2879|    107|        context->blockcbytes[i] = next_bstart - bstart;
 2880|    107|        if (context->blocknbytes[i] <= 0) {
  ------------------
  |  Branch (2880:13): [True: 29, False: 78]
  ------------------
 2881|     29|          BLOSC_TRACE_ERROR("Invalid VL-block uncompressed size in chunk.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2882|     29|          return BLOSC2_ERROR_INVALID_HEADER;
 2883|     29|        }
 2884|     78|        if (total_nbytes > INT32_MAX) {
  ------------------
  |  Branch (2884:13): [True: 0, False: 78]
  ------------------
 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|     78|        context->blockoffsets[i] = (int32_t)total_nbytes;
 2889|     78|        total_nbytes += context->blocknbytes[i];
 2890|     78|        if (total_nbytes > context->sourcesize) {
  ------------------
  |  Branch (2890:13): [True: 29, False: 49]
  ------------------
 2891|     29|          BLOSC_TRACE_ERROR("VL-block sizes exceed chunk nbytes.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2892|     29|          return BLOSC2_ERROR_INVALID_HEADER;
 2893|     29|        }
 2894|     49|        if (context->blocknbytes[i] > max_blocksize) {
  ------------------
  |  Branch (2894:13): [True: 48, False: 1]
  ------------------
 2895|     48|          max_blocksize = context->blocknbytes[i];
 2896|     48|        }
 2897|     49|        prev_bstart = bstart;
 2898|     49|      }
 2899|     46|      if (total_nbytes != context->sourcesize) {
  ------------------
  |  Branch (2899:11): [True: 42, False: 4]
  ------------------
 2900|     42|        BLOSC_TRACE_ERROR("VL-block sizes do not add up to chunk nbytes.");
  ------------------
  |  |   93|     42|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     42|    do {                                            \
  |  |  |  |   98|     42|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     42|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 42, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     42|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2901|     42|        return BLOSC2_ERROR_INVALID_HEADER;
 2902|     42|      }
 2903|      4|      context->blocksize = max_blocksize;
 2904|      4|      context->leftover = 0;
 2905|      4|    }
 2906|    254|  }
 2907|       |
 2908|  71.8k|  return 0;
 2909|  72.0k|}
blosc2.c:load_lazy_chunk_dict:
 2635|     59|static int load_lazy_chunk_dict(blosc2_context* context, blosc_header* header, int32_t bstarts_end) {
 2636|     59|  int32_t dict_offset = bstarts_end;
 2637|     59|  if (header->cbytes < dict_offset + (int32_t)sizeof(int32_t)) {
  ------------------
  |  Branch (2637:7): [True: 3, False: 56]
  ------------------
 2638|      3|    BLOSC_TRACE_ERROR("Lazy chunk dictionary header exceeds chunk length.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2639|      3|    return BLOSC2_ERROR_INVALID_HEADER;
 2640|      3|  }
 2641|       |
 2642|     56|  uint8_t dict_size_buf[sizeof(int32_t)];
 2643|     56|  int rc = read_lazy_chunk_bytes(context, dict_offset, dict_size_buf, (int32_t)sizeof(dict_size_buf),
 2644|     56|                                 "Cannot open frame file for lazy chunk dictionary read.",
 2645|     56|                                 "Cannot read lazy chunk dictionary size from disk.");
 2646|     56|  if (rc < 0) {
  ------------------
  |  Branch (2646:7): [True: 56, False: 0]
  ------------------
 2647|     56|    return rc;
 2648|     56|  }
 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|     56|                                 const char* open_error, const char* read_error) {
 2566|     56|  if (context->schunk == NULL || context->schunk->frame == NULL) {
  ------------------
  |  Branch (2566:7): [True: 15, False: 41]
  |  Branch (2566:34): [True: 0, False: 41]
  ------------------
 2567|     15|    BLOSC_TRACE_ERROR("Lazy chunk needs an associated super-chunk with a frame.");
  ------------------
  |  |   93|     15|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     15|    do {                                            \
  |  |  |  |   98|     15|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     15|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 15, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     15|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2568|     15|    return BLOSC2_ERROR_INVALID_PARAM;
 2569|     15|  }
 2570|       |
 2571|     41|  blosc2_frame_s* frame = (blosc2_frame_s*)context->schunk->frame;
 2572|     41|  blosc2_io_cb* io_cb = blosc2_get_io_cb(context->schunk->storage->io->id);
 2573|     41|  if (io_cb == NULL) {
  ------------------
  |  Branch (2573:7): [True: 0, False: 41]
  ------------------
 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|     41|  int32_t trailer_offset = BLOSC_EXTENDED_HEADER_LENGTH +
 2579|     41|                           context->nblocks * (int32_t)sizeof(int32_t);
 2580|     41|  int32_t nchunk_lazy;
 2581|     41|  int64_t chunk_offset;
 2582|     41|  memcpy(&nchunk_lazy, context->src + trailer_offset, sizeof(nchunk_lazy));
 2583|     41|  memcpy(&chunk_offset, context->src + trailer_offset + (int32_t)sizeof(int32_t), sizeof(chunk_offset));
 2584|       |
 2585|     41|  void* fp = NULL;
 2586|     41|  int64_t io_pos;
 2587|     41|  if (frame->sframe) {
  ------------------
  |  Branch (2587:7): [True: 0, False: 41]
  ------------------
 2588|      0|    fp = sframe_open_chunk(frame->urlpath, nchunk_lazy, "rb", context->schunk->storage->io);
 2589|      0|    io_pos = offset;
 2590|      0|  }
 2591|     41|  else {
 2592|     41|    if (chunk_offset < 0 || offset < 0) {
  ------------------
  |  Branch (2592:9): [True: 21, False: 20]
  |  Branch (2592:29): [True: 0, False: 20]
  ------------------
 2593|     21|      BLOSC_TRACE_ERROR("Lazy chunk offset cannot be negative.");
  ------------------
  |  |   93|     21|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     21|    do {                                            \
  |  |  |  |   98|     21|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     21|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 21, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     21|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2594|     21|      return BLOSC2_ERROR_INVALID_HEADER;
 2595|     21|    }
 2596|     20|    fp = frame_reader_acquire(frame, context->schunk->storage->io);
 2597|     20|    if (frame->file_offset > INT64_MAX - chunk_offset) {
  ------------------
  |  Branch (2597:9): [True: 0, False: 20]
  ------------------
 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|     20|    io_pos = frame->file_offset + chunk_offset;
 2605|     20|    if (io_pos > INT64_MAX - offset) {
  ------------------
  |  Branch (2605:9): [True: 1, False: 19]
  ------------------
 2606|      1|      BLOSC_TRACE_ERROR("Lazy block offset overflows file position.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2607|      1|      if (fp != NULL) {
  ------------------
  |  Branch (2607:11): [True: 0, False: 1]
  ------------------
 2608|      0|        frame_reader_release(frame, io_cb, fp);
 2609|      0|      }
 2610|      1|      return BLOSC2_ERROR_INVALID_HEADER;
 2611|      1|    }
 2612|     19|    io_pos += offset;
 2613|     19|  }
 2614|     19|  if (fp == NULL) {
  ------------------
  |  Branch (2614:7): [True: 19, False: 0]
  ------------------
 2615|     19|    BLOSC_TRACE_ERROR("%s", open_error);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2616|     19|    return BLOSC2_ERROR_FILE_OPEN;
 2617|     19|  }
 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|  71.8k|static int do_job(blosc2_context* context) {
 2350|  71.8k|  int32_t ntbytes;
 2351|       |
 2352|       |  /* Set sentinels */
 2353|  71.8k|  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|  71.8k|  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|  71.8k|  if (context->nthreads == 1 || (context->sourcesize / context->blocksize) <= 1 || rc < 0) {
  ------------------
  |  Branch (2365:7): [True: 71.8k, 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|  71.8k|    if (context->serial_context == NULL) {
  ------------------
  |  Branch (2367:9): [True: 12.0k, False: 59.7k]
  ------------------
 2368|  12.0k|      context->serial_context = create_thread_context(context, 0);
 2369|  12.0k|    }
 2370|  59.7k|    else if (context->blocksize != context->serial_context->tmp_blocksize) {
  ------------------
  |  Branch (2370:14): [True: 53, False: 59.7k]
  ------------------
 2371|     53|      free_thread_context(context->serial_context);
 2372|     53|      context->serial_context = create_thread_context(context, 0);
 2373|     53|    }
 2374|  71.8k|    BLOSC_ERROR_NULL(context->serial_context, BLOSC2_ERROR_THREAD_CREATE);
  ------------------
  |  |  104|  71.8k|    do {                                            \
  |  |  105|  71.8k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 71.8k]
  |  |  ------------------
  |  |  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|  71.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 71.8k]
  |  |  ------------------
  ------------------
 2375|  71.8k|    ntbytes = serial_blosc(context->serial_context);
 2376|  71.8k|  }
 2377|      0|  else {
 2378|      0|    ntbytes = parallel_blosc(context);
 2379|      0|  }
 2380|       |
 2381|  71.8k|  return ntbytes;
 2382|  71.8k|}
blosc2.c:serial_blosc:
 2161|  71.8k|static int serial_blosc(struct thread_context* thread_context) {
 2162|  71.8k|  blosc2_context* context = thread_context->parent_context;
 2163|  71.8k|  bool vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 2164|  71.8k|  int32_t j, bsize, leftoverblock;
 2165|  71.8k|  int32_t cbytes;
 2166|  71.8k|  int32_t ntbytes = context->output_bytes;
 2167|  71.8k|  int32_t* bstarts = context->bstarts;
 2168|  71.8k|  uint8_t* tmp = thread_context->tmp;
 2169|  71.8k|  uint8_t* tmp2 = thread_context->tmp2;
 2170|  71.8k|  int dict_training = context->use_dict && (context->dict_cdict == NULL);
  ------------------
  |  Branch (2170:23): [True: 6.57k, False: 65.2k]
  |  Branch (2170:44): [True: 6.57k, False: 0]
  ------------------
 2171|  71.8k|  bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;
 2172|  71.8k|  if (!context->do_compress && context->special_type) {
  ------------------
  |  Branch (2172:7): [True: 71.8k, False: 0]
  |  Branch (2172:32): [True: 18.0k, False: 53.8k]
  ------------------
 2173|       |    // Fake a runlen as if it was a memcpyed chunk
 2174|  18.0k|    memcpyed = true;
 2175|  18.0k|  }
 2176|       |
 2177|  79.3M|  for (j = 0; j < context->nblocks; j++) {
  ------------------
  |  Branch (2177:15): [True: 79.2M, False: 62.1k]
  ------------------
 2178|  79.2M|    if (context->do_compress && !memcpyed && !dict_training) {
  ------------------
  |  Branch (2178:9): [True: 0, False: 79.2M]
  |  Branch (2178:33): [True: 0, False: 0]
  |  Branch (2178:46): [True: 0, False: 0]
  ------------------
 2179|      0|      _sw32(bstarts + j, ntbytes);
 2180|      0|    }
 2181|  79.2M|    bsize = vlblocks ? context->blocknbytes[j] : context->blocksize;
  ------------------
  |  Branch (2181:13): [True: 12, False: 79.2M]
  ------------------
 2182|  79.2M|    leftoverblock = 0;
 2183|  79.2M|    if (!vlblocks && (j == context->nblocks - 1) && (context->leftover > 0)) {
  ------------------
  |  Branch (2183:9): [True: 79.2M, False: 12]
  |  Branch (2183:22): [True: 53.0k, False: 79.2M]
  |  Branch (2183:53): [True: 38.9k, False: 14.0k]
  ------------------
 2184|  38.9k|      bsize = context->leftover;
 2185|  38.9k|      leftoverblock = 1;
 2186|  38.9k|    }
 2187|  79.2M|    if (context->do_compress) {
  ------------------
  |  Branch (2187:9): [True: 0, False: 79.2M]
  ------------------
 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|  79.2M|    else {
 2208|       |      /* Regular decompression */
 2209|       |      // If memcpyed we don't have a bstarts section (because it is not needed)
 2210|  79.2M|      int32_t src_offset = memcpyed ?
  ------------------
  |  Branch (2210:28): [True: 79.1M, False: 90.0k]
  ------------------
 2211|  79.1M|          context->header_overhead + j * context->blocksize : sw32_(bstarts + j);
 2212|  79.2M|      uint8_t *dest_block = (vlblocks && context->vlblock_dests != NULL) ? context->vlblock_dests[j] : context->dest;
  ------------------
  |  Branch (2212:30): [True: 12, False: 79.2M]
  |  Branch (2212:42): [True: 0, False: 12]
  ------------------
 2213|  79.2M|      int32_t dest_offset = (vlblocks && context->vlblock_dests != NULL) ? 0 :
  ------------------
  |  Branch (2213:30): [True: 12, False: 79.2M]
  |  Branch (2213:42): [True: 0, False: 12]
  ------------------
 2214|  79.2M|                            (vlblocks ? context->blockoffsets[j] : j * context->blocksize);
  ------------------
  |  Branch (2214:30): [True: 12, False: 79.2M]
  ------------------
 2215|  79.2M|      cbytes = blosc_d(thread_context, bsize, leftoverblock, memcpyed,
 2216|  79.2M|                       context->src, context->srcsize, src_offset, j,
 2217|  79.2M|                       dest_block, dest_offset, tmp, tmp2);
 2218|  79.2M|    }
 2219|       |
 2220|  79.2M|    if (cbytes < 0) {
  ------------------
  |  Branch (2220:9): [True: 9.64k, False: 79.2M]
  ------------------
 2221|  9.64k|      ntbytes = cbytes;         /* error in blosc_c or blosc_d */
 2222|  9.64k|      break;
 2223|  9.64k|    }
 2224|  79.2M|    ntbytes += cbytes;
 2225|  79.2M|  }
 2226|       |
 2227|  71.8k|  return ntbytes;
 2228|  71.8k|}
blosc2.c:set_values:
 1644|  44.7M|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|  44.7M|  if (destsize % typesize != 0) {
  ------------------
  |  Branch (1657:7): [True: 41, False: 44.7M]
  ------------------
 1658|     41|    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|     41|    do {                                            \
  |  |  112|     41|        int rc_ = (rc);                             \
  |  |  113|     41|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 41, False: 0]
  |  |  ------------------
  |  |  114|     41|            char *error_msg = print_error(rc_);     \
  |  |  115|     41|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|     41|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|     41|    do {                                            \
  |  |  |  |  |  |   98|     41|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|     41|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 41, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|     41|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|     41|            return rc_;                             \
  |  |  117|     41|        }                                           \
  |  |  118|     41|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1659|     41|  }
 1660|  44.7M|  int32_t nitems = destsize / typesize;
 1661|  44.7M|  if (nitems == 0) {
  ------------------
  |  Branch (1661:7): [True: 0, False: 44.7M]
  ------------------
 1662|      0|    return 0;
 1663|      0|  }
 1664|       |
 1665|  44.7M|  switch (typesize) {
 1666|  38.5M|    case 8: {
  ------------------
  |  Branch (1666:5): [True: 38.5M, False: 6.19M]
  ------------------
 1667|  38.5M|      int64_t val8 = ((int64_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 1668|  38.5M|      int64_t* dest8 = (int64_t*)dest;
 1669|   865M|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (1669:23): [True: 826M, False: 38.5M]
  ------------------
 1670|   826M|        dest8[i] = val8;
 1671|   826M|      }
 1672|  38.5M|      break;
 1673|      0|    }
 1674|   115k|    case 4: {
  ------------------
  |  Branch (1674:5): [True: 115k, False: 44.5M]
  ------------------
 1675|   115k|      int32_t val4 = ((int32_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 1676|   115k|      int32_t* dest4 = (int32_t*)dest;
 1677|  3.07G|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (1677:23): [True: 3.07G, False: 115k]
  ------------------
 1678|  3.07G|        dest4[i] = val4;
 1679|  3.07G|      }
 1680|   115k|      break;
 1681|      0|    }
 1682|  4.23M|    case 2: {
  ------------------
  |  Branch (1682:5): [True: 4.23M, False: 40.4M]
  ------------------
 1683|  4.23M|      int16_t val2 = ((int16_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 1684|  4.23M|      int16_t* dest2 = (int16_t*)dest;
 1685|  9.73G|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (1685:23): [True: 9.73G, False: 4.23M]
  ------------------
 1686|  9.73G|        dest2[i] = val2;
 1687|  9.73G|      }
 1688|  4.23M|      break;
 1689|      0|    }
 1690|    595|    case 1: {
  ------------------
  |  Branch (1690:5): [True: 595, False: 44.7M]
  ------------------
 1691|    595|      int8_t val1 = ((int8_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 1692|    595|      int8_t* dest1 = (int8_t*)dest;
 1693|  6.17G|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (1693:23): [True: 6.17G, False: 595]
  ------------------
 1694|  6.17G|        dest1[i] = val1;
 1695|  6.17G|      }
 1696|    595|      break;
 1697|      0|    }
 1698|  1.84M|    default:
  ------------------
  |  Branch (1698:5): [True: 1.84M, False: 42.8M]
  ------------------
 1699|   856M|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (1699:23): [True: 854M, False: 1.84M]
  ------------------
 1700|   854M|        memcpy(dest + i * typesize, src + BLOSC_EXTENDED_HEADER_LENGTH, typesize);
 1701|   854M|      }
 1702|  44.7M|  }
 1703|  44.7M|#endif
 1704|       |
 1705|  44.7M|  return nitems;
 1706|  44.7M|}
blosc2.c:set_nans:
 1612|  14.9M|static int32_t set_nans(int32_t typesize, uint8_t* dest, int32_t destsize) {
 1613|  14.9M|  if (destsize % typesize != 0) {
  ------------------
  |  Branch (1613:7): [True: 6, False: 14.9M]
  ------------------
 1614|      6|    BLOSC_TRACE_ERROR("destsize can only be 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1615|      6|    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      6|    do {                                            \
  |  |  112|      6|        int rc_ = (rc);                             \
  |  |  113|      6|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 6, False: 0]
  |  |  ------------------
  |  |  114|      6|            char *error_msg = print_error(rc_);     \
  |  |  115|      6|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      6|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      6|    do {                                            \
  |  |  |  |  |  |   98|      6|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      6|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 6, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      6|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      6|            return rc_;                             \
  |  |  117|      6|        }                                           \
  |  |  118|      6|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1616|      6|  }
 1617|  14.9M|  int32_t nitems = destsize / typesize;
 1618|  14.9M|  if (nitems == 0) {
  ------------------
  |  Branch (1618:7): [True: 0, False: 14.9M]
  ------------------
 1619|      0|    return 0;
 1620|      0|  }
 1621|       |
 1622|  14.9M|  if (typesize == 4) {
  ------------------
  |  Branch (1622:7): [True: 3.22M, False: 11.7M]
  ------------------
 1623|  3.22M|    float* dest_ = (float*)dest;
 1624|  3.22M|    float val = nanf("");
 1625|  4.28G|    for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (1625:21): [True: 4.28G, False: 3.22M]
  ------------------
 1626|  4.28G|      dest_[i] = val;
 1627|  4.28G|    }
 1628|  3.22M|    return nitems;
 1629|  3.22M|  }
 1630|  11.7M|  else if (typesize == 8) {
  ------------------
  |  Branch (1630:12): [True: 11.7M, False: 17]
  ------------------
 1631|  11.7M|    double* dest_ = (double*)dest;
 1632|  11.7M|    double val = nan("");
 1633|  1.15G|    for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (1633:21): [True: 1.13G, False: 11.7M]
  ------------------
 1634|  1.13G|      dest_[i] = val;
 1635|  1.13G|    }
 1636|  11.7M|    return nitems;
 1637|  11.7M|  }
 1638|       |
 1639|     17|  BLOSC_TRACE_ERROR("Unsupported typesize for NaN");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1640|     17|  return BLOSC2_ERROR_DATA;
 1641|  14.9M|}
blosc2.c:my_malloc:
  243|   214k|static uint8_t* my_malloc(size_t size) {
  244|   214k|  void* block = NULL;
  245|   214k|  int res = 0;
  246|       |  /* Keep aligned allocations valid under Valgrind and POSIX wrappers. */
  247|   214k|  if (size == 0) {
  ------------------
  |  Branch (247:7): [True: 0, False: 214k]
  ------------------
  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|   214k|  res = posix_memalign(&block, 32, size);
  258|       |#else
  259|       |  block = malloc(size);
  260|       |#endif  /* _WIN32 */
  261|       |
  262|   214k|  if (block == NULL || res != 0) {
  ------------------
  |  Branch (262:7): [True: 0, False: 214k]
  |  Branch (262:24): [True: 0, False: 214k]
  ------------------
  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|   214k|  return (uint8_t*)block;
  268|   214k|}
blosc2.c:blosc_d:
 1713|  79.3M|    int32_t nblock, uint8_t* dest, int32_t dest_offset, uint8_t* tmp, uint8_t* tmp2) {
 1714|  79.3M|  blosc2_context* context = thread_context->parent_context;
 1715|  79.3M|  uint8_t* filters = context->filters;
 1716|  79.3M|  uint8_t *tmp3 = thread_context->tmp4;
 1717|  79.3M|  bool vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 1718|  79.3M|  int32_t compformat = (context->header_flags & (uint8_t)0xe0) >> 5u;
 1719|  79.3M|  int dont_split = (context->header_flags & 0x10) >> 4;
 1720|  79.3M|  int32_t chunk_nbytes;
 1721|  79.3M|  int32_t chunk_cbytes;
 1722|  79.3M|  int nstreams;
 1723|  79.3M|  int32_t neblock;
 1724|  79.3M|  int32_t nbytes;                /* number of decompressed bytes in split */
 1725|  79.3M|  int32_t cbytes;                /* number of compressed bytes in split */
 1726|       |  // int32_t ctbytes = 0;           /* number of compressed bytes in block */
 1727|  79.3M|  int32_t ntbytes = 0;           /* number of uncompressed bytes in block */
 1728|  79.3M|  uint8_t* _dest;
 1729|  79.3M|  int32_t typesize = context->typesize;
 1730|  79.3M|  bool instr_codec = context->blosc2_flags & BLOSC2_INSTR_CODEC;
 1731|  79.3M|  const char* compname;
 1732|  79.3M|  int rc;
 1733|       |
 1734|  79.3M|  if (context->block_maskout != NULL && context->block_maskout[nblock]) {
  ------------------
  |  Branch (1734:7): [True: 0, False: 79.3M]
  |  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|  79.3M|  rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 1740|  79.3M|  if (rc < 0) {
  ------------------
  |  Branch (1740:7): [True: 0, False: 79.3M]
  ------------------
 1741|      0|    return rc;
 1742|      0|  }
 1743|  79.3M|  if (context->special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (1743:7): [True: 44.7M, False: 34.6M]
  ------------------
 1744|       |    // We need the actual typesize in this case, but it cannot be encoded in the header, so derive it from cbytes
 1745|  44.7M|    typesize = chunk_cbytes - context->header_overhead;
 1746|  44.7M|  }
 1747|       |
 1748|       |  // In some situations (lazychunks) the context can arrive uninitialized
 1749|       |  // (but BITSHUFFLE needs it for accessing the format of the chunk)
 1750|  79.3M|  if (context->src == NULL) {
  ------------------
  |  Branch (1750:7): [True: 0, False: 79.3M]
  ------------------
 1751|      0|    context->src = src;
 1752|      0|  }
 1753|       |
 1754|       |  // Chunks with special values cannot be lazy
 1755|  79.3M|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (1755:19): [True: 79.3M, False: 908]
  ------------------
 1756|  79.3M|          (context->blosc2_flags & 0x08u) && !context->special_type);
  ------------------
  |  Branch (1756:11): [True: 18.1M, False: 61.1M]
  |  Branch (1756:46): [True: 14, False: 18.1M]
  ------------------
 1757|  79.3M|  if (is_lazy) {
  ------------------
  |  Branch (1757:7): [True: 14, False: 79.3M]
  ------------------
 1758|       |    // The chunk is on disk, so just lazily load the block
 1759|     14|    if (context->schunk == NULL) {
  ------------------
  |  Branch (1759:9): [True: 9, False: 5]
  ------------------
 1760|      9|      BLOSC_TRACE_ERROR("Lazy chunk needs an associated super-chunk.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1761|      9|      return BLOSC2_ERROR_INVALID_PARAM;
 1762|      9|    }
 1763|      5|    if (context->schunk->frame == NULL) {
  ------------------
  |  Branch (1763:9): [True: 0, False: 5]
  ------------------
 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|      5|    blosc2_frame_s* frame = (blosc2_frame_s*)context->schunk->frame;
 1768|      5|    size_t bstarts_nbytes;
 1769|      5|    size_t trailer_offset;
 1770|      5|    size_t block_csizes_nbytes;
 1771|      5|    size_t trailer_meta_nbytes;
 1772|      5|    size_t lazy_trailer_end;
 1773|      5|    if (srcsize < 0 || context->nblocks < 0 ||
  ------------------
  |  Branch (1773:9): [True: 0, False: 5]
  |  Branch (1773:24): [True: 0, False: 5]
  ------------------
 1774|      5|        !checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &bstarts_nbytes) ||
  ------------------
  |  Branch (1774:9): [True: 0, False: 5]
  ------------------
 1775|      5|        !checked_add_size((size_t)BLOSC_EXTENDED_HEADER_LENGTH, bstarts_nbytes, &trailer_offset) ||
  ------------------
  |  Branch (1775:9): [True: 0, False: 5]
  ------------------
 1776|      5|        !checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &block_csizes_nbytes) ||
  ------------------
  |  Branch (1776:9): [True: 0, False: 5]
  ------------------
 1777|      5|        !checked_add_size(sizeof(int32_t) + sizeof(int64_t), block_csizes_nbytes, &trailer_meta_nbytes) ||
  ------------------
  |  Branch (1777:9): [True: 0, False: 5]
  ------------------
 1778|      5|        !checked_add_size(trailer_offset, trailer_meta_nbytes, &lazy_trailer_end) ||
  ------------------
  |  Branch (1778:9): [True: 0, False: 5]
  ------------------
 1779|      5|        (size_t)srcsize < lazy_trailer_end) {
  ------------------
  |  Branch (1779:9): [True: 1, False: 4]
  ------------------
 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|      4|    int32_t nchunk;
 1784|      4|    int64_t chunk_offset;
 1785|       |    // The nchunk and the offset of the current chunk are in the trailer
 1786|      4|    memcpy(&nchunk, src + trailer_offset, sizeof(nchunk));
 1787|      4|    memcpy(&chunk_offset, src + trailer_offset + sizeof(int32_t), sizeof(chunk_offset));
 1788|       |    // Get the csize of the nblock
 1789|      4|    if (nblock < 0 || nblock >= context->nblocks) {
  ------------------
  |  Branch (1789:9): [True: 0, False: 4]
  |  Branch (1789:23): [True: 0, False: 4]
  ------------------
 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|      4|    int32_t *block_csizes = (int32_t *)(src + trailer_offset + sizeof(int32_t) + sizeof(int64_t));
 1794|      4|    int32_t block_csize = block_csizes[nblock];
 1795|      4|    int32_t max_lazy_block_csize = context->blocksize + context->typesize * (signed)sizeof(int32_t);
 1796|      4|    if (block_csize <= 0 || block_csize > max_lazy_block_csize) {
  ------------------
  |  Branch (1796:9): [True: 0, False: 4]
  |  Branch (1796:29): [True: 4, False: 0]
  ------------------
 1797|      4|      BLOSC_TRACE_ERROR("Invalid lazy block size in trailer.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1798|      4|      return BLOSC2_ERROR_INVALID_HEADER;
 1799|      4|    }
 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|  79.3M|  if (memcpyed) {
  ------------------
  |  Branch (1865:7): [True: 79.1M, False: 146k]
  ------------------
 1866|  79.1M|    int bsize_ = leftoverblock ? chunk_nbytes % context->blocksize : bsize;
  ------------------
  |  Branch (1866:18): [True: 2.63k, False: 79.1M]
  ------------------
 1867|  79.1M|    if (!context->special_type) {
  ------------------
  |  Branch (1867:9): [True: 629, False: 79.1M]
  ------------------
 1868|    629|      if (chunk_nbytes + context->header_overhead != chunk_cbytes) {
  ------------------
  |  Branch (1868:11): [True: 0, False: 629]
  ------------------
 1869|      0|        return BLOSC2_ERROR_WRITE_BUFFER;
 1870|      0|      }
 1871|    629|      if (chunk_cbytes < context->header_overhead + (nblock * context->blocksize) + bsize_) {
  ------------------
  |  Branch (1871:11): [True: 0, False: 629]
  ------------------
 1872|       |        /* Not enough input to copy block */
 1873|      0|        return BLOSC2_ERROR_READ_BUFFER;
 1874|      0|      }
 1875|    629|    }
 1876|  79.1M|    if (!is_lazy) {
  ------------------
  |  Branch (1876:9): [True: 79.1M, False: 0]
  ------------------
 1877|  79.1M|      src += context->header_overhead + nblock * context->blocksize;
 1878|  79.1M|    }
 1879|  79.1M|    _dest = dest + dest_offset;
 1880|  79.1M|    if (context->postfilter != NULL) {
  ------------------
  |  Branch (1880:9): [True: 0, False: 79.1M]
  ------------------
 1881|       |      // We are making use of a postfilter, so use a temp for destination
 1882|      0|      _dest = tmp;
 1883|      0|    }
 1884|  79.1M|    rc = 0;
 1885|  79.1M|    switch (context->special_type) {
 1886|  44.7M|      case BLOSC2_SPECIAL_VALUE:
  ------------------
  |  Branch (1886:7): [True: 44.7M, False: 34.4M]
  ------------------
 1887|       |        // All repeated values
 1888|  44.7M|        rc = set_values(typesize, context->src, _dest, bsize_);
 1889|  44.7M|        if (rc < 0) {
  ------------------
  |  Branch (1889:13): [True: 12, False: 44.7M]
  ------------------
 1890|     12|          BLOSC_TRACE_ERROR("set_values failed");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1891|     12|          return BLOSC2_ERROR_DATA;
 1892|     12|        }
 1893|  44.7M|        break;
 1894|  44.7M|      case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (1894:7): [True: 14.9M, False: 64.2M]
  ------------------
 1895|  14.9M|        rc = set_nans(context->typesize, _dest, bsize_);
 1896|  14.9M|        if (rc < 0) {
  ------------------
  |  Branch (1896:13): [True: 23, False: 14.9M]
  ------------------
 1897|     23|          BLOSC_TRACE_ERROR("set_nans failed");
  ------------------
  |  |   93|     23|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     23|    do {                                            \
  |  |  |  |   98|     23|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     23|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 23, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     23|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1898|     23|          return BLOSC2_ERROR_DATA;
 1899|     23|        }
 1900|  14.9M|        break;
 1901|  19.5M|      case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (1901:7): [True: 19.5M, False: 59.6M]
  ------------------
 1902|  19.5M|        memset(_dest, 0, bsize_);
 1903|  19.5M|        break;
 1904|  13.9k|      case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (1904:7): [True: 13.9k, False: 79.1M]
  ------------------
 1905|       |        // We do nothing here
 1906|  13.9k|        break;
 1907|    629|      default:
  ------------------
  |  Branch (1907:7): [True: 629, False: 79.1M]
  ------------------
 1908|    629|        memcpy(_dest, src, bsize_);
 1909|  79.1M|    }
 1910|  79.1M|    if (context->postfilter != NULL) {
  ------------------
  |  Branch (1910:9): [True: 0, False: 79.1M]
  ------------------
 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|  79.1M|    thread_context->zfp_cell_nitems = 0;
 1933|       |
 1934|  79.1M|    return bsize_;
 1935|  79.1M|  }
 1936|       |
 1937|   146k|  if (!is_lazy && (src_offset <= 0 || src_offset >= srcsize)) {
  ------------------
  |  Branch (1937:7): [True: 146k, False: 0]
  |  Branch (1937:20): [True: 62, False: 146k]
  |  Branch (1937:39): [True: 140, False: 146k]
  ------------------
 1938|       |    /* Invalid block src offset encountered */
 1939|    202|    return BLOSC2_ERROR_DATA;
 1940|    202|  }
 1941|       |
 1942|   146k|  src += src_offset;
 1943|   146k|  if (vlblocks) {
  ------------------
  |  Branch (1943:7): [True: 4, False: 146k]
  ------------------
 1944|      4|    if (context->blockcbytes == NULL || nblock >= context->nblocks ||
  ------------------
  |  Branch (1944:9): [True: 0, False: 4]
  |  Branch (1944:41): [True: 0, False: 4]
  ------------------
 1945|      4|        context->blockcbytes[nblock] <= (int32_t)sizeof(int32_t) ||
  ------------------
  |  Branch (1945:9): [True: 1, False: 3]
  ------------------
 1946|      3|        src_offset > srcsize - context->blockcbytes[nblock]) {
  ------------------
  |  Branch (1946:9): [True: 0, False: 3]
  ------------------
 1947|      1|      return BLOSC2_ERROR_DATA;
 1948|      1|    }
 1949|      3|    srcsize = context->blockcbytes[nblock];
 1950|      3|  }
 1951|   146k|  else {
 1952|   146k|    srcsize -= src_offset;
 1953|   146k|  }
 1954|       |
 1955|   146k|  int last_filter_index = last_filter(filters, 'd');
 1956|   146k|  if (instr_codec) {
  ------------------
  |  Branch (1956:7): [True: 1.40k, False: 145k]
  ------------------
 1957|       |    // If instrumented, we don't want to run the filters
 1958|  1.40k|    _dest = dest + dest_offset;
 1959|  1.40k|  }
 1960|   145k|  else if (((last_filter_index >= 0) &&
  ------------------
  |  Branch (1960:13): [True: 141k, False: 3.69k]
  ------------------
 1961|   141k|       (next_filter(filters, BLOSC2_MAX_FILTERS, 'd') != BLOSC_DELTA)) ||
  ------------------
  |  Branch (1961:8): [True: 112k, False: 29.1k]
  ------------------
 1962|   112k|    context->postfilter != NULL) {
  ------------------
  |  Branch (1962:5): [True: 0, False: 32.8k]
  ------------------
 1963|       |    // We are making use of some filter, so use a temp for destination
 1964|   112k|    _dest = tmp;
 1965|   112k|  }
 1966|  32.8k|  else {
 1967|       |    // If no filters, or only DELTA in pipeline
 1968|  32.8k|    _dest = dest + dest_offset;
 1969|  32.8k|  }
 1970|       |
 1971|       |  /* The number of compressed data streams for this block */
 1972|   146k|  if (vlblocks) {
  ------------------
  |  Branch (1972:7): [True: 3, False: 146k]
  ------------------
 1973|      3|    nstreams = 1;
 1974|      3|  }
 1975|   146k|  else if (!dont_split && !leftoverblock) {
  ------------------
  |  Branch (1975:12): [True: 1.52k, False: 144k]
  |  Branch (1975:27): [True: 1.50k, False: 17]
  ------------------
 1976|  1.50k|    nstreams = context->typesize;
 1977|  1.50k|  }
 1978|   144k|  else {
 1979|   144k|    nstreams = 1;
 1980|   144k|  }
 1981|       |
 1982|   146k|  neblock = bsize / nstreams;
 1983|   146k|  if (neblock == 0) {
  ------------------
  |  Branch (1983:7): [True: 1, False: 146k]
  ------------------
 1984|       |    /* Not enough space to output bytes */
 1985|      1|    BLOSC_ERROR(BLOSC2_ERROR_WRITE_BUFFER);
  ------------------
  |  |  111|      1|    do {                                            \
  |  |  112|      1|        int rc_ = (rc);                             \
  |  |  113|      1|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 1, False: 0]
  |  |  ------------------
  |  |  114|      1|            char *error_msg = print_error(rc_);     \
  |  |  115|      1|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      1|            return rc_;                             \
  |  |  117|      1|        }                                           \
  |  |  118|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1986|      1|  }
 1987|   284k|  for (int j = 0; j < nstreams; j++) {
  ------------------
  |  Branch (1987:19): [True: 146k, False: 137k]
  ------------------
 1988|   146k|    if (vlblocks) {
  ------------------
  |  Branch (1988:9): [True: 3, False: 146k]
  ------------------
 1989|      3|      if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (1989:11): [True: 0, False: 3]
  ------------------
 1990|       |        /* Not enough input to read compressed bytes */
 1991|      0|        return BLOSC2_ERROR_READ_BUFFER;
 1992|      0|      }
 1993|      3|      neblock = sw32_(src);
 1994|      3|      if (neblock != bsize) {
  ------------------
  |  Branch (1994:11): [True: 0, False: 3]
  ------------------
 1995|      0|        return BLOSC2_ERROR_DATA;
 1996|      0|      }
 1997|      3|      src += sizeof(int32_t);
 1998|      3|      cbytes = srcsize - (int32_t)sizeof(int32_t);
 1999|      3|      srcsize = 0;
 2000|      3|    }
 2001|   146k|    else {
 2002|   146k|      if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (2002:11): [True: 3, False: 146k]
  ------------------
 2003|       |        /* Not enough input to read compressed size */
 2004|      3|        return BLOSC2_ERROR_READ_BUFFER;
 2005|      3|      }
 2006|   146k|      srcsize -= sizeof(int32_t);
 2007|   146k|      cbytes = sw32_(src);      /* amount of compressed bytes */
 2008|   146k|      if (cbytes > 0) {
  ------------------
  |  Branch (2008:11): [True: 10.9k, False: 135k]
  ------------------
 2009|  10.9k|        if (srcsize < cbytes) {
  ------------------
  |  Branch (2009:13): [True: 31, False: 10.9k]
  ------------------
 2010|       |          /* Not enough input to read compressed bytes */
 2011|     31|          return BLOSC2_ERROR_READ_BUFFER;
 2012|     31|        }
 2013|  10.9k|        srcsize -= cbytes;
 2014|  10.9k|      }
 2015|   146k|      src += sizeof(int32_t);
 2016|   146k|    }
 2017|       |    // ctbytes += (signed)sizeof(int32_t);
 2018|       |
 2019|       |    /* Uncompress */
 2020|   146k|    if (!vlblocks && cbytes == 0) {
  ------------------
  |  Branch (2020:9): [True: 146k, False: 3]
  |  Branch (2020:22): [True: 96.4k, False: 50.1k]
  ------------------
 2021|       |      // A run of 0's
 2022|  96.4k|      memset(_dest, 0, (unsigned int)neblock);
 2023|  96.4k|      nbytes = neblock;
 2024|  96.4k|    }
 2025|  50.1k|    else if (!vlblocks && cbytes < 0) {
  ------------------
  |  Branch (2025:14): [True: 50.1k, False: 3]
  |  Branch (2025:27): [True: 39.2k, False: 10.9k]
  ------------------
 2026|       |      // A negative number means some encoding depending on the token that comes next
 2027|  39.2k|      uint8_t token;
 2028|       |
 2029|  39.2k|      if (srcsize < (signed)sizeof(uint8_t)) {
  ------------------
  |  Branch (2029:11): [True: 4, False: 39.2k]
  ------------------
 2030|       |        // Not enough input to read token */
 2031|      4|        return BLOSC2_ERROR_READ_BUFFER;
 2032|      4|      }
 2033|  39.2k|      srcsize -= sizeof(uint8_t);
 2034|       |
 2035|  39.2k|      token = src[0];
 2036|  39.2k|      src += 1;
 2037|       |      // ctbytes += 1;
 2038|       |
 2039|  39.2k|      if (token & 0x1) {
  ------------------
  |  Branch (2039:11): [True: 39.2k, False: 8]
  ------------------
 2040|       |        // A run of bytes that are different than 0
 2041|  39.2k|        if (cbytes < -255) {
  ------------------
  |  Branch (2041:13): [True: 25, False: 39.1k]
  ------------------
 2042|       |          // Runs can only encode a byte
 2043|     25|          return BLOSC2_ERROR_RUN_LENGTH;
 2044|     25|        }
 2045|  39.1k|        uint8_t value = -cbytes;
 2046|  39.1k|        memset(_dest, value, (unsigned int)neblock);
 2047|  39.1k|      } else {
 2048|      8|        BLOSC_TRACE_ERROR("Invalid or unsupported compressed stream token value - %d", token);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2049|      8|        return BLOSC2_ERROR_RUN_LENGTH;
 2050|      8|      }
 2051|  39.1k|      nbytes = neblock;
 2052|  39.1k|      cbytes = 0;  // everything is encoded in the cbytes token
 2053|  39.1k|    }
 2054|  10.9k|    else if (cbytes == neblock) {
  ------------------
  |  Branch (2054:14): [True: 1.55k, False: 9.37k]
  ------------------
 2055|  1.55k|      memcpy(_dest, src, (unsigned int)neblock);
 2056|  1.55k|      nbytes = (int32_t)neblock;
 2057|  1.55k|    }
 2058|  9.37k|    else {
 2059|  9.37k|      if (compformat == BLOSC_BLOSCLZ_FORMAT) {
  ------------------
  |  Branch (2059:11): [True: 236, False: 9.14k]
  ------------------
 2060|    236|        nbytes = blosclz_decompress(src, cbytes, _dest, (int)neblock);
 2061|    236|      }
 2062|  9.14k|      else if (compformat == BLOSC_LZ4_FORMAT) {
  ------------------
  |  Branch (2062:16): [True: 780, False: 8.36k]
  ------------------
 2063|    780|        nbytes = lz4_wrap_decompress((char*)src, (size_t)cbytes,
 2064|    780|                                     (char*)_dest, (size_t)neblock,
 2065|    780|                                     thread_context);
 2066|    780|      }
 2067|  8.36k|  #if defined(HAVE_ZLIB)
 2068|  8.36k|      else if (compformat == BLOSC_ZLIB_FORMAT) {
  ------------------
  |  Branch (2068:16): [True: 688, False: 7.67k]
  ------------------
 2069|    688|        nbytes = zlib_wrap_decompress((char*)src, (size_t)cbytes,
 2070|    688|                                      (char*)_dest, (size_t)neblock);
 2071|    688|      }
 2072|  7.67k|  #endif /*  HAVE_ZLIB */
 2073|  7.67k|  #if defined(HAVE_ZSTD)
 2074|  7.67k|      else if (compformat == BLOSC_ZSTD_FORMAT) {
  ------------------
  |  Branch (2074:16): [True: 7.12k, False: 545]
  ------------------
 2075|  7.12k|        nbytes = zstd_wrap_decompress(thread_context,
 2076|  7.12k|                                      (char*)src, (size_t)cbytes,
 2077|  7.12k|                                      (char*)_dest, (size_t)neblock);
 2078|  7.12k|      }
 2079|    545|  #endif /*  HAVE_ZSTD */
 2080|    545|      else if (compformat == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (2080:16): [True: 541, False: 4]
  ------------------
 2081|    541|        bool getcell = false;
 2082|       |
 2083|    541|#if defined(HAVE_ZFP)
 2084|    541|        if ((context->compcode == BLOSC_CODEC_ZFP_FIXED_RATE) &&
  ------------------
  |  Branch (2084:13): [True: 1, False: 540]
  ------------------
 2085|      1|            (thread_context->zfp_cell_nitems > 0)) {
  ------------------
  |  Branch (2085:13): [True: 0, False: 1]
  ------------------
 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|    541|#endif /* HAVE_ZFP */
 2095|    541|        if (!getcell) {
  ------------------
  |  Branch (2095:13): [True: 541, False: 0]
  ------------------
 2096|    541|          thread_context->zfp_cell_nitems = 0;
 2097|    649|          for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (2097:27): [True: 641, False: 8]
  ------------------
 2098|    641|            if (g_codecs[i].compcode == context->compcode) {
  ------------------
  |  Branch (2098:17): [True: 533, False: 108]
  ------------------
 2099|    533|              if (g_codecs[i].decoder == NULL) {
  ------------------
  |  Branch (2099:19): [True: 5, False: 528]
  ------------------
 2100|       |                // Dynamically load codec plugin
 2101|      5|                if (fill_codec(&g_codecs[i]) < 0) {
  ------------------
  |  Branch (2101:21): [True: 5, False: 0]
  ------------------
 2102|      5|                  BLOSC_TRACE_ERROR("Could not load codec %d.", g_codecs[i].compcode);
  ------------------
  |  |   93|      5|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      5|    do {                                            \
  |  |  |  |   98|      5|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      5|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 5, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      5|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2103|      5|                  return BLOSC2_ERROR_CODEC_SUPPORT;
 2104|      5|                }
 2105|      5|              }
 2106|    528|              blosc2_dparams dparams;
 2107|    528|              blosc2_ctx_get_dparams(context, &dparams);
 2108|    528|              nbytes = g_codecs[i].decoder(src,
 2109|    528|                                           cbytes,
 2110|    528|                                           _dest,
 2111|    528|                                           neblock,
 2112|    528|                                           context->compcode_meta,
 2113|    528|                                           &dparams,
 2114|    528|                                           context->src);
 2115|    528|              goto urcodecsuccess;
 2116|    533|            }
 2117|    641|          }
 2118|      8|          BLOSC_TRACE_ERROR("User-defined compressor codec %d not found during decompression", context->compcode);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2119|      8|          return BLOSC2_ERROR_CODEC_SUPPORT;
 2120|    541|        }
 2121|    528|      urcodecsuccess:
 2122|    528|        ;
 2123|    528|      }
 2124|      4|      else {
 2125|      4|        compname = clibcode_to_clibname(compformat);
 2126|      4|        BLOSC_TRACE_ERROR(
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2127|      4|                "Blosc has not been compiled with decompression "
 2128|      4|                "support for '%s' format.  "
 2129|      4|                "Please recompile for adding this support.", compname);
 2130|      4|        return BLOSC2_ERROR_CODEC_SUPPORT;
 2131|      4|      }
 2132|       |
 2133|       |      /* Check that decompressed bytes number is correct */
 2134|  9.36k|      if ((nbytes != neblock) && (thread_context->zfp_cell_nitems == 0)) {
  ------------------
  |  Branch (2134:11): [True: 9.04k, False: 315]
  |  Branch (2134:34): [True: 9.04k, False: 0]
  ------------------
 2135|  9.04k|        return BLOSC2_ERROR_DATA;
 2136|  9.04k|      }
 2137|       |
 2138|  9.36k|    }
 2139|   137k|    src += cbytes;
 2140|       |    // ctbytes += cbytes;
 2141|   137k|    _dest += nbytes;
 2142|   137k|    ntbytes += nbytes;
 2143|   137k|  } /* Closes j < nstreams */
 2144|       |
 2145|   137k|  if (!instr_codec) {
  ------------------
  |  Branch (2145:7): [True: 137k, False: 15]
  ------------------
 2146|   137k|    if (last_filter_index >= 0 || context->postfilter != NULL) {
  ------------------
  |  Branch (2146:9): [True: 133k, False: 3.60k]
  |  Branch (2146:35): [True: 0, False: 3.60k]
  ------------------
 2147|       |      /* Apply regular filter pipeline */
 2148|   133k|      int errcode = pipeline_backward(thread_context, bsize, dest, dest_offset, tmp, tmp2, tmp3,
 2149|   133k|                                      last_filter_index, nblock);
 2150|   133k|      if (errcode < 0)
  ------------------
  |  Branch (2150:11): [True: 255, False: 133k]
  ------------------
 2151|    255|        return errcode;
 2152|   133k|    }
 2153|   137k|  }
 2154|       |
 2155|       |  /* Return the number of uncompressed bytes */
 2156|   137k|  return (int)ntbytes;
 2157|   137k|}
blosc2.c:lz4_wrap_decompress:
  501|    780|                               struct thread_context* thread_context) {
  502|    780|  int nbytes;
  503|    780|  blosc2_context* context = thread_context->parent_context;
  504|    780|  if (context->use_dict && context->dict_buffer != NULL && context->dict_size > 0) {
  ------------------
  |  Branch (504:7): [True: 361, False: 419]
  |  Branch (504:28): [True: 361, False: 0]
  |  Branch (504:60): [True: 361, False: 0]
  ------------------
  505|    361|    nbytes = LZ4_decompress_safe_usingDict(input, output,
  506|    361|                                           (int)compressed_length, (int)maxout,
  507|    361|                                           (const char*)context->dict_buffer,
  508|    361|                                           (int)context->dict_size);
  509|    419|  } else {
  510|    419|    nbytes = LZ4_decompress_safe(input, output, (int)compressed_length, (int)maxout);
  511|    419|  }
  512|    780|  if (nbytes != (int)maxout) {
  ------------------
  |  Branch (512:7): [True: 673, False: 107]
  ------------------
  513|    673|    return 0;
  514|    673|  }
  515|    107|  return (int)maxout;
  516|    780|}
blosc2.c:zlib_wrap_decompress:
  540|    688|                                char* output, size_t maxout) {
  541|    688|  int status;
  542|    688|#if defined(HAVE_ZLIB_NG) && ! defined(ZLIB_COMPAT)
  543|    688|  size_t ul = maxout;
  544|    688|  status = zng_uncompress(
  545|    688|      (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|    688|  if (status != Z_OK) {
  ------------------
  |  |  180|    688|#define Z_OK            0
  ------------------
  |  Branch (551:7): [True: 625, False: 63]
  ------------------
  552|    625|    return 0;
  553|    625|  }
  554|     63|  return (int)ul;
  555|    688|}
blosc2.c:zstd_wrap_decompress:
  592|  7.12k|                                char* output, size_t maxout) {
  593|  7.12k|  size_t code;
  594|  7.12k|  blosc2_context* context = thread_context->parent_context;
  595|       |
  596|  7.12k|  if (thread_context->zstd_dctx == NULL) {
  ------------------
  |  Branch (596:7): [True: 7.08k, False: 49]
  ------------------
  597|  7.08k|    thread_context->zstd_dctx = ZSTD_createDCtx();
  598|  7.08k|  }
  599|       |
  600|  7.12k|  if (context->use_dict) {
  ------------------
  |  Branch (600:7): [True: 2.51k, False: 4.61k]
  ------------------
  601|  2.51k|    assert(context->dict_ddict != NULL);
  602|  2.51k|    code = ZSTD_decompress_usingDDict(
  603|  2.51k|            thread_context->zstd_dctx, (void*)output, maxout, (void*)input,
  604|  2.51k|            compressed_length, context->dict_ddict);
  605|  4.61k|  } else {
  606|  4.61k|    code = ZSTD_decompressDCtx(thread_context->zstd_dctx,
  607|  4.61k|        (void*)output, maxout, (void*)input, compressed_length);
  608|  4.61k|  }
  609|  7.12k|  if (ZSTD_isError(code) != ZSTD_error_no_error) {
  ------------------
  |  Branch (609:7): [True: 7.02k, False: 107]
  ------------------
  610|  7.02k|    BLOSC_TRACE_ERROR("Error in ZSTD decompression: '%s'.  Giving up.",
  ------------------
  |  |   93|  7.02k|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|  7.02k|    do {                                            \
  |  |  |  |   98|  7.02k|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|  7.02k|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 7.02k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|  7.02k|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  611|  7.02k|                      ZDICT_getErrorName(code));
  612|  7.02k|    return 0;
  613|  7.02k|  }
  614|    107|  return (int)code;
  615|  7.12k|}
blosc2.c:getitem_read_header:
 4505|  62.4k|static int getitem_read_header(const void* src, int32_t srcsize, blosc_header* header) {
 4506|  62.4k|  int result = read_chunk_header((uint8_t *) src, srcsize, true, header);
 4507|  62.4k|  if (result < 0) {
  ------------------
  |  Branch (4507:7): [True: 0, False: 62.4k]
  ------------------
 4508|      0|    return result;
 4509|      0|  }
 4510|  62.4k|  if (header->blosc2_flags2 & BLOSC2_VL_BLOCKS) {
  ------------------
  |  Branch (4510:7): [True: 0, False: 62.4k]
  ------------------
 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|  62.4k|  return 0;
 4515|  62.4k|}
blosc2.c:getitem_with_header:
 4521|  62.4k|                               int start, int nitems, void* dest, int32_t destsize) {
 4522|       |  /* Minimally populate the context */
 4523|  62.4k|  context->src = src;
 4524|  62.4k|  context->srcsize = srcsize;
 4525|  62.4k|  context->dest = dest;
 4526|  62.4k|  context->destsize = destsize;
 4527|       |
 4528|  62.4k|  int result = blosc2_initialize_context_from_header(context, header);
 4529|  62.4k|  if (result < 0) {
  ------------------
  |  Branch (4529:7): [True: 0, False: 62.4k]
  ------------------
 4530|      0|    return result;
 4531|      0|  }
 4532|       |
 4533|  62.4k|  if (context->serial_context == NULL) {
  ------------------
  |  Branch (4533:7): [True: 62.4k, False: 0]
  ------------------
 4534|  62.4k|    context->serial_context = create_thread_context(context, 0);
 4535|  62.4k|  }
 4536|  62.4k|  BLOSC_ERROR_NULL(context->serial_context, BLOSC2_ERROR_THREAD_CREATE);
  ------------------
  |  |  104|  62.4k|    do {                                            \
  |  |  105|  62.4k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 62.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|  62.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 62.4k]
  |  |  ------------------
  ------------------
 4537|       |  /* Call the actual getitem function */
 4538|  62.4k|  return _blosc_getitem(context, header, src, srcsize, start, nitems, dest, destsize);
 4539|  62.4k|}
blosc2.c:blosc2_initialize_context_from_header:
  862|   135k|static int blosc2_initialize_context_from_header(blosc2_context* context, blosc_header* header) {
  863|   135k|  context->header_flags = header->flags;
  864|   135k|  context->typesize = header->typesize;
  865|   135k|  context->sourcesize = header->nbytes;
  866|   135k|  context->header_blocksize = header->blocksize;
  867|   135k|  context->blocksize = header->blocksize;
  868|   135k|  context->blosc2_flags2 = header->blosc2_flags2;
  869|   135k|  context->blosc2_flags = header->blosc2_flags;
  870|   135k|  context->compcode = header->flags >> 5;
  871|   135k|  if (context->compcode == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (871:7): [True: 91.0k, False: 44.1k]
  ------------------
  872|  91.0k|    context->compcode = header->udcompcode;
  873|  91.0k|  }
  874|   135k|  if (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) {
  ------------------
  |  Branch (874:7): [True: 299, False: 134k]
  ------------------
  875|    299|    context->nblocks = header->blocksize;
  876|    299|    context->leftover = 0;
  877|    299|    context->blocksize = 0;
  878|    299|  }
  879|   134k|  else {
  880|   134k|    blosc2_calculate_blocks(context);
  881|   134k|  }
  882|       |
  883|   135k|  bool is_lazy = false;
  884|   135k|  if ((context->header_flags & BLOSC_DOSHUFFLE) &&
  ------------------
  |  Branch (884:7): [True: 134k, False: 567]
  ------------------
  885|   134k|      (context->header_flags & BLOSC_DOBITSHUFFLE)) {
  ------------------
  |  Branch (885:7): [True: 134k, False: 403]
  ------------------
  886|       |    /* Extended header */
  887|   134k|    context->header_overhead = BLOSC_EXTENDED_HEADER_LENGTH;
  888|       |
  889|   134k|    memcpy(context->filters, header->filters, BLOSC2_MAX_FILTERS);
  890|   134k|    memcpy(context->filters_meta, header->filters_meta, BLOSC2_MAX_FILTERS);
  891|   134k|    context->compcode_meta = header->compcode_meta;
  892|       |
  893|   134k|    context->filter_flags = filters_to_flags(header->filters);
  894|   134k|    context->special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
  895|       |
  896|   134k|    is_lazy = (context->blosc2_flags & 0x08u);
  897|   134k|  }
  898|    970|  else {
  899|    970|    context->header_overhead = BLOSC_MIN_HEADER_LENGTH;
  900|    970|    context->filter_flags = get_filter_flags(context->header_flags, context->typesize);
  901|    970|    flags_to_filters(context->header_flags, context->filters);
  902|    970|  }
  903|       |
  904|       |  // Some checks for malformed headers
  905|   135k|  if (!is_lazy && header->cbytes > context->srcsize) {
  ------------------
  |  Branch (905:7): [True: 133k, False: 2.04k]
  |  Branch (905:19): [True: 0, False: 133k]
  ------------------
  906|      0|    return BLOSC2_ERROR_INVALID_HEADER;
  907|      0|  }
  908|       |
  909|   135k|  return 0;
  910|   135k|}
blosc2.c:get_filter_flags:
  702|    970|                                const int32_t typesize) {
  703|    970|  uint8_t flags = 0;
  704|       |
  705|    970|  if ((header_flags & BLOSC_DOSHUFFLE) && (typesize > 1)) {
  ------------------
  |  Branch (705:7): [True: 403, False: 567]
  |  Branch (705:43): [True: 373, False: 30]
  ------------------
  706|    373|    flags |= BLOSC_DOSHUFFLE;
  707|    373|  }
  708|    970|  if (header_flags & BLOSC_DOBITSHUFFLE) {
  ------------------
  |  Branch (708:7): [True: 163, False: 807]
  ------------------
  709|    163|    flags |= BLOSC_DOBITSHUFFLE;
  710|    163|  }
  711|    970|  if (header_flags & BLOSC_DODELTA) {
  ------------------
  |  Branch (711:7): [True: 592, False: 378]
  ------------------
  712|    592|    flags |= BLOSC_DODELTA;
  713|    592|  }
  714|    970|  if (header_flags & BLOSC_MEMCPYED) {
  ------------------
  |  Branch (714:7): [True: 39, False: 931]
  ------------------
  715|     39|    flags |= BLOSC_MEMCPYED;
  716|     39|  }
  717|    970|  return flags;
  718|    970|}
blosc2.c:clear_context_decompression_dict:
 2550|  72.6k|static void clear_context_decompression_dict(blosc2_context* context) {
 2551|  72.6k|  context->use_dict = 0;
 2552|  72.6k|  release_context_dict_buffer(context);
 2553|  72.6k|#if defined(HAVE_ZSTD)
 2554|  72.6k|  if (context->dict_ddict != NULL) {
  ------------------
  |  Branch (2554:7): [True: 2.80k, False: 69.8k]
  ------------------
 2555|  2.80k|    ZSTD_freeDDict(context->dict_ddict);
 2556|  2.80k|    context->dict_ddict = NULL;
 2557|  2.80k|  }
 2558|       |#else
 2559|       |  context->dict_ddict = NULL;
 2560|       |#endif
 2561|  72.6k|}
blosc2.c:checked_mul_size:
  152|  53.9k|static inline bool checked_mul_size(size_t a, size_t b, size_t* out) {
  153|  53.9k|  if (a != 0 && b > SIZE_MAX / a) {
  ------------------
  |  Branch (153:7): [True: 53.9k, False: 22]
  |  Branch (153:17): [True: 0, False: 53.9k]
  ------------------
  154|      0|    return false;
  155|      0|  }
  156|  53.9k|  *out = a * b;
  157|       |  return true;
  158|  53.9k|}
blosc2.c:checked_add_size:
  160|  54.0k|static inline bool checked_add_size(size_t a, size_t b, size_t* out) {
  161|  54.0k|  if (a > SIZE_MAX - b) {
  ------------------
  |  Branch (161:7): [True: 0, False: 54.0k]
  ------------------
  162|      0|    return false;
  163|      0|  }
  164|  54.0k|  *out = a + b;
  165|       |  return true;
  166|  54.0k|}
blosc2.c:create_thread_context:
 2264|  74.5k|create_thread_context(blosc2_context* context, int32_t tid) {
 2265|  74.5k|  struct thread_context* thread_context;
 2266|  74.5k|  thread_context = (struct thread_context*)my_malloc(sizeof(struct thread_context));
 2267|  74.5k|  BLOSC_ERROR_NULL(thread_context, NULL);
  ------------------
  |  |  104|  74.5k|    do {                                            \
  |  |  105|  74.5k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 74.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|  74.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 74.5k]
  |  |  ------------------
  ------------------
 2268|  74.5k|  int rc = init_thread_context(thread_context, context, tid);
 2269|  74.5k|  if (rc < 0) {
  ------------------
  |  Branch (2269:7): [True: 0, False: 74.5k]
  ------------------
 2270|      0|    return NULL;
 2271|      0|  }
 2272|  74.5k|  return thread_context;
 2273|  74.5k|}
blosc2.c:init_thread_context:
 2234|  74.5k|{
 2235|  74.5k|  int32_t ebsize;
 2236|       |
 2237|  74.5k|  thread_context->parent_context = context;
 2238|  74.5k|  thread_context->owner_pool = NULL;
 2239|  74.5k|  thread_context->tid = tid;
 2240|       |
 2241|  74.5k|  int32_t blocksize = context != NULL ? context->blocksize : 0;
  ------------------
  |  Branch (2241:23): [True: 74.5k, False: 0]
  ------------------
 2242|  74.5k|  int32_t typesize = context != NULL ? context->typesize : 0;
  ------------------
  |  Branch (2242:22): [True: 74.5k, False: 0]
  ------------------
 2243|  74.5k|  ebsize = blocksize + typesize * (signed)sizeof(int32_t);
 2244|  74.5k|  thread_context->tmp_nbytes = (size_t)4 * ebsize;
 2245|  74.5k|  thread_context->tmp = my_malloc(thread_context->tmp_nbytes);
 2246|  74.5k|  BLOSC_ERROR_NULL(thread_context->tmp, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|  74.5k|    do {                                            \
  |  |  105|  74.5k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 74.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|  74.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 74.5k]
  |  |  ------------------
  ------------------
 2247|  74.5k|  thread_context->tmp2 = thread_context->tmp + ebsize;
 2248|  74.5k|  thread_context->tmp3 = thread_context->tmp2 + ebsize;
 2249|  74.5k|  thread_context->tmp4 = thread_context->tmp3 + ebsize;
 2250|  74.5k|  thread_context->tmp_blocksize = blocksize;
 2251|  74.5k|  thread_context->zfp_cell_nitems = 0;
 2252|  74.5k|  thread_context->zfp_cell_start = 0;
 2253|  74.5k|  #if defined(HAVE_ZSTD)
 2254|  74.5k|  thread_context->zstd_cctx = NULL;
 2255|  74.5k|  thread_context->zstd_dctx = NULL;
 2256|  74.5k|  #endif
 2257|  74.5k|  thread_context->lz4_cstream = NULL;
 2258|  74.5k|  thread_context->lz4hc_cstream = NULL;
 2259|       |
 2260|  74.5k|  return 0;
 2261|  74.5k|}
blosc2.c:release_thread_backend:
 5416|  65.8k|static int release_thread_backend(blosc2_context *context) {
 5417|  65.8k|  if (context->thread_backend == BLOSC_BACKEND_CALLBACK && context->threads_started > 0) {
  ------------------
  |  |   34|   131k|#define BLOSC_BACKEND_CALLBACK 2
  ------------------
  |  Branch (5417:7): [True: 0, False: 65.8k]
  |  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|  65.8k|  else if (context->thread_backend == BLOSC_BACKEND_SHARED_POOL && context->thread_pool != NULL) {
  ------------------
  |  |   33|   131k|#define BLOSC_BACKEND_SHARED_POOL 1
  ------------------
  |  Branch (5448:12): [True: 0, False: 65.8k]
  |  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|  65.8k|  context->threads_started = 0;
 5488|  65.8k|  context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   32|  65.8k|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 5489|  65.8k|  return 0;
 5490|  65.8k|}
blosc2.c:release_context_dict_buffer:
 2540|   138k|static void release_context_dict_buffer(blosc2_context* context) {
 2541|   138k|  if (context->dict_buffer_owned && context->dict_buffer != NULL) {
  ------------------
  |  Branch (2541:7): [True: 0, False: 138k]
  |  Branch (2541:37): [True: 0, False: 0]
  ------------------
 2542|      0|    free(context->dict_buffer);
 2543|      0|  }
 2544|   138k|  context->dict_buffer = NULL;
 2545|       |  context->dict_buffer_owned = false;
 2546|   138k|  context->dict_size = 0;
 2547|   138k|}

blosclz_decompress:
  685|    236|int blosclz_decompress(const void* input, int length, void* output, int maxout) {
  686|    236|  const uint8_t* ip = (const uint8_t*)input;
  687|    236|  const uint8_t* ip_limit = ip + length;
  688|    236|  uint8_t* op = (uint8_t*)output;
  689|    236|  uint32_t ctrl;
  690|    236|  uint8_t* op_limit = op + maxout;
  691|    236|  if (BLOSCLZ_UNLIKELY(length == 0)) {
  ------------------
  |  |   35|    236|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 0, False: 236]
  |  |  ------------------
  ------------------
  692|      0|    return 0;
  693|      0|  }
  694|    236|  ctrl = (*ip++) & 31U;
  695|       |
  696|  33.4k|  while (1) {
  ------------------
  |  Branch (696:10): [True: 33.4k, Folded]
  ------------------
  697|  33.4k|    if (ctrl >= 32) {
  ------------------
  |  Branch (697:9): [True: 18.2k, False: 15.2k]
  ------------------
  698|       |      // match
  699|  18.2k|      int32_t len = (int32_t)(ctrl >> 5U) - 1 ;
  700|  18.2k|      int32_t ofs = (int32_t)(ctrl & 31U) << 8U;
  701|  18.2k|      uint8_t code;
  702|  18.2k|      const uint8_t* ref = op - ofs;
  703|       |
  704|  18.2k|      if (len == 7 - 1) {
  ------------------
  |  Branch (704:11): [True: 12.7k, False: 5.48k]
  ------------------
  705|  29.8k|        do {
  706|  29.8k|          if (BLOSCLZ_UNLIKELY(ip + 1 >= ip_limit)) {
  ------------------
  |  |   35|  29.8k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 3, False: 29.8k]
  |  |  ------------------
  ------------------
  707|      3|            return 0;
  708|      3|          }
  709|  29.8k|          code = *ip++;
  710|  29.8k|          len += code;
  711|  29.8k|          if (BLOSCLZ_UNLIKELY(len > maxout)) {
  ------------------
  |  |   35|  29.8k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 3, False: 29.8k]
  |  |  ------------------
  ------------------
  712|      3|            return 0;
  713|      3|          }
  714|  29.8k|        } while (code == 255);
  ------------------
  |  Branch (714:18): [True: 17.1k, False: 12.7k]
  ------------------
  715|  12.7k|      }
  716|  5.48k|      else {
  717|  5.48k|        if (BLOSCLZ_UNLIKELY(ip + 1 >= ip_limit)) {
  ------------------
  |  |   35|  5.48k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 4, False: 5.47k]
  |  |  ------------------
  ------------------
  718|      4|          return 0;
  719|      4|        }
  720|  5.48k|      }
  721|  18.1k|      code = *ip++;
  722|  18.1k|      len += 3;
  723|  18.1k|      ref -= code;
  724|       |
  725|       |      /* match from 16-bit distance */
  726|  18.1k|      if (BLOSCLZ_UNLIKELY(code == 255)) {
  ------------------
  |  |   35|  18.1k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 3.48k, False: 14.7k]
  |  |  ------------------
  ------------------
  727|  3.48k|        if (ofs == (31U << 8U)) {
  ------------------
  |  Branch (727:13): [True: 2.99k, False: 485]
  ------------------
  728|  2.99k|          if (ip + 1 >= ip_limit) {
  ------------------
  |  Branch (728:15): [True: 2, False: 2.99k]
  ------------------
  729|      2|            return 0;
  730|      2|          }
  731|  2.99k|          ofs = (*ip++) << 8U;
  732|  2.99k|          ofs += *ip++;
  733|  2.99k|          ref = op - ofs - MAX_DISTANCE;
  ------------------
  |  |   46|  2.99k|#define MAX_DISTANCE 8191
  ------------------
  734|  2.99k|        }
  735|  3.48k|      }
  736|       |
  737|  18.1k|      if (BLOSCLZ_UNLIKELY(len > op_limit - op)) {
  ------------------
  |  |   35|  18.1k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 35, False: 18.1k]
  |  |  ------------------
  ------------------
  738|     35|        return 0;
  739|     35|      }
  740|       |
  741|  18.1k|      if (BLOSCLZ_UNLIKELY(ref <= (uint8_t*)output)) {
  ------------------
  |  |   35|  18.1k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 70, False: 18.0k]
  |  |  ------------------
  ------------------
  742|     70|        return 0;
  743|     70|      }
  744|       |
  745|  18.0k|      if (BLOSCLZ_UNLIKELY(ip >= ip_limit)) break;
  ------------------
  |  |   35|  18.0k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 2, False: 18.0k]
  |  |  ------------------
  ------------------
  746|  18.0k|      ctrl = *ip++;
  747|       |
  748|  18.0k|      ref--;
  749|  18.0k|      if (ref == op - 1) {
  ------------------
  |  Branch (749:11): [True: 6.58k, False: 11.4k]
  ------------------
  750|       |        /* optimized copy for a run */
  751|  6.58k|        memset(op, *ref, len);
  752|  6.58k|        op += len;
  753|  6.58k|      }
  754|  11.4k|      else if ((op - ref >= 8) && (op_limit - op >= len + 8)) {
  ------------------
  |  Branch (754:16): [True: 10.1k, False: 1.30k]
  |  Branch (754:35): [True: 10.0k, False: 99]
  ------------------
  755|       |        // copy with an overlap not larger than 8
  756|  10.0k|        wild_copy(op, ref, op + len);
  757|  10.0k|        op += len;
  758|  10.0k|      }
  759|  1.40k|      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.40k|          op = copy_match(op, ref, (unsigned) len);
  770|       |#if 0 && defined(__AVX2__)
  771|       |        }
  772|       |#endif
  773|  1.40k|      }
  774|  18.0k|    }
  775|  15.2k|    else {
  776|       |      // literal
  777|  15.2k|      ctrl++;
  778|  15.2k|      if (BLOSCLZ_UNLIKELY(ctrl > op_limit - op)) {
  ------------------
  |  |   35|  15.2k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 14, False: 15.2k]
  |  |  ------------------
  ------------------
  779|     14|        return 0;
  780|     14|      }
  781|  15.2k|      if (BLOSCLZ_UNLIKELY(ctrl > ip_limit - ip)) {
  ------------------
  |  |   35|  15.2k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 25, False: 15.1k]
  |  |  ------------------
  ------------------
  782|     25|        return 0;
  783|     25|      }
  784|       |
  785|  15.1k|      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|  15.1k|      if (BLOSCLZ_UNLIKELY(ip >= ip_limit)) break;
  ------------------
  |  |   35|  15.1k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 78, False: 15.1k]
  |  |  ------------------
  ------------------
  793|  15.1k|      ctrl = *ip++;
  794|  15.1k|    }
  795|  33.4k|  }
  796|       |
  797|     80|  return (int)(op - (uint8_t*)output);
  798|    236|}
blosclz.c:wild_copy:
  677|  10.0k|static inline void wild_copy(uint8_t *out, const uint8_t* from, uint8_t* end) {
  678|  10.0k|  uint8_t* d = out;
  679|  10.0k|  const uint8_t* s = from;
  680|  10.0k|  uint8_t* const e = end;
  681|       |
  682|   202k|  do { memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  Branch (682:44): [True: 191k, False: 10.0k]
  ------------------
  683|  10.0k|}

delta_decoder:
   97|   202k|                   int32_t typesize, uint8_t* dest) {
   98|   202k|  int32_t i;
   99|       |
  100|   202k|  if (offset == 0) {
  ------------------
  |  Branch (100:7): [True: 143k, False: 58.6k]
  ------------------
  101|       |    /* Decode delta for the reference block */
  102|   143k|    switch (typesize) {
  103|  64.4k|      case 1:
  ------------------
  |  Branch (103:7): [True: 64.4k, False: 79.1k]
  ------------------
  104|  7.60G|        for (i = 1; i < nbytes; i++) {
  ------------------
  |  Branch (104:21): [True: 7.60G, False: 64.4k]
  ------------------
  105|  7.60G|          dest[i] ^= dref[i-1];
  106|  7.60G|        }
  107|  64.4k|        break;
  108|    310|      case 2:
  ------------------
  |  Branch (108:7): [True: 310, False: 143k]
  ------------------
  109|   627M|        for (i = 1; i < nbytes / 2; i++) {
  ------------------
  |  Branch (109:21): [True: 627M, False: 310]
  ------------------
  110|   627M|          ((uint16_t *)dest)[i] ^= ((uint16_t *)dref)[i-1];
  111|   627M|        }
  112|    310|        break;
  113|    242|      case 4:
  ------------------
  |  Branch (113:7): [True: 242, False: 143k]
  ------------------
  114|   438M|        for (i = 1; i < nbytes / 4; i++) {
  ------------------
  |  Branch (114:21): [True: 438M, False: 242]
  ------------------
  115|   438M|          ((uint32_t *)dest)[i] ^= ((uint32_t *)dref)[i-1];
  116|   438M|        }
  117|    242|        break;
  118|  14.2k|      case 8:
  ------------------
  |  Branch (118:7): [True: 14.2k, False: 129k]
  ------------------
  119|   990M|        for (i = 1; i < nbytes / 8; i++) {
  ------------------
  |  Branch (119:21): [True: 990M, False: 14.2k]
  ------------------
  120|   990M|          ((uint64_t *)dest)[i] ^= ((uint64_t *)dref)[i-1];
  121|   990M|        }
  122|  14.2k|        break;
  123|  64.2k|      default:
  ------------------
  |  Branch (123:7): [True: 64.2k, False: 79.2k]
  ------------------
  124|  64.2k|        if ((typesize % 8) == 0) {
  ------------------
  |  Branch (124:13): [True: 157, False: 64.1k]
  ------------------
  125|    157|          delta_decoder(dref, offset, nbytes, 8, dest);
  126|  64.1k|        } else {
  127|  64.1k|          delta_decoder(dref, offset, nbytes, 1, dest);
  128|  64.1k|        }
  129|   143k|    }
  130|   143k|  } else {
  131|       |    /* Decode delta for the non-reference blocks */
  132|  58.6k|    switch (typesize) {
  133|  25.7k|      case 1:
  ------------------
  |  Branch (133:7): [True: 25.7k, False: 32.9k]
  ------------------
  134|   987M|        for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (134:21): [True: 987M, False: 25.7k]
  ------------------
  135|   987M|          dest[i] ^= dref[i];
  136|   987M|        }
  137|  25.7k|        break;
  138|    107|      case 2:
  ------------------
  |  Branch (138:7): [True: 107, False: 58.5k]
  ------------------
  139|  41.9M|        for (i = 0; i < nbytes / 2; i++) {
  ------------------
  |  Branch (139:21): [True: 41.9M, False: 107]
  ------------------
  140|  41.9M|          ((uint16_t *)dest)[i] ^= ((uint16_t *)dref)[i];
  141|  41.9M|        }
  142|    107|        break;
  143|     90|      case 4:
  ------------------
  |  Branch (143:7): [True: 90, False: 58.5k]
  ------------------
  144|   102M|        for (i = 0; i < nbytes / 4; i++) {
  ------------------
  |  Branch (144:21): [True: 102M, False: 90]
  ------------------
  145|   102M|          ((uint32_t *)dest)[i] ^= ((uint32_t *)dref)[i];
  146|   102M|        }
  147|     90|        break;
  148|  7.05k|      case 8:
  ------------------
  |  Branch (148:7): [True: 7.05k, False: 51.6k]
  ------------------
  149|   345M|        for (i = 0; i < nbytes / 8; i++) {
  ------------------
  |  Branch (149:21): [True: 345M, False: 7.05k]
  ------------------
  150|   345M|          ((uint64_t *)dest)[i] ^= ((uint64_t *)dref)[i];
  151|   345M|        }
  152|  7.05k|        break;
  153|  25.7k|      default:
  ------------------
  |  Branch (153:7): [True: 25.7k, False: 32.9k]
  ------------------
  154|  25.7k|        if ((typesize % 8) == 0) {
  ------------------
  |  Branch (154:13): [True: 98, False: 25.6k]
  ------------------
  155|     98|          delta_decoder(dref, offset, nbytes, 8, dest);
  156|  25.6k|        } else {
  157|  25.6k|          delta_decoder(dref, offset, nbytes, 1, dest);
  158|  25.6k|        }
  159|  58.6k|    }
  160|  58.6k|  }
  161|   202k|}

fastcopy:
  504|     92|unsigned char *fastcopy(unsigned char *out, const unsigned char *from, unsigned len) {
  505|     92|  switch (len) {
  506|      1|    case 32:
  ------------------
  |  Branch (506:5): [True: 1, False: 91]
  ------------------
  507|      1|      return copy_32_bytes(out, from);
  508|      1|    case 16:
  ------------------
  |  Branch (508:5): [True: 1, False: 91]
  ------------------
  509|      1|      return copy_16_bytes(out, from);
  510|      1|    case 8:
  ------------------
  |  Branch (510:5): [True: 1, False: 91]
  ------------------
  511|      1|      return copy_8_bytes(out, from);
  512|     89|    default: {
  ------------------
  |  Branch (512:5): [True: 89, False: 3]
  ------------------
  513|     89|    }
  514|     92|  }
  515|     89|  if (len < 8) {
  ------------------
  |  Branch (515:7): [True: 30, False: 59]
  ------------------
  516|     30|    return copy_bytes(out, from, len);
  517|     30|  }
  518|     59|#if defined(__SSE2__)
  519|     59|  if (len < 16) {
  ------------------
  |  Branch (519:7): [True: 3, False: 56]
  ------------------
  520|      3|    return chunk_memcpy(out, from, len);
  521|      3|  }
  522|     56|#if !defined(__AVX2__)
  523|     56|  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|     59|}
copy_match:
  537|  1.40k|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.40k|  unsigned overlap_dist = (unsigned) (out - from);
  556|  1.40k|  if (overlap_dist > sz) {
  ------------------
  |  Branch (556:7): [True: 92, False: 1.30k]
  ------------------
  557|     92|    return fastcopy(out, from, len);
  558|     92|  }
  559|       |
  560|       |  // Otherwise we need to be more careful so as not to overwrite destination
  561|  1.30k|  switch (overlap_dist) {
  562|      0|    case 32:
  ------------------
  |  Branch (562:5): [True: 0, False: 1.30k]
  ------------------
  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.30k]
  ------------------
  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.30k]
  ------------------
  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.30k]
  ------------------
  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.30k]
  ------------------
  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.30k]
  ------------------
  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.30k]
  ------------------
  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.30k]
  ------------------
  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.30k]
  ------------------
  615|    341|      for (; len >= 16; len -= 16) {
  ------------------
  |  Branch (615:14): [True: 338, False: 3]
  ------------------
  616|    338|        out = copy_16_bytes(out, from);
  617|    338|      }
  618|      3|      break;
  619|      4|    case 8:
  ------------------
  |  Branch (619:5): [True: 4, False: 1.30k]
  ------------------
  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|    419|    case 4:
  ------------------
  |  Branch (624:5): [True: 419, False: 890]
  ------------------
  625|   123k|      for (; len >= 4; len -= 4) {
  ------------------
  |  Branch (625:14): [True: 122k, False: 419]
  ------------------
  626|   122k|        out = copy_4_bytes(out, from);
  627|   122k|      }
  628|    419|      break;
  629|    607|    case 2:
  ------------------
  |  Branch (629:5): [True: 607, False: 702]
  ------------------
  630|   113k|      for (; len >= 2; len -= 2) {
  ------------------
  |  Branch (630:14): [True: 112k, False: 607]
  ------------------
  631|   112k|        out = copy_2_bytes(out, from);
  632|   112k|      }
  633|    607|      break;
  634|    276|    default:
  ------------------
  |  Branch (634:5): [True: 276, False: 1.03k]
  ------------------
  635|   168k|      for (; len > 0; len--) {
  ------------------
  |  Branch (635:14): [True: 168k, False: 276]
  ------------------
  636|   168k|        *out++ = *from++;
  637|   168k|      }
  638|  1.30k|  }
  639|       |
  640|       |  // Copy the leftovers
  641|  2.04k|  for (; len > 0; len--) {
  ------------------
  |  Branch (641:10): [True: 740, False: 1.30k]
  ------------------
  642|    740|    *out++ = *from++;
  643|    740|  }
  644|       |
  645|  1.30k|  return out;
  646|  1.30k|}
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|   100k|static inline unsigned char *copy_16_bytes(unsigned char *out, const unsigned char *from) {
   99|   100k|#if defined(__SSE2__)
  100|   100k|  __m128i chunk;
  101|   100k|  chunk = _mm_loadu_si128((__m128i*)from);
  102|   100k|  _mm_storeu_si128((__m128i*)out, chunk);
  103|   100k|  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|   100k|  return out;
  116|   100k|}
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|     30|static inline unsigned char *copy_bytes(unsigned char *out, const unsigned char *from, unsigned len) {
  162|     30|  assert(len < 8);
  163|       |
  164|       |#ifdef BLOSC_STRICT_ALIGN
  165|       |  while (len--) {
  166|       |    *out++ = *from++;
  167|       |  }
  168|       |#else
  169|     30|  switch (len) {
  170|      4|    case 7:
  ------------------
  |  Branch (170:5): [True: 4, False: 26]
  ------------------
  171|      4|      return copy_7_bytes(out, from);
  172|      6|    case 6:
  ------------------
  |  Branch (172:5): [True: 6, False: 24]
  ------------------
  173|      6|      return copy_6_bytes(out, from);
  174|      4|    case 5:
  ------------------
  |  Branch (174:5): [True: 4, False: 26]
  ------------------
  175|      4|      return copy_5_bytes(out, from);
  176|      4|    case 4:
  ------------------
  |  Branch (176:5): [True: 4, False: 26]
  ------------------
  177|      4|      return copy_4_bytes(out, from);
  178|     12|    case 3:
  ------------------
  |  Branch (178:5): [True: 12, False: 18]
  ------------------
  179|     12|      return copy_3_bytes(out, from);
  180|      0|    case 2:
  ------------------
  |  Branch (180:5): [True: 0, False: 30]
  ------------------
  181|      0|      return copy_2_bytes(out, from);
  182|      0|    case 1:
  ------------------
  |  Branch (182:5): [True: 0, False: 30]
  ------------------
  183|      0|      return copy_1_bytes(out, from);
  184|      0|    case 0:
  ------------------
  |  Branch (184:5): [True: 0, False: 30]
  ------------------
  185|      0|      return out;
  186|      0|    default:
  ------------------
  |  Branch (186:5): [True: 0, False: 30]
  ------------------
  187|      0|      assert(0);
  188|     30|  }
  189|      0|#endif /* BLOSC_STRICT_ALIGN */
  190|      0|  return out;
  191|     30|}
fastcopy.c:copy_7_bytes:
   80|      4|static inline unsigned char *copy_7_bytes(unsigned char *out, const unsigned char *from) {
   81|      4|  out = copy_3_bytes(out, from);
   82|      4|  return copy_4_bytes(out, from + 3);
   83|      4|}
fastcopy.c:copy_6_bytes:
   75|      6|static inline unsigned char *copy_6_bytes(unsigned char *out, const unsigned char *from) {
   76|      6|  out = copy_2_bytes(out, from);
   77|      6|  return copy_4_bytes(out, from + 2);
   78|      6|}
fastcopy.c:copy_5_bytes:
   70|      4|static inline unsigned char *copy_5_bytes(unsigned char *out, const unsigned char *from) {
   71|      4|  out = copy_1_bytes(out, from);
   72|      4|  return copy_4_bytes(out, from + 1);
   73|      4|}
fastcopy.c:copy_3_bytes:
   65|     16|static inline unsigned char *copy_3_bytes(unsigned char *out, const unsigned char *from) {
   66|     16|  out = copy_1_bytes(out, from);
   67|     16|  return copy_2_bytes(out, from + 1);
   68|     16|}
fastcopy.c:copy_1_bytes:
   60|     20|static inline unsigned char *copy_1_bytes(unsigned char *out, const unsigned char *from) {
   61|     20|  *out++ = *from;
   62|     20|  return out;
   63|     20|}
fastcopy.c:chunk_memcpy:
  200|      3|static inline unsigned char *chunk_memcpy(unsigned char *out, const unsigned char *from, unsigned len) {
  201|      3|  unsigned sz = sizeof(uint64_t);
  202|      3|  unsigned rem = len % sz;
  203|      3|  unsigned by8;
  204|       |
  205|      3|  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|      3|  copy_8_bytes(out, from);
  209|       |
  210|      3|  len /= sz;
  211|      3|  out += rem;
  212|      3|  from += rem;
  213|       |
  214|      3|  by8 = len % 8;
  215|      3|  len -= by8;
  216|      3|  switch (by8) {
  217|      0|    case 7:
  ------------------
  |  Branch (217:5): [True: 0, False: 3]
  ------------------
  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: 3]
  ------------------
  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: 3]
  ------------------
  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: 3]
  ------------------
  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: 3]
  ------------------
  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: 3]
  ------------------
  248|      0|      out = copy_8_bytes(out, from);
  249|      0|      from += sz;
  250|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  251|       |      __attribute__ ((fallthrough));
  252|       |      #endif
  253|      3|    case 1:
  ------------------
  |  Branch (253:5): [True: 3, False: 0]
  ------------------
  254|      3|      out = copy_8_bytes(out, from);
  255|      3|      from += sz;
  256|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  257|       |      __attribute__ ((fallthrough));
  258|       |      #endif
  259|      3|    default:
  ------------------
  |  Branch (259:5): [True: 0, False: 3]
  ------------------
  260|      3|      break;
  261|      3|  }
  262|       |
  263|      3|  while (len) {
  ------------------
  |  Branch (263:10): [True: 0, False: 3]
  ------------------
  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|      3|  return out;
  285|      3|}
fastcopy.c:chunk_memcpy_unaligned:
  410|     56|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|     56|#endif
  416|     56|  unsigned rem = len % sz;
  417|     56|  unsigned ilen;
  418|       |
  419|     56|  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|     56|#endif
  427|       |
  428|     56|  len /= sz;
  429|     56|  out += rem;
  430|     56|  from += rem;
  431|       |
  432|   100k|  for (ilen = 0; ilen < len; ilen++) {
  ------------------
  |  Branch (432:18): [True: 99.9k, False: 56]
  ------------------
  433|       |#if defined(__AVX2__)
  434|       |    copy_32_bytes(out, from);
  435|       |#elif defined(__SSE2__)
  436|       |    copy_16_bytes(out, from);
  437|  99.9k|#endif
  438|  99.9k|    out += sz;
  439|  99.9k|    from += sz;
  440|  99.9k|  }
  441|       |
  442|     56|  return out;
  443|     56|}
fastcopy.c:copy_4_bytes:
   48|   122k|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|   122k|  *(uint32_t *) out = *(uint32_t *) from;
   55|   122k|#endif
   56|   122k|  return out + 4;
   57|   122k|}
fastcopy.c:copy_2_bytes:
   37|   112k|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|   112k|  *(uint16_t *) out = *(uint16_t *) from;
   44|   112k|#endif
   45|   112k|  return out + 2;
   46|   112k|}

frame_reader_acquire:
  157|     20|void* frame_reader_acquire(blosc2_frame_s* frame, const blosc2_io* io) {
  158|     20|  blosc2_io_cb *io_cb = blosc2_get_io_cb(io->id);
  159|     20|  if (io_cb == NULL) {
  ------------------
  |  Branch (159:7): [True: 0, False: 20]
  ------------------
  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|     20|  if (io->id != BLOSC2_IO_FILESYSTEM) {
  ------------------
  |  Branch (163:7): [True: 0, False: 20]
  ------------------
  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|     20|  blosc2_pthread_mutex_lock(&frame->read_fp_mutex);
  ------------------
  |  |   92|     20|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  187|     20|  if (frame->read_fp == NULL && !frame->read_fp_nocache) {
  ------------------
  |  Branch (187:7): [True: 20, False: 0]
  |  Branch (187:33): [True: 20, False: 0]
  ------------------
  188|     20|    if (reader_cache_claim()) {
  ------------------
  |  Branch (188:9): [True: 20, False: 0]
  ------------------
  189|     20|      frame->read_fp = io_cb->open(frame->urlpath, "rb", io->params);
  190|     20|      if (frame->read_fp == NULL) {
  ------------------
  |  Branch (190:11): [True: 20, False: 0]
  ------------------
  191|     20|        reader_cache_return();
  192|     20|      }
  193|     20|    }
  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|     20|  }
  200|     20|  void* fp = frame->read_fp;
  201|     20|  if (fp != NULL) {
  ------------------
  |  Branch (201:7): [True: 0, False: 20]
  ------------------
  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|     20|  blosc2_pthread_mutex_unlock(&frame->read_fp_mutex);
  ------------------
  |  |   93|     20|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  207|     20|  if (fp == NULL) {
  ------------------
  |  Branch (207:7): [True: 20, 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|     20|    fp = io_cb->open(frame->urlpath, "rb", io->params);
  211|     20|  }
  212|     20|  return fp;
  213|     20|#endif
  214|     20|}
frame_reader_invalidate:
  265|  13.6k|void frame_reader_invalidate(blosc2_frame_s* frame) {
  266|  13.6k|  blosc2_pthread_mutex_lock(&frame->read_fp_mutex);
  ------------------
  |  |   92|  13.6k|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  267|  13.6k|  frame_reader_close_locked(frame, true);
  268|  13.6k|  blosc2_pthread_mutex_unlock(&frame->read_fp_mutex);
  ------------------
  |  |   93|  13.6k|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  269|  13.6k|}
frame_lock:
  481|  60.7k|int frame_lock(blosc2_frame_s* frame, bool exclusive) {
  482|  60.7k|  if (frame == NULL || !frame->locking) {
  ------------------
  |  Branch (482:7): [True: 0, False: 60.7k]
  |  Branch (482:24): [True: 60.7k, False: 0]
  ------------------
  483|  60.7k|    return BLOSC2_ERROR_SUCCESS;
  484|  60.7k|  }
  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|  60.7k|int frame_unlock(blosc2_frame_s* frame) {
  545|  60.7k|  if (frame == NULL || !frame->locking || frame->lock_depth == 0) {
  ------------------
  |  Branch (545:7): [True: 0, False: 60.7k]
  |  Branch (545:24): [True: 60.7k, False: 0]
  |  Branch (545:43): [True: 0, False: 0]
  ------------------
  546|  60.7k|    return BLOSC2_ERROR_SUCCESS;
  547|  60.7k|  }
  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|  13.6k|int frame_free(blosc2_frame_s* frame) {
  561|       |
  562|  13.6k|  frame_reader_invalidate(frame);
  563|  13.6k|  blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|  13.6k|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
  564|       |
  565|  13.6k|  if (frame->locking && frame->lock_fd != -1) {
  ------------------
  |  Branch (565:7): [True: 0, False: 13.6k]
  |  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|  13.6k|  if (frame->cframe != NULL && !frame->avoid_cframe_free) {
  ------------------
  |  Branch (573:7): [True: 13.6k, False: 0]
  |  Branch (573:32): [True: 0, False: 13.6k]
  ------------------
  574|      0|    free(frame->cframe);
  575|      0|  }
  576|       |
  577|  13.6k|  if (frame->coffsets != NULL && frame->coffsets_needs_free) {
  ------------------
  |  Branch (577:7): [True: 0, False: 13.6k]
  |  Branch (577:34): [True: 0, False: 0]
  ------------------
  578|      0|    free(frame->coffsets);
  579|      0|  }
  580|       |
  581|  13.6k|  if (frame->urlpath != NULL) {
  ------------------
  |  Branch (581:7): [True: 0, False: 13.6k]
  ------------------
  582|      0|    free(frame->urlpath);
  583|      0|  }
  584|       |
  585|  13.6k|  free(frame);
  586|       |
  587|  13.6k|  return 0;
  588|  13.6k|}
get_header_info:
  898|  78.1k|                    uint8_t *splitmode, uint8_t *use_dict, const blosc2_io *io) {
  899|  78.1k|  uint8_t* framep = frame->cframe;
  900|  78.1k|  uint8_t* header_ptr;
  901|  78.1k|  uint8_t header[FRAME_HEADER_MINLEN];
  902|       |
  903|  78.1k|  blosc2_io_cb *io_cb = blosc2_get_io_cb(io->id);
  904|  78.1k|  if (io_cb == NULL) {
  ------------------
  |  Branch (904:7): [True: 0, False: 78.1k]
  ------------------
  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|  78.1k|  if (frame->len <= 0) {
  ------------------
  |  Branch (909:7): [True: 0, False: 78.1k]
  ------------------
  910|      0|    return BLOSC2_ERROR_READ_BUFFER;
  911|      0|  }
  912|       |
  913|  78.1k|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (913:7): [True: 0, False: 78.1k]
  ------------------
  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|  78.1k|  uint8_t frame_type = framep[FRAME_TYPE];
  ------------------
  |  |   33|  78.1k|#define FRAME_TYPE (FRAME_FLAGS + 1)  // 26
  |  |  ------------------
  |  |  |  |   32|  78.1k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  78.1k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  78.1k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  78.1k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  949|  78.1k|  uint8_t frame_version = framep[FRAME_FLAGS] & 0x0fu;
  ------------------
  |  |   32|  78.1k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|  78.1k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|  78.1k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|  78.1k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  950|  78.1k|  if (frame_version > BLOSC2_VERSION_FRAME_FORMAT) {
  ------------------
  |  Branch (950:7): [True: 2, False: 78.1k]
  ------------------
  951|      2|    BLOSC_TRACE_ERROR("Unsupported cframe version: %u", frame_version);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  952|      2|    return BLOSC2_ERROR_VERSION_SUPPORT;
  953|      2|  }
  954|  78.1k|  if (frame->sframe) {
  ------------------
  |  Branch (954:7): [True: 0, False: 78.1k]
  ------------------
  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|  78.1k|  } else {
  959|  78.1k|    if (frame_type != FRAME_CONTIGUOUS_TYPE) {
  ------------------
  |  |   21|  78.1k|#define FRAME_CONTIGUOUS_TYPE 0
  ------------------
  |  Branch (959:9): [True: 8, False: 78.1k]
  ------------------
  960|      8|      return BLOSC2_ERROR_FRAME_TYPE;
  961|      8|    }
  962|  78.1k|  }
  963|       |
  964|       |  // Fetch some internal lengths
  965|  78.1k|  from_big(header_len, framep + FRAME_HEADER_LEN, sizeof(*header_len));
  ------------------
  |  |   38|  78.1k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  966|  78.1k|  if (*header_len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  78.1k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  78.1k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  78.1k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  78.1k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  78.1k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  78.1k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  78.1k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  78.1k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  78.1k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  78.1k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  78.1k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  78.1k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  78.1k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  78.1k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (966:7): [True: 17, False: 78.1k]
  ------------------
  967|     17|    BLOSC_TRACE_ERROR("Header length is zero or smaller than min allowed.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  968|     17|    return BLOSC2_ERROR_INVALID_HEADER;
  969|     17|  }
  970|  78.1k|  from_big(frame_len, framep + FRAME_LEN, sizeof(*frame_len));
  ------------------
  |  |   38|  78.1k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  971|  78.1k|  if (*header_len > *frame_len) {
  ------------------
  |  Branch (971:7): [True: 25, False: 78.1k]
  ------------------
  972|     25|    BLOSC_TRACE_ERROR("Header length exceeds length of the frame.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  973|     25|    return BLOSC2_ERROR_INVALID_HEADER;
  974|     25|  }
  975|  78.1k|  from_big(nbytes, framep + FRAME_NBYTES, sizeof(*nbytes));
  ------------------
  |  |   38|  78.1k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  976|  78.1k|  from_big(cbytes, framep + FRAME_CBYTES, sizeof(*cbytes));
  ------------------
  |  |   38|  78.1k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  977|  78.1k|  from_big(blocksize, framep + FRAME_BLOCKSIZE, sizeof(*blocksize));
  ------------------
  |  |   38|  78.1k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  978|  78.1k|  if (chunksize != NULL) {
  ------------------
  |  Branch (978:7): [True: 78.1k, False: 0]
  ------------------
  979|  78.1k|    from_big(chunksize, framep + FRAME_CHUNKSIZE, sizeof(*chunksize));
  ------------------
  |  |   38|  78.1k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  980|  78.1k|  }
  981|  78.1k|  if (typesize != NULL) {
  ------------------
  |  Branch (981:7): [True: 76.1k, False: 2.00k]
  ------------------
  982|  76.1k|    from_big(typesize, framep + FRAME_TYPESIZE, sizeof(*typesize));
  ------------------
  |  |   38|  76.1k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  983|  76.1k|    if (*typesize <= 0) {
  ------------------
  |  Branch (983:9): [True: 34, False: 76.0k]
  ------------------
  984|     34|      BLOSC_TRACE_ERROR("`typesize` cannot be zero or negative.");
  ------------------
  |  |   93|     34|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     34|    do {                                            \
  |  |  |  |   98|     34|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     34|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 34, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     34|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  985|     34|      return BLOSC2_ERROR_INVALID_HEADER;
  986|     34|    }
  987|  76.1k|  }
  988|       |
  989|       |  // Codecs
  990|  78.0k|  uint8_t frame_codecs = framep[FRAME_CODECS];
  ------------------
  |  |   34|  78.0k|#define FRAME_CODECS (FRAME_FLAGS + 2)  // 27
  |  |  ------------------
  |  |  |  |   32|  78.0k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  78.0k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  78.0k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  78.0k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  991|  78.0k|  if (clevel != NULL) {
  ------------------
  |  Branch (991:7): [True: 13.6k, False: 64.4k]
  ------------------
  992|  13.6k|    *clevel = frame_codecs >> 4u;
  993|  13.6k|  }
  994|  78.0k|  if (compcode != NULL) {
  ------------------
  |  Branch (994:7): [True: 13.6k, False: 64.4k]
  ------------------
  995|  13.6k|    *compcode = frame_codecs & 0xFu;
  996|  13.6k|    if (*compcode == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (996:9): [True: 552, False: 13.0k]
  ------------------
  997|    552|      from_big(compcode, framep + FRAME_UDCODEC, sizeof(*compcode));
  ------------------
  |  |   38|    552|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  998|    552|    }
  999|  13.6k|  }
 1000|       |
 1001|       |  // Other flags
 1002|  78.0k|  uint8_t other_flags = framep[FRAME_OTHER_FLAGS];
  ------------------
  |  |   35|  78.0k|#define FRAME_OTHER_FLAGS (FRAME_FLAGS + 3)  // 28
  |  |  ------------------
  |  |  |  |   32|  78.0k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  78.0k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  78.0k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  78.0k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1003|  78.0k|  if (splitmode != NULL) {
  ------------------
  |  Branch (1003:7): [True: 13.6k, False: 64.4k]
  ------------------
 1004|  13.6k|    *splitmode = (other_flags & 0x03u) + 1;
 1005|  13.6k|  }
 1006|       |
 1007|       |  // Other flags 2: bit 0 = use_dict
 1008|  78.0k|  if (use_dict != NULL) {
  ------------------
  |  Branch (1008:7): [True: 13.6k, False: 64.4k]
  ------------------
 1009|  13.6k|    *use_dict = (framep[FRAME_OTHER_FLAGS2] & FRAME_USE_DICT) ? 1 : 0;
  ------------------
  |  |   47|  13.6k|#define FRAME_OTHER_FLAGS2 (FRAME_FILTER_PIPELINE + 1 + 14)  // 85
  |  |  ------------------
  |  |  |  |   44|  13.6k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  13.6k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  13.6k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  13.6k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  13.6k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  13.6k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  13.6k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  13.6k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  13.6k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  13.6k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  13.6k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  13.6k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  13.6k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  *use_dict = (framep[FRAME_OTHER_FLAGS2] & FRAME_USE_DICT) ? 1 : 0;
  ------------------
  |  |   48|  13.6k|#define FRAME_USE_DICT (1U << 0)   //!< bit 0 of other_flags2: use dictionary compression
  ------------------
  |  Branch (1009:17): [True: 5.35k, False: 8.25k]
  ------------------
 1010|  13.6k|  }
 1011|       |
 1012|  78.0k|  if (compcode_meta != NULL) {
  ------------------
  |  Branch (1012:7): [True: 13.6k, False: 64.4k]
  ------------------
 1013|  13.6k|    from_big(compcode_meta, framep + FRAME_CODEC_META, sizeof(*compcode_meta));
  ------------------
  |  |   38|  13.6k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1014|  13.6k|  }
 1015|       |
 1016|       |  // Filters
 1017|  78.0k|  if (filters != NULL && filters_meta != NULL) {
  ------------------
  |  Branch (1017:7): [True: 13.6k, False: 64.4k]
  |  Branch (1017:26): [True: 13.6k, False: 0]
  ------------------
 1018|  13.6k|    uint8_t nfilters = framep[FRAME_FILTER_PIPELINE];
  ------------------
  |  |   44|  13.6k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|  13.6k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  13.6k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|  13.6k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|  13.6k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|  13.6k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  13.6k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  13.6k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  13.6k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  13.6k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  13.6k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  13.6k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  13.6k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1019|  13.6k|    if (nfilters > BLOSC2_MAX_FILTERS) {
  ------------------
  |  Branch (1019:9): [True: 4, False: 13.6k]
  ------------------
 1020|      4|      BLOSC_TRACE_ERROR("The number of filters in frame header are too large for Blosc2.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1021|      4|      return BLOSC2_ERROR_INVALID_HEADER;
 1022|      4|    }
 1023|  13.6k|    uint8_t *filters_ = framep + FRAME_FILTER_PIPELINE + 1;
  ------------------
  |  |   44|  13.6k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|  13.6k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  13.6k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|  13.6k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|  13.6k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|  13.6k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  13.6k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  13.6k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  13.6k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  13.6k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  13.6k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  13.6k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  13.6k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1024|  13.6k|    uint8_t *filters_meta_ = framep + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   44|  13.6k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|  13.6k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  13.6k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|  13.6k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|  13.6k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|  13.6k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  13.6k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  13.6k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  13.6k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  13.6k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  13.6k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  13.6k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  13.6k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  uint8_t *filters_meta_ = framep + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   53|  13.6k|#define FRAME_FILTER_PIPELINE_MAX (8)  // the maximum number of filters that can be stored in header
  ------------------
 1025|  20.3k|    for (int i = 0; i < nfilters; i++) {
  ------------------
  |  Branch (1025:21): [True: 6.75k, False: 13.6k]
  ------------------
 1026|  6.75k|      filters[i] = filters_[i];
 1027|  6.75k|      filters_meta[i] = filters_meta_[i];
 1028|  6.75k|    }
 1029|  13.6k|  }
 1030|       |
 1031|  78.0k|  if (*nbytes > 0) {
  ------------------
  |  Branch (1031:7): [True: 77.3k, False: 685]
  ------------------
 1032|  77.3k|    if (*chunksize > 0) {
  ------------------
  |  Branch (1032:9): [True: 58.6k, False: 18.7k]
  ------------------
 1033|       |      // We can compute the number of chunks directly when there is a fixed chunk size.
 1034|  58.6k|      *nchunks = *nbytes / *chunksize;
 1035|  58.6k|      if (*nbytes % *chunksize > 0) {
  ------------------
  |  Branch (1035:11): [True: 54.4k, False: 4.15k]
  ------------------
 1036|  54.4k|        *nchunks += 1;
 1037|  54.4k|      }
 1038|       |
 1039|       |      // Sanity check for compressed sizes
 1040|  58.6k|      if ((*cbytes < 0) || ((int64_t)*nchunks * *chunksize < *nbytes)) {
  ------------------
  |  Branch (1040:11): [True: 63, False: 58.5k]
  |  Branch (1040:28): [True: 10, False: 58.5k]
  ------------------
 1041|     73|        BLOSC_TRACE_ERROR("Invalid compressed size in frame header.");
  ------------------
  |  |   93|     73|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     73|    do {                                            \
  |  |  |  |   98|     73|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     73|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 73, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     73|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1042|     73|        return BLOSC2_ERROR_INVALID_HEADER;
 1043|     73|      }
 1044|  58.6k|    }
 1045|  18.7k|    else if (*chunksize == 0) {
  ------------------
  |  Branch (1045:14): [True: 18.7k, False: 43]
  ------------------
 1046|  18.7k|      int32_t coffsets_nbytes;
 1047|  18.7k|      int rc2 = get_coffsets_nbytes(frame, *header_len, *cbytes, &coffsets_nbytes, io);
 1048|  18.7k|      if (rc2 < 0) {
  ------------------
  |  Branch (1048:11): [True: 392, False: 18.3k]
  ------------------
 1049|    392|        return rc2;
 1050|    392|      }
 1051|  18.3k|      if (coffsets_nbytes < 0 || coffsets_nbytes % (int32_t)sizeof(int64_t) != 0) {
  ------------------
  |  Branch (1051:11): [True: 30, False: 18.2k]
  |  Branch (1051:34): [True: 10, False: 18.2k]
  ------------------
 1052|     40|        BLOSC_TRACE_ERROR("Invalid offsets chunk in frame header.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1053|     40|        return BLOSC2_ERROR_INVALID_HEADER;
 1054|     40|      }
 1055|  18.2k|      *nchunks = coffsets_nbytes / (int32_t)sizeof(int64_t);
 1056|  18.2k|    }
 1057|     43|    else {
 1058|     43|      BLOSC_TRACE_ERROR("Invalid chunk size in frame header.");
  ------------------
  |  |   93|     43|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     43|    do {                                            \
  |  |  |  |   98|     43|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     43|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 43, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     43|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1059|     43|      return BLOSC2_ERROR_INVALID_HEADER;
 1060|     43|    }
 1061|  77.3k|  } else {
 1062|    685|    *nchunks = 0;
 1063|    685|  }
 1064|       |
 1065|  77.5k|  if (*nchunks > 0) {
  ------------------
  |  Branch (1065:7): [True: 76.8k, False: 697]
  ------------------
 1066|  76.8k|    int32_t off_nbytes;
 1067|  76.8k|    if (!blosc2_nchunks_to_offsets_nbytes(*nchunks, &off_nbytes)) {
  ------------------
  |  Branch (1067:9): [True: 72, False: 76.7k]
  ------------------
 1068|     72|      BLOSC_TRACE_ERROR("Invalid number of chunks in frame header.");
  ------------------
  |  |   93|     72|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     72|    do {                                            \
  |  |  |  |   98|     72|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     72|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 72, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     72|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1069|     72|      return BLOSC2_ERROR_INVALID_HEADER;
 1070|     72|    }
 1071|  76.8k|  }
 1072|       |
 1073|  77.4k|  return 0;
 1074|  77.5k|}
get_trailer_offset:
 1077|    921|int64_t get_trailer_offset(blosc2_frame_s *frame, int32_t header_len, bool has_coffsets) {
 1078|    921|  if (!has_coffsets) {
  ------------------
  |  Branch (1078:7): [True: 147, False: 774]
  ------------------
 1079|       |    // No data chunks yet
 1080|    147|    return header_len;
 1081|    147|  }
 1082|    774|  return frame->len - frame->trailer_len;
 1083|    921|}
frame_from_cframe:
 1873|  13.8k|blosc2_frame_s* frame_from_cframe(uint8_t *cframe, int64_t len, bool copy) {
 1874|       |  // Get the length of the frame
 1875|  13.8k|  const uint8_t* header = cframe;
 1876|  13.8k|  int64_t frame_len;
 1877|  13.8k|  if (len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  13.8k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  13.8k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  13.8k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  13.8k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  13.8k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  13.8k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  13.8k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  13.8k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  13.8k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  13.8k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  13.8k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  13.8k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  13.8k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  13.8k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1877:7): [True: 0, False: 13.8k]
  ------------------
 1878|      0|    return NULL;
 1879|      0|  }
 1880|       |
 1881|  13.8k|  from_big(&frame_len, header + FRAME_LEN, sizeof(frame_len));
  ------------------
  |  |   38|  13.8k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1882|  13.8k|  if (frame_len != len) {   // sanity check
  ------------------
  |  Branch (1882:7): [True: 106, False: 13.7k]
  ------------------
 1883|    106|    return NULL;
 1884|    106|  }
 1885|       |
 1886|  13.7k|  blosc2_frame_s* frame = frame_alloc();
 1887|  13.7k|  if (frame == NULL) {
  ------------------
  |  Branch (1887:7): [True: 0, False: 13.7k]
  ------------------
 1888|      0|    return NULL;
 1889|      0|  }
 1890|  13.7k|  frame->len = frame_len;
 1891|  13.7k|  frame->file_offset = 0;
 1892|       |
 1893|       |  // Now, the trailer length
 1894|  13.7k|  const uint8_t* trailer = cframe + frame_len - FRAME_TRAILER_MINLEN;
  ------------------
  |  |   58|  13.7k|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
 1895|  13.7k|  int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   58|  13.7k|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
                int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   59|  13.7k|#define FRAME_TRAILER_LEN_OFFSET (22)  // offset to trailer length (counting from the end)
  ------------------
 1896|  13.7k|  if (trailer[trailer_offset - 1] != 0xce) {
  ------------------
  |  Branch (1896:7): [True: 13, False: 13.7k]
  ------------------
 1897|     13|    blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|     13|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 1898|     13|    free(frame);
 1899|     13|    return NULL;
 1900|     13|  }
 1901|  13.7k|  uint32_t trailer_len;
 1902|  13.7k|  from_big(&trailer_len, trailer + trailer_offset, sizeof(trailer_len));
  ------------------
  |  |   38|  13.7k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1903|  13.7k|  if (trailer_len < FRAME_TRAILER_MINLEN || trailer_len > INT32_MAX ||
  ------------------
  |  |   58|  27.5k|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (1903:7): [True: 7, False: 13.7k]
  |  Branch (1903:45): [True: 33, False: 13.7k]
  ------------------
 1904|  13.7k|      (int64_t)trailer_len > frame_len ||
  ------------------
  |  Branch (1904:7): [True: 35, False: 13.7k]
  ------------------
 1905|  13.7k|      (int64_t)trailer_len > frame_len - FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  13.7k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  13.7k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  13.7k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  13.7k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  13.7k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  13.7k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  13.7k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  13.7k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  13.7k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  13.7k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  13.7k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  13.7k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  13.7k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  13.7k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1905:7): [True: 14, False: 13.6k]
  ------------------
 1906|     89|    blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|     89|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 1907|     89|    free(frame);
 1908|     89|    return NULL;
 1909|     89|  }
 1910|  13.6k|  frame->trailer_len = trailer_len;
 1911|       |
 1912|  13.6k|  if (copy) {
  ------------------
  |  Branch (1912:7): [True: 0, False: 13.6k]
  ------------------
 1913|      0|    frame->cframe = malloc((size_t)len);
 1914|      0|    memcpy(frame->cframe, cframe, (size_t)len);
 1915|      0|  }
 1916|  13.6k|  else {
 1917|  13.6k|    frame->cframe = cframe;
 1918|  13.6k|    frame->avoid_cframe_free = true;
 1919|  13.6k|  }
 1920|       |
 1921|  13.6k|  return frame;
 1922|  13.7k|}
get_coffsets:
 2103|  75.1k|                      int64_t nchunks, int32_t *off_cbytes) {
 2104|  75.1k|  int32_t chunk_cbytes;
 2105|  75.1k|  int rc;
 2106|       |
 2107|  75.1k|  if (frame->coffsets != NULL) {
  ------------------
  |  Branch (2107:7): [True: 0, False: 75.1k]
  ------------------
 2108|      0|    if (off_cbytes != NULL) {
  ------------------
  |  Branch (2108:9): [True: 0, False: 0]
  ------------------
 2109|      0|      rc = blosc2_cbuffer_sizes(frame->coffsets, NULL, &chunk_cbytes, NULL);
 2110|      0|      if (rc < 0) {
  ------------------
  |  Branch (2110:11): [True: 0, False: 0]
  ------------------
 2111|      0|        return NULL;
 2112|      0|      }
 2113|      0|      *off_cbytes = (int32_t)chunk_cbytes;
 2114|      0|    }
 2115|      0|    return frame->coffsets;
 2116|      0|  }
 2117|  75.1k|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (2117:7): [True: 75.1k, False: 0]
  ------------------
 2118|  75.1k|    int64_t off_pos = header_len;
 2119|  75.1k|    if (cbytes < INT64_MAX - header_len) {
  ------------------
  |  Branch (2119:9): [True: 2.41k, False: 72.7k]
  ------------------
 2120|  2.41k|      off_pos += cbytes;
 2121|  2.41k|    }
 2122|       |    // Check that there is enough room to read Blosc header
 2123|  75.1k|    if (off_pos < 0 || off_pos > INT64_MAX - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (2123:9): [True: 0, False: 75.1k]
  |  Branch (2123:24): [True: 1, False: 75.1k]
  ------------------
 2124|  75.1k|        off_pos + BLOSC_EXTENDED_HEADER_LENGTH > frame->len) {
  ------------------
  |  Branch (2124:9): [True: 205, False: 74.9k]
  ------------------
 2125|    206|      BLOSC_TRACE_ERROR("Cannot read the offsets outside of frame boundary.");
  ------------------
  |  |   93|    206|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    206|    do {                                            \
  |  |  |  |   98|    206|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    206|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 206, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    206|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2126|    206|      return NULL;
 2127|    206|    }
 2128|       |    // For in-memory frames, the coffset is just one pointer away
 2129|  74.9k|    uint8_t* off_start = frame->cframe + off_pos;
 2130|  74.9k|    if (off_cbytes != NULL) {
  ------------------
  |  Branch (2130:9): [True: 74.9k, False: 0]
  ------------------
 2131|  74.9k|      int32_t chunk_nbytes;
 2132|  74.9k|      int32_t chunk_blocksize;
 2133|  74.9k|      rc = blosc2_cbuffer_sizes(off_start, &chunk_nbytes, &chunk_cbytes, &chunk_blocksize);
 2134|  74.9k|      if (rc < 0) {
  ------------------
  |  Branch (2134:11): [True: 15, False: 74.8k]
  ------------------
 2135|     15|        return NULL;
 2136|     15|      }
 2137|  74.8k|      *off_cbytes = (int32_t)chunk_cbytes;
 2138|  74.8k|      if (*off_cbytes < 0 || off_pos + *off_cbytes > frame->len) {
  ------------------
  |  Branch (2138:11): [True: 0, False: 74.8k]
  |  Branch (2138:30): [True: 45, False: 74.8k]
  ------------------
 2139|     45|        BLOSC_TRACE_ERROR("Cannot read the cbytes outside of frame boundary.");
  ------------------
  |  |   93|     45|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     45|    do {                                            \
  |  |  |  |   98|     45|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     45|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 45, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     45|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2140|     45|        return NULL;
 2141|     45|      }
 2142|  74.8k|      int32_t expected_off_nbytes;
 2143|  74.8k|      if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &expected_off_nbytes)) {
  ------------------
  |  Branch (2143:11): [True: 0, False: 74.8k]
  ------------------
 2144|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2145|      0|        return NULL;
 2146|      0|      }
 2147|  74.8k|      if (chunk_nbytes != expected_off_nbytes) {
  ------------------
  |  Branch (2147:11): [True: 59, False: 74.7k]
  ------------------
 2148|     59|        BLOSC_TRACE_ERROR("The number of chunks in offset idx "
  ------------------
  |  |   93|     59|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     59|    do {                                            \
  |  |  |  |   98|     59|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     59|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 59, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     59|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2149|     59|                          "does not match the ones in the header frame.");
 2150|     59|        return NULL;
 2151|     59|      }
 2152|       |
 2153|  74.8k|    }
 2154|  74.7k|    return off_start;
 2155|  74.9k|  }
 2156|       |
 2157|      0|  int64_t trailer_offset = get_trailer_offset(frame, header_len, true);
 2158|       |
 2159|      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 (2159:7): [True: 0, False: 0]
  |  Branch (2159:56): [True: 0, False: 0]
  ------------------
 2160|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2161|      0|    return NULL;
 2162|      0|  }
 2163|       |
 2164|      0|  int64_t coffsets_cbytes64;
 2165|      0|  if (frame->sframe) {
  ------------------
  |  Branch (2165:7): [True: 0, False: 0]
  ------------------
 2166|      0|    coffsets_cbytes64 = trailer_offset - header_len;
 2167|      0|  }
 2168|      0|  else {
 2169|      0|    coffsets_cbytes64 = trailer_offset - (header_len + cbytes);
 2170|      0|  }
 2171|      0|  if (coffsets_cbytes64 <= 0 || coffsets_cbytes64 > INT32_MAX) {
  ------------------
  |  Branch (2171:7): [True: 0, False: 0]
  |  Branch (2171:33): [True: 0, False: 0]
  ------------------
 2172|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2173|      0|    return NULL;
 2174|      0|  }
 2175|      0|  int32_t coffsets_cbytes = (int32_t)coffsets_cbytes64;
 2176|       |
 2177|      0|  if (off_cbytes != NULL) {
  ------------------
  |  Branch (2177:7): [True: 0, False: 0]
  ------------------
 2178|      0|    *off_cbytes = coffsets_cbytes;
 2179|      0|  }
 2180|       |
 2181|      0|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 2182|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (2182:7): [True: 0, False: 0]
  ------------------
 2183|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2184|      0|    return NULL;
 2185|      0|  }
 2186|       |
 2187|      0|  void* fp = NULL;
 2188|      0|  uint8_t* coffsets;
 2189|      0|  if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (2189:7): [True: 0, False: 0]
  ------------------
 2190|      0|    coffsets = malloc((size_t)coffsets_cbytes);
 2191|      0|    frame->coffsets_needs_free = true;
 2192|      0|  }
 2193|      0|  else {
 2194|      0|    frame->coffsets_needs_free = false;
 2195|      0|  }
 2196|       |
 2197|      0|  int64_t io_pos = 0;
 2198|      0|  if (frame->sframe) {
  ------------------
  |  Branch (2198:7): [True: 0, False: 0]
  ------------------
 2199|      0|    fp = sframe_open_index(frame->urlpath, "rb",
 2200|      0|                           frame->schunk->storage->io);
 2201|      0|    if (fp == NULL) {
  ------------------
  |  Branch (2201:9): [True: 0, False: 0]
  ------------------
 2202|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2203|      0|      return NULL;
 2204|      0|    }
 2205|      0|    io_pos = header_len + 0;
 2206|      0|  }
 2207|      0|  else {
 2208|      0|    fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 2209|      0|    if (fp == NULL) {
  ------------------
  |  Branch (2209:9): [True: 0, False: 0]
  ------------------
 2210|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2211|      0|      return NULL;
 2212|      0|    }
 2213|      0|    io_pos = frame->file_offset + header_len + cbytes;
 2214|      0|  }
 2215|      0|  int64_t rbytes = io_cb->read((void**)&coffsets, 1, coffsets_cbytes, io_pos, fp);
 2216|      0|  frame_reader_release(frame, io_cb, fp);
 2217|      0|  if (rbytes != coffsets_cbytes) {
  ------------------
  |  Branch (2217:7): [True: 0, False: 0]
  ------------------
 2218|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2219|      0|    if (frame->coffsets_needs_free)
  ------------------
  |  Branch (2219:9): [True: 0, False: 0]
  ------------------
 2220|      0|      free(coffsets);
 2221|      0|    return NULL;
 2222|      0|  }
 2223|      0|  frame->coffsets = coffsets;
 2224|      0|  return coffsets;
 2225|      0|}
frame_get_metalayers:
 2514|  1.08k|int frame_get_metalayers(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 2515|  1.08k|  int32_t header_len;
 2516|  1.08k|  int64_t frame_len;
 2517|  1.08k|  int64_t nbytes;
 2518|  1.08k|  int64_t cbytes;
 2519|  1.08k|  int32_t blocksize;
 2520|  1.08k|  int32_t chunksize;
 2521|  1.08k|  int64_t nchunks;
 2522|  1.08k|  int ret = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 2523|  1.08k|                            &blocksize, &chunksize, &nchunks,
 2524|  1.08k|                            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 2525|  1.08k|                            schunk->storage->io);
 2526|  1.08k|  if (ret < 0) {
  ------------------
  |  Branch (2526:7): [True: 0, False: 1.08k]
  ------------------
 2527|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2528|      0|    return ret;
 2529|      0|  }
 2530|       |
 2531|       |  // Get the header
 2532|  1.08k|  uint8_t* header = NULL;
 2533|  1.08k|  bool needs_free = false;
 2534|  1.08k|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (2534:7): [True: 1.08k, False: 0]
  ------------------
 2535|  1.08k|    header = frame->cframe;
 2536|  1.08k|  } else {
 2537|      0|    int64_t rbytes = 0;
 2538|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 2539|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (2539:9): [True: 0, False: 0]
  ------------------
 2540|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2541|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 2542|      0|    }
 2543|       |
 2544|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (2544:9): [True: 0, False: 0]
  ------------------
 2545|      0|      header = malloc(header_len);
 2546|      0|      needs_free = true;
 2547|      0|    }
 2548|      0|    else {
 2549|      0|      needs_free = false;
 2550|      0|    }
 2551|       |
 2552|      0|    void* fp = NULL;
 2553|      0|    int64_t io_pos = 0;
 2554|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2554:9): [True: 0, False: 0]
  ------------------
 2555|      0|      fp = sframe_open_index(frame->urlpath, "rb",
 2556|      0|                             frame->schunk->storage->io);
 2557|      0|      if (fp == NULL) {
  ------------------
  |  Branch (2557:11): [True: 0, False: 0]
  ------------------
 2558|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2559|      0|        return BLOSC2_ERROR_FILE_OPEN;
 2560|      0|      }
 2561|      0|    }
 2562|      0|    else {
 2563|      0|      fp = frame_reader_acquire(frame, 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|      io_pos = frame->file_offset;
 2569|      0|    }
 2570|      0|    if (fp != NULL) {
  ------------------
  |  Branch (2570:9): [True: 0, False: 0]
  ------------------
 2571|      0|      rbytes = io_cb->read((void**)&header, 1, header_len, io_pos, fp);
 2572|      0|      frame_reader_release(frame, io_cb, fp);
 2573|      0|    }
 2574|      0|    if (rbytes != header_len) {
  ------------------
  |  Branch (2574:9): [True: 0, False: 0]
  ------------------
 2575|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2576|      0|      if (needs_free)
  ------------------
  |  Branch (2576:11): [True: 0, False: 0]
  ------------------
 2577|      0|        free(header);
 2578|      0|      return BLOSC2_ERROR_FILE_READ;
 2579|      0|    }
 2580|      0|  }
 2581|       |
 2582|  1.08k|  ret = get_meta_from_header(frame, schunk, header, header_len);
 2583|       |
 2584|  1.08k|  if (frame->cframe == NULL && needs_free) {
  ------------------
  |  Branch (2584:7): [True: 0, False: 1.08k]
  |  Branch (2584:32): [True: 0, False: 0]
  ------------------
 2585|      0|    free(header);
 2586|      0|  }
 2587|       |
 2588|  1.08k|  return ret;
 2589|  1.08k|}
frame_get_vlmetalayers:
 2725|    921|int frame_get_vlmetalayers(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 2726|    921|  int32_t header_len;
 2727|    921|  int64_t frame_len;
 2728|    921|  int64_t nbytes;
 2729|    921|  int64_t cbytes;
 2730|    921|  int32_t blocksize;
 2731|    921|  int32_t chunksize;
 2732|    921|  int64_t nchunks;
 2733|    921|  int ret = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 2734|    921|                            &blocksize, &chunksize, &nchunks,
 2735|    921|                            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 2736|    921|                            schunk->storage->io);
 2737|    921|  if (ret < 0) {
  ------------------
  |  Branch (2737:7): [True: 0, False: 921]
  ------------------
 2738|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2739|      0|    return ret;
 2740|      0|  }
 2741|       |
 2742|    921|  int64_t trailer_offset = get_trailer_offset(frame, header_len, nbytes > 0);
 2743|    921|  int32_t trailer_len = (int32_t) frame->trailer_len;
 2744|       |
 2745|    921|  if (trailer_offset < BLOSC_EXTENDED_HEADER_LENGTH || trailer_offset + trailer_len > frame->len) {
  ------------------
  |  Branch (2745:7): [True: 0, False: 921]
  |  Branch (2745:56): [True: 55, False: 866]
  ------------------
 2746|     55|    BLOSC_TRACE_ERROR("Cannot access the trailer out of the frame.");
  ------------------
  |  |   93|     55|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     55|    do {                                            \
  |  |  |  |   98|     55|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     55|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 55, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     55|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2747|     55|    return BLOSC2_ERROR_READ_BUFFER;
 2748|     55|  }
 2749|       |
 2750|       |  // Get the trailer
 2751|    866|  uint8_t* trailer = NULL;
 2752|    866|  bool needs_free = false;
 2753|    866|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (2753:7): [True: 866, False: 0]
  ------------------
 2754|    866|    trailer = frame->cframe + trailer_offset;
 2755|    866|  } else {
 2756|      0|    int64_t rbytes = 0;
 2757|       |
 2758|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 2759|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (2759:9): [True: 0, False: 0]
  ------------------
 2760|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2761|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 2762|      0|    }
 2763|       |
 2764|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (2764:9): [True: 0, False: 0]
  ------------------
 2765|      0|      trailer = malloc(trailer_len);
 2766|      0|      needs_free = true;
 2767|      0|    }
 2768|      0|    else {
 2769|      0|      needs_free = false;
 2770|      0|    }
 2771|       |
 2772|      0|    void* fp = NULL;
 2773|      0|    int64_t io_pos = 0;
 2774|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2774:9): [True: 0, False: 0]
  ------------------
 2775|       |      // Check for overflow before calculating length
 2776|      0|      if (strlen(frame->urlpath) > SIZE_MAX - strlen("/chunks.b2frame") - 1) {
  ------------------
  |  Branch (2776:11): [True: 0, False: 0]
  ------------------
 2777|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2778|      0|        if (needs_free) free(trailer);
  ------------------
  |  Branch (2778:13): [True: 0, False: 0]
  ------------------
 2779|      0|        return BLOSC2_ERROR_INVALID_PARAM;
 2780|      0|      }
 2781|      0|      size_t _len = strlen(frame->urlpath) + strlen("/chunks.b2frame") + 1;
 2782|      0|      char* eframe_name = malloc(_len);
 2783|      0|      if (eframe_name == NULL) {
  ------------------
  |  Branch (2783:11): [True: 0, False: 0]
  ------------------
 2784|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2785|      0|        if (needs_free) free(trailer);
  ------------------
  |  Branch (2785:13): [True: 0, False: 0]
  ------------------
 2786|      0|        return BLOSC2_ERROR_MEMORY_ALLOC;
 2787|      0|      }
 2788|      0|      int _w = snprintf(eframe_name, _len, "%s/chunks.b2frame", frame->urlpath);
 2789|      0|      if (_w < 0 || (size_t)_w >= _len) {
  ------------------
  |  Branch (2789:11): [True: 0, False: 0]
  |  Branch (2789:21): [True: 0, False: 0]
  ------------------
 2790|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2791|      0|        free(eframe_name);
 2792|      0|        if (needs_free) free(trailer);
  ------------------
  |  Branch (2792:13): [True: 0, False: 0]
  ------------------
 2793|      0|        return BLOSC2_ERROR_INVALID_PARAM;
 2794|      0|      }
 2795|      0|      fp = io_cb->open(eframe_name, "rb", frame->schunk->storage->io->params);
 2796|      0|      if (fp == NULL) {
  ------------------
  |  Branch (2796:11): [True: 0, False: 0]
  ------------------
 2797|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2798|      0|        free(eframe_name);
 2799|      0|        return BLOSC2_ERROR_FILE_OPEN;
 2800|      0|      }
 2801|      0|      free(eframe_name);
 2802|      0|      io_pos = trailer_offset;
 2803|      0|    }
 2804|      0|    else {
 2805|      0|      fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 2806|      0|      if (fp == NULL) {
  ------------------
  |  Branch (2806:11): [True: 0, False: 0]
  ------------------
 2807|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2808|      0|        return BLOSC2_ERROR_FILE_OPEN;
 2809|      0|      }
 2810|      0|      io_pos = frame->file_offset + trailer_offset;
 2811|      0|    }
 2812|      0|    if (fp != NULL) {
  ------------------
  |  Branch (2812:9): [True: 0, False: 0]
  ------------------
 2813|      0|      rbytes = io_cb->read((void**)&trailer, 1, trailer_len, io_pos, fp);
 2814|      0|      frame_reader_release(frame, io_cb, fp);
 2815|      0|    }
 2816|      0|    if (rbytes != trailer_len) {
  ------------------
  |  Branch (2816:9): [True: 0, False: 0]
  ------------------
 2817|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2818|      0|      if (needs_free)
  ------------------
  |  Branch (2818:11): [True: 0, False: 0]
  ------------------
 2819|      0|        free(trailer);
 2820|      0|      return BLOSC2_ERROR_FILE_READ;
 2821|      0|    }
 2822|      0|  }
 2823|       |
 2824|    866|  ret = get_vlmeta_from_trailer(frame, schunk, trailer, trailer_len);
 2825|       |
 2826|    866|  if (frame->cframe == NULL && needs_free) {
  ------------------
  |  Branch (2826:7): [True: 0, False: 866]
  |  Branch (2826:32): [True: 0, False: 0]
  ------------------
 2827|      0|    free(trailer);
 2828|      0|  }
 2829|       |
 2830|    866|  return ret;
 2831|    866|}
get_new_storage:
 2837|  12.9k|                                const blosc2_io* iodefaults) {
 2838|       |
 2839|  12.9k|  blosc2_storage* new_storage = (blosc2_storage*)calloc(1, sizeof(blosc2_storage));
 2840|  12.9k|  memcpy(new_storage, storage, sizeof(blosc2_storage));
 2841|  12.9k|  if (storage->urlpath != NULL) {
  ------------------
  |  Branch (2841:7): [True: 0, False: 12.9k]
  ------------------
 2842|      0|    char* urlpath = normalize_urlpath(storage->urlpath);
 2843|      0|    new_storage->urlpath = malloc(strlen(urlpath) + 1);
 2844|      0|    strcpy(new_storage->urlpath, urlpath);
 2845|      0|  }
 2846|       |
 2847|       |  // cparams
 2848|  12.9k|  blosc2_cparams* cparams = malloc(sizeof(blosc2_cparams));
 2849|  12.9k|  if (storage->cparams != NULL) {
  ------------------
  |  Branch (2849:7): [True: 0, False: 12.9k]
  ------------------
 2850|      0|    memcpy(cparams, storage->cparams, sizeof(blosc2_cparams));
 2851|  12.9k|  } else {
 2852|  12.9k|    memcpy(cparams, cdefaults, sizeof(blosc2_cparams));
 2853|  12.9k|  }
 2854|  12.9k|  new_storage->cparams = cparams;
 2855|       |
 2856|       |  // dparams
 2857|  12.9k|  blosc2_dparams* dparams = malloc(sizeof(blosc2_dparams));
 2858|  12.9k|  if (storage->dparams != NULL) {
  ------------------
  |  Branch (2858:7): [True: 0, False: 12.9k]
  ------------------
 2859|      0|    memcpy(dparams, storage->dparams, sizeof(blosc2_dparams));
 2860|      0|  }
 2861|  12.9k|  else {
 2862|  12.9k|    memcpy(dparams, ddefaults, sizeof(blosc2_dparams));
 2863|  12.9k|  }
 2864|  12.9k|  new_storage->dparams = dparams;
 2865|       |
 2866|       |  // iodefaults
 2867|  12.9k|  blosc2_io* udio = malloc(sizeof(blosc2_io));
 2868|  12.9k|  if (storage->io != NULL) {
  ------------------
  |  Branch (2868:7): [True: 0, False: 12.9k]
  ------------------
 2869|      0|    memcpy(udio, storage->io, sizeof(blosc2_io));
 2870|      0|  }
 2871|  12.9k|  else {
 2872|  12.9k|    memcpy(udio, iodefaults, sizeof(blosc2_io));
 2873|  12.9k|  }
 2874|  12.9k|  new_storage->io = udio;
 2875|       |
 2876|  12.9k|  return new_storage;
 2877|  12.9k|}
frame_to_schunk:
 2941|  13.6k|blosc2_schunk* frame_to_schunk(blosc2_frame_s* frame, bool copy, const blosc2_io *udio) {
 2942|  13.6k|  int32_t header_len;
 2943|  13.6k|  int64_t frame_len;
 2944|  13.6k|  int rc;
 2945|  13.6k|  bool frame_attached = true;
 2946|  13.6k|  blosc2_schunk* schunk = calloc(1, sizeof(blosc2_schunk));
 2947|  13.6k|  blosc2_cparams *cparams = NULL;
 2948|  13.6k|  blosc2_dparams *dparams = NULL;
 2949|  13.6k|  int64_t *offsets = NULL;
 2950|  13.6k|  if (schunk == NULL) {
  ------------------
  |  Branch (2950:7): [True: 0, False: 13.6k]
  ------------------
 2951|      0|    return NULL;
 2952|      0|  }
 2953|  13.6k|  schunk->frame = (blosc2_frame*)frame;
 2954|  13.6k|  frame->schunk = schunk;
 2955|       |
 2956|  13.6k|  rc = get_header_info(frame, &header_len, &frame_len, &schunk->nbytes,
 2957|  13.6k|                       &schunk->cbytes, &schunk->blocksize,
 2958|  13.6k|                       &schunk->chunksize, &schunk->nchunks, &schunk->typesize,
 2959|  13.6k|                       &schunk->compcode, &schunk->compcode_meta, &schunk->clevel, schunk->filters,
 2960|  13.6k|                       schunk->filters_meta, &schunk->splitmode, &schunk->use_dict, udio);
 2961|  13.6k|  if (rc < 0) {
  ------------------
  |  Branch (2961:7): [True: 710, False: 12.9k]
  ------------------
 2962|    710|    BLOSC_TRACE_ERROR("Unable to get meta info from frame.");
  ------------------
  |  |   93|    710|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    710|    do {                                            \
  |  |  |  |   98|    710|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    710|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 710, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    710|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2963|    710|    goto error;
 2964|    710|  }
 2965|  12.9k|  int64_t nchunks = schunk->nchunks;
 2966|  12.9k|  int64_t nbytes = schunk->nbytes;
 2967|  12.9k|  (void) nbytes;
 2968|  12.9k|  int64_t cbytes = schunk->cbytes;
 2969|       |
 2970|       |  // Compression and decompression contexts
 2971|  12.9k|  blosc2_schunk_get_cparams(schunk, &cparams);
 2972|  12.9k|  schunk->cctx = blosc2_create_cctx(*cparams);
 2973|  12.9k|  if (schunk->cctx == NULL) {
  ------------------
  |  Branch (2973:7): [True: 78, False: 12.9k]
  ------------------
 2974|     78|    BLOSC_TRACE_ERROR("Error while creating the compression context");
  ------------------
  |  |   93|     78|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     78|    do {                                            \
  |  |  |  |   98|     78|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     78|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 78, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     78|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2975|     78|    goto error;
 2976|     78|  }
 2977|  12.9k|  blosc2_schunk_get_dparams(schunk, &dparams);
 2978|  12.9k|  schunk->dctx = blosc2_create_dctx(*dparams);
 2979|  12.9k|  if (schunk->dctx == NULL) {
  ------------------
  |  Branch (2979:7): [True: 0, False: 12.9k]
  ------------------
 2980|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2981|      0|    goto error;
 2982|      0|  }
 2983|  12.9k|  blosc2_storage storage = {.contiguous = copy ? false : true};
  ------------------
  |  Branch (2983:43): [True: 0, False: 12.9k]
  ------------------
 2984|  12.9k|  schunk->storage = get_new_storage(&storage, cparams, dparams, udio);
 2985|  12.9k|  free(cparams);
 2986|  12.9k|  cparams = NULL;
 2987|  12.9k|  free(dparams);
 2988|  12.9k|  dparams = NULL;
 2989|  12.9k|  if (nchunks > 0) {
  ------------------
  |  Branch (2989:7): [True: 12.6k, False: 257]
  ------------------
 2990|  12.6k|    rc = validate_offsets_chunk(frame, header_len, cbytes, nchunks);
 2991|  12.6k|    if (rc < 0) {
  ------------------
  |  Branch (2991:9): [True: 10.9k, False: 1.73k]
  ------------------
 2992|  10.9k|      BLOSC_TRACE_ERROR("Cannot validate frame offsets.");
  ------------------
  |  |   93|  10.9k|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|  10.9k|    do {                                            \
  |  |  |  |   98|  10.9k|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|  10.9k|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 10.9k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|  10.9k|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2993|  10.9k|      goto error;
 2994|  10.9k|    }
 2995|  12.6k|  }
 2996|  1.99k|  if (nchunks > 0) {
  ------------------
  |  Branch (2996:7): [True: 1.73k, False: 257]
  ------------------
 2997|  1.73k|    uint8_t *chunk;
 2998|  1.73k|    bool needs_free;
 2999|       |    // A lazy chunk is enough here: only the header is needed for the flags2 byte
 3000|  1.73k|    rc = frame_get_lazychunk(frame, 0, &chunk, &needs_free);
 3001|  1.73k|    if (rc < 0) {
  ------------------
  |  Branch (3001:9): [True: 910, False: 827]
  ------------------
 3002|    910|      BLOSC_TRACE_ERROR("Cannot inspect the first chunk in frame.");
  ------------------
  |  |   93|    910|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    910|    do {                                            \
  |  |  |  |   98|    910|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    910|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 910, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    910|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3003|    910|      goto error;
 3004|    910|    }
 3005|    827|    schunk->flags2 = chunk[BLOSC2_CHUNK_BLOSC2_FLAGS2];
 3006|    827|    if (needs_free) {
  ------------------
  |  Branch (3006:9): [True: 410, False: 417]
  ------------------
 3007|    410|      free(chunk);
 3008|    410|    }
 3009|    827|  }
 3010|  1.08k|  if (!copy) {
  ------------------
  |  Branch (3010:7): [True: 1.08k, False: 0]
  ------------------
 3011|  1.08k|    goto out;
 3012|  1.08k|  }
 3013|       |
 3014|       |  // We are not attached to a frame anymore
 3015|      0|  schunk->frame = NULL;
 3016|      0|  frame_attached = false;
 3017|       |
 3018|      0|  if (nchunks == 0) {
  ------------------
  |  Branch (3018:7): [True: 0, False: 0]
  ------------------
 3019|      0|    frame->schunk = NULL;
 3020|      0|    goto out;
 3021|      0|  }
 3022|       |
 3023|       |  // Get the compressed offsets
 3024|      0|  int32_t coffsets_cbytes = 0;
 3025|      0|  uint8_t* coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &coffsets_cbytes);
 3026|      0|  if (coffsets == NULL) {
  ------------------
  |  Branch (3026:7): [True: 0, False: 0]
  ------------------
 3027|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3028|      0|    goto error;
 3029|      0|  }
 3030|       |
 3031|       |  // Decompress offsets
 3032|      0|  blosc2_dparams off_dparams = BLOSC2_DPARAMS_DEFAULTS;
 3033|      0|  blosc2_context *dctx = blosc2_create_dctx(off_dparams);
 3034|      0|  if (dctx == NULL) {
  ------------------
  |  Branch (3034:7): [True: 0, False: 0]
  ------------------
 3035|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3036|      0|    goto error;
 3037|      0|  }
 3038|      0|  int32_t offsets_nbytes;
 3039|      0|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &offsets_nbytes)) {
  ------------------
  |  Branch (3039:7): [True: 0, False: 0]
  ------------------
 3040|      0|    blosc2_free_ctx(dctx);
 3041|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3042|      0|    goto error;
 3043|      0|  }
 3044|      0|  offsets = (int64_t *) malloc((size_t)offsets_nbytes);
 3045|      0|  if (offsets == NULL) {
  ------------------
  |  Branch (3045:7): [True: 0, False: 0]
  ------------------
 3046|      0|    blosc2_free_ctx(dctx);
 3047|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3048|      0|    goto error;
 3049|      0|  }
 3050|      0|  int32_t off_nbytes = blosc2_decompress_ctx(dctx, coffsets, coffsets_cbytes,
 3051|      0|                                             offsets, offsets_nbytes);
 3052|      0|  blosc2_free_ctx(dctx);
 3053|      0|  if (off_nbytes < 0) {
  ------------------
  |  Branch (3053:7): [True: 0, False: 0]
  ------------------
 3054|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3055|      0|    goto error;
 3056|      0|  }
 3057|       |
 3058|       |  // We want the contiguous schunk, so create the actual data chunks (and, while doing this,
 3059|       |  // get a guess at the blocksize used in this frame)
 3060|      0|  int64_t acc_nbytes = 0;
 3061|      0|  int64_t acc_cbytes = 0;
 3062|      0|  int32_t blocksize = 0;
 3063|      0|  int32_t chunk_nbytes;
 3064|      0|  int32_t chunk_cbytes;
 3065|      0|  int32_t chunk_blocksize;
 3066|      0|  size_t prev_alloc = BLOSC_EXTENDED_HEADER_LENGTH;
 3067|      0|  uint8_t* data_chunk = NULL;
 3068|      0|  bool needs_free = false;
 3069|      0|  const blosc2_io_cb *io_cb = blosc2_get_io_cb(udio->id);
 3070|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (3070:7): [True: 0, False: 0]
  ------------------
 3071|      0|    blosc2_schunk_free(schunk);
 3072|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3073|      0|    return NULL;
 3074|      0|  }
 3075|       |
 3076|      0|  void* fp = NULL;
 3077|      0|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3077:7): [True: 0, False: 0]
  ------------------
 3078|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (3078:9): [True: 0, False: 0]
  ------------------
 3079|      0|      data_chunk = malloc((size_t)prev_alloc);
 3080|      0|      needs_free = true;
 3081|      0|    }
 3082|      0|    else {
 3083|      0|      needs_free = false;
 3084|      0|    }
 3085|       |
 3086|      0|    if (!frame->sframe) {
  ------------------
  |  Branch (3086:9): [True: 0, False: 0]
  ------------------
 3087|       |      // If not the chunks won't be in the frame
 3088|      0|      fp = frame_reader_acquire(frame, udio);
 3089|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3089:11): [True: 0, False: 0]
  ------------------
 3090|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3091|      0|        rc = BLOSC2_ERROR_FILE_OPEN;
 3092|      0|        goto end;
 3093|      0|      }
 3094|      0|    }
 3095|      0|  }
 3096|      0|  schunk->data = malloc(nchunks * sizeof(void*));
 3097|      0|  for (int64_t i = 0; i < nchunks; i++) {
  ------------------
  |  Branch (3097:23): [True: 0, False: 0]
  ------------------
 3098|      0|    if (frame->cframe != NULL) {
  ------------------
  |  Branch (3098:9): [True: 0, False: 0]
  ------------------
 3099|      0|      if (needs_free) {
  ------------------
  |  Branch (3099:11): [True: 0, False: 0]
  ------------------
 3100|      0|        free(data_chunk);
 3101|      0|      }
 3102|      0|      if (offsets[i] < 0) {
  ------------------
  |  Branch (3102:11): [True: 0, False: 0]
  ------------------
 3103|      0|        int64_t rbytes = frame_get_chunk(frame, i, &data_chunk, &needs_free);
 3104|      0|        if (rbytes < 0) {
  ------------------
  |  Branch (3104:13): [True: 0, False: 0]
  ------------------
 3105|      0|          break;
 3106|      0|        }
 3107|      0|      }
 3108|      0|      else {
 3109|      0|        if (offsets[i] > INT64_MAX - header_len ||
  ------------------
  |  Branch (3109:13): [True: 0, False: 0]
  ------------------
 3110|      0|            header_len + offsets[i] > frame->len - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3110:13): [True: 0, False: 0]
  ------------------
 3111|      0|            offsets[i] > cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3111:13): [True: 0, False: 0]
  ------------------
 3112|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 3113|      0|          break;
 3114|      0|        }
 3115|      0|        data_chunk = frame->cframe + header_len + offsets[i];
 3116|      0|        needs_free = false;
 3117|      0|      }
 3118|      0|      rc = blosc2_cbuffer_sizes(data_chunk, NULL, &chunk_cbytes, NULL);
 3119|      0|      if (rc < 0) {
  ------------------
  |  Branch (3119:11): [True: 0, False: 0]
  ------------------
 3120|      0|        break;
 3121|      0|      }
 3122|      0|      if (offsets[i] >= 0 &&
  ------------------
  |  Branch (3122:11): [True: 0, False: 0]
  ------------------
 3123|      0|          (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3123:12): [True: 0, False: 0]
  ------------------
 3124|      0|           offsets[i] > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (3124:12): [True: 0, False: 0]
  ------------------
 3125|      0|           offsets[i] + chunk_cbytes > cbytes)) {
  ------------------
  |  Branch (3125:12): [True: 0, False: 0]
  ------------------
 3126|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3127|      0|        break;
 3128|      0|      }
 3129|      0|    }
 3130|      0|    else {
 3131|      0|      int64_t rbytes;
 3132|      0|      if (offsets[i] < 0 || frame->sframe) {
  ------------------
  |  Branch (3132:11): [True: 0, False: 0]
  |  Branch (3132:29): [True: 0, False: 0]
  ------------------
 3133|      0|        if (needs_free) {
  ------------------
  |  Branch (3133:13): [True: 0, False: 0]
  ------------------
 3134|      0|          free(data_chunk);
 3135|      0|        }
 3136|      0|        rbytes = frame_get_chunk(frame, i, &data_chunk, &needs_free);
 3137|      0|        if (rbytes < 0) {
  ------------------
  |  Branch (3137:13): [True: 0, False: 0]
  ------------------
 3138|      0|          break;
 3139|      0|        }
 3140|      0|      }
 3141|      0|      else {
 3142|      0|        if (offsets[i] > INT64_MAX - header_len ||
  ------------------
  |  Branch (3142:13): [True: 0, False: 0]
  ------------------
 3143|      0|            header_len + offsets[i] > frame->len - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3143:13): [True: 0, False: 0]
  ------------------
 3144|      0|            offsets[i] > cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3144:13): [True: 0, False: 0]
  ------------------
 3145|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 3146|      0|          break;
 3147|      0|        }
 3148|      0|        int64_t io_pos = frame->file_offset + header_len + offsets[i];
 3149|      0|        rbytes = io_cb->read((void**)&data_chunk, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, fp);
 3150|      0|      }
 3151|      0|      if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3151:11): [True: 0, False: 0]
  ------------------
 3152|      0|        rc = BLOSC2_ERROR_READ_BUFFER;
 3153|      0|        break;
 3154|      0|      }
 3155|      0|      rc = blosc2_cbuffer_sizes(data_chunk, NULL, &chunk_cbytes, NULL);
 3156|      0|      if (rc < 0) {
  ------------------
  |  Branch (3156:11): [True: 0, False: 0]
  ------------------
 3157|      0|        break;
 3158|      0|      }
 3159|      0|      if (offsets[i] >= 0 &&
  ------------------
  |  Branch (3159:11): [True: 0, False: 0]
  ------------------
 3160|      0|          (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3160:12): [True: 0, False: 0]
  ------------------
 3161|      0|           offsets[i] > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (3161:12): [True: 0, False: 0]
  ------------------
 3162|      0|           offsets[i] + chunk_cbytes > cbytes)) {
  ------------------
  |  Branch (3162:12): [True: 0, False: 0]
  ------------------
 3163|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3164|      0|        break;
 3165|      0|      }
 3166|      0|      if (chunk_cbytes > (int32_t)prev_alloc) {
  ------------------
  |  Branch (3166:11): [True: 0, False: 0]
  ------------------
 3167|      0|        if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (3167:13): [True: 0, False: 0]
  ------------------
 3168|      0|          data_chunk = realloc(data_chunk, chunk_cbytes);
 3169|      0|        if (data_chunk == NULL) {
  ------------------
  |  Branch (3169:13): [True: 0, False: 0]
  ------------------
 3170|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3171|      0|          rc = BLOSC2_ERROR_MEMORY_ALLOC;
 3172|      0|          break;
 3173|      0|        }
 3174|      0|        prev_alloc = chunk_cbytes;
 3175|      0|      }
 3176|      0|      if (!frame->sframe) {
  ------------------
  |  Branch (3176:11): [True: 0, False: 0]
  ------------------
 3177|      0|        int64_t io_pos = frame->file_offset + header_len + offsets[i];
 3178|      0|        rbytes = io_cb->read((void**)&data_chunk, 1, chunk_cbytes, io_pos, fp);
 3179|      0|        if (rbytes != chunk_cbytes) {
  ------------------
  |  Branch (3179:13): [True: 0, False: 0]
  ------------------
 3180|      0|          rc = BLOSC2_ERROR_READ_BUFFER;
 3181|      0|          break;
 3182|      0|        }
 3183|      0|      }
 3184|      0|    }
 3185|      0|    uint8_t* new_chunk = malloc(chunk_cbytes);
 3186|      0|    memcpy(new_chunk, data_chunk, chunk_cbytes);
 3187|      0|    schunk->data[i] = new_chunk;
 3188|      0|    rc = blosc2_cbuffer_sizes(data_chunk, &chunk_nbytes, NULL, &chunk_blocksize);
 3189|      0|    if (rc < 0) {
  ------------------
  |  Branch (3189:9): [True: 0, False: 0]
  ------------------
 3190|      0|      break;
 3191|      0|    }
 3192|      0|    acc_nbytes += chunk_nbytes;
 3193|      0|    acc_cbytes += chunk_cbytes;
 3194|      0|    if (i == 0) {
  ------------------
  |  Branch (3194:9): [True: 0, False: 0]
  ------------------
 3195|      0|      blocksize = chunk_blocksize;
 3196|      0|    }
 3197|      0|    else if (blocksize != chunk_blocksize) {
  ------------------
  |  Branch (3197:14): [True: 0, False: 0]
  ------------------
 3198|       |      // Blocksize varies
 3199|      0|      blocksize = 0;
 3200|      0|    }
 3201|      0|  }
 3202|       |
 3203|       |  // We are not attached to a schunk anymore
 3204|      0|  frame->schunk = NULL;
 3205|       |
 3206|      0|  end:
 3207|      0|  if (needs_free) {
  ------------------
  |  Branch (3207:7): [True: 0, False: 0]
  ------------------
 3208|      0|    free(data_chunk);
 3209|      0|  }
 3210|      0|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3210:7): [True: 0, False: 0]
  ------------------
 3211|      0|    if (!frame->sframe) {
  ------------------
  |  Branch (3211:9): [True: 0, False: 0]
  ------------------
 3212|      0|      frame_reader_release(frame, io_cb, fp);
 3213|      0|    }
 3214|      0|  }
 3215|      0|  free(offsets);
 3216|       |  // Avoid a double-free in the `error:` cleanup below, which is reached
 3217|       |  // when frame_get_metalayers / frame_get_vlmetalayers reject a malformed
 3218|       |  // metalayer index after we've already freed `offsets` here.
 3219|      0|  offsets = NULL;
 3220|       |
 3221|       |  // cframes and sframes have different ways to store chunks with special values:
 3222|       |  // 1) cframes represent special chunks as negative offsets
 3223|       |  // 2) sframes does not have the concept of offsets, but rather of data pointers (.data)
 3224|       |  //    so they always have a pointer to a special chunk
 3225|       |  // This is why cframes and sframes have different cbytes and hence, we cannot enforce acc_bytes == schunk->cbytes
 3226|       |  // In the future, maybe we could provide special meanings for .data[i] > 0x7FFFFFFF, but not there yet
 3227|       |  // if (rc < 0 || acc_nbytes != nbytes || acc_cbytes != cbytes) {
 3228|      0|  if (rc < 0 || acc_nbytes != nbytes) {
  ------------------
  |  Branch (3228:7): [True: 0, False: 0]
  |  Branch (3228:17): [True: 0, False: 0]
  ------------------
 3229|      0|    goto error;
 3230|      0|  }
 3231|       |  // Update counters
 3232|      0|  schunk->cbytes = acc_cbytes;
 3233|      0|  schunk->blocksize = blocksize;
 3234|       |
 3235|  1.08k|  out:
 3236|  1.08k|  rc = frame_get_metalayers(frame, schunk);
 3237|  1.08k|  if (rc < 0) {
  ------------------
  |  Branch (3237:7): [True: 163, False: 921]
  ------------------
 3238|    163|    BLOSC_TRACE_ERROR("Cannot access the metalayers.");
  ------------------
  |  |   93|    163|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    163|    do {                                            \
  |  |  |  |   98|    163|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    163|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 163, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    163|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3239|    163|    goto error;
 3240|    163|  }
 3241|       |
 3242|    921|  rc = frame_get_vlmetalayers(frame, schunk);
 3243|    921|  if (rc < 0) {
  ------------------
  |  Branch (3243:7): [True: 221, False: 700]
  ------------------
 3244|    221|    BLOSC_TRACE_ERROR("Cannot access the vlmetalayers.");
  ------------------
  |  |   93|    221|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    221|    do {                                            \
  |  |  |  |   98|    221|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    221|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 221, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    221|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3245|    221|    goto error;
 3246|    221|  }
 3247|       |
 3248|    700|  return schunk;
 3249|       |
 3250|  12.9k|error:
 3251|  12.9k|  free(cparams);
 3252|  12.9k|  free(dparams);
 3253|  12.9k|  free(offsets);
 3254|  12.9k|  if (schunk != NULL) {
  ------------------
  |  Branch (3254:7): [True: 12.9k, False: 0]
  ------------------
 3255|  12.9k|    blosc2_schunk_free(schunk);
 3256|  12.9k|  }
 3257|  12.9k|  if (!frame_attached) {
  ------------------
  |  Branch (3257:7): [True: 0, False: 12.9k]
  ------------------
 3258|      0|    frame->schunk = NULL;
 3259|      0|    frame_free(frame);
 3260|      0|  }
 3261|       |  return NULL;
 3262|    921|}
get_coffset:
 3284|  62.4k|                int64_t nchunk, int64_t nchunks, int64_t *offset) {
 3285|  62.4k|  int32_t off_cbytes;
 3286|       |  // Get the offset to nchunk
 3287|  62.4k|  uint8_t *coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &off_cbytes);
 3288|  62.4k|  if (coffsets == NULL) {
  ------------------
  |  Branch (3288:7): [True: 0, False: 62.4k]
  ------------------
 3289|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3290|      0|    return BLOSC2_ERROR_DATA;
 3291|      0|  }
 3292|       |
 3293|       |  // Get the 64-bit offset
 3294|  62.4k|  int rc = blosc2_getitem(coffsets, off_cbytes, (int32_t)nchunk, 1, offset, (int32_t)sizeof(int64_t));
 3295|  62.4k|  if (rc < 0) {
  ------------------
  |  Branch (3295:7): [True: 217, False: 62.2k]
  ------------------
 3296|    217|    BLOSC_TRACE_ERROR("Problems retrieving a chunk offset.");
  ------------------
  |  |   93|    217|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    217|    do {                                            \
  |  |  |  |   98|    217|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    217|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 217, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    217|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3297|  62.2k|  } else if (!frame->sframe && *offset >= 0) {
  ------------------
  |  Branch (3297:14): [True: 62.2k, False: 0]
  |  Branch (3297:32): [True: 48.6k, False: 13.6k]
  ------------------
 3298|  48.6k|    if (cbytes < 0 || cbytes > INT64_MAX - header_len) {
  ------------------
  |  Branch (3298:9): [True: 0, False: 48.6k]
  |  Branch (3298:23): [True: 218, False: 48.4k]
  ------------------
 3299|    218|      BLOSC_TRACE_ERROR("Invalid compressed size in frame header.");
  ------------------
  |  |   93|    218|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    218|    do {                                            \
  |  |  |  |   98|    218|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    218|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 218, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    218|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3300|    218|      return BLOSC2_ERROR_INVALID_HEADER;
 3301|    218|    }
 3302|  48.4k|    if (*offset > INT64_MAX - header_len) {
  ------------------
  |  Branch (3302:9): [True: 0, False: 48.4k]
  ------------------
 3303|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3304|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3305|      0|    }
 3306|  48.4k|    int64_t chunk_pos = header_len + *offset;
 3307|  48.4k|    int64_t data_limit = header_len + cbytes;
 3308|  48.4k|    if (chunk_pos < header_len ||
  ------------------
  |  Branch (3308:9): [True: 0, False: 48.4k]
  ------------------
 3309|  48.4k|        chunk_pos > data_limit - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3309:9): [True: 81, False: 48.3k]
  ------------------
 3310|  48.3k|        chunk_pos > frame->len - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3310:9): [True: 502, False: 47.8k]
  ------------------
 3311|    583|      BLOSC_TRACE_ERROR("Cannot read chunk %" PRId64 " outside of frame boundary.", nchunk);
  ------------------
  |  |   93|    583|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    583|    do {                                            \
  |  |  |  |   98|    583|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    583|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 583, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    583|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3312|    583|      return BLOSC2_ERROR_INVALID_HEADER;
 3313|    583|    }
 3314|  48.4k|  }
 3315|       |
 3316|  61.6k|  return rc;
 3317|  62.4k|}
frame_special_chunk:
 3322|  13.6k|                        uint8_t** chunk, int32_t cbytes, bool *needs_free) {
 3323|  13.6k|  int rc = 0;
 3324|  13.6k|  *chunk = malloc(cbytes);
 3325|  13.6k|  *needs_free = true;
 3326|       |
 3327|       |  // Detect the kind of special value
 3328|  13.6k|  uint64_t zeros_mask = (uint64_t) BLOSC2_SPECIAL_ZERO << (8 * 7);  // chunk of zeros
 3329|  13.6k|  uint64_t nans_mask = (uint64_t) BLOSC2_SPECIAL_NAN << (8 * 7);  // chunk of NaNs
 3330|  13.6k|  uint64_t uninit_mask = (uint64_t) BLOSC2_SPECIAL_UNINIT << (8 * 7);  // chunk of uninit values
 3331|       |
 3332|  13.6k|  blosc2_cparams cparams = BLOSC2_CPARAMS_DEFAULTS;
 3333|  13.6k|  cparams.typesize = typesize;
 3334|  13.6k|  cparams.blocksize = blocksize;
 3335|  13.6k|  if (special_value & zeros_mask) {
  ------------------
  |  Branch (3335:7): [True: 11.9k, False: 1.70k]
  ------------------
 3336|  11.9k|    rc = blosc2_chunk_zeros(cparams, nbytes, *chunk, cbytes);
 3337|  11.9k|    if (rc < 0) {
  ------------------
  |  Branch (3337:9): [True: 23, False: 11.9k]
  ------------------
 3338|     23|      BLOSC_TRACE_ERROR("Error creating a zero chunk");
  ------------------
  |  |   93|     23|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     23|    do {                                            \
  |  |  |  |   98|     23|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     23|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 23, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     23|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3339|     23|    }
 3340|  11.9k|  }
 3341|  1.70k|  else if (special_value & uninit_mask) {
  ------------------
  |  Branch (3341:12): [True: 1.06k, False: 639]
  ------------------
 3342|  1.06k|    rc = blosc2_chunk_uninit(cparams, nbytes, *chunk, cbytes);
 3343|  1.06k|    if (rc < 0) {
  ------------------
  |  Branch (3343:9): [True: 15, False: 1.04k]
  ------------------
 3344|     15|      BLOSC_TRACE_ERROR("Error creating a non initialized chunk");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3345|     15|    }
 3346|  1.06k|  }
 3347|    639|  else if (special_value & nans_mask) {
  ------------------
  |  Branch (3347:12): [True: 614, False: 25]
  ------------------
 3348|    614|    rc = blosc2_chunk_nans(cparams, nbytes, *chunk, cbytes);
 3349|    614|    if (rc < 0) {
  ------------------
  |  Branch (3349:9): [True: 3, False: 611]
  ------------------
 3350|      3|      BLOSC_TRACE_ERROR("Error creating a nan 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3351|      3|    }
 3352|    614|  }
 3353|     25|  else {
 3354|     25|    BLOSC_TRACE_ERROR("Special value not recognized: %" PRId64 "", special_value);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3355|     25|    rc = BLOSC2_ERROR_DATA;
 3356|     25|  }
 3357|       |
 3358|  13.6k|  if (rc < 0) {
  ------------------
  |  Branch (3358:7): [True: 66, False: 13.5k]
  ------------------
 3359|     66|    free(*chunk);
 3360|     66|    *needs_free = false;
 3361|     66|    *chunk = NULL;
 3362|     66|  }
 3363|       |
 3364|  13.6k|  return rc;
 3365|  13.6k|}
frame_get_chunk:
 3378|  60.7k|int frame_get_chunk(blosc2_frame_s *frame, int64_t nchunk, uint8_t **chunk, bool *needs_free) {
 3379|  60.7k|  int32_t header_len;
 3380|  60.7k|  int64_t frame_len;
 3381|  60.7k|  int64_t nbytes;
 3382|  60.7k|  int64_t cbytes;
 3383|  60.7k|  int32_t blocksize;
 3384|  60.7k|  int32_t chunksize;
 3385|  60.7k|  int64_t nchunks;
 3386|  60.7k|  int32_t typesize;
 3387|  60.7k|  int64_t offset;
 3388|  60.7k|  int32_t chunk_cbytes;
 3389|  60.7k|  int rc;
 3390|       |
 3391|  60.7k|  *chunk = NULL;
 3392|  60.7k|  *needs_free = false;
 3393|  60.7k|  rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 3394|  60.7k|                       &blocksize, &chunksize, &nchunks,
 3395|  60.7k|                       &typesize, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 3396|  60.7k|                       frame->schunk->storage->io);
 3397|  60.7k|  if (rc < 0) {
  ------------------
  |  Branch (3397:7): [True: 0, False: 60.7k]
  ------------------
 3398|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3399|      0|    return rc;
 3400|      0|  }
 3401|  60.7k|  rc = frame_refresh_if_stale(frame, frame_len);
 3402|  60.7k|  if (rc < 0) {
  ------------------
  |  Branch (3402:7): [True: 0, False: 60.7k]
  ------------------
 3403|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3404|      0|    return rc;
 3405|      0|  }
 3406|  60.7k|  if (rc > 0) {
  ------------------
  |  Branch (3406:7): [True: 0, False: 60.7k]
  ------------------
 3407|       |    // Keep the schunk-level counters in sync with the refreshed on-disk state.
 3408|       |    // Mutating ops (update/delete) read a chunk before adjusting the counters,
 3409|       |    // so this also gives them a fresh base to apply their deltas on.
 3410|      0|    frame->schunk->nbytes = nbytes;
 3411|      0|    frame->schunk->cbytes = cbytes;
 3412|      0|    frame->schunk->nchunks = nchunks;
 3413|      0|  }
 3414|       |
 3415|  60.7k|  if ((nchunks > 0) && (nchunk >= nchunks)) {
  ------------------
  |  Branch (3415:7): [True: 60.7k, False: 0]
  |  Branch (3415:24): [True: 0, False: 60.7k]
  ------------------
 3416|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3417|      0|                    "('%" PRId64 "') in frame.", nchunk, nchunks);
 3418|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 3419|      0|  }
 3420|       |
 3421|       |  // Get the offset to nchunk
 3422|  60.7k|  rc = get_coffset(frame, header_len, cbytes, nchunk, nchunks, &offset);
 3423|  60.7k|  if (rc < 0) {
  ------------------
  |  Branch (3423:7): [True: 186, False: 60.5k]
  ------------------
 3424|    186|    BLOSC_TRACE_ERROR("Unable to get offset to chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|    186|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    186|    do {                                            \
  |  |  |  |   98|    186|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    186|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 186, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    186|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3425|    186|    return rc;
 3426|    186|  }
 3427|       |
 3428|  60.5k|  if (offset < 0) {
  ------------------
  |  Branch (3428:7): [True: 13.1k, False: 47.3k]
  ------------------
 3429|       |    // Special value
 3430|  13.1k|    chunk_cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 3431|  13.1k|    int32_t chunksize_ = chunksize;
 3432|  13.1k|    if ((nchunk == nchunks - 1) && (nbytes % chunksize)) {
  ------------------
  |  Branch (3432:9): [True: 0, False: 13.1k]
  |  Branch (3432:36): [True: 0, False: 0]
  ------------------
 3433|       |      // Last chunk is incomplete.  Compute its actual size.
 3434|      0|      chunksize_ = (int32_t) (nbytes % chunksize);
 3435|      0|    }
 3436|  13.1k|    rc = frame_special_chunk(offset, chunksize_, typesize, blocksize, chunk, chunk_cbytes, needs_free);
 3437|  13.1k|    if (rc < 0) {
  ------------------
  |  Branch (3437:9): [True: 17, False: 13.1k]
  ------------------
 3438|     17|      return rc;
 3439|     17|    }
 3440|  13.1k|    goto end;
 3441|  13.1k|  }
 3442|       |
 3443|  47.3k|  if (frame->sframe) {
  ------------------
  |  Branch (3443:7): [True: 0, False: 47.3k]
  ------------------
 3444|       |    // Sparse on-disk
 3445|      0|    nchunk = offset;
 3446|      0|    return sframe_get_chunk(frame, nchunk, chunk, needs_free);
 3447|      0|  }
 3448|       |
 3449|  47.3k|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 3450|  47.3k|  if (io_cb == NULL) {
  ------------------
  |  Branch (3450:7): [True: 0, False: 47.3k]
  ------------------
 3451|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3452|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 3453|      0|  }
 3454|       |
 3455|  47.3k|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3455:7): [True: 0, False: 47.3k]
  ------------------
 3456|      0|    uint8_t* header_ptr;
 3457|      0|    uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 3458|      0|    void* fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 3459|      0|    if (fp == NULL) {
  ------------------
  |  Branch (3459:9): [True: 0, False: 0]
  ------------------
 3460|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3461|      0|      return BLOSC2_ERROR_FILE_OPEN;
 3462|      0|    }
 3463|      0|    if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (3463:9): [True: 0, False: 0]
  ------------------
 3464|      0|      header_ptr = header;
 3465|      0|    int64_t io_pos = frame->file_offset + header_len + offset;
 3466|      0|    int64_t rbytes = io_cb->read((void**)&header_ptr, 1, sizeof(header), io_pos, fp);
 3467|      0|    if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3467:9): [True: 0, False: 0]
  ------------------
 3468|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3469|      0|      frame_reader_release(frame, io_cb, fp);
 3470|      0|      return BLOSC2_ERROR_FILE_READ;
 3471|      0|    }
 3472|      0|    rc = blosc2_cbuffer_sizes(header_ptr, NULL, &chunk_cbytes, NULL);
 3473|      0|    if (rc < 0) {
  ------------------
  |  Branch (3473:9): [True: 0, False: 0]
  ------------------
 3474|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3475|      0|      frame_reader_release(frame, io_cb, fp);
 3476|      0|      return rc;
 3477|      0|    }
 3478|      0|    if (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3478:9): [True: 0, False: 0]
  ------------------
 3479|      0|        offset > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (3479:9): [True: 0, False: 0]
  ------------------
 3480|      0|        offset + chunk_cbytes > cbytes) {
  ------------------
  |  Branch (3480:9): [True: 0, False: 0]
  ------------------
 3481|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3482|      0|      frame_reader_release(frame, io_cb, fp);
 3483|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3484|      0|    }
 3485|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (3485:9): [True: 0, False: 0]
  ------------------
 3486|      0|      *chunk = malloc(chunk_cbytes);
 3487|      0|      *needs_free = true;
 3488|      0|    }
 3489|      0|    else {
 3490|      0|      *needs_free = false;
 3491|      0|    }
 3492|       |
 3493|      0|    io_pos = frame->file_offset + header_len + offset;
 3494|      0|    rbytes = io_cb->read((void**)chunk, 1, chunk_cbytes, io_pos, fp);
 3495|      0|    frame_reader_release(frame, io_cb, fp);
 3496|      0|    if (rbytes != chunk_cbytes) {
  ------------------
  |  Branch (3496:9): [True: 0, False: 0]
  ------------------
 3497|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3498|      0|      return BLOSC2_ERROR_FILE_READ;
 3499|      0|    }
 3500|       |
 3501|  47.3k|  } else {
 3502|       |    // The chunk is in memory and just one pointer away
 3503|  47.3k|    *chunk = frame->cframe + header_len + offset;
 3504|  47.3k|    rc = blosc2_cbuffer_sizes(*chunk, NULL, &chunk_cbytes, NULL);
 3505|  47.3k|    if (rc < 0) {
  ------------------
  |  Branch (3505:9): [True: 7, False: 47.3k]
  ------------------
 3506|      7|      return rc;
 3507|      7|    }
 3508|  47.3k|    if (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3508:9): [True: 1, False: 47.3k]
  ------------------
 3509|  47.3k|        offset > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (3509:9): [True: 0, False: 47.3k]
  ------------------
 3510|  47.3k|        offset + chunk_cbytes > cbytes) {
  ------------------
  |  Branch (3510:9): [True: 45, False: 47.3k]
  ------------------
 3511|     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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3512|     46|      return BLOSC2_ERROR_INVALID_HEADER;
 3513|     46|    }
 3514|  47.3k|  }
 3515|       |
 3516|  60.4k|  end:
 3517|  60.4k|  return (int32_t)chunk_cbytes;
 3518|  47.3k|}
frame_get_lazychunk:
 3531|  1.73k|int frame_get_lazychunk(blosc2_frame_s *frame, int64_t nchunk, uint8_t **chunk, bool *needs_free) {
 3532|  1.73k|  int32_t header_len;
 3533|  1.73k|  int64_t frame_len;
 3534|  1.73k|  int64_t nbytes;
 3535|  1.73k|  int64_t cbytes;
 3536|  1.73k|  int32_t blocksize;
 3537|  1.73k|  int32_t chunksize;
 3538|  1.73k|  int64_t nchunks;
 3539|  1.73k|  int32_t typesize;
 3540|  1.73k|  int32_t lazychunk_cbytes;
 3541|  1.73k|  int64_t offset;
 3542|  1.73k|  void* fp = NULL;
 3543|  1.73k|  int32_t* block_csizes = NULL;
 3544|  1.73k|  struct csize_idx *csize_idx = NULL;
 3545|       |
 3546|  1.73k|  *chunk = NULL;
 3547|  1.73k|  *needs_free = false;
 3548|  1.73k|  int rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 3549|  1.73k|                           &blocksize, &chunksize, &nchunks,
 3550|  1.73k|                           &typesize, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 3551|  1.73k|                           frame->schunk->storage->io);
 3552|  1.73k|  if (rc < 0) {
  ------------------
  |  Branch (3552:7): [True: 0, False: 1.73k]
  ------------------
 3553|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3554|      0|    return rc;
 3555|      0|  }
 3556|  1.73k|  rc = frame_refresh_if_stale(frame, frame_len);
 3557|  1.73k|  if (rc < 0) {
  ------------------
  |  Branch (3557:7): [True: 0, False: 1.73k]
  ------------------
 3558|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3559|      0|    return rc;
 3560|      0|  }
 3561|  1.73k|  if (rc > 0) {
  ------------------
  |  Branch (3561:7): [True: 0, False: 1.73k]
  ------------------
 3562|       |    // Keep the schunk-level counters in sync with the refreshed on-disk state
 3563|       |    // (see frame_get_chunk).
 3564|      0|    frame->schunk->nbytes = nbytes;
 3565|      0|    frame->schunk->cbytes = cbytes;
 3566|      0|    frame->schunk->nchunks = nchunks;
 3567|      0|  }
 3568|       |
 3569|  1.73k|  if (nchunk >= nchunks) {
  ------------------
  |  Branch (3569:7): [True: 0, False: 1.73k]
  ------------------
 3570|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3571|      0|                      "('%" PRId64 "') in frame.", nchunk, nchunks);
 3572|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 3573|      0|  }
 3574|       |
 3575|       |  // Get the offset to nchunk
 3576|  1.73k|  rc = get_coffset(frame, header_len, cbytes, nchunk, nchunks, &offset);
 3577|  1.73k|  if (rc < 0) {
  ------------------
  |  Branch (3577:7): [True: 832, False: 905]
  ------------------
 3578|    832|    BLOSC_TRACE_ERROR("Unable to get offset to chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|    832|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    832|    do {                                            \
  |  |  |  |   98|    832|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    832|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 832, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    832|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3579|    832|    return rc;
 3580|    832|  }
 3581|       |
 3582|    905|  if (offset < 0) {
  ------------------
  |  Branch (3582:7): [True: 459, False: 446]
  ------------------
 3583|       |    // Special value
 3584|    459|    lazychunk_cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 3585|    459|    int32_t chunksize_ = chunksize;
 3586|    459|    if ((nchunk == nchunks - 1) && (nbytes % chunksize)) {
  ------------------
  |  Branch (3586:9): [True: 6, False: 453]
  |  Branch (3586:36): [True: 6, False: 0]
  ------------------
 3587|       |      // Last chunk is incomplete.  Compute its actual size.
 3588|      6|      chunksize_ = (int32_t) (nbytes % chunksize);
 3589|      6|    }
 3590|    459|    rc = frame_special_chunk(offset, chunksize_, typesize, blocksize, chunk,
 3591|    459|                             (int32_t)lazychunk_cbytes, needs_free);
 3592|    459|    goto end;
 3593|    459|  }
 3594|       |
 3595|    446|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 3596|    446|  if (io_cb == NULL) {
  ------------------
  |  Branch (3596:7): [True: 0, False: 446]
  ------------------
 3597|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3598|      0|    rc = BLOSC2_ERROR_PLUGIN_IO;
 3599|      0|    goto end;
 3600|      0|  }
 3601|       |
 3602|    446|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3602:7): [True: 0, False: 446]
  ------------------
 3603|       |    // TODO: make this portable across different endianness
 3604|       |    // Get info for building a lazy chunk
 3605|      0|    int32_t chunk_nbytes;
 3606|      0|    int32_t chunk_cbytes;
 3607|      0|    int32_t chunk_blocksize;
 3608|      0|    uint8_t* header_ptr;
 3609|      0|    uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 3610|      0|    int64_t io_pos = 0;
 3611|      0|    if (frame->sframe) {
  ------------------
  |  Branch (3611:9): [True: 0, False: 0]
  ------------------
 3612|       |      // The chunk is not in the frame
 3613|      0|      fp = sframe_open_chunk(frame->urlpath, offset, "rb",
 3614|      0|                             frame->schunk->storage->io);
 3615|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3615:11): [True: 0, False: 0]
  ------------------
 3616|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3617|      0|        return BLOSC2_ERROR_FILE_OPEN;
 3618|      0|      }
 3619|      0|    }
 3620|      0|    else {
 3621|      0|      fp = frame_reader_acquire(frame, 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|      io_pos = frame->file_offset + header_len + offset;
 3627|      0|    }
 3628|      0|    if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (3628:9): [True: 0, False: 0]
  ------------------
 3629|      0|      header_ptr = header;
 3630|      0|    int64_t rbytes = io_cb->read((void**)&header_ptr, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, fp);
 3631|      0|    if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3631:9): [True: 0, False: 0]
  ------------------
 3632|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3633|      0|      rc = BLOSC2_ERROR_FILE_READ;
 3634|      0|      goto end;
 3635|      0|    }
 3636|      0|    rc = blosc2_cbuffer_sizes(header_ptr, &chunk_nbytes, &chunk_cbytes, &chunk_blocksize);
 3637|      0|    if (rc < 0) {
  ------------------
  |  Branch (3637:9): [True: 0, False: 0]
  ------------------
 3638|      0|      goto end;
 3639|      0|    }
 3640|      0|    if (chunk_nbytes < 0 || chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH || chunk_blocksize <= 0) {
  ------------------
  |  Branch (3640:9): [True: 0, False: 0]
  |  Branch (3640:29): [True: 0, False: 0]
  |  Branch (3640:76): [True: 0, False: 0]
  ------------------
 3641|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 3642|      0|      goto end;
 3643|      0|    }
 3644|      0|    bool vlblocks = (header_ptr[BLOSC2_CHUNK_BLOSC2_FLAGS2] & BLOSC2_VL_BLOCKS) != 0;
 3645|      0|    size_t nblocks;
 3646|      0|    size_t leftover_block = 0;
 3647|      0|    if (vlblocks) {
  ------------------
  |  Branch (3647:9): [True: 0, False: 0]
  ------------------
 3648|      0|      nblocks = (size_t)chunk_blocksize;
 3649|      0|    }
 3650|      0|    else {
 3651|      0|      nblocks = (size_t)chunk_nbytes / (size_t)chunk_blocksize;
 3652|      0|      leftover_block = (size_t)chunk_nbytes % (size_t)chunk_blocksize;
 3653|      0|      if (leftover_block) {
  ------------------
  |  Branch (3653:11): [True: 0, False: 0]
  ------------------
 3654|      0|        if (nblocks == SIZE_MAX) {
  ------------------
  |  Branch (3654:13): [True: 0, False: 0]
  ------------------
 3655|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 3656|      0|          goto end;
 3657|      0|        }
 3658|      0|        nblocks += 1;
 3659|      0|      }
 3660|      0|    }
 3661|      0|    if (nblocks == 0 || nblocks > (size_t)INT_MAX) {
  ------------------
  |  Branch (3661:9): [True: 0, False: 0]
  |  Branch (3661:25): [True: 0, False: 0]
  ------------------
 3662|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 3663|      0|      goto end;
 3664|      0|    }
 3665|       |    // Allocate space for the lazy chunk
 3666|      0|    int32_t special_type = (header_ptr[BLOSC2_CHUNK_BLOSC2_FLAGS] >> 4) & BLOSC2_SPECIAL_MASK;
 3667|      0|    int memcpyed = header_ptr[BLOSC2_CHUNK_FLAGS] & (uint8_t) BLOSC_MEMCPYED;
 3668|       |
 3669|      0|    int32_t trailer_offset;
 3670|      0|    size_t streams_offset = BLOSC_EXTENDED_HEADER_LENGTH;
 3671|      0|    size_t trailer_offset_sz = BLOSC_EXTENDED_HEADER_LENGTH;
 3672|      0|    size_t trailer_len_sz = 0;
 3673|      0|    size_t lazychunk_cbytes_sz = 0;
 3674|      0|    size_t bstarts_nbytes = 0;
 3675|      0|    if (special_type == 0) {
  ------------------
  |  Branch (3675:9): [True: 0, False: 0]
  ------------------
 3676|      0|      if (nblocks > SIZE_MAX / sizeof(int32_t)) {
  ------------------
  |  Branch (3676:11): [True: 0, False: 0]
  ------------------
 3677|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3678|      0|        goto end;
 3679|      0|      }
 3680|      0|      bstarts_nbytes = nblocks * sizeof(int32_t);
 3681|       |
 3682|      0|      if (!memcpyed) {
  ------------------
  |  Branch (3682:11): [True: 0, False: 0]
  ------------------
 3683|      0|        if ((size_t)chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3683:13): [True: 0, False: 0]
  ------------------
 3684|      0|            bstarts_nbytes > (size_t)chunk_cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3684:13): [True: 0, False: 0]
  ------------------
 3685|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 3686|      0|          goto end;
 3687|      0|        }
 3688|      0|      }
 3689|       |
 3690|      0|      if (bstarts_nbytes > SIZE_MAX - trailer_offset_sz) {
  ------------------
  |  Branch (3690:11): [True: 0, False: 0]
  ------------------
 3691|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3692|      0|        goto end;
 3693|      0|      }
 3694|      0|      trailer_offset_sz += bstarts_nbytes;
 3695|       |      // Regular values have offsets for blocks
 3696|      0|      if (!memcpyed) {
  ------------------
  |  Branch (3696:11): [True: 0, False: 0]
  ------------------
 3697|      0|        if (bstarts_nbytes > SIZE_MAX - streams_offset) {
  ------------------
  |  Branch (3697:13): [True: 0, False: 0]
  ------------------
 3698|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 3699|      0|          goto end;
 3700|      0|        }
 3701|      0|        streams_offset += bstarts_nbytes;
 3702|      0|      }
 3703|       |
 3704|      0|      if (bstarts_nbytes > SIZE_MAX - (sizeof(int32_t) + sizeof(int64_t))) {
  ------------------
  |  Branch (3704:11): [True: 0, False: 0]
  ------------------
 3705|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3706|      0|        goto end;
 3707|      0|      }
 3708|      0|      trailer_len_sz = sizeof(int32_t) + sizeof(int64_t) + bstarts_nbytes;
 3709|      0|      if (trailer_len_sz > SIZE_MAX - trailer_offset_sz) {
  ------------------
  |  Branch (3709:11): [True: 0, False: 0]
  ------------------
 3710|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3711|      0|        goto end;
 3712|      0|      }
 3713|      0|      lazychunk_cbytes_sz = trailer_offset_sz + trailer_len_sz;
 3714|      0|    }
 3715|      0|    else if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (3715:14): [True: 0, False: 0]
  ------------------
 3716|      0|      if (typesize <= 0) {
  ------------------
  |  Branch (3716:11): [True: 0, False: 0]
  ------------------
 3717|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3718|      0|        goto end;
 3719|      0|      }
 3720|      0|      if ((size_t)typesize > SIZE_MAX - trailer_offset_sz ||
  ------------------
  |  Branch (3720:11): [True: 0, False: 0]
  ------------------
 3721|      0|          (size_t)typesize > SIZE_MAX - streams_offset) {
  ------------------
  |  Branch (3721:11): [True: 0, False: 0]
  ------------------
 3722|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3723|      0|        goto end;
 3724|      0|      }
 3725|      0|      trailer_offset_sz += (size_t)typesize;
 3726|      0|      streams_offset += (size_t)typesize;
 3727|      0|      lazychunk_cbytes_sz = trailer_offset_sz;
 3728|      0|    }
 3729|      0|    else {
 3730|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 3731|      0|      goto end;
 3732|      0|    }
 3733|       |
 3734|      0|    if (streams_offset > (size_t)chunk_cbytes ||
  ------------------
  |  Branch (3734:9): [True: 0, False: 0]
  ------------------
 3735|      0|        trailer_offset_sz > INT32_MAX ||
  ------------------
  |  Branch (3735:9): [True: 0, False: 0]
  ------------------
 3736|      0|        trailer_len_sz > INT32_MAX ||
  ------------------
  |  Branch (3736:9): [True: 0, False: 0]
  ------------------
 3737|      0|        lazychunk_cbytes_sz > INT32_MAX) {
  ------------------
  |  Branch (3737:9): [True: 0, False: 0]
  ------------------
 3738|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 3739|      0|      goto end;
 3740|      0|    }
 3741|       |
 3742|      0|    trailer_offset = (int32_t)trailer_offset_sz;
 3743|      0|    lazychunk_cbytes = (int32_t)lazychunk_cbytes_sz;
 3744|       |
 3745|       |    // Read just the full header and bstarts section too (lazy partial length)
 3746|      0|    if (frame->sframe) {
  ------------------
  |  Branch (3746:9): [True: 0, False: 0]
  ------------------
 3747|      0|      io_pos = 0;
 3748|      0|    }
 3749|      0|    else {
 3750|      0|      io_pos = frame->file_offset + header_len + offset;
 3751|      0|    }
 3752|       |
 3753|       |    // The case here is a bit special because more memory is allocated than read from the file
 3754|       |    // and the chunk is modified after reading. Due to the modification, we cannot directly use
 3755|       |    // the memory provided by the io
 3756|      0|    *chunk = malloc((size_t)lazychunk_cbytes);
 3757|      0|    if (*chunk == NULL) {
  ------------------
  |  Branch (3757:9): [True: 0, False: 0]
  ------------------
 3758|      0|      rc = BLOSC2_ERROR_MEMORY_ALLOC;
 3759|      0|      goto end;
 3760|      0|    }
 3761|      0|    *needs_free = true;
 3762|       |
 3763|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (3763:9): [True: 0, False: 0]
  ------------------
 3764|      0|      rbytes = io_cb->read((void**)chunk, 1, (int64_t)streams_offset, io_pos, fp);
 3765|      0|    }
 3766|      0|    else {
 3767|      0|      uint8_t* chunk_ptr;
 3768|      0|      rbytes = io_cb->read((void**)&chunk_ptr, 1, (int64_t)streams_offset, io_pos, fp);
 3769|      0|      memcpy(*chunk, chunk_ptr, streams_offset);
 3770|      0|    }
 3771|       |
 3772|      0|    if (rbytes != (int64_t)streams_offset) {
  ------------------
  |  Branch (3772:9): [True: 0, False: 0]
  ------------------
 3773|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3774|      0|      rc = BLOSC2_ERROR_FILE_READ;
 3775|      0|      goto end;
 3776|      0|    }
 3777|      0|    if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (3777:9): [True: 0, False: 0]
  ------------------
 3778|       |      // Value runlen is not returning a lazy chunk.  We are done.
 3779|      0|      goto end;
 3780|      0|    }
 3781|       |
 3782|       |    // Mark chunk as lazy
 3783|      0|    uint8_t* blosc2_flags = *chunk + BLOSC2_CHUNK_BLOSC2_FLAGS;
 3784|      0|    *blosc2_flags |= 0x08U;
 3785|       |
 3786|       |    // Add the trailer (currently, nchunk + offset + block_csizes)
 3787|      0|    if (frame->sframe) {
  ------------------
  |  Branch (3787:9): [True: 0, False: 0]
  ------------------
 3788|      0|      *(int32_t*)(*chunk + trailer_offset) = (int32_t)offset;   // offset is nchunk for sframes
 3789|      0|      *(int64_t*)(*chunk + trailer_offset + sizeof(int32_t)) = offset;
 3790|      0|    }
 3791|      0|    else {
 3792|      0|      *(int32_t*)(*chunk + trailer_offset) = (int32_t)nchunk;
 3793|      0|      *(int64_t*)(*chunk + trailer_offset + sizeof(int32_t)) = header_len + offset;
 3794|      0|    }
 3795|       |
 3796|      0|    block_csizes = malloc(nblocks * sizeof(int32_t));
 3797|      0|    if (block_csizes == NULL) {
  ------------------
  |  Branch (3797:9): [True: 0, False: 0]
  ------------------
 3798|      0|      rc = BLOSC2_ERROR_MEMORY_ALLOC;
 3799|      0|      goto end;
 3800|      0|    }
 3801|       |
 3802|      0|    if (memcpyed) {
  ------------------
  |  Branch (3802:9): [True: 0, False: 0]
  ------------------
 3803|       |      // When memcpyed the blocksizes are trivial to compute
 3804|      0|      for (size_t i = 0; i + 1 < nblocks; i++) {
  ------------------
  |  Branch (3804:26): [True: 0, False: 0]
  ------------------
 3805|      0|        block_csizes[i] = (int)chunk_blocksize;
 3806|      0|      }
 3807|       |      // The last block could be incomplete, mainly due to the fact that the block size is not divisible
 3808|       |      // by the typesize
 3809|      0|      block_csizes[nblocks - 1] = (int32_t)leftover_block ? (int32_t)leftover_block : chunk_blocksize;
  ------------------
  |  Branch (3809:35): [True: 0, False: 0]
  ------------------
 3810|      0|    }
 3811|      0|    else {
 3812|       |      // In regular, compressed chunks, we need to sort the bstarts (they can be out
 3813|       |      // of order because of multi-threading), and get a reverse index too.
 3814|      0|      memcpy(block_csizes, *chunk + BLOSC_EXTENDED_HEADER_LENGTH, nblocks * sizeof(int32_t));
 3815|       |      // Helper structure to keep track of original indexes
 3816|      0|      csize_idx = malloc(nblocks * sizeof(struct csize_idx));
 3817|      0|      if (csize_idx == NULL) {
  ------------------
  |  Branch (3817:11): [True: 0, False: 0]
  ------------------
 3818|      0|        rc = BLOSC2_ERROR_MEMORY_ALLOC;
 3819|      0|        goto end;
 3820|      0|      }
 3821|      0|      for (size_t n = 0; n < nblocks; n++) {
  ------------------
  |  Branch (3821:26): [True: 0, False: 0]
  ------------------
 3822|      0|        csize_idx[n].val = block_csizes[n];
 3823|      0|        csize_idx[n].idx = (int)n;
 3824|      0|      }
 3825|      0|      qsort(csize_idx, nblocks, sizeof(struct csize_idx), &sort_offset);
 3826|       |      // Compute the actual csizes
 3827|      0|      int idx;
 3828|      0|      for (size_t n = 0; n + 1 < nblocks; n++) {
  ------------------
  |  Branch (3828:26): [True: 0, False: 0]
  ------------------
 3829|      0|        idx = csize_idx[n].idx;
 3830|      0|        block_csizes[idx] = csize_idx[n + 1].val - csize_idx[n].val;
 3831|      0|      }
 3832|      0|      idx = csize_idx[nblocks - 1].idx;
 3833|      0|      block_csizes[idx] = chunk_cbytes - csize_idx[nblocks - 1].val;
 3834|      0|      free(csize_idx);
 3835|      0|      csize_idx = NULL;
 3836|      0|    }
 3837|       |    // Copy the csizes at the end of the trailer
 3838|      0|    void *trailer_csizes = *chunk + lazychunk_cbytes - nblocks * sizeof(int32_t);
 3839|      0|    memcpy(trailer_csizes, block_csizes, nblocks * sizeof(int32_t));
 3840|      0|    free(block_csizes);
 3841|      0|    block_csizes = NULL;
 3842|    446|  } else {
 3843|       |    // The chunk is in memory and just one pointer away
 3844|    446|    int64_t chunk_header_offset = header_len + offset;
 3845|    446|    int64_t chunk_cbytes_offset = chunk_header_offset + BLOSC_MIN_HEADER_LENGTH;
 3846|       |
 3847|    446|    *chunk = frame->cframe + chunk_header_offset;
 3848|       |
 3849|    446|    if (chunk_header_offset < 0 ||
  ------------------
  |  Branch (3849:9): [True: 0, False: 446]
  ------------------
 3850|    446|        chunk_cbytes_offset < chunk_header_offset ||
  ------------------
  |  Branch (3850:9): [True: 0, False: 446]
  ------------------
 3851|    446|        chunk_cbytes_offset > frame->len) {
  ------------------
  |  Branch (3851:9): [True: 0, False: 446]
  ------------------
 3852|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3853|      0|      rc = BLOSC2_ERROR_READ_BUFFER;
 3854|    446|    } else {
 3855|    446|      rc = blosc2_cbuffer_sizes(*chunk, NULL, &lazychunk_cbytes, NULL);
 3856|    446|      if (rc < 0) {
  ------------------
  |  Branch (3856:11): [True: 0, False: 446]
  ------------------
 3857|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3858|      0|        rc = BLOSC2_ERROR_READ_BUFFER;
 3859|      0|      }
 3860|    446|      else if (lazychunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3860:16): [True: 1, False: 445]
  ------------------
 3861|    445|               chunk_header_offset > INT64_MAX - lazychunk_cbytes ||
  ------------------
  |  Branch (3861:16): [True: 0, False: 445]
  ------------------
 3862|    445|               chunk_header_offset + lazychunk_cbytes > frame_len) {
  ------------------
  |  Branch (3862:16): [True: 28, False: 417]
  ------------------
 3863|     29|        BLOSC_TRACE_ERROR("Compressed bytes exceed beyond frame length.");
  ------------------
  |  |   93|     29|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     29|    do {                                            \
  |  |  |  |   98|     29|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     29|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 29, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     29|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3864|     29|        rc = BLOSC2_ERROR_READ_BUFFER;
 3865|     29|      }
 3866|    446|    }
 3867|    446|  }
 3868|       |
 3869|    905|  end:
 3870|    905|  if (csize_idx != NULL) {
  ------------------
  |  Branch (3870:7): [True: 0, False: 905]
  ------------------
 3871|      0|    free(csize_idx);
 3872|      0|  }
 3873|    905|  if (block_csizes != NULL) {
  ------------------
  |  Branch (3873:7): [True: 0, False: 905]
  ------------------
 3874|      0|    free(block_csizes);
 3875|      0|  }
 3876|    905|  if (fp != NULL) {
  ------------------
  |  Branch (3876:7): [True: 0, False: 905]
  ------------------
 3877|      0|    frame_reader_release(frame, io_cb, fp);
 3878|      0|  }
 3879|    905|  if (rc < 0) {
  ------------------
  |  Branch (3879:7): [True: 78, False: 827]
  ------------------
 3880|     78|    if (*needs_free) {
  ------------------
  |  Branch (3880:9): [True: 0, False: 78]
  ------------------
 3881|      0|      free(*chunk);
 3882|      0|      *chunk = NULL;
 3883|      0|      *needs_free = false;
 3884|      0|    }
 3885|     78|    return rc;
 3886|     78|  }
 3887|       |
 3888|    827|  return (int)lazychunk_cbytes;
 3889|    905|}
frame_decompress_chunk:
 5248|  60.7k|int frame_decompress_chunk(blosc2_context *dctx, blosc2_frame_s* frame, int64_t nchunk, void *dest, int32_t nbytes) {
 5249|  60.7k|  uint8_t* src;
 5250|  60.7k|  bool needs_free;
 5251|  60.7k|  int32_t chunk_nbytes;
 5252|  60.7k|  int32_t chunk_cbytes;
 5253|  60.7k|  int rc;
 5254|       |
 5255|  60.7k|  rc = frame_get_chunk(frame, nchunk, &src, &needs_free);
 5256|  60.7k|  if (rc < 0) {
  ------------------
  |  Branch (5256:7): [True: 256, False: 60.4k]
  ------------------
 5257|    256|    BLOSC_TRACE_ERROR("Cannot get the chunk in position %" PRId64 ".", nchunk);
  ------------------
  |  |   93|    256|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    256|    do {                                            \
  |  |  |  |   98|    256|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    256|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 256, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    256|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5258|    256|    goto end;
 5259|    256|  }
 5260|  60.4k|  chunk_cbytes = rc;
 5261|  60.4k|  if (chunk_cbytes < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (5261:7): [True: 0, False: 60.4k]
  ------------------
 5262|       |    /* Not enough input to read `nbytes` */
 5263|      0|    rc = BLOSC2_ERROR_READ_BUFFER;
 5264|      0|  }
 5265|       |
 5266|  60.4k|  rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 5267|  60.4k|  if (rc < 0) {
  ------------------
  |  Branch (5267:7): [True: 15, False: 60.4k]
  ------------------
 5268|     15|    goto end;
 5269|     15|  }
 5270|       |
 5271|       |  /* Create a buffer for destination */
 5272|  60.4k|  if (chunk_nbytes > nbytes) {
  ------------------
  |  Branch (5272:7): [True: 34, False: 60.4k]
  ------------------
 5273|     34|    BLOSC_TRACE_ERROR("Not enough space for decompressing in dest.");
  ------------------
  |  |   93|     34|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     34|    do {                                            \
  |  |  |  |   98|     34|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     34|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 34, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     34|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5274|     34|    rc = BLOSC2_ERROR_WRITE_BUFFER;
 5275|     34|    goto end;
 5276|     34|  }
 5277|       |  /* And decompress it */
 5278|  60.4k|  dctx->header_overhead = BLOSC_EXTENDED_HEADER_LENGTH;
 5279|  60.4k|  int chunksize = rc = blosc2_decompress_ctx(dctx, src, chunk_cbytes, dest, nbytes);
 5280|  60.4k|  if (chunksize < 0 || chunksize != chunk_nbytes) {
  ------------------
  |  Branch (5280:7): [True: 181, False: 60.2k]
  |  Branch (5280:24): [True: 27, False: 60.2k]
  ------------------
 5281|    208|    BLOSC_TRACE_ERROR("Error in decompressing chunk.");
  ------------------
  |  |   93|    208|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    208|    do {                                            \
  |  |  |  |   98|    208|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    208|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 208, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    208|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5282|    208|    if (chunksize >= 0)
  ------------------
  |  Branch (5282:9): [True: 27, False: 181]
  ------------------
 5283|     27|      rc = BLOSC2_ERROR_FAILURE;
 5284|    208|  }
 5285|  60.7k|  end:
 5286|  60.7k|  if (needs_free) {
  ------------------
  |  Branch (5286:7): [True: 13.1k, False: 47.5k]
  ------------------
 5287|  13.1k|    free(src);
 5288|  13.1k|  }
 5289|  60.7k|  return rc;
 5290|  60.4k|}
frame.c:reader_cache_claim:
  125|     20|static bool reader_cache_claim(void) {
  126|     20|  bool claimed = false;
  127|     20|  blosc2_pthread_mutex_lock(&reader_cache_mutex);
  ------------------
  |  |   92|     20|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  128|     20|  if (reader_cache_count < reader_cache_max()) {
  ------------------
  |  Branch (128:7): [True: 20, False: 0]
  ------------------
  129|     20|    reader_cache_count++;
  130|     20|    claimed = true;
  131|     20|  }
  132|     20|  blosc2_pthread_mutex_unlock(&reader_cache_mutex);
  ------------------
  |  |   93|     20|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  133|     20|  return claimed;
  134|     20|}
frame.c:reader_cache_max:
   97|     20|static int reader_cache_max(void) {
   98|     20|  static int cached_max = -1;
   99|     20|  if (cached_max >= 0) {
  ------------------
  |  Branch (99:7): [True: 19, False: 1]
  ------------------
  100|     19|    return cached_max;
  101|     19|  }
  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|     20|static void reader_cache_return(void) {
  137|     20|  blosc2_pthread_mutex_lock(&reader_cache_mutex);
  ------------------
  |  |   92|     20|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  138|     20|  if (reader_cache_count > 0) {
  ------------------
  |  Branch (138:7): [True: 20, False: 0]
  ------------------
  139|     20|    reader_cache_count--;
  140|     20|  }
  141|     20|  blosc2_pthread_mutex_unlock(&reader_cache_mutex);
  ------------------
  |  |   93|     20|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  142|     20|}
frame.c:frame_reader_close_locked:
  238|  13.6k|static bool frame_reader_close_locked(blosc2_frame_s* frame, bool force) {
  239|  13.6k|  if (frame->read_fp == NULL) {
  ------------------
  |  Branch (239:7): [True: 13.6k, False: 0]
  ------------------
  240|  13.6k|    return true;
  241|  13.6k|  }
  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|  13.7k|static blosc2_frame_s* frame_alloc(void) {
  148|  13.7k|  blosc2_frame_s* frame = calloc(1, sizeof(blosc2_frame_s));
  149|  13.7k|  if (frame != NULL) {
  ------------------
  |  Branch (149:7): [True: 13.7k, False: 0]
  ------------------
  150|  13.7k|    blosc2_pthread_mutex_init(&frame->read_fp_mutex, NULL);
  ------------------
  |  |   90|  13.7k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
  151|  13.7k|  }
  152|  13.7k|  return frame;
  153|  13.7k|}
frame.c:frame_refresh_if_stale:
 1092|  62.4k|static int frame_refresh_if_stale(blosc2_frame_s *frame, int64_t frame_len_on_disk) {
 1093|  62.4k|  if (frame->cframe != NULL || frame->schunk == NULL ||
  ------------------
  |  Branch (1093:7): [True: 62.4k, False: 0]
  |  Branch (1093:32): [True: 0, False: 0]
  ------------------
 1094|  62.4k|      (!frame->force_refresh && frame_len_on_disk == frame->len)) {
  ------------------
  |  Branch (1094:8): [True: 0, False: 0]
  |  Branch (1094:33): [True: 0, False: 0]
  ------------------
 1095|  62.4k|    return 0;
 1096|  62.4k|  }
 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|  18.7k|                               int32_t *coffsets_nbytes, const blosc2_io *io) {
 1302|  18.7k|  int32_t chunk_cbytes;
 1303|  18.7k|  int rc;
 1304|  18.7k|  int64_t off_pos = header_len;
 1305|  18.7k|  if (!frame->sframe) {
  ------------------
  |  Branch (1305:7): [True: 18.7k, False: 0]
  ------------------
 1306|  18.7k|    if (cbytes < INT64_MAX - header_len) {
  ------------------
  |  Branch (1306:9): [True: 1.03k, False: 17.6k]
  ------------------
 1307|  1.03k|      off_pos += cbytes;
 1308|  1.03k|    }
 1309|  18.7k|  }
 1310|       |
 1311|  18.7k|  if (off_pos < 0 || off_pos > INT64_MAX - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (1311:7): [True: 121, False: 18.5k]
  |  Branch (1311:22): [True: 2, False: 18.5k]
  ------------------
 1312|  18.5k|      off_pos + BLOSC_EXTENDED_HEADER_LENGTH > frame->len) {
  ------------------
  |  Branch (1312:7): [True: 157, False: 18.4k]
  ------------------
 1313|    280|    BLOSC_TRACE_ERROR("Cannot read the offsets outside of frame boundary.");
  ------------------
  |  |   93|    280|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    280|    do {                                            \
  |  |  |  |   98|    280|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    280|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 280, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    280|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1314|    280|    return BLOSC2_ERROR_INVALID_HEADER;
 1315|    280|  }
 1316|       |
 1317|  18.4k|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (1317:7): [True: 18.4k, False: 0]
  ------------------
 1318|  18.4k|    uint8_t *off_start = frame->cframe + off_pos;
 1319|  18.4k|    rc = blosc2_cbuffer_sizes(off_start, coffsets_nbytes, &chunk_cbytes, NULL);
 1320|  18.4k|    if (rc < 0) {
  ------------------
  |  Branch (1320:9): [True: 44, False: 18.3k]
  ------------------
 1321|     44|      return rc;
 1322|     44|    }
 1323|  18.3k|    if (chunk_cbytes < 0 || off_pos + chunk_cbytes > frame->len) {
  ------------------
  |  Branch (1323:9): [True: 0, False: 18.3k]
  |  Branch (1323:29): [True: 68, False: 18.3k]
  ------------------
 1324|     68|      BLOSC_TRACE_ERROR("Cannot read the cbytes outside of frame boundary.");
  ------------------
  |  |   93|     68|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     68|    do {                                            \
  |  |  |  |   98|     68|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     68|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 68, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     68|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1325|     68|      return BLOSC2_ERROR_INVALID_HEADER;
 1326|     68|    }
 1327|  18.3k|    return 0;
 1328|  18.3k|  }
 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:
 2389|  1.08k|                                int32_t header_len) {
 2390|  1.08k|  BLOSC_UNUSED_PARAM(frame);
  ------------------
  |  |   28|  1.08k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
 2391|  1.08k|  int64_t header_pos = FRAME_IDX_SIZE;
  ------------------
  |  |   51|  1.08k|#define FRAME_IDX_SIZE (FRAME_METALAYERS + 1 + 1)  // 89
  |  |  ------------------
  |  |  |  |   50|  1.08k|#define FRAME_METALAYERS (FRAME_HEADER_MINLEN)  // 87
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|  1.08k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|  1.08k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  1.08k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   42|  1.08k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   41|  1.08k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   40|  1.08k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  1.08k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  1.08k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  1.08k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  1.08k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  1.08k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  1.08k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  1.08k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  1.08k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2392|       |
 2393|       |  // Get the size for the index of metalayers
 2394|  1.08k|  uint16_t idx_size;
 2395|  1.08k|  header_pos += sizeof(idx_size);
 2396|  1.08k|  if (header_len < header_pos) {
  ------------------
  |  Branch (2396:7): [True: 21, False: 1.06k]
  ------------------
 2397|     21|    return BLOSC2_ERROR_READ_BUFFER;
 2398|     21|  }
 2399|  1.06k|  from_big(&idx_size, header + FRAME_IDX_SIZE, sizeof(idx_size));
  ------------------
  |  |   38|  1.06k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2400|       |
 2401|       |  // Get the actual index of metalayers
 2402|  1.06k|  uint8_t* metalayers_idx = header + FRAME_IDX_SIZE + 2;
  ------------------
  |  |   51|  1.06k|#define FRAME_IDX_SIZE (FRAME_METALAYERS + 1 + 1)  // 89
  |  |  ------------------
  |  |  |  |   50|  1.06k|#define FRAME_METALAYERS (FRAME_HEADER_MINLEN)  // 87
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|  1.06k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|  1.06k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  1.06k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   42|  1.06k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   41|  1.06k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   40|  1.06k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  1.06k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  1.06k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  1.06k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  1.06k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  1.06k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  1.06k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  1.06k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  1.06k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2403|  1.06k|  header_pos += 1;
 2404|  1.06k|  if (header_len < header_pos) {
  ------------------
  |  Branch (2404:7): [True: 2, False: 1.06k]
  ------------------
 2405|      2|    return BLOSC2_ERROR_READ_BUFFER;
 2406|      2|  }
 2407|  1.06k|  if (metalayers_idx[0] != 0xde) {   // sanity check
  ------------------
  |  Branch (2407:7): [True: 62, False: 999]
  ------------------
 2408|     62|    return BLOSC2_ERROR_DATA;
 2409|     62|  }
 2410|    999|  uint8_t* idxp = metalayers_idx + 1;
 2411|    999|  uint16_t nmetalayers;
 2412|    999|  header_pos += sizeof(nmetalayers);
 2413|    999|  if (header_len < header_pos) {
  ------------------
  |  Branch (2413:7): [True: 2, False: 997]
  ------------------
 2414|      2|    return BLOSC2_ERROR_READ_BUFFER;
 2415|      2|  }
 2416|    997|  from_big(&nmetalayers, idxp, sizeof(uint16_t));
  ------------------
  |  |   38|    997|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2417|    997|  idxp += 2;
 2418|    997|  if (nmetalayers > BLOSC2_MAX_METALAYERS) {
  ------------------
  |  | 1744|    997|#define BLOSC2_MAX_METALAYERS 16
  ------------------
  |  Branch (2418:7): [True: 26, False: 971]
  ------------------
 2419|     26|    return BLOSC2_ERROR_DATA;
 2420|     26|  }
 2421|    971|  schunk->nmetalayers = nmetalayers;
 2422|       |
 2423|       |  // Populate the metalayers and its serialized values
 2424|    971|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2424:28): [True: 50, False: 921]
  ------------------
 2425|     50|    header_pos += 1;
 2426|     50|    if (header_len < header_pos) {
  ------------------
  |  Branch (2426:9): [True: 2, False: 48]
  ------------------
 2427|      2|      return BLOSC2_ERROR_READ_BUFFER;
 2428|      2|    }
 2429|     48|    if ((*idxp & 0xe0u) != 0xa0u) {   // sanity check
  ------------------
  |  Branch (2429:9): [True: 19, False: 29]
  ------------------
 2430|     19|      return BLOSC2_ERROR_DATA;
 2431|     19|    }
 2432|     29|    blosc2_metalayer* metalayer = calloc(1, sizeof(blosc2_metalayer));
 2433|     29|    if (metalayer == NULL) {
  ------------------
  |  Branch (2433:9): [True: 0, False: 29]
  ------------------
 2434|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2435|      0|    }
 2436|     29|    schunk->metalayers[nmetalayer] = metalayer;
 2437|       |
 2438|       |    // Populate the metalayer string
 2439|     29|    uint8_t nslen = *idxp & (uint8_t)0x1F;
 2440|     29|    idxp += 1;
 2441|     29|    header_pos += nslen;
 2442|     29|    if (header_len < header_pos) {
  ------------------
  |  Branch (2442:9): [True: 1, False: 28]
  ------------------
 2443|      1|      return BLOSC2_ERROR_READ_BUFFER;
 2444|      1|    }
 2445|     28|    char* ns = malloc((size_t)nslen + 1);
 2446|     28|    if (ns == NULL) {
  ------------------
  |  Branch (2446:9): [True: 0, False: 28]
  ------------------
 2447|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2448|      0|    }
 2449|     28|    memcpy(ns, idxp, nslen);
 2450|     28|    ns[nslen] = '\0';
 2451|     28|    idxp += nslen;
 2452|     28|    metalayer->name = ns;
 2453|       |
 2454|       |    // Populate the serialized value for this metalayer
 2455|       |    // Get the offset
 2456|     28|    header_pos += 1;
 2457|     28|    if (header_len < header_pos) {
  ------------------
  |  Branch (2457:9): [True: 1, False: 27]
  ------------------
 2458|      1|      return BLOSC2_ERROR_READ_BUFFER;
 2459|      1|    }
 2460|     27|    if ((*idxp & 0xffu) != 0xd2u) {   // sanity check
  ------------------
  |  Branch (2460:9): [True: 6, False: 21]
  ------------------
 2461|      6|      return BLOSC2_ERROR_DATA;
 2462|      6|    }
 2463|     21|    idxp += 1;
 2464|     21|    int32_t offset;
 2465|     21|    header_pos += sizeof(offset);
 2466|     21|    if (header_len < header_pos) {
  ------------------
  |  Branch (2466:9): [True: 1, False: 20]
  ------------------
 2467|      1|      return BLOSC2_ERROR_READ_BUFFER;
 2468|      1|    }
 2469|     20|    from_big(&offset, idxp, sizeof(offset));
  ------------------
  |  |   38|     20|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2470|     20|    idxp += 4;
 2471|     20|    if (offset < 0 || offset >= header_len) {
  ------------------
  |  Branch (2471:9): [True: 3, False: 17]
  |  Branch (2471:23): [True: 11, False: 6]
  ------------------
 2472|       |      // Offset is less than zero or exceeds header length
 2473|     14|      return BLOSC2_ERROR_DATA;
 2474|     14|    }
 2475|       |    // Go to offset and see if we have the correct marker
 2476|      6|    uint8_t* content_marker = header + offset;
 2477|      6|    if ((int64_t)header_len < (int64_t)offset + 1 + 4) {
  ------------------
  |  Branch (2477:9): [True: 0, False: 6]
  ------------------
 2478|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2479|      0|    }
 2480|      6|    if (*content_marker != 0xc6) {
  ------------------
  |  Branch (2480:9): [True: 4, False: 2]
  ------------------
 2481|      4|      return BLOSC2_ERROR_DATA;
 2482|      4|    }
 2483|       |
 2484|       |    // Read the size of the content
 2485|      2|    int32_t content_len;
 2486|      2|    from_big(&content_len, content_marker + 1, sizeof(content_len));
  ------------------
  |  |   38|      2|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2487|      2|    if (content_len < 0) {
  ------------------
  |  Branch (2487:9): [True: 1, False: 1]
  ------------------
 2488|      1|      return BLOSC2_ERROR_DATA;
 2489|      1|    }
 2490|      1|    metalayer->content_len = content_len;
 2491|       |
 2492|       |    // Finally, read the content. Use 64-bit arithmetic so a malicious
 2493|       |    // (offset, content_len) pair near INT32_MAX cannot wrap and bypass the
 2494|       |    // bounds check, which would let memcpy below read past the header buffer.
 2495|      1|    if ((int64_t)header_len < (int64_t)offset + 1 + 4 + (int64_t)content_len) {
  ------------------
  |  Branch (2495:9): [True: 1, False: 0]
  ------------------
 2496|      1|      return BLOSC2_ERROR_READ_BUFFER;
 2497|      1|    }
 2498|      0|    char* content = malloc((size_t)content_len);
 2499|       |    // malloc(0) is allowed to return NULL, and blosc2_meta_add accepts
 2500|       |    // content_len == 0, so only treat NULL as an allocation failure when
 2501|       |    // a non-zero allocation was requested.
 2502|      0|    if (content_len > 0 && content == NULL) {
  ------------------
  |  Branch (2502:9): [True: 0, False: 0]
  |  Branch (2502:28): [True: 0, False: 0]
  ------------------
 2503|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2504|      0|    }
 2505|      0|    if (content_len > 0) {
  ------------------
  |  Branch (2505:9): [True: 0, False: 0]
  ------------------
 2506|      0|      memcpy(content, content_marker + 1 + 4, (size_t)content_len);
 2507|      0|    }
 2508|      0|    metalayer->content = (uint8_t*)content;
 2509|      0|  }
 2510|       |
 2511|    921|  return 1;
 2512|    971|}
frame.c:get_vlmeta_from_trailer:
 2592|    866|                                   int32_t trailer_len) {
 2593|       |
 2594|    866|  BLOSC_UNUSED_PARAM(frame);
  ------------------
  |  |   28|    866|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
 2595|    866|  int64_t trailer_pos = FRAME_TRAILER_VLMETALAYERS + 2;
  ------------------
  |  |   60|    866|#define FRAME_TRAILER_VLMETALAYERS (2)
  ------------------
 2596|    866|  uint8_t* idxp = trailer + trailer_pos;
 2597|       |
 2598|       |  // Get the size for the index of metalayers
 2599|    866|  trailer_pos += 2;
 2600|    866|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2600:7): [True: 0, False: 866]
  ------------------
 2601|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2602|      0|  }
 2603|    866|  uint16_t idx_size;
 2604|    866|  from_big(&idx_size, idxp, sizeof(idx_size));
  ------------------
  |  |   38|    866|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2605|    866|  idxp += 2;
 2606|       |
 2607|    866|  trailer_pos += 1;
 2608|       |  // Get the actual index of metalayers
 2609|    866|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2609:7): [True: 0, False: 866]
  ------------------
 2610|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2611|      0|  }
 2612|    866|  if (idxp[0] != 0xde) {   // sanity check
  ------------------
  |  Branch (2612:7): [True: 70, False: 796]
  ------------------
 2613|     70|    return BLOSC2_ERROR_DATA;
 2614|     70|  }
 2615|    796|  idxp += 1;
 2616|       |
 2617|       |  // The on-wire encoding is unsigned (uint16 follows the msgpack `0xde`
 2618|       |  // map16 marker), but `schunk->nvlmetalayers` is int16_t. Decoding into a
 2619|       |  // signed local would let raw bytes like 0xff 0xff slip past the
 2620|       |  // `> BLOSC2_MAX_VLMETALAYERS` ceiling as a negative count, after which
 2621|       |  // a later `blosc2_vlmeta_add` would write through `vlmetalayers[-1]`
 2622|       |  // and corrupt adjacent schunk fields. Decode unsigned, then narrow.
 2623|    796|  uint16_t nmetalayers;
 2624|    796|  trailer_pos += sizeof(nmetalayers);
 2625|    796|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2625:7): [True: 0, False: 796]
  ------------------
 2626|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2627|      0|  }
 2628|    796|  from_big(&nmetalayers, idxp, sizeof(uint16_t));
  ------------------
  |  |   38|    796|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2629|    796|  idxp += 2;
 2630|    796|  if (nmetalayers > BLOSC2_MAX_VLMETALAYERS) {
  ------------------
  |  | 1750|    796|#define BLOSC2_MAX_VLMETALAYERS (8 * 1024)
  ------------------
  |  Branch (2630:7): [True: 19, False: 777]
  ------------------
 2631|     19|    return BLOSC2_ERROR_DATA;
 2632|     19|  }
 2633|    777|  schunk->nvlmetalayers = (int16_t)nmetalayers;
 2634|       |
 2635|       |  // Populate the metalayers and its serialized values
 2636|  1.05k|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2636:28): [True: 350, False: 700]
  ------------------
 2637|    350|    trailer_pos += 1;
 2638|    350|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2638:9): [True: 0, False: 350]
  ------------------
 2639|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2640|      0|    }
 2641|    350|    if ((*idxp & 0xe0u) != 0xa0u) {   // sanity check
  ------------------
  |  Branch (2641:9): [True: 17, False: 333]
  ------------------
 2642|     17|      return BLOSC2_ERROR_DATA;
 2643|     17|    }
 2644|    333|    blosc2_metalayer* metalayer = calloc(1, sizeof(blosc2_metalayer));
 2645|    333|    if (metalayer == NULL) {
  ------------------
  |  Branch (2645:9): [True: 0, False: 333]
  ------------------
 2646|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2647|      0|    }
 2648|    333|    schunk->vlmetalayers[nmetalayer] = metalayer;
 2649|       |
 2650|       |    // Populate the metalayer string
 2651|    333|    uint8_t nslen = *idxp & (uint8_t)0x1F;
 2652|    333|    idxp += 1;
 2653|    333|    trailer_pos += nslen;
 2654|    333|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2654:9): [True: 0, False: 333]
  ------------------
 2655|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2656|      0|    }
 2657|    333|    char* ns = malloc((size_t)nslen + 1);
 2658|    333|    if (ns == NULL) {
  ------------------
  |  Branch (2658:9): [True: 0, False: 333]
  ------------------
 2659|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2660|      0|    }
 2661|    333|    memcpy(ns, idxp, nslen);
 2662|    333|    ns[nslen] = '\0';
 2663|    333|    idxp += nslen;
 2664|    333|    metalayer->name = ns;
 2665|       |
 2666|       |    // Populate the serialized value for this metalayer
 2667|       |    // Get the offset
 2668|    333|    trailer_pos += 1;
 2669|    333|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2669:9): [True: 0, False: 333]
  ------------------
 2670|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2671|      0|    }
 2672|    333|    if ((*idxp & 0xffu) != 0xd2u) {   // sanity check
  ------------------
  |  Branch (2672:9): [True: 3, False: 330]
  ------------------
 2673|      3|      return BLOSC2_ERROR_DATA;
 2674|      3|    }
 2675|    330|    idxp += 1;
 2676|    330|    int32_t offset;
 2677|    330|    trailer_pos += sizeof(offset);
 2678|    330|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2678:9): [True: 0, False: 330]
  ------------------
 2679|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2680|      0|    }
 2681|    330|    from_big(&offset, idxp, sizeof(offset));
  ------------------
  |  |   38|    330|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2682|    330|    idxp += 4;
 2683|    330|    if (offset < 0 || offset >= trailer_len) {
  ------------------
  |  Branch (2683:9): [True: 8, False: 322]
  |  Branch (2683:23): [True: 7, False: 315]
  ------------------
 2684|       |      // Offset is less than zero or exceeds trailer length
 2685|     15|      return BLOSC2_ERROR_DATA;
 2686|     15|    }
 2687|       |    // Go to offset and see if we have the correct marker
 2688|    315|    uint8_t* content_marker = trailer + offset;
 2689|    315|    if ((int64_t)trailer_len < (int64_t)offset + 1 + 4) {
  ------------------
  |  Branch (2689:9): [True: 1, False: 314]
  ------------------
 2690|      1|      return BLOSC2_ERROR_READ_BUFFER;
 2691|      1|    }
 2692|    314|    if (*content_marker != 0xc6) {
  ------------------
  |  Branch (2692:9): [True: 5, False: 309]
  ------------------
 2693|      5|      return BLOSC2_ERROR_DATA;
 2694|      5|    }
 2695|       |
 2696|       |    // Read the size of the content
 2697|    309|    int32_t content_len;
 2698|    309|    from_big(&content_len, content_marker + 1, sizeof(content_len));
  ------------------
  |  |   38|    309|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2699|    309|    if (content_len < 0) {
  ------------------
  |  Branch (2699:9): [True: 4, False: 305]
  ------------------
 2700|      4|      return BLOSC2_ERROR_DATA;
 2701|      4|    }
 2702|    305|    metalayer->content_len = content_len;
 2703|       |
 2704|       |    // Finally, read the content. Use 64-bit arithmetic so a malicious
 2705|       |    // (offset, content_len) pair near INT32_MAX cannot wrap and bypass the
 2706|       |    // bounds check, which would let memcpy below read past the trailer buffer.
 2707|    305|    if ((int64_t)trailer_len < (int64_t)offset + 1 + 4 + (int64_t)content_len) {
  ------------------
  |  Branch (2707:9): [True: 32, False: 273]
  ------------------
 2708|     32|      return BLOSC2_ERROR_READ_BUFFER;
 2709|     32|    }
 2710|    273|    char* content = malloc((size_t)content_len);
 2711|       |    // Same zero-length carve-out as in get_meta_from_header: malloc(0) may
 2712|       |    // return NULL on some platforms, and the public API allows
 2713|       |    // content_len == 0, so don't reject a valid empty vlmetalayer.
 2714|    273|    if (content_len > 0 && content == NULL) {
  ------------------
  |  Branch (2714:9): [True: 271, False: 2]
  |  Branch (2714:28): [True: 0, False: 271]
  ------------------
 2715|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2716|      0|    }
 2717|    273|    if (content_len > 0) {
  ------------------
  |  Branch (2717:9): [True: 271, False: 2]
  ------------------
 2718|    271|      memcpy(content, content_marker + 1 + 4, (size_t)content_len);
 2719|    271|    }
 2720|    273|    metalayer->content = (uint8_t*)content;
 2721|    273|  }
 2722|    700|  return 1;
 2723|    777|}
frame.c:validate_offsets_chunk:
 2881|  12.6k|                                  int64_t nchunks) {
 2882|  12.6k|  int32_t coffsets_cbytes = 0;
 2883|  12.6k|  uint8_t* coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &coffsets_cbytes);
 2884|  12.6k|  if (coffsets == NULL) {
  ------------------
  |  Branch (2884:7): [True: 325, False: 12.3k]
  ------------------
 2885|    325|    BLOSC_TRACE_ERROR("Cannot get compressed offsets from frame.");
  ------------------
  |  |   93|    325|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    325|    do {                                            \
  |  |  |  |   98|    325|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    325|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 325, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    325|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2886|    325|    return BLOSC2_ERROR_DATA;
 2887|    325|  }
 2888|       |
 2889|  12.3k|  int32_t offsets_nbytes;
 2890|  12.3k|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &offsets_nbytes)) {
  ------------------
  |  Branch (2890:7): [True: 0, False: 12.3k]
  ------------------
 2891|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2892|      0|    return BLOSC2_ERROR_FAILURE;
 2893|      0|  }
 2894|       |
 2895|  12.3k|  int64_t* offsets = (int64_t*)malloc((size_t)offsets_nbytes);
 2896|  12.3k|  if (offsets == NULL) {
  ------------------
  |  Branch (2896:7): [True: 0, False: 12.3k]
  ------------------
 2897|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2898|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2899|      0|  }
 2900|       |
 2901|  12.3k|  blosc2_dparams off_dparams = BLOSC2_DPARAMS_DEFAULTS;
 2902|  12.3k|  blosc2_context* dctx = blosc2_create_dctx(off_dparams);
 2903|  12.3k|  if (dctx == NULL) {
  ------------------
  |  Branch (2903:7): [True: 0, False: 12.3k]
  ------------------
 2904|      0|    free(offsets);
 2905|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2906|      0|    return BLOSC2_ERROR_FAILURE;
 2907|      0|  }
 2908|       |
 2909|  12.3k|  int32_t off_nbytes = blosc2_decompress_ctx(dctx, coffsets, coffsets_cbytes,
 2910|  12.3k|                                             offsets, offsets_nbytes);
 2911|  12.3k|  blosc2_free_ctx(dctx);
 2912|  12.3k|  if (off_nbytes != offsets_nbytes) {
  ------------------
  |  Branch (2912:7): [True: 10.4k, False: 1.91k]
  ------------------
 2913|  10.4k|    free(offsets);
 2914|  10.4k|    BLOSC_TRACE_ERROR("Cannot decompress offsets chunk.");
  ------------------
  |  |   93|  10.4k|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|  10.4k|    do {                                            \
  |  |  |  |   98|  10.4k|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|  10.4k|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 10.4k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|  10.4k|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2915|  10.4k|    return BLOSC2_ERROR_DATA;
 2916|  10.4k|  }
 2917|       |
 2918|  9.40G|  for (int64_t i = 0; i < nchunks; ++i) {
  ------------------
  |  Branch (2918:23): [True: 9.40G, False: 1.73k]
  ------------------
 2919|  9.40G|    int64_t offset = offsets[i];
 2920|  9.40G|    if (offset < 0) {
  ------------------
  |  Branch (2920:9): [True: 3.84G, False: 5.56G]
  ------------------
 2921|  3.84G|      continue;
 2922|  3.84G|    }
 2923|  5.56G|    if (offset > INT64_MAX - header_len || offset > cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (2923:9): [True: 7, False: 5.56G]
  |  Branch (2923:44): [True: 168, False: 5.56G]
  ------------------
 2924|    175|      free(offsets);
 2925|    175|      BLOSC_TRACE_ERROR("Offset for chunk %" PRId64 " is out of bounds.", i);
  ------------------
  |  |   93|    175|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    175|    do {                                            \
  |  |  |  |   98|    175|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    175|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 175, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    175|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2926|    175|      return BLOSC2_ERROR_INVALID_HEADER;
 2927|    175|    }
 2928|       |    /* Offsets do not need to be monotonic.  Frame mutations like insert can append
 2929|       |     * chunk payloads at the end of the cframe while updating the logical chunk order
 2930|       |     * only in the offsets table, so a valid frame may legitimately contain
 2931|       |     * non-monotonic non-negative offsets.
 2932|       |     */
 2933|  5.56G|  }
 2934|       |
 2935|  1.73k|  free(offsets);
 2936|  1.73k|  return 0;
 2937|  1.91k|}

blosc2_schunk_get_cparams:
   70|  12.9k|int blosc2_schunk_get_cparams(blosc2_schunk *schunk, blosc2_cparams **cparams) {
   71|  12.9k|  *cparams = calloc(1, sizeof(blosc2_cparams));
   72|  12.9k|  (*cparams)->schunk = schunk;
   73|  90.8k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (73:19): [True: 77.8k, False: 12.9k]
  ------------------
   74|  77.8k|    (*cparams)->filters[i] = schunk->filters[i];
   75|  77.8k|    (*cparams)->filters_meta[i] = schunk->filters_meta[i];
   76|  77.8k|  }
   77|  12.9k|  (*cparams)->compcode = schunk->compcode;
   78|  12.9k|  (*cparams)->compcode_meta = schunk->compcode_meta;
   79|  12.9k|  (*cparams)->clevel = schunk->clevel;
   80|  12.9k|  (*cparams)->typesize = schunk->typesize;
   81|  12.9k|  (*cparams)->blocksize = schunk->blocksize;
   82|  12.9k|  (*cparams)->splitmode = schunk->splitmode;
   83|  12.9k|  (*cparams)->use_dict = schunk->use_dict;
   84|  12.9k|  if (schunk->cctx == NULL) {
  ------------------
  |  Branch (84:7): [True: 12.9k, False: 0]
  ------------------
   85|  12.9k|    (*cparams)->nthreads = blosc2_get_nthreads();
   86|  12.9k|  }
   87|      0|  else {
   88|      0|    (*cparams)->nthreads = (int16_t)schunk->cctx->nthreads;
   89|      0|  }
   90|  12.9k|  return 0;
   91|  12.9k|}
blosc2_schunk_get_dparams:
   95|  12.9k|int blosc2_schunk_get_dparams(blosc2_schunk *schunk, blosc2_dparams **dparams) {
   96|  12.9k|  *dparams = calloc(1, sizeof(blosc2_dparams));
   97|  12.9k|  (*dparams)->schunk = schunk;
   98|  12.9k|  if (schunk->dctx == NULL) {
  ------------------
  |  Branch (98:7): [True: 12.9k, False: 0]
  ------------------
   99|  12.9k|    (*dparams)->nthreads = blosc2_get_nthreads();
  100|  12.9k|  }
  101|      0|  else {
  102|      0|    (*dparams)->nthreads = schunk->dctx->nthreads;
  103|      0|  }
  104|  12.9k|  return 0;
  105|  12.9k|}
schunk_free_metalayers:
  653|  13.6k|void schunk_free_metalayers(blosc2_schunk *schunk) {
  654|  13.9k|  for (int i = 0; i < schunk->nmetalayers; i++) {
  ------------------
  |  Branch (654:19): [True: 258, False: 13.6k]
  ------------------
  655|    258|    if (schunk->metalayers[i] != NULL) {
  ------------------
  |  Branch (655:9): [True: 29, False: 229]
  ------------------
  656|     29|      free(schunk->metalayers[i]->name);
  657|     29|      free(schunk->metalayers[i]->content);
  658|     29|      free(schunk->metalayers[i]);
  659|       |      schunk->metalayers[i] = NULL;
  660|     29|    }
  661|    258|  }
  662|  13.6k|  schunk->nmetalayers = 0;
  663|  13.6k|}
schunk_free_vlmetalayers:
  666|  13.6k|void schunk_free_vlmetalayers(blosc2_schunk *schunk) {
  667|  48.3k|  for (int i = 0; i < schunk->nvlmetalayers; i++) {
  ------------------
  |  Branch (667:19): [True: 34.6k, False: 13.6k]
  ------------------
  668|  34.6k|    if (schunk->vlmetalayers[i] != NULL) {
  ------------------
  |  Branch (668:9): [True: 333, False: 34.2k]
  ------------------
  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|  34.6k|  }
  675|  13.6k|  schunk->nvlmetalayers = 0;
  676|  13.6k|}
blosc2_schunk_free:
  679|  13.6k|int blosc2_schunk_free(blosc2_schunk *schunk) {
  680|  13.6k|  int err = 0;
  681|       |
  682|       |  // If it is a view, the data belongs to original array and should not be freed
  683|  13.6k|  if (schunk->data != NULL && !schunk->view) {
  ------------------
  |  Branch (683:7): [True: 0, False: 13.6k]
  |  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|  13.6k|  if (schunk->cctx != NULL)
  ------------------
  |  Branch (689:7): [True: 12.9k, False: 788]
  ------------------
  690|  12.9k|    blosc2_free_ctx(schunk->cctx);
  691|  13.6k|  if (schunk->dctx != NULL)
  ------------------
  |  Branch (691:7): [True: 12.9k, False: 788]
  ------------------
  692|  12.9k|    blosc2_free_ctx(schunk->dctx);
  693|  13.6k|  if (schunk->blockshape != NULL)
  ------------------
  |  Branch (693:7): [True: 0, False: 13.6k]
  ------------------
  694|      0|    free(schunk->blockshape);
  695|       |
  696|  13.6k|  schunk_free_metalayers(schunk);
  697|       |
  698|  13.6k|  if (schunk->storage != NULL) {
  ------------------
  |  Branch (698:7): [True: 12.9k, False: 788]
  ------------------
  699|  12.9k|    blosc2_io_cb *io_cb = blosc2_get_io_cb(schunk->storage->io->id);
  700|  12.9k|    if (io_cb != NULL) {
  ------------------
  |  Branch (700:9): [True: 12.9k, False: 0]
  ------------------
  701|  12.9k|      int rc = io_cb->destroy(schunk->storage->io->params);
  702|  12.9k|      if (rc < 0) {
  ------------------
  |  Branch (702:11): [True: 0, False: 12.9k]
  ------------------
  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|  12.9k|    }
  707|       |
  708|  12.9k|    if (schunk->storage->urlpath != NULL) {
  ------------------
  |  Branch (708:9): [True: 0, False: 12.9k]
  ------------------
  709|      0|      free(schunk->storage->urlpath);
  710|      0|    }
  711|  12.9k|    free(schunk->storage->cparams);
  712|  12.9k|    free(schunk->storage->dparams);
  713|  12.9k|    free(schunk->storage->io);
  714|  12.9k|    free(schunk->storage);
  715|  12.9k|  }
  716|       |
  717|       |  // If it is a view, the frame belongs to original array and should not be freed
  718|  13.6k|  if (schunk->frame != NULL && !schunk->view) {
  ------------------
  |  Branch (718:7): [True: 13.6k, False: 0]
  |  Branch (718:32): [True: 13.6k, False: 0]
  ------------------
  719|  13.6k|    frame_free((blosc2_frame_s *) schunk->frame);
  720|  13.6k|  }
  721|       |
  722|  13.6k|  schunk_free_vlmetalayers(schunk);
  723|       |
  724|  13.6k|  free(schunk);
  725|       |
  726|  13.6k|  return err;
  727|  13.6k|}
blosc2_schunk_from_buffer:
  731|  14.1k|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|  14.1k|  if (cframe == NULL || len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  14.1k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  14.1k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  14.1k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  14.1k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  14.1k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  14.1k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  14.1k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  14.1k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  14.1k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  14.1k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  14.1k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  14.1k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  14.1k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  14.1k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (733:7): [True: 0, False: 14.1k]
  |  Branch (733:25): [True: 15, False: 14.0k]
  ------------------
  734|     15|    return NULL;
  735|     15|  }
  736|  14.0k|  char *magic_number = (char *)cframe + FRAME_HEADER_MAGIC;
  ------------------
  |  |   29|  14.0k|#define FRAME_HEADER_MAGIC 2
  ------------------
  737|  14.0k|  if (memcmp(magic_number, "b2frame", sizeof("b2frame")) != 0) {
  ------------------
  |  Branch (737:7): [True: 190, False: 13.8k]
  ------------------
  738|    190|    return NULL;
  739|    190|  }
  740|  13.8k|  blosc2_frame_s* frame = frame_from_cframe(cframe, len, false);
  741|  13.8k|  if (frame == NULL) {
  ------------------
  |  Branch (741:7): [True: 208, False: 13.6k]
  ------------------
  742|    208|    return NULL;
  743|    208|  }
  744|  13.6k|  blosc2_schunk* schunk = frame_to_schunk(frame, copy, &BLOSC2_IO_DEFAULTS);
  745|  13.6k|  if (schunk && copy) {
  ------------------
  |  Branch (745:7): [True: 700, False: 12.9k]
  |  Branch (745:17): [True: 0, False: 700]
  ------------------
  746|       |    // Super-chunk has its own copy of frame
  747|      0|    frame_free(frame);
  748|      0|  }
  749|  13.6k|  return schunk;
  750|  13.8k|}
blosc2_schunk_decompress_chunk:
 1482|  60.7k|                                   void *dest, int32_t nbytes) {
 1483|  60.7k|  int rc = validate_nchunk(schunk, nchunk, false, "blosc2_schunk_decompress_chunk");
 1484|  60.7k|  if (rc < 0) {
  ------------------
  |  Branch (1484:7): [True: 0, False: 60.7k]
  ------------------
 1485|      0|    return rc;
 1486|      0|  }
 1487|       |
 1488|  60.7k|  int32_t chunk_nbytes;
 1489|  60.7k|  int32_t chunk_cbytes;
 1490|  60.7k|  int chunksize;
 1491|  60.7k|  blosc2_frame_s* frame = (blosc2_frame_s*)schunk->frame;
 1492|       |
 1493|  60.7k|  schunk->current_nchunk = nchunk;
 1494|  60.7k|  if (frame == NULL) {
  ------------------
  |  Branch (1494:7): [True: 0, False: 60.7k]
  ------------------
 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|  60.7k|  } else {
 1519|  60.7k|    rc = frame_lock(frame, false);
 1520|  60.7k|    if (rc < 0) {
  ------------------
  |  Branch (1520:9): [True: 0, False: 60.7k]
  ------------------
 1521|      0|      return rc;
 1522|      0|    }
 1523|  60.7k|    chunksize = frame_decompress_chunk(schunk->dctx, frame, nchunk, dest, nbytes);
 1524|  60.7k|    frame_unlock(frame);
 1525|  60.7k|    if (chunksize < 0) {
  ------------------
  |  Branch (1525:9): [True: 513, False: 60.2k]
  ------------------
 1526|    513|      return chunksize;
 1527|    513|    }
 1528|  60.7k|  }
 1529|  60.2k|  return chunksize;
 1530|  60.7k|}
schunk.c:validate_nchunk:
   44|  60.7k|static int validate_nchunk(blosc2_schunk *schunk, int64_t nchunk, bool allow_end, const char *func_name) {
   45|  60.7k|  if (nchunk < 0) {
  ------------------
  |  Branch (45:7): [True: 0, False: 60.7k]
  ------------------
   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|  60.7k|  if (allow_end) {
  ------------------
  |  Branch (50:7): [True: 0, False: 60.7k]
  ------------------
   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|  60.7k|  else {
   58|  60.7k|    if (nchunk >= schunk->nchunks) {
  ------------------
  |  Branch (58:9): [True: 0, False: 60.7k]
  ------------------
   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|  60.7k|  }
   64|       |
   65|  60.7k|  return BLOSC2_ERROR_SUCCESS;
   66|  60.7k|}

unshuffle_avx2:
  784|   143k|               const uint8_t *_src, uint8_t *_dest) {
  785|   143k|  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|   143k|  if (blocksize < vectorized_chunk_size) {
  ------------------
  |  Branch (789:7): [True: 77.7k, False: 65.6k]
  ------------------
  790|  77.7k|    unshuffle_generic(bytesoftype, blocksize, _src, _dest);
  791|  77.7k|    return;
  792|  77.7k|  }
  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|  65.6k|  const int32_t vectorizable_bytes = blocksize - (blocksize % vectorized_chunk_size);
  800|       |
  801|  65.6k|  const int32_t vectorizable_elements = vectorizable_bytes / bytesoftype;
  802|  65.6k|  const int32_t total_elements = blocksize / bytesoftype;
  803|       |
  804|       |  /* Optimized unshuffle implementations */
  805|  65.6k|  switch (bytesoftype) {
  806|  3.77k|    case 2:
  ------------------
  |  Branch (806:5): [True: 3.77k, False: 61.8k]
  ------------------
  807|  3.77k|      unshuffle2_avx2(_dest, _src, vectorizable_elements, total_elements);
  808|  3.77k|      break;
  809|  8.39k|    case 4:
  ------------------
  |  Branch (809:5): [True: 8.39k, False: 57.2k]
  ------------------
  810|  8.39k|      unshuffle4_avx2(_dest, _src, vectorizable_elements, total_elements);
  811|  8.39k|      break;
  812|  9.61k|    case 8:
  ------------------
  |  Branch (812:5): [True: 9.61k, False: 56.0k]
  ------------------
  813|  9.61k|      unshuffle8_avx2(_dest, _src, vectorizable_elements, total_elements);
  814|  9.61k|      break;
  815|  1.49k|    case 12:
  ------------------
  |  Branch (815:5): [True: 1.49k, False: 64.1k]
  ------------------
  816|  1.49k|      unshuffle12_avx2(_dest, _src, vectorizable_elements, total_elements);
  817|  1.49k|      break;
  818|    103|    case 16:
  ------------------
  |  Branch (818:5): [True: 103, False: 65.5k]
  ------------------
  819|    103|      unshuffle16_avx2(_dest, _src, vectorizable_elements, total_elements);
  820|    103|      break;
  821|  42.2k|    default:
  ------------------
  |  Branch (821:5): [True: 42.2k, False: 23.3k]
  ------------------
  822|       |      /* For types larger than 16 bytes, use the AVX2 tiled unshuffle. */
  823|  42.2k|      if (bytesoftype > (int32_t)sizeof(__m128i)) {
  ------------------
  |  Branch (823:11): [True: 26.7k, False: 15.4k]
  ------------------
  824|  26.7k|        unshuffle16_tiled_avx2(_dest, _src, vectorizable_elements, total_elements, bytesoftype);
  825|  26.7k|      }
  826|  15.4k|      else {
  827|       |        /* Non-optimized unshuffle */
  828|  15.4k|        unshuffle_generic(bytesoftype, blocksize, _src, _dest);
  829|       |        /* The non-optimized function covers the whole buffer,
  830|       |           so we're done processing here. */
  831|  15.4k|        return;
  832|  15.4k|      }
  833|  65.6k|  }
  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|  50.1k|  if (vectorizable_bytes < blocksize) {
  ------------------
  |  Branch (838:7): [True: 46.0k, False: 4.10k]
  ------------------
  839|  46.0k|    unshuffle_generic_inline(bytesoftype, vectorizable_bytes, blocksize, _src, _dest);
  840|  46.0k|  }
  841|  50.1k|}
shuffle-avx2.c:unshuffle2_avx2:
  338|  3.77k|                const int32_t vectorizable_elements, const int32_t total_elements) {
  339|  3.77k|  static const int32_t bytesoftype = 2;
  340|  3.77k|  int32_t i;
  341|  3.77k|  int j;
  342|  3.77k|  __m256i ymm0[2], ymm1[2];
  343|       |
  344|  20.3M|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (344:15): [True: 20.3M, False: 3.77k]
  ------------------
  345|       |    /* Load 32 elements (64 bytes) into 2 YMM registers. */
  346|  20.3M|    const uint8_t* const src_for_ith_element = src + i;
  347|  60.9M|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (347:17): [True: 40.6M, False: 20.3M]
  ------------------
  348|  40.6M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  349|  40.6M|    }
  350|       |    /* Shuffle bytes */
  351|  60.9M|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (351:17): [True: 40.6M, False: 20.3M]
  ------------------
  352|  40.6M|      ymm0[j] = _mm256_permute4x64_epi64(ymm0[j], 0xd8);
  353|  40.6M|    }
  354|       |    /* Compute the low 64 bytes */
  355|  20.3M|    ymm1[0] = _mm256_unpacklo_epi8(ymm0[0], ymm0[1]);
  356|       |    /* Compute the hi 64 bytes */
  357|  20.3M|    ymm1[1] = _mm256_unpackhi_epi8(ymm0[0], ymm0[1]);
  358|       |    /* Store the result vectors in proper order */
  359|  20.3M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * sizeof(__m256i))), ymm1[0]);
  360|  20.3M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * sizeof(__m256i))), ymm1[1]);
  361|  20.3M|  }
  362|  3.77k|}
shuffle-avx2.c:unshuffle4_avx2:
  367|  8.39k|                const int32_t vectorizable_elements, const int32_t total_elements) {
  368|  8.39k|  static const int32_t bytesoftype = 4;
  369|  8.39k|  int32_t i;
  370|  8.39k|  int j;
  371|  8.39k|  __m256i ymm0[4], ymm1[4];
  372|       |
  373|  13.7M|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (373:15): [True: 13.7M, False: 8.39k]
  ------------------
  374|       |    /* Load 32 elements (128 bytes) into 4 YMM registers. */
  375|  13.7M|    const uint8_t* const src_for_ith_element = src + i;
  376|  68.5M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (376:17): [True: 54.8M, False: 13.7M]
  ------------------
  377|  54.8M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  378|  54.8M|    }
  379|       |    /* Shuffle bytes */
  380|  41.1M|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (380:17): [True: 27.4M, False: 13.7M]
  ------------------
  381|       |      /* Compute the low 64 bytes */
  382|  27.4M|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  383|       |      /* Compute the hi 64 bytes */
  384|  27.4M|      ymm1[2 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  385|  27.4M|    }
  386|       |    /* Shuffle 2-byte words */
  387|  41.1M|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (387:17): [True: 27.4M, False: 13.7M]
  ------------------
  388|       |      /* Compute the low 64 bytes */
  389|  27.4M|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  390|       |      /* Compute the hi 64 bytes */
  391|  27.4M|      ymm0[2 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  392|  27.4M|    }
  393|  13.7M|    ymm1[0] = _mm256_permute2x128_si256(ymm0[0], ymm0[2], 0x20);
  394|  13.7M|    ymm1[1] = _mm256_permute2x128_si256(ymm0[1], ymm0[3], 0x20);
  395|  13.7M|    ymm1[2] = _mm256_permute2x128_si256(ymm0[0], ymm0[2], 0x31);
  396|  13.7M|    ymm1[3] = _mm256_permute2x128_si256(ymm0[1], ymm0[3], 0x31);
  397|       |
  398|       |    /* Store the result vectors in proper order */
  399|  68.5M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (399:17): [True: 54.8M, False: 13.7M]
  ------------------
  400|  54.8M|      _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (j * sizeof(__m256i))), ymm1[j]);
  401|  54.8M|    }
  402|  13.7M|  }
  403|  8.39k|}
shuffle-avx2.c:unshuffle8_avx2:
  408|  9.61k|                const int32_t vectorizable_elements, const int32_t total_elements) {
  409|  9.61k|  static const int32_t bytesoftype = 8;
  410|  9.61k|  int32_t i;
  411|  9.61k|  int j;
  412|  9.61k|  __m256i ymm0[8], ymm1[8];
  413|       |
  414|  15.1M|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (414:15): [True: 15.1M, False: 9.61k]
  ------------------
  415|       |    /* Fetch 32 elements (256 bytes) into 8 YMM registers. */
  416|  15.1M|    const uint8_t* const src_for_ith_element = src + i;
  417|   136M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (417:17): [True: 121M, False: 15.1M]
  ------------------
  418|   121M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  419|   121M|    }
  420|       |    /* Shuffle bytes */
  421|  75.9M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (421:17): [True: 60.7M, False: 15.1M]
  ------------------
  422|       |      /* Compute the low 32 bytes */
  423|  60.7M|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  424|       |      /* Compute the hi 32 bytes */
  425|  60.7M|      ymm1[4 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  426|  60.7M|    }
  427|       |    /* Shuffle words */
  428|  75.9M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (428:17): [True: 60.7M, False: 15.1M]
  ------------------
  429|       |      /* Compute the low 32 bytes */
  430|  60.7M|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  431|       |      /* Compute the hi 32 bytes */
  432|  60.7M|      ymm0[4 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  433|  60.7M|    }
  434|   136M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (434:17): [True: 121M, False: 15.1M]
  ------------------
  435|   121M|      ymm0[j] = _mm256_permute4x64_epi64(ymm0[j], 0xd8);
  436|   121M|    }
  437|       |
  438|       |    /* Shuffle 4-byte dwords */
  439|  75.9M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (439:17): [True: 60.7M, False: 15.1M]
  ------------------
  440|       |      /* Compute the low 32 bytes */
  441|  60.7M|      ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  442|       |      /* Compute the hi 32 bytes */
  443|  60.7M|      ymm1[4 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  444|  60.7M|    }
  445|       |
  446|       |    /* Store the result vectors in proper order */
  447|  15.1M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * sizeof(__m256i))), ymm1[0]);
  448|  15.1M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * sizeof(__m256i))), ymm1[2]);
  449|  15.1M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (2 * sizeof(__m256i))), ymm1[1]);
  450|  15.1M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (3 * sizeof(__m256i))), ymm1[3]);
  451|  15.1M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (4 * sizeof(__m256i))), ymm1[4]);
  452|  15.1M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (5 * sizeof(__m256i))), ymm1[6]);
  453|  15.1M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (6 * sizeof(__m256i))), ymm1[5]);
  454|  15.1M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (7 * sizeof(__m256i))), ymm1[7]);
  455|  15.1M|  }
  456|  9.61k|}
shuffle-avx2.c:unshuffle12_avx2:
  533|  1.49k|    const int32_t vectorizable_elements, const int32_t total_elements) {
  534|  1.49k|  static const int32_t bytesoftype = 12;
  535|  1.49k|  int32_t i;
  536|  1.49k|  int j;
  537|  1.49k|  __m256i ymm0[16], ymm1[16];
  538|       |
  539|  1.49k|  __m256i permute = _mm256_set_epi32(0,0,6,5,4,2,1,0);
  540|  1.49k|  __m256i store_mask = _mm256_set_epi32(0x0, 0x0, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
  541|  1.49k|  int32_t jump = 2*bytesoftype;
  542|   532k|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (542:15): [True: 531k, False: 1.49k]
  ------------------
  543|       |    /* Fetch 24 elements (384 bytes) into 12 YMM registers. */
  544|   531k|    const uint8_t* const src_for_ith_element = src + i;
  545|  6.90M|    for (j = 0; j < bytesoftype; j++) {
  ------------------
  |  Branch (545:17): [True: 6.37M, False: 531k]
  ------------------
  546|  6.37M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  547|  6.37M|    }
  548|       |    /* Initialize the last 4 registers (128 bytes) to null */
  549|  2.65M|    for (j = bytesoftype; j < 16; j++) {
  ------------------
  |  Branch (549:27): [True: 2.12M, False: 531k]
  ------------------
  550|  2.12M|      ymm0[j] = _mm256_setzero_si256();
  551|  2.12M|    }
  552|       |
  553|       |    /* Shuffle bytes */
  554|  4.78M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (554:17): [True: 4.24M, False: 531k]
  ------------------
  555|       |      /* Compute the low 32 bytes */
  556|  4.24M|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  557|       |      /* Compute the hi 32 bytes */
  558|  4.24M|      ymm1[8 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  559|  4.24M|    }
  560|       |    /* Shuffle 2-byte words */
  561|  4.78M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (561:17): [True: 4.24M, False: 531k]
  ------------------
  562|       |      /* Compute the low 32 bytes */
  563|  4.24M|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  564|       |      /* Compute the hi 32 bytes */
  565|  4.24M|      ymm0[8 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  566|  4.24M|    }
  567|       |    /* Shuffle 4-byte dwords */
  568|  4.78M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (568:17): [True: 4.24M, False: 531k]
  ------------------
  569|       |      /* Compute the low 32 bytes */
  570|  4.24M|      ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  571|       |      /* Compute the hi 32 bytes */
  572|  4.24M|      ymm1[8 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  573|  4.24M|    }
  574|       |
  575|       |    /* Shuffle 8-byte qwords */
  576|  4.78M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (576:17): [True: 4.24M, False: 531k]
  ------------------
  577|       |      /* Compute the low 32 bytes */
  578|  4.24M|      ymm0[j] = _mm256_unpacklo_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  579|       |      /* Compute the hi 32 bytes */
  580|  4.24M|      ymm0[8 + j] = _mm256_unpackhi_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  581|  4.24M|    }
  582|       |
  583|       |
  584|  4.78M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (584:17): [True: 4.24M, False: 531k]
  ------------------
  585|  4.24M|      ymm1[j] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x20);
  586|  4.24M|      ymm1[j + 8] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x31);
  587|  4.24M|      ymm1[j] = _mm256_permutevar8x32_epi32(ymm1[j], permute);
  588|  4.24M|      ymm1[j+8] = _mm256_permutevar8x32_epi32(ymm1[j+8], permute);
  589|       |
  590|       |
  591|  4.24M|    }
  592|   531k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * jump)), ymm1[0]);
  593|   531k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * jump)), ymm1[4]);
  594|   531k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (2 * jump)), ymm1[2]);
  595|   531k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (3 * jump)), ymm1[6]);
  596|   531k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (4 * jump)), ymm1[1]);
  597|   531k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (5 * jump)), ymm1[5]);
  598|   531k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (6 * jump)), ymm1[3]);
  599|   531k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (7 * jump)), ymm1[7]);
  600|   531k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (8 * jump)), ymm1[8]);
  601|   531k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (9 * jump)), ymm1[12]);
  602|   531k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (10 * jump)), ymm1[10]);
  603|   531k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (11 * jump)), ymm1[14]);
  604|   531k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (12 * jump)), ymm1[9]);
  605|   531k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (13 * jump)), ymm1[13]);
  606|   531k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (14 * jump)), ymm1[11]);
  607|   531k|    _mm256_maskstore_epi32((int *)(dest + (i * bytesoftype) + (15 * jump)), store_mask, ymm1[15]);
  608|   531k|  }
  609|  1.49k|}
shuffle-avx2.c:unshuffle16_avx2:
  461|    103|                 const int32_t vectorizable_elements, const int32_t total_elements) {
  462|    103|  static const int32_t bytesoftype = 16;
  463|    103|  int32_t i;
  464|    103|  int j;
  465|    103|  __m256i ymm0[16], ymm1[16];
  466|       |
  467|  4.69M|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (467:15): [True: 4.69M, False: 103]
  ------------------
  468|       |    /* Fetch 32 elements (512 bytes) into 16 YMM registers. */
  469|  4.69M|    const uint8_t* const src_for_ith_element = src + i;
  470|  79.8M|    for (j = 0; j < 16; j++) {
  ------------------
  |  Branch (470:17): [True: 75.1M, False: 4.69M]
  ------------------
  471|  75.1M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  472|  75.1M|    }
  473|       |
  474|       |    /* Shuffle bytes */
  475|  42.2M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (475:17): [True: 37.5M, False: 4.69M]
  ------------------
  476|       |      /* Compute the low 32 bytes */
  477|  37.5M|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  478|       |      /* Compute the hi 32 bytes */
  479|  37.5M|      ymm1[8 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  480|  37.5M|    }
  481|       |    /* Shuffle 2-byte words */
  482|  42.2M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (482:17): [True: 37.5M, False: 4.69M]
  ------------------
  483|       |      /* Compute the low 32 bytes */
  484|  37.5M|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  485|       |      /* Compute the hi 32 bytes */
  486|  37.5M|      ymm0[8 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  487|  37.5M|    }
  488|       |    /* Shuffle 4-byte dwords */
  489|  42.2M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (489:17): [True: 37.5M, False: 4.69M]
  ------------------
  490|       |      /* Compute the low 32 bytes */
  491|  37.5M|      ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  492|       |      /* Compute the hi 32 bytes */
  493|  37.5M|      ymm1[8 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  494|  37.5M|    }
  495|       |
  496|       |    /* Shuffle 8-byte qwords */
  497|  42.2M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (497:17): [True: 37.5M, False: 4.69M]
  ------------------
  498|       |      /* Compute the low 32 bytes */
  499|  37.5M|      ymm0[j] = _mm256_unpacklo_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  500|       |      /* Compute the hi 32 bytes */
  501|  37.5M|      ymm0[8 + j] = _mm256_unpackhi_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  502|  37.5M|    }
  503|       |
  504|  42.2M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (504:17): [True: 37.5M, False: 4.69M]
  ------------------
  505|  37.5M|      ymm1[j] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x20);
  506|  37.5M|      ymm1[j + 8] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x31);
  507|  37.5M|    }
  508|       |
  509|       |    /* Store the result vectors in proper order */
  510|  4.69M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * sizeof(__m256i))), ymm1[0]);
  511|  4.69M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * sizeof(__m256i))), ymm1[4]);
  512|  4.69M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (2 * sizeof(__m256i))), ymm1[2]);
  513|  4.69M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (3 * sizeof(__m256i))), ymm1[6]);
  514|  4.69M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (4 * sizeof(__m256i))), ymm1[1]);
  515|  4.69M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (5 * sizeof(__m256i))), ymm1[5]);
  516|  4.69M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (6 * sizeof(__m256i))), ymm1[3]);
  517|  4.69M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (7 * sizeof(__m256i))), ymm1[7]);
  518|  4.69M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (8 * sizeof(__m256i))), ymm1[8]);
  519|  4.69M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (9 * sizeof(__m256i))), ymm1[12]);
  520|  4.69M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (10 * sizeof(__m256i))), ymm1[10]);
  521|  4.69M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (11 * sizeof(__m256i))), ymm1[14]);
  522|  4.69M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (12 * sizeof(__m256i))), ymm1[9]);
  523|  4.69M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (13 * sizeof(__m256i))), ymm1[13]);
  524|  4.69M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (14 * sizeof(__m256i))), ymm1[11]);
  525|  4.69M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (15 * sizeof(__m256i))), ymm1[15]);
  526|  4.69M|  }
  527|    103|}
shuffle-avx2.c:unshuffle16_tiled_avx2:
  613|  26.7k|                       const int32_t vectorizable_elements, const int32_t total_elements, const int32_t bytesoftype) {
  614|  26.7k|  int32_t i;
  615|  26.7k|  int j;
  616|  26.7k|  __m256i ymm0[16], ymm1[16];
  617|       |
  618|  26.7k|  const lldiv_t vecs_per_el = lldiv(bytesoftype, sizeof(__m128i));
  619|  26.7k|  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|  26.7k|  int32_t offset_into_type;
  624|   128k|  for (offset_into_type = 0; offset_into_type < bytesoftype;
  ------------------
  |  Branch (624:30): [True: 101k, False: 26.7k]
  ------------------
  625|   101k|       offset_into_type += (offset_into_type == 0 && vecs_rem > 0 ? vecs_rem : (int32_t)sizeof(__m128i))) {
  ------------------
  |  Branch (625:29): [True: 26.7k, False: 74.4k]
  |  Branch (625:54): [True: 21.5k, False: 5.27k]
  ------------------
  626|  32.0M|    for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (626:17): [True: 31.9M, False: 101k]
  ------------------
  627|       |      /* Load the first 16 bytes of 32 adjacent elements (512 bytes) into 16 YMM registers */
  628|  31.9M|      const uint8_t* const src_for_ith_element = src + i;
  629|   543M|      for (j = 0; j < 16; j++) {
  ------------------
  |  Branch (629:19): [True: 511M, False: 31.9M]
  ------------------
  630|   511M|        ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (total_elements * (offset_into_type + j))));
  631|   511M|      }
  632|       |
  633|       |      /* Shuffle bytes */
  634|   287M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (634:19): [True: 255M, False: 31.9M]
  ------------------
  635|       |        /* Compute the low 32 bytes */
  636|   255M|        ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  637|       |        /* Compute the hi 32 bytes */
  638|   255M|        ymm1[8 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  639|   255M|      }
  640|       |      /* Shuffle 2-byte words */
  641|   287M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (641:19): [True: 255M, False: 31.9M]
  ------------------
  642|       |        /* Compute the low 32 bytes */
  643|   255M|        ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  644|       |        /* Compute the hi 32 bytes */
  645|   255M|        ymm0[8 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  646|   255M|      }
  647|       |      /* Shuffle 4-byte dwords */
  648|   287M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (648:19): [True: 255M, False: 31.9M]
  ------------------
  649|       |        /* Compute the low 32 bytes */
  650|   255M|        ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  651|       |        /* Compute the hi 32 bytes */
  652|   255M|        ymm1[8 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  653|   255M|      }
  654|       |
  655|       |      /* Shuffle 8-byte qwords */
  656|   287M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (656:19): [True: 255M, False: 31.9M]
  ------------------
  657|       |        /* Compute the low 32 bytes */
  658|   255M|        ymm0[j] = _mm256_unpacklo_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  659|       |        /* Compute the hi 32 bytes */
  660|   255M|        ymm0[8 + j] = _mm256_unpackhi_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  661|   255M|      }
  662|       |
  663|   287M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (663:19): [True: 255M, False: 31.9M]
  ------------------
  664|   255M|        ymm1[j] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x20);
  665|   255M|        ymm1[j + 8] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x31);
  666|   255M|      }
  667|       |
  668|       |      /* Store the result vectors in proper order */
  669|  31.9M|      const uint8_t* const dest_with_offset = dest + offset_into_type;
  670|  31.9M|      _mm256_storeu2_m128i(
  671|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x01) * bytesoftype),
  672|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x00) * bytesoftype), ymm1[0]);
  673|  31.9M|      _mm256_storeu2_m128i(
  674|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x03) * bytesoftype),
  675|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x02) * bytesoftype), ymm1[4]);
  676|  31.9M|      _mm256_storeu2_m128i(
  677|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x05) * bytesoftype),
  678|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x04) * bytesoftype), ymm1[2]);
  679|  31.9M|      _mm256_storeu2_m128i(
  680|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x07) * bytesoftype),
  681|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x06) * bytesoftype), ymm1[6]);
  682|  31.9M|      _mm256_storeu2_m128i(
  683|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x09) * bytesoftype),
  684|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x08) * bytesoftype), ymm1[1]);
  685|  31.9M|      _mm256_storeu2_m128i(
  686|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x0b) * bytesoftype),
  687|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x0a) * bytesoftype), ymm1[5]);
  688|  31.9M|      _mm256_storeu2_m128i(
  689|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x0d) * bytesoftype),
  690|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x0c) * bytesoftype), ymm1[3]);
  691|  31.9M|      _mm256_storeu2_m128i(
  692|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x0f) * bytesoftype),
  693|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x0e) * bytesoftype), ymm1[7]);
  694|  31.9M|      _mm256_storeu2_m128i(
  695|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x11) * bytesoftype),
  696|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x10) * bytesoftype), ymm1[8]);
  697|  31.9M|      _mm256_storeu2_m128i(
  698|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x13) * bytesoftype),
  699|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x12) * bytesoftype), ymm1[12]);
  700|  31.9M|      _mm256_storeu2_m128i(
  701|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x15) * bytesoftype),
  702|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x14) * bytesoftype), ymm1[10]);
  703|  31.9M|      _mm256_storeu2_m128i(
  704|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x17) * bytesoftype),
  705|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x16) * bytesoftype), ymm1[14]);
  706|  31.9M|      _mm256_storeu2_m128i(
  707|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x19) * bytesoftype),
  708|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x18) * bytesoftype), ymm1[9]);
  709|  31.9M|      _mm256_storeu2_m128i(
  710|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x1b) * bytesoftype),
  711|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x1a) * bytesoftype), ymm1[13]);
  712|  31.9M|      _mm256_storeu2_m128i(
  713|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x1d) * bytesoftype),
  714|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x1c) * bytesoftype), ymm1[11]);
  715|  31.9M|      _mm256_storeu2_m128i(
  716|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x1f) * bytesoftype),
  717|  31.9M|          (__m128i*)(dest_with_offset + (i + 0x1e) * bytesoftype), ymm1[15]);
  718|  31.9M|    }
  719|   101k|  }
  720|  26.7k|}

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

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

blosc2_unshuffle:
  436|   143k|                 const void* src, void* dest) {
  437|       |  /* Initialize the shuffle implementation if necessary. */
  438|   143k|  init_shuffle_implementation();
  439|       |
  440|   143k|  if (typesize < 1 || typesize > 256 || blocksize < 0) {
  ------------------
  |  Branch (440:7): [True: 0, False: 143k]
  |  Branch (440:23): [True: 0, False: 143k]
  |  Branch (440:41): [True: 0, False: 143k]
  ------------------
  441|      0|    return BLOSC2_ERROR_INVALID_PARAM;
  442|      0|  }
  443|       |
  444|       |  /* The implementation is initialized.
  445|       |     Dispatch to it's unshuffle routine. */
  446|   143k|  (host_implementation.unshuffle)(typesize, blocksize, src, dest);
  447|       |
  448|   143k|  return blocksize;
  449|   143k|}
bitunshuffle:
  484|  70.5k|                     const uint8_t format_version) {
  485|       |  /* Initialize the shuffle implementation if necessary. */
  486|  70.5k|  init_shuffle_implementation();
  487|  70.5k|  size_t size = blocksize / typesize;
  488|       |
  489|  70.5k|  if (format_version == 2) {
  ------------------
  |  Branch (489:7): [True: 2.34k, False: 68.2k]
  ------------------
  490|       |    /* Starting from version 3, bitshuffle() works differently */
  491|  2.34k|    if ((size % 8) == 0) {
  ------------------
  |  Branch (491:9): [True: 1.50k, False: 835]
  ------------------
  492|       |      /* The number of elems is a multiple of 8 which is supported by
  493|       |         bitshuffle. */
  494|  1.50k|      int ret = (int) (host_implementation.bitunshuffle)
  495|  1.50k|          ((const void *) src, (void *) dest, blocksize / typesize, typesize);
  496|  1.50k|      if (ret < 0) {
  ------------------
  |  Branch (496:11): [True: 0, False: 1.50k]
  ------------------
  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|  1.50k|    }
  502|    835|    else {
  503|    835|      memcpy(dest, src, blocksize);
  504|    835|    }
  505|  2.34k|  }
  506|  68.2k|  else {
  507|       |    /* bitshuffle only supports a number of bytes that is a multiple of 8. */
  508|  68.2k|    size -= size % 8;
  509|  68.2k|    int ret = (int) (host_implementation.bitunshuffle)(src, dest, size, typesize);
  510|  68.2k|    if (ret < 0) {
  ------------------
  |  Branch (510:9): [True: 0, False: 68.2k]
  ------------------
  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|  68.2k|    size_t offset = size * typesize;
  517|  68.2k|    memcpy((uint8_t *) dest + offset, (const uint8_t *) src + offset, blocksize - offset);
  518|  68.2k|  }
  519|       |
  520|  70.5k|  return blocksize;
  521|  70.5k|}
shuffle.c:init_shuffle_implementation:
  391|   214k|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|   214k|#if defined(__GNUC__) || defined(__clang__)
  401|   214k|  if (__builtin_expect(!implementation_initialized, 0)) {
  ------------------
  |  Branch (401:7): [True: 1, False: 214k]
  ------------------
  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|   214k|}
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|  13.5k|int blosc_stune_next_blocksize(blosc2_context *context) {
   48|  13.5k|  int32_t clevel = context->clevel;
   49|  13.5k|  int32_t typesize = context->typesize;
   50|  13.5k|  int32_t nbytes = context->sourcesize;
   51|  13.5k|  int32_t user_blocksize = context->blocksize;
   52|  13.5k|  int32_t blocksize = nbytes;
   53|       |
   54|       |  // Protection against very small buffers
   55|  13.5k|  if (nbytes < typesize) {
  ------------------
  |  Branch (55:7): [True: 12.2k, False: 1.35k]
  ------------------
   56|  12.2k|    context->blocksize = 1;
   57|  12.2k|    return BLOSC2_ERROR_SUCCESS;
   58|  12.2k|  }
   59|       |
   60|  1.35k|  int splitmode = split_block(context, typesize, blocksize);
   61|  1.35k|  if (user_blocksize) {
  ------------------
  |  Branch (61:7): [True: 971, False: 382]
  ------------------
   62|    971|    blocksize = user_blocksize;
   63|    971|    goto last;
   64|    971|  }
   65|       |
   66|    382|  if (nbytes >= L1) {
  ------------------
  |  |   19|    382|#define L1 (32 * 1024)
  ------------------
  |  Branch (66:7): [True: 381, False: 1]
  ------------------
   67|    381|    blocksize = L1;
  ------------------
  |  |   19|    381|#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|    381|    if (is_HCR(context)) {
  ------------------
  |  Branch (72:9): [True: 0, False: 381]
  ------------------
   73|      0|      blocksize *= 2;
   74|      0|    }
   75|       |
   76|       |    // Choose a different blocksize depending on the compression level
   77|    381|    switch (clevel) {
   78|      0|      case 0:
  ------------------
  |  Branch (78:7): [True: 0, False: 381]
  ------------------
   79|       |        // Case of plain copy
   80|      0|        blocksize /= 4;
   81|      0|        break;
   82|      0|      case 1:
  ------------------
  |  Branch (82:7): [True: 0, False: 381]
  ------------------
   83|      0|        blocksize /= 2;
   84|      0|        break;
   85|      0|      case 2:
  ------------------
  |  Branch (85:7): [True: 0, False: 381]
  ------------------
   86|      0|        blocksize *= 1;
   87|      0|        break;
   88|      0|      case 3:
  ------------------
  |  Branch (88:7): [True: 0, False: 381]
  ------------------
   89|      0|        blocksize *= 2;
   90|      0|        break;
   91|      0|      case 4:
  ------------------
  |  Branch (91:7): [True: 0, False: 381]
  ------------------
   92|    381|      case 5:
  ------------------
  |  Branch (92:7): [True: 381, False: 0]
  ------------------
   93|    381|        blocksize *= 4;
   94|    381|        break;
   95|      0|      case 6:
  ------------------
  |  Branch (95:7): [True: 0, False: 381]
  ------------------
   96|      0|      case 7:
  ------------------
  |  Branch (96:7): [True: 0, False: 381]
  ------------------
   97|      0|      case 8:
  ------------------
  |  Branch (97:7): [True: 0, False: 381]
  ------------------
   98|      0|        blocksize *= 8;
   99|      0|        break;
  100|      0|      case 9:
  ------------------
  |  Branch (100:7): [True: 0, False: 381]
  ------------------
  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: 381]
  ------------------
  108|      0|        break;
  109|    381|    }
  110|    381|  }
  111|       |
  112|       |  /* Now the blocksize for splittable codecs */
  113|    382|  if (clevel > 0 && splitmode) {
  ------------------
  |  Branch (113:7): [True: 382, False: 0]
  |  Branch (113:21): [True: 368, False: 14]
  ------------------
  114|       |    // For performance reasons, do not exceed 256 KB (it must fit in L2 cache)
  115|    368|    switch (clevel) {
  116|      0|      case 1:
  ------------------
  |  Branch (116:7): [True: 0, False: 368]
  ------------------
  117|      0|      case 2:
  ------------------
  |  Branch (117:7): [True: 0, False: 368]
  ------------------
  118|      0|      case 3:
  ------------------
  |  Branch (118:7): [True: 0, False: 368]
  ------------------
  119|      0|        blocksize = 32 * 1024;
  120|      0|        break;
  121|      0|      case 4:
  ------------------
  |  Branch (121:7): [True: 0, False: 368]
  ------------------
  122|    368|      case 5:
  ------------------
  |  Branch (122:7): [True: 368, False: 0]
  ------------------
  123|    368|      case 6:
  ------------------
  |  Branch (123:7): [True: 0, False: 368]
  ------------------
  124|    368|        blocksize = 64 * 1024;
  125|    368|        break;
  126|      0|      case 7:
  ------------------
  |  Branch (126:7): [True: 0, False: 368]
  ------------------
  127|      0|        blocksize = 128 * 1024;
  128|      0|        break;
  129|      0|      case 8:
  ------------------
  |  Branch (129:7): [True: 0, False: 368]
  ------------------
  130|      0|        blocksize = 256 * 1024;
  131|      0|        break;
  132|      0|      case 9:
  ------------------
  |  Branch (132:7): [True: 0, False: 368]
  ------------------
  133|      0|      default:
  ------------------
  |  Branch (133:7): [True: 0, False: 368]
  ------------------
  134|      0|        blocksize = 512 * 1024;
  135|      0|        break;
  136|    368|    }
  137|       |    // Multiply by typesize to get proper split sizes
  138|    368|    blocksize *= typesize;
  139|       |    // But do not exceed 4 MB per thread (having this capacity in L3 is normal in modern CPUs)
  140|    368|    if (blocksize > 4 * 1024 * 1024) {
  ------------------
  |  Branch (140:9): [True: 0, False: 368]
  ------------------
  141|      0|      blocksize = 4 * 1024 * 1024;
  142|      0|    }
  143|    368|    if (blocksize < 32 * 1024) {
  ------------------
  |  Branch (143:9): [True: 0, False: 368]
  ------------------
  144|       |      /* Do not use a too small blocksize (< 32 KB) when typesize is small */
  145|      0|      blocksize = 32 * 1024;
  146|      0|    }
  147|    368|  }
  148|       |
  149|  1.35k|  last:
  150|       |  /* Check that blocksize is not too large */
  151|  1.35k|  if (blocksize > nbytes) {
  ------------------
  |  Branch (151:7): [True: 984, False: 369]
  ------------------
  152|    984|    blocksize = nbytes;
  153|    984|  }
  154|       |
  155|       |  // blocksize *must absolutely* be a multiple of the typesize
  156|  1.35k|  if (blocksize > typesize) {
  ------------------
  |  Branch (156:7): [True: 531, False: 822]
  ------------------
  157|    531|    blocksize = blocksize / typesize * typesize;
  158|    531|  }
  159|       |
  160|  1.35k|  context->blocksize = blocksize;
  161|  1.35k|  BLOSC_INFO("compcode: %d, clevel: %d, blocksize: %d, splitmode: %d, typesize: %d",
  ------------------
  |  |  121|  1.35k|    do {                                            \
  |  |  122|  1.35k|        const char *__e = getenv("BLOSC_INFO");     \
  |  |  123|  1.35k|        if (!__e) { break; }                        \
  |  |  ------------------
  |  |  |  Branch (123:13): [True: 1.35k, False: 0]
  |  |  ------------------
  |  |  124|  1.35k|        fprintf(stderr, "[INFO] - " msg "\n", ##__VA_ARGS__); \
  |  |  125|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  162|  1.35k|             context->compcode, context->clevel, blocksize, splitmode, typesize);
  163|       |
  164|  1.35k|  return BLOSC2_ERROR_SUCCESS;
  165|    382|}
split_block:
  186|  1.35k|int split_block(blosc2_context *context, int32_t typesize, int32_t blocksize) {
  187|  1.35k|  switch (context->splitmode) {
  188|      0|    case BLOSC_ALWAYS_SPLIT:
  ------------------
  |  Branch (188:5): [True: 0, False: 1.35k]
  ------------------
  189|      0|      return 1;
  190|      0|    case BLOSC_NEVER_SPLIT:
  ------------------
  |  Branch (190:5): [True: 0, False: 1.35k]
  ------------------
  191|      0|      return 0;
  192|  1.35k|    case BLOSC_FORWARD_COMPAT_SPLIT:
  ------------------
  |  Branch (192:5): [True: 1.35k, False: 0]
  ------------------
  193|  1.35k|    case BLOSC_AUTO_SPLIT:
  ------------------
  |  Branch (193:5): [True: 0, False: 1.35k]
  ------------------
  194|       |      // These cases will be handled later
  195|  1.35k|      break;
  196|      0|    default:
  ------------------
  |  Branch (196:5): [True: 0, False: 1.35k]
  ------------------
  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|  1.35k|  }
  199|       |
  200|  1.35k|  int compcode = context->compcode;
  201|  1.35k|  if (compcode == BLOSC_CODEC_OPENZL) {
  ------------------
  |  Branch (201:7): [True: 0, False: 1.35k]
  ------------------
  202|       |    // Never split blocks for OpenZL, as it has its own block mechanisms
  203|      0|    return 0;
  204|      0|  }
  205|  1.35k|  return (
  206|       |          // Fast codecs like blosclz, lz4 seems to prefer to split
  207|  1.35k|          ((compcode == BLOSC_BLOSCLZ) || (compcode == BLOSC_LZ4)
  ------------------
  |  Branch (207:12): [True: 1.35k, 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|  1.35k|            ) &&
  211|       |          // ...but split seems to harm cratio too much when not using shuffle
  212|  1.35k|          (context->filter_flags & BLOSC_DOSHUFFLE) &&
  ------------------
  |  Branch (212:11): [True: 1.35k, False: 0]
  ------------------
  213|  1.35k|          (typesize <= MAX_STREAMS) &&
  ------------------
  |  |   24|  1.35k|#define MAX_STREAMS 16 /* Cannot be larger than 128 */
  ------------------
  |  Branch (213:11): [True: 514, False: 839]
  ------------------
  214|    514|          (blocksize / typesize) >= BLOSC_MIN_BUFFERSIZE);
  ------------------
  |  Branch (214:11): [True: 511, False: 3]
  ------------------
  215|  1.35k|}
stune.c:is_HCR:
   21|    381|static bool is_HCR(blosc2_context * context) {
   22|    381|  switch (context->compcode) {
   23|    381|    case BLOSC_BLOSCLZ :
  ------------------
  |  Branch (23:5): [True: 381, False: 0]
  ------------------
   24|    381|      return false;
   25|      0|    case BLOSC_LZ4 :
  ------------------
  |  Branch (25:5): [True: 0, False: 381]
  ------------------
   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: 381]
  ------------------
   30|      0|    case BLOSC_ZLIB :
  ------------------
  |  Branch (30:5): [True: 0, False: 381]
  ------------------
   31|      0|    case BLOSC_ZSTD :
  ------------------
  |  Branch (31:5): [True: 0, False: 381]
  ------------------
   32|      0|      return true;
   33|      0|    default :
  ------------------
  |  Branch (33:5): [True: 0, False: 381]
  ------------------
   34|       |      return false;
   35|    381|  }
   36|    381|}

blosc2.c:print_error:
  525|     48|static char *print_error(int rc) {
  526|       |  // TODO: remove this function, use blosc2_error_string only
  527|     48|  return (char *) blosc2_error_string(rc);
  528|     48|}
ndcell.c:blosc2_meta_get:
 2447|      5|                                  int32_t *content_len) {
 2448|      5|  if (schunk == NULL || name == NULL || content == NULL || content_len == NULL) {
  ------------------
  |  Branch (2448:7): [True: 4, False: 1]
  |  Branch (2448:25): [True: 0, False: 1]
  |  Branch (2448:41): [True: 0, False: 1]
  |  Branch (2448:60): [True: 0, False: 1]
  ------------------
 2449|      4|    BLOSC_TRACE_ERROR("Invalid parameters.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2450|      4|    return BLOSC2_ERROR_INVALID_PARAM;
 2451|      4|  }
 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|}
ndmean.c:blosc2_meta_get:
 2447|      5|                                  int32_t *content_len) {
 2448|      5|  if (schunk == NULL || name == NULL || content == NULL || content_len == NULL) {
  ------------------
  |  Branch (2448:7): [True: 5, False: 0]
  |  Branch (2448:25): [True: 0, False: 0]
  |  Branch (2448:41): [True: 0, False: 0]
  |  Branch (2448:60): [True: 0, False: 0]
  ------------------
 2449|      5|    BLOSC_TRACE_ERROR("Invalid parameters.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2450|      5|    return BLOSC2_ERROR_INVALID_PARAM;
 2451|      5|  }
 2452|       |
 2453|      0|  int nmetalayer = blosc2_meta_exists(schunk, name);
 2454|      0|  if (nmetalayer < 0) {
  ------------------
  |  Branch (2454:7): [True: 0, False: 0]
  ------------------
 2455|      0|    BLOSC_TRACE_WARNING("Metalayer \"%s\" not found.", name);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2456|      0|    return nmetalayer;
 2457|      0|  }
 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|}
bytedelta.c:print_error:
  525|     30|static char *print_error(int rc) {
  526|       |  // TODO: remove this function, use blosc2_error_string only
  527|     30|  return (char *) blosc2_error_string(rc);
  528|     30|}

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

ndlz_decompress:
   42|    525|                    uint8_t meta, blosc2_dparams *dparams, const void *chunk) {
   43|    525|  NDLZ_ERROR_NULL(input);
  ------------------
  |  |   19|    525|  do {                           \
  |  |   20|    525|    if ((pointer) == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (20:9): [True: 0, False: 525]
  |  |  ------------------
  |  |   21|      0|      return 0;                  \
  |  |   22|      0|    }                            \
  |  |   23|    525|  } while (0)
  |  |  ------------------
  |  |  |  Branch (23:12): [Folded, False: 525]
  |  |  ------------------
  ------------------
   44|    525|  NDLZ_ERROR_NULL(output);
  ------------------
  |  |   19|    525|  do {                           \
  |  |   20|    525|    if ((pointer) == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (20:9): [True: 0, False: 525]
  |  |  ------------------
  |  |   21|      0|      return 0;                  \
  |  |   22|      0|    }                            \
  |  |   23|    525|  } while (0)
  |  |  ------------------
  |  |  |  Branch (23:12): [Folded, False: 525]
  |  |  ------------------
  ------------------
   45|    525|  NDLZ_ERROR_NULL(dparams);
  ------------------
  |  |   19|    525|  do {                           \
  |  |   20|    525|    if ((pointer) == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (20:9): [True: 0, False: 525]
  |  |  ------------------
  |  |   21|      0|      return 0;                  \
  |  |   22|      0|    }                            \
  |  |   23|    525|  } while (0)
  |  |  ------------------
  |  |  |  Branch (23:12): [Folded, False: 525]
  |  |  ------------------
  ------------------
   46|    525|  BLOSC_UNUSED_PARAM(chunk);
  ------------------
  |  |   28|    525|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
   47|       |
   48|    525|  switch (meta) {
   49|    295|    case 4:
  ------------------
  |  Branch (49:5): [True: 295, False: 230]
  ------------------
   50|    295|      return ndlz4_decompress(input, input_len, output, output_len, meta, dparams);
   51|    228|    case 8:
  ------------------
  |  Branch (51:5): [True: 228, False: 297]
  ------------------
   52|    228|      return ndlz8_decompress(input, input_len, output, output_len, meta, dparams);
   53|      2|    default:
  ------------------
  |  Branch (53:5): [True: 2, False: 523]
  ------------------
   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|    525|  }
   56|      2|  return BLOSC2_ERROR_FAILURE;
   57|    525|}

ndlz4_decompress:
  526|    295|                     uint8_t meta, blosc2_dparams *dparams) {
  527|    295|  BLOSC_UNUSED_PARAM(meta);
  ------------------
  |  |   28|    295|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  528|    295|  BLOSC_UNUSED_PARAM(dparams);
  ------------------
  |  |   28|    295|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  529|    295|  BLOSC_ERROR_NULL(input, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    295|    do {                                            \
  |  |  105|    295|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 295]
  |  |  ------------------
  |  |  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|    295|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 295]
  |  |  ------------------
  ------------------
  530|    295|  BLOSC_ERROR_NULL(output, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    295|    do {                                            \
  |  |  105|    295|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 295]
  |  |  ------------------
  |  |  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|    295|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 295]
  |  |  ------------------
  ------------------
  531|       |
  532|    295|  uint8_t *ip = (uint8_t *) input;
  533|    295|  uint8_t *op = (uint8_t *) output;
  534|    295|  uint8_t ndim;
  535|    295|  int32_t blockshape[2];
  536|    295|  int32_t eshape[2];
  537|    295|  uint8_t *buffercpy;
  538|    295|  uint8_t local_buffer[16];
  539|    295|  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|    295|  if (NDLZ_UNEXPECT_CONDITIONAL(input_len < (int32_t) (1 + 2 * sizeof(int32_t)))) {
  ------------------
  |  |   30|    295|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 1, False: 294]
  |  |  ------------------
  ------------------
  546|      1|    return 0;
  547|      1|  }
  548|    294|  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|    294|#define NDLZ4_CHECK_RANGE(pos, len)                                              \
  560|    294|  do {                                                                           \
  561|    294|    int64_t _pos = (int64_t) (pos);                                              \
  562|    294|    int64_t _len = (int64_t) (len);                                              \
  563|    294|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  564|    294|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  565|    294|      return BLOSC2_ERROR_FAILURE;                                               \
  566|    294|    }                                                                            \
  567|    294|  } while (0)
  568|       |
  569|       |  /* we start with literal copy */
  570|    294|  ndim = *ip;
  571|    294|  ip++;
  572|    294|  if (ndim != 2) {
  ------------------
  |  Branch (572:7): [True: 1, False: 293]
  ------------------
  573|      1|    BLOSC_TRACE_ERROR("This codec only works for ndim = 2");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  574|      1|    return BLOSC2_ERROR_FAILURE;
  575|      1|  }
  576|    293|  memcpy(&blockshape[0], ip, 4);
  577|    293|  ip += 4;
  578|    293|  memcpy(&blockshape[1], ip, 4);
  579|    293|  ip += 4;
  580|       |
  581|       |  // Sanity check.  See https://www.cve.org/CVERecord?id=CVE-2024-3204
  582|    293|  if (output_len < 0 || blockshape[0] < 0 || blockshape[1] < 0) {
  ------------------
  |  Branch (582:7): [True: 0, False: 293]
  |  Branch (582:25): [True: 26, False: 267]
  |  Branch (582:46): [True: 18, False: 249]
  ------------------
  583|     44|    BLOSC_TRACE_ERROR("Output length or blockshape is negative");
  ------------------
  |  |   93|     44|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     44|    do {                                            \
  |  |  |  |   98|     44|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     44|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 44, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     44|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  584|     44|    return BLOSC2_ERROR_FAILURE;
  585|     44|  }
  586|       |
  587|    249|  eshape[0] = ((blockshape[0] + 3) / 4) * 4;
  588|    249|  eshape[1] = ((blockshape[1] + 3) / 4) * 4;
  589|       |
  590|    249|  if (NDLZ_UNEXPECT_CONDITIONAL((int64_t)output_len < (int64_t)blockshape[0] * (int64_t)blockshape[1])) {
  ------------------
  |  |   30|    249|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 67, False: 182]
  |  |  ------------------
  ------------------
  591|     67|    BLOSC_TRACE_ERROR("The blockshape is bigger than the output buffer");
  ------------------
  |  |   93|     67|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     67|    do {                                            \
  |  |  |  |   98|     67|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     67|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 67, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     67|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  592|     67|    return 0;
  593|     67|  }
  594|    182|  memset(op, 0, blockshape[0] * blockshape[1]);
  595|       |
  596|    182|  uint32_t i_stop[2];
  597|    546|  for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (597:19): [True: 364, False: 182]
  ------------------
  598|    364|    i_stop[i] = eshape[i] / 4;
  599|    364|  }
  600|       |
  601|       |  /* main loop */
  602|    182|  uint32_t ii[2];
  603|    182|  uint32_t padding[2] = {0};
  604|    182|  uint32_t ind = 0;
  605|    182|  uint8_t cell_aux[16];
  606|  1.42G|  for (ii[0] = 0; ii[0] < i_stop[0]; ++ii[0]) {
  ------------------
  |  Branch (606:19): [True: 1.42G, False: 27]
  ------------------
  607|  1.42G|    for (ii[1] = 0; ii[1] < i_stop[1]; ++ii[1]) {      // for each cell
  ------------------
  |  Branch (607:21): [True: 1.95k, False: 1.42G]
  ------------------
  608|  1.95k|      if (NDLZ_UNEXPECT_CONDITIONAL(ip > ip_limit)) {
  ------------------
  |  |   30|  1.95k|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 0, False: 1.95k]
  |  |  ------------------
  ------------------
  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.95k|      if (ii[0] == i_stop[0] - 1) {
  ------------------
  |  Branch (612:11): [True: 396, False: 1.55k]
  ------------------
  613|    396|        padding[0] = (blockshape[0] % 4 == 0) ? 4 : blockshape[0] % 4;
  ------------------
  |  Branch (613:22): [True: 49, False: 347]
  ------------------
  614|  1.55k|      } else {
  615|  1.55k|        padding[0] = 4;
  616|  1.55k|      }
  617|  1.95k|      if (ii[1] == i_stop[1] - 1) {
  ------------------
  |  Branch (617:11): [True: 1.53k, False: 420]
  ------------------
  618|  1.53k|        padding[1] = (blockshape[1] % 4 == 0) ? 4 : blockshape[1] % 4;
  ------------------
  |  Branch (618:22): [True: 47, False: 1.48k]
  ------------------
  619|  1.53k|      } else {
  620|    420|        padding[1] = 4;
  621|    420|      }
  622|  1.95k|      int64_t cur = ip - (const uint8_t *) input;   // in-range: ip is within [input, ip_limit]
  623|  1.95k|      NDLZ4_CHECK_RANGE(cur, 1);
  ------------------
  |  |  560|  1.95k|  do {                                                                           \
  |  |  561|  1.95k|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|  1.95k|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|  1.95k|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 1.95k]
  |  |  |  Branch (563:21): [True: 0, False: 1.95k]
  |  |  |  Branch (563:33): [True: 2, False: 1.94k]
  |  |  ------------------
  |  |  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|  1.95k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 1.94k]
  |  |  ------------------
  ------------------
  624|  1.94k|      token = *ip++;
  625|  1.94k|      if (token == 0) {    // no match
  ------------------
  |  Branch (625:11): [True: 945, False: 1.00k]
  ------------------
  626|    945|        NDLZ4_CHECK_RANGE(cur + 1, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  560|    945|  do {                                                                           \
  |  |  561|    945|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    945|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    945|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 945]
  |  |  |  Branch (563:21): [True: 0, False: 945]
  |  |  |  Branch (563:33): [True: 3, False: 942]
  |  |  ------------------
  |  |  564|      3|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      3|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      3|    do {                                            \
  |  |  |  |  |  |   98|      3|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      3|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 3, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      3|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      3|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      3|    }                                                                            \
  |  |  567|    945|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 942]
  |  |  ------------------
  ------------------
  627|    942|        buffercpy = ip;
  628|    942|        ip += padding[0] * padding[1];
  629|  1.00k|      } else if (token == (uint8_t) ((1U << 7U) | (1U << 6U))) {  // cell match
  ------------------
  |  Branch (629:18): [True: 114, False: 890]
  ------------------
  630|    114|        NDLZ4_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  560|    114|  do {                                                                           \
  |  |  561|    114|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    114|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    114|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 114]
  |  |  |  Branch (563:21): [True: 0, False: 114]
  |  |  |  Branch (563:33): [True: 1, False: 113]
  |  |  ------------------
  |  |  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|    114|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 113]
  |  |  ------------------
  ------------------
  631|    113|        uint16_t offset;
  632|    113|        memcpy(&offset, ip, sizeof(offset));
  633|    113|        int64_t bpos = (cur + 1) - (int64_t) offset - 1;   // back-reference start offset
  634|    113|        NDLZ4_CHECK_RANGE(bpos, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  560|    113|  do {                                                                           \
  |  |  561|    113|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    113|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    113|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 17, False: 96]
  |  |  |  Branch (563:21): [True: 0, False: 96]
  |  |  |  Branch (563:33): [True: 1, False: 95]
  |  |  ------------------
  |  |  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|    113|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 95]
  |  |  ------------------
  ------------------
  635|     95|        buffercpy = (uint8_t *) input + bpos;
  636|     95|        ip += 2;
  637|    890|      } else if (token == (uint8_t) (1U << 6U)) { // whole cell of same element
  ------------------
  |  Branch (637:18): [True: 94, False: 796]
  ------------------
  638|     94|        NDLZ4_CHECK_RANGE(cur + 1, 1);
  ------------------
  |  |  560|     94|  do {                                                                           \
  |  |  561|     94|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|     94|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|     94|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 94]
  |  |  |  Branch (563:21): [True: 0, False: 94]
  |  |  |  Branch (563:33): [True: 1, False: 93]
  |  |  ------------------
  |  |  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|     94|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 93]
  |  |  ------------------
  ------------------
  639|     93|        buffercpy = cell_aux;
  640|     93|        memset(buffercpy, *ip, 16);
  641|     93|        ip++;
  642|    796|      } else if (token >= 224) { // three rows match
  ------------------
  |  Branch (642:18): [True: 257, False: 539]
  ------------------
  643|    257|        buffercpy = local_buffer;
  644|    257|        NDLZ4_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  560|    257|  do {                                                                           \
  |  |  561|    257|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    257|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    257|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 257]
  |  |  |  Branch (563:21): [True: 0, False: 257]
  |  |  |  Branch (563:33): [True: 2, False: 255]
  |  |  ------------------
  |  |  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|    257|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 255]
  |  |  ------------------
  ------------------
  645|    255|        uint16_t offset;
  646|    255|        memcpy(&offset, ip, sizeof(offset));
  647|    255|        offset += 3;
  648|    255|        ip += 2;
  649|    255|        int i, j, k;
  650|    255|        if ((token >> 3U) == 28) {
  ------------------
  |  Branch (650:13): [True: 17, False: 238]
  ------------------
  651|     17|          i = 1;
  652|     17|          j = 2;
  653|     17|          k = 3;
  654|    238|        } else {
  655|    238|          i = 0;
  656|    238|          if ((token >> 3U) < 30) {
  ------------------
  |  Branch (656:15): [True: 37, False: 201]
  ------------------
  657|     37|            j = 1;
  658|     37|            k = 2;
  659|    201|          } else {
  660|    201|            k = 3;
  661|    201|            if ((token >> 3U) == 30) {
  ------------------
  |  Branch (661:17): [True: 44, False: 157]
  ------------------
  662|     44|              j = 1;
  663|    157|            } else {
  664|    157|              j = 2;
  665|    157|            }
  666|    201|          }
  667|    238|        }
  668|    255|        int64_t bpos = (cur + 3) - (int64_t) offset;   // == (ip - offset) as an offset
  669|    255|        NDLZ4_CHECK_RANGE(bpos, 12);
  ------------------
  |  |  560|    255|  do {                                                                           \
  |  |  561|    255|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    255|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    255|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 18, False: 237]
  |  |  |  Branch (563:21): [True: 0, False: 237]
  |  |  |  Branch (563:33): [True: 3, False: 234]
  |  |  ------------------
  |  |  564|     21|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|     21|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|     21|    do {                                            \
  |  |  |  |  |  |   98|     21|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|     21|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 21, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|     21|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|     21|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|     21|    }                                                                            \
  |  |  567|    255|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 234]
  |  |  ------------------
  ------------------
  670|    234|        const uint8_t *ref = (const uint8_t *) input + bpos;
  671|    234|        memcpy(&buffercpy[i * 4], ref, 4);
  672|    234|        memcpy(&buffercpy[j * 4], ref + 4, 4);
  673|    234|        memcpy(&buffercpy[k * 4], ref + 8, 4);
  674|    568|        for (int l = 0; l < 4; l++) {
  ------------------
  |  Branch (674:25): [True: 568, False: 0]
  ------------------
  675|    568|          if ((l != i) && (l != j) && (l != k)) {
  ------------------
  |  Branch (675:15): [True: 349, False: 219]
  |  Branch (675:27): [True: 271, False: 78]
  |  Branch (675:39): [True: 234, False: 37]
  ------------------
  676|    234|            NDLZ4_CHECK_RANGE(ip - (const uint8_t *) input, 4);
  ------------------
  |  |  560|    234|  do {                                                                           \
  |  |  561|    234|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    234|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    234|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 234]
  |  |  |  Branch (563:21): [True: 0, False: 234]
  |  |  |  Branch (563:33): [True: 2, False: 232]
  |  |  ------------------
  |  |  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|    234|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 232]
  |  |  ------------------
  ------------------
  677|    232|            memcpy(&buffercpy[l * 4], ip, 4);
  678|    232|            ip += 4;
  679|    232|            break;
  680|    234|          }
  681|    568|        }
  682|       |
  683|    539|      } else if ((token >= 128) && (token <= 191)) { // rows pair match
  ------------------
  |  Branch (683:18): [True: 403, False: 136]
  |  Branch (683:36): [True: 400, False: 3]
  ------------------
  684|    400|        buffercpy = local_buffer;
  685|    400|        NDLZ4_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  560|    400|  do {                                                                           \
  |  |  561|    400|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    400|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    400|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 400]
  |  |  |  Branch (563:21): [True: 0, False: 400]
  |  |  |  Branch (563:33): [True: 1, False: 399]
  |  |  ------------------
  |  |  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|    400|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 399]
  |  |  ------------------
  ------------------
  686|    399|        uint16_t offset;
  687|    399|        memcpy(&offset, ip, sizeof(offset));
  688|    399|        offset += 3;
  689|    399|        ip += 2;
  690|    399|        int i, j;
  691|    399|        if (token == 128) {
  ------------------
  |  Branch (691:13): [True: 79, False: 320]
  ------------------
  692|     79|          i = 2;
  693|     79|          j = 3;
  694|    320|        } else {
  695|    320|          i = (token - 128) >> 5U;
  696|    320|          j = ((token - 128) >> 3U) - (i << 2U);
  697|    320|        }
  698|    399|        int64_t bpos = (cur + 3) - (int64_t) offset;
  699|    399|        NDLZ4_CHECK_RANGE(bpos, 8);
  ------------------
  |  |  560|    399|  do {                                                                           \
  |  |  561|    399|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    399|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    399|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 26, False: 373]
  |  |  |  Branch (563:21): [True: 0, False: 373]
  |  |  |  Branch (563:33): [True: 1, False: 372]
  |  |  ------------------
  |  |  564|     27|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|     27|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|     27|    }                                                                            \
  |  |  567|    399|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 372]
  |  |  ------------------
  ------------------
  700|    372|        const uint8_t *ref = (const uint8_t *) input + bpos;
  701|    372|        memcpy(&buffercpy[i * 4], ref, 4);
  702|    372|        memcpy(&buffercpy[j * 4], ref + 4, 4);
  703|  1.85k|        for (int k = 0; k < 4; k++) {
  ------------------
  |  Branch (703:25): [True: 1.48k, False: 368]
  ------------------
  704|  1.48k|          if ((k != i) && (k != j)) {
  ------------------
  |  Branch (704:15): [True: 1.11k, False: 370]
  |  Branch (704:27): [True: 838, False: 274]
  ------------------
  705|    838|            NDLZ4_CHECK_RANGE(ip - (const uint8_t *) input, 4);
  ------------------
  |  |  560|    838|  do {                                                                           \
  |  |  561|    838|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    838|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    838|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 838]
  |  |  |  Branch (563:21): [True: 0, False: 838]
  |  |  |  Branch (563:33): [True: 4, False: 834]
  |  |  ------------------
  |  |  564|      4|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      4|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      4|    }                                                                            \
  |  |  567|    838|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 834]
  |  |  ------------------
  ------------------
  706|    834|            memcpy(&buffercpy[k * 4], ip, 4);
  707|    834|            ip += 4;
  708|    834|          }
  709|  1.48k|        }
  710|    372|      } else if ((token >= 40) && (token <= 63)) {  // 2 rows pair matches
  ------------------
  |  Branch (710:18): [True: 124, False: 15]
  |  Branch (710:35): [True: 113, False: 11]
  ------------------
  711|    113|        buffercpy = local_buffer;
  712|    113|        NDLZ4_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  560|    113|  do {                                                                           \
  |  |  561|    113|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    113|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    113|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 113]
  |  |  |  Branch (563:21): [True: 0, False: 113]
  |  |  |  Branch (563:33): [True: 1, False: 112]
  |  |  ------------------
  |  |  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|    113|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 112]
  |  |  ------------------
  ------------------
  713|    112|        uint16_t offset_1;
  714|    112|        memcpy(&offset_1, ip, sizeof(offset_1));
  715|    112|        offset_1 += 5;
  716|    112|        ip += 2;
  717|    112|        NDLZ4_CHECK_RANGE(cur + 3, 2);
  ------------------
  |  |  560|    112|  do {                                                                           \
  |  |  561|    112|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    112|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    112|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 112]
  |  |  |  Branch (563:21): [True: 0, False: 112]
  |  |  |  Branch (563:33): [True: 1, False: 111]
  |  |  ------------------
  |  |  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|    112|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 111]
  |  |  ------------------
  ------------------
  718|    111|        uint16_t offset_2;
  719|    111|        memcpy(&offset_2, ip, sizeof(offset_2));
  720|    111|        offset_2 += 5;
  721|    111|        ip += 2;
  722|    111|        int i, j, k, l, m;
  723|    111|        i = 0;
  724|    111|        j = ((token - 32) >> 3U);
  725|    111|        l = -1;
  726|    444|        for (k = 1; k < 4; k++) {
  ------------------
  |  Branch (726:21): [True: 333, False: 111]
  ------------------
  727|    333|          if ((k != i) && (k != j)) {
  ------------------
  |  Branch (727:15): [True: 333, False: 0]
  |  Branch (727:27): [True: 222, False: 111]
  ------------------
  728|    222|            if (l == -1) {
  ------------------
  |  Branch (728:17): [True: 111, False: 111]
  ------------------
  729|    111|              l = k;
  730|    111|            } else {
  731|    111|              m = k;
  732|    111|            }
  733|    222|          }
  734|    333|        }
  735|    111|        int64_t bpos1 = (cur + 5) - (int64_t) offset_1;
  736|    111|        NDLZ4_CHECK_RANGE(bpos1, 8);
  ------------------
  |  |  560|    111|  do {                                                                           \
  |  |  561|    111|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    111|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    111|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 26, False: 85]
  |  |  |  Branch (563:21): [True: 0, False: 85]
  |  |  |  Branch (563:33): [True: 1, False: 84]
  |  |  ------------------
  |  |  564|     27|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|     27|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|     27|    }                                                                            \
  |  |  567|    111|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 84]
  |  |  ------------------
  ------------------
  737|     84|        const uint8_t *ref1 = (const uint8_t *) input + bpos1;
  738|     84|        memcpy(&buffercpy[i * 4], ref1, 4);
  739|     84|        memcpy(&buffercpy[j * 4], ref1 + 4, 4);
  740|     84|        int64_t bpos2 = (cur + 5) - (int64_t) offset_2;
  741|     84|        NDLZ4_CHECK_RANGE(bpos2, 8);
  ------------------
  |  |  560|     84|  do {                                                                           \
  |  |  561|     84|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|     84|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|     84|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 17, False: 67]
  |  |  |  Branch (563:21): [True: 0, False: 67]
  |  |  |  Branch (563:33): [True: 1, False: 66]
  |  |  ------------------
  |  |  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|     84|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 66]
  |  |  ------------------
  ------------------
  742|     66|        const uint8_t *ref2 = (const uint8_t *) input + bpos2;
  743|     66|        memcpy(&buffercpy[l * 4], ref2, 4);
  744|     66|        memcpy(&buffercpy[m * 4], ref2 + 4, 4);
  745|       |
  746|     66|      } else {
  747|     26|        BLOSC_TRACE_ERROR("Invalid token: %u at cell [%d, %d]\n", token, ii[0], ii[1]);
  ------------------
  |  |   93|     26|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     26|    do {                                            \
  |  |  |  |   98|     26|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     26|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 26, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     26|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  748|     26|        return BLOSC2_ERROR_FAILURE;
  749|     26|      }
  750|       |      // fill op with buffercpy
  751|  1.79k|      uint32_t orig = ii[0] * 4 * blockshape[1] + ii[1] * 4;
  752|  8.98k|      for (uint32_t i = 0; i < 4; i++) {
  ------------------
  |  Branch (752:28): [True: 7.18k, False: 1.79k]
  ------------------
  753|  7.18k|        if (i < padding[0]) {
  ------------------
  |  Branch (753:13): [True: 6.47k, False: 711]
  ------------------
  754|  6.47k|          ind = orig + i * blockshape[1];
  755|  6.47k|          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|  6.47k|          buffercpy += padding[1];
  762|  6.47k|        }
  763|  7.18k|      }
  764|  1.79k|      if (ind > (uint32_t) output_len) {
  ------------------
  |  Branch (764:11): [True: 0, False: 1.79k]
  ------------------
  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.79k|    }
  769|  1.42G|  }
  770|     27|  ind += padding[1];
  771|       |
  772|     27|  if ((int32_t)ind != (blockshape[0] * blockshape[1])) {
  ------------------
  |  Branch (772:7): [True: 0, False: 27]
  ------------------
  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|     27|  if (ind > (uint32_t) output_len) {
  ------------------
  |  Branch (776:7): [True: 0, False: 27]
  ------------------
  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|     27|  return (int) ind;
  782|     27|#undef NDLZ4_CHECK_RANGE
  783|     27|}

ndlz8_decompress:
  444|    228|                     uint8_t meta, blosc2_dparams *dparams) {
  445|    228|  BLOSC_UNUSED_PARAM(meta);
  ------------------
  |  |   28|    228|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  446|    228|  BLOSC_UNUSED_PARAM(dparams);
  ------------------
  |  |   28|    228|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  447|    228|  BLOSC_ERROR_NULL(input, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    228|    do {                                            \
  |  |  105|    228|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 228]
  |  |  ------------------
  |  |  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|    228|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 228]
  |  |  ------------------
  ------------------
  448|    228|  BLOSC_ERROR_NULL(output, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    228|    do {                                            \
  |  |  105|    228|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 228]
  |  |  ------------------
  |  |  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|    228|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 228]
  |  |  ------------------
  ------------------
  449|       |
  450|    228|  const int cell_shape = 8;
  451|    228|  const int cell_size = 64;
  452|    228|  uint8_t *ip = (uint8_t *) input;
  453|    228|  uint8_t *op = (uint8_t *) output;
  454|    228|  uint8_t ndim;
  455|    228|  int32_t blockshape[2];
  456|    228|  int32_t eshape[2];
  457|    228|  uint8_t *buffercpy;
  458|    228|  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|    228|  if (NDLZ_UNEXPECT_CONDITIONAL(input_len < (int32_t) (1 + 2 * sizeof(int32_t)))) {
  ------------------
  |  |   30|    228|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 1, False: 227]
  |  |  ------------------
  ------------------
  465|      1|    return 0;
  466|      1|  }
  467|    227|  uint8_t *ip_limit = ip + input_len;
  468|       |
  469|       |  /* we start with literal copy */
  470|    227|  ndim = *ip;
  471|    227|  ip++;
  472|    227|  if (ndim != 2) {
  ------------------
  |  Branch (472:7): [True: 1, False: 226]
  ------------------
  473|      1|    BLOSC_TRACE_ERROR("This codec only works for ndim = 2");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  474|      1|    return BLOSC2_ERROR_FAILURE;
  475|      1|  }
  476|    226|  memcpy(&blockshape[0], ip, 4);
  477|    226|  ip += 4;
  478|    226|  memcpy(&blockshape[1], ip, 4);
  479|    226|  ip += 4;
  480|       |
  481|       |  // Sanity check.  See https://www.cve.org/CVERecord?id=CVE-2024-3203
  482|    226|  if (output_len < 0 || blockshape[0] < 0 || blockshape[1] < 0) {
  ------------------
  |  Branch (482:7): [True: 0, False: 226]
  |  Branch (482:25): [True: 19, False: 207]
  |  Branch (482:46): [True: 15, False: 192]
  ------------------
  483|     34|    BLOSC_TRACE_ERROR("Output length or blockshape is negative");
  ------------------
  |  |   93|     34|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     34|    do {                                            \
  |  |  |  |   98|     34|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     34|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 34, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     34|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  484|     34|    return BLOSC2_ERROR_FAILURE;
  485|     34|  }
  486|       |
  487|    192|  eshape[0] = ((blockshape[0] + 7) / cell_shape) * cell_shape;
  488|    192|  eshape[1] = ((blockshape[1] + 7) / cell_shape) * cell_shape;
  489|       |
  490|    192|  if (NDLZ_UNEXPECT_CONDITIONAL((int64_t)output_len < (int64_t)blockshape[0] * (int64_t)blockshape[1])) {
  ------------------
  |  |   30|    192|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 36, False: 156]
  |  |  ------------------
  ------------------
  491|     36|    BLOSC_TRACE_ERROR("The blockshape is bigger than the output buffer");
  ------------------
  |  |   93|     36|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     36|    do {                                            \
  |  |  |  |   98|     36|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     36|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 36, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     36|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  492|     36|    return 0;
  493|     36|  }
  494|    156|  memset(op, 0, blockshape[0] * blockshape[1]);
  495|       |
  496|    156|  int32_t i_stop[2];
  497|    468|  for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (497:19): [True: 312, False: 156]
  ------------------
  498|    312|    i_stop[i] = eshape[i] / cell_shape;
  499|    312|  }
  500|       |
  501|       |  /* main loop */
  502|    156|  int32_t ii[2];
  503|    156|  int32_t padding[2] = {0};
  504|    156|  int32_t ind = 0;
  505|    156|  uint8_t *local_buffer = malloc(cell_size);
  506|    156|  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|    156|#define NDLZ8_CHECK_RANGE(pos, len)                                              \
  518|    156|  do {                                                                           \
  519|    156|    int64_t _pos = (int64_t) (pos);                                              \
  520|    156|    int64_t _len = (int64_t) (len);                                              \
  521|    156|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  522|    156|      free(local_buffer);                                                        \
  523|    156|      free(cell_aux);                                                            \
  524|    156|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  525|    156|      return BLOSC2_ERROR_FAILURE;                                               \
  526|    156|    }                                                                            \
  527|    156|  } while (0)
  528|       |
  529|  1.49G|  for (ii[0] = 0; ii[0] < i_stop[0]; ++ii[0]) {
  ------------------
  |  Branch (529:19): [True: 1.49G, False: 18]
  ------------------
  530|  1.49G|    for (ii[1] = 0; ii[1] < i_stop[1]; ++ii[1]) {      // for each cell
  ------------------
  |  Branch (530:21): [True: 1.00k, False: 1.49G]
  ------------------
  531|  1.00k|      if (NDLZ_UNEXPECT_CONDITIONAL(ip > ip_limit)) {
  ------------------
  |  |   30|  1.00k|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 0, False: 1.00k]
  |  |  ------------------
  ------------------
  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.00k|      if (ii[0] == i_stop[0] - 1) {
  ------------------
  |  Branch (537:11): [True: 840, False: 164]
  ------------------
  538|    840|        padding[0] = (blockshape[0] % cell_shape == 0) ? cell_shape : blockshape[0] % cell_shape;
  ------------------
  |  Branch (538:22): [True: 6, False: 834]
  ------------------
  539|    840|      } else {
  540|    164|        padding[0] = cell_shape;
  541|    164|      }
  542|  1.00k|      if (ii[1] == i_stop[1] - 1) {
  ------------------
  |  Branch (542:11): [True: 115, False: 889]
  ------------------
  543|    115|        padding[1] = (blockshape[1] % cell_shape == 0) ? cell_shape : blockshape[1] % cell_shape;
  ------------------
  |  Branch (543:22): [True: 64, False: 51]
  ------------------
  544|    889|      } else {
  545|    889|        padding[1] = cell_shape;
  546|    889|      }
  547|  1.00k|      int64_t cur = ip - (const uint8_t *) input;   // in-range: ip is within [input, ip_limit]
  548|  1.00k|      NDLZ8_CHECK_RANGE(cur, 1);
  ------------------
  |  |  518|  1.00k|  do {                                                                           \
  |  |  519|  1.00k|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|  1.00k|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|  1.00k|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 1.00k]
  |  |  |  Branch (521:21): [True: 0, False: 1.00k]
  |  |  |  Branch (521:33): [True: 6, False: 998]
  |  |  ------------------
  |  |  522|      6|      free(local_buffer);                                                        \
  |  |  523|      6|      free(cell_aux);                                                            \
  |  |  524|      6|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      6|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      6|    do {                                            \
  |  |  |  |  |  |   98|      6|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      6|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 6, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      6|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      6|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      6|    }                                                                            \
  |  |  527|  1.00k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 998]
  |  |  ------------------
  ------------------
  549|    998|      token = *ip++;
  550|    998|      uint8_t match_type = (token >> 3U);
  551|    998|      if (token == 0) {    // no match
  ------------------
  |  Branch (551:11): [True: 215, False: 783]
  ------------------
  552|    215|        NDLZ8_CHECK_RANGE(cur + 1, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  518|    215|  do {                                                                           \
  |  |  519|    215|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    215|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    215|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 215]
  |  |  |  Branch (521:21): [True: 0, False: 215]
  |  |  |  Branch (521:33): [True: 3, False: 212]
  |  |  ------------------
  |  |  522|      3|      free(local_buffer);                                                        \
  |  |  523|      3|      free(cell_aux);                                                            \
  |  |  524|      3|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      3|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      3|    do {                                            \
  |  |  |  |  |  |   98|      3|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      3|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 3, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      3|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      3|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      3|    }                                                                            \
  |  |  527|    215|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 212]
  |  |  ------------------
  ------------------
  553|    212|        buffercpy = ip;
  554|    212|        ip += padding[0] * padding[1];
  555|    783|      } else if (token == (uint8_t) ((1U << 7U) | (1U << 6U))) {  // cell match
  ------------------
  |  Branch (555:18): [True: 23, False: 760]
  ------------------
  556|     23|        NDLZ8_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  518|     23|  do {                                                                           \
  |  |  519|     23|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     23|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     23|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 23]
  |  |  |  Branch (521:21): [True: 0, False: 23]
  |  |  |  Branch (521:33): [True: 1, False: 22]
  |  |  ------------------
  |  |  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|     23|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 22]
  |  |  ------------------
  ------------------
  557|     22|        uint16_t offset;
  558|     22|        memcpy(&offset, ip, sizeof(offset));
  559|     22|        int64_t bpos = (cur + 1) - (int64_t) offset - 1;
  560|     22|        NDLZ8_CHECK_RANGE(bpos, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  518|     22|  do {                                                                           \
  |  |  519|     22|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     22|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     22|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 16, False: 6]
  |  |  |  Branch (521:21): [True: 0, False: 6]
  |  |  |  Branch (521:33): [True: 2, False: 4]
  |  |  ------------------
  |  |  522|     18|      free(local_buffer);                                                        \
  |  |  523|     18|      free(cell_aux);                                                            \
  |  |  524|     18|      BLOSC_TRACE_ERROR("ndlz8: 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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|     18|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|     18|    }                                                                            \
  |  |  527|     22|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 4]
  |  |  ------------------
  ------------------
  561|      4|        buffercpy = (uint8_t *) input + bpos;
  562|      4|        ip += 2;
  563|    760|      } else if (token == (uint8_t) (1U << 6U)) { // whole cell of same element
  ------------------
  |  Branch (563:18): [True: 534, False: 226]
  ------------------
  564|    534|        NDLZ8_CHECK_RANGE(cur + 1, 1);
  ------------------
  |  |  518|    534|  do {                                                                           \
  |  |  519|    534|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    534|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    534|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 534]
  |  |  |  Branch (521:21): [True: 0, False: 534]
  |  |  |  Branch (521:33): [True: 1, False: 533]
  |  |  ------------------
  |  |  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|    534|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 533]
  |  |  ------------------
  ------------------
  565|    533|        buffercpy = cell_aux;
  566|    533|        memset(buffercpy, *ip, cell_size);
  567|    533|        ip++;
  568|    533|      } else if (match_type == 21) {    // triple match
  ------------------
  |  Branch (568:18): [True: 81, False: 145]
  ------------------
  569|     81|        buffercpy = local_buffer;
  570|     81|        int row = (int) (token & 7);
  571|     81|        if (row + 2 >= cell_shape) {
  ------------------
  |  Branch (571:13): [True: 1, False: 80]
  ------------------
  572|      1|          free(local_buffer);
  573|      1|          free(cell_aux);
  574|      1|          BLOSC_TRACE_ERROR("Triple match row out of bounds");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  575|      1|          return BLOSC2_ERROR_FAILURE;
  576|      1|        }
  577|     80|        NDLZ8_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  518|     80|  do {                                                                           \
  |  |  519|     80|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     80|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     80|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 80]
  |  |  |  Branch (521:21): [True: 0, False: 80]
  |  |  |  Branch (521:33): [True: 1, False: 79]
  |  |  ------------------
  |  |  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|     80|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 79]
  |  |  ------------------
  ------------------
  578|     79|        uint16_t offset;
  579|     79|        memcpy(&offset, ip, sizeof(offset));
  580|     79|        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|     79|        int64_t bpos = cur - (int64_t) offset;
  584|     79|        NDLZ8_CHECK_RANGE(bpos, 3 * cell_shape);
  ------------------
  |  |  518|     79|  do {                                                                           \
  |  |  519|     79|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     79|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     79|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 17, False: 62]
  |  |  |  Branch (521:21): [True: 0, False: 62]
  |  |  |  Branch (521:33): [True: 1, False: 61]
  |  |  ------------------
  |  |  522|     18|      free(local_buffer);                                                        \
  |  |  523|     18|      free(cell_aux);                                                            \
  |  |  524|     18|      BLOSC_TRACE_ERROR("ndlz8: 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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|     18|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|     18|    }                                                                            \
  |  |  527|     79|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 61]
  |  |  ------------------
  ------------------
  585|     61|        const uint8_t *ref = (const uint8_t *) input + bpos;
  586|    244|        for (int l = 0; l < 3; l++) {
  ------------------
  |  Branch (586:25): [True: 183, False: 61]
  ------------------
  587|    183|          memcpy(&buffercpy[(row + l) * cell_shape], ref + l * cell_shape, cell_shape);
  588|    183|        }
  589|    520|        for (int l = 0; l < cell_shape; l++) {
  ------------------
  |  Branch (589:25): [True: 467, False: 53]
  ------------------
  590|    467|          if ((l < row) || (l > row + 2)) {
  ------------------
  |  Branch (590:15): [True: 221, False: 246]
  |  Branch (590:28): [True: 75, False: 171]
  ------------------
  591|    296|            NDLZ8_CHECK_RANGE(ip - (const uint8_t *) input, cell_shape);
  ------------------
  |  |  518|    296|  do {                                                                           \
  |  |  519|    296|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    296|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    296|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 296]
  |  |  |  Branch (521:21): [True: 0, False: 296]
  |  |  |  Branch (521:33): [True: 8, False: 288]
  |  |  ------------------
  |  |  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|    296|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 288]
  |  |  ------------------
  ------------------
  592|    288|            memcpy(&buffercpy[l * cell_shape], ip, cell_shape);
  593|    288|            ip += cell_shape;
  594|    288|          }
  595|    467|        }
  596|    145|      } else if (match_type == 17) {    // pair match
  ------------------
  |  Branch (596:18): [True: 97, False: 48]
  ------------------
  597|     97|        buffercpy = local_buffer;
  598|     97|        int row = (int) (token & 7);
  599|     97|        if (row + 1 >= cell_shape) {
  ------------------
  |  Branch (599:13): [True: 1, False: 96]
  ------------------
  600|      1|          free(local_buffer);
  601|      1|          free(cell_aux);
  602|      1|          BLOSC_TRACE_ERROR("Pair match row out of bounds");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  603|      1|          return BLOSC2_ERROR_FAILURE;
  604|      1|        }
  605|     96|        NDLZ8_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  518|     96|  do {                                                                           \
  |  |  519|     96|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     96|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     96|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 96]
  |  |  |  Branch (521:21): [True: 0, False: 96]
  |  |  |  Branch (521:33): [True: 1, False: 95]
  |  |  ------------------
  |  |  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|     96|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 95]
  |  |  ------------------
  ------------------
  606|     95|        uint16_t offset;
  607|     95|        memcpy(&offset, ip, sizeof(offset));
  608|     95|        ip += 2;
  609|       |        // back-reference base == cur - offset (see triple-match note above).
  610|     95|        int64_t bpos = cur - (int64_t) offset;
  611|     95|        NDLZ8_CHECK_RANGE(bpos, 2 * cell_shape);
  ------------------
  |  |  518|     95|  do {                                                                           \
  |  |  519|     95|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     95|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     95|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 19, False: 76]
  |  |  |  Branch (521:21): [True: 0, False: 76]
  |  |  |  Branch (521:33): [True: 2, False: 74]
  |  |  ------------------
  |  |  522|     21|      free(local_buffer);                                                        \
  |  |  523|     21|      free(cell_aux);                                                            \
  |  |  524|     21|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|     21|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|     21|    do {                                            \
  |  |  |  |  |  |   98|     21|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|     21|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 21, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|     21|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|     21|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|     21|    }                                                                            \
  |  |  527|     95|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 74]
  |  |  ------------------
  ------------------
  612|     74|        const uint8_t *ref = (const uint8_t *) input + bpos;
  613|    222|        for (int l = 0; l < 2; l++) {
  ------------------
  |  Branch (613:25): [True: 148, False: 74]
  ------------------
  614|    148|          memcpy(&buffercpy[(row + l) * cell_shape], ref + l * cell_shape, cell_shape);
  615|    148|        }
  616|    625|        for (int l = 0; l < cell_shape; l++) {
  ------------------
  |  Branch (616:25): [True: 561, False: 64]
  ------------------
  617|    561|          if ((l < row) || (l > row + 1)) {
  ------------------
  |  Branch (617:15): [True: 278, False: 283]
  |  Branch (617:28): [True: 143, False: 140]
  ------------------
  618|    421|            NDLZ8_CHECK_RANGE(ip - (const uint8_t *) input, cell_shape);
  ------------------
  |  |  518|    421|  do {                                                                           \
  |  |  519|    421|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    421|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    421|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 421]
  |  |  |  Branch (521:21): [True: 0, False: 421]
  |  |  |  Branch (521:33): [True: 10, False: 411]
  |  |  ------------------
  |  |  522|     10|      free(local_buffer);                                                        \
  |  |  523|     10|      free(cell_aux);                                                            \
  |  |  524|     10|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|     10|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|     10|    do {                                            \
  |  |  |  |  |  |   98|     10|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|     10|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 10, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|     10|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|     10|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|     10|    }                                                                            \
  |  |  527|    421|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 411]
  |  |  ------------------
  ------------------
  619|    411|            memcpy(&buffercpy[l * cell_shape], ip, cell_shape);
  620|    411|            ip += cell_shape;
  621|    411|          }
  622|    561|        }
  623|     74|      } else {
  624|     48|        free(local_buffer);
  625|     48|        free(cell_aux);
  626|     48|        BLOSC_TRACE_ERROR("Invalid token: %u at cell [%d, %d]\n", token, ii[0], ii[1]);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  627|     48|        return BLOSC2_ERROR_FAILURE;
  628|     48|      }
  629|       |
  630|    866|      int32_t orig = ii[0] * cell_shape * blockshape[1] + ii[1] * cell_shape;
  631|  7.79k|      for (int32_t i = 0; i < (int32_t) cell_shape; i++) {
  ------------------
  |  Branch (631:27): [True: 6.92k, False: 866]
  ------------------
  632|  6.92k|        if (i < padding[0]) {
  ------------------
  |  Branch (632:13): [True: 3.33k, False: 3.59k]
  ------------------
  633|  3.33k|          ind = orig + i * blockshape[1];
  634|  3.33k|          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.33k|          buffercpy += padding[1];
  641|  3.33k|        }
  642|  6.92k|      }
  643|    866|      if (ind > output_len) {
  ------------------
  |  Branch (643:11): [True: 0, False: 866]
  ------------------
  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|    866|    }
  650|  1.49G|  }
  651|     18|  ind += padding[1];
  652|       |
  653|     18|  free(cell_aux);
  654|     18|  free(local_buffer);
  655|       |
  656|     18|  if (ind != (blockshape[0] * blockshape[1])) {
  ------------------
  |  Branch (656:7): [True: 0, False: 18]
  ------------------
  657|      0|    BLOSC_TRACE_ERROR("Output size is not compatible with embedded blockshape");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  658|      0|    return BLOSC2_ERROR_FAILURE;
  659|      0|  }
  660|     18|  if (ind > output_len) {
  ------------------
  |  Branch (660:7): [True: 0, False: 18]
  ------------------
  661|      0|    BLOSC_TRACE_ERROR("Exceeding output size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  662|      0|    return BLOSC2_ERROR_FAILURE;
  663|      0|  }
  664|       |
  665|     18|  return (int) ind;
  666|     18|#undef NDLZ8_CHECK_RANGE
  667|     18|}

zfp_acc_decompress:
  233|      1|                       int32_t output_len, uint8_t meta, blosc2_dparams *dparams, const void *chunk) {
  234|      1|  ZFP_ERROR_NULL(input);
  ------------------
  |  |   22|      1|  do {                          \
  |  |   23|      1|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 1]
  |  |  ------------------
  ------------------
  235|      1|  ZFP_ERROR_NULL(output);
  ------------------
  |  |   22|      1|  do {                          \
  |  |   23|      1|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 1]
  |  |  ------------------
  ------------------
  236|      1|  ZFP_ERROR_NULL(dparams);
  ------------------
  |  |   22|      1|  do {                          \
  |  |   23|      1|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 1]
  |  |  ------------------
  ------------------
  237|      1|  ZFP_ERROR_NULL(dparams->schunk);
  ------------------
  |  |   22|      1|  do {                          \
  |  |   23|      1|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 1, False: 0]
  |  |  ------------------
  |  |   24|      1|      return 0;                 \
  |  |   25|      1|    }                           \
  |  |   26|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  238|      0|  BLOSC_UNUSED_PARAM(chunk);
  ------------------
  |  |   28|      0|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  239|       |
  240|      0|  blosc2_schunk *sc = dparams->schunk;
  241|      0|  int32_t typesize = sc->typesize;
  242|       |
  243|      0|  double tol = (int8_t) meta;
  244|      0|  int8_t ndim;
  245|      0|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  246|      0|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  247|      0|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  248|      0|  uint8_t *smeta;
  249|      0|  int32_t smeta_len;
  250|      0|  if (blosc2_meta_get(sc, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (250:7): [True: 0, False: 0]
  ------------------
  251|      0|    BLOSC_TRACE_ERROR("Cannot access b2nd meta info");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  252|      0|    free(shape);
  253|      0|    free(chunkshape);
  254|      0|    free(blockshape);
  255|      0|    return BLOSC2_ERROR_FAILURE;
  256|      0|  }
  257|      0|  int deserialize_rc = b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL);
  258|      0|  free(smeta);
  259|       |
  260|      0|  if (zfp_check_output_size(deserialize_rc, ndim, blockshape, typesize, output_len) < 0) {
  ------------------
  |  Branch (260:7): [True: 0, False: 0]
  ------------------
  261|      0|    free(shape);
  262|      0|    free(chunkshape);
  263|      0|    free(blockshape);
  264|      0|    return BLOSC2_ERROR_FAILURE;
  265|      0|  }
  266|       |
  267|      0|  zfp_type type;     /* array scalar type */
  268|      0|  zfp_field *field;  /* array meta data */
  269|      0|  zfp_stream *zfp;   /* compressed stream */
  270|      0|  bitstream *stream; /* bit stream to write to or read from */
  271|      0|  size_t zfpsize;    /* byte size of compressed stream */
  272|      0|  double tolerance = pow(10, tol);
  273|       |
  274|      0|  switch (typesize) {
  275|      0|    case sizeof(float):
  ------------------
  |  Branch (275:5): [True: 0, False: 0]
  ------------------
  276|      0|      type = zfp_type_float;
  277|      0|      break;
  278|      0|    case sizeof(double):
  ------------------
  |  Branch (278:5): [True: 0, False: 0]
  ------------------
  279|      0|      type = zfp_type_double;
  280|      0|      break;
  281|      0|    default:
  ------------------
  |  Branch (281:5): [True: 0, False: 0]
  ------------------
  282|      0|      free(shape);
  283|      0|      free(chunkshape);
  284|      0|      free(blockshape);
  285|      0|      BLOSC_TRACE_ERROR("ZFP is not available for typesize: %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  286|      0|      return BLOSC2_ERROR_FAILURE;
  287|      0|  }
  288|       |
  289|      0|  zfp = zfp_stream_open(NULL);
  290|      0|  zfp_stream_set_accuracy(zfp, tolerance);
  291|      0|  stream = stream_open((void *) input, input_len);
  292|      0|  zfp_stream_set_bit_stream(zfp, stream);
  293|      0|  zfp_stream_rewind(zfp);
  294|       |
  295|      0|  switch (ndim) {
  296|      0|    case 1:
  ------------------
  |  Branch (296:5): [True: 0, False: 0]
  ------------------
  297|      0|      field = zfp_field_1d((void *) output, type, blockshape[0]);
  298|      0|      break;
  299|      0|    case 2:
  ------------------
  |  Branch (299:5): [True: 0, False: 0]
  ------------------
  300|      0|      field = zfp_field_2d((void *) output, type, blockshape[1], blockshape[0]);
  301|      0|      break;
  302|      0|    case 3:
  ------------------
  |  Branch (302:5): [True: 0, False: 0]
  ------------------
  303|      0|      field = zfp_field_3d((void *) output, type, blockshape[2], blockshape[1], blockshape[0]);
  304|      0|      break;
  305|      0|    case 4:
  ------------------
  |  Branch (305:5): [True: 0, False: 0]
  ------------------
  306|      0|      field = zfp_field_4d((void *) output, type, blockshape[3], blockshape[2], blockshape[1], blockshape[0]);
  307|      0|      break;
  308|      0|    default:
  ------------------
  |  Branch (308:5): [True: 0, False: 0]
  ------------------
  309|      0|      free(shape);
  310|      0|      free(chunkshape);
  311|      0|      free(blockshape);
  312|      0|      BLOSC_TRACE_ERROR("ZFP is not available for ndims: %d", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  313|      0|      return BLOSC2_ERROR_FAILURE;
  314|      0|  }
  315|       |
  316|      0|  zfpsize = zfp_decompress(zfp, field);
  317|       |
  318|       |  /* clean up */
  319|      0|  zfp_field_free(field);
  320|      0|  zfp_stream_close(zfp);
  321|      0|  stream_close(stream);
  322|      0|  free(shape);
  323|      0|  free(chunkshape);
  324|      0|  free(blockshape);
  325|       |
  326|      0|  if (zfpsize == 0) {
  ------------------
  |  Branch (326:7): [True: 0, False: 0]
  ------------------
  327|      0|    BLOSC_TRACE_ERROR("\n ZFP: Decompression failed\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  328|      0|    return (int) zfpsize;
  329|      0|  }
  330|       |
  331|      0|  return (int) output_len;
  332|      0|}
zfp_prec_decompress:
  509|      1|                        int32_t output_len, uint8_t meta, blosc2_dparams *dparams, const void *chunk) {
  510|      1|  ZFP_ERROR_NULL(input);
  ------------------
  |  |   22|      1|  do {                          \
  |  |   23|      1|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 1]
  |  |  ------------------
  ------------------
  511|      1|  ZFP_ERROR_NULL(output);
  ------------------
  |  |   22|      1|  do {                          \
  |  |   23|      1|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 1]
  |  |  ------------------
  ------------------
  512|      1|  ZFP_ERROR_NULL(dparams);
  ------------------
  |  |   22|      1|  do {                          \
  |  |   23|      1|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 1]
  |  |  ------------------
  ------------------
  513|      1|  ZFP_ERROR_NULL(dparams->schunk);
  ------------------
  |  |   22|      1|  do {                          \
  |  |   23|      1|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 1, False: 0]
  |  |  ------------------
  |  |   24|      1|      return 0;                 \
  |  |   25|      1|    }                           \
  |  |   26|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  514|      0|  BLOSC_UNUSED_PARAM(chunk);
  ------------------
  |  |   28|      0|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  515|       |
  516|      0|  blosc2_schunk *sc = dparams->schunk;
  517|      0|  int32_t typesize = sc->typesize;
  518|      0|  int8_t ndim;
  519|      0|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  520|      0|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  521|      0|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  522|      0|  uint8_t *smeta;
  523|      0|  int32_t smeta_len;
  524|      0|  if (blosc2_meta_get(sc, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (524:7): [True: 0, False: 0]
  ------------------
  525|      0|    BLOSC_TRACE_ERROR("Cannot access b2nd meta info");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  526|      0|    free(shape);
  527|      0|    free(chunkshape);
  528|      0|    free(blockshape);
  529|      0|    return BLOSC2_ERROR_FAILURE;
  530|      0|  }
  531|      0|  int deserialize_rc = b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL);
  532|      0|  free(smeta);
  533|       |
  534|      0|  if (zfp_check_output_size(deserialize_rc, ndim, blockshape, typesize, output_len) < 0) {
  ------------------
  |  Branch (534:7): [True: 0, False: 0]
  ------------------
  535|      0|    free(shape);
  536|      0|    free(chunkshape);
  537|      0|    free(blockshape);
  538|      0|    return BLOSC2_ERROR_FAILURE;
  539|      0|  }
  540|       |
  541|      0|  zfp_type type;     /* array scalar type */
  542|      0|  zfp_field *field;  /* array meta data */
  543|      0|  zfp_stream *zfp;   /* compressed stream */
  544|      0|  bitstream *stream; /* bit stream to write to or read from */
  545|      0|  size_t zfpsize;    /* byte size of compressed stream */
  546|       |
  547|      0|  uint prec;
  548|      0|  switch (ndim) {
  549|      0|    case 1:
  ------------------
  |  Branch (549:5): [True: 0, False: 0]
  ------------------
  550|      0|      prec = meta + 5;
  551|      0|      break;
  552|      0|    case 2:
  ------------------
  |  Branch (552:5): [True: 0, False: 0]
  ------------------
  553|      0|      prec = meta + 7;
  554|      0|      break;
  555|      0|    case 3:
  ------------------
  |  Branch (555:5): [True: 0, False: 0]
  ------------------
  556|      0|      prec = meta + 9;
  557|      0|      break;
  558|      0|    case 4:
  ------------------
  |  Branch (558:5): [True: 0, False: 0]
  ------------------
  559|      0|      prec = meta + 11;
  560|      0|      break;
  561|      0|    default:
  ------------------
  |  Branch (561:5): [True: 0, False: 0]
  ------------------
  562|      0|      free(shape);
  563|      0|      free(chunkshape);
  564|      0|      free(blockshape);
  565|      0|      BLOSC_TRACE_ERROR("ZFP is not available for ndims: %d", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  566|      0|      return BLOSC2_ERROR_FAILURE;
  567|      0|  }
  568|       |
  569|      0|  if (prec > ZFP_MAX_PREC) {
  ------------------
  |  |   20|      0|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  ------------------
  |  Branch (569:7): [True: 0, False: 0]
  ------------------
  570|      0|    BLOSC_TRACE_ERROR("Max precision for this codecs is %d", ZFP_MAX_PREC);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  570|      0|    BLOSC_TRACE_ERROR("Max precision for this codecs is %d", ZFP_MAX_PREC);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   20|      0|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  571|      0|    prec = ZFP_MAX_PREC;
  ------------------
  |  |   20|      0|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  ------------------
  572|      0|  }
  573|       |
  574|      0|  switch (typesize) {
  575|      0|    case sizeof(float):
  ------------------
  |  Branch (575:5): [True: 0, False: 0]
  ------------------
  576|      0|      type = zfp_type_float;
  577|      0|      break;
  578|      0|    case sizeof(double):
  ------------------
  |  Branch (578:5): [True: 0, False: 0]
  ------------------
  579|      0|      type = zfp_type_double;
  580|      0|      break;
  581|      0|    default:
  ------------------
  |  Branch (581:5): [True: 0, False: 0]
  ------------------
  582|      0|      free(shape);
  583|      0|      free(chunkshape);
  584|      0|      free(blockshape);
  585|      0|      BLOSC_TRACE_ERROR("ZFP is not available for typesize: %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  586|      0|      return BLOSC2_ERROR_FAILURE;
  587|      0|  }
  588|       |
  589|      0|  zfp = zfp_stream_open(NULL);
  590|      0|  zfp_stream_set_precision(zfp, prec);
  591|      0|  stream = stream_open((void *) input, input_len);
  592|      0|  zfp_stream_set_bit_stream(zfp, stream);
  593|      0|  zfp_stream_rewind(zfp);
  594|       |
  595|      0|  switch (ndim) {
  596|      0|    case 1:
  ------------------
  |  Branch (596:5): [True: 0, False: 0]
  ------------------
  597|      0|      field = zfp_field_1d((void *) output, type, blockshape[0]);
  598|      0|      break;
  599|      0|    case 2:
  ------------------
  |  Branch (599:5): [True: 0, False: 0]
  ------------------
  600|      0|      field = zfp_field_2d((void *) output, type, blockshape[1], blockshape[0]);
  601|      0|      break;
  602|      0|    case 3:
  ------------------
  |  Branch (602:5): [True: 0, False: 0]
  ------------------
  603|      0|      field = zfp_field_3d((void *) output, type, blockshape[2], blockshape[1], blockshape[0]);
  604|      0|      break;
  605|      0|    case 4:
  ------------------
  |  Branch (605:5): [True: 0, False: 0]
  ------------------
  606|      0|      field = zfp_field_4d((void *) output, type, blockshape[3], blockshape[2], blockshape[1], blockshape[0]);
  607|      0|      break;
  608|      0|    default:
  ------------------
  |  Branch (608:5): [True: 0, False: 0]
  ------------------
  609|      0|      free(shape);
  610|      0|      free(chunkshape);
  611|      0|      free(blockshape);
  612|      0|      BLOSC_TRACE_ERROR("ZFP is not available for ndims: %d", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  613|      0|      return BLOSC2_ERROR_FAILURE;
  614|      0|  }
  615|       |
  616|      0|  zfpsize = zfp_decompress(zfp, field);
  617|       |
  618|       |  /* clean up */
  619|      0|  zfp_field_free(field);
  620|      0|  zfp_stream_close(zfp);
  621|      0|  stream_close(stream);
  622|      0|  free(shape);
  623|      0|  free(chunkshape);
  624|      0|  free(blockshape);
  625|       |
  626|      0|  if (zfpsize == 0) {
  ------------------
  |  Branch (626:7): [True: 0, False: 0]
  ------------------
  627|      0|    BLOSC_TRACE_ERROR("\n ZFP: Decompression failed\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  628|      0|    return (int) zfpsize;
  629|      0|  }
  630|       |
  631|      0|  return (int) output_len;
  632|      0|}
zfp_rate_decompress:
  796|      1|                        int32_t output_len, uint8_t meta, blosc2_dparams *dparams, const void *chunk) {
  797|      1|  ZFP_ERROR_NULL(input);
  ------------------
  |  |   22|      1|  do {                          \
  |  |   23|      1|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 1]
  |  |  ------------------
  ------------------
  798|      1|  ZFP_ERROR_NULL(output);
  ------------------
  |  |   22|      1|  do {                          \
  |  |   23|      1|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 1]
  |  |  ------------------
  ------------------
  799|      1|  ZFP_ERROR_NULL(dparams);
  ------------------
  |  |   22|      1|  do {                          \
  |  |   23|      1|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 1]
  |  |  ------------------
  ------------------
  800|      1|  ZFP_ERROR_NULL(dparams->schunk);
  ------------------
  |  |   22|      1|  do {                          \
  |  |   23|      1|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 1, False: 0]
  |  |  ------------------
  |  |   24|      1|      return 0;                 \
  |  |   25|      1|    }                           \
  |  |   26|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  801|      0|  BLOSC_UNUSED_PARAM(chunk);
  ------------------
  |  |   28|      0|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  802|       |
  803|      0|  blosc2_schunk *sc = dparams->schunk;
  804|      0|  int32_t typesize = sc->typesize;
  805|       |
  806|      0|  double ratio = (double) meta / 100.0;
  807|      0|  int8_t ndim;
  808|      0|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  809|      0|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  810|      0|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  811|      0|  uint8_t *smeta;
  812|      0|  int32_t smeta_len;
  813|      0|  if (blosc2_meta_get(sc, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (813:7): [True: 0, False: 0]
  ------------------
  814|      0|    BLOSC_TRACE_ERROR("Cannot access b2nd meta info");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  815|      0|    free(shape);
  816|      0|    free(chunkshape);
  817|      0|    free(blockshape);
  818|      0|    return BLOSC2_ERROR_FAILURE;
  819|      0|  }
  820|      0|  int deserialize_rc = b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL);
  821|      0|  free(smeta);
  822|       |
  823|      0|  if (zfp_check_output_size(deserialize_rc, ndim, blockshape, typesize, output_len) < 0) {
  ------------------
  |  Branch (823:7): [True: 0, False: 0]
  ------------------
  824|      0|    free(shape);
  825|      0|    free(chunkshape);
  826|      0|    free(blockshape);
  827|      0|    return BLOSC2_ERROR_FAILURE;
  828|      0|  }
  829|       |
  830|      0|  zfp_type type;     /* array scalar type */
  831|      0|  zfp_field *field;  /* array meta data */
  832|      0|  zfp_stream *zfp;   /* compressed stream */
  833|      0|  bitstream *stream; /* bit stream to write to or read from */
  834|      0|  size_t zfpsize;    /* byte size of compressed stream */
  835|       |
  836|      0|  switch (typesize) {
  837|      0|    case sizeof(float):
  ------------------
  |  Branch (837:5): [True: 0, False: 0]
  ------------------
  838|      0|      type = zfp_type_float;
  839|      0|      break;
  840|      0|    case sizeof(double):
  ------------------
  |  Branch (840:5): [True: 0, False: 0]
  ------------------
  841|      0|      type = zfp_type_double;
  842|      0|      break;
  843|      0|    default:
  ------------------
  |  Branch (843:5): [True: 0, False: 0]
  ------------------
  844|      0|      free(shape);
  845|      0|      free(chunkshape);
  846|      0|      free(blockshape);
  847|      0|      BLOSC_TRACE_ERROR("ZFP is not available for typesize: %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  848|      0|      return BLOSC2_ERROR_FAILURE;
  849|      0|  }
  850|      0|  double rate =
  851|      0|      ratio * (double) typesize * 8;     // convert from output size / input size to output bits per input value
  852|      0|  zfp = zfp_stream_open(NULL);
  853|      0|  zfp_stream_set_rate(zfp, rate, type, ndim, zfp_false);
  854|       |
  855|      0|  stream = stream_open((void *) input, input_len);
  856|      0|  zfp_stream_set_bit_stream(zfp, stream);
  857|      0|  zfp_stream_rewind(zfp);
  858|       |
  859|      0|  switch (ndim) {
  860|      0|    case 1:
  ------------------
  |  Branch (860:5): [True: 0, False: 0]
  ------------------
  861|      0|      field = zfp_field_1d((void *) output, type, blockshape[0]);
  862|      0|      break;
  863|      0|    case 2:
  ------------------
  |  Branch (863:5): [True: 0, False: 0]
  ------------------
  864|      0|      field = zfp_field_2d((void *) output, type, blockshape[1], blockshape[0]);
  865|      0|      break;
  866|      0|    case 3:
  ------------------
  |  Branch (866:5): [True: 0, False: 0]
  ------------------
  867|      0|      field = zfp_field_3d((void *) output, type, blockshape[2], blockshape[1], blockshape[0]);
  868|      0|      break;
  869|      0|    case 4:
  ------------------
  |  Branch (869:5): [True: 0, False: 0]
  ------------------
  870|      0|      field = zfp_field_4d((void *) output, type, blockshape[3], blockshape[2], blockshape[1], blockshape[0]);
  871|      0|      break;
  872|      0|    default:
  ------------------
  |  Branch (872:5): [True: 0, False: 0]
  ------------------
  873|      0|      free(shape);
  874|      0|      free(chunkshape);
  875|      0|      free(blockshape);
  876|      0|      BLOSC_TRACE_ERROR("ZFP is not available for ndims: %d", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  877|      0|      return BLOSC2_ERROR_FAILURE;
  878|      0|  }
  879|       |
  880|      0|  zfpsize = zfp_decompress(zfp, field);
  881|       |
  882|       |  /* clean up */
  883|      0|  zfp_field_free(field);
  884|      0|  zfp_stream_close(zfp);
  885|      0|  stream_close(stream);
  886|      0|  free(shape);
  887|      0|  free(chunkshape);
  888|      0|  free(blockshape);
  889|       |
  890|      0|  if (zfpsize == 0) {
  ------------------
  |  Branch (890:7): [True: 0, False: 0]
  ------------------
  891|      0|    BLOSC_TRACE_ERROR("\n ZFP: Decompression failed\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  892|      0|    return (int) zfpsize;
  893|      0|  }
  894|       |
  895|      0|  return (int) output_len;
  896|      0|}

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

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

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

ndcell_backward:
  205|      5|                   uint8_t id) {
  206|      5|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|      5|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  207|      5|  blosc2_schunk *schunk = dparams->schunk;
  208|      5|  int8_t ndim;
  209|      5|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|      5|#define B2ND_MAX_DIM 16
  ------------------
  210|      5|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      5|#define B2ND_MAX_DIM 16
  ------------------
  211|      5|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      5|#define B2ND_MAX_DIM 16
  ------------------
  212|      5|  uint8_t *smeta;
  213|      5|  int32_t smeta_len;
  214|      5|  if (blosc2_meta_get(schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (214:7): [True: 5, False: 0]
  ------------------
  215|      5|    free(shape);
  216|      5|    free(chunkshape);
  217|      5|    free(blockshape);
  218|      5|    BLOSC_TRACE_ERROR("b2nd layer not found!");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  219|      5|    return BLOSC2_ERROR_FAILURE;
  220|      5|  }
  221|      0|  if (b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL) < 0) {
  ------------------
  |  Branch (221:7): [True: 0, False: 0]
  ------------------
  222|      0|    free(smeta);
  223|      0|    free(shape);
  224|      0|    free(chunkshape);
  225|      0|    free(blockshape);
  226|      0|    return BLOSC2_ERROR_FAILURE;
  227|      0|  }
  228|      0|  free(smeta);
  229|      0|  if (ndim <= 0 || ndim > NDCELL_MAX_DIM) {
  ------------------
  |  |   16|      0|#define NDCELL_MAX_DIM 8
  ------------------
  |  Branch (229:7): [True: 0, False: 0]
  |  Branch (229:20): [True: 0, False: 0]
  ------------------
  230|      0|    free(shape);
  231|      0|    free(chunkshape);
  232|      0|    free(blockshape);
  233|      0|    BLOSC_TRACE_ERROR("ndim %d is out of range", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  234|      0|    return BLOSC2_ERROR_FAILURE;
  235|      0|  }
  236|       |
  237|       |  // `meta` is attacker-controlled in a crafted frame.  Interpret it as unsigned
  238|       |  // and reject 0: an (int8_t) cast would turn 128..255 into negative values and
  239|       |  // 0 would later divide by zero in `(blockshape[i] + cell_shape - 1) / cell_shape`.
  240|      0|  int cell_shape = (int) meta;
  241|      0|  if (cell_shape <= 0) {
  ------------------
  |  Branch (241:7): [True: 0, False: 0]
  ------------------
  242|      0|    free(shape);
  243|      0|    free(chunkshape);
  244|      0|    free(blockshape);
  245|      0|    BLOSC_TRACE_ERROR("Invalid cell_shape %d", cell_shape);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  246|      0|    return BLOSC2_ERROR_FAILURE;
  247|      0|  }
  248|       |  // See ndcell_forward(): compute cell_shape^ndim with checked 64-bit
  249|       |  // multiplication so an overflowing (int) pow() cannot bypass the
  250|       |  // "buffer smaller than cell" check below.
  251|      0|  int64_t cell_size = 1;
  252|      0|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (252:19): [True: 0, False: 0]
  ------------------
  253|      0|    if (cell_size > INT64_MAX / cell_shape) {
  ------------------
  |  Branch (253:9): [True: 0, False: 0]
  ------------------
  254|      0|      free(shape);
  255|      0|      free(chunkshape);
  256|      0|      free(blockshape);
  257|      0|      BLOSC_TRACE_ERROR("cell_shape %d too large for ndim %d", cell_shape, ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  258|      0|      return BLOSC2_ERROR_FAILURE;
  259|      0|    }
  260|      0|    cell_size *= cell_shape;
  261|      0|  }
  262|      0|  int32_t typesize = schunk->typesize;
  263|      0|  uint8_t *ip = (uint8_t *) input;
  264|      0|  uint8_t *ip_limit = ip + length;
  265|      0|  uint8_t *op = (uint8_t *) output;
  266|      0|  if (typesize <= 0) {
  ------------------
  |  Branch (266:7): [True: 0, False: 0]
  ------------------
  267|      0|    free(shape);
  268|      0|    free(chunkshape);
  269|      0|    free(blockshape);
  270|      0|    BLOSC_TRACE_ERROR("Invalid typesize %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  271|      0|    return BLOSC2_ERROR_FAILURE;
  272|      0|  }
  273|       |  // The block geometry (blockshape) comes from the attacker-controlled "b2nd"
  274|       |  // metalayer and is NOT validated by b2nd_deserialize_meta().  Compute the
  275|       |  // block size in 64-bit and reject non-positive dimensions.  Otherwise a
  276|       |  // crafted blockshape whose 32-bit product wraps back onto `length` would pass
  277|       |  // the check below, while the scatter-write index arithmetic further down uses
  278|       |  // the true (huge) dimensions, writing past the `length`-sized output buffer
  279|       |  // (heap overflow).  Bailing as soon as the running product exceeds `length`
  280|       |  // also keeps the 64-bit multiply from overflowing (it stays
  281|       |  // <= length * INT32_MAX < INT64_MAX).
  282|      0|  int64_t blocksize = (int64_t) typesize;
  283|      0|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (283:19): [True: 0, False: 0]
  ------------------
  284|      0|    if (blockshape[i] <= 0) {
  ------------------
  |  Branch (284:9): [True: 0, False: 0]
  ------------------
  285|      0|      free(shape);
  286|      0|      free(chunkshape);
  287|      0|      free(blockshape);
  288|      0|      BLOSC_TRACE_ERROR("Invalid blockshape[%d] = %d", i, blockshape[i]);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  289|      0|      return BLOSC2_ERROR_FAILURE;
  290|      0|    }
  291|      0|    blocksize *= blockshape[i];
  292|      0|    if (blocksize > (int64_t) length) {
  ------------------
  |  Branch (292:9): [True: 0, False: 0]
  ------------------
  293|      0|      free(shape);
  294|      0|      free(chunkshape);
  295|      0|      free(blockshape);
  296|      0|      BLOSC_TRACE_ERROR("blockshape too large for block of %d bytes", length);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  297|      0|      return BLOSC2_ERROR_FAILURE;
  298|      0|    }
  299|      0|  }
  300|       |
  301|      0|  if ((int64_t) length != blocksize) {
  ------------------
  |  Branch (301:7): [True: 0, False: 0]
  ------------------
  302|      0|    free(shape);
  303|      0|    free(chunkshape);
  304|      0|    free(blockshape);
  305|      0|    BLOSC_TRACE_ERROR("Length not equal to blocksize %d %lld", length, (long long) blocksize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  306|      0|    return BLOSC2_ERROR_FAILURE;
  307|      0|  }
  308|       |
  309|       |  // length is a multiple of typesize here (length == blocksize, checked above),
  310|       |  // so the division is exact; phrasing the check this way avoids overflowing the
  311|       |  // cell_size * typesize product.
  312|      0|  if (cell_size > (int64_t) length / typesize) {
  ------------------
  |  Branch (312:7): [True: 0, False: 0]
  ------------------
  313|      0|    free(shape);
  314|      0|    free(chunkshape);
  315|      0|    free(blockshape);
  316|      0|    BLOSC_TRACE_ERROR("input and output buffer cannot be smaller than cell size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  317|      0|    return BLOSC2_ERROR_FAILURE;
  318|      0|  }
  319|       |
  320|      0|  int64_t i_shape[NDCELL_MAX_DIM];
  321|      0|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (321:19): [True: 0, False: 0]
  ------------------
  322|      0|    i_shape[i] = (blockshape[i] + cell_shape - 1) / cell_shape;
  323|      0|  }
  324|       |
  325|      0|  int64_t ncells = 1;
  326|      0|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (326:19): [True: 0, False: 0]
  ------------------
  327|      0|    ncells *= i_shape[i];
  328|      0|  }
  329|       |
  330|       |  /* main loop */
  331|      0|  int64_t pad_shape[NDCELL_MAX_DIM] = {0};
  332|      0|  int64_t ii[NDCELL_MAX_DIM];
  333|      0|  int32_t ind = 0;
  334|      0|  for (int cell_ind = 0; cell_ind < ncells; cell_ind++) {      // for each cell
  ------------------
  |  Branch (334:26): [True: 0, False: 0]
  ------------------
  335|       |
  336|      0|    if (ip > ip_limit) {
  ------------------
  |  Branch (336:9): [True: 0, False: 0]
  ------------------
  337|      0|      free(shape);
  338|      0|      free(chunkshape);
  339|      0|      free(blockshape);
  340|      0|      BLOSC_TRACE_ERROR("Exceeding input length!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  341|      0|      return BLOSC2_ERROR_FAILURE;
  342|      0|    }
  343|      0|    blosc2_unidim_to_multidim(ndim, i_shape, cell_ind, ii);
  344|      0|    uint32_t orig = 0;
  345|      0|    int64_t nd_aux = (int64_t) cell_shape;
  346|      0|    for (int i = ndim - 1; i >= 0; i--) {
  ------------------
  |  Branch (346:28): [True: 0, False: 0]
  ------------------
  347|      0|      orig += ii[i] * nd_aux;
  348|      0|      nd_aux *= blockshape[i];
  349|      0|    }
  350|       |
  351|      0|    for (int dim_ind = 0; dim_ind < ndim; dim_ind++) {
  ------------------
  |  Branch (351:27): [True: 0, False: 0]
  ------------------
  352|      0|      if ((blockshape[dim_ind] % cell_shape != 0) && (ii[dim_ind] == i_shape[dim_ind] - 1)) {
  ------------------
  |  Branch (352:11): [True: 0, False: 0]
  |  Branch (352:54): [True: 0, False: 0]
  ------------------
  353|      0|        pad_shape[dim_ind] = blockshape[dim_ind] % cell_shape;
  354|      0|      } else {
  355|      0|        pad_shape[dim_ind] = (int64_t) cell_shape;
  356|      0|      }
  357|      0|    }
  358|       |
  359|      0|    int64_t ncopies = 1;
  360|      0|    for (int i = 0; i < ndim - 1; ++i) {
  ------------------
  |  Branch (360:21): [True: 0, False: 0]
  ------------------
  361|      0|      ncopies *= pad_shape[i];
  362|      0|    }
  363|      0|    int64_t kk[NDCELL_MAX_DIM];
  364|      0|    for (int copy_ind = 0; copy_ind < ncopies; ++copy_ind) {
  ------------------
  |  Branch (364:28): [True: 0, False: 0]
  ------------------
  365|      0|      blosc2_unidim_to_multidim(ndim - 1, pad_shape, copy_ind, kk);
  366|      0|      nd_aux = blockshape[ndim - 1];
  367|      0|      ind = (int32_t) orig;
  368|      0|      for (int i = ndim - 2; i >= 0; i--) {
  ------------------
  |  Branch (368:30): [True: 0, False: 0]
  ------------------
  369|      0|        ind += (int32_t) (kk[i] * nd_aux);
  370|      0|        nd_aux *= blockshape[i];
  371|      0|      }
  372|      0|      memcpy(&op[ind * typesize], ip, pad_shape[ndim - 1] * typesize);
  373|      0|      ip += pad_shape[ndim - 1] * typesize;
  374|      0|    }
  375|      0|  }
  376|      0|  ind += (int32_t) pad_shape[ndim - 1];
  377|       |
  378|       |
  379|      0|  if (ind != (int32_t) (blocksize / typesize)) {
  ------------------
  |  Branch (379:7): [True: 0, False: 0]
  ------------------
  380|      0|    free(shape);
  381|      0|    free(chunkshape);
  382|      0|    free(blockshape);
  383|      0|    BLOSC_TRACE_ERROR("Output size is not compatible with embedded blockshape ind %d %lld \n",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  384|      0|                      ind, (long long) (blocksize / typesize));
  385|      0|    return BLOSC2_ERROR_FAILURE;
  386|      0|  }
  387|       |
  388|      0|  free(shape);
  389|      0|  free(chunkshape);
  390|      0|  free(blockshape);
  391|       |
  392|      0|  return BLOSC2_ERROR_SUCCESS;
  393|      0|}

ndmean_backward:
  243|      5|                   uint8_t id) {
  244|      5|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|      5|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  245|      5|  blosc2_schunk *schunk = dparams->schunk;
  246|      5|  int8_t ndim;
  247|       |  // b2nd_deserialize_meta() writes up to B2ND_MAX_DIM entries (it only validates
  248|       |  // ndim <= B2ND_MAX_DIM), so the destination buffers must be sized accordingly,
  249|       |  // not for NDMEAN_MAX_DIM.  Otherwise a crafted b2nd metalayer with
  250|       |  // NDMEAN_MAX_DIM < ndim <= B2ND_MAX_DIM overflows these allocations.
  251|      5|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|      5|#define B2ND_MAX_DIM 16
  ------------------
  252|      5|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      5|#define B2ND_MAX_DIM 16
  ------------------
  253|      5|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      5|#define B2ND_MAX_DIM 16
  ------------------
  254|      5|  uint8_t *smeta;
  255|      5|  int32_t smeta_len;
  256|      5|  if (blosc2_meta_get(schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (256:7): [True: 5, False: 0]
  ------------------
  257|      5|    free(shape);
  258|      5|    free(chunkshape);
  259|      5|    free(blockshape);
  260|      5|    BLOSC_TRACE_ERROR("b2nd layer not found!");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  261|      5|    return BLOSC2_ERROR_FAILURE;
  262|      5|  }
  263|      0|  if (b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL) < 0) {
  ------------------
  |  Branch (263:7): [True: 0, False: 0]
  ------------------
  264|      0|    free(smeta);
  265|      0|    free(shape);
  266|      0|    free(chunkshape);
  267|      0|    free(blockshape);
  268|      0|    BLOSC_TRACE_ERROR("Cannot deserialize b2nd metalayer");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  269|      0|    return BLOSC2_ERROR_FAILURE;
  270|      0|  }
  271|      0|  free(smeta);
  272|       |  // Guard the fixed-size (NDMEAN_MAX_DIM) stack arrays used below.
  273|      0|  if (ndim <= 0 || ndim > NDMEAN_MAX_DIM) {
  ------------------
  |  |   16|      0|#define NDMEAN_MAX_DIM 8
  ------------------
  |  Branch (273:7): [True: 0, False: 0]
  |  Branch (273:20): [True: 0, False: 0]
  ------------------
  274|      0|    free(shape);
  275|      0|    free(chunkshape);
  276|      0|    free(blockshape);
  277|      0|    BLOSC_TRACE_ERROR("ndim %d is out of range", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  278|      0|    return BLOSC2_ERROR_FAILURE;
  279|      0|  }
  280|       |
  281|       |  // `meta` carries the NDMEAN cell shape and is attacker-controlled (it is the
  282|       |  // chunk-header filters_meta byte).  It is cast to int8_t and used as the
  283|       |  // divisor when building i_shape[] below, so a value of 0 (divide-by-zero) or
  284|       |  // one that becomes negative after the cast (meta > INT8_MAX) would crash or
  285|       |  // produce bogus, out-of-range geometry (e.g. a negative pad_shape feeding a
  286|       |  // huge memcpy).  Require a positive cell shape.
  287|      0|  if ((int8_t) meta <= 0) {
  ------------------
  |  Branch (287:7): [True: 0, False: 0]
  ------------------
  288|      0|    free(shape);
  289|      0|    free(chunkshape);
  290|      0|    free(blockshape);
  291|      0|    BLOSC_TRACE_ERROR("Invalid cell shape (meta) %d", (int) meta);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  292|      0|    return BLOSC2_ERROR_FAILURE;
  293|      0|  }
  294|       |
  295|      0|  int8_t cellshape[8];
  296|      0|  int64_t cell_size = 1;  // 64-bit: prod(cellshape) can reach 127^ndim, which overflows int
  297|      0|  for (int i = 0; i < 8; ++i) {
  ------------------
  |  Branch (297:19): [True: 0, False: 0]
  ------------------
  298|      0|    if (i < ndim) {
  ------------------
  |  Branch (298:9): [True: 0, False: 0]
  ------------------
  299|      0|      cellshape[i] = (int8_t) meta;
  300|      0|      if (cellshape[i] > blockshape[i]) {
  ------------------
  |  Branch (300:11): [True: 0, False: 0]
  ------------------
  301|      0|        cellshape[i] = (int8_t) blockshape[i];
  302|      0|      }
  303|      0|      cell_size *= cellshape[i];
  304|      0|    } else {
  305|      0|      cellshape[i] = 1;
  306|      0|    }
  307|      0|  }
  308|       |
  309|      0|  int8_t typesize = (int8_t) schunk->typesize;
  310|      0|  uint8_t *ip = (uint8_t *) input;
  311|      0|  uint8_t *ip_limit = ip + length;
  312|      0|  uint8_t *op = (uint8_t *) output;
  313|      0|  if (typesize <= 0) {
  ------------------
  |  Branch (313:7): [True: 0, False: 0]
  ------------------
  314|      0|    free(shape);
  315|      0|    free(chunkshape);
  316|      0|    free(blockshape);
  317|      0|    BLOSC_TRACE_ERROR("Invalid typesize %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  318|      0|    return BLOSC2_ERROR_FAILURE;
  319|      0|  }
  320|       |  // The block geometry (blockshape) comes from the attacker-controlled "b2nd"
  321|       |  // metalayer and is NOT validated by b2nd_deserialize_meta().  Compute the
  322|       |  // block size in 64-bit and reject non-positive dimensions.  Otherwise a
  323|       |  // crafted blockshape whose 32-bit product wraps back onto `length` would pass
  324|       |  // the check below, while the scatter-write index arithmetic further down uses
  325|       |  // the true (huge) dimensions, writing past the `length`-sized output buffer
  326|       |  // (heap overflow).  Bailing as soon as the running product exceeds `length`
  327|       |  // also keeps the 64-bit multiply from overflowing.
  328|      0|  int64_t blocksize = (int64_t) typesize;
  329|      0|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (329:19): [True: 0, False: 0]
  ------------------
  330|      0|    if (blockshape[i] <= 0) {
  ------------------
  |  Branch (330:9): [True: 0, False: 0]
  ------------------
  331|      0|      free(shape);
  332|      0|      free(chunkshape);
  333|      0|      free(blockshape);
  334|      0|      BLOSC_TRACE_ERROR("Invalid blockshape[%d] = %d", i, blockshape[i]);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  335|      0|      return BLOSC2_ERROR_FAILURE;
  336|      0|    }
  337|      0|    blocksize *= blockshape[i];
  338|      0|    if (blocksize > (int64_t) length) {
  ------------------
  |  Branch (338:9): [True: 0, False: 0]
  ------------------
  339|      0|      free(shape);
  340|      0|      free(chunkshape);
  341|      0|      free(blockshape);
  342|      0|      BLOSC_TRACE_ERROR("blockshape too large for block of %d bytes", length);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  343|      0|      return BLOSC2_ERROR_FAILURE;
  344|      0|    }
  345|      0|  }
  346|       |
  347|      0|  if ((int64_t) length != blocksize) {
  ------------------
  |  Branch (347:7): [True: 0, False: 0]
  ------------------
  348|      0|    free(shape);
  349|      0|    free(chunkshape);
  350|      0|    free(blockshape);
  351|      0|    BLOSC_TRACE_ERROR("Length not equal to blocksize");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  352|      0|    return BLOSC2_ERROR_FAILURE;
  353|      0|  }
  354|       |
  355|      0|  if (length < cell_size * typesize) {
  ------------------
  |  Branch (355:7): [True: 0, False: 0]
  ------------------
  356|      0|    free(shape);
  357|      0|    free(chunkshape);
  358|      0|    free(blockshape);
  359|      0|    BLOSC_TRACE_ERROR("input and output buffer cannot be smaller than cell size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  360|      0|    return BLOSC2_ERROR_FAILURE;
  361|      0|  }
  362|       |
  363|      0|  int64_t i_shape[NDMEAN_MAX_DIM];
  364|      0|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (364:19): [True: 0, False: 0]
  ------------------
  365|      0|    i_shape[i] = (blockshape[i] + cellshape[i] - 1) / cellshape[i];
  366|      0|  }
  367|       |
  368|      0|  int64_t ncells = 1;
  369|      0|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (369:19): [True: 0, False: 0]
  ------------------
  370|      0|    ncells *= i_shape[i];
  371|      0|  }
  372|       |
  373|       |  /* main loop */
  374|      0|  int64_t pad_shape[NDMEAN_MAX_DIM] = {0};
  375|      0|  int64_t ii[NDMEAN_MAX_DIM];
  376|      0|  int32_t ind = 0;
  377|      0|  for (int cell_ind = 0; cell_ind < ncells; cell_ind++) {      // for each cell
  ------------------
  |  Branch (377:26): [True: 0, False: 0]
  ------------------
  378|       |
  379|      0|    if (ip > ip_limit) {
  ------------------
  |  Branch (379:9): [True: 0, False: 0]
  ------------------
  380|      0|      free(shape);
  381|      0|      free(chunkshape);
  382|      0|      free(blockshape);
  383|      0|      BLOSC_TRACE_ERROR("Exceeding input length!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  384|      0|      return BLOSC2_ERROR_FAILURE;
  385|      0|    }
  386|      0|    blosc2_unidim_to_multidim(ndim, i_shape, cell_ind, ii);
  387|      0|    uint32_t orig = 0;
  388|      0|    int64_t nd_aux = (int64_t) (cellshape[0]);
  389|      0|    for (int i = ndim - 1; i >= 0; i--) {
  ------------------
  |  Branch (389:28): [True: 0, False: 0]
  ------------------
  390|      0|      orig += ii[i] * nd_aux;
  391|      0|      nd_aux *= blockshape[i];
  392|      0|    }
  393|       |
  394|      0|    for (int dim_ind = 0; dim_ind < ndim; dim_ind++) {
  ------------------
  |  Branch (394:27): [True: 0, False: 0]
  ------------------
  395|      0|      if ((blockshape[dim_ind] % cellshape[dim_ind] != 0) && (ii[dim_ind] == i_shape[dim_ind] - 1)) {
  ------------------
  |  Branch (395:11): [True: 0, False: 0]
  |  Branch (395:62): [True: 0, False: 0]
  ------------------
  396|      0|        pad_shape[dim_ind] = blockshape[dim_ind] % cellshape[dim_ind];
  397|      0|      } else {
  398|      0|        pad_shape[dim_ind] = (int64_t) cellshape[dim_ind];
  399|      0|      }
  400|      0|    }
  401|       |
  402|      0|    int64_t ncopies = 1;
  403|      0|    for (int i = 0; i < ndim - 1; ++i) {
  ------------------
  |  Branch (403:21): [True: 0, False: 0]
  ------------------
  404|      0|      ncopies *= pad_shape[i];
  405|      0|    }
  406|      0|    int64_t kk[NDMEAN_MAX_DIM];
  407|      0|    for (int copy_ind = 0; copy_ind < ncopies; ++copy_ind) {
  ------------------
  |  Branch (407:28): [True: 0, False: 0]
  ------------------
  408|      0|      blosc2_unidim_to_multidim((int8_t) (ndim - 1), pad_shape, copy_ind, kk);
  409|      0|      nd_aux = blockshape[ndim - 1];
  410|      0|      ind = (int32_t) orig;
  411|      0|      for (int i = ndim - 2; i >= 0; i--) {
  ------------------
  |  Branch (411:30): [True: 0, False: 0]
  ------------------
  412|      0|        ind += (int32_t) (kk[i] * nd_aux);
  413|      0|        nd_aux *= blockshape[i];
  414|      0|      }
  415|      0|      memcpy(&op[ind * typesize], ip, pad_shape[ndim - 1] * typesize);
  416|      0|      ip += pad_shape[ndim - 1] * typesize;
  417|      0|    }
  418|      0|  }
  419|      0|  ind += (int32_t) pad_shape[ndim - 1];
  420|       |
  421|      0|  free(shape);
  422|      0|  free(chunkshape);
  423|      0|  free(blockshape);
  424|       |
  425|      0|  if (ind != (int32_t) (blocksize / typesize)) {
  ------------------
  |  Branch (425:7): [True: 0, False: 0]
  ------------------
  426|      0|    BLOSC_TRACE_ERROR("Output size is not compatible with embedded blockshape ind %d %lld \n",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  427|      0|                      ind, (long long) (blocksize / typesize));
  428|      0|    return BLOSC2_ERROR_FAILURE;
  429|      0|  }
  430|       |
  431|      0|  return BLOSC2_ERROR_SUCCESS;
  432|      0|}

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

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

