LZ4_compressBound:
  760|  7.07k|int LZ4_compressBound(int isize)  { return LZ4_COMPRESSBOUND(isize); }
  ------------------
  |  |  215|  7.07k|#define LZ4_COMPRESSBOUND(isize)  ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
  |  |  ------------------
  |  |  |  |  214|  7.07k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  |  |  ------------------
  |  |  |  Branch (215:36): [True: 0, False: 7.07k]
  |  |  ------------------
  ------------------
LZ4_decompress_safe:
 2504|  10.7k|{
 2505|  10.7k|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2506|  10.7k|                                  decode_full_block, noDict,
 2507|       |                                  (BYTE*)dest, NULL, 0);
 2508|  10.7k|}
lz4.c:LZ4_isLittleEndian:
  365|  2.45M|{
  366|  2.45M|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  367|  2.45M|    return one.c[0];
  368|  2.45M|}
lz4.c:LZ4_wildCopy8:
  467|  56.0k|{
  468|  56.0k|    BYTE* d = (BYTE*)dstPtr;
  469|  56.0k|    const BYTE* s = (const BYTE*)srcPtr;
  470|  56.0k|    BYTE* const e = (BYTE*)dstEnd;
  471|       |
  472|  8.96M|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  350|  8.96M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (472:50): [True: 8.90M, False: 56.0k]
  ------------------
  473|  56.0k|}
lz4.c:LZ4_read16:
  394|  2.45M|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  399|  36.8k|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_decompress_generic:
 2067|  10.7k|{
 2068|  10.7k|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (2068:9): [True: 0, False: 10.7k]
  |  Branch (2068:26): [True: 0, False: 10.7k]
  ------------------
 2069|       |
 2070|  10.7k|    {   const BYTE* ip = (const BYTE*) src;
 2071|  10.7k|        const BYTE* const iend = ip + srcSize;
 2072|       |
 2073|  10.7k|        BYTE* op = (BYTE*) dst;
 2074|  10.7k|        BYTE* const oend = op + outputSize;
 2075|  10.7k|        BYTE* cpy;
 2076|       |
 2077|  10.7k|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (2077:37): [True: 10.7k, False: 0]
  ------------------
 2078|       |
 2079|  10.7k|        const int checkOffset = (dictSize < (int)(64 KB));
  ------------------
  |  |  252|  10.7k|#define KB *(1 <<10)
  ------------------
 2080|       |
 2081|       |
 2082|       |        /* Set up the "end" pointers for the shortcut. */
 2083|  10.7k|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 2084|  10.7k|        const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/;
 2085|       |
 2086|  10.7k|        const BYTE* match;
 2087|  10.7k|        size_t offset;
 2088|  10.7k|        unsigned token;
 2089|  10.7k|        size_t length;
 2090|       |
 2091|       |
 2092|  10.7k|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  290|  10.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2093|       |
 2094|       |        /* Special cases */
 2095|  10.7k|        assert(lowPrefix <= op);
  ------------------
  |  Branch (2095:9): [True: 0, False: 10.7k]
  |  Branch (2095:9): [True: 10.7k, False: 0]
  ------------------
 2096|  10.7k|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  181|  10.7k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  10.7k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 10.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2097|       |            /* Empty output buffer */
 2098|      0|            if (partialDecoding) return 0;
  ------------------
  |  Branch (2098:17): [True: 0, False: 0]
  ------------------
 2099|      0|            return ((srcSize==1) && (*ip==0)) ? 0 : -1;
  ------------------
  |  Branch (2099:21): [True: 0, False: 0]
  |  Branch (2099:37): [True: 0, False: 0]
  ------------------
 2100|      0|        }
 2101|  10.7k|        if (unlikely(srcSize==0)) { return -1; }
  ------------------
  |  |  181|  10.7k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  10.7k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 10.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2102|       |
 2103|       |    /* LZ4_FAST_DEC_LOOP:
 2104|       |     * designed for modern OoO performance cpus,
 2105|       |     * where copying reliably 32-bytes is preferable to an unpredictable branch.
 2106|       |     * note : fast loop may show a regression for some client arm chips. */
 2107|  10.7k|#if LZ4_FAST_DEC_LOOP
 2108|  10.7k|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  10.7k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2108:13): [True: 4.59k, False: 6.19k]
  ------------------
 2109|  4.59k|            DEBUGLOG(6, "move to safe decode loop");
  ------------------
  |  |  290|  4.59k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2110|  4.59k|            goto safe_decode;
 2111|  4.59k|        }
 2112|       |
 2113|       |        /* Fast loop : decode sequences as long as output < oend-FASTLOOP_SAFE_DISTANCE */
 2114|  6.19k|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  290|  6.19k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2115|  2.44M|        while (1) {
  ------------------
  |  Branch (2115:16): [True: 2.44M, Folded]
  ------------------
 2116|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2117|  2.44M|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  Branch (2117:13): [True: 0, False: 2.44M]
  |  Branch (2117:13): [True: 2.44M, False: 0]
  ------------------
 2118|  2.44M|            assert(ip < iend);
  ------------------
  |  Branch (2118:13): [True: 0, False: 2.44M]
  |  Branch (2118:13): [True: 2.44M, False: 0]
  ------------------
 2119|  2.44M|            token = *ip++;
 2120|  2.44M|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  261|  2.44M|#define ML_BITS  4
  ------------------
 2121|  2.44M|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  2.44M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2122|       |
 2123|  2.44M|            if (ip > iend-(16 + 1/*max lit + offset + nextToken*/)) { goto safe_literal_copy_early; }
  ------------------
  |  Branch (2123:17): [True: 1.65k, False: 2.44M]
  ------------------
 2124|       |
 2125|       |            /* decode literal length */
 2126|  2.44M|            if (length == RUN_MASK) {
  ------------------
  |  |  264|  2.44M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  2.44M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  2.44M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2126:17): [True: 62.9k, False: 2.37M]
  ------------------
 2127|       |                /* literal length >= RUN_MASK means >= RUN_MASK literal bytes follow the extension bytes,
 2128|       |                 * so extension bytes cannot reach the last RUN_MASK bytes of input */
 2129|  62.9k|                size_t const addl = read_variable_length(&ip, iend - RUN_MASK);
  ------------------
  |  |  264|  62.9k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  62.9k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  62.9k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2130|  62.9k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2130:21): [True: 0, False: 62.9k]
  ------------------
 2131|      0|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2132|      0|                    goto _output_error;
 2133|      0|                }
 2134|  62.9k|                length += addl;
 2135|  62.9k|                cpy = op+length;
 2136|  62.9k|                if (unlikely((uptrval)(cpy)<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|  62.9k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  62.9k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 62.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2137|  62.9k|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|  62.9k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  62.9k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 62.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2138|       |
 2139|       |                /* copy literals */
 2140|  62.9k|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  278|  62.9k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2141|       |              #ifdef __aarch64__
 2142|       |                if ((cpy>oend-64) || (ip+length>iend-64)) { goto safe_literal_copy; }
 2143|       |                LZ4_wildCopy64(op, ip, cpy);
 2144|       |              #else
 2145|  62.9k|                if ((cpy>oend-32) || (ip+length>iend-32)) { goto safe_literal_copy; }
  ------------------
  |  Branch (2145:21): [True: 267, False: 62.6k]
  |  Branch (2145:38): [True: 580, False: 62.0k]
  ------------------
 2146|  62.0k|                LZ4_wildCopy32(op, ip, cpy);
 2147|  62.0k|              #endif
 2148|  62.0k|                ip += length; op = cpy;
 2149|  2.37M|            } else {
 2150|  2.37M|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)length);
  ------------------
  |  |  290|  2.37M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2151|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2152|  2.37M|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  350|  2.37M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2153|  2.37M|                ip += length; op += length;
 2154|  2.37M|            }
 2155|       |
 2156|       |            /* get offset */
 2157|  2.44M|            offset = LZ4_readLE16(ip); ip+=2;
 2158|  2.44M|            DEBUGLOG(6, "blockPos%6u: offset = %u", (unsigned)(op-(BYTE*)dst), (unsigned)offset);
  ------------------
  |  |  290|  2.44M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2159|  2.44M|            match = op - offset;
 2160|  2.44M|            assert(match <= op);  /* overflow check */
  ------------------
  |  Branch (2160:13): [True: 0, False: 2.44M]
  |  Branch (2160:13): [True: 2.44M, False: 0]
  ------------------
 2161|       |
 2162|       |            /* get matchlength */
 2163|  2.44M|            length = token & ML_MASK;
  ------------------
  |  |  262|  2.44M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  2.44M|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2164|  2.44M|            DEBUGLOG(7, "  match length token = %u (len==%u)", (unsigned)length, (unsigned)length+MINMATCH);
  ------------------
  |  |  290|  2.44M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2165|       |
 2166|  2.44M|            if (length == ML_MASK) {
  ------------------
  |  |  262|  2.44M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  2.44M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2166:17): [True: 567k, False: 1.87M]
  ------------------
 2167|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2168|   567k|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  246|   567k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2169|   567k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2169:21): [True: 0, False: 567k]
  ------------------
 2170|      0|                    DEBUGLOG(5, "error reading long match length");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2171|      0|                    goto _output_error;
 2172|      0|                }
 2173|   567k|                length += addl;
 2174|   567k|                length += MINMATCH;
  ------------------
  |  |  243|   567k|#define MINMATCH 4
  ------------------
 2175|   567k|                DEBUGLOG(7, "  long match length == %u", (unsigned)length);
  ------------------
  |  |  290|   567k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2176|   567k|                if (unlikely((uptrval)(op)+length<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|   567k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   567k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 567k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2177|   567k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|   567k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2177:21): [True: 2.27k, False: 565k]
  ------------------
 2178|  2.27k|                    goto safe_match_copy;
 2179|  2.27k|                }
 2180|  1.87M|            } else {
 2181|  1.87M|                length += MINMATCH;
  ------------------
  |  |  243|  1.87M|#define MINMATCH 4
  ------------------
 2182|  1.87M|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  1.87M|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2182:21): [True: 1.41k, False: 1.87M]
  ------------------
 2183|  1.41k|                    DEBUGLOG(7, "moving to safe_match_copy (ml==%u)", (unsigned)length);
  ------------------
  |  |  290|  1.41k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2184|  1.41k|                    goto safe_match_copy;
 2185|  1.41k|                }
 2186|       |
 2187|       |                /* Fastpath check: skip LZ4_wildCopy32 when true */
 2188|  1.87M|                if ((dict == withPrefix64k) || (match >= lowPrefix)) {
  ------------------
  |  Branch (2188:21): [True: 0, False: 1.87M]
  |  Branch (2188:48): [True: 1.87M, False: 0]
  ------------------
 2189|  1.87M|                    if (offset >= 8) {
  ------------------
  |  Branch (2189:25): [True: 1.68M, False: 184k]
  ------------------
 2190|  1.68M|                        assert(match >= lowPrefix);
  ------------------
  |  Branch (2190:25): [True: 0, False: 1.68M]
  |  Branch (2190:25): [True: 1.68M, False: 0]
  ------------------
 2191|  1.68M|                        assert(match <= op);
  ------------------
  |  Branch (2191:25): [True: 0, False: 1.68M]
  |  Branch (2191:25): [True: 1.68M, False: 0]
  ------------------
 2192|  1.68M|                        assert(op + 18 <= oend);
  ------------------
  |  Branch (2192:25): [True: 0, False: 1.68M]
  |  Branch (2192:25): [True: 1.68M, False: 0]
  ------------------
 2193|       |
 2194|  1.68M|                        LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  1.68M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2195|  1.68M|                        LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  350|  1.68M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2196|  1.68M|                        LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  350|  1.68M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2197|  1.68M|                        op += length;
 2198|  1.68M|                        continue;
 2199|  1.68M|            }   }   }
 2200|       |
 2201|   750k|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  181|   750k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   750k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2201:18): [True: 750k, False: 0]
  |  Branch (2201:33): [True: 0, False: 750k]
  ------------------
 2202|      0|                DEBUGLOG(5, "Error : pos=%zi, offset=%zi => outside buffers", op-lowPrefix, op-match);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2203|      0|                goto _output_error;
 2204|      0|            }
 2205|       |            /* match starting within external dictionary */
 2206|   750k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2206:17): [True: 0, False: 750k]
  |  Branch (2206:41): [True: 0, False: 0]
  ------------------
 2207|      0|                assert(dictEnd != NULL);
  ------------------
  |  Branch (2207:17): [True: 0, False: 0]
  |  Branch (2207:17): [True: 0, False: 0]
  ------------------
 2208|      0|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  181|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2209|      0|                    if (partialDecoding) {
  ------------------
  |  Branch (2209:25): [True: 0, False: 0]
  ------------------
 2210|      0|                        DEBUGLOG(7, "partialDecoding: dictionary match, close to dstEnd");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2211|      0|                        length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1887|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1887:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2212|      0|                    } else {
 2213|      0|                        DEBUGLOG(6, "end-of-block condition violated")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2214|      0|                        goto _output_error;
 2215|      0|                }   }
 2216|       |
 2217|      0|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2217:21): [True: 0, False: 0]
  ------------------
 2218|       |                    /* match fits entirely within external dictionary : just copy */
 2219|      0|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  358|      0|#    define LZ4_memmove __builtin_memmove
  ------------------
 2220|      0|                    op += length;
 2221|      0|                } else {
 2222|       |                    /* match stretches into both external dictionary and current block */
 2223|      0|                    size_t const copySize = (size_t)(lowPrefix - match);
 2224|      0|                    size_t const restSize = length - copySize;
 2225|      0|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2226|      0|                    op += copySize;
 2227|      0|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2227:25): [True: 0, False: 0]
  ------------------
 2228|      0|                        BYTE* const endOfMatch = op + restSize;
 2229|      0|                        const BYTE* copyFrom = lowPrefix;
 2230|      0|                        while (op < endOfMatch) { *op++ = *copyFrom++; }
  ------------------
  |  Branch (2230:32): [True: 0, False: 0]
  ------------------
 2231|      0|                    } else {
 2232|      0|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2233|      0|                        op += restSize;
 2234|      0|                }   }
 2235|      0|                continue;
 2236|      0|            }
 2237|       |
 2238|       |            /* copy match within block */
 2239|   750k|            cpy = op + length;
 2240|       |
 2241|   750k|            assert((op <= oend) && (oend-op >= 64));
  ------------------
  |  Branch (2241:13): [True: 0, False: 750k]
  |  Branch (2241:13): [True: 0, False: 0]
  |  Branch (2241:13): [True: 750k, False: 0]
  |  Branch (2241:13): [True: 750k, False: 0]
  ------------------
 2242|   750k|            if (unlikely(offset<16)) {
  ------------------
  |  |  181|   750k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   750k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 259k, False: 490k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2243|   259k|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2244|       |    #ifdef __aarch64__
 2245|       |            } else if (offset >= 64) {
 2246|       |                LZ4_wildCopy64(op, match, cpy);
 2247|       |    #endif
 2248|   490k|            } else {
 2249|   490k|                LZ4_wildCopy32(op, match, cpy);
 2250|   490k|            }
 2251|       |
 2252|   750k|            op = cpy;   /* wildcopy correction */
 2253|   750k|        }
 2254|  4.59k|    safe_decode:
 2255|  4.59k|#endif
 2256|       |
 2257|       |        /* Main Loop : decode remaining sequences where output < FASTLOOP_SAFE_DISTANCE */
 2258|  4.59k|        DEBUGLOG(6, "using safe decode loop");
  ------------------
  |  |  290|  4.59k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2259|  27.1k|        while (1) {
  ------------------
  |  Branch (2259:16): [True: 27.1k, Folded]
  ------------------
 2260|  27.1k|            assert(ip < iend);
  ------------------
  |  Branch (2260:13): [True: 0, False: 27.1k]
  |  Branch (2260:13): [True: 27.1k, False: 0]
  ------------------
 2261|  27.1k|            token = *ip++;
 2262|  27.1k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  261|  27.1k|#define ML_BITS  4
  ------------------
 2263|  27.1k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  27.1k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2264|       |
 2265|       |            /* A two-stage shortcut for the most common case:
 2266|       |             * 1) If the literal length is 0..14, and there is enough space,
 2267|       |             * enter the shortcut and copy 16 bytes on behalf of the literals
 2268|       |             * (in the fast mode, only 8 bytes can be safely copied this way).
 2269|       |             * 2) Further if the match length is 4..18, copy 18 bytes in a similar
 2270|       |             * manner; but we ensure that there's enough space in the output for
 2271|       |             * those 18 bytes earlier, upon entering the shortcut (in other words,
 2272|       |             * there is a combined check for both stages).
 2273|       |             */
 2274|  27.1k|            if ( (length != RUN_MASK)
  ------------------
  |  |  264|  27.1k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  27.1k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  27.1k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2274:18): [True: 26.4k, False: 720]
  ------------------
 2275|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2276|  26.4k|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  178|  26.4k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  26.4k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 6.09k, False: 20.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2277|       |                /* Copy the literals */
 2278|  6.09k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  350|  6.09k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2279|  6.09k|                op += length; ip += length;
 2280|       |
 2281|       |                /* The second stage: prepare for match copying, decode full info.
 2282|       |                 * If it doesn't work out, the info won't be wasted. */
 2283|  6.09k|                length = token & ML_MASK; /* match length */
  ------------------
  |  |  262|  6.09k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  6.09k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2284|  6.09k|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u (len=%u)", (unsigned)(op-(BYTE*)dst), (unsigned)length, (unsigned)length + 4);
  ------------------
  |  |  290|  6.09k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2285|  6.09k|                offset = LZ4_readLE16(ip); ip += 2;
 2286|  6.09k|                match = op - offset;
 2287|  6.09k|                assert(match <= op); /* check overflow */
  ------------------
  |  Branch (2287:17): [True: 0, False: 6.09k]
  |  Branch (2287:17): [True: 6.09k, False: 0]
  ------------------
 2288|       |
 2289|       |                /* Do not deal with overlapping matches. */
 2290|  6.09k|                if ( (length != ML_MASK)
  ------------------
  |  |  262|  6.09k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  6.09k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2290:22): [True: 5.49k, False: 598]
  ------------------
 2291|  5.49k|                  && (offset >= 8)
  ------------------
  |  Branch (2291:22): [True: 3.23k, False: 2.26k]
  ------------------
 2292|  3.23k|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2292:23): [True: 0, False: 3.23k]
  |  Branch (2292:46): [True: 3.23k, False: 0]
  ------------------
 2293|       |                    /* Copy the match. */
 2294|  3.23k|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  350|  3.23k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2295|  3.23k|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  350|  3.23k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2296|  3.23k|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  350|  3.23k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2297|  3.23k|                    op += length + MINMATCH;
  ------------------
  |  |  243|  3.23k|#define MINMATCH 4
  ------------------
 2298|       |                    /* Both stages worked, load the next token. */
 2299|  3.23k|                    continue;
 2300|  3.23k|                }
 2301|       |
 2302|       |                /* The second stage didn't work out, but the info is ready.
 2303|       |                 * Propel it right to the point of match copying. */
 2304|  2.85k|                goto _copy_match;
 2305|  6.09k|            }
 2306|       |
 2307|  21.0k|#if LZ4_FAST_DEC_LOOP
 2308|  22.7k|        safe_literal_copy_early:
 2309|  22.7k|#endif
 2310|       |
 2311|       |            /* decode literal length */
 2312|  22.7k|            if (length == RUN_MASK) {
  ------------------
  |  |  264|  22.7k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  22.7k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  22.7k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2312:17): [True: 724, False: 22.0k]
  ------------------
 2313|       |                /* literal length >= RUN_MASK means >= RUN_MASK literal bytes follow the extension bytes,
 2314|       |                 * so extension bytes cannot reach the last RUN_MASK bytes of input */
 2315|    724|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK);
  ------------------
  |  |  264|    724|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    724|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    724|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2316|    724|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2316:21): [True: 0, False: 724]
  ------------------
 2317|    724|                length += addl;
 2318|    724|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|    724|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    724|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 724]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2319|    724|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|    724|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    724|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 724]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2320|    724|            }
 2321|       |
 2322|       |            /* copy literals */
 2323|  22.7k|            cpy = op+length;
 2324|       |
 2325|  22.7k|#if LZ4_FAST_DEC_LOOP
 2326|  23.5k|        safe_literal_copy:
 2327|  23.5k|#endif
 2328|       |
 2329|  23.5k|            LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  278|  23.5k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2330|  23.5k|            if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  247|  23.5k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  246|  14.8k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2330:17): [True: 8.78k, False: 14.8k]
  |  Branch (2330:39): [True: 2.01k, False: 12.8k]
  ------------------
 2331|       |                /* We've either hit the input parsing restriction or the output parsing restriction.
 2332|       |                 * In the normal scenario, decoding a full block, it must be the last sequence,
 2333|       |                 * otherwise it's an error (invalid input or dimensions).
 2334|       |                 * In partialDecoding scenario, it's necessary to ensure there is no buffer overflow.
 2335|       |                 */
 2336|  10.7k|                if (partialDecoding) {
  ------------------
  |  Branch (2336:21): [True: 0, False: 10.7k]
  ------------------
 2337|       |                    /* Since we are partial decoding we may be in this block because of the output parsing
 2338|       |                     * restriction, which is not valid since the output buffer is allowed to be undersized.
 2339|       |                     */
 2340|      0|                    DEBUGLOG(7, "partialDecoding: copying literals, close to input or output end")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2341|      0|                    DEBUGLOG(7, "partialDecoding: literal length = %u", (unsigned)length);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2342|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in dstBuffer : %i", (int)(oend - op));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2343|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in srcBuffer : %i", (int)(iend - ip));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2344|       |                    /* Finishing in the middle of a literals segment,
 2345|       |                     * due to lack of input.
 2346|       |                     */
 2347|      0|                    if (ip+length > iend) {
  ------------------
  |  Branch (2347:25): [True: 0, False: 0]
  ------------------
 2348|      0|                        length = (size_t)(iend-ip);
 2349|      0|                        cpy = op + length;
 2350|      0|                    }
 2351|       |                    /* Finishing in the middle of a literals segment,
 2352|       |                     * due to lack of output space.
 2353|       |                     */
 2354|      0|                    if (cpy > oend) {
  ------------------
  |  Branch (2354:25): [True: 0, False: 0]
  ------------------
 2355|      0|                        cpy = oend;
 2356|      0|                        assert(op<=oend);
  ------------------
  |  Branch (2356:25): [True: 0, False: 0]
  |  Branch (2356:25): [True: 0, False: 0]
  ------------------
 2357|      0|                        length = (size_t)(oend-op);
 2358|      0|                    }
 2359|  10.7k|                } else {
 2360|       |                     /* We must be on the last sequence (or invalid) because of the parsing limitations
 2361|       |                      * so check that we exactly consume the input and don't overrun the output buffer.
 2362|       |                      */
 2363|  10.7k|                    if ((ip+length != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2363:25): [True: 0, False: 10.7k]
  |  Branch (2363:48): [True: 0, False: 10.7k]
  ------------------
 2364|      0|                        DEBUGLOG(5, "should have been last run of literals")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2365|      0|                        DEBUGLOG(5, "ip(%p) + length(%i) = %p != iend (%p)", (void*)ip, (int)length, (void*)(ip+length), (void*)iend);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2366|      0|                        DEBUGLOG(5, "or cpy(%p) > (oend-MFLIMIT)(%p)", (void*)cpy, (void*)(oend-MFLIMIT));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2367|      0|                        DEBUGLOG(5, "after writing %u bytes / %i bytes available", (unsigned)(op-(BYTE*)dst), outputSize);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2368|      0|                        goto _output_error;
 2369|      0|                    }
 2370|  10.7k|                }
 2371|  10.7k|                LZ4_memmove(op, ip, length);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  358|  10.7k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2372|  10.7k|                ip += length;
 2373|  10.7k|                op += length;
 2374|       |                /* Necessarily EOF when !partialDecoding.
 2375|       |                 * When partialDecoding, it is EOF if we've either
 2376|       |                 * filled the output buffer or
 2377|       |                 * can't proceed with reading an offset for following match.
 2378|       |                 */
 2379|  10.7k|                if (!partialDecoding || (cpy == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2379:21): [True: 10.7k, False: 0]
  |  Branch (2379:41): [True: 0, False: 0]
  |  Branch (2379:58): [True: 0, False: 0]
  ------------------
 2380|  10.7k|                    break;
 2381|  10.7k|                }
 2382|  12.8k|            } else {
 2383|  12.8k|                LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2384|  12.8k|                ip += length; op = cpy;
 2385|  12.8k|            }
 2386|       |
 2387|       |            /* get offset */
 2388|  12.8k|            offset = LZ4_readLE16(ip); ip+=2;
 2389|  12.8k|            match = op - offset;
 2390|       |
 2391|       |            /* get matchlength */
 2392|  12.8k|            length = token & ML_MASK;
  ------------------
  |  |  262|  12.8k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  12.8k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2393|  12.8k|            DEBUGLOG(7, "blockPos%6u: matchLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  12.8k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2394|       |
 2395|  15.6k|    _copy_match:
 2396|  15.6k|            if (length == ML_MASK) {
  ------------------
  |  |  262|  15.6k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  15.6k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2396:17): [True: 3.45k, False: 12.2k]
  ------------------
 2397|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2398|  3.45k|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  246|  3.45k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2399|  3.45k|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2399:21): [True: 0, False: 3.45k]
  ------------------
 2400|  3.45k|                length += addl;
 2401|  3.45k|                if (unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  181|  3.45k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  3.45k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 3.45k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2402|  3.45k|            }
 2403|  15.6k|            length += MINMATCH;
  ------------------
  |  |  243|  15.6k|#define MINMATCH 4
  ------------------
 2404|       |
 2405|  15.6k|#if LZ4_FAST_DEC_LOOP
 2406|  19.3k|        safe_match_copy:
 2407|  19.3k|#endif
 2408|  19.3k|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error;   /* Error : offset outside buffers */
  ------------------
  |  |  181|  19.3k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  19.3k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2408:17): [True: 19.3k, False: 0]
  |  Branch (2408:34): [True: 0, False: 19.3k]
  ------------------
 2409|       |            /* match starting within external dictionary */
 2410|  19.3k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2410:17): [True: 0, False: 19.3k]
  |  Branch (2410:41): [True: 0, False: 0]
  ------------------
 2411|      0|                assert(dictEnd != NULL);
  ------------------
  |  Branch (2411:17): [True: 0, False: 0]
  |  Branch (2411:17): [True: 0, False: 0]
  ------------------
 2412|      0|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  181|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2413|      0|                    if (partialDecoding) length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1887|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1887:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2413:25): [True: 0, False: 0]
  ------------------
 2414|      0|                    else goto _output_error;   /* doesn't respect parsing restriction */
 2415|      0|                }
 2416|       |
 2417|      0|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2417:21): [True: 0, False: 0]
  ------------------
 2418|       |                    /* match fits entirely within external dictionary : just copy */
 2419|      0|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  358|      0|#    define LZ4_memmove __builtin_memmove
  ------------------
 2420|      0|                    op += length;
 2421|      0|                } else {
 2422|       |                    /* match stretches into both external dictionary and current block */
 2423|      0|                    size_t const copySize = (size_t)(lowPrefix - match);
 2424|      0|                    size_t const restSize = length - copySize;
 2425|      0|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2426|      0|                    op += copySize;
 2427|      0|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2427:25): [True: 0, False: 0]
  ------------------
 2428|      0|                        BYTE* const endOfMatch = op + restSize;
 2429|      0|                        const BYTE* copyFrom = lowPrefix;
 2430|      0|                        while (op < endOfMatch) *op++ = *copyFrom++;
  ------------------
  |  Branch (2430:32): [True: 0, False: 0]
  ------------------
 2431|      0|                    } else {
 2432|      0|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2433|      0|                        op += restSize;
 2434|      0|                }   }
 2435|      0|                continue;
 2436|      0|            }
 2437|  19.3k|            assert(match >= lowPrefix);
  ------------------
  |  Branch (2437:13): [True: 0, False: 19.3k]
  |  Branch (2437:13): [True: 19.3k, False: 0]
  ------------------
 2438|       |
 2439|       |            /* copy match within block */
 2440|  19.3k|            cpy = op + length;
 2441|       |
 2442|       |            /* partialDecoding : may end anywhere within the block */
 2443|  19.3k|            assert(op<=oend);
  ------------------
  |  Branch (2443:13): [True: 0, False: 19.3k]
  |  Branch (2443:13): [True: 19.3k, False: 0]
  ------------------
 2444|  19.3k|            if (partialDecoding && (cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  248|      0|#define MATCH_SAFEGUARD_DISTANCE  ((2*WILDCOPYLENGTH) - MINMATCH)   /* ensure it's possible to write 2 x wildcopyLength without overflowing output buffer */
  |  |  ------------------
  |  |  |  |  245|      0|#define WILDCOPYLENGTH 8
  |  |  ------------------
  |  |               #define MATCH_SAFEGUARD_DISTANCE  ((2*WILDCOPYLENGTH) - MINMATCH)   /* ensure it's possible to write 2 x wildcopyLength without overflowing output buffer */
  |  |  ------------------
  |  |  |  |  243|      0|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (2444:17): [True: 0, False: 19.3k]
  |  Branch (2444:36): [True: 0, False: 0]
  ------------------
 2445|      0|                size_t const mlen = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1887|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1887:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2446|      0|                const BYTE* const matchEnd = match + mlen;
 2447|      0|                BYTE* const copyEnd = op + mlen;
 2448|      0|                if (matchEnd > op) {   /* overlap copy */
  ------------------
  |  Branch (2448:21): [True: 0, False: 0]
  ------------------
 2449|      0|                    while (op < copyEnd) { *op++ = *match++; }
  ------------------
  |  Branch (2449:28): [True: 0, False: 0]
  ------------------
 2450|      0|                } else {
 2451|      0|                    LZ4_memcpy(op, match, mlen);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2452|      0|                }
 2453|      0|                op = copyEnd;
 2454|      0|                if (op == oend) { break; }
  ------------------
  |  Branch (2454:21): [True: 0, False: 0]
  ------------------
 2455|      0|                continue;
 2456|      0|            }
 2457|       |
 2458|  19.3k|            if (unlikely(offset<8)) {
  ------------------
  |  |  181|  19.3k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  19.3k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 10.3k, False: 9.03k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2459|  10.3k|                LZ4_write32(op, 0);   /* silence msan warning when offset==0 */
 2460|  10.3k|                op[0] = match[0];
 2461|  10.3k|                op[1] = match[1];
 2462|  10.3k|                op[2] = match[2];
 2463|  10.3k|                op[3] = match[3];
 2464|  10.3k|                match += inc32table[offset];
 2465|  10.3k|                LZ4_memcpy(op+4, match, 4);
  ------------------
  |  |  350|  10.3k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2466|  10.3k|                match -= dec64table[offset];
 2467|  10.3k|            } else {
 2468|  9.03k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  9.03k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2469|  9.03k|                match += 8;
 2470|  9.03k|            }
 2471|  19.3k|            op += 8;
 2472|       |
 2473|  19.3k|            if (unlikely(cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  181|  19.3k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  19.3k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 6.33k, False: 13.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2474|  6.33k|                BYTE* const oCopyLimit = oend - (WILDCOPYLENGTH-1);
  ------------------
  |  |  245|  6.33k|#define WILDCOPYLENGTH 8
  ------------------
 2475|  6.33k|                if (cpy > oend-LASTLITERALS) { goto _output_error; } /* Error : last LASTLITERALS bytes must be literals (uncompressed) */
  ------------------
  |  |  246|  6.33k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2475:21): [True: 0, False: 6.33k]
  ------------------
 2476|  6.33k|                if (op < oCopyLimit) {
  ------------------
  |  Branch (2476:21): [True: 3.87k, False: 2.45k]
  ------------------
 2477|  3.87k|                    LZ4_wildCopy8(op, match, oCopyLimit);
 2478|  3.87k|                    match += oCopyLimit - op;
 2479|  3.87k|                    op = oCopyLimit;
 2480|  3.87k|                }
 2481|  11.8k|                while (op < cpy) { *op++ = *match++; }
  ------------------
  |  Branch (2481:24): [True: 5.53k, False: 6.33k]
  ------------------
 2482|  13.0k|            } else {
 2483|  13.0k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  13.0k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2484|  13.0k|                if (length > 16) { LZ4_wildCopy8(op+8, match+8, cpy); }
  ------------------
  |  Branch (2484:21): [True: 4.14k, False: 8.87k]
  ------------------
 2485|  13.0k|            }
 2486|  19.3k|            op = cpy;   /* wildcopy correction */
 2487|  19.3k|        }
 2488|       |
 2489|       |        /* end of decoding */
 2490|  10.7k|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  290|  10.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2491|  10.7k|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2492|       |
 2493|       |        /* Overflow error detected */
 2494|      0|    _output_error:
 2495|      0|        return (int) (-(((const char*)ip)-src))-1;
 2496|  4.59k|    }
 2497|  4.59k|}
