LZ4_decompress_safe:
 2504|  7.55k|{
 2505|  7.55k|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2506|  7.55k|                                  decode_full_block, noDict,
 2507|       |                                  (BYTE*)dest, NULL, 0);
 2508|  7.55k|}
LZ4_decompress_safe_withPrefix64k:
 2532|  3.36k|{
 2533|  3.36k|    return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
 2534|  3.36k|                                  decode_full_block, withPrefix64k,
 2535|  3.36k|                                  (BYTE*)dest - 64 KB, NULL, 0);
  ------------------
  |  |  252|  3.36k|#define KB *(1 <<10)
  ------------------
 2536|  3.36k|}
LZ4_decompress_safe_forceExtDict:
 2578|  11.6k|{
 2579|  11.6k|    DEBUGLOG(5, "LZ4_decompress_safe_forceExtDict");
  ------------------
  |  |  290|  11.6k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2580|  11.6k|    return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
 2581|  11.6k|                                  decode_full_block, usingExtDict,
 2582|  11.6k|                                  (BYTE*)dest, (const BYTE*)dictStart, dictSize);
 2583|  11.6k|}
LZ4_decompress_safe_usingDict:
 2774|  27.7k|{
 2775|  27.7k|    if (dictSize==0)
  ------------------
  |  Branch (2775:9): [True: 7.55k, False: 20.2k]
  ------------------
 2776|  7.55k|        return LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize);
 2777|  20.2k|    if (dictStart+dictSize == dest) {
  ------------------
  |  Branch (2777:9): [True: 8.58k, False: 11.6k]
  ------------------
 2778|  8.58k|        if (dictSize >= 64 KB - 1) {
  ------------------
  |  |  252|  8.58k|#define KB *(1 <<10)
  ------------------
  |  Branch (2778:13): [True: 3.36k, False: 5.22k]
  ------------------
 2779|  3.36k|            return LZ4_decompress_safe_withPrefix64k(source, dest, compressedSize, maxOutputSize);
 2780|  3.36k|        }
 2781|  8.58k|        assert(dictSize >= 0);
  ------------------
  |  Branch (2781:9): [True: 0, False: 5.22k]
  |  Branch (2781:9): [True: 5.22k, False: 0]
  ------------------
 2782|  5.22k|        return LZ4_decompress_safe_withSmallPrefix(source, dest, compressedSize, maxOutputSize, (size_t)dictSize);
 2783|  5.22k|    }
 2784|  20.2k|    assert(dictSize >= 0);
  ------------------
  |  Branch (2784:5): [True: 0, False: 11.6k]
  |  Branch (2784:5): [True: 11.6k, False: 0]
  ------------------
 2785|  11.6k|    return LZ4_decompress_safe_forceExtDict(source, dest, compressedSize, maxOutputSize, dictStart, (size_t)dictSize);
 2786|  11.6k|}
lz4.c:LZ4_isLittleEndian:
  365|  16.7M|{
  366|  16.7M|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  367|  16.7M|    return one.c[0];
  368|  16.7M|}
lz4.c:LZ4_wildCopy8:
  467|  2.34M|{
  468|  2.34M|    BYTE* d = (BYTE*)dstPtr;
  469|  2.34M|    const BYTE* s = (const BYTE*)srcPtr;
  470|  2.34M|    BYTE* const e = (BYTE*)dstEnd;
  471|       |
  472|  29.5M|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  350|  29.5M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (472:50): [True: 27.1M, False: 2.34M]
  ------------------
  473|  2.34M|}
