LZ4_decompress_safe:
 2589|  8.13k|{
 2590|  8.13k|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2591|  8.13k|                                  decode_full_block, noDict,
 2592|       |                                  (BYTE*)dest, NULL, 0);
 2593|  8.13k|}
LZ4_decompress_safe_withPrefix64k:
 2617|  17.0k|{
 2618|  17.0k|    return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
 2619|  17.0k|                                  decode_full_block, withPrefix64k,
 2620|  17.0k|                                  (BYTE*)dest - 64 KB, NULL, 0);
  ------------------
  |  |  251|  17.0k|#define KB *(1 <<10)
  ------------------
 2621|  17.0k|}
LZ4_decompress_safe_forceExtDict:
 2663|  31.5k|{
 2664|  31.5k|    DEBUGLOG(5, "LZ4_decompress_safe_forceExtDict");
  ------------------
  |  |  289|  31.5k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2665|  31.5k|    return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
 2666|  31.5k|                                  decode_full_block, usingExtDict,
 2667|  31.5k|                                  (BYTE*)dest, (const BYTE*)dictStart, dictSize);
 2668|  31.5k|}
LZ4_decompress_safe_usingDict:
 2862|  78.0k|{
 2863|  78.0k|    if (dictSize < 0) return -1;
  ------------------
  |  Branch (2863:9): [True: 0, False: 78.0k]
  ------------------
 2864|  78.0k|    if (dictSize==0)
  ------------------
  |  Branch (2864:9): [True: 8.13k, False: 69.9k]
  ------------------
 2865|  8.13k|        return LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize);
 2866|  69.9k|    if (dictStart+dictSize == dest) {
  ------------------
  |  Branch (2866:9): [True: 38.3k, False: 31.5k]
  ------------------
 2867|  38.3k|        if (dictSize >= 64 KB - 1) {
  ------------------
  |  |  251|  38.3k|#define KB *(1 <<10)
  ------------------
  |  Branch (2867:13): [True: 17.0k, False: 21.3k]
  ------------------
 2868|  17.0k|            return LZ4_decompress_safe_withPrefix64k(source, dest, compressedSize, maxOutputSize);
 2869|  17.0k|        }
 2870|  38.3k|        assert(dictSize >= 0);
  ------------------
  |  Branch (2870:9): [True: 0, False: 21.3k]
  |  Branch (2870:9): [True: 21.3k, False: 0]
  ------------------
 2871|  21.3k|        return LZ4_decompress_safe_withSmallPrefix(source, dest, compressedSize, maxOutputSize, (size_t)dictSize);
 2872|  21.3k|    }
 2873|  69.9k|    assert(dictSize >= 0);
  ------------------
  |  Branch (2873:5): [True: 0, False: 31.5k]
  |  Branch (2873:5): [True: 31.5k, False: 0]
  ------------------
 2874|  31.5k|    return LZ4_decompress_safe_forceExtDict(source, dest, compressedSize, maxOutputSize, dictStart, (size_t)dictSize);
 2875|  31.5k|}
lz4.c:LZ4_isLittleEndian:
  364|  11.4M|{
  365|  11.4M|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  366|  11.4M|    return one.c[0];
  367|  11.4M|}
lz4.c:LZ4_wildCopy8:
  466|   295k|{
  467|   295k|    BYTE* d = (BYTE*)dstPtr;
  468|   295k|    const BYTE* s = (const BYTE*)srcPtr;
  469|   295k|    BYTE* const e = (BYTE*)dstEnd;
  470|       |
  471|  44.9M|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  349|  44.9M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (471:50): [True: 44.6M, False: 295k]
  ------------------
  472|   295k|}
