LZ4_decompress_safe:
 2452|    422|{
 2453|    422|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2454|    422|                                  decode_full_block, noDict,
 2455|       |                                  (BYTE*)dest, NULL, 0);
 2456|    422|}
LZ4_decompress_safe_forceExtDict:
 2526|    337|{
 2527|    337|    DEBUGLOG(5, "LZ4_decompress_safe_forceExtDict");
  ------------------
  |  |  289|    337|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2528|    337|    return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
 2529|    337|                                  decode_full_block, usingExtDict,
 2530|    337|                                  (BYTE*)dest, (const BYTE*)dictStart, dictSize);
 2531|    337|}
LZ4_decompress_safe_usingDict:
 2720|    337|{
 2721|    337|    if (dictSize==0)
  ------------------
  |  Branch (2721:9): [True: 0, False: 337]
  ------------------
 2722|      0|        return LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize);
 2723|    337|    if (dictStart+dictSize == dest) {
  ------------------
  |  Branch (2723:9): [True: 0, False: 337]
  ------------------
 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|    337|    assert(dictSize >= 0);
  ------------------
  |  |  273|    337|#    define assert(condition) ((void)0)
  ------------------
 2731|    337|    return LZ4_decompress_safe_forceExtDict(source, dest, compressedSize, maxOutputSize, dictStart, (size_t)dictSize);
 2732|    337|}
lz4.c:LZ4_wildCopy8:
  466|  9.10k|{
  467|  9.10k|    BYTE* d = (BYTE*)dstPtr;
  468|  9.10k|    const BYTE* s = (const BYTE*)srcPtr;
  469|  9.10k|    BYTE* const e = (BYTE*)dstEnd;
  470|       |
  471|   894k|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  349|   894k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (471:50): [True: 884k, False: 9.10k]
  ------------------
  472|  9.10k|}
lz4.c:LZ4_isLittleEndian:
  364|  76.6k|{
  365|  76.6k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  366|  76.6k|    return one.c[0];
  367|  76.6k|}
lz4.c:LZ4_read16:
  393|  76.6k|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  398|  7.95k|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_decompress_generic:
 2035|    759|{
 2036|    759|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (2036:9): [True: 0, False: 759]
  |  Branch (2036:26): [True: 0, False: 759]
  ------------------
 2037|       |
 2038|    759|    {   const BYTE* ip = (const BYTE*) src;
 2039|    759|        const BYTE* const iend = ip + srcSize;
 2040|       |
 2041|    759|        BYTE* op = (BYTE*) dst;
 2042|    759|        BYTE* const oend = op + outputSize;
 2043|    759|        BYTE* cpy;
 2044|       |
 2045|    759|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (2045:37): [True: 422, False: 337]
  ------------------
 2046|       |
 2047|    759|        const int checkOffset = (dictSize < (int)(64 KB));
  ------------------
  |  |  251|    759|#define KB *(1 <<10)
  ------------------
 2048|       |
 2049|       |
 2050|       |        /* Set up the "end" pointers for the shortcut. */
 2051|    759|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 2052|    759|        const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/;
 2053|       |
 2054|    759|        const BYTE* match;
 2055|    759|        size_t offset;
 2056|    759|        unsigned token;
 2057|    759|        size_t length;
 2058|       |
 2059|       |
 2060|    759|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  289|    759|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2061|       |
 2062|       |        /* Special cases */
 2063|    759|        assert(lowPrefix <= op);
  ------------------
  |  |  273|    759|#    define assert(condition) ((void)0)
  ------------------
 2064|    759|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  180|    759|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    759|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 759]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 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|    759|        if (unlikely(srcSize==0)) { return -1; }
  ------------------
  |  |  180|    759|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    759|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 759]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 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|    759|#if LZ4_FAST_DEC_LOOP
 2076|    759|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|    759|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2076:13): [True: 12, False: 747]
  ------------------
 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|    747|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  289|    747|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2083|  76.1k|        while (1) {
  ------------------
  |  Branch (2083:16): [True: 76.1k, Folded]
  ------------------
 2084|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2085|  76.1k|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  |  273|  76.1k|#    define assert(condition) ((void)0)
  ------------------
 2086|  76.1k|            assert(ip < iend);
  ------------------
  |  |  273|  76.1k|#    define assert(condition) ((void)0)
  ------------------
 2087|  76.1k|            token = *ip++;
 2088|  76.1k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  260|  76.1k|#define ML_BITS  4
  ------------------
 2089|  76.1k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  289|  76.1k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2090|       |
 2091|       |            /* decode literal length */
 2092|  76.1k|            if (length == RUN_MASK) {
  ------------------
  |  |  263|  76.1k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|  76.1k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|  76.1k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2092:17): [True: 2.28k, False: 73.8k]
  ------------------
 2093|  2.28k|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  263|  2.28k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|  2.28k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|  2.28k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2094|  2.28k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2094:21): [True: 8, False: 2.27k]
  ------------------
 2095|      8|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  289|      8|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2096|      8|                    goto _output_error;
 2097|      8|                }
 2098|  2.27k|                length += addl;
 2099|  2.27k|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  2.27k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  2.27k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 2.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2100|  2.27k|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  2.27k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  2.27k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 2.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2101|       |
 2102|       |                /* copy literals */
 2103|  2.27k|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  277|  2.27k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2104|  2.27k|                if ((op+length>oend-32) || (ip+length>iend-32)) { goto safe_literal_copy; }
  ------------------
  |  Branch (2104:21): [True: 17, False: 2.26k]
  |  Branch (2104:44): [True: 350, False: 1.91k]
  ------------------
 2105|  1.91k|                LZ4_wildCopy32(op, ip, op+length);
 2106|  1.91k|                ip += length; op += length;
 2107|  73.8k|            } else if (ip <= iend-(16 + 1/*max lit + offset + nextToken*/)) {
  ------------------
  |  Branch (2107:24): [True: 73.8k, False: 49]
  ------------------
 2108|       |                /* We don't need to check oend, since we check it once for each loop below */
 2109|  73.8k|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)length);
  ------------------
  |  |  289|  73.8k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2110|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2111|  73.8k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  349|  73.8k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2112|  73.8k|                ip += length; op += length;
 2113|  73.8k|            } else {
 2114|     49|                goto safe_literal_copy;
 2115|     49|            }
 2116|       |
 2117|       |            /* get offset */
 2118|  75.7k|            offset = LZ4_readLE16(ip); ip+=2;
 2119|  75.7k|            DEBUGLOG(6, "blockPos%6u: offset = %u", (unsigned)(op-(BYTE*)dst), (unsigned)offset);
  ------------------
  |  |  289|  75.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2120|  75.7k|            match = op - offset;
 2121|  75.7k|            assert(match <= op);  /* overflow check */
  ------------------
  |  |  273|  75.7k|#    define assert(condition) ((void)0)
  ------------------
 2122|       |
 2123|       |            /* get matchlength */
 2124|  75.7k|            length = token & ML_MASK;
  ------------------
  |  |  261|  75.7k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  75.7k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2125|  75.7k|            DEBUGLOG(7, "  match length token = %u (len==%u)", (unsigned)length, (unsigned)length+MINMATCH);
  ------------------
  |  |  289|  75.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2126|       |
 2127|  75.7k|            if (length == ML_MASK) {
  ------------------
  |  |  261|  75.7k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  75.7k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2127:17): [True: 47.0k, False: 28.7k]
  ------------------
 2128|  47.0k|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  245|  47.0k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2129|  47.0k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2129:21): [True: 5, False: 47.0k]
  ------------------
 2130|      5|                    DEBUGLOG(5, "error reading long match length");
  ------------------
  |  |  289|      5|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2131|      5|                    goto _output_error;
 2132|      5|                }
 2133|  47.0k|                length += addl;
 2134|  47.0k|                length += MINMATCH;
  ------------------
  |  |  242|  47.0k|#define MINMATCH 4
  ------------------
 2135|  47.0k|                DEBUGLOG(7, "  long match length == %u", (unsigned)length);
  ------------------
  |  |  289|  47.0k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2136|  47.0k|                if (unlikely((uptrval)(op)+length<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  47.0k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  47.0k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 47.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2137|  47.0k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|  47.0k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2137:21): [True: 177, False: 46.8k]
  ------------------
 2138|    177|                    goto safe_match_copy;
 2139|    177|                }
 2140|  47.0k|            } else {
 2141|  28.7k|                length += MINMATCH;
  ------------------
  |  |  242|  28.7k|#define MINMATCH 4
  ------------------
 2142|  28.7k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|  28.7k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2142:21): [True: 28, False: 28.6k]
  ------------------
 2143|     28|                    DEBUGLOG(7, "moving to safe_match_copy (ml==%u)", (unsigned)length);
  ------------------
  |  |  289|     28|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2144|     28|                    goto safe_match_copy;
 2145|     28|                }
 2146|       |
 2147|       |                /* Fastpath check: skip LZ4_wildCopy32 when true */
 2148|  28.6k|                if ((dict == withPrefix64k) || (match >= lowPrefix)) {
  ------------------
  |  Branch (2148:21): [True: 0, False: 28.6k]
  |  Branch (2148:48): [True: 27.8k, False: 858]
  ------------------
 2149|  27.8k|                    if (offset >= 8) {
  ------------------
  |  Branch (2149:25): [True: 17.1k, False: 10.6k]
  ------------------
 2150|  17.1k|                        assert(match >= lowPrefix);
  ------------------
  |  |  273|  17.1k|#    define assert(condition) ((void)0)
  ------------------
 2151|  17.1k|                        assert(match <= op);
  ------------------
  |  |  273|  17.1k|#    define assert(condition) ((void)0)
  ------------------
 2152|  17.1k|                        assert(op + 18 <= oend);
  ------------------
  |  |  273|  17.1k|#    define assert(condition) ((void)0)
  ------------------
 2153|       |
 2154|  17.1k|                        LZ4_memcpy(op, match, 8);
  ------------------
  |  |  349|  17.1k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2155|  17.1k|                        LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  349|  17.1k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2156|  17.1k|                        LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  349|  17.1k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2157|  17.1k|                        op += length;
 2158|  17.1k|                        continue;
 2159|  17.1k|            }   }   }
 2160|       |
 2161|  58.3k|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  180|  58.3k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  58.3k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2161:18): [True: 58.3k, False: 0]
  |  Branch (2161:33): [True: 113, False: 58.2k]
  ------------------
 2162|    113|                DEBUGLOG(5, "Error : pos=%zi, offset=%zi => outside buffers", op-lowPrefix, op-match);
  ------------------
  |  |  289|    113|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2163|    113|                goto _output_error;
 2164|    113|            }
 2165|       |            /* match starting within external dictionary */
 2166|  58.2k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2166:17): [True: 21.4k, False: 36.8k]
  |  Branch (2166:41): [True: 1.30k, False: 20.1k]
  ------------------
 2167|  1.30k|                assert(dictEnd != NULL);
  ------------------
  |  |  273|  1.30k|#    define assert(condition) ((void)0)
  ------------------
 2168|  1.30k|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  180|  1.30k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  1.30k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 1.30k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 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.30k|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2177:21): [True: 1.18k, False: 126]
  ------------------
 2178|       |                    /* match fits entirely within external dictionary : just copy */
 2179|  1.18k|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  357|  1.18k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2180|  1.18k|                    op += length;
 2181|  1.18k|                } else {
 2182|       |                    /* match stretches into both external dictionary and current block */
 2183|    126|                    size_t const copySize = (size_t)(lowPrefix - match);
 2184|    126|                    size_t const restSize = length - copySize;
 2185|    126|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  349|    126|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2186|    126|                    op += copySize;
 2187|    126|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2187:25): [True: 79, False: 47]
  ------------------
 2188|     79|                        BYTE* const endOfMatch = op + restSize;
 2189|     79|                        const BYTE* copyFrom = lowPrefix;
 2190|   783k|                        while (op < endOfMatch) { *op++ = *copyFrom++; }
  ------------------
  |  Branch (2190:32): [True: 783k, False: 79]
  ------------------
 2191|     79|                    } else {
 2192|     47|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  349|     47|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2193|     47|                        op += restSize;
 2194|     47|                }   }
 2195|  1.30k|                continue;
 2196|  1.30k|            }
 2197|       |
 2198|       |            /* copy match within block */
 2199|  56.9k|            cpy = op + length;
 2200|       |
 2201|  56.9k|            assert((op <= oend) && (oend-op >= 32));
  ------------------
  |  |  273|  56.9k|#    define assert(condition) ((void)0)
  ------------------
 2202|  56.9k|            if (unlikely(offset<16)) {
  ------------------
  |  |  180|  56.9k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  56.9k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 38.2k, False: 18.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2203|  38.2k|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2204|  38.2k|            } else {
 2205|  18.7k|                LZ4_wildCopy32(op, match, cpy);
 2206|  18.7k|            }
 2207|       |
 2208|  56.9k|            op = cpy;   /* wildcopy correction */
 2209|  56.9k|        }
 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|    962|        while (1) {
  ------------------
  |  Branch (2215:16): [True: 962, Folded]
  ------------------
 2216|    962|            assert(ip < iend);
  ------------------
  |  |  273|    962|#    define assert(condition) ((void)0)
  ------------------
 2217|    962|            token = *ip++;
 2218|    962|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  260|    962|#define ML_BITS  4
  ------------------
 2219|    962|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  289|    962|#  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|    962|            if ( (length != RUN_MASK)
  ------------------
  |  |  263|    962|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    962|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    962|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2230:18): [True: 801, False: 161]
  ------------------
 2231|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2232|    801|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  177|    801|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|    801|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 350, False: 451]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2233|       |                /* Copy the literals */
 2234|    350|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  349|    350|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2235|    350|                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|    350|                length = token & ML_MASK; /* match length */
  ------------------
  |  |  261|    350|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    350|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2240|    350|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u (len=%u)", (unsigned)(op-(BYTE*)dst), (unsigned)length, (unsigned)length + 4);
  ------------------
  |  |  289|    350|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2241|    350|                offset = LZ4_readLE16(ip); ip += 2;
 2242|    350|                match = op - offset;
 2243|    350|                assert(match <= op); /* check overflow */
  ------------------
  |  |  273|    350|#    define assert(condition) ((void)0)
  ------------------
 2244|       |
 2245|       |                /* Do not deal with overlapping matches. */
 2246|    350|                if ( (length != ML_MASK)
  ------------------
  |  |  261|    350|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    350|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2246:22): [True: 263, False: 87]
  ------------------
 2247|    263|                  && (offset >= 8)
  ------------------
  |  Branch (2247:22): [True: 148, False: 115]
  ------------------
 2248|    148|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2248:23): [True: 0, False: 148]
  |  Branch (2248:46): [True: 105, False: 43]
  ------------------
 2249|       |                    /* Copy the match. */
 2250|    105|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  349|    105|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2251|    105|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  349|    105|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2252|    105|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  349|    105|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2253|    105|                    op += length + MINMATCH;
  ------------------
  |  |  242|    105|#define MINMATCH 4
  ------------------
 2254|       |                    /* Both stages worked, load the next token. */
 2255|    105|                    continue;
 2256|    105|                }
 2257|       |
 2258|       |                /* The second stage didn't work out, but the info is ready.
 2259|       |                 * Propel it right to the point of match copying. */
 2260|    245|                goto _copy_match;
 2261|    350|            }
 2262|       |
 2263|       |            /* decode literal length */
 2264|    612|            if (length == RUN_MASK) {
  ------------------
  |  |  263|    612|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    612|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    612|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2264:17): [True: 161, False: 451]
  ------------------
 2265|    161|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  263|    161|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    161|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    161|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2266|    161|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2266:21): [True: 30, False: 131]
  ------------------
 2267|    131|                length += addl;
 2268|    131|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|    131|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    131|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 131]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2269|    131|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|    131|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    131|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 131]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2270|    131|            }
 2271|       |
 2272|    582|#if LZ4_FAST_DEC_LOOP
 2273|    998|        safe_literal_copy:
 2274|    998|#endif
 2275|       |            /* copy literals */
 2276|    998|            cpy = op+length;
 2277|       |
 2278|    998|            LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  277|    998|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2279|    998|            if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  246|    998|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  245|    799|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2279:17): [True: 199, False: 799]
  |  Branch (2279:39): [True: 250, False: 549]
  ------------------
 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|    449|                if (partialDecoding) {
  ------------------
  |  Branch (2285:21): [True: 0, False: 449]
  ------------------
 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|    449|                } 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|    449|                    if ((ip+length != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2312:25): [True: 330, False: 119]
  |  Branch (2312:48): [True: 3, False: 116]
  ------------------
 2313|    333|                        DEBUGLOG(5, "should have been last run of literals")
  ------------------
  |  |  289|    333|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2314|    333|                        DEBUGLOG(5, "ip(%p) + length(%i) = %p != iend (%p)", ip, (int)length, ip+length, iend);
  ------------------
  |  |  289|    333|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2315|    333|                        DEBUGLOG(5, "or cpy(%p) > (oend-MFLIMIT)(%p)", cpy, oend-MFLIMIT);
  ------------------
  |  |  289|    333|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2316|    333|                        DEBUGLOG(5, "after writing %u bytes / %i bytes available", (unsigned)(op-(BYTE*)dst), outputSize);
  ------------------
  |  |  289|    333|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2317|    333|                        goto _output_error;
 2318|    333|                    }
 2319|    449|                }
 2320|    116|                LZ4_memmove(op, ip, length);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  357|    116|#    define LZ4_memmove __builtin_memmove
  ------------------
 2321|    116|                ip += length;
 2322|    116|                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|    116|                if (!partialDecoding || (cpy == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2328:21): [True: 116, False: 0]
  |  Branch (2328:41): [True: 0, False: 0]
  |  Branch (2328:58): [True: 0, False: 0]
  ------------------
 2329|    116|                    break;
 2330|    116|                }
 2331|    549|            } else {
 2332|    549|                LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2333|    549|                ip += length; op = cpy;
 2334|    549|            }
 2335|       |
 2336|       |            /* get offset */
 2337|    549|            offset = LZ4_readLE16(ip); ip+=2;
 2338|    549|            match = op - offset;
 2339|       |
 2340|       |            /* get matchlength */
 2341|    549|            length = token & ML_MASK;
  ------------------
  |  |  261|    549|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    549|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2342|    549|            DEBUGLOG(7, "blockPos%6u: matchLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  289|    549|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2343|       |
 2344|    794|    _copy_match:
 2345|    794|            if (length == ML_MASK) {
  ------------------
  |  |  261|    794|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    794|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2345:17): [True: 429, False: 365]
  ------------------
 2346|    429|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  245|    429|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2347|    429|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2347:21): [True: 6, False: 423]
  ------------------
 2348|    423|                length += addl;
 2349|    423|                if (unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  180|    423|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    423|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 423]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2350|    423|            }
 2351|    788|            length += MINMATCH;
  ------------------
  |  |  242|    788|#define MINMATCH 4
  ------------------
 2352|       |
 2353|    788|#if LZ4_FAST_DEC_LOOP
 2354|    993|        safe_match_copy:
 2355|    993|#endif
 2356|    993|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error;   /* Error : offset outside buffers */
  ------------------
  |  |  180|    993|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    993|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2356:17): [True: 993, False: 0]
  |  Branch (2356:34): [True: 119, False: 874]
  ------------------
 2357|       |            /* match starting within external dictionary */
 2358|    874|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2358:17): [True: 419, False: 455]
  |  Branch (2358:41): [True: 57, False: 362]
  ------------------
 2359|     57|                assert(dictEnd != NULL);
  ------------------
  |  |  273|     57|#    define assert(condition) ((void)0)
  ------------------
 2360|     57|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  180|     57|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|     57|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 3, False: 54]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 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|     54|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2365:21): [True: 19, False: 35]
  ------------------
 2366|       |                    /* match fits entirely within external dictionary : just copy */
 2367|     19|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  357|     19|#    define LZ4_memmove __builtin_memmove
  ------------------
 2368|     19|                    op += length;
 2369|     35|                } else {
 2370|       |                    /* match stretches into both external dictionary and current block */
 2371|     35|                    size_t const copySize = (size_t)(lowPrefix - match);
 2372|     35|                    size_t const restSize = length - copySize;
 2373|     35|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  349|     35|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2374|     35|                    op += copySize;
 2375|     35|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2375:25): [True: 32, False: 3]
  ------------------
 2376|     32|                        BYTE* const endOfMatch = op + restSize;
 2377|     32|                        const BYTE* copyFrom = lowPrefix;
 2378|   148k|                        while (op < endOfMatch) *op++ = *copyFrom++;
  ------------------
  |  Branch (2378:32): [True: 148k, False: 32]
  ------------------
 2379|     32|                    } else {
 2380|      3|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  349|      3|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2381|      3|                        op += restSize;
 2382|      3|                }   }
 2383|     54|                continue;
 2384|     57|            }
 2385|    817|            assert(match >= lowPrefix);
  ------------------
  |  |  273|    817|#    define assert(condition) ((void)0)
  ------------------
 2386|       |
 2387|       |            /* copy match within block */
 2388|    817|            cpy = op + length;
 2389|       |
 2390|       |            /* partialDecoding : may end anywhere within the block */
 2391|    817|            assert(op<=oend);
  ------------------
  |  |  273|    817|#    define assert(condition) ((void)0)
  ------------------
 2392|    817|            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: 817]
  |  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|    817|            if (unlikely(offset<8)) {
  ------------------
  |  |  180|    817|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    817|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 464, False: 353]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2407|    464|                LZ4_write32(op, 0);   /* silence msan warning when offset==0 */
 2408|    464|                op[0] = match[0];
 2409|    464|                op[1] = match[1];
 2410|    464|                op[2] = match[2];
 2411|    464|                op[3] = match[3];
 2412|    464|                match += inc32table[offset];
 2413|    464|                LZ4_memcpy(op+4, match, 4);
  ------------------
  |  |  349|    464|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2414|    464|                match -= dec64table[offset];
 2415|    464|            } else {
 2416|    353|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  349|    353|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2417|    353|                match += 8;
 2418|    353|            }
 2419|    817|            op += 8;
 2420|       |
 2421|    817|            if (unlikely(cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  180|    817|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    817|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 177, False: 640]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2422|    177|                BYTE* const oCopyLimit = oend - (WILDCOPYLENGTH-1);
  ------------------
  |  |  244|    177|#define WILDCOPYLENGTH 8
  ------------------
 2423|    177|                if (cpy > oend-LASTLITERALS) { goto _output_error; } /* Error : last LASTLITERALS bytes must be literals (uncompressed) */
  ------------------
  |  |  245|    177|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2423:21): [True: 26, False: 151]
  ------------------
 2424|    151|                if (op < oCopyLimit) {
  ------------------
  |  Branch (2424:21): [True: 146, False: 5]
  ------------------
 2425|    146|                    LZ4_wildCopy8(op, match, oCopyLimit);
 2426|    146|                    match += oCopyLimit - op;
 2427|    146|                    op = oCopyLimit;
 2428|    146|                }
 2429|    368|                while (op < cpy) { *op++ = *match++; }
  ------------------
  |  Branch (2429:24): [True: 217, False: 151]
  ------------------
 2430|    640|            } else {
 2431|    640|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  349|    640|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2432|    640|                if (length > 16) { LZ4_wildCopy8(op+8, match+8, cpy); }
  ------------------
  |  Branch (2432:21): [True: 354, False: 286]
  ------------------
 2433|    640|            }
 2434|    791|            op = cpy;   /* wildcopy correction */
 2435|    791|        }
 2436|       |
 2437|       |        /* end of decoding */
 2438|    116|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  289|    116|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2439|    116|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2440|       |
 2441|       |        /* Overflow error detected */
 2442|    643|    _output_error:
 2443|    643|        return (int) (-(((const char*)ip)-src))-1;
 2444|     12|    }
 2445|     12|}
lz4.c:read_variable_length:
 1981|  49.8k|{
 1982|  49.8k|    Rvl_t s, length = 0;
 1983|  49.8k|    assert(ip != NULL);
  ------------------
  |  |  273|  49.8k|#    define assert(condition) ((void)0)
  ------------------
 1984|  49.8k|    assert(*ip !=  NULL);
  ------------------
  |  |  273|  49.8k|#    define assert(condition) ((void)0)
  ------------------
 1985|  49.8k|    assert(ilimit != NULL);
  ------------------
  |  |  273|  49.8k|#    define assert(condition) ((void)0)
  ------------------
 1986|  49.8k|    if (initial_check && unlikely((*ip) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|  2.44k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  2.44k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 29, False: 2.41k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1986:9): [True: 2.44k, False: 47.4k]
  ------------------
 1987|     29|        return rvl_error;
 1988|     29|    }
 1989|  49.8k|    s = **ip;
 1990|  49.8k|    (*ip)++;
 1991|  49.8k|    length += s;
 1992|  49.8k|    if (unlikely((*ip) > ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|  49.8k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  49.8k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 6, False: 49.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1993|      6|        return rvl_error;
 1994|      6|    }
 1995|       |    /* accumulator overflow detection (32-bit mode only) */
 1996|  49.8k|    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: 49.8k]
  ------------------
 1997|      0|        return rvl_error;
 1998|      0|    }
 1999|  49.8k|    if (likely(s != 255)) return length;
  ------------------
  |  |  177|  49.8k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|  49.8k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 48.1k, False: 1.75k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2000|  80.8k|    do {
 2001|  80.8k|        s = **ip;
 2002|  80.8k|        (*ip)++;
 2003|  80.8k|        length += s;
 2004|  80.8k|        if (unlikely((*ip) > ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|  80.8k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  80.8k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 14, False: 80.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2005|     14|            return rvl_error;
 2006|     14|        }
 2007|       |        /* accumulator overflow detection (32-bit mode only) */
 2008|  80.8k|        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: 80.8k]
  ------------------
 2009|      0|            return rvl_error;
 2010|      0|        }
 2011|  80.8k|    } while (s == 255);
  ------------------
  |  Branch (2011:14): [True: 79.0k, False: 1.73k]
  ------------------
 2012|       |
 2013|  1.73k|    return length;
 2014|  1.75k|}
lz4.c:LZ4_wildCopy32:
  523|  20.6k|{
  524|  20.6k|    BYTE* d = (BYTE*)dstPtr;
  525|  20.6k|    const BYTE* s = (const BYTE*)srcPtr;
  526|  20.6k|    BYTE* const e = (BYTE*)dstEnd;
  527|       |
  528|   254k|    do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  349|   254k|#    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|   254k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (528:79): [True: 233k, False: 20.6k]
  ------------------
  529|  20.6k|}
lz4.c:LZ4_readLE16:
  431|  76.6k|{
  432|  76.6k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (432:9): [True: 76.6k, False: 0]
  ------------------
  433|  76.6k|        return LZ4_read16(memPtr);
  434|  76.6k|    } else {
  435|      0|        const BYTE* p = (const BYTE*)memPtr;
  436|      0|        return (U16)((U16)p[0] | (p[1]<<8));
  437|      0|    }
  438|  76.6k|}
lz4.c:LZ4_memcpy_using_offset:
  536|  38.2k|{
  537|  38.2k|    BYTE v[8];
  538|       |
  539|  38.2k|    assert(dstEnd >= dstPtr + MINMATCH);
  ------------------
  |  |  273|  38.2k|#    define assert(condition) ((void)0)
  ------------------
  540|       |
  541|  38.2k|    switch(offset) {
  542|  29.3k|    case 1:
  ------------------
  |  Branch (542:5): [True: 29.3k, False: 8.87k]
  ------------------
  543|  29.3k|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  236|  29.3k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  234|  29.3k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  544|  29.3k|        break;
  545|    311|    case 2:
  ------------------
  |  Branch (545:5): [True: 311, False: 37.9k]
  ------------------
  546|    311|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  349|    311|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  547|    311|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  349|    311|#    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|    311|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  349|    311|#    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|    311|        break;
  557|    513|    case 4:
  ------------------
  |  Branch (557:5): [True: 513, False: 37.7k]
  ------------------
  558|    513|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  349|    513|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  559|    513|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  349|    513|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  560|    513|        break;
  561|  8.05k|    default:
  ------------------
  |  Branch (561:5): [True: 8.05k, False: 30.1k]
  ------------------
  562|  8.05k|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  563|  8.05k|        return;
  564|  38.2k|    }
  565|       |
  566|  30.1k|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  349|  30.1k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  567|  30.1k|    dstPtr += 8;
  568|  1.03M|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (568:12): [True: 1.00M, False: 30.1k]
  ------------------
  569|  1.00M|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  349|  1.00M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  570|  1.00M|        dstPtr += 8;
  571|  1.00M|    }
  572|  30.1k|}
lz4.c:LZ4_memcpy_using_offset_base:
  497|  8.05k|{
  498|  8.05k|    assert(srcPtr + offset == dstPtr);
  ------------------
  |  |  273|  8.05k|#    define assert(condition) ((void)0)
  ------------------
  499|  8.05k|    if (offset < 8) {
  ------------------
  |  Branch (499:9): [True: 7.49k, False: 562]
  ------------------
  500|  7.49k|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  501|  7.49k|        dstPtr[0] = srcPtr[0];
  502|  7.49k|        dstPtr[1] = srcPtr[1];
  503|  7.49k|        dstPtr[2] = srcPtr[2];
  504|  7.49k|        dstPtr[3] = srcPtr[3];
  505|  7.49k|        srcPtr += inc32table[offset];
  506|  7.49k|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  349|  7.49k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  507|  7.49k|        srcPtr -= dec64table[offset];
  508|  7.49k|        dstPtr += 8;
  509|  7.49k|    } else {
  510|    562|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  349|    562|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  511|    562|        dstPtr += 8;
  512|    562|        srcPtr += 8;
  513|    562|    }
  514|       |
  515|  8.05k|    LZ4_wildCopy8(dstPtr, srcPtr, dstEnd);
  516|  8.05k|}

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

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

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

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

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

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

chunkset_avx2.c:loadhalfchunk:
   91|     42|static inline void loadhalfchunk(uint8_t const *s, halfchunk_t *chunk) {
   92|     42|    *chunk = _mm_loadu_si128((__m128i *)s);
   93|     42|}
chunkset_avx2.c:GET_HALFCHUNK_MAG:
  105|  1.20k|static inline halfchunk_t GET_HALFCHUNK_MAG(uint8_t *buf, uint32_t *chunk_rem, uint32_t dist) {
  106|  1.20k|    lut_rem_pair lut_rem = perm_idx_lut[dist - 3];
  107|  1.20k|    __m128i perm_vec, ret_vec;
  108|  1.20k|    __msan_unpoison(buf + dist, 16 - dist);
  ------------------
  |  |  338|  1.20k|#  define __msan_unpoison(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0)
  |  |  ------------------
  |  |  |  |  128|  1.20k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  |  |               #  define __msan_unpoison(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0)
  |  |  ------------------
  |  |  |  |  128|  1.20k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  |  |  |  Branch (338:79): [Folded, False: 1.20k]
  |  |  ------------------
  ------------------
  109|  1.20k|    ret_vec = _mm_loadu_si128((__m128i*)buf);
  110|  1.20k|    *chunk_rem = half_rem_vals[dist - 3];
  111|       |
  112|  1.20k|    perm_vec = _mm_load_si128((__m128i*)(permute_table + lut_rem.idx));
  113|  1.20k|    ret_vec = _mm_shuffle_epi8(ret_vec, perm_vec);
  114|       |
  115|  1.20k|    return ret_vec;
  116|  1.20k|}
chunkset_avx2.c:storehalfchunk:
   95|    236|static inline void storehalfchunk(uint8_t *out, halfchunk_t *chunk) {
   96|    236|    _mm_storeu_si128((__m128i *)out, *chunk);
   97|    236|}
chunkset_avx2.c:halfchunk2whole:
   99|  1.20k|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.20k|    return _mm256_zextsi128_si256(*chunk);
  103|  1.20k|}
chunkset_avx2.c:chunkmemset_2:
   22|  2.35k|static inline void chunkmemset_2(uint8_t *from, chunk_t *chunk) {
   23|  2.35k|    *chunk = _mm256_set1_epi16(zng_memread_2(from));
   24|  2.35k|}
chunkset_avx2.c:chunkmemset_4:
   26|  1.76k|static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) {
   27|  1.76k|    *chunk = _mm256_set1_epi32(zng_memread_4(from));
   28|  1.76k|}
chunkset_avx2.c:chunkmemset_8:
   30|    527|static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) {
   31|    527|    *chunk = _mm256_set1_epi64x(zng_memread_8(from));
   32|    527|}
chunkset_avx2.c:chunkmemset_16:
   34|  1.02k|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|  1.02k|    *chunk = _mm256_broadcastsi128_si256(_mm_loadu_si128((__m128i*)from));
   41|  1.02k|#endif
   42|  1.02k|}