lz4.c:read_variable_length:
 2020|   635k|{
 2021|   635k|    Rvl_t s, length = 0;
 2022|   635k|    assert(ipPtr != NULL);
  ------------------
  |  Branch (2022:5): [True: 0, False: 635k]
  |  Branch (2022:5): [True: 635k, False: 0]
  ------------------
 2023|   635k|    assert(*ipPtr !=  NULL);
  ------------------
  |  Branch (2023:5): [True: 0, False: 635k]
  |  Branch (2023:5): [True: 635k, False: 0]
  ------------------
 2024|   635k|    assert(ilimit != NULL);
  ------------------
  |  Branch (2024:5): [True: 0, False: 635k]
  |  Branch (2024:5): [True: 635k, False: 0]
  ------------------
 2025|   635k|    if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|   635k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   635k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 635k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2026|      0|        return rvl_error;
 2027|      0|    }
 2028|   635k|    s = **ipPtr;
 2029|   635k|    (*ipPtr)++;
 2030|   635k|    length += s;
 2031|   635k|    if (likely(s != 255)) return length;
  ------------------
  |  |  178|   635k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|   635k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 570k, False: 64.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2032|   968k|    do {
 2033|   968k|        if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|   968k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   968k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 968k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2034|      0|            return rvl_error;
 2035|      0|        }
 2036|   968k|        s = **ipPtr;
 2037|   968k|        (*ipPtr)++;
 2038|   968k|        length += s;
 2039|       |        /* accumulator overflow detection (32-bit mode only) */
 2040|   968k|        if ((sizeof(length) < 8) && unlikely(length > ((Rvl_t)(-1)/2)) ) {
  ------------------
  |  |  181|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2040:13): [Folded, False: 968k]
  ------------------
 2041|      0|            return rvl_error;
 2042|      0|        }
 2043|   968k|    } while (s == 255);
  ------------------
  |  Branch (2043:14): [True: 904k, False: 64.6k]
  ------------------
 2044|       |
 2045|  64.6k|    return length;
 2046|  64.6k|}
lz4.c:LZ4_wildCopy32:
  532|   552k|{
  533|   552k|    BYTE* d = (BYTE*)dstPtr;
  534|   552k|    const BYTE* s = (const BYTE*)srcPtr;
  535|   552k|    BYTE* const e = (BYTE*)dstEnd;
  536|       |
  537|  4.44M|    do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  350|  4.44M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
                  do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  350|  4.44M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (537:79): [True: 3.88M, False: 552k]
  ------------------
  538|   552k|}
lz4.c:LZ4_readLE16:
  432|  2.45M|{
  433|  2.45M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (433:9): [True: 2.45M, False: 0]
  ------------------
  434|  2.45M|        return LZ4_read16(memPtr);
  435|  2.45M|    } else {
  436|      0|        const BYTE* p = (const BYTE*)memPtr;
  437|      0|        return (U16)((U16)p[0] | (p[1]<<8));
  438|      0|    }
  439|  2.45M|}
lz4.c:LZ4_memcpy_using_offset:
  545|   259k|{
  546|   259k|    BYTE v[8];
  547|       |
  548|   259k|    assert(dstEnd >= dstPtr + MINMATCH);
  ------------------
  |  Branch (548:5): [True: 0, False: 259k]
  |  Branch (548:5): [True: 259k, False: 0]
  ------------------
  549|       |
  550|   259k|    switch(offset) {
  551|  60.8k|    case 1:
  ------------------
  |  Branch (551:5): [True: 60.8k, False: 198k]
  ------------------
  552|  60.8k|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  237|  60.8k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  235|  60.8k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  553|  60.8k|        break;
  554|   108k|    case 2:
  ------------------
  |  Branch (554:5): [True: 108k, False: 151k]
  ------------------
  555|   108k|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  350|   108k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  556|   108k|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  350|   108k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  557|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  558|       |#  pragma warning(push)
  559|       |#  pragma warning(disable : 6385) /* warning C6385: Reading invalid data from 'v'. */
  560|       |#endif
  561|   108k|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  350|   108k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  562|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  563|       |#  pragma warning(pop)
  564|       |#endif
  565|   108k|        break;
  566|  55.0k|    case 4:
  ------------------
  |  Branch (566:5): [True: 55.0k, False: 204k]
  ------------------
  567|  55.0k|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  350|  55.0k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  568|  55.0k|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  350|  55.0k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  569|  55.0k|        break;
  570|  35.1k|    default:
  ------------------
  |  Branch (570:5): [True: 35.1k, False: 224k]
  ------------------
  571|  35.1k|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  572|  35.1k|        return;
  573|   259k|    }
  574|       |
  575|   224k|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  350|   224k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  576|   224k|    dstPtr += 8;
  577|  7.36M|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (577:12): [True: 7.13M, False: 224k]
  ------------------
  578|  7.13M|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  350|  7.13M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  579|  7.13M|        dstPtr += 8;
  580|  7.13M|    }
  581|   224k|}
lz4.c:LZ4_memcpy_using_offset_base:
  493|  35.1k|{
  494|  35.1k|    assert(srcPtr + offset == dstPtr);
  ------------------
  |  Branch (494:5): [True: 0, False: 35.1k]
  |  Branch (494:5): [True: 35.1k, False: 0]
  ------------------
  495|  35.1k|    if (offset < 8) {
  ------------------
  |  Branch (495:9): [True: 26.5k, False: 8.65k]
  ------------------
  496|  26.5k|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  497|  26.5k|        assert(offset != 1);   /* offset==0 happens on testing */
  ------------------
  |  Branch (497:9): [True: 0, False: 26.5k]
  |  Branch (497:9): [True: 26.5k, False: 0]
  ------------------
  498|  26.5k|        LZ4_memcpy(dstPtr, srcPtr, 2);
  ------------------
  |  |  350|  26.5k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  499|  26.5k|        LZ4_memcpy(dstPtr + 2, srcPtr + 2, 2);
  ------------------
  |  |  350|  26.5k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  500|  26.5k|        srcPtr += inc32table[offset];
  501|  26.5k|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  350|  26.5k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  502|  26.5k|        srcPtr -= dec64table[offset];
  503|  26.5k|        dstPtr += 8;
  504|  26.5k|    } else {
  505|  8.65k|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  350|  8.65k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  506|  8.65k|        dstPtr += 8;
  507|  8.65k|        srcPtr += 8;
  508|  8.65k|    }
  509|       |
  510|  35.1k|    LZ4_wildCopy8(dstPtr, srcPtr, dstEnd);
  511|  35.1k|}
lz4hc.c:LZ4_isAligned:
  294|  21.2k|{
  295|  21.2k|    return ((size_t)ptr & (alignment -1)) == 0;
  296|  21.2k|}
lz4hc.c:LZ4_read32:
  395|  1.58G|static U32 LZ4_read32(const void* ptr) { return ((const LZ4_unalign32*)ptr)->u32; }
lz4hc.c:LZ4_isLittleEndian:
  365|   181M|{
  366|   181M|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  367|   181M|    return one.c[0];
  368|   181M|}
lz4hc.c:LZ4_count:
  690|  71.0M|{
  691|  71.0M|    const BYTE* const pStart = pIn;
  692|       |
  693|  71.0M|    if (likely(pIn < pInLimit-(STEPSIZE-1))) {
  ------------------
  |  |  178|  71.0M|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  71.0M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 71.0M, False: 26.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  694|  71.0M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  695|  71.0M|        if (!diff) {
  ------------------
  |  Branch (695:13): [True: 14.0M, False: 56.9M]
  ------------------
  696|  14.0M|            pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  687|  14.0M|#define STEPSIZE sizeof(reg_t)
  ------------------
                          pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  687|  14.0M|#define STEPSIZE sizeof(reg_t)
  ------------------
  697|  56.9M|        } else {
  698|  56.9M|            return LZ4_NbCommonBytes(diff);
  699|  56.9M|    }   }
  700|       |
  701|   414M|    while (likely(pIn < pInLimit-(STEPSIZE-1))) {
  702|   414M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  703|   414M|        if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  687|   400M|#define STEPSIZE sizeof(reg_t)
  ------------------
                      if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  687|   400M|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (703:13): [True: 400M, False: 14.0M]
  ------------------
  704|  14.0M|        pIn += LZ4_NbCommonBytes(diff);
  705|  14.0M|        return (unsigned)(pIn - pStart);
  706|   414M|    }
  707|       |
  708|  46.0k|    if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  |  687|  46.0k|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (708:9): [True: 46.0k, Folded]
  |  Branch (708:26): [True: 35.6k, False: 10.4k]
  |  Branch (708:48): [True: 14.1k, False: 21.4k]
  ------------------
  709|  46.0k|    if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (709:9): [True: 35.4k, False: 10.6k]
  |  Branch (709:31): [True: 14.3k, False: 21.0k]
  ------------------
  710|  46.0k|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (710:9): [True: 36.9k, False: 9.16k]
  |  Branch (710:27): [True: 19.8k, False: 17.1k]
  ------------------
  711|  46.0k|    return (unsigned)(pIn - pStart);
  712|  14.1M|}
lz4hc.c:LZ4_read_ARCH:
  396|  1.06G|static reg_t LZ4_read_ARCH(const void* ptr) { return ((const LZ4_unalignST*)ptr)->uArch; }
lz4hc.c:LZ4_NbCommonBytes:
  589|   125M|{
  590|   125M|    assert(val != 0);
  ------------------
  |  Branch (590:5): [True: 0, False: 125M]
  |  Branch (590:5): [True: 125M, False: 0]
  ------------------
  591|   125M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (591:9): [True: 125M, False: 0]
  ------------------
  592|   125M|        if (sizeof(val) == 8) {
  ------------------
  |  Branch (592:13): [True: 125M, Folded]
  ------------------
  593|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1800) && (defined(_M_AMD64) && !defined(_M_ARM64EC)) && !defined(LZ4_FORCE_SW_BITCOUNT)
  594|       |/*-*************************************************************************************************
  595|       |* ARM64EC is a Microsoft-designed ARM64 ABI compatible with AMD64 applications on ARM64 Windows 11.
  596|       |* The ARM64EC ABI does not support AVX/AVX2/AVX512 instructions, nor their relevant intrinsics
  597|       |* including _tzcnt_u64. Therefore, we need to neuter the _tzcnt_u64 code path for ARM64EC.
  598|       |****************************************************************************************************/
  599|       |#         if defined(__clang__) && (__clang_major__ < 10)
  600|       |            /* Avoid undefined clang-cl intrinsics issue.
  601|       |             * See https://github.com/lz4/lz4/pull/1017 for details. */
  602|       |            return (unsigned)__builtin_ia32_tzcnt_u64(val) >> 3;
  603|       |#         else
  604|       |            /* x64 CPUS without BMI support interpret `TZCNT` as `REP BSF` */
  605|       |            return (unsigned)_tzcnt_u64(val) >> 3;
  606|       |#         endif
  607|       |#       elif defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT)
  608|       |            unsigned long r = 0;
  609|       |            _BitScanForward64(&r, (U64)val);
  610|       |            return (unsigned)r >> 3;
  611|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  612|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  613|       |                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  614|       |            return (unsigned)__builtin_ctzll((U64)val) >> 3;
  615|       |#       else
  616|       |            const U64 m = 0x0101010101010101ULL;
  617|       |            val ^= val - 1;
  618|       |            return (unsigned)(((U64)((val & (m - 1)) * m)) >> 56);
  619|       |#       endif
  620|   125M|        } else /* 32 bits */ {
  621|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT)
  622|       |            unsigned long r;
  623|       |            _BitScanForward(&r, (U32)val);
  624|       |            return (unsigned)r >> 3;
  625|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  626|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  627|       |                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  628|       |            return (unsigned)__builtin_ctz((U32)val) >> 3;
  629|       |#       else
  630|       |            const U32 m = 0x01010101;
  631|       |            return (unsigned)((((val - 1) ^ val) & (m - 1)) * m) >> 24;
  632|       |#       endif
  633|      0|        }
  634|   125M|    } else   /* Big Endian CPU */ {
  635|      0|        if (sizeof(val)==8) {
  ------------------
  |  Branch (635:13): [True: 0, Folded]
  ------------------
  636|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  637|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  638|      0|                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  639|      0|            return (unsigned)__builtin_clzll((U64)val) >> 3;
  640|       |#       else
  641|       |#if 1
  642|       |            /* this method is probably faster,
  643|       |             * but adds a 128 bytes lookup table */
  644|       |            static const unsigned char ctz7_tab[128] = {
  645|       |                7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  646|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  647|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  648|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  649|       |                6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  650|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  651|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  652|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  653|       |            };
  654|       |            U64 const mask = 0x0101010101010101ULL;
  655|       |            U64 const t = (((val >> 8) - mask) | val) & mask;
  656|       |            return ctz7_tab[(t * 0x0080402010080402ULL) >> 57];
  657|       |#else
  658|       |            /* this method doesn't consume memory space like the previous one,
  659|       |             * but it contains several branches,
  660|       |             * that may end up slowing execution */
  661|       |            static const U32 by32 = sizeof(val)*4;  /* 32 on 64 bits (goal), 16 on 32 bits.
  662|       |            Just to avoid some static analyzer complaining about shift by 32 on 32-bits target.
  663|       |            Note that this code path is never triggered in 32-bits mode. */
  664|       |            unsigned r;
  665|       |            if (!(val>>by32)) { r=4; } else { r=0; val>>=by32; }
  666|       |            if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; }
  667|       |            r += (!val);
  668|       |            return r;
  669|       |#endif
  670|       |#       endif
  671|      0|        } else /* 32 bits */ {
  672|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  673|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  674|      0|                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  675|      0|            return (unsigned)__builtin_clz((U32)val) >> 3;
  676|       |#       else
  677|       |            val >>= 8;
  678|       |            val = ((((val + 0x00FFFF00) | 0x00FFFFFF) + val) |
  679|       |              (val + 0x00FF0000)) >> 24;
  680|       |            return (unsigned)val ^ 3;
  681|       |#       endif
  682|      0|        }
  683|      0|    }
  684|   125M|}