lz4.c:LZ4_read16:
  394|  16.7M|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  399|  2.29M|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_decompress_generic:
 2067|  27.7k|{
 2068|  27.7k|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (2068:9): [True: 0, False: 27.7k]
  |  Branch (2068:26): [True: 0, False: 27.7k]
  ------------------
 2069|       |
 2070|  27.7k|    {   const BYTE* ip = (const BYTE*) src;
 2071|  27.7k|        const BYTE* const iend = ip + srcSize;
 2072|       |
 2073|  27.7k|        BYTE* op = (BYTE*) dst;
 2074|  27.7k|        BYTE* const oend = op + outputSize;
 2075|  27.7k|        BYTE* cpy;
 2076|       |
 2077|  27.7k|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (2077:37): [True: 16.1k, False: 11.6k]
  ------------------
 2078|       |
 2079|  27.7k|        const int checkOffset = (dictSize < (int)(64 KB));
  ------------------
  |  |  252|  27.7k|#define KB *(1 <<10)
  ------------------
 2080|       |
 2081|       |
 2082|       |        /* Set up the "end" pointers for the shortcut. */
 2083|  27.7k|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 2084|  27.7k|        const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/;
 2085|       |
 2086|  27.7k|        const BYTE* match;
 2087|  27.7k|        size_t offset;
 2088|  27.7k|        unsigned token;
 2089|  27.7k|        size_t length;
 2090|       |
 2091|       |
 2092|  27.7k|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  290|  27.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2093|       |
 2094|       |        /* Special cases */
 2095|  27.7k|        assert(lowPrefix <= op);
  ------------------
  |  Branch (2095:9): [True: 0, False: 27.7k]
  |  Branch (2095:9): [True: 27.7k, False: 0]
  ------------------
 2096|  27.7k|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  181|  27.7k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  27.7k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 27.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2097|       |            /* Empty output buffer */
 2098|      0|            if (partialDecoding) return 0;
  ------------------
  |  Branch (2098:17): [True: 0, False: 0]
  ------------------
 2099|      0|            return ((srcSize==1) && (*ip==0)) ? 0 : -1;
  ------------------
  |  Branch (2099:21): [True: 0, False: 0]
  |  Branch (2099:37): [True: 0, False: 0]
  ------------------
 2100|      0|        }
 2101|  27.7k|        if (unlikely(srcSize==0)) { return -1; }
  ------------------
  |  |  181|  27.7k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  27.7k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 27.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2102|       |
 2103|       |    /* LZ4_FAST_DEC_LOOP:
 2104|       |     * designed for modern OoO performance cpus,
 2105|       |     * where copying reliably 32-bytes is preferable to an unpredictable branch.
 2106|       |     * note : fast loop may show a regression for some client arm chips. */
 2107|  27.7k|#if LZ4_FAST_DEC_LOOP
 2108|  27.7k|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  27.7k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2108:13): [True: 0, False: 27.7k]
  ------------------
 2109|      0|            DEBUGLOG(6, "move to safe decode loop");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2110|      0|            goto safe_decode;
 2111|      0|        }
 2112|       |
 2113|       |        /* Fast loop : decode sequences as long as output < oend-FASTLOOP_SAFE_DISTANCE */
 2114|  27.7k|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  290|  27.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2115|  16.7M|        while (1) {
  ------------------
  |  Branch (2115:16): [True: 16.7M, Folded]
  ------------------
 2116|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2117|  16.7M|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  Branch (2117:13): [True: 0, False: 16.7M]
  |  Branch (2117:13): [True: 16.7M, False: 0]
  ------------------
 2118|  16.7M|            assert(ip < iend);
  ------------------
  |  Branch (2118:13): [True: 0, False: 16.7M]
  |  Branch (2118:13): [True: 16.7M, False: 0]
  ------------------
 2119|  16.7M|            token = *ip++;
 2120|  16.7M|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  261|  16.7M|#define ML_BITS  4
  ------------------
 2121|  16.7M|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  16.7M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2122|       |
 2123|  16.7M|            if (ip > iend-(16 + 1/*max lit + offset + nextToken*/)) { goto safe_literal_copy_early; }
  ------------------
  |  Branch (2123:17): [True: 18.6k, False: 16.7M]
  ------------------
 2124|       |
 2125|       |            /* decode literal length */
 2126|  16.7M|            if (length == RUN_MASK) {
  ------------------
  |  |  264|  16.7M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  16.7M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  16.7M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2126:17): [True: 331k, False: 16.3M]
  ------------------
 2127|       |                /* literal length >= RUN_MASK means >= RUN_MASK literal bytes follow the extension bytes,
 2128|       |                 * so extension bytes cannot reach the last RUN_MASK bytes of input */
 2129|   331k|                size_t const addl = read_variable_length(&ip, iend - RUN_MASK);
  ------------------
  |  |  264|   331k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|   331k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|   331k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2130|   331k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2130:21): [True: 120, False: 331k]
  ------------------
 2131|    120|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  290|    120|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2132|    120|                    goto _output_error;
 2133|    120|                }
 2134|   331k|                length += addl;
 2135|   331k|                cpy = op+length;
 2136|   331k|                if (unlikely((uptrval)(cpy)<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|   331k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   331k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 331k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2137|   331k|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|   331k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   331k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 331k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2138|       |
 2139|       |                /* copy literals */
 2140|   331k|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  278|   331k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2141|       |              #ifdef __aarch64__
 2142|       |                if ((cpy>oend-64) || (ip+length>iend-64)) { goto safe_literal_copy; }
 2143|       |                LZ4_wildCopy64(op, ip, cpy);
 2144|       |              #else
 2145|   331k|                if ((cpy>oend-32) || (ip+length>iend-32)) { goto safe_literal_copy; }
  ------------------
  |  Branch (2145:21): [True: 320, False: 331k]
  |  Branch (2145:38): [True: 6.04k, False: 325k]
  ------------------
 2146|   325k|                LZ4_wildCopy32(op, ip, cpy);
 2147|   325k|              #endif
 2148|   325k|                ip += length; op = cpy;
 2149|  16.3M|            } else {
 2150|  16.3M|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)length);
  ------------------
  |  |  290|  16.3M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2151|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2152|  16.3M|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  350|  16.3M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2153|  16.3M|                ip += length; op += length;
 2154|  16.3M|            }
 2155|       |
 2156|       |            /* get offset */
 2157|  16.7M|            offset = LZ4_readLE16(ip); ip+=2;
 2158|  16.7M|            DEBUGLOG(6, "blockPos%6u: offset = %u", (unsigned)(op-(BYTE*)dst), (unsigned)offset);
  ------------------
  |  |  290|  16.7M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2159|  16.7M|            match = op - offset;
 2160|  16.7M|            assert(match <= op);  /* overflow check */
  ------------------
  |  Branch (2160:13): [True: 0, False: 16.7M]
  |  Branch (2160:13): [True: 16.7M, False: 0]
  ------------------
 2161|       |
 2162|       |            /* get matchlength */
 2163|  16.7M|            length = token & ML_MASK;
  ------------------
  |  |  262|  16.7M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  16.7M|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2164|  16.7M|            DEBUGLOG(7, "  match length token = %u (len==%u)", (unsigned)length, (unsigned)length+MINMATCH);
  ------------------
  |  |  290|  16.7M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2165|       |
 2166|  16.7M|            if (length == ML_MASK) {
  ------------------
  |  |  262|  16.7M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  16.7M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2166:17): [True: 11.3M, False: 5.35M]
  ------------------
 2167|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2168|  11.3M|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  246|  11.3M|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2169|  11.3M|                if (addl == rvl_error) {
  ------------------
  |  Branch (2169:21): [True: 112, False: 11.3M]
  ------------------
 2170|    112|                    DEBUGLOG(5, "error reading long match length");
  ------------------
  |  |  290|    112|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2171|    112|                    goto _output_error;
 2172|    112|                }
 2173|  11.3M|                length += addl;
 2174|  11.3M|                length += MINMATCH;
  ------------------
  |  |  243|  11.3M|#define MINMATCH 4
  ------------------
 2175|  11.3M|                DEBUGLOG(7, "  long match length == %u", (unsigned)length);
  ------------------
  |  |  290|  11.3M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2176|  11.3M|                if (unlikely((uptrval)(op)+length<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|  11.3M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  11.3M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 11.3M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2177|  11.3M|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  11.3M|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2177:21): [True: 800, False: 11.3M]
  ------------------
 2178|    800|                    goto safe_match_copy;
 2179|    800|                }
 2180|  11.3M|            } else {
 2181|  5.35M|                length += MINMATCH;
  ------------------
  |  |  243|  5.35M|#define MINMATCH 4
  ------------------
 2182|  5.35M|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  5.35M|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2182:21): [True: 280, False: 5.35M]
  ------------------
 2183|    280|                    DEBUGLOG(7, "moving to safe_match_copy (ml==%u)", (unsigned)length);
  ------------------
  |  |  290|    280|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2184|    280|                    goto safe_match_copy;
 2185|    280|                }
 2186|       |
 2187|       |                /* Fastpath check: skip LZ4_wildCopy32 when true */
 2188|  5.35M|                if ((dict == withPrefix64k) || (match >= lowPrefix)) {
  ------------------
  |  Branch (2188:21): [True: 403k, False: 4.95M]
  |  Branch (2188:48): [True: 4.94M, False: 12.4k]
  ------------------
 2189|  5.34M|                    if (offset >= 8) {
  ------------------
  |  Branch (2189:25): [True: 3.03M, False: 2.31M]
  ------------------
 2190|  3.03M|                        assert(match >= lowPrefix);
  ------------------
  |  Branch (2190:25): [True: 0, False: 3.03M]
  |  Branch (2190:25): [True: 3.03M, False: 0]
  ------------------
 2191|  3.03M|                        assert(match <= op);
  ------------------
  |  Branch (2191:25): [True: 0, False: 3.03M]
  |  Branch (2191:25): [True: 3.03M, False: 0]
  ------------------
 2192|  3.03M|                        assert(op + 18 <= oend);
  ------------------
  |  Branch (2192:25): [True: 0, False: 3.03M]
  |  Branch (2192:25): [True: 3.03M, False: 0]
  ------------------
 2193|       |
 2194|  3.03M|                        LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  3.03M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2195|  3.03M|                        LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  350|  3.03M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2196|  3.03M|                        LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  350|  3.03M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2197|  3.03M|                        op += length;
 2198|  3.03M|                        continue;
 2199|  3.03M|            }   }   }
 2200|       |
 2201|  13.6M|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  181|  13.6M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  13.6M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2201:18): [True: 13.6M, False: 64.1k]
  |  Branch (2201:33): [True: 1.42k, False: 13.6M]
  ------------------
 2202|  1.42k|                DEBUGLOG(5, "Error : pos=%zi, offset=%zi => outside buffers", op-lowPrefix, op-match);
  ------------------
  |  |  290|  1.42k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2203|  1.42k|                goto _output_error;
 2204|  1.42k|            }
 2205|       |            /* match starting within external dictionary */
 2206|  13.6M|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2206:17): [True: 7.07M, False: 6.60M]
  |  Branch (2206:41): [True: 15.7k, False: 7.06M]
  ------------------
 2207|  15.7k|                assert(dictEnd != NULL);
  ------------------
  |  Branch (2207:17): [True: 0, False: 15.7k]
  |  Branch (2207:17): [True: 15.7k, False: 0]
  ------------------
 2208|  15.7k|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  181|  15.7k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  15.7k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 15.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2209|      0|                    if (partialDecoding) {
  ------------------
  |  Branch (2209:25): [True: 0, False: 0]
  ------------------
 2210|      0|                        DEBUGLOG(7, "partialDecoding: dictionary match, close to dstEnd");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2211|      0|                        length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1887|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1887:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2212|      0|                    } else {
 2213|      0|                        DEBUGLOG(6, "end-of-block condition violated")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2214|      0|                        goto _output_error;
 2215|      0|                }   }
 2216|       |
 2217|  15.7k|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2217:21): [True: 14.7k, False: 966]
  ------------------
 2218|       |                    /* match fits entirely within external dictionary : just copy */
 2219|  14.7k|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  358|  14.7k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2220|  14.7k|                    op += length;
 2221|  14.7k|                } else {
 2222|       |                    /* match stretches into both external dictionary and current block */
 2223|    966|                    size_t const copySize = (size_t)(lowPrefix - match);
 2224|    966|                    size_t const restSize = length - copySize;
 2225|    966|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  350|    966|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2226|    966|                    op += copySize;
 2227|    966|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2227:25): [True: 664, False: 302]
  ------------------
 2228|    664|                        BYTE* const endOfMatch = op + restSize;
 2229|    664|                        const BYTE* copyFrom = lowPrefix;
 2230|  42.5M|                        while (op < endOfMatch) { *op++ = *copyFrom++; }
  ------------------
  |  Branch (2230:32): [True: 42.5M, False: 664]
  ------------------
 2231|    664|                    } else {
 2232|    302|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  350|    302|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2233|    302|                        op += restSize;
 2234|    302|                }   }
 2235|  15.7k|                continue;
 2236|  15.7k|            }
 2237|       |
 2238|       |            /* copy match within block */
 2239|  13.6M|            cpy = op + length;
 2240|       |
 2241|  13.6M|            assert((op <= oend) && (oend-op >= 64));
  ------------------
  |  Branch (2241:13): [True: 0, False: 13.6M]
  |  Branch (2241:13): [True: 0, False: 0]
  |  Branch (2241:13): [True: 13.6M, False: 0]
  |  Branch (2241:13): [True: 13.6M, False: 0]
  ------------------
 2242|  13.6M|            if (unlikely(offset<16)) {
  ------------------
  |  |  181|  13.6M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  13.6M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 2.44M, False: 11.2M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2243|  2.44M|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2244|       |    #ifdef __aarch64__
 2245|       |            } else if (offset >= 64) {
 2246|       |                LZ4_wildCopy64(op, match, cpy);
 2247|       |    #endif
 2248|  11.2M|            } else {
 2249|  11.2M|                LZ4_wildCopy32(op, match, cpy);
 2250|  11.2M|            }
 2251|       |
 2252|  13.6M|            op = cpy;   /* wildcopy correction */
 2253|  13.6M|        }
 2254|      0|    safe_decode:
 2255|      0|#endif
 2256|       |
 2257|       |        /* Main Loop : decode remaining sequences where output < FASTLOOP_SAFE_DISTANCE */
 2258|      0|        DEBUGLOG(6, "using safe decode loop");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2259|  25.7k|        while (1) {
  ------------------
  |  Branch (2259:16): [True: 25.7k, Folded]
  ------------------
 2260|  25.7k|            assert(ip < iend);
  ------------------
  |  Branch (2260:13): [True: 0, False: 25.7k]
  |  Branch (2260:13): [True: 25.7k, False: 0]
  ------------------
 2261|  25.7k|            token = *ip++;
 2262|  25.7k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  261|  25.7k|#define ML_BITS  4
  ------------------
 2263|  25.7k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  25.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2264|       |
 2265|       |            /* A two-stage shortcut for the most common case:
 2266|       |             * 1) If the literal length is 0..14, and there is enough space,
 2267|       |             * enter the shortcut and copy 16 bytes on behalf of the literals
 2268|       |             * (in the fast mode, only 8 bytes can be safely copied this way).
 2269|       |             * 2) Further if the match length is 4..18, copy 18 bytes in a similar
 2270|       |             * manner; but we ensure that there's enough space in the output for
 2271|       |             * those 18 bytes earlier, upon entering the shortcut (in other words,
 2272|       |             * there is a combined check for both stages).
 2273|       |             */
 2274|  25.7k|            if ( (length != RUN_MASK)
  ------------------
  |  |  264|  25.7k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  25.7k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  25.7k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2274:18): [True: 23.3k, False: 2.45k]
  ------------------
 2275|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2276|  23.3k|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  178|  23.3k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  23.3k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 6.36k, False: 16.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2277|       |                /* Copy the literals */
 2278|  6.36k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  350|  6.36k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2279|  6.36k|                op += length; ip += length;
 2280|       |
 2281|       |                /* The second stage: prepare for match copying, decode full info.
 2282|       |                 * If it doesn't work out, the info won't be wasted. */
 2283|  6.36k|                length = token & ML_MASK; /* match length */
  ------------------
  |  |  262|  6.36k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  6.36k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2284|  6.36k|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u (len=%u)", (unsigned)(op-(BYTE*)dst), (unsigned)length, (unsigned)length + 4);
  ------------------
  |  |  290|  6.36k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2285|  6.36k|                offset = LZ4_readLE16(ip); ip += 2;
 2286|  6.36k|                match = op - offset;
 2287|  6.36k|                assert(match <= op); /* check overflow */
  ------------------
  |  Branch (2287:17): [True: 0, False: 6.36k]
  |  Branch (2287:17): [True: 6.36k, False: 0]
  ------------------
 2288|       |
 2289|       |                /* Do not deal with overlapping matches. */
 2290|  6.36k|                if ( (length != ML_MASK)
  ------------------
  |  |  262|  6.36k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  6.36k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2290:22): [True: 4.01k, False: 2.34k]
  ------------------
 2291|  4.01k|                  && (offset >= 8)
  ------------------
  |  Branch (2291:22): [True: 1.97k, False: 2.04k]
  ------------------
 2292|  1.97k|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2292:23): [True: 470, False: 1.50k]
  |  Branch (2292:46): [True: 1.26k, False: 236]
  ------------------
 2293|       |                    /* Copy the match. */
 2294|  1.73k|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  350|  1.73k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2295|  1.73k|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  350|  1.73k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2296|  1.73k|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  350|  1.73k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2297|  1.73k|                    op += length + MINMATCH;
  ------------------
  |  |  243|  1.73k|#define MINMATCH 4
  ------------------
 2298|       |                    /* Both stages worked, load the next token. */
 2299|  1.73k|                    continue;
 2300|  1.73k|                }
 2301|       |
 2302|       |                /* The second stage didn't work out, but the info is ready.
 2303|       |                 * Propel it right to the point of match copying. */
 2304|  4.62k|                goto _copy_match;
 2305|  6.36k|            }
 2306|       |
 2307|  19.4k|#if LZ4_FAST_DEC_LOOP
 2308|  38.1k|        safe_literal_copy_early:
 2309|  38.1k|#endif
 2310|       |
 2311|       |            /* decode literal length */
 2312|  38.1k|            if (length == RUN_MASK) {
  ------------------
  |  |  264|  38.1k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  38.1k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  38.1k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2312:17): [True: 6.55k, False: 31.5k]
  ------------------
 2313|       |                /* literal length >= RUN_MASK means >= RUN_MASK literal bytes follow the extension bytes,
 2314|       |                 * so extension bytes cannot reach the last RUN_MASK bytes of input */
 2315|  6.55k|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK);
  ------------------
  |  |  264|  6.55k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  6.55k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  6.55k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2316|  6.55k|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2316:21): [True: 598, False: 5.95k]
  ------------------
 2317|  5.95k|                length += addl;
 2318|  5.95k|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|  5.95k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  5.95k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 5.95k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2319|  5.95k|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|  5.95k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  5.95k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 5.95k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2320|  5.95k|            }
 2321|       |
 2322|       |            /* copy literals */
 2323|  37.5k|            cpy = op+length;
 2324|       |
 2325|  37.5k|#if LZ4_FAST_DEC_LOOP
 2326|  43.8k|        safe_literal_copy:
 2327|  43.8k|#endif
 2328|       |
 2329|  43.8k|            LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  278|  43.8k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2330|  43.8k|            if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  247|  43.8k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  246|  43.0k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2330:17): [True: 846, False: 43.0k]
  |  Branch (2330:39): [True: 22.9k, False: 20.1k]
  ------------------
 2331|       |                /* We've either hit the input parsing restriction or the output parsing restriction.
 2332|       |                 * In the normal scenario, decoding a full block, it must be the last sequence,
 2333|       |                 * otherwise it's an error (invalid input or dimensions).
 2334|       |                 * In partialDecoding scenario, it's necessary to ensure there is no buffer overflow.
 2335|       |                 */
 2336|  23.7k|                if (partialDecoding) {
  ------------------
  |  Branch (2336:21): [True: 0, False: 23.7k]
  ------------------
 2337|       |                    /* Since we are partial decoding we may be in this block because of the output parsing
 2338|       |                     * restriction, which is not valid since the output buffer is allowed to be undersized.
 2339|       |                     */
 2340|      0|                    DEBUGLOG(7, "partialDecoding: copying literals, close to input or output end")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2341|      0|                    DEBUGLOG(7, "partialDecoding: literal length = %u", (unsigned)length);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2342|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in dstBuffer : %i", (int)(oend - op));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2343|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in srcBuffer : %i", (int)(iend - ip));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2344|       |                    /* Finishing in the middle of a literals segment,
 2345|       |                     * due to lack of input.
 2346|       |                     */
 2347|      0|                    if (ip+length > iend) {
  ------------------
  |  Branch (2347:25): [True: 0, False: 0]
  ------------------
 2348|      0|                        length = (size_t)(iend-ip);
 2349|      0|                        cpy = op + length;
 2350|      0|                    }
 2351|       |                    /* Finishing in the middle of a literals segment,
 2352|       |                     * due to lack of output space.
 2353|       |                     */
 2354|      0|                    if (cpy > oend) {
  ------------------
  |  Branch (2354:25): [True: 0, False: 0]
  ------------------
 2355|      0|                        cpy = oend;
 2356|      0|                        assert(op<=oend);
  ------------------
  |  Branch (2356:25): [True: 0, False: 0]
  |  Branch (2356:25): [True: 0, False: 0]
  ------------------
 2357|      0|                        length = (size_t)(oend-op);
 2358|      0|                    }
 2359|  23.7k|                } else {
 2360|       |                     /* We must be on the last sequence (or invalid) because of the parsing limitations
 2361|       |                      * so check that we exactly consume the input and don't overrun the output buffer.
 2362|       |                      */
 2363|  23.7k|                    if ((ip+length != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2363:25): [True: 3.17k, False: 20.5k]
  |  Branch (2363:48): [True: 48, False: 20.5k]
  ------------------
 2364|  3.22k|                        DEBUGLOG(5, "should have been last run of literals")
  ------------------
  |  |  290|  3.22k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2365|  3.22k|                        DEBUGLOG(5, "ip(%p) + length(%i) = %p != iend (%p)", (void*)ip, (int)length, (void*)(ip+length), (void*)iend);
  ------------------
  |  |  290|  3.22k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2366|  3.22k|                        DEBUGLOG(5, "or cpy(%p) > (oend-MFLIMIT)(%p)", (void*)cpy, (void*)(oend-MFLIMIT));
  ------------------
  |  |  290|  3.22k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2367|  3.22k|                        DEBUGLOG(5, "after writing %u bytes / %i bytes available", (unsigned)(op-(BYTE*)dst), outputSize);
  ------------------
  |  |  290|  3.22k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2368|  3.22k|                        goto _output_error;
 2369|  3.22k|                    }
 2370|  23.7k|                }
 2371|  20.5k|                LZ4_memmove(op, ip, length);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  358|  20.5k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2372|  20.5k|                ip += length;
 2373|  20.5k|                op += length;
 2374|       |                /* Necessarily EOF when !partialDecoding.
 2375|       |                 * When partialDecoding, it is EOF if we've either
 2376|       |                 * filled the output buffer or
 2377|       |                 * can't proceed with reading an offset for following match.
 2378|       |                 */
 2379|  20.5k|                if (!partialDecoding || (cpy == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2379:21): [True: 20.5k, False: 0]
  |  Branch (2379:41): [True: 0, False: 0]
  |  Branch (2379:58): [True: 0, False: 0]
  ------------------
 2380|  20.5k|                    break;
 2381|  20.5k|                }
 2382|  20.5k|            } else {
 2383|  20.1k|                LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2384|  20.1k|                ip += length; op = cpy;
 2385|  20.1k|            }
 2386|       |
 2387|       |            /* get offset */
 2388|  20.1k|            offset = LZ4_readLE16(ip); ip+=2;
 2389|  20.1k|            match = op - offset;
 2390|       |
 2391|       |            /* get matchlength */
 2392|  20.1k|            length = token & ML_MASK;
  ------------------
  |  |  262|  20.1k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  20.1k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2393|  20.1k|            DEBUGLOG(7, "blockPos%6u: matchLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  20.1k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2394|       |
 2395|  24.7k|    _copy_match:
 2396|  24.7k|            if (length == ML_MASK) {
  ------------------
  |  |  262|  24.7k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  24.7k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2396:17): [True: 5.11k, False: 19.6k]
  ------------------
 2397|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2398|  5.11k|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  246|  5.11k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2399|  5.11k|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2399:21): [True: 122, False: 4.98k]
  ------------------
 2400|  4.98k|                length += addl;
 2401|  4.98k|                if (unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  181|  4.98k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  4.98k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 4.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2402|  4.98k|            }
 2403|  24.6k|            length += MINMATCH;
  ------------------
  |  |  243|  24.6k|#define MINMATCH 4
  ------------------
 2404|       |
 2405|  24.6k|#if LZ4_FAST_DEC_LOOP
 2406|  25.7k|        safe_match_copy:
 2407|  25.7k|#endif
 2408|  25.7k|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error;   /* Error : offset outside buffers */
  ------------------
  |  |  181|  24.6k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  24.6k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2408:17): [True: 24.6k, False: 1.04k]
  |  Branch (2408:34): [True: 1.27k, False: 23.3k]
  ------------------
 2409|       |            /* match starting within external dictionary */
 2410|  24.4k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2410:17): [True: 11.2k, False: 13.2k]
  |  Branch (2410:41): [True: 3.65k, False: 7.55k]
  ------------------
 2411|  3.65k|                assert(dictEnd != NULL);
  ------------------
  |  Branch (2411:17): [True: 0, False: 3.65k]
  |  Branch (2411:17): [True: 3.65k, False: 0]
  ------------------
 2412|  3.65k|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  181|  3.65k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  3.65k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 36, False: 3.61k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2413|     36|                    if (partialDecoding) length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1887|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1887:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2413:25): [True: 0, False: 36]
  ------------------
 2414|     36|                    else goto _output_error;   /* doesn't respect parsing restriction */
 2415|     36|                }
 2416|       |
 2417|  3.61k|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2417:21): [True: 2.19k, False: 1.42k]
  ------------------
 2418|       |                    /* match fits entirely within external dictionary : just copy */
 2419|  2.19k|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  358|  2.19k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2420|  2.19k|                    op += length;
 2421|  2.19k|                } else {
 2422|       |                    /* match stretches into both external dictionary and current block */
 2423|  1.42k|                    size_t const copySize = (size_t)(lowPrefix - match);
 2424|  1.42k|                    size_t const restSize = length - copySize;
 2425|  1.42k|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  350|  1.42k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2426|  1.42k|                    op += copySize;
 2427|  1.42k|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2427:25): [True: 664, False: 756]
  ------------------
 2428|    664|                        BYTE* const endOfMatch = op + restSize;
 2429|    664|                        const BYTE* copyFrom = lowPrefix;
 2430|  35.9M|                        while (op < endOfMatch) *op++ = *copyFrom++;
  ------------------
  |  Branch (2430:32): [True: 35.9M, False: 664]
  ------------------
 2431|    756|                    } else {
 2432|    756|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  350|    756|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2433|    756|                        op += restSize;
 2434|    756|                }   }
 2435|  3.61k|                continue;
 2436|  3.65k|            }
 2437|  24.4k|            assert(match >= lowPrefix);
  ------------------
  |  Branch (2437:13): [True: 0, False: 20.7k]
  |  Branch (2437:13): [True: 20.7k, False: 0]
  ------------------
 2438|       |
 2439|       |            /* copy match within block */
 2440|  20.7k|            cpy = op + length;
 2441|       |
 2442|       |            /* partialDecoding : may end anywhere within the block */
 2443|  20.7k|            assert(op<=oend);
  ------------------
  |  Branch (2443:13): [True: 0, False: 20.7k]
  |  Branch (2443:13): [True: 20.7k, False: 0]
  ------------------
 2444|  20.7k|            if (partialDecoding && (cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  248|      0|#define MATCH_SAFEGUARD_DISTANCE  ((2*WILDCOPYLENGTH) - MINMATCH)   /* ensure it's possible to write 2 x wildcopyLength without overflowing output buffer */
  |  |  ------------------
  |  |  |  |  245|      0|#define WILDCOPYLENGTH 8
  |  |  ------------------
  |  |               #define MATCH_SAFEGUARD_DISTANCE  ((2*WILDCOPYLENGTH) - MINMATCH)   /* ensure it's possible to write 2 x wildcopyLength without overflowing output buffer */
  |  |  ------------------
  |  |  |  |  243|      0|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (2444:17): [True: 0, False: 20.7k]
  |  Branch (2444:36): [True: 0, False: 0]
  ------------------
 2445|      0|                size_t const mlen = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1887|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1887:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2446|      0|                const BYTE* const matchEnd = match + mlen;
 2447|      0|                BYTE* const copyEnd = op + mlen;
 2448|      0|                if (matchEnd > op) {   /* overlap copy */
  ------------------
  |  Branch (2448:21): [True: 0, False: 0]
  ------------------
 2449|      0|                    while (op < copyEnd) { *op++ = *match++; }
  ------------------
  |  Branch (2449:28): [True: 0, False: 0]
  ------------------
 2450|      0|                } else {
 2451|      0|                    LZ4_memcpy(op, match, mlen);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2452|      0|                }
 2453|      0|                op = copyEnd;
 2454|      0|                if (op == oend) { break; }
  ------------------
  |  Branch (2454:21): [True: 0, False: 0]
  ------------------
 2455|      0|                continue;
 2456|      0|            }
 2457|       |
 2458|  20.7k|            if (unlikely(offset<8)) {
  ------------------
  |  |  181|  20.7k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  20.7k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 11.7k, False: 9.02k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2459|  11.7k|                LZ4_write32(op, 0);   /* silence msan warning when offset==0 */
 2460|  11.7k|                op[0] = match[0];
 2461|  11.7k|                op[1] = match[1];
 2462|  11.7k|                op[2] = match[2];
 2463|  11.7k|                op[3] = match[3];
 2464|  11.7k|                match += inc32table[offset];
 2465|  11.7k|                LZ4_memcpy(op+4, match, 4);
  ------------------
  |  |  350|  11.7k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2466|  11.7k|                match -= dec64table[offset];
 2467|  11.7k|            } else {
 2468|  9.02k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  9.02k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2469|  9.02k|                match += 8;
 2470|  9.02k|            }
 2471|  20.7k|            op += 8;
 2472|       |
 2473|  20.7k|            if (unlikely(cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  181|  20.7k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  20.7k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 760, False: 20.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2474|    760|                BYTE* const oCopyLimit = oend - (WILDCOPYLENGTH-1);
  ------------------
  |  |  245|    760|#define WILDCOPYLENGTH 8
  ------------------
 2475|    760|                if (cpy > oend-LASTLITERALS) { goto _output_error; } /* Error : last LASTLITERALS bytes must be literals (uncompressed) */
  ------------------
  |  |  246|    760|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2475:21): [True: 360, False: 400]
  ------------------
 2476|    400|                if (op < oCopyLimit) {
  ------------------
  |  Branch (2476:21): [True: 164, False: 236]
  ------------------
 2477|    164|                    LZ4_wildCopy8(op, match, oCopyLimit);
 2478|    164|                    match += oCopyLimit - op;
 2479|    164|                    op = oCopyLimit;
 2480|    164|                }
 2481|    538|                while (op < cpy) { *op++ = *match++; }
  ------------------
  |  Branch (2481:24): [True: 138, False: 400]
  ------------------
 2482|  20.0k|            } else {
 2483|  20.0k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  20.0k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2484|  20.0k|                if (length > 16) { LZ4_wildCopy8(op+8, match+8, cpy); }
  ------------------
  |  Branch (2484:21): [True: 6.52k, False: 13.4k]
  ------------------
 2485|  20.0k|            }
 2486|  20.4k|            op = cpy;   /* wildcopy correction */
 2487|  20.4k|        }
 2488|       |
 2489|       |        /* end of decoding */
 2490|  20.5k|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  290|  20.5k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2491|  20.5k|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2492|       |
 2493|       |        /* Overflow error detected */
 2494|  7.26k|    _output_error:
 2495|  7.26k|        return (int) (-(((const char*)ip)-src))-1;
 2496|      0|    }
 2497|      0|}