chunkset_avx2.c:GET_CHUNK_MAG:
   52|  13.5k|static inline chunk_t GET_CHUNK_MAG(uint8_t *buf, uint32_t *chunk_rem, uint32_t dist) {
   53|  13.5k|    lut_rem_pair lut_rem = perm_idx_lut[dist - 3];
   54|  13.5k|    __m256i ret_vec;
   55|       |    /* While technically we only need to read 4 or 8 bytes into this vector register for a lot of cases, GCC is
   56|       |     * compiling this to a shared load for all branches, preferring the simpler code.  Given that the buf value isn't in
   57|       |     * GPRs to begin with the 256 bit load is _probably_ just as inexpensive */
   58|  13.5k|    *chunk_rem = lut_rem.remval;
   59|       |
   60|       |    /* See note in chunkset_ssse3.c for why this is ok */
   61|  13.5k|    __msan_unpoison(buf + dist, 32 - dist);
  ------------------
  |  |  338|  13.5k|#  define __msan_unpoison(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0)
  |  |  ------------------
  |  |  |  |  128|  13.5k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  |  |               #  define __msan_unpoison(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0)
  |  |  ------------------
  |  |  |  |  128|  13.5k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  |  |  |  Branch (338:79): [Folded, False: 13.5k]
  |  |  ------------------
  ------------------
   62|       |
   63|  13.5k|    if (dist < 16) {
  ------------------
  |  Branch (63:9): [True: 8.28k, False: 5.25k]
  ------------------
   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|  8.28k|        const __m256i permute_xform =
   68|  8.28k|            _mm256_setr_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   69|  8.28k|                             16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16);
   70|  8.28k|        __m256i perm_vec = _mm256_load_si256((__m256i*)(permute_table+lut_rem.idx));
   71|  8.28k|        __m128i ret_vec0 = _mm_loadu_si128((__m128i*)buf);
   72|  8.28k|        perm_vec = _mm256_add_epi8(perm_vec, permute_xform);
   73|  8.28k|        ret_vec = _mm256_inserti128_si256(_mm256_castsi128_si256(ret_vec0), ret_vec0, 1);
   74|  8.28k|        ret_vec = _mm256_shuffle_epi8(ret_vec, perm_vec);
   75|  8.28k|    }  else {
   76|  5.25k|        __m128i ret_vec0 = _mm_loadu_si128((__m128i*)buf);
   77|  5.25k|        __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|  5.25k|        __m128i perm_vec1 = _mm_load_si128((__m128i*)(permute_table + lut_rem.idx));
   80|  5.25k|        __m128i xlane_permutes = _mm_cmpgt_epi8(_mm_set1_epi8(16), perm_vec1);
   81|  5.25k|        __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|  5.25k|        __m128i latter_half = _mm_blendv_epi8(ret_vec1, xlane_res, xlane_permutes);
   85|  5.25k|        ret_vec = _mm256_inserti128_si256(_mm256_castsi128_si256(ret_vec0), latter_half, 1);
   86|  5.25k|    }
   87|       |
   88|  13.5k|    return ret_vec;
   89|  13.5k|}
chunkset_avx2.c:storechunk:
   48|   361k|static inline void storechunk(uint8_t *out, chunk_t *chunk) {
   49|   361k|    _mm256_storeu_si256((__m256i *)out, *chunk);
   50|   361k|}
chunkset_avx2.c:loadchunk:
   44|   299k|static inline void loadchunk(uint8_t const *s, chunk_t *chunk) {
   45|   299k|    *chunk = _mm256_loadu_si256((__m256i *)s);
   46|   299k|}

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.24k|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.24k|    len = MIN(len, left);
  ------------------
  |  |  124|  3.24k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 0, False: 3.24k]
  |  |  ------------------
  ------------------
  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.24k|#ifndef HAVE_MASKED_READWRITE
  247|  3.24k|    if (UNLIKELY(left < sizeof(chunk_t))) {
  ------------------
  |  |  214|  3.24k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 82, False: 3.16k]
  |  |  ------------------
  ------------------
  248|    892|        while (len > 0) {
  ------------------
  |  Branch (248:16): [True: 810, False: 82]
  ------------------
  249|    810|            *out++ = *from++;
  250|    810|            --len;
  251|    810|        }
  252|       |
  253|     82|        return out;
  254|     82|    }
  255|  3.16k|#endif
  256|       |
  257|  3.16k|    if (len)
  ------------------
  |  Branch (257:9): [True: 3.16k, False: 0]
  ------------------
  258|  3.16k|        out = CHUNKMEMSET(out, from, len);
  ------------------
  |  |  121|  3.16k|#define CHUNKMEMSET      chunkmemset_avx2
  ------------------
  259|       |
  260|  3.16k|    return out;
  261|  3.24k|}
chunkset_avx2.c:chunkmemset_avx2:
  112|   177k|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|   177k|    Assert(from != out, "chunkmemset cannot have a distance 0");
  116|       |
  117|   177k|    chunk_t chunk_load;
  118|   177k|    uint32_t chunk_mod = 0;
  119|   177k|    uint32_t adv_amount;
  120|   177k|    int64_t sdist = out - from;
  121|   177k|    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|   177k|    if (sdist < 0 && dist < len) {
  ------------------
  |  Branch (127:9): [True: 0, False: 177k]
  |  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|   177k|    if (dist == 1) {
  ------------------
  |  Branch (143:9): [True: 156k, False: 20.8k]
  ------------------
  144|   156k|        memset(out, *from, len);
  145|   156k|        return out + len;
  146|   156k|    } else if (dist >= sizeof(chunk_t)) {
  ------------------
  |  Branch (146:16): [True: 420, False: 20.4k]
  ------------------
  147|    420|        return CHUNKCOPY(out, from, len);
  ------------------
  |  |  119|    420|#define CHUNKCOPY        chunkcopy_avx2
  ------------------
  148|    420|    }
  149|       |
  150|       |    /* Only AVX2+ as there's 128 bit vectors and 256 bit. We allow for shorter vector
  151|       |     * lengths because they serve to allow more cases to fall into chunkcopy, as the
  152|       |     * distance of the shorter length is still deemed a safe distance. We rewrite this
  153|       |     * here rather than calling the ssse3 variant directly now because doing so required
  154|       |     * dispatching to another function and broke inlining for this function entirely. We
  155|       |     * also can merge an assert and some remainder peeling behavior into the same code blocks,
  156|       |     * making the code a little smaller.  */
  157|  20.4k|#ifdef HAVE_HALF_CHUNK
  158|  20.4k|    if (len <= sizeof(halfchunk_t)) {
  ------------------
  |  Branch (158:9): [True: 3.01k, False: 17.4k]
  ------------------
  159|  3.01k|        if (dist >= sizeof(halfchunk_t))
  ------------------
  |  Branch (159:13): [True: 42, False: 2.97k]
  ------------------
  160|     42|            return HALFCHUNKCOPY(out, from, len);
  161|       |
  162|  2.97k|        if ((dist % 2) != 0 || dist == 6) {
  ------------------
  |  Branch (162:13): [True: 897, False: 2.07k]
  |  Branch (162:32): [True: 304, False: 1.77k]
  ------------------
  163|  1.20k|            halfchunk_t halfchunk_load = GET_HALFCHUNK_MAG(from, &chunk_mod, (unsigned)dist);
  164|       |
  165|  1.20k|            if (len == sizeof(halfchunk_t)) {
  ------------------
  |  Branch (165:17): [True: 194, False: 1.00k]
  ------------------
  166|    194|                storehalfchunk(out, &halfchunk_load);
  167|    194|                len -= sizeof(halfchunk_t);
  168|    194|                out += sizeof(halfchunk_t);
  169|    194|            }
  170|       |
  171|  1.20k|            chunk_load = halfchunk2whole(&halfchunk_load);
  172|  1.20k|            goto rem_bytes;
  173|  1.20k|        }
  174|  2.97k|    }
  175|  19.2k|#endif
  176|       |
  177|  19.2k|#ifdef HAVE_CHUNKMEMSET_2
  178|  19.2k|    if (dist == 2) {
  ------------------
  |  Branch (178:9): [True: 2.35k, False: 16.8k]
  ------------------
  179|  2.35k|        chunkmemset_2(from, &chunk_load);
  180|  2.35k|    } else
  181|  16.8k|#endif
  182|  16.8k|#ifdef HAVE_CHUNKMEMSET_4
  183|  16.8k|    if (dist == 4) {
  ------------------
  |  Branch (183:9): [True: 1.76k, False: 15.0k]
  ------------------
  184|  1.76k|        chunkmemset_4(from, &chunk_load);
  185|  1.76k|    } else
  186|  15.0k|#endif
  187|  15.0k|#ifdef HAVE_CHUNKMEMSET_8
  188|  15.0k|    if (dist == 8) {
  ------------------
  |  Branch (188:9): [True: 527, False: 14.5k]
  ------------------
  189|    527|        chunkmemset_8(from, &chunk_load);
  190|    527|    } else
  191|  14.5k|#endif
  192|  14.5k|#ifdef HAVE_CHUNKMEMSET_16
  193|  14.5k|    if (dist == 16) {
  ------------------
  |  Branch (193:9): [True: 1.02k, False: 13.5k]
  ------------------
  194|  1.02k|        chunkmemset_16(from, &chunk_load);
  195|  1.02k|    } else
  196|  13.5k|#endif
  197|  13.5k|    chunk_load = GET_CHUNK_MAG(from, &chunk_mod, (unsigned)dist);
  198|       |
  199|  19.2k|    adv_amount = sizeof(chunk_t) - chunk_mod;
  200|       |
  201|  45.3k|    while (len >= (2 * sizeof(chunk_t))) {
  ------------------
  |  Branch (201:12): [True: 26.1k, False: 19.2k]
  ------------------
  202|  26.1k|        storechunk(out, &chunk_load);
  203|  26.1k|        storechunk(out + adv_amount, &chunk_load);
  204|  26.1k|        out += 2 * adv_amount;
  205|  26.1k|        len -= 2 * adv_amount;
  206|  26.1k|    }
  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|  28.6k|    while (len >= sizeof(chunk_t)) {
  ------------------
  |  Branch (212:12): [True: 9.44k, False: 19.2k]
  ------------------
  213|  9.44k|        storechunk(out, &chunk_load);
  214|  9.44k|        len -= adv_amount;
  215|  9.44k|        out += adv_amount;
  216|  9.44k|    }
  217|       |
  218|  19.2k|#ifdef HAVE_HALF_CHUNK
  219|  20.4k|rem_bytes:
  220|  20.4k|#endif
  221|  20.4k|    if (len) {
  ------------------
  |  Branch (221:9): [True: 20.1k, False: 226]
  ------------------
  222|  20.1k|        memcpy(out, &chunk_load, len);
  223|  20.1k|        out += len;
  224|  20.1k|    }
  225|       |
  226|  20.4k|    return out;
  227|  19.2k|}
chunkset_avx2.c:HALFCHUNKCOPY:
   91|     42|static inline uint8_t* HALFCHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) {
   92|     42|    halfchunk_t chunk;
   93|     42|    int32_t align = ((len - 1) % sizeof(halfchunk_t)) + 1;
   94|     42|    loadhalfchunk(from, &chunk);
   95|     42|    storehalfchunk(out, &chunk);
   96|     42|    out += align;
   97|     42|    from += align;
   98|     42|    len -= align;
   99|     42|    while (len > 0) {
  ------------------
  |  Branch (99:12): [True: 0, False: 42]
  ------------------
  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|     42|    return out;
  107|     42|}
chunkset_avx2.c:chunksize_avx2:
    9|   177k|static inline size_t CHUNKSIZE(void) {
   10|   177k|    return sizeof(chunk_t);
   11|   177k|}
chunkset_avx2.c:chunkcopy_avx2:
   24|  51.0k|static inline uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) {
   25|  51.0k|    Assert(len > 0, "chunkcopy should never have a length 0");
   26|  51.0k|    chunk_t chunk;
   27|  51.0k|    int32_t align = ((len - 1) % sizeof(chunk_t)) + 1;
   28|  51.0k|    loadchunk(from, &chunk);
   29|  51.0k|    storechunk(out, &chunk);
   30|  51.0k|    out += align;
   31|  51.0k|    from += align;
   32|  51.0k|    len -= align;
   33|   299k|    while (len > 0) {
  ------------------
  |  Branch (33:12): [True: 248k, False: 51.0k]
  ------------------
   34|   248k|        loadchunk(from, &chunk);
   35|   248k|        storechunk(out, &chunk);
   36|   248k|        out += sizeof(chunk_t);
   37|   248k|        from += sizeof(chunk_t);
   38|   248k|        len -= sizeof(chunk_t);
   39|   248k|    }
   40|  51.0k|    return out;
   41|  51.0k|}

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

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

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

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

zng_inflate_table:
   31|    744|                                code * *table, unsigned *bits, uint16_t *work) {
   32|    744|    unsigned len;               /* a code's length in bits */
   33|    744|    unsigned sym;               /* index of code symbols */
   34|    744|    unsigned min, max;          /* minimum and maximum code lengths */
   35|    744|    unsigned root;              /* number of index bits for root table */
   36|    744|    unsigned curr;              /* number of index bits for current table */
   37|    744|    unsigned drop;              /* code bits to drop for sub-table */
   38|    744|    int left;                   /* number of prefix codes available */
   39|    744|    unsigned used;              /* code entries in table used */
   40|    744|    unsigned huff;              /* Huffman code */
   41|    744|    unsigned incr;              /* for incrementing code, index */
   42|    744|    unsigned fill;              /* index for replicating entries */
   43|    744|    unsigned low;               /* low bits for current root entry */
   44|    744|    unsigned mask;              /* mask for low root bits */
   45|    744|    code here;                  /* table entry for duplication */
   46|    744|    code *next;                 /* next available space in table */
   47|    744|    const uint16_t *base;       /* base value table to use */
   48|    744|    const uint16_t *extra;      /* extra bits table to use */
   49|    744|    unsigned match;             /* use base and extra for symbol >= match */
   50|    744|    uint16_t count[MAX_BITS+1];  /* number of codes of each length */
   51|    744|    uint16_t offs[MAX_BITS+1];   /* offsets in table for each length */
   52|    744|    static const uint16_t lbase[31] = { /* Length codes 257..285 base */
   53|    744|        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
   54|    744|        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
   55|    744|    static const uint16_t lext[31] = { /* Length codes 257..285 extra */
   56|    744|        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
   57|    744|        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77};
   58|    744|    static const uint16_t dbase[32] = { /* Distance codes 0..29 base */
   59|    744|        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
   60|    744|        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
   61|    744|        8193, 12289, 16385, 24577, 0, 0};
   62|    744|    static const uint16_t dext[32] = { /* Distance codes 0..29 extra */
   63|    744|        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
   64|    744|        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
   65|    744|        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.6k|    for (len = 0; len <= MAX_BITS; len++)
  ------------------
  |  |   39|  12.6k|#define MAX_BITS 15
  ------------------
  |  Branch (99:19): [True: 11.9k, False: 744]
  ------------------
  100|  11.9k|        count[len] = 0;
  101|  79.5k|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (101:19): [True: 78.8k, False: 744]
  ------------------
  102|  78.8k|        count[lens[sym]]++;
  103|       |
  104|       |    /* bound code lengths, force root to be within code lengths */
  105|    744|    root = *bits;
  106|  5.84k|    for (max = MAX_BITS; max >= 1; max--)
  ------------------
  |  |   39|    744|#define MAX_BITS 15
  ------------------
  |  Branch (106:26): [True: 5.84k, False: 7]
  ------------------
  107|  5.84k|        if (count[max] != 0) break;
  ------------------
  |  Branch (107:13): [True: 737, False: 5.10k]
  ------------------
  108|    744|    root = MIN(root, max);
  ------------------
  |  |  124|    744|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 204, False: 540]
  |  |  ------------------
  ------------------
  109|    744|    if (UNLIKELY(max == 0)) {           /* no symbols to code at all */
  ------------------
  |  |  214|    744|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 7, False: 737]
  |  |  ------------------
  ------------------
  110|      7|        here.op = (unsigned char)64;    /* invalid code marker */
  111|      7|        here.bits = (unsigned char)1;
  112|      7|        here.val = (uint16_t)0;
  113|      7|        *(*table)++ = here;             /* make a table to force an error */
  114|      7|        *(*table)++ = here;
  115|      7|        *bits = 1;
  116|      7|        return 0;     /* no symbols, but wait for decoding to report error */
  117|      7|    }
  118|  1.23k|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (118:19): [True: 1.19k, False: 37]
  ------------------
  119|  1.19k|        if (count[min] != 0) break;
  ------------------
  |  Branch (119:13): [True: 700, False: 497]
  ------------------
  120|    737|    root = MAX(root, min);
  ------------------
  |  |  126|    737|#define MAX(a, b) ((a) < (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (126:20): [True: 2, False: 735]
  |  |  ------------------
  ------------------
  121|       |
  122|       |    /* check for an over-subscribed or incomplete set of lengths */
  123|    737|    left = 1;
  124|  10.9k|    for (len = 1; len <= MAX_BITS; len++) {
  ------------------
  |  |   39|  10.9k|#define MAX_BITS 15
  ------------------
  |  Branch (124:19): [True: 10.3k, False: 647]
  ------------------
  125|  10.3k|        left <<= 1;
  126|  10.3k|        left -= count[len];
  127|  10.3k|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (127:13): [True: 90, False: 10.2k]
  ------------------
  128|  10.3k|    }
  129|    647|    if (left > 0 && (type == CODES || max != 1))
  ------------------
  |  Branch (129:9): [True: 46, False: 601]
  |  Branch (129:22): [True: 13, False: 33]
  |  Branch (129:39): [True: 32, False: 1]
  ------------------
  130|     45|        return -1;                      /* incomplete set */
  131|       |
  132|       |    /* generate offsets into symbol table for each length for sorting */
  133|    602|    offs[1] = 0;
  134|  9.03k|    for (len = 1; len < MAX_BITS; len++)
  ------------------
  |  |   39|  9.03k|#define MAX_BITS 15
  ------------------
  |  Branch (134:19): [True: 8.42k, False: 602]
  ------------------
  135|  8.42k|        offs[len + 1] = offs[len] + count[len];
  136|       |
  137|       |    /* sort symbols by length, by symbol order within each length */
  138|  56.3k|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (138:19): [True: 55.7k, False: 602]
  ------------------
  139|  55.7k|        if (lens[sym] != 0) work[offs[lens[sym]]++] = (uint16_t)sym;
  ------------------
  |  Branch (139:13): [True: 47.5k, False: 8.19k]
  ------------------
  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|    602|    switch (type) {
  174|    300|    case CODES:
  ------------------
  |  Branch (174:5): [True: 300, False: 302]
  ------------------
  175|    300|        base = extra = work;    /* dummy value--not used */
  176|    300|        match = 20;
  177|    300|        break;
  178|    161|    case LENS:
  ------------------
  |  Branch (178:5): [True: 161, False: 441]
  ------------------
  179|    161|        base = lbase;
  180|    161|        extra = lext;
  181|    161|        match = 257;
  182|    161|        break;
  183|    141|    default:    /* DISTS */
  ------------------
  |  Branch (183:5): [True: 141, False: 461]
  ------------------
  184|    141|        base = dbase;
  185|    141|        extra = dext;
  186|    141|        match = 0;
  187|    602|    }
  188|       |
  189|       |    /* initialize state for loop */
  190|    602|    huff = 0;                   /* starting code */
  191|    602|    sym = 0;                    /* starting code symbol */
  192|    602|    len = min;                  /* starting code length */
  193|    602|    next = *table;              /* current table to fill in */
  194|    602|    curr = root;                /* current table index bits */
  195|    602|    drop = 0;                   /* current bits to drop from code for index */
  196|    602|    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
  197|    602|    used = 1U << root;          /* use root table entries */
  198|    602|    mask = used - 1;            /* mask for comparing low */
  199|       |
  200|       |    /* check available table space */
  201|    602|    if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   52|    161|#define ENOUGH_LENS 1332
  ------------------
  |  Branch (201:10): [True: 161, False: 441]
  |  Branch (201:26): [True: 0, False: 161]
  ------------------
  202|    602|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   53|    141|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (202:10): [True: 141, False: 461]
  |  Branch (202:27): [True: 0, False: 141]
  ------------------
  203|      0|        return 1;
  204|       |
  205|       |    /* process all codes and make table entries */
  206|  47.5k|    for (;;) {
  207|       |        /* create table entry */
  208|  47.5k|        here.bits = (unsigned char)(len - drop);
  209|  47.5k|        if (LIKELY(work[sym] >= match)) {
  ------------------
  |  |  213|  47.5k|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (213:33): [True: 3.53k, False: 44.0k]
  |  |  ------------------
  ------------------
  210|  3.53k|            here.op = (unsigned char)(extra[work[sym] - match]);
  211|  3.53k|            here.val = base[work[sym] - match];
  212|  44.0k|        } else if (work[sym] + 1U < match) {
  ------------------
  |  Branch (212:20): [True: 43.8k, False: 161]
  ------------------
  213|  43.8k|            here.op = (unsigned char)0;
  214|  43.8k|            here.val = work[sym];
  215|  43.8k|        } else {
  216|    161|            here.op = (unsigned char)(32 + 64);         /* end of block */
  217|    161|            here.val = 0;
  218|    161|        }
  219|       |
  220|       |        /* replicate for those indices with low len bits equal to huff */
  221|  47.5k|        incr = 1U << (len - drop);
  222|  47.5k|        fill = 1U << curr;
  223|  47.5k|        min = fill;                 /* save offset to next table */
  224|   248k|        do {
  225|   248k|            fill -= incr;
  226|   248k|            next[(huff >> drop) + fill] = here;
  227|   248k|        } while (fill != 0);
  ------------------
  |  Branch (227:18): [True: 200k, False: 47.5k]
  ------------------
  228|       |
  229|       |        /* backwards increment the len-bit code huff */
  230|  47.5k|        incr = 1U << (len - 1);
  231|  94.5k|        while (huff & incr)
  ------------------
  |  Branch (231:16): [True: 46.9k, False: 47.5k]
  ------------------
  232|  46.9k|            incr >>= 1;
  233|  47.5k|        if (incr != 0) {
  ------------------
  |  Branch (233:13): [True: 46.9k, False: 601]
  ------------------
  234|  46.9k|            huff &= incr - 1;
  235|  46.9k|            huff += incr;
  236|  46.9k|        } else {
  237|    601|            huff = 0;
  238|    601|        }
  239|       |
  240|       |        /* go to next symbol, update count, len */
  241|  47.5k|        sym++;
  242|  47.5k|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (242:13): [True: 3.28k, False: 44.2k]
  ------------------
  243|  3.28k|            if (len == max)
  ------------------
  |  Branch (243:17): [True: 602, False: 2.68k]
  ------------------
  244|    602|                break;
  245|  2.68k|            len = lens[work[sym]];
  246|  2.68k|        }
  247|       |
  248|       |        /* create new sub-table if needed */
  249|  46.9k|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (249:13): [True: 7.16k, False: 39.8k]
  |  Branch (249:27): [True: 3.42k, False: 3.74k]
  ------------------
  250|       |            /* if first time, transition to sub-tables */
  251|  3.42k|            if (drop == 0)
  ------------------
  |  Branch (251:17): [True: 168, False: 3.25k]
  ------------------
  252|    168|                drop = root;
  253|       |
  254|       |            /* increment past last table */
  255|  3.42k|            next += min;            /* here min is 1 << curr */
  256|       |
  257|       |            /* determine length of next table */
  258|  3.42k|            curr = len - drop;
  259|  3.42k|            left = (int)(1 << curr);
  260|  3.44k|            while (curr + drop < max) {
  ------------------
  |  Branch (260:20): [True: 51, False: 3.39k]
  ------------------
  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.42k|            used += 1U << curr;
  270|  3.42k|            if ((type == LENS && used > ENOUGH_LENS) || (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   52|  3.29k|#define ENOUGH_LENS 1332
  ------------------
                          if ((type == LENS && used > ENOUGH_LENS) || (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   53|    129|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (270:18): [True: 3.29k, False: 129]
  |  Branch (270:34): [True: 0, False: 3.29k]
  |  Branch (270:58): [True: 129, False: 3.29k]
  |  Branch (270:75): [True: 0, False: 129]
  ------------------
  271|      0|                return 1;
  272|       |
  273|       |            /* point entry in root table to sub-table */
  274|  3.42k|            low = huff & mask;
  275|  3.42k|            (*table)[low].op = (unsigned char)curr;
  276|  3.42k|            (*table)[low].bits = (unsigned char)root;
  277|  3.42k|            (*table)[low].val = (uint16_t)(next - *table);
  278|  3.42k|        }
  279|  46.9k|    }
  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|    602|    if (UNLIKELY(huff != 0)) {
  ------------------
  |  |  214|    602|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 1, False: 601]
  |  |  ------------------
  ------------------
  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|    602|    *table += used;
  293|    602|    *bits = root;
  294|    602|    return 0;
  295|    602|}

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

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

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

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

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

zstd_decompress_block.c:ZSTD_highbit32:
  175|   326k|{
  176|   326k|    assert(val != 0);
  ------------------
  |  |   70|   326k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|   326k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|   326k|}
zstd_decompress_block.c:ZSTD_countLeadingZeros32:
   70|   326k|{
   71|   326k|    assert(val != 0);
  ------------------
  |  |   70|   326k|#    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|   326k|}
entropy_common.c:ZSTD_countTrailingZeros32:
   29|  5.96k|{
   30|  5.96k|    assert(val != 0);
  ------------------
  |  |   70|  5.96k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   31|       |#if defined(_MSC_VER)
   32|       |#  if STATIC_BMI2
   33|       |    return (unsigned)_tzcnt_u32(val);
   34|       |#  else
   35|       |    if (val != 0) {
   36|       |        unsigned long r;
   37|       |        _BitScanForward(&r, val);
   38|       |        return (unsigned)r;
   39|       |    } else {
   40|       |        __assume(0); /* Should not reach this code path */
   41|       |    }
   42|       |#  endif
   43|       |#elif defined(__GNUC__) && (__GNUC__ >= 4)
   44|       |    return (unsigned)__builtin_ctz(val);
   45|       |#elif defined(__ICCARM__)
   46|       |    return (unsigned)__builtin_ctz(val);
   47|       |#else
   48|       |    return ZSTD_countTrailingZeros32_fallback(val);
   49|       |#endif
   50|  5.96k|}
entropy_common.c:ZSTD_highbit32:
  175|  15.4k|{
  176|  15.4k|    assert(val != 0);
  ------------------
  |  |   70|  15.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  15.4k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  15.4k|}
entropy_common.c:ZSTD_countLeadingZeros32:
   70|  15.4k|{
   71|  15.4k|    assert(val != 0);
  ------------------
  |  |   70|  15.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|  15.4k|}
fse_decompress.c:ZSTD_highbit32:
  175|  46.7k|{
  176|  46.7k|    assert(val != 0);
  ------------------
  |  |   70|  46.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  46.7k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  46.7k|}
fse_decompress.c:ZSTD_countLeadingZeros32:
   70|  46.7k|{
   71|  46.7k|    assert(val != 0);
  ------------------
  |  |   70|  46.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|  46.7k|}
huf_decompress.c:ZSTD_highbit32:
  175|  1.27k|{
  176|  1.27k|    assert(val != 0);
  ------------------
  |  |   70|  1.27k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  1.27k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  1.27k|}
huf_decompress.c:ZSTD_countLeadingZeros32:
   70|  1.27k|{
   71|  1.27k|    assert(val != 0);
  ------------------
  |  |   70|  1.27k|#    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.27k|}
huf_decompress.c:ZSTD_countTrailingZeros64:
   94|    369|{
   95|    369|    assert(val != 0);
  ------------------
  |  |   70|    369|#    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|    369|}

zstd_decompress_block.c:BIT_initDStream:
  255|  2.19k|{
  256|  2.19k|    if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   46|      5|# 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|      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 (256:9): [True: 5, False: 2.19k]
  ------------------
  257|       |
  258|  2.19k|    bitD->start = (const char*)srcBuffer;
  259|  2.19k|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|  2.19k|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 2.12k, False: 63]
  ------------------
  262|  2.12k|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|  2.12k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|  2.12k|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|  2.12k|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 2.01k, False: 115]
  ------------------
  266|  2.12k|          if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
  ------------------
  |  |   49|    115|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    115|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    115|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (266:15): [True: 115, False: 2.01k]
  ------------------
  267|  2.12k|    } else {
  268|     63|        bitD->ptr   = bitD->start;
  269|     63|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|     63|        switch(srcSize)
  271|     63|        {
  272|     10|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 10, False: 53]
  ------------------
  273|     10|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     10|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|     15|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 5, False: 58]
  ------------------
  276|     15|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     15|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|     19|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 4, False: 59]
  ------------------
  279|     19|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     19|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|     28|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 9, False: 54]
  ------------------
  282|     28|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     28|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|     36|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 8, False: 55]
  ------------------
  285|     36|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     36|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|     49|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 13, False: 50]
  ------------------
  288|     49|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     49|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|     63|        default: break;
  ------------------
  |  Branch (290:9): [True: 14, False: 49]
  ------------------
  291|     63|        }
  292|     63|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|     63|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 55, False: 8]
  ------------------
  294|     63|            if (lastByte == 0) return ERROR(corruption_detected);  /* endMark not present */
  ------------------
  |  |   49|      8|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      8|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      8|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (294:17): [True: 8, False: 55]
  ------------------
  295|     63|        }
  296|     55|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|     55|    }
  298|       |
  299|  2.06k|    return srcSize;
  300|  2.19k|}
zstd_decompress_block.c:BIT_readBits:
  363|  7.90M|{
  364|  7.90M|    BitContainerType const value = BIT_lookBits(bitD, nbBits);
  365|  7.90M|    BIT_skipBits(bitD, nbBits);
  366|  7.90M|    return value;
  367|  7.90M|}
zstd_decompress_block.c:BIT_lookBits:
  331|  7.90M|{
  332|       |    /* arbitrate between double-shift and shift+mask */
  333|  7.90M|#if 1
  334|       |    /* if bitD->bitsConsumed + nbBits > sizeof(bitD->bitContainer)*8,
  335|       |     * bitstream is likely corrupted, and result is undefined */
  336|  7.90M|    return BIT_getMiddleBits(bitD->bitContainer, (sizeof(bitD->bitContainer)*8) - bitD->bitsConsumed - nbBits, nbBits);
  337|       |#else
  338|       |    /* this code path is slower on my os-x laptop */
  339|       |    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  340|       |    return ((bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> 1) >> ((regMask-nbBits) & regMask);
  341|       |#endif
  342|  7.90M|}
zstd_decompress_block.c:BIT_getMiddleBits:
  308|  7.90M|{
  309|  7.90M|    U32 const regMask = sizeof(bitContainer)*8 - 1;
  310|       |    /* if start > regMask, bitstream is corrupted, and result is undefined */
  311|  7.90M|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  7.90M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  312|       |    /* x86 transform & ((1 << nbBits) - 1) to bzhi instruction, it is better
  313|       |     * than accessing memory. When bmi2 instruction is not present, we consider
  314|       |     * such cpus old (pre-Haswell, 2013) and their performance is not of that
  315|       |     * importance.
  316|       |     */
  317|  7.90M|#if defined(__x86_64__) || defined(_M_X64)
  318|  7.90M|    return (bitContainer >> (start & regMask)) & ((((U64)1) << nbBits) - 1);
  319|       |#else
  320|       |    return (bitContainer >> (start & regMask)) & BIT_mask[nbBits];
  321|       |#endif
  322|  7.90M|}
zstd_decompress_block.c:BIT_skipBits:
  354|  9.80M|{
  355|  9.80M|    bitD->bitsConsumed += nbBits;
  356|  9.80M|}
zstd_decompress_block.c:BIT_reloadDStream:
  413|  2.64M|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|  2.64M|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  188|  2.64M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 2.47M, False: 166k]
  |  |  ------------------
  ------------------
  416|  2.47M|        static const BitContainerType zeroFilled = 0;
  417|  2.47M|        bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
  418|       |        /* overflow detected, erroneous scenario or end of stream: no update */
  419|  2.47M|        return BIT_DStream_overflow;
  420|  2.47M|    }
  421|       |
  422|   166k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|   166k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|   166k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 120k, False: 45.4k]
  ------------------
  425|   120k|        return BIT_reloadDStream_internal(bitD);
  426|   120k|    }
  427|  45.4k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 23.6k, False: 21.7k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|  23.6k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 23.4k, False: 161]
  ------------------
  430|    161|        return BIT_DStream_completed;
  431|  23.6k|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  21.7k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  21.7k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  21.7k|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (435:13): [True: 888, False: 20.8k]
  ------------------
  436|    888|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|    888|            result = BIT_DStream_endOfBuffer;
  438|    888|        }
  439|  21.7k|        bitD->ptr -= nbBytes;
  440|  21.7k|        bitD->bitsConsumed -= nbBytes*8;
  441|  21.7k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  21.7k|        return result;
  443|  45.4k|    }
  444|  45.4k|}
zstd_decompress_block.c:BIT_reloadDStream_internal:
  385|   120k|{
  386|   120k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|   120k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|   120k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|   120k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|   120k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|   120k|    bitD->bitsConsumed &= 7;
  390|   120k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|   120k|    return BIT_DStream_unfinished;
  392|   120k|}
zstd_decompress_block.c:BIT_readBitsFast:
  372|  1.89M|{
  373|  1.89M|    BitContainerType const value = BIT_lookBitsFast(bitD, nbBits);
  374|  1.89M|    assert(nbBits >= 1);
  ------------------
  |  |   70|  1.89M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  375|  1.89M|    BIT_skipBits(bitD, nbBits);
  376|  1.89M|    return value;
  377|  1.89M|}
zstd_decompress_block.c:BIT_lookBitsFast:
  347|  1.89M|{
  348|  1.89M|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|  1.89M|    assert(nbBits >= 1);
  ------------------
  |  |   70|  1.89M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|  1.89M|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|  1.89M|}
zstd_decompress_block.c:BIT_endOfDStream:
  450|    446|{
  451|    446|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (451:13): [True: 409, False: 37]
  |  Branch (451:49): [True: 394, False: 15]
  ------------------
  452|    446|}
fse_decompress.c:BIT_initDStream:
  255|    881|{
  256|    881|    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: 878]
  ------------------
  257|       |
  258|    878|    bitD->start = (const char*)srcBuffer;
  259|    878|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|    878|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 745, False: 133]
  ------------------
  262|    745|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|    745|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|    745|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|    745|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 706, False: 39]
  ------------------
  266|    745|          if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
  ------------------
  |  |   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 (266:15): [True: 39, False: 706]
  ------------------
  267|    745|    } else {
  268|    133|        bitD->ptr   = bitD->start;
  269|    133|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|    133|        switch(srcSize)
  271|    133|        {
  272|     10|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 10, False: 123]
  ------------------
  273|     10|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     10|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|     18|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 8, False: 125]
  ------------------
  276|     18|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     18|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|     36|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 18, False: 115]
  ------------------
  279|     36|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     36|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|     66|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 30, False: 103]
  ------------------
  282|     66|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     66|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|     98|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 32, False: 101]
  ------------------
  285|     98|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     98|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|    126|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 28, False: 105]
  ------------------
  288|    126|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|    126|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|    133|        default: break;
  ------------------
  |  Branch (290:9): [True: 7, False: 126]
  ------------------
  291|    133|        }
  292|    133|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|    133|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 127, False: 6]
  ------------------
  294|    133|            if (lastByte == 0) return ERROR(corruption_detected);  /* endMark not present */
  ------------------
  |  |   49|      6|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      6|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      6|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (294:17): [True: 6, False: 127]
  ------------------
  295|    133|        }
  296|    127|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|    127|    }
  298|       |
  299|    833|    return srcSize;
  300|    878|}