lz4hc.c:LZ4_read16:
  394|  1.28G|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4hc.c:LZ4_wildCopy8:
  467|  2.65M|{
  468|  2.65M|    BYTE* d = (BYTE*)dstPtr;
  469|  2.65M|    const BYTE* s = (const BYTE*)srcPtr;
  470|  2.65M|    BYTE* const e = (BYTE*)dstEnd;
  471|       |
  472|  7.25M|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  350|  7.25M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (472:50): [True: 4.60M, False: 2.65M]
  ------------------
  473|  2.65M|}
lz4hc.c:LZ4_writeLE16:
  454|  2.65M|{
  455|  2.65M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (455:9): [True: 2.65M, False: 0]
  ------------------
  456|  2.65M|        LZ4_write16(memPtr, value);
  457|  2.65M|    } else {
  458|      0|        BYTE* p = (BYTE*)memPtr;
  459|      0|        p[0] = (BYTE) value;
  460|      0|        p[1] = (BYTE)(value>>8);
  461|      0|    }
  462|  2.65M|}
lz4hc.c:LZ4_write16:
  398|  2.65M|static void LZ4_write16(void* memPtr, U16 value) { ((LZ4_unalign16*)memPtr)->u16 = value; }

LZ4_sizeofStateHC:
 1567|  7.04k|int LZ4_sizeofStateHC(void) { return (int)sizeof(LZ4_streamHC_t); }
LZ4_compress_HC_extStateHC_fastReset:
 1582|  7.07k|{
 1583|  7.07k|    LZ4HC_CCtx_internal* const ctx = &((LZ4_streamHC_t*)state)->internal_donotuse;
 1584|  7.07k|    if (!LZ4_isAligned(state, LZ4_streamHC_t_alignment())) return 0;
  ------------------
  |  Branch (1584:9): [True: 0, False: 7.07k]
  ------------------
 1585|  7.07k|    LZ4_resetStreamHC_fast((LZ4_streamHC_t*)state, compressionLevel);
 1586|  7.07k|    LZ4HC_init_internal (ctx, (const BYTE*)src);
 1587|  7.07k|    if (dstCapacity < LZ4_compressBound(srcSize))
  ------------------
  |  Branch (1587:9): [True: 7.07k, False: 0]
  ------------------
 1588|  7.07k|        return LZ4HC_compress_generic (ctx, src, dst, &srcSize, dstCapacity, compressionLevel, limitedOutput);
 1589|      0|    else
 1590|      0|        return LZ4HC_compress_generic (ctx, src, dst, &srcSize, dstCapacity, compressionLevel, notLimited);
 1591|  7.07k|}
LZ4_compress_HC_extStateHC:
 1594|  7.07k|{
 1595|  7.07k|    LZ4_streamHC_t* const ctx = LZ4_initStreamHC(state, sizeof(*ctx));
 1596|  7.07k|    if (ctx==NULL) return 0;   /* init failure */
  ------------------
  |  Branch (1596:9): [True: 0, False: 7.07k]
  ------------------
 1597|  7.07k|    return LZ4_compress_HC_extStateHC_fastReset(state, src, dst, srcSize, dstCapacity, compressionLevel);
 1598|  7.07k|}
LZ4_compress_HC:
 1601|  7.07k|{
 1602|  7.07k|    int cSize;
 1603|  7.07k|#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1
 1604|  7.07k|    LZ4_streamHC_t* const statePtr = (LZ4_streamHC_t*)ALLOC(sizeof(LZ4_streamHC_t));
  ------------------
  |  |  226|  7.07k|# define ALLOC(s)          malloc(s)
  ------------------
 1605|  7.07k|    if (statePtr==NULL) return 0;
  ------------------
  |  Branch (1605:9): [True: 0, False: 7.07k]
  ------------------
 1606|       |#else
 1607|       |    LZ4_streamHC_t state;
 1608|       |    LZ4_streamHC_t* const statePtr = &state;
 1609|       |#endif
 1610|  7.07k|    DEBUGLOG(5, "LZ4_compress_HC")
  ------------------
  |  |  290|  7.07k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1611|  7.07k|    cSize = LZ4_compress_HC_extStateHC(statePtr, src, dst, srcSize, dstCapacity, compressionLevel);
 1612|  7.07k|#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1
 1613|  7.07k|    FREEMEM(statePtr);
  ------------------
  |  |  228|  7.07k|# define FREEMEM(p)        free(p)
  ------------------
 1614|  7.07k|#endif
 1615|  7.07k|    return cSize;
 1616|  7.07k|}
LZ4_compress_HC_destSize:
 1620|  7.04k|{
 1621|  7.04k|    LZ4_streamHC_t* const ctx = LZ4_initStreamHC(state, sizeof(*ctx));
 1622|  7.04k|    if (ctx==NULL) return 0;   /* init failure */
  ------------------
  |  Branch (1622:9): [True: 0, False: 7.04k]
  ------------------
 1623|  7.04k|    LZ4HC_init_internal(&ctx->internal_donotuse, (const BYTE*) source);
 1624|  7.04k|    LZ4_setCompressionLevel(ctx, cLevel);
 1625|  7.04k|    return LZ4HC_compress_generic(&ctx->internal_donotuse, source, dest, sourceSizePtr, targetDestSize, cLevel, fillOutput);
 1626|  7.04k|}
LZ4_initStreamHC:
 1655|  14.1k|{
 1656|  14.1k|    LZ4_streamHC_t* const LZ4_streamHCPtr = (LZ4_streamHC_t*)buffer;
 1657|  14.1k|    DEBUGLOG(4, "LZ4_initStreamHC(%p, %u)", buffer, (unsigned)size);
  ------------------
  |  |  290|  14.1k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1658|       |    /* check conditions */
 1659|  14.1k|    if (buffer == NULL) return NULL;
  ------------------
  |  Branch (1659:9): [True: 0, False: 14.1k]
  ------------------
 1660|  14.1k|    if (size < sizeof(LZ4_streamHC_t)) return NULL;
  ------------------
  |  Branch (1660:9): [True: 0, False: 14.1k]
  ------------------
 1661|  14.1k|    if (!LZ4_isAligned(buffer, LZ4_streamHC_t_alignment())) return NULL;
  ------------------
  |  Branch (1661:9): [True: 0, False: 14.1k]
  ------------------
 1662|       |    /* init */
 1663|  14.1k|    { LZ4HC_CCtx_internal* const hcstate = &(LZ4_streamHCPtr->internal_donotuse);
 1664|  14.1k|      MEM_INIT(hcstate, 0, sizeof(*hcstate)); }
  ------------------
  |  |  237|  14.1k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  235|  14.1k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 1665|  14.1k|    LZ4_setCompressionLevel(LZ4_streamHCPtr, LZ4HC_CLEVEL_DEFAULT);
  ------------------
  |  |   48|  14.1k|#define LZ4HC_CLEVEL_DEFAULT     9
  ------------------
 1666|  14.1k|    return LZ4_streamHCPtr;
 1667|  14.1k|}
LZ4_resetStreamHC_fast:
 1677|  7.07k|{
 1678|  7.07k|    LZ4HC_CCtx_internal* const s = &LZ4_streamHCPtr->internal_donotuse;
 1679|  7.07k|    DEBUGLOG(5, "LZ4_resetStreamHC_fast(%p, %d)", LZ4_streamHCPtr, compressionLevel);
  ------------------
  |  |  290|  7.07k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1680|  7.07k|    if (s->dirty) {
  ------------------
  |  Branch (1680:9): [True: 0, False: 7.07k]
  ------------------
 1681|       |        /* a failed compression left the tables in an undefined state : start from scratch,
 1682|       |         * but preserve parameters, as a reset without prior failure would */
 1683|      0|        LZ4_i8 const favorDecSpeed = s->favorDecSpeed;
 1684|      0|        LZ4_initStreamHC(LZ4_streamHCPtr, sizeof(*LZ4_streamHCPtr));
 1685|      0|        s->favorDecSpeed = favorDecSpeed;
 1686|  7.07k|    } else {
 1687|  7.07k|        assert(s->end >= s->prefixStart);
  ------------------
  |  Branch (1687:9): [True: 0, False: 7.07k]
  |  Branch (1687:9): [True: 7.07k, False: 0]
  ------------------
 1688|  7.07k|        s->dictLimit += (U32)(s->end - s->prefixStart);
 1689|  7.07k|        s->prefixStart = NULL;
 1690|  7.07k|        s->end = NULL;
 1691|  7.07k|        s->dictCtx = NULL;
 1692|  7.07k|    }
 1693|  7.07k|    LZ4_setCompressionLevel(LZ4_streamHCPtr, compressionLevel);
 1694|  7.07k|}
LZ4_setCompressionLevel:
 1697|  28.2k|{
 1698|  28.2k|    DEBUGLOG(5, "LZ4_setCompressionLevel(%p, %d)", LZ4_streamHCPtr, compressionLevel);
  ------------------
  |  |  290|  28.2k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1699|  28.2k|    if (compressionLevel < 1) compressionLevel = LZ4HC_CLEVEL_DEFAULT;
  ------------------
  |  |   48|      0|#define LZ4HC_CLEVEL_DEFAULT     9
  ------------------
  |  Branch (1699:9): [True: 0, False: 28.2k]
  ------------------
 1700|  28.2k|    if (compressionLevel > LZ4HC_CLEVEL_MAX) compressionLevel = LZ4HC_CLEVEL_MAX;
  ------------------
  |  |   50|  28.2k|#define LZ4HC_CLEVEL_MAX        12
  ------------------
                  if (compressionLevel > LZ4HC_CLEVEL_MAX) compressionLevel = LZ4HC_CLEVEL_MAX;
  ------------------
  |  |   50|      0|#define LZ4HC_CLEVEL_MAX        12
  ------------------
  |  Branch (1700:9): [True: 0, False: 28.2k]
  ------------------
 1701|  28.2k|    LZ4_streamHCPtr->internal_donotuse.compressionLevel = (short)compressionLevel;
 1702|  28.2k|}
lz4hc.c:LZ4_streamHC_t_alignment:
 1570|  21.2k|{
 1571|  21.2k|#if LZ4_ALIGN_TEST
 1572|  21.2k|    typedef struct { char c; LZ4_streamHC_t t; } t_a;
 1573|  21.2k|    return sizeof(t_a) - sizeof(LZ4_streamHC_t);
 1574|       |#else
 1575|       |    return 1;  /* effectively disabled */
 1576|       |#endif
 1577|  21.2k|}
lz4hc.c:LZ4HC_init_internal:
  244|  14.1k|{
  245|  14.1k|    size_t const bufferSize = (size_t)(hc4->end - hc4->prefixStart);
  246|  14.1k|    size_t newStartingOffset = bufferSize + hc4->dictLimit;
  247|  14.1k|    DEBUGLOG(5, "LZ4HC_init_internal");
  ------------------
  |  |  290|  14.1k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  248|  14.1k|    assert(newStartingOffset >= bufferSize);  /* check overflow */
  ------------------
  |  Branch (248:5): [True: 0, False: 14.1k]
  |  Branch (248:5): [True: 14.1k, False: 0]
  ------------------
  249|  14.1k|    if (newStartingOffset > 1 GB) {
  ------------------
  |  |  254|  14.1k|#define GB *(1U<<30)
  ------------------
  |  Branch (249:9): [True: 0, False: 14.1k]
  ------------------
  250|      0|        LZ4HC_clearTables(hc4);
  251|      0|        newStartingOffset = 0;
  252|      0|    }
  253|  14.1k|    newStartingOffset += 64 KB;
  ------------------
  |  |  252|  14.1k|#define KB *(1 <<10)
  ------------------
  254|  14.1k|    hc4->nextToUpdate = (U32)newStartingOffset;
  255|  14.1k|    hc4->prefixStart = start;
  256|  14.1k|    hc4->end = start;
  257|  14.1k|    hc4->dictStart = start;
  258|  14.1k|    hc4->dictLimit = (U32)newStartingOffset;
  259|  14.1k|    hc4->lowLimit = (U32)newStartingOffset;
  260|  14.1k|}
lz4hc.c:LZ4HC_compress_generic:
 1558|  14.1k|{
 1559|  14.1k|    if (ctx->dictCtx == NULL) {
  ------------------
  |  Branch (1559:9): [True: 14.1k, False: 0]
  ------------------
 1560|  14.1k|        return LZ4HC_compress_generic_noDictCtx(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit);
 1561|  14.1k|    } else {
 1562|      0|        return LZ4HC_compress_generic_dictCtx(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit);
 1563|      0|    }
 1564|  14.1k|}
lz4hc.c:LZ4HC_compress_generic_noDictCtx:
 1507|  14.1k|{
 1508|  14.1k|    assert(ctx->dictCtx == NULL);
  ------------------
  |  Branch (1508:5): [True: 0, False: 14.1k]
  |  Branch (1508:5): [True: 14.1k, False: 0]
  ------------------
 1509|  14.1k|    return LZ4HC_compress_generic_internal(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit, noDictCtx);
 1510|  14.1k|}
lz4hc.c:LZ4HC_compress_generic_internal:
 1459|  14.1k|{
 1460|  14.1k|    DEBUGLOG(5, "LZ4HC_compress_generic_internal(src=%p, srcSize=%d, dstCapacity=%d)",
  ------------------
  |  |  290|  14.1k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1461|  14.1k|                src, *srcSizePtr, dstCapacity);
 1462|       |
 1463|       |    /* input sanitization */
 1464|  14.1k|    if ((U32)*srcSizePtr > (U32)LZ4_MAX_INPUT_SIZE) return 0;  /* Unsupported input size (too large or negative) */
  ------------------
  |  |  214|  14.1k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  ------------------
  |  Branch (1464:9): [True: 0, False: 14.1k]
  ------------------
 1465|  14.1k|    if (dstCapacity < 1) return 0;   /* Invalid: impossible to store anything */
  ------------------
  |  Branch (1465:9): [True: 29, False: 14.0k]
  ------------------
 1466|  14.1k|    assert(dst); /* since dstCapacity >= 1, dst must be valid */
  ------------------
  |  Branch (1466:5): [True: 0, False: 14.0k]
  |  Branch (1466:5): [True: 14.0k, False: 0]
  ------------------
 1467|  14.0k|    if (*srcSizePtr == 0) { *dst = 0; return 1; }
  ------------------
  |  Branch (1467:9): [True: 0, False: 14.0k]
  ------------------
 1468|  14.0k|    assert(src != NULL); /* since *srcSizePtr >= 1, src must be valid */
  ------------------
  |  Branch (1468:5): [True: 0, False: 14.0k]
  |  Branch (1468:5): [True: 14.0k, False: 0]
  ------------------
 1469|       |
 1470|  14.0k|    ctx->end += *srcSizePtr;
 1471|  14.0k|    {   cParams_t const cParam = LZ4HC_getCLevelParams(cLevel);
 1472|  14.0k|        HCfavor_e const favor = ctx->favorDecSpeed ? favorDecompressionSpeed : favorCompressionRatio;
  ------------------
  |  Branch (1472:33): [True: 0, False: 14.0k]
  ------------------
 1473|  14.0k|        int result;
 1474|       |
 1475|  14.0k|        if (cParam.strat == lz4mid) {
  ------------------
  |  Branch (1475:13): [True: 2.11k, False: 11.9k]
  ------------------
 1476|  2.11k|            result = LZ4MID_compress(ctx,
 1477|  2.11k|                                src, dst, srcSizePtr, dstCapacity,
 1478|  2.11k|                                limit, dict);
 1479|  11.9k|        } else if (cParam.strat == lz4hc) {
  ------------------
  |  Branch (1479:20): [True: 6.50k, False: 5.47k]
  ------------------
 1480|  6.50k|            result = LZ4HC_compress_hashChain(ctx,
 1481|  6.50k|                                src, dst, srcSizePtr, dstCapacity,
 1482|  6.50k|                                cParam.nbSearches, limit, dict);
 1483|  6.50k|        } else {
 1484|  5.47k|            assert(cParam.strat == lz4opt);
  ------------------
  |  Branch (1484:13): [True: 0, False: 5.47k]
  |  Branch (1484:13): [True: 5.47k, False: 0]
  ------------------
 1485|  5.47k|            result = LZ4HC_compress_optimal(ctx,
 1486|  5.47k|                                src, dst, srcSizePtr, dstCapacity,
 1487|  5.47k|                                cParam.nbSearches, cParam.nbSearchesSeq, (int)cParam.targetLength, limit,
 1488|  5.47k|                                dict, favor);
 1489|  5.47k|        }
 1490|  14.0k|        if (result <= 0) ctx->dirty = 1;
  ------------------
  |  Branch (1490:13): [True: 3.30k, False: 10.7k]
  ------------------
 1491|  14.0k|        return result;
 1492|  14.0k|    }
 1493|  14.0k|}