lz4.c:LZ4_read16:
  393|  11.4M|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  398|  1.95M|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_decompress_generic:
 2237|  78.0k|{
 2238|  78.0k|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (2238:9): [True: 0, False: 78.0k]
  |  Branch (2238:26): [True: 0, False: 78.0k]
  ------------------
 2239|       |
 2240|  78.0k|    {   const BYTE* ip = (const BYTE*) src;
 2241|  78.0k|        const BYTE* const iend = ip + srcSize;
 2242|       |
 2243|  78.0k|        BYTE* op = (BYTE*) dst;
 2244|  78.0k|        BYTE* const oend = op + outputSize;
 2245|       |
 2246|  78.0k|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (2246:37): [True: 46.5k, False: 31.5k]
  ------------------
 2247|       |
 2248|       |        /* withPrefix64k : offset <= 65535 can't reach beyond the 64 KB prefix */
 2249|  78.0k|        const int checkOffset = (dict != withPrefix64k) && (dictSize < (int)(64 KB));
  ------------------
  |  |  251|  60.9k|#define KB *(1 <<10)
  ------------------
  |  Branch (2249:33): [True: 60.9k, False: 17.0k]
  |  Branch (2249:60): [True: 49.6k, False: 11.3k]
  ------------------
 2250|       |
 2251|       |
 2252|       |        /* Set up the "end" pointers for the shortcut. */
 2253|  78.0k|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 2254|  78.0k|        const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/;
 2255|       |
 2256|       |        /* shared by both loops : the fast loop can hand over a decoded match (safe_match_copy) */
 2257|  78.0k|        const BYTE* match;
 2258|  78.0k|        size_t offset;
 2259|  78.0k|        size_t ml;   /* match length */
 2260|       |
 2261|       |
 2262|  78.0k|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  289|  78.0k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2263|       |
 2264|       |        /* Special cases */
 2265|  78.0k|        assert(lowPrefix <= op);
  ------------------
  |  Branch (2265:9): [True: 0, False: 78.0k]
  |  Branch (2265:9): [True: 78.0k, False: 0]
  ------------------
 2266|  78.0k|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  180|  78.0k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  78.0k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 78.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2267|       |            /* Empty output buffer */
 2268|      0|            if (partialDecoding) return 0;
  ------------------
  |  Branch (2268:17): [True: 0, False: 0]
  ------------------
 2269|      0|            if ((srcSize==1) && (*ip==0)) return 0;   /* empty block */
  ------------------
  |  Branch (2269:17): [True: 0, False: 0]
  |  Branch (2269:33): [True: 0, False: 0]
  ------------------
 2270|      0|            return (srcSize > 1) ? -2 : -1;   /* -2 : output buffer too small */
  ------------------
  |  Branch (2270:20): [True: 0, False: 0]
  ------------------
 2271|      0|        }
 2272|  78.0k|        if (unlikely(srcSize<=0)) { return -1; }
  ------------------
  |  |  180|  78.0k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  78.0k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 78.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2273|       |
 2274|       |    /* LZ4_FAST_DEC_LOOP:
 2275|       |     * designed for modern OoO performance cpus,
 2276|       |     * where copying reliably 32-bytes is preferable to an unpredictable branch.
 2277|       |     * note : fast loop may show a regression for some client arm chips. */
 2278|  78.0k|#if LZ4_FAST_DEC_LOOP
 2279|  78.0k|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|  78.0k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2279:13): [True: 0, False: 78.0k]
  ------------------
 2280|      0|            DEBUGLOG(6, "move to safe decode loop");
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2281|      0|            goto safe_decode;
 2282|      0|        }
 2283|       |        /* Ring buffer restarting at its beginning : the oldest referenced history (max distance behind op)
 2284|       |         * lies in the external dictionary, ahead of op, always at the same distance.
 2285|       |         * Rings sized with the former LZ4_DECODER_RING_BUFFER_SIZE() (margin 14, up to v1.10.0)
 2286|       |         * still work, but leave as little as 16 bytes :
 2287|       |         * the fast loop's wide copies could overwrite it, the safe loop's can't. */
 2288|  78.0k|        if ( (dict==usingExtDict)
  ------------------
  |  Branch (2288:14): [True: 31.5k, False: 46.5k]
  ------------------
 2289|  31.5k|          && ((uptrval)dictEnd - (uptrval)lowPrefix - LZ4_DISTANCE_ABSOLUTE_MAX < FASTLOOP_SAFE_DISTANCE) ) {
  ------------------
  |  |  255|  31.5k|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
                        && ((uptrval)dictEnd - (uptrval)lowPrefix - LZ4_DISTANCE_ABSOLUTE_MAX < FASTLOOP_SAFE_DISTANCE) ) {
  ------------------
  |  |  248|  31.5k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2289:14): [True: 0, False: 31.5k]
  ------------------
 2290|      0|            DEBUGLOG(6, "history just ahead : move to safe decode loop");
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2291|      0|            goto safe_decode;
 2292|      0|        }
 2293|       |
 2294|       |        /* Fast loop : decode sequences as long as output < oend-FASTLOOP_SAFE_DISTANCE,
 2295|       |         * and input is not too close to iend.
 2296|       |         * It hands over to the safe loop either at a sequence start (break),
 2297|       |         * or once a match is fully decoded (goto safe_match_copy). */
 2298|  78.0k|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  289|  78.0k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2299|  11.3M|        while (1) {
  ------------------
  |  Branch (2299:16): [True: 11.3M, Folded]
  ------------------
 2300|  11.3M|            unsigned token;
 2301|  11.3M|            size_t ll;   /* literal length */
 2302|  11.3M|            BYTE* cpy;
 2303|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2304|  11.3M|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  Branch (2304:13): [True: 0, False: 11.3M]
  |  Branch (2304:13): [True: 11.3M, False: 0]
  ------------------
 2305|  11.3M|            assert(ip < iend);
  ------------------
  |  Branch (2305:13): [True: 0, False: 11.3M]
  |  Branch (2305:13): [True: 11.3M, False: 0]
  ------------------
 2306|  11.3M|            token = *ip++;
 2307|  11.3M|            ll = token >> ML_BITS;
  ------------------
  |  |  260|  11.3M|#define ML_BITS  4
  ------------------
 2308|  11.3M|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)ll);
  ------------------
  |  |  289|  11.3M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2309|       |
 2310|       |            /* too close to input end : the safe loop restarts this sequence */
 2311|  11.3M|            if (ip > iend-(16 + 1/*max lit + offset + nextToken*/)) { ip--; break; }
  ------------------
  |  Branch (2311:17): [True: 17.6k, False: 11.2M]
  ------------------
 2312|       |
 2313|       |            /* decode literal length */
 2314|  11.2M|            if (ll == RUN_MASK) {
  ------------------
  |  |  263|  11.2M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|  11.2M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|  11.2M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2314:17): [True: 347k, False: 10.9M]
  ------------------
 2315|       |                /* literal length >= RUN_MASK means >= RUN_MASK literal bytes follow the extension bytes,
 2316|       |                 * so extension bytes cannot reach the last RUN_MASK bytes of input */
 2317|   347k|                const BYTE* const tokenPos = ip-1;
 2318|   347k|                size_t const addl = read_variable_length(&ip, iend - RUN_MASK);
  ------------------
  |  |  263|   347k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|   347k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|   347k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2319|   347k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2319:21): [True: 138, False: 347k]
  ------------------
 2320|    138|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  289|    138|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2321|    138|                    goto _output_error;
 2322|    138|                }
 2323|   347k|                ll += addl;
 2324|   347k|                if (unlikely((uptrval)(op)+ll<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|   347k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|   347k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 347k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2325|   347k|                if (unlikely((uptrval)(ip)+ll<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|   347k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|   347k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 347k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2326|       |
 2327|       |                /* copy literals, unless too close to the end for a wild copy :
 2328|       |                 * nothing is written yet, so the safe loop can restart this sequence */
 2329|   347k|                cpy = op+ll;
 2330|   347k|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  277|   347k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2331|   347k|              #if LZ4_WILDCOPY64
 2332|   347k|                if ((cpy>oend-64) || (ip+ll>iend-64)) { ip = tokenPos; break; }
  ------------------
  |  Branch (2332:21): [True: 308, False: 347k]
  |  Branch (2332:38): [True: 57.6k, False: 289k]
  ------------------
 2333|   289k|                LZ4_wildCopy64(op, ip, cpy);
 2334|       |              #else
 2335|       |                if ((cpy>oend-32) || (ip+ll>iend-32)) { ip = tokenPos; break; }
 2336|       |                LZ4_wildCopy32(op, ip, cpy);
 2337|       |              #endif
 2338|   289k|                ip += ll; op = cpy;
 2339|  10.9M|            } else {
 2340|  10.9M|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)ll);
  ------------------
  |  |  289|  10.9M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2341|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2342|  10.9M|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  349|  10.9M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2343|  10.9M|                ip += ll; op += ll;
 2344|  10.9M|            }
 2345|       |
 2346|       |            /* get offset */
 2347|  11.2M|            offset = LZ4_readLE16(ip); ip+=2;
 2348|  11.2M|            DEBUGLOG(6, "blockPos%6u: offset = %u", (unsigned)(op-(BYTE*)dst), (unsigned)offset);
  ------------------
  |  |  289|  11.2M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2349|  11.2M|            match = op - offset;
 2350|  11.2M|            assert(match <= op);  /* overflow check */
  ------------------
  |  Branch (2350:13): [True: 0, False: 11.2M]
  |  Branch (2350:13): [True: 11.2M, False: 0]
  ------------------
 2351|       |
 2352|       |            /* get matchlength */
 2353|  11.2M|            ml = token & ML_MASK;
  ------------------
  |  |  261|  11.2M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  11.2M|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2354|  11.2M|            DEBUGLOG(7, "  match length token = %u (len==%u)", (unsigned)ml, (unsigned)ml+MINMATCH);
  ------------------
  |  |  289|  11.2M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2355|       |
 2356|  11.2M|            if (ml == ML_MASK) {
  ------------------
  |  |  261|  11.2M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  11.2M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2356:17): [True: 7.11M, False: 4.11M]
  ------------------
 2357|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2358|  7.11M|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  245|  7.11M|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2359|  7.11M|                if (addl == rvl_error) {
  ------------------
  |  Branch (2359:21): [True: 108, False: 7.11M]
  ------------------
 2360|    108|                    DEBUGLOG(5, "error reading long match length");
  ------------------
  |  |  289|    108|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2361|    108|                    goto _output_error;
 2362|    108|                }
 2363|  7.11M|                ml += addl;
 2364|  7.11M|                DEBUGLOG(7, "  long match length == %u", (unsigned)ml + MINMATCH);
  ------------------
  |  |  289|  7.11M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2365|  7.11M|                if (unlikely((uptrval)(op)+ml<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  7.11M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  7.11M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 7.11M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2366|  7.11M|            }
 2367|  11.2M|            ml += MINMATCH;
  ------------------
  |  |  242|  11.2M|#define MINMATCH 4
  ------------------
 2368|       |
 2369|  11.2M|            if (op + ml >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|  11.2M|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2369:17): [True: 786, False: 11.2M]
  ------------------
 2370|    786|                DEBUGLOG(7, "moving to safe_match_copy (ml==%u)", (unsigned)ml);
  ------------------
  |  |  289|    786|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2371|    786|                goto safe_match_copy;
 2372|    786|            }
 2373|       |
 2374|       |            /* match length from token only (<= 18), no overlap, within prefix : copy 18 bytes */
 2375|  11.2M|            if ( ((token & ML_MASK) != ML_MASK) && (offset >= 8)
  ------------------
  |  |  261|  11.2M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  11.2M|#define ML_BITS  4
  |  |  ------------------
  ------------------
                          if ( ((token & ML_MASK) != ML_MASK) && (offset >= 8)
  ------------------
  |  |  261|  11.2M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  11.2M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2375:18): [True: 4.11M, False: 7.11M]
  |  Branch (2375:52): [True: 2.16M, False: 1.95M]
  ------------------
 2376|  2.16M|              && ((dict == withPrefix64k) || (match >= lowPrefix)) ) {
  ------------------
  |  Branch (2376:19): [True: 122k, False: 2.04M]
  |  Branch (2376:46): [True: 2.02M, False: 11.0k]
  ------------------
 2377|  2.15M|                assert(match >= lowPrefix);
  ------------------
  |  Branch (2377:17): [True: 0, False: 2.15M]
  |  Branch (2377:17): [True: 2.15M, False: 0]
  ------------------
 2378|  2.15M|                assert(match <= op);
  ------------------
  |  Branch (2378:17): [True: 0, False: 2.15M]
  |  Branch (2378:17): [True: 2.15M, False: 0]
  ------------------
 2379|  2.15M|                assert(op + 18 <= oend);
  ------------------
  |  Branch (2379:17): [True: 0, False: 2.15M]
  |  Branch (2379:17): [True: 2.15M, False: 0]
  ------------------
 2380|  2.15M|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  349|  2.15M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2381|  2.15M|                LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  349|  2.15M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2382|  2.15M|                LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  349|  2.15M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2383|  2.15M|                op += ml;
 2384|  2.15M|                continue;
 2385|  2.15M|            }
 2386|       |
 2387|       |            /* match ends far from oend : no end-of-block condition to check */
 2388|  11.2M|            assert(op + ml < oend - FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  Branch (2388:13): [True: 0, False: 9.07M]
  |  Branch (2388:13): [True: 9.07M, False: 0]
  ------------------
 2389|       |
 2390|  9.07M|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  180|  8.66M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  8.66M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2390:18): [True: 8.66M, False: 412k]
  |  Branch (2390:33): [True: 1.44k, False: 8.66M]
  ------------------
 2391|  1.44k|                DEBUGLOG(5, "Error : pos=%zi, offset=%zi => outside buffers", op-lowPrefix, op-match);
  ------------------
  |  |  289|  1.44k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2392|  1.44k|                goto _offset_error;
 2393|  1.44k|            }
 2394|       |            /* match starting within external dictionary */
 2395|  9.07M|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2395:17): [True: 4.75M, False: 4.32M]
  |  Branch (2395:41): [True: 14.6k, False: 4.73M]
  ------------------
 2396|  14.6k|                size_t const inDict = (size_t)(lowPrefix - match);
 2397|  14.6k|                assert(dictEnd != NULL);
  ------------------
  |  Branch (2397:17): [True: 0, False: 14.6k]
  |  Branch (2397:17): [True: 14.6k, False: 0]
  ------------------
 2398|  14.6k|                if (ml + 16 <= inDict) {
  ------------------
  |  Branch (2398:21): [True: 13.7k, False: 850]
  ------------------
 2399|       |                    /* match within dictionary, followed by 16 more bytes of dictionary : wild copy */
 2400|  13.7k|                    LZ4_wildCopy16(op, dictEnd - inDict, op + ml);
 2401|  13.7k|                    op += ml;
 2402|  13.7k|                    continue;
 2403|  13.7k|                }
 2404|    850|                op = LZ4_copyExtDictMatch(op, match, ml, lowPrefix, dictEnd);
 2405|    850|                continue;
 2406|  14.6k|            }
 2407|       |
 2408|       |            /* copy match within block */
 2409|  9.06M|            cpy = op + ml;
 2410|       |
 2411|  9.06M|            assert((op <= oend) && (oend-op >= 64));
  ------------------
  |  Branch (2411:13): [True: 0, False: 9.06M]
  |  Branch (2411:13): [True: 0, False: 0]
  |  Branch (2411:13): [True: 9.06M, False: 0]
  |  Branch (2411:13): [True: 9.06M, False: 0]
  ------------------
 2412|  9.06M|            if (unlikely(offset<16)) {
  ------------------
  |  |  180|  9.06M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  9.06M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 2.07M, False: 6.99M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2413|  2.07M|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2414|  2.07M|    #if LZ4_WILDCOPY64
 2415|  6.99M|            } else if (offset >= 64) {
  ------------------
  |  Branch (2415:24): [True: 6.97M, False: 18.2k]
  ------------------
 2416|  6.97M|                LZ4_wildCopy64(op, match, cpy);
 2417|  6.97M|    #endif
 2418|  6.97M|            } else {
 2419|  18.2k|                LZ4_wildCopy32(op, match, cpy);
 2420|  18.2k|            }
 2421|       |
 2422|  9.06M|            op = cpy;   /* wildcopy correction */
 2423|  9.06M|        }
 2424|  75.5k|    safe_decode:
 2425|  75.5k|#endif
 2426|       |
 2427|       |        /* Safe loop : decode remaining sequences, without writing beyond oend nor reading beyond iend.
 2428|       |         * With LZ4_FAST_DEC_LOOP, that's the end of the block (or a block too small for the fast loop),
 2429|       |         * entered at a sequence start, or at safe_match_copy with a decoded match.
 2430|       |         * Without it, that's the whole block. */
 2431|  75.5k|        DEBUGLOG(6, "using safe decode loop");
  ------------------
  |  |  289|  75.5k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2432|   272k|        while (1) {
  ------------------
  |  Branch (2432:16): [True: 272k, Folded]
  ------------------
 2433|   272k|            unsigned token;
 2434|   272k|            size_t ll;   /* literal length */
 2435|   272k|            BYTE* cpy;
 2436|   272k|            assert(ip < iend);
  ------------------
  |  Branch (2436:13): [True: 0, False: 272k]
  |  Branch (2436:13): [True: 272k, False: 0]
  ------------------
 2437|   272k|            token = *ip++;
 2438|   272k|            ll = token >> ML_BITS;
  ------------------
  |  |  260|   272k|#define ML_BITS  4
  ------------------
 2439|   272k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)ll);
  ------------------
  |  |  289|   272k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2440|       |
 2441|       |            /* A two-stage shortcut for the most common case:
 2442|       |             * 1) If the literal length is 0..14, and there is enough space,
 2443|       |             * enter the shortcut and copy 16 bytes on behalf of the literals.
 2444|       |             * 2) Further if the match length is 4..18, copy 18 bytes in a similar
 2445|       |             * manner; but we ensure that there's enough space in the output for
 2446|       |             * those 18 bytes earlier, upon entering the shortcut (in other words,
 2447|       |             * there is a combined check for both stages).
 2448|       |             */
 2449|   272k|            if ( (ll != RUN_MASK)
  ------------------
  |  |  263|   272k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|   272k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|   272k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2449:18): [True: 211k, False: 61.0k]
  ------------------
 2450|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2451|   211k|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  177|   211k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|   211k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 127k, False: 84.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2452|       |                /* Copy the literals */
 2453|   127k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  349|   127k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2454|   127k|                op += ll; ip += ll;
 2455|       |
 2456|       |                /* The second stage: prepare for match copying, decode full info.
 2457|       |                 * If it doesn't work out, the info won't be wasted. */
 2458|   127k|                offset = LZ4_readLE16(ip); ip += 2;
 2459|   127k|                match = op - offset;
 2460|   127k|                assert(match <= op); /* check overflow */
  ------------------
  |  Branch (2460:17): [True: 0, False: 127k]
  |  Branch (2460:17): [True: 127k, False: 0]
  ------------------
 2461|   127k|                ml = token & ML_MASK;
  ------------------
  |  |  261|   127k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|   127k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2462|   127k|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u (len=%u)", (unsigned)(op-(BYTE*)dst), (unsigned)ml, (unsigned)ml + 4);
  ------------------
  |  |  289|   127k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2463|       |
 2464|       |                /* Do not deal with overlapping matches. */
 2465|   127k|                if ( (ml != ML_MASK)
  ------------------
  |  |  261|   127k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|   127k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2465:22): [True: 13.9k, False: 113k]
  ------------------
 2466|  13.9k|                  && (offset >= 8)
  ------------------
  |  Branch (2466:22): [True: 10.4k, False: 3.46k]
  ------------------
 2467|  10.4k|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2467:23): [True: 2.84k, False: 7.61k]
  |  Branch (2467:46): [True: 3.91k, False: 3.70k]
  ------------------
 2468|       |                    /* Copy the match. */
 2469|  6.75k|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  349|  6.75k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2470|  6.75k|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  349|  6.75k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2471|  6.75k|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  349|  6.75k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2472|  6.75k|                    op += ml + MINMATCH;
  ------------------
  |  |  242|  6.75k|#define MINMATCH 4
  ------------------
 2473|       |                    /* Both stages worked, load the next token. */
 2474|  6.75k|                    continue;
 2475|  6.75k|                }
 2476|       |                /* The second stage didn't work out, but the info is ready for the match copy below. */
 2477|   145k|            } else {
 2478|       |                /* decode literal length */
 2479|   145k|                if (ll == RUN_MASK) {
  ------------------
  |  |  263|   145k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|   145k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|   145k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2479:21): [True: 61.0k, False: 84.3k]
  ------------------
 2480|       |                    /* literal length >= RUN_MASK means >= RUN_MASK literal bytes follow the extension bytes,
 2481|       |                     * so extension bytes cannot reach the last RUN_MASK bytes of input */
 2482|  61.0k|                    size_t const addl = read_variable_length(&ip, iend-RUN_MASK);
  ------------------
  |  |  263|  61.0k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|  61.0k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|  61.0k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2483|  61.0k|                    if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2483:25): [True: 814, False: 60.1k]
  ------------------
 2484|  60.1k|                    ll += addl;
 2485|  60.1k|                    if (unlikely((uptrval)(op)+ll<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  60.1k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  60.1k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 60.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2486|  60.1k|                    if (unlikely((uptrval)(ip)+ll<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  60.1k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  60.1k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 60.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2487|  60.1k|                }
 2488|       |
 2489|       |                /* copy literals */
 2490|   144k|                cpy = op+ll;
 2491|   144k|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  277|   144k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2492|   144k|                if ((cpy>oend-MFLIMIT) || (ip+ll>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  246|   144k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                              if ((cpy>oend-MFLIMIT) || (ip+ll>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  245|   143k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2492:21): [True: 582, False: 143k]
  |  Branch (2492:43): [True: 72.9k, False: 71.0k]
  ------------------
 2493|       |                    /* close to input or output end : these must be the last literals of the block,
 2494|       |                     * except with partialDecoding, which can also stop within them */
 2495|  73.4k|                    if (partialDecoding) {
  ------------------
  |  Branch (2495:25): [True: 0, False: 73.4k]
  ------------------
 2496|       |                        /* stop at input end, or when output is full */
 2497|      0|                        ll = MIN(ll, (size_t)(iend-ip));
  ------------------
  |  | 2009|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (2009:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2498|      0|                        ll = MIN(ll, (size_t)(oend-op));
  ------------------
  |  | 2009|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (2009:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2499|  73.4k|                    } else if ((ip+ll != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2499:32): [True: 3.57k, False: 69.9k]
  |  Branch (2499:51): [True: 28, False: 69.8k]
  ------------------
 2500|       |                        /* last literals must end exactly at input end, within output */
 2501|  3.59k|                        DEBUGLOG(5, "invalid last literals : they end at iend%+zi and oend%+zi", (ip+ll)-iend, cpy-oend);
  ------------------
  |  |  289|  3.59k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2502|  3.59k|                        if ((ip+ll <= iend) && (cpy > oend-MFLIMIT)) goto _dst_too_small;   /* output full, input left */
  ------------------
  |  |  246|  1.70k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2502:29): [True: 1.70k, False: 1.89k]
  |  Branch (2502:48): [True: 176, False: 1.52k]
  ------------------
 2503|  3.42k|                        goto _output_error;
 2504|  3.59k|                    }
 2505|  69.8k|                    LZ4_memmove(op, ip, ll);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  357|  69.8k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2506|  69.8k|                    ip += ll;
 2507|  69.8k|                    op += ll;
 2508|       |                    /* end of block, unless partialDecoding can go on : output not full, input left for a match */
 2509|  69.8k|                    if (!partialDecoding || (op == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2509:25): [True: 69.8k, False: 0]
  |  Branch (2509:45): [True: 0, False: 0]
  |  Branch (2509:61): [True: 0, False: 0]
  ------------------
 2510|  69.8k|                        break;
 2511|  69.8k|                    }
 2512|  71.0k|                } else {
 2513|  71.0k|                    LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2514|  71.0k|                    ip += ll; op = cpy;
 2515|  71.0k|                }
 2516|       |
 2517|       |                /* get offset */
 2518|  71.0k|                offset = LZ4_readLE16(ip); ip+=2;
 2519|  71.0k|                match = op - offset;
 2520|       |
 2521|       |                /* get matchlength */
 2522|  71.0k|                ml = token & ML_MASK;
  ------------------
  |  |  261|  71.0k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  71.0k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2523|  71.0k|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)ml);
  ------------------
  |  |  289|  71.0k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2524|  71.0k|            }
 2525|       |
 2526|       |            /* literals copied, offset decoded, ml == match length token */
 2527|   191k|            if (ml == ML_MASK) {
  ------------------
  |  |  261|   191k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|   191k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2527:17): [True: 117k, False: 74.0k]
  ------------------
 2528|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2529|   117k|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  245|   117k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2530|   117k|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2530:21): [True: 286, False: 116k]
  ------------------
 2531|   116k|                ml += addl;
 2532|   116k|                if (unlikely((uptrval)(op)+ml<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  180|   116k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|   116k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 116k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2533|   116k|            }
 2534|   191k|            ml += MINMATCH;
  ------------------
  |  |  242|   191k|#define MINMATCH 4
  ------------------
 2535|       |
 2536|   191k|#if LZ4_FAST_DEC_LOOP
 2537|   191k|        safe_match_copy:
 2538|   191k|#endif
 2539|       |            /* literals copied, match fully decoded (ml includes MINMATCH), offset not validated yet */
 2540|   191k|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _offset_error;   /* Error : offset outside buffers */
  ------------------
  |  |  180|   107k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|   107k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2540:17): [True: 107k, False: 84.2k]
  |  Branch (2540:34): [True: 1.43k, False: 106k]
  ------------------
 2541|       |
 2542|       |            /* end of block : the last LASTLITERALS bytes must be literals */
 2543|   191k|            assert(op <= oend);
  ------------------
  |  Branch (2543:13): [True: 0, False: 190k]
  |  Branch (2543:13): [True: 190k, False: 0]
  ------------------
 2544|   190k|            if (unlikely(op+ml > oend-LASTLITERALS)) {
  ------------------
  |  |  180|   190k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|   190k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 340, False: 190k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2545|    340|                if (partialDecoding) ml = MIN(ml, (size_t)(oend-op));   /* partialDecoding : may end anywhere */
  ------------------
  |  | 2009|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (2009:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2545:21): [True: 0, False: 340]
  ------------------
 2546|    340|                else goto _dst_too_small;
 2547|    340|            }
 2548|       |
 2549|       |            /* match starting within external dictionary */
 2550|   190k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2550:17): [True: 80.1k, False: 109k]
  |  Branch (2550:41): [True: 21.0k, False: 59.1k]
  ------------------
 2551|  21.0k|                assert(dictEnd != NULL);
  ------------------
  |  Branch (2551:17): [True: 0, False: 21.0k]
  |  Branch (2551:17): [True: 21.0k, False: 0]
  ------------------
 2552|  21.0k|                op = LZ4_copyExtDictMatch(op, match, ml, lowPrefix, dictEnd);
 2553|  21.0k|                continue;
 2554|  21.0k|            }
 2555|   190k|            assert(match >= lowPrefix);
  ------------------
  |  Branch (2555:13): [True: 0, False: 169k]
  |  Branch (2555:13): [True: 169k, False: 0]
  ------------------
 2556|       |
 2557|       |            /* close to block end : no wild copy */
 2558|   169k|            if (unlikely(op+ml > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  180|   169k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|   169k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 300, False: 168k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2559|    300|                op = LZ4_copyMatchExact(op, match, ml);
 2560|    300|                if (op == oend) { break; }   /* partialDecoding : output buffer full */
  ------------------
  |  Branch (2560:21): [True: 0, False: 300]
  ------------------
 2561|    300|                continue;
 2562|    300|            }
 2563|       |
 2564|       |            /* copy match within block */
 2565|   168k|            cpy = op + ml;
 2566|   168k|            LZ4_memcpy_using_offset_base(op, match, cpy, offset);
 2567|   168k|            op = cpy;   /* wildcopy correction */
 2568|   168k|        }
 2569|       |
 2570|       |        /* end of decoding */
 2571|  69.8k|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  289|  69.8k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2572|  69.8k|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2573|       |
 2574|       |        /* errors : see LZ4_decompress_safe() in lz4.h */
 2575|  4.76k|    _output_error:
 2576|  4.76k|        return -1;
 2577|    516|    _dst_too_small:
 2578|    516|        return -2;
 2579|  2.87k|    _offset_error:
 2580|  2.87k|        return -3;
 2581|  75.5k|    }
 2582|  75.5k|}
lz4.c:read_variable_length:
 2144|  7.63M|{
 2145|  7.63M|    Rvl_t s, length = 0;
 2146|  7.63M|    assert(ipPtr != NULL);
  ------------------
  |  Branch (2146:5): [True: 0, False: 7.63M]
  |  Branch (2146:5): [True: 7.63M, False: 0]
  ------------------
 2147|  7.63M|    assert(*ipPtr !=  NULL);
  ------------------
  |  Branch (2147:5): [True: 0, False: 7.63M]
  |  Branch (2147:5): [True: 7.63M, False: 0]
  ------------------
 2148|  7.63M|    assert(ilimit != NULL);
  ------------------
  |  Branch (2148:5): [True: 0, False: 7.63M]
  |  Branch (2148:5): [True: 7.63M, False: 0]
  ------------------
 2149|  7.63M|    if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|  7.63M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  7.63M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 916, False: 7.63M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2150|    916|        return rvl_error;
 2151|    916|    }
 2152|  7.63M|    s = **ipPtr;
 2153|  7.63M|    (*ipPtr)++;
 2154|  7.63M|    length += s;
 2155|  7.63M|    if (likely(s != 255)) return length;
  ------------------
  |  |  177|  7.63M|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|  7.63M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 7.56M, False: 67.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2156|  32.9M|    do {
 2157|  32.9M|        if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|  32.9M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  32.9M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 430, False: 32.9M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2158|    430|            return rvl_error;
 2159|    430|        }
 2160|  32.9M|        s = **ipPtr;
 2161|  32.9M|        (*ipPtr)++;
 2162|  32.9M|        length += s;
 2163|       |        /* accumulator overflow detection (32-bit mode only) */
 2164|  32.9M|        if ((sizeof(length) < 8) && unlikely(length > ((Rvl_t)(-1)/2)) ) {
  ------------------
  |  |  180|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2164:13): [Folded, False: 32.9M]
  ------------------
 2165|      0|            return rvl_error;
 2166|      0|        }
 2167|  32.9M|    } while (s == 255);
  ------------------
  |  Branch (2167:14): [True: 32.8M, False: 66.8k]
  ------------------
 2168|       |
 2169|  66.8k|    return length;
 2170|  67.3k|}
lz4.c:LZ4_wildCopy64:
  537|  7.26M|{
  538|  7.26M|    BYTE* d = (BYTE*)dstPtr;
  539|  7.26M|    const BYTE* s = (const BYTE*)srcPtr;
  540|  7.26M|    BYTE* const e = (BYTE*)dstEnd;
  541|       |
  542|  13.5M|    do { LZ4_memcpy(d,s,64); d+=64; s+=64; } while (d<e);
  ------------------
  |  |  349|  13.5M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (542:53): [True: 6.25M, False: 7.26M]
  ------------------
  543|  7.26M|}