fse_decompress.c:BIT_readBits:
  363|  81.0k|{
  364|  81.0k|    BitContainerType const value = BIT_lookBits(bitD, nbBits);
  365|  81.0k|    BIT_skipBits(bitD, nbBits);
  366|  81.0k|    return value;
  367|  81.0k|}
fse_decompress.c:BIT_lookBits:
  331|  81.0k|{
  332|       |    /* arbitrate between double-shift and shift+mask */
  333|  81.0k|#if 1
  334|       |    /* if bitD->bitsConsumed + nbBits > sizeof(bitD->bitContainer)*8,
  335|       |     * bitstream is likely corrupted, and result is undefined */
  336|  81.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|  81.0k|}
fse_decompress.c:BIT_getMiddleBits:
  308|  81.0k|{
  309|  81.0k|    U32 const regMask = sizeof(bitContainer)*8 - 1;
  310|       |    /* if start > regMask, bitstream is corrupted, and result is undefined */
  311|  81.0k|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  81.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|  81.0k|#if defined(__x86_64__) || defined(_M_X64)
  318|  81.0k|    return (bitContainer >> (start & regMask)) & ((((U64)1) << nbBits) - 1);
  319|       |#else
  320|       |    return (bitContainer >> (start & regMask)) & BIT_mask[nbBits];
  321|       |#endif
  322|  81.0k|}
fse_decompress.c:BIT_skipBits:
  354|   100k|{
  355|   100k|    bitD->bitsConsumed += nbBits;
  356|   100k|}
fse_decompress.c:BIT_reloadDStream:
  413|  49.0k|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|  49.0k|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  188|  49.0k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 820, False: 48.2k]
  |  |  ------------------
  ------------------
  416|    820|        static const BitContainerType zeroFilled = 0;
  417|    820|        bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
  418|       |        /* overflow detected, erroneous scenario or end of stream: no update */
  419|    820|        return BIT_DStream_overflow;
  420|    820|    }
  421|       |
  422|  48.2k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  48.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|  48.2k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 12.6k, False: 35.5k]
  ------------------
  425|  12.6k|        return BIT_reloadDStream_internal(bitD);
  426|  12.6k|    }
  427|  35.5k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 28.5k, False: 7.03k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|  28.5k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 27.7k, False: 803]
  ------------------
  430|    803|        return BIT_DStream_completed;
  431|  28.5k|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  7.03k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  7.03k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  7.03k|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (435:13): [True: 74, False: 6.95k]
  ------------------
  436|     74|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|     74|            result = BIT_DStream_endOfBuffer;
  438|     74|        }
  439|  7.03k|        bitD->ptr -= nbBytes;
  440|  7.03k|        bitD->bitsConsumed -= nbBytes*8;
  441|  7.03k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  7.03k|        return result;
  443|  35.5k|    }
  444|  35.5k|}
fse_decompress.c:BIT_reloadDStream_internal:
  385|  12.6k|{
  386|  12.6k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|  12.6k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|  12.6k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|  12.6k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  12.6k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|  12.6k|    bitD->bitsConsumed &= 7;
  390|  12.6k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|  12.6k|    return BIT_DStream_unfinished;
  392|  12.6k|}
fse_decompress.c:BIT_readBitsFast:
  372|  19.7k|{
  373|  19.7k|    BitContainerType const value = BIT_lookBitsFast(bitD, nbBits);
  374|  19.7k|    assert(nbBits >= 1);
  ------------------
  |  |   70|  19.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  375|  19.7k|    BIT_skipBits(bitD, nbBits);
  376|  19.7k|    return value;
  377|  19.7k|}
fse_decompress.c:BIT_lookBitsFast:
  347|  19.7k|{
  348|  19.7k|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|  19.7k|    assert(nbBits >= 1);
  ------------------
  |  |   70|  19.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|  19.7k|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|  19.7k|}
huf_decompress.c:BIT_initDStream:
  255|    964|{
  256|    964|    if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   46|      8|# 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|      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 (256:9): [True: 8, False: 956]
  ------------------
  257|       |
  258|    956|    bitD->start = (const char*)srcBuffer;
  259|    956|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|    956|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 772, False: 184]
  ------------------
  262|    772|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|    772|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|    772|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|    772|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 761, False: 11]
  ------------------
  266|    772|          if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
  ------------------
  |  |   49|     11|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     11|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     11|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (266:15): [True: 11, False: 761]
  ------------------
  267|    772|    } 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|     30|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 15, False: 169]
  ------------------
  276|     30|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     30|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|     49|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 19, False: 165]
  ------------------
  279|     49|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     49|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|     71|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 22, False: 162]
  ------------------
  282|     71|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     71|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|     94|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 23, False: 161]
  ------------------
  285|     94|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     94|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|    123|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 29, False: 155]
  ------------------
  288|    123|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|    123|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|    184|        default: break;
  ------------------
  |  Branch (290:9): [True: 61, False: 123]
  ------------------
  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|    931|    return srcSize;
  300|    956|}
huf_decompress.c:BIT_reloadDStream:
  413|  54.2k|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|  54.2k|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  188|  54.2k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 90, False: 54.1k]
  |  |  ------------------
  ------------------
  416|     90|        static const BitContainerType zeroFilled = 0;
  417|     90|        bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
  418|       |        /* overflow detected, erroneous scenario or end of stream: no update */
  419|     90|        return BIT_DStream_overflow;
  420|     90|    }
  421|       |
  422|  54.1k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  54.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|  54.1k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 50.6k, False: 3.49k]
  ------------------
  425|  50.6k|        return BIT_reloadDStream_internal(bitD);
  426|  50.6k|    }
  427|  3.49k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 786, False: 2.70k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|    786|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 772, False: 14]
  ------------------
  430|     14|        return BIT_DStream_completed;
  431|    786|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  2.70k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  2.70k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  2.70k|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (435:13): [True: 417, False: 2.29k]
  ------------------
  436|    417|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|    417|            result = BIT_DStream_endOfBuffer;
  438|    417|        }
  439|  2.70k|        bitD->ptr -= nbBytes;
  440|  2.70k|        bitD->bitsConsumed -= nbBytes*8;
  441|  2.70k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  2.70k|        return result;
  443|  3.49k|    }
  444|  3.49k|}
huf_decompress.c:BIT_reloadDStream_internal:
  385|  75.6k|{
  386|  75.6k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|  75.6k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|  75.6k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|  75.6k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  75.6k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|  75.6k|    bitD->bitsConsumed &= 7;
  390|  75.6k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|  75.6k|    return BIT_DStream_unfinished;
  392|  75.6k|}
huf_decompress.c:BIT_lookBitsFast:
  347|  1.12M|{
  348|  1.12M|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|  1.12M|    assert(nbBits >= 1);
  ------------------
  |  |   70|  1.12M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|  1.12M|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|  1.12M|}
huf_decompress.c:BIT_skipBits:
  354|  1.12M|{
  355|  1.12M|    bitD->bitsConsumed += nbBits;
  356|  1.12M|}
huf_decompress.c:BIT_endOfDStream:
  450|    883|{
  451|    883|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (451:13): [True: 631, False: 252]
  |  Branch (451:49): [True: 11, False: 620]
  ------------------
  452|    883|}
huf_decompress.c:BIT_reloadDStreamFast:
  401|  25.2k|{
  402|  25.2k|    if (UNLIKELY(bitD->ptr < bitD->limitPtr))
  ------------------
  |  |  188|  25.2k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 259, False: 24.9k]
  |  |  ------------------
  ------------------
  403|    259|        return BIT_DStream_overflow;
  404|  24.9k|    return BIT_reloadDStream_internal(bitD);
  405|  25.2k|}

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

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

FSE_isError:
   31|  1.24k|unsigned FSE_isError(size_t code) { return ERR_isError(code); }
FSE_readNCount_bmi2:
  209|  4.27k|{
  210|  4.27k|#if DYNAMIC_BMI2
  211|  4.27k|    if (bmi2) {
  ------------------
  |  Branch (211:9): [True: 620, False: 3.65k]
  ------------------
  212|    620|        return FSE_readNCount_body_bmi2(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
  213|    620|    }
  214|  3.65k|#endif
  215|  3.65k|    (void)bmi2;
  216|  3.65k|    return FSE_readNCount_body_default(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
  217|  4.27k|}
FSE_readNCount:
  222|  3.30k|{
  223|  3.30k|    return FSE_readNCount_bmi2(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize, /* bmi2 */ 0);
  224|  3.30k|}
HUF_readStats_wksp:
  332|  1.02k|{
  333|  1.02k|#if DYNAMIC_BMI2
  334|  1.02k|    if (flags & HUF_flags_bmi2) {
  ------------------
  |  Branch (334:9): [True: 666, False: 359]
  ------------------
  335|    666|        return HUF_readStats_body_bmi2(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize);
  336|    666|    }
  337|    359|#endif
  338|    359|    (void)flags;
  339|    359|    return HUF_readStats_body_default(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize);
  340|  1.02k|}
entropy_common.c:FSE_readNCount_body_bmi2:
  201|    620|{
  202|    620|    return FSE_readNCount_body(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
  203|    620|}
entropy_common.c:FSE_readNCount_body:
   44|  4.27k|{
   45|  4.27k|    const BYTE* const istart = (const BYTE*) headerBuffer;
   46|  4.27k|    const BYTE* const iend = istart + hbSize;
   47|  4.27k|    const BYTE* ip = istart;
   48|  4.27k|    int nbBits;
   49|  4.27k|    int remaining;
   50|  4.27k|    int threshold;
   51|  4.27k|    U32 bitStream;
   52|  4.27k|    int bitCount;
   53|  4.27k|    unsigned charnum = 0;
   54|  4.27k|    unsigned const maxSV1 = *maxSVPtr + 1;
   55|  4.27k|    int previous0 = 0;
   56|       |
   57|  4.27k|    if (hbSize < 8) {
  ------------------
  |  Branch (57:9): [True: 274, False: 4.00k]
  ------------------
   58|       |        /* This function only works when hbSize >= 8 */
   59|    274|        char buffer[8] = {0};
   60|    274|        ZSTD_memcpy(buffer, headerBuffer, hbSize);
  ------------------
  |  |   44|    274|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
   61|    274|        {   size_t const countSize = FSE_readNCount(normalizedCounter, maxSVPtr, tableLogPtr,
   62|    274|                                                    buffer, sizeof(buffer));
   63|    274|            if (FSE_isError(countSize)) return countSize;
  ------------------
  |  Branch (63:17): [True: 54, False: 220]
  ------------------
   64|    220|            if (countSize > hbSize) 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 (64:17): [True: 61, False: 159]
  ------------------
   65|    159|            return countSize;
   66|    220|    }   }
   67|  4.00k|    assert(hbSize >= 8);
  ------------------
  |  |   70|  4.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   68|       |
   69|       |    /* init */
   70|  4.00k|    ZSTD_memset(normalizedCounter, 0, (*maxSVPtr+1) * sizeof(normalizedCounter[0]));   /* all symbols not present in NCount have a frequency of 0 */
  ------------------
  |  |   46|  4.00k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
   71|  4.00k|    bitStream = MEM_readLE32(ip);
   72|  4.00k|    nbBits = (bitStream & 0xF) + FSE_MIN_TABLELOG;   /* extract tableLog */
  ------------------
  |  |  616|  4.00k|#define FSE_MIN_TABLELOG 5
  ------------------
   73|  4.00k|    if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  |  618|  4.00k|#define FSE_TABLELOG_ABSOLUTE_MAX 15
  ------------------
                  if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   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 (73:9): [True: 45, False: 3.95k]
  ------------------
   74|  3.95k|    bitStream >>= 4;
   75|  3.95k|    bitCount = 4;
   76|  3.95k|    *tableLogPtr = nbBits;
   77|  3.95k|    remaining = (1<<nbBits)+1;
   78|  3.95k|    threshold = 1<<nbBits;
   79|  3.95k|    nbBits++;
   80|       |
   81|  48.0k|    for (;;) {
   82|  48.0k|        if (previous0) {
  ------------------
  |  Branch (82:13): [True: 5.63k, False: 42.4k]
  ------------------
   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.63k|            int repeats = ZSTD_countTrailingZeros32(~bitStream | 0x80000000) >> 1;
   89|  5.96k|            while (repeats >= 12) {
  ------------------
  |  Branch (89:20): [True: 333, False: 5.63k]
  ------------------
   90|    333|                charnum += 3 * 12;
   91|    333|                if (LIKELY(ip <= iend-7)) {
  ------------------
  |  |  187|    333|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (187:19): [True: 302, False: 31]
  |  |  ------------------
  ------------------
   92|    302|                    ip += 3;
   93|    302|                } else {
   94|     31|                    bitCount -= (int)(8 * (iend - 7 - ip));
   95|     31|                    bitCount &= 31;
   96|     31|                    ip = iend - 4;
   97|     31|                }
   98|    333|                bitStream = MEM_readLE32(ip) >> bitCount;
   99|    333|                repeats = ZSTD_countTrailingZeros32(~bitStream | 0x80000000) >> 1;
  100|    333|            }
  101|  5.63k|            charnum += 3 * repeats;
  102|  5.63k|            bitStream >>= 2 * repeats;
  103|  5.63k|            bitCount += 2 * repeats;
  104|       |
  105|       |            /* Add the final repeat which isn't 0b11. */
  106|  5.63k|            assert((bitStream & 3) < 3);
  ------------------
  |  |   70|  5.63k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  107|  5.63k|            charnum += bitStream & 3;
  108|  5.63k|            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.63k|            if (charnum >= maxSV1) break;
  ------------------
  |  Branch (114:17): [True: 24, False: 5.61k]
  ------------------
  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.61k|            if (LIKELY(ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
  ------------------
  |  |  187|  11.2k|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (187:19): [True: 4.14k, False: 1.46k]
  |  |  ------------------
  ------------------
  |  Branch (120:41): [True: 345, False: 1.12k]
  ------------------
  121|  4.48k|                assert((bitCount >> 3) <= 3); /* For first condition to work */
  ------------------
  |  |   70|  4.48k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  122|  4.48k|                ip += bitCount>>3;
  123|  4.48k|                bitCount &= 7;
  124|  4.48k|            } else {
  125|  1.12k|                bitCount -= (int)(8 * (iend - 4 - ip));
  126|  1.12k|                bitCount &= 31;
  127|  1.12k|                ip = iend - 4;
  128|  1.12k|            }
  129|  5.61k|            bitStream = MEM_readLE32(ip) >> bitCount;
  130|  5.61k|        }
  131|  48.0k|        {
  132|  48.0k|            int const max = (2*threshold-1) - remaining;
  133|  48.0k|            int count;
  134|       |
  135|  48.0k|            if ((bitStream & (threshold-1)) < (U32)max) {
  ------------------
  |  Branch (135:17): [True: 34.6k, False: 13.4k]
  ------------------
  136|  34.6k|                count = bitStream & (threshold-1);
  137|  34.6k|                bitCount += nbBits-1;
  138|  34.6k|            } else {
  139|  13.4k|                count = bitStream & (2*threshold-1);
  140|  13.4k|                if (count >= threshold) count -= max;
  ------------------
  |  Branch (140:21): [True: 4.92k, False: 8.47k]
  ------------------
  141|  13.4k|                bitCount += nbBits;
  142|  13.4k|            }
  143|       |
  144|  48.0k|            count--;   /* extra accuracy */
  145|       |            /* When it matters (small blocks), this is a
  146|       |             * predictable branch, because we don't use -1.
  147|       |             */
  148|  48.0k|            if (count >= 0) {
  ------------------
  |  Branch (148:17): [True: 24.8k, False: 23.2k]
  ------------------
  149|  24.8k|                remaining -= count;
  150|  24.8k|            } else {
  151|  23.2k|                assert(count == -1);
  ------------------
  |  |   70|  23.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  152|  23.2k|                remaining += count;
  153|  23.2k|            }
  154|  48.0k|            normalizedCounter[charnum++] = (short)count;
  155|  48.0k|            previous0 = !count;
  156|       |
  157|  48.0k|            assert(threshold > 1);
  ------------------
  |  |   70|  48.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  158|  48.0k|            if (remaining < threshold) {
  ------------------
  |  Branch (158:17): [True: 17.0k, False: 31.0k]
  ------------------
  159|       |                /* This branch can be folded into the
  160|       |                 * threshold update condition because we
  161|       |                 * know that threshold > 1.
  162|       |                 */
  163|  17.0k|                if (remaining <= 1) break;
  ------------------
  |  Branch (163:21): [True: 3.89k, False: 13.1k]
  ------------------
  164|  13.1k|                nbBits = ZSTD_highbit32(remaining) + 1;
  165|  13.1k|                threshold = 1 << (nbBits - 1);
  166|  13.1k|            }
  167|  44.1k|            if (charnum >= maxSV1) break;
  ------------------
  |  Branch (167:17): [True: 35, False: 44.1k]
  ------------------
  168|       |
  169|  44.1k|            if (LIKELY(ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
  ------------------
  |  |  187|  88.2k|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (187:19): [True: 34.5k, False: 9.53k]
  |  |  ------------------
  ------------------
  |  Branch (169:41): [True: 1.60k, False: 7.93k]
  ------------------
  170|  36.1k|                ip += bitCount>>3;
  171|  36.1k|                bitCount &= 7;
  172|  36.1k|            } else {
  173|  7.93k|                bitCount -= (int)(8 * (iend - 4 - ip));
  174|  7.93k|                bitCount &= 31;
  175|  7.93k|                ip = iend - 4;
  176|  7.93k|            }
  177|  44.1k|            bitStream = MEM_readLE32(ip) >> bitCount;
  178|  44.1k|    }   }
  179|  3.95k|    if (remaining != 1) return ERROR(corruption_detected);
  ------------------
  |  |   49|     59|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     59|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     59|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (179:9): [True: 59, False: 3.89k]
  ------------------
  180|       |    /* Only possible when there are too many zeros. */
  181|  3.89k|    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.89k]
  ------------------
  182|  3.89k|    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.89k]
  ------------------
  183|  3.89k|    *maxSVPtr = charnum-1;
  184|       |
  185|  3.89k|    ip += (bitCount+7)>>3;
  186|  3.89k|    return ip-istart;
  187|  3.89k|}
entropy_common.c:FSE_readNCount_body_default:
  193|  3.65k|{
  194|  3.65k|    return FSE_readNCount_body(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
  195|  3.65k|}
entropy_common.c:HUF_readStats_body_bmi2:
  322|    666|{
  323|    666|    return HUF_readStats_body(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize, 1);
  324|    666|}
entropy_common.c:HUF_readStats_body:
  248|  1.02k|{
  249|  1.02k|    U32 weightTotal;
  250|  1.02k|    const BYTE* ip = (const BYTE*) src;
  251|  1.02k|    size_t iSize;
  252|  1.02k|    size_t oSize;
  253|       |
  254|  1.02k|    if (!srcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|     12|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     12|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     12|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (254:9): [True: 12, False: 1.01k]
  ------------------
  255|  1.01k|    iSize = ip[0];
  256|       |    /* ZSTD_memset(huffWeight, 0, hwSize);   *//* is not necessary, even though some analyzer complain ... */
  257|       |
  258|  1.01k|    if (iSize >= 128) {  /* special header */
  ------------------
  |  Branch (258:9): [True: 38, False: 975]
  ------------------
  259|     38|        oSize = iSize - 127;
  260|     38|        iSize = ((oSize+1)/2);
  261|     38|        if (iSize+1 > srcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      8|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      8|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      8|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (261:13): [True: 8, False: 30]
  ------------------
  262|     30|        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: 30]
  ------------------
  263|     30|        ip += 1;
  264|     30|        {   U32 n;
  265|    406|            for (n=0; n<oSize; n+=2) {
  ------------------
  |  Branch (265:23): [True: 376, False: 30]
  ------------------
  266|    376|                huffWeight[n]   = ip[n/2] >> 4;
  267|    376|                huffWeight[n+1] = ip[n/2] & 15;
  268|    376|    }   }   }
  269|    975|    else  {   /* header compressed with FSE (normal case) */
  270|    975|        if (iSize+1 > srcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|      8|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      8|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      8|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (270:13): [True: 8, False: 967]
  ------------------
  271|       |        /* max (hwSize-1) values decoded, as last one is implied */
  272|    967|        oSize = FSE_decompress_wksp_bmi2(huffWeight, hwSize-1, ip+1, iSize, 6, workSpace, wkspSize, bmi2);
  273|    967|        if (FSE_isError(oSize)) return oSize;
  ------------------
  |  Branch (273:13): [True: 160, False: 807]
  ------------------
  274|    967|    }
  275|       |
  276|       |    /* collect weight stats */
  277|    837|    ZSTD_memset(rankStats, 0, (HUF_TABLELOG_MAX + 1) * sizeof(U32));
  ------------------
  |  |   46|    837|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  278|    837|    weightTotal = 0;
  279|  93.7k|    {   U32 n; for (n=0; n<oSize; n++) {
  ------------------
  |  Branch (279:26): [True: 93.0k, False: 777]
  ------------------
  280|  93.0k|            if (huffWeight[n] > HUF_TABLELOG_MAX) return ERROR(corruption_detected);
  ------------------
  |  |   37|  93.0k|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  ------------------
                          if (huffWeight[n] > HUF_TABLELOG_MAX) return ERROR(corruption_detected);
  ------------------
  |  |   49|     60|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     60|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     60|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (280:17): [True: 60, False: 92.9k]
  ------------------
  281|  92.9k|            rankStats[huffWeight[n]]++;
  282|  92.9k|            weightTotal += (1 << huffWeight[n]) >> 1;
  283|  92.9k|    }   }
  284|    777|    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: 775]
  ------------------
  285|       |
  286|       |    /* get last non-null symbol weight (implied, total must be 2^n) */
  287|    775|    {   U32 const tableLog = ZSTD_highbit32(weightTotal) + 1;
  288|    775|        if (tableLog > HUF_TABLELOG_MAX) return ERROR(corruption_detected);
  ------------------
  |  |   37|    775|#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: 765]
  ------------------
  289|    765|        *tableLogPtr = tableLog;
  290|       |        /* determine last weight */
  291|    765|        {   U32 const total = 1 << tableLog;
  292|    765|            U32 const rest = total - weightTotal;
  293|    765|            U32 const verif = 1 << ZSTD_highbit32(rest);
  294|    765|            U32 const lastWeight = ZSTD_highbit32(rest) + 1;
  295|    765|            if (verif != rest) return ERROR(corruption_detected);    /* last value must be a clean power of 2 */
  ------------------
  |  |   49|     55|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     55|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     55|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (295:17): [True: 55, False: 710]
  ------------------
  296|    710|            huffWeight[oSize] = (BYTE)lastWeight;
  297|    710|            rankStats[lastWeight]++;
  298|    710|    }   }
  299|       |
  300|       |    /* check tree construction validity */
  301|    710|    if ((rankStats[1] < 2) || (rankStats[1] & 1)) return ERROR(corruption_detected);   /* by construction : at least 2 elts of rank 1, must be even */
  ------------------
  |  |   49|      6|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      6|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      6|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (301:9): [True: 6, False: 704]
  |  Branch (301:31): [True: 0, False: 704]
  ------------------
  302|       |
  303|       |    /* results */
  304|    704|    *nbSymbolsPtr = (U32)(oSize+1);
  305|    704|    return iSize+1;
  306|    710|}
entropy_common.c:HUF_readStats_body_default:
  313|    359|{
  314|    359|    return HUF_readStats_body(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize, 0);
  315|    359|}

zstd_common.c:ERR_isError:
   52|  10.8k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  10.8k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  10.8k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  10.8k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_common.c:ERR_getErrorCode:
   54|  3.87k|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: 262, False: 3.61k]
  ------------------
zstd_ddict.c:ERR_isError:
   52|  12.6k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  12.6k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  12.6k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  12.6k|#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.64M|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  2.64M|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  2.64M|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  2.64M|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_v05.c:ERR_isError:
   52|   116k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|   116k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|   116k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|   116k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_v06.c:ERR_isError:
   52|  36.8k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  36.8k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  36.8k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  36.8k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_v07.c:ERR_isError:
   52|  57.3k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  57.3k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  57.3k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  57.3k|#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.72k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  2.72k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  2.72k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  2.72k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
huf_decompress.c:ERR_isError:
   52|  3.46k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  3.46k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  3.46k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  3.46k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------

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

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

zstd_ddict.c:MEM_readLE32:
  322|  4.87k|{
  323|  4.87k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 4.87k, False: 0]
  ------------------
  324|  4.87k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  4.87k|}
zstd_ddict.c:MEM_isLittleEndian:
  141|  4.87k|{
  142|  4.87k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  4.87k|    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.87k|}
zstd_ddict.c:MEM_read32:
  183|  4.87k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress.c:MEM_readLE32:
  322|  30.6k|{
  323|  30.6k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 30.6k, False: 0]
  ------------------
  324|  30.6k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  30.6k|}
zstd_decompress.c:MEM_isLittleEndian:
  141|  31.7k|{
  142|  31.7k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  31.7k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  31.7k|}
zstd_decompress.c:MEM_read32:
  183|  30.6k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress.c:MEM_readLE16:
  290|    565|{
  291|    565|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 565, False: 0]
  ------------------
  292|    565|        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|    565|}
zstd_decompress.c:MEM_read16:
  182|    565|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_decompress.c:MEM_readLE64:
  338|    584|{
  339|    584|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 584, False: 0]
  ------------------
  340|    584|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|    584|}
zstd_decompress.c:MEM_read64:
  184|    584|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
zstd_decompress_block.c:MEM_readLE24:
  311|  7.31k|{
  312|  7.31k|    return (U32)MEM_readLE16(memPtr) + ((U32)(((const BYTE*)memPtr)[2]) << 16);
  313|  7.31k|}
zstd_decompress_block.c:MEM_readLE32:
  322|    724|{
  323|    724|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 724, False: 0]
  ------------------
  324|    724|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|    724|}
zstd_decompress_block.c:MEM_isLittleEndian:
  141|   152k|{
  142|   152k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   152k|    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|   152k|}
zstd_decompress_block.c:MEM_read32:
  183|    724|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress_block.c:MEM_write64:
  189|  21.2k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
zstd_decompress_block.c:MEM_readLE16:
  290|  7.50k|{
  291|  7.50k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 7.50k, False: 0]
  ------------------
  292|  7.50k|        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.50k|}
zstd_decompress_block.c:MEM_read16:
  182|  7.50k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_decompress_block.c:MEM_32bits:
  137|  12.3M|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_decompress_block.c:MEM_64bits:
  138|  2.63M|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_decompress_block.c:MEM_readLEST:
  354|   144k|{
  355|   144k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 144k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|   144k|    else
  358|   144k|        return (size_t)MEM_readLE64(memPtr);
  359|   144k|}
zstd_decompress_block.c:MEM_readLE64:
  338|   144k|{
  339|   144k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 144k, False: 0]
  ------------------
  340|   144k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|   144k|}
zstd_decompress_block.c:MEM_read64:
  184|   144k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
zstd_v05.c:MEM_readLE32:
  322|  41.8k|{
  323|  41.8k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 41.8k, False: 0]
  ------------------
  324|  41.8k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  41.8k|}
zstd_v05.c:MEM_isLittleEndian:
  141|   288k|{
  142|   288k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   288k|    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|   288k|}
zstd_v05.c:MEM_read32:
  183|  41.8k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_v05.c:MEM_readLEST:
  354|   108k|{
  355|   108k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 108k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|   108k|    else
  358|   108k|        return (size_t)MEM_readLE64(memPtr);
  359|   108k|}
zstd_v05.c:MEM_32bits:
  137|   287k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_v05.c:MEM_readLE64:
  338|   108k|{
  339|   108k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 108k, False: 0]
  ------------------
  340|   108k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|   108k|}
zstd_v05.c:MEM_read64:
  184|   108k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
zstd_v05.c:MEM_readLE16:
  290|    824|{
  291|    824|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 824, False: 0]
  ------------------
  292|    824|        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|    824|}
zstd_v05.c:MEM_read16:
  182|    824|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_v05.c:MEM_64bits:
  138|  24.2k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_v05.c:MEM_writeLE16:
  300|   137k|{
  301|   137k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (301:9): [True: 137k, False: 0]
  ------------------
  302|   137k|        MEM_write16(memPtr, val);
  303|   137k|    } else {
  304|      0|        BYTE* p = (BYTE*)memPtr;
  305|      0|        p[0] = (BYTE)val;
  306|      0|        p[1] = (BYTE)(val>>8);
  307|      0|    }
  308|   137k|}
zstd_v05.c:MEM_write16:
  187|   137k|MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(unalign16*)memPtr = value; }
entropy_common.c:MEM_readLE32:
  322|  54.0k|{
  323|  54.0k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 54.0k, False: 0]
  ------------------
  324|  54.0k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  54.0k|}
entropy_common.c:MEM_isLittleEndian:
  141|  54.0k|{
  142|  54.0k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  54.0k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  54.0k|}
entropy_common.c:MEM_read32:
  183|  54.0k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
fse_decompress.c:MEM_write64:
  189|  1.79k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
fse_decompress.c:MEM_readLEST:
  354|  20.4k|{
  355|  20.4k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 20.4k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|  20.4k|    else
  358|  20.4k|        return (size_t)MEM_readLE64(memPtr);
  359|  20.4k|}
fse_decompress.c:MEM_32bits:
  137|  20.4k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
fse_decompress.c:MEM_isLittleEndian:
  141|  20.4k|{
  142|  20.4k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  20.4k|    return 1;
  144|       |#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  145|       |    return 0;
  146|       |#elif defined(__clang__) && __LITTLE_ENDIAN__
  147|       |    return 1;
  148|       |#elif defined(__clang__) && __BIG_ENDIAN__
  149|       |    return 0;
  150|       |#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
  151|       |    return 1;
  152|       |#elif defined(__DMC__) && defined(_M_IX86)
  153|       |    return 1;
  154|       |#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
  155|       |    return 1;
  156|       |#else
  157|       |    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  158|       |    return one.c[0];
  159|       |#endif
  160|  20.4k|}
fse_decompress.c:MEM_readLE64:
  338|  20.4k|{
  339|  20.4k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 20.4k, False: 0]
  ------------------
  340|  20.4k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  20.4k|}
fse_decompress.c:MEM_read64:
  184|  20.4k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
huf_decompress.c:MEM_isLittleEndian:
  141|   243k|{
  142|   243k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   243k|    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|   243k|}
huf_decompress.c:MEM_write64:
  189|   159k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
huf_decompress.c:MEM_readLEST:
  354|  79.8k|{
  355|  79.8k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 79.8k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|  79.8k|    else
  358|  79.8k|        return (size_t)MEM_readLE64(memPtr);
  359|  79.8k|}
huf_decompress.c:MEM_32bits:
  137|  80.8k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
huf_decompress.c:MEM_readLE64:
  338|  79.8k|{
  339|  79.8k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 79.8k, False: 0]
  ------------------
  340|  79.8k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  79.8k|}
huf_decompress.c:MEM_read64:
  184|  79.8k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
huf_decompress.c:MEM_64bits:
  138|   190k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
huf_decompress.c:MEM_readLE16:
  290|  1.57k|{
  291|  1.57k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 1.57k, False: 0]
  ------------------
  292|  1.57k|        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.57k|}
huf_decompress.c:MEM_read16:
  182|  1.57k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }

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

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

zstd_decompress.c:ZSTD_cpuSupportsBmi2:
  319|  6.92k|{
  320|  6.92k|    ZSTD_cpuid_t cpuid = ZSTD_cpuid();
  321|  6.92k|    return ZSTD_cpuid_bmi1(cpuid) && ZSTD_cpuid_bmi2(cpuid);
  ------------------
  |  Branch (321:12): [True: 6.92k, False: 0]
  |  Branch (321:38): [True: 6.92k, False: 0]
  ------------------
  322|  6.92k|}
zstd_decompress_block.c:ZSTD_wildcopy:
  217|  1.21M|{
  218|  1.21M|    ptrdiff_t diff = (BYTE*)dst - (const BYTE*)src;
  219|  1.21M|    const BYTE* ip = (const BYTE*)src;
  220|  1.21M|    BYTE* op = (BYTE*)dst;
  221|  1.21M|    BYTE* const oend = op + length;
  222|       |
  223|  1.21M|    if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) {
  ------------------
  |  |  200|   284k|#define WILDCOPY_VECLEN 16
  ------------------
  |  Branch (223:9): [True: 284k, False: 933k]
  |  Branch (223:50): [True: 283k, False: 208]
  ------------------
  224|       |        /* Handle short offset copies. */
  225|  6.25M|        do {
  226|  6.25M|            COPY8(op, ip);
  ------------------
  |  |  177|  6.25M|#define COPY8(d,s) do { ZSTD_copy8(d,s); d+=8; s+=8; } while (0)
  |  |  ------------------
  |  |  |  Branch (177:63): [Folded, False: 6.25M]
  |  |  ------------------
  ------------------
  227|  6.25M|        } while (op < oend);
  ------------------
  |  Branch (227:18): [True: 5.97M, False: 283k]
  ------------------
  228|   933k|    } else {
  229|   933k|        assert(diff >= WILDCOPY_VECLEN || diff <= -WILDCOPY_VECLEN);
  ------------------
  |  |   70|   933k|#    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|   933k|        ZSTD_copy16(op, ip);
  237|   933k|        if (16 >= length) return;
  ------------------
  |  Branch (237:13): [True: 747k, False: 186k]
  ------------------
  238|   186k|        op += 16;
  239|   186k|        ip += 16;
  240|  3.33M|        do {
  241|  3.33M|            COPY16(op, ip);
  ------------------
  |  |  197|  3.33M|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (197:67): [Folded, False: 3.33M]
  |  |  ------------------
  ------------------
  242|  3.33M|            COPY16(op, ip);
  ------------------
  |  |  197|  3.33M|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (197:67): [Folded, False: 3.33M]
  |  |  ------------------
  ------------------
  243|  3.33M|        }
  244|  3.33M|        while (op < oend);
  ------------------
  |  Branch (244:16): [True: 3.14M, False: 186k]
  ------------------
  245|   186k|    }
  246|  1.21M|}
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.0M|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.0M|}

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

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

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

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

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