lz4hc.c:LZ4MID_compress:
  657|  2.11k|{
  658|  2.11k|    U32* const hash4Table = ctx->hashTable;
  659|  2.11k|    U32* const hash8Table = hash4Table + LZ4MID_HASHTABLESIZE;
  ------------------
  |  |  144|  2.11k|#define LZ4MID_HASHTABLESIZE (1 << LZ4MID_HASHLOG)
  |  |  ------------------
  |  |  |  |  143|  2.11k|#define LZ4MID_HASHLOG (LZ4HC_HASH_LOG-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  233|  2.11k|#define LZ4HC_HASH_LOG 15
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  660|  2.11k|    const BYTE* ip = (const BYTE*)src;
  661|  2.11k|    const BYTE* anchor = ip;
  662|  2.11k|    const BYTE* const iend = ip + *srcSizePtr;
  663|  2.11k|    const BYTE* const mflimit = iend - MFLIMIT;
  ------------------
  |  |  247|  2.11k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  664|  2.11k|    const BYTE* const matchlimit = (iend - LASTLITERALS);
  ------------------
  |  |  246|  2.11k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  665|  2.11k|    const BYTE* const ilimit = (iend - LZ4MID_HASHSIZE);
  ------------------
  |  |  142|  2.11k|#define LZ4MID_HASHSIZE 8
  ------------------
  666|  2.11k|    BYTE* op = (BYTE*)dst;
  667|       |    /* fillOutput : keep room for the final run of literals (LZ4 format restriction) */
  668|  2.11k|    BYTE* const oend = op + maxOutputSize - ((limit == fillOutput) ? LASTLITERALS : 0);
  ------------------
  |  |  246|  1.05k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (668:46): [True: 1.05k, False: 1.05k]
  ------------------
  669|       |
  670|  2.11k|    const BYTE* const prefixPtr = ctx->prefixStart;
  671|  2.11k|    const U32 prefixIdx = ctx->dictLimit;
  672|  2.11k|    const U32 ilimitIdx = (U32)(ilimit - prefixPtr) + prefixIdx;
  673|  2.11k|    const BYTE* const dictStart = ctx->dictStart;
  674|  2.11k|    const U32 dictIdx = ctx->lowLimit;
  675|  2.11k|    const U32 gDictEndIndex = ctx->lowLimit;
  676|  2.11k|    const LZ4MID_searchIntoDict_f searchIntoDict = (dict == usingDictCtxHc) ? select_searchDict_function(ctx->dictCtx) : NULL;
  ------------------
  |  Branch (676:52): [True: 0, False: 2.11k]
  ------------------
  677|  2.11k|    unsigned matchLength;
  678|  2.11k|    unsigned matchDistance;
  679|       |
  680|  2.11k|    DEBUGLOG(5, "LZ4MID_compress (%i bytes)", *srcSizePtr);
  ------------------
  |  |  290|  2.11k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  681|       |
  682|       |    /* preconditions verifications */
  683|  2.11k|    if (dict == usingDictCtxHc) DEBUGLOG(5, "usingDictCtxHc");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  |  Branch (683:9): [True: 0, False: 2.11k]
  ------------------
  684|  2.11k|    assert(*srcSizePtr > 0);
  ------------------
  |  Branch (684:5): [True: 0, False: 2.11k]
  |  Branch (684:5): [True: 2.11k, False: 0]
  ------------------
  685|  2.11k|    assert(*srcSizePtr <= LZ4_MAX_INPUT_SIZE);
  ------------------
  |  Branch (685:5): [True: 0, False: 2.11k]
  |  Branch (685:5): [True: 2.11k, False: 0]
  ------------------
  686|  2.11k|    assert(src != NULL);
  ------------------
  |  Branch (686:5): [True: 0, False: 2.11k]
  |  Branch (686:5): [True: 2.11k, False: 0]
  ------------------
  687|  2.11k|    assert(maxOutputSize >= 1);
  ------------------
  |  Branch (687:5): [True: 0, False: 2.11k]
  |  Branch (687:5): [True: 2.11k, False: 0]
  ------------------
  688|  2.11k|    assert(dst != NULL);
  ------------------
  |  Branch (688:5): [True: 0, False: 2.11k]
  |  Branch (688:5): [True: 2.11k, False: 0]
  ------------------
  689|       |
  690|  2.11k|    if (*srcSizePtr < LZ4_minLength)
  ------------------
  |  Branch (690:9): [True: 20, False: 2.09k]
  ------------------
  691|     20|        goto _lz4mid_last_literals;  /* Input too small, no compression (all literals) */
  692|       |
  693|       |    /* main loop */
  694|  4.87M|    while (ip <= mflimit) {
  ------------------
  |  Branch (694:12): [True: 4.87M, False: 1.30k]
  ------------------
  695|  4.87M|        const U32 ipIndex = (U32)(ip - prefixPtr) + prefixIdx;
  696|       |        /* search long match */
  697|  4.87M|        {   U32 const h8 = LZ4MID_hash8Ptr(ip);
  698|  4.87M|            U32 const pos8 = hash8Table[h8];
  699|  4.87M|            assert(h8 < LZ4MID_HASHTABLESIZE);
  ------------------
  |  Branch (699:13): [True: 0, False: 4.87M]
  |  Branch (699:13): [True: 4.87M, False: 0]
  ------------------
  700|  4.87M|            assert(pos8 < ipIndex);
  ------------------
  |  Branch (700:13): [True: 0, False: 4.87M]
  |  Branch (700:13): [True: 4.87M, False: 0]
  ------------------
  701|  4.87M|            LZ4MID_addPosition(hash8Table, h8, ipIndex);
  702|  4.87M|            if (ipIndex - pos8 <= LZ4_DISTANCE_MAX) {
  ------------------
  |  |  678|  4.87M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (702:17): [True: 3.05M, False: 1.81M]
  ------------------
  703|       |                /* match candidate found */
  704|  3.05M|                if (pos8 >= prefixIdx) {
  ------------------
  |  Branch (704:21): [True: 3.05M, False: 0]
  ------------------
  705|  3.05M|                    const BYTE* const matchPtr = prefixPtr + pos8 - prefixIdx;
  706|  3.05M|                    assert(matchPtr < ip);
  ------------------
  |  Branch (706:21): [True: 0, False: 3.05M]
  |  Branch (706:21): [True: 3.05M, False: 0]
  ------------------
  707|  3.05M|                    matchLength = LZ4_count(ip, matchPtr, matchlimit);
  708|  3.05M|                    if (matchLength >= MINMATCH) {
  ------------------
  |  |  243|  3.05M|#define MINMATCH 4
  ------------------
  |  Branch (708:25): [True: 712k, False: 2.34M]
  ------------------
  709|   712k|                        DEBUGLOG(7, "found long match at pos %u (len=%u)", pos8, matchLength);
  ------------------
  |  |  290|   712k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  710|   712k|                        matchDistance = ipIndex - pos8;
  711|   712k|                        goto _lz4mid_encode_sequence;
  712|   712k|                    }
  713|  3.05M|                } else {
  714|      0|                    if (pos8 >= dictIdx) {
  ------------------
  |  Branch (714:25): [True: 0, False: 0]
  ------------------
  715|       |                        /* extDict match candidate */
  716|      0|                        const BYTE* const matchPtr = dictStart + (pos8 - dictIdx);
  717|      0|                        const size_t safeLen = MIN(prefixIdx - pos8, (size_t)(matchlimit - ip));
  ------------------
  |  |   81|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (81:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  718|      0|                        matchLength = LZ4_count(ip, matchPtr, ip + safeLen);
  719|      0|                        if (matchLength >= MINMATCH) {
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
  |  Branch (719:29): [True: 0, False: 0]
  ------------------
  720|      0|                            DEBUGLOG(7, "found long match at ExtDict pos %u (len=%u)", pos8, matchLength);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  721|      0|                            matchDistance = ipIndex - pos8;
  722|      0|                            goto _lz4mid_encode_sequence;
  723|      0|                        }
  724|      0|                    }
  725|      0|                }
  726|  3.05M|        }   }
  727|       |        /* search short match */
  728|  4.15M|        {   U32 const h4 = LZ4MID_hash4Ptr(ip);
  729|  4.15M|            U32 const pos4 = hash4Table[h4];
  730|  4.15M|            assert(h4 < LZ4MID_HASHTABLESIZE);
  ------------------
  |  Branch (730:13): [True: 0, False: 4.15M]
  |  Branch (730:13): [True: 4.15M, False: 0]
  ------------------
  731|  4.15M|            assert(pos4 < ipIndex);
  ------------------
  |  Branch (731:13): [True: 0, False: 4.15M]
  |  Branch (731:13): [True: 4.15M, False: 0]
  ------------------
  732|  4.15M|            LZ4MID_addPosition(hash4Table, h4, ipIndex);
  733|  4.15M|            if (ipIndex - pos4 <= LZ4_DISTANCE_MAX) {
  ------------------
  |  |  678|  4.15M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (733:17): [True: 2.34M, False: 1.81M]
  ------------------
  734|       |                /* match candidate found */
  735|  2.34M|                if (pos4 >= prefixIdx) {
  ------------------
  |  Branch (735:21): [True: 2.34M, False: 0]
  ------------------
  736|       |                /* only search within prefix */
  737|  2.34M|                    const BYTE* const matchPtr = prefixPtr + (pos4 - prefixIdx);
  738|  2.34M|                    assert(matchPtr < ip);
  ------------------
  |  Branch (738:21): [True: 0, False: 2.34M]
  |  Branch (738:21): [True: 2.34M, False: 0]
  ------------------
  739|  2.34M|                    assert(matchPtr >= prefixPtr);
  ------------------
  |  Branch (739:21): [True: 0, False: 2.34M]
  |  Branch (739:21): [True: 2.34M, False: 0]
  ------------------
  740|  2.34M|                    matchLength = LZ4_count(ip, matchPtr, matchlimit);
  741|  2.34M|                    if (matchLength >= MINMATCH) {
  ------------------
  |  |  243|  2.34M|#define MINMATCH 4
  ------------------
  |  Branch (741:25): [True: 164k, False: 2.18M]
  ------------------
  742|       |                        /* short match found, let's just check ip+1 for longer */
  743|   164k|                        U32 const h8 = LZ4MID_hash8Ptr(ip+1);
  744|   164k|                        U32 const pos8 = hash8Table[h8];
  745|   164k|                        U32 const m2Distance = ipIndex + 1 - pos8;
  746|   164k|                        matchDistance = ipIndex - pos4;
  747|   164k|                        if ( m2Distance <= LZ4_DISTANCE_MAX
  ------------------
  |  |  678|   328k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (747:30): [True: 116k, False: 47.8k]
  ------------------
  748|   116k|                        && pos8 >= prefixIdx /* only search within prefix */
  ------------------
  |  Branch (748:28): [True: 116k, False: 0]
  ------------------
  749|   116k|                        && likely(ip < mflimit)
  ------------------
  |  |  178|   116k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|   116k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 116k, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  750|   164k|                        ) {
  751|   116k|                            const BYTE* const m2Ptr = prefixPtr + (pos8 - prefixIdx);
  752|   116k|                            unsigned ml2 = LZ4_count(ip+1, m2Ptr, matchlimit);
  753|   116k|                            if (ml2 > matchLength) {
  ------------------
  |  Branch (753:33): [True: 46.8k, False: 69.4k]
  ------------------
  754|  46.8k|                                LZ4MID_addPosition(hash8Table, h8, ipIndex+1);
  755|  46.8k|                                ip++;
  756|  46.8k|                                matchLength = ml2;
  757|  46.8k|                                matchDistance = m2Distance;
  758|  46.8k|                        }   }
  759|   164k|                        goto _lz4mid_encode_sequence;
  760|   164k|                    }
  761|  2.34M|                } else {
  762|      0|                    if (pos4 >= dictIdx) {
  ------------------
  |  Branch (762:25): [True: 0, False: 0]
  ------------------
  763|       |                        /* extDict match candidate */
  764|      0|                        const BYTE* const matchPtr = dictStart + (pos4 - dictIdx);
  765|      0|                        const size_t safeLen = MIN(prefixIdx - pos4, (size_t)(matchlimit - ip));
  ------------------
  |  |   81|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (81:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  766|      0|                        matchLength = LZ4_count(ip, matchPtr, ip + safeLen);
  767|      0|                        if (matchLength >= MINMATCH) {
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
  |  Branch (767:29): [True: 0, False: 0]
  ------------------
  768|      0|                            DEBUGLOG(7, "found match at ExtDict pos %u (len=%u)", pos4, matchLength);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  769|      0|                            matchDistance = ipIndex - pos4;
  770|      0|                            goto _lz4mid_encode_sequence;
  771|      0|                        }
  772|      0|                    }
  773|      0|                }
  774|  2.34M|        }   }
  775|       |        /* no match found in prefix */
  776|  3.99M|        if ( (dict == usingDictCtxHc)
  ------------------
  |  Branch (776:14): [True: 0, False: 3.99M]
  ------------------
  777|      0|          && (ipIndex - gDictEndIndex < LZ4_DISTANCE_MAX - 8) ) {
  ------------------
  |  |  678|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (777:14): [True: 0, False: 0]
  ------------------
  778|       |            /* search a match into external dictionary */
  779|      0|            LZ4HC_match_t dMatch = searchIntoDict(ip, ipIndex,
  780|      0|                    matchlimit,
  781|      0|                    ctx->dictCtx, gDictEndIndex);
  782|      0|            if (dMatch.len >= MINMATCH) {
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
  |  Branch (782:17): [True: 0, False: 0]
  ------------------
  783|      0|                DEBUGLOG(7, "found Dictionary match (offset=%i)", dMatch.off);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  784|      0|                assert(dMatch.back == 0);
  ------------------
  |  Branch (784:17): [True: 0, False: 0]
  |  Branch (784:17): [True: 0, False: 0]
  ------------------
  785|      0|                matchLength = (unsigned)dMatch.len;
  786|      0|                matchDistance = (unsigned)dMatch.off;
  787|      0|                goto _lz4mid_encode_sequence;
  788|      0|            }
  789|      0|        }
  790|       |        /* no match found */
  791|  3.99M|        ip += 1 + ((ip-anchor) >> 9);  /* skip faster over incompressible data */
  792|  3.99M|        continue;
  793|       |
  794|   876k|_lz4mid_encode_sequence:
  795|       |        /* catch back */
  796|   990k|        while (((ip > anchor) & ((U32)(ip-prefixPtr) > matchDistance)) && (unlikely(ip[-1] == ip[-(int)matchDistance-1]))) {
  ------------------
  |  |  181|   324k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   324k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (796:16): [True: 324k, False: 666k]
  |  Branch (796:75): [True: 114k, False: 210k]
  ------------------
  797|   114k|            ip--;  matchLength++;
  798|   114k|        };
  799|       |
  800|       |        /* fill table with beginning of match */
  801|   876k|        ADDPOS8(ip+1, ipIndex+1);
  ------------------
  |  |  602|   876k|#define ADDPOS8(_p, _idx) LZ4MID_addPosition(hash8Table, LZ4MID_hash8Ptr(_p), _idx)
  ------------------
  802|   876k|        ADDPOS8(ip+2, ipIndex+2);
  ------------------
  |  |  602|   876k|#define ADDPOS8(_p, _idx) LZ4MID_addPosition(hash8Table, LZ4MID_hash8Ptr(_p), _idx)
  ------------------
  803|   876k|        ADDPOS4(ip+1, ipIndex+1);
  ------------------
  |  |  603|   876k|#define ADDPOS4(_p, _idx) LZ4MID_addPosition(hash4Table, LZ4MID_hash4Ptr(_p), _idx)
  ------------------
  804|       |
  805|       |        /* encode */
  806|   876k|        if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  231|   876k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (806:13): [True: 791, False: 875k]
  ------------------
  807|   876k|                (int)matchLength, (int)matchDistance,
  808|   876k|                limit, oend) )
  809|    791|            goto _lz4mid_dest_overflow;
  810|       |
  811|       |        /* fill table with end of match */
  812|   875k|        {   U32 endMatchIdx = (U32)(ip-prefixPtr) + prefixIdx;
  813|   875k|            U32 pos_m2 = endMatchIdx - 2;
  814|   875k|            if (pos_m2 < ilimitIdx) {
  ------------------
  |  Branch (814:17): [True: 875k, False: 453]
  ------------------
  815|   875k|                if (likely(ip - prefixPtr > 5)) {
  ------------------
  |  |  178|   875k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|   875k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 875k, False: 144]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  816|   875k|                    ADDPOS8(ip-5, endMatchIdx - 5);
  ------------------
  |  |  602|   875k|#define ADDPOS8(_p, _idx) LZ4MID_addPosition(hash8Table, LZ4MID_hash8Ptr(_p), _idx)
  ------------------
  817|   875k|                }
  818|   875k|                ADDPOS8(ip-3, endMatchIdx - 3);
  ------------------
  |  |  602|   875k|#define ADDPOS8(_p, _idx) LZ4MID_addPosition(hash8Table, LZ4MID_hash8Ptr(_p), _idx)
  ------------------
  819|   875k|                ADDPOS8(ip-2, endMatchIdx - 2);
  ------------------
  |  |  602|   875k|#define ADDPOS8(_p, _idx) LZ4MID_addPosition(hash8Table, LZ4MID_hash8Ptr(_p), _idx)
  ------------------
  820|   875k|                ADDPOS4(ip-2, endMatchIdx - 2);
  ------------------
  |  |  603|   875k|#define ADDPOS4(_p, _idx) LZ4MID_addPosition(hash4Table, LZ4MID_hash4Ptr(_p), _idx)
  ------------------
  821|   875k|                ADDPOS4(ip-1, endMatchIdx - 1);
  ------------------
  |  |  603|   875k|#define ADDPOS4(_p, _idx) LZ4MID_addPosition(hash4Table, LZ4MID_hash4Ptr(_p), _idx)
  ------------------
  822|   875k|            }
  823|   875k|        }
  824|   875k|    }
  825|       |
  826|  1.79k|_lz4mid_last_literals:
  827|  1.79k|    if (LZ4HC_encodeLastLiterals(UPDATABLE(ip, op, anchor), iend, limit, oend))
  ------------------
  |  |  231|  1.79k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (827:9): [True: 187, False: 1.60k]
  ------------------
  828|    187|        return 0;  /* not enough space in @dst */
  829|       |
  830|       |    /* End */
  831|  1.60k|    DEBUGLOG(5, "compressed %i bytes into %i bytes", *srcSizePtr, (int)((char*)op - dst));
  ------------------
  |  |  290|  1.60k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  832|  1.60k|    assert(ip >= (const BYTE*)src);
  ------------------
  |  Branch (832:5): [True: 0, False: 1.60k]
  |  Branch (832:5): [True: 1.60k, False: 0]
  ------------------
  833|  1.60k|    assert(ip <= iend);
  ------------------
  |  Branch (833:5): [True: 0, False: 1.60k]
  |  Branch (833:5): [True: 1.60k, False: 0]
  ------------------
  834|  1.60k|    *srcSizePtr = (int)(ip - (const BYTE*)src);
  835|  1.60k|    assert((char*)op >= dst);
  ------------------
  |  Branch (835:5): [True: 0, False: 1.60k]
  |  Branch (835:5): [True: 1.60k, False: 0]
  ------------------
  836|  1.60k|    assert((char*)op - dst <= maxOutputSize);
  ------------------
  |  Branch (836:5): [True: 0, False: 1.60k]
  |  Branch (836:5): [True: 1.60k, False: 0]
  ------------------
  837|  1.60k|    assert((char*)op - dst < INT_MAX);
  ------------------
  |  Branch (837:5): [True: 0, False: 1.60k]
  |  Branch (837:5): [True: 1.60k, False: 0]
  ------------------
  838|  1.60k|    return (int)((char*)op - dst);
  839|       |
  840|    791|_lz4mid_dest_overflow:
  841|    791|    if (limit != fillOutput) return 0;  /* compression failed */
  ------------------
  |  Branch (841:9): [True: 322, False: 469]
  ------------------
  842|    469|    LZ4HC_encodeLastSequence_fillOutput(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  231|    469|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  843|    469|                        (int)matchLength, (int)matchDistance, oend);
  844|    469|    goto _lz4mid_last_literals;
  845|    791|}
lz4hc.c:LZ4HC_hashPtr:
  123|   366M|static U32 LZ4HC_hashPtr(const void* ptr) { return HASH_FUNCTION(LZ4_read32(ptr)); }
  ------------------
  |  |  122|   366M|#define HASH_FUNCTION(i)      (((i) * 2654435761U) >> ((MINMATCH*8)-LZ4HC_HASH_LOG))
  |  |  ------------------
  |  |  |  |  243|   366M|#define MINMATCH 4
  |  |  ------------------
  |  |               #define HASH_FUNCTION(i)      (((i) * 2654435761U) >> ((MINMATCH*8)-LZ4HC_HASH_LOG))
  |  |  ------------------
  |  |  |  |  233|   366M|#define LZ4HC_HASH_LOG 15
  |  |  ------------------
  ------------------
lz4hc.c:LZ4HC_countBack:
  208|  46.9M|{
  209|  46.9M|    int back = 0;
  210|  46.9M|    int const min = (int)MAX(iMin - ip, mMin - match);
  ------------------
  |  |   82|  46.9M|#define MAX(a,b)   ( (a) > (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (82:22): [True: 46.8M, False: 64.0k]
  |  |  ------------------
  ------------------
  211|  46.9M|    assert(min <= 0);
  ------------------
  |  Branch (211:5): [True: 0, False: 46.9M]
  |  Branch (211:5): [True: 46.9M, False: 0]
  ------------------
  212|  46.9M|    assert(ip >= iMin); assert((size_t)(ip-iMin) < (1U<<31));
  ------------------
  |  Branch (212:5): [True: 0, False: 46.9M]
  |  Branch (212:5): [True: 46.9M, False: 0]
  |  Branch (212:25): [True: 0, False: 46.9M]
  |  Branch (212:25): [True: 46.9M, False: 0]
  ------------------
  213|  46.9M|    assert(match >= mMin); assert((size_t)(match - mMin) < (1U<<31));
  ------------------
  |  Branch (213:5): [True: 0, False: 46.9M]
  |  Branch (213:5): [True: 46.9M, False: 0]
  |  Branch (213:28): [True: 0, False: 46.9M]
  |  Branch (213:28): [True: 46.9M, False: 0]
  ------------------
  214|       |
  215|   113M|    while ((back - min) > 3) {
  ------------------
  |  Branch (215:12): [True: 110M, False: 2.81M]
  ------------------
  216|   110M|        U32 const v = LZ4_read32(ip + back - 4) ^ LZ4_read32(match + back - 4);
  217|   110M|        if (v) {
  ------------------
  |  Branch (217:13): [True: 44.1M, False: 66.0M]
  ------------------
  218|  44.1M|            return (back - (int)LZ4HC_NbCommonBytes32(v));
  219|  66.0M|        } else back -= 4; /* 4-byte step */
  220|   110M|    }
  221|       |    /* check remainder if any */
  222|  4.92M|    while ( (back > min)
  ------------------
  |  Branch (222:13): [True: 4.58M, False: 334k]
  ------------------
  223|  4.58M|         && (ip[back-1] == match[back-1]) )
  ------------------
  |  Branch (223:13): [True: 2.10M, False: 2.47M]
  ------------------
  224|  2.10M|            back--;
  225|  2.81M|    return back;
  226|  46.9M|}
lz4hc.c:LZ4HC_NbCommonBytes32:
  170|  44.1M|{
  171|  44.1M|    assert(val != 0);
  ------------------
  |  Branch (171:5): [True: 0, False: 44.1M]
  |  Branch (171:5): [True: 44.1M, False: 0]
  ------------------
  172|  44.1M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (172:9): [True: 44.1M, False: 0]
  ------------------
  173|       |#     if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT)
  174|       |        unsigned long r;
  175|       |        _BitScanReverse(&r, val);
  176|       |        return (unsigned)((31 - r) >> 3);
  177|       |#     elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  178|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  179|       |                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  180|       |        return (unsigned)__builtin_clz(val) >> 3;
  181|       |#     else
  182|       |        val >>= 8;
  183|       |        val = ((((val + 0x00FFFF00) | 0x00FFFFFF) + val) |
  184|       |              (val + 0x00FF0000)) >> 24;
  185|       |        return (unsigned)val ^ 3;
  186|       |#     endif
  187|  44.1M|    } else {
  188|       |#     if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT)
  189|       |        unsigned long r;
  190|       |        _BitScanForward(&r, val);
  191|       |        return (unsigned)(r >> 3);
  192|       |#     elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  193|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  194|       |                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  195|       |        return (unsigned)__builtin_ctz(val) >> 3;
  196|       |#     else
  197|       |        const U32 m = 0x01010101;
  198|       |        return (unsigned)((((val - 1) ^ val) & (m - 1)) * m) >> 24;
  199|       |#     endif
  200|      0|    }
  201|  44.1M|}
lz4hc.c:LZ4MID_hash8Ptr:
  152|  9.41M|static U32 LZ4MID_hash8Ptr(const void* ptr) { return LZ4MID_hash7(LZ4_readLE64(ptr)); }
lz4hc.c:LZ4MID_hash7:
  150|  9.41M|static U32 LZ4MID_hash7(U64 v) { return (U32)(((v  << (64-56)) * 58295818150454627ULL) >> (64-LZ4MID_HASHLOG)) ; }
  ------------------
  |  |  143|  9.41M|#define LZ4MID_HASHLOG (LZ4HC_HASH_LOG-1)
  |  |  ------------------
  |  |  |  |  233|  9.41M|#define LZ4HC_HASH_LOG 15
  |  |  ------------------
  ------------------
lz4hc.c:LZ4_readLE64:
  155|  9.41M|{
  156|  9.41M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (156:9): [True: 9.41M, False: 0]
  ------------------
  157|  9.41M|        return LZ4_read64(memPtr);
  158|  9.41M|    } else {
  159|      0|        const BYTE* p = (const BYTE*)memPtr;
  160|       |        /* note: relies on the compiler to simplify this expression */
  161|      0|        return (U64)p[0] | ((U64)p[1]<<8) | ((U64)p[2]<<16) | ((U64)p[3]<<24)
  162|      0|            | ((U64)p[4]<<32) | ((U64)p[5]<<40) | ((U64)p[6]<<48) | ((U64)p[7]<<56);
  163|      0|    }
  164|  9.41M|}
lz4hc.c:LZ4_read64:
  132|  9.41M|static U64 LZ4_read64(const void* ptr) { return ((const LZ4_unalign64*)ptr)->u64; }
lz4hc.c:LZ4MID_addPosition:
  598|  16.0M|{
  599|  16.0M|    hTable[hValue] = index;
  600|  16.0M|}
lz4hc.c:LZ4MID_hash4Ptr:
  147|  6.78M|static U32 LZ4MID_hash4Ptr(const void* ptr) { return LZ4MID_hash4(LZ4_read32(ptr)); }
lz4hc.c:LZ4MID_hash4:
  146|  6.78M|static U32 LZ4MID_hash4(U32 v) { return (v * 2654435761U) >> (32-LZ4MID_HASHLOG); }
  ------------------
  |  |  143|  6.78M|#define LZ4MID_HASHLOG (LZ4HC_HASH_LOG-1)
  |  |  ------------------
  |  |  |  |  233|  6.78M|#define LZ4HC_HASH_LOG 15
  |  |  ------------------
  ------------------