lz4.c:LZ4_readLE16:
  431|  11.4M|{
  432|  11.4M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (432:9): [True: 11.4M, False: 0]
  ------------------
  433|  11.4M|        return LZ4_read16(memPtr);
  434|  11.4M|    } else {
  435|      0|        const BYTE* p = (const BYTE*)memPtr;
  436|      0|        return (U16)((U16)p[0] | (p[1]<<8));
  437|      0|    }
  438|  11.4M|}
lz4.c:LZ4_wildCopy16:
  563|  13.7k|{
  564|  13.7k|    BYTE* d = (BYTE*)dstPtr;
  565|  13.7k|    const BYTE* s = (const BYTE*)srcPtr;
  566|  13.7k|    BYTE* const e = (BYTE*)dstEnd;
  567|       |
  568|  68.6k|    do { LZ4_memcpy(d,s,16); d+=16; s+=16; } while (d<e);
  ------------------
  |  |  349|  68.6k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (568:53): [True: 54.8k, False: 13.7k]
  ------------------
  569|  13.7k|}
lz4.c:LZ4_copyExtDictMatch:
 2205|  21.8k|{
 2206|  21.8k|    if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2206:9): [True: 19.2k, False: 2.59k]
  ------------------
 2207|       |        /* match fits entirely within external dictionary : just copy */
 2208|  19.2k|        LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  357|  19.2k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2209|  19.2k|        return op + length;
 2210|  19.2k|    } else {
 2211|       |        /* match stretches into both external dictionary and current block */
 2212|  2.59k|        size_t const copySize = (size_t)(lowPrefix - match);
 2213|  2.59k|        LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  349|  2.59k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2214|  2.59k|        return LZ4_copyMatchExact(op + copySize, lowPrefix, length - copySize);
 2215|  2.59k|    }
 2216|  21.8k|}
lz4.c:LZ4_memcpy_using_offset:
  576|  2.07M|{
  577|  2.07M|    BYTE v[8];
  578|       |
  579|  2.07M|    assert(dstEnd >= dstPtr + MINMATCH);
  ------------------
  |  Branch (579:5): [True: 0, False: 2.07M]
  |  Branch (579:5): [True: 2.07M, False: 0]
  ------------------
  580|       |
  581|  2.07M|    switch(offset) {
  582|  47.4k|    case 1:
  ------------------
  |  Branch (582:5): [True: 47.4k, False: 2.02M]
  ------------------
  583|  47.4k|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  236|  47.4k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  234|  47.4k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  584|  47.4k|        break;
  585|  35.1k|    case 2:
  ------------------
  |  Branch (585:5): [True: 35.1k, False: 2.03M]
  ------------------
  586|  35.1k|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  349|  35.1k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  587|  35.1k|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  349|  35.1k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  588|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  589|       |#  pragma warning(push)
  590|       |#  pragma warning(disable : 6385) /* warning C6385: Reading invalid data from 'v'. */
  591|       |#endif
  592|  35.1k|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  349|  35.1k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  593|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  594|       |#  pragma warning(pop)
  595|       |#endif
  596|  35.1k|        break;
  597|  28.6k|    case 4:
  ------------------
  |  Branch (597:5): [True: 28.6k, False: 2.04M]
  ------------------
  598|  28.6k|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  349|  28.6k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  599|  28.6k|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  349|  28.6k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  600|  28.6k|        break;
  601|  1.96M|    default:
  ------------------
  |  Branch (601:5): [True: 1.96M, False: 111k]
  ------------------
  602|  1.96M|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  603|  1.96M|        return;
  604|  2.07M|    }
  605|       |
  606|   111k|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  349|   111k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  607|   111k|    dstPtr += 8;
  608|  16.6M|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (608:12): [True: 16.5M, False: 111k]
  ------------------
  609|  16.5M|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  349|  16.5M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  610|  16.5M|        dstPtr += 8;
  611|  16.5M|    }
  612|   111k|}
lz4.c:LZ4_wildCopy32:
  551|  18.2k|{
  552|  18.2k|    BYTE* d = (BYTE*)dstPtr;
  553|  18.2k|    const BYTE* s = (const BYTE*)srcPtr;
  554|  18.2k|    BYTE* const e = (BYTE*)dstEnd;
  555|       |
  556|   569k|    do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  349|   569k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
                  do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  349|   569k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (556:79): [True: 550k, False: 18.2k]
  ------------------
  557|  18.2k|}
lz4.c:LZ4_copyMatchExact:
 2179|  2.89k|{
 2180|  2.89k|    if (unlikely(match == op)) {   /* invalid offset 0 : clear the match segment, see doc/lz4_Block_format.md */
  ------------------
  |  |  180|  2.89k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  2.89k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 70, False: 2.82k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2181|     70|        MEM_INIT(op, 0, length);
  ------------------
  |  |  236|     70|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  234|     70|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 2182|     70|        return op + length;
 2183|     70|    }
 2184|       |    /* bytes from match to op repeat with period (op-match) :
 2185|       |     * copy all of them, so the distance doubles at each round.
 2186|       |     * Beyond 2 KB, keep the distance : larger copies of just written data are slower */
 2187|  52.3k|    while (length > (size_t)(op - match)) {
  ------------------
  |  Branch (2187:12): [True: 49.5k, False: 2.82k]
  ------------------
 2188|  49.5k|        size_t const available = (size_t)(op - match);
 2189|  49.5k|        LZ4_memcpy(op, match, available);
  ------------------
  |  |  349|  49.5k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2190|  49.5k|        op += available;
 2191|  49.5k|        length -= available;
 2192|  49.5k|        if (available >= 2048) match += available;
  ------------------
  |  Branch (2192:13): [True: 44.0k, False: 5.54k]
  ------------------
 2193|  49.5k|    }
 2194|  2.82k|    LZ4_memcpy(op, match, length);
  ------------------
  |  |  349|  2.82k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2195|  2.82k|    return op + length;
 2196|  2.89k|}
lz4.c:LZ4_memcpy_using_offset_base:
  497|  2.12M|{
  498|  2.12M|    assert(srcPtr + offset == dstPtr);
  ------------------
  |  Branch (498:5): [True: 0, False: 2.12M]
  |  Branch (498:5): [True: 2.12M, False: 0]
  ------------------
  499|  2.12M|    if (unlikely(offset < 8)) {
  ------------------
  |  |  180|  2.12M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  2.12M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 1.95M, False: 178k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  500|  1.95M|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  501|  1.95M|        dstPtr[0] = srcPtr[0];
  502|  1.95M|        dstPtr[1] = srcPtr[1];
  503|  1.95M|        dstPtr[2] = srcPtr[2];
  504|  1.95M|        dstPtr[3] = srcPtr[3];
  505|  1.95M|        srcPtr += inc32table[offset];
  506|  1.95M|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  349|  1.95M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  507|  1.95M|        srcPtr -= dec64table[offset];
  508|  1.95M|    } else {
  509|   178k|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  349|   178k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  510|   178k|        srcPtr += 8;
  511|   178k|    }
  512|  2.12M|    dstPtr += 8;
  513|       |
  514|       |    /* srcPtr is now at least 8 bytes behind dstPtr */
  515|  2.12M|    LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  349|  2.12M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  516|  2.12M|    if (dstEnd > dstPtr + 8) { LZ4_wildCopy8(dstPtr + 8, srcPtr + 8, dstEnd); }
  ------------------
  |  Branch (516:9): [True: 224k, False: 1.90M]
  ------------------
  517|  2.12M|}
lz4.c:LZ4_decompress_safe_withSmallPrefix:
 2643|  21.3k|{
 2644|  21.3k|    return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
 2645|  21.3k|                                  decode_full_block, noDict,
 2646|       |                                  (BYTE*)dest-prefixSize, NULL, 0);
 2647|  21.3k|}

LZ4F_isError:
  351|  92.8k|{
  352|  92.8k|    return (code > (LZ4F_errorCode_t)(-LZ4F_ERROR_maxCode));
  353|  92.8k|}
LZ4F_getBlockSize:
  412|  14.1k|{
  413|  14.1k|    static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  268|  14.1k|#  define KB *(1<<10)
  ------------------
                  static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  268|  14.1k|#  define KB *(1<<10)
  ------------------
                  static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  269|  14.1k|#  define MB *(1<<20)
  ------------------
                  static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  269|  14.1k|#  define MB *(1<<20)
  ------------------
  414|       |
  415|  14.1k|    if (blockSizeID == 0) blockSizeID = LZ4F_BLOCKSIZEID_DEFAULT;
  ------------------
  |  |  280|      0|#define LZ4F_BLOCKSIZEID_DEFAULT LZ4F_max64KB
  ------------------
  |  Branch (415:9): [True: 0, False: 14.1k]
  ------------------
  416|  14.1k|    if (blockSizeID < LZ4F_max64KB || blockSizeID > LZ4F_max4MB)
  ------------------
  |  Branch (416:9): [True: 0, False: 14.1k]
  |  Branch (416:39): [True: 0, False: 14.1k]
  ------------------
  417|      0|        RETURN_ERROR(maxBlockSize_invalid);
  ------------------
  |  |  375|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  418|  14.1k|    {   int const blockSizeIdx = (int)blockSizeID - (int)LZ4F_max64KB;
  419|  14.1k|        return blockSizes[blockSizeIdx];
  420|  14.1k|}   }
LZ4F_createDecompressionContext_advanced:
 2755|  3.71k|{
 2756|  3.71k|    LZ4F_dctx* const dctx = (LZ4F_dctx*)LZ4F_calloc(sizeof(LZ4F_dctx), customMem);
 2757|  3.71k|    if (dctx == NULL) return NULL;
  ------------------
  |  Branch (2757:9): [True: 0, False: 3.71k]
  ------------------
 2758|       |
 2759|  3.71k|    dctx->cmem = customMem;
 2760|  3.71k|    dctx->version = version;
 2761|  3.71k|    return dctx;
 2762|  3.71k|}
LZ4F_createDecompressionContext:
 2772|  3.71k|{
 2773|  3.71k|    assert(LZ4F_decompressionContextPtr != NULL);  /* violation of narrow contract */
  ------------------
  |  Branch (2773:5): [True: 0, False: 3.71k]
  |  Branch (2773:5): [True: 3.71k, False: 0]
  ------------------
 2774|  3.71k|    RETURN_ERROR_IF(LZ4F_decompressionContextPtr == NULL, parameter_null);  /* in case it nonetheless happen in production */
  ------------------
  |  |  377|  3.71k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  378|  3.71k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (378:13): [True: 0, False: 3.71k]
  |  |  ------------------
  |  |  379|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  191|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  380|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  375|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  381|      0|        }                          \
  |  |  382|  3.71k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (382:14): [Folded, False: 3.71k]
  |  |  ------------------
  ------------------
 2775|       |
 2776|  3.71k|    *LZ4F_decompressionContextPtr = LZ4F_createDecompressionContext_advanced(LZ4F_defaultCMem, versionNumber);
 2777|  3.71k|    if (*LZ4F_decompressionContextPtr == NULL) {  /* failed allocation */
  ------------------
  |  Branch (2777:9): [True: 0, False: 3.71k]
  ------------------
 2778|      0|        RETURN_ERROR(allocation_failed);
  ------------------
  |  |  375|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
 2779|      0|    }
 2780|  3.71k|    return LZ4F_OK_NoError;
 2781|  3.71k|}
LZ4F_freeDecompressionContext:
 2784|  3.71k|{
 2785|  3.71k|    LZ4F_errorCode_t result = LZ4F_OK_NoError;
 2786|  3.71k|    if (dctx != NULL) {   /* can accept NULL input, like free() */
  ------------------
  |  Branch (2786:9): [True: 3.71k, False: 0]
  ------------------
 2787|  3.71k|      result = (LZ4F_errorCode_t)dctx->dStage;
 2788|  3.71k|      LZ4F_free(dctx->tmpIn, dctx->cmem);
 2789|  3.71k|      LZ4F_free(dctx->tmpOutBuffer, dctx->cmem);
 2790|  3.71k|      LZ4F_free(dctx, dctx->cmem);
 2791|  3.71k|    }
 2792|  3.71k|    return result;
 2793|  3.71k|}
LZ4F_resetDecompressionContext:
 2805|  15.1k|{
 2806|  15.1k|    DEBUGLOG(5, "LZ4F_resetDecompressionContext");
  ------------------
  |  |  191|  15.1k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 2807|  15.1k|    dctx->dStage = dstage_getFrameHeader;
 2808|       |    dctx->dict = NULL;
 2809|  15.1k|    dctx->dictSize = 0;
 2810|  15.1k|    dctx->skipBlockChecksum = 0;
 2811|  15.1k|    dctx->skipContentChecksum = 0;
 2812|  15.1k|    dctx->frameRemainingSize = 0;
 2813|  15.1k|}