zstd_decompress.c:ZSTD_isLegacy:
   57|  22.1k|{
   58|  22.1k|    U32 magicNumberLE;
   59|  22.1k|    if (srcSize<4) return 0;
  ------------------
  |  Branch (59:9): [True: 0, False: 22.1k]
  ------------------
   60|  22.1k|    magicNumberLE = MEM_readLE32(src);
   61|  22.1k|    switch(magicNumberLE)
   62|  22.1k|    {
   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.13k|        case ZSTDv05_MAGICNUMBER : return 5;
  ------------------
  |  |  153|  8.13k|#define ZSTDv05_MAGICNUMBER 0xFD2FB525   /* v0.5 */
  ------------------
  |  Branch (76:9): [True: 8.13k, False: 13.9k]
  ------------------
   77|      0|#endif
   78|      0|#if (ZSTD_LEGACY_SUPPORT <= 6)
   79|  6.83k|        case ZSTDv06_MAGICNUMBER : return 6;
  ------------------
  |  |  164|  6.83k|#define ZSTDv06_MAGICNUMBER 0xFD2FB526   /* v0.6 */
  ------------------
  |  Branch (79:9): [True: 6.83k, False: 15.2k]
  ------------------
   80|      0|#endif
   81|      0|#if (ZSTD_LEGACY_SUPPORT <= 7)
   82|  3.23k|        case ZSTDv07_MAGICNUMBER : return 7;
  ------------------
  |  |  180|  3.23k|#define ZSTDv07_MAGICNUMBER            0xFD2FB527   /* v0.7 */
  ------------------
  |  Branch (82:9): [True: 3.23k, False: 18.8k]
  ------------------
   83|      0|#endif
   84|  3.91k|        default : return 0;
  ------------------
  |  Branch (84:9): [True: 3.91k, False: 18.2k]
  ------------------
   85|  22.1k|    }
   86|  22.1k|}
zstd_decompress.c:ZSTD_getDecompressedSize_legacy:
   90|  1.94k|{
   91|  1.94k|    U32 const version = ZSTD_isLegacy(src, srcSize);
   92|  1.94k|    if (version < 5) return 0;  /* no decompressed size in frame header, or not a legacy format */
  ------------------
  |  Branch (92:9): [True: 0, False: 1.94k]
  ------------------
   93|  1.94k|#if (ZSTD_LEGACY_SUPPORT <= 5)
   94|  1.94k|    if (version==5) {
  ------------------
  |  Branch (94:9): [True: 1.04k, False: 899]
  ------------------
   95|  1.04k|        ZSTDv05_parameters fParams;
   96|  1.04k|        size_t const frResult = ZSTDv05_getFrameParams(&fParams, src, srcSize);
   97|  1.04k|        if (frResult != 0) return 0;
  ------------------
  |  Branch (97:13): [True: 0, False: 1.04k]
  ------------------
   98|  1.04k|        return fParams.srcSize;
   99|  1.04k|    }
  100|    899|#endif
  101|    899|#if (ZSTD_LEGACY_SUPPORT <= 6)
  102|    899|    if (version==6) {
  ------------------
  |  Branch (102:9): [True: 753, False: 146]
  ------------------
  103|    753|        ZSTDv06_frameParams fParams;
  104|    753|        size_t const frResult = ZSTDv06_getFrameParams(&fParams, src, srcSize);
  105|    753|        if (frResult != 0) return 0;
  ------------------
  |  Branch (105:13): [True: 0, False: 753]
  ------------------
  106|    753|        return fParams.frameContentSize;
  107|    753|    }
  108|    146|#endif
  109|    146|#if (ZSTD_LEGACY_SUPPORT <= 7)
  110|    146|    if (version==7) {
  ------------------
  |  Branch (110:9): [True: 146, False: 0]
  ------------------
  111|    146|        ZSTDv07_frameParams fParams;
  112|    146|        size_t const frResult = ZSTDv07_getFrameParams(&fParams, src, srcSize);
  113|    146|        if (frResult != 0) return 0;
  ------------------
  |  Branch (113:13): [True: 0, False: 146]
  ------------------
  114|    146|        return fParams.frameContentSize;
  115|    146|    }
  116|      0|#endif
  117|      0|    return 0;   /* should not be possible */
  118|    146|}
zstd_decompress.c:ZSTD_findFrameSizeInfoLegacy:
  196|  4.82k|{
  197|  4.82k|    ZSTD_frameSizeInfo frameSizeInfo;
  198|  4.82k|    U32 const version = ZSTD_isLegacy(src, srcSize);
  199|  4.82k|    switch(version)
  200|  4.82k|    {
  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.03k|        case 5 :
  ------------------
  |  Branch (230:9): [True: 2.03k, False: 2.79k]
  ------------------
  231|  2.03k|            ZSTDv05_findFrameSizeInfoLegacy(src, srcSize,
  232|  2.03k|                &frameSizeInfo.compressedSize,
  233|  2.03k|                &frameSizeInfo.decompressedBound);
  234|  2.03k|            break;
  235|      0|#endif
  236|      0|#if (ZSTD_LEGACY_SUPPORT <= 6)
  237|  1.80k|        case 6 :
  ------------------
  |  Branch (237:9): [True: 1.80k, False: 3.02k]
  ------------------
  238|  1.80k|            ZSTDv06_findFrameSizeInfoLegacy(src, srcSize,
  239|  1.80k|                &frameSizeInfo.compressedSize,
  240|  1.80k|                &frameSizeInfo.decompressedBound);
  241|  1.80k|            break;
  242|      0|#endif
  243|      0|#if (ZSTD_LEGACY_SUPPORT <= 7)
  244|    989|        case 7 :
  ------------------
  |  Branch (244:9): [True: 989, False: 3.83k]
  ------------------
  245|    989|            ZSTDv07_findFrameSizeInfoLegacy(src, srcSize,
  246|    989|                &frameSizeInfo.compressedSize,
  247|    989|                &frameSizeInfo.decompressedBound);
  248|    989|            break;
  249|      0|#endif
  250|      0|        default :
  ------------------
  |  Branch (250:9): [True: 0, False: 4.82k]
  ------------------
  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.82k|    }
  255|  4.82k|    if (!ZSTD_isError(frameSizeInfo.compressedSize) && frameSizeInfo.compressedSize > srcSize) {
  ------------------
  |  |   44|  4.82k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (255:9): [True: 4.65k, False: 171]
  |  Branch (255:56): [True: 0, False: 4.65k]
  ------------------
  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.82k|    if (frameSizeInfo.decompressedBound != ZSTD_CONTENTSIZE_ERROR) {
  ------------------
  |  |  204|  4.82k|#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
  ------------------
  |  Branch (262:9): [True: 4.65k, False: 171]
  ------------------
  263|  4.65k|        assert((frameSizeInfo.decompressedBound & (ZSTD_BLOCKSIZE_MAX - 1)) == 0);
  ------------------
  |  |   70|  4.65k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  264|  4.65k|        frameSizeInfo.nbBlocks = (size_t)(frameSizeInfo.decompressedBound / ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |  148|  4.65k|#define ZSTD_BLOCKSIZE_MAX     (1<<ZSTD_BLOCKSIZELOG_MAX)
  |  |  ------------------
  |  |  |  |  147|  4.65k|#define ZSTD_BLOCKSIZELOG_MAX  17
  |  |  ------------------
  ------------------
  265|  4.65k|    }
  266|  4.82k|    return frameSizeInfo;
  267|  4.82k|}
zstd_decompress.c:ZSTD_findFrameCompressedSizeLegacy:
  270|  4.82k|{
  271|  4.82k|    ZSTD_frameSizeInfo frameSizeInfo = ZSTD_findFrameSizeInfoLegacy(src, srcSize);
  272|  4.82k|    return frameSizeInfo.compressedSize;
  273|  4.82k|}
zstd_decompress.c:ZSTD_decompressLegacy:
  125|  4.65k|{
  126|  4.65k|    U32 const version = ZSTD_isLegacy(src, compressedSize);
  127|  4.65k|    char x;
  128|       |    /* Avoid passing NULL to legacy decoding. */
  129|  4.65k|    if (dst == NULL) {
  ------------------
  |  Branch (129:9): [True: 0, False: 4.65k]
  ------------------
  130|      0|        assert(dstCapacity == 0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  131|      0|        dst = &x;
  132|      0|    }
  133|  4.65k|    if (src == NULL) {
  ------------------
  |  Branch (133:9): [True: 0, False: 4.65k]
  ------------------
  134|      0|        assert(compressedSize == 0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  135|      0|        src = &x;
  136|      0|    }
  137|  4.65k|    if (dict == NULL) {
  ------------------
  |  Branch (137:9): [True: 2.17k, False: 2.47k]
  ------------------
  138|  2.17k|        assert(dictSize == 0);
  ------------------
  |  |   70|  2.17k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  139|  2.17k|        dict = &x;
  140|  2.17k|    }
  141|  4.65k|    (void)dst; (void)dstCapacity; (void)dict; (void)dictSize;  /* unused when ZSTD_LEGACY_SUPPORT >= 8 */
  142|  4.65k|    switch(version)
  143|  4.65k|    {
  144|       |#if (ZSTD_LEGACY_SUPPORT <= 1)
  145|       |        case 1 :
  146|       |            return ZSTDv01_decompress(dst, dstCapacity, src, compressedSize);
  147|       |#endif
  148|       |#if (ZSTD_LEGACY_SUPPORT <= 2)
  149|       |        case 2 :
  150|       |            return ZSTDv02_decompress(dst, dstCapacity, src, compressedSize);
  151|       |#endif
  152|       |#if (ZSTD_LEGACY_SUPPORT <= 3)
  153|       |        case 3 :
  154|       |            return ZSTDv03_decompress(dst, dstCapacity, src, compressedSize);
  155|       |#endif
  156|       |#if (ZSTD_LEGACY_SUPPORT <= 4)
  157|       |        case 4 :
  158|       |            return ZSTDv04_decompress(dst, dstCapacity, src, compressedSize);
  159|       |#endif
  160|      0|#if (ZSTD_LEGACY_SUPPORT <= 5)
  161|  1.96k|        case 5 :
  ------------------
  |  Branch (161:9): [True: 1.96k, False: 2.68k]
  ------------------
  162|  1.96k|            {   size_t result;
  163|  1.96k|                ZSTDv05_DCtx* const zd = ZSTDv05_createDCtx();
  164|  1.96k|                if (zd==NULL) return ERROR(memory_allocation);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (164:21): [True: 0, False: 1.96k]
  ------------------
  165|  1.96k|                result = ZSTDv05_decompress_usingDict(zd, dst, dstCapacity, src, compressedSize, dict, dictSize);
  166|  1.96k|                ZSTDv05_freeDCtx(zd);
  167|  1.96k|                return result;
  168|  1.96k|            }
  169|      0|#endif
  170|      0|#if (ZSTD_LEGACY_SUPPORT <= 6)
  171|  1.72k|        case 6 :
  ------------------
  |  Branch (171:9): [True: 1.72k, False: 2.93k]
  ------------------
  172|  1.72k|            {   size_t result;
  173|  1.72k|                ZSTDv06_DCtx* const zd = ZSTDv06_createDCtx();
  174|  1.72k|                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.72k]
  ------------------
  175|  1.72k|                result = ZSTDv06_decompress_usingDict(zd, dst, dstCapacity, src, compressedSize, dict, dictSize);
  176|  1.72k|                ZSTDv06_freeDCtx(zd);
  177|  1.72k|                return result;
  178|  1.72k|            }
  179|      0|#endif
  180|      0|#if (ZSTD_LEGACY_SUPPORT <= 7)
  181|    962|        case 7 :
  ------------------
  |  Branch (181:9): [True: 962, False: 3.69k]
  ------------------
  182|    962|            {   size_t result;
  183|    962|                ZSTDv07_DCtx* const zd = ZSTDv07_createDCtx();
  184|    962|                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: 962]
  ------------------
  185|    962|                result = ZSTDv07_decompress_usingDict(zd, dst, dstCapacity, src, compressedSize, dict, dictSize);
  186|    962|                ZSTDv07_freeDCtx(zd);
  187|    962|                return result;
  188|    962|            }
  189|      0|#endif
  190|      0|        default :
  ------------------
  |  Branch (190:9): [True: 0, False: 4.65k]
  ------------------
  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.65k|    }
  193|  4.65k|}

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

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

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

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

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

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

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

blosc2_stdio_open:
  137|    102|void *blosc2_stdio_open(const char *urlpath, const char *mode, void *params) {
  138|    102|  BLOSC_UNUSED_PARAM(params);
  ------------------
  |  |   28|    102|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  139|    102|  if (urlpath == NULL || mode == NULL) {
  ------------------
  |  Branch (139:7): [True: 102, False: 0]
  |  Branch (139:26): [True: 0, False: 0]
  ------------------
  140|    102|    BLOSC_TRACE_ERROR("Invalid arguments for stdio open.");
  ------------------
  |  |   93|    102|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    102|    do {                                            \
  |  |  |  |   98|    102|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    102|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 102, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    102|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  141|    102|    return NULL;
  142|    102|  }
  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.6k|int blosc2_stdio_destroy(void* params) {
  303|  12.6k|  BLOSC_UNUSED_PARAM(params);
  ------------------
  |  |   28|  12.6k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  304|  12.6k|  return 0;
  305|  12.6k|}

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

blosclz_decompress:
  685|    231|int blosclz_decompress(const void* input, int length, void* output, int maxout) {
  686|    231|  const uint8_t* ip = (const uint8_t*)input;
  687|    231|  const uint8_t* ip_limit = ip + length;
  688|    231|  uint8_t* op = (uint8_t*)output;
  689|    231|  uint32_t ctrl;
  690|    231|  uint8_t* op_limit = op + maxout;
  691|    231|  if (BLOSCLZ_UNLIKELY(length == 0)) {
  ------------------
  |  |   35|    231|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 0, False: 231]
  |  |  ------------------
  ------------------
  692|      0|    return 0;
  693|      0|  }
  694|    231|  ctrl = (*ip++) & 31U;
  695|       |
  696|  34.0k|  while (1) {
  ------------------
  |  Branch (696:10): [True: 34.0k, Folded]
  ------------------
  697|  34.0k|    if (ctrl >= 32) {
  ------------------
  |  Branch (697:9): [True: 18.1k, False: 15.8k]
  ------------------
  698|       |      // match
  699|  18.1k|      int32_t len = (int32_t)(ctrl >> 5U) - 1 ;
  700|  18.1k|      int32_t ofs = (int32_t)(ctrl & 31U) << 8U;
  701|  18.1k|      uint8_t code;
  702|  18.1k|      const uint8_t* ref = op - ofs;
  703|       |
  704|  18.1k|      if (len == 7 - 1) {
  ------------------
  |  Branch (704:11): [True: 13.2k, False: 4.89k]
  ------------------
  705|  30.4k|        do {
  706|  30.4k|          if (BLOSCLZ_UNLIKELY(ip + 1 >= ip_limit)) {
  ------------------
  |  |   35|  30.4k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 8, False: 30.4k]
  |  |  ------------------
  ------------------
  707|      8|            return 0;
  708|      8|          }
  709|  30.4k|          code = *ip++;
  710|  30.4k|          len += code;
  711|  30.4k|          if (BLOSCLZ_UNLIKELY(len > maxout)) {
  ------------------
  |  |   35|  30.4k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 3, False: 30.4k]
  |  |  ------------------
  ------------------
  712|      3|            return 0;
  713|      3|          }
  714|  30.4k|        } while (code == 255);
  ------------------
  |  Branch (714:18): [True: 17.1k, False: 13.2k]
  ------------------
  715|  13.2k|      }
  716|  4.89k|      else {
  717|  4.89k|        if (BLOSCLZ_UNLIKELY(ip + 1 >= ip_limit)) {
  ------------------
  |  |   35|  4.89k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 5, False: 4.89k]
  |  |  ------------------
  ------------------
  718|      5|          return 0;
  719|      5|        }
  720|  4.89k|      }
  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.44k, False: 14.6k]
  |  |  ------------------
  ------------------
  727|  3.44k|        if (ofs == (31U << 8U)) {
  ------------------
  |  Branch (727:13): [True: 3.02k, False: 421]
  ------------------
  728|  3.02k|          if (ip + 1 >= ip_limit) {
  ------------------
  |  Branch (728:15): [True: 1, False: 3.02k]
  ------------------
  729|      1|            return 0;
  730|      1|          }
  731|  3.02k|          ofs = (*ip++) << 8U;
  732|  3.02k|          ofs += *ip++;
  733|  3.02k|          ref = op - ofs - MAX_DISTANCE;
  ------------------
  |  |   46|  3.02k|#define MAX_DISTANCE 8191
  ------------------
  734|  3.02k|        }
  735|  3.44k|      }
  736|       |
  737|  18.1k|      if (BLOSCLZ_UNLIKELY(len > op_limit - op)) {
  ------------------
  |  |   35|  18.1k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 30, False: 18.1k]
  |  |  ------------------
  ------------------
  738|     30|        return 0;
  739|     30|      }
  740|       |
  741|  18.1k|      if (BLOSCLZ_UNLIKELY(ref <= (uint8_t*)output)) {
  ------------------
  |  |   35|  18.1k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 62, False: 18.0k]
  |  |  ------------------
  ------------------
  742|     62|        return 0;
  743|     62|      }
  744|       |
  745|  18.0k|      if (BLOSCLZ_UNLIKELY(ip >= ip_limit)) break;
  ------------------
  |  |   35|  18.0k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 4, False: 18.0k]
  |  |  ------------------
  ------------------
  746|  18.0k|      ctrl = *ip++;
  747|       |
  748|  18.0k|      ref--;
  749|  18.0k|      if (ref == op - 1) {
  ------------------
  |  Branch (749:11): [True: 7.31k, False: 10.7k]
  ------------------
  750|       |        /* optimized copy for a run */
  751|  7.31k|        memset(op, *ref, len);
  752|  7.31k|        op += len;
  753|  7.31k|      }
  754|  10.7k|      else if ((op - ref >= 8) && (op_limit - op >= len + 8)) {
  ------------------
  |  Branch (754:16): [True: 9.61k, False: 1.11k]
  |  Branch (754:35): [True: 9.51k, False: 97]
  ------------------
  755|       |        // copy with an overlap not larger than 8
  756|  9.51k|        wild_copy(op, ref, op + len);
  757|  9.51k|        op += len;
  758|  9.51k|      }
  759|  1.21k|      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.21k|          op = copy_match(op, ref, (unsigned) len);
  770|       |#if 0 && defined(__AVX2__)
  771|       |        }
  772|       |#endif
  773|  1.21k|      }
  774|  18.0k|    }
  775|  15.8k|    else {
  776|       |      // literal
  777|  15.8k|      ctrl++;
  778|  15.8k|      if (BLOSCLZ_UNLIKELY(ctrl > op_limit - op)) {
  ------------------
  |  |   35|  15.8k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 13, False: 15.8k]
  |  |  ------------------
  ------------------
  779|     13|        return 0;
  780|     13|      }
  781|  15.8k|      if (BLOSCLZ_UNLIKELY(ctrl > ip_limit - ip)) {
  ------------------
  |  |   35|  15.8k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 23, False: 15.8k]
  |  |  ------------------
  ------------------
  782|     23|        return 0;
  783|     23|      }
  784|       |
  785|  15.8k|      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.8k|      if (BLOSCLZ_UNLIKELY(ip >= ip_limit)) break;
  ------------------
  |  |   35|  15.8k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (35:30): [True: 82, False: 15.7k]
  |  |  ------------------
  ------------------
  793|  15.7k|      ctrl = *ip++;
  794|  15.7k|    }
  795|  34.0k|  }
  796|       |
  797|     86|  return (int)(op - (uint8_t*)output);
  798|    231|}
blosclz.c:wild_copy:
  677|  9.51k|static inline void wild_copy(uint8_t *out, const uint8_t* from, uint8_t* end) {
  678|  9.51k|  uint8_t* d = out;
  679|  9.51k|  const uint8_t* s = from;
  680|  9.51k|  uint8_t* const e = end;
  681|       |
  682|   187k|  do { memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  Branch (682:44): [True: 177k, False: 9.51k]
  ------------------
  683|  9.51k|}

delta_decoder:
   97|   164k|                   int32_t typesize, uint8_t* dest) {
   98|   164k|  int32_t i;
   99|       |
  100|   164k|  if (offset == 0) {
  ------------------
  |  Branch (100:7): [True: 117k, False: 47.2k]
  ------------------
  101|       |    /* Decode delta for the reference block */
  102|   117k|    switch (typesize) {
  103|  49.4k|      case 1:
  ------------------
  |  Branch (103:7): [True: 49.4k, False: 67.7k]
  ------------------
  104|  6.72G|        for (i = 1; i < nbytes; i++) {
  ------------------
  |  Branch (104:21): [True: 6.72G, False: 49.4k]
  ------------------
  105|  6.72G|          dest[i] ^= dref[i-1];
  106|  6.72G|        }
  107|  49.4k|        break;
  108|    310|      case 2:
  ------------------
  |  Branch (108:7): [True: 310, False: 116k]
  ------------------
  109|   651M|        for (i = 1; i < nbytes / 2; i++) {
  ------------------
  |  Branch (109:21): [True: 651M, False: 310]
  ------------------
  110|   651M|          ((uint16_t *)dest)[i] ^= ((uint16_t *)dref)[i-1];
  111|   651M|        }
  112|    310|        break;
  113|    251|      case 4:
  ------------------
  |  Branch (113:7): [True: 251, False: 116k]
  ------------------
  114|   501M|        for (i = 1; i < nbytes / 4; i++) {
  ------------------
  |  Branch (114:21): [True: 501M, False: 251]
  ------------------
  115|   501M|          ((uint32_t *)dest)[i] ^= ((uint32_t *)dref)[i-1];
  116|   501M|        }
  117|    251|        break;
  118|  17.8k|      case 8:
  ------------------
  |  Branch (118:7): [True: 17.8k, False: 99.2k]
  ------------------
  119|  1.01G|        for (i = 1; i < nbytes / 8; i++) {
  ------------------
  |  Branch (119:21): [True: 1.01G, False: 17.8k]
  ------------------
  120|  1.01G|          ((uint64_t *)dest)[i] ^= ((uint64_t *)dref)[i-1];
  121|  1.01G|        }
  122|  17.8k|        break;
  123|  49.3k|      default:
  ------------------
  |  Branch (123:7): [True: 49.3k, False: 67.8k]
  ------------------
  124|  49.3k|        if ((typesize % 8) == 0) {
  ------------------
  |  Branch (124:13): [True: 151, False: 49.1k]
  ------------------
  125|    151|          delta_decoder(dref, offset, nbytes, 8, dest);
  126|  49.1k|        } else {
  127|  49.1k|          delta_decoder(dref, offset, nbytes, 1, dest);
  128|  49.1k|        }
  129|   117k|    }
  130|   117k|  } else {
  131|       |    /* Decode delta for the non-reference blocks */
  132|  47.2k|    switch (typesize) {
  133|  19.2k|      case 1:
  ------------------
  |  Branch (133:7): [True: 19.2k, False: 28.0k]
  ------------------
  134|  1.14G|        for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (134:21): [True: 1.14G, False: 19.2k]
  ------------------
  135|  1.14G|          dest[i] ^= dref[i];
  136|  1.14G|        }
  137|  19.2k|        break;
  138|    114|      case 2:
  ------------------
  |  Branch (138:7): [True: 114, False: 47.1k]
  ------------------
  139|  54.5M|        for (i = 0; i < nbytes / 2; i++) {
  ------------------
  |  Branch (139:21): [True: 54.5M, False: 114]
  ------------------
  140|  54.5M|          ((uint16_t *)dest)[i] ^= ((uint16_t *)dref)[i];
  141|  54.5M|        }
  142|    114|        break;
  143|     86|      case 4:
  ------------------
  |  Branch (143:7): [True: 86, False: 47.1k]
  ------------------
  144|  96.2M|        for (i = 0; i < nbytes / 4; i++) {
  ------------------
  |  Branch (144:21): [True: 96.2M, False: 86]
  ------------------
  145|  96.2M|          ((uint32_t *)dest)[i] ^= ((uint32_t *)dref)[i];
  146|  96.2M|        }
  147|     86|        break;
  148|  8.59k|      case 8:
  ------------------
  |  Branch (148:7): [True: 8.59k, False: 38.6k]
  ------------------
  149|   309M|        for (i = 0; i < nbytes / 8; i++) {
  ------------------
  |  Branch (149:21): [True: 309M, False: 8.59k]
  ------------------
  150|   309M|          ((uint64_t *)dest)[i] ^= ((uint64_t *)dref)[i];
  151|   309M|        }
  152|  8.59k|        break;
  153|  19.2k|      default:
  ------------------
  |  Branch (153:7): [True: 19.2k, False: 28.0k]
  ------------------
  154|  19.2k|        if ((typesize % 8) == 0) {
  ------------------
  |  Branch (154:13): [True: 89, False: 19.1k]
  ------------------
  155|     89|          delta_decoder(dref, offset, nbytes, 8, dest);
  156|  19.1k|        } else {
  157|  19.1k|          delta_decoder(dref, offset, nbytes, 1, dest);
  158|  19.1k|        }
  159|  47.2k|    }
  160|  47.2k|  }
  161|   164k|}

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