lz4.c:read_variable_length:
 2020|  11.6M|{
 2021|  11.6M|    Rvl_t s, length = 0;
 2022|  11.6M|    assert(ipPtr != NULL);
  ------------------
  |  Branch (2022:5): [True: 0, False: 11.6M]
  |  Branch (2022:5): [True: 11.6M, False: 0]
  ------------------
 2023|  11.6M|    assert(*ipPtr !=  NULL);
  ------------------
  |  Branch (2023:5): [True: 0, False: 11.6M]
  |  Branch (2023:5): [True: 11.6M, False: 0]
  ------------------
 2024|  11.6M|    assert(ilimit != NULL);
  ------------------
  |  Branch (2024:5): [True: 0, False: 11.6M]
  |  Branch (2024:5): [True: 11.6M, False: 0]
  ------------------
 2025|  11.6M|    if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|  11.6M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  11.6M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 600, False: 11.6M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2026|    600|        return rvl_error;
 2027|    600|    }
 2028|  11.6M|    s = **ipPtr;
 2029|  11.6M|    (*ipPtr)++;
 2030|  11.6M|    length += s;
 2031|  11.6M|    if (likely(s != 255)) return length;
  ------------------
  |  |  178|  11.6M|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  11.6M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 11.6M, False: 63.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2032|  31.2M|    do {
 2033|  31.2M|        if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|  31.2M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  31.2M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 352, False: 31.2M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2034|    352|            return rvl_error;
 2035|    352|        }
 2036|  31.2M|        s = **ipPtr;
 2037|  31.2M|        (*ipPtr)++;
 2038|  31.2M|        length += s;
 2039|       |        /* accumulator overflow detection (32-bit mode only) */
 2040|  31.2M|        if ((sizeof(length) < 8) && unlikely(length > ((Rvl_t)(-1)/2)) ) {
  ------------------
  |  |  181|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2040:13): [Folded, False: 31.2M]
  ------------------
 2041|      0|            return rvl_error;
 2042|      0|        }
 2043|  31.2M|    } while (s == 255);
  ------------------
  |  Branch (2043:14): [True: 31.1M, False: 62.8k]
  ------------------
 2044|       |
 2045|  62.8k|    return length;
 2046|  63.2k|}
lz4.c:LZ4_wildCopy32:
  532|  11.5M|{
  533|  11.5M|    BYTE* d = (BYTE*)dstPtr;
  534|  11.5M|    const BYTE* s = (const BYTE*)srcPtr;
  535|  11.5M|    BYTE* const e = (BYTE*)dstEnd;
  536|       |
  537|  37.6M|    do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  350|  37.6M|#    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);
  ------------------
  |  |  350|  37.6M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (537:79): [True: 26.1M, False: 11.5M]
  ------------------
  538|  11.5M|}
lz4.c:LZ4_readLE16:
  432|  16.7M|{
  433|  16.7M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (433:9): [True: 16.7M, False: 0]
  ------------------
  434|  16.7M|        return LZ4_read16(memPtr);
  435|  16.7M|    } else {
  436|      0|        const BYTE* p = (const BYTE*)memPtr;
  437|      0|        return (U16)((U16)p[0] | (p[1]<<8));
  438|      0|    }
  439|  16.7M|}
lz4.c:LZ4_memcpy_using_offset:
  545|  2.44M|{
  546|  2.44M|    BYTE v[8];
  547|       |
  548|  2.44M|    assert(dstEnd >= dstPtr + MINMATCH);
  ------------------
  |  Branch (548:5): [True: 0, False: 2.44M]
  |  Branch (548:5): [True: 2.44M, False: 0]
  ------------------
  549|       |
  550|  2.44M|    switch(offset) {
  551|  50.8k|    case 1:
  ------------------
  |  Branch (551:5): [True: 50.8k, False: 2.39M]
  ------------------
  552|  50.8k|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  237|  50.8k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  235|  50.8k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  553|  50.8k|        break;
  554|  44.4k|    case 2:
  ------------------
  |  Branch (554:5): [True: 44.4k, False: 2.39M]
  ------------------
  555|  44.4k|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  350|  44.4k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  556|  44.4k|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  350|  44.4k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  557|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  558|       |#  pragma warning(push)
  559|       |#  pragma warning(disable : 6385) /* warning C6385: Reading invalid data from 'v'. */
  560|       |#endif
  561|  44.4k|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  350|  44.4k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  562|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  563|       |#  pragma warning(pop)
  564|       |#endif
  565|  44.4k|        break;
  566|  24.7k|    case 4:
  ------------------
  |  Branch (566:5): [True: 24.7k, False: 2.41M]
  ------------------
  567|  24.7k|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  350|  24.7k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  568|  24.7k|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  350|  24.7k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  569|  24.7k|        break;
  570|  2.32M|    default:
  ------------------
  |  Branch (570:5): [True: 2.32M, False: 120k]
  ------------------
  571|  2.32M|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  572|  2.32M|        return;
  573|  2.44M|    }
  574|       |
  575|   120k|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  350|   120k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  576|   120k|    dstPtr += 8;
  577|  21.4M|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (577:12): [True: 21.3M, False: 120k]
  ------------------
  578|  21.3M|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  350|  21.3M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  579|  21.3M|        dstPtr += 8;
  580|  21.3M|    }
  581|   120k|}
lz4.c:LZ4_memcpy_using_offset_base:
  493|  2.32M|{
  494|  2.32M|    assert(srcPtr + offset == dstPtr);
  ------------------
  |  Branch (494:5): [True: 0, False: 2.32M]
  |  Branch (494:5): [True: 2.32M, False: 0]
  ------------------
  495|  2.32M|    if (offset < 8) {
  ------------------
  |  Branch (495:9): [True: 2.28M, False: 35.8k]
  ------------------
  496|  2.28M|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  497|  2.28M|        assert(offset != 1);   /* offset==0 happens on testing */
  ------------------
  |  Branch (497:9): [True: 0, False: 2.28M]
  |  Branch (497:9): [True: 2.28M, False: 0]
  ------------------
  498|  2.28M|        LZ4_memcpy(dstPtr, srcPtr, 2);
  ------------------
  |  |  350|  2.28M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  499|  2.28M|        LZ4_memcpy(dstPtr + 2, srcPtr + 2, 2);
  ------------------
  |  |  350|  2.28M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  500|  2.28M|        srcPtr += inc32table[offset];
  501|  2.28M|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  350|  2.28M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  502|  2.28M|        srcPtr -= dec64table[offset];
  503|  2.28M|        dstPtr += 8;
  504|  2.28M|    } else {
  505|  35.8k|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  350|  35.8k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  506|  35.8k|        dstPtr += 8;
  507|  35.8k|        srcPtr += 8;
  508|  35.8k|    }
  509|       |
  510|  2.32M|    LZ4_wildCopy8(dstPtr, srcPtr, dstEnd);
  511|  2.32M|}
lz4.c:LZ4_decompress_safe_withSmallPrefix:
 2558|  5.22k|{
 2559|  5.22k|    return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
 2560|  5.22k|                                  decode_full_block, noDict,
 2561|       |                                  (BYTE*)dest-prefixSize, NULL, 0);
 2562|  5.22k|}

LZ4F_isError:
  296|  12.8k|{
  297|  12.8k|    return (code > (LZ4F_errorCode_t)(-LZ4F_ERROR_maxCode));
  298|  12.8k|}
LZ4F_getBlockSize:
  336|  12.3k|{
  337|  12.3k|    static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  240|  12.3k|#  define KB *(1<<10)
  ------------------
                  static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  240|  12.3k|#  define KB *(1<<10)
  ------------------
                  static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  241|  12.3k|#  define MB *(1<<20)
  ------------------
                  static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  241|  12.3k|#  define MB *(1<<20)
  ------------------
  338|       |
  339|  12.3k|    if (blockSizeID == 0) blockSizeID = LZ4F_BLOCKSIZEID_DEFAULT;
  ------------------
  |  |  252|      0|#define LZ4F_BLOCKSIZEID_DEFAULT LZ4F_max64KB
  ------------------
  |  Branch (339:9): [True: 0, False: 12.3k]
  ------------------
  340|  12.3k|    if (blockSizeID < LZ4F_max64KB || blockSizeID > LZ4F_max4MB)
  ------------------
  |  Branch (340:9): [True: 0, False: 12.3k]
  |  Branch (340:39): [True: 0, False: 12.3k]
  ------------------
  341|      0|        RETURN_ERROR(maxBlockSize_invalid);
  ------------------
  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  342|  12.3k|    {   int const blockSizeIdx = (int)blockSizeID - (int)LZ4F_max64KB;
  343|  12.3k|        return blockSizes[blockSizeIdx];
  344|  12.3k|}   }
LZ4F_createDecompressionContext_advanced:
 1355|  3.24k|{
 1356|  3.24k|    LZ4F_dctx* const dctx = (LZ4F_dctx*)LZ4F_calloc(sizeof(LZ4F_dctx), customMem);
 1357|  3.24k|    if (dctx == NULL) return NULL;
  ------------------
  |  Branch (1357:9): [True: 0, False: 3.24k]
  ------------------
 1358|       |
 1359|  3.24k|    dctx->cmem = customMem;
 1360|  3.24k|    dctx->version = version;
 1361|  3.24k|    return dctx;
 1362|  3.24k|}
LZ4F_createDecompressionContext:
 1372|  3.24k|{
 1373|  3.24k|    assert(LZ4F_decompressionContextPtr != NULL);  /* violation of narrow contract */
  ------------------
  |  Branch (1373:5): [True: 0, False: 3.24k]
  |  Branch (1373:5): [True: 3.24k, False: 0]
  ------------------
 1374|  3.24k|    RETURN_ERROR_IF(LZ4F_decompressionContextPtr == NULL, parameter_null);  /* in case it nonetheless happen in production */
  ------------------
  |  |  322|  3.24k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  3.24k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 3.24k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  3.24k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 3.24k]
  |  |  ------------------
  ------------------
 1375|       |
 1376|  3.24k|    *LZ4F_decompressionContextPtr = LZ4F_createDecompressionContext_advanced(LZ4F_defaultCMem, versionNumber);
 1377|  3.24k|    if (*LZ4F_decompressionContextPtr == NULL) {  /* failed allocation */
  ------------------
  |  Branch (1377:9): [True: 0, False: 3.24k]
  ------------------
 1378|      0|        RETURN_ERROR(allocation_failed);
  ------------------
  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
 1379|      0|    }
 1380|  3.24k|    return LZ4F_OK_NoError;
 1381|  3.24k|}
LZ4F_freeDecompressionContext:
 1384|  3.24k|{
 1385|  3.24k|    LZ4F_errorCode_t result = LZ4F_OK_NoError;
 1386|  3.24k|    if (dctx != NULL) {   /* can accept NULL input, like free() */
  ------------------
  |  Branch (1386:9): [True: 3.24k, False: 0]
  ------------------
 1387|  3.24k|      result = (LZ4F_errorCode_t)dctx->dStage;
 1388|  3.24k|      LZ4F_free(dctx->tmpIn, dctx->cmem);
 1389|  3.24k|      LZ4F_free(dctx->tmpOutBuffer, dctx->cmem);
 1390|  3.24k|      LZ4F_free(dctx, dctx->cmem);
 1391|  3.24k|    }
 1392|  3.24k|    return result;
 1393|  3.24k|}
LZ4F_resetDecompressionContext:
 1405|  13.1k|{
 1406|  13.1k|    DEBUGLOG(5, "LZ4F_resetDecompressionContext");
  ------------------
  |  |  163|  13.1k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1407|  13.1k|    dctx->dStage = dstage_getFrameHeader;
 1408|       |    dctx->dict = NULL;
 1409|  13.1k|    dctx->dictSize = 0;
 1410|  13.1k|    dctx->skipBlockChecksum = 0;
 1411|  13.1k|    dctx->skipContentChecksum = 0;
 1412|  13.1k|    dctx->frameRemainingSize = 0;
 1413|  13.1k|}