LZ4F_decompress:
 3175|  14.8k|{
 3176|  14.8k|    static const BYTE emptySrc = 0;   /* NULL srcBuffer (no input, used by LZ4F_getFrameInfo()) points here instead :
 3177|       |                                       * NULL+0 and memcpy(dst, NULL, 0) are UB */
 3178|  14.8k|    LZ4F_decompressOptions_t optionsNull;
 3179|  14.8k|    const BYTE* const srcStart = srcBuffer ? (const BYTE*)srcBuffer : &emptySrc;
  ------------------
  |  Branch (3179:34): [True: 14.8k, False: 0]
  ------------------
 3180|  14.8k|    const BYTE* const srcEnd = srcBuffer ? srcStart + *srcSizePtr : srcStart;
  ------------------
  |  Branch (3180:32): [True: 14.8k, False: 0]
  ------------------
 3181|  14.8k|    const BYTE* srcPtr = srcStart;
 3182|  14.8k|    BYTE* const dstStart = (BYTE*)dstBuffer;
 3183|  14.8k|    BYTE* const dstEnd = dstStart ? dstStart + *dstSizePtr : NULL;
  ------------------
  |  Branch (3183:26): [True: 14.8k, False: 0]
  ------------------
 3184|  14.8k|    BYTE* dstPtr = dstStart;
 3185|  14.8k|    const BYTE* selectedIn = NULL;
 3186|  14.8k|    unsigned doAnotherStage = 1;
 3187|  14.8k|    size_t nextSrcSizeHint = 1;
 3188|       |
 3189|       |
 3190|  14.8k|    DEBUGLOG(5, "LZ4F_decompress: src[%p](%u) => dst[%p](%u)",
  ------------------
  |  |  191|  14.8k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3191|  14.8k|            srcBuffer, (unsigned)*srcSizePtr, dstBuffer, (unsigned)*dstSizePtr);
 3192|  14.8k|    if (dstBuffer == NULL) assert(*dstSizePtr == 0);
  ------------------
  |  Branch (3192:9): [True: 0, False: 14.8k]
  |  Branch (3192:28): [True: 0, False: 0]
  |  Branch (3192:28): [True: 0, False: 0]
  ------------------
 3193|  14.8k|    if (srcBuffer == NULL) assert(*srcSizePtr == 0);
  ------------------
  |  Branch (3193:9): [True: 0, False: 14.8k]
  |  Branch (3193:28): [True: 0, False: 0]
  |  Branch (3193:28): [True: 0, False: 0]
  ------------------
 3194|  14.8k|    MEM_INIT(&optionsNull, 0, sizeof(optionsNull));
  ------------------
  |  |  109|  14.8k|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
 3195|  14.8k|    if (decompressOptionsPtr==NULL) decompressOptionsPtr = &optionsNull;
  ------------------
  |  Branch (3195:9): [True: 0, False: 14.8k]
  ------------------
 3196|  14.8k|    *srcSizePtr = 0;
 3197|  14.8k|    *dstSizePtr = 0;
 3198|  14.8k|    assert(dctx != NULL);
  ------------------
  |  Branch (3198:5): [True: 0, False: 14.8k]
  |  Branch (3198:5): [True: 14.8k, False: 0]
  ------------------
 3199|  14.8k|    if (decompressOptionsPtr->skipChecksums) {   /* once set, disable for the remainder of the frame */
  ------------------
  |  Branch (3199:9): [True: 5.48k, False: 9.39k]
  ------------------
 3200|  5.48k|        dctx->skipBlockChecksum = 1;
 3201|  5.48k|        dctx->skipContentChecksum = 1;
 3202|  5.48k|    }
 3203|       |
 3204|       |    /* behaves as a state machine */
 3205|       |
 3206|   225k|    while (doAnotherStage) {
  ------------------
  |  Branch (3206:12): [True: 220k, False: 5.04k]
  ------------------
 3207|       |
 3208|   220k|        switch(dctx->dStage)
  ------------------
  |  Branch (3208:16): [True: 220k, False: 0]
  ------------------
 3209|   220k|        {
 3210|       |
 3211|  14.8k|        case dstage_getFrameHeader:
  ------------------
  |  Branch (3211:9): [True: 14.8k, False: 205k]
  ------------------
 3212|  14.8k|            DEBUGLOG(6, "dstage_getFrameHeader");
  ------------------
  |  |  191|  14.8k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3213|  14.8k|            if ((size_t)(srcEnd-srcPtr) >= maxFHSize) {  /* enough to decode - shortcut */
  ------------------
  |  Branch (3213:17): [True: 12.5k, False: 2.32k]
  ------------------
 3214|  12.5k|                size_t const hSize = LZ4F_decodeHeader(dctx, srcPtr, (size_t)(srcEnd-srcPtr));  /* will update dStage appropriately */
 3215|  12.5k|                if (LZ4F_isError(hSize)) { nextSrcSizeHint = hSize; goto _output; }
  ------------------
  |  Branch (3215:21): [True: 52, False: 12.5k]
  ------------------
 3216|  12.5k|                srcPtr += hSize;
 3217|  12.5k|                break;
 3218|  12.5k|            }
 3219|  2.32k|            dctx->tmpInSize = 0;
 3220|  2.32k|            if (srcEnd-srcPtr == 0) return minFHSize;   /* 0-size input */
  ------------------
  |  Branch (3220:17): [True: 92, False: 2.22k]
  ------------------
 3221|  2.22k|            dctx->tmpInTarget = minFHSize;   /* minimum size to decode header */
 3222|  2.22k|            dctx->dStage = dstage_storeFrameHeader;
 3223|       |            /* fall-through */
 3224|       |
 3225|  2.26k|        case dstage_storeFrameHeader:
  ------------------
  |  Branch (3225:9): [True: 40, False: 220k]
  ------------------
 3226|  2.26k|            DEBUGLOG(6, "dstage_storeFrameHeader");
  ------------------
  |  |  191|  2.26k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3227|  2.26k|            {   size_t const sizeToCopy = MIN(dctx->tmpInTarget - dctx->tmpInSize, (size_t)(srcEnd - srcPtr));
  ------------------
  |  |  426|  2.26k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (426:22): [True: 1.88k, False: 384]
  |  |  ------------------
  ------------------
 3228|  2.26k|                memcpy(dctx->header + dctx->tmpInSize, srcPtr, sizeToCopy);
 3229|  2.26k|                dctx->tmpInSize += sizeToCopy;
 3230|  2.26k|                srcPtr += sizeToCopy;
 3231|  2.26k|            }
 3232|  2.26k|            if (dctx->tmpInSize < dctx->tmpInTarget) {
  ------------------
  |  Branch (3232:17): [True: 60, False: 2.20k]
  ------------------
 3233|     60|                nextSrcSizeHint = (dctx->tmpInTarget - dctx->tmpInSize) + BHSize;   /* rest of header + nextBlockHeader */
 3234|     60|                doAnotherStage = 0;   /* not enough src data, ask for some more */
 3235|     60|                break;
 3236|     60|            }
 3237|  2.20k|            {   size_t const hSize = LZ4F_decodeHeader(dctx, dctx->header, dctx->tmpInTarget); /* will update dStage appropriately */
 3238|  2.20k|                if (LZ4F_isError(hSize)) { nextSrcSizeHint = hSize; goto _output; }
  ------------------
  |  Branch (3238:21): [True: 188, False: 2.02k]
  ------------------
 3239|  2.20k|            }
 3240|  2.02k|            break;
 3241|       |
 3242|  14.1k|        case dstage_init:
  ------------------
  |  Branch (3242:9): [True: 14.1k, False: 206k]
  ------------------
 3243|  14.1k|            DEBUGLOG(6, "dstage_init");
  ------------------
  |  |  191|  14.1k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3244|  14.1k|            if (dctx->frameInfo.contentChecksumFlag) (void)XXH32_reset(&(dctx->xxh), 0);
  ------------------
  |  |  131|  9.99k|#  define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
  |  |  ------------------
  |  |  |  |  126|  9.99k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  9.99k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3244:17): [True: 9.99k, False: 4.19k]
  ------------------
 3245|       |            /* internal buffers allocation */
 3246|  14.1k|            {   size_t const tmpInNeeded = dctx->maxBlockSize + BFSize /* block checksum */;
 3247|  14.1k|                size_t const tmpOutNeeded = dctx->maxBlockSize
 3248|  14.1k|                    + ((dctx->frameInfo.blockMode==LZ4F_blockLinked) ? 128 KB : 0);
  ------------------
  |  |  268|  11.8k|#  define KB *(1<<10)
  ------------------
  |  Branch (3248:24): [True: 11.8k, False: 2.32k]
  ------------------
 3249|  14.1k|                if ( (tmpInNeeded > dctx->tmpInCapacity)
  ------------------
  |  Branch (3249:22): [True: 3.54k, False: 10.6k]
  ------------------
 3250|  10.6k|                  || (tmpOutNeeded > dctx->tmpOutBufferCapacity) ) {   /* tmp buffers too small */
  ------------------
  |  Branch (3250:22): [True: 0, False: 10.6k]
  ------------------
 3251|       |                    /* capacities remain 0 until allocation succeeds,
 3252|       |                     * so that allocation will be re-attempted on next entry */
 3253|  3.54k|                    LZ4F_free(dctx->tmpIn, dctx->cmem);
 3254|  3.54k|                    dctx->tmpInCapacity = 0;
 3255|  3.54k|                    dctx->tmpIn = (BYTE*)LZ4F_malloc(tmpInNeeded, dctx->cmem);
 3256|  3.54k|                    if (dctx->tmpIn == NULL) {
  ------------------
  |  Branch (3256:25): [True: 0, False: 3.54k]
  ------------------
 3257|      0|                        nextSrcSizeHint = LZ4F_returnErrorCode(LZ4F_ERROR_allocation_failed);
 3258|      0|                        goto _output;
 3259|      0|                    }
 3260|  3.54k|                    dctx->tmpInCapacity = tmpInNeeded;
 3261|  3.54k|                    LZ4F_free(dctx->tmpOutBuffer, dctx->cmem);
 3262|  3.54k|                    dctx->tmpOutBufferCapacity = 0;
 3263|  3.54k|                    dctx->tmpOutBuffer= (BYTE*)LZ4F_malloc(tmpOutNeeded, dctx->cmem);
 3264|  3.54k|                    if (dctx->tmpOutBuffer== NULL) {
  ------------------
  |  Branch (3264:25): [True: 0, False: 3.54k]
  ------------------
 3265|      0|                        nextSrcSizeHint = LZ4F_returnErrorCode(LZ4F_ERROR_allocation_failed);
 3266|      0|                        goto _output;
 3267|      0|                    }
 3268|  3.54k|                    dctx->tmpOutBufferCapacity = tmpOutNeeded;
 3269|  3.54k|            }   }
 3270|  14.1k|            dctx->tmpInSize = 0;
 3271|  14.1k|            dctx->tmpInTarget = 0;
 3272|  14.1k|            dctx->tmpOut = dctx->tmpOutBuffer;
 3273|  14.1k|            dctx->tmpOutStart = 0;
 3274|  14.1k|            dctx->tmpOutSize = 0;
 3275|       |
 3276|  14.1k|            dctx->dStage = dstage_getBlockHeader;
 3277|       |            /* fall-through */
 3278|       |
 3279|  99.6k|        case dstage_getBlockHeader:
  ------------------
  |  Branch (3279:9): [True: 85.4k, False: 135k]
  ------------------
 3280|  99.6k|            selectedIn = LZ4F_gatherInput(dctx, dctx->tmpIn, BHSize, &srcPtr, srcEnd);
 3281|  99.6k|            if (selectedIn == NULL) {   /* not enough input for cBlockSize */
  ------------------
  |  Branch (3281:17): [True: 2.12k, False: 97.5k]
  ------------------
 3282|  2.12k|                nextSrcSizeHint = BHSize - dctx->tmpInSize;
 3283|  2.12k|                doAnotherStage = 0;
 3284|  2.12k|                break;
 3285|  2.12k|            }
 3286|       |
 3287|       |            /* decode block header */
 3288|  97.5k|            {   U32 const blockHeader = LZ4F_readLE32(selectedIn);
 3289|  97.5k|                size_t const nextCBlockSize = blockHeader & 0x7FFFFFFFU;
 3290|  97.5k|                size_t const crcSize = dctx->frameInfo.blockChecksumFlag * BFSize;
 3291|  97.5k|                if (blockHeader==0) {  /* frameEnd signal, no more block */
  ------------------
  |  Branch (3291:21): [True: 746, False: 96.7k]
  ------------------
 3292|    746|                    DEBUGLOG(5, "end of frame");
  ------------------
  |  |  191|    746|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3293|    746|                    dctx->dStage = dstage_getSuffix;
 3294|    746|                    break;
 3295|    746|                }
 3296|  96.7k|                if (nextCBlockSize > dctx->maxBlockSize) {
  ------------------
  |  Branch (3296:21): [True: 886, False: 95.8k]
  ------------------
 3297|    886|                    nextSrcSizeHint = LZ4F_returnErrorCode(LZ4F_ERROR_maxBlockSize_invalid);
 3298|    886|                    goto _output;
 3299|    886|                }
 3300|  95.8k|                if (blockHeader & LZ4F_BLOCKUNCOMPRESSED_FLAG) {
  ------------------
  |  |  279|  95.8k|#define LZ4F_BLOCKUNCOMPRESSED_FLAG 0x80000000U
  ------------------
  |  Branch (3300:21): [True: 17.4k, False: 78.4k]
  ------------------
 3301|       |                    /* next block is uncompressed */
 3302|  17.4k|                    if (dctx->frameInfo.contentSize && nextCBlockSize > dctx->frameRemainingSize) {
  ------------------
  |  Branch (3302:25): [True: 2.94k, False: 14.4k]
  |  Branch (3302:56): [True: 18, False: 2.92k]
  ------------------
 3303|     18|                        nextSrcSizeHint = LZ4F_returnErrorCode(LZ4F_ERROR_frameSize_wrong);
 3304|     18|                        goto _output;
 3305|     18|                    }
 3306|  17.4k|                    dctx->tmpInTarget = nextCBlockSize;
 3307|  17.4k|                    DEBUGLOG(5, "next block is uncompressed (size %u)", (U32)nextCBlockSize);
  ------------------
  |  |  191|  17.4k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3308|  17.4k|                    if (dctx->frameInfo.blockChecksumFlag) {
  ------------------
  |  Branch (3308:25): [True: 9.00k, False: 8.41k]
  ------------------
 3309|  9.00k|                        (void)XXH32_reset(&dctx->blockChecksum, 0);
  ------------------
  |  |  131|  9.00k|#  define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
  |  |  ------------------
  |  |  |  |  126|  9.00k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  9.00k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3310|  9.00k|                    }
 3311|  17.4k|                    dctx->dStage = dstage_copyDirect;
 3312|  17.4k|                    break;
 3313|  17.4k|                }
 3314|       |                /* next block is a compressed block */
 3315|  78.4k|                dctx->tmpInTarget = nextCBlockSize + crcSize;
 3316|  78.4k|                dctx->dStage = dstage_getCBlock;
 3317|  78.4k|                if (dstPtr==dstEnd || srcPtr==srcEnd) {
  ------------------
  |  Branch (3317:21): [True: 26, False: 78.4k]
  |  Branch (3317:39): [True: 74, False: 78.3k]
  ------------------
 3318|    100|                    nextSrcSizeHint = BHSize + nextCBlockSize + crcSize;
 3319|    100|                    doAnotherStage = 0;
 3320|    100|                }
 3321|  78.4k|                break;
 3322|  95.8k|            }
 3323|       |
 3324|  17.4k|        case dstage_copyDirect:   /* uncompressed block */
  ------------------
  |  Branch (3324:9): [True: 17.4k, False: 203k]
  ------------------
 3325|  17.4k|            DEBUGLOG(6, "dstage_copyDirect");
  ------------------
  |  |  191|  17.4k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3326|  17.4k|            {   size_t sizeToCopy;
 3327|  17.4k|                if (dstPtr == NULL) {
  ------------------
  |  Branch (3327:21): [True: 0, False: 17.4k]
  ------------------
 3328|      0|                    sizeToCopy = 0;
 3329|  17.4k|                } else {
 3330|  17.4k|                    size_t const minBuffSize = MIN((size_t)(srcEnd-srcPtr), (size_t)(dstEnd-dstPtr));
  ------------------
  |  |  426|  17.4k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (426:22): [True: 14.4k, False: 2.97k]
  |  |  ------------------
  ------------------
 3331|  17.4k|                    sizeToCopy = MIN(dctx->tmpInTarget, minBuffSize);
  ------------------
  |  |  426|  17.4k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (426:22): [True: 15.0k, False: 2.31k]
  |  |  ------------------
  ------------------
 3332|  17.4k|                    memcpy(dstPtr, srcPtr, sizeToCopy);
 3333|  17.4k|                    if (dctx->frameInfo.blockChecksumFlag && !dctx->skipBlockChecksum)
  ------------------
  |  Branch (3333:25): [True: 9.00k, False: 8.41k]
  |  Branch (3333:62): [True: 7.39k, False: 1.60k]
  ------------------
 3334|  7.39k|                        (void)XXH32_update(&dctx->blockChecksum, srcPtr, sizeToCopy);
  ------------------
  |  |  132|  7.39k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  7.39k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  7.39k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3335|  17.4k|                    if (dctx->frameInfo.contentChecksumFlag && !dctx->skipContentChecksum)
  ------------------
  |  Branch (3335:25): [True: 12.7k, False: 4.65k]
  |  Branch (3335:64): [True: 9.58k, False: 3.17k]
  ------------------
 3336|  9.58k|                        (void)XXH32_update(&dctx->xxh, srcPtr, sizeToCopy);
  ------------------
  |  |  132|  9.58k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  9.58k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  9.58k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3337|  17.4k|                    if (dctx->frameInfo.contentSize)
  ------------------
  |  Branch (3337:25): [True: 2.92k, False: 14.4k]
  ------------------
 3338|  2.92k|                        dctx->frameRemainingSize -= sizeToCopy;
 3339|       |
 3340|       |                    /* history management (linked blocks only), unless the frame ends with this block */
 3341|  17.4k|                    if ( (dctx->frameInfo.blockMode == LZ4F_blockLinked)
  ------------------
  |  Branch (3341:26): [True: 14.5k, False: 2.85k]
  ------------------
 3342|  14.5k|                      && !( (sizeToCopy == dctx->tmpInTarget)
  ------------------
  |  Branch (3342:29): [True: 13.8k, False: 726]
  ------------------
 3343|  14.4k|                         && LZ4F_endMarkFollows(srcPtr + sizeToCopy, srcEnd, dctx->frameInfo.blockChecksumFlag * BFSize) ) ) {
  ------------------
  |  Branch (3343:29): [True: 90, False: 13.7k]
  ------------------
 3344|  14.4k|                        LZ4F_updateDict(dctx, dstPtr, sizeToCopy, dstStart, 0);
 3345|  14.4k|                    }
 3346|  17.4k|                    srcPtr += sizeToCopy;
 3347|  17.4k|                    dstPtr += sizeToCopy;
 3348|  17.4k|                }
 3349|  17.4k|                if (sizeToCopy == dctx->tmpInTarget) {   /* all done */
  ------------------
  |  Branch (3349:21): [True: 16.4k, False: 960]
  ------------------
 3350|  16.4k|                    if (dctx->frameInfo.blockChecksumFlag)
  ------------------
  |  Branch (3350:25): [True: 8.80k, False: 7.64k]
  ------------------
 3351|  8.80k|                        dctx->dStage = dstage_getBlockChecksum;
 3352|  7.64k|                    else
 3353|  7.64k|                        dctx->dStage = dstage_getBlockHeader;  /* new block */
 3354|  16.4k|                    break;
 3355|  16.4k|                }
 3356|    960|                dctx->tmpInTarget -= sizeToCopy;  /* need to copy more */
 3357|    960|            }
 3358|      0|            nextSrcSizeHint = dctx->tmpInTarget
 3359|    960|                            + (dctx->frameInfo.blockChecksumFlag ? BFSize : 0)
  ------------------
  |  Branch (3359:32): [True: 194, False: 766]
  ------------------
 3360|    960|                            + BHSize /* next header size */;
 3361|    960|            doAnotherStage = 0;
 3362|    960|            break;
 3363|       |
 3364|       |        /* check block checksum for recently transferred uncompressed block */
 3365|  8.80k|        case dstage_getBlockChecksum:
  ------------------
  |  Branch (3365:9): [True: 8.80k, False: 211k]
  ------------------
 3366|  8.80k|            DEBUGLOG(6, "dstage_getBlockChecksum");
  ------------------
  |  |  191|  8.80k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3367|  8.80k|            selectedIn = LZ4F_gatherInput(dctx, dctx->tmpIn, BFSize, &srcPtr, srcEnd);
 3368|  8.80k|            if (selectedIn == NULL) {   /* all input consumed */
  ------------------
  |  Branch (3368:17): [True: 88, False: 8.72k]
  ------------------
 3369|     88|                nextSrcSizeHint = (BFSize - dctx->tmpInSize) + BHSize /* next header size */;
 3370|     88|                doAnotherStage = 0;
 3371|     88|                break;
 3372|     88|            }
 3373|  8.72k|            if (!dctx->skipBlockChecksum) {
  ------------------
  |  Branch (3373:17): [True: 7.24k, False: 1.47k]
  ------------------
 3374|  7.24k|                U32 const readCRC = LZ4F_readLE32(selectedIn);
 3375|  7.24k|                U32 const calcCRC = XXH32_digest(&dctx->blockChecksum);
  ------------------
  |  |  133|  7.24k|#  define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
  |  |  ------------------
  |  |  |  |  126|  7.24k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  7.24k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3376|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 3377|       |                DEBUGLOG(6, "compare block checksum");
 3378|       |                if (readCRC != calcCRC) {
 3379|       |                    DEBUGLOG(4, "incorrect block checksum: %08X != %08X",
 3380|       |                            readCRC, calcCRC);
 3381|       |                    nextSrcSizeHint = LZ4F_returnErrorCode(LZ4F_ERROR_blockChecksum_invalid);
 3382|       |                    goto _output;
 3383|       |                }
 3384|       |#else
 3385|  7.24k|                (void)readCRC;
 3386|  7.24k|                (void)calcCRC;
 3387|  7.24k|#endif
 3388|  7.24k|            }
 3389|  8.72k|            dctx->dStage = dstage_getBlockHeader;  /* new block */
 3390|  8.72k|            break;
 3391|       |
 3392|  78.3k|        case dstage_getCBlock:
  ------------------
  |  Branch (3392:9): [True: 78.3k, False: 142k]
  ------------------
 3393|  78.3k|            DEBUGLOG(6, "dstage_getCBlock");
  ------------------
  |  |  191|  78.3k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3394|  78.3k|            selectedIn = LZ4F_gatherInput(dctx, dctx->tmpIn, dctx->tmpInTarget, &srcPtr, srcEnd);
 3395|  78.3k|            if (selectedIn == NULL) {   /* need more input */
  ------------------
  |  Branch (3395:17): [True: 298, False: 78.0k]
  ------------------
 3396|    298|                nextSrcSizeHint = (dctx->tmpInTarget - dctx->tmpInSize)   /* block checksum included */
 3397|    298|                                + BHSize /* next header size */;
 3398|    298|                doAnotherStage = 0;
 3399|    298|                break;
 3400|    298|            }
 3401|       |
 3402|       |            /* At this stage, input is large enough to decode a block */
 3403|       |
 3404|       |            /* First, decode and control block checksum if it exists */
 3405|  78.0k|            if (dctx->frameInfo.blockChecksumFlag) {
  ------------------
  |  Branch (3405:17): [True: 7.71k, False: 70.3k]
  ------------------
 3406|  7.71k|                assert(dctx->tmpInTarget >= 4);
  ------------------
  |  Branch (3406:17): [True: 0, False: 7.71k]
  |  Branch (3406:17): [True: 7.71k, False: 0]
  ------------------
 3407|  7.71k|                dctx->tmpInTarget -= 4;
 3408|  7.71k|                if (!dctx->skipBlockChecksum) {
  ------------------
  |  Branch (3408:21): [True: 6.45k, False: 1.25k]
  ------------------
 3409|  6.45k|                    U32 const readBlockCrc = LZ4F_readLE32(selectedIn + dctx->tmpInTarget);
 3410|  6.45k|                    U32 const calcBlockCrc = XXH32(selectedIn, dctx->tmpInTarget, 0);
  ------------------
  |  |  128|  6.45k|#  define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
  |  |  ------------------
  |  |  |  |  126|  6.45k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  6.45k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3411|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 3412|       |                    if (readBlockCrc != calcBlockCrc) {
 3413|       |                        nextSrcSizeHint = LZ4F_returnErrorCode(LZ4F_ERROR_blockChecksum_invalid);
 3414|       |                        goto _output;
 3415|       |                    }
 3416|       |#else
 3417|  6.45k|                    (void)readBlockCrc;
 3418|  6.45k|                    (void)calcBlockCrc;
 3419|  6.45k|#endif
 3420|  6.45k|            }   }
 3421|       |
 3422|       |            /* decode directly into destination buffer if there is enough room */
 3423|  78.0k|            if ( ((size_t)(dstEnd-dstPtr) >= dctx->maxBlockSize)
  ------------------
  |  Branch (3423:18): [True: 34.2k, False: 43.8k]
  ------------------
 3424|       |                 /* unless the dictionary is stored in tmpOut:
 3425|       |                  * in which case it's faster to decode within tmpOut
 3426|       |                  * to benefit from prefix speedup */
 3427|  34.2k|              && !(dctx->dict!= NULL && (const BYTE*)dctx->dict + dctx->dictSize == dctx->tmpOut) )
  ------------------
  |  Branch (3427:20): [True: 33.5k, False: 648]
  |  Branch (3427:41): [True: 0, False: 33.5k]
  ------------------
 3428|  34.2k|            {   size_t const decodedSize = LZ4F_decodeBlock(dctx, selectedIn, dctx->tmpInTarget, dstPtr);
 3429|  34.2k|                if (LZ4F_isError(decodedSize)) { nextSrcSizeHint = decodedSize; goto _output; }
  ------------------
  |  Branch (3429:21): [True: 430, False: 33.8k]
  ------------------
 3430|       |
 3431|       |                /* dictionary management, unless the frame ends with this block */
 3432|  33.8k|                if ( (dctx->frameInfo.blockMode==LZ4F_blockLinked)
  ------------------
  |  Branch (3432:22): [True: 32.9k, False: 896]
  ------------------
 3433|  32.9k|                  && !LZ4F_endMarkFollows(srcPtr, srcEnd, 0) ) {
  ------------------
  |  Branch (3433:22): [True: 32.9k, False: 18]
  ------------------
 3434|  32.9k|                    LZ4F_updateDict(dctx, dstPtr, decodedSize, dstStart, 0);
 3435|  32.9k|                }
 3436|       |
 3437|  33.8k|                dstPtr += decodedSize;
 3438|  33.8k|                dctx->dStage = dstage_getBlockHeader;  /* end of block, let's get another one */
 3439|  33.8k|                break;
 3440|  34.2k|            }
 3441|       |
 3442|       |            /* not enough place into dst : decode into tmpOut */
 3443|       |
 3444|       |            /* manage dictionary */
 3445|  43.8k|            if (dctx->frameInfo.blockMode == LZ4F_blockLinked) {
  ------------------
  |  Branch (3445:17): [True: 40.0k, False: 3.72k]
  ------------------
 3446|  40.0k|                if (dctx->dict == dctx->tmpOutBuffer) {
  ------------------
  |  Branch (3446:21): [True: 14.9k, False: 25.1k]
  ------------------
 3447|       |                    /* truncate dictionary to 64 KB if too big */
 3448|  14.9k|                    if (dctx->dictSize > 128 KB) {
  ------------------
  |  |  268|  14.9k|#  define KB *(1<<10)
  ------------------
  |  Branch (3448:25): [True: 0, False: 14.9k]
  ------------------
 3449|      0|                        memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - 64 KB, 64 KB);
  ------------------
  |  |  268|      0|#  define KB *(1<<10)
  ------------------
                                      memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - 64 KB, 64 KB);
  ------------------
  |  |  268|      0|#  define KB *(1<<10)
  ------------------
 3450|      0|                        dctx->dictSize = 64 KB;
  ------------------
  |  |  268|      0|#  define KB *(1<<10)
  ------------------
 3451|      0|                    }
 3452|  14.9k|                    dctx->tmpOut = dctx->tmpOutBuffer + dctx->dictSize;
 3453|  25.1k|                } else {  /* dict not within tmpOut */
 3454|  25.1k|                    size_t const reservedDictSpace = MIN(dctx->dictSize, 64 KB);
  ------------------
  |  |  426|  25.1k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (426:22): [True: 20.9k, False: 4.22k]
  |  |  ------------------
  ------------------
 3455|  25.1k|                    dctx->tmpOut = dctx->tmpOutBuffer + reservedDictSpace;
 3456|  25.1k|            }   }
 3457|       |
 3458|       |            /* Decode block into tmpOut */
 3459|  43.8k|            {   size_t const decodedSize = LZ4F_decodeBlock(dctx, selectedIn, dctx->tmpInTarget, dctx->tmpOut);
 3460|  43.8k|                if (LZ4F_isError(decodedSize)) { nextSrcSizeHint = decodedSize; goto _output; }
  ------------------
  |  Branch (3460:21): [True: 7.74k, False: 36.0k]
  ------------------
 3461|  36.0k|                dctx->tmpOutSize = decodedSize;
 3462|  36.0k|                dctx->tmpOutStart = 0;
 3463|  36.0k|                dctx->dStage = dstage_flushOut;
 3464|  36.0k|            }
 3465|       |            /* fall-through */
 3466|       |
 3467|  36.0k|        case dstage_flushOut:  /* flush decoded data from tmpOut to dstBuffer */
  ------------------
  |  Branch (3467:9): [True: 0, False: 220k]
  ------------------
 3468|  36.0k|            DEBUGLOG(6, "dstage_flushOut");
  ------------------
  |  |  191|  36.0k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3469|  36.0k|            if (dstPtr != NULL) {
  ------------------
  |  Branch (3469:17): [True: 36.0k, False: 0]
  ------------------
 3470|  36.0k|                size_t const sizeToCopy = MIN(dctx->tmpOutSize - dctx->tmpOutStart, (size_t)(dstEnd-dstPtr));
  ------------------
  |  |  426|  36.0k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (426:22): [True: 35.2k, False: 816]
  |  |  ------------------
  ------------------
 3471|  36.0k|                memcpy(dstPtr, dctx->tmpOut + dctx->tmpOutStart, sizeToCopy);
 3472|       |
 3473|       |                /* dictionary management, unless the frame ends with this block */
 3474|  36.0k|                if ( (dctx->frameInfo.blockMode == LZ4F_blockLinked)
  ------------------
  |  Branch (3474:22): [True: 33.3k, False: 2.74k]
  ------------------
 3475|  33.3k|                  && !( (dctx->tmpOutStart + sizeToCopy == dctx->tmpOutSize)
  ------------------
  |  Branch (3475:25): [True: 32.5k, False: 732]
  ------------------
 3476|  32.5k|                     && LZ4F_endMarkFollows(srcPtr, srcEnd, 0) ) )
  ------------------
  |  Branch (3476:25): [True: 112, False: 32.4k]
  ------------------
 3477|  33.2k|                    LZ4F_updateDict(dctx, dstPtr, sizeToCopy, dstStart, 1 /*withinTmp*/);
 3478|       |
 3479|  36.0k|                dctx->tmpOutStart += sizeToCopy;
 3480|  36.0k|                dstPtr += sizeToCopy;
 3481|  36.0k|            }
 3482|  36.0k|            if (dctx->tmpOutStart == dctx->tmpOutSize) { /* all flushed */
  ------------------
  |  Branch (3482:17): [True: 35.2k, False: 798]
  ------------------
 3483|  35.2k|                dctx->dStage = dstage_getBlockHeader;  /* get next block */
 3484|  35.2k|                break;
 3485|  35.2k|            }
 3486|       |            /* could not flush everything : stop there, just request a block header */
 3487|    798|            doAnotherStage = 0;
 3488|    798|            nextSrcSizeHint = BHSize;
 3489|    798|            break;
 3490|       |
 3491|    746|        case dstage_getSuffix:
  ------------------
  |  Branch (3491:9): [True: 746, False: 219k]
  ------------------
 3492|    746|            if (dctx->frameRemainingSize) {   /* incorrect frame size decoded */
  ------------------
  |  Branch (3492:17): [True: 422, False: 324]
  ------------------
 3493|    422|                nextSrcSizeHint = LZ4F_returnErrorCode(LZ4F_ERROR_frameSize_wrong);
 3494|    422|                goto _output;
 3495|    422|            }
 3496|    324|            if (!dctx->frameInfo.contentChecksumFlag) {  /* no checksum, frame is completed */
  ------------------
  |  Branch (3496:17): [True: 14, False: 310]
  ------------------
 3497|     14|                nextSrcSizeHint = 0;
 3498|     14|                LZ4F_resetDecompressionContext(dctx);
 3499|     14|                doAnotherStage = 0;
 3500|     14|                break;
 3501|     14|            }
 3502|    310|            selectedIn = LZ4F_gatherInput(dctx, dctx->tmpIn, 4, &srcPtr, srcEnd);
 3503|    310|            if (selectedIn == NULL) {   /* not enough input to read complete suffix */
  ------------------
  |  Branch (3503:17): [True: 28, False: 282]
  ------------------
 3504|     28|                nextSrcSizeHint = 4 - dctx->tmpInSize;
 3505|     28|                doAnotherStage = 0;
 3506|     28|                break;
 3507|     28|            }
 3508|    282|            if (!dctx->skipContentChecksum) {
  ------------------
  |  Branch (3508:17): [True: 246, False: 36]
  ------------------
 3509|    246|                U32 const readCRC = LZ4F_readLE32(selectedIn);
 3510|    246|                U32 const resultCRC = XXH32_digest(&(dctx->xxh));
  ------------------
  |  |  133|    246|#  define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
  |  |  ------------------
  |  |  |  |  126|    246|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|    246|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3511|    246|                DEBUGLOG(4, "frame checksum: stored 0x%0X vs 0x%0X processed", readCRC, resultCRC);
  ------------------
  |  |  191|    246|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3512|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 3513|       |                if (readCRC != resultCRC) {
 3514|       |                    nextSrcSizeHint = LZ4F_returnErrorCode(LZ4F_ERROR_contentChecksum_invalid);
 3515|       |                    goto _output;
 3516|       |                }
 3517|       |#else
 3518|    246|                (void)readCRC;
 3519|    246|                (void)resultCRC;
 3520|    246|#endif
 3521|    246|            }
 3522|    282|            nextSrcSizeHint = 0;
 3523|    282|            LZ4F_resetDecompressionContext(dctx);
 3524|    282|            doAnotherStage = 0;
 3525|    282|            break;
 3526|       |
 3527|    296|        case dstage_getSFrameSize:
  ------------------
  |  Branch (3527:9): [True: 296, False: 220k]
  ------------------
 3528|    296|            selectedIn = LZ4F_gatherInput(dctx, dctx->header + 4, 4, &srcPtr, srcEnd);
 3529|    296|            if (selectedIn == NULL) {   /* not enough input to read the skippable frame size */
  ------------------
  |  Branch (3529:17): [True: 4, False: 292]
  ------------------
 3530|      4|                nextSrcSizeHint = 4 - dctx->tmpInSize;
 3531|      4|                doAnotherStage = 0;
 3532|      4|                break;
 3533|      4|            }
 3534|    292|            {   size_t const SFrameSize = LZ4F_readLE32(selectedIn);
 3535|    292|                dctx->frameInfo.contentSize = SFrameSize;
 3536|    292|                dctx->tmpInTarget = SFrameSize;
 3537|    292|                dctx->dStage = dstage_skipSkippable;
 3538|    292|                break;
 3539|    296|            }
 3540|       |
 3541|    292|        case dstage_skipSkippable:
  ------------------
  |  Branch (3541:9): [True: 292, False: 220k]
  ------------------
 3542|    292|            {   size_t const skipSize = MIN(dctx->tmpInTarget, (size_t)(srcEnd-srcPtr));
  ------------------
  |  |  426|    292|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (426:22): [True: 12, False: 280]
  |  |  ------------------
  ------------------
 3543|    292|                srcPtr += skipSize;
 3544|    292|                dctx->tmpInTarget -= skipSize;
 3545|    292|                doAnotherStage = 0;
 3546|    292|                nextSrcSizeHint = dctx->tmpInTarget;
 3547|    292|                if (nextSrcSizeHint) break;  /* still more to skip */
  ------------------
  |  Branch (3547:21): [True: 276, False: 16]
  ------------------
 3548|       |                /* frame fully skipped : prepare context for a new frame */
 3549|     16|                LZ4F_resetDecompressionContext(dctx);
 3550|     16|                break;
 3551|    292|            }
 3552|   220k|        }   /* switch (dctx->dStage) */
 3553|   220k|    }   /* while (doAnotherStage) */
 3554|       |
 3555|       |    /* preserve history within tmpOut whenever necessary */
 3556|  5.04k|    LZ4F_STATIC_ASSERT((unsigned)dstage_init == 2);
  ------------------
  |  |  178|  5.04k|#define LZ4F_STATIC_ASSERT(c)    { enum { LZ4F_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
 3557|  5.04k|    if ( (dctx->frameInfo.blockMode==LZ4F_blockLinked)  /* next block will use up to 64KB from previous ones */
  ------------------
  |  Branch (3557:10): [True: 3.98k, False: 1.06k]
  ------------------
 3558|  3.98k|      && (dctx->dict != dctx->tmpOutBuffer)             /* dictionary is not already within tmp */
  ------------------
  |  Branch (3558:10): [True: 2.45k, False: 1.53k]
  ------------------
 3559|  2.45k|      && (dctx->dict != NULL)                           /* dictionary exists */
  ------------------
  |  Branch (3559:10): [True: 2.02k, False: 430]
  ------------------
 3560|  2.02k|      && (!decompressOptionsPtr->stableDst)             /* cannot rely on dst data to remain there for next call */
  ------------------
  |  Branch (3560:10): [True: 1.01k, False: 1.01k]
  ------------------
 3561|  1.01k|      && ((unsigned)(dctx->dStage)-2 < (unsigned)(dstage_getSuffix)-2) )  /* valid stages : [init ... getSuffix[ */
  ------------------
  |  Branch (3561:10): [True: 930, False: 80]
  ------------------
 3562|    930|    {
 3563|    930|        if (dctx->dStage == dstage_flushOut) {
  ------------------
  |  Branch (3563:13): [True: 193, False: 737]
  ------------------
 3564|    193|            LZ4F_moveDictBeforeTmpOut(dctx, 0);
 3565|    737|        } else {
 3566|    737|            const BYTE* const oldDictEnd = dctx->dict + dctx->dictSize;
 3567|    737|            size_t const newDictSize = MIN(dctx->dictSize, 64 KB);
  ------------------
  |  |  426|    737|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (426:22): [True: 721, False: 16]
  |  |  ------------------
  ------------------
 3568|       |
 3569|    737|            memcpy(dctx->tmpOutBuffer, oldDictEnd - newDictSize, newDictSize);
 3570|       |
 3571|    737|            dctx->dict = dctx->tmpOutBuffer;
 3572|    737|            dctx->dictSize = newDictSize;
 3573|    737|            dctx->tmpOut = dctx->tmpOutBuffer + newDictSize;
 3574|    737|        }
 3575|    930|    }
 3576|       |
 3577|  14.7k|_output:   /* also on error : report progress, but do not preserve history for reuse */
 3578|  14.7k|    *srcSizePtr = (size_t)(srcPtr - srcStart);
 3579|  14.7k|    *dstSizePtr = dstStart ? (size_t)(dstPtr - dstStart) : 0;
  ------------------
  |  Branch (3579:19): [True: 14.7k, False: 0]
  ------------------
 3580|  14.7k|    return nextSrcSizeHint;
 3581|  5.04k|}