frame_reader_acquire:
  157|     51|void* frame_reader_acquire(blosc2_frame_s* frame, const blosc2_io* io) {
  158|     51|  blosc2_io_cb *io_cb = blosc2_get_io_cb(io->id);
  159|     51|  if (io_cb == NULL) {
  ------------------
  |  Branch (159:7): [True: 0, False: 51]
  ------------------
  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|     51|  if (io->id != BLOSC2_IO_FILESYSTEM) {
  ------------------
  |  Branch (163:7): [True: 0, False: 51]
  ------------------
  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|     51|  blosc2_pthread_mutex_lock(&frame->read_fp_mutex);
  ------------------
  |  |   92|     51|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  187|     51|  if (frame->read_fp == NULL && !frame->read_fp_nocache) {
  ------------------
  |  Branch (187:7): [True: 51, False: 0]
  |  Branch (187:33): [True: 51, False: 0]
  ------------------
  188|     51|    if (reader_cache_claim()) {
  ------------------
  |  Branch (188:9): [True: 51, False: 0]
  ------------------
  189|     51|      frame->read_fp = io_cb->open(frame->urlpath, "rb", io->params);
  190|     51|      if (frame->read_fp == NULL) {
  ------------------
  |  Branch (190:11): [True: 51, False: 0]
  ------------------
  191|     51|        reader_cache_return();
  192|     51|      }
  193|     51|    }
  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|     51|  }
  200|     51|  void* fp = frame->read_fp;
  201|     51|  if (fp != NULL) {
  ------------------
  |  Branch (201:7): [True: 0, False: 51]
  ------------------
  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|     51|  blosc2_pthread_mutex_unlock(&frame->read_fp_mutex);
  ------------------
  |  |   93|     51|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  207|     51|  if (fp == NULL) {
  ------------------
  |  Branch (207:7): [True: 51, 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|     51|    fp = io_cb->open(frame->urlpath, "rb", io->params);
  211|     51|  }
  212|     51|  return fp;
  213|     51|#endif
  214|     51|}
frame_reader_invalidate:
  265|  13.4k|void frame_reader_invalidate(blosc2_frame_s* frame) {
  266|  13.4k|  blosc2_pthread_mutex_lock(&frame->read_fp_mutex);
  ------------------
  |  |   92|  13.4k|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  267|  13.4k|  frame_reader_close_locked(frame, true);
  268|  13.4k|  blosc2_pthread_mutex_unlock(&frame->read_fp_mutex);
  ------------------
  |  |   93|  13.4k|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  269|  13.4k|}
frame_lock:
  481|  56.5k|int frame_lock(blosc2_frame_s* frame, bool exclusive) {
  482|  56.5k|  if (frame == NULL || !frame->locking) {
  ------------------
  |  Branch (482:7): [True: 0, False: 56.5k]
  |  Branch (482:24): [True: 56.5k, False: 0]
  ------------------
  483|  56.5k|    return BLOSC2_ERROR_SUCCESS;
  484|  56.5k|  }
  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|  56.5k|int frame_unlock(blosc2_frame_s* frame) {
  545|  56.5k|  if (frame == NULL || !frame->locking || frame->lock_depth == 0) {
  ------------------
  |  Branch (545:7): [True: 0, False: 56.5k]
  |  Branch (545:24): [True: 56.5k, False: 0]
  |  Branch (545:43): [True: 0, False: 0]
  ------------------
  546|  56.5k|    return BLOSC2_ERROR_SUCCESS;
  547|  56.5k|  }
  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.4k|int frame_free(blosc2_frame_s* frame) {
  561|       |
  562|  13.4k|  frame_reader_invalidate(frame);
  563|  13.4k|  blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|  13.4k|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
  564|       |
  565|  13.4k|  if (frame->locking && frame->lock_fd != -1) {
  ------------------
  |  Branch (565:7): [True: 0, False: 13.4k]
  |  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.4k|  if (frame->cframe != NULL && !frame->avoid_cframe_free) {
  ------------------
  |  Branch (573:7): [True: 13.4k, False: 0]
  |  Branch (573:32): [True: 0, False: 13.4k]
  ------------------
  574|      0|    free(frame->cframe);
  575|      0|  }
  576|       |
  577|  13.4k|  if (frame->coffsets != NULL && frame->coffsets_needs_free) {
  ------------------
  |  Branch (577:7): [True: 0, False: 13.4k]
  |  Branch (577:34): [True: 0, False: 0]
  ------------------
  578|      0|    free(frame->coffsets);
  579|      0|  }
  580|       |
  581|  13.4k|  if (frame->urlpath != NULL) {
  ------------------
  |  Branch (581:7): [True: 0, False: 13.4k]
  ------------------
  582|      0|    free(frame->urlpath);
  583|      0|  }
  584|       |
  585|  13.4k|  free(frame);
  586|       |
  587|  13.4k|  return 0;
  588|  13.4k|}
get_header_info:
  898|  73.7k|                    uint8_t *splitmode, uint8_t *use_dict, const blosc2_io *io) {
  899|  73.7k|  uint8_t* framep = frame->cframe;
  900|  73.7k|  uint8_t* header_ptr;
  901|  73.7k|  uint8_t header[FRAME_HEADER_MINLEN];
  902|       |
  903|  73.7k|  blosc2_io_cb *io_cb = blosc2_get_io_cb(io->id);
  904|  73.7k|  if (io_cb == NULL) {
  ------------------
  |  Branch (904:7): [True: 0, False: 73.7k]
  ------------------
  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|  73.7k|  if (frame->len <= 0) {
  ------------------
  |  Branch (909:7): [True: 0, False: 73.7k]
  ------------------
  910|      0|    return BLOSC2_ERROR_READ_BUFFER;
  911|      0|  }
  912|       |
  913|  73.7k|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (913:7): [True: 0, False: 73.7k]
  ------------------
  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|  73.7k|  uint8_t frame_type = framep[FRAME_TYPE];
  ------------------
  |  |   33|  73.7k|#define FRAME_TYPE (FRAME_FLAGS + 1)  // 26
  |  |  ------------------
  |  |  |  |   32|  73.7k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  73.7k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  73.7k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  73.7k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  949|  73.7k|  uint8_t frame_version = framep[FRAME_FLAGS] & 0x0fu;
  ------------------
  |  |   32|  73.7k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|  73.7k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|  73.7k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|  73.7k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  950|  73.7k|  if (frame_version > BLOSC2_VERSION_FRAME_FORMAT) {
  ------------------
  |  Branch (950:7): [True: 2, False: 73.7k]
  ------------------
  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|  73.7k|  if (frame->sframe) {
  ------------------
  |  Branch (954:7): [True: 0, False: 73.7k]
  ------------------
  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|  73.7k|  } else {
  959|  73.7k|    if (frame_type != FRAME_CONTIGUOUS_TYPE) {
  ------------------
  |  |   21|  73.7k|#define FRAME_CONTIGUOUS_TYPE 0
  ------------------
  |  Branch (959:9): [True: 2, False: 73.7k]
  ------------------
  960|      2|      return BLOSC2_ERROR_FRAME_TYPE;
  961|      2|    }
  962|  73.7k|  }
  963|       |
  964|       |  // Fetch some internal lengths
  965|  73.7k|  from_big(header_len, framep + FRAME_HEADER_LEN, sizeof(*header_len));
  ------------------
  |  |   38|  73.7k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  966|  73.7k|  if (*header_len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  73.7k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  73.7k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  73.7k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  73.7k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  73.7k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  73.7k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  73.7k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  73.7k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  73.7k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  73.7k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  73.7k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  73.7k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  73.7k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  73.7k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (966:7): [True: 29, False: 73.7k]
  ------------------
  967|     29|    BLOSC_TRACE_ERROR("Header length is zero or smaller than min allowed.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  968|     29|    return BLOSC2_ERROR_INVALID_HEADER;
  969|     29|  }
  970|  73.7k|  from_big(frame_len, framep + FRAME_LEN, sizeof(*frame_len));
  ------------------
  |  |   38|  73.7k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  971|  73.7k|  if (*header_len > *frame_len) {
  ------------------
  |  Branch (971:7): [True: 28, False: 73.7k]
  ------------------
  972|     28|    BLOSC_TRACE_ERROR("Header length exceeds length of the frame.");
  ------------------
  |  |   93|     28|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     28|    do {                                            \
  |  |  |  |   98|     28|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     28|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 28, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     28|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  973|     28|    return BLOSC2_ERROR_INVALID_HEADER;
  974|     28|  }
  975|  73.7k|  from_big(nbytes, framep + FRAME_NBYTES, sizeof(*nbytes));
  ------------------
  |  |   38|  73.7k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  976|  73.7k|  from_big(cbytes, framep + FRAME_CBYTES, sizeof(*cbytes));
  ------------------
  |  |   38|  73.7k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  977|  73.7k|  from_big(blocksize, framep + FRAME_BLOCKSIZE, sizeof(*blocksize));
  ------------------
  |  |   38|  73.7k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  978|  73.7k|  if (chunksize != NULL) {
  ------------------
  |  Branch (978:7): [True: 73.7k, False: 0]
  ------------------
  979|  73.7k|    from_big(chunksize, framep + FRAME_CHUNKSIZE, sizeof(*chunksize));
  ------------------
  |  |   38|  73.7k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  980|  73.7k|  }
  981|  73.7k|  if (typesize != NULL) {
  ------------------
  |  Branch (981:7): [True: 71.6k, False: 2.04k]
  ------------------
  982|  71.6k|    from_big(typesize, framep + FRAME_TYPESIZE, sizeof(*typesize));
  ------------------
  |  |   38|  71.6k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  983|  71.6k|    if (*typesize <= 0) {
  ------------------
  |  Branch (983:9): [True: 34, False: 71.6k]
  ------------------
  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|  71.6k|  }
  988|       |
  989|       |  // Codecs
  990|  73.6k|  uint8_t frame_codecs = framep[FRAME_CODECS];
  ------------------
  |  |   34|  73.6k|#define FRAME_CODECS (FRAME_FLAGS + 2)  // 27
  |  |  ------------------
  |  |  |  |   32|  73.6k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  73.6k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  73.6k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  73.6k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  991|  73.6k|  if (clevel != NULL) {
  ------------------
  |  Branch (991:7): [True: 13.3k, False: 60.3k]
  ------------------
  992|  13.3k|    *clevel = frame_codecs >> 4u;
  993|  13.3k|  }
  994|  73.6k|  if (compcode != NULL) {
  ------------------
  |  Branch (994:7): [True: 13.3k, False: 60.3k]
  ------------------
  995|  13.3k|    *compcode = frame_codecs & 0xFu;
  996|  13.3k|    if (*compcode == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (996:9): [True: 494, False: 12.8k]
  ------------------
  997|    494|      from_big(compcode, framep + FRAME_UDCODEC, sizeof(*compcode));
  ------------------
  |  |   38|    494|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
  998|    494|    }
  999|  13.3k|  }
 1000|       |
 1001|       |  // Other flags
 1002|  73.6k|  uint8_t other_flags = framep[FRAME_OTHER_FLAGS];
  ------------------
  |  |   35|  73.6k|#define FRAME_OTHER_FLAGS (FRAME_FLAGS + 3)  // 28
  |  |  ------------------
  |  |  |  |   32|  73.6k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  73.6k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  73.6k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  73.6k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1003|  73.6k|  if (splitmode != NULL) {
  ------------------
  |  Branch (1003:7): [True: 13.3k, False: 60.3k]
  ------------------
 1004|  13.3k|    *splitmode = (other_flags & 0x03u) + 1;
 1005|  13.3k|  }
 1006|       |
 1007|       |  // Other flags 2: bit 0 = use_dict
 1008|  73.6k|  if (use_dict != NULL) {
  ------------------
  |  Branch (1008:7): [True: 13.3k, False: 60.3k]
  ------------------
 1009|  13.3k|    *use_dict = (framep[FRAME_OTHER_FLAGS2] & FRAME_USE_DICT) ? 1 : 0;
  ------------------
  |  |   47|  13.3k|#define FRAME_OTHER_FLAGS2 (FRAME_FILTER_PIPELINE + 1 + 14)  // 85
  |  |  ------------------
  |  |  |  |   44|  13.3k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  13.3k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  13.3k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  13.3k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  13.3k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  13.3k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  13.3k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  13.3k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  13.3k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  13.3k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  13.3k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  13.3k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  13.3k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  *use_dict = (framep[FRAME_OTHER_FLAGS2] & FRAME_USE_DICT) ? 1 : 0;
  ------------------
  |  |   48|  13.3k|#define FRAME_USE_DICT (1U << 0)   //!< bit 0 of other_flags2: use dictionary compression
  ------------------
  |  Branch (1009:17): [True: 5.14k, False: 8.20k]
  ------------------
 1010|  13.3k|  }
 1011|       |
 1012|  73.6k|  if (compcode_meta != NULL) {
  ------------------
  |  Branch (1012:7): [True: 13.3k, False: 60.3k]
  ------------------
 1013|  13.3k|    from_big(compcode_meta, framep + FRAME_CODEC_META, sizeof(*compcode_meta));
  ------------------
  |  |   38|  13.3k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1014|  13.3k|  }
 1015|       |
 1016|       |  // Filters
 1017|  73.6k|  if (filters != NULL && filters_meta != NULL) {
  ------------------
  |  Branch (1017:7): [True: 13.3k, False: 60.3k]
  |  Branch (1017:26): [True: 13.3k, False: 0]
  ------------------
 1018|  13.3k|    uint8_t nfilters = framep[FRAME_FILTER_PIPELINE];
  ------------------
  |  |   44|  13.3k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|  13.3k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  13.3k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|  13.3k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|  13.3k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|  13.3k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  13.3k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  13.3k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  13.3k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  13.3k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  13.3k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  13.3k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  13.3k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1019|  13.3k|    if (nfilters > BLOSC2_MAX_FILTERS) {
  ------------------
  |  Branch (1019:9): [True: 4, False: 13.3k]
  ------------------
 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.3k|    uint8_t *filters_ = framep + FRAME_FILTER_PIPELINE + 1;
  ------------------
  |  |   44|  13.3k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|  13.3k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  13.3k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|  13.3k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|  13.3k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|  13.3k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  13.3k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  13.3k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  13.3k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  13.3k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  13.3k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  13.3k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  13.3k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1024|  13.3k|    uint8_t *filters_meta_ = framep + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   44|  13.3k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|  13.3k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  13.3k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|  13.3k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|  13.3k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|  13.3k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  13.3k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  13.3k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  13.3k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  13.3k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  13.3k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  13.3k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  13.3k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  uint8_t *filters_meta_ = framep + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   53|  13.3k|#define FRAME_FILTER_PIPELINE_MAX (8)  // the maximum number of filters that can be stored in header
  ------------------
 1025|  20.2k|    for (int i = 0; i < nfilters; i++) {
  ------------------
  |  Branch (1025:21): [True: 6.85k, False: 13.3k]
  ------------------
 1026|  6.85k|      filters[i] = filters_[i];
 1027|  6.85k|      filters_meta[i] = filters_meta_[i];
 1028|  6.85k|    }
 1029|  13.3k|  }
 1030|       |
 1031|  73.6k|  if (*nbytes > 0) {
  ------------------
  |  Branch (1031:7): [True: 72.9k, False: 678]
  ------------------
 1032|  72.9k|    if (*chunksize > 0) {
  ------------------
  |  Branch (1032:9): [True: 54.1k, False: 18.8k]
  ------------------
 1033|       |      // We can compute the number of chunks directly when there is a fixed chunk size.
 1034|  54.1k|      *nchunks = *nbytes / *chunksize;
 1035|  54.1k|      if (*nbytes % *chunksize > 0) {
  ------------------
  |  Branch (1035:11): [True: 49.1k, False: 5.02k]
  ------------------
 1036|  49.1k|        *nchunks += 1;
 1037|  49.1k|      }
 1038|       |
 1039|       |      // Sanity check for compressed sizes
 1040|  54.1k|      if ((*cbytes < 0) || ((int64_t)*nchunks * *chunksize < *nbytes)) {
  ------------------
  |  Branch (1040:11): [True: 62, False: 54.0k]
  |  Branch (1040:28): [True: 11, False: 54.0k]
  ------------------
 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|  54.1k|    }
 1045|  18.8k|    else if (*chunksize == 0) {
  ------------------
  |  Branch (1045:14): [True: 18.7k, False: 44]
  ------------------
 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: 393, False: 18.4k]
  ------------------
 1049|    393|        return rc2;
 1050|    393|      }
 1051|  18.4k|      if (coffsets_nbytes < 0 || coffsets_nbytes % (int32_t)sizeof(int64_t) != 0) {
  ------------------
  |  Branch (1051:11): [True: 30, False: 18.3k]
  |  Branch (1051:34): [True: 9, False: 18.3k]
  ------------------
 1052|     39|        BLOSC_TRACE_ERROR("Invalid offsets chunk in frame header.");
  ------------------
  |  |   93|     39|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     39|    do {                                            \
  |  |  |  |   98|     39|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     39|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 39, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     39|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1053|     39|        return BLOSC2_ERROR_INVALID_HEADER;
 1054|     39|      }
 1055|  18.3k|      *nchunks = coffsets_nbytes / (int32_t)sizeof(int64_t);
 1056|  18.3k|    }
 1057|     44|    else {
 1058|     44|      BLOSC_TRACE_ERROR("Invalid chunk size in frame header.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1059|     44|      return BLOSC2_ERROR_INVALID_HEADER;
 1060|     44|    }
 1061|  72.9k|  } else {
 1062|    678|    *nchunks = 0;
 1063|    678|  }
 1064|       |
 1065|  73.1k|  if (*nchunks > 0) {
  ------------------
  |  Branch (1065:7): [True: 72.4k, False: 693]
  ------------------
 1066|  72.4k|    int32_t off_nbytes;
 1067|  72.4k|    if (!blosc2_nchunks_to_offsets_nbytes(*nchunks, &off_nbytes)) {
  ------------------
  |  Branch (1067:9): [True: 66, False: 72.3k]
  ------------------
 1068|     66|      BLOSC_TRACE_ERROR("Invalid number of chunks in frame header.");
  ------------------
  |  |   93|     66|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     66|    do {                                            \
  |  |  |  |   98|     66|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     66|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 66, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     66|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1069|     66|      return BLOSC2_ERROR_INVALID_HEADER;
 1070|     66|    }
 1071|  72.4k|  }
 1072|       |
 1073|  73.0k|  return 0;
 1074|  73.1k|}
get_trailer_offset:
 1077|    948|int64_t get_trailer_offset(blosc2_frame_s *frame, int32_t header_len, bool has_coffsets) {
 1078|    948|  if (!has_coffsets) {
  ------------------
  |  Branch (1078:7): [True: 150, False: 798]
  ------------------
 1079|       |    // No data chunks yet
 1080|    150|    return header_len;
 1081|    150|  }
 1082|    798|  return frame->len - frame->trailer_len;
 1083|    948|}
frame_from_cframe:
 1873|  13.6k|blosc2_frame_s* frame_from_cframe(uint8_t *cframe, int64_t len, bool copy) {
 1874|       |  // Get the length of the frame
 1875|  13.6k|  const uint8_t* header = cframe;
 1876|  13.6k|  int64_t frame_len;
 1877|  13.6k|  if (len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  13.6k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   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
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1877:7): [True: 0, False: 13.6k]
  ------------------
 1878|      0|    return NULL;
 1879|      0|  }
 1880|       |
 1881|  13.6k|  from_big(&frame_len, header + FRAME_LEN, sizeof(frame_len));
  ------------------
  |  |   38|  13.6k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1882|  13.6k|  if (frame_len != len) {   // sanity check
  ------------------
  |  Branch (1882:7): [True: 103, False: 13.5k]
  ------------------
 1883|    103|    return NULL;
 1884|    103|  }
 1885|       |
 1886|  13.5k|  blosc2_frame_s* frame = frame_alloc();
 1887|  13.5k|  if (frame == NULL) {
  ------------------
  |  Branch (1887:7): [True: 0, False: 13.5k]
  ------------------
 1888|      0|    return NULL;
 1889|      0|  }
 1890|  13.5k|  frame->len = frame_len;
 1891|  13.5k|  frame->file_offset = 0;
 1892|       |
 1893|       |  // Now, the trailer length
 1894|  13.5k|  const uint8_t* trailer = cframe + frame_len - FRAME_TRAILER_MINLEN;
  ------------------
  |  |   58|  13.5k|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
 1895|  13.5k|  int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   58|  13.5k|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
                int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   59|  13.5k|#define FRAME_TRAILER_LEN_OFFSET (22)  // offset to trailer length (counting from the end)
  ------------------
 1896|  13.5k|  if (trailer[trailer_offset - 1] != 0xce) {
  ------------------
  |  Branch (1896:7): [True: 12, False: 13.5k]
  ------------------
 1897|     12|    blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|     12|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 1898|     12|    free(frame);
 1899|     12|    return NULL;
 1900|     12|  }
 1901|  13.5k|  uint32_t trailer_len;
 1902|  13.5k|  from_big(&trailer_len, trailer + trailer_offset, sizeof(trailer_len));
  ------------------
  |  |   38|  13.5k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1903|  13.5k|  if (trailer_len < FRAME_TRAILER_MINLEN || trailer_len > INT32_MAX ||
  ------------------
  |  |   58|  27.0k|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (1903:7): [True: 7, False: 13.5k]
  |  Branch (1903:45): [True: 32, False: 13.4k]
  ------------------
 1904|  13.4k|      (int64_t)trailer_len > frame_len ||
  ------------------
  |  Branch (1904:7): [True: 35, False: 13.4k]
  ------------------
 1905|  13.4k|      (int64_t)trailer_len > frame_len - FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  13.4k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  13.4k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  13.4k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  13.4k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  13.4k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  13.4k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  13.4k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  13.4k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  13.4k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  13.4k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  13.4k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  13.4k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  13.4k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  13.4k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1905:7): [True: 14, False: 13.4k]
  ------------------
 1906|     88|    blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|     88|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 1907|     88|    free(frame);
 1908|     88|    return NULL;
 1909|     88|  }
 1910|  13.4k|  frame->trailer_len = trailer_len;
 1911|       |
 1912|  13.4k|  if (copy) {
  ------------------
  |  Branch (1912:7): [True: 0, False: 13.4k]
  ------------------
 1913|      0|    frame->cframe = malloc((size_t)len);
 1914|      0|    memcpy(frame->cframe, cframe, (size_t)len);
 1915|      0|  }
 1916|  13.4k|  else {
 1917|  13.4k|    frame->cframe = cframe;
 1918|  13.4k|    frame->avoid_cframe_free = true;
 1919|  13.4k|  }
 1920|       |
 1921|  13.4k|  return frame;
 1922|  13.5k|}
get_coffsets:
 2103|  70.6k|                      int64_t nchunks, int32_t *off_cbytes) {
 2104|  70.6k|  int32_t chunk_cbytes;
 2105|  70.6k|  int rc;
 2106|       |
 2107|  70.6k|  if (frame->coffsets != NULL) {
  ------------------
  |  Branch (2107:7): [True: 0, False: 70.6k]
  ------------------
 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|  70.6k|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (2117:7): [True: 70.6k, False: 0]
  ------------------
 2118|  70.6k|    int64_t off_pos = header_len;
 2119|  70.6k|    if (cbytes < INT64_MAX - header_len) {
  ------------------
  |  Branch (2119:9): [True: 2.49k, False: 68.1k]
  ------------------
 2120|  2.49k|      off_pos += cbytes;
 2121|  2.49k|    }
 2122|       |    // Check that there is enough room to read Blosc header
 2123|  70.6k|    if (off_pos < 0 || off_pos > INT64_MAX - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (2123:9): [True: 0, False: 70.6k]
  |  Branch (2123:24): [True: 1, False: 70.6k]
  ------------------
 2124|  70.6k|        off_pos + BLOSC_EXTENDED_HEADER_LENGTH > frame->len) {
  ------------------
  |  Branch (2124:9): [True: 203, False: 70.4k]
  ------------------
 2125|    204|      BLOSC_TRACE_ERROR("Cannot read the offsets outside of frame boundary.");
  ------------------
  |  |   93|    204|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    204|    do {                                            \
  |  |  |  |   98|    204|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    204|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 204, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    204|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2126|    204|      return NULL;
 2127|    204|    }
 2128|       |    // For in-memory frames, the coffset is just one pointer away
 2129|  70.4k|    uint8_t* off_start = frame->cframe + off_pos;
 2130|  70.4k|    if (off_cbytes != NULL) {
  ------------------
  |  Branch (2130:9): [True: 70.4k, False: 0]
  ------------------
 2131|  70.4k|      int32_t chunk_nbytes;
 2132|  70.4k|      int32_t chunk_blocksize;
 2133|  70.4k|      rc = blosc2_cbuffer_sizes(off_start, &chunk_nbytes, &chunk_cbytes, &chunk_blocksize);
 2134|  70.4k|      if (rc < 0) {
  ------------------
  |  Branch (2134:11): [True: 15, False: 70.4k]
  ------------------
 2135|     15|        return NULL;
 2136|     15|      }
 2137|  70.4k|      *off_cbytes = (int32_t)chunk_cbytes;
 2138|  70.4k|      if (*off_cbytes < 0 || off_pos + *off_cbytes > frame->len) {
  ------------------
  |  Branch (2138:11): [True: 0, False: 70.4k]
  |  Branch (2138:30): [True: 60, False: 70.3k]
  ------------------
 2139|     60|        BLOSC_TRACE_ERROR("Cannot read the cbytes outside of frame boundary.");
  ------------------
  |  |   93|     60|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     60|    do {                                            \
  |  |  |  |   98|     60|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     60|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 60, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     60|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2140|     60|        return NULL;
 2141|     60|      }
 2142|  70.3k|      int32_t expected_off_nbytes;
 2143|  70.3k|      if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &expected_off_nbytes)) {
  ------------------
  |  Branch (2143:11): [True: 0, False: 70.3k]
  ------------------
 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|  70.3k|      if (chunk_nbytes != expected_off_nbytes) {
  ------------------
  |  Branch (2147:11): [True: 53, False: 70.3k]
  ------------------
 2148|     53|        BLOSC_TRACE_ERROR("The number of chunks in offset idx "
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2149|     53|                          "does not match the ones in the header frame.");
 2150|     53|        return NULL;
 2151|     53|      }
 2152|       |
 2153|  70.3k|    }
 2154|  70.3k|    return off_start;
 2155|  70.4k|  }
 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.09k|int frame_get_metalayers(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 2515|  1.09k|  int32_t header_len;
 2516|  1.09k|  int64_t frame_len;
 2517|  1.09k|  int64_t nbytes;
 2518|  1.09k|  int64_t cbytes;
 2519|  1.09k|  int32_t blocksize;
 2520|  1.09k|  int32_t chunksize;
 2521|  1.09k|  int64_t nchunks;
 2522|  1.09k|  int ret = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 2523|  1.09k|                            &blocksize, &chunksize, &nchunks,
 2524|  1.09k|                            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 2525|  1.09k|                            schunk->storage->io);
 2526|  1.09k|  if (ret < 0) {
  ------------------
  |  Branch (2526:7): [True: 0, False: 1.09k]
  ------------------
 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.09k|  uint8_t* header = NULL;
 2533|  1.09k|  bool needs_free = false;
 2534|  1.09k|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (2534:7): [True: 1.09k, False: 0]
  ------------------
 2535|  1.09k|    header = frame->cframe;
 2536|  1.09k|  } 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.09k|  ret = get_meta_from_header(frame, schunk, header, header_len);
 2583|       |
 2584|  1.09k|  if (frame->cframe == NULL && needs_free) {
  ------------------
  |  Branch (2584:7): [True: 0, False: 1.09k]
  |  Branch (2584:32): [True: 0, False: 0]
  ------------------
 2585|      0|    free(header);
 2586|      0|  }
 2587|       |
 2588|  1.09k|  return ret;
 2589|  1.09k|}
frame_get_vlmetalayers:
 2725|    948|int frame_get_vlmetalayers(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 2726|    948|  int32_t header_len;
 2727|    948|  int64_t frame_len;
 2728|    948|  int64_t nbytes;
 2729|    948|  int64_t cbytes;
 2730|    948|  int32_t blocksize;
 2731|    948|  int32_t chunksize;
 2732|    948|  int64_t nchunks;
 2733|    948|  int ret = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 2734|    948|                            &blocksize, &chunksize, &nchunks,
 2735|    948|                            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 2736|    948|                            schunk->storage->io);
 2737|    948|  if (ret < 0) {
  ------------------
  |  Branch (2737:7): [True: 0, False: 948]
  ------------------
 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|    948|  int64_t trailer_offset = get_trailer_offset(frame, header_len, nbytes > 0);
 2743|    948|  int32_t trailer_len = (int32_t) frame->trailer_len;
 2744|       |
 2745|    948|  if (trailer_offset < BLOSC_EXTENDED_HEADER_LENGTH || trailer_offset + trailer_len > frame->len) {
  ------------------
  |  Branch (2745:7): [True: 0, False: 948]
  |  Branch (2745:56): [True: 53, False: 895]
  ------------------
 2746|     53|    BLOSC_TRACE_ERROR("Cannot access the trailer out of the frame.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2747|     53|    return BLOSC2_ERROR_READ_BUFFER;
 2748|     53|  }
 2749|       |
 2750|       |  // Get the trailer
 2751|    895|  uint8_t* trailer = NULL;
 2752|    895|  bool needs_free = false;
 2753|    895|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (2753:7): [True: 895, False: 0]
  ------------------
 2754|    895|    trailer = frame->cframe + trailer_offset;
 2755|    895|  } 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|    895|  ret = get_vlmeta_from_trailer(frame, schunk, trailer, trailer_len);
 2825|       |
 2826|    895|  if (frame->cframe == NULL && needs_free) {
  ------------------
  |  Branch (2826:7): [True: 0, False: 895]
  |  Branch (2826:32): [True: 0, False: 0]
  ------------------
 2827|      0|    free(trailer);
 2828|      0|  }
 2829|       |
 2830|    895|  return ret;
 2831|    895|}
get_new_storage:
 2837|  12.6k|                                const blosc2_io* iodefaults) {
 2838|       |
 2839|  12.6k|  blosc2_storage* new_storage = (blosc2_storage*)calloc(1, sizeof(blosc2_storage));
 2840|  12.6k|  memcpy(new_storage, storage, sizeof(blosc2_storage));
 2841|  12.6k|  if (storage->urlpath != NULL) {
  ------------------
  |  Branch (2841:7): [True: 0, False: 12.6k]
  ------------------
 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.6k|  blosc2_cparams* cparams = malloc(sizeof(blosc2_cparams));
 2849|  12.6k|  if (storage->cparams != NULL) {
  ------------------
  |  Branch (2849:7): [True: 0, False: 12.6k]
  ------------------
 2850|      0|    memcpy(cparams, storage->cparams, sizeof(blosc2_cparams));
 2851|  12.6k|  } else {
 2852|  12.6k|    memcpy(cparams, cdefaults, sizeof(blosc2_cparams));
 2853|  12.6k|  }
 2854|  12.6k|  new_storage->cparams = cparams;
 2855|       |
 2856|       |  // dparams
 2857|  12.6k|  blosc2_dparams* dparams = malloc(sizeof(blosc2_dparams));
 2858|  12.6k|  if (storage->dparams != NULL) {
  ------------------
  |  Branch (2858:7): [True: 0, False: 12.6k]
  ------------------
 2859|      0|    memcpy(dparams, storage->dparams, sizeof(blosc2_dparams));
 2860|      0|  }
 2861|  12.6k|  else {
 2862|  12.6k|    memcpy(dparams, ddefaults, sizeof(blosc2_dparams));
 2863|  12.6k|  }
 2864|  12.6k|  new_storage->dparams = dparams;
 2865|       |
 2866|       |  // iodefaults
 2867|  12.6k|  blosc2_io* udio = malloc(sizeof(blosc2_io));
 2868|  12.6k|  if (storage->io != NULL) {
  ------------------
  |  Branch (2868:7): [True: 0, False: 12.6k]
  ------------------
 2869|      0|    memcpy(udio, storage->io, sizeof(blosc2_io));
 2870|      0|  }
 2871|  12.6k|  else {
 2872|  12.6k|    memcpy(udio, iodefaults, sizeof(blosc2_io));
 2873|  12.6k|  }
 2874|  12.6k|  new_storage->io = udio;
 2875|       |
 2876|  12.6k|  return new_storage;
 2877|  12.6k|}
frame_to_schunk:
 2941|  13.4k|blosc2_schunk* frame_to_schunk(blosc2_frame_s* frame, bool copy, const blosc2_io *udio) {
 2942|  13.4k|  int32_t header_len;
 2943|  13.4k|  int64_t frame_len;
 2944|  13.4k|  int rc;
 2945|  13.4k|  bool frame_attached = true;
 2946|  13.4k|  blosc2_schunk* schunk = calloc(1, sizeof(blosc2_schunk));
 2947|  13.4k|  blosc2_cparams *cparams = NULL;
 2948|  13.4k|  blosc2_dparams *dparams = NULL;
 2949|  13.4k|  int64_t *offsets = NULL;
 2950|  13.4k|  if (schunk == NULL) {
  ------------------
  |  Branch (2950:7): [True: 0, False: 13.4k]
  ------------------
 2951|      0|    return NULL;
 2952|      0|  }
 2953|  13.4k|  schunk->frame = (blosc2_frame*)frame;
 2954|  13.4k|  frame->schunk = schunk;
 2955|       |
 2956|  13.4k|  rc = get_header_info(frame, &header_len, &frame_len, &schunk->nbytes,
 2957|  13.4k|                       &schunk->cbytes, &schunk->blocksize,
 2958|  13.4k|                       &schunk->chunksize, &schunk->nchunks, &schunk->typesize,
 2959|  13.4k|                       &schunk->compcode, &schunk->compcode_meta, &schunk->clevel, schunk->filters,
 2960|  13.4k|                       schunk->filters_meta, &schunk->splitmode, &schunk->use_dict, udio);
 2961|  13.4k|  if (rc < 0) {
  ------------------
  |  Branch (2961:7): [True: 714, False: 12.7k]
  ------------------
 2962|    714|    BLOSC_TRACE_ERROR("Unable to get meta info from frame.");
  ------------------
  |  |   93|    714|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    714|    do {                                            \
  |  |  |  |   98|    714|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    714|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 714, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    714|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2963|    714|    goto error;
 2964|    714|  }
 2965|  12.7k|  int64_t nchunks = schunk->nchunks;
 2966|  12.7k|  int64_t nbytes = schunk->nbytes;
 2967|  12.7k|  (void) nbytes;
 2968|  12.7k|  int64_t cbytes = schunk->cbytes;
 2969|       |
 2970|       |  // Compression and decompression contexts
 2971|  12.7k|  blosc2_schunk_get_cparams(schunk, &cparams);
 2972|  12.7k|  schunk->cctx = blosc2_create_cctx(*cparams);
 2973|  12.7k|  if (schunk->cctx == NULL) {
  ------------------
  |  Branch (2973:7): [True: 77, False: 12.6k]
  ------------------
 2974|     77|    BLOSC_TRACE_ERROR("Error while creating the compression context");
  ------------------
  |  |   93|     77|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     77|    do {                                            \
  |  |  |  |   98|     77|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     77|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 77, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     77|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2975|     77|    goto error;
 2976|     77|  }
 2977|  12.6k|  blosc2_schunk_get_dparams(schunk, &dparams);
 2978|  12.6k|  schunk->dctx = blosc2_create_dctx(*dparams);
 2979|  12.6k|  if (schunk->dctx == NULL) {
  ------------------
  |  Branch (2979:7): [True: 0, False: 12.6k]
  ------------------
 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.6k|  blosc2_storage storage = {.contiguous = copy ? false : true};
  ------------------
  |  Branch (2983:43): [True: 0, False: 12.6k]
  ------------------
 2984|  12.6k|  schunk->storage = get_new_storage(&storage, cparams, dparams, udio);
 2985|  12.6k|  free(cparams);
 2986|  12.6k|  cparams = NULL;
 2987|  12.6k|  free(dparams);
 2988|  12.6k|  dparams = NULL;
 2989|  12.6k|  if (nchunks > 0) {
  ------------------
  |  Branch (2989:7): [True: 12.4k, False: 253]
  ------------------
 2990|  12.4k|    rc = validate_offsets_chunk(frame, header_len, cbytes, nchunks);
 2991|  12.4k|    if (rc < 0) {
  ------------------
  |  Branch (2991:9): [True: 10.6k, False: 1.72k]
  ------------------
 2992|  10.6k|      BLOSC_TRACE_ERROR("Cannot validate frame offsets.");
  ------------------
  |  |   93|  10.6k|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|  10.6k|    do {                                            \
  |  |  |  |   98|  10.6k|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|  10.6k|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 10.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|  10.6k|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2993|  10.6k|      goto error;
 2994|  10.6k|    }
 2995|  12.4k|  }
 2996|  1.97k|  if (nchunks > 0) {
  ------------------
  |  Branch (2996:7): [True: 1.72k, False: 253]
  ------------------
 2997|  1.72k|    uint8_t *chunk;
 2998|  1.72k|    bool needs_free;
 2999|       |    // A lazy chunk is enough here: only the header is needed for the flags2 byte
 3000|  1.72k|    rc = frame_get_lazychunk(frame, 0, &chunk, &needs_free);
 3001|  1.72k|    if (rc < 0) {
  ------------------
  |  Branch (3001:9): [True: 878, False: 845]
  ------------------
 3002|    878|      BLOSC_TRACE_ERROR("Cannot inspect the first chunk in frame.");
  ------------------
  |  |   93|    878|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    878|    do {                                            \
  |  |  |  |   98|    878|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    878|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 878, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    878|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3003|    878|      goto error;
 3004|    878|    }
 3005|    845|    schunk->flags2 = chunk[BLOSC2_CHUNK_BLOSC2_FLAGS2];
 3006|    845|    if (needs_free) {
  ------------------
  |  Branch (3006:9): [True: 437, False: 408]
  ------------------
 3007|    437|      free(chunk);
 3008|    437|    }
 3009|    845|  }
 3010|  1.09k|  if (!copy) {
  ------------------
  |  Branch (3010:7): [True: 1.09k, False: 0]
  ------------------
 3011|  1.09k|    goto out;
 3012|  1.09k|  }
 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.09k|  out:
 3236|  1.09k|  rc = frame_get_metalayers(frame, schunk);
 3237|  1.09k|  if (rc < 0) {
  ------------------
  |  Branch (3237:7): [True: 150, False: 948]
  ------------------
 3238|    150|    BLOSC_TRACE_ERROR("Cannot access the metalayers.");
  ------------------
  |  |   93|    150|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    150|    do {                                            \
  |  |  |  |   98|    150|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    150|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 150, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    150|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3239|    150|    goto error;
 3240|    150|  }
 3241|       |
 3242|    948|  rc = frame_get_vlmetalayers(frame, schunk);
 3243|    948|  if (rc < 0) {
  ------------------
  |  Branch (3243:7): [True: 210, False: 738]
  ------------------
 3244|    210|    BLOSC_TRACE_ERROR("Cannot access the vlmetalayers.");
  ------------------
  |  |   93|    210|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    210|    do {                                            \
  |  |  |  |   98|    210|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    210|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 210, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    210|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3245|    210|    goto error;
 3246|    210|  }
 3247|       |
 3248|    738|  return schunk;
 3249|       |
 3250|  12.7k|error:
 3251|  12.7k|  free(cparams);
 3252|  12.7k|  free(dparams);
 3253|  12.7k|  free(offsets);
 3254|  12.7k|  if (schunk != NULL) {
  ------------------
  |  Branch (3254:7): [True: 12.7k, False: 0]
  ------------------
 3255|  12.7k|    blosc2_schunk_free(schunk);
 3256|  12.7k|  }
 3257|  12.7k|  if (!frame_attached) {
  ------------------
  |  Branch (3257:7): [True: 0, False: 12.7k]
  ------------------
 3258|      0|    frame->schunk = NULL;
 3259|      0|    frame_free(frame);
 3260|      0|  }
 3261|       |  return NULL;
 3262|    948|}
get_coffset:
 3284|  58.2k|                int64_t nchunk, int64_t nchunks, int64_t *offset) {
 3285|  58.2k|  int32_t off_cbytes;
 3286|       |  // Get the offset to nchunk
 3287|  58.2k|  uint8_t *coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &off_cbytes);
 3288|  58.2k|  if (coffsets == NULL) {
  ------------------
  |  Branch (3288:7): [True: 0, False: 58.2k]
  ------------------
 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|  58.2k|  int rc = blosc2_getitem(coffsets, off_cbytes, (int32_t)nchunk, 1, offset, (int32_t)sizeof(int64_t));
 3295|  58.2k|  if (rc < 0) {
  ------------------
  |  Branch (3295:7): [True: 211, False: 58.0k]
  ------------------
 3296|    211|    BLOSC_TRACE_ERROR("Problems retrieving a chunk offset.");
  ------------------
  |  |   93|    211|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    211|    do {                                            \
  |  |  |  |   98|    211|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    211|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 211, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    211|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3297|  58.0k|  } else if (!frame->sframe && *offset >= 0) {
  ------------------
  |  Branch (3297:14): [True: 58.0k, False: 0]
  |  Branch (3297:32): [True: 44.4k, False: 13.5k]
  ------------------
 3298|  44.4k|    if (cbytes < 0 || cbytes > INT64_MAX - header_len) {
  ------------------
  |  Branch (3298:9): [True: 0, False: 44.4k]
  |  Branch (3298:23): [True: 225, False: 44.2k]
  ------------------
 3299|    225|      BLOSC_TRACE_ERROR("Invalid compressed size in frame header.");
  ------------------
  |  |   93|    225|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    225|    do {                                            \
  |  |  |  |   98|    225|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    225|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 225, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    225|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3300|    225|      return BLOSC2_ERROR_INVALID_HEADER;
 3301|    225|    }
 3302|  44.2k|    if (*offset > INT64_MAX - header_len) {
  ------------------
  |  Branch (3302:9): [True: 0, False: 44.2k]
  ------------------
 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|  44.2k|    int64_t chunk_pos = header_len + *offset;
 3307|  44.2k|    int64_t data_limit = header_len + cbytes;
 3308|  44.2k|    if (chunk_pos < header_len ||
  ------------------
  |  Branch (3308:9): [True: 0, False: 44.2k]
  ------------------
 3309|  44.2k|        chunk_pos > data_limit - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3309:9): [True: 63, False: 44.1k]
  ------------------
 3310|  44.1k|        chunk_pos > frame->len - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3310:9): [True: 495, False: 43.6k]
  ------------------
 3311|    558|      BLOSC_TRACE_ERROR("Cannot read chunk %" PRId64 " outside of frame boundary.", nchunk);
  ------------------
  |  |   93|    558|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    558|    do {                                            \
  |  |  |  |   98|    558|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    558|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 558, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    558|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3312|    558|      return BLOSC2_ERROR_INVALID_HEADER;
 3313|    558|    }
 3314|  44.2k|  }
 3315|       |
 3316|  57.4k|  return rc;
 3317|  58.2k|}
frame_special_chunk:
 3322|  13.5k|                        uint8_t** chunk, int32_t cbytes, bool *needs_free) {
 3323|  13.5k|  int rc = 0;
 3324|  13.5k|  *chunk = malloc(cbytes);
 3325|  13.5k|  *needs_free = true;
 3326|       |
 3327|       |  // Detect the kind of special value
 3328|  13.5k|  uint64_t zeros_mask = (uint64_t) BLOSC2_SPECIAL_ZERO << (8 * 7);  // chunk of zeros
 3329|  13.5k|  uint64_t nans_mask = (uint64_t) BLOSC2_SPECIAL_NAN << (8 * 7);  // chunk of NaNs
 3330|  13.5k|  uint64_t uninit_mask = (uint64_t) BLOSC2_SPECIAL_UNINIT << (8 * 7);  // chunk of uninit values
 3331|       |
 3332|  13.5k|  blosc2_cparams cparams = BLOSC2_CPARAMS_DEFAULTS;
 3333|  13.5k|  cparams.typesize = typesize;
 3334|  13.5k|  cparams.blocksize = blocksize;
 3335|  13.5k|  if (special_value & zeros_mask) {
  ------------------
  |  Branch (3335:7): [True: 11.9k, False: 1.62k]
  ------------------
 3336|  11.9k|    rc = blosc2_chunk_zeros(cparams, nbytes, *chunk, cbytes);
 3337|  11.9k|    if (rc < 0) {
  ------------------
  |  Branch (3337:9): [True: 19, False: 11.9k]
  ------------------
 3338|     19|      BLOSC_TRACE_ERROR("Error creating a zero chunk");
  ------------------
  |  |   93|     19|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     19|    do {                                            \
  |  |  |  |   98|     19|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     19|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 19, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     19|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3339|     19|    }
 3340|  11.9k|  }
 3341|  1.62k|  else if (special_value & uninit_mask) {
  ------------------
  |  Branch (3341:12): [True: 974, False: 654]
  ------------------
 3342|    974|    rc = blosc2_chunk_uninit(cparams, nbytes, *chunk, cbytes);
 3343|    974|    if (rc < 0) {
  ------------------
  |  Branch (3343:9): [True: 13, False: 961]
  ------------------
 3344|     13|      BLOSC_TRACE_ERROR("Error creating a non initialized chunk");
  ------------------
  |  |   93|     13|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     13|    do {                                            \
  |  |  |  |   98|     13|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     13|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 13, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     13|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3345|     13|    }
 3346|    974|  }
 3347|    654|  else if (special_value & nans_mask) {
  ------------------
  |  Branch (3347:12): [True: 629, False: 25]
  ------------------
 3348|    629|    rc = blosc2_chunk_nans(cparams, nbytes, *chunk, cbytes);
 3349|    629|    if (rc < 0) {
  ------------------
  |  Branch (3349:9): [True: 2, False: 627]
  ------------------
 3350|      2|      BLOSC_TRACE_ERROR("Error creating a nan chunk");
  ------------------
  |  |   93|      2|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      2|    do {                                            \
  |  |  |  |   98|      2|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      2|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 2, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      2|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3351|      2|    }
 3352|    629|  }
 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.5k|  if (rc < 0) {
  ------------------
  |  Branch (3358:7): [True: 59, False: 13.5k]
  ------------------
 3359|     59|    free(*chunk);
 3360|     59|    *needs_free = false;
 3361|     59|    *chunk = NULL;
 3362|     59|  }
 3363|       |
 3364|  13.5k|  return rc;
 3365|  13.5k|}
frame_get_chunk:
 3378|  56.5k|int frame_get_chunk(blosc2_frame_s *frame, int64_t nchunk, uint8_t **chunk, bool *needs_free) {
 3379|  56.5k|  int32_t header_len;
 3380|  56.5k|  int64_t frame_len;
 3381|  56.5k|  int64_t nbytes;
 3382|  56.5k|  int64_t cbytes;
 3383|  56.5k|  int32_t blocksize;
 3384|  56.5k|  int32_t chunksize;
 3385|  56.5k|  int64_t nchunks;
 3386|  56.5k|  int32_t typesize;
 3387|  56.5k|  int64_t offset;
 3388|  56.5k|  int32_t chunk_cbytes;
 3389|  56.5k|  int rc;
 3390|       |
 3391|  56.5k|  *chunk = NULL;
 3392|  56.5k|  *needs_free = false;
 3393|  56.5k|  rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 3394|  56.5k|                       &blocksize, &chunksize, &nchunks,
 3395|  56.5k|                       &typesize, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 3396|  56.5k|                       frame->schunk->storage->io);
 3397|  56.5k|  if (rc < 0) {
  ------------------
  |  Branch (3397:7): [True: 0, False: 56.5k]
  ------------------
 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|  56.5k|  rc = frame_refresh_if_stale(frame, frame_len);
 3402|  56.5k|  if (rc < 0) {
  ------------------
  |  Branch (3402:7): [True: 0, False: 56.5k]
  ------------------
 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|  56.5k|  if (rc > 0) {
  ------------------
  |  Branch (3406:7): [True: 0, False: 56.5k]
  ------------------
 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|  56.5k|  if ((nchunks > 0) && (nchunk >= nchunks)) {
  ------------------
  |  Branch (3415:7): [True: 56.5k, False: 0]
  |  Branch (3415:24): [True: 0, False: 56.5k]
  ------------------
 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|  56.5k|  rc = get_coffset(frame, header_len, cbytes, nchunk, nchunks, &offset);
 3423|  56.5k|  if (rc < 0) {
  ------------------
  |  Branch (3423:7): [True: 188, False: 56.3k]
  ------------------
 3424|    188|    BLOSC_TRACE_ERROR("Unable to get offset to chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3425|    188|    return rc;
 3426|    188|  }
 3427|       |
 3428|  56.3k|  if (offset < 0) {
  ------------------
  |  Branch (3428:7): [True: 13.1k, False: 43.2k]
  ------------------
 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: 16, False: 13.0k]
  ------------------
 3438|     16|      return rc;
 3439|     16|    }
 3440|  13.0k|    goto end;
 3441|  13.1k|  }
 3442|       |
 3443|  43.2k|  if (frame->sframe) {
  ------------------
  |  Branch (3443:7): [True: 0, False: 43.2k]
  ------------------
 3444|       |    // Sparse on-disk
 3445|      0|    nchunk = offset;
 3446|      0|    return sframe_get_chunk(frame, nchunk, chunk, needs_free);
 3447|      0|  }
 3448|       |
 3449|  43.2k|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 3450|  43.2k|  if (io_cb == NULL) {
  ------------------
  |  Branch (3450:7): [True: 0, False: 43.2k]
  ------------------
 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|  43.2k|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3455:7): [True: 0, False: 43.2k]
  ------------------
 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|  43.2k|  } else {
 3502|       |    // The chunk is in memory and just one pointer away
 3503|  43.2k|    *chunk = frame->cframe + header_len + offset;
 3504|  43.2k|    rc = blosc2_cbuffer_sizes(*chunk, NULL, &chunk_cbytes, NULL);
 3505|  43.2k|    if (rc < 0) {
  ------------------
  |  Branch (3505:9): [True: 6, False: 43.2k]
  ------------------
 3506|      6|      return rc;
 3507|      6|    }
 3508|  43.2k|    if (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3508:9): [True: 1, False: 43.2k]
  ------------------
 3509|  43.2k|        offset > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (3509:9): [True: 0, False: 43.2k]
  ------------------
 3510|  43.2k|        offset + chunk_cbytes > cbytes) {
  ------------------
  |  Branch (3510:9): [True: 43, False: 43.1k]
  ------------------
 3511|     44|      BLOSC_TRACE_ERROR("Invalid chunk size in frame for chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3512|     44|      return BLOSC2_ERROR_INVALID_HEADER;
 3513|     44|    }
 3514|  43.2k|  }
 3515|       |
 3516|  56.2k|  end:
 3517|  56.2k|  return (int32_t)chunk_cbytes;
 3518|  43.2k|}
frame_get_lazychunk:
 3531|  1.72k|int frame_get_lazychunk(blosc2_frame_s *frame, int64_t nchunk, uint8_t **chunk, bool *needs_free) {
 3532|  1.72k|  int32_t header_len;
 3533|  1.72k|  int64_t frame_len;
 3534|  1.72k|  int64_t nbytes;
 3535|  1.72k|  int64_t cbytes;
 3536|  1.72k|  int32_t blocksize;
 3537|  1.72k|  int32_t chunksize;
 3538|  1.72k|  int64_t nchunks;
 3539|  1.72k|  int32_t typesize;
 3540|  1.72k|  int32_t lazychunk_cbytes;
 3541|  1.72k|  int64_t offset;
 3542|  1.72k|  void* fp = NULL;
 3543|  1.72k|  int32_t* block_csizes = NULL;
 3544|  1.72k|  struct csize_idx *csize_idx = NULL;
 3545|       |
 3546|  1.72k|  *chunk = NULL;
 3547|  1.72k|  *needs_free = false;
 3548|  1.72k|  int rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 3549|  1.72k|                           &blocksize, &chunksize, &nchunks,
 3550|  1.72k|                           &typesize, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 3551|  1.72k|                           frame->schunk->storage->io);
 3552|  1.72k|  if (rc < 0) {
  ------------------
  |  Branch (3552:7): [True: 0, False: 1.72k]
  ------------------
 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.72k|  rc = frame_refresh_if_stale(frame, frame_len);
 3557|  1.72k|  if (rc < 0) {
  ------------------
  |  Branch (3557:7): [True: 0, False: 1.72k]
  ------------------
 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.72k|  if (rc > 0) {
  ------------------
  |  Branch (3561:7): [True: 0, False: 1.72k]
  ------------------
 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.72k|  if (nchunk >= nchunks) {
  ------------------
  |  Branch (3569:7): [True: 0, False: 1.72k]
  ------------------
 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.72k|  rc = get_coffset(frame, header_len, cbytes, nchunk, nchunks, &offset);
 3577|  1.72k|  if (rc < 0) {
  ------------------
  |  Branch (3577:7): [True: 806, False: 917]
  ------------------
 3578|    806|    BLOSC_TRACE_ERROR("Unable to get offset to chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|    806|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    806|    do {                                            \
  |  |  |  |   98|    806|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    806|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 806, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    806|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3579|    806|    return rc;
 3580|    806|  }
 3581|       |
 3582|    917|  if (offset < 0) {
  ------------------
  |  Branch (3582:7): [True: 480, False: 437]
  ------------------
 3583|       |    // Special value
 3584|    480|    lazychunk_cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 3585|    480|    int32_t chunksize_ = chunksize;
 3586|    480|    if ((nchunk == nchunks - 1) && (nbytes % chunksize)) {
  ------------------
  |  Branch (3586:9): [True: 6, False: 474]
  |  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|    480|    rc = frame_special_chunk(offset, chunksize_, typesize, blocksize, chunk,
 3591|    480|                             (int32_t)lazychunk_cbytes, needs_free);
 3592|    480|    goto end;
 3593|    480|  }
 3594|       |
 3595|    437|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 3596|    437|  if (io_cb == NULL) {
  ------------------
  |  Branch (3596:7): [True: 0, False: 437]
  ------------------
 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|    437|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3602:7): [True: 0, False: 437]
  ------------------
 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|    437|  } else {
 3843|       |    // The chunk is in memory and just one pointer away
 3844|    437|    int64_t chunk_header_offset = header_len + offset;
 3845|    437|    int64_t chunk_cbytes_offset = chunk_header_offset + BLOSC_MIN_HEADER_LENGTH;
 3846|       |
 3847|    437|    *chunk = frame->cframe + chunk_header_offset;
 3848|       |
 3849|    437|    if (chunk_header_offset < 0 ||
  ------------------
  |  Branch (3849:9): [True: 0, False: 437]
  ------------------
 3850|    437|        chunk_cbytes_offset < chunk_header_offset ||
  ------------------
  |  Branch (3850:9): [True: 0, False: 437]
  ------------------
 3851|    437|        chunk_cbytes_offset > frame->len) {
  ------------------
  |  Branch (3851:9): [True: 0, False: 437]
  ------------------
 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|    437|    } else {
 3855|    437|      rc = blosc2_cbuffer_sizes(*chunk, NULL, &lazychunk_cbytes, NULL);
 3856|    437|      if (rc < 0) {
  ------------------
  |  Branch (3856:11): [True: 0, False: 437]
  ------------------
 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|    437|      else if (lazychunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3860:16): [True: 2, False: 435]
  ------------------
 3861|    435|               chunk_header_offset > INT64_MAX - lazychunk_cbytes ||
  ------------------
  |  Branch (3861:16): [True: 0, False: 435]
  ------------------
 3862|    435|               chunk_header_offset + lazychunk_cbytes > frame_len) {
  ------------------
  |  Branch (3862:16): [True: 27, False: 408]
  ------------------
 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|    437|    }
 3867|    437|  }
 3868|       |
 3869|    917|  end:
 3870|    917|  if (csize_idx != NULL) {
  ------------------
  |  Branch (3870:7): [True: 0, False: 917]
  ------------------
 3871|      0|    free(csize_idx);
 3872|      0|  }
 3873|    917|  if (block_csizes != NULL) {
  ------------------
  |  Branch (3873:7): [True: 0, False: 917]
  ------------------
 3874|      0|    free(block_csizes);
 3875|      0|  }
 3876|    917|  if (fp != NULL) {
  ------------------
  |  Branch (3876:7): [True: 0, False: 917]
  ------------------
 3877|      0|    frame_reader_release(frame, io_cb, fp);
 3878|      0|  }
 3879|    917|  if (rc < 0) {
  ------------------
  |  Branch (3879:7): [True: 72, False: 845]
  ------------------
 3880|     72|    if (*needs_free) {
  ------------------
  |  Branch (3880:9): [True: 0, False: 72]
  ------------------
 3881|      0|      free(*chunk);
 3882|      0|      *chunk = NULL;
 3883|      0|      *needs_free = false;
 3884|      0|    }
 3885|     72|    return rc;
 3886|     72|  }
 3887|       |
 3888|    845|  return (int)lazychunk_cbytes;
 3889|    917|}
frame_decompress_chunk:
 5248|  56.5k|int frame_decompress_chunk(blosc2_context *dctx, blosc2_frame_s* frame, int64_t nchunk, void *dest, int32_t nbytes) {
 5249|  56.5k|  uint8_t* src;
 5250|  56.5k|  bool needs_free;
 5251|  56.5k|  int32_t chunk_nbytes;
 5252|  56.5k|  int32_t chunk_cbytes;
 5253|  56.5k|  int rc;
 5254|       |
 5255|  56.5k|  rc = frame_get_chunk(frame, nchunk, &src, &needs_free);
 5256|  56.5k|  if (rc < 0) {
  ------------------
  |  Branch (5256:7): [True: 254, False: 56.2k]
  ------------------
 5257|    254|    BLOSC_TRACE_ERROR("Cannot get the chunk in position %" PRId64 ".", nchunk);
  ------------------
  |  |   93|    254|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    254|    do {                                            \
  |  |  |  |   98|    254|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    254|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 254, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    254|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5258|    254|    goto end;
 5259|    254|  }
 5260|  56.2k|  chunk_cbytes = rc;
 5261|  56.2k|  if (chunk_cbytes < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (5261:7): [True: 0, False: 56.2k]
  ------------------
 5262|       |    /* Not enough input to read `nbytes` */
 5263|      0|    rc = BLOSC2_ERROR_READ_BUFFER;
 5264|      0|  }
 5265|       |
 5266|  56.2k|  rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 5267|  56.2k|  if (rc < 0) {
  ------------------
  |  Branch (5267:7): [True: 13, False: 56.2k]
  ------------------
 5268|     13|    goto end;
 5269|     13|  }
 5270|       |
 5271|       |  /* Create a buffer for destination */
 5272|  56.2k|  if (chunk_nbytes > nbytes) {
  ------------------
  |  Branch (5272:7): [True: 43, False: 56.2k]
  ------------------
 5273|     43|    BLOSC_TRACE_ERROR("Not enough space for decompressing in dest.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5274|     43|    rc = BLOSC2_ERROR_WRITE_BUFFER;
 5275|     43|    goto end;
 5276|     43|  }
 5277|       |  /* And decompress it */
 5278|  56.2k|  dctx->header_overhead = BLOSC_EXTENDED_HEADER_LENGTH;
 5279|  56.2k|  int chunksize = rc = blosc2_decompress_ctx(dctx, src, chunk_cbytes, dest, nbytes);
 5280|  56.2k|  if (chunksize < 0 || chunksize != chunk_nbytes) {
  ------------------
  |  Branch (5280:7): [True: 219, False: 56.0k]
  |  Branch (5280:24): [True: 29, False: 55.9k]
  ------------------
 5281|    248|    BLOSC_TRACE_ERROR("Error in decompressing chunk.");
  ------------------
  |  |   93|    248|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    248|    do {                                            \
  |  |  |  |   98|    248|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    248|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 248, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    248|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5282|    248|    if (chunksize >= 0)
  ------------------
  |  Branch (5282:9): [True: 29, False: 219]
  ------------------
 5283|     29|      rc = BLOSC2_ERROR_FAILURE;
 5284|    248|  }
 5285|  56.5k|  end:
 5286|  56.5k|  if (needs_free) {
  ------------------
  |  Branch (5286:7): [True: 13.0k, False: 43.4k]
  ------------------
 5287|  13.0k|    free(src);
 5288|  13.0k|  }
 5289|  56.5k|  return rc;
 5290|  56.2k|}
frame.c:reader_cache_claim:
  125|     51|static bool reader_cache_claim(void) {
  126|     51|  bool claimed = false;
  127|     51|  blosc2_pthread_mutex_lock(&reader_cache_mutex);
  ------------------
  |  |   92|     51|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  128|     51|  if (reader_cache_count < reader_cache_max()) {
  ------------------
  |  Branch (128:7): [True: 51, False: 0]
  ------------------
  129|     51|    reader_cache_count++;
  130|     51|    claimed = true;
  131|     51|  }
  132|     51|  blosc2_pthread_mutex_unlock(&reader_cache_mutex);
  ------------------
  |  |   93|     51|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  133|     51|  return claimed;
  134|     51|}
frame.c:reader_cache_max:
   97|     51|static int reader_cache_max(void) {
   98|     51|  static int cached_max = -1;
   99|     51|  if (cached_max >= 0) {
  ------------------
  |  Branch (99:7): [True: 50, False: 1]
  ------------------
  100|     50|    return cached_max;
  101|     50|  }
  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|     51|static void reader_cache_return(void) {
  137|     51|  blosc2_pthread_mutex_lock(&reader_cache_mutex);
  ------------------
  |  |   92|     51|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  138|     51|  if (reader_cache_count > 0) {
  ------------------
  |  Branch (138:7): [True: 51, False: 0]
  ------------------
  139|     51|    reader_cache_count--;
  140|     51|  }
  141|     51|  blosc2_pthread_mutex_unlock(&reader_cache_mutex);
  ------------------
  |  |   93|     51|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  142|     51|}
frame.c:frame_reader_close_locked:
  238|  13.4k|static bool frame_reader_close_locked(blosc2_frame_s* frame, bool force) {
  239|  13.4k|  if (frame->read_fp == NULL) {
  ------------------
  |  Branch (239:7): [True: 13.4k, False: 0]
  ------------------
  240|  13.4k|    return true;
  241|  13.4k|  }
  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.5k|static blosc2_frame_s* frame_alloc(void) {
  148|  13.5k|  blosc2_frame_s* frame = calloc(1, sizeof(blosc2_frame_s));
  149|  13.5k|  if (frame != NULL) {
  ------------------
  |  Branch (149:7): [True: 13.5k, False: 0]
  ------------------
  150|  13.5k|    blosc2_pthread_mutex_init(&frame->read_fp_mutex, NULL);
  ------------------
  |  |   90|  13.5k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
  151|  13.5k|  }
  152|  13.5k|  return frame;
  153|  13.5k|}
frame.c:frame_refresh_if_stale:
 1092|  58.2k|static int frame_refresh_if_stale(blosc2_frame_s *frame, int64_t frame_len_on_disk) {
 1093|  58.2k|  if (frame->cframe != NULL || frame->schunk == NULL ||
  ------------------
  |  Branch (1093:7): [True: 58.2k, False: 0]
  |  Branch (1093:32): [True: 0, False: 0]
  ------------------
 1094|  58.2k|      (!frame->force_refresh && frame_len_on_disk == frame->len)) {
  ------------------
  |  Branch (1094:8): [True: 0, False: 0]
  |  Branch (1094:33): [True: 0, False: 0]
  ------------------
 1095|  58.2k|    return 0;
 1096|  58.2k|  }
 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.02k, False: 17.7k]
  ------------------
 1307|  1.02k|      off_pos += cbytes;
 1308|  1.02k|    }
 1309|  18.7k|  }
 1310|       |
 1311|  18.7k|  if (off_pos < 0 || off_pos > INT64_MAX - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (1311:7): [True: 123, False: 18.6k]
  |  Branch (1311:22): [True: 2, False: 18.6k]
  ------------------
 1312|  18.6k|      off_pos + BLOSC_EXTENDED_HEADER_LENGTH > frame->len) {
  ------------------
  |  Branch (1312:7): [True: 158, False: 18.5k]
  ------------------
 1313|    283|    BLOSC_TRACE_ERROR("Cannot read the offsets outside of frame boundary.");
  ------------------
  |  |   93|    283|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    283|    do {                                            \
  |  |  |  |   98|    283|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    283|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 283, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    283|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1314|    283|    return BLOSC2_ERROR_INVALID_HEADER;
 1315|    283|  }
 1316|       |
 1317|  18.5k|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (1317:7): [True: 18.5k, False: 0]
  ------------------
 1318|  18.5k|    uint8_t *off_start = frame->cframe + off_pos;
 1319|  18.5k|    rc = blosc2_cbuffer_sizes(off_start, coffsets_nbytes, &chunk_cbytes, NULL);
 1320|  18.5k|    if (rc < 0) {
  ------------------
  |  Branch (1320:9): [True: 45, False: 18.4k]
  ------------------
 1321|     45|      return rc;
 1322|     45|    }
 1323|  18.4k|    if (chunk_cbytes < 0 || off_pos + chunk_cbytes > frame->len) {
  ------------------
  |  Branch (1323:9): [True: 0, False: 18.4k]
  |  Branch (1323:29): [True: 65, False: 18.4k]
  ------------------
 1324|     65|      BLOSC_TRACE_ERROR("Cannot read the cbytes outside of frame boundary.");
  ------------------
  |  |   93|     65|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     65|    do {                                            \
  |  |  |  |   98|     65|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     65|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 65, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     65|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1325|     65|      return BLOSC2_ERROR_INVALID_HEADER;
 1326|     65|    }
 1327|  18.4k|    return 0;
 1328|  18.4k|  }
 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.09k|                                int32_t header_len) {
 2390|  1.09k|  BLOSC_UNUSED_PARAM(frame);
  ------------------
  |  |   28|  1.09k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
 2391|  1.09k|  int64_t header_pos = FRAME_IDX_SIZE;
  ------------------
  |  |   51|  1.09k|#define FRAME_IDX_SIZE (FRAME_METALAYERS + 1 + 1)  // 89
  |  |  ------------------
  |  |  |  |   50|  1.09k|#define FRAME_METALAYERS (FRAME_HEADER_MINLEN)  // 87
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|  1.09k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|  1.09k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  1.09k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   42|  1.09k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   41|  1.09k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   40|  1.09k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  1.09k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  1.09k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  1.09k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  1.09k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  1.09k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  1.09k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  1.09k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  1.09k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2392|       |
 2393|       |  // Get the size for the index of metalayers
 2394|  1.09k|  uint16_t idx_size;
 2395|  1.09k|  header_pos += sizeof(idx_size);
 2396|  1.09k|  if (header_len < header_pos) {
  ------------------
  |  Branch (2396:7): [True: 23, False: 1.07k]
  ------------------
 2397|     23|    return BLOSC2_ERROR_READ_BUFFER;
 2398|     23|  }
 2399|  1.07k|  from_big(&idx_size, header + FRAME_IDX_SIZE, sizeof(idx_size));
  ------------------
  |  |   38|  1.07k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2400|       |
 2401|       |  // Get the actual index of metalayers
 2402|  1.07k|  uint8_t* metalayers_idx = header + FRAME_IDX_SIZE + 2;
  ------------------
  |  |   51|  1.07k|#define FRAME_IDX_SIZE (FRAME_METALAYERS + 1 + 1)  // 89
  |  |  ------------------
  |  |  |  |   50|  1.07k|#define FRAME_METALAYERS (FRAME_HEADER_MINLEN)  // 87
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|  1.07k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|  1.07k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  1.07k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   42|  1.07k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   41|  1.07k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   40|  1.07k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  1.07k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  1.07k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  1.07k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  1.07k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  1.07k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  1.07k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  1.07k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  1.07k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2403|  1.07k|  header_pos += 1;
 2404|  1.07k|  if (header_len < header_pos) {
  ------------------
  |  Branch (2404:7): [True: 1, False: 1.07k]
  ------------------
 2405|      1|    return BLOSC2_ERROR_READ_BUFFER;
 2406|      1|  }
 2407|  1.07k|  if (metalayers_idx[0] != 0xde) {   // sanity check
  ------------------
  |  Branch (2407:7): [True: 50, False: 1.02k]
  ------------------
 2408|     50|    return BLOSC2_ERROR_DATA;
 2409|     50|  }
 2410|  1.02k|  uint8_t* idxp = metalayers_idx + 1;
 2411|  1.02k|  uint16_t nmetalayers;
 2412|  1.02k|  header_pos += sizeof(nmetalayers);
 2413|  1.02k|  if (header_len < header_pos) {
  ------------------
  |  Branch (2413:7): [True: 2, False: 1.02k]
  ------------------
 2414|      2|    return BLOSC2_ERROR_READ_BUFFER;
 2415|      2|  }
 2416|  1.02k|  from_big(&nmetalayers, idxp, sizeof(uint16_t));
  ------------------
  |  |   38|  1.02k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2417|  1.02k|  idxp += 2;
 2418|  1.02k|  if (nmetalayers > BLOSC2_MAX_METALAYERS) {
  ------------------
  |  | 1744|  1.02k|#define BLOSC2_MAX_METALAYERS 16
  ------------------
  |  Branch (2418:7): [True: 23, False: 999]
  ------------------
 2419|     23|    return BLOSC2_ERROR_DATA;
 2420|     23|  }
 2421|    999|  schunk->nmetalayers = nmetalayers;
 2422|       |
 2423|       |  // Populate the metalayers and its serialized values
 2424|    999|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2424:28): [True: 51, False: 948]
  ------------------
 2425|     51|    header_pos += 1;
 2426|     51|    if (header_len < header_pos) {
  ------------------
  |  Branch (2426:9): [True: 2, False: 49]
  ------------------
 2427|      2|      return BLOSC2_ERROR_READ_BUFFER;
 2428|      2|    }
 2429|     49|    if ((*idxp & 0xe0u) != 0xa0u) {   // sanity check
  ------------------
  |  Branch (2429:9): [True: 20, False: 29]
  ------------------
 2430|     20|      return BLOSC2_ERROR_DATA;
 2431|     20|    }
 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: 2, False: 27]
  ------------------
 2443|      2|      return BLOSC2_ERROR_READ_BUFFER;
 2444|      2|    }
 2445|     27|    char* ns = malloc((size_t)nslen + 1);
 2446|     27|    if (ns == NULL) {
  ------------------
  |  Branch (2446:9): [True: 0, False: 27]
  ------------------
 2447|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2448|      0|    }
 2449|     27|    memcpy(ns, idxp, nslen);
 2450|     27|    ns[nslen] = '\0';
 2451|     27|    idxp += nslen;
 2452|     27|    metalayer->name = ns;
 2453|       |
 2454|       |    // Populate the serialized value for this metalayer
 2455|       |    // Get the offset
 2456|     27|    header_pos += 1;
 2457|     27|    if (header_len < header_pos) {
  ------------------
  |  Branch (2457:9): [True: 1, False: 26]
  ------------------
 2458|      1|      return BLOSC2_ERROR_READ_BUFFER;
 2459|      1|    }
 2460|     26|    if ((*idxp & 0xffu) != 0xd2u) {   // sanity check
  ------------------
  |  Branch (2460:9): [True: 5, False: 21]
  ------------------
 2461|      5|      return BLOSC2_ERROR_DATA;
 2462|      5|    }
 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: 4, False: 16]
  |  Branch (2471:23): [True: 11, False: 5]
  ------------------
 2472|       |      // Offset is less than zero or exceeds header length
 2473|     15|      return BLOSC2_ERROR_DATA;
 2474|     15|    }
 2475|       |    // Go to offset and see if we have the correct marker
 2476|      5|    uint8_t* content_marker = header + offset;
 2477|      5|    if ((int64_t)header_len < (int64_t)offset + 1 + 4) {
  ------------------
  |  Branch (2477:9): [True: 0, False: 5]
  ------------------
 2478|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2479|      0|    }
 2480|      5|    if (*content_marker != 0xc6) {
  ------------------
  |  Branch (2480:9): [True: 3, False: 2]
  ------------------
 2481|      3|      return BLOSC2_ERROR_DATA;
 2482|      3|    }
 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|    948|  return 1;
 2512|    999|}
frame.c:get_vlmeta_from_trailer:
 2592|    895|                                   int32_t trailer_len) {
 2593|       |
 2594|    895|  BLOSC_UNUSED_PARAM(frame);
  ------------------
  |  |   28|    895|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
 2595|    895|  int64_t trailer_pos = FRAME_TRAILER_VLMETALAYERS + 2;
  ------------------
  |  |   60|    895|#define FRAME_TRAILER_VLMETALAYERS (2)
  ------------------
 2596|    895|  uint8_t* idxp = trailer + trailer_pos;
 2597|       |
 2598|       |  // Get the size for the index of metalayers
 2599|    895|  trailer_pos += 2;
 2600|    895|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2600:7): [True: 0, False: 895]
  ------------------
 2601|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2602|      0|  }
 2603|    895|  uint16_t idx_size;
 2604|    895|  from_big(&idx_size, idxp, sizeof(idx_size));
  ------------------
  |  |   38|    895|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2605|    895|  idxp += 2;
 2606|       |
 2607|    895|  trailer_pos += 1;
 2608|       |  // Get the actual index of metalayers
 2609|    895|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2609:7): [True: 0, False: 895]
  ------------------
 2610|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2611|      0|  }
 2612|    895|  if (idxp[0] != 0xde) {   // sanity check
  ------------------
  |  Branch (2612:7): [True: 76, False: 819]
  ------------------
 2613|     76|    return BLOSC2_ERROR_DATA;
 2614|     76|  }
 2615|    819|  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|    819|  uint16_t nmetalayers;
 2624|    819|  trailer_pos += sizeof(nmetalayers);
 2625|    819|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2625:7): [True: 0, False: 819]
  ------------------
 2626|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2627|      0|  }
 2628|    819|  from_big(&nmetalayers, idxp, sizeof(uint16_t));
  ------------------
  |  |   38|    819|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2629|    819|  idxp += 2;
 2630|    819|  if (nmetalayers > BLOSC2_MAX_VLMETALAYERS) {
  ------------------
  |  | 1750|    819|#define BLOSC2_MAX_VLMETALAYERS (8 * 1024)
  ------------------
  |  Branch (2630:7): [True: 15, False: 804]
  ------------------
 2631|     15|    return BLOSC2_ERROR_DATA;
 2632|     15|  }
 2633|    804|  schunk->nvlmetalayers = (int16_t)nmetalayers;
 2634|       |
 2635|       |  // Populate the metalayers and its serialized values
 2636|  1.11k|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2636:28): [True: 379, False: 738]
  ------------------
 2637|    379|    trailer_pos += 1;
 2638|    379|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2638:9): [True: 0, False: 379]
  ------------------
 2639|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2640|      0|    }
 2641|    379|    if ((*idxp & 0xe0u) != 0xa0u) {   // sanity check
  ------------------
  |  Branch (2641:9): [True: 17, False: 362]
  ------------------
 2642|     17|      return BLOSC2_ERROR_DATA;
 2643|     17|    }
 2644|    362|    blosc2_metalayer* metalayer = calloc(1, sizeof(blosc2_metalayer));
 2645|    362|    if (metalayer == NULL) {
  ------------------
  |  Branch (2645:9): [True: 0, False: 362]
  ------------------
 2646|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2647|      0|    }
 2648|    362|    schunk->vlmetalayers[nmetalayer] = metalayer;
 2649|       |
 2650|       |    // Populate the metalayer string
 2651|    362|    uint8_t nslen = *idxp & (uint8_t)0x1F;
 2652|    362|    idxp += 1;
 2653|    362|    trailer_pos += nslen;
 2654|    362|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2654:9): [True: 0, False: 362]
  ------------------
 2655|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2656|      0|    }
 2657|    362|    char* ns = malloc((size_t)nslen + 1);
 2658|    362|    if (ns == NULL) {
  ------------------
  |  Branch (2658:9): [True: 0, False: 362]
  ------------------
 2659|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2660|      0|    }
 2661|    362|    memcpy(ns, idxp, nslen);
 2662|    362|    ns[nslen] = '\0';
 2663|    362|    idxp += nslen;
 2664|    362|    metalayer->name = ns;
 2665|       |
 2666|       |    // Populate the serialized value for this metalayer
 2667|       |    // Get the offset
 2668|    362|    trailer_pos += 1;
 2669|    362|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2669:9): [True: 0, False: 362]
  ------------------
 2670|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2671|      0|    }
 2672|    362|    if ((*idxp & 0xffu) != 0xd2u) {   // sanity check
  ------------------
  |  Branch (2672:9): [True: 2, False: 360]
  ------------------
 2673|      2|      return BLOSC2_ERROR_DATA;
 2674|      2|    }
 2675|    360|    idxp += 1;
 2676|    360|    int32_t offset;
 2677|    360|    trailer_pos += sizeof(offset);
 2678|    360|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2678:9): [True: 0, False: 360]
  ------------------
 2679|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2680|      0|    }
 2681|    360|    from_big(&offset, idxp, sizeof(offset));
  ------------------
  |  |   38|    360|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2682|    360|    idxp += 4;
 2683|    360|    if (offset < 0 || offset >= trailer_len) {
  ------------------
  |  Branch (2683:9): [True: 8, False: 352]
  |  Branch (2683:23): [True: 10, False: 342]
  ------------------
 2684|       |      // Offset is less than zero or exceeds trailer length
 2685|     18|      return BLOSC2_ERROR_DATA;
 2686|     18|    }
 2687|       |    // Go to offset and see if we have the correct marker
 2688|    342|    uint8_t* content_marker = trailer + offset;
 2689|    342|    if ((int64_t)trailer_len < (int64_t)offset + 1 + 4) {
  ------------------
  |  Branch (2689:9): [True: 1, False: 341]
  ------------------
 2690|      1|      return BLOSC2_ERROR_READ_BUFFER;
 2691|      1|    }
 2692|    341|    if (*content_marker != 0xc6) {
  ------------------
  |  Branch (2692:9): [True: 3, False: 338]
  ------------------
 2693|      3|      return BLOSC2_ERROR_DATA;
 2694|      3|    }
 2695|       |
 2696|       |    // Read the size of the content
 2697|    338|    int32_t content_len;
 2698|    338|    from_big(&content_len, content_marker + 1, sizeof(content_len));
  ------------------
  |  |   38|    338|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2699|    338|    if (content_len < 0) {
  ------------------
  |  Branch (2699:9): [True: 4, False: 334]
  ------------------
 2700|      4|      return BLOSC2_ERROR_DATA;
 2701|      4|    }
 2702|    334|    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|    334|    if ((int64_t)trailer_len < (int64_t)offset + 1 + 4 + (int64_t)content_len) {
  ------------------
  |  Branch (2707:9): [True: 21, False: 313]
  ------------------
 2708|     21|      return BLOSC2_ERROR_READ_BUFFER;
 2709|     21|    }
 2710|    313|    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|    313|    if (content_len > 0 && content == NULL) {
  ------------------
  |  Branch (2714:9): [True: 311, False: 2]
  |  Branch (2714:28): [True: 0, False: 311]
  ------------------
 2715|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2716|      0|    }
 2717|    313|    if (content_len > 0) {
  ------------------
  |  Branch (2717:9): [True: 311, False: 2]
  ------------------
 2718|    311|      memcpy(content, content_marker + 1 + 4, (size_t)content_len);
 2719|    311|    }
 2720|    313|    metalayer->content = (uint8_t*)content;
 2721|    313|  }
 2722|    738|  return 1;
 2723|    804|}
frame.c:validate_offsets_chunk:
 2881|  12.4k|                                  int64_t nchunks) {
 2882|  12.4k|  int32_t coffsets_cbytes = 0;
 2883|  12.4k|  uint8_t* coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &coffsets_cbytes);
 2884|  12.4k|  if (coffsets == NULL) {
  ------------------
  |  Branch (2884:7): [True: 332, False: 12.0k]
  ------------------
 2885|    332|    BLOSC_TRACE_ERROR("Cannot get compressed offsets from frame.");
  ------------------
  |  |   93|    332|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    332|    do {                                            \
  |  |  |  |   98|    332|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    332|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 332, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    332|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2886|    332|    return BLOSC2_ERROR_DATA;
 2887|    332|  }
 2888|       |
 2889|  12.0k|  int32_t offsets_nbytes;
 2890|  12.0k|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &offsets_nbytes)) {
  ------------------
  |  Branch (2890:7): [True: 0, False: 12.0k]
  ------------------
 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.0k|  int64_t* offsets = (int64_t*)malloc((size_t)offsets_nbytes);
 2896|  12.0k|  if (offsets == NULL) {
  ------------------
  |  Branch (2896:7): [True: 0, False: 12.0k]
  ------------------
 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.0k|  blosc2_dparams off_dparams = BLOSC2_DPARAMS_DEFAULTS;
 2902|  12.0k|  blosc2_context* dctx = blosc2_create_dctx(off_dparams);
 2903|  12.0k|  if (dctx == NULL) {
  ------------------
  |  Branch (2903:7): [True: 0, False: 12.0k]
  ------------------
 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.0k|  int32_t off_nbytes = blosc2_decompress_ctx(dctx, coffsets, coffsets_cbytes,
 2910|  12.0k|                                             offsets, offsets_nbytes);
 2911|  12.0k|  blosc2_free_ctx(dctx);
 2912|  12.0k|  if (off_nbytes != offsets_nbytes) {
  ------------------
  |  Branch (2912:7): [True: 10.1k, False: 1.90k]
  ------------------
 2913|  10.1k|    free(offsets);
 2914|  10.1k|    BLOSC_TRACE_ERROR("Cannot decompress offsets chunk.");
  ------------------
  |  |   93|  10.1k|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|  10.1k|    do {                                            \
  |  |  |  |   98|  10.1k|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|  10.1k|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 10.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|  10.1k|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2915|  10.1k|    return BLOSC2_ERROR_DATA;
 2916|  10.1k|  }
 2917|       |
 2918|  9.16G|  for (int64_t i = 0; i < nchunks; ++i) {
  ------------------
  |  Branch (2918:23): [True: 9.16G, False: 1.72k]
  ------------------
 2919|  9.16G|    int64_t offset = offsets[i];
 2920|  9.16G|    if (offset < 0) {
  ------------------
  |  Branch (2920:9): [True: 3.54G, False: 5.61G]
  ------------------
 2921|  3.54G|      continue;
 2922|  3.54G|    }
 2923|  5.61G|    if (offset > INT64_MAX - header_len || offset > cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (2923:9): [True: 7, False: 5.61G]
  |  Branch (2923:44): [True: 176, False: 5.61G]
  ------------------
 2924|    183|      free(offsets);
 2925|    183|      BLOSC_TRACE_ERROR("Offset for chunk %" PRId64 " is out of bounds.", i);
  ------------------
  |  |   93|    183|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    183|    do {                                            \
  |  |  |  |   98|    183|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    183|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 183, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    183|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2926|    183|      return BLOSC2_ERROR_INVALID_HEADER;
 2927|    183|    }
 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.61G|  }
 2934|       |
 2935|  1.72k|  free(offsets);
 2936|  1.72k|  return 0;
 2937|  1.90k|}

blosc2_schunk_get_cparams:
   70|  12.7k|int blosc2_schunk_get_cparams(blosc2_schunk *schunk, blosc2_cparams **cparams) {
   71|  12.7k|  *cparams = calloc(1, sizeof(blosc2_cparams));
   72|  12.7k|  (*cparams)->schunk = schunk;
   73|  89.1k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (73:19): [True: 76.3k, False: 12.7k]
  ------------------
   74|  76.3k|    (*cparams)->filters[i] = schunk->filters[i];
   75|  76.3k|    (*cparams)->filters_meta[i] = schunk->filters_meta[i];
   76|  76.3k|  }
   77|  12.7k|  (*cparams)->compcode = schunk->compcode;
   78|  12.7k|  (*cparams)->compcode_meta = schunk->compcode_meta;
   79|  12.7k|  (*cparams)->clevel = schunk->clevel;
   80|  12.7k|  (*cparams)->typesize = schunk->typesize;
   81|  12.7k|  (*cparams)->blocksize = schunk->blocksize;
   82|  12.7k|  (*cparams)->splitmode = schunk->splitmode;
   83|  12.7k|  (*cparams)->use_dict = schunk->use_dict;
   84|  12.7k|  if (schunk->cctx == NULL) {
  ------------------
  |  Branch (84:7): [True: 12.7k, False: 0]
  ------------------
   85|  12.7k|    (*cparams)->nthreads = blosc2_get_nthreads();
   86|  12.7k|  }
   87|      0|  else {
   88|      0|    (*cparams)->nthreads = (int16_t)schunk->cctx->nthreads;
   89|      0|  }
   90|  12.7k|  return 0;
   91|  12.7k|}
blosc2_schunk_get_dparams:
   95|  12.6k|int blosc2_schunk_get_dparams(blosc2_schunk *schunk, blosc2_dparams **dparams) {
   96|  12.6k|  *dparams = calloc(1, sizeof(blosc2_dparams));
   97|  12.6k|  (*dparams)->schunk = schunk;
   98|  12.6k|  if (schunk->dctx == NULL) {
  ------------------
  |  Branch (98:7): [True: 12.6k, False: 0]
  ------------------
   99|  12.6k|    (*dparams)->nthreads = blosc2_get_nthreads();
  100|  12.6k|  }
  101|      0|  else {
  102|      0|    (*dparams)->nthreads = schunk->dctx->nthreads;
  103|      0|  }
  104|  12.6k|  return 0;
  105|  12.6k|}
schunk_free_metalayers:
  653|  13.4k|void schunk_free_metalayers(blosc2_schunk *schunk) {
  654|  13.7k|  for (int i = 0; i < schunk->nmetalayers; i++) {
  ------------------
  |  Branch (654:19): [True: 255, False: 13.4k]
  ------------------
  655|    255|    if (schunk->metalayers[i] != NULL) {
  ------------------
  |  Branch (655:9): [True: 29, False: 226]
  ------------------
  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|    255|  }
  662|  13.4k|  schunk->nmetalayers = 0;
  663|  13.4k|}
schunk_free_vlmetalayers:
  666|  13.4k|void schunk_free_vlmetalayers(blosc2_schunk *schunk) {
  667|  48.0k|  for (int i = 0; i < schunk->nvlmetalayers; i++) {
  ------------------
  |  Branch (667:19): [True: 34.6k, False: 13.4k]
  ------------------
  668|  34.6k|    if (schunk->vlmetalayers[i] != NULL) {
  ------------------
  |  Branch (668:9): [True: 362, False: 34.2k]
  ------------------
  669|    362|      free(schunk->vlmetalayers[i]->name);
  670|    362|      free(schunk->vlmetalayers[i]->content);
  671|    362|      free(schunk->vlmetalayers[i]);
  672|       |      schunk->vlmetalayers[i] = NULL;
  673|    362|    }
  674|  34.6k|  }
  675|  13.4k|  schunk->nvlmetalayers = 0;
  676|  13.4k|}
blosc2_schunk_free:
  679|  13.4k|int blosc2_schunk_free(blosc2_schunk *schunk) {
  680|  13.4k|  int err = 0;
  681|       |
  682|       |  // If it is a view, the data belongs to original array and should not be freed
  683|  13.4k|  if (schunk->data != NULL && !schunk->view) {
  ------------------
  |  Branch (683:7): [True: 0, False: 13.4k]
  |  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.4k|  if (schunk->cctx != NULL)
  ------------------
  |  Branch (689:7): [True: 12.6k, False: 791]
  ------------------
  690|  12.6k|    blosc2_free_ctx(schunk->cctx);
  691|  13.4k|  if (schunk->dctx != NULL)
  ------------------
  |  Branch (691:7): [True: 12.6k, False: 791]
  ------------------
  692|  12.6k|    blosc2_free_ctx(schunk->dctx);
  693|  13.4k|  if (schunk->blockshape != NULL)
  ------------------
  |  Branch (693:7): [True: 0, False: 13.4k]
  ------------------
  694|      0|    free(schunk->blockshape);
  695|       |
  696|  13.4k|  schunk_free_metalayers(schunk);
  697|       |
  698|  13.4k|  if (schunk->storage != NULL) {
  ------------------
  |  Branch (698:7): [True: 12.6k, False: 791]
  ------------------
  699|  12.6k|    blosc2_io_cb *io_cb = blosc2_get_io_cb(schunk->storage->io->id);
  700|  12.6k|    if (io_cb != NULL) {
  ------------------
  |  Branch (700:9): [True: 12.6k, False: 0]
  ------------------
  701|  12.6k|      int rc = io_cb->destroy(schunk->storage->io->params);
  702|  12.6k|      if (rc < 0) {
  ------------------
  |  Branch (702:11): [True: 0, False: 12.6k]
  ------------------
  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.6k|    }
  707|       |
  708|  12.6k|    if (schunk->storage->urlpath != NULL) {
  ------------------
  |  Branch (708:9): [True: 0, False: 12.6k]
  ------------------
  709|      0|      free(schunk->storage->urlpath);
  710|      0|    }
  711|  12.6k|    free(schunk->storage->cparams);
  712|  12.6k|    free(schunk->storage->dparams);
  713|  12.6k|    free(schunk->storage->io);
  714|  12.6k|    free(schunk->storage);
  715|  12.6k|  }
  716|       |
  717|       |  // If it is a view, the frame belongs to original array and should not be freed
  718|  13.4k|  if (schunk->frame != NULL && !schunk->view) {
  ------------------
  |  Branch (718:7): [True: 13.4k, False: 0]
  |  Branch (718:32): [True: 13.4k, False: 0]
  ------------------
  719|  13.4k|    frame_free((blosc2_frame_s *) schunk->frame);
  720|  13.4k|  }
  721|       |
  722|  13.4k|  schunk_free_vlmetalayers(schunk);
  723|       |
  724|  13.4k|  free(schunk);
  725|       |
  726|  13.4k|  return err;
  727|  13.4k|}
blosc2_schunk_from_buffer:
  731|  13.8k|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|  13.8k|  if (cframe == NULL || 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 (733:7): [True: 0, False: 13.8k]
  |  Branch (733:25): [True: 15, False: 13.8k]
  ------------------
  734|     15|    return NULL;
  735|     15|  }
  736|  13.8k|  char *magic_number = (char *)cframe + FRAME_HEADER_MAGIC;
  ------------------
  |  |   29|  13.8k|#define FRAME_HEADER_MAGIC 2
  ------------------
  737|  13.8k|  if (memcmp(magic_number, "b2frame", sizeof("b2frame")) != 0) {
  ------------------
  |  Branch (737:7): [True: 189, False: 13.6k]
  ------------------
  738|    189|    return NULL;
  739|    189|  }
  740|  13.6k|  blosc2_frame_s* frame = frame_from_cframe(cframe, len, false);
  741|  13.6k|  if (frame == NULL) {
  ------------------
  |  Branch (741:7): [True: 203, False: 13.4k]
  ------------------
  742|    203|    return NULL;
  743|    203|  }
  744|  13.4k|  blosc2_schunk* schunk = frame_to_schunk(frame, copy, &BLOSC2_IO_DEFAULTS);
  745|  13.4k|  if (schunk && copy) {
  ------------------
  |  Branch (745:7): [True: 738, False: 12.7k]
  |  Branch (745:17): [True: 0, False: 738]
  ------------------
  746|       |    // Super-chunk has its own copy of frame
  747|      0|    frame_free(frame);
  748|      0|  }
  749|  13.4k|  return schunk;
  750|  13.6k|}
blosc2_schunk_decompress_chunk:
 1482|  56.5k|                                   void *dest, int32_t nbytes) {
 1483|  56.5k|  int rc = validate_nchunk(schunk, nchunk, false, "blosc2_schunk_decompress_chunk");
 1484|  56.5k|  if (rc < 0) {
  ------------------
  |  Branch (1484:7): [True: 0, False: 56.5k]
  ------------------
 1485|      0|    return rc;
 1486|      0|  }
 1487|       |
 1488|  56.5k|  int32_t chunk_nbytes;
 1489|  56.5k|  int32_t chunk_cbytes;
 1490|  56.5k|  int chunksize;
 1491|  56.5k|  blosc2_frame_s* frame = (blosc2_frame_s*)schunk->frame;
 1492|       |
 1493|  56.5k|  schunk->current_nchunk = nchunk;
 1494|  56.5k|  if (frame == NULL) {
  ------------------
  |  Branch (1494:7): [True: 0, False: 56.5k]
  ------------------
 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|  56.5k|  } else {
 1519|  56.5k|    rc = frame_lock(frame, false);
 1520|  56.5k|    if (rc < 0) {
  ------------------
  |  Branch (1520:9): [True: 0, False: 56.5k]
  ------------------
 1521|      0|      return rc;
 1522|      0|    }
 1523|  56.5k|    chunksize = frame_decompress_chunk(schunk->dctx, frame, nchunk, dest, nbytes);
 1524|  56.5k|    frame_unlock(frame);
 1525|  56.5k|    if (chunksize < 0) {
  ------------------
  |  Branch (1525:9): [True: 558, False: 55.9k]
  ------------------
 1526|    558|      return chunksize;
 1527|    558|    }
 1528|  56.5k|  }
 1529|  55.9k|  return chunksize;
 1530|  56.5k|}
schunk.c:validate_nchunk:
   44|  56.5k|static int validate_nchunk(blosc2_schunk *schunk, int64_t nchunk, bool allow_end, const char *func_name) {
   45|  56.5k|  if (nchunk < 0) {
  ------------------
  |  Branch (45:7): [True: 0, False: 56.5k]
  ------------------
   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|  56.5k|  if (allow_end) {
  ------------------
  |  Branch (50:7): [True: 0, False: 56.5k]
  ------------------
   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|  56.5k|  else {
   58|  56.5k|    if (nchunk >= schunk->nchunks) {
  ------------------
  |  Branch (58:9): [True: 0, False: 56.5k]
  ------------------
   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|  56.5k|  }
   64|       |
   65|  56.5k|  return BLOSC2_ERROR_SUCCESS;
   66|  56.5k|}

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

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

shuffle-generic.c:unshuffle_generic_inline:
   64|  65.4k|                                     const uint8_t *_src, uint8_t *_dest) {
   65|  65.4k|  int32_t i, j;
   66|       |
   67|       |  /* Calculate the number of elements in the block. */
   68|  65.4k|  const int32_t neblock_quot = blocksize / type_size;
   69|  65.4k|  const int32_t neblock_rem = blocksize % type_size;
   70|  65.4k|  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: 65.4k]
  ------------------
   74|  5.99G|    for (j = 0; j < type_size; j++) {
  ------------------
  |  Branch (74:17): [True: 4.27G, False: 1.71G]
  ------------------
   75|  4.27G|      _dest[i * type_size + j] = _src[j * neblock_quot + i];
   76|  4.27G|    }
   77|  1.71G|  }
   78|       |
   79|       |  /* Copy any leftover bytes in the block without unshuffling them. */
   80|  65.4k|  memcpy(_dest + (blocksize - neblock_rem), _src + (blocksize - neblock_rem), neblock_rem);
   81|  65.4k|}
shuffle-avx2.c:unshuffle_generic_inline:
   64|  40.2k|                                     const uint8_t *_src, uint8_t *_dest) {
   65|  40.2k|  int32_t i, j;
   66|       |
   67|       |  /* Calculate the number of elements in the block. */
   68|  40.2k|  const int32_t neblock_quot = blocksize / type_size;
   69|  40.2k|  const int32_t neblock_rem = blocksize % type_size;
   70|  40.2k|  const int32_t vectorizable_elements = vectorizable_blocksize / type_size;
   71|       |
   72|       |  /* Non-optimized unshuffle */
   73|   707k|  for (i = vectorizable_elements; i < (int32_t)neblock_quot; i++) {
  ------------------
  |  Branch (73:35): [True: 667k, False: 40.2k]
  ------------------
   74|  19.4M|    for (j = 0; j < type_size; j++) {
  ------------------
  |  Branch (74:17): [True: 18.7M, False: 667k]
  ------------------
   75|  18.7M|      _dest[i * type_size + j] = _src[j * neblock_quot + i];
   76|  18.7M|    }
   77|   667k|  }
   78|       |
   79|       |  /* Copy any leftover bytes in the block without unshuffling them. */
   80|  40.2k|  memcpy(_dest + (blocksize - neblock_rem), _src + (blocksize - neblock_rem), neblock_rem);
   81|  40.2k|}

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

blosc2.c:print_error:
  525|     38|static char *print_error(int rc) {
  526|       |  // TODO: remove this function, use blosc2_error_string only
  527|     38|  return (char *) blosc2_error_string(rc);
  528|     38|}
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|      4|                                  int32_t *content_len) {
 2448|      4|  if (schunk == NULL || name == NULL || content == NULL || content_len == NULL) {
  ------------------
  |  Branch (2448:7): [True: 4, False: 0]
  |  Branch (2448:25): [True: 0, False: 0]
  |  Branch (2448:41): [True: 0, False: 0]
  |  Branch (2448:60): [True: 0, False: 0]
  ------------------
 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|      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|  13.8k|void register_codecs(void) {
   19|       |  // May add .free func in future
   20|       |
   21|  13.8k|  blosc2_codec ndlz;
   22|  13.8k|  ndlz.compcode = BLOSC_CODEC_NDLZ;
   23|  13.8k|  ndlz.version = 1;
   24|  13.8k|  ndlz.complib = BLOSC_CODEC_NDLZ;
   25|  13.8k|  ndlz.encoder = &ndlz_compress;
   26|  13.8k|  ndlz.decoder = &ndlz_decompress;
   27|  13.8k|  ndlz.compname = "ndlz";
   28|       |  // ndlz.free = NULL; 
   29|  13.8k|  register_codec_private(&ndlz);
   30|       |
   31|  13.8k|#if defined(HAVE_ZFP)
   32|  13.8k|  blosc2_codec zfp_acc;
   33|  13.8k|  zfp_acc.compcode = BLOSC_CODEC_ZFP_FIXED_ACCURACY;
   34|  13.8k|  zfp_acc.version = 1;
   35|  13.8k|  zfp_acc.complib = BLOSC_CODEC_ZFP_FIXED_ACCURACY;
   36|  13.8k|  zfp_acc.encoder = &zfp_acc_compress;
   37|  13.8k|  zfp_acc.decoder = &zfp_acc_decompress;
   38|       |  // zfp_acc.free = NULL;
   39|  13.8k|  zfp_acc.compname = "zfp_acc";
   40|  13.8k|  register_codec_private(&zfp_acc);
   41|       |
   42|  13.8k|  blosc2_codec zfp_prec;
   43|  13.8k|  zfp_prec.compcode = BLOSC_CODEC_ZFP_FIXED_PRECISION;
   44|  13.8k|  zfp_prec.version = 1;
   45|  13.8k|  zfp_prec.complib = BLOSC_CODEC_ZFP_FIXED_PRECISION;
   46|  13.8k|  zfp_prec.encoder = &zfp_prec_compress;
   47|  13.8k|  zfp_prec.decoder = &zfp_prec_decompress;
   48|       |  // zfp_prec.free = NULL;
   49|  13.8k|  zfp_prec.compname = "zfp_prec";
   50|  13.8k|  register_codec_private(&zfp_prec);
   51|       |
   52|  13.8k|  blosc2_codec zfp_rate;
   53|  13.8k|  zfp_rate.compcode = BLOSC_CODEC_ZFP_FIXED_RATE;
   54|  13.8k|  zfp_rate.version = 1;
   55|  13.8k|  zfp_rate.complib = BLOSC_CODEC_ZFP_FIXED_RATE;
   56|  13.8k|  zfp_rate.encoder = &zfp_rate_compress;
   57|  13.8k|  zfp_rate.decoder = &zfp_rate_decompress;
   58|  13.8k|  zfp_rate.compname = "zfp_rate";
   59|       |  // zfp_rate.free = NULL;
   60|  13.8k|  register_codec_private(&zfp_rate);
   61|  13.8k|#endif
   62|       |
   63|  13.8k|  blosc2_codec openhtj2k;
   64|  13.8k|  openhtj2k.compcode = BLOSC_CODEC_OPENHTJ2K;
   65|  13.8k|  openhtj2k.version = 1;
   66|  13.8k|  openhtj2k.complib = BLOSC_CODEC_OPENHTJ2K;
   67|  13.8k|  openhtj2k.encoder = NULL;
   68|  13.8k|  openhtj2k.decoder = NULL;
   69|       |  // openhtj2k.free = NULL;
   70|  13.8k|  openhtj2k.compname = "openhtj2k";
   71|  13.8k|  register_codec_private(&openhtj2k);
   72|       |
   73|  13.8k|  blosc2_codec grok;
   74|  13.8k|  grok.compcode = BLOSC_CODEC_GROK;
   75|  13.8k|  grok.version = 1;
   76|  13.8k|  grok.complib = BLOSC_CODEC_GROK;
   77|  13.8k|  grok.encoder = NULL;
   78|  13.8k|  grok.decoder = NULL;
   79|       |  // grok.free = NULL;
   80|  13.8k|  grok.compname = "grok";
   81|  13.8k|  register_codec_private(&grok);
   82|       |
   83|  13.8k|  blosc2_codec openzl;
   84|  13.8k|  openzl.compcode = BLOSC_CODEC_OPENZL;
   85|  13.8k|  openzl.version = 1;
   86|  13.8k|  openzl.complib = BLOSC_CODEC_OPENZL;
   87|  13.8k|  openzl.encoder = NULL;
   88|  13.8k|  openzl.decoder = NULL;
   89|       |  // openzl.free = NULL;
   90|  13.8k|  openzl.compname = "openzl";
   91|  13.8k|  register_codec_private(&openzl);
   92|       |
   93|  13.8k|  blosc2_codec j2k;
   94|  13.8k|  j2k.compcode = BLOSC_CODEC_J2K;
   95|  13.8k|  j2k.version = 1;
   96|  13.8k|  j2k.complib = BLOSC_CODEC_J2K;
   97|  13.8k|  j2k.encoder = NULL;
   98|  13.8k|  j2k.decoder = NULL;
   99|       |  // j2k.free = NULL;
  100|  13.8k|  j2k.compname = "j2k";
  101|  13.8k|  register_codec_private(&j2k);
  102|       |
  103|  13.8k|  blosc2_codec htj2k;
  104|  13.8k|  htj2k.compcode = BLOSC_CODEC_HTJ2K;
  105|  13.8k|  htj2k.version = 1;
  106|  13.8k|  htj2k.complib = BLOSC_CODEC_HTJ2K;
  107|  13.8k|  htj2k.encoder = NULL;
  108|  13.8k|  htj2k.decoder = NULL;
  109|       |  // htj2k.free = NULL;
  110|  13.8k|  htj2k.compname = "htj2k";
  111|  13.8k|  register_codec_private(&htj2k);
  112|  13.8k|}

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

ndlz4_decompress:
  526|    264|                     uint8_t meta, blosc2_dparams *dparams) {
  527|    264|  BLOSC_UNUSED_PARAM(meta);
  ------------------
  |  |   28|    264|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  528|    264|  BLOSC_UNUSED_PARAM(dparams);
  ------------------
  |  |   28|    264|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  529|    264|  BLOSC_ERROR_NULL(input, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    264|    do {                                            \
  |  |  105|    264|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 264]
  |  |  ------------------
  |  |  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|    264|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 264]
  |  |  ------------------
  ------------------
  530|    264|  BLOSC_ERROR_NULL(output, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    264|    do {                                            \
  |  |  105|    264|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 264]
  |  |  ------------------
  |  |  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|    264|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 264]
  |  |  ------------------
  ------------------
  531|       |
  532|    264|  uint8_t *ip = (uint8_t *) input;
  533|    264|  uint8_t *op = (uint8_t *) output;
  534|    264|  uint8_t ndim;
  535|    264|  int32_t blockshape[2];
  536|    264|  int32_t eshape[2];
  537|    264|  uint8_t *buffercpy;
  538|    264|  uint8_t local_buffer[16];
  539|    264|  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|    264|  if (NDLZ_UNEXPECT_CONDITIONAL(input_len < (int32_t) (1 + 2 * sizeof(int32_t)))) {
  ------------------
  |  |   30|    264|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 1, False: 263]
  |  |  ------------------
  ------------------
  546|      1|    return 0;
  547|      1|  }
  548|    263|  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|    263|#define NDLZ4_CHECK_RANGE(pos, len)                                              \
  560|    263|  do {                                                                           \
  561|    263|    int64_t _pos = (int64_t) (pos);                                              \
  562|    263|    int64_t _len = (int64_t) (len);                                              \
  563|    263|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  564|    263|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  565|    263|      return BLOSC2_ERROR_FAILURE;                                               \
  566|    263|    }                                                                            \
  567|    263|  } while (0)
  568|       |
  569|       |  /* we start with literal copy */
  570|    263|  ndim = *ip;
  571|    263|  ip++;
  572|    263|  if (ndim != 2) {
  ------------------
  |  Branch (572:7): [True: 1, False: 262]
  ------------------
  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|    262|  memcpy(&blockshape[0], ip, 4);
  577|    262|  ip += 4;
  578|    262|  memcpy(&blockshape[1], ip, 4);
  579|    262|  ip += 4;
  580|       |
  581|       |  // Sanity check.  See https://www.cve.org/CVERecord?id=CVE-2024-3204
  582|    262|  if (output_len < 0 || blockshape[0] < 0 || blockshape[1] < 0) {
  ------------------
  |  Branch (582:7): [True: 0, False: 262]
  |  Branch (582:25): [True: 26, False: 236]
  |  Branch (582:46): [True: 20, False: 216]
  ------------------
  583|     46|    BLOSC_TRACE_ERROR("Output length or blockshape is negative");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  584|     46|    return BLOSC2_ERROR_FAILURE;
  585|     46|  }
  586|       |
  587|    216|  eshape[0] = ((blockshape[0] + 3) / 4) * 4;
  588|    216|  eshape[1] = ((blockshape[1] + 3) / 4) * 4;
  589|       |
  590|    216|  if (NDLZ_UNEXPECT_CONDITIONAL((int64_t)output_len < (int64_t)blockshape[0] * (int64_t)blockshape[1])) {
  ------------------
  |  |   30|    216|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 67, False: 149]
  |  |  ------------------
  ------------------
  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|    149|  memset(op, 0, blockshape[0] * blockshape[1]);
  595|       |
  596|    149|  uint32_t i_stop[2];
  597|    447|  for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (597:19): [True: 298, False: 149]
  ------------------
  598|    298|    i_stop[i] = eshape[i] / 4;
  599|    298|  }
  600|       |
  601|       |  /* main loop */
  602|    149|  uint32_t ii[2];
  603|    149|  uint32_t padding[2] = {0};
  604|    149|  uint32_t ind = 0;
  605|    149|  uint8_t cell_aux[16];
  606|   276M|  for (ii[0] = 0; ii[0] < i_stop[0]; ++ii[0]) {
  ------------------
  |  Branch (606:19): [True: 276M, False: 15]
  ------------------
  607|   276M|    for (ii[1] = 0; ii[1] < i_stop[1]; ++ii[1]) {      // for each cell
  ------------------
  |  Branch (607:21): [True: 1.87k, False: 276M]
  ------------------
  608|  1.87k|      if (NDLZ_UNEXPECT_CONDITIONAL(ip > ip_limit)) {
  ------------------
  |  |   30|  1.87k|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 0, False: 1.87k]
  |  |  ------------------
  ------------------
  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.87k|      if (ii[0] == i_stop[0] - 1) {
  ------------------
  |  Branch (612:11): [True: 359, False: 1.51k]
  ------------------
  613|    359|        padding[0] = (blockshape[0] % 4 == 0) ? 4 : blockshape[0] % 4;
  ------------------
  |  Branch (613:22): [True: 49, False: 310]
  ------------------
  614|  1.51k|      } else {
  615|  1.51k|        padding[0] = 4;
  616|  1.51k|      }
  617|  1.87k|      if (ii[1] == i_stop[1] - 1) {
  ------------------
  |  Branch (617:11): [True: 1.48k, False: 389]
  ------------------
  618|  1.48k|        padding[1] = (blockshape[1] % 4 == 0) ? 4 : blockshape[1] % 4;
  ------------------
  |  Branch (618:22): [True: 52, False: 1.43k]
  ------------------
  619|  1.48k|      } else {
  620|    389|        padding[1] = 4;
  621|    389|      }
  622|  1.87k|      int64_t cur = ip - (const uint8_t *) input;   // in-range: ip is within [input, ip_limit]
  623|  1.87k|      NDLZ4_CHECK_RANGE(cur, 1);
  ------------------
  |  |  560|  1.87k|  do {                                                                           \
  |  |  561|  1.87k|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|  1.87k|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|  1.87k|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 1.87k]
  |  |  |  Branch (563:21): [True: 0, False: 1.87k]
  |  |  |  Branch (563:33): [True: 3, False: 1.86k]
  |  |  ------------------
  |  |  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|  1.87k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 1.86k]
  |  |  ------------------
  ------------------
  624|  1.86k|      token = *ip++;
  625|  1.86k|      if (token == 0) {    // no match
  ------------------
  |  Branch (625:11): [True: 908, False: 960]
  ------------------
  626|    908|        NDLZ4_CHECK_RANGE(cur + 1, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  560|    908|  do {                                                                           \
  |  |  561|    908|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    908|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    908|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 908]
  |  |  |  Branch (563:21): [True: 0, False: 908]
  |  |  |  Branch (563:33): [True: 3, False: 905]
  |  |  ------------------
  |  |  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|    908|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 905]
  |  |  ------------------
  ------------------
  627|    905|        buffercpy = ip;
  628|    905|        ip += padding[0] * padding[1];
  629|    960|      } else if (token == (uint8_t) ((1U << 7U) | (1U << 6U))) {  // cell match
  ------------------
  |  Branch (629:18): [True: 100, False: 860]
  ------------------
  630|    100|        NDLZ4_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  560|    100|  do {                                                                           \
  |  |  561|    100|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    100|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    100|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 100]
  |  |  |  Branch (563:21): [True: 0, False: 100]
  |  |  |  Branch (563:33): [True: 1, False: 99]
  |  |  ------------------
  |  |  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|    100|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 99]
  |  |  ------------------
  ------------------
  631|     99|        uint16_t offset;
  632|     99|        memcpy(&offset, ip, sizeof(offset));
  633|     99|        int64_t bpos = (cur + 1) - (int64_t) offset - 1;   // back-reference start offset
  634|     99|        NDLZ4_CHECK_RANGE(bpos, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  560|     99|  do {                                                                           \
  |  |  561|     99|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|     99|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|     99|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 6, False: 93]
  |  |  |  Branch (563:21): [True: 0, False: 93]
  |  |  |  Branch (563:33): [True: 1, False: 92]
  |  |  ------------------
  |  |  564|      7|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|      7|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|      7|    }                                                                            \
  |  |  567|     99|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 92]
  |  |  ------------------
  ------------------
  635|     92|        buffercpy = (uint8_t *) input + bpos;
  636|     92|        ip += 2;
  637|    860|      } else if (token == (uint8_t) (1U << 6U)) { // whole cell of same element
  ------------------
  |  Branch (637:18): [True: 121, False: 739]
  ------------------
  638|    121|        NDLZ4_CHECK_RANGE(cur + 1, 1);
  ------------------
  |  |  560|    121|  do {                                                                           \
  |  |  561|    121|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    121|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    121|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 121]
  |  |  |  Branch (563:21): [True: 0, False: 121]
  |  |  |  Branch (563:33): [True: 1, False: 120]
  |  |  ------------------
  |  |  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|    121|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 120]
  |  |  ------------------
  ------------------
  639|    120|        buffercpy = cell_aux;
  640|    120|        memset(buffercpy, *ip, 16);
  641|    120|        ip++;
  642|    739|      } else if (token >= 224) { // three rows match
  ------------------
  |  Branch (642:18): [True: 237, False: 502]
  ------------------
  643|    237|        buffercpy = local_buffer;
  644|    237|        NDLZ4_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  560|    237|  do {                                                                           \
  |  |  561|    237|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    237|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    237|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 237]
  |  |  |  Branch (563:21): [True: 0, False: 237]
  |  |  |  Branch (563:33): [True: 2, False: 235]
  |  |  ------------------
  |  |  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|    237|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 235]
  |  |  ------------------
  ------------------
  645|    235|        uint16_t offset;
  646|    235|        memcpy(&offset, ip, sizeof(offset));
  647|    235|        offset += 3;
  648|    235|        ip += 2;
  649|    235|        int i, j, k;
  650|    235|        if ((token >> 3U) == 28) {
  ------------------
  |  Branch (650:13): [True: 17, False: 218]
  ------------------
  651|     17|          i = 1;
  652|     17|          j = 2;
  653|     17|          k = 3;
  654|    218|        } else {
  655|    218|          i = 0;
  656|    218|          if ((token >> 3U) < 30) {
  ------------------
  |  Branch (656:15): [True: 31, False: 187]
  ------------------
  657|     31|            j = 1;
  658|     31|            k = 2;
  659|    187|          } else {
  660|    187|            k = 3;
  661|    187|            if ((token >> 3U) == 30) {
  ------------------
  |  Branch (661:17): [True: 41, False: 146]
  ------------------
  662|     41|              j = 1;
  663|    146|            } else {
  664|    146|              j = 2;
  665|    146|            }
  666|    187|          }
  667|    218|        }
  668|    235|        int64_t bpos = (cur + 3) - (int64_t) offset;   // == (ip - offset) as an offset
  669|    235|        NDLZ4_CHECK_RANGE(bpos, 12);
  ------------------
  |  |  560|    235|  do {                                                                           \
  |  |  561|    235|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    235|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    235|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 19, False: 216]
  |  |  |  Branch (563:21): [True: 0, False: 216]
  |  |  |  Branch (563:33): [True: 2, False: 214]
  |  |  ------------------
  |  |  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|    235|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 214]
  |  |  ------------------
  ------------------
  670|    214|        const uint8_t *ref = (const uint8_t *) input + bpos;
  671|    214|        memcpy(&buffercpy[i * 4], ref, 4);
  672|    214|        memcpy(&buffercpy[j * 4], ref + 4, 4);
  673|    214|        memcpy(&buffercpy[k * 4], ref + 8, 4);
  674|    512|        for (int l = 0; l < 4; l++) {
  ------------------
  |  Branch (674:25): [True: 512, False: 0]
  ------------------
  675|    512|          if ((l != i) && (l != j) && (l != k)) {
  ------------------
  |  Branch (675:15): [True: 313, False: 199]
  |  Branch (675:27): [True: 244, False: 69]
  |  Branch (675:39): [True: 214, False: 30]
  ------------------
  676|    214|            NDLZ4_CHECK_RANGE(ip - (const uint8_t *) input, 4);
  ------------------
  |  |  560|    214|  do {                                                                           \
  |  |  561|    214|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    214|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    214|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 214]
  |  |  |  Branch (563:21): [True: 0, False: 214]
  |  |  |  Branch (563:33): [True: 2, False: 212]
  |  |  ------------------
  |  |  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|    214|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 212]
  |  |  ------------------
  ------------------
  677|    212|            memcpy(&buffercpy[l * 4], ip, 4);
  678|    212|            ip += 4;
  679|    212|            break;
  680|    214|          }
  681|    512|        }
  682|       |
  683|    502|      } else if ((token >= 128) && (token <= 191)) { // rows pair match
  ------------------
  |  Branch (683:18): [True: 375, False: 127]
  |  Branch (683:36): [True: 372, False: 3]
  ------------------
  684|    372|        buffercpy = local_buffer;
  685|    372|        NDLZ4_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  560|    372|  do {                                                                           \
  |  |  561|    372|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    372|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    372|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 372]
  |  |  |  Branch (563:21): [True: 0, False: 372]
  |  |  |  Branch (563:33): [True: 1, False: 371]
  |  |  ------------------
  |  |  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|    372|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 371]
  |  |  ------------------
  ------------------
  686|    371|        uint16_t offset;
  687|    371|        memcpy(&offset, ip, sizeof(offset));
  688|    371|        offset += 3;
  689|    371|        ip += 2;
  690|    371|        int i, j;
  691|    371|        if (token == 128) {
  ------------------
  |  Branch (691:13): [True: 71, False: 300]
  ------------------
  692|     71|          i = 2;
  693|     71|          j = 3;
  694|    300|        } else {
  695|    300|          i = (token - 128) >> 5U;
  696|    300|          j = ((token - 128) >> 3U) - (i << 2U);
  697|    300|        }
  698|    371|        int64_t bpos = (cur + 3) - (int64_t) offset;
  699|    371|        NDLZ4_CHECK_RANGE(bpos, 8);
  ------------------
  |  |  560|    371|  do {                                                                           \
  |  |  561|    371|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    371|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    371|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 20, False: 351]
  |  |  |  Branch (563:21): [True: 0, False: 351]
  |  |  |  Branch (563:33): [True: 1, False: 350]
  |  |  ------------------
  |  |  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|    371|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 350]
  |  |  ------------------
  ------------------
  700|    350|        const uint8_t *ref = (const uint8_t *) input + bpos;
  701|    350|        memcpy(&buffercpy[i * 4], ref, 4);
  702|    350|        memcpy(&buffercpy[j * 4], ref + 4, 4);
  703|  1.74k|        for (int k = 0; k < 4; k++) {
  ------------------
  |  Branch (703:25): [True: 1.39k, False: 346]
  ------------------
  704|  1.39k|          if ((k != i) && (k != j)) {
  ------------------
  |  Branch (704:15): [True: 1.04k, False: 348]
  |  Branch (704:27): [True: 785, False: 261]
  ------------------
  705|    785|            NDLZ4_CHECK_RANGE(ip - (const uint8_t *) input, 4);
  ------------------
  |  |  560|    785|  do {                                                                           \
  |  |  561|    785|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    785|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    785|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 785]
  |  |  |  Branch (563:21): [True: 0, False: 785]
  |  |  |  Branch (563:33): [True: 4, False: 781]
  |  |  ------------------
  |  |  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|    785|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 781]
  |  |  ------------------
  ------------------
  706|    781|            memcpy(&buffercpy[k * 4], ip, 4);
  707|    781|            ip += 4;
  708|    781|          }
  709|  1.39k|        }
  710|    350|      } else if ((token >= 40) && (token <= 63)) {  // 2 rows pair matches
  ------------------
  |  Branch (710:18): [True: 120, False: 10]
  |  Branch (710:35): [True: 110, False: 10]
  ------------------
  711|    110|        buffercpy = local_buffer;
  712|    110|        NDLZ4_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  560|    110|  do {                                                                           \
  |  |  561|    110|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    110|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    110|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 110]
  |  |  |  Branch (563:21): [True: 0, False: 110]
  |  |  |  Branch (563:33): [True: 1, False: 109]
  |  |  ------------------
  |  |  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|    110|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 109]
  |  |  ------------------
  ------------------
  713|    109|        uint16_t offset_1;
  714|    109|        memcpy(&offset_1, ip, sizeof(offset_1));
  715|    109|        offset_1 += 5;
  716|    109|        ip += 2;
  717|    109|        NDLZ4_CHECK_RANGE(cur + 3, 2);
  ------------------
  |  |  560|    109|  do {                                                                           \
  |  |  561|    109|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    109|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    109|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 0, False: 109]
  |  |  |  Branch (563:21): [True: 0, False: 109]
  |  |  |  Branch (563:33): [True: 1, False: 108]
  |  |  ------------------
  |  |  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|    109|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 108]
  |  |  ------------------
  ------------------
  718|    108|        uint16_t offset_2;
  719|    108|        memcpy(&offset_2, ip, sizeof(offset_2));
  720|    108|        offset_2 += 5;
  721|    108|        ip += 2;
  722|    108|        int i, j, k, l, m;
  723|    108|        i = 0;
  724|    108|        j = ((token - 32) >> 3U);
  725|    108|        l = -1;
  726|    432|        for (k = 1; k < 4; k++) {
  ------------------
  |  Branch (726:21): [True: 324, False: 108]
  ------------------
  727|    324|          if ((k != i) && (k != j)) {
  ------------------
  |  Branch (727:15): [True: 324, False: 0]
  |  Branch (727:27): [True: 216, False: 108]
  ------------------
  728|    216|            if (l == -1) {
  ------------------
  |  Branch (728:17): [True: 108, False: 108]
  ------------------
  729|    108|              l = k;
  730|    108|            } else {
  731|    108|              m = k;
  732|    108|            }
  733|    216|          }
  734|    324|        }
  735|    108|        int64_t bpos1 = (cur + 5) - (int64_t) offset_1;
  736|    108|        NDLZ4_CHECK_RANGE(bpos1, 8);
  ------------------
  |  |  560|    108|  do {                                                                           \
  |  |  561|    108|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|    108|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|    108|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 27, False: 81]
  |  |  |  Branch (563:21): [True: 0, False: 81]
  |  |  |  Branch (563:33): [True: 1, False: 80]
  |  |  ------------------
  |  |  564|     28|      BLOSC_TRACE_ERROR("ndlz4: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|     28|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|     28|    do {                                            \
  |  |  |  |  |  |   98|     28|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|     28|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 28, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|     28|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|     28|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  566|     28|    }                                                                            \
  |  |  567|    108|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 80]
  |  |  ------------------
  ------------------
  737|     80|        const uint8_t *ref1 = (const uint8_t *) input + bpos1;
  738|     80|        memcpy(&buffercpy[i * 4], ref1, 4);
  739|     80|        memcpy(&buffercpy[j * 4], ref1 + 4, 4);
  740|     80|        int64_t bpos2 = (cur + 5) - (int64_t) offset_2;
  741|     80|        NDLZ4_CHECK_RANGE(bpos2, 8);
  ------------------
  |  |  560|     80|  do {                                                                           \
  |  |  561|     80|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  562|     80|    int64_t _len = (int64_t) (len);                                              \
  |  |  563|     80|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (563:9): [True: 17, False: 63]
  |  |  |  Branch (563:21): [True: 0, False: 63]
  |  |  |  Branch (563:33): [True: 1, False: 62]
  |  |  ------------------
  |  |  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|     80|  } while (0)
  |  |  ------------------
  |  |  |  Branch (567:12): [Folded, False: 62]
  |  |  ------------------
  ------------------
  742|     62|        const uint8_t *ref2 = (const uint8_t *) input + bpos2;
  743|     62|        memcpy(&buffercpy[l * 4], ref2, 4);
  744|     62|        memcpy(&buffercpy[m * 4], ref2 + 4, 4);
  745|       |
  746|     62|      } else {
  747|     20|        BLOSC_TRACE_ERROR("Invalid token: %u at cell [%d, %d]\n", token, ii[0], ii[1]);
  ------------------
  |  |   93|     20|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     20|    do {                                            \
  |  |  |  |   98|     20|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     20|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 20, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     20|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  748|     20|        return BLOSC2_ERROR_FAILURE;
  749|     20|      }
  750|       |      // fill op with buffercpy
  751|  1.73k|      uint32_t orig = ii[0] * 4 * blockshape[1] + ii[1] * 4;
  752|  8.68k|      for (uint32_t i = 0; i < 4; i++) {
  ------------------
  |  Branch (752:28): [True: 6.94k, False: 1.73k]
  ------------------
  753|  6.94k|        if (i < padding[0]) {
  ------------------
  |  Branch (753:13): [True: 6.34k, False: 605]
  ------------------
  754|  6.34k|          ind = orig + i * blockshape[1];
  755|  6.34k|          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.34k|          buffercpy += padding[1];
  762|  6.34k|        }
  763|  6.94k|      }
  764|  1.73k|      if (ind > (uint32_t) output_len) {
  ------------------
  |  Branch (764:11): [True: 0, False: 1.73k]
  ------------------
  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.73k|    }
  769|   276M|  }
  770|     15|  ind += padding[1];
  771|       |
  772|     15|  if ((int32_t)ind != (blockshape[0] * blockshape[1])) {
  ------------------
  |  Branch (772:7): [True: 0, False: 15]
  ------------------
  773|      0|    BLOSC_TRACE_ERROR("Output size is not compatible with embedded blockshape");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  774|      0|    return BLOSC2_ERROR_FAILURE;
  775|      0|  }
  776|     15|  if (ind > (uint32_t) output_len) {
  ------------------
  |  Branch (776:7): [True: 0, False: 15]
  ------------------
  777|      0|    BLOSC_TRACE_ERROR("Exceeding output size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  778|      0|    return BLOSC2_ERROR_FAILURE;
  779|      0|  }
  780|       |
  781|     15|  return (int) ind;
  782|     15|#undef NDLZ4_CHECK_RANGE
  783|     15|}