LZ4F_decompress:
 1699|  12.9k|{
 1700|  12.9k|    static const BYTE emptySrc = 0;   /* NULL srcBuffer (no input, used by LZ4F_getFrameInfo()) points here instead :
 1701|       |                                       * NULL+0 and memcpy(dst, NULL, 0) are UB */
 1702|  12.9k|    LZ4F_decompressOptions_t optionsNull;
 1703|  12.9k|    const BYTE* const srcStart = srcBuffer ? (const BYTE*)srcBuffer : &emptySrc;
  ------------------
  |  Branch (1703:34): [True: 12.9k, False: 0]
  ------------------
 1704|  12.9k|    const BYTE* const srcEnd = srcBuffer ? srcStart + *srcSizePtr : srcStart;
  ------------------
  |  Branch (1704:32): [True: 12.9k, False: 0]
  ------------------
 1705|  12.9k|    const BYTE* srcPtr = srcStart;
 1706|  12.9k|    BYTE* const dstStart = (BYTE*)dstBuffer;
 1707|  12.9k|    BYTE* const dstEnd = dstStart ? dstStart + *dstSizePtr : NULL;
  ------------------
  |  Branch (1707:26): [True: 12.9k, False: 0]
  ------------------
 1708|  12.9k|    BYTE* dstPtr = dstStart;
 1709|  12.9k|    const BYTE* selectedIn = NULL;
 1710|  12.9k|    unsigned doAnotherStage = 1;
 1711|  12.9k|    size_t nextSrcSizeHint = 1;
 1712|       |
 1713|       |
 1714|  12.9k|    DEBUGLOG(5, "LZ4F_decompress: src[%p](%u) => dst[%p](%u)",
  ------------------
  |  |  163|  12.9k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1715|  12.9k|            srcBuffer, (unsigned)*srcSizePtr, dstBuffer, (unsigned)*dstSizePtr);
 1716|  12.9k|    if (dstBuffer == NULL) assert(*dstSizePtr == 0);
  ------------------
  |  Branch (1716:9): [True: 0, False: 12.9k]
  |  Branch (1716:28): [True: 0, False: 0]
  |  Branch (1716:28): [True: 0, False: 0]
  ------------------
 1717|  12.9k|    if (srcBuffer == NULL) assert(*srcSizePtr == 0);
  ------------------
  |  Branch (1717:9): [True: 0, False: 12.9k]
  |  Branch (1717:28): [True: 0, False: 0]
  |  Branch (1717:28): [True: 0, False: 0]
  ------------------
 1718|  12.9k|    MEM_INIT(&optionsNull, 0, sizeof(optionsNull));
  ------------------
  |  |   91|  12.9k|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
 1719|  12.9k|    if (decompressOptionsPtr==NULL) decompressOptionsPtr = &optionsNull;
  ------------------
  |  Branch (1719:9): [True: 0, False: 12.9k]
  ------------------
 1720|  12.9k|    *srcSizePtr = 0;
 1721|  12.9k|    *dstSizePtr = 0;
 1722|  12.9k|    assert(dctx != NULL);
  ------------------
  |  Branch (1722:5): [True: 0, False: 12.9k]
  |  Branch (1722:5): [True: 12.9k, False: 0]
  ------------------
 1723|  12.9k|    if (decompressOptionsPtr->skipChecksums) {   /* once set, disable for the remainder of the frame */
  ------------------
  |  Branch (1723:9): [True: 5.04k, False: 7.94k]
  ------------------
 1724|  5.04k|        dctx->skipBlockChecksum = 1;
 1725|  5.04k|        dctx->skipContentChecksum = 1;
 1726|  5.04k|    }
 1727|       |
 1728|       |    /* behaves as a state machine */
 1729|       |
 1730|   121k|    while (doAnotherStage) {
  ------------------
  |  Branch (1730:12): [True: 117k, False: 4.28k]
  ------------------
 1731|       |
 1732|   117k|        switch(dctx->dStage)
  ------------------
  |  Branch (1732:16): [True: 117k, False: 0]
  ------------------
 1733|   117k|        {
 1734|       |
 1735|  12.9k|        case dstage_getFrameHeader:
  ------------------
  |  Branch (1735:9): [True: 12.9k, False: 104k]
  ------------------
 1736|  12.9k|            DEBUGLOG(6, "dstage_getFrameHeader");
  ------------------
  |  |  163|  12.9k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1737|  12.9k|            if ((size_t)(srcEnd-srcPtr) >= maxFHSize) {  /* enough to decode - shortcut */
  ------------------
  |  Branch (1737:17): [True: 11.4k, False: 1.54k]
  ------------------
 1738|  11.4k|                size_t const hSize = LZ4F_decodeHeader(dctx, srcPtr, (size_t)(srcEnd-srcPtr));  /* will update dStage appropriately */
 1739|  11.4k|                FORWARD_IF_ERROR(hSize);
  ------------------
  |  |  329|  11.4k|#define FORWARD_IF_ERROR(r) do { if (LZ4F_isError(r)) return (r); } while (0)
  |  |  ------------------
  |  |  |  Branch (329:38): [True: 48, False: 11.3k]
  |  |  |  Branch (329:76): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
 1740|  11.3k|                srcPtr += hSize;
 1741|  11.3k|                break;
 1742|  11.4k|            }
 1743|  1.54k|            dctx->tmpInSize = 0;
 1744|  1.54k|            if (srcEnd-srcPtr == 0) return minFHSize;   /* 0-size input */
  ------------------
  |  Branch (1744:17): [True: 92, False: 1.45k]
  ------------------
 1745|  1.45k|            dctx->tmpInTarget = minFHSize;   /* minimum size to decode header */
 1746|  1.45k|            dctx->dStage = dstage_storeFrameHeader;
 1747|       |            /* fall-through */
 1748|       |
 1749|  1.52k|        case dstage_storeFrameHeader:
  ------------------
  |  Branch (1749:9): [True: 64, False: 117k]
  ------------------
 1750|  1.52k|            DEBUGLOG(6, "dstage_storeFrameHeader");
  ------------------
  |  |  163|  1.52k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1751|  1.52k|            {   size_t const sizeToCopy = MIN(dctx->tmpInTarget - dctx->tmpInSize, (size_t)(srcEnd - srcPtr));
  ------------------
  |  |  349|  1.52k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 1.10k, False: 416]
  |  |  ------------------
  ------------------
 1752|  1.52k|                memcpy(dctx->header + dctx->tmpInSize, srcPtr, sizeToCopy);
 1753|  1.52k|                dctx->tmpInSize += sizeToCopy;
 1754|  1.52k|                srcPtr += sizeToCopy;
 1755|  1.52k|            }
 1756|  1.52k|            if (dctx->tmpInSize < dctx->tmpInTarget) {
  ------------------
  |  Branch (1756:17): [True: 68, False: 1.45k]
  ------------------
 1757|     68|                nextSrcSizeHint = (dctx->tmpInTarget - dctx->tmpInSize) + BHSize;   /* rest of header + nextBlockHeader */
 1758|     68|                doAnotherStage = 0;   /* not enough src data, ask for some more */
 1759|     68|                break;
 1760|     68|            }
 1761|  1.45k|            FORWARD_IF_ERROR( LZ4F_decodeHeader(dctx, dctx->header, dctx->tmpInTarget) ); /* will update dStage appropriately */
  ------------------
  |  |  329|  1.45k|#define FORWARD_IF_ERROR(r) do { if (LZ4F_isError(r)) return (r); } while (0)
  |  |  ------------------
  |  |  |  Branch (329:38): [True: 164, False: 1.28k]
  |  |  |  Branch (329:76): [Folded, False: 1.28k]
  |  |  ------------------
  ------------------
 1762|  1.28k|            break;
 1763|       |
 1764|  12.3k|        case dstage_init:
  ------------------
  |  Branch (1764:9): [True: 12.3k, False: 105k]
  ------------------
 1765|  12.3k|            DEBUGLOG(6, "dstage_init");
  ------------------
  |  |  163|  12.3k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1766|  12.3k|            if (dctx->frameInfo.contentChecksumFlag) (void)XXH32_reset(&(dctx->xxh), 0);
  ------------------
  |  |  131|  8.28k|#  define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
  |  |  ------------------
  |  |  |  |  126|  8.28k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  8.28k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1766:17): [True: 8.28k, False: 4.02k]
  ------------------
 1767|       |            /* internal buffers allocation */
 1768|  12.3k|            {   size_t const tmpInNeeded = dctx->maxBlockSize + BFSize /* block checksum */;
 1769|  12.3k|                size_t const tmpOutNeeded = dctx->maxBlockSize
 1770|  12.3k|                    + ((dctx->frameInfo.blockMode==LZ4F_blockLinked) ? 128 KB : 0);
  ------------------
  |  |  240|  10.1k|#  define KB *(1<<10)
  ------------------
  |  Branch (1770:24): [True: 10.1k, False: 2.10k]
  ------------------
 1771|  12.3k|                if ( (tmpInNeeded > dctx->tmpInCapacity)
  ------------------
  |  Branch (1771:22): [True: 3.07k, False: 9.22k]
  ------------------
 1772|  9.22k|                  || (tmpOutNeeded > dctx->tmpOutBufferCapacity) ) {   /* tmp buffers too small */
  ------------------
  |  Branch (1772:22): [True: 0, False: 9.22k]
  ------------------
 1773|       |                    /* capacities remain 0 until allocation succeeds,
 1774|       |                     * so that allocation will be re-attempted on next entry */
 1775|  3.07k|                    LZ4F_free(dctx->tmpIn, dctx->cmem);
 1776|  3.07k|                    dctx->tmpInCapacity = 0;
 1777|  3.07k|                    dctx->tmpIn = (BYTE*)LZ4F_malloc(tmpInNeeded, dctx->cmem);
 1778|  3.07k|                    RETURN_ERROR_IF(dctx->tmpIn == NULL, allocation_failed);
  ------------------
  |  |  322|  3.07k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  3.07k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 3.07k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  3.07k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 3.07k]
  |  |  ------------------
  ------------------
 1779|  3.07k|                    dctx->tmpInCapacity = tmpInNeeded;
 1780|  3.07k|                    LZ4F_free(dctx->tmpOutBuffer, dctx->cmem);
 1781|  3.07k|                    dctx->tmpOutBufferCapacity = 0;
 1782|  3.07k|                    dctx->tmpOutBuffer= (BYTE*)LZ4F_malloc(tmpOutNeeded, dctx->cmem);
 1783|  3.07k|                    RETURN_ERROR_IF(dctx->tmpOutBuffer== NULL, allocation_failed);
  ------------------
  |  |  322|  3.07k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  3.07k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 3.07k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  3.07k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 3.07k]
  |  |  ------------------
  ------------------
 1784|  3.07k|                    dctx->tmpOutBufferCapacity = tmpOutNeeded;
 1785|  3.07k|            }   }
 1786|  12.3k|            dctx->tmpInSize = 0;
 1787|  12.3k|            dctx->tmpInTarget = 0;
 1788|  12.3k|            dctx->tmpOut = dctx->tmpOutBuffer;
 1789|  12.3k|            dctx->tmpOutStart = 0;
 1790|  12.3k|            dctx->tmpOutSize = 0;
 1791|       |
 1792|  12.3k|            dctx->dStage = dstage_getBlockHeader;
 1793|       |            /* fall-through */
 1794|       |
 1795|  48.4k|        case dstage_getBlockHeader:
  ------------------
  |  Branch (1795:9): [True: 36.1k, False: 81.5k]
  ------------------
 1796|  48.4k|            if ((size_t)(srcEnd - srcPtr) >= BHSize) {
  ------------------
  |  Branch (1796:17): [True: 46.5k, False: 1.86k]
  ------------------
 1797|  46.5k|                selectedIn = srcPtr;
 1798|  46.5k|                srcPtr += BHSize;
 1799|  46.5k|            } else {
 1800|       |                /* not enough input to read cBlockSize field */
 1801|  1.86k|                dctx->tmpInSize = 0;
 1802|  1.86k|                dctx->dStage = dstage_storeBlockHeader;
 1803|  1.86k|            }
 1804|       |
 1805|  48.4k|            if (dctx->dStage == dstage_storeBlockHeader)   /* can be skipped */
  ------------------
  |  Branch (1805:17): [True: 1.86k, False: 46.5k]
  ------------------
 1806|  1.86k|        case dstage_storeBlockHeader:
  ------------------
  |  Branch (1806:9): [True: 0, False: 117k]
  ------------------
 1807|  1.86k|            {   size_t const remainingInput = (size_t)(srcEnd - srcPtr);
 1808|  1.86k|                size_t const wantedData = BHSize - dctx->tmpInSize;
 1809|  1.86k|                size_t const sizeToCopy = MIN(wantedData, remainingInput);
  ------------------
  |  |  349|  1.86k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 0, False: 1.86k]
  |  |  ------------------
  ------------------
 1810|  1.86k|                memcpy(dctx->tmpIn + dctx->tmpInSize, srcPtr, sizeToCopy);
 1811|  1.86k|                srcPtr += sizeToCopy;
 1812|  1.86k|                dctx->tmpInSize += sizeToCopy;
 1813|       |
 1814|  1.86k|                if (dctx->tmpInSize < BHSize) {   /* not enough input for cBlockSize */
  ------------------
  |  Branch (1814:21): [True: 1.86k, False: 0]
  ------------------
 1815|  1.86k|                    nextSrcSizeHint = BHSize - dctx->tmpInSize;
 1816|  1.86k|                    doAnotherStage  = 0;
 1817|  1.86k|                    break;
 1818|  1.86k|                }
 1819|      0|                selectedIn = dctx->tmpIn;
 1820|      0|            }   /* if (dctx->dStage == dstage_storeBlockHeader) */
 1821|       |
 1822|       |        /* decode block header */
 1823|  46.5k|            {   U32 const blockHeader = LZ4F_readLE32(selectedIn);
 1824|  46.5k|                size_t const nextCBlockSize = blockHeader & 0x7FFFFFFFU;
 1825|  46.5k|                size_t const crcSize = dctx->frameInfo.blockChecksumFlag * BFSize;
 1826|  46.5k|                if (blockHeader==0) {  /* frameEnd signal, no more block */
  ------------------
  |  Branch (1826:21): [True: 652, False: 45.9k]
  ------------------
 1827|    652|                    DEBUGLOG(5, "end of frame");
  ------------------
  |  |  163|    652|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1828|    652|                    dctx->dStage = dstage_getSuffix;
 1829|    652|                    break;
 1830|    652|                }
 1831|  45.9k|                if (nextCBlockSize > dctx->maxBlockSize) {
  ------------------
  |  Branch (1831:21): [True: 654, False: 45.2k]
  ------------------
 1832|    654|                    RETURN_ERROR(maxBlockSize_invalid);
  ------------------
  |  |  320|    654|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
 1833|    654|                }
 1834|  45.2k|                if (blockHeader & LZ4F_BLOCKUNCOMPRESSED_FLAG) {
  ------------------
  |  |  251|  45.2k|#define LZ4F_BLOCKUNCOMPRESSED_FLAG 0x80000000U
  ------------------
  |  Branch (1834:21): [True: 17.0k, False: 28.2k]
  ------------------
 1835|       |                    /* next block is uncompressed */
 1836|  17.0k|                    dctx->tmpInTarget = nextCBlockSize;
 1837|  17.0k|                    DEBUGLOG(5, "next block is uncompressed (size %u)", (U32)nextCBlockSize);
  ------------------
  |  |  163|  17.0k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1838|  17.0k|                    if (dctx->frameInfo.blockChecksumFlag) {
  ------------------
  |  Branch (1838:25): [True: 9.60k, False: 7.43k]
  ------------------
 1839|  9.60k|                        (void)XXH32_reset(&dctx->blockChecksum, 0);
  ------------------
  |  |  131|  9.60k|#  define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
  |  |  ------------------
  |  |  |  |  126|  9.60k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  9.60k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1840|  9.60k|                    }
 1841|  17.0k|                    dctx->dStage = dstage_copyDirect;
 1842|  17.0k|                    break;
 1843|  17.0k|                }
 1844|       |                /* next block is a compressed block */
 1845|  28.2k|                dctx->tmpInTarget = nextCBlockSize + crcSize;
 1846|  28.2k|                dctx->dStage = dstage_getCBlock;
 1847|  28.2k|                if (dstPtr==dstEnd || srcPtr==srcEnd) {
  ------------------
  |  Branch (1847:21): [True: 28, False: 28.2k]
  |  Branch (1847:39): [True: 42, False: 28.1k]
  ------------------
 1848|     70|                    nextSrcSizeHint = BHSize + nextCBlockSize + crcSize;
 1849|     70|                    doAnotherStage = 0;
 1850|     70|                }
 1851|  28.2k|                break;
 1852|  45.2k|            }
 1853|       |
 1854|  17.0k|        case dstage_copyDirect:   /* uncompressed block */
  ------------------
  |  Branch (1854:9): [True: 17.0k, False: 100k]
  ------------------
 1855|  17.0k|            DEBUGLOG(6, "dstage_copyDirect");
  ------------------
  |  |  163|  17.0k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1856|  17.0k|            {   size_t sizeToCopy;
 1857|  17.0k|                if (dstPtr == NULL) {
  ------------------
  |  Branch (1857:21): [True: 0, False: 17.0k]
  ------------------
 1858|      0|                    sizeToCopy = 0;
 1859|  17.0k|                } else {
 1860|  17.0k|                    size_t const minBuffSize = MIN((size_t)(srcEnd-srcPtr), (size_t)(dstEnd-dstPtr));
  ------------------
  |  |  349|  17.0k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 14.5k, False: 2.45k]
  |  |  ------------------
  ------------------
 1861|  17.0k|                    sizeToCopy = MIN(dctx->tmpInTarget, minBuffSize);
  ------------------
  |  |  349|  17.0k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 15.5k, False: 1.47k]
  |  |  ------------------
  ------------------
 1862|  17.0k|                    memcpy(dstPtr, srcPtr, sizeToCopy);
 1863|  17.0k|                    if (dctx->frameInfo.blockChecksumFlag && !dctx->skipBlockChecksum)
  ------------------
  |  Branch (1863:25): [True: 9.60k, False: 7.43k]
  |  Branch (1863:62): [True: 8.42k, False: 1.18k]
  ------------------
 1864|  8.42k|                        (void)XXH32_update(&dctx->blockChecksum, srcPtr, sizeToCopy);
  ------------------
  |  |  132|  8.42k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  8.42k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  8.42k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1865|  17.0k|                    if (dctx->frameInfo.contentChecksumFlag && !dctx->skipContentChecksum)
  ------------------
  |  Branch (1865:25): [True: 13.0k, False: 4.01k]
  |  Branch (1865:64): [True: 9.91k, False: 3.11k]
  ------------------
 1866|  9.91k|                        (void)XXH32_update(&dctx->xxh, srcPtr, sizeToCopy);
  ------------------
  |  |  132|  9.91k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  9.91k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  9.91k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1867|  17.0k|                    if (dctx->frameInfo.contentSize)
  ------------------
  |  Branch (1867:25): [True: 1.85k, False: 15.1k]
  ------------------
 1868|  1.85k|                        dctx->frameRemainingSize -= sizeToCopy;
 1869|       |
 1870|       |                    /* history management (linked blocks only)*/
 1871|  17.0k|                    if (dctx->frameInfo.blockMode == LZ4F_blockLinked) {
  ------------------
  |  Branch (1871:25): [True: 15.0k, False: 2.00k]
  ------------------
 1872|  15.0k|                        LZ4F_updateDict(dctx, dstPtr, sizeToCopy, dstStart, 0);
 1873|  15.0k|                    }
 1874|  17.0k|                    srcPtr += sizeToCopy;
 1875|  17.0k|                    dstPtr += sizeToCopy;
 1876|  17.0k|                }
 1877|  17.0k|                if (sizeToCopy == dctx->tmpInTarget) {   /* all done */
  ------------------
  |  Branch (1877:21): [True: 16.3k, False: 684]
  ------------------
 1878|  16.3k|                    if (dctx->frameInfo.blockChecksumFlag) {
  ------------------
  |  Branch (1878:25): [True: 9.38k, False: 6.97k]
  ------------------
 1879|  9.38k|                        dctx->tmpInSize = 0;
 1880|  9.38k|                        dctx->dStage = dstage_getBlockChecksum;
 1881|  9.38k|                    } else
 1882|  6.97k|                        dctx->dStage = dstage_getBlockHeader;  /* new block */
 1883|  16.3k|                    break;
 1884|  16.3k|                }
 1885|    684|                dctx->tmpInTarget -= sizeToCopy;  /* need to copy more */
 1886|    684|            }
 1887|      0|            nextSrcSizeHint = dctx->tmpInTarget +
 1888|    684|                            +(dctx->frameInfo.blockChecksumFlag ? BFSize : 0)
  ------------------
  |  Branch (1888:31): [True: 222, False: 462]
  ------------------
 1889|    684|                            + BHSize /* next header size */;
 1890|    684|            doAnotherStage = 0;
 1891|    684|            break;
 1892|       |
 1893|       |        /* check block checksum for recently transferred uncompressed block */
 1894|  9.38k|        case dstage_getBlockChecksum:
  ------------------
  |  Branch (1894:9): [True: 9.38k, False: 108k]
  ------------------
 1895|  9.38k|            DEBUGLOG(6, "dstage_getBlockChecksum");
  ------------------
  |  |  163|  9.38k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1896|  9.38k|            {   const void* crcSrc;
 1897|  9.38k|                if ((srcEnd-srcPtr >= 4) && (dctx->tmpInSize==0)) {
  ------------------
  |  Branch (1897:21): [True: 9.26k, False: 118]
  |  Branch (1897:45): [True: 9.26k, False: 0]
  ------------------
 1898|  9.26k|                    crcSrc = srcPtr;
 1899|  9.26k|                    srcPtr += 4;
 1900|  9.26k|                } else {
 1901|    118|                    size_t const stillToCopy = 4 - dctx->tmpInSize;
 1902|    118|                    size_t const sizeToCopy = MIN(stillToCopy, (size_t)(srcEnd-srcPtr));
  ------------------
  |  |  349|    118|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 0, False: 118]
  |  |  ------------------
  ------------------
 1903|    118|                    memcpy(dctx->header + dctx->tmpInSize, srcPtr, sizeToCopy);
 1904|    118|                    dctx->tmpInSize += sizeToCopy;
 1905|    118|                    srcPtr += sizeToCopy;
 1906|    118|                    if (dctx->tmpInSize < 4) {  /* all input consumed */
  ------------------
  |  Branch (1906:25): [True: 118, False: 0]
  ------------------
 1907|    118|                        nextSrcSizeHint = (4 - dctx->tmpInSize) + BHSize /* next header size */;
 1908|    118|                        doAnotherStage = 0;
 1909|    118|                        break;
 1910|    118|                    }
 1911|      0|                    crcSrc = dctx->header;
 1912|      0|                }
 1913|  9.26k|                if (!dctx->skipBlockChecksum) {
  ------------------
  |  Branch (1913:21): [True: 8.23k, False: 1.03k]
  ------------------
 1914|  8.23k|                    U32 const readCRC = LZ4F_readLE32(crcSrc);
 1915|  8.23k|                    U32 const calcCRC = XXH32_digest(&dctx->blockChecksum);
  ------------------
  |  |  133|  8.23k|#  define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
  |  |  ------------------
  |  |  |  |  126|  8.23k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  8.23k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1916|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 1917|       |                    DEBUGLOG(6, "compare block checksum");
 1918|       |                    if (readCRC != calcCRC) {
 1919|       |                        DEBUGLOG(4, "incorrect block checksum: %08X != %08X",
 1920|       |                                readCRC, calcCRC);
 1921|       |                        RETURN_ERROR(blockChecksum_invalid);
 1922|       |                    }
 1923|       |#else
 1924|  8.23k|                    (void)readCRC;
 1925|  8.23k|                    (void)calcCRC;
 1926|  8.23k|#endif
 1927|  8.23k|            }   }
 1928|      0|            dctx->dStage = dstage_getBlockHeader;  /* new block */
 1929|  9.26k|            break;
 1930|       |
 1931|  28.1k|        case dstage_getCBlock:
  ------------------
  |  Branch (1931:9): [True: 28.1k, False: 89.5k]
  ------------------
 1932|  28.1k|            DEBUGLOG(6, "dstage_getCBlock");
  ------------------
  |  |  163|  28.1k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1933|  28.1k|            if ((size_t)(srcEnd-srcPtr) < dctx->tmpInTarget) {
  ------------------
  |  Branch (1933:17): [True: 364, False: 27.7k]
  ------------------
 1934|    364|                dctx->tmpInSize = 0;
 1935|    364|                dctx->dStage = dstage_storeCBlock;
 1936|    364|                break;
 1937|    364|            }
 1938|       |            /* input large enough to read full block directly */
 1939|  27.7k|            selectedIn = srcPtr;
 1940|  27.7k|            srcPtr += dctx->tmpInTarget;
 1941|       |
 1942|  27.7k|            if (0)  /* always jump over next block */
  ------------------
  |  Branch (1942:17): [Folded, False: 27.7k]
  ------------------
 1943|    364|        case dstage_storeCBlock:
  ------------------
  |  Branch (1943:9): [True: 364, False: 117k]
  ------------------
 1944|    364|            {   size_t const wantedData = dctx->tmpInTarget - dctx->tmpInSize;
 1945|    364|                size_t const inputLeft = (size_t)(srcEnd-srcPtr);
 1946|    364|                size_t const sizeToCopy = MIN(wantedData, inputLeft);
  ------------------
  |  |  349|    364|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 0, False: 364]
  |  |  ------------------
  ------------------
 1947|    364|                memcpy(dctx->tmpIn + dctx->tmpInSize, srcPtr, sizeToCopy);
 1948|    364|                dctx->tmpInSize += sizeToCopy;
 1949|    364|                srcPtr += sizeToCopy;
 1950|    364|                if (dctx->tmpInSize < dctx->tmpInTarget) { /* need more input */
  ------------------
  |  Branch (1950:21): [True: 364, False: 0]
  ------------------
 1951|    364|                    nextSrcSizeHint = (dctx->tmpInTarget - dctx->tmpInSize)   /* block checksum included */
 1952|    364|                                    + BHSize /* next header size */;
 1953|    364|                    doAnotherStage = 0;
 1954|    364|                    break;
 1955|    364|                }
 1956|      0|                selectedIn = dctx->tmpIn;
 1957|      0|            }
 1958|       |
 1959|       |            /* At this stage, input is large enough to decode a block */
 1960|       |
 1961|       |            /* First, decode and control block checksum if it exists */
 1962|  27.7k|            if (dctx->frameInfo.blockChecksumFlag) {
  ------------------
  |  Branch (1962:17): [True: 9.12k, False: 18.6k]
  ------------------
 1963|  9.12k|                assert(dctx->tmpInTarget >= 4);
  ------------------
  |  Branch (1963:17): [True: 0, False: 9.12k]
  |  Branch (1963:17): [True: 9.12k, False: 0]
  ------------------
 1964|  9.12k|                dctx->tmpInTarget -= 4;
 1965|  9.12k|                assert(selectedIn != NULL);  /* selectedIn is defined at this stage (either srcPtr, or dctx->tmpIn) */
  ------------------
  |  Branch (1965:17): [True: 0, False: 9.12k]
  |  Branch (1965:17): [True: 9.12k, False: 0]
  ------------------
 1966|  9.12k|                if (!dctx->skipBlockChecksum) {
  ------------------
  |  Branch (1966:21): [True: 7.17k, False: 1.94k]
  ------------------
 1967|  7.17k|                    U32 const readBlockCrc = LZ4F_readLE32(selectedIn + dctx->tmpInTarget);
 1968|  7.17k|                    U32 const calcBlockCrc = XXH32(selectedIn, dctx->tmpInTarget, 0);
  ------------------
  |  |  128|  7.17k|#  define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
  |  |  ------------------
  |  |  |  |  126|  7.17k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  7.17k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1969|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 1970|       |                    RETURN_ERROR_IF(readBlockCrc != calcBlockCrc, blockChecksum_invalid);
 1971|       |#else
 1972|  7.17k|                    (void)readBlockCrc;
 1973|  7.17k|                    (void)calcBlockCrc;
 1974|  7.17k|#endif
 1975|  7.17k|            }   }
 1976|       |
 1977|       |            /* decode directly into destination buffer if there is enough room */
 1978|  27.7k|            if ( ((size_t)(dstEnd-dstPtr) >= dctx->maxBlockSize)
  ------------------
  |  Branch (1978:18): [True: 3.93k, False: 23.8k]
  ------------------
 1979|       |                 /* unless the dictionary is stored in tmpOut:
 1980|       |                  * in which case it's faster to decode within tmpOut
 1981|       |                  * to benefit from prefix speedup */
 1982|  3.93k|              && !(dctx->dict!= NULL && (const BYTE*)dctx->dict + dctx->dictSize == dctx->tmpOut) )
  ------------------
  |  Branch (1982:20): [True: 2.83k, False: 1.10k]
  |  Branch (1982:41): [True: 0, False: 2.83k]
  ------------------
 1983|  3.93k|            {
 1984|  3.93k|                const char* dict = (const char*)dctx->dict;
 1985|  3.93k|                size_t dictSize = dctx->dictSize;
 1986|  3.93k|                int decodedSize;
 1987|  3.93k|                assert(dstPtr != NULL);
  ------------------
  |  Branch (1987:17): [True: 0, False: 3.93k]
  |  Branch (1987:17): [True: 3.93k, False: 0]
  ------------------
 1988|  3.93k|                if (dict && dictSize > 1 GB) {
  ------------------
  |  |  242|  2.83k|#  define GB *(1<<30)
  ------------------
  |  Branch (1988:21): [True: 2.83k, False: 1.10k]
  |  Branch (1988:29): [True: 0, False: 2.83k]
  ------------------
 1989|       |                    /* overflow control : dctx->dictSize is an int, avoid truncation / sign issues */
 1990|      0|                    dict += dictSize - 64 KB;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 1991|      0|                    dictSize = 64 KB;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 1992|      0|                }
 1993|  3.93k|                decodedSize = LZ4_decompress_safe_usingDict(
 1994|  3.93k|                        (const char*)selectedIn, (char*)dstPtr,
 1995|  3.93k|                        (int)dctx->tmpInTarget, (int)dctx->maxBlockSize,
 1996|  3.93k|                        dict, (int)dictSize);
 1997|  3.93k|                RETURN_ERROR_IF(decodedSize < 0, decompressionFailed);
  ------------------
  |  |  322|  3.93k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  3.93k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 596, False: 3.33k]
  |  |  ------------------
  |  |  324|    596|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|    596|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|    596|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|    596|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|    596|        }                          \
  |  |  327|  3.93k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 3.33k]
  |  |  ------------------
  ------------------
 1998|  3.33k|                if ((dctx->frameInfo.contentChecksumFlag) && (!dctx->skipContentChecksum))
  ------------------
  |  Branch (1998:21): [True: 2.87k, False: 460]
  |  Branch (1998:62): [True: 2.23k, False: 648]
  ------------------
 1999|  2.23k|                    XXH32_update(&(dctx->xxh), dstPtr, (size_t)decodedSize);
  ------------------
  |  |  132|  2.23k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  2.23k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  2.23k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2000|  3.33k|                if (dctx->frameInfo.contentSize)
  ------------------
  |  Branch (2000:21): [True: 1.57k, False: 1.76k]
  ------------------
 2001|  1.57k|                    dctx->frameRemainingSize -= (size_t)decodedSize;
 2002|       |
 2003|       |                /* dictionary management */
 2004|  3.33k|                if (dctx->frameInfo.blockMode==LZ4F_blockLinked) {
  ------------------
  |  Branch (2004:21): [True: 2.28k, False: 1.05k]
  ------------------
 2005|  2.28k|                    LZ4F_updateDict(dctx, dstPtr, (size_t)decodedSize, dstStart, 0);
 2006|  2.28k|                }
 2007|       |
 2008|  3.33k|                dstPtr += decodedSize;
 2009|  3.33k|                dctx->dStage = dstage_getBlockHeader;  /* end of block, let's get another one */
 2010|  3.33k|                break;
 2011|  3.93k|            }
 2012|       |
 2013|       |            /* not enough place into dst : decode into tmpOut */
 2014|       |
 2015|       |            /* manage dictionary */
 2016|  23.8k|            if (dctx->frameInfo.blockMode == LZ4F_blockLinked) {
  ------------------
  |  Branch (2016:17): [True: 20.0k, False: 3.84k]
  ------------------
 2017|  20.0k|                if (dctx->dict == dctx->tmpOutBuffer) {
  ------------------
  |  Branch (2017:21): [True: 7.34k, False: 12.6k]
  ------------------
 2018|       |                    /* truncate dictionary to 64 KB if too big */
 2019|  7.34k|                    if (dctx->dictSize > 128 KB) {
  ------------------
  |  |  240|  7.34k|#  define KB *(1<<10)
  ------------------
  |  Branch (2019:25): [True: 0, False: 7.34k]
  ------------------
 2020|      0|                        memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - 64 KB, 64 KB);
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
                                      memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - 64 KB, 64 KB);
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 2021|      0|                        dctx->dictSize = 64 KB;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 2022|      0|                    }
 2023|  7.34k|                    dctx->tmpOut = dctx->tmpOutBuffer + dctx->dictSize;
 2024|  12.6k|                } else {  /* dict not within tmpOut */
 2025|  12.6k|                    size_t const reservedDictSpace = MIN(dctx->dictSize, 64 KB);
  ------------------
  |  |  349|  12.6k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 12.0k, False: 624]
  |  |  ------------------
  ------------------
 2026|  12.6k|                    dctx->tmpOut = dctx->tmpOutBuffer + reservedDictSpace;
 2027|  12.6k|            }   }
 2028|       |
 2029|       |            /* Decode block into tmpOut */
 2030|  23.8k|            {   const char* dict = (const char*)dctx->dict;
 2031|  23.8k|                size_t dictSize = dctx->dictSize;
 2032|  23.8k|                int decodedSize;
 2033|  23.8k|                if (dict && dictSize > 1 GB) {
  ------------------
  |  |  242|  19.1k|#  define GB *(1<<30)
  ------------------
  |  Branch (2033:21): [True: 19.1k, False: 4.76k]
  |  Branch (2033:29): [True: 0, False: 19.1k]
  ------------------
 2034|       |                    /* the dictSize param is an int, avoid truncation / sign issues */
 2035|      0|                    dict += dictSize - 64 KB;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 2036|      0|                    dictSize = 64 KB;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 2037|      0|                }
 2038|  23.8k|                decodedSize = LZ4_decompress_safe_usingDict(
 2039|  23.8k|                        (const char*)selectedIn, (char*)dctx->tmpOut,
 2040|  23.8k|                        (int)dctx->tmpInTarget, (int)dctx->maxBlockSize,
 2041|  23.8k|                        dict, (int)dictSize);
 2042|  23.8k|                RETURN_ERROR_IF(decodedSize < 0, decompressionFailed);
  ------------------
  |  |  322|  23.8k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  23.8k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 6.67k, False: 17.1k]
  |  |  ------------------
  |  |  324|  6.67k|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|  6.67k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|  6.67k|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|  6.67k|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|  6.67k|        }                          \
  |  |  327|  23.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 17.1k]
  |  |  ------------------
  ------------------
 2043|  17.1k|                if (dctx->frameInfo.contentChecksumFlag && !dctx->skipContentChecksum)
  ------------------
  |  Branch (2043:21): [True: 13.2k, False: 3.89k]
  |  Branch (2043:60): [True: 8.67k, False: 4.61k]
  ------------------
 2044|  8.67k|                    XXH32_update(&(dctx->xxh), dctx->tmpOut, (size_t)decodedSize);
  ------------------
  |  |  132|  8.67k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  8.67k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  8.67k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2045|  17.1k|                if (dctx->frameInfo.contentSize)
  ------------------
  |  Branch (2045:21): [True: 3.04k, False: 14.1k]
  ------------------
 2046|  3.04k|                    dctx->frameRemainingSize -= (size_t)decodedSize;
 2047|  17.1k|                dctx->tmpOutSize = (size_t)decodedSize;
 2048|  17.1k|                dctx->tmpOutStart = 0;
 2049|  17.1k|                dctx->dStage = dstage_flushOut;
 2050|  17.1k|            }
 2051|       |            /* fall-through */
 2052|       |
 2053|  17.1k|        case dstage_flushOut:  /* flush decoded data from tmpOut to dstBuffer */
  ------------------
  |  Branch (2053:9): [True: 0, False: 117k]
  ------------------
 2054|  17.1k|            DEBUGLOG(6, "dstage_flushOut");
  ------------------
  |  |  163|  17.1k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 2055|  17.1k|            if (dstPtr != NULL) {
  ------------------
  |  Branch (2055:17): [True: 17.1k, False: 0]
  ------------------
 2056|  17.1k|                size_t const sizeToCopy = MIN(dctx->tmpOutSize - dctx->tmpOutStart, (size_t)(dstEnd-dstPtr));
  ------------------
  |  |  349|  17.1k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 16.5k, False: 640]
  |  |  ------------------
  ------------------
 2057|  17.1k|                memcpy(dstPtr, dctx->tmpOut + dctx->tmpOutStart, sizeToCopy);
 2058|       |
 2059|       |                /* dictionary management */
 2060|  17.1k|                if (dctx->frameInfo.blockMode == LZ4F_blockLinked)
  ------------------
  |  Branch (2060:21): [True: 14.1k, False: 3.07k]
  ------------------
 2061|  14.1k|                    LZ4F_updateDict(dctx, dstPtr, sizeToCopy, dstStart, 1 /*withinTmp*/);
 2062|       |
 2063|  17.1k|                dctx->tmpOutStart += sizeToCopy;
 2064|  17.1k|                dstPtr += sizeToCopy;
 2065|  17.1k|            }
 2066|  17.1k|            if (dctx->tmpOutStart == dctx->tmpOutSize) { /* all flushed */
  ------------------
  |  Branch (2066:17): [True: 16.5k, False: 628]
  ------------------
 2067|  16.5k|                dctx->dStage = dstage_getBlockHeader;  /* get next block */
 2068|  16.5k|                break;
 2069|  16.5k|            }
 2070|       |            /* could not flush everything : stop there, just request a block header */
 2071|    628|            doAnotherStage = 0;
 2072|    628|            nextSrcSizeHint = BHSize;
 2073|    628|            break;
 2074|       |
 2075|    652|        case dstage_getSuffix:
  ------------------
  |  Branch (2075:9): [True: 652, False: 117k]
  ------------------
 2076|    652|            RETURN_ERROR_IF(dctx->frameRemainingSize, frameSize_wrong);   /* incorrect frame size decoded */
  ------------------
  |  |  322|    652|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|    652|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 470, False: 182]
  |  |  ------------------
  |  |  324|    470|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|    470|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|    470|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|    470|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|    470|        }                          \
  |  |  327|    652|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 182]
  |  |  ------------------
  ------------------
 2077|    182|            if (!dctx->frameInfo.contentChecksumFlag) {  /* no checksum, frame is completed */
  ------------------
  |  Branch (2077:17): [True: 8, False: 174]
  ------------------
 2078|      8|                nextSrcSizeHint = 0;
 2079|      8|                LZ4F_resetDecompressionContext(dctx);
 2080|      8|                doAnotherStage = 0;
 2081|      8|                break;
 2082|      8|            }
 2083|    174|            if ((srcEnd - srcPtr) < 4) {  /* not enough size for entire CRC */
  ------------------
  |  Branch (2083:17): [True: 18, False: 156]
  ------------------
 2084|     18|                dctx->tmpInSize = 0;
 2085|     18|                dctx->dStage = dstage_storeSuffix;
 2086|    156|            } else {
 2087|    156|                selectedIn = srcPtr;
 2088|    156|                srcPtr += 4;
 2089|    156|            }
 2090|       |
 2091|    174|            if (dctx->dStage == dstage_storeSuffix)   /* can be skipped */
  ------------------
  |  Branch (2091:17): [True: 18, False: 156]
  ------------------
 2092|     18|        case dstage_storeSuffix:
  ------------------
  |  Branch (2092:9): [True: 0, False: 117k]
  ------------------
 2093|     18|            {   size_t const remainingInput = (size_t)(srcEnd - srcPtr);
 2094|     18|                size_t const wantedData = 4 - dctx->tmpInSize;
 2095|     18|                size_t const sizeToCopy = MIN(wantedData, remainingInput);
  ------------------
  |  |  349|     18|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 0, False: 18]
  |  |  ------------------
  ------------------
 2096|     18|                memcpy(dctx->tmpIn + dctx->tmpInSize, srcPtr, sizeToCopy);
 2097|     18|                srcPtr += sizeToCopy;
 2098|     18|                dctx->tmpInSize += sizeToCopy;
 2099|     18|                if (dctx->tmpInSize < 4) { /* not enough input to read complete suffix */
  ------------------
  |  Branch (2099:21): [True: 18, False: 0]
  ------------------
 2100|     18|                    nextSrcSizeHint = 4 - dctx->tmpInSize;
 2101|     18|                    doAnotherStage=0;
 2102|     18|                    break;
 2103|     18|                }
 2104|      0|                selectedIn = dctx->tmpIn;
 2105|      0|            }   /* if (dctx->dStage == dstage_storeSuffix) */
 2106|       |
 2107|       |        /* case dstage_checkSuffix: */   /* no direct entry, avoid initialization risks */
 2108|    156|            if (!dctx->skipContentChecksum) {
  ------------------
  |  Branch (2108:17): [True: 150, False: 6]
  ------------------
 2109|    150|                U32 const readCRC = LZ4F_readLE32(selectedIn);
 2110|    150|                U32 const resultCRC = XXH32_digest(&(dctx->xxh));
  ------------------
  |  |  133|    150|#  define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
  |  |  ------------------
  |  |  |  |  126|    150|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|    150|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2111|    150|                DEBUGLOG(4, "frame checksum: stored 0x%0X vs 0x%0X processed", readCRC, resultCRC);
  ------------------
  |  |  163|    150|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 2112|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 2113|       |                RETURN_ERROR_IF(readCRC != resultCRC, contentChecksum_invalid);
 2114|       |#else
 2115|    150|                (void)readCRC;
 2116|    150|                (void)resultCRC;
 2117|    150|#endif
 2118|    150|            }
 2119|    156|            nextSrcSizeHint = 0;
 2120|    156|            LZ4F_resetDecompressionContext(dctx);
 2121|    156|            doAnotherStage = 0;
 2122|    156|            break;
 2123|       |
 2124|     96|        case dstage_getSFrameSize:
  ------------------
  |  Branch (2124:9): [True: 96, False: 117k]
  ------------------
 2125|     96|            if ((srcEnd - srcPtr) >= 4) {
  ------------------
  |  Branch (2125:17): [True: 96, False: 0]
  ------------------
 2126|     96|                selectedIn = srcPtr;
 2127|     96|                srcPtr += 4;
 2128|     96|            } else {
 2129|       |                /* not enough input to read cBlockSize field */
 2130|      0|                dctx->tmpInSize = 4;
 2131|      0|                dctx->tmpInTarget = 8;
 2132|      0|                dctx->dStage = dstage_storeSFrameSize;
 2133|      0|            }
 2134|       |
 2135|     96|            if (dctx->dStage == dstage_storeSFrameSize)
  ------------------
  |  Branch (2135:17): [True: 0, False: 96]
  ------------------
 2136|    216|        case dstage_storeSFrameSize:
  ------------------
  |  Branch (2136:9): [True: 216, False: 117k]
  ------------------
 2137|    216|            {   size_t const sizeToCopy = MIN(dctx->tmpInTarget - dctx->tmpInSize,
  ------------------
  |  |  349|    216|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 40, False: 176]
  |  |  ------------------
  ------------------
 2138|    216|                                             (size_t)(srcEnd - srcPtr) );
 2139|    216|                memcpy(dctx->header + dctx->tmpInSize, srcPtr, sizeToCopy);
 2140|    216|                srcPtr += sizeToCopy;
 2141|    216|                dctx->tmpInSize += sizeToCopy;
 2142|    216|                if (dctx->tmpInSize < dctx->tmpInTarget) {
  ------------------
  |  Branch (2142:21): [True: 4, False: 212]
  ------------------
 2143|       |                    /* not enough input to get full sBlockSize; wait for more */
 2144|      4|                    nextSrcSizeHint = dctx->tmpInTarget - dctx->tmpInSize;
 2145|      4|                    doAnotherStage = 0;
 2146|      4|                    break;
 2147|      4|                }
 2148|    212|                selectedIn = dctx->header + 4;
 2149|    212|            }   /* if (dctx->dStage == dstage_storeSFrameSize) */
 2150|       |
 2151|       |        /* case dstage_decodeSFrameSize: */   /* no direct entry */
 2152|    308|            {   size_t const SFrameSize = LZ4F_readLE32(selectedIn);
 2153|    308|                dctx->frameInfo.contentSize = SFrameSize;
 2154|    308|                dctx->tmpInTarget = SFrameSize;
 2155|    308|                dctx->dStage = dstage_skipSkippable;
 2156|    308|                break;
 2157|     96|            }
 2158|       |
 2159|    308|        case dstage_skipSkippable:
  ------------------
  |  Branch (2159:9): [True: 308, False: 117k]
  ------------------
 2160|    308|            {   size_t const skipSize = MIN(dctx->tmpInTarget, (size_t)(srcEnd-srcPtr));
  ------------------
  |  |  349|    308|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 12, False: 296]
  |  |  ------------------
  ------------------
 2161|    308|                srcPtr += skipSize;
 2162|    308|                dctx->tmpInTarget -= skipSize;
 2163|    308|                doAnotherStage = 0;
 2164|    308|                nextSrcSizeHint = dctx->tmpInTarget;
 2165|    308|                if (nextSrcSizeHint) break;  /* still more to skip */
  ------------------
  |  Branch (2165:21): [True: 292, False: 16]
  ------------------
 2166|       |                /* frame fully skipped : prepare context for a new frame */
 2167|     16|                LZ4F_resetDecompressionContext(dctx);
 2168|     16|                break;
 2169|    308|            }
 2170|   117k|        }   /* switch (dctx->dStage) */
 2171|   117k|    }   /* while (doAnotherStage) */
 2172|       |
 2173|       |    /* preserve history within tmpOut whenever necessary */
 2174|  4.28k|    LZ4F_STATIC_ASSERT((unsigned)dstage_init == 2);
  ------------------
  |  |  151|  4.28k|#define LZ4F_STATIC_ASSERT(c)    { enum { LZ4F_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
 2175|  4.28k|    if ( (dctx->frameInfo.blockMode==LZ4F_blockLinked)  /* next block will use up to 64KB from previous ones */
  ------------------
  |  Branch (2175:10): [True: 3.44k, False: 846]
  ------------------
 2176|  3.44k|      && (dctx->dict != dctx->tmpOutBuffer)             /* dictionary is not already within tmp */
  ------------------
  |  Branch (2176:10): [True: 2.01k, False: 1.42k]
  ------------------
 2177|  2.01k|      && (dctx->dict != NULL)                           /* dictionary exists */
  ------------------
  |  Branch (2177:10): [True: 1.69k, False: 324]
  ------------------
 2178|  1.69k|      && (!decompressOptionsPtr->stableDst)             /* cannot rely on dst data to remain there for next call */
  ------------------
  |  Branch (2178:10): [True: 846, False: 846]
  ------------------
 2179|    846|      && ((unsigned)(dctx->dStage)-2 < (unsigned)(dstage_getSuffix)-2) )  /* valid stages : [init ... getSuffix[ */
  ------------------
  |  Branch (2179:10): [True: 767, False: 79]
  ------------------
 2180|    767|    {
 2181|    767|        if (dctx->dStage == dstage_flushOut) {
  ------------------
  |  Branch (2181:13): [True: 135, False: 632]
  ------------------
 2182|    135|            size_t const preserveSize = (size_t)(dctx->tmpOut - dctx->tmpOutBuffer);
 2183|    135|            size_t copySize = 64 KB - dctx->tmpOutSize;
  ------------------
  |  |  240|    135|#  define KB *(1<<10)
  ------------------
 2184|    135|            const BYTE* oldDictEnd = dctx->dict + dctx->dictSize - dctx->tmpOutStart;
 2185|    135|            if (dctx->tmpOutSize > 64 KB) copySize = 0;
  ------------------
  |  |  240|    135|#  define KB *(1<<10)
  ------------------
  |  Branch (2185:17): [True: 39, False: 96]
  ------------------
 2186|    135|            if (copySize > preserveSize) copySize = preserveSize;
  ------------------
  |  Branch (2186:17): [True: 86, False: 49]
  ------------------
 2187|    135|            assert(dctx->tmpOutBuffer != NULL);
  ------------------
  |  Branch (2187:13): [True: 0, False: 135]
  |  Branch (2187:13): [True: 135, False: 0]
  ------------------
 2188|       |
 2189|    135|            memcpy(dctx->tmpOutBuffer + preserveSize - copySize, oldDictEnd - copySize, copySize);
 2190|       |
 2191|    135|            dctx->dict = dctx->tmpOutBuffer;
 2192|    135|            dctx->dictSize = preserveSize + dctx->tmpOutStart;
 2193|    632|        } else {
 2194|    632|            const BYTE* const oldDictEnd = dctx->dict + dctx->dictSize;
 2195|    632|            size_t const newDictSize = MIN(dctx->dictSize, 64 KB);
  ------------------
  |  |  349|    632|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 612, False: 20]
  |  |  ------------------
  ------------------
 2196|       |
 2197|    632|            memcpy(dctx->tmpOutBuffer, oldDictEnd - newDictSize, newDictSize);
 2198|       |
 2199|    632|            dctx->dict = dctx->tmpOutBuffer;
 2200|    632|            dctx->dictSize = newDictSize;
 2201|    632|            dctx->tmpOut = dctx->tmpOutBuffer + newDictSize;
 2202|    632|        }
 2203|    767|    }
 2204|       |
 2205|  4.28k|    *srcSizePtr = (size_t)(srcPtr - srcStart);
 2206|  4.28k|    *dstSizePtr = (size_t)(dstPtr - dstStart);
 2207|  4.28k|    return nextSrcSizeHint;
 2208|  4.28k|}