LZ4F_decompress_usingDict:
 3593|  6.16k|{
 3594|  6.16k|    if (dctx->dStage <= dstage_init) {
  ------------------
  |  Branch (3594:9): [True: 6.16k, False: 0]
  ------------------
 3595|  6.16k|        dctx->dict = (const BYTE*)dict;
 3596|  6.16k|        dctx->dictSize = dictSize;
 3597|  6.16k|    }
 3598|  6.16k|    return LZ4F_decompress(dctx, dstBuffer, dstSizePtr,
 3599|  6.16k|                           srcBuffer, srcSizePtr,
 3600|  6.16k|                           decompressOptionsPtr);
 3601|  6.16k|}
lz4frame.c:LZ4F_returnErrorCode:
  369|  9.73k|{
  370|       |    /* A compilation error here means sizeof(ptrdiff_t) is not large enough */
  371|  9.73k|    LZ4F_STATIC_ASSERT(sizeof(ptrdiff_t) >= sizeof(size_t));
  ------------------
  |  |  178|  9.73k|#define LZ4F_STATIC_ASSERT(c)    { enum { LZ4F_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
  372|  9.73k|    return (LZ4F_errorCode_t)-(ptrdiff_t)code;
  373|  9.73k|}
lz4frame.c:LZ4F_free:
  155|  18.2k|{
  156|  18.2k|    if (p == NULL) return;
  ------------------
  |  Branch (156:9): [True: 7.43k, False: 10.8k]
  ------------------
  157|  10.8k|    if (cmem.customFree != NULL) {
  ------------------
  |  Branch (157:9): [True: 0, False: 10.8k]
  ------------------
  158|       |        /* custom allocation defined : use it */
  159|      0|        cmem.customFree(cmem.opaqueState, p);
  160|      0|        return;
  161|      0|    }
  162|       |    /* nothing defined : use default <stdlib.h>'s free() */
  163|  10.8k|    FREEMEM(p);
  ------------------
  |  |  124|  10.8k|#    define FREEMEM(p)        free(p)
  ------------------
  164|  10.8k|}