lz4hc.c:LZ4HC_encodeSequence:
  301|  2.66M|{
  302|  2.66M|#define ip      (*_ip)
  303|  2.66M|#define op      (*_op)
  304|  2.66M|#define anchor  (*_anchor)
  305|       |
  306|  2.66M|    BYTE* const token = op++;
  ------------------
  |  |  303|  2.66M|#define op      (*_op)
  ------------------
  307|       |
  308|       |#if defined(LZ4_DEBUG) && (LZ4_DEBUG >= 6)
  309|       |    static const BYTE* start = NULL;
  310|       |    static U32 totalCost = 0;
  311|       |    U32 const pos = (start==NULL) ? 0 : (U32)(anchor - start); /* only works for single segment */
  312|       |    U32 const ll = (U32)(ip - anchor);
  313|       |    U32 const llAdd = (ll>=15) ? ((ll-15) / 255) + 1 : 0;
  314|       |    U32 const mlAdd = (matchLength>=19) ? ((matchLength-19) / 255) + 1 : 0;
  315|       |    U32 const cost = 1 + llAdd + ll + 2 + mlAdd;
  316|       |    if (start==NULL) start = anchor;  /* only works for single segment */
  317|       |    DEBUGLOG(6, "pos:%7u -- literals:%4u, match:%4i, offset:%5i, cost:%4u + %5u",
  318|       |                pos,
  319|       |                (U32)(ip - anchor), matchLength, offset,
  320|       |                cost, totalCost);
  321|       |# if 1 /* only works on single segment data */
  322|       |    HEX_CMP(7, ip, ip-offset, matchLength);
  323|       |# endif
  324|       |    totalCost += cost;
  325|       |#endif
  326|       |
  327|       |    /* Encode Literal length */
  328|  2.66M|    {   size_t litLen = (size_t)(ip - anchor);
  ------------------
  |  |  302|  2.66M|#define ip      (*_ip)
  ------------------
                  {   size_t litLen = (size_t)(ip - anchor);
  ------------------
  |  |  304|  2.66M|#define anchor  (*_anchor)
  ------------------
  329|  2.66M|        LZ4_STATIC_ASSERT(notLimited == 0);
  ------------------
  |  |  278|  2.66M|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
  330|       |        /* Check output limit */
  331|  2.66M|        if (limit && ((op + (litLen / 255) + litLen + (2 + 1 + LASTLITERALS)) > oend)) {
  ------------------
  |  |  303|  2.66M|#define op      (*_op)
  ------------------
                      if (limit && ((op + (litLen / 255) + litLen + (2 + 1 + LASTLITERALS)) > oend)) {
  ------------------
  |  |  246|  2.66M|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (331:13): [True: 2.66M, False: 1.58k]
  |  Branch (331:22): [True: 5.51k, False: 2.65M]
  ------------------
  332|  5.51k|            DEBUGLOG(6, "Not enough room to write %i literals (%i bytes remaining)",
  ------------------
  |  |  290|  5.51k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  333|  5.51k|                    (int)litLen, (int)(oend - op));
  334|  5.51k|            op = token;
  ------------------
  |  |  303|  5.51k|#define op      (*_op)
  ------------------
  335|  5.51k|            return 1;
  336|  5.51k|        }
  337|  2.65M|        if (litLen >= RUN_MASK) {
  ------------------
  |  |  264|  2.65M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  2.65M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  2.65M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (337:13): [True: 85.3k, False: 2.57M]
  ------------------
  338|  85.3k|            size_t len = litLen - RUN_MASK;
  ------------------
  |  |  264|  85.3k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  85.3k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  85.3k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  339|  85.3k|            *token = (RUN_MASK << ML_BITS);
  ------------------
  |  |  264|  85.3k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  85.3k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  85.3k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          *token = (RUN_MASK << ML_BITS);
  ------------------
  |  |  261|  85.3k|#define ML_BITS  4
  ------------------
  340|   213k|            for(; len >= 255 ; len -= 255) *op++ = 255;
  ------------------
  |  |  303|   127k|#define op      (*_op)
  ------------------
  |  Branch (340:19): [True: 127k, False: 85.3k]
  ------------------
  341|  85.3k|            *op++ = (BYTE)len;
  ------------------
  |  |  303|  85.3k|#define op      (*_op)
  ------------------
  342|  2.57M|        } else {
  343|  2.57M|            *token = (BYTE)(litLen << ML_BITS);
  ------------------
  |  |  261|  2.57M|#define ML_BITS  4
  ------------------
  344|  2.57M|        }
  345|       |
  346|       |        /* Copy Literals */
  347|  2.65M|        LZ4_wildCopy8(op, anchor, op + litLen);
  ------------------
  |  |  303|  2.65M|#define op      (*_op)
  ------------------
                      LZ4_wildCopy8(op, anchor, op + litLen);
  ------------------
  |  |  304|  2.65M|#define anchor  (*_anchor)
  ------------------
                      LZ4_wildCopy8(op, anchor, op + litLen);
  ------------------
  |  |  303|  2.65M|#define op      (*_op)
  ------------------
  348|  2.65M|        op += litLen;
  ------------------
  |  |  303|  2.65M|#define op      (*_op)
  ------------------
  349|  2.65M|    }
  350|       |
  351|       |    /* Encode Offset */
  352|  2.65M|    assert(offset <= LZ4_DISTANCE_MAX );
  ------------------
  |  Branch (352:5): [True: 0, False: 2.65M]
  |  Branch (352:5): [True: 2.65M, False: 0]
  ------------------
  353|  2.65M|    assert(offset > 0);
  ------------------
  |  Branch (353:5): [True: 0, False: 2.65M]
  |  Branch (353:5): [True: 2.65M, False: 0]
  ------------------
  354|  2.65M|    LZ4_writeLE16(op, (U16)(offset)); op += 2;
  ------------------
  |  |  303|  2.65M|#define op      (*_op)
  ------------------
                  LZ4_writeLE16(op, (U16)(offset)); op += 2;
  ------------------
  |  |  303|  2.65M|#define op      (*_op)
  ------------------
  355|       |
  356|       |    /* Encode MatchLength */
  357|  2.65M|    assert(matchLength >= MINMATCH);
  ------------------
  |  Branch (357:5): [True: 0, False: 2.65M]
  |  Branch (357:5): [True: 2.65M, False: 0]
  ------------------
  358|  2.65M|    {   size_t mlCode = (size_t)matchLength - MINMATCH;
  ------------------
  |  |  243|  2.65M|#define MINMATCH 4
  ------------------
  359|  2.65M|        if (limit && (op + (mlCode / 255) + (1 + LASTLITERALS) > oend)) {
  ------------------
  |  |  303|  2.65M|#define op      (*_op)
  ------------------
                      if (limit && (op + (mlCode / 255) + (1 + LASTLITERALS) > oend)) {
  ------------------
  |  |  246|  2.65M|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (359:13): [True: 2.65M, False: 1.58k]
  |  Branch (359:22): [True: 194, False: 2.65M]
  ------------------
  360|    194|            DEBUGLOG(6, "Not enough room to write match length");
  ------------------
  |  |  290|    194|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  361|    194|            op = token;
  ------------------
  |  |  303|    194|#define op      (*_op)
  ------------------
  362|    194|            return 1;
  363|    194|        }
  364|  2.65M|        if (mlCode >= ML_MASK) {
  ------------------
  |  |  262|  2.65M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  2.65M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (364:13): [True: 604k, False: 2.05M]
  ------------------
  365|   604k|            *token += ML_MASK;
  ------------------
  |  |  262|   604k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   604k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  366|   604k|            mlCode -= ML_MASK;
  ------------------
  |  |  262|   604k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   604k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  367|   986k|            for(; mlCode >= 510 ; mlCode -= 510) { *op++ = 255; *op++ = 255; }
  ------------------
  |  |  303|   381k|#define op      (*_op)
  ------------------
                          for(; mlCode >= 510 ; mlCode -= 510) { *op++ = 255; *op++ = 255; }
  ------------------
  |  |  303|   381k|#define op      (*_op)
  ------------------
  |  Branch (367:19): [True: 381k, False: 604k]
  ------------------
  368|   604k|            if (mlCode >= 255) { mlCode -= 255; *op++ = 255; }
  ------------------
  |  |  303|  37.3k|#define op      (*_op)
  ------------------
  |  Branch (368:17): [True: 37.3k, False: 567k]
  ------------------
  369|   604k|            *op++ = (BYTE)mlCode;
  ------------------
  |  |  303|   604k|#define op      (*_op)
  ------------------
  370|  2.05M|        } else {
  371|  2.05M|            *token += (BYTE)(mlCode);
  372|  2.05M|    }   }
  373|       |
  374|       |    /* Prepare next loop */
  375|  2.65M|    ip += matchLength;
  ------------------
  |  |  302|  2.65M|#define ip      (*_ip)
  ------------------
  376|  2.65M|    anchor = ip;
  ------------------
  |  |  304|  2.65M|#define anchor  (*_anchor)
  ------------------
                  anchor = ip;
  ------------------
  |  |  302|  2.65M|#define ip      (*_ip)
  ------------------
  377|       |
  378|  2.65M|    return 0;
  379|       |
  380|  2.65M|#undef ip
  381|  2.65M|#undef op
  382|  2.65M|#undef anchor
  383|  2.65M|}
lz4hc.c:LZ4HC_encodeLastLiterals:
  398|  11.7k|{
  399|  11.7k|#define ip      (*_ip)
  400|  11.7k|#define op      (*_op)
  401|  11.7k|#define anchor  (*_anchor)
  402|       |
  403|  11.7k|    BYTE* const dstEnd = (limit == fillOutput) ? oend + LASTLITERALS : oend;
  ------------------
  |  |  246|  7.04k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (403:26): [True: 7.04k, False: 4.66k]
  ------------------
  404|  11.7k|    size_t lastRunSize = (size_t)(iend - anchor);  /* literals */
  ------------------
  |  |  401|  11.7k|#define anchor  (*_anchor)
  ------------------
  405|  11.7k|    size_t llAdd = (lastRunSize + 255 - RUN_MASK) / 255;
  ------------------
  |  |  264|  11.7k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  11.7k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  11.7k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  406|  11.7k|    size_t const totalSize = 1 + llAdd + lastRunSize;
  407|  11.7k|    if (limit && (op + totalSize > dstEnd)) {
  ------------------
  |  |  400|  11.7k|#define op      (*_op)
  ------------------
  |  Branch (407:9): [True: 11.7k, False: 0]
  |  Branch (407:18): [True: 4.26k, False: 7.44k]
  ------------------
  408|  4.26k|        if (limit == limitedOutput) return 1;  /* not enough space in dst */
  ------------------
  |  Branch (408:13): [True: 915, False: 3.34k]
  ------------------
  409|       |        /* adapt lastRunSize to fill dst */
  410|  3.34k|        lastRunSize  = (size_t)(dstEnd - op) - 1 /*token*/;
  ------------------
  |  |  400|  3.34k|#define op      (*_op)
  ------------------
  411|  3.34k|        llAdd = (lastRunSize + 256 - RUN_MASK) / 256;
  ------------------
  |  |  264|  3.34k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  3.34k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  3.34k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  412|  3.34k|        lastRunSize -= llAdd;
  413|  3.34k|    }
  414|  10.7k|    DEBUGLOG(6, "Final literal run : %i literals", (int)lastRunSize);
  ------------------
  |  |  290|  10.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  415|  10.7k|    ip = anchor + lastRunSize;  /* can be != iend if limit==fillOutput */
  ------------------
  |  |  399|  10.7k|#define ip      (*_ip)
  ------------------
                  ip = anchor + lastRunSize;  /* can be != iend if limit==fillOutput */
  ------------------
  |  |  401|  10.7k|#define anchor  (*_anchor)
  ------------------
  416|       |
  417|  10.7k|    if (lastRunSize >= RUN_MASK) {
  ------------------
  |  |  264|  10.7k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  10.7k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  10.7k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (417:9): [True: 882, False: 9.91k]
  ------------------
  418|    882|        size_t accumulator = lastRunSize - RUN_MASK;
  ------------------
  |  |  264|    882|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    882|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    882|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  419|    882|        *op++ = (RUN_MASK << ML_BITS);
  ------------------
  |  |  400|    882|#define op      (*_op)
  ------------------
                      *op++ = (RUN_MASK << ML_BITS);
  ------------------
  |  |  264|    882|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    882|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    882|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      *op++ = (RUN_MASK << ML_BITS);
  ------------------
  |  |  261|    882|#define ML_BITS  4
  ------------------
  420|  81.0k|        for(; accumulator >= 255 ; accumulator -= 255) *op++ = 255;
  ------------------
  |  |  400|  80.1k|#define op      (*_op)
  ------------------
  |  Branch (420:15): [True: 80.1k, False: 882]
  ------------------
  421|    882|        *op++ = (BYTE) accumulator;
  ------------------
  |  |  400|    882|#define op      (*_op)
  ------------------
  422|  9.91k|    } else {
  423|  9.91k|        *op++ = (BYTE)(lastRunSize << ML_BITS);
  ------------------
  |  |  400|  9.91k|#define op      (*_op)
  ------------------
                      *op++ = (BYTE)(lastRunSize << ML_BITS);
  ------------------
  |  |  261|  9.91k|#define ML_BITS  4
  ------------------
  424|  9.91k|    }
  425|  10.7k|    assert(lastRunSize <= (size_t)(dstEnd - op));
  ------------------
  |  Branch (425:5): [True: 0, False: 10.7k]
  |  Branch (425:5): [True: 10.7k, False: 0]
  ------------------
  426|  10.7k|    LZ4_memcpy(op, anchor, lastRunSize);
  ------------------
  |  |  350|  10.7k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  427|  10.7k|    op += lastRunSize;
  ------------------
  |  |  400|  10.7k|#define op      (*_op)
  ------------------
  428|  10.7k|    return 0;
  429|       |
  430|  10.7k|#undef ip
  431|  10.7k|#undef op
  432|  10.7k|#undef anchor
  433|  10.7k|}
lz4hc.c:LZ4HC_encodeLastSequence_fillOutput:
  448|  3.31k|{
  449|  3.31k|#define ip      (*_ip)
  450|  3.31k|#define op      (*_op)
  451|  3.31k|#define anchor  (*_anchor)
  452|       |
  453|  3.31k|    BYTE* const dstEnd = oend + LASTLITERALS;
  ------------------
  |  |  246|  3.31k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  454|  3.31k|    size_t const ll = (size_t)(ip - anchor);
  ------------------
  |  |  449|  3.31k|#define ip      (*_ip)
  ------------------
                  size_t const ll = (size_t)(ip - anchor);
  ------------------
  |  |  451|  3.31k|#define anchor  (*_anchor)
  ------------------
  455|  3.31k|    size_t const ll_addbytes = (ll + 240) / 255;
  456|  3.31k|    size_t const ll_totalCost = 1 + ll_addbytes + ll;
  457|  3.31k|    BYTE* const maxLitPos = oend - 3; /* 2 for offset, 1 for token */
  458|  3.31k|    DEBUGLOG(6, "Last sequence is overflowing : %u literals, %u remaining space",
  ------------------
  |  |  290|  3.31k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  459|  3.31k|                (unsigned)ll, (unsigned)(oend - op));
  460|  3.31k|    if (op + ll_totalCost <= maxLitPos) {
  ------------------
  |  |  450|  3.31k|#define op      (*_op)
  ------------------
  |  Branch (460:9): [True: 1.98k, False: 1.33k]
  ------------------
  461|       |        /* ll validated; now adjust match length */
  462|  1.98k|        size_t const bytesLeftForMl = (size_t)(maxLitPos - (op+ll_totalCost));
  ------------------
  |  |  450|  1.98k|#define op      (*_op)
  ------------------
  463|  1.98k|        size_t const maxMlSize = MINMATCH + (ML_MASK-1) + (bytesLeftForMl * 255);
  ------------------
  |  |  243|  1.98k|#define MINMATCH 4
  ------------------
                      size_t const maxMlSize = MINMATCH + (ML_MASK-1) + (bytesLeftForMl * 255);
  ------------------
  |  |  262|  1.98k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.98k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  464|  1.98k|        assert(maxMlSize < INT_MAX); assert(matchLength >= 0);
  ------------------
  |  Branch (464:9): [True: 0, False: 1.98k]
  |  Branch (464:9): [True: 1.98k, False: 0]
  |  Branch (464:38): [True: 0, False: 1.98k]
  |  Branch (464:38): [True: 1.98k, False: 0]
  ------------------
  465|  1.98k|        if ((size_t)matchLength > maxMlSize) matchLength = (int)maxMlSize;
  ------------------
  |  Branch (465:13): [True: 86, False: 1.90k]
  ------------------
  466|  1.98k|        if (dstEnd - (op + ll_totalCost + 2) - 1 + matchLength >= MFLIMIT) {
  ------------------
  |  |  450|  1.98k|#define op      (*_op)
  ------------------
                      if (dstEnd - (op + ll_totalCost + 2) - 1 + matchLength >= MFLIMIT) {
  ------------------
  |  |  247|  1.98k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (466:13): [True: 1.58k, False: 406]
  ------------------
  467|  1.58k|            DEBUGLOG(6, "Let's encode a last sequence (ll=%u, ml=%i)", (unsigned)ll, matchLength);
  ------------------
  |  |  290|  1.58k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  468|  1.58k|            LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), matchLength, offset, notLimited, oend);
  ------------------
  |  |  231|  1.58k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  469|  1.58k|    }   }
  470|       |
  471|  3.31k|#undef ip
  472|  3.31k|#undef op
  473|  3.31k|#undef anchor
  474|  3.31k|}
lz4hc.c:LZ4HC_compress_hashChain:
 1265|  6.50k|{
 1266|  6.50k|    const int inputSize = *srcSizePtr;
 1267|  6.50k|    const int patternAnalysis = (maxNbAttempts > 128);   /* levels 9+ */
 1268|       |
 1269|  6.50k|    const BYTE* ip = (const BYTE*)src;
 1270|  6.50k|    const BYTE* anchor = ip;
 1271|  6.50k|    const BYTE* const iend = ip + inputSize;
 1272|  6.50k|    const BYTE* const mflimit = iend - MFLIMIT;
  ------------------
  |  |  247|  6.50k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1273|  6.50k|    const BYTE* const matchlimit = (iend - LASTLITERALS);
  ------------------
  |  |  246|  6.50k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1274|       |
 1275|  6.50k|    BYTE* op = (BYTE*) dst;
 1276|       |    /* fillOutput : keep room for the final run of literals (LZ4 format restriction) */
 1277|  6.50k|    BYTE* const oend = op + maxOutputSize - ((limit == fillOutput) ? LASTLITERALS : 0);
  ------------------
  |  |  246|  3.25k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (1277:46): [True: 3.25k, False: 3.25k]
  ------------------
 1278|       |
 1279|  6.50k|    const BYTE* start0;
 1280|  6.50k|    const BYTE* start2 = NULL;
 1281|  6.50k|    const BYTE* start3 = NULL;
 1282|  6.50k|    LZ4HC_match_t m0, m1, m2, m3;
 1283|  6.50k|    const LZ4HC_match_t nomatch = {0, 0, 0};
 1284|       |
 1285|       |    /* init */
 1286|  6.50k|    DEBUGLOG(5, "LZ4HC_compress_hashChain (dict?=>%i)", dict);
  ------------------
  |  |  290|  6.50k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1287|       |
 1288|       |    /* preconditions verifications */
 1289|  6.50k|    assert(*srcSizePtr >= 1);
  ------------------
  |  Branch (1289:5): [True: 0, False: 6.50k]
  |  Branch (1289:5): [True: 6.50k, False: 0]
  ------------------
 1290|  6.50k|    assert(src != NULL);
  ------------------
  |  Branch (1290:5): [True: 0, False: 6.50k]
  |  Branch (1290:5): [True: 6.50k, False: 0]
  ------------------
 1291|  6.50k|    assert(maxOutputSize >= 1);
  ------------------
  |  Branch (1291:5): [True: 0, False: 6.50k]
  |  Branch (1291:5): [True: 6.50k, False: 0]
  ------------------
 1292|  6.50k|    assert(dst != NULL);
  ------------------
  |  Branch (1292:5): [True: 0, False: 6.50k]
  |  Branch (1292:5): [True: 6.50k, False: 0]
  ------------------
 1293|       |
 1294|  6.50k|    *srcSizePtr = 0;
 1295|  6.50k|    if (inputSize < LZ4_minLength) goto _last_literals;             /* Input too small, no compression (all literals) */
  ------------------
  |  Branch (1295:9): [True: 34, False: 6.47k]
  ------------------
 1296|       |
 1297|       |    /* Main Loop */
 1298|  51.1M|    while (ip <= mflimit) {
  ------------------
  |  Branch (1298:12): [True: 51.1M, False: 3.94k]
  ------------------
 1299|  51.1M|        m1 = LZ4HC_InsertAndFindBestMatch(ctx, ip, matchlimit, maxNbAttempts, patternAnalysis, dict);
 1300|  51.1M|        if (m1.len<MINMATCH) { ip++; continue; }
  ------------------
  |  |  243|  51.1M|#define MINMATCH 4
  ------------------
  |  Branch (1300:13): [True: 50.2M, False: 881k]
  ------------------
 1301|       |
 1302|       |        /* saved, in case we would skip too much */
 1303|   881k|        start0 = ip; m0 = m1;
 1304|       |
 1305|  1.40M|_Search2:
 1306|  1.40M|        DEBUGLOG(7, "_Search2 (currently found match of size %i)", m1.len);
  ------------------
  |  |  290|  1.40M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1307|  1.40M|        if (ip+m1.len <= mflimit) {
  ------------------
  |  Branch (1307:13): [True: 1.40M, False: 3.31k]
  ------------------
 1308|  1.40M|            start2 = ip + m1.len - 2;
 1309|  1.40M|            m2 = LZ4HC_InsertAndGetWiderMatch(ctx,
 1310|  1.40M|                            start2, ip + 0, matchlimit, m1.len,
 1311|  1.40M|                            maxNbAttempts, patternAnalysis, 0, dict, favorCompressionRatio);
 1312|  1.40M|            start2 += m2.back;
 1313|  1.40M|        } else {
 1314|  3.31k|            m2 = nomatch;  /* do not search further */
 1315|  3.31k|        }
 1316|       |
 1317|  1.40M|        if (m2.len <= m1.len) { /* No better match => encode ML1 immediately */
  ------------------
  |  Branch (1317:13): [True: 720k, False: 683k]
  ------------------
 1318|   720k|            if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  231|   720k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1318:17): [True: 1.72k, False: 718k]
  ------------------
 1319|   720k|                    m1.len, m1.off,
 1320|   720k|                    limit, oend) )
 1321|  1.72k|                goto _dest_overflow;
 1322|   718k|            continue;
 1323|   720k|        }
 1324|       |
 1325|   683k|        if (start0 < ip) {   /* first match was skipped at least once */
  ------------------
  |  Branch (1325:13): [True: 135k, False: 548k]
  ------------------
 1326|   135k|            if (start2 < ip + m0.len) {  /* squeezing ML1 between ML0(original ML1) and ML2 */
  ------------------
  |  Branch (1326:17): [True: 86.2k, False: 49.7k]
  ------------------
 1327|  86.2k|                ip = start0; m1 = m0;  /* restore initial Match1 */
 1328|  86.2k|        }   }
 1329|       |
 1330|       |        /* Here, start0==ip */
 1331|   683k|        if ((start2 - ip) < 3) {  /* First Match too small : removed */
  ------------------
  |  Branch (1331:13): [True: 352k, False: 331k]
  ------------------
 1332|   352k|            ip = start2;
 1333|   352k|            m1 = m2;
 1334|   352k|            goto _Search2;
 1335|   352k|        }
 1336|       |
 1337|   450k|_Search3:
 1338|       |        /* m1.len itself is decided when encoding m1 */
 1339|   450k|        if ((start2 - ip) < OPTIMAL_ML)
  ------------------
  |  |   76|   450k|#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  262|   450k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|   450k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  243|   450k|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (1339:13): [True: 421k, False: 28.7k]
  ------------------
 1340|   421k|            (void)LZ4HC_splitOverlap(ip, m1.len, &start2, &m2);
 1341|       |
 1342|   450k|        if (start2 + m2.len <= mflimit) {
  ------------------
  |  Branch (1342:13): [True: 450k, False: 597]
  ------------------
 1343|   450k|            start3 = start2 + m2.len - 3;
 1344|   450k|            m3 = LZ4HC_InsertAndGetWiderMatch(ctx,
 1345|   450k|                            start3, start2, matchlimit, m2.len,
 1346|   450k|                            maxNbAttempts, patternAnalysis, 0, dict, favorCompressionRatio);
 1347|   450k|            start3 += m3.back;
 1348|   450k|        } else {
 1349|    597|            m3 = nomatch;  /* do not search further */
 1350|    597|        }
 1351|       |
 1352|   450k|        if (m3.len <= m2.len) {  /* No better match => encode ML1 and ML2 */
  ------------------
  |  Branch (1352:13): [True: 160k, False: 290k]
  ------------------
 1353|       |            /* ip & ref are known; Now for ml */
 1354|   160k|            if (start2 < ip+m1.len) m1.len = (int)(start2 - ip);
  ------------------
  |  Branch (1354:17): [True: 35.3k, False: 125k]
  ------------------
 1355|       |            /* Now, encode 2 sequences */
 1356|   160k|            if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  231|   160k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1356:17): [True: 315, False: 160k]
  ------------------
 1357|   160k|                    m1.len, m1.off,
 1358|   160k|                    limit, oend) )
 1359|    315|                goto _dest_overflow;
 1360|   160k|            ip = start2;
 1361|   160k|            if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  231|   160k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1361:17): [True: 136, False: 160k]
  ------------------
 1362|   160k|                    m2.len, m2.off,
 1363|   160k|                    limit, oend) ) {
 1364|    136|                m1 = m2;
 1365|    136|                goto _dest_overflow;
 1366|    136|            }
 1367|   160k|            continue;
 1368|   160k|        }
 1369|       |
 1370|   290k|        if (start3 < ip+m1.len+3) {  /* Not enough space for match 2 : remove it */
  ------------------
  |  Branch (1370:13): [True: 181k, False: 109k]
  ------------------
 1371|   181k|            if (start3 >= (ip+m1.len)) {  /* can write Seq1 immediately ==> Seq2 is removed, so Seq3 becomes Seq1 */
  ------------------
  |  Branch (1371:17): [True: 170k, False: 10.3k]
  ------------------
 1372|   170k|                if (start2 < ip+m1.len) {
  ------------------
  |  Branch (1372:21): [True: 8.13k, False: 162k]
  ------------------
 1373|  8.13k|                    int correction = (int)(ip+m1.len - start2);
 1374|  8.13k|                    start2 += correction;
 1375|  8.13k|                    m2.len -= correction;
 1376|  8.13k|                    if (m2.len < MINMATCH) {
  ------------------
  |  |  243|  8.13k|#define MINMATCH 4
  ------------------
  |  Branch (1376:25): [True: 76, False: 8.06k]
  ------------------
 1377|     76|                        start2 = start3;
 1378|     76|                        m2 = m3;
 1379|     76|                    }
 1380|  8.13k|                }
 1381|       |
 1382|   170k|                if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  231|   170k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1382:21): [True: 257, False: 170k]
  ------------------
 1383|   170k|                        m1.len, m1.off,
 1384|   170k|                        limit, oend) )
 1385|    257|                    goto _dest_overflow;
 1386|   170k|                ip  = start3;
 1387|   170k|                m1 = m3;
 1388|       |
 1389|   170k|                start0 = start2;
 1390|   170k|                m0 = m2;
 1391|   170k|                goto _Search2;
 1392|   170k|            }
 1393|       |
 1394|  10.3k|            start2 = start3;
 1395|  10.3k|            m2 = m3;
 1396|  10.3k|            goto _Search3;
 1397|   181k|        }
 1398|       |
 1399|       |        /*
 1400|       |        * OK, now we have 3 ascending matches;
 1401|       |        * let's write the first one ML1.
 1402|       |        * ip & ref are known; Now decide ml.
 1403|       |        */
 1404|   109k|        if (start2 < ip+m1.len) {
  ------------------
  |  Branch (1404:13): [True: 17.0k, False: 92.0k]
  ------------------
 1405|  17.0k|            if ((start2 - ip) < OPTIMAL_ML)
  ------------------
  |  |   76|  17.0k|#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  262|  17.0k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  17.0k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  243|  17.0k|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (1405:17): [True: 0, False: 17.0k]
  ------------------
 1406|      0|                m1.len = LZ4HC_splitOverlap(ip, m1.len, &start2, &m2);
 1407|  17.0k|            else
 1408|  17.0k|                m1.len = (int)(start2 - ip);
 1409|  17.0k|        }
 1410|   109k|        if ( LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  231|   109k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1410:14): [True: 93, False: 108k]
  ------------------
 1411|   109k|                m1.len, m1.off,
 1412|   109k|                limit, oend) )
 1413|     93|            goto _dest_overflow;
 1414|       |
 1415|       |        /* ML2 becomes ML1 */
 1416|   108k|        ip = start2; m1 = m2;
 1417|       |
 1418|       |        /* ML3 becomes ML2 */
 1419|   108k|        start2 = start3; m2 = m3;
 1420|       |
 1421|       |        /* let's find a new ML3 */
 1422|   108k|        goto _Search3;
 1423|   109k|    }
 1424|       |
 1425|  5.43k|_last_literals:
 1426|  5.43k|    if (LZ4HC_encodeLastLiterals(UPDATABLE(ip, op, anchor), iend, limit, oend))
  ------------------
  |  |  231|  5.43k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1426:9): [True: 392, False: 5.04k]
  ------------------
 1427|    392|        return 0;  /* not enough space in @dst */
 1428|       |
 1429|       |    /* End */
 1430|  5.04k|    *srcSizePtr = (int) (((const char*)ip) - src);
 1431|  5.04k|    return (int) (((char*)op)-dst);
 1432|       |
 1433|  2.53k|_dest_overflow:
 1434|  2.53k|    if (limit != fillOutput) return 0;  /* compression failed */
  ------------------
  |  Branch (1434:9): [True: 1.06k, False: 1.46k]
  ------------------
 1435|  1.46k|    LZ4HC_encodeLastSequence_fillOutput(UPDATABLE(ip, op, anchor), m1.len, m1.off, oend);
  ------------------
  |  |  231|  1.46k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
 1436|  1.46k|    goto _last_literals;
 1437|  2.53k|}