LZ4F_decompress_usingDict:
 2220|  5.29k|{
 2221|  5.29k|    if (dctx->dStage <= dstage_init) {
  ------------------
  |  Branch (2221:9): [True: 5.29k, False: 0]
  ------------------
 2222|  5.29k|        dctx->dict = (const BYTE*)dict;
 2223|  5.29k|        dctx->dictSize = dictSize;
 2224|  5.29k|    }
 2225|  5.29k|    return LZ4F_decompress(dctx, dstBuffer, dstSizePtr,
 2226|  5.29k|                           srcBuffer, srcSizePtr,
 2227|  5.29k|                           decompressOptionsPtr);
 2228|  5.29k|}
lz4frame.c:LZ4F_returnErrorCode:
  314|  8.76k|{
  315|       |    /* A compilation error here means sizeof(ptrdiff_t) is not large enough */
  316|  8.76k|    LZ4F_STATIC_ASSERT(sizeof(ptrdiff_t) >= sizeof(size_t));
  ------------------
  |  |  151|  8.76k|#define LZ4F_STATIC_ASSERT(c)    { enum { LZ4F_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
  317|  8.76k|    return (LZ4F_errorCode_t)-(ptrdiff_t)code;
  318|  8.76k|}
lz4frame.c:LZ4F_free:
  128|  15.8k|{
  129|  15.8k|    if (p == NULL) return;
  ------------------
  |  Branch (129:9): [True: 6.49k, False: 9.39k]
  ------------------
  130|  9.39k|    if (cmem.customFree != NULL) {
  ------------------
  |  Branch (130:9): [True: 0, False: 9.39k]
  ------------------
  131|       |        /* custom allocation defined : use it */
  132|      0|        cmem.customFree(cmem.opaqueState, p);
  133|      0|        return;
  134|      0|    }
  135|       |    /* nothing defined : use default <stdlib.h>'s free() */
  136|  9.39k|    FREEMEM(p);
  ------------------
  |  |   98|  9.39k|#  define FREEMEM(p)        free(p)
  ------------------
  137|  9.39k|}