lz4frame.c:LZ4F_malloc:
  145|  7.09k|{
  146|       |    /* custom malloc defined : use it */
  147|  7.09k|    if (cmem.customAlloc != NULL) {
  ------------------
  |  Branch (147:9): [True: 0, False: 7.09k]
  ------------------
  148|      0|        return cmem.customAlloc(cmem.opaqueState, s);
  149|      0|    }
  150|       |    /* nothing defined : use default <stdlib.h>'s malloc() */
  151|  7.09k|    return ALLOC(s);
  ------------------
  |  |  122|  7.09k|#    define ALLOC(s)          malloc(s)
  ------------------
  152|  7.09k|}
lz4frame.c:LZ4F_calloc:
  129|  3.71k|{
  130|       |    /* custom calloc defined : use it */
  131|  3.71k|    if (cmem.customCalloc != NULL) {
  ------------------
  |  Branch (131:9): [True: 0, False: 3.71k]
  ------------------
  132|      0|        return cmem.customCalloc(cmem.opaqueState, s);
  133|      0|    }
  134|       |    /* nothing defined : use default <stdlib.h>'s calloc() */
  135|  3.71k|    if (cmem.customAlloc == NULL) {
  ------------------
  |  Branch (135:9): [True: 3.71k, False: 0]
  ------------------
  136|  3.71k|        return ALLOC_AND_ZERO(s);
  ------------------
  |  |  123|  3.71k|#    define ALLOC_AND_ZERO(s) calloc(1,(s))
  ------------------
  137|  3.71k|    }
  138|       |    /* only custom alloc defined : use it, and combine it with memset() */
  139|      0|    {   void* const p = cmem.customAlloc(cmem.opaqueState, s);
  140|      0|        if (p != NULL) MEM_INIT(p, 0, s);
  ------------------
  |  |  109|      0|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
  |  Branch (140:13): [True: 0, False: 0]
  ------------------
  141|      0|        return p;
  142|  3.71k|}   }
lz4frame.c:LZ4F_readLE32:
  218|   204k|{
  219|   204k|    const BYTE* const srcPtr = (const BYTE*)src;
  220|   204k|    U32 value32 = srcPtr[0];
  221|   204k|    value32 |= ((U32)srcPtr[1])<< 8;
  222|   204k|    value32 |= ((U32)srcPtr[2])<<16;
  223|   204k|    value32 |= ((U32)srcPtr[3])<<24;
  224|   204k|    return value32;
  225|   204k|}
lz4frame.c:LZ4F_decodeHeader:
 2824|  14.7k|{
 2825|  14.7k|    unsigned blockMode, blockChecksumFlag, contentSizeFlag, contentChecksumFlag, dictIDFlag, blockSizeID;
 2826|  14.7k|    size_t frameHeaderSize;
 2827|  14.7k|    const BYTE* srcPtr = (const BYTE*)src;
 2828|       |
 2829|  14.7k|    DEBUGLOG(5, "LZ4F_decodeHeader");
  ------------------
  |  |  191|  14.7k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 2830|  14.7k|    assert(srcSize >= minFHSize);   /* minimal frame header size */
  ------------------
  |  Branch (2830:5): [True: 0, False: 14.7k]
  |  Branch (2830:5): [True: 14.7k, False: 0]
  ------------------
 2831|  14.7k|    MEM_INIT(&(dctx->frameInfo), 0, sizeof(dctx->frameInfo));
  ------------------
  |  |  109|  14.7k|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
 2832|       |
 2833|       |    /* special case : skippable frames */
 2834|  14.7k|    if ((LZ4F_readLE32(srcPtr) & 0xFFFFFFF0U) == LZ4F_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  509|  14.7k|#define LZ4F_MAGIC_SKIPPABLE_START 0x184D2A50U
  ------------------
  |  Branch (2834:9): [True: 296, False: 14.4k]
  ------------------
 2835|    296|        dctx->frameInfo.frameType = LZ4F_skippableFrame;
 2836|    296|        dctx->dStage = dstage_getSFrameSize;
 2837|    296|        if (src == (void*)(dctx->header)) {
  ------------------
  |  Branch (2837:13): [True: 224, False: 72]
  ------------------
 2838|       |            /* the beginning of the frame size field is already gathered in header+4 */
 2839|    224|            assert(srcSize <= 8);
  ------------------
  |  Branch (2839:13): [True: 0, False: 224]
  |  Branch (2839:13): [True: 224, False: 0]
  ------------------
 2840|    224|            dctx->tmpInSize = srcSize - 4;
 2841|    224|            return srcSize;
 2842|    224|        } else {
 2843|     72|            dctx->tmpInSize = 0;
 2844|     72|            return 4;
 2845|     72|    }   }
 2846|       |
 2847|       |    /* control magic number */
 2848|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 2849|       |    if (LZ4F_readLE32(srcPtr) != LZ4F_MAGICNUMBER) {
 2850|       |        DEBUGLOG(4, "frame header error : unknown magic number");
 2851|       |        RETURN_ERROR(frameType_unknown);
 2852|       |    }
 2853|       |#endif
 2854|  14.4k|    dctx->frameInfo.frameType = LZ4F_frame;
 2855|       |
 2856|       |    /* Flags */
 2857|  14.4k|    {   U32 const FLG = srcPtr[4];
 2858|  14.4k|        U32 const version = (FLG>>6) & _2BITS;
  ------------------
  |  |  274|  14.4k|#define _2BITS 0x03
  ------------------
 2859|  14.4k|        blockChecksumFlag = (FLG>>4) & _1BIT;
  ------------------
  |  |  273|  14.4k|#define _1BIT  0x01
  ------------------
 2860|  14.4k|        blockMode = (FLG>>5) & _1BIT;
  ------------------
  |  |  273|  14.4k|#define _1BIT  0x01
  ------------------
 2861|  14.4k|        contentSizeFlag = (FLG>>3) & _1BIT;
  ------------------
  |  |  273|  14.4k|#define _1BIT  0x01
  ------------------
 2862|  14.4k|        contentChecksumFlag = (FLG>>2) & _1BIT;
  ------------------
  |  |  273|  14.4k|#define _1BIT  0x01
  ------------------
 2863|  14.4k|        dictIDFlag = FLG & _1BIT;
  ------------------
  |  |  273|  14.4k|#define _1BIT  0x01
  ------------------
 2864|       |        /* validate */
 2865|  14.4k|        if (((FLG>>1)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set); /* Reserved bit */
  ------------------
  |  |  273|  14.4k|#define _1BIT  0x01
  ------------------
                      if (((FLG>>1)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set); /* Reserved bit */
  ------------------
  |  |  375|     48|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (2865:13): [True: 48, False: 14.4k]
  ------------------
 2866|  14.4k|        if (version != 1) RETURN_ERROR(headerVersion_wrong);       /* Version Number, only supported value */
  ------------------
  |  |  375|    104|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (2866:13): [True: 104, False: 14.3k]
  ------------------
 2867|  14.4k|    }
 2868|  14.3k|    DEBUGLOG(6, "contentSizeFlag: %u", contentSizeFlag);
  ------------------
  |  |  191|  14.3k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 2869|       |
 2870|       |    /* Frame Header Size */
 2871|  14.3k|    frameHeaderSize = minFHSize + (contentSizeFlag?8:0) + (dictIDFlag?4:0);
  ------------------
  |  Branch (2871:36): [True: 2.56k, False: 11.7k]
  |  Branch (2871:60): [True: 556, False: 13.7k]
  ------------------
 2872|       |
 2873|  14.3k|    if (srcSize < frameHeaderSize) {
  ------------------
  |  Branch (2873:9): [True: 40, False: 14.2k]
  ------------------
 2874|       |        /* only the minimal header is gathered into dctx->header : gather the rest */
 2875|     40|        assert(srcPtr == dctx->header);
  ------------------
  |  Branch (2875:9): [True: 0, False: 40]
  |  Branch (2875:9): [True: 40, False: 0]
  ------------------
 2876|     40|        assert(dctx->dStage == dstage_storeFrameHeader);
  ------------------
  |  Branch (2876:9): [True: 0, False: 40]
  |  Branch (2876:9): [True: 40, False: 0]
  ------------------
 2877|     40|        assert(dctx->tmpInSize == srcSize);
  ------------------
  |  Branch (2877:9): [True: 0, False: 40]
  |  Branch (2877:9): [True: 40, False: 0]
  ------------------
 2878|     40|        dctx->tmpInTarget = frameHeaderSize;
 2879|     40|        return srcSize;
 2880|     40|    }
 2881|       |
 2882|  14.2k|    {   U32 const BD = srcPtr[5];
 2883|  14.2k|        blockSizeID = (BD>>4) & _3BITS;
  ------------------
  |  |  275|  14.2k|#define _3BITS 0x07
  ------------------
 2884|       |        /* validate */
 2885|  14.2k|        if (((BD>>7)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set);   /* Reserved bit */
  ------------------
  |  |  273|  14.2k|#define _1BIT  0x01
  ------------------
                      if (((BD>>7)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set);   /* Reserved bit */
  ------------------
  |  |  375|     36|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (2885:13): [True: 36, False: 14.2k]
  ------------------
 2886|  14.2k|        if (blockSizeID < 4) RETURN_ERROR(maxBlockSize_invalid);    /* 4-7 only supported values for the time being */
  ------------------
  |  |  375|     28|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (2886:13): [True: 28, False: 14.2k]
  ------------------
 2887|  14.2k|        if (((BD>>0)&_4BITS) != 0) RETURN_ERROR(reservedFlag_set);  /* Reserved bits */
  ------------------
  |  |  276|  14.2k|#define _4BITS 0x0F
  ------------------
                      if (((BD>>0)&_4BITS) != 0) RETURN_ERROR(reservedFlag_set);  /* Reserved bits */
  ------------------
  |  |  375|     24|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (2887:13): [True: 24, False: 14.1k]
  ------------------
 2888|  14.2k|    }
 2889|       |
 2890|       |    /* check header */
 2891|  14.2k|    assert(frameHeaderSize > 5);
  ------------------
  |  Branch (2891:5): [True: 0, False: 14.1k]
  |  Branch (2891:5): [True: 14.1k, False: 0]
  ------------------
 2892|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 2893|       |    {   BYTE const HC = LZ4F_headerChecksum(srcPtr+4, frameHeaderSize-5);
 2894|       |        RETURN_ERROR_IF(HC != srcPtr[frameHeaderSize-1], headerChecksum_invalid);
 2895|       |    }
 2896|       |#endif
 2897|       |
 2898|       |    /* save */
 2899|  14.1k|    dctx->frameInfo.blockMode = (LZ4F_blockMode_t)blockMode;
 2900|  14.1k|    dctx->frameInfo.blockChecksumFlag = (LZ4F_blockChecksum_t)blockChecksumFlag;
 2901|  14.1k|    dctx->frameInfo.contentChecksumFlag = (LZ4F_contentChecksum_t)contentChecksumFlag;
 2902|  14.1k|    dctx->frameInfo.blockSizeID = (LZ4F_blockSizeID_t)blockSizeID;
 2903|  14.1k|    dctx->maxBlockSize = LZ4F_getBlockSize((LZ4F_blockSizeID_t)blockSizeID);
 2904|  14.1k|    if (contentSizeFlag) {
  ------------------
  |  Branch (2904:9): [True: 2.52k, False: 11.6k]
  ------------------
 2905|  2.52k|        dctx->frameRemainingSize = dctx->frameInfo.contentSize = LZ4F_readLE64(srcPtr+6);
 2906|  2.52k|    }
 2907|  14.1k|    if (dictIDFlag)
  ------------------
  |  Branch (2907:9): [True: 516, False: 13.6k]
  ------------------
 2908|    516|        dctx->frameInfo.dictID = LZ4F_readLE32(srcPtr + frameHeaderSize - 5);
 2909|       |
 2910|  14.1k|    dctx->dStage = dstage_init;
 2911|       |
 2912|  14.1k|    return frameHeaderSize;
 2913|  14.1k|}
lz4frame.c:LZ4F_readLE64:
  237|  2.52k|{
  238|  2.52k|    const BYTE* const srcPtr = (const BYTE*)src;
  239|  2.52k|    U64 value64 = srcPtr[0];
  240|  2.52k|    value64 |= ((U64)srcPtr[1]<<8);
  241|  2.52k|    value64 |= ((U64)srcPtr[2]<<16);
  242|  2.52k|    value64 |= ((U64)srcPtr[3]<<24);
  243|  2.52k|    value64 |= ((U64)srcPtr[4]<<32);
  244|  2.52k|    value64 |= ((U64)srcPtr[5]<<40);
  245|  2.52k|    value64 |= ((U64)srcPtr[6]<<48);
  246|  2.52k|    value64 |= ((U64)srcPtr[7]<<56);
  247|  2.52k|    return value64;
  248|  2.52k|}
lz4frame.c:LZ4F_gatherInput:
 3135|   187k|{
 3136|   187k|    const BYTE* const srcPtr = *srcPtrPtr;
 3137|   187k|    size_t const available = (size_t)(srcEnd - srcPtr);
 3138|   187k|    if ((dctx->tmpInSize == 0) && (available >= wanted)) {
  ------------------
  |  Branch (3138:9): [True: 187k, False: 224]
  |  Branch (3138:35): [True: 184k, False: 2.53k]
  ------------------
 3139|   184k|        *srcPtrPtr = srcPtr + wanted;
 3140|   184k|        return srcPtr;
 3141|   184k|    }
 3142|  2.76k|    {   size_t const sizeToCopy = MIN(wanted - dctx->tmpInSize, available);
  ------------------
  |  |  426|  2.76k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (426:22): [True: 12, False: 2.74k]
  |  |  ------------------
  ------------------
 3143|  2.76k|        memcpy(buffer + dctx->tmpInSize, srcPtr, sizeToCopy);
 3144|  2.76k|        dctx->tmpInSize += sizeToCopy;
 3145|  2.76k|        *srcPtrPtr = srcPtr + sizeToCopy;
 3146|  2.76k|    }
 3147|  2.76k|    if (dctx->tmpInSize < wanted) return NULL;
  ------------------
  |  Branch (3147:9): [True: 2.54k, False: 220]
  ------------------
 3148|    220|    dctx->tmpInSize = 0;   /* ready for next gathering */
 3149|    220|    return buffer;
 3150|  2.76k|}
lz4frame.c:LZ4F_endMarkFollows:
 3092|  79.3k|{
 3093|  79.3k|    return ((size_t)(srcEnd - srcPtr) >= skip + BHSize) && (LZ4F_readLE32(srcPtr + skip) == 0);
  ------------------
  |  Branch (3093:12): [True: 77.9k, False: 1.40k]
  |  Branch (3093:60): [True: 220, False: 77.7k]
  ------------------
 3094|  79.3k|}
lz4frame.c:LZ4F_updateDict:
 3031|  80.5k|{
 3032|  80.5k|    assert(dstPtr != NULL);
  ------------------
  |  Branch (3032:5): [True: 0, False: 80.5k]
  |  Branch (3032:5): [True: 80.5k, False: 0]
  ------------------
 3033|  80.5k|    if (dctx->dictSize==0) dctx->dict = (const BYTE*)dstPtr;  /* will lead to prefix mode */
  ------------------
  |  Branch (3033:9): [True: 7.91k, False: 72.6k]
  ------------------
 3034|  80.5k|    assert(dctx->dict != NULL);
  ------------------
  |  Branch (3034:5): [True: 0, False: 80.5k]
  |  Branch (3034:5): [True: 80.5k, False: 0]
  ------------------
 3035|       |
 3036|  80.5k|    if (dctx->dict + dctx->dictSize == dstPtr) {  /* prefix mode, everything within dstBuffer */
  ------------------
  |  Branch (3036:9): [True: 51.2k, False: 29.3k]
  ------------------
 3037|  51.2k|        dctx->dictSize += dstSize;
 3038|  51.2k|        return;
 3039|  51.2k|    }
 3040|       |
 3041|  80.5k|    assert(dstPtr >= dstBufferStart);
  ------------------
  |  Branch (3041:5): [True: 0, False: 29.3k]
  |  Branch (3041:5): [True: 29.3k, False: 0]
  ------------------
 3042|  29.3k|    if ((size_t)(dstPtr - dstBufferStart) + dstSize >= 64 KB) {  /* history in dstBuffer becomes large enough to become dictionary */
  ------------------
  |  |  268|  29.3k|#  define KB *(1<<10)
  ------------------
  |  Branch (3042:9): [True: 132, False: 29.2k]
  ------------------
 3043|    132|        dctx->dict = (const BYTE*)dstBufferStart;
 3044|    132|        dctx->dictSize = (size_t)(dstPtr - dstBufferStart) + dstSize;
 3045|    132|        return;
 3046|    132|    }
 3047|       |
 3048|  29.3k|    assert(dstSize < 64 KB);   /* if dstSize >= 64 KB, dictionary would be set into dstBuffer directly */
  ------------------
  |  Branch (3048:5): [True: 0, False: 29.2k]
  |  Branch (3048:5): [True: 29.2k, False: 0]
  ------------------
 3049|       |
 3050|       |    /* dstBuffer does not contain whole useful history (64 KB), so it must be saved within tmpOutBuffer */
 3051|  29.2k|    assert(dctx->tmpOutBuffer != NULL);
  ------------------
  |  Branch (3051:5): [True: 0, False: 29.2k]
  |  Branch (3051:5): [True: 29.2k, False: 0]
  ------------------
 3052|       |
 3053|  29.2k|    if (withinTmp && (dctx->dict == dctx->tmpOutBuffer)) {   /* continue history within tmpOutBuffer */
  ------------------
  |  Branch (3053:9): [True: 13.8k, False: 15.3k]
  |  Branch (3053:22): [True: 12.7k, False: 1.04k]
  ------------------
 3054|       |        /* withinTmp expectation : content of [dstPtr,dstSize] is same as [dict+dictSize,dstSize], so we just extend it */
 3055|  12.7k|        assert(dctx->dict + dctx->dictSize == dctx->tmpOut + dctx->tmpOutStart);
  ------------------
  |  Branch (3055:9): [True: 0, False: 12.7k]
  |  Branch (3055:9): [True: 12.7k, False: 0]
  ------------------
 3056|  12.7k|        dctx->dictSize += dstSize;
 3057|  12.7k|        return;
 3058|  12.7k|    }
 3059|       |
 3060|  16.4k|    if (withinTmp) { /* copy relevant dict portion in front of tmpOut within tmpOutBuffer */
  ------------------
  |  Branch (3060:9): [True: 1.04k, False: 15.3k]
  ------------------
 3061|  1.04k|        LZ4F_moveDictBeforeTmpOut(dctx, dstSize);
 3062|  1.04k|        return;
 3063|  1.04k|    }
 3064|       |
 3065|  15.3k|    if (dctx->dict == dctx->tmpOutBuffer) {    /* copy dst into tmp to complete dict */
  ------------------
  |  Branch (3065:9): [True: 12.5k, False: 2.83k]
  ------------------
 3066|  12.5k|        if (dctx->dictSize + dstSize > dctx->tmpOutBufferCapacity) {  /* tmp buffer not large enough */
  ------------------
  |  Branch (3066:13): [True: 0, False: 12.5k]
  ------------------
 3067|      0|            size_t const preserveSize = 64 KB - dstSize;
  ------------------
  |  |  268|      0|#  define KB *(1<<10)
  ------------------
 3068|      0|            memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - preserveSize, preserveSize);
 3069|      0|            dctx->dictSize = preserveSize;
 3070|      0|        }
 3071|  12.5k|        memcpy(dctx->tmpOutBuffer + dctx->dictSize, dstPtr, dstSize);
 3072|  12.5k|        dctx->dictSize += dstSize;
 3073|  12.5k|        return;
 3074|  12.5k|    }
 3075|       |
 3076|       |    /* join dict & dest into tmp */
 3077|  2.83k|    {   size_t preserveSize = 64 KB - dstSize;
  ------------------
  |  |  268|  2.83k|#  define KB *(1<<10)
  ------------------
 3078|  2.83k|        if (preserveSize > dctx->dictSize) preserveSize = dctx->dictSize;
  ------------------
  |  Branch (3078:13): [True: 2.10k, False: 728]
  ------------------
 3079|  2.83k|        memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - preserveSize, preserveSize);
 3080|  2.83k|        memcpy(dctx->tmpOutBuffer + preserveSize, dstPtr, dstSize);
 3081|  2.83k|        dctx->dict = dctx->tmpOutBuffer;
 3082|  2.83k|        dctx->dictSize = preserveSize + dstSize;
 3083|  2.83k|    }
 3084|  2.83k|}
lz4frame.c:LZ4F_decodeBlock:
 3102|  78.0k|{
 3103|  78.0k|    const char* dict = (const char*)dctx->dict;
 3104|  78.0k|    size_t dictSize = dctx->dictSize;
 3105|  78.0k|    int decodedSize;
 3106|  78.0k|    assert(dst != NULL);
  ------------------
  |  Branch (3106:5): [True: 0, False: 78.0k]
  |  Branch (3106:5): [True: 78.0k, False: 0]
  ------------------
 3107|  78.0k|    if (dict && dictSize > 1 GB) {
  ------------------
  |  |  270|  72.4k|#  define GB *(1<<30)
  ------------------
  |  Branch (3107:9): [True: 72.4k, False: 5.57k]
  |  Branch (3107:17): [True: 0, False: 72.4k]
  ------------------
 3108|       |        /* the dictSize param is an int, avoid truncation / sign issues */
 3109|      0|        dict += dictSize - 64 KB;
  ------------------
  |  |  268|      0|#  define KB *(1<<10)
  ------------------
 3110|      0|        dictSize = 64 KB;
  ------------------
  |  |  268|      0|#  define KB *(1<<10)
  ------------------
 3111|      0|    }
 3112|  78.0k|    decodedSize = LZ4_decompress_safe_usingDict(
 3113|  78.0k|            (const char*)src, (char*)dst,
 3114|  78.0k|            (int)srcSize, (int)dctx->maxBlockSize,
 3115|  78.0k|            dict, (int)dictSize);
 3116|  78.0k|    RETURN_ERROR_IF(decodedSize < 0, decompressionFailed);
  ------------------
  |  |  377|  78.0k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  378|  78.0k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (378:13): [True: 8.16k, False: 69.8k]
  |  |  ------------------
  |  |  379|  8.16k|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  191|  8.16k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  380|  8.16k|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  375|  8.16k|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  381|  8.16k|        }                          \
  |  |  382|  78.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (382:14): [Folded, False: 69.8k]
  |  |  ------------------
  ------------------
 3117|  69.8k|    RETURN_ERROR_IF(dctx->frameInfo.contentSize && (U64)decodedSize > dctx->frameRemainingSize, frameSize_wrong);
  ------------------
  |  |  377|  69.8k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  378|   143k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (378:13): [True: 3.44k, False: 66.4k]
  |  |  |  Branch (378:13): [True: 12, False: 3.43k]
  |  |  ------------------
  |  |  379|     12|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  191|     12|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  380|     12|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  375|     12|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  381|     12|        }                          \
  |  |  382|  69.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (382:14): [Folded, False: 69.8k]
  |  |  ------------------
  ------------------
 3118|  69.8k|    if (dctx->frameInfo.contentChecksumFlag && !dctx->skipContentChecksum)
  ------------------
  |  Branch (3118:9): [True: 65.5k, False: 4.34k]
  |  Branch (3118:48): [True: 49.3k, False: 16.1k]
  ------------------
 3119|  49.3k|        XXH32_update(&(dctx->xxh), dst, (size_t)decodedSize);
  ------------------
  |  |  132|  49.3k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  49.3k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  49.3k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3120|  69.8k|    if (dctx->frameInfo.contentSize)
  ------------------
  |  Branch (3120:9): [True: 3.43k, False: 66.4k]
  ------------------
 3121|  3.43k|        dctx->frameRemainingSize -= (size_t)decodedSize;
 3122|  69.8k|    return (size_t)decodedSize;
 3123|  69.8k|}