lz4hc.c:LZ4HC_InsertAndFindBestMatch:
 1220|  51.1M|{
 1221|  51.1M|    DEBUGLOG(7, "LZ4HC_InsertAndFindBestMatch");
  ------------------
  |  |  290|  51.1M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1222|       |    /* note : LZ4HC_InsertAndGetWiderMatch() is able to modify the starting position of a match (*startpos),
 1223|       |     * but this won't be the case here, as we define iLowLimit==ip,
 1224|       |     * so LZ4HC_InsertAndGetWiderMatch() won't be allowed to search past ip */
 1225|  51.1M|    return LZ4HC_InsertAndGetWiderMatch(hc4, ip, ip, iLimit, MINMATCH-1, maxNbAttempts, patternAnalysis, 0 /*chainSwap*/, dict, favorCompressionRatio);
  ------------------
  |  |  243|  51.1M|#define MINMATCH 4
  ------------------
 1226|  51.1M|}
lz4hc.c:LZ4HC_InsertAndGetWiderMatch:
 1032|  95.3M|{
 1033|  95.3M|    U16* const chainTable = hc4->chainTable;
 1034|  95.3M|    U32* const hashTable = hc4->hashTable;
 1035|  95.3M|    const LZ4HC_CCtx_internal* const dictCtx = hc4->dictCtx;
 1036|  95.3M|    const BYTE* const prefixPtr = hc4->prefixStart;
 1037|  95.3M|    const U32 prefixIdx = hc4->dictLimit;
 1038|  95.3M|    const U32 ipIndex = (U32)(ip - prefixPtr) + prefixIdx;
 1039|  95.3M|    const int withinStartDistance = (hc4->lowLimit + (LZ4_DISTANCE_MAX + 1) > ipIndex);
  ------------------
  |  |  678|  95.3M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
 1040|  95.3M|    const U32 lowestMatchIndex = (withinStartDistance) ? hc4->lowLimit : ipIndex - LZ4_DISTANCE_MAX;
  ------------------
  |  |  678|  72.2M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1040:34): [True: 23.0M, False: 72.2M]
  ------------------
 1041|  95.3M|    const BYTE* const dictStart = hc4->dictStart;
 1042|  95.3M|    const U32 dictIdx = hc4->lowLimit;
 1043|  95.3M|    int const lookBackLength = (int)(ip-iLowLimit);
 1044|  95.3M|    int const maxLength = (int)(iHighLimit-iLowLimit);   /* no match can be longer */
 1045|  95.3M|    int nbAttempts = maxNbAttempts;
 1046|  95.3M|    U32 matchChainPos = 0;
 1047|  95.3M|    U32 const pattern = LZ4_read32(ip);
 1048|  95.3M|    U32 matchIndex;
 1049|  95.3M|    repeat_state_e repeat = rep_untested;
 1050|  95.3M|    size_t srcPatternLength = 0;
 1051|  95.3M|    int offset = 0, sBack = 0;
 1052|       |
 1053|  95.3M|    DEBUGLOG(7, "LZ4HC_InsertAndGetWiderMatch");
  ------------------
  |  |  290|  95.3M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1054|       |    /* First Match */
 1055|  95.3M|    LZ4HC_Insert(hc4, ip);  /* insert all prior positions up to ip (excluded) */
 1056|  95.3M|    matchIndex = hashTable[LZ4HC_hashPtr(ip)];
 1057|  95.3M|    DEBUGLOG(7, "First candidate match for pos %u found at index %u / %u (lowestMatchIndex)",
  ------------------
  |  |  290|  95.3M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1058|  95.3M|                ipIndex, matchIndex, lowestMatchIndex);
 1059|       |
 1060|       |    /* Candidates only replace the current match if strictly longer,
 1061|       |     * so stopping once @longest reaches @maxLength doesn't change the result. */
 1062|   736M|    while ((matchIndex>=lowestMatchIndex) && (nbAttempts>0) && (longest<maxLength)) {
  ------------------
  |  Branch (1062:12): [True: 643M, False: 92.9M]
  |  Branch (1062:46): [True: 641M, False: 2.34M]
  |  Branch (1062:64): [True: 641M, False: 3.95k]
  ------------------
 1063|   641M|        int matchLength=0;
 1064|   641M|        nbAttempts--;
 1065|   641M|        assert(matchIndex < ipIndex);
  ------------------
  |  Branch (1065:9): [True: 0, False: 641M]
  |  Branch (1065:9): [True: 641M, False: 0]
  ------------------
 1066|   641M|        if (favorDecSpeed && (ipIndex - matchIndex < 8)) {
  ------------------
  |  Branch (1066:13): [True: 0, False: 641M]
  |  Branch (1066:30): [True: 0, False: 0]
  ------------------
 1067|       |            /* do nothing:
 1068|       |             * favorDecSpeed intentionally skips matches with offset < 8 */
 1069|   641M|        } else if (matchIndex >= prefixIdx) {   /* within current Prefix */
  ------------------
  |  Branch (1069:20): [True: 641M, False: 0]
  ------------------
 1070|   641M|            const BYTE* const matchPtr = prefixPtr + (matchIndex - prefixIdx);
 1071|   641M|            assert(matchPtr < ip);
  ------------------
  |  Branch (1071:13): [True: 0, False: 641M]
  |  Branch (1071:13): [True: 641M, False: 0]
  ------------------
 1072|   641M|            assert(longest >= 1);
  ------------------
  |  Branch (1072:13): [True: 0, False: 641M]
  |  Branch (1072:13): [True: 641M, False: 0]
  ------------------
 1073|   641M|            if (LZ4_read16(iLowLimit + longest - 1) == LZ4_read16(matchPtr - lookBackLength + longest - 1)) {
  ------------------
  |  Branch (1073:17): [True: 74.1M, False: 567M]
  ------------------
 1074|  74.1M|                if (LZ4_read32(matchPtr) == pattern) {
  ------------------
  |  Branch (1074:21): [True: 65.5M, False: 8.60M]
  ------------------
 1075|  65.5M|                    int const back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, prefixPtr) : 0;
  ------------------
  |  Branch (1075:38): [True: 46.9M, False: 18.5M]
  ------------------
 1076|  65.5M|                    matchLength = MINMATCH + (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
  ------------------
  |  |  243|  65.5M|#define MINMATCH 4
  ------------------
                                  matchLength = MINMATCH + (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
  ------------------
  |  |  243|  65.5M|#define MINMATCH 4
  ------------------
                                  matchLength = MINMATCH + (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
  ------------------
  |  |  243|  65.5M|#define MINMATCH 4
  ------------------
 1077|  65.5M|                    matchLength -= back;
 1078|  65.5M|                    if (matchLength > longest) {
  ------------------
  |  Branch (1078:25): [True: 5.87M, False: 59.6M]
  ------------------
 1079|  5.87M|                        longest = matchLength;
 1080|  5.87M|                        offset = (int)(ipIndex - matchIndex);
 1081|  5.87M|                        sBack = back;
 1082|  5.87M|                        DEBUGLOG(7, "Found match of len=%i within prefix, offset=%i, back=%i", longest, offset, -back);
  ------------------
  |  |  290|  5.87M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1083|  5.87M|                        HEX_CMP(7, ip + back, ip + back - offset, (size_t)matchLength);
 1084|  5.87M|            }   }   }
 1085|   641M|        } else {   /* lowestMatchIndex <= matchIndex < dictLimit : within Ext Dict */
 1086|      0|            const BYTE* const matchPtr = dictStart + (matchIndex - dictIdx);
 1087|      0|            assert(matchIndex >= dictIdx);
  ------------------
  |  Branch (1087:13): [True: 0, False: 0]
  |  Branch (1087:13): [True: 0, False: 0]
  ------------------
 1088|      0|            if ( likely(matchIndex <= prefixIdx - 4)
  ------------------
  |  |  178|      0|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1089|      0|              && (LZ4_read32(matchPtr) == pattern) ) {
  ------------------
  |  Branch (1089:18): [True: 0, False: 0]
  ------------------
 1090|      0|                int back = 0;
 1091|      0|                const BYTE* vLimit = ip + (prefixIdx - matchIndex);
 1092|      0|                if (vLimit > iHighLimit) vLimit = iHighLimit;
  ------------------
  |  Branch (1092:21): [True: 0, False: 0]
  ------------------
 1093|      0|                matchLength = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
                              matchLength = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
                              matchLength = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
 1094|      0|                if ((ip+matchLength == vLimit) && (vLimit < iHighLimit))
  ------------------
  |  Branch (1094:21): [True: 0, False: 0]
  |  Branch (1094:51): [True: 0, False: 0]
  ------------------
 1095|      0|                    matchLength += LZ4_count(ip+matchLength, prefixPtr, iHighLimit);
 1096|      0|                back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, dictStart) : 0;
  ------------------
  |  Branch (1096:24): [True: 0, False: 0]
  ------------------
 1097|      0|                matchLength -= back;
 1098|      0|                if (matchLength > longest) {
  ------------------
  |  Branch (1098:21): [True: 0, False: 0]
  ------------------
 1099|      0|                    longest = matchLength;
 1100|      0|                    offset = (int)(ipIndex - matchIndex);
 1101|      0|                    sBack = back;
 1102|      0|                    DEBUGLOG(7, "Found match of len=%i within dict, offset=%i, back=%i", longest, offset, -back);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1103|      0|                    HEX_CMP(7, ip + back, matchPtr + back, (size_t)matchLength);
 1104|      0|        }   }   }
 1105|       |
 1106|   641M|        if (chainSwap && matchLength==longest && matchIndex + (U32)longest <= ipIndex) {   /* better match => select a better chain */
  ------------------
  |  Branch (1106:13): [True: 467M, False: 173M]
  |  Branch (1106:26): [True: 2.38M, False: 465M]
  |  Branch (1106:50): [True: 2.13M, False: 248k]
  ------------------
 1107|  2.13M|            U32 const distanceToNextMatch = LZ4HC_sparsestChain(chainTable, matchIndex, longest, &matchChainPos);
 1108|  2.13M|            assert(lookBackLength==0);   /* search forward only */
  ------------------
  |  Branch (1108:13): [True: 0, False: 2.13M]
  |  Branch (1108:13): [True: 2.13M, False: 0]
  ------------------
 1109|  2.13M|            if (distanceToNextMatch > 1) {
  ------------------
  |  Branch (1109:17): [True: 1.99M, False: 142k]
  ------------------
 1110|  1.99M|                if (distanceToNextMatch > matchIndex) break;   /* avoid overflow */
  ------------------
  |  Branch (1110:21): [True: 0, False: 1.99M]
  ------------------
 1111|  1.99M|                matchIndex -= distanceToNextMatch;
 1112|  1.99M|                continue;
 1113|  1.99M|        }   }
 1114|       |
 1115|   639M|        {   U32 const distNextMatch = DELTANEXTU16(chainTable, matchIndex);
  ------------------
  |  |  229|   639M|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
 1116|   639M|            if (patternAnalysis && distNextMatch==1 && matchChainPos==0) {
  ------------------
  |  Branch (1116:17): [True: 558M, False: 80.5M]
  |  Branch (1116:36): [True: 88.5M, False: 470M]
  |  Branch (1116:56): [True: 58.9M, False: 29.6M]
  ------------------
 1117|  58.9M|                U32 const matchCandidateIdx = matchIndex-1;
 1118|  58.9M|                size_t forwardPatternLength, backLength;
 1119|       |                /* may be a repeated pattern */
 1120|  58.9M|                if (repeat == rep_untested) {
  ------------------
  |  Branch (1120:21): [True: 396k, False: 58.5M]
  ------------------
 1121|   396k|                    if ( ((pattern & 0xFFFF) == (pattern >> 16))
  ------------------
  |  Branch (1121:26): [True: 387k, False: 8.92k]
  ------------------
 1122|   396k|                      &  ((pattern & 0xFF)   == (pattern >> 24)) ) {
 1123|   387k|                        DEBUGLOG(7, "Repeat pattern detected, char %02X", pattern >> 24);
  ------------------
  |  |  290|   387k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1124|   387k|                        repeat = rep_confirmed;
 1125|   387k|                        srcPatternLength = LZ4HC_countPattern(ip+sizeof(pattern), iHighLimit, pattern) + sizeof(pattern);
 1126|   387k|                    } else {
 1127|  8.92k|                        repeat = rep_not;
 1128|  8.92k|                }   }
 1129|  58.9M|                if ( (repeat == rep_confirmed) && (matchCandidateIdx >= lowestMatchIndex)
  ------------------
  |  Branch (1129:22): [True: 54.4M, False: 4.51M]
  |  Branch (1129:51): [True: 54.4M, False: 2.87k]
  ------------------
 1130|  54.4M|                  && LZ4HC_protectDictEnd(prefixIdx, matchCandidateIdx)
  ------------------
  |  Branch (1130:22): [True: 54.4M, False: 0]
  ------------------
 1131|  54.4M|                  && LZ4HC_patternSegment(hc4, matchCandidateIdx, pattern, iHighLimit, lowestMatchIndex,
  ------------------
  |  Branch (1131:22): [True: 54.2M, False: 112k]
  ------------------
 1132|  54.4M|                                          &forwardPatternLength, &backLength) ) {
 1133|  54.2M|                    size_t const currentSegmentLength = backLength + forwardPatternLength;
 1134|       |                    /* if the full source pattern fits (and hasn't been reached yet), jump to its best position :
 1135|       |                     * at the end of the segment, it might be followed by more match.
 1136|       |                     * Otherwise, jump to the farthest position in the segment : the longest match, plus maybe some back */
 1137|  54.2M|                    int const fullPatternFits = (currentSegmentLength >= srcPatternLength)
  ------------------
  |  Branch (1137:49): [True: 25.9M, False: 28.3M]
  ------------------
 1138|  25.9M|                                             && (forwardPatternLength <= srcPatternLength);
  ------------------
  |  Branch (1138:49): [True: 11.8M, False: 14.0M]
  ------------------
 1139|  54.2M|                    U32 const newMatchIndex = fullPatternFits ?
  ------------------
  |  Branch (1139:47): [True: 11.8M, False: 42.4M]
  ------------------
 1140|  11.8M|                                              matchCandidateIdx + (U32)forwardPatternLength - (U32)srcPatternLength :
 1141|  54.2M|                                              matchCandidateIdx - (U32)backLength;
 1142|  54.2M|                    if (!LZ4HC_protectDictEnd(prefixIdx, newMatchIndex)) {
  ------------------
  |  Branch (1142:25): [True: 0, False: 54.2M]
  ------------------
 1143|       |                        /* Can only happen if started in the prefix */
 1144|      0|                        assert(newMatchIndex >= prefixIdx - 3 && newMatchIndex < prefixIdx && matchCandidateIdx >= prefixIdx);
  ------------------
  |  Branch (1144:25): [True: 0, False: 0]
  |  Branch (1144:25): [True: 0, False: 0]
  |  Branch (1144:25): [True: 0, False: 0]
  |  Branch (1144:25): [True: 0, False: 0]
  |  Branch (1144:25): [True: 0, False: 0]
  |  Branch (1144:25): [True: 0, False: 0]
  ------------------
 1145|      0|                        matchIndex = prefixIdx;
 1146|      0|                        continue;
 1147|      0|                    }
 1148|  54.2M|                    matchIndex = newMatchIndex;
 1149|  54.2M|                    if (!fullPatternFits && lookBackLength==0) {  /* no back possible : the match length is known */
  ------------------
  |  Branch (1149:25): [True: 42.4M, False: 11.8M]
  |  Branch (1149:45): [True: 39.6M, False: 2.76M]
  ------------------
 1150|  39.6M|                        size_t const maxML = MIN(currentSegmentLength, srcPatternLength);
  ------------------
  |  |   81|  39.6M|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (81:22): [True: 27.3M, False: 12.3M]
  |  |  ------------------
  ------------------
 1151|  39.6M|                        if ((size_t)longest < maxML) {
  ------------------
  |  Branch (1151:29): [True: 80.5k, False: 39.5M]
  ------------------
 1152|  80.5k|                            assert(prefixPtr - prefixIdx + matchIndex != ip);
  ------------------
  |  Branch (1152:29): [True: 0, False: 80.5k]
  |  Branch (1152:29): [True: 80.5k, False: 0]
  ------------------
 1153|  80.5k|                            if ((size_t)(ip - prefixPtr) + prefixIdx - matchIndex > LZ4_DISTANCE_MAX) break;
  ------------------
  |  |  678|  80.5k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1153:33): [True: 0, False: 80.5k]
  ------------------
 1154|  80.5k|                            assert(maxML < 2 GB);
  ------------------
  |  Branch (1154:29): [True: 0, False: 80.5k]
  |  Branch (1154:29): [True: 80.5k, False: 0]
  ------------------
 1155|  80.5k|                            longest = (int)maxML;
 1156|  80.5k|                            offset = (int)(ipIndex - matchIndex);
 1157|  80.5k|                            assert(sBack == 0);
  ------------------
  |  Branch (1157:29): [True: 0, False: 80.5k]
  |  Branch (1157:29): [True: 80.5k, False: 0]
  ------------------
 1158|  80.5k|                            DEBUGLOG(7, "Found repeat pattern match of len=%i, offset=%i", longest, offset);
  ------------------
  |  |  290|  80.5k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1159|  80.5k|                        }
 1160|  39.6M|                        {   U32 const distToNextPattern = DELTANEXTU16(chainTable, matchIndex);
  ------------------
  |  |  229|  39.6M|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
 1161|  39.6M|                            if (distToNextPattern > matchIndex) break;  /* avoid overflow */
  ------------------
  |  Branch (1161:33): [True: 0, False: 39.6M]
  ------------------
 1162|  39.6M|                            matchIndex -= distToNextPattern;
 1163|  39.6M|                    }   }
 1164|  54.2M|                    continue;
 1165|  54.2M|                }
 1166|  58.9M|        }   }   /* PA optimization */
 1167|       |
 1168|       |        /* follow current chain */
 1169|   584M|        matchIndex -= DELTANEXTU16(chainTable, matchIndex + matchChainPos);
  ------------------
  |  |  229|   584M|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
 1170|       |
 1171|   584M|    }  /* while ((matchIndex>=lowestMatchIndex) && (nbAttempts)) */
 1172|       |
 1173|  95.3M|    if ( dict == usingDictCtxHc
  ------------------
  |  Branch (1173:10): [True: 0, False: 95.3M]
  ------------------
 1174|      0|      && nbAttempts > 0
  ------------------
  |  Branch (1174:10): [True: 0, False: 0]
  ------------------
 1175|      0|      && longest < maxLength
  ------------------
  |  Branch (1175:10): [True: 0, False: 0]
  ------------------
 1176|      0|      && withinStartDistance) {
  ------------------
  |  Branch (1176:10): [True: 0, False: 0]
  ------------------
 1177|      0|        size_t const dictEndOffset = (size_t)(dictCtx->end - dictCtx->prefixStart) + dictCtx->dictLimit;
 1178|      0|        U32 dictMatchIndex = dictCtx->hashTable[LZ4HC_hashPtr(ip)];
 1179|      0|        assert(dictEndOffset <= 1 GB);
  ------------------
  |  Branch (1179:9): [True: 0, False: 0]
  |  Branch (1179:9): [True: 0, False: 0]
  ------------------
 1180|      0|        matchIndex = dictMatchIndex + lowestMatchIndex - (U32)dictEndOffset;
 1181|      0|        if (dictMatchIndex>0) DEBUGLOG(7, "dictEndOffset = %zu, dictMatchIndex = %u => relative matchIndex = %i", dictEndOffset, dictMatchIndex, (int)dictMatchIndex - (int)dictEndOffset);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  |  Branch (1181:13): [True: 0, False: 0]
  ------------------
 1182|      0|        while (ipIndex - matchIndex <= LZ4_DISTANCE_MAX && longest < maxLength && nbAttempts--) {
  ------------------
  |  |  678|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1182:16): [True: 0, False: 0]
  |  Branch (1182:60): [True: 0, False: 0]
  |  Branch (1182:83): [True: 0, False: 0]
  ------------------
 1183|      0|            const BYTE* const matchPtr = dictCtx->prefixStart - dictCtx->dictLimit + dictMatchIndex;
 1184|       |
 1185|      0|            if (LZ4_read32(matchPtr) == pattern) {
  ------------------
  |  Branch (1185:17): [True: 0, False: 0]
  ------------------
 1186|      0|                int mlt;
 1187|      0|                int back = 0;
 1188|      0|                const BYTE* vLimit = ip + (dictEndOffset - dictMatchIndex);
 1189|      0|                if (vLimit > iHighLimit) vLimit = iHighLimit;
  ------------------
  |  Branch (1189:21): [True: 0, False: 0]
  ------------------
 1190|      0|                mlt = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
                              mlt = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
                              mlt = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
 1191|      0|                back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, dictCtx->prefixStart) : 0;
  ------------------
  |  Branch (1191:24): [True: 0, False: 0]
  ------------------
 1192|      0|                mlt -= back;
 1193|      0|                if (mlt > longest) {
  ------------------
  |  Branch (1193:21): [True: 0, False: 0]
  ------------------
 1194|      0|                    longest = mlt;
 1195|      0|                    offset = (int)(ipIndex - matchIndex);
 1196|      0|                    sBack = back;
 1197|      0|                    DEBUGLOG(7, "found match of length %i within extDictCtx", longest);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1198|      0|            }   }
 1199|       |
 1200|      0|            {   U32 const nextOffset = DELTANEXTU16(dictCtx->chainTable, dictMatchIndex);
  ------------------
  |  |  229|      0|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
 1201|      0|                dictMatchIndex -= nextOffset;
 1202|      0|                matchIndex -= nextOffset;
 1203|      0|    }   }   }
 1204|       |
 1205|  95.3M|    {   LZ4HC_match_t md;
 1206|  95.3M|        assert(longest >= 0);
  ------------------
  |  Branch (1206:9): [True: 0, False: 95.3M]
  |  Branch (1206:9): [True: 95.3M, False: 0]
  ------------------
 1207|  95.3M|        md.len = longest;
 1208|  95.3M|        md.off = offset;
 1209|  95.3M|        md.back = sBack;
 1210|  95.3M|        return md;
 1211|  95.3M|    }
 1212|  95.3M|}