ndlz8_decompress:
  444|    223|                     uint8_t meta, blosc2_dparams *dparams) {
  445|    223|  BLOSC_UNUSED_PARAM(meta);
  ------------------
  |  |   28|    223|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  446|    223|  BLOSC_UNUSED_PARAM(dparams);
  ------------------
  |  |   28|    223|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  447|    223|  BLOSC_ERROR_NULL(input, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    223|    do {                                            \
  |  |  105|    223|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 223]
  |  |  ------------------
  |  |  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|    223|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 223]
  |  |  ------------------
  ------------------
  448|    223|  BLOSC_ERROR_NULL(output, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    223|    do {                                            \
  |  |  105|    223|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 223]
  |  |  ------------------
  |  |  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|    223|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 223]
  |  |  ------------------
  ------------------
  449|       |
  450|    223|  const int cell_shape = 8;
  451|    223|  const int cell_size = 64;
  452|    223|  uint8_t *ip = (uint8_t *) input;
  453|    223|  uint8_t *op = (uint8_t *) output;
  454|    223|  uint8_t ndim;
  455|    223|  int32_t blockshape[2];
  456|    223|  int32_t eshape[2];
  457|    223|  uint8_t *buffercpy;
  458|    223|  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|    223|  if (NDLZ_UNEXPECT_CONDITIONAL(input_len < (int32_t) (1 + 2 * sizeof(int32_t)))) {
  ------------------
  |  |   30|    223|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 1, False: 222]
  |  |  ------------------
  ------------------
  465|      1|    return 0;
  466|      1|  }
  467|    222|  uint8_t *ip_limit = ip + input_len;
  468|       |
  469|       |  /* we start with literal copy */
  470|    222|  ndim = *ip;
  471|    222|  ip++;
  472|    222|  if (ndim != 2) {
  ------------------
  |  Branch (472:7): [True: 1, False: 221]
  ------------------
  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|    221|  memcpy(&blockshape[0], ip, 4);
  477|    221|  ip += 4;
  478|    221|  memcpy(&blockshape[1], ip, 4);
  479|    221|  ip += 4;
  480|       |
  481|       |  // Sanity check.  See https://www.cve.org/CVERecord?id=CVE-2024-3203
  482|    221|  if (output_len < 0 || blockshape[0] < 0 || blockshape[1] < 0) {
  ------------------
  |  Branch (482:7): [True: 0, False: 221]
  |  Branch (482:25): [True: 18, False: 203]
  |  Branch (482:46): [True: 15, False: 188]
  ------------------
  483|     33|    BLOSC_TRACE_ERROR("Output length or blockshape is negative");
  ------------------
  |  |   93|     33|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     33|    do {                                            \
  |  |  |  |   98|     33|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     33|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 33, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     33|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  484|     33|    return BLOSC2_ERROR_FAILURE;
  485|     33|  }
  486|       |
  487|    188|  eshape[0] = ((blockshape[0] + 7) / cell_shape) * cell_shape;
  488|    188|  eshape[1] = ((blockshape[1] + 7) / cell_shape) * cell_shape;
  489|       |
  490|    188|  if (NDLZ_UNEXPECT_CONDITIONAL((int64_t)output_len < (int64_t)blockshape[0] * (int64_t)blockshape[1])) {
  ------------------
  |  |   30|    188|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 33, False: 155]
  |  |  ------------------
  ------------------
  491|     33|    BLOSC_TRACE_ERROR("The blockshape is bigger than the output buffer");
  ------------------
  |  |   93|     33|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     33|    do {                                            \
  |  |  |  |   98|     33|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     33|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 33, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     33|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  492|     33|    return 0;
  493|     33|  }
  494|    155|  memset(op, 0, blockshape[0] * blockshape[1]);
  495|       |
  496|    155|  int32_t i_stop[2];
  497|    465|  for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (497:19): [True: 310, False: 155]
  ------------------
  498|    310|    i_stop[i] = eshape[i] / cell_shape;
  499|    310|  }
  500|       |
  501|       |  /* main loop */
  502|    155|  int32_t ii[2];
  503|    155|  int32_t padding[2] = {0};
  504|    155|  int32_t ind = 0;
  505|    155|  uint8_t *local_buffer = malloc(cell_size);
  506|    155|  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|    155|#define NDLZ8_CHECK_RANGE(pos, len)                                              \
  518|    155|  do {                                                                           \
  519|    155|    int64_t _pos = (int64_t) (pos);                                              \
  520|    155|    int64_t _len = (int64_t) (len);                                              \
  521|    155|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  522|    155|      free(local_buffer);                                                        \
  523|    155|      free(cell_aux);                                                            \
  524|    155|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  525|    155|      return BLOSC2_ERROR_FAILURE;                                               \
  526|    155|    }                                                                            \
  527|    155|  } while (0)
  528|       |
  529|  1.49G|  for (ii[0] = 0; ii[0] < i_stop[0]; ++ii[0]) {
  ------------------
  |  Branch (529:19): [True: 1.49G, False: 19]
  ------------------
  530|  1.49G|    for (ii[1] = 0; ii[1] < i_stop[1]; ++ii[1]) {      // for each cell
  ------------------
  |  Branch (530:21): [True: 999, False: 1.49G]
  ------------------
  531|    999|      if (NDLZ_UNEXPECT_CONDITIONAL(ip > ip_limit)) {
  ------------------
  |  |   30|    999|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 0, False: 999]
  |  |  ------------------
  ------------------
  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|    999|      if (ii[0] == i_stop[0] - 1) {
  ------------------
  |  Branch (537:11): [True: 825, False: 174]
  ------------------
  538|    825|        padding[0] = (blockshape[0] % cell_shape == 0) ? cell_shape : blockshape[0] % cell_shape;
  ------------------
  |  Branch (538:22): [True: 6, False: 819]
  ------------------
  539|    825|      } else {
  540|    174|        padding[0] = cell_shape;
  541|    174|      }
  542|    999|      if (ii[1] == i_stop[1] - 1) {
  ------------------
  |  Branch (542:11): [True: 126, False: 873]
  ------------------
  543|    126|        padding[1] = (blockshape[1] % cell_shape == 0) ? cell_shape : blockshape[1] % cell_shape;
  ------------------
  |  Branch (543:22): [True: 73, False: 53]
  ------------------
  544|    873|      } else {
  545|    873|        padding[1] = cell_shape;
  546|    873|      }
  547|    999|      int64_t cur = ip - (const uint8_t *) input;   // in-range: ip is within [input, ip_limit]
  548|    999|      NDLZ8_CHECK_RANGE(cur, 1);
  ------------------
  |  |  518|    999|  do {                                                                           \
  |  |  519|    999|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    999|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    999|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 999]
  |  |  |  Branch (521:21): [True: 0, False: 999]
  |  |  |  Branch (521:33): [True: 6, False: 993]
  |  |  ------------------
  |  |  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|    999|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 993]
  |  |  ------------------
  ------------------
  549|    993|      token = *ip++;
  550|    993|      uint8_t match_type = (token >> 3U);
  551|    993|      if (token == 0) {    // no match
  ------------------
  |  Branch (551:11): [True: 219, False: 774]
  ------------------
  552|    219|        NDLZ8_CHECK_RANGE(cur + 1, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  518|    219|  do {                                                                           \
  |  |  519|    219|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    219|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    219|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 219]
  |  |  |  Branch (521:21): [True: 0, False: 219]
  |  |  |  Branch (521:33): [True: 6, False: 213]
  |  |  ------------------
  |  |  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|    219|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 213]
  |  |  ------------------
  ------------------
  553|    213|        buffercpy = ip;
  554|    213|        ip += padding[0] * padding[1];
  555|    774|      } else if (token == (uint8_t) ((1U << 7U) | (1U << 6U))) {  // cell match
  ------------------
  |  Branch (555:18): [True: 22, False: 752]
  ------------------
  556|     22|        NDLZ8_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  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: 0, False: 22]
  |  |  |  Branch (521:21): [True: 0, False: 22]
  |  |  |  Branch (521:33): [True: 1, False: 21]
  |  |  ------------------
  |  |  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|     22|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 21]
  |  |  ------------------
  ------------------
  557|     21|        uint16_t offset;
  558|     21|        memcpy(&offset, ip, sizeof(offset));
  559|     21|        int64_t bpos = (cur + 1) - (int64_t) offset - 1;
  560|     21|        NDLZ8_CHECK_RANGE(bpos, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  518|     21|  do {                                                                           \
  |  |  519|     21|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     21|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     21|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 16, False: 5]
  |  |  |  Branch (521:21): [True: 0, False: 5]
  |  |  |  Branch (521:33): [True: 1, False: 4]
  |  |  ------------------
  |  |  522|     17|      free(local_buffer);                                                        \
  |  |  523|     17|      free(cell_aux);                                                            \
  |  |  524|     17|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|     17|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|     17|    do {                                            \
  |  |  |  |  |  |   98|     17|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|     17|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 17, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|     17|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|     17|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|     17|    }                                                                            \
  |  |  527|     21|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 4]
  |  |  ------------------
  ------------------
  561|      4|        buffercpy = (uint8_t *) input + bpos;
  562|      4|        ip += 2;
  563|    752|      } else if (token == (uint8_t) (1U << 6U)) { // whole cell of same element
  ------------------
  |  Branch (563:18): [True: 531, False: 221]
  ------------------
  564|    531|        NDLZ8_CHECK_RANGE(cur + 1, 1);
  ------------------
  |  |  518|    531|  do {                                                                           \
  |  |  519|    531|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    531|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    531|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 531]
  |  |  |  Branch (521:21): [True: 0, False: 531]
  |  |  |  Branch (521:33): [True: 1, False: 530]
  |  |  ------------------
  |  |  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|    531|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 530]
  |  |  ------------------
  ------------------
  565|    530|        buffercpy = cell_aux;
  566|    530|        memset(buffercpy, *ip, cell_size);
  567|    530|        ip++;
  568|    530|      } else if (match_type == 21) {    // triple match
  ------------------
  |  Branch (568:18): [True: 77, False: 144]
  ------------------
  569|     77|        buffercpy = local_buffer;
  570|     77|        int row = (int) (token & 7);
  571|     77|        if (row + 2 >= cell_shape) {
  ------------------
  |  Branch (571:13): [True: 1, False: 76]
  ------------------
  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|     76|        NDLZ8_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  518|     76|  do {                                                                           \
  |  |  519|     76|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     76|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     76|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 76]
  |  |  |  Branch (521:21): [True: 0, False: 76]
  |  |  |  Branch (521:33): [True: 1, False: 75]
  |  |  ------------------
  |  |  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|     76|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 75]
  |  |  ------------------
  ------------------
  578|     75|        uint16_t offset;
  579|     75|        memcpy(&offset, ip, sizeof(offset));
  580|     75|        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|     75|        int64_t bpos = cur - (int64_t) offset;
  584|     75|        NDLZ8_CHECK_RANGE(bpos, 3 * cell_shape);
  ------------------
  |  |  518|     75|  do {                                                                           \
  |  |  519|     75|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     75|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     75|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 14, False: 61]
  |  |  |  Branch (521:21): [True: 0, False: 61]
  |  |  |  Branch (521:33): [True: 1, False: 60]
  |  |  ------------------
  |  |  522|     15|      free(local_buffer);                                                        \
  |  |  523|     15|      free(cell_aux);                                                            \
  |  |  524|     15|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|     15|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|     15|    do {                                            \
  |  |  |  |  |  |   98|     15|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|     15|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 15, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|     15|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|     15|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|     15|    }                                                                            \
  |  |  527|     75|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 60]
  |  |  ------------------
  ------------------
  585|     60|        const uint8_t *ref = (const uint8_t *) input + bpos;
  586|    240|        for (int l = 0; l < 3; l++) {
  ------------------
  |  Branch (586:25): [True: 180, False: 60]
  ------------------
  587|    180|          memcpy(&buffercpy[(row + l) * cell_shape], ref + l * cell_shape, cell_shape);
  588|    180|        }
  589|    511|        for (int l = 0; l < cell_shape; l++) {
  ------------------
  |  Branch (589:25): [True: 459, False: 52]
  ------------------
  590|    459|          if ((l < row) || (l > row + 2)) {
  ------------------
  |  Branch (590:15): [True: 215, False: 244]
  |  Branch (590:28): [True: 76, False: 168]
  ------------------
  591|    291|            NDLZ8_CHECK_RANGE(ip - (const uint8_t *) input, cell_shape);
  ------------------
  |  |  518|    291|  do {                                                                           \
  |  |  519|    291|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    291|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    291|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 291]
  |  |  |  Branch (521:21): [True: 0, False: 291]
  |  |  |  Branch (521:33): [True: 8, False: 283]
  |  |  ------------------
  |  |  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|    291|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 283]
  |  |  ------------------
  ------------------
  592|    283|            memcpy(&buffercpy[l * cell_shape], ip, cell_shape);
  593|    283|            ip += cell_shape;
  594|    283|          }
  595|    459|        }
  596|    144|      } else if (match_type == 17) {    // pair match
  ------------------
  |  Branch (596:18): [True: 98, False: 46]
  ------------------
  597|     98|        buffercpy = local_buffer;
  598|     98|        int row = (int) (token & 7);
  599|     98|        if (row + 1 >= cell_shape) {
  ------------------
  |  Branch (599:13): [True: 1, False: 97]
  ------------------
  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|     97|        NDLZ8_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  518|     97|  do {                                                                           \
  |  |  519|     97|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     97|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     97|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 97]
  |  |  |  Branch (521:21): [True: 0, False: 97]
  |  |  |  Branch (521:33): [True: 1, False: 96]
  |  |  ------------------
  |  |  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|     97|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 96]
  |  |  ------------------
  ------------------
  606|     96|        uint16_t offset;
  607|     96|        memcpy(&offset, ip, sizeof(offset));
  608|     96|        ip += 2;
  609|       |        // back-reference base == cur - offset (see triple-match note above).
  610|     96|        int64_t bpos = cur - (int64_t) offset;
  611|     96|        NDLZ8_CHECK_RANGE(bpos, 2 * cell_shape);
  ------------------
  |  |  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: 19, False: 77]
  |  |  |  Branch (521:21): [True: 0, False: 77]
  |  |  |  Branch (521:33): [True: 2, False: 75]
  |  |  ------------------
  |  |  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|     96|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 75]
  |  |  ------------------
  ------------------
  612|     75|        const uint8_t *ref = (const uint8_t *) input + bpos;
  613|    225|        for (int l = 0; l < 2; l++) {
  ------------------
  |  Branch (613:25): [True: 150, False: 75]
  ------------------
  614|    150|          memcpy(&buffercpy[(row + l) * cell_shape], ref + l * cell_shape, cell_shape);
  615|    150|        }
  616|    633|        for (int l = 0; l < cell_shape; l++) {
  ------------------
  |  Branch (616:25): [True: 569, False: 64]
  ------------------
  617|    569|          if ((l < row) || (l > row + 1)) {
  ------------------
  |  Branch (617:15): [True: 281, False: 288]
  |  Branch (617:28): [True: 146, False: 142]
  ------------------
  618|    427|            NDLZ8_CHECK_RANGE(ip - (const uint8_t *) input, cell_shape);
  ------------------
  |  |  518|    427|  do {                                                                           \
  |  |  519|    427|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    427|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    427|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 427]
  |  |  |  Branch (521:21): [True: 0, False: 427]
  |  |  |  Branch (521:33): [True: 11, False: 416]
  |  |  ------------------
  |  |  522|     11|      free(local_buffer);                                                        \
  |  |  523|     11|      free(cell_aux);                                                            \
  |  |  524|     11|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|     11|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|     11|    do {                                            \
  |  |  |  |  |  |   98|     11|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|     11|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 11, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|     11|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|     11|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|     11|    }                                                                            \
  |  |  527|    427|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 416]
  |  |  ------------------
  ------------------
  619|    416|            memcpy(&buffercpy[l * cell_shape], ip, cell_shape);
  620|    416|            ip += cell_shape;
  621|    416|          }
  622|    569|        }
  623|     75|      } else {
  624|     46|        free(local_buffer);
  625|     46|        free(cell_aux);
  626|     46|        BLOSC_TRACE_ERROR("Invalid token: %u at cell [%d, %d]\n", token, ii[0], ii[1]);
  ------------------
  |  |   93|     46|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     46|    do {                                            \
  |  |  |  |   98|     46|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     46|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 46, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     46|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  627|     46|        return BLOSC2_ERROR_FAILURE;
  628|     46|      }
  629|       |
  630|    863|      int32_t orig = ii[0] * cell_shape * blockshape[1] + ii[1] * cell_shape;
  631|  7.76k|      for (int32_t i = 0; i < (int32_t) cell_shape; i++) {
  ------------------
  |  Branch (631:27): [True: 6.90k, False: 863]
  ------------------
  632|  6.90k|        if (i < padding[0]) {
  ------------------
  |  Branch (632:13): [True: 3.36k, False: 3.53k]
  ------------------
  633|  3.36k|          ind = orig + i * blockshape[1];
  634|  3.36k|          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.36k|          buffercpy += padding[1];
  641|  3.36k|        }
  642|  6.90k|      }
  643|    863|      if (ind > output_len) {
  ------------------
  |  Branch (643:11): [True: 0, False: 863]
  ------------------
  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|    863|    }
  650|  1.49G|  }
  651|     19|  ind += padding[1];
  652|       |
  653|     19|  free(cell_aux);
  654|     19|  free(local_buffer);
  655|       |
  656|     19|  if (ind != (blockshape[0] * blockshape[1])) {
  ------------------
  |  Branch (656:7): [True: 0, False: 19]
  ------------------
  657|      0|    BLOSC_TRACE_ERROR("Output size is not compatible with embedded blockshape");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  658|      0|    return BLOSC2_ERROR_FAILURE;
  659|      0|  }
  660|     19|  if (ind > output_len) {
  ------------------
  |  Branch (660:7): [True: 0, False: 19]
  ------------------
  661|      0|    BLOSC_TRACE_ERROR("Exceeding output size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  662|      0|    return BLOSC2_ERROR_FAILURE;
  663|      0|  }
  664|       |
  665|     19|  return (int) ind;
  666|     19|#undef NDLZ8_CHECK_RANGE
  667|     19|}

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

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

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

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|      4|                   uint8_t id) {
  244|      4|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|      4|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  245|      4|  blosc2_schunk *schunk = dparams->schunk;
  246|      4|  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|      4|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|      4|#define B2ND_MAX_DIM 16
  ------------------
  252|      4|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      4|#define B2ND_MAX_DIM 16
  ------------------
  253|      4|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      4|#define B2ND_MAX_DIM 16
  ------------------
  254|      4|  uint8_t *smeta;
  255|      4|  int32_t smeta_len;
  256|      4|  if (blosc2_meta_get(schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (256:7): [True: 4, False: 0]
  ------------------
  257|      4|    free(shape);
  258|      4|    free(chunkshape);
  259|      4|    free(blockshape);
  260|      4|    BLOSC_TRACE_ERROR("b2nd layer not found!");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  261|      4|    return BLOSC2_ERROR_FAILURE;
  262|      4|  }
  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|  13.8k|void register_tuners(void) {
   14|       |
   15|  13.8k|  blosc2_tuner btune;
   16|  13.8k|  btune.id = BLOSC_BTUNE;
   17|  13.8k|  btune.name = "btune";
   18|  13.8k|  btune.init = NULL;
   19|  13.8k|  btune.next_cparams = NULL;
   20|  13.8k|  btune.next_blocksize = NULL;
   21|  13.8k|  btune.update = NULL;
   22|  13.8k|  btune.free = NULL;
   23|       |
   24|  13.8k|  register_tuner_private(&btune);
   25|  13.8k|}

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