lz4frame.c:LZ4F_moveDictBeforeTmpOut:
 3010|  1.23k|{
 3011|  1.23k|    size_t const preserveSize = (size_t)(dctx->tmpOut - dctx->tmpOutBuffer);
 3012|  1.23k|    size_t copySize = 64 KB - dctx->tmpOutSize;
  ------------------
  |  |  268|  1.23k|#  define KB *(1<<10)
  ------------------
 3013|  1.23k|    const BYTE* const oldDictEnd = dctx->dict + dctx->dictSize - dctx->tmpOutStart;
 3014|  1.23k|    if (dctx->tmpOutSize > 64 KB) copySize = 0;
  ------------------
  |  |  268|  1.23k|#  define KB *(1<<10)
  ------------------
  |  Branch (3014:9): [True: 106, False: 1.12k]
  ------------------
 3015|  1.23k|    if (copySize > preserveSize) copySize = preserveSize;
  ------------------
  |  Branch (3015:9): [True: 842, False: 393]
  ------------------
 3016|  1.23k|    assert(dctx->tmpOutBuffer != NULL);
  ------------------
  |  Branch (3016:5): [True: 0, False: 1.23k]
  |  Branch (3016:5): [True: 1.23k, False: 0]
  ------------------
 3017|       |
 3018|  1.23k|    memcpy(dctx->tmpOutBuffer + preserveSize - copySize, oldDictEnd - copySize, copySize);
 3019|       |
 3020|  1.23k|    dctx->dict = dctx->tmpOutBuffer;
 3021|  1.23k|    dctx->dictSize = preserveSize + dctx->tmpOutStart + flushSize;
 3022|  1.23k|}

LZ4_XXH32:
  393|  6.45k|{
  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|  6.45k|    XXH_endianness endian_detected = (XXH_endianness)XXH_CPU_LITTLE_ENDIAN;
  ------------------
  |  |  225|  6.45k|#   define XXH_CPU_LITTLE_ENDIAN   XXH_isLittleEndian()
  ------------------
  402|       |
  403|  6.45k|    if (XXH_FORCE_ALIGN_CHECK) {
  ------------------
  |  |   95|  6.45k|#    define XXH_FORCE_ALIGN_CHECK 0
  |  |  ------------------
  |  |  |  Branch (95:35): [Folded, False: 6.45k]
  |  |  ------------------
  ------------------
  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|  6.45k|    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: 6.45k, False: 0]
  ------------------
  412|  6.45k|        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|  6.45k|#endif
  416|  6.45k|}
LZ4_XXH32_reset:
  438|  18.9k|{
  439|  18.9k|    XXH32_state_t state;   /* using a local state to memcpy() in order to avoid strict-aliasing warnings */
  440|  18.9k|    memset(&state, 0, sizeof(state));
  441|  18.9k|    state.v1 = seed + PRIME32_1 + PRIME32_2;
  442|  18.9k|    state.v2 = seed + PRIME32_2;
  443|  18.9k|    state.v3 = seed + 0;
  444|  18.9k|    state.v4 = seed - PRIME32_1;
  445|       |    /* do not write into reserved, planned to be removed in a future version */
  446|  18.9k|    memcpy(statePtr, &state, sizeof(state) - sizeof(state.reserved));
  447|  18.9k|    return XXH_OK;
  448|  18.9k|}
LZ4_XXH32_update:
  516|  66.3k|{
  517|  66.3k|    XXH_endianness endian_detected = (XXH_endianness)XXH_CPU_LITTLE_ENDIAN;
  ------------------
  |  |  225|  66.3k|#   define XXH_CPU_LITTLE_ENDIAN   XXH_isLittleEndian()
  ------------------
  518|       |
  519|  66.3k|    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: 66.3k, False: 0]
  ------------------
  520|  66.3k|        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|  66.3k|}
LZ4_XXH32_digest:
  547|  7.49k|{
  548|  7.49k|    XXH_endianness endian_detected = (XXH_endianness)XXH_CPU_LITTLE_ENDIAN;
  ------------------
  |  |  225|  7.49k|#   define XXH_CPU_LITTLE_ENDIAN   XXH_isLittleEndian()
  ------------------
  549|       |
  550|  7.49k|    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: 7.49k, False: 0]
  ------------------
  551|  7.49k|        return XXH32_digest_endian(state_in, XXH_littleEndian);
  552|      0|    else
  553|      0|        return XXH32_digest_endian(state_in, XXH_bigEndian);
  554|  7.49k|}
xxhash.c:XXH_isLittleEndian:
  221|  80.3k|{
  222|  80.3k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  223|  80.3k|    return one.c[0] ? XXH_littleEndian : XXH_bigEndian;
  ------------------
  |  Branch (223:12): [True: 80.3k, False: 0]
  ------------------
  224|  80.3k|}
xxhash.c:XXH32_endian_align:
  354|  6.45k|{
  355|  6.45k|    const BYTE* p = (const BYTE*)input;
  356|  6.45k|    const BYTE* bEnd = p + len;
  357|  6.45k|    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|  6.45k|    if (len>=16) {
  ------------------
  |  Branch (366:9): [True: 1.89k, False: 4.56k]
  ------------------
  367|  1.89k|        const BYTE* const limit = bEnd - 15;
  368|  1.89k|        U32 v1 = seed + PRIME32_1 + PRIME32_2;
  369|  1.89k|        U32 v2 = seed + PRIME32_2;
  370|  1.89k|        U32 v3 = seed + 0;
  371|  1.89k|        U32 v4 = seed - PRIME32_1;
  372|       |
  373|  6.17M|        do {
  374|  6.17M|            v1 = XXH32_round(v1, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  288|  6.17M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  375|  6.17M|            v2 = XXH32_round(v2, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  288|  6.17M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  376|  6.17M|            v3 = XXH32_round(v3, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  288|  6.17M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  377|  6.17M|            v4 = XXH32_round(v4, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  288|  6.17M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  378|  6.17M|        } while (p < limit);
  ------------------
  |  Branch (378:18): [True: 6.16M, False: 1.89k]
  ------------------
  379|       |
  380|  1.89k|        h32 = XXH_rotl32(v1, 1)  + XXH_rotl32(v2, 7)
  ------------------
  |  |  194|  1.89k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
                      h32 = XXH_rotl32(v1, 1)  + XXH_rotl32(v2, 7)
  ------------------
  |  |  194|  1.89k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  381|  1.89k|            + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18);
  ------------------
  |  |  194|  1.89k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
                          + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18);
  ------------------
  |  |  194|  1.89k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  382|  4.56k|    } else {
  383|  4.56k|        h32  = seed + PRIME32_5;
  384|  4.56k|    }
  385|       |
  386|  6.45k|    h32 += (U32)len;
  387|       |
  388|  6.45k|    return XXH32_finalize(h32, p, len&15, endian, align);
  389|  6.45k|}
xxhash.c:XXH32_round:
  270|  78.5M|{
  271|  78.5M|    seed += input * PRIME32_2;
  272|  78.5M|    seed  = XXH_rotl32(seed, 13);
  ------------------
  |  |  194|  78.5M|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  273|  78.5M|    seed *= PRIME32_1;
  274|  78.5M|    return seed;
  275|  78.5M|}
xxhash.c:XXH_readLE32_align:
  235|  78.5M|{
  236|  78.5M|    if (align==XXH_unaligned)
  ------------------
  |  Branch (236:9): [True: 78.5M, False: 6.76k]
  ------------------
  237|  78.5M|        return endian==XXH_littleEndian ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr));
  ------------------
  |  Branch (237:16): [True: 78.5M, False: 0]
  ------------------
  238|  6.76k|    else
  239|  6.76k|        return endian==XXH_littleEndian ? *(const U32*)ptr : XXH_swap32(*(const U32*)ptr);
  ------------------
  |  Branch (239:16): [True: 6.76k, False: 0]
  ------------------
  240|  78.5M|}
xxhash.c:XXH_read32:
  175|  78.5M|{
  176|  78.5M|    U32 val;
  177|  78.5M|    memcpy(&val, memPtr, sizeof(val));
  178|  78.5M|    return val;
  179|  78.5M|}