lz4hc.c:LZ4HC_sparsestChain:
  961|  2.13M|{
  962|  2.13M|    int const kTrigger = 4;
  963|  2.13M|    U32 distanceToNextMatch = 1;
  964|  2.13M|    int const end = longest - MINMATCH + 1;
  ------------------
  |  |  243|  2.13M|#define MINMATCH 4
  ------------------
  965|  2.13M|    int step = 1;
  966|  2.13M|    int accel = 1 << kTrigger;
  967|  2.13M|    int pos;
  968|   113M|    for (pos = 0; pos < end; pos += step) {
  ------------------
  |  Branch (968:19): [True: 111M, False: 2.13M]
  ------------------
  969|   111M|        U32 const candidateDist = DELTANEXTU16(chainTable, matchIndex + (U32)pos);
  ------------------
  |  |  229|   111M|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
  970|   111M|        step = (accel++ >> kTrigger);
  971|   111M|        if (candidateDist > distanceToNextMatch) {
  ------------------
  |  Branch (971:13): [True: 2.75M, False: 108M]
  ------------------
  972|  2.75M|            distanceToNextMatch = candidateDist;
  973|  2.75M|            *matchChainPosPtr = (U32)pos;
  974|  2.75M|            accel = 1 << kTrigger;
  975|  2.75M|    }   }
  976|  2.13M|    return distanceToNextMatch;
  977|  2.13M|}
lz4hc.c:LZ4HC_countPattern:
  894|  54.6M|{
  895|  54.6M|    const BYTE* const iStart = ip;
  896|  54.6M|    reg_t const pattern = (sizeof(pattern)==8) ?
  ------------------
  |  Branch (896:27): [True: 54.6M, Folded]
  ------------------
  897|  54.6M|        (reg_t)pattern32 + (((reg_t)pattern32) << (sizeof(pattern)*4)) : pattern32;
  898|       |
  899|  97.6M|    while (likely(ip < iEnd-(sizeof(pattern)-1))) {
  900|  97.6M|        reg_t const diff = LZ4_read_ARCH(ip) ^ pattern;
  901|  97.6M|        if (!diff) { ip+=sizeof(pattern); continue; }
  ------------------
  |  Branch (901:13): [True: 42.9M, False: 54.6M]
  ------------------
  902|  54.6M|        ip += LZ4_NbCommonBytes(diff);
  903|  54.6M|        return (unsigned)(ip - iStart);
  904|  97.6M|    }
  905|       |
  906|  9.72k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (906:9): [True: 9.72k, False: 0]
  ------------------
  907|  9.72k|        reg_t patternByte = pattern;
  908|  38.4k|        while ((ip<iEnd) && (*ip == (BYTE)patternByte)) {
  ------------------
  |  Branch (908:16): [True: 32.6k, False: 5.87k]
  |  Branch (908:29): [True: 28.7k, False: 3.84k]
  ------------------
  909|  28.7k|            ip++; patternByte >>= 8;
  910|  28.7k|        }
  911|  9.72k|    } else {  /* big endian */
  912|      0|        U32 bitOffset = (sizeof(pattern)*8) - 8;
  913|      0|        while (ip < iEnd) {
  ------------------
  |  Branch (913:16): [True: 0, False: 0]
  ------------------
  914|      0|            BYTE const byte = (BYTE)(pattern >> bitOffset);
  915|      0|            if (*ip != byte) break;
  ------------------
  |  Branch (915:17): [True: 0, False: 0]
  ------------------
  916|      0|            ip ++; bitOffset -= 8;
  917|      0|    }   }
  918|       |
  919|  9.72k|    return (unsigned)(ip - iStart);
  920|  54.6M|}
lz4hc.c:LZ4HC_protectDictEnd:
  948|   108M|{
  949|   108M|    return ((U32)((dictLimit - 1) - matchIndex) >= 3);
  950|   108M|}
lz4hc.c:LZ4HC_patternSegment:
  988|  54.4M|{
  989|  54.4M|    const BYTE* const prefixPtr = hc4->prefixStart;
  990|  54.4M|    U32 const prefixIdx = hc4->dictLimit;
  991|  54.4M|    const BYTE* const dictStart = hc4->dictStart;
  992|  54.4M|    U32 const dictIdx = hc4->lowLimit;
  993|  54.4M|    const BYTE* const dictEnd = dictStart + prefixIdx - dictIdx;
  994|  54.4M|    int const extDict = candidateIdx < prefixIdx;
  995|  54.4M|    const BYTE* const matchPtr = extDict ? dictStart + (candidateIdx - dictIdx) : prefixPtr + (candidateIdx - prefixIdx);
  ------------------
  |  Branch (995:34): [True: 0, False: 54.4M]
  ------------------
  996|  54.4M|    size_t forward, back;
  997|  54.4M|    if (LZ4_read32(matchPtr) != pattern) return 0;
  ------------------
  |  Branch (997:9): [True: 112k, False: 54.2M]
  ------------------
  998|       |
  999|  54.2M|    {   const BYTE* const iLimit = extDict ? dictEnd : iHighLimit;
  ------------------
  |  Branch (999:36): [True: 0, False: 54.2M]
  ------------------
 1000|  54.2M|        forward = LZ4HC_countPattern(matchPtr+sizeof(pattern), iLimit, pattern) + sizeof(pattern);
 1001|  54.2M|        if (extDict && matchPtr + forward == iLimit) {   /* continues into the prefix */
  ------------------
  |  Branch (1001:13): [True: 0, False: 54.2M]
  |  Branch (1001:24): [True: 0, False: 0]
  ------------------
 1002|      0|            U32 const rotatedPattern = LZ4HC_rotatePattern(forward, pattern);
 1003|      0|            forward += LZ4HC_countPattern(prefixPtr, iHighLimit, rotatedPattern);
 1004|      0|    }   }
 1005|       |
 1006|  54.2M|    back = LZ4HC_reverseCountPattern(matchPtr, extDict ? dictStart : prefixPtr, pattern);
  ------------------
  |  Branch (1006:48): [True: 0, False: 54.2M]
  ------------------
 1007|  54.2M|    if (!extDict && matchPtr - back == prefixPtr && dictIdx < prefixIdx) {   /* continues into the external dictionary */
  ------------------
  |  Branch (1007:9): [True: 54.2M, False: 0]
  |  Branch (1007:21): [True: 44.2k, False: 54.2M]
  |  Branch (1007:53): [True: 0, False: 44.2k]
  ------------------
 1008|      0|        U32 const rotatedPattern = LZ4HC_rotatePattern((U32)(-(int)back), pattern);
 1009|      0|        back += LZ4HC_reverseCountPattern(dictEnd, dictStart, rotatedPattern);
 1010|      0|    }
 1011|       |    /* don't go below lowestMatchIndex */
 1012|  54.2M|    back = candidateIdx - MAX(candidateIdx - (U32)back, lowestMatchIndex);
  ------------------
  |  |   82|  54.2M|#define MAX(a,b)   ( (a) > (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (82:22): [True: 54.2M, False: 71.5k]
  |  |  ------------------
  ------------------
 1013|  54.2M|    assert(candidateIdx - back >= lowestMatchIndex);
  ------------------
  |  Branch (1013:5): [True: 0, False: 54.2M]
  |  Branch (1013:5): [True: 54.2M, False: 0]
  ------------------
 1014|       |
 1015|  54.2M|    *forwardPtr = forward;
 1016|  54.2M|    *backPtr = back;
 1017|  54.2M|    return 1;
 1018|  54.2M|}
lz4hc.c:LZ4HC_reverseCountPattern:
  927|  54.2M|{
  928|  54.2M|    const BYTE* const iStart = ip;
  929|       |
  930|   766M|    while (likely(ip >= iLow+4)) {
  931|   766M|        if (LZ4_read32(ip-4) != pattern) break;
  ------------------
  |  Branch (931:13): [True: 54.2M, False: 712M]
  ------------------
  932|   712M|        ip -= 4;
  933|   712M|    }
  934|  54.2M|    {   const BYTE* bytePtr = (const BYTE*)(&pattern) + 3; /* works for any endianness */
  935|   127M|        while (likely(ip>iLow)) {
  936|   127M|            if (ip[-1] != *bytePtr) break;
  ------------------
  |  Branch (936:17): [True: 54.2M, False: 73.3M]
  ------------------
  937|  73.3M|            ip--; bytePtr--;
  938|  73.3M|    }   }
  939|  54.2M|    return (unsigned)(iStart - ip);
  940|  54.2M|}
lz4hc.c:LZ4HC_splitOverlap:
 1242|   421k|{
 1243|   421k|    int const gap = (int)(*start2 - ip);
 1244|   421k|    int newML = MIN(ml1, OPTIMAL_ML);
  ------------------
  |  |   81|   421k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (81:22): [True: 370k, False: 51.3k]
  |  |  ------------------
  ------------------
 1245|   421k|    assert(gap < OPTIMAL_ML);
  ------------------
  |  Branch (1245:5): [True: 0, False: 421k]
  |  Branch (1245:5): [True: 421k, False: 0]
  ------------------
 1246|   421k|    if (newML > gap + m2->len - MINMATCH)
  ------------------
  |  |  243|   421k|#define MINMATCH 4
  ------------------
  |  Branch (1246:9): [True: 190, False: 421k]
  ------------------
 1247|    190|        newML = gap + m2->len - MINMATCH;
  ------------------
  |  |  243|    190|#define MINMATCH 4
  ------------------
 1248|   421k|    if (newML > gap) {   /* shift m2 */
  ------------------
  |  Branch (1248:9): [True: 393k, False: 28.3k]
  ------------------
 1249|   393k|        *start2 += newML - gap;
 1250|   393k|        m2->len -= newML - gap;
 1251|   393k|    }
 1252|   421k|    return newML;
 1253|   421k|}
lz4hc.c:LZ4HC_compress_optimal:
 2164|  5.47k|{
 2165|  5.47k|#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1
 2166|  5.47k|    LZ4HC_optimal_t* const opt = (LZ4HC_optimal_t*)ALLOC(sizeof(LZ4HC_optimal_t) * (LZ4_OPT_NUM + TRAILING_LITERALS));
  ------------------
  |  |  226|  5.47k|# define ALLOC(s)          malloc(s)
  ------------------
 2167|  5.47k|    int result;
 2168|  5.47k|    if (opt == NULL) return 0;
  ------------------
  |  Branch (2168:9): [True: 0, False: 5.47k]
  ------------------
 2169|  5.47k|    result = LZ4HC_compress_optimal_internal(ctx, source, dst, srcSizePtr, dstCapacity,
 2170|  5.47k|                    nbSearches, nbSearchesSeq, targetLength, limit, dict, favorDecSpeed, opt);
 2171|  5.47k|    FREEMEM(opt);
  ------------------
  |  |  228|  5.47k|# define FREEMEM(p)        free(p)
  ------------------
 2172|  5.47k|    return result;
 2173|       |#else
 2174|       |    LZ4HC_optimal_t opt[LZ4_OPT_NUM + TRAILING_LITERALS];   /* ~64 KB, which can be a bit large for some stacks... */
 2175|       |    return LZ4HC_compress_optimal_internal(ctx, source, dst, srcSizePtr, dstCapacity,
 2176|       |                    nbSearches, nbSearchesSeq, targetLength, limit, dict, favorDecSpeed, opt);
 2177|       |#endif
 2178|  5.47k|}
lz4hc.c:LZ4HC_compress_optimal_internal:
 2021|  5.47k|{
 2022|  5.47k|    const BYTE* ip = (const BYTE*) source;
 2023|  5.47k|    const BYTE* anchor = ip;
 2024|  5.47k|    const BYTE* const iend = ip + *srcSizePtr;
 2025|  5.47k|    const BYTE* const mflimit = iend - MFLIMIT;
  ------------------
  |  |  247|  5.47k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2026|  5.47k|    const BYTE* const matchlimit = iend - LASTLITERALS;
  ------------------
  |  |  246|  5.47k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2027|  5.47k|    BYTE* op = (BYTE*) dst;
 2028|       |    /* fillOutput : keep room for the final run of literals (LZ4 format restriction) */
 2029|  5.47k|    BYTE* const oend = op + dstCapacity - ((limit == fillOutput) ? LASTLITERALS : 0);
  ------------------
  |  |  246|  2.73k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2029:44): [True: 2.73k, False: 2.73k]
  ------------------
 2030|  5.47k|    int const sufficientLen = MIN(targetLength, LZ4_OPT_NUM-1);
  ------------------
  |  |   81|  5.47k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (81:22): [True: 3.35k, False: 2.11k]
  |  |  ------------------
  ------------------
 2031|       |
 2032|  5.47k|    DEBUGLOG(5, "LZ4HC_compress_optimal(dst=%p, dstCapa=%u)", dst, (unsigned)dstCapacity);
  ------------------
  |  |  290|  5.47k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2033|       |
 2034|       |    /* preconditions verifications */
 2035|  5.47k|    assert(dstCapacity > 0);
  ------------------
  |  Branch (2035:5): [True: 0, False: 5.47k]
  |  Branch (2035:5): [True: 5.47k, False: 0]
  ------------------
 2036|  5.47k|    assert(dst != NULL);
  ------------------
  |  Branch (2036:5): [True: 0, False: 5.47k]
  |  Branch (2036:5): [True: 5.47k, False: 0]
  ------------------
 2037|  5.47k|    assert(*srcSizePtr > 0);
  ------------------
  |  Branch (2037:5): [True: 0, False: 5.47k]
  |  Branch (2037:5): [True: 5.47k, False: 0]
  ------------------
 2038|  5.47k|    assert(source != NULL);
  ------------------
  |  Branch (2038:5): [True: 0, False: 5.47k]
  |  Branch (2038:5): [True: 5.47k, False: 0]
  ------------------
 2039|  5.47k|    assert(opt != NULL);
  ------------------
  |  Branch (2039:5): [True: 0, False: 5.47k]
  |  Branch (2039:5): [True: 5.47k, False: 0]
  ------------------
 2040|  5.47k|    assert(nbSearchesSeq >= 1);
  ------------------
  |  Branch (2040:5): [True: 0, False: 5.47k]
  |  Branch (2040:5): [True: 5.47k, False: 0]
  ------------------
 2041|       |
 2042|  5.47k|    *srcSizePtr = 0;
 2043|       |
 2044|       |    /* Main Loop */
 2045|  40.8M|    while (ip <= mflimit) {
  ------------------
  |  Branch (2045:12): [True: 40.8M, False: 3.09k]
  ------------------
 2046|  40.8M|        int const llen = LZ4HC_pricedLitlen((int)(ip - anchor));
 2047|  40.8M|        int cur, lastPos;
 2048|  40.8M|        int lastSeqPos;         /* position of the last sequence to encode */
 2049|  40.8M|        LZ4HC_match_t lastSeq;
 2050|       |
 2051|  40.8M|        LZ4HC_match_t const firstMatch = LZ4HC_FindLongestMatch(ctx, ip, matchlimit, nbSearches, dict, favorDecSpeed);
 2052|  40.8M|        if (firstMatch.len==0) { ip++; continue; }
  ------------------
  |  Branch (2052:13): [True: 40.6M, False: 167k]
  ------------------
 2053|       |
 2054|   167k|        if (firstMatch.len > sufficientLen) {
  ------------------
  |  Branch (2054:13): [True: 22.4k, False: 145k]
  ------------------
 2055|       |            /* good enough solution : immediate encoding */
 2056|  22.4k|            lastSeqPos = 0;
 2057|  22.4k|            lastSeq = firstMatch;
 2058|  22.4k|            goto encode;
 2059|  22.4k|        }
 2060|       |
 2061|       |        /* set prices for first positions (literals) */
 2062|   145k|        {   int rPos;
 2063|   725k|            for (rPos = 0 ; rPos < MINMATCH ; rPos++)
  ------------------
  |  |  243|   725k|#define MINMATCH 4
  ------------------
  |  Branch (2063:29): [True: 580k, False: 145k]
  ------------------
 2064|   580k|                LZ4HC_setLiteral(opt, rPos, llen + rPos, LZ4HC_literalsPrice(llen + rPos));
 2065|   145k|        }
 2066|   145k|        lastPos = LZ4HC_addMatch(opt, 0, firstMatch, 0, favorDecSpeed);
 2067|       |
 2068|       |        /* check further positions */
 2069|  22.7M|        for (cur = 1; cur < lastPos; cur++) {
  ------------------
  |  Branch (2069:23): [True: 22.6M, False: 137k]
  ------------------
 2070|  22.6M|            const BYTE* const curPtr = ip + cur;
 2071|  22.6M|            LZ4HC_match_t newMatch;
 2072|  22.6M|            int nbS = nbSearches;
 2073|       |
 2074|  22.6M|            if (curPtr > mflimit) break;
  ------------------
  |  Branch (2074:17): [True: 3.02k, False: 22.6M]
  ------------------
 2075|  22.6M|            DEBUGLOG(7, "rPos:%u[%u] vs [%u]%u",
  ------------------
  |  |  290|  22.6M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2076|  22.6M|                    cur, opt[cur].price, opt[cur+1].price, cur+1);
 2077|       |            /* not useful to search here if next position has same (or lower) cost */
 2078|  22.6M|            if (opt[cur+1].price <= opt[cur].price) continue;
  ------------------
  |  Branch (2078:17): [True: 21.1M, False: 1.50M]
  ------------------
 2079|       |            /* favorDecSpeed : next position costs less than one more byte, the difference comes from sequences.
 2080|       |             * A match starting here might save some : worth a cheaper search, if close to lastPos */
 2081|  1.50M|            if (favorDecSpeed && (opt[cur+1].price < opt[cur].price + LZ4HC_PRICE_SCALE)) {
  ------------------
  |  | 1874|      0|#define LZ4HC_PRICE_SCALE 4
  ------------------
  |  Branch (2081:17): [True: 0, False: 1.50M]
  |  Branch (2081:34): [True: 0, False: 0]
  ------------------
 2082|      0|                if (lastPos - cur > LZ4HC_SEQ_SEARCH_DIST) continue;
  ------------------
  |  | 1883|      0|#define LZ4HC_SEQ_SEARCH_DIST  4
  ------------------
  |  Branch (2082:21): [True: 0, False: 0]
  ------------------
 2083|      0|                nbS = nbSearchesSeq;
 2084|      0|            }
 2085|       |
 2086|  1.50M|            newMatch = LZ4HC_FindLongestMatch(ctx, curPtr, matchlimit, nbS, dict, favorDecSpeed);
 2087|  1.50M|            if (!newMatch.len) continue;
  ------------------
  |  Branch (2087:17): [True: 231k, False: 1.27M]
  ------------------
 2088|       |
 2089|  1.27M|            if ( (newMatch.len > sufficientLen)
  ------------------
  |  Branch (2089:18): [True: 4.36k, False: 1.26M]
  ------------------
 2090|  1.26M|              || (newMatch.len + cur >= LZ4_OPT_NUM) ) {
  ------------------
  |  |   77|  1.26M|#define LZ4_OPT_NUM   (1<<12)
  ------------------
  |  Branch (2090:18): [True: 401, False: 1.26M]
  ------------------
 2091|       |                /* immediate encoding */
 2092|  4.76k|                lastSeqPos = cur;
 2093|  4.76k|                lastSeq = newMatch;
 2094|  4.76k|                goto encode;
 2095|  4.76k|            }
 2096|       |
 2097|  1.26M|            lastPos = LZ4HC_addMatch(opt, cur, newMatch, lastPos, favorDecSpeed);
 2098|  1.26M|        }  /* for (cur = 1; cur < lastPos; cur++) */
 2099|       |
 2100|   145k|        assert(lastPos < LZ4_OPT_NUM + TRAILING_LITERALS);
  ------------------
  |  Branch (2100:9): [True: 0, False: 140k]
  |  Branch (2100:9): [True: 140k, False: 0]
  ------------------
 2101|   140k|        lastSeq.len = opt[lastPos].mlen;
 2102|   140k|        lastSeq.off = opt[lastPos].off;
 2103|   140k|        lastSeqPos = lastPos - lastSeq.len;
 2104|       |
 2105|   167k|encode: /* lastSeqPos and lastSeq must be set */
 2106|   167k|        assert(0 <= lastSeqPos && lastSeqPos < LZ4_OPT_NUM);
  ------------------
  |  Branch (2106:9): [True: 0, False: 167k]
  |  Branch (2106:9): [True: 0, False: 0]
  |  Branch (2106:9): [True: 167k, False: 0]
  |  Branch (2106:9): [True: 167k, False: 0]
  ------------------
 2107|   167k|        DEBUGLOG(6, "reverse traversal, looking for shortest path (lastSeqPos=%i)", lastSeqPos);
  ------------------
  |  |  290|   167k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2108|       |        /* opt[pos] describes the step ending at pos.
 2109|       |         * Walk the path backward, moving each step to its starting position instead */
 2110|   167k|        {   int pos = lastSeqPos;
 2111|   167k|            int mlen = lastSeq.len;
 2112|   167k|            int off = lastSeq.off;
 2113|   541k|            while (pos > 0) {
  ------------------
  |  Branch (2113:20): [True: 373k, False: 167k]
  ------------------
 2114|   373k|                int const prevMlen = opt[pos].mlen;
 2115|   373k|                int const prevOff = opt[pos].off;
 2116|   373k|                opt[pos].mlen = mlen;
 2117|   373k|                opt[pos].off = off;
 2118|   373k|                mlen = prevMlen;
 2119|   373k|                off = prevOff;
 2120|   373k|                assert(0 < mlen && mlen <= pos);
  ------------------
  |  Branch (2120:17): [True: 0, False: 373k]
  |  Branch (2120:17): [True: 0, False: 0]
  |  Branch (2120:17): [True: 373k, False: 0]
  |  Branch (2120:17): [True: 373k, False: 0]
  ------------------
 2121|   373k|                pos -= mlen;
 2122|   373k|            }
 2123|       |            /* first step of the path; note : opt[0] isn't necessarily initialized */
 2124|   167k|            opt[0].mlen = mlen;
 2125|   167k|            opt[0].off = off;
 2126|   167k|        }
 2127|       |
 2128|       |        /* encode all recorded sequences in order */
 2129|   167k|        {   int rPos = 0;  /* relative position (to ip) */
 2130|   705k|            while (rPos <= lastSeqPos) {
  ------------------
  |  Branch (2130:20): [True: 540k, False: 165k]
  ------------------
 2131|   540k|                int const ml = opt[rPos].mlen;
 2132|   540k|                int const offset = opt[rPos].off;
 2133|   540k|                if (ml == 1) { ip++; rPos++; continue; }  /* literal */
  ------------------
  |  Branch (2133:21): [True: 77.7k, False: 462k]
  ------------------
 2134|   462k|                rPos += ml;
 2135|   462k|                assert(ml >= MINMATCH);
  ------------------
  |  Branch (2135:17): [True: 0, False: 462k]
  |  Branch (2135:17): [True: 462k, False: 0]
  ------------------
 2136|   462k|                assert((offset >= 1) && (offset <= LZ4_DISTANCE_MAX));
  ------------------
  |  Branch (2136:17): [True: 0, False: 462k]
  |  Branch (2136:17): [True: 0, False: 0]
  |  Branch (2136:17): [True: 462k, False: 0]
  |  Branch (2136:17): [True: 462k, False: 0]
  ------------------
 2137|   462k|                if ( LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml, offset, limit, oend) ) {  /* updates ip, op and anchor */
  ------------------
  |  |  231|   462k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (2137:22): [True: 2.38k, False: 460k]
  ------------------
 2138|  2.38k|                    if (limit != fillOutput) return 0;  /* compression failed */
  ------------------
  |  Branch (2138:25): [True: 999, False: 1.38k]
  ------------------
 2139|  1.38k|                    LZ4HC_encodeLastSequence_fillOutput(UPDATABLE(ip, op, anchor), ml, offset, oend);
  ------------------
  |  |  231|  1.38k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
 2140|  1.38k|                    goto _last_literals;
 2141|  2.38k|        }   }   }
 2142|   167k|    }  /* while (ip <= mflimit) */
 2143|       |
 2144|  4.47k|_last_literals:
 2145|  4.47k|    if (LZ4HC_encodeLastLiterals(UPDATABLE(ip, op, anchor), iend, limit, oend))
  ------------------
  |  |  231|  4.47k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (2145:9): [True: 336, False: 4.13k]
  ------------------
 2146|    336|        return 0;  /* not enough space in @dst */
 2147|       |
 2148|       |    /* End */
 2149|  4.13k|    *srcSizePtr = (int) (((const char*)ip) - source);
 2150|  4.13k|    return (int) ((char*)op-dst);
 2151|  4.47k|}