lz4frame.c:LZ4F_malloc:
  118|  6.15k|{
  119|       |    /* custom malloc defined : use it */
  120|  6.15k|    if (cmem.customAlloc != NULL) {
  ------------------
  |  Branch (120:9): [True: 0, False: 6.15k]
  ------------------
  121|      0|        return cmem.customAlloc(cmem.opaqueState, s);
  122|      0|    }
  123|       |    /* nothing defined : use default <stdlib.h>'s malloc() */
  124|  6.15k|    return ALLOC(s);
  ------------------
  |  |   96|  6.15k|#  define ALLOC(s)          malloc(s)
  ------------------
  125|  6.15k|}
lz4frame.c:LZ4F_calloc:
  102|  3.24k|{
  103|       |    /* custom calloc defined : use it */
  104|  3.24k|    if (cmem.customCalloc != NULL) {
  ------------------
  |  Branch (104:9): [True: 0, False: 3.24k]
  ------------------
  105|      0|        return cmem.customCalloc(cmem.opaqueState, s);
  106|      0|    }
  107|       |    /* nothing defined : use default <stdlib.h>'s calloc() */
  108|  3.24k|    if (cmem.customAlloc == NULL) {
  ------------------
  |  Branch (108:9): [True: 3.24k, False: 0]
  ------------------
  109|  3.24k|        return ALLOC_AND_ZERO(s);
  ------------------
  |  |   97|  3.24k|#  define ALLOC_AND_ZERO(s) calloc(1,(s))
  ------------------
  110|  3.24k|    }
  111|       |    /* only custom alloc defined : use it, and combine it with memset() */
  112|      0|    {   void* const p = cmem.customAlloc(cmem.opaqueState, s);
  113|      0|        if (p != NULL) MEM_INIT(p, 0, s);
  ------------------
  |  |   91|      0|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
  |  Branch (113:13): [True: 0, False: 0]
  ------------------
  114|      0|        return p;
  115|  3.24k|}   }
lz4frame.c:LZ4F_readLE32:
  190|  76.6k|{
  191|  76.6k|    const BYTE* const srcPtr = (const BYTE*)src;
  192|  76.6k|    U32 value32 = srcPtr[0];
  193|  76.6k|    value32 |= ((U32)srcPtr[1])<< 8;
  194|  76.6k|    value32 |= ((U32)srcPtr[2])<<16;
  195|  76.6k|    value32 |= ((U32)srcPtr[3])<<24;
  196|  76.6k|    return value32;
  197|  76.6k|}