xxhash.c:XXH32_finalize:
  294|  13.9k|{
  295|  13.9k|    const BYTE* p = (const BYTE*)ptr;
  296|       |
  297|  13.9k|#define PROCESS1               \
  298|  13.9k|    h32 += (*p++) * PRIME32_5; \
  299|  13.9k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  300|       |
  301|  13.9k|#define PROCESS4                         \
  302|  13.9k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  303|  13.9k|    p+=4;                                \
  304|  13.9k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  305|       |
  306|  13.9k|    switch(len&15)  /* or switch(bEnd - p) */
  ------------------
  |  Branch (306:12): [True: 13.9k, False: 0]
  ------------------
  307|  13.9k|    {
  308|    884|      case 12:      PROCESS4;
  ------------------
  |  |  302|    884|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|    884|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|    884|    p+=4;                                \
  |  |  304|    884|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|    884|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (308:7): [True: 884, False: 13.0k]
  ------------------
  309|       |                    /* fallthrough */
  310|  1.17k|      case 8:       PROCESS4;
  ------------------
  |  |  302|  1.17k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  1.17k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  1.17k|    p+=4;                                \
  |  |  304|  1.17k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  1.17k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (310:7): [True: 286, False: 13.6k]
  ------------------
  311|       |                    /* fallthrough */
  312|  2.24k|      case 4:       PROCESS4;
  ------------------
  |  |  302|  2.24k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  2.24k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  2.24k|    p+=4;                                \
  |  |  304|  2.24k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  2.24k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (312:7): [True: 1.07k, False: 12.8k]
  ------------------
  313|  2.24k|                    return XXH32_avalanche(h32);
  314|       |
  315|    384|      case 13:      PROCESS4;
  ------------------
  |  |  302|    384|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|    384|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|    384|    p+=4;                                \
  |  |  304|    384|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|    384|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (315:7): [True: 384, False: 13.5k]
  ------------------
  316|       |                    /* fallthrough */
  317|    782|      case 9:       PROCESS4;
  ------------------
  |  |  302|    782|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|    782|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|    782|    p+=4;                                \
  |  |  304|    782|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|    782|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (317:7): [True: 398, False: 13.5k]
  ------------------
  318|       |                    /* fallthrough */
  319|  1.15k|      case 5:       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 (319:7): [True: 370, False: 13.5k]
  ------------------
  320|  1.15k|                    PROCESS1;
  ------------------
  |  |  298|  1.15k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  1.15k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  1.15k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  321|  1.15k|                    return XXH32_avalanche(h32);
  322|       |
  323|    838|      case 14:      PROCESS4;
  ------------------
  |  |  302|    838|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|    838|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|    838|    p+=4;                                \
  |  |  304|    838|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|    838|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (323:7): [True: 838, False: 13.1k]
  ------------------
  324|       |                    /* fallthrough */
  325|  1.04k|      case 10:      PROCESS4;
  ------------------
  |  |  302|  1.04k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  1.04k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  1.04k|    p+=4;                                \
  |  |  304|  1.04k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  1.04k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (325:7): [True: 202, False: 13.7k]
  ------------------
  326|       |                    /* fallthrough */
  327|  1.42k|      case 6:       PROCESS4;
  ------------------
  |  |  302|  1.42k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  1.42k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  1.42k|    p+=4;                                \
  |  |  304|  1.42k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  1.42k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (327:7): [True: 388, False: 13.5k]
  ------------------
  328|  1.42k|                    PROCESS1;
  ------------------
  |  |  298|  1.42k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  1.42k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  1.42k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  329|  1.42k|                    PROCESS1;
  ------------------
  |  |  298|  1.42k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  1.42k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  1.42k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  330|  1.42k|                    return XXH32_avalanche(h32);
  331|       |
  332|    500|      case 15:      PROCESS4;
  ------------------
  |  |  302|    500|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|    500|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|    500|    p+=4;                                \
  |  |  304|    500|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|    500|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (332:7): [True: 500, False: 13.4k]
  ------------------
  333|       |                    /* fallthrough */
  334|  2.80k|      case 11:      PROCESS4;
  ------------------
  |  |  302|  2.80k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  2.80k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  2.80k|    p+=4;                                \
  |  |  304|  2.80k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  2.80k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (334:7): [True: 2.30k, False: 11.6k]
  ------------------
  335|       |                    /* fallthrough */
  336|  3.08k|      case 7:       PROCESS4;
  ------------------
  |  |  302|  3.08k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  3.08k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  3.08k|    p+=4;                                \
  |  |  304|  3.08k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  3.08k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (336:7): [True: 282, False: 13.6k]
  ------------------
  337|       |                    /* fallthrough */
  338|  3.70k|      case 3:       PROCESS1;
  ------------------
  |  |  298|  3.70k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  3.70k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  3.70k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (338:7): [True: 618, False: 13.3k]
  ------------------
  339|       |                    /* fallthrough */
  340|  4.44k|      case 2:       PROCESS1;
  ------------------
  |  |  298|  4.44k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  4.44k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  4.44k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (340:7): [True: 736, False: 13.2k]
  ------------------
  341|       |                    /* fallthrough */
  342|  5.43k|      case 1:       PROCESS1;
  ------------------
  |  |  298|  5.43k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  5.43k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  5.43k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (342:7): [True: 990, False: 12.9k]
  ------------------
  343|       |                    /* fallthrough */
  344|  9.12k|      case 0:       return XXH32_avalanche(h32);
  ------------------
  |  Branch (344:7): [True: 3.69k, False: 10.2k]
  ------------------
  345|  13.9k|    }
  346|  13.9k|    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|  13.9k|{
  280|  13.9k|    h32 ^= h32 >> 15;
  281|  13.9k|    h32 *= PRIME32_2;
  282|  13.9k|    h32 ^= h32 >> 13;
  283|  13.9k|    h32 *= PRIME32_3;
  284|  13.9k|    h32 ^= h32 >> 16;
  285|  13.9k|    return(h32);
  286|  13.9k|}
xxhash.c:XXH32_update_endian:
  453|  66.3k|{
  454|  66.3k|    if (input==NULL)
  ------------------
  |  Branch (454:9): [True: 0, False: 66.3k]
  ------------------
  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|  66.3k|#endif
  460|       |
  461|  66.3k|    {   const BYTE* p = (const BYTE*)input;
  462|  66.3k|        const BYTE* const bEnd = p + len;
  463|       |
  464|  66.3k|        state->total_len_32 += (unsigned)len;
  465|  66.3k|        state->large_len |= (len>=16) | (state->total_len_32>=16);
  466|       |
  467|  66.3k|        if (state->memsize + len < 16)  {   /* fill in tmp buffer */
  ------------------
  |  Branch (467:13): [True: 16.5k, False: 49.7k]
  ------------------
  468|  16.5k|            XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, len);
  469|  16.5k|            state->memsize += (unsigned)len;
  470|  16.5k|            return XXH_OK;
  471|  16.5k|        }
  472|       |
  473|  49.7k|        if (state->memsize) {   /* some data left from previous update */
  ------------------
  |  Branch (473:13): [True: 43.9k, False: 5.89k]
  ------------------
  474|  43.9k|            XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, 16-state->memsize);
  475|  43.9k|            {   const U32* p32 = state->mem32;
  476|  43.9k|                state->v1 = XXH32_round(state->v1, XXH_readLE32(p32, endian)); p32++;
  477|  43.9k|                state->v2 = XXH32_round(state->v2, XXH_readLE32(p32, endian)); p32++;
  478|  43.9k|                state->v3 = XXH32_round(state->v3, XXH_readLE32(p32, endian)); p32++;
  479|  43.9k|                state->v4 = XXH32_round(state->v4, XXH_readLE32(p32, endian));
  480|  43.9k|            }
  481|  43.9k|            p += 16-state->memsize;
  482|  43.9k|            state->memsize = 0;
  483|  43.9k|        }
  484|       |
  485|  49.7k|        if (p <= bEnd-16) {
  ------------------
  |  Branch (485:13): [True: 44.6k, False: 5.11k]
  ------------------
  486|  44.6k|            const BYTE* const limit = bEnd - 16;
  487|  44.6k|            U32 v1 = state->v1;
  488|  44.6k|            U32 v2 = state->v2;
  489|  44.6k|            U32 v3 = state->v3;
  490|  44.6k|            U32 v4 = state->v4;
  491|       |
  492|  13.4M|            do {
  493|  13.4M|                v1 = XXH32_round(v1, XXH_readLE32(p, endian)); p+=4;
  494|  13.4M|                v2 = XXH32_round(v2, XXH_readLE32(p, endian)); p+=4;
  495|  13.4M|                v3 = XXH32_round(v3, XXH_readLE32(p, endian)); p+=4;
  496|  13.4M|                v4 = XXH32_round(v4, XXH_readLE32(p, endian)); p+=4;
  497|  13.4M|            } while (p<=limit);
  ------------------
  |  Branch (497:22): [True: 13.3M, False: 44.6k]
  ------------------
  498|       |
  499|  44.6k|            state->v1 = v1;
  500|  44.6k|            state->v2 = v2;
  501|  44.6k|            state->v3 = v3;
  502|  44.6k|            state->v4 = v4;
  503|  44.6k|        }
  504|       |
  505|  49.7k|        if (p < bEnd) {
  ------------------
  |  Branch (505:13): [True: 44.7k, False: 5.06k]
  ------------------
  506|  44.7k|            XXH_memcpy(state->mem32, p, (size_t)(bEnd-p));
  507|  44.7k|            state->memsize = (unsigned)(bEnd-p);
  508|  44.7k|        }
  509|  49.7k|    }
  510|       |
  511|      0|    return XXH_OK;
  512|  66.3k|}
xxhash.c:XXH_memcpy:
  112|   105k|static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); }
xxhash.c:XXH_readLE32:
  243|  53.8M|{
  244|  53.8M|    return XXH_readLE32_align(ptr, endian, XXH_unaligned);
  245|  53.8M|}
xxhash.c:XXH32_digest_endian:
  528|  7.49k|{
  529|  7.49k|    U32 h32;
  530|       |
  531|  7.49k|    if (state->large_len) {
  ------------------
  |  Branch (531:9): [True: 1.19k, False: 6.30k]
  ------------------
  532|  1.19k|        h32 = XXH_rotl32(state->v1, 1)
  ------------------
  |  |  194|  1.19k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  533|  1.19k|            + XXH_rotl32(state->v2, 7)
  ------------------
  |  |  194|  1.19k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  534|  1.19k|            + XXH_rotl32(state->v3, 12)
  ------------------
  |  |  194|  1.19k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  535|  1.19k|            + XXH_rotl32(state->v4, 18);
  ------------------
  |  |  194|  1.19k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  536|  6.30k|    } else {
  537|  6.30k|        h32 = state->v3 /* == seed */ + PRIME32_5;
  538|  6.30k|    }
  539|       |
  540|  7.49k|    h32 += state->total_len_32;
  541|       |
  542|  7.49k|    return XXH32_finalize(h32, state->mem32, state->memsize, endian, XXH_aligned);
  543|  7.49k|}

LLVMFuzzerTestOneInput:
   32|  3.71k|{
   33|  3.71k|    FUZZ_dataProducer_t *producer = FUZZ_dataProducer_create(data, size);
   34|  3.71k|    size_t const dstCapacitySeed = FUZZ_dataProducer_retrieve32(producer);
   35|  3.71k|    size_t const dictSizeSeed = FUZZ_dataProducer_retrieve32(producer);
   36|  3.71k|    int const skipChecksums = (FUZZ_dataProducer_range32(producer, 0, 7) == 0);   /* occasionally */
   37|  3.71k|    size = FUZZ_dataProducer_remainingBytes(producer);
   38|       |
   39|  3.71k|    size_t const dstCapacity = FUZZ_getRange_from_uint32(
   40|  3.71k|      dstCapacitySeed, 0, 4 * size);
   41|  3.71k|    size_t const largeDictSize = 64 * 1024;
   42|  3.71k|    size_t const dictSize = FUZZ_getRange_from_uint32(
   43|  3.71k|      dictSizeSeed, 0, largeDictSize);
   44|       |
   45|  3.71k|    char* const dst = (char*)malloc(dstCapacity);
   46|  3.71k|    char* const dict = (char*)malloc(dictSize);
   47|  3.71k|    LZ4F_decompressOptions_t opts;
   48|  3.71k|    LZ4F_dctx* dctx;
   49|  3.71k|    LZ4F_createDecompressionContext(&dctx, LZ4F_VERSION);
  ------------------
  |  |  336|  3.71k|#define LZ4F_VERSION 100    /* This number can be used to check for an incompatible API breaking change */
  ------------------
   50|       |
   51|  3.71k|    FUZZ_ASSERT(dctx);
  ------------------
  |  |   47|  3.71k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  3.71k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 3.71k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  3.71k|          : (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.71k|    FUZZ_ASSERT(dst);
  ------------------
  |  |   47|  3.71k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  3.71k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 3.71k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  3.71k|          : (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.71k|    FUZZ_ASSERT(dict);
  ------------------
  |  |   47|  3.71k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  3.71k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 3.71k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  3.71k|          : (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.71k|    memset(dict, 0, dictSize);
   57|       |
   58|       |
   59|       |    /* Decompress using multiple configurations. */
   60|  3.71k|    memset(&opts, 0, sizeof(opts));
   61|  3.71k|    opts.skipChecksums = (unsigned)skipChecksums;
   62|  3.71k|    opts.stableDst = 0;
   63|  3.71k|    decompress(dctx, dst, dstCapacity, data, size, NULL, 0, &opts);
   64|  3.71k|    opts.stableDst = 1;
   65|  3.71k|    decompress(dctx, dst, dstCapacity, data, size, NULL, 0, &opts);
   66|  3.71k|    opts.stableDst = 0;
   67|  3.71k|    decompress(dctx, dst, dstCapacity, data, size, dict, dictSize, &opts);
   68|  3.71k|    opts.stableDst = 1;
   69|  3.71k|    decompress(dctx, dst, dstCapacity, data, size, dict, dictSize, &opts);
   70|       |
   71|  3.71k|    LZ4F_freeDecompressionContext(dctx);
   72|  3.71k|    free(dst);
   73|  3.71k|    free(dict);
   74|  3.71k|    FUZZ_dataProducer_free(producer);
   75|       |
   76|  3.71k|    return 0;
   77|  3.71k|}
decompress_frame_fuzzer.c:decompress:
   22|  14.8k|{
   23|  14.8k|    LZ4F_resetDecompressionContext(dctx);
   24|  14.8k|    if (dictSize == 0)
  ------------------
  |  Branch (24:9): [True: 8.71k, False: 6.16k]
  ------------------
   25|  8.71k|        LZ4F_decompress(dctx, dst, &dstCapacity, src, &srcSize, opts);
   26|  6.16k|    else
   27|  6.16k|        LZ4F_decompress_usingDict(dctx, dst, &dstCapacity, src, &srcSize,
   28|  6.16k|                                  dict, dictSize, opts);
   29|  14.8k|}

FUZZ_dataProducer_create:
    8|  3.71k|FUZZ_dataProducer_t* FUZZ_dataProducer_create(const uint8_t* data, size_t size) {
    9|  3.71k|  FUZZ_dataProducer_t* const producer = malloc(sizeof(FUZZ_dataProducer_t));
   10|       |
   11|  3.71k|  FUZZ_ASSERT(producer != NULL);
  ------------------
  |  |   47|  3.71k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  3.71k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 3.71k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  3.71k|          : (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.71k|  producer->data = data;
   14|  3.71k|  producer->size = size;
   15|  3.71k|  return producer;
   16|  3.71k|}
FUZZ_dataProducer_free:
   18|  3.71k|void FUZZ_dataProducer_free(FUZZ_dataProducer_t *producer) { free(producer); }
FUZZ_dataProducer_retrieve32:
   20|  11.1k|uint32_t FUZZ_dataProducer_retrieve32(FUZZ_dataProducer_t *producer) {
   21|  11.1k|    const uint8_t* data = producer->data;
   22|  11.1k|    const size_t size = producer->size;
   23|  11.1k|    if (size == 0) {
  ------------------
  |  Branch (23:9): [True: 21, False: 11.1k]
  ------------------
   24|     21|        return 0;
   25|  11.1k|    } else if (size < 4) {
  ------------------
  |  Branch (25:16): [True: 32, False: 11.1k]
  ------------------
   26|     32|        producer->size -= 1;
   27|     32|        return (uint32_t)data[size - 1];
   28|  11.1k|    } else {
   29|  11.1k|        const uint8_t* const p = data + size - 4;
   30|  11.1k|        producer->size -= 4;
   31|  11.1k|        return (uint32_t)p[0] | ((uint32_t)p[1] << 8)
   32|  11.1k|            | ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24);
   33|  11.1k|    }
   34|  11.1k|}
FUZZ_getRange_from_uint32:
   37|  11.1k|{
   38|  11.1k|    uint32_t range = max - min;
   39|  11.1k|    if (range == 0xffffffff) {
  ------------------
  |  Branch (39:9): [True: 0, False: 11.1k]
  ------------------
   40|      0|      return seed;
   41|      0|    }
   42|  11.1k|    return min + seed % (range + 1);
   43|  11.1k|}
FUZZ_dataProducer_range32:
   47|  3.71k|{
   48|  3.71k|    uint32_t const seed = FUZZ_dataProducer_retrieve32(producer);
   49|  3.71k|    return FUZZ_getRange_from_uint32(seed, min, max);
   50|  3.71k|}
FUZZ_dataProducer_remainingBytes:
   77|  3.71k|size_t FUZZ_dataProducer_remainingBytes(FUZZ_dataProducer_t *producer){
   78|  3.71k|  return producer->size;
   79|  3.71k|}