lz4hc.c:LZ4HC_pricedLitlen:
 1913|  40.8M|{
 1914|  40.8M|    int const reduceFrom = (int)RUN_MASK + 255;
  ------------------
  |  |  264|  40.8M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  40.8M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  40.8M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1915|  40.8M|    assert(llen >= 0);
  ------------------
  |  Branch (1915:5): [True: 0, False: 40.8M]
  |  Branch (1915:5): [True: 40.8M, False: 0]
  ------------------
 1916|  40.8M|    if (llen < reduceFrom) return llen;
  ------------------
  |  Branch (1916:9): [True: 1.57M, False: 39.2M]
  ------------------
 1917|  39.2M|    return reduceFrom + ((llen - (int)RUN_MASK) % 255);
  ------------------
  |  |  264|  39.2M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  39.2M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  39.2M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1918|  40.8M|}
lz4hc.c:LZ4HC_FindLongestMatch:
 1926|  42.3M|{
 1927|  42.3M|    LZ4HC_match_t const match0 = { 0 , 0, 0 };
 1928|       |    /* note : LZ4HC_InsertAndGetWiderMatch() can extend a match backward (md.back < 0),
 1929|       |     * but not here, since iLowLimit == ip */
 1930|  42.3M|    LZ4HC_match_t md = LZ4HC_InsertAndGetWiderMatch(ctx, ip, ip, iHighLimit, MINMATCH-1, nbSearches, 1 /*patternAnalysis*/, 1 /*chainSwap*/, dict, favorDecSpeed);
  ------------------
  |  |  243|  42.3M|#define MINMATCH 4
  ------------------
 1931|  42.3M|    assert(md.back == 0);
  ------------------
  |  Branch (1931:5): [True: 0, False: 42.3M]
  |  Branch (1931:5): [True: 42.3M, False: 0]
  ------------------
 1932|  42.3M|    if (md.len < MINMATCH) return match0;
  ------------------
  |  |  243|  42.3M|#define MINMATCH 4
  ------------------
  |  Branch (1932:9): [True: 40.8M, False: 1.44M]
  ------------------
 1933|  1.44M|    if (favorDecSpeed) {
  ------------------
  |  Branch (1933:9): [True: 0, False: 1.44M]
  ------------------
 1934|      0|        if ((md.len>18) & (md.len<=36)) md.len=18;   /* favor dec.speed (shortcut) */
  ------------------
  |  Branch (1934:13): [True: 0, False: 0]
  ------------------
 1935|      0|    }
 1936|  1.44M|    return md;
 1937|  42.3M|}
lz4hc.c:LZ4HC_setLiteral:
 1941|  4.82M|{
 1942|  4.82M|    opt[pos].mlen = 1;
 1943|  4.82M|    opt[pos].off = 0;
 1944|  4.82M|    opt[pos].litlen = litlen;
 1945|  4.82M|    opt[pos].price = price;
 1946|  4.82M|    DEBUGLOG(7, "rPos:%3i => price:%3i (litlen=%i)", pos, price, litlen);
  ------------------
  |  |  290|  4.82M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1947|  4.82M|}
lz4hc.c:LZ4HC_literalsPrice:
 1886|   120M|{
 1887|   120M|    int price = litlen;
 1888|   120M|    assert(litlen >= 0);
  ------------------
  |  Branch (1888:5): [True: 0, False: 120M]
  |  Branch (1888:5): [True: 120M, False: 0]
  ------------------
 1889|   120M|    if (litlen >= (int)RUN_MASK)
  ------------------
  |  |  264|   120M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|   120M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|   120M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1889:9): [True: 1.71M, False: 118M]
  ------------------
 1890|  1.71M|        price += 1 + ((litlen-(int)RUN_MASK) / 255);
  ------------------
  |  |  264|  1.71M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  1.71M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  1.71M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1891|   120M|    return price * LZ4HC_PRICE_SCALE;
  ------------------
  |  | 1874|   120M|#define LZ4HC_PRICE_SCALE 4
  ------------------
 1892|   120M|}
lz4hc.c:LZ4HC_addMatch:
 1974|  1.41M|{
 1975|  1.41M|    int const ll = opt[cur].litlen;
 1976|  1.41M|    int const basePrice = LZ4HC_runStartPrice(opt, cur) + (favorDecSpeed ? LZ4HC_SEQ_PRICE_FDS : 0);
  ------------------
  |  | 1882|      0|#define LZ4HC_SEQ_PRICE_FDS    1
  ------------------
  |  Branch (1976:60): [True: 0, False: 1.41M]
  ------------------
 1977|  1.41M|    int ml;
 1978|  1.41M|    assert(cur + match.len < LZ4_OPT_NUM);
  ------------------
  |  Branch (1978:5): [True: 0, False: 1.41M]
  |  Branch (1978:5): [True: 1.41M, False: 0]
  ------------------
 1979|  1.41M|    assert((U32)favorDecSpeed <= 1);
  ------------------
  |  Branch (1979:5): [True: 0, False: 1.41M]
  |  Branch (1979:5): [True: 1.41M, False: 0]
  ------------------
 1980|   117M|    for (ml = MINMATCH; ml <= match.len; ml++) {
  ------------------
  |  |  243|  1.41M|#define MINMATCH 4
  ------------------
  |  Branch (1980:25): [True: 115M, False: 1.41M]
  ------------------
 1981|   115M|        int const pos = cur + ml;
 1982|   115M|        int const price = basePrice + LZ4HC_sequencePrice(ll, ml);
 1983|       |        /* on equal price, favorDecSpeed keeps the existing solution */
 1984|   115M|        if ( pos > lastPos + TRAILING_LITERALS
  ------------------
  |  | 1870|   231M|#define TRAILING_LITERALS 3
  ------------------
  |  Branch (1984:14): [True: 21.6M, False: 93.9M]
  ------------------
 1985|  93.9M|          || price <= opt[pos].price - (int)favorDecSpeed) {
  ------------------
  |  Branch (1985:14): [True: 5.48M, False: 88.5M]
  ------------------
 1986|  27.1M|            LZ4HC_setMatch(opt, pos, ml, match.off, price);
 1987|  27.1M|            if ((ml == match.len) && (lastPos < pos)) lastPos = pos;
  ------------------
  |  Branch (1987:17): [True: 1.01M, False: 26.0M]
  |  Branch (1987:38): [True: 968k, False: 48.1k]
  ------------------
 1988|  27.1M|    }   }
 1989|       |
 1990|       |    /* complete following positions with literals */
 1991|  1.41M|    {   int addLit;
 1992|  1.41M|        assert(opt[lastPos].mlen >= MINMATCH);
  ------------------
  |  Branch (1992:9): [True: 0, False: 1.41M]
  |  Branch (1992:9): [True: 1.41M, False: 0]
  ------------------
 1993|  5.65M|        for (addLit = 1; addLit <= TRAILING_LITERALS; addLit++)
  ------------------
  |  | 1870|  5.65M|#define TRAILING_LITERALS 3
  ------------------
  |  Branch (1993:26): [True: 4.24M, False: 1.41M]
  ------------------
 1994|  4.24M|            LZ4HC_setLiteral(opt, lastPos + addLit, addLit,
 1995|  4.24M|                             opt[lastPos].price + LZ4HC_literalsPrice(addLit));
 1996|  1.41M|    }
 1997|  1.41M|    return lastPos;
 1998|  1.41M|}
lz4hc.c:LZ4HC_runStartPrice:
 1962|  1.41M|{
 1963|  1.41M|    int const ll = opt[pos].litlen;
 1964|  1.41M|    return (ll <= pos) ? opt[pos - ll].price : 0;
  ------------------
  |  Branch (1964:12): [True: 1.18M, False: 225k]
  ------------------
 1965|  1.41M|}
lz4hc.c:LZ4HC_sequencePrice:
 1896|   115M|{
 1897|   115M|    int price = 1 + 2 ; /* token + 16-bit offset */
 1898|   115M|    assert(litlen >= 0);
  ------------------
  |  Branch (1898:5): [True: 0, False: 115M]
  |  Branch (1898:5): [True: 115M, False: 0]
  ------------------
 1899|   115M|    assert(mlen >= MINMATCH);
  ------------------
  |  Branch (1899:5): [True: 0, False: 115M]
  |  Branch (1899:5): [True: 115M, False: 0]
  ------------------
 1900|       |
 1901|   115M|    if (mlen >= (int)(ML_MASK+MINMATCH))
  ------------------
  |  |  262|   115M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   115M|#define ML_BITS  4
  |  |  ------------------
  ------------------
                  if (mlen >= (int)(ML_MASK+MINMATCH))
  ------------------
  |  |  243|   115M|#define MINMATCH 4
  ------------------
  |  Branch (1901:9): [True: 97.6M, False: 18.0M]
  ------------------
 1902|  97.6M|        price += 1 + ((mlen-(int)(ML_MASK+MINMATCH)) / 255);
  ------------------
  |  |  262|  97.6M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  97.6M|#define ML_BITS  4
  |  |  ------------------
  ------------------
                      price += 1 + ((mlen-(int)(ML_MASK+MINMATCH)) / 255);
  ------------------
  |  |  243|  97.6M|#define MINMATCH 4
  ------------------
 1903|       |
 1904|   115M|    return price * LZ4HC_PRICE_SCALE + LZ4HC_literalsPrice(litlen);
  ------------------
  |  | 1874|   115M|#define LZ4HC_PRICE_SCALE 4
  ------------------
 1905|   115M|}
lz4hc.c:LZ4HC_setMatch:
 1951|  27.1M|{
 1952|  27.1M|    opt[pos].mlen = mlen;
 1953|  27.1M|    opt[pos].off = off;
 1954|  27.1M|    opt[pos].litlen = 0;
 1955|  27.1M|    opt[pos].price = price;
 1956|  27.1M|    DEBUGLOG(7, "rPos:%3i => price:%3i (matchlen=%i)", pos, price, mlen);
  ------------------
  |  |  290|  27.1M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1957|  27.1M|}
lz4hc.c:LZ4HC_getCLevelParams:
  110|  14.0k|{
  111|       |    /* note : clevel convention is a bit different from lz4frame,
  112|       |     * possibly something worth revisiting for consistency */
  113|  14.0k|    if (cLevel < 1)
  ------------------
  |  Branch (113:9): [True: 0, False: 14.0k]
  ------------------
  114|      0|        cLevel = LZ4HC_CLEVEL_DEFAULT;
  ------------------
  |  |   48|      0|#define LZ4HC_CLEVEL_DEFAULT     9
  ------------------
  115|  14.0k|    cLevel = MIN(LZ4HC_CLEVEL_MAX, cLevel);
  ------------------
  |  |   81|  14.0k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (81:22): [True: 0, False: 14.0k]
  |  |  ------------------
  ------------------
  116|  14.0k|    return k_clTable[cLevel];
  117|  14.0k|}
lz4hc.c:LZ4HC_Insert:
  854|  95.3M|{
  855|  95.3M|    U16* const chainTable = hc4->chainTable;
  856|  95.3M|    U32* const hashTable  = hc4->hashTable;
  857|  95.3M|    const BYTE* const prefixPtr = hc4->prefixStart;
  858|  95.3M|    U32 const prefixIdx = hc4->dictLimit;
  859|  95.3M|    U32 const target = (U32)(ip - prefixPtr) + prefixIdx;
  860|  95.3M|    U32 idx = hc4->nextToUpdate;
  861|  95.3M|    assert(ip >= prefixPtr);
  ------------------
  |  Branch (861:5): [True: 0, False: 95.3M]
  |  Branch (861:5): [True: 95.3M, False: 0]
  ------------------
  862|  95.3M|    assert(target >= prefixIdx);
  ------------------
  |  Branch (862:5): [True: 0, False: 95.3M]
  |  Branch (862:5): [True: 95.3M, False: 0]
  ------------------
  863|       |
  864|   366M|    while (idx < target) {
  ------------------
  |  Branch (864:12): [True: 270M, False: 95.3M]
  ------------------
  865|   270M|        U32 const h = LZ4HC_hashPtr(prefixPtr+idx-prefixIdx);
  866|   270M|        size_t delta = idx - hashTable[h];
  867|   270M|        if (delta>LZ4_DISTANCE_MAX) delta = LZ4_DISTANCE_MAX;
  ------------------
  |  |  678|   270M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                      if (delta>LZ4_DISTANCE_MAX) delta = LZ4_DISTANCE_MAX;
  ------------------
  |  |  678|  26.0M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (867:13): [True: 26.0M, False: 244M]
  ------------------
  868|   270M|        DELTANEXTU16(chainTable, idx) = (U16)delta;
  ------------------
  |  |  229|   270M|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
  869|   270M|        hashTable[h] = idx;
  870|   270M|        idx++;
  871|   270M|    }
  872|       |
  873|  95.3M|    hc4->nextToUpdate = target;
  874|  95.3M|}

LLVMFuzzerTestOneInput:
   18|  7.07k|{
   19|  7.07k|    FUZZ_dataProducer_t *producer = FUZZ_dataProducer_create(data, size);
   20|  7.07k|    size_t const dstCapacitySeed = FUZZ_dataProducer_retrieve32(producer);
   21|  7.07k|    size_t const levelSeed = FUZZ_dataProducer_retrieve32(producer);
   22|  7.07k|    size = FUZZ_dataProducer_remainingBytes(producer);
   23|       |
   24|  7.07k|    size_t const dstCapacity = FUZZ_getRange_from_uint32(dstCapacitySeed, 0, size);
   25|  7.07k|    int const level = FUZZ_getRange_from_uint32(levelSeed, LZ4HC_CLEVEL_MIN, LZ4HC_CLEVEL_MAX);
  ------------------
  |  |   47|  7.07k|#define LZ4HC_CLEVEL_MIN         2
  ------------------
                  int const level = FUZZ_getRange_from_uint32(levelSeed, LZ4HC_CLEVEL_MIN, LZ4HC_CLEVEL_MAX);
  ------------------
  |  |   50|  7.07k|#define LZ4HC_CLEVEL_MAX        12
  ------------------
   26|       |
   27|  7.07k|    char* const dst = (char*)malloc(dstCapacity);
   28|  7.07k|    char* const rt = (char*)malloc(size);
   29|       |
   30|  7.07k|    FUZZ_ASSERT(dst);
  ------------------
  |  |   47|  7.07k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  7.07k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 7.07k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  7.07k|          : (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()))
  |  |  ------------------
  ------------------
   31|  7.07k|    FUZZ_ASSERT(rt);
  ------------------
  |  |   47|  7.07k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  7.07k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 7.07k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  7.07k|          : (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()))
  |  |  ------------------
  ------------------
   32|       |
   33|       |    /* If compression succeeds it must round trip correctly. */
   34|  7.07k|    {
   35|  7.07k|        int const dstSize = LZ4_compress_HC((const char*)data, dst, size,
   36|  7.07k|                                            dstCapacity, level);
   37|  7.07k|        if (dstSize > 0) {
  ------------------
  |  Branch (37:13): [True: 3.74k, False: 3.33k]
  ------------------
   38|  3.74k|            int const rtSize = LZ4_decompress_safe(dst, rt, dstSize, size);
   39|  3.74k|            FUZZ_ASSERT_MSG(rtSize == size, "Incorrect regenerated size");
  ------------------
  |  |   43|  3.74k|  ((cond) ? (void)0                                                            \
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 3.74k, False: 0]
  |  |  ------------------
  |  |   44|  3.74k|          : (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()))
  ------------------
   40|  3.74k|            FUZZ_ASSERT_MSG(!memcmp(data, rt, size), "Corruption!");
  ------------------
  |  |   43|  3.74k|  ((cond) ? (void)0                                                            \
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 3.74k, False: 0]
  |  |  ------------------
  |  |   44|  3.74k|          : (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()))
  ------------------
   41|  3.74k|        }
   42|  7.07k|    }
   43|       |
   44|  7.07k|    if (dstCapacity > 0) {
  ------------------
  |  Branch (44:9): [True: 7.04k, False: 29]
  ------------------
   45|       |        /* Compression succeeds and must round trip correctly. */
   46|  7.04k|        void* state = malloc(LZ4_sizeofStateHC());
   47|  7.04k|        FUZZ_ASSERT(state);
  ------------------
  |  |   47|  7.04k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  7.04k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 7.04k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  7.04k|          : (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()))
  |  |  ------------------
  ------------------
   48|  7.04k|        int compressedSize = size;
   49|  7.04k|        int const dstSize = LZ4_compress_HC_destSize(state, (const char*)data,
   50|  7.04k|                                                     dst, &compressedSize,
   51|  7.04k|                                                     dstCapacity, level);
   52|  7.04k|        FUZZ_ASSERT(dstSize > 0);
  ------------------
  |  |   47|  7.04k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  7.04k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 7.04k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  7.04k|          : (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|  7.04k|        int const rtSize = LZ4_decompress_safe(dst, rt, dstSize, size);
   54|  7.04k|        FUZZ_ASSERT_MSG(rtSize == compressedSize, "Incorrect regenerated size");
  ------------------
  |  |   43|  7.04k|  ((cond) ? (void)0                                                            \
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 7.04k, False: 0]
  |  |  ------------------
  |  |   44|  7.04k|          : (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()))
  ------------------
   55|  7.04k|        FUZZ_ASSERT_MSG(!memcmp(data, rt, compressedSize), "Corruption!");
  ------------------
  |  |   43|  7.04k|  ((cond) ? (void)0                                                            \
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 7.04k, False: 0]
  |  |  ------------------
  |  |   44|  7.04k|          : (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()))
  ------------------
   56|  7.04k|        free(state);
   57|  7.04k|    }
   58|       |
   59|  7.07k|    free(dst);
   60|  7.07k|    free(rt);
   61|  7.07k|    FUZZ_dataProducer_free(producer);
   62|       |
   63|  7.07k|    return 0;
   64|  7.07k|}

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