lz4frame.c:LZ4F_decodeHeader:
 1425|  13.0k|{
 1426|  13.0k|    unsigned blockMode, blockChecksumFlag, contentSizeFlag, contentChecksumFlag, dictIDFlag, blockSizeID;
 1427|  13.0k|    size_t frameHeaderSize;
 1428|  13.0k|    const BYTE* srcPtr = (const BYTE*)src;
 1429|       |
 1430|  13.0k|    DEBUGLOG(5, "LZ4F_decodeHeader");
  ------------------
  |  |  163|  13.0k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1431|       |    /* need to decode header to get frameInfo */
 1432|  13.0k|    RETURN_ERROR_IF(srcSize < minFHSize, frameHeader_incomplete);   /* minimal frame header size */
  ------------------
  |  |  322|  13.0k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  13.0k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 13.0k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  13.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 13.0k]
  |  |  ------------------
  ------------------
 1433|  13.0k|    MEM_INIT(&(dctx->frameInfo), 0, sizeof(dctx->frameInfo));
  ------------------
  |  |   91|  13.0k|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
 1434|       |
 1435|       |    /* special case : skippable frames */
 1436|  13.0k|    if ((LZ4F_readLE32(srcPtr) & 0xFFFFFFF0U) == LZ4F_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  418|  13.0k|#define LZ4F_MAGIC_SKIPPABLE_START 0x184D2A50U
  ------------------
  |  Branch (1436:9): [True: 312, False: 12.7k]
  ------------------
 1437|    312|        dctx->frameInfo.frameType = LZ4F_skippableFrame;
 1438|    312|        if (src == (void*)(dctx->header)) {
  ------------------
  |  Branch (1438:13): [True: 216, False: 96]
  ------------------
 1439|    216|            dctx->tmpInSize = srcSize;
 1440|    216|            dctx->tmpInTarget = 8;
 1441|    216|            dctx->dStage = dstage_storeSFrameSize;
 1442|    216|            return srcSize;
 1443|    216|        } else {
 1444|     96|            dctx->dStage = dstage_getSFrameSize;
 1445|     96|            return 4;
 1446|     96|    }   }
 1447|       |
 1448|       |    /* control magic number */
 1449|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 1450|       |    if (LZ4F_readLE32(srcPtr) != LZ4F_MAGICNUMBER) {
 1451|       |        DEBUGLOG(4, "frame header error : unknown magic number");
 1452|       |        RETURN_ERROR(frameType_unknown);
 1453|       |    }
 1454|       |#endif
 1455|  12.7k|    dctx->frameInfo.frameType = LZ4F_frame;
 1456|       |
 1457|       |    /* Flags */
 1458|  12.7k|    {   U32 const FLG = srcPtr[4];
 1459|  12.7k|        U32 const version = (FLG>>6) & _2BITS;
  ------------------
  |  |  246|  12.7k|#define _2BITS 0x03
  ------------------
 1460|  12.7k|        blockChecksumFlag = (FLG>>4) & _1BIT;
  ------------------
  |  |  245|  12.7k|#define _1BIT  0x01
  ------------------
 1461|  12.7k|        blockMode = (FLG>>5) & _1BIT;
  ------------------
  |  |  245|  12.7k|#define _1BIT  0x01
  ------------------
 1462|  12.7k|        contentSizeFlag = (FLG>>3) & _1BIT;
  ------------------
  |  |  245|  12.7k|#define _1BIT  0x01
  ------------------
 1463|  12.7k|        contentChecksumFlag = (FLG>>2) & _1BIT;
  ------------------
  |  |  245|  12.7k|#define _1BIT  0x01
  ------------------
 1464|  12.7k|        dictIDFlag = FLG & _1BIT;
  ------------------
  |  |  245|  12.7k|#define _1BIT  0x01
  ------------------
 1465|       |        /* validate */
 1466|  12.7k|        if (((FLG>>1)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set); /* Reserved bit */
  ------------------
  |  |  245|  12.7k|#define _1BIT  0x01
  ------------------
                      if (((FLG>>1)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set); /* Reserved bit */
  ------------------
  |  |  320|     84|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (1466:13): [True: 84, False: 12.6k]
  ------------------
 1467|  12.6k|        if (version != 1) RETURN_ERROR(headerVersion_wrong);       /* Version Number, only supported value */
  ------------------
  |  |  320|    136|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (1467:13): [True: 136, False: 12.5k]
  ------------------
 1468|  12.6k|    }
 1469|  12.5k|    DEBUGLOG(6, "contentSizeFlag: %u", contentSizeFlag);
  ------------------
  |  |  163|  12.5k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1470|       |
 1471|       |    /* Frame Header Size */
 1472|  12.5k|    frameHeaderSize = minFHSize + (contentSizeFlag?8:0) + (dictIDFlag?4:0);
  ------------------
  |  Branch (1472:36): [True: 2.71k, False: 9.80k]
  |  Branch (1472:60): [True: 1.14k, False: 11.3k]
  ------------------
 1473|       |
 1474|  12.5k|    if (srcSize < frameHeaderSize) {
  ------------------
  |  Branch (1474:9): [True: 64, False: 12.4k]
  ------------------
 1475|       |        /* not enough input to fully decode frame header */
 1476|     64|        if (srcPtr != dctx->header)
  ------------------
  |  Branch (1476:13): [True: 0, False: 64]
  ------------------
 1477|      0|            memcpy(dctx->header, srcPtr, srcSize);
 1478|     64|        dctx->tmpInSize = srcSize;
 1479|     64|        dctx->tmpInTarget = frameHeaderSize;
 1480|     64|        dctx->dStage = dstage_storeFrameHeader;
 1481|     64|        return srcSize;
 1482|     64|    }
 1483|       |
 1484|  12.4k|    {   U32 const BD = srcPtr[5];
 1485|  12.4k|        blockSizeID = (BD>>4) & _3BITS;
  ------------------
  |  |  247|  12.4k|#define _3BITS 0x07
  ------------------
 1486|       |        /* validate */
 1487|  12.4k|        if (((BD>>7)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set);   /* Reserved bit */
  ------------------
  |  |  245|  12.4k|#define _1BIT  0x01
  ------------------
                      if (((BD>>7)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set);   /* Reserved bit */
  ------------------
  |  |  320|     68|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (1487:13): [True: 68, False: 12.3k]
  ------------------
 1488|  12.3k|        if (blockSizeID < 4) RETURN_ERROR(maxBlockSize_invalid);    /* 4-7 only supported values for the time being */
  ------------------
  |  |  320|     52|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (1488:13): [True: 52, False: 12.3k]
  ------------------
 1489|  12.3k|        if (((BD>>0)&_4BITS) != 0) RETURN_ERROR(reservedFlag_set);  /* Reserved bits */
  ------------------
  |  |  248|  12.3k|#define _4BITS 0x0F
  ------------------
                      if (((BD>>0)&_4BITS) != 0) RETURN_ERROR(reservedFlag_set);  /* Reserved bits */
  ------------------
  |  |  320|     36|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (1489:13): [True: 36, False: 12.3k]
  ------------------
 1490|  12.3k|    }
 1491|       |
 1492|       |    /* check header */
 1493|  12.3k|    assert(frameHeaderSize > 5);
  ------------------
  |  Branch (1493:5): [True: 0, False: 12.3k]
  |  Branch (1493:5): [True: 12.3k, False: 0]
  ------------------
 1494|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 1495|       |    {   BYTE const HC = LZ4F_headerChecksum(srcPtr+4, frameHeaderSize-5);
 1496|       |        RETURN_ERROR_IF(HC != srcPtr[frameHeaderSize-1], headerChecksum_invalid);
 1497|       |    }
 1498|       |#endif
 1499|       |
 1500|       |    /* save */
 1501|  12.3k|    dctx->frameInfo.blockMode = (LZ4F_blockMode_t)blockMode;
 1502|  12.3k|    dctx->frameInfo.blockChecksumFlag = (LZ4F_blockChecksum_t)blockChecksumFlag;
 1503|  12.3k|    dctx->frameInfo.contentChecksumFlag = (LZ4F_contentChecksum_t)contentChecksumFlag;
 1504|  12.3k|    dctx->frameInfo.blockSizeID = (LZ4F_blockSizeID_t)blockSizeID;
 1505|  12.3k|    dctx->maxBlockSize = LZ4F_getBlockSize((LZ4F_blockSizeID_t)blockSizeID);
 1506|  12.3k|    if (contentSizeFlag) {
  ------------------
  |  Branch (1506:9): [True: 2.67k, False: 9.62k]
  ------------------
 1507|  2.67k|        dctx->frameRemainingSize = dctx->frameInfo.contentSize = LZ4F_readLE64(srcPtr+6);
 1508|  2.67k|    }
 1509|  12.3k|    if (dictIDFlag)
  ------------------
  |  Branch (1509:9): [True: 1.10k, False: 11.1k]
  ------------------
 1510|  1.10k|        dctx->frameInfo.dictID = LZ4F_readLE32(srcPtr + frameHeaderSize - 5);
 1511|       |
 1512|  12.3k|    dctx->dStage = dstage_init;
 1513|       |
 1514|  12.3k|    return frameHeaderSize;
 1515|  12.3k|}
lz4frame.c:LZ4F_readLE64:
  209|  2.67k|{
  210|  2.67k|    const BYTE* const srcPtr = (const BYTE*)src;
  211|  2.67k|    U64 value64 = srcPtr[0];
  212|  2.67k|    value64 |= ((U64)srcPtr[1]<<8);
  213|  2.67k|    value64 |= ((U64)srcPtr[2]<<16);
  214|  2.67k|    value64 |= ((U64)srcPtr[3]<<24);
  215|  2.67k|    value64 |= ((U64)srcPtr[4]<<32);
  216|  2.67k|    value64 |= ((U64)srcPtr[5]<<40);
  217|  2.67k|    value64 |= ((U64)srcPtr[6]<<48);
  218|  2.67k|    value64 |= ((U64)srcPtr[7]<<56);
  219|  2.67k|    return value64;
  220|  2.67k|}
lz4frame.c:LZ4F_updateDict:
 1612|  31.4k|{
 1613|  31.4k|    assert(dstPtr != NULL);
  ------------------
  |  Branch (1613:5): [True: 0, False: 31.4k]
  |  Branch (1613:5): [True: 31.4k, False: 0]
  ------------------
 1614|  31.4k|    if (dctx->dictSize==0) dctx->dict = (const BYTE*)dstPtr;  /* will lead to prefix mode */
  ------------------
  |  Branch (1614:9): [True: 6.16k, False: 25.2k]
  ------------------
 1615|  31.4k|    assert(dctx->dict != NULL);
  ------------------
  |  Branch (1615:5): [True: 0, False: 31.4k]
  |  Branch (1615:5): [True: 31.4k, False: 0]
  ------------------
 1616|       |
 1617|  31.4k|    if (dctx->dict + dctx->dictSize == dstPtr) {  /* prefix mode, everything within dstBuffer */
  ------------------
  |  Branch (1617:9): [True: 17.2k, False: 14.2k]
  ------------------
 1618|  17.2k|        dctx->dictSize += dstSize;
 1619|  17.2k|        return;
 1620|  17.2k|    }
 1621|       |
 1622|  31.4k|    assert(dstPtr >= dstBufferStart);
  ------------------
  |  Branch (1622:5): [True: 0, False: 14.2k]
  |  Branch (1622:5): [True: 14.2k, False: 0]
  ------------------
 1623|  14.2k|    if ((size_t)(dstPtr - dstBufferStart) + dstSize >= 64 KB) {  /* history in dstBuffer becomes large enough to become dictionary */
  ------------------
  |  |  240|  14.2k|#  define KB *(1<<10)
  ------------------
  |  Branch (1623:9): [True: 90, False: 14.1k]
  ------------------
 1624|     90|        dctx->dict = (const BYTE*)dstBufferStart;
 1625|     90|        dctx->dictSize = (size_t)(dstPtr - dstBufferStart) + dstSize;
 1626|     90|        return;
 1627|     90|    }
 1628|       |
 1629|  14.2k|    assert(dstSize < 64 KB);   /* if dstSize >= 64 KB, dictionary would be set into dstBuffer directly */
  ------------------
  |  Branch (1629:5): [True: 0, False: 14.1k]
  |  Branch (1629:5): [True: 14.1k, False: 0]
  ------------------
 1630|       |
 1631|       |    /* dstBuffer does not contain whole useful history (64 KB), so it must be saved within tmpOutBuffer */
 1632|  14.1k|    assert(dctx->tmpOutBuffer != NULL);
  ------------------
  |  Branch (1632:5): [True: 0, False: 14.1k]
  |  Branch (1632:5): [True: 14.1k, False: 0]
  ------------------
 1633|       |
 1634|  14.1k|    if (withinTmp && (dctx->dict == dctx->tmpOutBuffer)) {   /* continue history within tmpOutBuffer */
  ------------------
  |  Branch (1634:9): [True: 6.41k, False: 7.71k]
  |  Branch (1634:22): [True: 5.45k, False: 962]
  ------------------
 1635|       |        /* withinTmp expectation : content of [dstPtr,dstSize] is same as [dict+dictSize,dstSize], so we just extend it */
 1636|  5.45k|        assert(dctx->dict + dctx->dictSize == dctx->tmpOut + dctx->tmpOutStart);
  ------------------
  |  Branch (1636:9): [True: 0, False: 5.45k]
  |  Branch (1636:9): [True: 5.45k, False: 0]
  ------------------
 1637|  5.45k|        dctx->dictSize += dstSize;
 1638|  5.45k|        return;
 1639|  5.45k|    }
 1640|       |
 1641|  8.67k|    if (withinTmp) { /* copy relevant dict portion in front of tmpOut within tmpOutBuffer */
  ------------------
  |  Branch (1641:9): [True: 962, False: 7.71k]
  ------------------
 1642|    962|        size_t const preserveSize = (size_t)(dctx->tmpOut - dctx->tmpOutBuffer);
 1643|    962|        size_t copySize = 64 KB - dctx->tmpOutSize;
  ------------------
  |  |  240|    962|#  define KB *(1<<10)
  ------------------
 1644|    962|        const BYTE* const oldDictEnd = dctx->dict + dctx->dictSize - dctx->tmpOutStart;
 1645|    962|        if (dctx->tmpOutSize > 64 KB) copySize = 0;
  ------------------
  |  |  240|    962|#  define KB *(1<<10)
  ------------------
  |  Branch (1645:13): [True: 10, False: 952]
  ------------------
 1646|    962|        if (copySize > preserveSize) copySize = preserveSize;
  ------------------
  |  Branch (1646:13): [True: 628, False: 334]
  ------------------
 1647|       |
 1648|    962|        memcpy(dctx->tmpOutBuffer + preserveSize - copySize, oldDictEnd - copySize, copySize);
 1649|       |
 1650|    962|        dctx->dict = dctx->tmpOutBuffer;
 1651|    962|        dctx->dictSize = preserveSize + dctx->tmpOutStart + dstSize;
 1652|    962|        return;
 1653|    962|    }
 1654|       |
 1655|  7.71k|    if (dctx->dict == dctx->tmpOutBuffer) {    /* copy dst into tmp to complete dict */
  ------------------
  |  Branch (1655:9): [True: 5.24k, False: 2.46k]
  ------------------
 1656|  5.24k|        if (dctx->dictSize + dstSize > dctx->tmpOutBufferCapacity) {  /* tmp buffer not large enough */
  ------------------
  |  Branch (1656:13): [True: 0, False: 5.24k]
  ------------------
 1657|      0|            size_t const preserveSize = 64 KB - dstSize;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 1658|      0|            memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - preserveSize, preserveSize);
 1659|      0|            dctx->dictSize = preserveSize;
 1660|      0|        }
 1661|  5.24k|        memcpy(dctx->tmpOutBuffer + dctx->dictSize, dstPtr, dstSize);
 1662|  5.24k|        dctx->dictSize += dstSize;
 1663|  5.24k|        return;
 1664|  5.24k|    }
 1665|       |
 1666|       |    /* join dict & dest into tmp */
 1667|  2.46k|    {   size_t preserveSize = 64 KB - dstSize;
  ------------------
  |  |  240|  2.46k|#  define KB *(1<<10)
  ------------------
 1668|  2.46k|        if (preserveSize > dctx->dictSize) preserveSize = dctx->dictSize;
  ------------------
  |  Branch (1668:13): [True: 1.78k, False: 686]
  ------------------
 1669|  2.46k|        memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - preserveSize, preserveSize);
 1670|  2.46k|        memcpy(dctx->tmpOutBuffer + preserveSize, dstPtr, dstSize);
 1671|  2.46k|        dctx->dict = dctx->tmpOutBuffer;
 1672|  2.46k|        dctx->dictSize = preserveSize + dstSize;
 1673|  2.46k|    }
 1674|  2.46k|}

LZ4_XXH32:
  393|  7.17k|{
  394|       |#if 0
  395|       |    /* Simple version, good for code maintenance, but unfortunately slow for small inputs */
  396|       |    XXH32_state_t state;
  397|       |    XXH32_reset(&state, seed);
  398|       |    XXH32_update(&state, input, len);
  399|       |    return XXH32_digest(&state);
  400|       |#else
  401|  7.17k|    XXH_endianness endian_detected = (XXH_endianness)XXH_CPU_LITTLE_ENDIAN;
  ------------------
  |  |  225|  7.17k|#   define XXH_CPU_LITTLE_ENDIAN   XXH_isLittleEndian()
  ------------------
  402|       |
  403|  7.17k|    if (XXH_FORCE_ALIGN_CHECK) {
  ------------------
  |  |   95|  7.17k|#    define XXH_FORCE_ALIGN_CHECK 0
  |  |  ------------------
  |  |  |  Branch (95:35): [Folded, False: 7.17k]
  |  |  ------------------
  ------------------
  404|      0|        if ((((size_t)input) & 3) == 0) {   /* Input is 4-bytes aligned, leverage the speed benefit */
  ------------------
  |  Branch (404:13): [True: 0, False: 0]
  ------------------
  405|      0|            if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
  ------------------
  |  |   83|      0|#  define XXH_FORCE_NATIVE_FORMAT 0
  |  |  ------------------
  |  |  |  Branch (83:35): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (405:17): [True: 0, False: 0]
  ------------------
  406|      0|                return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned);
  407|      0|            else
  408|      0|                return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned);
  409|      0|    }   }
  410|       |
  411|  7.17k|    if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
  ------------------
  |  |   83|      0|#  define XXH_FORCE_NATIVE_FORMAT 0
  |  |  ------------------
  |  |  |  Branch (83:35): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (411:9): [True: 7.17k, False: 0]
  ------------------
  412|  7.17k|        return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned);
  413|      0|    else
  414|      0|        return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned);
  415|  7.17k|#endif
  416|  7.17k|}
LZ4_XXH32_reset:
  438|  17.8k|{
  439|  17.8k|    XXH32_state_t state;   /* using a local state to memcpy() in order to avoid strict-aliasing warnings */
  440|  17.8k|    memset(&state, 0, sizeof(state));
  441|  17.8k|    state.v1 = seed + PRIME32_1 + PRIME32_2;
  442|  17.8k|    state.v2 = seed + PRIME32_2;
  443|  17.8k|    state.v3 = seed + 0;
  444|  17.8k|    state.v4 = seed - PRIME32_1;
  445|       |    /* do not write into reserved, planned to be removed in a future version */
  446|  17.8k|    memcpy(statePtr, &state, sizeof(state) - sizeof(state.reserved));
  447|  17.8k|    return XXH_OK;
  448|  17.8k|}
LZ4_XXH32_update:
  516|  29.2k|{
  517|  29.2k|    XXH_endianness endian_detected = (XXH_endianness)XXH_CPU_LITTLE_ENDIAN;
  ------------------
  |  |  225|  29.2k|#   define XXH_CPU_LITTLE_ENDIAN   XXH_isLittleEndian()
  ------------------
  518|       |
  519|  29.2k|    if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
  ------------------
  |  |   83|      0|#  define XXH_FORCE_NATIVE_FORMAT 0
  |  |  ------------------
  |  |  |  Branch (83:35): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (519:9): [True: 29.2k, False: 0]
  ------------------
  520|  29.2k|        return XXH32_update_endian(state_in, input, len, XXH_littleEndian);
  521|      0|    else
  522|      0|        return XXH32_update_endian(state_in, input, len, XXH_bigEndian);
  523|  29.2k|}
LZ4_XXH32_digest:
  547|  8.38k|{
  548|  8.38k|    XXH_endianness endian_detected = (XXH_endianness)XXH_CPU_LITTLE_ENDIAN;
  ------------------
  |  |  225|  8.38k|#   define XXH_CPU_LITTLE_ENDIAN   XXH_isLittleEndian()
  ------------------
  549|       |
  550|  8.38k|    if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
  ------------------
  |  |   83|      0|#  define XXH_FORCE_NATIVE_FORMAT 0
  |  |  ------------------
  |  |  |  Branch (83:35): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (550:9): [True: 8.38k, False: 0]
  ------------------
  551|  8.38k|        return XXH32_digest_endian(state_in, XXH_littleEndian);
  552|      0|    else
  553|      0|        return XXH32_digest_endian(state_in, XXH_bigEndian);
  554|  8.38k|}
xxhash.c:XXH_isLittleEndian:
  221|  44.8k|{
  222|  44.8k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  223|  44.8k|    return one.c[0];
  224|  44.8k|}
xxhash.c:XXH32_endian_align:
  354|  7.17k|{
  355|  7.17k|    const BYTE* p = (const BYTE*)input;
  356|  7.17k|    const BYTE* bEnd = p + len;
  357|  7.17k|    U32 h32;
  358|       |
  359|       |#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1)
  360|       |    if (p==NULL) {
  361|       |        len=0;
  362|       |        bEnd=p=(const BYTE*)(size_t)16;
  363|       |    }
  364|       |#endif
  365|       |
  366|  7.17k|    if (len>=16) {
  ------------------
  |  Branch (366:9): [True: 3.62k, False: 3.55k]
  ------------------
  367|  3.62k|        const BYTE* const limit = bEnd - 15;
  368|  3.62k|        U32 v1 = seed + PRIME32_1 + PRIME32_2;
  369|  3.62k|        U32 v2 = seed + PRIME32_2;
  370|  3.62k|        U32 v3 = seed + 0;
  371|  3.62k|        U32 v4 = seed - PRIME32_1;
  372|       |
  373|  10.0M|        do {
  374|  10.0M|            v1 = XXH32_round(v1, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  288|  10.0M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  375|  10.0M|            v2 = XXH32_round(v2, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  288|  10.0M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  376|  10.0M|            v3 = XXH32_round(v3, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  288|  10.0M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  377|  10.0M|            v4 = XXH32_round(v4, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  288|  10.0M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  378|  10.0M|        } while (p < limit);
  ------------------
  |  Branch (378:18): [True: 10.0M, False: 3.62k]
  ------------------
  379|       |
  380|  3.62k|        h32 = XXH_rotl32(v1, 1)  + XXH_rotl32(v2, 7)
  ------------------
  |  |  194|  3.62k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
                      h32 = XXH_rotl32(v1, 1)  + XXH_rotl32(v2, 7)
  ------------------
  |  |  194|  3.62k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  381|  3.62k|            + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18);
  ------------------
  |  |  194|  3.62k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
                          + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18);
  ------------------
  |  |  194|  3.62k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  382|  3.62k|    } else {
  383|  3.55k|        h32  = seed + PRIME32_5;
  384|  3.55k|    }
  385|       |
  386|  7.17k|    h32 += (U32)len;
  387|       |
  388|  7.17k|    return XXH32_finalize(h32, p, len&15, endian, align);
  389|  7.17k|}
xxhash.c:XXH32_round:
  270|  93.2M|{
  271|  93.2M|    seed += input * PRIME32_2;
  272|  93.2M|    seed  = XXH_rotl32(seed, 13);
  ------------------
  |  |  194|  93.2M|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  273|  93.2M|    seed *= PRIME32_1;
  274|  93.2M|    return seed;
  275|  93.2M|}
xxhash.c:XXH_readLE32_align:
  235|  93.2M|{
  236|  93.2M|    if (align==XXH_unaligned)
  ------------------
  |  Branch (236:9): [True: 93.2M, False: 10.1k]
  ------------------
  237|  93.2M|        return endian==XXH_littleEndian ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr));
  ------------------
  |  Branch (237:16): [True: 93.2M, False: 0]
  ------------------
  238|  10.1k|    else
  239|  10.1k|        return endian==XXH_littleEndian ? *(const U32*)ptr : XXH_swap32(*(const U32*)ptr);
  ------------------
  |  Branch (239:16): [True: 10.1k, False: 0]
  ------------------
  240|  93.2M|}
xxhash.c:XXH_read32:
  175|  93.2M|{
  176|  93.2M|    U32 val;
  177|  93.2M|    memcpy(&val, memPtr, sizeof(val));
  178|  93.2M|    return val;
  179|  93.2M|}
xxhash.c:XXH32_finalize:
  294|  15.5k|{
  295|  15.5k|    const BYTE* p = (const BYTE*)ptr;
  296|       |
  297|  15.5k|#define PROCESS1               \
  298|  15.5k|    h32 += (*p++) * PRIME32_5; \
  299|  15.5k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  300|       |
  301|  15.5k|#define PROCESS4                         \
  302|  15.5k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  303|  15.5k|    p+=4;                                \
  304|  15.5k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  305|       |
  306|  15.5k|    switch(len&15)  /* or switch(bEnd - p) */
  ------------------
  |  Branch (306:12): [True: 15.5k, False: 0]
  ------------------
  307|  15.5k|    {
  308|  1.15k|      case 12:      PROCESS4;
  ------------------
  |  |  302|  1.15k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  1.15k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  1.15k|    p+=4;                                \
  |  |  304|  1.15k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  1.15k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (308:7): [True: 1.15k, False: 14.4k]
  ------------------
  309|       |                    /* fallthrough */
  310|  1.50k|      case 8:       PROCESS4;
  ------------------
  |  |  302|  1.50k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  1.50k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  1.50k|    p+=4;                                \
  |  |  304|  1.50k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  1.50k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (310:7): [True: 348, False: 15.2k]
  ------------------
  311|       |                    /* fallthrough */
  312|  4.91k|      case 4:       PROCESS4;
  ------------------
  |  |  302|  4.91k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  4.91k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  4.91k|    p+=4;                                \
  |  |  304|  4.91k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  4.91k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (312:7): [True: 3.40k, False: 12.1k]
  ------------------
  313|  4.91k|                    return XXH32_avalanche(h32);
  314|       |
  315|    280|      case 13:      PROCESS4;
  ------------------
  |  |  302|    280|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|    280|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|    280|    p+=4;                                \
  |  |  304|    280|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|    280|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (315:7): [True: 280, False: 15.2k]
  ------------------
  316|       |                    /* fallthrough */
  317|  1.01k|      case 9:       PROCESS4;
  ------------------
  |  |  302|  1.01k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  1.01k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  1.01k|    p+=4;                                \
  |  |  304|  1.01k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  1.01k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (317:7): [True: 734, False: 14.8k]
  ------------------
  318|       |                    /* fallthrough */
  319|  1.74k|      case 5:       PROCESS4;
  ------------------
  |  |  302|  1.74k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  1.74k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  1.74k|    p+=4;                                \
  |  |  304|  1.74k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  1.74k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (319:7): [True: 726, False: 14.8k]
  ------------------
  320|  1.74k|                    PROCESS1;
  ------------------
  |  |  298|  1.74k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  1.74k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  1.74k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  321|  1.74k|                    return XXH32_avalanche(h32);
  322|       |
  323|    646|      case 14:      PROCESS4;
  ------------------
  |  |  302|    646|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|    646|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|    646|    p+=4;                                \
  |  |  304|    646|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|    646|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (323:7): [True: 646, False: 14.9k]
  ------------------
  324|       |                    /* fallthrough */
  325|    876|      case 10:      PROCESS4;
  ------------------
  |  |  302|    876|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|    876|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|    876|    p+=4;                                \
  |  |  304|    876|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|    876|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (325:7): [True: 230, False: 15.3k]
  ------------------
  326|       |                    /* fallthrough */
  327|  1.63k|      case 6:       PROCESS4;
  ------------------
  |  |  302|  1.63k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  1.63k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  1.63k|    p+=4;                                \
  |  |  304|  1.63k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  1.63k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (327:7): [True: 758, False: 14.8k]
  ------------------
  328|  1.63k|                    PROCESS1;
  ------------------
  |  |  298|  1.63k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  1.63k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  1.63k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  329|  1.63k|                    PROCESS1;
  ------------------
  |  |  298|  1.63k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  1.63k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  1.63k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  330|  1.63k|                    return XXH32_avalanche(h32);
  331|       |
  332|    706|      case 15:      PROCESS4;
  ------------------
  |  |  302|    706|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|    706|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|    706|    p+=4;                                \
  |  |  304|    706|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|    706|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (332:7): [True: 706, False: 14.8k]
  ------------------
  333|       |                    /* fallthrough */
  334|  1.41k|      case 11:      PROCESS4;
  ------------------
  |  |  302|  1.41k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  1.41k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  1.41k|    p+=4;                                \
  |  |  304|  1.41k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  1.41k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (334:7): [True: 712, False: 14.8k]
  ------------------
  335|       |                    /* fallthrough */
  336|  2.02k|      case 7:       PROCESS4;
  ------------------
  |  |  302|  2.02k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  2.02k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  2.02k|    p+=4;                                \
  |  |  304|  2.02k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  2.02k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (336:7): [True: 604, False: 14.9k]
  ------------------
  337|       |                    /* fallthrough */
  338|  2.65k|      case 3:       PROCESS1;
  ------------------
  |  |  298|  2.65k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  2.65k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  2.65k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (338:7): [True: 628, False: 14.9k]
  ------------------
  339|       |                    /* fallthrough */
  340|  3.32k|      case 2:       PROCESS1;
  ------------------
  |  |  298|  3.32k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  3.32k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  3.32k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (340:7): [True: 676, False: 14.8k]
  ------------------
  341|       |                    /* fallthrough */
  342|  5.89k|      case 1:       PROCESS1;
  ------------------
  |  |  298|  5.89k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  5.89k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  5.89k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (342:7): [True: 2.56k, False: 12.9k]
  ------------------
  343|       |                    /* fallthrough */
  344|  7.27k|      case 0:       return XXH32_avalanche(h32);
  ------------------
  |  Branch (344:7): [True: 1.38k, False: 14.1k]
  ------------------
  345|  15.5k|    }
  346|  15.5k|    assert(0);
  ------------------
  |  Branch (346:5): [Folded, False: 0]
  |  Branch (346:5): [Folded, False: 0]
  ------------------
  347|      0|    return h32;   /* reaching this point is deemed impossible */
  348|      0|}
xxhash.c:XXH32_avalanche:
  279|  15.5k|{
  280|  15.5k|    h32 ^= h32 >> 15;
  281|  15.5k|    h32 *= PRIME32_2;
  282|  15.5k|    h32 ^= h32 >> 13;
  283|  15.5k|    h32 *= PRIME32_3;
  284|  15.5k|    h32 ^= h32 >> 16;
  285|  15.5k|    return(h32);
  286|  15.5k|}
xxhash.c:XXH32_update_endian:
  453|  29.2k|{
  454|  29.2k|    if (input==NULL)
  ------------------
  |  Branch (454:9): [True: 0, False: 29.2k]
  ------------------
  455|       |#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1)
  456|       |        return XXH_OK;
  457|       |#else
  458|      0|        return XXH_ERROR;
  459|  29.2k|#endif
  460|       |
  461|  29.2k|    {   const BYTE* p = (const BYTE*)input;
  462|  29.2k|        const BYTE* const bEnd = p + len;
  463|       |
  464|  29.2k|        state->total_len_32 += (unsigned)len;
  465|  29.2k|        state->large_len |= (len>=16) | (state->total_len_32>=16);
  466|       |
  467|  29.2k|        if (state->memsize + len < 16)  {   /* fill in tmp buffer */
  ------------------
  |  Branch (467:13): [True: 17.1k, False: 12.0k]
  ------------------
  468|  17.1k|            XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, len);
  469|  17.1k|            state->memsize += (unsigned)len;
  470|  17.1k|            return XXH_OK;
  471|  17.1k|        }
  472|       |
  473|  12.0k|        if (state->memsize) {   /* some data left from previous update */
  ------------------
  |  Branch (473:13): [True: 9.75k, False: 2.32k]
  ------------------
  474|  9.75k|            XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, 16-state->memsize);
  475|  9.75k|            {   const U32* p32 = state->mem32;
  476|  9.75k|                state->v1 = XXH32_round(state->v1, XXH_readLE32(p32, endian)); p32++;
  477|  9.75k|                state->v2 = XXH32_round(state->v2, XXH_readLE32(p32, endian)); p32++;
  478|  9.75k|                state->v3 = XXH32_round(state->v3, XXH_readLE32(p32, endian)); p32++;
  479|  9.75k|                state->v4 = XXH32_round(state->v4, XXH_readLE32(p32, endian));
  480|  9.75k|            }
  481|  9.75k|            p += 16-state->memsize;
  482|  9.75k|            state->memsize = 0;
  483|  9.75k|        }
  484|       |
  485|  12.0k|        if (p <= bEnd-16) {
  ------------------
  |  Branch (485:13): [True: 4.54k, False: 7.53k]
  ------------------
  486|  4.54k|            const BYTE* const limit = bEnd - 16;
  487|  4.54k|            U32 v1 = state->v1;
  488|  4.54k|            U32 v2 = state->v2;
  489|  4.54k|            U32 v3 = state->v3;
  490|  4.54k|            U32 v4 = state->v4;
  491|       |
  492|  13.2M|            do {
  493|  13.2M|                v1 = XXH32_round(v1, XXH_readLE32(p, endian)); p+=4;
  494|  13.2M|                v2 = XXH32_round(v2, XXH_readLE32(p, endian)); p+=4;
  495|  13.2M|                v3 = XXH32_round(v3, XXH_readLE32(p, endian)); p+=4;
  496|  13.2M|                v4 = XXH32_round(v4, XXH_readLE32(p, endian)); p+=4;
  497|  13.2M|            } while (p<=limit);
  ------------------
  |  Branch (497:22): [True: 13.2M, False: 4.54k]
  ------------------
  498|       |
  499|  4.54k|            state->v1 = v1;
  500|  4.54k|            state->v2 = v2;
  501|  4.54k|            state->v3 = v3;
  502|  4.54k|            state->v4 = v4;
  503|  4.54k|        }
  504|       |
  505|  12.0k|        if (p < bEnd) {
  ------------------
  |  Branch (505:13): [True: 9.61k, False: 2.47k]
  ------------------
  506|  9.61k|            XXH_memcpy(state->mem32, p, (size_t)(bEnd-p));
  507|  9.61k|            state->memsize = (unsigned)(bEnd-p);
  508|  9.61k|        }
  509|  12.0k|    }
  510|       |
  511|      0|    return XXH_OK;
  512|  29.2k|}
xxhash.c:XXH_memcpy:
  112|  36.5k|static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); }
xxhash.c:XXH_readLE32:
  243|  53.2M|{
  244|  53.2M|    return XXH_readLE32_align(ptr, endian, XXH_unaligned);
  245|  53.2M|}
xxhash.c:XXH32_digest_endian:
  528|  8.38k|{
  529|  8.38k|    U32 h32;
  530|       |
  531|  8.38k|    if (state->large_len) {
  ------------------
  |  Branch (531:9): [True: 880, False: 7.50k]
  ------------------
  532|    880|        h32 = XXH_rotl32(state->v1, 1)
  ------------------
  |  |  194|    880|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  533|    880|            + XXH_rotl32(state->v2, 7)
  ------------------
  |  |  194|    880|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  534|    880|            + XXH_rotl32(state->v3, 12)
  ------------------
  |  |  194|    880|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  535|    880|            + XXH_rotl32(state->v4, 18);
  ------------------
  |  |  194|    880|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  536|  7.50k|    } else {
  537|  7.50k|        h32 = state->v3 /* == seed */ + PRIME32_5;
  538|  7.50k|    }
  539|       |
  540|  8.38k|    h32 += state->total_len_32;
  541|       |
  542|  8.38k|    return XXH32_finalize(h32, state->mem32, state->memsize, endian, XXH_aligned);
  543|  8.38k|}

LLVMFuzzerTestOneInput:
   32|  3.24k|{
   33|  3.24k|    FUZZ_dataProducer_t *producer = FUZZ_dataProducer_create(data, size);
   34|  3.24k|    size_t const dstCapacitySeed = FUZZ_dataProducer_retrieve32(producer);
   35|  3.24k|    size_t const dictSizeSeed = FUZZ_dataProducer_retrieve32(producer);
   36|  3.24k|    int const skipChecksums = (FUZZ_dataProducer_range32(producer, 0, 7) == 0);   /* occasionally */
   37|  3.24k|    size = FUZZ_dataProducer_remainingBytes(producer);
   38|       |
   39|  3.24k|    size_t const dstCapacity = FUZZ_getRange_from_uint32(
   40|  3.24k|      dstCapacitySeed, 0, 4 * size);
   41|  3.24k|    size_t const largeDictSize = 64 * 1024;
   42|  3.24k|    size_t const dictSize = FUZZ_getRange_from_uint32(
   43|  3.24k|      dictSizeSeed, 0, largeDictSize);
   44|       |
   45|  3.24k|    char* const dst = (char*)malloc(dstCapacity);
   46|  3.24k|    char* const dict = (char*)malloc(dictSize);
   47|  3.24k|    LZ4F_decompressOptions_t opts;
   48|  3.24k|    LZ4F_dctx* dctx;
   49|  3.24k|    LZ4F_createDecompressionContext(&dctx, LZ4F_VERSION);
  ------------------
  |  |  259|  3.24k|#define LZ4F_VERSION 100    /* This number can be used to check for an incompatible API breaking change */
  ------------------
   50|       |
   51|  3.24k|    FUZZ_ASSERT(dctx);
  ------------------
  |  |   47|  3.24k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  3.24k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 3.24k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  3.24k|          : (fprintf(stderr, "%s: %u: Assertion: `%s' failed. %s\n", __FILE__, \
  |  |  |  |   45|      0|                     __LINE__, FUZZ_QUOTE(cond), (msg)),                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      0|#define FUZZ_QUOTE(str) FUZZ_QUOTE_IMPL(str)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   36|      0|#define FUZZ_QUOTE_IMPL(str) #str
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   46|      0|             abort()))
  |  |  ------------------
  ------------------
   52|  3.24k|    FUZZ_ASSERT(dst);
  ------------------
  |  |   47|  3.24k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  3.24k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 3.24k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  3.24k|          : (fprintf(stderr, "%s: %u: Assertion: `%s' failed. %s\n", __FILE__, \
  |  |  |  |   45|      0|                     __LINE__, FUZZ_QUOTE(cond), (msg)),                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      0|#define FUZZ_QUOTE(str) FUZZ_QUOTE_IMPL(str)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   36|      0|#define FUZZ_QUOTE_IMPL(str) #str
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   46|      0|             abort()))
  |  |  ------------------
  ------------------
   53|  3.24k|    FUZZ_ASSERT(dict);
  ------------------
  |  |   47|  3.24k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  3.24k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 3.24k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  3.24k|          : (fprintf(stderr, "%s: %u: Assertion: `%s' failed. %s\n", __FILE__, \
  |  |  |  |   45|      0|                     __LINE__, FUZZ_QUOTE(cond), (msg)),                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      0|#define FUZZ_QUOTE(str) FUZZ_QUOTE_IMPL(str)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   36|      0|#define FUZZ_QUOTE_IMPL(str) #str
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   46|      0|             abort()))
  |  |  ------------------
  ------------------
   54|       |
   55|       |    /* Prepare the dictionary. The data doesn't matter for decompression. */
   56|  3.24k|    memset(dict, 0, dictSize);
   57|       |
   58|       |
   59|       |    /* Decompress using multiple configurations. */
   60|  3.24k|    memset(&opts, 0, sizeof(opts));
   61|  3.24k|    opts.skipChecksums = (unsigned)skipChecksums;
   62|  3.24k|    opts.stableDst = 0;
   63|  3.24k|    decompress(dctx, dst, dstCapacity, data, size, NULL, 0, &opts);
   64|  3.24k|    opts.stableDst = 1;
   65|  3.24k|    decompress(dctx, dst, dstCapacity, data, size, NULL, 0, &opts);
   66|  3.24k|    opts.stableDst = 0;
   67|  3.24k|    decompress(dctx, dst, dstCapacity, data, size, dict, dictSize, &opts);
   68|  3.24k|    opts.stableDst = 1;
   69|  3.24k|    decompress(dctx, dst, dstCapacity, data, size, dict, dictSize, &opts);
   70|       |
   71|  3.24k|    LZ4F_freeDecompressionContext(dctx);
   72|  3.24k|    free(dst);
   73|  3.24k|    free(dict);
   74|  3.24k|    FUZZ_dataProducer_free(producer);
   75|       |
   76|  3.24k|    return 0;
   77|  3.24k|}
decompress_frame_fuzzer.c:decompress:
   22|  12.9k|{
   23|  12.9k|    LZ4F_resetDecompressionContext(dctx);
   24|  12.9k|    if (dictSize == 0)
  ------------------
  |  Branch (24:9): [True: 7.69k, False: 5.29k]
  ------------------
   25|  7.69k|        LZ4F_decompress(dctx, dst, &dstCapacity, src, &srcSize, opts);
   26|  5.29k|    else
   27|  5.29k|        LZ4F_decompress_usingDict(dctx, dst, &dstCapacity, src, &srcSize,
   28|  5.29k|                                  dict, dictSize, opts);
   29|  12.9k|}

FUZZ_dataProducer_create:
    8|  3.24k|FUZZ_dataProducer_t* FUZZ_dataProducer_create(const uint8_t* data, size_t size) {
    9|  3.24k|  FUZZ_dataProducer_t* const producer = malloc(sizeof(FUZZ_dataProducer_t));
   10|       |
   11|  3.24k|  FUZZ_ASSERT(producer != NULL);
  ------------------
  |  |   47|  3.24k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  3.24k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 3.24k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  3.24k|          : (fprintf(stderr, "%s: %u: Assertion: `%s' failed. %s\n", __FILE__, \
  |  |  |  |   45|      0|                     __LINE__, FUZZ_QUOTE(cond), (msg)),                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      0|#define FUZZ_QUOTE(str) FUZZ_QUOTE_IMPL(str)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   36|      0|#define FUZZ_QUOTE_IMPL(str) #str
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   46|      0|             abort()))
  |  |  ------------------
  ------------------
   12|       |
   13|  3.24k|  producer->data = data;
   14|  3.24k|  producer->size = size;
   15|  3.24k|  return producer;
   16|  3.24k|}
FUZZ_dataProducer_free:
   18|  3.24k|void FUZZ_dataProducer_free(FUZZ_dataProducer_t *producer) { free(producer); }
FUZZ_dataProducer_retrieve32:
   20|  9.73k|uint32_t FUZZ_dataProducer_retrieve32(FUZZ_dataProducer_t *producer) {
   21|  9.73k|    const uint8_t* data = producer->data;
   22|  9.73k|    const size_t size = producer->size;
   23|  9.73k|    if (size == 0) {
  ------------------
  |  Branch (23:9): [True: 22, False: 9.71k]
  ------------------
   24|     22|        return 0;
   25|  9.71k|    } else if (size < 4) {
  ------------------
  |  Branch (25:16): [True: 29, False: 9.68k]
  ------------------
   26|     29|        producer->size -= 1;
   27|     29|        return (uint32_t)data[size - 1];
   28|  9.68k|    } else {
   29|  9.68k|        const uint8_t* const p = data + size - 4;
   30|  9.68k|        producer->size -= 4;
   31|  9.68k|        return (uint32_t)p[0] | ((uint32_t)p[1] << 8)
   32|  9.68k|            | ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24);
   33|  9.68k|    }
   34|  9.73k|}
FUZZ_getRange_from_uint32:
   37|  9.73k|{
   38|  9.73k|    uint32_t range = max - min;
   39|  9.73k|    if (range == 0xffffffff) {
  ------------------
  |  Branch (39:9): [True: 0, False: 9.73k]
  ------------------
   40|      0|      return seed;
   41|      0|    }
   42|  9.73k|    return min + seed % (range + 1);
   43|  9.73k|}
FUZZ_dataProducer_range32:
   47|  3.24k|{
   48|  3.24k|    uint32_t const seed = FUZZ_dataProducer_retrieve32(producer);
   49|  3.24k|    return FUZZ_getRange_from_uint32(seed, min, max);
   50|  3.24k|}
FUZZ_dataProducer_remainingBytes:
   77|  3.24k|size_t FUZZ_dataProducer_remainingBytes(FUZZ_dataProducer_t *producer){
   78|  3.24k|  return producer->size;
   79|  3.24k|}

