lz4hc.c:LZ4_isAligned:
  292|  15.7k|{
  293|  15.7k|    return ((size_t)ptr & (alignment -1)) == 0;
  294|  15.7k|}
lz4hc.c:LZ4_count:
  720|   379M|{
  721|   379M|    const BYTE* const pStart = pIn;
  722|       |
  723|   379M|    if (likely(pIn < pInLimit-(STEPSIZE-1))) {
  ------------------
  |  |  177|   379M|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|   379M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 379M, False: 101k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  724|   379M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  725|   379M|        if (!diff) {
  ------------------
  |  Branch (725:13): [True: 99.5M, False: 279M]
  ------------------
  726|  99.5M|            pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  717|  99.5M|#define STEPSIZE sizeof(reg_t)
  ------------------
                          pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  717|  99.5M|#define STEPSIZE sizeof(reg_t)
  ------------------
  727|   279M|        } else {
  728|   279M|            return LZ4_NbCommonBytes(diff);
  729|   279M|    }   }
  730|       |
  731|  3.43G|    while (likely(pIn < pInLimit-(STEPSIZE-1))) {
  732|  3.43G|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  733|  3.43G|        if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  717|  3.33G|#define STEPSIZE sizeof(reg_t)
  ------------------
                      if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  717|  3.33G|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (733:13): [True: 3.33G, False: 98.9M]
  ------------------
  734|  98.9M|        pIn += LZ4_NbCommonBytes(diff);
  735|  98.9M|        return (unsigned)(pIn - pStart);
  736|  3.43G|    }
  737|       |
  738|   705k|    if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  |  717|   705k|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (738:9): [True: 705k, Folded]
  |  Branch (738:26): [True: 352k, False: 353k]
  |  Branch (738:48): [True: 295k, False: 57.0k]
  ------------------
  739|   705k|    if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (739:9): [True: 362k, False: 343k]
  |  Branch (739:31): [True: 303k, False: 58.6k]
  ------------------
  740|   705k|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (740:9): [True: 349k, False: 356k]
  |  Branch (740:27): [True: 290k, False: 59.1k]
  ------------------
  741|   705k|    return (unsigned)(pIn - pStart);
  742|  99.6M|}
lz4hc.c:LZ4_read_ARCH:
  394|  8.23G|static reg_t LZ4_read_ARCH(const void* ptr) { return ((const LZ4_unalignST*)ptr)->uArch; }
lz4hc.c:LZ4_NbCommonBytes:
  619|   677M|{
  620|   677M|    assert(val != 0);
  ------------------
  |  Branch (620:5): [True: 0, False: 677M]
  |  Branch (620:5): [True: 677M, False: 0]
  ------------------
  621|   677M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (621:9): [True: 677M, False: 0]
  ------------------
  622|   677M|        if (sizeof(val) == 8) {
  ------------------
  |  Branch (622:13): [True: 677M, Folded]
  ------------------
  623|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1800) && (defined(_M_AMD64) && !defined(_M_ARM64EC)) && !defined(LZ4_FORCE_SW_BITCOUNT)
  624|       |/*-*************************************************************************************************
  625|       |* ARM64EC is a Microsoft-designed ARM64 ABI compatible with AMD64 applications on ARM64 Windows 11.
  626|       |* The ARM64EC ABI does not support AVX/AVX2/AVX512 instructions, nor their relevant intrinsics
  627|       |* including _tzcnt_u64. Therefore, we need to neuter the _tzcnt_u64 code path for ARM64EC.
  628|       |****************************************************************************************************/
  629|       |#         if defined(__clang__) && (__clang_major__ < 10)
  630|       |            /* Avoid undefined clang-cl intrinsics issue.
  631|       |             * See https://github.com/lz4/lz4/pull/1017 for details. */
  632|       |            return (unsigned)__builtin_ia32_tzcnt_u64(val) >> 3;
  633|       |#         else
  634|       |            /* x64 CPUS without BMI support interpret `TZCNT` as `REP BSF` */
  635|       |            return (unsigned)_tzcnt_u64(val) >> 3;
  636|       |#         endif
  637|       |#       elif defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT)
  638|       |            unsigned long r = 0;
  639|       |            _BitScanForward64(&r, (U64)val);
  640|       |            return (unsigned)r >> 3;
  641|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  642|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  643|       |                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  644|       |            return (unsigned)__builtin_ctzll((U64)val) >> 3;
  645|       |#       else
  646|       |            const U64 m = 0x0101010101010101ULL;
  647|       |            val ^= val - 1;
  648|       |            return (unsigned)(((U64)((val & (m - 1)) * m)) >> 56);
  649|       |#       endif
  650|   677M|        } else /* 32 bits */ {
  651|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT)
  652|       |            unsigned long r;
  653|       |            _BitScanForward(&r, (U32)val);
  654|       |            return (unsigned)r >> 3;
  655|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  656|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  657|       |                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  658|       |            return (unsigned)__builtin_ctz((U32)val) >> 3;
  659|       |#       else
  660|       |            const U32 m = 0x01010101;
  661|       |            return (unsigned)((((val - 1) ^ val) & (m - 1)) * m) >> 24;
  662|       |#       endif
  663|      0|        }
  664|   677M|    } else   /* Big Endian CPU */ {
  665|      0|        if (sizeof(val)==8) {
  ------------------
  |  Branch (665:13): [True: 0, Folded]
  ------------------
  666|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  667|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  668|      0|                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  669|      0|            return (unsigned)__builtin_clzll((U64)val) >> 3;
  670|       |#       else
  671|       |#if 1
  672|       |            /* this method is probably faster,
  673|       |             * but adds a 128 bytes lookup table */
  674|       |            static const unsigned char ctz7_tab[128] = {
  675|       |                7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  676|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  677|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  678|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  679|       |                6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  680|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  681|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  682|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  683|       |            };
  684|       |            U64 const mask = 0x0101010101010101ULL;
  685|       |            U64 const t = (((val >> 8) - mask) | val) & mask;
  686|       |            return ctz7_tab[(t * 0x0080402010080402ULL) >> 57];
  687|       |#else
  688|       |            /* this method doesn't consume memory space like the previous one,
  689|       |             * but it contains several branches,
  690|       |             * that may end up slowing execution */
  691|       |            static const U32 by32 = sizeof(val)*4;  /* 32 on 64 bits (goal), 16 on 32 bits.
  692|       |            Just to avoid some static analyzer complaining about shift by 32 on 32-bits target.
  693|       |            Note that this code path is never triggered in 32-bits mode. */
  694|       |            unsigned r;
  695|       |            if (!(val>>by32)) { r=4; } else { r=0; val>>=by32; }
  696|       |            if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; }
  697|       |            r += (!val);
  698|       |            return r;
  699|       |#endif
  700|       |#       endif
  701|      0|        } else /* 32 bits */ {
  702|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  703|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  704|      0|                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  705|      0|            return (unsigned)__builtin_clz((U32)val) >> 3;
  706|       |#       else
  707|       |            val >>= 8;
  708|       |            val = ((((val + 0x00FFFF00) | 0x00FFFFFF) + val) |
  709|       |              (val + 0x00FF0000)) >> 24;
  710|       |            return (unsigned)val ^ 3;
  711|       |#       endif
  712|      0|        }
  713|      0|    }
  714|   677M|}
lz4hc.c:LZ4_isLittleEndian:
  363|   897M|{
  364|   897M|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  365|   897M|    return one.c[0];
  366|   897M|}
lz4hc.c:LZ4_read32:
  393|  6.70G|static U32 LZ4_read32(const void* ptr) { return ((const LZ4_unalign32*)ptr)->u32; }
lz4hc.c:LZ4_read16:
  392|  2.79G|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4hc.c:LZ4_wildCopy8:
  465|  9.02M|{
  466|  9.02M|    BYTE* d = (BYTE*)dstPtr;
  467|  9.02M|    const BYTE* s = (const BYTE*)srcPtr;
  468|  9.02M|    BYTE* const e = (BYTE*)dstEnd;
  469|       |
  470|  18.1M|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  348|  18.1M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (470:50): [True: 9.14M, False: 9.02M]
  ------------------
  471|  9.02M|}
lz4hc.c:LZ4_writeLE16:
  452|  9.02M|{
  453|  9.02M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (453:9): [True: 9.02M, False: 0]
  ------------------
  454|  9.02M|        LZ4_write16(memPtr, value);
  455|  9.02M|    } else {
  456|      0|        BYTE* p = (BYTE*)memPtr;
  457|      0|        p[0] = (BYTE) value;
  458|      0|        p[1] = (BYTE)(value>>8);
  459|      0|    }
  460|  9.02M|}
lz4hc.c:LZ4_write16:
  396|  9.02M|static void LZ4_write16(void* memPtr, U16 value) { ((LZ4_unalign16*)memPtr)->u16 = value; }
LZ4_compressBound:
  792|  23.5k|int LZ4_compressBound(int isize)  { return LZ4_COMPRESSBOUND(isize); }
  ------------------
  |  |  261|  23.5k|#define LZ4_COMPRESSBOUND(isize)  ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
  |  |  ------------------
  |  |  |  |  260|  23.5k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  |  |  ------------------
  |  |  |  Branch (261:36): [True: 0, False: 23.5k]
  |  |  ------------------
  ------------------
LZ4_compress_fast_extState_fastReset:
 1592|  3.69k|{
 1593|  3.69k|    LZ4_stream_t_internal* const ctx = &((LZ4_stream_t*)state)->internal_donotuse;
 1594|  3.69k|    acceleration = LZ4_clampAcceleration(acceleration);
 1595|  3.69k|    assert(ctx != NULL);
  ------------------
  |  Branch (1595:5): [True: 0, False: 3.69k]
  |  Branch (1595:5): [True: 3.69k, False: 0]
  ------------------
 1596|       |
 1597|  3.69k|    if (dstCapacity >= LZ4_compressBound(srcSize)) {
  ------------------
  |  Branch (1597:9): [True: 0, False: 3.69k]
  ------------------
 1598|      0|        return LZ4_compress_fastReset_generic(ctx, src, dst, srcSize, 0, notLimited, acceleration);
 1599|  3.69k|    } else {
 1600|  3.69k|        return LZ4_compress_fastReset_generic(ctx, src, dst, srcSize, dstCapacity, limitedOutput, acceleration);
 1601|  3.69k|    }
 1602|  3.69k|}
LZ4_initStream:
 1703|  8.33k|{
 1704|  8.33k|    DEBUGLOG(5, "LZ4_initStream");
  ------------------
  |  |  288|  8.33k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1705|  8.33k|    if (buffer == NULL) { return NULL; }
  ------------------
  |  Branch (1705:9): [True: 0, False: 8.33k]
  ------------------
 1706|  8.33k|    if (size < sizeof(LZ4_stream_t)) { return NULL; }
  ------------------
  |  Branch (1706:9): [True: 0, False: 8.33k]
  ------------------
 1707|  8.33k|    if (!LZ4_isAligned(buffer, LZ4_stream_t_alignment())) return NULL;
  ------------------
  |  Branch (1707:9): [True: 0, False: 8.33k]
  ------------------
 1708|  8.33k|    MEM_INIT(buffer, 0, sizeof(LZ4_stream_t_internal));
  ------------------
  |  |  235|  8.33k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  233|  8.33k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 1709|  8.33k|    return (LZ4_stream_t*)buffer;
 1710|  8.33k|}
LZ4_compress_fast_continue:
 1901|  7.66k|{
 1902|  7.66k|    const tableType_t tableType = byU32;
 1903|  7.66k|    LZ4_stream_t_internal* const streamPtr = &LZ4_stream->internal_donotuse;
 1904|  7.66k|    const char* dictEnd = streamPtr->dictSize ? (const char*)streamPtr->dictionary + streamPtr->dictSize : NULL;
  ------------------
  |  Branch (1904:27): [True: 4.61k, False: 3.05k]
  ------------------
 1905|       |
 1906|  7.66k|    DEBUGLOG(5, "LZ4_compress_fast_continue (inputSize=%i, dictSize=%u)", inputSize, streamPtr->dictSize);
  ------------------
  |  |  288|  7.66k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1907|       |
 1908|       |    /* new stream (no history) : clear the table beyond LZ4_CLEAR_TABLE_THRESHOLD */
 1909|  7.66k|    if ((streamPtr->dictSize == 0) && (streamPtr->dictCtx == NULL) && (inputSize >= LZ4_CLEAR_TABLE_THRESHOLD))
  ------------------
  |  |  950|  3.05k|#define LZ4_CLEAR_TABLE_THRESHOLD (LZ4_HASHTABLESIZE / 16)
  |  |  ------------------
  |  |  |  |  767|  3.05k|#define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|  3.05k|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  206|  3.05k|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1909:9): [True: 3.05k, False: 4.61k]
  |  Branch (1909:39): [True: 3.05k, False: 0]
  |  Branch (1909:71): [True: 1.35k, False: 1.69k]
  ------------------
 1910|  1.35k|        LZ4_prepareTable(streamPtr, inputSize, byU32);
 1911|       |
 1912|  7.66k|    LZ4_renormDictT(streamPtr, inputSize);   /* fix index overflow */
 1913|  7.66k|    acceleration = LZ4_clampAcceleration(acceleration);
 1914|       |
 1915|       |    /* invalidate tiny dictionaries */
 1916|  7.66k|    if ( (streamPtr->dictSize < 4)     /* tiny dictionary : not enough for a hash */
  ------------------
  |  Branch (1916:10): [True: 3.07k, False: 4.58k]
  ------------------
 1917|  3.07k|      && (dictEnd != source)           /* prefix mode */
  ------------------
  |  Branch (1917:10): [True: 3.05k, False: 22]
  ------------------
 1918|  3.05k|      && (inputSize > 0)               /* tolerance : don't lose history, in case next invocation would use prefix mode */
  ------------------
  |  Branch (1918:10): [True: 3.05k, False: 0]
  ------------------
 1919|  3.05k|      && (streamPtr->dictCtx == NULL)  /* usingDictCtx */
  ------------------
  |  Branch (1919:10): [True: 3.05k, False: 0]
  ------------------
 1920|  7.66k|      ) {
 1921|  3.05k|        DEBUGLOG(5, "LZ4_compress_fast_continue: dictSize(%u) at addr:%p is too small", streamPtr->dictSize, (void*)streamPtr->dictionary);
  ------------------
  |  |  288|  3.05k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1922|       |        /* remove dictionary existence from history, to employ faster prefix mode */
 1923|  3.05k|        streamPtr->dictSize = 0;
 1924|  3.05k|        streamPtr->dictionary = (const BYTE*)source;
 1925|  3.05k|        dictEnd = source;
 1926|  3.05k|    }
 1927|       |
 1928|       |    /* Check overlapping input/dictionary space */
 1929|  7.66k|    {   const char* const sourceEnd = source + inputSize;
 1930|  7.66k|        if ((sourceEnd > (const char*)streamPtr->dictionary) && (source < dictEnd)) {
  ------------------
  |  Branch (1930:13): [True: 5.96k, False: 1.70k]
  |  Branch (1930:65): [True: 0, False: 5.96k]
  ------------------
 1931|       |            /* only the part of the dictionary beyond input remains */
 1932|      0|            streamPtr->dictSize = (sourceEnd < dictEnd) ? (U32)(dictEnd - sourceEnd) : 0;
  ------------------
  |  Branch (1932:35): [True: 0, False: 0]
  ------------------
 1933|      0|            if (streamPtr->dictSize > 64 KB) streamPtr->dictSize = 64 KB;
  ------------------
  |  |  250|      0|#define KB *(1 <<10)
  ------------------
                          if (streamPtr->dictSize > 64 KB) streamPtr->dictSize = 64 KB;
  ------------------
  |  |  250|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (1933:17): [True: 0, False: 0]
  ------------------
 1934|      0|            if (streamPtr->dictSize < 4) streamPtr->dictSize = 0;
  ------------------
  |  Branch (1934:17): [True: 0, False: 0]
  ------------------
 1935|      0|            streamPtr->dictionary = (const BYTE*)dictEnd - streamPtr->dictSize;
 1936|      0|        }
 1937|  7.66k|    }
 1938|       |
 1939|       |    /* prefix mode : source data follows dictionary */
 1940|  7.66k|    if (dictEnd == source) {
  ------------------
  |  Branch (1940:9): [True: 5.25k, False: 2.41k]
  ------------------
 1941|  5.25k|        if (LZ4_isDictSmall(streamPtr))
  ------------------
  |  Branch (1941:13): [True: 0, False: 5.25k]
  ------------------
 1942|      0|            return LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, withPrefix64k, dictSmall, acceleration);
 1943|  5.25k|        if (inputSize >= LZ4_CLAMP_TABLE_THRESHOLD) {
  ------------------
  |  | 1882|  5.25k|#define LZ4_CLAMP_TABLE_THRESHOLD (LZ4_HASHTABLESIZE * 2)
  |  |  ------------------
  |  |  |  |  767|  5.25k|#define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|  5.25k|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  206|  5.25k|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1943:13): [True: 2.23k, False: 3.02k]
  ------------------
 1944|       |            /* history guaranteed present : the last 64 KB (lz4.h, LZ4_compress_fast_continue() Note 2) */
 1945|  2.23k|            U32 const lowIdx = streamPtr->currentOffset - ((streamPtr->dictSize < 64 KB) ? streamPtr->dictSize : 64 KB);
  ------------------
  |  |  250|  2.23k|#define KB *(1 <<10)
  ------------------
                          U32 const lowIdx = streamPtr->currentOffset - ((streamPtr->dictSize < 64 KB) ? streamPtr->dictSize : 64 KB);
  ------------------
  |  |  250|    961|#define KB *(1 <<10)
  ------------------
  |  Branch (1945:60): [True: 1.26k, False: 961]
  ------------------
 1946|  2.23k|            assert(streamPtr->dictSize <= streamPtr->currentOffset);
  ------------------
  |  Branch (1946:13): [True: 0, False: 2.23k]
  |  Branch (1946:13): [True: 2.23k, False: 0]
  ------------------
 1947|  2.23k|            if (lowIdx) LZ4_clampTable(streamPtr, lowIdx);
  ------------------
  |  Branch (1947:17): [True: 898, False: 1.33k]
  ------------------
 1948|  2.23k|            return LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, withPrefix64k, clampedTable, acceleration);
 1949|  2.23k|        }
 1950|  3.02k|        return LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, withPrefix64k, noDictIssue, acceleration);
 1951|  5.25k|    }
 1952|       |
 1953|       |    /* external dictionary mode */
 1954|  2.41k|    {   int result;
 1955|  2.41k|        if (streamPtr->dictCtx) {
  ------------------
  |  Branch (1955:13): [True: 0, False: 2.41k]
  ------------------
 1956|       |            /* We depend here on the fact that dictCtx'es (produced by
 1957|       |             * LZ4_loadDict) guarantee that their tables contain no references
 1958|       |             * to offsets between dictCtx->currentOffset - 64 KB and
 1959|       |             * dictCtx->currentOffset - dictCtx->dictSize. This makes it safe
 1960|       |             * to use noDictIssue even when the dict isn't a full 64 KB.
 1961|       |             */
 1962|      0|            if (inputSize >= LZ4_DICTCTX_COPY_THRESHOLD) {
  ------------------
  |  | 1877|      0|#define LZ4_DICTCTX_COPY_THRESHOLD ((LZ4_HASHTABLESIZE / 8 < 4 KB) ? (LZ4_HASHTABLESIZE / 8) : 4 KB)
  |  |  ------------------
  |  |  |  |  767|      0|#define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|      0|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  206|      0|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define LZ4_DICTCTX_COPY_THRESHOLD ((LZ4_HASHTABLESIZE / 8 < 4 KB) ? (LZ4_HASHTABLESIZE / 8) : 4 KB)
  |  |  ------------------
  |  |  |  |  250|      0|#define KB *(1 <<10)
  |  |  ------------------
  |  |               #define LZ4_DICTCTX_COPY_THRESHOLD ((LZ4_HASHTABLESIZE / 8 < 4 KB) ? (LZ4_HASHTABLESIZE / 8) : 4 KB)
  |  |  ------------------
  |  |  |  |  767|      0|#define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|      0|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  206|      0|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define LZ4_DICTCTX_COPY_THRESHOLD ((LZ4_HASHTABLESIZE / 8 < 4 KB) ? (LZ4_HASHTABLESIZE / 8) : 4 KB)
  |  |  ------------------
  |  |  |  |  250|      0|#define KB *(1 <<10)
  |  |  ------------------
  |  |  |  Branch (1877:37): [True: 0, Folded]
  |  |  ------------------
  ------------------
  |  Branch (1962:17): [True: 0, False: 0]
  ------------------
 1963|       |                /* For compressing large blobs, it is faster to pay the setup
 1964|       |                 * cost to copy the dictionary's tables into the active context,
 1965|       |                 * so that the compression loop is only looking into one table.
 1966|       |                 */
 1967|      0|                LZ4_memcpy(streamPtr, streamPtr->dictCtx, sizeof(*streamPtr));
  ------------------
  |  |  348|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 1968|      0|                result = LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingExtDict, noDictIssue, acceleration);
 1969|      0|            } else {
 1970|      0|                result = LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingDictCtx, noDictIssue, acceleration);
 1971|      0|            }
 1972|  2.41k|        } else {  /* external dictionary in the current context */
 1973|  2.41k|            if (LZ4_isDictSmall(streamPtr)) {
  ------------------
  |  Branch (1973:17): [True: 0, False: 2.41k]
  ------------------
 1974|      0|                result = LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingExtDict, dictSmall, acceleration);
 1975|  2.41k|            } else {
 1976|       |                result = LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingExtDict, noDictIssue, acceleration);
 1977|  2.41k|            }
 1978|  2.41k|        }
 1979|  2.41k|        streamPtr->dictionary = (const BYTE*)source;
 1980|  2.41k|        streamPtr->dictSize = (U32)inputSize;
 1981|  2.41k|        return result;
 1982|  7.66k|    }
 1983|  7.66k|}
LZ4_saveDict:
 2015|  3.94k|{
 2016|  3.94k|    LZ4_stream_t_internal* const dict = &LZ4_dict->internal_donotuse;
 2017|       |
 2018|  3.94k|    DEBUGLOG(5, "LZ4_saveDict : dictSize=%i, safeBuffer=%p", dictSize, (void*)safeBuffer);
  ------------------
  |  |  288|  3.94k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2019|       |
 2020|  3.94k|    if (dictSize < 0) dictSize = 0;   /* invalid : save nothing, like LZ4_saveDictHC() */
  ------------------
  |  Branch (2020:9): [True: 0, False: 3.94k]
  ------------------
 2021|  3.94k|    if ((U32)dictSize > 64 KB) { dictSize = 64 KB; } /* useless to define a dictionary > 64 KB */
  ------------------
  |  |  250|  3.94k|#define KB *(1 <<10)
  ------------------
                  if ((U32)dictSize > 64 KB) { dictSize = 64 KB; } /* useless to define a dictionary > 64 KB */
  ------------------
  |  |  250|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (2021:9): [True: 0, False: 3.94k]
  ------------------
 2022|  3.94k|    if ((U32)dictSize > dict->dictSize) { dictSize = (int)dict->dictSize; }
  ------------------
  |  Branch (2022:9): [True: 0, False: 3.94k]
  ------------------
 2023|       |
 2024|  3.94k|    if (safeBuffer == NULL) assert(dictSize == 0);
  ------------------
  |  Branch (2024:9): [True: 0, False: 3.94k]
  |  Branch (2024:29): [True: 0, False: 0]
  |  Branch (2024:29): [True: 0, False: 0]
  ------------------
 2025|  3.94k|    if (dictSize > 0) {
  ------------------
  |  Branch (2025:9): [True: 3.94k, False: 0]
  ------------------
 2026|  3.94k|        const BYTE* const previousDictEnd = dict->dictionary + dict->dictSize;
 2027|  3.94k|        assert(dict->dictionary);
  ------------------
  |  Branch (2027:9): [True: 0, False: 3.94k]
  |  Branch (2027:9): [True: 3.94k, False: 0]
  ------------------
 2028|  3.94k|        LZ4_memmove(safeBuffer, previousDictEnd - dictSize, (size_t)dictSize);
  ------------------
  |  |  356|  3.94k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2029|  3.94k|    }
 2030|       |
 2031|  3.94k|    dict->dictionary = (const BYTE*)safeBuffer;
 2032|  3.94k|    dict->dictSize = (U32)dictSize;
 2033|       |
 2034|  3.94k|    return dictSize;
 2035|  3.94k|}
LZ4_decompress_safe:
 2647|  30.0k|{
 2648|  30.0k|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2649|  30.0k|                                  decode_full_block, noDict,
 2650|  30.0k|                                  (BYTE*)dest, NULL, 0,
 2651|       |                                  complete_input, NULL);
 2652|  30.0k|}
LZ4_decompress_safe_withPrefix64k:
 2677|  14.0k|{
 2678|  14.0k|    return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
 2679|  14.0k|                                  decode_full_block, withPrefix64k,
 2680|  14.0k|                                  (BYTE*)dest - 64 KB, NULL, 0,
  ------------------
  |  |  250|  14.0k|#define KB *(1 <<10)
  ------------------
 2681|       |                                  complete_input, NULL);
 2682|  14.0k|}
LZ4_decompress_safe_forceExtDict:
 2727|  2.65k|{
 2728|  2.65k|    DEBUGLOG(5, "LZ4_decompress_safe_forceExtDict");
  ------------------
  |  |  288|  2.65k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2729|  2.65k|    return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
 2730|  2.65k|                                  decode_full_block, usingExtDict,
 2731|  2.65k|                                  (BYTE*)dest, (const BYTE*)dictStart, dictSize,
 2732|       |                                  complete_input, NULL);
 2733|  2.65k|}
LZ4_decompress_incomplete:
 2794|     15|{
 2795|     15|    const char* srcEnd = src;
 2796|     15|    int decodedSize;
 2797|     15|    if ((srcSizePtr == NULL) || (*srcSizePtr < 0) || (dictSize < 0)) return -1;
  ------------------
  |  Branch (2797:9): [True: 0, False: 15]
  |  Branch (2797:33): [True: 0, False: 15]
  |  Branch (2797:54): [True: 0, False: 15]
  ------------------
 2798|     15|    if ((*srcSizePtr == 0) || (dstCapacity == 0)) { *srcSizePtr = 0; return 0; }   /* nothing to decode yet */
  ------------------
  |  Branch (2798:9): [True: 0, False: 15]
  |  Branch (2798:31): [True: 0, False: 15]
  ------------------
 2799|     15|    if ((dictSize == 0) || (dictStart + dictSize == dst)) {
  ------------------
  |  Branch (2799:9): [True: 0, False: 15]
  |  Branch (2799:28): [True: 0, False: 15]
  ------------------
 2800|      0|        decodedSize = LZ4_decompress_incomplete_withPrefix(src, dst, *srcSizePtr, dstCapacity,
 2801|      0|                                                           (size_t)dictSize, &srcEnd);
 2802|     15|    } else {
 2803|     15|        decodedSize = LZ4_decompress_incomplete_extDict(src, dst, *srcSizePtr, dstCapacity,
 2804|     15|                                                        dictStart, (size_t)dictSize, &srcEnd);
 2805|     15|    }
 2806|     15|    if (decodedSize >= 0) *srcSizePtr = (int)(srcEnd - src);
  ------------------
  |  Branch (2806:9): [True: 15, False: 0]
  ------------------
 2807|     15|    return decodedSize;
 2808|     15|}
LZ4_decompress_safe_usingDict:
 2967|  52.0k|{
 2968|  52.0k|    if (dictSize < 0) return -1;
  ------------------
  |  Branch (2968:9): [True: 0, False: 52.0k]
  ------------------
 2969|  52.0k|    if (dictSize==0)
  ------------------
  |  Branch (2969:9): [True: 30.0k, False: 21.9k]
  ------------------
 2970|  30.0k|        return LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize);
 2971|  21.9k|    if (dictStart+dictSize == dest) {
  ------------------
  |  Branch (2971:9): [True: 19.3k, False: 2.65k]
  ------------------
 2972|  19.3k|        if (dictSize >= 64 KB - 1) {
  ------------------
  |  |  250|  19.3k|#define KB *(1 <<10)
  ------------------
  |  Branch (2972:13): [True: 14.0k, False: 5.31k]
  ------------------
 2973|  14.0k|            return LZ4_decompress_safe_withPrefix64k(source, dest, compressedSize, maxOutputSize);
 2974|  14.0k|        }
 2975|  19.3k|        assert(dictSize >= 0);
  ------------------
  |  Branch (2975:9): [True: 0, False: 5.31k]
  |  Branch (2975:9): [True: 5.31k, False: 0]
  ------------------
 2976|  5.31k|        return LZ4_decompress_safe_withSmallPrefix(source, dest, compressedSize, maxOutputSize, (size_t)dictSize);
 2977|  5.31k|    }
 2978|  21.9k|    assert(dictSize >= 0);
  ------------------
  |  Branch (2978:5): [True: 0, False: 2.65k]
  |  Branch (2978:5): [True: 2.65k, False: 0]
  ------------------
 2979|  2.65k|    return LZ4_decompress_safe_forceExtDict(source, dest, compressedSize, maxOutputSize, dictStart, (size_t)dictSize);
 2980|  2.65k|}
lz4.c:LZ4_clampAcceleration:
 1535|  11.3k|{
 1536|  11.3k|    if (acceleration < 1) return LZ4_ACCELERATION_DEFAULT;
  ------------------
  |  |  649|      0|#define LZ4_ACCELERATION_DEFAULT 1
  ------------------
  |  Branch (1536:9): [True: 0, False: 11.3k]
  ------------------
 1537|  11.3k|    if (acceleration > LZ4_ACCELERATION_MAX) return LZ4_ACCELERATION_MAX;
  ------------------
  |  |  650|  11.3k|#define LZ4_ACCELERATION_MAX 65537
  ------------------
                  if (acceleration > LZ4_ACCELERATION_MAX) return LZ4_ACCELERATION_MAX;
  ------------------
  |  |  650|      0|#define LZ4_ACCELERATION_MAX 65537
  ------------------
  |  Branch (1537:9): [True: 0, False: 11.3k]
  ------------------
 1538|  11.3k|    return acceleration;
 1539|  11.3k|}
lz4.c:LZ4_compress_fastReset_generic:
 1559|  3.69k|{
 1560|  3.69k|    if (srcSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1560:9): [True: 3.28k, False: 412]
  ------------------
 1561|  3.28k|        LZ4_prepareTable(ctx, srcSize, byU16);
 1562|  3.28k|        if (ctx->currentOffset) {  /* table re-used : stale entries must be rejected */
  ------------------
  |  Branch (1562:13): [True: 799, False: 2.48k]
  ------------------
 1563|    799|            return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, dstCapacity, outputDirective, byU16, noDict, dictSmall, acceleration);
 1564|  2.48k|        } else {
 1565|  2.48k|            return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, dstCapacity, outputDirective, byU16, noDict, noDictIssue, acceleration);
 1566|  2.48k|        }
 1567|  3.28k|    } else {
 1568|    412|        const tableType_t tableType = LZ4_largeInputTableType(src);
 1569|    412|        LZ4_prepareTable(ctx, srcSize, tableType);
 1570|       |        return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, dstCapacity, outputDirective, tableType, noDict, noDictIssue, acceleration);
 1571|    412|    }
 1572|  3.69k|}
lz4.c:LZ4_largeInputTableType:
 1545|    412|{
 1546|    412|    (void)src;   /* unused on 64-bit systems */
 1547|    412|    return ((sizeof(void*)==4) && ((uptrval)src > LZ4_DISTANCE_MAX)) ? byPtr : byU32;
  ------------------
  |  |  745|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1547:13): [Folded, False: 412]
  |  Branch (1547:35): [True: 0, False: 0]
  ------------------
 1548|    412|}
lz4.c:LZ4_isAligned:
  292|  8.33k|{
  293|  8.33k|    return ((size_t)ptr & (alignment -1)) == 0;
  294|  8.33k|}
lz4.c:LZ4_stream_t_alignment:
 1693|  8.33k|{
 1694|  8.33k|#if LZ4_ALIGN_TEST
 1695|  8.33k|    typedef struct { char c; LZ4_stream_t t; } t_a;
 1696|  8.33k|    return sizeof(t_a) - sizeof(LZ4_stream_t);
 1697|       |#else
 1698|       |    return 1;  /* effectively disabled */
 1699|       |#endif
 1700|  8.33k|}
lz4.c:LZ4_prepareTable:
  955|  5.05k|           const tableType_t tableType) {
  956|       |    /* If the table hasn't been used, it's guaranteed to be zeroed out, and is
  957|       |     * therefore safe to use no matter what mode we're in. Otherwise, we figure
  958|       |     * out if it's safe to leave as is or whether it needs to be reset.
  959|       |     */
  960|  5.05k|    if ((tableType_t)cctx->tableType != clearedTable) {
  ------------------
  |  Branch (960:9): [True: 1.47k, False: 3.58k]
  ------------------
  961|  1.47k|        assert(inputSize >= 0);
  ------------------
  |  Branch (961:9): [True: 0, False: 1.47k]
  |  Branch (961:9): [True: 1.47k, False: 0]
  ------------------
  962|  1.47k|        if ((tableType_t)cctx->tableType != tableType
  ------------------
  |  Branch (962:13): [True: 8, False: 1.46k]
  ------------------
  963|  1.46k|          || ((tableType == byU16) && cctx->currentOffset + (unsigned)inputSize >= 0xFFFFU)
  ------------------
  |  Branch (963:15): [True: 1.34k, False: 119]
  |  Branch (963:39): [True: 497, False: 846]
  ------------------
  964|    965|          || ((tableType == byU32) && cctx->currentOffset > 1 GB)
  ------------------
  |  |  252|    119|#define GB *(1U<<30)
  ------------------
  |  Branch (964:15): [True: 119, False: 846]
  |  Branch (964:39): [True: 0, False: 119]
  ------------------
  965|    965|          || tableType == byPtr
  ------------------
  |  Branch (965:14): [True: 0, False: 965]
  ------------------
  966|    965|          || inputSize >= LZ4_CLEAR_TABLE_THRESHOLD)
  ------------------
  |  |  950|    965|#define LZ4_CLEAR_TABLE_THRESHOLD (LZ4_HASHTABLESIZE / 16)
  |  |  ------------------
  |  |  |  |  767|    965|#define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|    965|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  206|    965|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (966:14): [True: 166, False: 799]
  ------------------
  967|    671|        {
  968|    671|            DEBUGLOG(4, "LZ4_prepareTable: Resetting table in %p", (void*)cctx);
  ------------------
  |  |  288|    671|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  969|    671|            MEM_INIT(cctx->hashTable, 0, LZ4_HASHTABLESIZE);
  ------------------
  |  |  235|    671|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  233|    671|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  970|    671|            cctx->currentOffset = 0;
  971|    671|            cctx->tableType = (U32)clearedTable;
  972|    799|        } else {
  973|    799|            DEBUGLOG(4, "LZ4_prepareTable: Re-use hash table (no reset)");
  ------------------
  |  |  288|    799|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  974|    799|        }
  975|  1.47k|    }
  976|       |
  977|       |    /* Adding a gap, so all previous entries are > LZ4_DISTANCE_MAX back,
  978|       |     * is faster than compressing without a gap.
  979|       |     * However, compressing with currentOffset == 0 is faster still,
  980|       |     * so we preserve that case.
  981|       |     */
  982|  5.05k|    if (cctx->currentOffset != 0 && tableType == byU32) {
  ------------------
  |  Branch (982:9): [True: 799, False: 4.25k]
  |  Branch (982:37): [True: 0, False: 799]
  ------------------
  983|      0|        DEBUGLOG(5, "LZ4_prepareTable: adding 64KB to currentOffset");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  984|      0|        cctx->currentOffset += 64 KB;
  ------------------
  |  |  250|      0|#define KB *(1 <<10)
  ------------------
  985|      0|    }
  986|       |
  987|       |    /* Finally, clear history */
  988|  5.05k|    cctx->dictCtx = NULL;
  989|       |    cctx->dictionary = NULL;
  990|  5.05k|    cctx->dictSize = 0;
  991|  5.05k|}
lz4.c:LZ4_hashPosition:
  865|  45.0M|{
  866|  45.0M|    if ((sizeof(reg_t)==8) && (tableType != byU16)) return LZ4_hash5(LZ4_read_ARCH(p), tableType);
  ------------------
  |  Branch (866:9): [True: 45.0M, Folded]
  |  Branch (866:31): [True: 39.1M, False: 5.94M]
  ------------------
  867|       |
  868|       |#ifdef LZ4_STATIC_LINKING_ONLY_ENDIANNESS_INDEPENDENT_OUTPUT
  869|       |    return LZ4_hash4(LZ4_readLE32(p), tableType);
  870|       |#else
  871|  5.94M|    return LZ4_hash4(LZ4_read32(p), tableType);
  872|  45.0M|#endif
  873|  45.0M|}
lz4.c:LZ4_hash5:
  853|  39.1M|{
  854|  39.1M|    const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  766|      0|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  201|      0|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  206|      0|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  766|  78.2M|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  201|  39.1M|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  206|  39.1M|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (854:25): [True: 0, False: 39.1M]
  ------------------
  855|  39.1M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (855:9): [True: 39.1M, False: 0]
  ------------------
  856|  39.1M|        const U64 prime5bytes = 889523592379ULL;
  857|  39.1M|        return (U32)(((sequence << 24) * prime5bytes) >> (64 - hashLog));
  858|  39.1M|    } else {
  859|      0|        const U64 prime8bytes = 11400714785074694791ULL;
  860|      0|        return (U32)(((sequence >> 24) * prime8bytes) >> (64 - hashLog));
  861|      0|    }
  862|  39.1M|}
lz4.c:LZ4_isLittleEndian:
  363|  85.9M|{
  364|  85.9M|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  365|  85.9M|    return one.c[0];
  366|  85.9M|}
lz4.c:LZ4_read_ARCH:
  394|   145M|static reg_t LZ4_read_ARCH(const void* ptr) { return ((const LZ4_unalignST*)ptr)->uArch; }
lz4.c:LZ4_hash4:
  847|  5.94M|{
  848|  5.94M|    const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  766|  5.94M|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  201|  5.94M|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  206|  5.94M|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  766|  5.94M|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  201|      0|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  206|      0|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (848:25): [True: 5.94M, False: 0]
  ------------------
  849|  5.94M|    return ((sequence * 2654435761U) >> ((MINMATCH*8)-hashLog));
  ------------------
  |  |  241|  5.94M|#define MINMATCH 4
  ------------------
  850|  5.94M|}
lz4.c:LZ4_read32:
  393|  66.3M|static U32 LZ4_read32(const void* ptr) { return ((const LZ4_unalign32*)ptr)->u32; }
lz4.c:LZ4_putIndexOnHash:
  888|  41.1M|{
  889|  41.1M|    switch (tableType)
  890|  41.1M|    {
  891|      0|    default: /* fallthrough */
  ------------------
  |  Branch (891:5): [True: 0, False: 41.1M]
  ------------------
  892|      0|    case clearedTable: /* fallthrough */
  ------------------
  |  Branch (892:5): [True: 0, False: 41.1M]
  ------------------
  893|      0|    case byPtr: { /* illegal! */ assert(0); return; }
  ------------------
  |  Branch (893:5): [True: 0, False: 41.1M]
  |  Branch (893:34): [Folded, False: 0]
  |  Branch (893:34): [Folded, False: 0]
  ------------------
  894|  35.5M|    case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = idx; return; }
  ------------------
  |  Branch (894:5): [True: 35.5M, False: 5.55M]
  ------------------
  895|  5.55M|    case byU16: { U16* hashTable = (U16*) tableBase; assert(idx < 65536); hashTable[h] = (U16)idx; return; }
  ------------------
  |  Branch (895:5): [True: 5.55M, False: 35.5M]
  |  Branch (895:54): [True: 0, False: 5.55M]
  |  Branch (895:54): [True: 5.55M, False: 0]
  ------------------
  896|  41.1M|    }
  897|  41.1M|}
lz4.c:LZ4_getIndexOnHash:
  927|  39.8M|{
  928|  39.8M|    LZ4_STATIC_ASSERT(LZ4_MEMORY_USAGE > 2);
  ------------------
  |  |  276|  39.8M|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
  929|  39.8M|    if (tableType == byU32) {
  ------------------
  |  Branch (929:9): [True: 34.4M, False: 5.44M]
  ------------------
  930|  34.4M|        const U32* const hashTable = (const U32*) tableBase;
  931|  34.4M|        assert(h < (1U << (LZ4_MEMORY_USAGE-2)));
  ------------------
  |  Branch (931:9): [True: 0, False: 34.4M]
  |  Branch (931:9): [True: 34.4M, False: 0]
  ------------------
  932|  34.4M|        return hashTable[h];
  933|  34.4M|    }
  934|  5.44M|    if (tableType == byU16) {
  ------------------
  |  Branch (934:9): [True: 5.44M, False: 0]
  ------------------
  935|  5.44M|        const U16* const hashTable = (const U16*) tableBase;
  936|  5.44M|        assert(h < (1U << (LZ4_MEMORY_USAGE-1)));
  ------------------
  |  Branch (936:9): [True: 0, False: 5.44M]
  |  Branch (936:9): [True: 5.44M, False: 0]
  ------------------
  937|  5.44M|        return hashTable[h];
  938|  5.44M|    }
  939|  5.44M|    assert(0); return 0;  /* forbidden case */
  ------------------
  |  Branch (939:5): [Folded, False: 0]
  |  Branch (939:5): [Folded, False: 0]
  ------------------
  940|      0|}
lz4.c:LZ4_renormDictT:
 1848|  7.66k|{
 1849|  7.66k|    assert(nextSize >= 0);
  ------------------
  |  Branch (1849:5): [True: 0, False: 7.66k]
  |  Branch (1849:5): [True: 7.66k, False: 0]
  ------------------
 1850|  7.66k|    if (LZ4_dict->currentOffset + (unsigned)nextSize > 0x80000000) {   /* potential ptrdiff_t overflow (32-bits mode) */
  ------------------
  |  Branch (1850:9): [True: 0, False: 7.66k]
  ------------------
 1851|       |        /* rescale hash table */
 1852|      0|        U32 const delta = LZ4_dict->currentOffset - 64 KB;
  ------------------
  |  |  250|      0|#define KB *(1 <<10)
  ------------------
 1853|      0|        const BYTE* dictEnd = LZ4_dict->dictionary + LZ4_dict->dictSize;
 1854|      0|        int i;
 1855|      0|        DEBUGLOG(4, "LZ4_renormDictT");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1856|      0|        for (i=0; i<LZ4_HASH_SIZE_U32; i++) {
  ------------------
  |  |  768|      0|#define LZ4_HASH_SIZE_U32 (1 << LZ4_HASHLOG)       /* required as macro for static allocation */
  |  |  ------------------
  |  |  |  |  766|      0|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|      0|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  206|      0|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1856:19): [True: 0, False: 0]
  ------------------
 1857|      0|            if (LZ4_dict->hashTable[i] < delta) LZ4_dict->hashTable[i]=0;
  ------------------
  |  Branch (1857:17): [True: 0, False: 0]
  ------------------
 1858|      0|            else LZ4_dict->hashTable[i] -= delta;
 1859|      0|        }
 1860|      0|        LZ4_dict->currentOffset = 64 KB;
  ------------------
  |  |  250|      0|#define KB *(1 <<10)
  ------------------
 1861|      0|        if (LZ4_dict->dictSize > 64 KB) LZ4_dict->dictSize = 64 KB;
  ------------------
  |  |  250|      0|#define KB *(1 <<10)
  ------------------
                      if (LZ4_dict->dictSize > 64 KB) LZ4_dict->dictSize = 64 KB;
  ------------------
  |  |  250|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (1861:13): [True: 0, False: 0]
  ------------------
 1862|      0|        LZ4_dict->dictionary = dictEnd - LZ4_dict->dictSize;
 1863|      0|    }
 1864|  7.66k|}
lz4.c:LZ4_isDictSmall:
 1870|  7.66k|{
 1871|  7.66k|    return (streamPtr->dictSize < 64 KB) && (streamPtr->dictSize < streamPtr->currentOffset);
  ------------------
  |  |  250|  7.66k|#define KB *(1 <<10)
  ------------------
  |  Branch (1871:12): [True: 3.55k, False: 4.10k]
  |  Branch (1871:45): [True: 0, False: 3.55k]
  ------------------
 1872|  7.66k|}
lz4.c:LZ4_compress_generic:
 1482|  11.3k|{
 1483|  11.3k|    DEBUGLOG(5, "LZ4_compress_generic: srcSize=%i, dstCapacity=%i",
  ------------------
  |  |  288|  11.3k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1484|  11.3k|                srcSize, dstCapacity);
 1485|       |
 1486|  11.3k|    if ((U32)srcSize > (U32)LZ4_MAX_INPUT_SIZE) { return 0; }  /* Unsupported srcSize, too large (or negative) */
  ------------------
  |  |  260|  11.3k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  ------------------
  |  Branch (1486:9): [True: 0, False: 11.3k]
  ------------------
 1487|  11.3k|    if (outputDirective != notLimited && dstCapacity <= 0) return 0;  /* no room, or negative capacity : nothing can be written */
  ------------------
  |  Branch (1487:9): [True: 11.3k, False: 0]
  |  Branch (1487:42): [True: 0, False: 11.3k]
  ------------------
 1488|  11.3k|    if ((sizeof(void*) == 4) && (outputDirective != notLimited)) {
  ------------------
  |  Branch (1488:9): [Folded, False: 11.3k]
  |  Branch (1488:33): [True: 0, False: 0]
  ------------------
 1489|       |        /* output checks compare op + length with olimit, and op + length stays below dst + LZ4_compressBound(srcSize).
 1490|       |         * With 32-bit pointers, this sum can pass the end of the address space (dst near its top, such as a stack buffer) :
 1491|       |         * then fail (limitedOutput), or compress less (fillOutput) */
 1492|      0|        size_t const room = (size_t)0 - (uptrval)dst;   /* up to the top of the address space */
 1493|      0|        if (room < (size_t)LZ4_COMPRESSBOUND(srcSize)) {
  ------------------
  |  |  261|      0|#define LZ4_COMPRESSBOUND(isize)  ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
  |  |  ------------------
  |  |  |  |  260|      0|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  |  |  ------------------
  |  |  |  Branch (261:36): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1493:13): [True: 0, False: 0]
  ------------------
 1494|      0|            if ((outputDirective == limitedOutput) || (room < 16)) return 0;
  ------------------
  |  Branch (1494:17): [True: 0, False: 0]
  |  Branch (1494:55): [True: 0, False: 0]
  ------------------
 1495|      0|            srcSize = (int)((room - 16) / 256 * 255);   /* LZ4_compressBound(srcSize) <= room */
 1496|      0|        }
 1497|      0|    }
 1498|  11.3k|    if (srcSize == 0) {   /* src == NULL supported if srcSize == 0 */
  ------------------
  |  Branch (1498:9): [True: 0, False: 11.3k]
  ------------------
 1499|      0|        DEBUGLOG(5, "Generating an empty block");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1500|      0|        assert(dst != NULL);
  ------------------
  |  Branch (1500:9): [True: 0, False: 0]
  |  Branch (1500:9): [True: 0, False: 0]
  ------------------
 1501|      0|        dst[0] = 0;
 1502|      0|        if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1502:13): [True: 0, False: 0]
  ------------------
 1503|      0|            assert (inputConsumed != NULL);
  ------------------
  |  Branch (1503:13): [True: 0, False: 0]
  |  Branch (1503:13): [True: 0, False: 0]
  ------------------
 1504|      0|            *inputConsumed = 0;
 1505|      0|        }
 1506|      0|        return 1;
 1507|      0|    }
 1508|  11.3k|    assert(src != NULL);
  ------------------
  |  Branch (1508:5): [True: 0, False: 11.3k]
  |  Branch (1508:5): [True: 11.3k, False: 0]
  ------------------
 1509|       |
 1510|  11.3k|    if ((dictDirective == usingExtDict) && (dictIssue == noDictIssue)) {
  ------------------
  |  Branch (1510:9): [True: 2.41k, False: 8.94k]
  |  Branch (1510:44): [True: 2.41k, False: 0]
  ------------------
 1511|       |        /* beyond LZ4_DISTANCE_MAX, the dictionary is out of reach : the rest of the input is compressed in prefix mode */
 1512|  2.41k|        LZ4_resume_t state;
 1513|  2.41k|        int result;
 1514|  2.41k|        assert(tableType == byU32);
  ------------------
  |  Branch (1514:9): [True: 0, False: 2.41k]
  |  Branch (1514:9): [True: 2.41k, False: 0]
  ------------------
 1515|  2.41k|        assert(outputDirective != fillOutput);
  ------------------
  |  Branch (1515:9): [True: 0, False: 2.41k]
  |  Branch (1515:9): [True: 2.41k, False: 0]
  ------------------
 1516|  2.41k|        state.ip = NULL;
 1517|  2.41k|        result = LZ4_compress_generic_validated(cctx, src, dst, srcSize, inputConsumed, dstCapacity, outputDirective,
 1518|  2.41k|                    tableType, usingExtDict, noDictIssue, acceleration, &state, NULL);
 1519|  2.41k|        if (state.ip == NULL) return result;   /* completed (or failed) in extDict mode */
  ------------------
  |  Branch (1519:13): [True: 1.82k, False: 590]
  ------------------
 1520|       |        /* notLimited : dst is presumed large enough for LZ4_compressBound() */
 1521|    590|        return LZ4_compress_resumeWithPrefix(cctx, src, dst, srcSize,
 1522|    590|                    (outputDirective == notLimited) ? LZ4_COMPRESSBOUND(srcSize) : dstCapacity,
  ------------------
  |  |  261|      0|#define LZ4_COMPRESSBOUND(isize)  ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
  |  |  ------------------
  |  |  |  |  260|      0|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  |  |  ------------------
  |  |  |  Branch (261:36): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1522:21): [True: 0, False: 590]
  ------------------
 1523|    590|                    acceleration, &state);
 1524|  2.41k|    }
 1525|       |
 1526|  8.94k|    return LZ4_compress_generic_validated(cctx, src, dst, srcSize,
 1527|  8.94k|                inputConsumed, /* only written into if outputDirective == fillOutput */
 1528|  8.94k|                dstCapacity, outputDirective,
 1529|  8.94k|                tableType, dictDirective, dictIssue, acceleration, NULL, NULL);
 1530|  11.3k|}
lz4.c:LZ4_compress_generic_validated:
 1028|  11.9k|{
 1029|  11.9k|    int result;
 1030|  11.9k|    const BYTE* ip = resume ? resume->ip : (const BYTE*)source;
  ------------------
  |  Branch (1030:22): [True: 590, False: 11.3k]
  ------------------
 1031|       |
 1032|  11.9k|    U32 const startIndex = resume ? resume->startIndex : cctx->currentOffset;
  ------------------
  |  Branch (1032:28): [True: 590, False: 11.3k]
  ------------------
 1033|  11.9k|    const BYTE* base = (const BYTE*)source - startIndex;
 1034|  11.9k|    const BYTE* lowLimit;
 1035|       |
 1036|  11.9k|    const LZ4_stream_t_internal* dictCtx = (const LZ4_stream_t_internal*) cctx->dictCtx;
 1037|  11.9k|    const BYTE* const dictionary =
 1038|  11.9k|        dictDirective == usingDictCtx ? dictCtx->dictionary : cctx->dictionary;
  ------------------
  |  Branch (1038:9): [True: 0, False: 11.9k]
  ------------------
 1039|  11.9k|    const U32 dictSize =
 1040|  11.9k|        dictDirective == usingDictCtx ? dictCtx->dictSize : cctx->dictSize;
  ------------------
  |  Branch (1040:9): [True: 0, False: 11.9k]
  ------------------
 1041|  11.9k|    const U32 dictDelta =
 1042|  11.9k|        (dictDirective == usingDictCtx) ? startIndex - dictCtx->currentOffset : 0;   /* make indexes in dictCtx comparable with indexes in current context */
  ------------------
  |  Branch (1042:9): [True: 0, False: 11.9k]
  ------------------
 1043|       |
 1044|  11.9k|    int const maybe_extMem = (dictDirective == usingExtDict) || (dictDirective == usingDictCtx);
  ------------------
  |  Branch (1044:30): [True: 2.41k, False: 9.53k]
  |  Branch (1044:65): [True: 0, False: 9.53k]
  ------------------
 1045|  11.9k|    int const compareFirst = (dictDirective == noDict) || (dictIssue == clampedTable);   /* every candidate is readable */
  ------------------
  |  Branch (1045:30): [True: 3.69k, False: 8.25k]
  |  Branch (1045:59): [True: 2.23k, False: 6.02k]
  ------------------
 1046|  11.9k|    U32 const prefixIdxLimit = startIndex - dictSize;   /* used when dictDirective == dictSmall */
 1047|  11.9k|    const BYTE* const dictEnd = dictionary ? dictionary + dictSize : dictionary;
  ------------------
  |  Branch (1047:33): [True: 8.25k, False: 3.69k]
  ------------------
 1048|  11.9k|    const BYTE* anchor = resume ? resume->ip : (const BYTE*)source;
  ------------------
  |  Branch (1048:26): [True: 590, False: 11.3k]
  ------------------
 1049|  11.9k|    const BYTE* const iend = (const BYTE*)source + inputSize;
 1050|  11.9k|    const BYTE* mflimitPlusOne;   /* set after the size check : would precede a small input */
 1051|  11.9k|    const BYTE* matchlimit;
 1052|  11.9k|    const BYTE* seqLimit;   /* suspend : mflimitPlusOne, or earlier, where the dictionary gets out of reach */
 1053|       |
 1054|       |    /* the dictCtx currentOffset is indexed on the start of the dictionary,
 1055|       |     * while a dictionary in the current context precedes the currentOffset */
 1056|  11.9k|    const BYTE* dictBase = (dictionary == NULL) ? NULL :
  ------------------
  |  Branch (1056:28): [True: 3.69k, False: 8.25k]
  ------------------
 1057|  11.9k|                           (dictDirective == usingDictCtx) ?
  ------------------
  |  Branch (1057:28): [True: 0, False: 8.25k]
  ------------------
 1058|      0|                            dictionary + dictSize - dictCtx->currentOffset :
 1059|  8.25k|                            dictionary + dictSize - startIndex;
 1060|       |
 1061|  11.9k|    BYTE* op = resume ? resume->op : (BYTE*)dest;
  ------------------
  |  Branch (1061:16): [True: 590, False: 11.3k]
  ------------------
 1062|  11.9k|    BYTE* const olimit = (BYTE*)dest + maxOutputSize;
 1063|       |
 1064|  11.9k|    U32 offset = 0;
 1065|  11.9k|    U32 forwardH;
 1066|  11.9k|    const BYTE* filledIp = NULL;   /* fillOutput only ; set by catch up (resume : never with fillOutput) */
 1067|       |
 1068|  11.9k|    DEBUGLOG(5, "LZ4_compress_generic_validated: srcSize=%i, tableType=%u", inputSize, tableType);
  ------------------
  |  |  288|  11.9k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1069|  11.9k|    assert(ip != NULL);
  ------------------
  |  Branch (1069:5): [True: 0, False: 11.9k]
  |  Branch (1069:5): [True: 11.9k, False: 0]
  ------------------
 1070|  11.9k|    if (tableType == byU16) assert(inputSize<LZ4_64Klimit);  /* Size too large (not within 64K limit) */
  ------------------
  |  Branch (1070:9): [True: 3.28k, False: 8.66k]
  |  Branch (1070:29): [True: 0, False: 3.28k]
  |  Branch (1070:29): [True: 3.28k, False: 0]
  ------------------
 1071|  11.9k|    if (tableType == byPtr) assert(dictDirective==noDict);   /* only supported use case with byPtr */
  ------------------
  |  Branch (1071:9): [True: 0, False: 11.9k]
  |  Branch (1071:29): [True: 0, False: 0]
  |  Branch (1071:29): [True: 0, False: 0]
  ------------------
 1072|  11.9k|    assert(outputDirective == notLimited || maxOutputSize >= 1);   /* checked by LZ4_compress_generic() */
  ------------------
  |  Branch (1072:5): [True: 11.9k, False: 0]
  |  Branch (1072:5): [True: 0, False: 0]
  |  Branch (1072:5): [True: 0, False: 11.9k]
  |  Branch (1072:5): [True: 11.9k, False: 0]
  ------------------
 1073|  11.9k|    assert(acceleration >= 1);
  ------------------
  |  Branch (1073:5): [True: 0, False: 11.9k]
  |  Branch (1073:5): [True: 11.9k, False: 0]
  ------------------
 1074|       |
 1075|       |    /* resume : candidates are within source (see LZ4_compress_generic()) */
 1076|  11.9k|    lowLimit = (const BYTE*)source - ((dictDirective == withPrefix64k) && !resume ? dictSize : 0);
  ------------------
  |  Branch (1076:39): [True: 5.84k, False: 6.10k]
  |  Branch (1076:75): [True: 5.25k, False: 590]
  ------------------
 1077|       |
 1078|  11.9k|    if (!resume) {   /* resume : context state already updated */
  ------------------
  |  Branch (1078:9): [True: 11.3k, False: 590]
  ------------------
 1079|       |        /* Update context state */
 1080|  11.3k|        if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1080:13): [True: 0, False: 11.3k]
  ------------------
 1081|       |            /* Subsequent linked blocks can't use the dictionary. */
 1082|       |            /* Instead, they use the block we just compressed. */
 1083|      0|            cctx->dictCtx = NULL;
 1084|      0|            cctx->dictSize = (U32)inputSize;
 1085|  11.3k|        } else {
 1086|  11.3k|            cctx->dictSize += (U32)inputSize;
 1087|  11.3k|        }
 1088|  11.3k|        cctx->currentOffset += (U32)inputSize;
 1089|  11.3k|        cctx->tableType = (U32)tableType;
 1090|       |
 1091|  11.3k|        if (inputSize<LZ4_minLength) goto _last_literals;        /* Input too small, no compression (all literals) */
  ------------------
  |  Branch (1091:13): [True: 934, False: 10.4k]
  ------------------
 1092|  11.3k|    }
 1093|  11.0k|    mflimitPlusOne = iend - MFLIMIT + 1;
  ------------------
  |  |  245|  11.0k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1094|  11.0k|    matchlimit = iend - LASTLITERALS;
  ------------------
  |  |  244|  11.0k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1095|  11.0k|    seqLimit = mflimitPlusOne;
 1096|  11.0k|    if ((suspend != NULL) && (inputSize > LZ4_DISTANCE_MAX + MFLIMIT - 1))   /* source + LZ4_DISTANCE_MAX < mflimitPlusOne */
  ------------------
  |  |  745|  2.41k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                  if ((suspend != NULL) && (inputSize > LZ4_DISTANCE_MAX + MFLIMIT - 1))   /* source + LZ4_DISTANCE_MAX < mflimitPlusOne */
  ------------------
  |  |  245|  2.41k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (1096:9): [True: 2.41k, False: 8.60k]
  |  Branch (1096:30): [True: 611, False: 1.80k]
  ------------------
 1097|    611|        seqLimit = (const BYTE*)source + LZ4_DISTANCE_MAX;
  ------------------
  |  |  745|    611|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
 1098|       |
 1099|  11.0k|    if (resume) goto _resume;
  ------------------
  |  Branch (1099:9): [True: 590, False: 10.4k]
  ------------------
 1100|       |
 1101|       |    /* First Byte */
 1102|  10.4k|    LZ4_putPosition(ip, cctx->hashTable, tableType, base);
 1103|  10.4k|    ip++; forwardH = LZ4_hashPosition(ip, tableType);
 1104|       |
 1105|       |    /* Main Loop */
 1106|  3.93M|    for ( ; ; ) {
 1107|  3.93M|        const BYTE* match;
 1108|  3.93M|        BYTE* token;
 1109|       |
 1110|       |        /* Find a match */
 1111|  3.93M|        if (tableType == byPtr) {
  ------------------
  |  Branch (1111:13): [True: 0, False: 3.93M]
  ------------------
 1112|      0|            const BYTE* forwardIp = ip;
 1113|      0|            int step = 1;
 1114|      0|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1115|      0|            do {
 1116|      0|                U32 const h = forwardH;
 1117|      0|                ip = forwardIp;
 1118|      0|                forwardIp += step;
 1119|      0|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1120|       |
 1121|      0|                if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
  ------------------
  |  |  180|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1122|      0|                assert(ip < mflimitPlusOne);
  ------------------
  |  Branch (1122:17): [True: 0, False: 0]
  |  Branch (1122:17): [True: 0, False: 0]
  ------------------
 1123|       |
 1124|      0|                match = LZ4_getPositionOnHash(h, cctx->hashTable, tableType);
 1125|      0|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1126|      0|                LZ4_putPositionOnHash(ip, h, cctx->hashTable, tableType);
 1127|       |
 1128|      0|            } while ( (match+LZ4_DISTANCE_MAX < ip)
  ------------------
  |  |  745|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1128:23): [True: 0, False: 0]
  ------------------
 1129|      0|                   || (LZ4_read32(match) != LZ4_read32(ip)) );
  ------------------
  |  Branch (1129:23): [True: 0, False: 0]
  ------------------
 1130|       |
 1131|  3.93M|        } else {   /* byU32, byU16 */
 1132|       |
 1133|  3.93M|            const BYTE* forwardIp = ip;
 1134|  3.93M|            int step = 1;
 1135|  3.93M|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1136|  23.4M|            do {
 1137|  23.4M|                U32 const h = forwardH;
 1138|  23.4M|                U32 const curIndex = (U32)(forwardIp - base);
 1139|  23.4M|                U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1140|  23.4M|                assert(matchIndex <= curIndex);
  ------------------
  |  Branch (1140:17): [True: 0, False: 23.4M]
  |  Branch (1140:17): [True: 23.4M, False: 0]
  ------------------
 1141|  23.4M|                assert(forwardIp - base < (ptrdiff_t)(2 GB - 1));
  ------------------
  |  Branch (1141:17): [True: 0, False: 23.4M]
  |  Branch (1141:17): [True: 23.4M, False: 0]
  ------------------
 1142|  23.4M|                ip = forwardIp;
 1143|  23.4M|                forwardIp += step;
 1144|  23.4M|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1145|       |
 1146|  23.4M|                if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
  ------------------
  |  |  180|  23.4M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  23.4M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 3.93k, False: 23.4M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1147|  23.4M|                assert(ip < mflimitPlusOne);
  ------------------
  |  Branch (1147:17): [True: 0, False: 23.4M]
  |  Branch (1147:17): [True: 23.4M, False: 0]
  ------------------
 1148|       |
 1149|  23.4M|                if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1149:21): [True: 0, False: 23.4M]
  ------------------
 1150|      0|                    if (matchIndex < startIndex) {
  ------------------
  |  Branch (1150:25): [True: 0, False: 0]
  ------------------
 1151|       |                        /* there was no match, try the dictionary */
 1152|      0|                        assert(tableType == byU32);
  ------------------
  |  Branch (1152:25): [True: 0, False: 0]
  |  Branch (1152:25): [True: 0, False: 0]
  ------------------
 1153|      0|                        matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32);
 1154|      0|                        match = dictBase + matchIndex;
 1155|      0|                        matchIndex += dictDelta;   /* make dictCtx index comparable with current context */
 1156|      0|                        lowLimit = dictionary;
 1157|      0|                    } else {
 1158|      0|                        match = base + matchIndex;
 1159|      0|                        lowLimit = (const BYTE*)source;
 1160|      0|                    }
 1161|  23.4M|                } else if (dictDirective == usingExtDict) {
  ------------------
  |  Branch (1161:28): [True: 7.42M, False: 15.9M]
  ------------------
 1162|       |                    /* select without branch : dictionary and prefix candidates alternate unpredictably.
 1163|       |                     * relative to dictEnd or source, within their buffers (base can be NULL) */
 1164|  7.42M|                    ptrdiff_t const relIdx = (ptrdiff_t)matchIndex - (ptrdiff_t)startIndex;   /* < 0 : within dictionary */
 1165|  7.42M|                    match = ((relIdx < 0) ? dictEnd : (const BYTE*)source) + relIdx;
  ------------------
  |  Branch (1165:30): [True: 2.54M, False: 4.88M]
  ------------------
 1166|  15.9M|                } else {   /* single continuous memory segment */
 1167|  15.9M|                    match = base + matchIndex;
 1168|  15.9M|                }
 1169|  23.4M|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1170|  23.4M|                LZ4_putIndexOnHash(curIndex, h, cctx->hashTable, tableType);
 1171|       |
 1172|  23.4M|                DEBUGLOG(7, "candidate at pos=%u  (offset=%u \n", matchIndex, curIndex - matchIndex);
  ------------------
  |  |  288|  23.4M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1173|  23.4M|                if ((dictIssue == dictSmall) && (matchIndex < prefixIdxLimit)) { continue; }    /* match outside of valid area */
  ------------------
  |  Branch (1173:21): [True: 16.5k, False: 23.3M]
  |  Branch (1173:49): [True: 13.4k, False: 3.02k]
  ------------------
 1174|  23.4M|                assert(matchIndex < curIndex);
  ------------------
  |  Branch (1174:17): [True: 0, False: 23.4M]
  |  Branch (1174:17): [True: 23.4M, False: 0]
  ------------------
 1175|       |                /* compareFirst : the candidate is readable (noDict : within input ; clampedTable : within the last 64 KB),
 1176|       |                 * so it is compared before checking its distance : this order is faster (better branch prediction) */
 1177|  23.4M|                assert((dictDirective != noDict) || (match >= (const BYTE*)source));
  ------------------
  |  Branch (1177:17): [True: 23.4M, False: 0]
  |  Branch (1177:17): [True: 0, False: 0]
  |  Branch (1177:17): [True: 16.3M, False: 7.06M]
  |  Branch (1177:17): [True: 7.06M, False: 0]
  ------------------
 1178|  23.4M|                assert((dictIssue != clampedTable) || (matchIndex + 64 KB >= startIndex));
  ------------------
  |  Branch (1178:17): [True: 23.4M, False: 0]
  |  Branch (1178:17): [True: 0, False: 0]
  |  Branch (1178:17): [True: 16.4M, False: 6.98M]
  |  Branch (1178:17): [True: 6.98M, False: 0]
  ------------------
 1179|  23.4M|                if ( (!compareFirst)
  ------------------
  |  Branch (1179:22): [True: 9.34M, False: 14.0M]
  ------------------
 1180|  9.34M|                  && ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  745|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                                && ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  254|      0|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
  |  Branch (1180:23): [True: 9.34M, False: 0]
  |  Branch (1180:47): [Folded, False: 0]
  ------------------
 1181|  9.34M|                  && (matchIndex+LZ4_DISTANCE_MAX < curIndex)) {
  ------------------
  |  |  745|  9.34M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1181:22): [True: 1.54M, False: 7.80M]
  ------------------
 1182|  1.54M|                    continue;
 1183|  1.54M|                } /* too far */
 1184|       |
 1185|  21.8M|                if (LZ4_read32(match) == LZ4_read32(ip)) {
  ------------------
  |  Branch (1185:21): [True: 3.98M, False: 17.8M]
  ------------------
 1186|  3.98M|                    if ( (compareFirst)
  ------------------
  |  Branch (1186:26): [True: 2.36M, False: 1.62M]
  ------------------
 1187|  2.36M|                      && ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  745|   385k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                                    && ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  254|   385k|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
  |  Branch (1187:27): [True: 1.97M, False: 385k]
  |  Branch (1187:51): [Folded, False: 0]
  ------------------
 1188|  1.97M|                      && (matchIndex+LZ4_DISTANCE_MAX < curIndex)) {
  ------------------
  |  |  745|  1.97M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1188:26): [True: 58.1k, False: 1.91M]
  ------------------
 1189|  58.1k|                        continue;
 1190|  58.1k|                    } /* too far */
 1191|  3.98M|                    assert((curIndex - matchIndex) <= LZ4_DISTANCE_MAX);  /* match now expected within distance */
  ------------------
  |  Branch (1191:21): [True: 0, False: 3.92M]
  |  Branch (1191:21): [True: 3.92M, False: 0]
  ------------------
 1192|  3.92M|                    if (maybe_extMem) offset = curIndex - matchIndex;
  ------------------
  |  Branch (1192:25): [True: 1.29M, False: 2.63M]
  ------------------
 1193|  3.92M|                    if (dictDirective == usingExtDict)   /* lowLimit : only needed once a match is found */
  ------------------
  |  Branch (1193:25): [True: 1.29M, False: 2.63M]
  ------------------
 1194|  1.29M|                        lowLimit = (matchIndex < startIndex) ? dictionary : (const BYTE*)source;
  ------------------
  |  Branch (1194:36): [True: 136k, False: 1.16M]
  ------------------
 1195|  3.92M|                    break;   /* match found */
 1196|  3.92M|                }
 1197|       |
 1198|  21.8M|            } while(1);
  ------------------
  |  Branch (1198:21): [True: 19.4M, Folded]
  ------------------
 1199|  3.93M|        }
 1200|       |
 1201|       |        /* Catch up */
 1202|  3.92M|        filledIp = ip;
 1203|  3.92M|        assert(ip > anchor); /* this is always true as ip has been advanced before entering the main loop */
  ------------------
  |  Branch (1203:9): [True: 0, False: 3.92M]
  |  Branch (1203:9): [True: 3.92M, False: 0]
  ------------------
 1204|  3.92M|        if ((match > lowLimit) && unlikely(ip[-1] == match[-1])) {
  ------------------
  |  |  180|  3.92M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  3.92M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 954k, False: 2.96M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1204:13): [True: 3.92M, False: 6.05k]
  ------------------
 1205|  1.59M|            do { ip--; match--; } while (((ip > anchor) & (match > lowLimit)) && (unlikely(ip[-1] == match[-1])));
  ------------------
  |  |  180|  1.36M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  1.36M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1205:42): [True: 1.36M, False: 227k]
  |  Branch (1205:82): [True: 640k, False: 727k]
  ------------------
 1206|   954k|        }
 1207|       |
 1208|       |        /* Encode Literals */
 1209|  3.92M|        {   unsigned const litLength = (unsigned)(ip - anchor);
 1210|  3.92M|            token = op++;
 1211|  3.92M|            if ((outputDirective == limitedOutput) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1211:17): [True: 3.92M, False: 0]
  ------------------
 1212|  3.92M|                (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength/255) > olimit)) ) {
  ------------------
  |  |  180|  3.92M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  3.92M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1212:17): [True: 64, False: 3.92M]
  ------------------
 1213|     64|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1214|     64|            }
 1215|  3.92M|            if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1215:17): [True: 0, False: 3.92M]
  ------------------
 1216|      0|                (unlikely(op + (litLength+240)/255 /* litlen */ + litLength /* literals */ + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit))) {
  ------------------
  |  |  180|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1216:17): [True: 0, False: 0]
  ------------------
 1217|      0|                op--;
 1218|      0|                goto _last_literals;
 1219|      0|            }
 1220|  3.92M|            if (litLength >= RUN_MASK) {
  ------------------
  |  |  262|  3.92M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  3.92M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  3.92M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1220:17): [True: 451k, False: 3.47M]
  ------------------
 1221|   451k|                unsigned len = litLength - RUN_MASK;
  ------------------
  |  |  262|   451k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   451k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|   451k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1222|   451k|                *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  262|   451k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   451k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|   451k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                              *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  259|   451k|#define ML_BITS  4
  ------------------
 1223|   619k|                for(; len >= 255 ; len-=255) *op++ = 255;
  ------------------
  |  Branch (1223:23): [True: 167k, False: 451k]
  ------------------
 1224|   451k|                *op++ = (BYTE)len;
 1225|   451k|            }
 1226|  3.47M|            else *token = (BYTE)(litLength<<ML_BITS);
  ------------------
  |  |  259|  3.47M|#define ML_BITS  4
  ------------------
 1227|       |
 1228|       |            /* Copy Literals */
 1229|  3.92M|            LZ4_wildCopy8(op, anchor, op+litLength);
 1230|  3.92M|            op+=litLength;
 1231|  3.92M|            DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  288|  3.92M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1232|  3.92M|                        (int)(anchor-(const BYTE*)source), litLength, (int)(ip-(const BYTE*)source));
 1233|  3.92M|        }
 1234|       |
 1235|  8.86M|_next_match:
 1236|       |        /* at this stage, the following variables must be correctly set :
 1237|       |         * - ip : at start of LZ operation
 1238|       |         * - match : at start of previous pattern occurrence; can be within current prefix, or within extDict
 1239|       |         * - offset : if maybe_ext_memSegment==1 (constant)
 1240|       |         * - lowLimit : must be == dictionary to mean "match is within extDict"; must be == source otherwise
 1241|       |         * - token and *token : position to write 4-bits for match length; higher 4-bits for literal length supposed already written
 1242|       |         */
 1243|       |
 1244|  8.86M|        if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1244:13): [True: 0, False: 8.86M]
  ------------------
 1245|      0|            (op + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit)) {
  ------------------
  |  |  245|      0|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          (op + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit)) {
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
  |  Branch (1245:13): [True: 0, False: 0]
  ------------------
 1246|       |            /* the match was too close to the end, rewind and go to last literals */
 1247|      0|            op = token;
 1248|      0|            goto _last_literals;
 1249|      0|        }
 1250|       |
 1251|       |        /* Encode Offset */
 1252|  8.86M|        if (maybe_extMem) {   /* static test */
  ------------------
  |  Branch (1252:13): [True: 2.82M, False: 6.03M]
  ------------------
 1253|  2.82M|            DEBUGLOG(6, "             with offset=%u  (ext if > %i)", offset, (int)(ip - (const BYTE*)source));
  ------------------
  |  |  288|  2.82M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1254|  2.82M|            assert(offset <= LZ4_DISTANCE_MAX && offset > 0);
  ------------------
  |  Branch (1254:13): [True: 0, False: 2.82M]
  |  Branch (1254:13): [True: 0, False: 0]
  |  Branch (1254:13): [True: 2.82M, False: 0]
  |  Branch (1254:13): [True: 2.82M, False: 0]
  ------------------
 1255|  2.82M|            LZ4_writeLE16(op, (U16)offset); op+=2;
 1256|  6.03M|        } else  {
 1257|  6.03M|            DEBUGLOG(6, "             with offset=%u  (same segment)", (U32)(ip - match));
  ------------------
  |  |  288|  6.03M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1258|  6.03M|            assert(ip-match <= LZ4_DISTANCE_MAX);
  ------------------
  |  Branch (1258:13): [True: 0, False: 6.03M]
  |  Branch (1258:13): [True: 6.03M, False: 0]
  ------------------
 1259|  6.03M|            LZ4_writeLE16(op, (U16)(ip - match)); op+=2;
 1260|  6.03M|        }
 1261|       |
 1262|       |        /* Encode MatchLength */
 1263|  8.86M|        {   unsigned matchCode;
 1264|       |
 1265|  8.86M|            if ( (dictDirective==usingExtDict || dictDirective==usingDictCtx)
  ------------------
  |  Branch (1265:19): [True: 2.82M, False: 6.03M]
  |  Branch (1265:50): [True: 0, False: 6.03M]
  ------------------
 1266|  2.82M|              && (lowLimit==dictionary) /* match within extDict */ ) {
  ------------------
  |  Branch (1266:18): [True: 239k, False: 2.58M]
  ------------------
 1267|   239k|                const BYTE* limit = ip + (dictEnd-match);
 1268|   239k|                assert(dictEnd > match);
  ------------------
  |  Branch (1268:17): [True: 0, False: 239k]
  |  Branch (1268:17): [True: 239k, False: 0]
  ------------------
 1269|   239k|                if (limit > matchlimit) limit = matchlimit;
  ------------------
  |  Branch (1269:21): [True: 233, False: 239k]
  ------------------
 1270|   239k|                matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, limit);
  ------------------
  |  |  241|   239k|#define MINMATCH 4
  ------------------
                              matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, limit);
  ------------------
  |  |  241|   239k|#define MINMATCH 4
  ------------------
 1271|   239k|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  241|   239k|#define MINMATCH 4
  ------------------
 1272|   239k|                if (ip==limit) {
  ------------------
  |  Branch (1272:21): [True: 1.28k, False: 238k]
  ------------------
 1273|  1.28k|                    unsigned const more = LZ4_count(limit, (const BYTE*)source, matchlimit);
 1274|  1.28k|                    matchCode += more;
 1275|  1.28k|                    ip += more;
 1276|  1.28k|                }
 1277|   239k|                DEBUGLOG(6, "             with matchLength=%u starting in extDict", matchCode+MINMATCH);
  ------------------
  |  |  288|   239k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1278|  8.62M|            } else {
 1279|  8.62M|                matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  241|  8.62M|#define MINMATCH 4
  ------------------
                              matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  241|  8.62M|#define MINMATCH 4
  ------------------
 1280|  8.62M|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  241|  8.62M|#define MINMATCH 4
  ------------------
 1281|  8.62M|                DEBUGLOG(6, "             with matchLength=%u", matchCode+MINMATCH);
  ------------------
  |  |  288|  8.62M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1282|  8.62M|            }
 1283|       |
 1284|  8.86M|            if ((outputDirective) &&    /* Check output buffer overflow */
  ------------------
  |  Branch (1284:17): [True: 8.86M, False: 0]
  ------------------
 1285|  8.86M|                (unlikely(op + (1 + LASTLITERALS) + (matchCode+240)/255 > olimit)) ) {
  ------------------
  |  |  180|  8.86M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  8.86M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1285:17): [True: 11, False: 8.86M]
  ------------------
 1286|     11|                if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1286:21): [True: 0, False: 11]
  ------------------
 1287|       |                    /* Match description too long : reduce it */
 1288|      0|                    U32 newMatchCode = 15 /* in token */ - 1 /* to avoid needing a zero byte */ + ((U32)(olimit - op) - 1 - LASTLITERALS) * 255;
  ------------------
  |  |  244|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1289|      0|                    ip -= matchCode - newMatchCode;
 1290|      0|                    assert(newMatchCode < matchCode);
  ------------------
  |  Branch (1290:21): [True: 0, False: 0]
  |  Branch (1290:21): [True: 0, False: 0]
  ------------------
 1291|      0|                    matchCode = newMatchCode;
 1292|      0|                    if (unlikely(ip <= filledIp)) {
  ------------------
  |  |  180|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1293|       |                        /* We have already filled up to filledIp so if ip ends up less than filledIp
 1294|       |                         * we have positions in the hash table beyond the current position. This is
 1295|       |                         * a problem if we reuse the hash table. So we have to remove these positions
 1296|       |                         * from the hash table.
 1297|       |                         */
 1298|      0|                        const BYTE* ptr;
 1299|      0|                        DEBUGLOG(5, "Clearing %u positions", (U32)(filledIp - ip));
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1300|      0|                        for (ptr = ip; ptr <= filledIp; ++ptr) {
  ------------------
  |  Branch (1300:40): [True: 0, False: 0]
  ------------------
 1301|      0|                            U32 const h = LZ4_hashPosition(ptr, tableType);
 1302|      0|                            LZ4_clearHash(h, cctx->hashTable, tableType);
 1303|      0|                        }
 1304|      0|                    }
 1305|     11|                } else {
 1306|     11|                    assert(outputDirective == limitedOutput);
  ------------------
  |  Branch (1306:21): [True: 0, False: 11]
  |  Branch (1306:21): [True: 11, False: 0]
  ------------------
 1307|     11|                    return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1308|     11|                }
 1309|     11|            }
 1310|  8.86M|            if (matchCode >= ML_MASK) {
  ------------------
  |  |  260|  8.86M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  8.86M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (1310:17): [True: 1.37M, False: 7.49M]
  ------------------
 1311|  1.37M|                *token += ML_MASK;
  ------------------
  |  |  260|  1.37M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  1.37M|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1312|  1.37M|                matchCode -= ML_MASK;
  ------------------
  |  |  260|  1.37M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  1.37M|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1313|  1.37M|                LZ4_write32(op, 0xFFFFFFFF);
 1314|  1.52M|                while (matchCode >= 4*255) {
  ------------------
  |  Branch (1314:24): [True: 154k, False: 1.37M]
  ------------------
 1315|   154k|                    op+=4;
 1316|   154k|                    LZ4_write32(op, 0xFFFFFFFF);
 1317|   154k|                    matchCode -= 4*255;
 1318|   154k|                }
 1319|  1.37M|                op += matchCode / 255;
 1320|  1.37M|                *op++ = (BYTE)(matchCode % 255);
 1321|  1.37M|            } else
 1322|  7.49M|                *token += (BYTE)(matchCode);
 1323|  8.86M|        }
 1324|       |        /* Ensure we have enough space for the last literals. */
 1325|  8.86M|        assert(!(outputDirective == fillOutput && op + 1 + LASTLITERALS > olimit));
  ------------------
  |  Branch (1325:9): [True: 0, False: 8.86M]
  |  Branch (1325:9): [True: 0, False: 0]
  |  Branch (1325:9): [True: 0, False: 8.86M]
  |  Branch (1325:9): [True: 0, False: 0]
  ------------------
 1326|       |
 1327|  8.86M|        anchor = ip;
 1328|       |
 1329|       |        /* Test end of chunk */
 1330|  8.86M|        if (ip >= seqLimit) {
  ------------------
  |  Branch (1330:13): [True: 7.00k, False: 8.85M]
  ------------------
 1331|  7.00k|            if ((suspend == NULL) || (ip >= mflimitPlusOne)) break;
  ------------------
  |  Branch (1331:17): [True: 5.10k, False: 1.90k]
  |  Branch (1331:38): [True: 1.31k, False: 590]
  ------------------
 1332|       |            /* extDict : from ip, all candidates (and catch up) are beyond reach of the dictionary :
 1333|       |             * stop, to resume in prefix mode, which is faster */
 1334|    590|            suspend->ip = ip;
 1335|    590|            suspend->op = op;
 1336|    590|            suspend->startIndex = startIndex;
 1337|    590|            return 0;
 1338|  7.00k|        }
 1339|       |
 1340|  8.85M|_resume:
 1341|       |        /* Fill table, and test next position.
 1342|       |         * First, the position after the previous occurrence of ip-1, if it matches 8+ bytes :
 1343|       |         * it breaks chains of short matches, which the table alone can produce on periodic data. */
 1344|  8.85M|        if (tableType == byPtr) {
  ------------------
  |  Branch (1344:13): [True: 0, False: 8.85M]
  ------------------
 1345|       |
 1346|      0|            U32 const hPrev = LZ4_hashPosition(ip-1, tableType);
 1347|      0|            const BYTE* const prev = LZ4_getPositionOnHash(hPrev, cctx->hashTable, tableType);
 1348|      0|            U32 const h = LZ4_hashPosition(ip, tableType);
 1349|      0|            LZ4_putPositionOnHash(ip-1, hPrev, cctx->hashTable, tableType);
 1350|      0|            match = LZ4_getPositionOnHash(h, cctx->hashTable, tableType);
 1351|      0|            if ((prev+1+LZ4_DISTANCE_MAX >= ip) && LZ4_match8(prev+1, ip)) match = prev+1;
  ------------------
  |  |  745|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1351:17): [True: 0, False: 0]
  |  Branch (1351:52): [True: 0, False: 0]
  ------------------
 1352|      0|            LZ4_putPositionOnHash(ip, h, cctx->hashTable, tableType);
 1353|      0|            if ( (match+LZ4_DISTANCE_MAX >= ip)
  ------------------
  |  |  745|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1353:18): [True: 0, False: 0]
  ------------------
 1354|      0|              && (LZ4_read32(match) == LZ4_read32(ip)) )
  ------------------
  |  Branch (1354:18): [True: 0, False: 0]
  ------------------
 1355|      0|            { token=op++; *token=0; goto _next_match; }
 1356|       |
 1357|  8.85M|        } else {   /* byU32, byU16 */
 1358|       |
 1359|  8.85M|            U32 const h = LZ4_hashPosition(ip, tableType);
 1360|  8.85M|            U32 const curIndex = (U32)(ip-base);
 1361|  8.85M|            U32 const hPrev = LZ4_hashPosition(ip-1, tableType);
 1362|  8.85M|            U32 prevIndex = LZ4_getIndexOnHash(hPrev, cctx->hashTable, tableType);
 1363|  8.85M|            U32 matchIndex;
 1364|  8.85M|            LZ4_putIndexOnHash(curIndex-1, hPrev, cctx->hashTable, tableType);
 1365|  8.85M|            if ((dictDirective == usingDictCtx) && (prevIndex < startIndex)) {
  ------------------
  |  Branch (1365:17): [True: 0, False: 8.85M]
  |  Branch (1365:52): [True: 0, False: 0]
  ------------------
 1366|       |                /* no occurrence in the current context : try the dictionary */
 1367|      0|                prevIndex = LZ4_getIndexOnHash(hPrev, dictCtx->hashTable, byU32) + dictDelta;
 1368|      0|            }
 1369|  8.85M|            {   /* used table (small block, see LZ4_prepareTable()) : a stale entry yields the candidate of an empty slot
 1370|       |                 * of a cleared table (0), the position after the first one : the output doesn't depend on the table's history */
 1371|  8.85M|                int const usedTable = (dictDirective == noDict) && (dictIssue == dictSmall);
  ------------------
  |  Branch (1371:39): [True: 2.45M, False: 6.40M]
  |  Branch (1371:68): [True: 4.05k, False: 2.44M]
  ------------------
 1372|  8.85M|                U32 const ctxIndex = ((usedTable && (prevIndex < startIndex)) ? startIndex : prevIndex) + 1;
  ------------------
  |  Branch (1372:40): [True: 4.05k, False: 8.85M]
  |  Branch (1372:53): [True: 2.14k, False: 1.90k]
  ------------------
 1373|  8.85M|                int const inDict = (dictDirective == usingExtDict || dictDirective == usingDictCtx) && (ctxIndex < startIndex);
  ------------------
  |  Branch (1373:37): [True: 2.81M, False: 6.03M]
  |  Branch (1373:70): [True: 0, False: 6.03M]
  |  Branch (1373:104): [True: 617k, False: 2.20M]
  ------------------
 1374|  8.85M|                if ( ((dictIssue==dictSmall) ? (ctxIndex >= prefixIdxLimit) : 1)
  ------------------
  |  Branch (1374:22): [True: 8.85M, False: 0]
  |  Branch (1374:23): [True: 4.05k, False: 8.85M]
  ------------------
 1375|  8.85M|                  && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (ctxIndex+LZ4_DISTANCE_MAX >= curIndex))
  ------------------
  |  |  745|  1.29M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                                && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (ctxIndex+LZ4_DISTANCE_MAX >= curIndex))
  ------------------
  |  |  254|  1.29M|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
                                && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (ctxIndex+LZ4_DISTANCE_MAX >= curIndex))
  ------------------
  |  |  745|  7.55M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1375:22): [True: 8.29M, False: 561k]
  |  Branch (1375:24): [True: 1.29M, False: 7.55M]
  |  Branch (1375:46): [True: 0, Folded]
  ------------------
 1376|  8.29M|                  && (!inDict || (ctxIndex + 8 <= startIndex))   /* the 8 compared bytes are within the dictionary */
  ------------------
  |  Branch (1376:23): [True: 7.98M, False: 303k]
  |  Branch (1376:34): [True: 303k, False: 0]
  ------------------
 1377|  8.29M|                  && LZ4_match8(inDict ? dictBase + (ctxIndex - dictDelta) : base + ctxIndex, ip) ) {
  ------------------
  |  Branch (1377:22): [True: 1.24M, False: 7.04M]
  |  Branch (1377:33): [True: 303k, False: 7.98M]
  ------------------
 1378|  1.24M|                    matchIndex = ctxIndex;
 1379|  7.60M|                } else {
 1380|  7.60M|                    matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1381|  7.60M|                    if ((dictDirective == usingDictCtx) && (matchIndex < startIndex))
  ------------------
  |  Branch (1381:25): [True: 0, False: 7.60M]
  |  Branch (1381:60): [True: 0, False: 0]
  ------------------
 1382|      0|                        matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32) + dictDelta;
 1383|  7.60M|                }
 1384|  8.85M|            }
 1385|  8.85M|            assert(matchIndex < curIndex);
  ------------------
  |  Branch (1385:13): [True: 0, False: 8.85M]
  |  Branch (1385:13): [True: 8.85M, False: 0]
  ------------------
 1386|  8.85M|            if (dictDirective == usingExtDict) {   /* select without branch */
  ------------------
  |  Branch (1386:17): [True: 2.81M, False: 6.03M]
  ------------------
 1387|  2.81M|                ptrdiff_t const relIdx = (ptrdiff_t)matchIndex - (ptrdiff_t)startIndex;   /* < 0 : within dictionary */
 1388|  2.81M|                match = ((relIdx < 0) ? dictEnd : (const BYTE*)source) + relIdx;
  ------------------
  |  Branch (1388:26): [True: 606k, False: 2.21M]
  ------------------
 1389|  6.03M|            } else if ((dictDirective == usingDictCtx) && (matchIndex < startIndex)) {
  ------------------
  |  Branch (1389:24): [True: 0, False: 6.03M]
  |  Branch (1389:59): [True: 0, False: 0]
  ------------------
 1390|      0|                match = dictBase + (matchIndex - dictDelta);
 1391|      0|                lowLimit = dictionary;   /* required for match length counter */
 1392|  6.03M|            } else {
 1393|  6.03M|                match = base + matchIndex;
 1394|  6.03M|                if (dictDirective == usingDictCtx)
  ------------------
  |  Branch (1394:21): [True: 0, False: 6.03M]
  ------------------
 1395|      0|                    lowLimit = (const BYTE*)source;   /* required for match length counter */
 1396|  6.03M|            }
 1397|  8.85M|            LZ4_putIndexOnHash(curIndex, h, cctx->hashTable, tableType);
 1398|  8.85M|            assert(matchIndex < curIndex);
  ------------------
  |  Branch (1398:13): [True: 0, False: 8.85M]
  |  Branch (1398:13): [True: 8.85M, False: 0]
  ------------------
 1399|  8.85M|            if ( ((dictIssue==dictSmall) ? (matchIndex >= prefixIdxLimit) : 1)
  ------------------
  |  Branch (1399:18): [True: 8.85M, False: 1.96k]
  |  Branch (1399:19): [True: 4.05k, False: 8.85M]
  ------------------
 1400|  8.85M|              && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= curIndex))
  ------------------
  |  |  745|  1.29M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                            && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= curIndex))
  ------------------
  |  |  254|  1.29M|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
                            && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= curIndex))
  ------------------
  |  |  745|  7.55M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1400:18): [True: 8.34M, False: 508k]
  |  Branch (1400:20): [True: 1.29M, False: 7.55M]
  |  Branch (1400:42): [True: 0, Folded]
  ------------------
 1401|  8.34M|              && (LZ4_read32(match) == LZ4_read32(ip)) ) {
  ------------------
  |  Branch (1401:18): [True: 4.93M, False: 3.41M]
  ------------------
 1402|  4.93M|                token=op++;
 1403|  4.93M|                *token=0;
 1404|  4.93M|                if (maybe_extMem) offset = curIndex - matchIndex;
  ------------------
  |  Branch (1404:21): [True: 1.52M, False: 3.40M]
  ------------------
 1405|  4.93M|                if (dictDirective == usingExtDict)
  ------------------
  |  Branch (1405:21): [True: 1.52M, False: 3.40M]
  ------------------
 1406|  1.52M|                    lowLimit = (matchIndex < startIndex) ? dictionary : (const BYTE*)source;   /* required for match length counter */
  ------------------
  |  Branch (1406:32): [True: 103k, False: 1.42M]
  ------------------
 1407|  4.93M|                DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  288|  4.93M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1408|  4.93M|                            (int)(anchor-(const BYTE*)source), 0, (int)(ip-(const BYTE*)source));
 1409|  4.93M|                goto _next_match;
 1410|  4.93M|            }
 1411|  8.85M|        }
 1412|       |
 1413|       |        /* Prepare next loop */
 1414|  3.92M|        forwardH = LZ4_hashPosition(++ip, tableType);
 1415|       |
 1416|  3.92M|    }
 1417|       |
 1418|  11.2k|_last_literals:
 1419|       |    /* Encode Last Literals */
 1420|  11.2k|    {   size_t lastRun = (size_t)(iend - anchor);
 1421|  11.2k|        if ( (outputDirective) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1421:14): [True: 11.2k, False: 0]
  ------------------
 1422|  11.2k|            (op + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > olimit)) {
  ------------------
  |  |  262|  11.2k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  11.2k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  11.2k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1422:13): [True: 2.72k, False: 8.55k]
  ------------------
 1423|  2.72k|            if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1423:17): [True: 0, False: 2.72k]
  ------------------
 1424|       |                /* adapt lastRun to fill 'dst' */
 1425|      0|                assert(olimit >= op);
  ------------------
  |  Branch (1425:17): [True: 0, False: 0]
  |  Branch (1425:17): [True: 0, False: 0]
  ------------------
 1426|      0|                lastRun  = (size_t)(olimit-op) - 1/*token*/;
 1427|      0|                lastRun -= (lastRun + 256 - RUN_MASK) / 256;  /*additional length tokens*/
  ------------------
  |  |  262|      0|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|      0|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|      0|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1428|  2.72k|            } else {
 1429|  2.72k|                assert(outputDirective == limitedOutput);
  ------------------
  |  Branch (1429:17): [True: 0, False: 2.72k]
  |  Branch (1429:17): [True: 2.72k, False: 0]
  ------------------
 1430|  2.72k|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1431|  2.72k|            }
 1432|  2.72k|        }
 1433|  8.55k|        DEBUGLOG(6, "Final literal run : %i literals", (int)lastRun);
  ------------------
  |  |  288|  8.55k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1434|  8.55k|        if (lastRun >= RUN_MASK) {
  ------------------
  |  |  262|  8.55k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  8.55k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  8.55k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1434:13): [True: 1.70k, False: 6.85k]
  ------------------
 1435|  1.70k|            size_t accumulator = lastRun - RUN_MASK;
  ------------------
  |  |  262|  1.70k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.70k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  1.70k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1436|  1.70k|            *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  262|  1.70k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.70k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  1.70k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  259|  1.70k|#define ML_BITS  4
  ------------------
 1437|  40.2k|            for(; accumulator >= 255 ; accumulator-=255) *op++ = 255;
  ------------------
  |  Branch (1437:19): [True: 38.5k, False: 1.70k]
  ------------------
 1438|  1.70k|            *op++ = (BYTE) accumulator;
 1439|  6.85k|        } else {
 1440|  6.85k|            *op++ = (BYTE)(lastRun<<ML_BITS);
  ------------------
  |  |  259|  6.85k|#define ML_BITS  4
  ------------------
 1441|  6.85k|        }
 1442|  8.55k|        LZ4_memcpy(op, anchor, lastRun);
  ------------------
  |  |  348|  8.55k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 1443|  8.55k|        ip = anchor + lastRun;
 1444|  8.55k|        op += lastRun;
 1445|  8.55k|    }
 1446|       |
 1447|  8.55k|    if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1447:9): [True: 0, False: 8.55k]
  ------------------
 1448|      0|        *inputConsumed = (int) (((const char*)ip)-source);
 1449|      0|    }
 1450|  8.55k|    result = (int)(((char*)op) - dest);
 1451|  8.55k|    assert(result > 0);
  ------------------
  |  Branch (1451:5): [True: 0, False: 8.55k]
  |  Branch (1451:5): [True: 8.55k, False: 0]
  ------------------
 1452|  8.55k|    DEBUGLOG(5, "LZ4_compress_generic: compressed %i bytes into %i bytes", inputSize, result);
  ------------------
  |  |  288|  8.55k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1453|  8.55k|    return result;
 1454|  8.55k|}
lz4.c:LZ4_putPosition:
  911|  10.4k|{
  912|  10.4k|    U32 const h = LZ4_hashPosition(p, tableType);
  913|  10.4k|    if (tableType == byPtr) {
  ------------------
  |  Branch (913:9): [True: 0, False: 10.4k]
  ------------------
  914|      0|        LZ4_putPositionOnHash(p, h, tableBase, byPtr);
  915|  10.4k|    } else {
  916|  10.4k|        LZ4_putIndexOnHash((U32)(p - base), h, tableBase, tableType);
  917|  10.4k|    }
  918|  10.4k|}
lz4.c:LZ4_wildCopy8:
  465|  4.11M|{
  466|  4.11M|    BYTE* d = (BYTE*)dstPtr;
  467|  4.11M|    const BYTE* s = (const BYTE*)srcPtr;
  468|  4.11M|    BYTE* const e = (BYTE*)dstEnd;
  469|       |
  470|  17.2M|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  348|  17.2M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (470:50): [True: 13.1M, False: 4.11M]
  ------------------
  471|  4.11M|}
lz4.c:LZ4_writeLE16:
  452|  8.86M|{
  453|  8.86M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (453:9): [True: 8.86M, False: 0]
  ------------------
  454|  8.86M|        LZ4_write16(memPtr, value);
  455|  8.86M|    } else {
  456|      0|        BYTE* p = (BYTE*)memPtr;
  457|      0|        p[0] = (BYTE) value;
  458|      0|        p[1] = (BYTE)(value>>8);
  459|      0|    }
  460|  8.86M|}
lz4.c:LZ4_write16:
  396|  8.86M|static void LZ4_write16(void* memPtr, U16 value) { ((LZ4_unalign16*)memPtr)->u16 = value; }
lz4.c:LZ4_count:
  720|  8.86M|{
  721|  8.86M|    const BYTE* const pStart = pIn;
  722|       |
  723|  8.86M|    if (likely(pIn < pInLimit-(STEPSIZE-1))) {
  ------------------
  |  |  177|  8.86M|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|  8.86M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 8.85M, False: 2.17k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  724|  8.85M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  725|  8.85M|        if (!diff) {
  ------------------
  |  Branch (725:13): [True: 1.98M, False: 6.87M]
  ------------------
  726|  1.98M|            pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  717|  1.98M|#define STEPSIZE sizeof(reg_t)
  ------------------
                          pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  717|  1.98M|#define STEPSIZE sizeof(reg_t)
  ------------------
  727|  6.87M|        } else {
  728|  6.87M|            return LZ4_NbCommonBytes(diff);
  729|  6.87M|    }   }
  730|       |
  731|  36.0M|    while (likely(pIn < pInLimit-(STEPSIZE-1))) {
  732|  36.0M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  733|  36.0M|        if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  717|  34.0M|#define STEPSIZE sizeof(reg_t)
  ------------------
                      if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  717|  34.0M|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (733:13): [True: 34.0M, False: 1.97M]
  ------------------
  734|  1.97M|        pIn += LZ4_NbCommonBytes(diff);
  735|  1.97M|        return (unsigned)(pIn - pStart);
  736|  36.0M|    }
  737|       |
  738|  7.66k|    if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  |  717|  7.66k|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (738:9): [True: 7.66k, Folded]
  |  Branch (738:26): [True: 4.65k, False: 3.00k]
  |  Branch (738:48): [True: 3.17k, False: 1.47k]
  ------------------
  739|  7.66k|    if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (739:9): [True: 5.22k, False: 2.43k]
  |  Branch (739:31): [True: 3.75k, False: 1.47k]
  ------------------
  740|  7.66k|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (740:9): [True: 4.94k, False: 2.72k]
  |  Branch (740:27): [True: 3.58k, False: 1.35k]
  ------------------
  741|  7.66k|    return (unsigned)(pIn - pStart);
  742|  1.98M|}
lz4.c:LZ4_NbCommonBytes:
  619|  8.85M|{
  620|  8.85M|    assert(val != 0);
  ------------------
  |  Branch (620:5): [True: 0, False: 8.85M]
  |  Branch (620:5): [True: 8.85M, False: 0]
  ------------------
  621|  8.85M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (621:9): [True: 8.85M, False: 0]
  ------------------
  622|  8.85M|        if (sizeof(val) == 8) {
  ------------------
  |  Branch (622:13): [True: 8.85M, Folded]
  ------------------
  623|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1800) && (defined(_M_AMD64) && !defined(_M_ARM64EC)) && !defined(LZ4_FORCE_SW_BITCOUNT)
  624|       |/*-*************************************************************************************************
  625|       |* ARM64EC is a Microsoft-designed ARM64 ABI compatible with AMD64 applications on ARM64 Windows 11.
  626|       |* The ARM64EC ABI does not support AVX/AVX2/AVX512 instructions, nor their relevant intrinsics
  627|       |* including _tzcnt_u64. Therefore, we need to neuter the _tzcnt_u64 code path for ARM64EC.
  628|       |****************************************************************************************************/
  629|       |#         if defined(__clang__) && (__clang_major__ < 10)
  630|       |            /* Avoid undefined clang-cl intrinsics issue.
  631|       |             * See https://github.com/lz4/lz4/pull/1017 for details. */
  632|       |            return (unsigned)__builtin_ia32_tzcnt_u64(val) >> 3;
  633|       |#         else
  634|       |            /* x64 CPUS without BMI support interpret `TZCNT` as `REP BSF` */
  635|       |            return (unsigned)_tzcnt_u64(val) >> 3;
  636|       |#         endif
  637|       |#       elif defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT)
  638|       |            unsigned long r = 0;
  639|       |            _BitScanForward64(&r, (U64)val);
  640|       |            return (unsigned)r >> 3;
  641|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  642|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  643|       |                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  644|       |            return (unsigned)__builtin_ctzll((U64)val) >> 3;
  645|       |#       else
  646|       |            const U64 m = 0x0101010101010101ULL;
  647|       |            val ^= val - 1;
  648|       |            return (unsigned)(((U64)((val & (m - 1)) * m)) >> 56);
  649|       |#       endif
  650|  8.85M|        } else /* 32 bits */ {
  651|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT)
  652|       |            unsigned long r;
  653|       |            _BitScanForward(&r, (U32)val);
  654|       |            return (unsigned)r >> 3;
  655|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  656|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  657|       |                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  658|       |            return (unsigned)__builtin_ctz((U32)val) >> 3;
  659|       |#       else
  660|       |            const U32 m = 0x01010101;
  661|       |            return (unsigned)((((val - 1) ^ val) & (m - 1)) * m) >> 24;
  662|       |#       endif
  663|      0|        }
  664|  8.85M|    } else   /* Big Endian CPU */ {
  665|      0|        if (sizeof(val)==8) {
  ------------------
  |  Branch (665:13): [True: 0, Folded]
  ------------------
  666|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  667|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  668|      0|                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  669|      0|            return (unsigned)__builtin_clzll((U64)val) >> 3;
  670|       |#       else
  671|       |#if 1
  672|       |            /* this method is probably faster,
  673|       |             * but adds a 128 bytes lookup table */
  674|       |            static const unsigned char ctz7_tab[128] = {
  675|       |                7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  676|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  677|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  678|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  679|       |                6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  680|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  681|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  682|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  683|       |            };
  684|       |            U64 const mask = 0x0101010101010101ULL;
  685|       |            U64 const t = (((val >> 8) - mask) | val) & mask;
  686|       |            return ctz7_tab[(t * 0x0080402010080402ULL) >> 57];
  687|       |#else
  688|       |            /* this method doesn't consume memory space like the previous one,
  689|       |             * but it contains several branches,
  690|       |             * that may end up slowing execution */
  691|       |            static const U32 by32 = sizeof(val)*4;  /* 32 on 64 bits (goal), 16 on 32 bits.
  692|       |            Just to avoid some static analyzer complaining about shift by 32 on 32-bits target.
  693|       |            Note that this code path is never triggered in 32-bits mode. */
  694|       |            unsigned r;
  695|       |            if (!(val>>by32)) { r=4; } else { r=0; val>>=by32; }
  696|       |            if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; }
  697|       |            r += (!val);
  698|       |            return r;
  699|       |#endif
  700|       |#       endif
  701|      0|        } else /* 32 bits */ {
  702|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  703|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  704|      0|                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  705|      0|            return (unsigned)__builtin_clz((U32)val) >> 3;
  706|       |#       else
  707|       |            val >>= 8;
  708|       |            val = ((((val + 0x00FFFF00) | 0x00FFFFFF) + val) |
  709|       |              (val + 0x00FF0000)) >> 24;
  710|       |            return (unsigned)val ^ 3;
  711|       |#       endif
  712|      0|        }
  713|      0|    }
  714|  8.85M|}
lz4.c:LZ4_read16:
  392|  29.1M|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  397|  1.88M|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_match8:
  995|  8.29M|{
  996|  8.29M|    if (sizeof(reg_t) == 8) return LZ4_read_ARCH(p) == LZ4_read_ARCH(q);
  ------------------
  |  Branch (996:9): [True: 8.29M, Folded]
  ------------------
  997|      0|    return (LZ4_read32(p) == LZ4_read32(q))
  ------------------
  |  Branch (997:12): [True: 0, False: 0]
  ------------------
  998|      0|        && (LZ4_read32((const BYTE*)p + 4) == LZ4_read32((const BYTE*)q + 4));
  ------------------
  |  Branch (998:12): [True: 0, False: 0]
  ------------------
  999|  8.29M|}
lz4.c:LZ4_compress_resumeWithPrefix:
 1461|    590|{
 1462|    590|    return LZ4_compress_generic_validated(cctx, src, dst, srcSize, NULL, dstCapacity, limitedOutput,
 1463|       |                byU32, withPrefix64k, noDictIssue, acceleration, NULL, state);
 1464|    590|}
lz4.c:LZ4_clampTable:
 1889|    898|{
 1890|    898|    U32* const hashTable = cctx->hashTable;
 1891|    898|    int i;
 1892|  3.67M|    for (i = 0; i < LZ4_HASH_SIZE_U32; i++)
  ------------------
  |  |  768|  3.67M|#define LZ4_HASH_SIZE_U32 (1 << LZ4_HASHLOG)       /* required as macro for static allocation */
  |  |  ------------------
  |  |  |  |  766|  3.67M|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|  3.67M|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  206|  3.67M|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1892:17): [True: 3.67M, False: 898]
  ------------------
 1893|  3.67M|        hashTable[i] = (hashTable[i] < lowIdx) ? lowIdx : hashTable[i];
  ------------------
  |  Branch (1893:24): [True: 2.82M, False: 855k]
  ------------------
 1894|    898|}
lz4.c:LZ4_decompress_generic:
 2277|  52.1k|{
 2278|  52.1k|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (2278:9): [True: 0, False: 52.1k]
  |  Branch (2278:26): [True: 0, False: 52.1k]
  ------------------
 2279|       |
 2280|  52.1k|    {   const BYTE* ip = (const BYTE*) src;
 2281|  52.1k|        const BYTE* const iend = ip + srcSize;
 2282|       |
 2283|  52.1k|        BYTE* op = (BYTE*) dst;
 2284|  52.1k|        BYTE* const oend = op + outputSize;
 2285|       |
 2286|  52.1k|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (2286:37): [True: 49.4k, False: 2.67k]
  ------------------
 2287|       |
 2288|       |        /* withPrefix64k : offset <= 65535 can't reach beyond the 64 KB prefix */
 2289|  52.1k|        const int checkOffset = (dict != withPrefix64k) && (dictSize < (int)(64 KB));
  ------------------
  |  |  250|  38.0k|#define KB *(1 <<10)
  ------------------
  |  Branch (2289:33): [True: 38.0k, False: 14.0k]
  |  Branch (2289:60): [True: 36.1k, False: 1.87k]
  ------------------
 2290|       |
 2291|       |
 2292|       |        /* Set up the "end" pointers for the shortcut. */
 2293|  52.1k|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 2294|  52.1k|        const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/;
 2295|       |
 2296|       |        /* shared by both loops : the fast loop can hand over a decoded match (safe_match_copy) */
 2297|  52.1k|        const BYTE* match;
 2298|  52.1k|        size_t offset;
 2299|  52.1k|        size_t ml;   /* match length */
 2300|       |
 2301|       |        /* incompleteInput : start of the current sequence, where decoding stops if it can't be completed */
 2302|  52.1k|        const BYTE* seqIp = NULL;
 2303|  52.1k|        BYTE* seqOp = NULL;
 2304|       |
 2305|  52.1k|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  288|  52.1k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2306|       |
 2307|       |        /* Special cases */
 2308|  52.1k|        assert(lowPrefix <= op);
  ------------------
  |  Branch (2308:9): [True: 0, False: 52.1k]
  |  Branch (2308:9): [True: 52.1k, False: 0]
  ------------------
 2309|  52.1k|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  180|  52.1k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  52.1k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 52.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2310|       |            /* Empty output buffer */
 2311|      0|            if (partialDecoding) return 0;
  ------------------
  |  Branch (2311:17): [True: 0, False: 0]
  ------------------
 2312|      0|            if ((srcSize==1) && (*ip==0)) return 0;   /* empty block */
  ------------------
  |  Branch (2312:17): [True: 0, False: 0]
  |  Branch (2312:33): [True: 0, False: 0]
  ------------------
 2313|      0|            return (srcSize > 1) ? -2 : -1;   /* -2 : output buffer too small */
  ------------------
  |  Branch (2313:20): [True: 0, False: 0]
  ------------------
 2314|      0|        }
 2315|  52.1k|        if (unlikely(srcSize<=0)) { return -1; }
  ------------------
  |  |  180|  52.1k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  52.1k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 52.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2316|       |
 2317|       |    /* LZ4_FAST_DEC_LOOP:
 2318|       |     * designed for modern OoO performance cpus,
 2319|       |     * where copying reliably 32-bytes is preferable to an unpredictable branch.
 2320|       |     * note : fast loop may show a regression for some client arm chips. */
 2321|  52.1k|#if LZ4_FAST_DEC_LOOP
 2322|  52.1k|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  247|  52.1k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2322:13): [True: 0, False: 52.1k]
  ------------------
 2323|      0|            DEBUGLOG(6, "move to safe decode loop");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2324|      0|            goto safe_decode;
 2325|      0|        }
 2326|       |        /* Ring buffer restarting at its beginning : the oldest referenced history (max distance behind op)
 2327|       |         * lies in the external dictionary, ahead of op, always at the same distance.
 2328|       |         * Rings sized with the former LZ4_DECODER_RING_BUFFER_SIZE() (margin 14, up to v1.10.0)
 2329|       |         * still work, but leave as little as 16 bytes :
 2330|       |         * the fast loop's wide copies could overwrite it, the safe loop's can't. */
 2331|  52.1k|        if ( (dict==usingExtDict)
  ------------------
  |  Branch (2331:14): [True: 2.67k, False: 49.4k]
  ------------------
 2332|  2.67k|          && ((uptrval)dictEnd - (uptrval)lowPrefix - LZ4_DISTANCE_ABSOLUTE_MAX < FASTLOOP_SAFE_DISTANCE) ) {
  ------------------
  |  |  254|  2.67k|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
                        && ((uptrval)dictEnd - (uptrval)lowPrefix - LZ4_DISTANCE_ABSOLUTE_MAX < FASTLOOP_SAFE_DISTANCE) ) {
  ------------------
  |  |  247|  2.67k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2332:14): [True: 0, False: 2.67k]
  ------------------
 2333|      0|            DEBUGLOG(6, "history just ahead : move to safe decode loop");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2334|      0|            goto safe_decode;
 2335|      0|        }
 2336|       |
 2337|       |        /* Fast loop : decode sequences as long as output < oend-FASTLOOP_SAFE_DISTANCE,
 2338|       |         * and input is not too close to iend.
 2339|       |         * It hands over to the safe loop either at a sequence start (break),
 2340|       |         * or once a match is fully decoded (goto safe_match_copy). */
 2341|  52.1k|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  288|  52.1k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2342|  29.0M|        while (1) {
  ------------------
  |  Branch (2342:16): [True: 29.0M, Folded]
  ------------------
 2343|  29.0M|            unsigned token;
 2344|  29.0M|            size_t ll;   /* literal length */
 2345|  29.0M|            BYTE* cpy;
 2346|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2347|  29.0M|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  Branch (2347:13): [True: 0, False: 29.0M]
  |  Branch (2347:13): [True: 29.0M, False: 0]
  ------------------
 2348|  29.0M|            assert(ip < iend);
  ------------------
  |  Branch (2348:13): [True: 0, False: 29.0M]
  |  Branch (2348:13): [True: 29.0M, False: 0]
  ------------------
 2349|  29.0M|            seqIp = ip; seqOp = op;
 2350|  29.0M|            token = *ip++;
 2351|  29.0M|            ll = token >> ML_BITS;
  ------------------
  |  |  259|  29.0M|#define ML_BITS  4
  ------------------
 2352|  29.0M|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)ll);
  ------------------
  |  |  288|  29.0M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2353|       |
 2354|       |            /* too close to input end : the safe loop restarts this sequence */
 2355|  29.0M|            if (ip > iend-(16 + 1/*max lit + offset + nextToken*/)) { ip--; break; }
  ------------------
  |  Branch (2355:17): [True: 27.2k, False: 29.0M]
  ------------------
 2356|       |
 2357|       |            /* decode literal length */
 2358|  29.0M|            if (ll == RUN_MASK) {
  ------------------
  |  |  262|  29.0M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  29.0M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  29.0M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2358:17): [True: 1.82M, False: 27.2M]
  ------------------
 2359|       |                /* literal length >= RUN_MASK means >= RUN_MASK literal bytes follow the extension bytes,
 2360|       |                 * so extension bytes cannot reach the last RUN_MASK bytes of input */
 2361|  1.82M|                const BYTE* const tokenPos = ip-1;
 2362|  1.82M|                size_t const addl = read_variable_length(&ip, iend - RUN_MASK);
  ------------------
  |  |  262|  1.82M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.82M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  1.82M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2363|  1.82M|                if (addl == rvl_error) {
  ------------------
  |  Branch (2363:21): [True: 87, False: 1.82M]
  ------------------
 2364|     87|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  288|     87|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2365|     87|                    goto _output_error;
 2366|     87|                }
 2367|  1.82M|                ll += addl;
 2368|  1.82M|                if (unlikely((uptrval)(op)+ll<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  1.82M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  1.82M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 1.82M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2369|  1.82M|                if (unlikely((uptrval)(ip)+ll<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  1.82M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  1.82M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 1.82M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2370|       |
 2371|       |                /* copy literals, unless too close to the end for a wild copy :
 2372|       |                 * nothing is written yet, so the safe loop can restart this sequence */
 2373|  1.82M|                cpy = op+ll;
 2374|  1.82M|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  276|  1.82M|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2375|  1.82M|              #if LZ4_WILDCOPY64
 2376|  1.82M|                if ((cpy>oend-64) || (ip+ll>iend-64)) { ip = tokenPos; break; }
  ------------------
  |  Branch (2376:21): [True: 3.50k, False: 1.82M]
  |  Branch (2376:38): [True: 13.9k, False: 1.80M]
  ------------------
 2377|  1.80M|                LZ4_wildCopy64(op, ip, cpy);
 2378|       |              #else
 2379|       |                if ((cpy>oend-32) || (ip+ll>iend-32)) { ip = tokenPos; break; }
 2380|       |                LZ4_wildCopy32(op, ip, cpy);
 2381|       |              #endif
 2382|  1.80M|                ip += ll; op = cpy;
 2383|  27.2M|            } else {
 2384|  27.2M|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)ll);
  ------------------
  |  |  288|  27.2M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2385|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2386|  27.2M|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  348|  27.2M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2387|  27.2M|                ip += ll; op += ll;
 2388|  27.2M|            }
 2389|       |
 2390|       |            /* get offset */
 2391|  29.0M|            offset = LZ4_readLE16(ip); ip+=2;
 2392|  29.0M|            DEBUGLOG(6, "blockPos%6u: offset = %u", (unsigned)(op-(BYTE*)dst), (unsigned)offset);
  ------------------
  |  |  288|  29.0M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2393|  29.0M|            match = op - offset;
 2394|  29.0M|            assert(match <= op);  /* overflow check */
  ------------------
  |  Branch (2394:13): [True: 0, False: 29.0M]
  |  Branch (2394:13): [True: 29.0M, False: 0]
  ------------------
 2395|       |
 2396|       |            /* get matchlength */
 2397|  29.0M|            ml = token & ML_MASK;
  ------------------
  |  |  260|  29.0M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  29.0M|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2398|  29.0M|            DEBUGLOG(7, "  match length token = %u (len==%u)", (unsigned)ml, (unsigned)ml+MINMATCH);
  ------------------
  |  |  288|  29.0M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2399|       |
 2400|  29.0M|            if (ml == ML_MASK) {
  ------------------
  |  |  260|  29.0M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  29.0M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2400:17): [True: 4.71M, False: 24.3M]
  ------------------
 2401|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2402|  4.71M|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  244|  4.71M|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2403|  4.71M|                if (addl == rvl_error) {
  ------------------
  |  Branch (2403:21): [True: 131, False: 4.71M]
  ------------------
 2404|    131|                    DEBUGLOG(5, "error reading long match length");
  ------------------
  |  |  288|    131|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2405|    131|                    goto _output_error;
 2406|    131|                }
 2407|  4.71M|                ml += addl;
 2408|  4.71M|                DEBUGLOG(7, "  long match length == %u", (unsigned)ml + MINMATCH);
  ------------------
  |  |  288|  4.71M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2409|  4.71M|                if (unlikely((uptrval)(op)+ml+MINMATCH<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  4.71M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  4.71M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 4.71M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2410|  4.71M|            }
 2411|  29.0M|            ml += MINMATCH;
  ------------------
  |  |  241|  29.0M|#define MINMATCH 4
  ------------------
 2412|       |
 2413|  29.0M|            if (op + ml >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  247|  29.0M|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2413:17): [True: 6.77k, False: 29.0M]
  ------------------
 2414|  6.77k|                DEBUGLOG(7, "moving to safe_match_copy (ml==%u)", (unsigned)ml);
  ------------------
  |  |  288|  6.77k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2415|  6.77k|                goto safe_match_copy;
 2416|  6.77k|            }
 2417|       |
 2418|       |            /* match length from token only (<= 18), no overlap, within prefix : copy 18 bytes */
 2419|  29.0M|            if ( ((token & ML_MASK) != ML_MASK) && (offset >= 8)
  ------------------
  |  |  260|  29.0M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  29.0M|#define ML_BITS  4
  |  |  ------------------
  ------------------
                          if ( ((token & ML_MASK) != ML_MASK) && (offset >= 8)
  ------------------
  |  |  260|  29.0M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  29.0M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2419:18): [True: 24.3M, False: 4.70M]
  |  Branch (2419:52): [True: 23.0M, False: 1.25M]
  ------------------
 2420|  23.0M|              && ((dict == withPrefix64k) || (match >= lowPrefix)) ) {
  ------------------
  |  Branch (2420:19): [True: 9.66M, False: 13.4M]
  |  Branch (2420:46): [True: 13.2M, False: 121k]
  ------------------
 2421|  22.9M|                assert(match >= lowPrefix);
  ------------------
  |  Branch (2421:17): [True: 0, False: 22.9M]
  |  Branch (2421:17): [True: 22.9M, False: 0]
  ------------------
 2422|  22.9M|                assert(match <= op);
  ------------------
  |  Branch (2422:17): [True: 0, False: 22.9M]
  |  Branch (2422:17): [True: 22.9M, False: 0]
  ------------------
 2423|  22.9M|                assert(op + 18 <= oend);
  ------------------
  |  Branch (2423:17): [True: 0, False: 22.9M]
  |  Branch (2423:17): [True: 22.9M, False: 0]
  ------------------
 2424|  22.9M|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  348|  22.9M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2425|  22.9M|                LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  348|  22.9M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2426|  22.9M|                LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  348|  22.9M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2427|  22.9M|                op += ml;
 2428|  22.9M|                continue;
 2429|  22.9M|            }
 2430|       |
 2431|       |            /* match ends far from oend : no end-of-block condition to check */
 2432|  29.0M|            assert(op + ml < oend - FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  Branch (2432:13): [True: 0, False: 6.08M]
  |  Branch (2432:13): [True: 6.08M, False: 0]
  ------------------
 2433|       |
 2434|  6.08M|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  180|  3.25M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  3.25M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2434:18): [True: 3.25M, False: 2.83M]
  |  Branch (2434:33): [True: 363, False: 3.24M]
  ------------------
 2435|    363|                DEBUGLOG(5, "Error : pos=%zi, offset=%zi => outside buffers", op-lowPrefix, op-match);
  ------------------
  |  |  288|    363|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2436|    363|                goto _offset_error;
 2437|    363|            }
 2438|       |            /* match starting within external dictionary */
 2439|  6.08M|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2439:17): [True: 458k, False: 5.62M]
  |  Branch (2439:41): [True: 170k, False: 287k]
  ------------------
 2440|   170k|                size_t const inDict = (size_t)(lowPrefix - match);
 2441|   170k|                assert(dictEnd != NULL);
  ------------------
  |  Branch (2441:17): [True: 0, False: 170k]
  |  Branch (2441:17): [True: 170k, False: 0]
  ------------------
 2442|   170k|                if (ml + 16 <= inDict) {
  ------------------
  |  Branch (2442:21): [True: 168k, False: 2.75k]
  ------------------
 2443|       |                    /* match within dictionary, followed by 16 more bytes of dictionary : wild copy */
 2444|   168k|                    LZ4_wildCopy16(op, dictEnd - inDict, op + ml);
 2445|   168k|                    op += ml;
 2446|   168k|                    continue;
 2447|   168k|                }
 2448|  2.75k|                op = LZ4_copyExtDictMatch(op, match, ml, lowPrefix, dictEnd);
 2449|  2.75k|                continue;
 2450|   170k|            }
 2451|       |
 2452|       |            /* copy match within block */
 2453|  5.91M|            cpy = op + ml;
 2454|       |
 2455|  5.91M|            assert((op <= oend) && (oend-op >= 64));
  ------------------
  |  Branch (2455:13): [True: 0, False: 5.91M]
  |  Branch (2455:13): [True: 0, False: 0]
  |  Branch (2455:13): [True: 5.91M, False: 0]
  |  Branch (2455:13): [True: 5.91M, False: 0]
  ------------------
 2456|  5.91M|            if (unlikely(offset<16)) {
  ------------------
  |  |  180|  5.91M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  5.91M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 1.67M, False: 4.23M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2457|  1.67M|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2458|  1.67M|    #if LZ4_WILDCOPY64
 2459|  4.23M|            } else if (offset >= 64) {
  ------------------
  |  Branch (2459:24): [True: 3.91M, False: 319k]
  ------------------
 2460|  3.91M|                LZ4_wildCopy64(op, match, cpy);
 2461|  3.91M|    #endif
 2462|  3.91M|            } else {
 2463|   319k|                LZ4_wildCopy32(op, match, cpy);
 2464|   319k|            }
 2465|       |
 2466|  5.91M|            op = cpy;   /* wildcopy correction */
 2467|  5.91M|        }
 2468|  44.7k|    safe_decode:
 2469|  44.7k|#endif
 2470|       |
 2471|       |        /* Safe loop : decode remaining sequences, without writing beyond oend nor reading beyond iend.
 2472|       |         * With LZ4_FAST_DEC_LOOP, that's the end of the block (or a block too small for the fast loop),
 2473|       |         * entered at a sequence start, or at safe_match_copy with a decoded match.
 2474|       |         * Without it, that's the whole block. */
 2475|  44.7k|        DEBUGLOG(6, "using safe decode loop");
  ------------------
  |  |  288|  44.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2476|   142k|        while (1) {
  ------------------
  |  Branch (2476:16): [True: 142k, Folded]
  ------------------
 2477|   142k|            unsigned token;
 2478|   142k|            size_t ll;   /* literal length */
 2479|   142k|            BYTE* cpy;
 2480|   142k|            assert(ip < iend);
  ------------------
  |  Branch (2480:13): [True: 0, False: 142k]
  |  Branch (2480:13): [True: 142k, False: 0]
  ------------------
 2481|   142k|            seqIp = ip; seqOp = op;
 2482|   142k|            token = *ip++;
 2483|   142k|            ll = token >> ML_BITS;
  ------------------
  |  |  259|   142k|#define ML_BITS  4
  ------------------
 2484|   142k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)ll);
  ------------------
  |  |  288|   142k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2485|       |
 2486|       |            /* A two-stage shortcut for the most common case:
 2487|       |             * 1) If the literal length is 0..14, and there is enough space,
 2488|       |             * enter the shortcut and copy 16 bytes on behalf of the literals.
 2489|       |             * 2) Further if the match length is 4..18, copy 18 bytes in a similar
 2490|       |             * manner; but we ensure that there's enough space in the output for
 2491|       |             * those 18 bytes earlier, upon entering the shortcut (in other words,
 2492|       |             * there is a combined check for both stages).
 2493|       |             */
 2494|   142k|            if ( (ll != RUN_MASK)
  ------------------
  |  |  262|   142k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   142k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|   142k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2494:18): [True: 120k, False: 22.4k]
  ------------------
 2495|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2496|   120k|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  177|   120k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|   120k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 32.6k, False: 87.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2497|       |                /* Copy the literals */
 2498|  32.6k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  348|  32.6k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2499|  32.6k|                op += ll; ip += ll;
 2500|       |
 2501|       |                /* The second stage: prepare for match copying, decode full info.
 2502|       |                 * If it doesn't work out, the info won't be wasted. */
 2503|  32.6k|                offset = LZ4_readLE16(ip); ip += 2;
 2504|  32.6k|                match = op - offset;
 2505|  32.6k|                assert(match <= op); /* check overflow */
  ------------------
  |  Branch (2505:17): [True: 0, False: 32.6k]
  |  Branch (2505:17): [True: 32.6k, False: 0]
  ------------------
 2506|  32.6k|                ml = token & ML_MASK;
  ------------------
  |  |  260|  32.6k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  32.6k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2507|  32.6k|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u (len=%u)", (unsigned)(op-(BYTE*)dst), (unsigned)ml, (unsigned)ml + 4);
  ------------------
  |  |  288|  32.6k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2508|       |
 2509|       |                /* Do not deal with overlapping matches. */
 2510|  32.6k|                if ( (ml != ML_MASK)
  ------------------
  |  |  260|  32.6k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  32.6k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2510:22): [True: 24.1k, False: 8.45k]
  ------------------
 2511|  24.1k|                  && (offset >= 8)
  ------------------
  |  Branch (2511:22): [True: 18.7k, False: 5.45k]
  ------------------
 2512|  18.7k|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2512:23): [True: 6.31k, False: 12.4k]
  |  Branch (2512:46): [True: 12.1k, False: 220]
  ------------------
 2513|       |                    /* Copy the match. */
 2514|  18.5k|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  348|  18.5k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2515|  18.5k|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  348|  18.5k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2516|  18.5k|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  348|  18.5k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2517|  18.5k|                    op += ml + MINMATCH;
  ------------------
  |  |  241|  18.5k|#define MINMATCH 4
  ------------------
 2518|       |                    /* Both stages worked, load the next token. */
 2519|  18.5k|                    continue;
 2520|  18.5k|                }
 2521|       |                /* The second stage didn't work out, but the info is ready for the match copy below. */
 2522|   110k|            } else {
 2523|       |                /* decode literal length */
 2524|   110k|                if (ll == RUN_MASK) {
  ------------------
  |  |  262|   110k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   110k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|   110k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2524:21): [True: 22.4k, False: 87.8k]
  ------------------
 2525|       |                    /* literal length >= RUN_MASK means >= RUN_MASK literal bytes follow the extension bytes,
 2526|       |                     * so extension bytes cannot reach the last RUN_MASK bytes of input */
 2527|  22.4k|                    size_t const addl = read_variable_length(&ip, iend-RUN_MASK);
  ------------------
  |  |  262|  22.4k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  22.4k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  22.4k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2528|  22.4k|                    if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2528:25): [True: 300, False: 22.1k]
  ------------------
 2529|  22.1k|                    ll += addl;
 2530|  22.1k|                    if (unlikely((uptrval)(op)+ll<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  22.1k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  22.1k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 22.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2531|  22.1k|                    if (unlikely((uptrval)(ip)+ll<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  22.1k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  22.1k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 22.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2532|  22.1k|                }
 2533|       |
 2534|       |                /* copy literals */
 2535|   109k|                cpy = op+ll;
 2536|   109k|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  276|   109k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2537|   109k|                if ((cpy>oend-MFLIMIT) || (ip+ll>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  245|   109k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                              if ((cpy>oend-MFLIMIT) || (ip+ll>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  244|  94.0k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2537:21): [True: 15.8k, False: 94.0k]
  |  Branch (2537:43): [True: 34.7k, False: 59.3k]
  ------------------
 2538|       |                    /* close to input or output end : these must be the last literals of the block,
 2539|       |                     * except with partialDecoding, which can also stop within them,
 2540|       |                     * and incompleteInput, which stops before them : the block goes on */
 2541|  50.6k|                    if (incompleteInput) goto _incomplete;
  ------------------
  |  Branch (2541:25): [True: 5, False: 50.6k]
  ------------------
 2542|  50.6k|                    if (partialDecoding) {
  ------------------
  |  Branch (2542:25): [True: 0, False: 50.6k]
  ------------------
 2543|       |                        /* stop at input end, or when output is full */
 2544|      0|                        ll = MIN(ll, (size_t)(iend-ip));
  ------------------
  |  | 2047|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (2047:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2545|      0|                        ll = MIN(ll, (size_t)(oend-op));
  ------------------
  |  | 2047|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (2047:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2546|  50.6k|                    } else if ((ip+ll != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2546:32): [True: 1.14k, False: 49.5k]
  |  Branch (2546:51): [True: 58, False: 49.4k]
  ------------------
 2547|       |                        /* last literals must end exactly at input end, within output */
 2548|  1.19k|                        DEBUGLOG(5, "invalid last literals : they end at iend%+zi and oend%+zi", (ip+ll)-iend, cpy-oend);
  ------------------
  |  |  288|  1.19k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2549|  1.19k|                        if ((ip+ll <= iend) && (cpy > oend-MFLIMIT)) goto _dst_too_small;   /* output full, input left */
  ------------------
  |  |  245|    521|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2549:29): [True: 521, False: 678]
  |  Branch (2549:48): [True: 177, False: 344]
  ------------------
 2550|  1.02k|                        goto _output_error;
 2551|  1.19k|                    }
 2552|  49.4k|                    LZ4_memmove(op, ip, ll);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  356|  49.4k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2553|  49.4k|                    ip += ll;
 2554|  49.4k|                    op += ll;
 2555|       |                    /* end of block, unless partialDecoding can go on : output not full, input left for a match */
 2556|  49.4k|                    if (!partialDecoding || (op == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2556:25): [True: 49.4k, False: 0]
  |  Branch (2556:45): [True: 0, False: 0]
  |  Branch (2556:61): [True: 0, False: 0]
  ------------------
 2557|  49.4k|                        break;
 2558|  49.4k|                    }
 2559|  59.3k|                } else {
 2560|  59.3k|                    LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2561|  59.3k|                    ip += ll; op = cpy;
 2562|  59.3k|                }
 2563|       |
 2564|       |                /* get offset */
 2565|  59.3k|                offset = LZ4_readLE16(ip); ip+=2;
 2566|  59.3k|                match = op - offset;
 2567|       |
 2568|       |                /* get matchlength */
 2569|  59.3k|                ml = token & ML_MASK;
  ------------------
  |  |  260|  59.3k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  59.3k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2570|  59.3k|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)ml);
  ------------------
  |  |  288|  59.3k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2571|  59.3k|            }
 2572|       |
 2573|       |            /* literals copied, offset decoded, ml == match length token */
 2574|  73.4k|            if (ml == ML_MASK) {
  ------------------
  |  |  260|  73.4k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  73.4k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2574:17): [True: 29.8k, False: 43.6k]
  ------------------
 2575|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2576|  29.8k|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  244|  29.8k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2577|  29.8k|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2577:21): [True: 159, False: 29.6k]
  ------------------
 2578|  29.6k|                ml += addl;
 2579|  29.6k|                if (unlikely((uptrval)(op)+ml+MINMATCH<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  180|  29.6k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  29.6k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 29.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2580|  29.6k|            }
 2581|  73.2k|            ml += MINMATCH;
  ------------------
  |  |  241|  73.2k|#define MINMATCH 4
  ------------------
 2582|       |
 2583|  73.2k|#if LZ4_FAST_DEC_LOOP
 2584|  80.0k|        safe_match_copy:
 2585|  80.0k|#endif
 2586|       |            /* literals copied, match fully decoded (ml includes MINMATCH), offset not validated yet */
 2587|  80.0k|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _offset_error;   /* Error : offset outside buffers */
  ------------------
  |  |  180|  51.3k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  51.3k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2587:17): [True: 51.3k, False: 28.7k]
  |  Branch (2587:34): [True: 309, False: 51.0k]
  ------------------
 2588|       |
 2589|       |            /* end of block : the last LASTLITERALS bytes must be literals */
 2590|  80.0k|            assert(op <= oend);
  ------------------
  |  Branch (2590:13): [True: 0, False: 79.7k]
  |  Branch (2590:13): [True: 79.7k, False: 0]
  ------------------
 2591|  79.7k|            if (unlikely(op+ml > oend-LASTLITERALS)) {
  ------------------
  |  |  180|  79.7k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  79.7k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 95, False: 79.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2592|     95|                if (partialDecoding) ml = MIN(ml, (size_t)(oend-op));   /* partialDecoding : may end anywhere */
  ------------------
  |  | 2047|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (2047:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2592:21): [True: 0, False: 95]
  ------------------
 2593|     95|                else goto _dst_too_small;
 2594|     95|            }
 2595|       |
 2596|       |            /* match starting within external dictionary */
 2597|  79.6k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2597:17): [True: 4.53k, False: 75.1k]
  |  Branch (2597:41): [True: 420, False: 4.11k]
  ------------------
 2598|    420|                assert(dictEnd != NULL);
  ------------------
  |  Branch (2598:17): [True: 0, False: 420]
  |  Branch (2598:17): [True: 420, False: 0]
  ------------------
 2599|    420|                op = LZ4_copyExtDictMatch(op, match, ml, lowPrefix, dictEnd);
 2600|    420|                continue;
 2601|    420|            }
 2602|  79.6k|            assert(match >= lowPrefix);
  ------------------
  |  Branch (2602:13): [True: 0, False: 79.2k]
  |  Branch (2602:13): [True: 79.2k, False: 0]
  ------------------
 2603|       |
 2604|       |            /* close to block end : no wild copy */
 2605|  79.2k|            if (unlikely(op+ml > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  180|  79.2k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  79.2k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 11.8k, False: 67.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2606|  11.8k|                op = LZ4_copyMatchExact(op, match, ml);
 2607|  11.8k|                if (op == oend) { break; }   /* partialDecoding : output buffer full */
  ------------------
  |  Branch (2607:21): [True: 0, False: 11.8k]
  ------------------
 2608|  11.8k|                continue;
 2609|  11.8k|            }
 2610|       |
 2611|       |            /* copy match within block */
 2612|  67.3k|            cpy = op + ml;
 2613|  67.3k|            LZ4_memcpy_using_offset_base(op, match, cpy, offset);
 2614|  67.3k|            op = cpy;   /* wildcopy correction */
 2615|  67.3k|        }
 2616|       |
 2617|       |        /* end of decoding */
 2618|  49.4k|        assert(!incompleteInput);   /* never ends the block : stops before its last literals */
  ------------------
  |  Branch (2618:9): [True: 0, False: 49.4k]
  |  Branch (2618:9): [True: 49.4k, False: 0]
  ------------------
 2619|  49.4k|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  288|  49.4k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2620|  49.4k|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2621|       |
 2622|     15|    _incomplete:   /* incompleteInput : stop before the current sequence, which can't be decoded yet */
 2623|     15|        DEBUGLOG(5, "incomplete input : decoded %i bytes", (int)(seqOp - (BYTE*)dst));
  ------------------
  |  |  288|     15|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2624|     15|        *srcEndPtr = (const char*)seqIp;
 2625|     15|        return (int)(seqOp - (BYTE*)dst);
 2626|       |
 2627|       |        /* errors : see LZ4_decompress_safe() in lz4.h
 2628|       |         * incompleteInput : input ends within the current sequence, or output is full,
 2629|       |         * or the sequence is invalid (reported once the block is complete) : stop before it */
 2630|  1.69k|    _output_error:
 2631|  1.69k|        if (incompleteInput) goto _incomplete;
  ------------------
  |  Branch (2631:13): [True: 0, False: 1.69k]
  ------------------
 2632|  1.69k|        return -1;
 2633|    272|    _dst_too_small:
 2634|    272|        if (incompleteInput) goto _incomplete;
  ------------------
  |  Branch (2634:13): [True: 10, False: 262]
  ------------------
 2635|    262|        return -2;
 2636|    672|    _offset_error:
 2637|    672|        if (incompleteInput) goto _incomplete;
  ------------------
  |  Branch (2637:13): [True: 0, False: 672]
  ------------------
 2638|    672|        return -3;
 2639|    672|    }
 2640|    672|}
lz4.c:read_variable_length:
 2182|  6.58M|{
 2183|  6.58M|    Rvl_t s, length = 0;
 2184|  6.58M|    assert(ipPtr != NULL);
  ------------------
  |  Branch (2184:5): [True: 0, False: 6.58M]
  |  Branch (2184:5): [True: 6.58M, False: 0]
  ------------------
 2185|  6.58M|    assert(*ipPtr !=  NULL);
  ------------------
  |  Branch (2185:5): [True: 0, False: 6.58M]
  |  Branch (2185:5): [True: 6.58M, False: 0]
  ------------------
 2186|  6.58M|    assert(ilimit != NULL);
  ------------------
  |  Branch (2186:5): [True: 0, False: 6.58M]
  |  Branch (2186:5): [True: 6.58M, False: 0]
  ------------------
 2187|  6.58M|    if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|  6.58M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  6.58M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 315, False: 6.58M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2188|    315|        return rvl_error;
 2189|    315|    }
 2190|  6.58M|    s = **ipPtr;
 2191|  6.58M|    (*ipPtr)++;
 2192|  6.58M|    length += s;
 2193|  6.58M|    if (likely(s != 255)) return length;
  ------------------
  |  |  177|  6.58M|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|  6.58M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 5.83M, False: 754k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2194|  4.96M|    do {
 2195|  4.96M|        if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|  4.96M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  4.96M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 362, False: 4.96M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2196|    362|            return rvl_error;
 2197|    362|        }
 2198|  4.96M|        s = **ipPtr;
 2199|  4.96M|        (*ipPtr)++;
 2200|  4.96M|        length += s;
 2201|       |        /* accumulator overflow detection (32-bit mode only) */
 2202|  4.96M|        if ((sizeof(length) < 8) && unlikely(length > ((Rvl_t)(-1)/2)) ) {
  ------------------
  |  |  180|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2202:13): [Folded, False: 4.96M]
  ------------------
 2203|      0|            return rvl_error;
 2204|      0|        }
 2205|  4.96M|    } while (s == 255);
  ------------------
  |  Branch (2205:14): [True: 4.21M, False: 754k]
  ------------------
 2206|       |
 2207|   754k|    return length;
 2208|   754k|}
lz4.c:LZ4_wildCopy64:
  536|  5.72M|{
  537|  5.72M|    BYTE* d = (BYTE*)dstPtr;
  538|  5.72M|    const BYTE* s = (const BYTE*)srcPtr;
  539|  5.72M|    BYTE* const e = (BYTE*)dstEnd;
  540|       |
  541|  19.6M|    do { LZ4_memcpy(d,s,64); d+=64; s+=64; } while (d<e);
  ------------------
  |  |  348|  19.6M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (541:53): [True: 13.9M, False: 5.72M]
  ------------------
  542|  5.72M|}
lz4.c:LZ4_readLE16:
  430|  29.1M|{
  431|  29.1M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (431:9): [True: 29.1M, False: 0]
  ------------------
  432|  29.1M|        return LZ4_read16(memPtr);
  433|  29.1M|    } else {
  434|      0|        const BYTE* p = (const BYTE*)memPtr;
  435|      0|        return (U16)((U16)p[0] | (p[1]<<8));
  436|      0|    }
  437|  29.1M|}
lz4.c:LZ4_wildCopy16:
  562|   168k|{
  563|   168k|    BYTE* d = (BYTE*)dstPtr;
  564|   168k|    const BYTE* s = (const BYTE*)srcPtr;
  565|   168k|    BYTE* const e = (BYTE*)dstEnd;
  566|       |
  567|  1.59M|    do { LZ4_memcpy(d,s,16); d+=16; s+=16; } while (d<e);
  ------------------
  |  |  348|  1.59M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (567:53): [True: 1.42M, False: 168k]
  ------------------
  568|   168k|}
lz4.c:LZ4_copyExtDictMatch:
 2243|  3.17k|{
 2244|  3.17k|    if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2244:9): [True: 1.21k, False: 1.96k]
  ------------------
 2245|       |        /* match fits entirely within external dictionary : just copy */
 2246|  1.21k|        LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  356|  1.21k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2247|  1.21k|        return op + length;
 2248|  1.96k|    } else {
 2249|       |        /* match stretches into both external dictionary and current block */
 2250|  1.96k|        size_t const copySize = (size_t)(lowPrefix - match);
 2251|  1.96k|        LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  348|  1.96k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2252|  1.96k|        return LZ4_copyMatchExact(op + copySize, lowPrefix, length - copySize);
 2253|  1.96k|    }
 2254|  3.17k|}
lz4.c:LZ4_memcpy_using_offset:
  575|  1.67M|{
  576|  1.67M|    BYTE v[8];
  577|       |
  578|  1.67M|    assert(dstEnd >= dstPtr + MINMATCH);
  ------------------
  |  Branch (578:5): [True: 0, False: 1.67M]
  |  Branch (578:5): [True: 1.67M, False: 0]
  ------------------
  579|       |
  580|  1.67M|    switch(offset) {
  581|  1.00M|    case 1:
  ------------------
  |  Branch (581:5): [True: 1.00M, False: 676k]
  ------------------
  582|  1.00M|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  235|  1.00M|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  233|  1.00M|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  583|  1.00M|        break;
  584|   206k|    case 2:
  ------------------
  |  Branch (584:5): [True: 206k, False: 1.47M]
  ------------------
  585|   206k|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  348|   206k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  586|   206k|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  348|   206k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  587|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  588|       |#  pragma warning(push)
  589|       |#  pragma warning(disable : 6385) /* warning C6385: Reading invalid data from 'v'. */
  590|       |#endif
  591|   206k|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  348|   206k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  592|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  593|       |#  pragma warning(pop)
  594|       |#endif
  595|   206k|        break;
  596|  90.0k|    case 4:
  ------------------
  |  Branch (596:5): [True: 90.0k, False: 1.58M]
  ------------------
  597|  90.0k|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  348|  90.0k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  598|  90.0k|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  348|  90.0k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  599|  90.0k|        break;
  600|   380k|    default:
  ------------------
  |  Branch (600:5): [True: 380k, False: 1.29M]
  ------------------
  601|   380k|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  602|   380k|        return;
  603|  1.67M|    }
  604|       |
  605|  1.29M|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  348|  1.29M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  606|  1.29M|    dstPtr += 8;
  607|  25.6M|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (607:12): [True: 24.3M, False: 1.29M]
  ------------------
  608|  24.3M|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  348|  24.3M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  609|  24.3M|        dstPtr += 8;
  610|  24.3M|    }
  611|  1.29M|}
lz4.c:LZ4_wildCopy32:
  550|   319k|{
  551|   319k|    BYTE* d = (BYTE*)dstPtr;
  552|   319k|    const BYTE* s = (const BYTE*)srcPtr;
  553|   319k|    BYTE* const e = (BYTE*)dstEnd;
  554|       |
  555|  3.47M|    do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  348|  3.47M|#    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);
  ------------------
  |  |  348|  3.47M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (555:79): [True: 3.15M, False: 319k]
  ------------------
  556|   319k|}
lz4.c:LZ4_copyMatchExact:
 2217|  13.8k|{
 2218|  13.8k|    if (unlikely(match == op)) {   /* invalid offset 0 : clear the match segment, see doc/lz4_Block_format.md */
  ------------------
  |  |  180|  13.8k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  13.8k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 48, False: 13.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2219|     48|        MEM_INIT(op, 0, length);
  ------------------
  |  |  235|     48|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  233|     48|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 2220|     48|        return op + length;
 2221|     48|    }
 2222|       |    /* bytes from match to op repeat with period (op-match) :
 2223|       |     * copy all of them, so the distance doubles at each round.
 2224|       |     * Beyond 2 KB, keep the distance : larger copies of just written data are slower */
 2225|  72.9k|    while (length > (size_t)(op - match)) {
  ------------------
  |  Branch (2225:12): [True: 59.1k, False: 13.8k]
  ------------------
 2226|  59.1k|        size_t const available = (size_t)(op - match);
 2227|  59.1k|        LZ4_memcpy(op, match, available);
  ------------------
  |  |  348|  59.1k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2228|  59.1k|        op += available;
 2229|  59.1k|        length -= available;
 2230|  59.1k|        if (available >= 2048) match += available;
  ------------------
  |  Branch (2230:13): [True: 35.0k, False: 24.1k]
  ------------------
 2231|  59.1k|    }
 2232|  13.8k|    LZ4_memcpy(op, match, length);
  ------------------
  |  |  348|  13.8k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2233|  13.8k|    return op + length;
 2234|  13.8k|}
lz4.c:LZ4_memcpy_using_offset_base:
  496|   447k|{
  497|   447k|    assert(srcPtr + offset == dstPtr);
  ------------------
  |  Branch (497:5): [True: 0, False: 447k]
  |  Branch (497:5): [True: 447k, False: 0]
  ------------------
  498|   447k|    if (unlikely(offset < 8)) {
  ------------------
  |  |  180|   447k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|   447k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 357k, False: 89.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  499|   357k|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  500|   357k|        dstPtr[0] = srcPtr[0];
  501|   357k|        dstPtr[1] = srcPtr[1];
  502|   357k|        dstPtr[2] = srcPtr[2];
  503|   357k|        dstPtr[3] = srcPtr[3];
  504|   357k|        srcPtr += inc32table[offset];
  505|   357k|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  348|   357k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  506|   357k|        srcPtr -= dec64table[offset];
  507|   357k|    } else {
  508|  89.9k|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  348|  89.9k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  509|  89.9k|        srcPtr += 8;
  510|  89.9k|    }
  511|   447k|    dstPtr += 8;
  512|       |
  513|       |    /* srcPtr is now at least 8 bytes behind dstPtr */
  514|   447k|    LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  348|   447k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  515|   447k|    if (dstEnd > dstPtr + 8) { LZ4_wildCopy8(dstPtr + 8, srcPtr + 8, dstEnd); }
  ------------------
  |  Branch (515:9): [True: 123k, False: 323k]
  ------------------
  516|   447k|}
lz4.c:LZ4_decompress_incomplete_extDict:
 2785|     15|{
 2786|     15|    return LZ4_decompress_generic(src, dst, srcSize, dstCapacity,
 2787|     15|                                  decode_full_block, usingExtDict,
 2788|     15|                                  (BYTE*)dst, (const BYTE*)dictStart, dictSize,
 2789|     15|                                  incomplete_input, srcEndPtr);
 2790|     15|}
lz4.c:LZ4_decompress_safe_withSmallPrefix:
 2705|  5.31k|{
 2706|  5.31k|    return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
 2707|  5.31k|                                  decode_full_block, noDict,
 2708|  5.31k|                                  (BYTE*)dest-prefixSize, NULL, 0,
 2709|       |                                  complete_input, NULL);
 2710|  5.31k|}

LZ4F_readOpen_advanced:
  185|  31.3k|{
  186|  31.3k|    LZ4_readFile_t* readFile;
  187|       |
  188|       |    /* Validate parameters */
  189|  31.3k|    if (lz4fRead == NULL) {
  ------------------
  |  Branch (189:9): [True: 0, False: 31.3k]
  ------------------
  190|      0|        RETURN_ERROR(parameter_null);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  191|      0|    }
  192|  31.3k|    *lz4fRead = NULL;   /* in case of failure */
  193|  31.3k|    if (fp == NULL) {
  ------------------
  |  Branch (193:9): [True: 0, False: 31.3k]
  ------------------
  194|      0|        RETURN_ERROR(parameter_null);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  195|      0|    }
  196|       |
  197|       |    /* Allocate read file structure */
  198|  31.3k|    readFile = (LZ4_readFile_t*)fileMalloc(sizeof(LZ4_readFile_t), customMem);
  199|  31.3k|    if (readFile == NULL) {
  ------------------
  |  Branch (199:9): [True: 0, False: 31.3k]
  ------------------
  200|      0|        RETURN_ERROR(allocation_failed);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  201|      0|    }
  202|  31.3k|    memset(readFile, 0, sizeof(*readFile));
  203|  31.3k|    readFile->cmem = customMem;
  204|       |
  205|  31.3k|    readFile->fp = fp;
  206|  31.3k|    readFile->seekable = (ftell(fp) != -1L);   /* no position on pipes */
  207|       |
  208|       |    /* Initialize decompression context */
  209|  31.3k|    readFile->dctxPtr = LZ4F_createDecompressionContext_advanced(customMem, LZ4F_VERSION);
  ------------------
  |  |  347|  31.3k|#define LZ4F_VERSION 100    /* This number can be used to check for an incompatible API breaking change */
  ------------------
  210|  31.3k|    if (readFile->dctxPtr == NULL) {
  ------------------
  |  Branch (210:9): [True: 0, False: 31.3k]
  ------------------
  211|      0|        freeReadFileResources(readFile);
  212|      0|        RETURN_ERROR(allocation_failed);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  213|      0|    }
  214|       |
  215|       |    /* Read and parse the header */
  216|  31.3k|    { LZ4F_errorCode_t const result = readAndParseHeader(readFile, fp);
  217|  31.3k|      if (LZ4F_isError(result)) {
  ------------------
  |  Branch (217:11): [True: 11.9k, False: 19.3k]
  ------------------
  218|  11.9k|          freeReadFileResources(readFile);
  219|  11.9k|          return result;
  220|  11.9k|    } }
  221|       |
  222|  19.3k|    *lz4fRead = readFile;
  223|  19.3k|    return LZ4F_OK_NoError;
  224|  31.3k|}
LZ4F_readOpen:
  227|  31.3k|{
  228|  31.3k|    return LZ4F_readOpen_advanced(lz4fRead, fp, LZ4F_defaultCMem);
  229|  31.3k|}
LZ4F_read:
  297|  66.3k|{
  298|  66.3k|  LZ4_byte* outPtr = (LZ4_byte*)buf;
  299|  66.3k|  size_t totalBytesRead = 0;
  300|       |
  301|  66.3k|  if (lz4fRead == NULL || buf == NULL)
  ------------------
  |  Branch (301:7): [True: 0, False: 66.3k]
  |  Branch (301:27): [True: 0, False: 66.3k]
  ------------------
  302|      0|    RETURN_ERROR(parameter_null);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  303|  66.3k|  if (LZ4F_isError(lz4fRead->error))
  ------------------
  |  Branch (303:7): [True: 966, False: 65.3k]
  ------------------
  304|    966|    return lz4fRead->error;
  305|       |
  306|   225k|  while (totalBytesRead < size) {
  ------------------
  |  Branch (306:10): [True: 173k, False: 51.5k]
  ------------------
  307|   173k|    size_t srcBytes = lz4fRead->srcBufSize - lz4fRead->srcBufNext;
  308|   173k|    size_t dstBytes = size - totalBytesRead;
  309|   173k|    size_t provided;
  310|       |
  311|   173k|    if (srcBytes == 0) {
  ------------------
  |  Branch (311:9): [True: 46.6k, False: 127k]
  ------------------
  312|  46.6k|      size_t bytesRead;
  313|  46.6k|      lz4fRead->srcBufPos += lz4fRead->srcBufSize;
  314|  46.6k|      lz4fRead->srcBufSize = 0;
  315|  46.6k|      lz4fRead->srcBufNext = 0;
  316|  46.6k|      bytesRead = fread(lz4fRead->srcBuf, 1, lz4fRead->srcBufMaxSize, lz4fRead->fp);
  317|  46.6k|      if (bytesRead == 0) {
  ------------------
  |  Branch (317:11): [True: 10.1k, False: 36.5k]
  ------------------
  318|  10.1k|        if (ferror(lz4fRead->fp) || frameInProgress(lz4fRead)) {
  ------------------
  |  Branch (318:13): [True: 0, False: 10.1k]
  |  Branch (318:37): [True: 1.77k, False: 8.34k]
  ------------------
  319|  1.77k|          RETURN_ERROR(io_read);   /* read error, or input ends within a frame */
  ------------------
  |  |   78|  1.77k|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  320|  1.77k|        }
  321|  8.34k|        break; /* end of input reached */
  322|  10.1k|      }
  323|       |      /* success: ret > 0*/
  324|  36.5k|      lz4fRead->srcBufSize = bytesRead;
  325|  36.5k|      srcBytes = lz4fRead->srcBufSize;
  326|  36.5k|    }
  327|       |
  328|       |    /* provide at most the hinted amount : decoding then stops right after each block header */
  329|   163k|    if (srcBytes > inputLimit(lz4fRead)) srcBytes = inputLimit(lz4fRead);
  ------------------
  |  Branch (329:9): [True: 119k, False: 44.4k]
  ------------------
  330|   163k|    provided = srcBytes;
  331|       |
  332|   163k|    { size_t const decStatus = LZ4F_decompress(
  333|   163k|                          lz4fRead->dctxPtr,
  334|   163k|                          outPtr, &dstBytes,
  335|   163k|                          lz4fRead->srcBuf + lz4fRead->srcBufNext,
  336|   163k|                          &srcBytes,
  337|   163k|                          NULL);
  338|   163k|      if (LZ4F_isError(decStatus)) {
  ------------------
  |  Branch (338:11): [True: 3.72k, False: 159k]
  ------------------
  339|  3.72k|          lz4fRead->error = decStatus;   /* the dctx can't be used again before a reset */
  340|  3.72k|          return decStatus;
  341|  3.72k|      }
  342|   159k|      lz4fRead->srcBufNext += srcBytes;
  343|   159k|      lz4fRead->decodedPos += dstBytes;
  344|   159k|      totalBytesRead += dstBytes;
  345|   159k|      outPtr += dstBytes;
  346|   159k|      trackPosition(lz4fRead, decStatus, provided, srcBytes);
  347|   159k|    }
  348|   159k|  }
  349|       |
  350|  59.8k|  return totalBytesRead;
  351|  65.3k|}
LZ4F_seek:
  402|  27.7k|{
  403|  27.7k|  unsigned long long target;
  404|       |
  405|  27.7k|  if (lz4fRead == NULL)
  ------------------
  |  Branch (405:7): [True: 0, False: 27.7k]
  ------------------
  406|      0|    RETURN_ERROR(parameter_null);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  407|       |
  408|  27.7k|  switch (origin) {
  409|  19.0k|  case SEEK_SET:
  ------------------
  |  Branch (409:3): [True: 19.0k, False: 8.75k]
  ------------------
  410|  19.0k|    if (offset < 0) RETURN_ERROR(parameter_invalid);
  ------------------
  |  |   78|    766|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (410:9): [True: 766, False: 18.2k]
  ------------------
  411|  18.2k|    target = (unsigned long long)offset;
  412|  18.2k|    break;
  413|  8.75k|  case SEEK_CUR:
  ------------------
  |  Branch (413:3): [True: 8.75k, False: 19.0k]
  ------------------
  414|  8.75k|    if (offset < 0 && (unsigned long long)-(offset + 1) >= lz4fRead->decodedPos)
  ------------------
  |  Branch (414:9): [True: 4.76k, False: 3.99k]
  |  Branch (414:23): [True: 412, False: 4.35k]
  ------------------
  415|    412|      RETURN_ERROR(parameter_invalid);   /* before start */
  ------------------
  |  |   78|    412|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  416|  8.34k|    target = lz4fRead->decodedPos + (unsigned long long)offset;
  417|  8.34k|    break;
  418|      0|  default:   /* SEEK_END is not supported */
  ------------------
  |  Branch (418:3): [True: 0, False: 27.7k]
  ------------------
  419|      0|    RETURN_ERROR(parameter_invalid);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  420|  27.7k|  }
  421|       |
  422|       |  /* restart from closest resume point : required backward, and avoids decoding forward */
  423|  26.6k|  { const LZ4F_resumePoint* const p = findResumePoint(lz4fRead, target);
  424|  26.6k|    if (target < lz4fRead->decodedPos) {
  ------------------
  |  Branch (424:9): [True: 14.4k, False: 12.1k]
  ------------------
  425|  14.4k|      LZ4F_errorCode_t const result = restartFrom(lz4fRead, p);
  426|  14.4k|      if (LZ4F_isError(result)) return result;
  ------------------
  |  Branch (426:11): [True: 0, False: 14.4k]
  ------------------
  427|  14.4k|    } else if (p != NULL && p->dPos > lz4fRead->decodedPos && lz4fRead->seekable) {
  ------------------
  |  Branch (427:16): [True: 1.02k, False: 11.1k]
  |  Branch (427:29): [True: 759, False: 264]
  |  Branch (427:63): [True: 759, False: 0]
  ------------------
  428|    759|      LZ4F_errorCode_t const result = restartFrom(lz4fRead, p);
  429|    759|      if (LZ4F_isError(result)) return result;
  ------------------
  |  Branch (429:11): [True: 0, False: 759]
  ------------------
  430|    759|  } }
  431|       |
  432|       |  /* decode and discard up to target */
  433|  26.6k|  if (lz4fRead->decodedPos < target && lz4fRead->skipBuf == NULL) {
  ------------------
  |  Branch (433:7): [True: 20.6k, False: 5.96k]
  |  Branch (433:40): [True: 6.29k, False: 14.3k]
  ------------------
  434|  6.29k|    lz4fRead->skipBuf = (LZ4_byte*)fileMalloc(LZ4F_SKIP_BUFFER_SIZE, lz4fRead->cmem);
  ------------------
  |  |   91|  6.29k|#define LZ4F_SKIP_BUFFER_SIZE (64 << 10)
  ------------------
  435|  6.29k|    if (lz4fRead->skipBuf == NULL) RETURN_ERROR(allocation_failed);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (435:9): [True: 0, False: 6.29k]
  ------------------
  436|  6.29k|  }
  437|  49.5k|  while (lz4fRead->decodedPos < target) {
  ------------------
  |  Branch (437:10): [True: 27.2k, False: 22.3k]
  ------------------
  438|  27.2k|    unsigned long long const remaining = target - lz4fRead->decodedPos;
  439|  27.2k|    size_t const toRead = (remaining < LZ4F_SKIP_BUFFER_SIZE) ? (size_t)remaining : LZ4F_SKIP_BUFFER_SIZE;
  ------------------
  |  |   91|  27.2k|#define LZ4F_SKIP_BUFFER_SIZE (64 << 10)
  ------------------
                  size_t const toRead = (remaining < LZ4F_SKIP_BUFFER_SIZE) ? (size_t)remaining : LZ4F_SKIP_BUFFER_SIZE;
  ------------------
  |  |   91|  10.0k|#define LZ4F_SKIP_BUFFER_SIZE (64 << 10)
  ------------------
  |  Branch (439:27): [True: 17.2k, False: 10.0k]
  ------------------
  440|  27.2k|    size_t const result = LZ4F_read(lz4fRead, lz4fRead->skipBuf, toRead);
  441|  27.2k|    if (LZ4F_isError(result)) return result;
  ------------------
  |  Branch (441:9): [True: 4.17k, False: 23.0k]
  ------------------
  442|  23.0k|    if (result == 0) RETURN_ERROR(parameter_invalid);   /* beyond end of decoded data */
  ------------------
  |  |   78|     98|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (442:9): [True: 98, False: 22.9k]
  ------------------
  443|  23.0k|  }
  444|  22.3k|  return LZ4F_OK_NoError;
  445|  26.6k|}
LZ4F_tell:
  448|  72.6k|{
  449|  72.6k|  return lz4fRead ? lz4fRead->decodedPos : 0;
  ------------------
  |  Branch (449:10): [True: 72.6k, False: 0]
  ------------------
  450|  72.6k|}
LZ4F_readClose:
  453|  19.3k|{
  454|  19.3k|  if (lz4fRead == NULL)
  ------------------
  |  Branch (454:7): [True: 0, False: 19.3k]
  ------------------
  455|      0|    RETURN_ERROR(parameter_null);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  456|  19.3k|  freeReadFileResources(lz4fRead);
  457|  19.3k|  return LZ4F_OK_NoError;
  458|  19.3k|}
LZ4F_writeOpen_advanced:
  503|  15.6k|{
  504|  15.6k|  LZ4_writeFile_t* writeFile;
  505|  15.6k|  size_t blockSize;
  506|       |
  507|  15.6k|  if (lz4fWrite == NULL)
  ------------------
  |  Branch (507:7): [True: 0, False: 15.6k]
  ------------------
  508|      0|      RETURN_ERROR(parameter_null);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  509|  15.6k|  *lz4fWrite = NULL;   /* in case of failure */
  510|  15.6k|  if (fp == NULL)
  ------------------
  |  Branch (510:7): [True: 0, False: 15.6k]
  ------------------
  511|      0|      RETURN_ERROR(parameter_null);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  512|       |
  513|       |  /* Validate block size */
  514|  15.6k|  { LZ4F_blockSizeID_t const blockSizeID = prefsPtr ? prefsPtr->frameInfo.blockSizeID : LZ4F_default;
  ------------------
  |  Branch (514:44): [True: 15.6k, False: 0]
  ------------------
  515|  15.6k|    blockSize = LZ4F_getBlockSize(blockSizeID);
  516|  15.6k|    if (LZ4F_isError(blockSize)) {
  ------------------
  |  Branch (516:9): [True: 0, False: 15.6k]
  ------------------
  517|      0|        RETURN_ERROR(maxBlockSize_invalid);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  518|      0|  } }
  519|       |
  520|       |  /* Allocate write file structure */
  521|  15.6k|  writeFile = (LZ4_writeFile_t*)fileMalloc(sizeof(LZ4_writeFile_t), customMem);
  522|  15.6k|  if (writeFile == NULL) {
  ------------------
  |  Branch (522:7): [True: 0, False: 15.6k]
  ------------------
  523|      0|    RETURN_ERROR(allocation_failed);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  524|      0|  }
  525|  15.6k|  memset(writeFile, 0, sizeof(*writeFile));
  526|  15.6k|  writeFile->cmem = customMem;
  527|  15.6k|  writeFile->fp = fp;
  528|  15.6k|  writeFile->errCode = LZ4F_OK_NoError;
  529|  15.6k|  writeFile->maxWriteSize = blockSize;
  530|       |
  531|       |  /* Calculate and allocate destination buffer */
  532|  15.6k|  writeFile->dstBufMaxSize = LZ4F_compressBound(blockSize, prefsPtr);
  533|  15.6k|  writeFile->dstBuf = (LZ4_byte*)fileMalloc(writeFile->dstBufMaxSize, customMem);
  534|  15.6k|  if (writeFile->dstBuf == NULL) {
  ------------------
  |  Branch (534:7): [True: 0, False: 15.6k]
  ------------------
  535|      0|    freeWriteFileResources(writeFile);
  536|      0|    RETURN_ERROR(allocation_failed);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  537|      0|  }
  538|       |
  539|       |  /* Initialize compression context */
  540|  15.6k|  writeFile->cctxPtr = LZ4F_createCompressionContext_advanced(customMem, LZ4F_VERSION);
  ------------------
  |  |  347|  15.6k|#define LZ4F_VERSION 100    /* This number can be used to check for an incompatible API breaking change */
  ------------------
  541|  15.6k|  if (writeFile->cctxPtr == NULL) {
  ------------------
  |  Branch (541:7): [True: 0, False: 15.6k]
  ------------------
  542|      0|    freeWriteFileResources(writeFile);
  543|      0|    RETURN_ERROR(allocation_failed);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  544|      0|  }
  545|       |
  546|       |    /* Write header to file */
  547|  15.6k|  { LZ4F_errorCode_t const writeStatus = writeHeader(writeFile, fp, prefsPtr);
  548|  15.6k|    if (LZ4F_isError(writeStatus)) {
  ------------------
  |  Branch (548:9): [True: 0, False: 15.6k]
  ------------------
  549|      0|        freeWriteFileResources(writeFile);
  550|      0|        return writeStatus;
  551|      0|  } }
  552|       |
  553|  15.6k|  *lz4fWrite = writeFile;
  554|  15.6k|  return LZ4F_OK_NoError;
  555|  15.6k|}
LZ4F_writeOpen:
  558|  15.6k|{
  559|  15.6k|  return LZ4F_writeOpen_advanced(lz4fWrite, fp, prefsPtr, LZ4F_defaultCMem);
  560|  15.6k|}
LZ4F_write:
  563|  31.3k|{
  564|  31.3k|  const LZ4_byte* p = (const LZ4_byte*)buf;
  565|  31.3k|  size_t remainingBytes = size;
  566|       |
  567|       |  /* Validate parameters */
  568|  31.3k|  if (lz4fWrite == NULL || buf == NULL)
  ------------------
  |  Branch (568:7): [True: 0, False: 31.3k]
  |  Branch (568:28): [True: 0, False: 31.3k]
  ------------------
  569|      0|    RETURN_ERROR(parameter_null);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  570|       |
  571|  71.1k|  while (remainingBytes) {
  ------------------
  |  Branch (571:10): [True: 39.8k, False: 31.3k]
  ------------------
  572|  39.8k|    size_t const chunkSize = (remainingBytes > lz4fWrite->maxWriteSize) ? lz4fWrite->maxWriteSize : remainingBytes;
  ------------------
  |  Branch (572:30): [True: 8.62k, False: 31.2k]
  ------------------
  573|       |
  574|       |    /* Compress and write chunk */
  575|  39.8k|    size_t cSize = LZ4F_compressUpdate(lz4fWrite->cctxPtr,
  576|  39.8k|                              lz4fWrite->dstBuf, lz4fWrite->dstBufMaxSize,
  577|  39.8k|                              p, chunkSize,
  578|  39.8k|                              NULL);
  579|  39.8k|    if (LZ4F_isError(cSize)) {
  ------------------
  |  Branch (579:9): [True: 0, False: 39.8k]
  ------------------
  580|      0|      lz4fWrite->errCode = cSize;
  581|      0|      return cSize;
  582|      0|    }
  583|       |
  584|  39.8k|    if (cSize != 0 && cSize != fwrite(lz4fWrite->dstBuf, 1, cSize, lz4fWrite->fp)) {
  ------------------
  |  Branch (584:9): [True: 22.0k, False: 17.7k]
  |  Branch (584:23): [True: 0, False: 22.0k]
  ------------------
  585|      0|      lz4fWrite->errCode = returnErrorCode(LZ4F_ERROR_io_write);
  586|      0|      RETURN_ERROR(io_write);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  587|      0|    }
  588|       |
  589|       |    /* Update positions */
  590|  39.8k|    p += chunkSize;
  591|  39.8k|    remainingBytes -= chunkSize;
  592|  39.8k|  }
  593|       |
  594|  31.3k|  return size;
  595|  31.3k|}
LZ4F_writeClose:
  598|  15.6k|{
  599|  15.6k|  LZ4F_errorCode_t ret;
  600|       |
  601|  15.6k|  if (lz4fWrite == NULL) {
  ------------------
  |  Branch (601:7): [True: 0, False: 15.6k]
  ------------------
  602|      0|    RETURN_ERROR(parameter_null);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  603|      0|  }
  604|       |
  605|  15.6k|  ret = lz4fWrite->errCode;   /* a previous LZ4F_write() failure leaves the frame incomplete */
  606|  15.6k|  if (ret == LZ4F_OK_NoError) {
  ------------------
  |  Branch (606:7): [True: 15.6k, False: 0]
  ------------------
  607|  15.6k|    size_t endSize;
  608|  15.6k|    do {   /* dstBuf >= LZ4F_compressBound(0) : a single invocation completes the frame */
  609|  15.6k|      endSize = LZ4F_compressEnd(lz4fWrite->cctxPtr,
  610|  15.6k|                                 lz4fWrite->dstBuf, lz4fWrite->dstBufMaxSize,
  611|  15.6k|                                 NULL);
  612|  15.6k|      if (LZ4F_isError(endSize)) {
  ------------------
  |  Branch (612:11): [True: 0, False: 15.6k]
  ------------------
  613|      0|        ret = endSize;
  614|      0|        break;
  615|      0|      }
  616|  15.6k|      if (endSize != fwrite(lz4fWrite->dstBuf, 1, endSize, lz4fWrite->fp)) {
  ------------------
  |  Branch (616:11): [True: 0, False: 15.6k]
  ------------------
  617|      0|        ret = returnErrorCode(LZ4F_ERROR_io_write);
  618|      0|        break;
  619|      0|      }
  620|  15.6k|    } while (endSize == lz4fWrite->dstBufMaxSize);
  ------------------
  |  Branch (620:14): [True: 0, False: 15.6k]
  ------------------
  621|  15.6k|  }
  622|       |
  623|  15.6k|  freeWriteFileResources(lz4fWrite);
  624|  15.6k|  return ret;
  625|  15.6k|}
lz4file.c:returnErrorCode:
   73|  3.30k|{
   74|  3.30k|    return (LZ4F_errorCode_t)-(ptrdiff_t)code;
   75|  3.30k|}
lz4file.c:fileMalloc:
   59|  95.8k|{
   60|  95.8k|  if (cmem.customAlloc != NULL) return cmem.customAlloc(cmem.opaqueState, s);
  ------------------
  |  Branch (60:7): [True: 0, False: 95.8k]
  ------------------
   61|  95.8k|  return LZ4FILE_MALLOC(s);
  ------------------
  |  |   54|  95.8k|#  define LZ4FILE_MALLOC(s)    malloc(s)
  ------------------
   62|  95.8k|}
lz4file.c:freeReadFileResources:
  123|  31.3k|{
  124|  31.3k|  if (lz4fRead==NULL) return;
  ------------------
  |  Branch (124:7): [True: 0, False: 31.3k]
  ------------------
  125|  31.3k|  LZ4F_freeDecompressionContext(lz4fRead->dctxPtr);
  126|  31.3k|  fileFree(lz4fRead->srcBuf, lz4fRead->cmem);
  127|  31.3k|  fileFree(lz4fRead->points, lz4fRead->cmem);
  128|  31.3k|  fileFree(lz4fRead->skipBuf, lz4fRead->cmem);
  129|  31.3k|  fileFree(lz4fRead, lz4fRead->cmem);
  130|  31.3k|}
lz4file.c:fileFree:
   65|   164k|{
   66|   164k|  if (p == NULL) return;
  ------------------
  |  Branch (66:7): [True: 68.3k, False: 95.8k]
  ------------------
   67|  95.8k|  if (cmem.customFree != NULL) cmem.customFree(cmem.opaqueState, p);
  ------------------
  |  Branch (67:7): [True: 0, False: 95.8k]
  ------------------
   68|  95.8k|  else LZ4FILE_FREE(p);
  ------------------
  |  |   55|  95.8k|#  define LZ4FILE_FREE(p)      free(p)
  ------------------
   69|  95.8k|}
lz4file.c:readAndParseHeader:
  133|  31.3k|{
  134|  31.3k|    char headerBuf[LZ4F_HEADER_SIZE_MAX];
  135|  31.3k|    LZ4F_frameInfo_t frameInfo;
  136|  31.3k|    size_t consumedSize;
  137|       |
  138|       |    /* Read the header from file */
  139|  31.3k|    const size_t bytesRead = fread(headerBuf, 1, sizeof(headerBuf), fp);
  140|  31.3k|    if (bytesRead < LZ4F_SKIPPABLE_HEADER_SIZE) {
  ------------------
  |  |   92|  31.3k|#define LZ4F_SKIPPABLE_HEADER_SIZE 8   /* magic number, frame size : the shortest complete frame */
  ------------------
  |  Branch (140:9): [True: 255, False: 31.0k]
  ------------------
  141|    255|        RETURN_ERROR(io_read);
  ------------------
  |  |   78|    255|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  142|    255|    }
  143|       |
  144|       |    /* Parse frame information */
  145|  31.0k|    consumedSize = bytesRead;
  146|  31.0k|    { const size_t result = LZ4F_getFrameInfo(readFile->dctxPtr, &frameInfo, headerBuf, &consumedSize);
  147|  31.0k|      if (LZ4F_isError(result)) {
  ------------------
  |  Branch (147:11): [True: 11.7k, False: 19.3k]
  ------------------
  148|  11.7k|          return result;
  149|  11.7k|      }
  150|  19.3k|      readFile->hint = result;
  151|  19.3k|    }
  152|       |    /* A normal frame needs an end mark, while an empty skippable frame is only its header. */
  153|  19.3k|    if (frameInfo.frameType != LZ4F_skippableFrame
  ------------------
  |  Branch (153:9): [True: 19.0k, False: 342]
  ------------------
  154|  19.0k|      && bytesRead < LZ4F_HEADER_SIZE_MIN + LZ4F_ENDMARK_SIZE) {
  ------------------
  |  |  371|  19.0k|#define LZ4F_HEADER_SIZE_MIN  7   /* LZ4 Frame header size can vary, depending on selected parameters */
  ------------------
                    && bytesRead < LZ4F_HEADER_SIZE_MIN + LZ4F_ENDMARK_SIZE) {
  ------------------
  |  |  384|  19.0k|#define LZ4F_ENDMARK_SIZE 4
  ------------------
  |  Branch (154:10): [True: 1, False: 19.0k]
  ------------------
  155|      1|        RETURN_ERROR(io_read);
  ------------------
  |  |   78|      1|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  156|      1|    }
  157|       |
  158|       |    /* Determine buffer size based on block size */
  159|  19.3k|    { const size_t blockSize = LZ4F_getBlockSize(frameInfo.blockSizeID);
  160|  19.3k|      if (LZ4F_isError(blockSize)) {
  ------------------
  |  Branch (160:11): [True: 0, False: 19.3k]
  ------------------
  161|      0|          RETURN_ERROR(maxBlockSize_invalid);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  162|      0|      }
  163|  19.3k|      readFile->srcBufMaxSize = blockSize;
  164|  19.3k|    }
  165|       |
  166|       |    /* Allocate source buffer */
  167|  19.3k|    assert(readFile->srcBuf == NULL); /* Should be NULL from creation */
  ------------------
  |  Branch (167:5): [True: 0, False: 19.3k]
  |  Branch (167:5): [True: 19.3k, False: 0]
  ------------------
  168|  19.3k|    readFile->srcBuf = (LZ4_byte*)fileMalloc(readFile->srcBufMaxSize, readFile->cmem);
  169|  19.3k|    if (readFile->srcBuf == NULL) {
  ------------------
  |  Branch (169:9): [True: 0, False: 19.3k]
  ------------------
  170|      0|        RETURN_ERROR(allocation_failed);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  171|      0|    }
  172|       |
  173|       |    /* Store remaining header data in buffer */
  174|  19.3k|    readFile->srcBufPos = consumedSize;
  175|  19.3k|    readFile->srcBufSize = bytesRead - consumedSize;
  176|  19.3k|    if (readFile->srcBufSize > 0) {
  ------------------
  |  Branch (176:9): [True: 18.6k, False: 750]
  ------------------
  177|  18.6k|        memcpy(readFile->srcBuf, headerBuf + consumedSize, readFile->srcBufSize);
  178|  18.6k|    }
  179|  19.3k|    readFile->srcBufNext = 0;
  180|       |
  181|  19.3k|    return LZ4F_OK_NoError;
  182|  19.3k|}
lz4file.c:frameInProgress:
  260|   412k|{
  261|   412k|  return lz4fRead->hint != 0;
  262|   412k|}
lz4file.c:inputLimit:
  267|   402k|{
  268|   402k|  return frameInProgress(lz4fRead) ? lz4fRead->hint : LZ4F_HEADER_SIZE_MIN;
  ------------------
  |  |  371|  54.3k|#define LZ4F_HEADER_SIZE_MIN  7   /* LZ4 Frame header size can vary, depending on selected parameters */
  ------------------
  |  Branch (268:10): [True: 347k, False: 54.3k]
  ------------------
  269|   402k|}
lz4file.c:trackPosition:
  274|   159k|{
  275|   159k|  unsigned long long const cPos = lz4fRead->srcBufPos + lz4fRead->srcBufNext;
  276|   159k|  if (decStatus == 0) {   /* end of frame : next frame starts here */
  ------------------
  |  Branch (276:7): [True: 18.3k, False: 141k]
  ------------------
  277|  18.3k|    lz4fRead->hint = 0;
  278|  18.3k|    lz4fRead->frameDPos = lz4fRead->decodedPos;
  279|  18.3k|    addResumePoint(lz4fRead, cPos, NULL);
  280|  18.3k|    return;
  281|  18.3k|  }
  282|       |  /* exactly the hinted input was consumed, and next hint covers a block :
  283|       |   * decoding stopped right after a block header */
  284|   141k|  if (consumed == provided && provided == inputLimit(lz4fRead) && decStatus > LZ4F_BLOCK_HEADER_SIZE) {
  ------------------
  |  |  375|  96.7k|#define LZ4F_BLOCK_HEADER_SIZE 4
  ------------------
  |  Branch (284:7): [True: 119k, False: 22.2k]
  |  Branch (284:31): [True: 96.7k, False: 22.5k]
  |  Branch (284:67): [True: 67.8k, False: 28.9k]
  ------------------
  285|  67.8k|    LZ4F_frameInfo_t frameInfo;
  286|  67.8k|    size_t noInput = 0;
  287|       |    /* fails within a frame header, which isn't followed by a block header yet */
  288|  67.8k|    if (!LZ4F_isError(LZ4F_getFrameInfo(lz4fRead->dctxPtr, &frameInfo, NULL, &noInput))
  ------------------
  |  Branch (288:9): [True: 66.6k, False: 1.18k]
  ------------------
  289|  66.6k|      && frameInfo.frameType == LZ4F_frame
  ------------------
  |  Branch (289:10): [True: 66.2k, False: 365]
  ------------------
  290|  66.2k|      && frameInfo.blockMode == LZ4F_blockIndependent)
  ------------------
  |  Branch (290:10): [True: 17.8k, False: 48.4k]
  ------------------
  291|  17.8k|      addResumePoint(lz4fRead, cPos - LZ4F_BLOCK_HEADER_SIZE, &frameInfo);
  ------------------
  |  |  375|  17.8k|#define LZ4F_BLOCK_HEADER_SIZE 4
  ------------------
  292|  67.8k|  }
  293|   141k|  lz4fRead->hint = decStatus;
  294|   141k|}
lz4file.c:addResumePoint:
  236|  36.1k|{
  237|  36.1k|  unsigned long long const lastDPos = lz4fRead->nbPoints ? lz4fRead->points[lz4fRead->nbPoints-1].dPos : 0;
  ------------------
  |  Branch (237:39): [True: 10.1k, False: 26.0k]
  ------------------
  238|  36.1k|  LZ4F_resumePoint* p;
  239|  36.1k|  if (lz4fRead->decodedPos < lastDPos + LZ4F_RESUME_SPAN) return;
  ------------------
  |  |   87|  36.1k|#  define LZ4F_RESUME_SPAN 64           /* resume points within small fuzzing inputs */
  ------------------
  |  Branch (239:7): [True: 26.6k, False: 9.55k]
  ------------------
  240|  9.55k|  if (lz4fRead->nbPoints == lz4fRead->pointsCapacity) {
  ------------------
  |  Branch (240:7): [True: 7.50k, False: 2.05k]
  ------------------
  241|  7.50k|    size_t const newCapacity = lz4fRead->pointsCapacity ? 2 * lz4fRead->pointsCapacity : 64;
  ------------------
  |  Branch (241:32): [True: 0, False: 7.50k]
  ------------------
  242|  7.50k|    LZ4F_resumePoint* const newPoints = (LZ4F_resumePoint*)fileMalloc(newCapacity * sizeof(*newPoints), lz4fRead->cmem);   /* no realloc() among user functions */
  243|  7.50k|    if (newPoints == NULL) return;
  ------------------
  |  Branch (243:9): [True: 0, False: 7.50k]
  ------------------
  244|  7.50k|    if (lz4fRead->nbPoints) memcpy(newPoints, lz4fRead->points, lz4fRead->nbPoints * sizeof(*newPoints));
  ------------------
  |  Branch (244:9): [True: 0, False: 7.50k]
  ------------------
  245|  7.50k|    fileFree(lz4fRead->points, lz4fRead->cmem);
  246|  7.50k|    lz4fRead->points = newPoints;
  247|  7.50k|    lz4fRead->pointsCapacity = newCapacity;
  248|  7.50k|  }
  249|  9.55k|  p = lz4fRead->points + lz4fRead->nbPoints++;
  250|  9.55k|  memset(p, 0, sizeof(*p));
  251|  9.55k|  p->cPos = cPos;
  252|  9.55k|  p->dPos = lz4fRead->decodedPos;
  253|  9.55k|  p->frameDPos = lz4fRead->frameDPos;
  254|  9.55k|  p->isBlockStart = (frameInfo != NULL);
  255|  9.55k|  if (frameInfo != NULL) p->frameInfo = *frameInfo;
  ------------------
  |  Branch (255:7): [True: 2.60k, False: 6.94k]
  ------------------
  256|  9.55k|}
lz4file.c:findResumePoint:
  367|  26.6k|{
  368|  26.6k|  size_t lo = 0, hi = lz4fRead->nbPoints;
  369|  42.5k|  while (lo < hi) {   /* first point beyond @pos is within [lo, hi] */
  ------------------
  |  Branch (369:10): [True: 15.9k, False: 26.6k]
  ------------------
  370|  15.9k|    size_t const mid = lo + (hi - lo) / 2;
  371|  15.9k|    if (lz4fRead->points[mid].dPos <= pos) lo = mid + 1; else hi = mid;
  ------------------
  |  Branch (371:9): [True: 1.63k, False: 14.2k]
  ------------------
  372|  15.9k|  }
  373|  26.6k|  return lo ? lz4fRead->points + lo - 1 : NULL;
  ------------------
  |  Branch (373:10): [True: 1.52k, False: 25.0k]
  ------------------
  374|  26.6k|}
lz4file.c:restartFrom:
  378|  15.2k|{
  379|  15.2k|  unsigned long long const cPos = p ? p->cPos : 0;
  ------------------
  |  Branch (379:35): [True: 1.26k, False: 13.9k]
  ------------------
  380|  15.2k|  unsigned long long const filePos = lz4fRead->srcBufPos + lz4fRead->srcBufSize;
  381|  15.2k|  if (!lz4fRead->seekable || fseekRelative(lz4fRead->fp, (long long)cPos - (long long)filePos))
  ------------------
  |  Branch (381:7): [True: 0, False: 15.2k]
  |  Branch (381:30): [True: 0, False: 15.2k]
  ------------------
  382|      0|    RETURN_ERROR(io_read);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  383|  15.2k|  lz4fRead->srcBufPos = cPos;
  384|  15.2k|  lz4fRead->srcBufSize = 0;
  385|  15.2k|  lz4fRead->srcBufNext = 0;
  386|  15.2k|  lz4fRead->decodedPos = p ? p->dPos : 0;
  ------------------
  |  Branch (386:26): [True: 1.26k, False: 13.9k]
  ------------------
  387|  15.2k|  if (p && p->isBlockStart) {
  ------------------
  |  Branch (387:7): [True: 1.26k, False: 13.9k]
  |  Branch (387:12): [True: 1.20k, False: 54]
  ------------------
  388|  1.20k|    size_t const result = LZ4F_resumeFrame(lz4fRead->dctxPtr, &p->frameInfo, p->dPos - p->frameDPos, NULL, 0);
  389|  1.20k|    if (LZ4F_isError(result)) return result;
  ------------------
  |  Branch (389:9): [True: 0, False: 1.20k]
  ------------------
  390|  1.20k|    lz4fRead->hint = LZ4F_BLOCK_HEADER_SIZE;
  ------------------
  |  |  375|  1.20k|#define LZ4F_BLOCK_HEADER_SIZE 4
  ------------------
  391|  1.20k|    lz4fRead->frameDPos = p->frameDPos;
  392|  14.0k|  } else {
  393|  14.0k|    LZ4F_resetDecompressionContext(lz4fRead->dctxPtr);
  394|  14.0k|    lz4fRead->hint = 0;
  395|  14.0k|    lz4fRead->frameDPos = lz4fRead->decodedPos;
  396|  14.0k|  }
  397|  15.2k|  lz4fRead->error = LZ4F_OK_NoError;
  398|  15.2k|  return LZ4F_OK_NoError;
  399|  15.2k|}
lz4file.c:fseekRelative:
  355|  15.2k|{
  356|  15.2k|  long const stepMax = 1L << 30;
  357|  30.4k|  while (delta != 0) {
  ------------------
  |  Branch (357:10): [True: 15.2k, False: 15.2k]
  ------------------
  358|  15.2k|    long const step = (delta > stepMax) ? stepMax : (delta < -stepMax) ? -stepMax : (long)delta;
  ------------------
  |  Branch (358:23): [True: 0, False: 15.2k]
  |  Branch (358:53): [True: 0, False: 15.2k]
  ------------------
  359|  15.2k|    if (fseek(fp, step, SEEK_CUR) != 0) return -1;
  ------------------
  |  Branch (359:9): [True: 0, False: 15.2k]
  ------------------
  360|  15.2k|    delta -= step;
  361|  15.2k|  }
  362|  15.2k|  return 0;
  363|  15.2k|}
lz4file.c:freeWriteFileResources:
  473|  15.6k|{
  474|  15.6k|  if (state == NULL) return;
  ------------------
  |  Branch (474:7): [True: 0, False: 15.6k]
  ------------------
  475|  15.6k|  LZ4F_freeCompressionContext(state->cctxPtr);
  476|  15.6k|  fileFree(state->dstBuf, state->cmem);
  477|  15.6k|  fileFree(state, state->cmem);
  478|  15.6k|}
lz4file.c:writeHeader:
  483|  15.6k|{
  484|  15.6k|  LZ4_byte headerBuf[LZ4F_HEADER_SIZE_MAX];
  485|       |
  486|       |  /* Generate header */
  487|  15.6k|  LZ4F_errorCode_t const headerSize = LZ4F_compressBegin(writeFile->cctxPtr,
  488|  15.6k|                                  headerBuf, LZ4F_HEADER_SIZE_MAX, prefsPtr);
  ------------------
  |  |  372|  15.6k|#define LZ4F_HEADER_SIZE_MAX 19
  ------------------
  489|  15.6k|  if (LZ4F_isError(headerSize)) {
  ------------------
  |  Branch (489:7): [True: 0, False: 15.6k]
  ------------------
  490|      0|    return headerSize;
  491|      0|  }
  492|       |
  493|       |  /* Write header to file */
  494|  15.6k|  if (headerSize != fwrite(headerBuf, 1, headerSize, fp)) {
  ------------------
  |  Branch (494:7): [True: 0, False: 15.6k]
  ------------------
  495|      0|    RETURN_ERROR(io_write);
  ------------------
  |  |   78|      0|#define RETURN_ERROR(e) return returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  496|      0|  }
  497|       |
  498|  15.6k|  return LZ4F_OK_NoError;
  499|  15.6k|}

LZ4F_isError:
  368|   952k|{
  369|   952k|    return (code > (LZ4F_errorCode_t)(-LZ4F_ERROR_maxCode));
  370|   952k|}
LZ4F_getBlockSize:
  429|   116k|{
  430|   116k|    static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  285|   116k|#  define KB *(1<<10)
  ------------------
                  static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  285|   116k|#  define KB *(1<<10)
  ------------------
                  static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  286|   116k|#  define MB *(1<<20)
  ------------------
                  static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  286|   116k|#  define MB *(1<<20)
  ------------------
  431|       |
  432|   116k|    if (blockSizeID == 0) blockSizeID = LZ4F_BLOCKSIZEID_DEFAULT;
  ------------------
  |  |  297|  17.6k|#define LZ4F_BLOCKSIZEID_DEFAULT LZ4F_max64KB
  ------------------
  |  Branch (432:9): [True: 17.6k, False: 98.8k]
  ------------------
  433|   116k|    if (blockSizeID < LZ4F_max64KB || blockSizeID > LZ4F_max4MB)
  ------------------
  |  Branch (433:9): [True: 0, False: 116k]
  |  Branch (433:39): [True: 0, False: 116k]
  ------------------
  434|      0|        RETURN_ERROR(maxBlockSize_invalid);
  ------------------
  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  435|   116k|    {   int const blockSizeIdx = (int)blockSizeID - (int)LZ4F_max64KB;
  436|   116k|        return blockSizes[blockSizeIdx];
  437|   116k|}   }
LZ4F_createCompressionContext_advanced:
  777|  15.6k|{
  778|  15.6k|    LZ4F_cctx* const cctxPtr =
  779|  15.6k|        (LZ4F_cctx*)LZ4F_calloc(sizeof(LZ4F_cctx), customMem);
  780|  15.6k|    if (cctxPtr==NULL) return NULL;
  ------------------
  |  Branch (780:9): [True: 0, False: 15.6k]
  ------------------
  781|       |
  782|  15.6k|    cctxPtr->cmem = customMem;
  783|  15.6k|    cctxPtr->version = version;
  784|  15.6k|    cctxPtr->cStage = 0;   /* Uninitialized. Next stage : init cctx */
  785|       |
  786|  15.6k|    return cctxPtr;
  787|  15.6k|}
LZ4F_freeCompressionContext:
  810|  15.6k|{
  811|  15.6k|    if (cctxPtr != NULL) {  /* support free on NULL */
  ------------------
  |  Branch (811:9): [True: 15.6k, False: 0]
  ------------------
  812|  15.6k|       LZ4F_mt_free(cctxPtr->mt, cctxPtr->cmem);   /* first : waits for jobs still in flight */
  813|  15.6k|       LZ4F_free(cctxPtr->lz4CtxPtr, cctxPtr->cmem);  /* note: LZ4_streamHC_t and LZ4_stream_t are simple POD types */
  814|  15.6k|       LZ4F_free(cctxPtr->tmpBuff, cctxPtr->cmem);
  815|  15.6k|       LZ4F_free(cctxPtr->stageBuff, cctxPtr->cmem);
  816|  15.6k|       LZ4F_free(cctxPtr->rawDictFast, cctxPtr->cmem);
  817|  15.6k|       LZ4F_free(cctxPtr->rawDictHC, cctxPtr->cmem);
  818|  15.6k|       LZ4F_free(cctxPtr, cctxPtr->cmem);
  819|  15.6k|    }
  820|  15.6k|    return LZ4F_OK_NoError;
  821|  15.6k|}
LZ4F_compressBegin:
 1109|  15.6k|{
 1110|  15.6k|    return LZ4F_compressBegin_internal(cctx, dstBuffer, dstCapacity,
 1111|  15.6k|                                        NULL, 0,
 1112|       |                                        NULL, preferencesPtr);
 1113|  15.6k|}
LZ4F_compressBound:
 1142|  15.6k|{
 1143|  15.6k|    size_t bound;
 1144|  15.6k|    size_t const blockCRCSize = preferencesPtr
  ------------------
  |  Branch (1144:33): [True: 15.6k, False: 0]
  ------------------
 1145|  15.6k|                             ? BFSize * preferencesPtr->frameInfo.blockChecksumFlag
 1146|  15.6k|                             : BFSize;
 1147|  15.6k|    if (preferencesPtr && !preferencesPtr->autoFlush && LZ4F_mtEligible(preferencesPtr)) {
  ------------------
  |  Branch (1147:9): [True: 15.6k, False: 0]
  |  Branch (1147:27): [True: 9.12k, False: 6.54k]
  |  Branch (1147:57): [True: 0, False: 9.12k]
  ------------------
 1148|       |        /* frame cut into jobs : output can lag behind input */
 1149|      0|        return LZ4F_mtCompressBound(srcSize, preferencesPtr);
 1150|      0|    }
 1151|  15.6k|    if (preferencesPtr && preferencesPtr->autoFlush) {
  ------------------
  |  Branch (1151:9): [True: 15.6k, False: 0]
  |  Branch (1151:27): [True: 6.54k, False: 9.12k]
  ------------------
 1152|       |        /* + 1 : output of LZ4F_flush() and LZ4F_compressEnd() remains strictly below LZ4F_compressBound(0),
 1153|       |         * since a filled dstBuffer means more output may remain */
 1154|  6.54k|        return LZ4F_compressBound_autoFlush(srcSize, preferencesPtr) + (srcSize == 0);
 1155|  6.54k|    }
 1156|       |    /* single-threaded : full blocks only, each one stored uncompressed in worst case.
 1157|       |     * Up to (blockSize-1) bytes can already be buffered : srcSize completes at most srcSize/blockSize + 1 blocks.
 1158|       |     * The buffered block can also be emitted separately (mode switch), or remain from an incomplete LZ4F_flush() :
 1159|       |     * then, srcSize completes at most srcSize/blockSize blocks.
 1160|       |     * @srcSize == 0 : LZ4F_flush() and LZ4F_compressEnd() emit the buffered block (< blockSize bytes : output
 1161|       |     * remains strictly below the bound, so that a single invocation completes them), then the frame footer.
 1162|       |     * The frame footer is always included, so that the bound grows with @srcSize. */
 1163|  9.12k|    {   size_t const bs = LZ4F_getBlockSize(preferencesPtr ? preferencesPtr->frameInfo.blockSizeID : LZ4F_default);
  ------------------
  |  Branch (1163:45): [True: 9.12k, False: 0]
  ------------------
 1164|  9.12k|        size_t const blockSize = LZ4F_isError(bs) ? 4 MB : bs;
  ------------------
  |  |  286|      0|#  define MB *(1<<20)
  ------------------
  |  Branch (1164:34): [True: 0, False: 9.12k]
  ------------------
 1165|  9.12k|        size_t const contentCRCSize = preferencesPtr
  ------------------
  |  Branch (1165:39): [True: 9.12k, False: 0]
  ------------------
 1166|  9.12k|                                    ? BFSize * preferencesPtr->frameInfo.contentChecksumFlag
 1167|  9.12k|                                    : BFSize;
 1168|  9.12k|        size_t const nbBlocks = srcSize / blockSize + 1;
 1169|  9.12k|        bound = nbBlocks * (blockSize + BHSize + blockCRCSize) + BHSize + contentCRCSize;
 1170|  9.12k|    }
 1171|  9.12k|    return bound;
 1172|  15.6k|}
LZ4F_compressUpdate:
 2584|  39.8k|{
 2585|  39.8k|    LZ4F_BlockCompressMode_e mode;
 2586|  39.8k|    if (compressOptionsPtr == NULL) compressOptionsPtr = &k_cOptionsNull;
  ------------------
  |  Branch (2586:9): [True: 39.8k, False: 0]
  ------------------
 2587|  39.8k|    mode = (compressOptionsPtr->uncompressed == 1) ? LZ4B_UNCOMPRESSED : LZ4B_COMPRESSED;
  ------------------
  |  Branch (2587:12): [True: 0, False: 39.8k]
  ------------------
 2588|  39.8k|    if (cctxPtr->mtActive)
  ------------------
  |  Branch (2588:9): [True: 0, False: 39.8k]
  ------------------
 2589|      0|        return LZ4F_mt_update(cctxPtr, dstBuffer, dstCapacity, srcBuffer, srcSize, compressOptionsPtr, mode);
 2590|  39.8k|    return LZ4F_st_update(cctxPtr, dstBuffer, dstCapacity, srcBuffer, srcSize, compressOptionsPtr, mode);
 2591|  39.8k|}
LZ4F_compressEnd:
 2701|  15.6k|{
 2702|  15.6k|    BYTE* const dst = (BYTE*)dstBuffer;
 2703|  15.6k|    size_t pos = 0;
 2704|  15.6k|    DEBUGLOG(5,"LZ4F_compressEnd: dstCapacity=%u", (unsigned)dstCapacity);
  ------------------
  |  |  208|  15.6k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 2705|  15.6k|    (void)compressOptionsPtr;   /* not useful (yet) */
 2706|  15.6k|    RETURN_ERROR_IF((cctxPtr->cStage != 1) && (cctxPtr->cStage != 2), compressionState_uninitialized);
  ------------------
  |  |  394|  15.6k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  31.3k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 15.6k]
  |  |  |  Branch (395:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  15.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 15.6k]
  |  |  ------------------
  ------------------
 2707|  15.6k|    RETURN_ERROR_IF(dstCapacity == 0, dstCapacity_tooSmall);   /* no progress possible : rejected, the frame continues */
  ------------------
  |  |  394|  15.6k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  15.6k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 15.6k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  15.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 15.6k]
  |  |  ------------------
  ------------------
 2708|       |
 2709|  15.6k|    if (cctxPtr->cStage == 1) {
  ------------------
  |  Branch (2709:9): [True: 15.6k, False: 0]
  ------------------
 2710|       |        /* end of frame : no more input */
 2711|  15.6k|        if (cctxPtr->prefs.frameInfo.contentSize && (cctxPtr->prefs.frameInfo.contentSize != cctxPtr->totalInSize)) {
  ------------------
  |  Branch (2711:13): [True: 0, False: 15.6k]
  |  Branch (2711:53): [True: 0, False: 0]
  ------------------
 2712|      0|            LZ4F_invalidateFrame(cctxPtr);
 2713|      0|            RETURN_ERROR(frameSize_wrong);
  ------------------
  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
 2714|      0|        }
 2715|  15.6k|        cctxPtr->cStage = 2;
 2716|  15.6k|        if (cctxPtr->flushStage == 0) {
  ------------------
  |  Branch (2716:13): [True: 15.6k, False: 0]
  ------------------
 2717|  15.6k|            pos = LZ4F_flushPoint(cctxPtr, dst, dstCapacity);
 2718|  15.6k|            FORWARD_IF_ERROR(pos);   /* already invalidated */
  ------------------
  |  |  402|  15.6k|#define FORWARD_IF_ERROR(r) do {                     \
  |  |  403|  15.6k|        size_t const err_code = (r);                 \
  |  |  404|  15.6k|        if (LZ4F_isError(err_code)) return err_code; \
  |  |  ------------------
  |  |  |  Branch (404:13): [True: 0, False: 15.6k]
  |  |  ------------------
  |  |  405|  15.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (405:14): [Folded, False: 15.6k]
  |  |  ------------------
  ------------------
 2719|  15.6k|    }   }
 2720|       |
 2721|  15.6k|    if (cctxPtr->flushStage == 1) {
  ------------------
  |  Branch (2721:9): [True: 15.6k, False: 0]
  ------------------
 2722|  15.6k|        pos = LZ4F_emitPending(cctxPtr, dst, dstCapacity, pos);
 2723|  15.6k|        FORWARD_IF_ERROR(pos);   /* already invalidated */
  ------------------
  |  |  402|  15.6k|#define FORWARD_IF_ERROR(r) do {                     \
  |  |  403|  15.6k|        size_t const err_code = (r);                 \
  |  |  404|  15.6k|        if (LZ4F_isError(err_code)) return err_code; \
  |  |  ------------------
  |  |  |  Branch (404:13): [True: 0, False: 15.6k]
  |  |  ------------------
  |  |  405|  15.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (405:14): [Folded, False: 15.6k]
  |  |  ------------------
  ------------------
 2724|  15.6k|        if (LZ4F_outputPending(cctxPtr)) return pos;   /* dstBuffer is full */
  ------------------
  |  Branch (2724:13): [True: 0, False: 15.6k]
  ------------------
 2725|       |        /* footer : endMark, then optional content checksum */
 2726|  15.6k|        LZ4F_writeLE32(cctxPtr->footer, 0);
 2727|  15.6k|        cctxPtr->pendingSize = 4;
 2728|  15.6k|        if (cctxPtr->prefs.frameInfo.contentChecksumFlag == LZ4F_contentChecksumEnabled) {
  ------------------
  |  Branch (2728:13): [True: 6.36k, False: 9.31k]
  ------------------
 2729|  6.36k|            U32 const xxh = XXH32_digest(&(cctxPtr->xxh));
  ------------------
  |  |  133|  6.36k|#  define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
  |  |  ------------------
  |  |  |  |  126|  6.36k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  6.36k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2730|  6.36k|            DEBUGLOG(5,"Writing 32-bit content checksum (0x%0X)", xxh);
  ------------------
  |  |  208|  6.36k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 2731|  6.36k|            LZ4F_writeLE32(cctxPtr->footer + 4, xxh);
 2732|  6.36k|            cctxPtr->pendingSize = 8;
 2733|  6.36k|        }
 2734|  15.6k|        cctxPtr->pending = cctxPtr->footer;
 2735|  15.6k|        cctxPtr->flushStage = 2;
 2736|  15.6k|    }
 2737|       |
 2738|  15.6k|    if (cctxPtr->flushStage == 2) {
  ------------------
  |  Branch (2738:9): [True: 15.6k, False: 0]
  ------------------
 2739|  15.6k|        pos += LZ4F_copyPending(cctxPtr, dst, dstCapacity, pos);
 2740|  15.6k|        if (cctxPtr->pendingSize) return pos;   /* dstBuffer is full */
  ------------------
  |  Branch (2740:13): [True: 0, False: 15.6k]
  ------------------
 2741|  15.6k|        cctxPtr->flushStage = 3;
 2742|  15.6k|    }
 2743|       |
 2744|  15.6k|    assert(cctxPtr->flushStage == 3);
  ------------------
  |  Branch (2744:5): [True: 0, False: 15.6k]
  |  Branch (2744:5): [True: 15.6k, False: 0]
  ------------------
 2745|  15.6k|    if (pos < dstCapacity) {
  ------------------
  |  Branch (2745:9): [True: 15.6k, False: 0]
  ------------------
 2746|       |        /* completed : the context is available for a new frame */
 2747|  15.6k|        cctxPtr->cStage = 0;
 2748|  15.6k|        cctxPtr->flushStage = 0;
 2749|  15.6k|    }   /* otherwise, completed, but dstBuffer is full : next invocation returns 0 */
 2750|  15.6k|    return pos;
 2751|  15.6k|}
LZ4F_createDecompressionContext_advanced:
 2805|  31.3k|{
 2806|  31.3k|    LZ4F_dctx* const dctx = (LZ4F_dctx*)LZ4F_calloc(sizeof(LZ4F_dctx), customMem);
 2807|  31.3k|    if (dctx == NULL) return NULL;
  ------------------
  |  Branch (2807:9): [True: 0, False: 31.3k]
  ------------------
 2808|       |
 2809|  31.3k|    dctx->cmem = customMem;
 2810|  31.3k|    dctx->version = version;
 2811|  31.3k|    return dctx;
 2812|  31.3k|}
LZ4F_freeDecompressionContext:
 2834|  31.3k|{
 2835|  31.3k|    LZ4F_errorCode_t result = LZ4F_OK_NoError;
 2836|  31.3k|    if (dctx != NULL) {   /* can accept NULL input, like free() */
  ------------------
  |  Branch (2836:9): [True: 31.3k, False: 0]
  ------------------
 2837|  31.3k|      result = (LZ4F_errorCode_t)dctx->dStage;
 2838|  31.3k|      LZ4F_free(dctx->tmpIn, dctx->cmem);
 2839|  31.3k|      LZ4F_free(dctx->tmpOutBuffer, dctx->cmem);
 2840|  31.3k|      LZ4F_free(dctx, dctx->cmem);
 2841|  31.3k|    }
 2842|  31.3k|    return result;
 2843|  31.3k|}
LZ4F_resetDecompressionContext:
 2860|  33.5k|{
 2861|  33.5k|    DEBUGLOG(5, "LZ4F_resetDecompressionContext");
  ------------------
  |  |  208|  33.5k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 2862|  33.5k|    dctx->dStage = dstage_getFrameHeader;
 2863|       |    dctx->dict = NULL;
 2864|  33.5k|    dctx->dictSize = 0;
 2865|  33.5k|    dctx->skipBlockChecksum = 0;
 2866|  33.5k|    dctx->skipContentChecksum = 0;
 2867|  33.5k|    dctx->frameRemainingSize = 0;
 2868|  33.5k|    dctx->frameEnded = 0;
 2869|  33.5k|}
LZ4F_headerSize:
 2986|  31.0k|{
 2987|  31.0k|    RETURN_ERROR_IF(src == NULL, srcPtr_wrong);
  ------------------
  |  |  394|  31.0k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  31.0k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 31.0k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  31.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 31.0k]
  |  |  ------------------
  ------------------
 2988|       |
 2989|       |    /* minimal srcSize to determine header size */
 2990|  31.0k|    if (srcSize < LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH)
  ------------------
  |  |  531|  31.0k|#define LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH 5
  ------------------
  |  Branch (2990:9): [True: 0, False: 31.0k]
  ------------------
 2991|      0|        RETURN_ERROR(frameHeader_incomplete);
  ------------------
  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
 2992|       |
 2993|       |    /* special case : skippable frames */
 2994|  31.0k|    if ((LZ4F_readLE32(src) & 0xFFFFFFF0U) == LZ4F_MAGIC_SKIPPABLE_START)
  ------------------
  |  |  530|  31.0k|#define LZ4F_MAGIC_SKIPPABLE_START 0x184D2A50U
  ------------------
  |  Branch (2994:9): [True: 342, False: 30.7k]
  ------------------
 2995|    342|        return 8;
 2996|       |
 2997|       |    /* control magic number */
 2998|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 2999|       |    if (LZ4F_readLE32(src) != LZ4F_MAGICNUMBER)
 3000|       |        RETURN_ERROR(frameType_unknown);
 3001|       |#endif
 3002|       |
 3003|       |    /* Frame Header Size */
 3004|  30.7k|    {   BYTE const FLG = ((const BYTE*)src)[4];
 3005|  30.7k|        U32 const contentSizeFlag = (FLG>>3) & _1BIT;
  ------------------
  |  |  290|  30.7k|#define _1BIT  0x01
  ------------------
 3006|  30.7k|        U32 const dictIDFlag = FLG & _1BIT;
  ------------------
  |  |  290|  30.7k|#define _1BIT  0x01
  ------------------
 3007|  30.7k|        return minFHSize + (contentSizeFlag?8:0) + (dictIDFlag?4:0);
  ------------------
  |  Branch (3007:29): [True: 4.32k, False: 26.4k]
  |  Branch (3007:53): [True: 3.82k, False: 26.9k]
  ------------------
 3008|  31.0k|    }
 3009|  31.0k|}
LZ4F_getFrameInfo:
 3030|  98.9k|{
 3031|  98.9k|    assert(dctx != NULL);
  ------------------
  |  Branch (3031:5): [True: 0, False: 98.9k]
  |  Branch (3031:5): [True: 98.9k, False: 0]
  ------------------
 3032|  98.9k|    RETURN_ERROR_IF(frameInfoPtr == NULL, parameter_null);
  ------------------
  |  |  394|  98.9k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  98.9k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 98.9k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  98.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 98.9k]
  |  |  ------------------
  ------------------
 3033|  98.9k|    RETURN_ERROR_IF(srcSizePtr == NULL, parameter_null);
  ------------------
  |  |  394|  98.9k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  98.9k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 98.9k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  98.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 98.9k]
  |  |  ------------------
  ------------------
 3034|       |
 3035|  98.9k|    LZ4F_STATIC_ASSERT(dstage_getFrameHeader < dstage_storeFrameHeader);
  ------------------
  |  |  195|  98.9k|#define LZ4F_STATIC_ASSERT(c)    { enum { LZ4F_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
 3036|  98.9k|    if (dctx->dStage > dstage_storeFrameHeader) {
  ------------------
  |  Branch (3036:9): [True: 66.6k, False: 32.2k]
  ------------------
 3037|       |        /* frameInfo already decoded */
 3038|  66.6k|        size_t o=0, i=0;
 3039|  66.6k|        *srcSizePtr = 0;
 3040|  66.6k|        *frameInfoPtr = dctx->frameInfo;
 3041|       |        /* returns : recommended nb of bytes for LZ4F_decompress() */
 3042|  66.6k|        return LZ4F_decompress(dctx, NULL, &o, NULL, &i, NULL);
 3043|  66.6k|    } else {
 3044|  32.2k|        if (dctx->dStage == dstage_storeFrameHeader) {
  ------------------
  |  Branch (3044:13): [True: 1.18k, False: 31.0k]
  ------------------
 3045|       |            /* frame decoding already started, in the middle of header => automatic fail */
 3046|  1.18k|            *srcSizePtr = 0;
 3047|  1.18k|            RETURN_ERROR(frameDecoding_alreadyStarted);
  ------------------
  |  |  392|  1.18k|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
 3048|  31.0k|        } else if (dctx->frameEnded && (*srcSizePtr == 0)) {
  ------------------
  |  Branch (3048:20): [True: 0, False: 31.0k]
  |  Branch (3048:40): [True: 0, False: 0]
  ------------------
 3049|       |            /* no input, after the end of a frame : parameters of this frame */
 3050|      0|            *frameInfoPtr = dctx->frameInfo;
 3051|      0|            return 0;
 3052|  31.0k|        } else {
 3053|  31.0k|            size_t const hSize = LZ4F_headerSize(srcBuffer, *srcSizePtr);
 3054|  31.0k|            if (LZ4F_isError(hSize)) { *srcSizePtr=0; return hSize; }
  ------------------
  |  Branch (3054:17): [True: 0, False: 31.0k]
  ------------------
 3055|  31.0k|            if (*srcSizePtr < hSize) {
  ------------------
  |  Branch (3055:17): [True: 314, False: 30.7k]
  ------------------
 3056|    314|                *srcSizePtr=0;
 3057|    314|                RETURN_ERROR(frameHeader_incomplete);
  ------------------
  |  |  392|    314|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
 3058|    314|            }
 3059|       |
 3060|  30.7k|            {   size_t decodeResult = LZ4F_decodeHeader(dctx, srcBuffer, hSize);
 3061|  30.7k|                if (LZ4F_isError(decodeResult)) {
  ------------------
  |  Branch (3061:21): [True: 11.3k, False: 19.3k]
  ------------------
 3062|  11.3k|                    *srcSizePtr = 0;
 3063|  19.3k|                } else {
 3064|  19.3k|                    *srcSizePtr = decodeResult;
 3065|  19.3k|                    decodeResult = BHSize;   /* block header size */
 3066|  19.3k|                }
 3067|  30.7k|                *frameInfoPtr = dctx->frameInfo;
 3068|  30.7k|                return decodeResult;
 3069|  31.0k|    }   }   }
 3070|  98.9k|}
LZ4F_decompress:
 3323|   230k|{
 3324|   230k|    static const BYTE emptySrc = 0;   /* NULL srcBuffer (no input, used by LZ4F_getFrameInfo()) points here instead :
 3325|       |                                       * NULL+0 and LZ4_memcpy(dst, NULL, 0) are UB */
 3326|   230k|    LZ4F_decompressOptions_t optionsNull;
 3327|   230k|    const BYTE* const srcStart = srcBuffer ? (const BYTE*)srcBuffer : &emptySrc;
  ------------------
  |  Branch (3327:34): [True: 163k, False: 66.6k]
  ------------------
 3328|   230k|    const BYTE* const srcEnd = srcBuffer ? srcStart + *srcSizePtr : srcStart;
  ------------------
  |  Branch (3328:32): [True: 163k, False: 66.6k]
  ------------------
 3329|   230k|    const BYTE* srcPtr = srcStart;
 3330|   230k|    BYTE* const dstStart = (BYTE*)dstBuffer;
 3331|   230k|    BYTE* const dstEnd = dstStart ? dstStart + *dstSizePtr : NULL;
  ------------------
  |  Branch (3331:26): [True: 163k, False: 66.6k]
  ------------------
 3332|   230k|    BYTE* dstPtr = dstStart;
 3333|   230k|    const BYTE* selectedIn = NULL;
 3334|   230k|    unsigned doAnotherStage = 1;
 3335|   230k|    size_t nextSrcSizeHint = 1;
 3336|       |
 3337|       |
 3338|   230k|    DEBUGLOG(5, "LZ4F_decompress: src[%p](%u) => dst[%p](%u)",
  ------------------
  |  |  208|   230k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3339|   230k|            srcBuffer, (unsigned)*srcSizePtr, dstBuffer, (unsigned)*dstSizePtr);
 3340|   230k|    if (dstBuffer == NULL) assert(*dstSizePtr == 0);
  ------------------
  |  Branch (3340:9): [True: 66.6k, False: 163k]
  |  Branch (3340:28): [True: 0, False: 66.6k]
  |  Branch (3340:28): [True: 66.6k, False: 0]
  ------------------
 3341|   230k|    if (srcBuffer == NULL) assert(*srcSizePtr == 0);
  ------------------
  |  Branch (3341:9): [True: 66.6k, False: 163k]
  |  Branch (3341:28): [True: 0, False: 66.6k]
  |  Branch (3341:28): [True: 66.6k, False: 0]
  ------------------
 3342|   230k|    MEM_INIT(&optionsNull, 0, sizeof(optionsNull));
  ------------------
  |  |  122|   230k|#  define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  119|   230k|#  define LZ4_memset(p,v,n)  memset((p),(v),(n))
  |  |  ------------------
  ------------------
 3343|   230k|    if (decompressOptionsPtr==NULL) decompressOptionsPtr = &optionsNull;
  ------------------
  |  Branch (3343:9): [True: 230k, False: 0]
  ------------------
 3344|   230k|    *srcSizePtr = 0;
 3345|   230k|    *dstSizePtr = 0;
 3346|   230k|    assert(dctx != NULL);
  ------------------
  |  Branch (3346:5): [True: 0, False: 230k]
  |  Branch (3346:5): [True: 230k, False: 0]
  ------------------
 3347|   230k|    switch (decompressOptionsPtr->skipChecksums) {   /* once set, disable for the remainder of the frame */
 3348|   230k|    case LZ4F_verifyChecksums: break;
  ------------------
  |  Branch (3348:5): [True: 230k, False: 0]
  ------------------
 3349|      0|    case LZ4F_skipAllChecksums: dctx->skipBlockChecksum = 1; dctx->skipContentChecksum = 1; break;
  ------------------
  |  Branch (3349:5): [True: 0, False: 230k]
  ------------------
 3350|      0|    case LZ4F_skipContentChecksum: dctx->skipContentChecksum = 1; break;
  ------------------
  |  Branch (3350:5): [True: 0, False: 230k]
  ------------------
 3351|      0|    case LZ4F_skipBlockChecksums: dctx->skipBlockChecksum = 1; break;
  ------------------
  |  Branch (3351:5): [True: 0, False: 230k]
  ------------------
 3352|      0|    default: RETURN_ERROR(parameter_invalid);
  ------------------
  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (3352:5): [True: 0, False: 230k]
  ------------------
 3353|   230k|    }
 3354|       |
 3355|       |    /* behaves as a state machine */
 3356|       |
 3357|   571k|    while (doAnotherStage) {
  ------------------
  |  Branch (3357:12): [True: 345k, False: 226k]
  ------------------
 3358|       |
 3359|   345k|        switch(dctx->dStage)
  ------------------
  |  Branch (3359:16): [True: 345k, False: 0]
  ------------------
 3360|   345k|        {
 3361|       |
 3362|  18.2k|        case dstage_getFrameHeader:
  ------------------
  |  Branch (3362:9): [True: 18.2k, False: 326k]
  ------------------
 3363|  18.2k|            DEBUGLOG(6, "dstage_getFrameHeader");
  ------------------
  |  |  208|  18.2k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3364|  18.2k|            if ((size_t)(srcEnd-srcPtr) >= maxFHSize) {  /* enough to decode - shortcut */
  ------------------
  |  Branch (3364:17): [True: 0, False: 18.2k]
  ------------------
 3365|      0|                size_t const hSize = LZ4F_decodeHeader(dctx, srcPtr, (size_t)(srcEnd-srcPtr));  /* will update dStage appropriately */
 3366|      0|                if (LZ4F_isError(hSize)) { nextSrcSizeHint = hSize; goto _output; }
  ------------------
  |  Branch (3366:21): [True: 0, False: 0]
  ------------------
 3367|      0|                srcPtr += hSize;
 3368|      0|                break;
 3369|      0|            }
 3370|  18.2k|            dctx->tmpInSize = 0;
 3371|  18.2k|            if (srcEnd-srcPtr == 0) return minFHSize;   /* 0-size input */
  ------------------
  |  Branch (3371:17): [True: 0, False: 18.2k]
  ------------------
 3372|  18.2k|            dctx->tmpInTarget = minFHSize;   /* minimum size to decode header */
 3373|  18.2k|            dctx->dStage = dstage_storeFrameHeader;
 3374|       |            /* fall-through */
 3375|       |
 3376|  20.8k|        case dstage_storeFrameHeader:
  ------------------
  |  Branch (3376:9): [True: 2.54k, False: 342k]
  ------------------
 3377|  20.8k|            DEBUGLOG(6, "dstage_storeFrameHeader");
  ------------------
  |  |  208|  20.8k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3378|  20.8k|            {   size_t const sizeToCopy = MIN(dctx->tmpInTarget - dctx->tmpInSize, (size_t)(srcEnd - srcPtr));
  ------------------
  |  |  443|  20.8k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (443:22): [True: 1.29k, False: 19.5k]
  |  |  ------------------
  ------------------
 3379|  20.8k|                LZ4_memcpy(dctx->header + dctx->tmpInSize, srcPtr, sizeToCopy);
  ------------------
  |  |  113|  20.8k|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 3380|  20.8k|                dctx->tmpInSize += sizeToCopy;
 3381|  20.8k|                srcPtr += sizeToCopy;
 3382|  20.8k|            }
 3383|  20.8k|            if (dctx->tmpInSize < dctx->tmpInTarget) {
  ------------------
  |  Branch (3383:17): [True: 1.44k, False: 19.3k]
  ------------------
 3384|  1.44k|                nextSrcSizeHint = (dctx->tmpInTarget - dctx->tmpInSize) + BHSize;   /* rest of header + nextBlockHeader */
 3385|  1.44k|                doAnotherStage = 0;   /* not enough src data, ask for some more */
 3386|  1.44k|                break;
 3387|  1.44k|            }
 3388|  19.3k|            {   size_t const hSize = LZ4F_decodeHeader(dctx, dctx->header, dctx->tmpInTarget); /* will update dStage appropriately */
 3389|  19.3k|                if (LZ4F_isError(hSize)) { nextSrcSizeHint = hSize; goto _output; }
  ------------------
  |  Branch (3389:21): [True: 243, False: 19.1k]
  ------------------
 3390|  19.3k|            }
 3391|  19.1k|            break;
 3392|       |
 3393|  33.9k|        case dstage_init:
  ------------------
  |  Branch (3393:9): [True: 33.9k, False: 311k]
  ------------------
 3394|  33.9k|            DEBUGLOG(6, "dstage_init");
  ------------------
  |  |  208|  33.9k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3395|  33.9k|            if (dctx->frameInfo.contentChecksumFlag) (void)XXH32_reset(&(dctx->xxh), 0);
  ------------------
  |  |  131|  13.9k|#  define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
  |  |  ------------------
  |  |  |  |  126|  13.9k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  13.9k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3395:17): [True: 13.9k, False: 19.9k]
  ------------------
 3396|       |            /* internal buffers allocation */
 3397|  33.9k|            {   size_t const tmpInNeeded = dctx->maxBlockSize + BFSize /* block checksum */;
 3398|  33.9k|                size_t const tmpOutNeeded = dctx->maxBlockSize   /* + history : linked blocks, or first block decoded progressively */
 3399|  33.9k|                    + (((dctx->frameInfo.blockMode==LZ4F_blockLinked) || dctx->progressive) ? 128 KB : 0);
  ------------------
  |  |  285|  22.7k|#  define KB *(1<<10)
  ------------------
  |  Branch (3399:25): [True: 22.7k, False: 11.1k]
  |  Branch (3399:74): [True: 0, False: 11.1k]
  ------------------
 3400|  33.9k|                if ( (tmpInNeeded > dctx->tmpInCapacity)
  ------------------
  |  Branch (3400:22): [True: 18.7k, False: 15.2k]
  ------------------
 3401|  18.7k|                  || (tmpOutNeeded > dctx->tmpOutBufferCapacity) ) {   /* tmp buffers too small */
  ------------------
  |  Branch (3401:22): [True: 9, False: 15.2k]
  ------------------
 3402|       |                    /* capacities remain 0 until allocation succeeds,
 3403|       |                     * so that allocation will be re-attempted on next entry */
 3404|  18.7k|                    LZ4F_free(dctx->tmpIn, dctx->cmem);
 3405|  18.7k|                    dctx->tmpInCapacity = 0;
 3406|  18.7k|                    dctx->tmpIn = (BYTE*)LZ4F_malloc(tmpInNeeded, dctx->cmem);
 3407|  18.7k|                    if (dctx->tmpIn == NULL) {
  ------------------
  |  Branch (3407:25): [True: 0, False: 18.7k]
  ------------------
 3408|      0|                        nextSrcSizeHint = LZ4F_returnErrorCode(LZ4F_ERROR_allocation_failed);
 3409|      0|                        goto _output;
 3410|      0|                    }
 3411|  18.7k|                    dctx->tmpInCapacity = tmpInNeeded;
 3412|  18.7k|                    LZ4F_free(dctx->tmpOutBuffer, dctx->cmem);
 3413|  18.7k|                    dctx->tmpOutBufferCapacity = 0;
 3414|  18.7k|                    dctx->tmpOutBuffer= (BYTE*)LZ4F_malloc(tmpOutNeeded, dctx->cmem);
 3415|  18.7k|                    if (dctx->tmpOutBuffer== NULL) {
  ------------------
  |  Branch (3415:25): [True: 0, False: 18.7k]
  ------------------
 3416|      0|                        nextSrcSizeHint = LZ4F_returnErrorCode(LZ4F_ERROR_allocation_failed);
 3417|      0|                        goto _output;
 3418|      0|                    }
 3419|  18.7k|                    dctx->tmpOutBufferCapacity = tmpOutNeeded;
 3420|  18.7k|            }   }
 3421|  33.9k|            dctx->tmpInSize = 0;
 3422|  33.9k|            dctx->tmpInTarget = 0;
 3423|  33.9k|            dctx->progressiveFrame = dctx->progressive;
 3424|  33.9k|            dctx->tmpInDecoded = 0;
 3425|  33.9k|            dctx->blockDecoded = 0;
 3426|  33.9k|            dctx->blockNb = 0;
 3427|  33.9k|            dctx->tmpOut = dctx->tmpOutBuffer;
 3428|  33.9k|            dctx->tmpOutStart = 0;
 3429|  33.9k|            dctx->tmpOutSize = 0;
 3430|       |
 3431|  33.9k|            dctx->dStage = dstage_getBlockHeader;
 3432|       |            /* fall-through */
 3433|       |
 3434|   100k|        case dstage_getBlockHeader:
  ------------------
  |  Branch (3434:9): [True: 66.9k, False: 278k]
  ------------------
 3435|   100k|            selectedIn = LZ4F_gatherInput(dctx, dctx->tmpIn, BHSize, &srcPtr, srcEnd);
 3436|   100k|            if (selectedIn == NULL) {   /* not enough input for cBlockSize */
  ------------------
  |  Branch (3436:17): [True: 14.0k, False: 86.8k]
  ------------------
 3437|  14.0k|                nextSrcSizeHint = BHSize - dctx->tmpInSize;
 3438|  14.0k|                doAnotherStage = 0;
 3439|  14.0k|                break;
 3440|  14.0k|            }
 3441|       |
 3442|       |            /* decode block header */
 3443|  86.8k|            {   U32 const blockHeader = LZ4F_readLE32(selectedIn);
 3444|  86.8k|                size_t const nextCBlockSize = blockHeader & 0x7FFFFFFFU;
 3445|  86.8k|                size_t const crcSize = dctx->frameInfo.blockChecksumFlag * BFSize;
 3446|  86.8k|                if (blockHeader==0) {  /* frameEnd signal, no more block */
  ------------------
  |  Branch (3446:21): [True: 19.5k, False: 67.3k]
  ------------------
 3447|  19.5k|                    DEBUGLOG(5, "end of frame");
  ------------------
  |  |  208|  19.5k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3448|  19.5k|                    dctx->dStage = dstage_getSuffix;
 3449|  19.5k|                    break;
 3450|  19.5k|                }
 3451|  67.3k|                if (dctx->blockNb < 2) dctx->blockNb++;
  ------------------
  |  Branch (3451:21): [True: 49.4k, False: 17.8k]
  ------------------
 3452|  67.3k|                if (nextCBlockSize > dctx->maxBlockSize) {
  ------------------
  |  Branch (3452:21): [True: 669, False: 66.6k]
  ------------------
 3453|    669|                    nextSrcSizeHint = LZ4F_returnErrorCode(LZ4F_ERROR_maxBlockSize_invalid);
 3454|    669|                    goto _output;
 3455|    669|                }
 3456|  66.6k|                if (blockHeader & LZ4F_BLOCKUNCOMPRESSED_FLAG) {
  ------------------
  |  |  296|  66.6k|#define LZ4F_BLOCKUNCOMPRESSED_FLAG 0x80000000U
  ------------------
  |  Branch (3456:21): [True: 14.2k, False: 52.4k]
  ------------------
 3457|       |                    /* next block is uncompressed */
 3458|  14.2k|                    if (dctx->frameInfo.contentSize && nextCBlockSize > dctx->frameRemainingSize) {
  ------------------
  |  Branch (3458:25): [True: 869, False: 13.3k]
  |  Branch (3458:56): [True: 33, False: 836]
  ------------------
 3459|     33|                        nextSrcSizeHint = LZ4F_returnErrorCode(LZ4F_ERROR_frameSize_wrong);
 3460|     33|                        goto _output;
 3461|     33|                    }
 3462|  14.2k|                    dctx->tmpInTarget = nextCBlockSize;
 3463|  14.2k|                    DEBUGLOG(5, "next block is uncompressed (size %u)", (U32)nextCBlockSize);
  ------------------
  |  |  208|  14.2k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3464|  14.2k|                    if (dctx->frameInfo.blockChecksumFlag) {
  ------------------
  |  Branch (3464:25): [True: 5.20k, False: 9.00k]
  ------------------
 3465|  5.20k|                        (void)XXH32_reset(&dctx->blockChecksum, 0);
  ------------------
  |  |  131|  5.20k|#  define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
  |  |  ------------------
  |  |  |  |  126|  5.20k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  5.20k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3466|  5.20k|                    }
 3467|  14.2k|                    dctx->dStage = dstage_copyDirect;
 3468|  14.2k|                    break;
 3469|  14.2k|                }
 3470|       |                /* next block is a compressed block */
 3471|  52.4k|                dctx->tmpInTarget = nextCBlockSize + crcSize;
 3472|  52.4k|                assert(dctx->tmpInDecoded == 0 && dctx->blockDecoded == 0);   /* see LZ4F_endBlock() */
  ------------------
  |  Branch (3472:17): [True: 0, False: 52.4k]
  |  Branch (3472:17): [True: 0, False: 0]
  |  Branch (3472:17): [True: 52.4k, False: 0]
  |  Branch (3472:17): [True: 52.4k, False: 0]
  ------------------
 3473|  52.4k|                dctx->dStage = dstage_getCBlock;
 3474|  52.4k|                if (dstPtr==dstEnd || srcPtr==srcEnd) {
  ------------------
  |  Branch (3474:21): [True: 2.96k, False: 49.4k]
  |  Branch (3474:39): [True: 49.4k, False: 0]
  ------------------
 3475|  52.4k|                    nextSrcSizeHint = BHSize + nextCBlockSize + crcSize;
 3476|  52.4k|                    doAnotherStage = 0;
 3477|  52.4k|                }
 3478|  52.4k|                break;
 3479|  52.4k|            }
 3480|       |
 3481|  49.0k|        case dstage_copyDirect:   /* uncompressed block */
  ------------------
  |  Branch (3481:9): [True: 49.0k, False: 296k]
  ------------------
 3482|  49.0k|            DEBUGLOG(6, "dstage_copyDirect");
  ------------------
  |  |  208|  49.0k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3483|  49.0k|            {   size_t sizeToCopy;
 3484|  49.0k|                if (dstPtr == NULL) {
  ------------------
  |  Branch (3484:21): [True: 13.7k, False: 35.3k]
  ------------------
 3485|  13.7k|                    sizeToCopy = 0;
 3486|  35.3k|                } else {
 3487|  35.3k|                    size_t const minBuffSize = MIN((size_t)(srcEnd-srcPtr), (size_t)(dstEnd-dstPtr));
  ------------------
  |  |  443|  35.3k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (443:22): [True: 26.3k, False: 8.94k]
  |  |  ------------------
  ------------------
 3488|  35.3k|                    sizeToCopy = MIN(dctx->tmpInTarget, minBuffSize);
  ------------------
  |  |  443|  35.3k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (443:22): [True: 7.28k, False: 28.0k]
  |  |  ------------------
  ------------------
 3489|  35.3k|                    LZ4_memcpy(dstPtr, srcPtr, sizeToCopy);
  ------------------
  |  |  113|  35.3k|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 3490|  35.3k|                    if (dctx->frameInfo.blockChecksumFlag && !dctx->skipBlockChecksum)
  ------------------
  |  Branch (3490:25): [True: 13.3k, False: 22.0k]
  |  Branch (3490:62): [True: 13.3k, False: 0]
  ------------------
 3491|  13.3k|                        (void)XXH32_update(&dctx->blockChecksum, srcPtr, sizeToCopy);
  ------------------
  |  |  132|  13.3k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  13.3k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  13.3k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3492|  35.3k|                    if (dctx->frameInfo.contentChecksumFlag && !dctx->skipContentChecksum)
  ------------------
  |  Branch (3492:25): [True: 15.1k, False: 20.2k]
  |  Branch (3492:64): [True: 14.8k, False: 238]
  ------------------
 3493|  14.8k|                        (void)XXH32_update(&dctx->xxh, srcPtr, sizeToCopy);
  ------------------
  |  |  132|  14.8k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  14.8k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  14.8k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3494|  35.3k|                    if (dctx->frameInfo.contentSize)
  ------------------
  |  Branch (3494:25): [True: 1.60k, False: 33.7k]
  ------------------
 3495|  1.60k|                        dctx->frameRemainingSize -= sizeToCopy;
 3496|       |
 3497|       |                    /* history management (linked blocks only), unless the frame ends with this block */
 3498|  35.3k|                    if ( (dctx->frameInfo.blockMode == LZ4F_blockLinked)
  ------------------
  |  Branch (3498:26): [True: 25.1k, False: 10.1k]
  ------------------
 3499|  25.1k|                      && !( (sizeToCopy == dctx->tmpInTarget)
  ------------------
  |  Branch (3499:29): [True: 8.89k, False: 16.2k]
  ------------------
 3500|  22.5k|                         && LZ4F_endMarkFollows(srcPtr + sizeToCopy, srcEnd, dctx->frameInfo.blockChecksumFlag * BFSize) ) ) {
  ------------------
  |  Branch (3500:29): [True: 2.67k, False: 6.22k]
  ------------------
 3501|  22.5k|                        LZ4F_updateDict(dctx, dstPtr, sizeToCopy, dstStart, 0);
 3502|  22.5k|                    }
 3503|  35.3k|                    srcPtr += sizeToCopy;
 3504|  35.3k|                    dstPtr += sizeToCopy;
 3505|  35.3k|                }
 3506|  49.0k|                if (sizeToCopy == dctx->tmpInTarget) {   /* all done */
  ------------------
  |  Branch (3506:21): [True: 12.3k, False: 36.7k]
  ------------------
 3507|  12.3k|                    if (dctx->frameInfo.blockChecksumFlag)
  ------------------
  |  Branch (3507:25): [True: 4.44k, False: 7.93k]
  ------------------
 3508|  4.44k|                        dctx->dStage = dstage_getBlockChecksum;
 3509|  7.93k|                    else
 3510|  7.93k|                        dctx->dStage = dstage_getBlockHeader;  /* new block */
 3511|  12.3k|                    break;
 3512|  12.3k|                }
 3513|  36.7k|                dctx->tmpInTarget -= sizeToCopy;  /* need to copy more */
 3514|  36.7k|            }
 3515|      0|            nextSrcSizeHint = dctx->tmpInTarget
 3516|  36.7k|                            + (dctx->frameInfo.blockChecksumFlag ? BFSize : 0)
  ------------------
  |  Branch (3516:32): [True: 13.9k, False: 22.7k]
  ------------------
 3517|  36.7k|                            + BHSize /* next header size */;
 3518|  36.7k|            doAnotherStage = 0;
 3519|  36.7k|            break;
 3520|       |
 3521|       |        /* check block checksum for recently transferred uncompressed block */
 3522|  4.85k|        case dstage_getBlockChecksum:
  ------------------
  |  Branch (3522:9): [True: 4.85k, False: 340k]
  ------------------
 3523|  4.85k|            DEBUGLOG(6, "dstage_getBlockChecksum");
  ------------------
  |  |  208|  4.85k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3524|  4.85k|            selectedIn = LZ4F_gatherInput(dctx, dctx->tmpIn, BFSize, &srcPtr, srcEnd);
 3525|  4.85k|            if (selectedIn == NULL) {   /* all input consumed */
  ------------------
  |  Branch (3525:17): [True: 444, False: 4.40k]
  ------------------
 3526|    444|                nextSrcSizeHint = (BFSize - dctx->tmpInSize) + BHSize /* next header size */;
 3527|    444|                doAnotherStage = 0;
 3528|    444|                break;
 3529|    444|            }
 3530|  4.40k|            if (!dctx->skipBlockChecksum) {
  ------------------
  |  Branch (3530:17): [True: 4.40k, False: 0]
  ------------------
 3531|  4.40k|                U32 const readCRC = LZ4F_readLE32(selectedIn);
 3532|  4.40k|                U32 const calcCRC = XXH32_digest(&dctx->blockChecksum);
  ------------------
  |  |  133|  4.40k|#  define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
  |  |  ------------------
  |  |  |  |  126|  4.40k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  4.40k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3533|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 3534|       |                DEBUGLOG(6, "compare block checksum");
 3535|       |                if (readCRC != calcCRC) {
 3536|       |                    DEBUGLOG(4, "incorrect block checksum: %08X != %08X",
 3537|       |                            readCRC, calcCRC);
 3538|       |                    nextSrcSizeHint = LZ4F_returnErrorCode(LZ4F_ERROR_blockChecksum_invalid);
 3539|       |                    goto _output;
 3540|       |                }
 3541|       |#else
 3542|  4.40k|                (void)readCRC;
 3543|  4.40k|                (void)calcCRC;
 3544|  4.40k|#endif
 3545|  4.40k|            }
 3546|  4.40k|            dctx->dStage = dstage_getBlockHeader;  /* new block */
 3547|  4.40k|            break;
 3548|       |
 3549|   119k|        case dstage_getCBlock:
  ------------------
  |  Branch (3549:9): [True: 119k, False: 225k]
  ------------------
 3550|   119k|            DEBUGLOG(6, "dstage_getCBlock");
  ------------------
  |  |  208|   119k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3551|   119k|            selectedIn = LZ4F_gatherInput(dctx, dctx->tmpIn, dctx->tmpInTarget, &srcPtr, srcEnd);
 3552|   119k|            if (selectedIn == NULL) {   /* need more input */
  ------------------
  |  Branch (3552:17): [True: 67.6k, False: 52.0k]
  ------------------
 3553|       |                /* first block of the frame : output what can be decoded already (see LZ4F_setProgressiveDecoding()),
 3554|       |                 * unless a block checksum must be verified first */
 3555|  67.6k|                if ( dctx->progressiveFrame && (dctx->blockNb == 1)
  ------------------
  |  Branch (3555:22): [True: 0, False: 67.6k]
  |  Branch (3555:48): [True: 0, False: 0]
  ------------------
 3556|      0|                  && !dctx->frameInfo.blockChecksumFlag && (dstPtr != NULL) ) {
  ------------------
  |  Branch (3556:22): [True: 0, False: 0]
  |  Branch (3556:60): [True: 0, False: 0]
  ------------------
 3557|      0|                    size_t const decodedSize = LZ4F_decodeProgressive(dctx, dstPtr, (size_t)(dstEnd - dstPtr), dstStart);
 3558|      0|                    if (LZ4F_isError(decodedSize)) { nextSrcSizeHint = decodedSize; goto _output; }
  ------------------
  |  Branch (3558:25): [True: 0, False: 0]
  ------------------
 3559|      0|                    dstPtr += decodedSize;
 3560|      0|                }
 3561|  67.6k|                nextSrcSizeHint = (dctx->tmpInTarget - dctx->tmpInSize)   /* block checksum included */
 3562|  67.6k|                                + BHSize /* next header size */;
 3563|  67.6k|                doAnotherStage = 0;
 3564|  67.6k|                break;
 3565|  67.6k|            }
 3566|       |
 3567|       |            /* At this stage, input is large enough to decode a block */
 3568|       |            /* (or the rest of a block decoded progressively : dctx->tmpInDecoded bytes already decoded, never with block checksum) */
 3569|   119k|            assert((dctx->tmpInDecoded == 0) || (selectedIn == dctx->tmpIn));
  ------------------
  |  Branch (3569:13): [True: 52.0k, False: 0]
  |  Branch (3569:13): [True: 0, False: 0]
  |  Branch (3569:13): [True: 52.0k, False: 0]
  |  Branch (3569:13): [True: 0, False: 0]
  ------------------
 3570|  52.0k|            assert((dctx->tmpInDecoded == 0) || !dctx->frameInfo.blockChecksumFlag);
  ------------------
  |  Branch (3570:13): [True: 52.0k, False: 0]
  |  Branch (3570:13): [True: 0, False: 0]
  |  Branch (3570:13): [True: 52.0k, False: 0]
  |  Branch (3570:13): [True: 0, False: 0]
  ------------------
 3571|       |
 3572|       |            /* First, decode and control block checksum if it exists */
 3573|  52.0k|            if (dctx->frameInfo.blockChecksumFlag) {
  ------------------
  |  Branch (3573:17): [True: 21.0k, False: 31.0k]
  ------------------
 3574|  21.0k|                assert(dctx->tmpInTarget >= 4);
  ------------------
  |  Branch (3574:17): [True: 0, False: 21.0k]
  |  Branch (3574:17): [True: 21.0k, False: 0]
  ------------------
 3575|  21.0k|                dctx->tmpInTarget -= 4;
 3576|  21.0k|                if (!dctx->skipBlockChecksum) {
  ------------------
  |  Branch (3576:21): [True: 21.0k, False: 0]
  ------------------
 3577|  21.0k|                    U32 const readBlockCrc = LZ4F_readLE32(selectedIn + dctx->tmpInTarget);
 3578|  21.0k|                    U32 const calcBlockCrc = XXH32(selectedIn, dctx->tmpInTarget, 0);
  ------------------
  |  |  128|  21.0k|#  define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
  |  |  ------------------
  |  |  |  |  126|  21.0k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  21.0k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3579|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 3580|       |                    if (readBlockCrc != calcBlockCrc) {
 3581|       |                        nextSrcSizeHint = LZ4F_returnErrorCode(LZ4F_ERROR_blockChecksum_invalid);
 3582|       |                        goto _output;
 3583|       |                    }
 3584|       |#else
 3585|  21.0k|                    (void)readBlockCrc;
 3586|  21.0k|                    (void)calcBlockCrc;
 3587|  21.0k|#endif
 3588|  21.0k|            }   }
 3589|       |
 3590|       |            /* decode directly into destination buffer if there is enough room */
 3591|  52.0k|            if ( ((size_t)(dstEnd-dstPtr) >= dctx->maxBlockSize - dctx->blockDecoded)
  ------------------
  |  Branch (3591:18): [True: 14.6k, False: 37.4k]
  ------------------
 3592|       |                 /* unless the dictionary is stored in tmpOut:
 3593|       |                  * in which case it's faster to decode within tmpOut
 3594|       |                  * to benefit from prefix speedup (but the rest of a block decoded progressively would be copied) */
 3595|  14.6k|              && ( dctx->blockDecoded
  ------------------
  |  Branch (3595:20): [True: 0, False: 14.6k]
  ------------------
 3596|  14.6k|                || !(dctx->dict!= NULL && (const BYTE*)dctx->dict + dctx->dictSize == dctx->tmpOut) ) )
  ------------------
  |  Branch (3596:22): [True: 8.95k, False: 5.72k]
  |  Branch (3596:43): [True: 6.28k, False: 2.66k]
  ------------------
 3597|  8.39k|            {   size_t const decodedSize = LZ4F_decodeBlock(dctx,
 3598|  8.39k|                                selectedIn + dctx->tmpInDecoded, dctx->tmpInTarget - dctx->tmpInDecoded,
 3599|  8.39k|                                dstPtr, dctx->maxBlockSize - dctx->blockDecoded, NULL);
 3600|  8.39k|                if (LZ4F_isError(decodedSize)) { nextSrcSizeHint = decodedSize; goto _output; }
  ------------------
  |  Branch (3600:21): [True: 713, False: 7.68k]
  ------------------
 3601|       |
 3602|       |                /* dictionary management, unless the frame ends with this block */
 3603|  7.68k|                if ( (dctx->frameInfo.blockMode==LZ4F_blockLinked)
  ------------------
  |  Branch (3603:22): [True: 5.52k, False: 2.15k]
  ------------------
 3604|  5.52k|                  && !LZ4F_endMarkFollows(srcPtr, srcEnd, 0) ) {
  ------------------
  |  Branch (3604:22): [True: 5.40k, False: 118]
  ------------------
 3605|  5.40k|                    LZ4F_updateDict(dctx, dstPtr, decodedSize, dstStart, 0);
 3606|  5.40k|                }
 3607|       |
 3608|  7.68k|                dstPtr += decodedSize;
 3609|  7.68k|                LZ4F_endBlock(dctx);
 3610|  7.68k|                dctx->dStage = dstage_getBlockHeader;  /* end of block, let's get another one */
 3611|  7.68k|                break;
 3612|  8.39k|            }
 3613|       |
 3614|       |            /* not enough place into dst : decode into tmpOut */
 3615|       |
 3616|       |            /* manage dictionary : history of linked blocks, or beginning of a block decoded progressively */
 3617|  43.6k|            if ((dctx->frameInfo.blockMode == LZ4F_blockLinked) || dctx->blockDecoded) {
  ------------------
  |  Branch (3617:17): [True: 32.4k, False: 11.2k]
  |  Branch (3617:68): [True: 0, False: 11.2k]
  ------------------
 3618|  32.4k|                if (dctx->dict == dctx->tmpOutBuffer) {
  ------------------
  |  Branch (3618:21): [True: 19.9k, False: 12.5k]
  ------------------
 3619|       |                    /* truncate dictionary to 64 KB if too big */
 3620|  19.9k|                    if (dctx->dictSize > 128 KB) {
  ------------------
  |  |  285|  19.9k|#  define KB *(1<<10)
  ------------------
  |  Branch (3620:25): [True: 1.18k, False: 18.7k]
  ------------------
 3621|  1.18k|                        LZ4_memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - 64 KB, 64 KB);
  ------------------
  |  |  113|  1.18k|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 3622|  1.18k|                        dctx->dictSize = 64 KB;
  ------------------
  |  |  285|  1.18k|#  define KB *(1<<10)
  ------------------
 3623|  1.18k|                    }
 3624|  19.9k|                    dctx->tmpOut = dctx->tmpOutBuffer + dctx->dictSize;
 3625|  19.9k|                } else {  /* dict not within tmpOut */
 3626|  12.5k|                    size_t const reservedDictSpace = MIN(dctx->dictSize, 64 KB);
  ------------------
  |  |  443|  12.5k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (443:22): [True: 12.5k, False: 0]
  |  |  ------------------
  ------------------
 3627|  12.5k|                    dctx->tmpOut = dctx->tmpOutBuffer + reservedDictSpace;
 3628|  12.5k|            }   }
 3629|       |
 3630|       |            /* Decode block into tmpOut */
 3631|  43.6k|            {   size_t const decodedSize = LZ4F_decodeBlock(dctx,
 3632|  43.6k|                                selectedIn + dctx->tmpInDecoded, dctx->tmpInTarget - dctx->tmpInDecoded,
 3633|  43.6k|                                dctx->tmpOut, dctx->maxBlockSize - dctx->blockDecoded, NULL);
 3634|  43.6k|                if (LZ4F_isError(decodedSize)) { nextSrcSizeHint = decodedSize; goto _output; }
  ------------------
  |  Branch (3634:21): [True: 1.91k, False: 41.7k]
  ------------------
 3635|  41.7k|                LZ4F_endBlock(dctx);
 3636|  41.7k|                dctx->tmpOutSize = decodedSize;
 3637|  41.7k|                dctx->tmpOutStart = 0;
 3638|  41.7k|                dctx->dStage = dstage_flushOut;
 3639|  41.7k|            }
 3640|       |            /* fall-through */
 3641|       |
 3642|  52.2k|        case dstage_flushOut:  /* flush decoded data from tmpOut to dstBuffer */
  ------------------
  |  Branch (3642:9): [True: 10.4k, False: 334k]
  ------------------
 3643|  52.2k|            DEBUGLOG(6, "dstage_flushOut");
  ------------------
  |  |  208|  52.2k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3644|  52.2k|            if (dstPtr != NULL) {
  ------------------
  |  Branch (3644:17): [True: 52.2k, False: 0]
  ------------------
 3645|  52.2k|                size_t const sizeToCopy = MIN(dctx->tmpOutSize - dctx->tmpOutStart, (size_t)(dstEnd-dstPtr));
  ------------------
  |  |  443|  52.2k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (443:22): [True: 19.9k, False: 32.2k]
  |  |  ------------------
  ------------------
 3646|  52.2k|                LZ4_memcpy(dstPtr, dctx->tmpOut + dctx->tmpOutStart, sizeToCopy);
  ------------------
  |  |  113|  52.2k|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 3647|       |
 3648|       |                /* dictionary management, unless the frame ends with this block */
 3649|  52.2k|                if ( (dctx->frameInfo.blockMode == LZ4F_blockLinked)
  ------------------
  |  Branch (3649:22): [True: 39.5k, False: 12.7k]
  ------------------
 3650|  39.5k|                  && !( (dctx->tmpOutStart + sizeToCopy == dctx->tmpOutSize)
  ------------------
  |  Branch (3650:25): [True: 25.3k, False: 14.1k]
  ------------------
 3651|  25.3k|                     && LZ4F_endMarkFollows(srcPtr, srcEnd, 0) ) )
  ------------------
  |  Branch (3651:25): [True: 9.86k, False: 15.5k]
  ------------------
 3652|  29.6k|                    LZ4F_updateDict(dctx, dstPtr, sizeToCopy, dstStart, 1 /*withinTmp*/);
 3653|       |
 3654|  52.2k|                dctx->tmpOutStart += sizeToCopy;
 3655|  52.2k|                dstPtr += sizeToCopy;
 3656|  52.2k|            }
 3657|  52.2k|            if (dctx->tmpOutStart == dctx->tmpOutSize) { /* all flushed */
  ------------------
  |  Branch (3657:17): [True: 33.4k, False: 18.7k]
  ------------------
 3658|  33.4k|                dctx->dStage = dstage_getBlockHeader;  /* get next block */
 3659|  33.4k|                break;
 3660|  33.4k|            }
 3661|       |            /* could not flush everything : stop there, just request a block header */
 3662|  18.7k|            doAnotherStage = 0;
 3663|  18.7k|            nextSrcSizeHint = BHSize;
 3664|  18.7k|            break;
 3665|       |
 3666|  23.0k|        case dstage_getSuffix:
  ------------------
  |  Branch (3666:9): [True: 23.0k, False: 322k]
  ------------------
 3667|  23.0k|            if (dctx->frameRemainingSize) {   /* incorrect frame size decoded */
  ------------------
  |  Branch (3667:17): [True: 154, False: 22.8k]
  ------------------
 3668|    154|                nextSrcSizeHint = LZ4F_returnErrorCode(LZ4F_ERROR_frameSize_wrong);
 3669|    154|                goto _output;
 3670|    154|            }
 3671|  22.8k|            if (!dctx->frameInfo.contentChecksumFlag) {  /* no checksum, frame is completed */
  ------------------
  |  Branch (3671:17): [True: 10.9k, False: 11.9k]
  ------------------
 3672|  10.9k|                nextSrcSizeHint = 0;
 3673|  10.9k|                LZ4F_endFrame(dctx);
 3674|  10.9k|                doAnotherStage = 0;
 3675|  10.9k|                break;
 3676|  10.9k|            }
 3677|  11.9k|            selectedIn = LZ4F_gatherInput(dctx, dctx->tmpIn, 4, &srcPtr, srcEnd);
 3678|  11.9k|            if (selectedIn == NULL) {   /* not enough input to read complete suffix */
  ------------------
  |  Branch (3678:17): [True: 8.47k, False: 3.47k]
  ------------------
 3679|  8.47k|                nextSrcSizeHint = 4 - dctx->tmpInSize;
 3680|  8.47k|                doAnotherStage = 0;
 3681|  8.47k|                break;
 3682|  8.47k|            }
 3683|  3.47k|            if (!dctx->skipContentChecksum) {
  ------------------
  |  Branch (3683:17): [True: 3.37k, False: 95]
  ------------------
 3684|  3.37k|                U32 const readCRC = LZ4F_readLE32(selectedIn);
 3685|  3.37k|                U32 const resultCRC = XXH32_digest(&(dctx->xxh));
  ------------------
  |  |  133|  3.37k|#  define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
  |  |  ------------------
  |  |  |  |  126|  3.37k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  3.37k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3686|  3.37k|                DEBUGLOG(4, "frame checksum: stored 0x%0X vs 0x%0X processed", readCRC, resultCRC);
  ------------------
  |  |  208|  3.37k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 3687|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 3688|       |                if (readCRC != resultCRC) {
 3689|       |                    nextSrcSizeHint = LZ4F_returnErrorCode(LZ4F_ERROR_contentChecksum_invalid);
 3690|       |                    goto _output;
 3691|       |                }
 3692|       |#else
 3693|  3.37k|                (void)readCRC;
 3694|  3.37k|                (void)resultCRC;
 3695|  3.37k|#endif
 3696|  3.37k|            }
 3697|  3.47k|            nextSrcSizeHint = 0;
 3698|  3.47k|            LZ4F_endFrame(dctx);
 3699|  3.47k|            doAnotherStage = 0;
 3700|  3.47k|            break;
 3701|       |
 3702|  7.79k|        case dstage_getSFrameSize:
  ------------------
  |  Branch (3702:9): [True: 7.79k, False: 337k]
  ------------------
 3703|  7.79k|            selectedIn = LZ4F_gatherInput(dctx, dctx->header + 4, 4, &srcPtr, srcEnd);
 3704|  7.79k|            if (selectedIn == NULL) {   /* not enough input to read the skippable frame size */
  ------------------
  |  Branch (3704:17): [True: 3.70k, False: 4.08k]
  ------------------
 3705|  3.70k|                nextSrcSizeHint = 4 - dctx->tmpInSize;
 3706|  3.70k|                doAnotherStage = 0;
 3707|  3.70k|                break;
 3708|  3.70k|            }
 3709|  4.08k|            {   size_t const SFrameSize = LZ4F_readLE32(selectedIn);
 3710|  4.08k|                dctx->frameInfo.contentSize = SFrameSize;
 3711|  4.08k|                dctx->tmpInTarget = SFrameSize;
 3712|  4.08k|                dctx->dStage = dstage_skipSkippable;
 3713|  4.08k|                break;
 3714|  7.79k|            }
 3715|       |
 3716|  8.39k|        case dstage_skipSkippable:
  ------------------
  |  Branch (3716:9): [True: 8.39k, False: 336k]
  ------------------
 3717|  8.39k|            {   size_t const skipSize = MIN(dctx->tmpInTarget, (size_t)(srcEnd-srcPtr));
  ------------------
  |  |  443|  8.39k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (443:22): [True: 91, False: 8.30k]
  |  |  ------------------
  ------------------
 3718|  8.39k|                srcPtr += skipSize;
 3719|  8.39k|                dctx->tmpInTarget -= skipSize;
 3720|  8.39k|                doAnotherStage = 0;
 3721|  8.39k|                nextSrcSizeHint = dctx->tmpInTarget;
 3722|  8.39k|                if (nextSrcSizeHint) break;  /* still more to skip */
  ------------------
  |  Branch (3722:21): [True: 4.47k, False: 3.92k]
  ------------------
 3723|       |                /* frame fully skipped : prepare context for a new frame */
 3724|  3.92k|                LZ4F_endFrame(dctx);
 3725|  3.92k|                break;
 3726|  8.39k|            }
 3727|   345k|        }   /* switch (dctx->dStage) */
 3728|   345k|    }   /* while (doAnotherStage) */
 3729|       |
 3730|       |    /* preserve history within tmpOut whenever necessary */
 3731|   226k|    LZ4F_STATIC_ASSERT((unsigned)dstage_init == 2);
  ------------------
  |  |  195|   226k|#define LZ4F_STATIC_ASSERT(c)    { enum { LZ4F_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
 3732|   226k|    if ( ( (dctx->frameInfo.blockMode==LZ4F_blockLinked)  /* next block will use up to 64KB from previous ones */
  ------------------
  |  Branch (3732:12): [True: 167k, False: 59.4k]
  ------------------
 3733|  59.4k|        || (dctx->blockDecoded && (dctx->dStage == dstage_getCBlock)) )  /* rest of the block decoded progressively too */
  ------------------
  |  Branch (3733:13): [True: 0, False: 59.4k]
  |  Branch (3733:35): [True: 0, False: 0]
  ------------------
 3734|   167k|      && (dctx->dict != dctx->tmpOutBuffer)             /* dictionary is not already within tmp */
  ------------------
  |  Branch (3734:10): [True: 103k, False: 63.1k]
  ------------------
 3735|   103k|      && (dctx->dict != NULL)                           /* dictionary exists */
  ------------------
  |  Branch (3735:10): [True: 31.2k, False: 72.6k]
  ------------------
 3736|  31.2k|      && (!decompressOptionsPtr->stableDst)             /* cannot rely on dst data to remain there for next call */
  ------------------
  |  Branch (3736:10): [True: 31.2k, False: 0]
  ------------------
 3737|  31.2k|      && ((unsigned)(dctx->dStage)-2 < (unsigned)(dstage_getSuffix)-2) )  /* valid stages : [init ... getSuffix[ */
  ------------------
  |  Branch (3737:10): [True: 31.2k, False: 0]
  ------------------
 3738|  31.2k|    {
 3739|  31.2k|        if (dctx->dStage == dstage_flushOut) {
  ------------------
  |  Branch (3739:13): [True: 5.50k, False: 25.7k]
  ------------------
 3740|  5.50k|            LZ4F_moveDictBeforeTmpOut(dctx, 0);
 3741|  25.7k|        } else {
 3742|  25.7k|            const BYTE* const oldDictEnd = dctx->dict + dctx->dictSize;
 3743|  25.7k|            size_t const newDictSize = MIN(dctx->dictSize, 64 KB);
  ------------------
  |  |  443|  25.7k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (443:22): [True: 14.8k, False: 10.8k]
  |  |  ------------------
  ------------------
 3744|       |
 3745|  25.7k|            LZ4_memcpy(dctx->tmpOutBuffer, oldDictEnd - newDictSize, newDictSize);
  ------------------
  |  |  113|  25.7k|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 3746|       |
 3747|  25.7k|            dctx->dict = dctx->tmpOutBuffer;
 3748|  25.7k|            dctx->dictSize = newDictSize;
 3749|  25.7k|            dctx->tmpOut = dctx->tmpOutBuffer + newDictSize;
 3750|  25.7k|        }
 3751|  31.2k|    }
 3752|       |
 3753|   230k|_output:   /* also on error : report progress, but do not preserve history for reuse */
 3754|   230k|    *srcSizePtr = (size_t)(srcPtr - srcStart);
 3755|   230k|    *dstSizePtr = dstStart ? (size_t)(dstPtr - dstStart) : 0;
  ------------------
  |  Branch (3755:19): [True: 163k, False: 66.6k]
  ------------------
 3756|   230k|    return nextSrcSizeHint;
 3757|   226k|}
LZ4F_resumeFrame:
 3784|  1.20k|{
 3785|  1.20k|    assert(dctx != NULL);
  ------------------
  |  Branch (3785:5): [True: 0, False: 1.20k]
  |  Branch (3785:5): [True: 1.20k, False: 0]
  ------------------
 3786|  1.20k|    RETURN_ERROR_IF(frameInfo == NULL, parameter_null);
  ------------------
  |  |  394|  1.20k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  1.20k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 1.20k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  1.20k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 1.20k]
  |  |  ------------------
  ------------------
 3787|  1.20k|    RETURN_ERROR_IF(dict == NULL && dictSize > 0, parameter_null);
  ------------------
  |  |  394|  1.20k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  3.62k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 1.20k, False: 0]
  |  |  |  Branch (395:13): [True: 0, False: 1.20k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  1.20k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 1.20k]
  |  |  ------------------
  ------------------
 3788|  1.20k|    RETURN_ERROR_IF(frameInfo->frameType != LZ4F_frame, frameType_unknown);
  ------------------
  |  |  394|  1.20k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  1.20k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 1.20k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  1.20k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 1.20k]
  |  |  ------------------
  ------------------
 3789|  1.20k|    RETURN_ERROR_IF(frameInfo->blockSizeID < LZ4F_max64KB || frameInfo->blockSizeID > LZ4F_max4MB, maxBlockSize_invalid);
  ------------------
  |  |  394|  1.20k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  3.62k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 1.20k]
  |  |  |  Branch (395:13): [True: 0, False: 1.20k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  1.20k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 1.20k]
  |  |  ------------------
  ------------------
 3790|  1.20k|    RETURN_ERROR_IF((unsigned)frameInfo->blockMode > 1, blockMode_invalid);
  ------------------
  |  |  394|  1.20k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  1.20k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 1.20k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  1.20k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 1.20k]
  |  |  ------------------
  ------------------
 3791|  1.20k|    RETURN_ERROR_IF((unsigned)frameInfo->blockChecksumFlag > 1, parameter_invalid);
  ------------------
  |  |  394|  1.20k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  1.20k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 1.20k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  1.20k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 1.20k]
  |  |  ------------------
  ------------------
 3792|  1.20k|    RETURN_ERROR_IF((unsigned)frameInfo->contentChecksumFlag > 1, parameter_invalid);
  ------------------
  |  |  394|  1.20k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  1.20k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 1.20k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  1.20k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 1.20k]
  |  |  ------------------
  ------------------
 3793|  1.20k|    RETURN_ERROR_IF(frameInfo->contentSize && decodedPos > frameInfo->contentSize, frameSize_wrong);
  ------------------
  |  |  394|  1.20k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  2.58k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 168, False: 1.04k]
  |  |  |  Branch (395:13): [True: 0, False: 168]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  1.20k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 1.20k]
  |  |  ------------------
  ------------------
 3794|       |
 3795|  1.20k|    LZ4F_resetDecompressionContext(dctx);
 3796|  1.20k|    dctx->frameInfo = *frameInfo;
 3797|  1.20k|    dctx->maxBlockSize = LZ4F_getBlockSize(frameInfo->blockSizeID);
 3798|  1.20k|    if (frameInfo->contentSize)
  ------------------
  |  Branch (3798:9): [True: 168, False: 1.04k]
  ------------------
 3799|    168|        dctx->frameRemainingSize = frameInfo->contentSize - decodedPos;
 3800|  1.20k|    dctx->dict = (const BYTE*)dict;
 3801|  1.20k|    dctx->dictSize = dictSize;
 3802|  1.20k|    dctx->skipContentChecksum = 1;   /* content checksum covers the whole frame : can't be verified */
 3803|  1.20k|    dctx->dStage = dstage_init;
 3804|  1.20k|    return 0;
 3805|  1.20k|}
lz4frame.c:LZ4F_returnErrorCode:
  386|  16.6k|{
  387|       |    /* A compilation error here means sizeof(ptrdiff_t) is not large enough */
  388|  16.6k|    LZ4F_STATIC_ASSERT(sizeof(ptrdiff_t) >= sizeof(size_t));
  ------------------
  |  |  195|  16.6k|#define LZ4F_STATIC_ASSERT(c)    { enum { LZ4F_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
  389|  16.6k|    return (LZ4F_errorCode_t)-(ptrdiff_t)code;
  390|  16.6k|}
lz4frame.c:LZ4F_compressBound_autoFlush:
  475|  6.54k|{
  476|  6.54k|    size_t const blockSize = LZ4F_getBlockSize(prefsPtr->frameInfo.blockSizeID);
  477|  6.54k|    size_t const nbFullBlocks = srcSize / blockSize;
  478|  6.54k|    size_t const lastBlockSize = srcSize & (blockSize-1);
  479|  6.54k|    size_t const nbBlocks = nbFullBlocks + (lastBlockSize>0);
  480|  6.54k|    size_t const blockCRCSize = BFSize * prefsPtr->frameInfo.blockChecksumFlag;
  481|  6.54k|    size_t const frameEnd = BHSize + (prefsPtr->frameInfo.contentChecksumFlag*BFSize);
  482|  6.54k|    assert(prefsPtr->autoFlush);
  ------------------
  |  Branch (482:5): [True: 0, False: 6.54k]
  |  Branch (482:5): [True: 6.54k, False: 0]
  ------------------
  483|  6.54k|    return ((BHSize + blockCRCSize) * nbBlocks) +
  484|  6.54k|           (blockSize * nbFullBlocks) + lastBlockSize + frameEnd;
  485|  6.54k|}
lz4frame.c:LZ4F_mtEligible:
  534|  24.8k|{
  535|  24.8k|    if (prefs->nbWorkers == 0) return 0;
  ------------------
  |  Branch (535:9): [True: 24.8k, False: 0]
  ------------------
  536|       |    /* linked blocks : jobs define the output, so frames are cut into jobs even without threads */
  537|      0|    if (prefs->frameInfo.blockMode == LZ4F_blockLinked) return 1;
  ------------------
  |  Branch (537:9): [True: 0, False: 0]
  ------------------
  538|       |#if LZ4F_MULTITHREAD
  539|       |    return (prefs->frameInfo.blockMode == LZ4F_blockIndependent);
  540|       |#else
  541|       |    /* independent blocks : the output is identical to single-threaded mode, which is faster without threads */
  542|      0|    return 0;
  543|      0|#endif
  544|      0|}
lz4frame.c:LZ4F_invalidateFrame:
  411|  15.6k|{
  412|  15.6k|    if (cctx->mtActive) LZ4F_mt_abort(cctx->mt);
  ------------------
  |  Branch (412:9): [True: 0, False: 15.6k]
  ------------------
  413|  15.6k|    cctx->cStage = 0;
  414|  15.6k|}
lz4frame.c:LZ4F_free:
  172|   254k|{
  173|   254k|    if (p == NULL) return;
  ------------------
  |  Branch (173:9): [True: 141k, False: 113k]
  ------------------
  174|   113k|    if (cmem.customFree != NULL) {
  ------------------
  |  Branch (174:9): [True: 0, False: 113k]
  ------------------
  175|       |        /* custom allocation defined : use it */
  176|      0|        cmem.customFree(cmem.opaqueState, p);
  177|      0|        return;
  178|      0|    }
  179|       |    /* nothing defined : use default free(), if any */
  180|   113k|    FREEMEM(p);
  ------------------
  |  |  141|   113k|#    define FREEMEM(p)        free(p)
  ------------------
  181|   113k|}
lz4frame.c:LZ4F_malloc:
  162|  66.8k|{
  163|       |    /* custom malloc defined : use it */
  164|  66.8k|    if (cmem.customAlloc != NULL) {
  ------------------
  |  Branch (164:9): [True: 0, False: 66.8k]
  ------------------
  165|      0|        return cmem.customAlloc(cmem.opaqueState, s);
  166|      0|    }
  167|       |    /* nothing defined : use default malloc(), if any */
  168|  66.8k|    return ALLOC(s);
  ------------------
  |  |  139|  66.8k|#    define ALLOC(s)          malloc(s)
  ------------------
  169|  66.8k|}
lz4frame.c:LZ4F_calloc:
  146|  47.0k|{
  147|       |    /* custom calloc defined : use it */
  148|  47.0k|    if (cmem.customCalloc != NULL) {
  ------------------
  |  Branch (148:9): [True: 0, False: 47.0k]
  ------------------
  149|      0|        return cmem.customCalloc(cmem.opaqueState, s);
  150|      0|    }
  151|       |    /* nothing defined : use default calloc(), if any */
  152|  47.0k|    if (cmem.customAlloc == NULL) {
  ------------------
  |  Branch (152:9): [True: 47.0k, False: 0]
  ------------------
  153|  47.0k|        return ALLOC_AND_ZERO(s);
  ------------------
  |  |  140|  47.0k|#    define ALLOC_AND_ZERO(s) calloc(1,(s))
  ------------------
  154|  47.0k|    }
  155|       |    /* only custom alloc defined : use it, and combine it with LZ4_memset() */
  156|      0|    {   void* const p = cmem.customAlloc(cmem.opaqueState, s);
  157|      0|        if (p != NULL) MEM_INIT(p, 0, s);
  ------------------
  |  |  122|      0|#  define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  119|      0|#  define LZ4_memset(p,v,n)  memset((p),(v),(n))
  |  |  ------------------
  ------------------
  |  Branch (157:13): [True: 0, False: 0]
  ------------------
  158|      0|        return p;
  159|  47.0k|}   }
lz4frame.c:LZ4F_sizeofLZ4State:
  895|  31.3k|{
  896|  31.3k|    switch (ctxType) {
  ------------------
  |  Branch (896:13): [True: 31.3k, False: 0]
  ------------------
  897|  15.6k|    case ctxNone: return 0;
  ------------------
  |  Branch (897:5): [True: 15.6k, False: 15.6k]
  ------------------
  898|  5.27k|    case ctxFast: return sizeof(LZ4_stream_t);
  ------------------
  |  Branch (898:5): [True: 5.27k, False: 26.0k]
  ------------------
  899|  10.3k|    case ctxHC:   return LZ4_STREAMHC_EXTSIZE;   /* extended : levels >= 10 allocate nothing */
  ------------------
  |  |  380|  10.3k|#define LZ4_STREAMHC_EXTSIZE (sizeof(LZ4_streamHC_t) + 65584)   /* LZ4_streamHC_t exceeds LZ4_STREAMHC_MINSIZE with 16-byte pointers */
  ------------------
  |  Branch (899:5): [True: 10.3k, False: 20.9k]
  ------------------
  900|  31.3k|    }
  901|  31.3k|    assert(0);   /* invalid ctxType */
  ------------------
  |  Branch (901:5): [Folded, False: 0]
  |  Branch (901:5): [Folded, False: 0]
  ------------------
  902|      0|    return 0;
  903|      0|}
lz4frame.c:LZ4F_compressBegin_internal:
  970|  15.6k|{
  971|  15.6k|    LZ4F_preferences_t const prefNull = LZ4F_INIT_PREFERENCES;
  ------------------
  |  |  228|  15.6k|#define LZ4F_INIT_PREFERENCES   { LZ4F_INIT_FRAMEINFO, 0, 0u, 0u, 0u, 0u, 0u }    /* v1.8.3+ */
  |  |  ------------------
  |  |  |  |  209|  15.6k|#define LZ4F_INIT_FRAMEINFO   { LZ4F_max64KB, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0ULL, 0U, LZ4F_noBlockChecksum }    /* v1.8.3+ */
  |  |  ------------------
  ------------------
  972|  15.6k|    BYTE* const dstStart = (BYTE*)dstBuffer;
  973|  15.6k|    BYTE* dstPtr = dstStart;
  974|  15.6k|    int mtFrame;   /* frame cut into jobs (multi-threaded compression) */
  975|       |
  976|  15.6k|    if (preferencesPtr == NULL) preferencesPtr = &prefNull;
  ------------------
  |  Branch (976:9): [True: 0, False: 15.6k]
  ------------------
  977|       |    /* validate arguments before modifying @cctx : when they are rejected, a frame in progress continues */
  978|  15.6k|    {   size_t const headerSize = minFHSize
  979|  15.6k|                                + (preferencesPtr->frameInfo.contentSize ? 8 : 0)
  ------------------
  |  Branch (979:36): [True: 0, False: 15.6k]
  ------------------
  980|  15.6k|                                + (preferencesPtr->frameInfo.dictID ? 4 : 0);
  ------------------
  |  Branch (980:36): [True: 0, False: 15.6k]
  ------------------
  981|  15.6k|        RETURN_ERROR_IF(dstCapacity < headerSize, dstCapacity_tooSmall);
  ------------------
  |  |  394|  15.6k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  15.6k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 15.6k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  15.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 15.6k]
  |  |  ------------------
  ------------------
  982|  15.6k|    }
  983|  15.6k|    FORWARD_IF_ERROR( LZ4F_getBlockSize(preferencesPtr->frameInfo.blockSizeID) );
  ------------------
  |  |  402|  15.6k|#define FORWARD_IF_ERROR(r) do {                     \
  |  |  403|  15.6k|        size_t const err_code = (r);                 \
  |  |  404|  15.6k|        if (LZ4F_isError(err_code)) return err_code; \
  |  |  ------------------
  |  |  |  Branch (404:13): [True: 0, False: 15.6k]
  |  |  ------------------
  |  |  405|  15.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (405:14): [Folded, False: 15.6k]
  |  |  ------------------
  ------------------
  984|  15.6k|    RETURN_ERROR_IF(dictSize > INT_MAX, parameter_invalid);
  ------------------
  |  |  394|  15.6k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  15.6k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 15.6k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  15.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 15.6k]
  |  |  ------------------
  ------------------
  985|       |    /* from now on, a failure (allocation) leaves no frame in progress */
  986|  15.6k|    LZ4F_invalidateFrame(cctx);   /* jobs of an abandoned frame : must complete before @cctx is modified */
  987|  15.6k|    cctx->mtActive = 0;
  988|  15.6k|    cctx->flushStage = 0;
  989|  15.6k|    cctx->pendingSize = 0;
  990|  15.6k|    cctx->prefs = *preferencesPtr;
  991|  15.6k|    mtFrame = LZ4F_mtEligible(&cctx->prefs);
  992|  15.6k|    DEBUGLOG(5, "LZ4F_compressBegin_internal: Independent_blocks=%u", cctx->prefs.frameInfo.blockMode);
  ------------------
  |  |  208|  15.6k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
  993|       |
  994|       |    /* cctx Management */
  995|  15.6k|    {   LZ4F_CtxType_e const ctxType = (cctx->prefs.compressionLevel < LZ4HC_CLEVEL_MIN) ? ctxFast : ctxHC;
  ------------------
  |  |   46|  15.6k|#define LZ4HC_CLEVEL_MIN         2
  ------------------
  |  Branch (995:40): [True: 5.27k, False: 10.3k]
  ------------------
  996|  15.6k|        size_t const requiredSize = LZ4F_sizeofLZ4State(ctxType);
  997|  15.6k|        size_t const allocatedSize = LZ4F_sizeofLZ4State((LZ4F_CtxType_e)cctx->lz4CtxAlloc);
  998|  15.6k|        if (allocatedSize < requiredSize) {
  ------------------
  |  Branch (998:13): [True: 15.6k, False: 0]
  ------------------
  999|       |            /* not enough space allocated : must take ownership of memory allocation,
 1000|       |             * in order to respect custom allocator contract */
 1001|  15.6k|            LZ4F_free(cctx->lz4CtxPtr, cctx->cmem);
 1002|  15.6k|            cctx->lz4CtxAlloc = (U16)ctxNone;   /* in case allocation fails */
 1003|  15.6k|            cctx->lz4CtxPtr = LZ4F_malloc(requiredSize, cctx->cmem);
 1004|  15.6k|            RETURN_ERROR_IF(cctx->lz4CtxPtr == NULL, allocation_failed);
  ------------------
  |  |  394|  15.6k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  15.6k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 15.6k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  15.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 15.6k]
  |  |  ------------------
  ------------------
 1005|  15.6k|            cctx->lz4CtxAlloc = (U16)ctxType;
 1006|  15.6k|            cctx->lz4CtxType = (U16)ctxNone;    /* not initialized yet */
 1007|  15.6k|        }
 1008|  15.6k|        if (cctx->lz4CtxType != ctxType) {
  ------------------
  |  Branch (1008:13): [True: 15.6k, False: 0]
  ------------------
 1009|       |            /* initialize the state for the correct context type */
 1010|  15.6k|            LZ4F_initLZ4State(cctx->lz4CtxPtr, ctxType, cctx->prefs.compressionLevel);
 1011|  15.6k|            cctx->lz4CtxType = (U16)ctxType;
 1012|  15.6k|    }   }
 1013|       |
 1014|       |    /* raw dictionary : employed by each block as a CDict (independent blocks, or jobs of multi-threaded frames) ;
 1015|       |     * single-threaded linked blocks keep the historical behavior : dictionary loaded as history, preceding the first block,
 1016|       |     * from a copy within @tmpBuff (see below) */
 1017|  15.6k|    if ( dictBuffer
  ------------------
  |  Branch (1017:10): [True: 0, False: 15.6k]
  ------------------
 1018|      0|      && ((cctx->prefs.frameInfo.blockMode == LZ4F_blockIndependent) || mtFrame) ) {
  ------------------
  |  Branch (1018:11): [True: 0, False: 0]
  |  Branch (1018:73): [True: 0, False: 0]
  ------------------
 1019|      0|        assert(cdict == NULL);
  ------------------
  |  Branch (1019:9): [True: 0, False: 0]
  |  Branch (1019:9): [True: 0, False: 0]
  ------------------
 1020|      0|        cdict = LZ4F_digestRawDict(cctx, dictBuffer, dictSize);
 1021|      0|        RETURN_ERROR_IF(cdict == NULL, allocation_failed);
  ------------------
  |  |  394|      0|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|      0|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1022|      0|        dictBuffer = NULL;
 1023|      0|        dictSize = 0;
 1024|      0|    }
 1025|       |
 1026|       |    /* Buffer Management */
 1027|  15.6k|    if (cctx->prefs.frameInfo.blockSizeID == 0)
  ------------------
  |  Branch (1027:9): [True: 5.76k, False: 9.91k]
  ------------------
 1028|  5.76k|        cctx->prefs.frameInfo.blockSizeID = LZ4F_BLOCKSIZEID_DEFAULT;
  ------------------
  |  |  297|  5.76k|#define LZ4F_BLOCKSIZEID_DEFAULT LZ4F_max64KB
  ------------------
 1029|  15.6k|    cctx->maxBlockSize = LZ4F_getBlockSize(cctx->prefs.frameInfo.blockSizeID);
 1030|       |
 1031|  15.6k|    {   size_t const requiredBuffSize = mtFrame ? 0 :   /* jobs employ their own buffers */
  ------------------
  |  Branch (1031:41): [True: 0, False: 15.6k]
  ------------------
 1032|  15.6k|                preferencesPtr->autoFlush ?
  ------------------
  |  Branch (1032:17): [True: 6.54k, False: 9.12k]
  ------------------
 1033|  6.54k|                ((cctx->prefs.frameInfo.blockMode == LZ4F_blockLinked) ? 128 KB : 0) :  /* history, then inputs < 64 KB (see LZ4F_st_update()) */
  ------------------
  |  |  285|  4.51k|#  define KB *(1<<10)
  ------------------
  |  Branch (1033:18): [True: 4.51k, False: 2.03k]
  ------------------
 1034|  15.6k|                cctx->maxBlockSize + ((cctx->prefs.frameInfo.blockMode == LZ4F_blockLinked) ? 128 KB : 0);
  ------------------
  |  |  285|  5.43k|#  define KB *(1<<10)
  ------------------
  |  Branch (1034:39): [True: 5.43k, False: 3.69k]
  ------------------
 1035|       |
 1036|  15.6k|        if (cctx->tmpBuffCapacity < requiredBuffSize) {
  ------------------
  |  Branch (1036:13): [True: 13.6k, False: 2.03k]
  ------------------
 1037|  13.6k|            cctx->tmpBuffCapacity = 0;
 1038|  13.6k|            LZ4F_free(cctx->tmpBuff, cctx->cmem);
 1039|  13.6k|            cctx->tmpBuff = (BYTE*)LZ4F_malloc(requiredBuffSize, cctx->cmem);
 1040|  13.6k|            RETURN_ERROR_IF(cctx->tmpBuff == NULL, allocation_failed);
  ------------------
  |  |  394|  13.6k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  13.6k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 13.6k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  13.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 13.6k]
  |  |  ------------------
  ------------------
 1041|  13.6k|            cctx->tmpBuffCapacity = requiredBuffSize;
 1042|  13.6k|    }   }
 1043|  15.6k|    cctx->tmpIn = cctx->tmpBuff;
 1044|  15.6k|    cctx->tmpInSize = 0;
 1045|  15.6k|    if (dictBuffer) {
  ------------------
  |  Branch (1045:9): [True: 0, False: 15.6k]
  ------------------
 1046|       |        /* single-threaded linked blocks : the dictionary is copied into @tmpBuff, as saved history :
 1047|       |         * buffered input follows it, and references it in prefix mode
 1048|       |         * (faster than an external dictionary, which fast levels also lose after the first block) */
 1049|      0|        if (dictSize > 64 KB) {
  ------------------
  |  |  285|      0|#  define KB *(1<<10)
  ------------------
  |  Branch (1049:13): [True: 0, False: 0]
  ------------------
 1050|      0|            dictBuffer = (const BYTE*)dictBuffer + dictSize - 64 KB;
  ------------------
  |  |  285|      0|#  define KB *(1<<10)
  ------------------
 1051|      0|            dictSize = 64 KB;
  ------------------
  |  |  285|      0|#  define KB *(1<<10)
  ------------------
 1052|      0|        }
 1053|      0|        assert(cctx->tmpBuffCapacity >= 128 KB);
  ------------------
  |  Branch (1053:9): [True: 0, False: 0]
  |  Branch (1053:9): [True: 0, False: 0]
  ------------------
 1054|      0|        LZ4_memcpy(cctx->tmpBuff, dictBuffer, dictSize);
  ------------------
  |  |  113|      0|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 1055|      0|        dictBuffer = cctx->tmpBuff;
 1056|      0|        cctx->tmpIn = cctx->tmpBuff + dictSize;
 1057|      0|    }
 1058|  15.6k|    (void)XXH32_reset(&(cctx->xxh), 0);
  ------------------
  |  |  131|  15.6k|#  define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
  |  |  ------------------
  |  |  |  |  126|  15.6k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  15.6k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1059|       |
 1060|       |    /* context init */
 1061|  15.6k|    cctx->cdict = cdict;
 1062|  15.6k|    cctx->blockCompressMode = LZ4B_COMPRESSED;   /* a frame starts with the LZ4 state just initialized (dictionary included) */
 1063|  15.6k|    LZ4F_startStream(cctx->lz4CtxPtr, &cctx->prefs, cdict, dictBuffer, dictSize);
 1064|       |
 1065|       |    /* Stage 2 : Write Frame Header */
 1066|       |
 1067|       |    /* Magic Number */
 1068|  15.6k|    LZ4F_writeLE32(dstPtr, LZ4F_MAGICNUMBER);
  ------------------
  |  |  529|  15.6k|#define LZ4F_MAGICNUMBER 0x184D2204U
  ------------------
 1069|  15.6k|    dstPtr += 4;
 1070|  15.6k|    {   BYTE* const headerStart = dstPtr;
 1071|       |
 1072|       |        /* FLG Byte */
 1073|  15.6k|        *dstPtr++ = (BYTE)(((1 & _2BITS) << 6)    /* Version('01') */
  ------------------
  |  |  291|  15.6k|#define _2BITS 0x03
  ------------------
 1074|  15.6k|            + ((cctx->prefs.frameInfo.blockMode & _1BIT ) << 5)
  ------------------
  |  |  290|  15.6k|#define _1BIT  0x01
  ------------------
 1075|  15.6k|            + ((cctx->prefs.frameInfo.blockChecksumFlag & _1BIT ) << 4)
  ------------------
  |  |  290|  15.6k|#define _1BIT  0x01
  ------------------
 1076|  15.6k|            + ((unsigned)(cctx->prefs.frameInfo.contentSize > 0) << 3)
 1077|  15.6k|            + ((cctx->prefs.frameInfo.contentChecksumFlag & _1BIT ) << 2)
  ------------------
  |  |  290|  15.6k|#define _1BIT  0x01
  ------------------
 1078|  15.6k|            +  (cctx->prefs.frameInfo.dictID > 0) );
 1079|       |        /* BD Byte */
 1080|  15.6k|        *dstPtr++ = (BYTE)((cctx->prefs.frameInfo.blockSizeID & _3BITS) << 4);
  ------------------
  |  |  292|  15.6k|#define _3BITS 0x07
  ------------------
 1081|       |        /* Optional Frame content size field */
 1082|  15.6k|        if (cctx->prefs.frameInfo.contentSize) {
  ------------------
  |  Branch (1082:13): [True: 0, False: 15.6k]
  ------------------
 1083|      0|            LZ4F_writeLE64(dstPtr, cctx->prefs.frameInfo.contentSize);
 1084|      0|            dstPtr += 8;
 1085|      0|            cctx->totalInSize = 0;
 1086|      0|        }
 1087|       |        /* Optional dictionary ID field */
 1088|  15.6k|        if (cctx->prefs.frameInfo.dictID) {
  ------------------
  |  Branch (1088:13): [True: 0, False: 15.6k]
  ------------------
 1089|      0|            LZ4F_writeLE32(dstPtr, cctx->prefs.frameInfo.dictID);
 1090|      0|            dstPtr += 4;
 1091|      0|        }
 1092|       |        /* Header CRC Byte */
 1093|  15.6k|        *dstPtr = LZ4F_headerChecksum(headerStart, (size_t)(dstPtr - headerStart));
 1094|  15.6k|        dstPtr++;
 1095|  15.6k|    }
 1096|       |
 1097|  15.6k|    if (mtFrame) {
  ------------------
  |  Branch (1097:9): [True: 0, False: 15.6k]
  ------------------
 1098|      0|        assert(dictBuffer == NULL);
  ------------------
  |  Branch (1098:9): [True: 0, False: 0]
  |  Branch (1098:9): [True: 0, False: 0]
  ------------------
 1099|      0|        FORWARD_IF_ERROR( LZ4F_mt_begin(cctx) );
  ------------------
  |  |  402|      0|#define FORWARD_IF_ERROR(r) do {                     \
  |  |  403|      0|        size_t const err_code = (r);                 \
  |  |  404|      0|        if (LZ4F_isError(err_code)) return err_code; \
  |  |  ------------------
  |  |  |  Branch (404:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  405|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (405:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1100|      0|    }
 1101|       |
 1102|  15.6k|    cctx->cStage = 1;   /* header written, now request input data block */
 1103|  15.6k|    return (size_t)(dstPtr - dstStart);
 1104|  15.6k|}
lz4frame.c:LZ4F_initLZ4State:
  908|  15.6k|{
  909|  15.6k|    if (ctxType == ctxFast) {
  ------------------
  |  Branch (909:9): [True: 5.27k, False: 10.3k]
  ------------------
  910|  5.27k|        LZ4_initStream(state, sizeof(LZ4_stream_t));
  911|  10.3k|    } else {
  912|  10.3k|        assert(ctxType == ctxHC);
  ------------------
  |  Branch (912:9): [True: 0, False: 10.3k]
  |  Branch (912:9): [True: 10.3k, False: 0]
  ------------------
  913|  10.3k|        LZ4_initStreamHC(state, LZ4_STREAMHC_EXTSIZE);
  ------------------
  |  |  380|  10.3k|#define LZ4_STREAMHC_EXTSIZE (sizeof(LZ4_streamHC_t) + 65584)   /* LZ4_streamHC_t exceeds LZ4_STREAMHC_MINSIZE with 16-byte pointers */
  ------------------
  914|  10.3k|        LZ4_setCompressionLevel((LZ4_streamHC_t*)state, level);
  915|  10.3k|    }
  916|  15.6k|}
lz4frame.c:LZ4F_startStream:
  870|  15.6k|{
  871|  15.6k|    int const level = prefs->compressionLevel;
  872|  15.6k|    if (prefs->frameInfo.blockMode == LZ4F_blockLinked)
  ------------------
  |  Branch (872:9): [True: 9.94k, False: 5.73k]
  ------------------
  873|  9.94k|        LZ4F_initStream(ctx, cdict, level, LZ4F_blockLinked);
  874|  15.6k|    if (level >= LZ4HC_CLEVEL_MIN)
  ------------------
  |  |   46|  15.6k|#define LZ4HC_CLEVEL_MIN         2
  ------------------
  |  Branch (874:9): [True: 10.3k, False: 5.27k]
  ------------------
  875|  10.3k|        LZ4_favorDecompressionSpeed((LZ4_streamHC_t*)ctx, (int)prefs->favorDecSpeed);
  876|  15.6k|    if (dict) {
  ------------------
  |  Branch (876:9): [True: 0, False: 15.6k]
  ------------------
  877|      0|        assert(cdict == NULL);
  ------------------
  |  Branch (877:9): [True: 0, False: 0]
  |  Branch (877:9): [True: 0, False: 0]
  ------------------
  878|      0|        assert(prefs->frameInfo.blockMode == LZ4F_blockLinked);
  ------------------
  |  Branch (878:9): [True: 0, False: 0]
  |  Branch (878:9): [True: 0, False: 0]
  ------------------
  879|      0|        assert(dictSize <= INT_MAX);
  ------------------
  |  Branch (879:9): [True: 0, False: 0]
  |  Branch (879:9): [True: 0, False: 0]
  ------------------
  880|      0|        if (level < LZ4HC_CLEVEL_MIN) {
  ------------------
  |  |   46|      0|#define LZ4HC_CLEVEL_MIN         2
  ------------------
  |  Branch (880:13): [True: 0, False: 0]
  ------------------
  881|      0|            LZ4_loadDict((LZ4_stream_t*)ctx, (const char*)dict, (int)dictSize);
  882|      0|        } else {
  883|      0|            LZ4_loadDictHC((LZ4_streamHC_t*)ctx, (const char*)dict, (int)dictSize);
  884|      0|        }
  885|      0|    }
  886|  15.6k|}
lz4frame.c:LZ4F_initStream:
  835|  19.0k|                            LZ4F_blockMode_t blockMode) {
  836|  19.0k|    if (level < LZ4HC_CLEVEL_MIN) {
  ------------------
  |  |   46|  19.0k|#define LZ4HC_CLEVEL_MIN         2
  ------------------
  |  Branch (836:9): [True: 6.74k, False: 12.2k]
  ------------------
  837|       |        /* In these cases, we will call LZ4_compress_fast_continue(),
  838|       |         * which needs an already reset context. Otherwise, we'll call a
  839|       |         * one-shot API. The non-continued APIs internally perform their own
  840|       |         * resets at the beginning of their calls, where they know what
  841|       |         * tableType they need the context to be in. So in that case this
  842|       |         * would be misguided / wasted work. */
  843|  6.74k|        if (cdict) {
  ------------------
  |  Branch (843:13): [True: 0, False: 6.74k]
  ------------------
  844|      0|            LZ4_resetStream_fast((LZ4_stream_t*)ctx);
  845|      0|            LZ4_attach_dictionary((LZ4_stream_t*)ctx, cdict->fastCtx);
  846|  6.74k|        } else if (blockMode == LZ4F_blockLinked) {
  ------------------
  |  Branch (846:20): [True: 3.05k, False: 3.69k]
  ------------------
  847|       |            /* Clear the table, rather than LZ4_resetStream_fast() :
  848|       |             * output doesn't depend on the context's history,
  849|       |             * and it's faster, unless the frame is tiny. */
  850|  3.05k|            LZ4_initStream(ctx, sizeof(LZ4_stream_t));
  851|  3.05k|        }
  852|       |        /* In these cases, we'll call a one-shot API.
  853|       |         * The non-continued APIs internally perform their own resets
  854|       |         * at the beginning of their calls, where they know
  855|       |         * which tableType they need the context to be in.
  856|       |         * Therefore, a reset here would be wasted work. */
  857|  12.2k|    } else {
  858|  12.2k|        LZ4_resetStreamHC_fast((LZ4_streamHC_t*)ctx, level);
  859|  12.2k|        if (cdict)
  ------------------
  |  Branch (859:13): [True: 0, False: 12.2k]
  ------------------
  860|      0|            LZ4_attach_HC_dictionary((LZ4_streamHC_t*)ctx, cdict->HCCtx);
  861|  12.2k|    }
  862|  19.0k|}
lz4frame.c:LZ4F_headerChecksum:
  446|  15.6k|{
  447|  15.6k|    U32 const xxh = XXH32(header, length, 0);
  ------------------
  |  |  128|  15.6k|#  define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
  |  |  ------------------
  |  |  |  |  126|  15.6k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  15.6k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  448|  15.6k|    return (BYTE)(xxh >> 8);
  449|  15.6k|}
lz4frame.c:LZ4F_mt_free:
 2136|  15.6k|{
 2137|  15.6k|    if (mt == NULL) return;
  ------------------
  |  Branch (2137:9): [True: 15.6k, False: 0]
  ------------------
 2138|      0|    LZ4F_mt_abort(mt);
 2139|      0|    LZ4F_pool_free(mt->pool, cmem);
 2140|      0|    LZ4F_pool_free(mt->hPool, cmem);
 2141|      0|    LZ4F_mt_freeStates(mt, cmem);
 2142|      0|    LZ4F_mt_freeJobs(mt, cmem);
 2143|      0|    LZ4F_mt_freeInBuffs(mt, cmem);
 2144|      0|    LZ4F_free(mt->history, cmem);
 2145|      0|    LZ4F_free(mt, cmem);
 2146|      0|}
lz4frame.c:LZ4F_compressBlocks_internal:
 1233|  14.1k|{
 1234|  14.1k|    const BYTE* ip = (const BYTE*)src;
 1235|  14.1k|    const BYTE* const iend = srcSize ? ip + srcSize : ip;
  ------------------
  |  Branch (1235:30): [True: 14.1k, False: 0]
  ------------------
 1236|  14.1k|    BYTE* const ostart = (BYTE*)dst;
 1237|  14.1k|    BYTE* op = ostart;
 1238|  14.1k|    BYTE* const oend = dstCapacity ? ostart + dstCapacity : ostart;
  ------------------
  |  Branch (1238:24): [True: 14.1k, False: 0]
  ------------------
 1239|       |
 1240|  28.2k|    while (ip < iend) {
  ------------------
  |  Branch (1240:12): [True: 14.1k, False: 14.1k]
  ------------------
 1241|  14.1k|        size_t const bSize = MIN(blockSize, (size_t)(iend - ip));
  ------------------
  |  |  443|  14.1k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (443:22): [True: 0, False: 14.1k]
  |  |  ------------------
  ------------------
 1242|  14.1k|        size_t const cSize = LZ4F_makeBlock(op, (size_t)(oend - op),
 1243|  14.1k|                                            ip, bSize,
 1244|  14.1k|                                            compress, lz4ctx, level,
 1245|  14.1k|                                            cdict, crcFlag);
 1246|  14.1k|        FORWARD_IF_ERROR(cSize);
  ------------------
  |  |  402|  14.1k|#define FORWARD_IF_ERROR(r) do {                     \
  |  |  403|  14.1k|        size_t const err_code = (r);                 \
  |  |  404|  14.1k|        if (LZ4F_isError(err_code)) return err_code; \
  |  |  ------------------
  |  |  |  Branch (404:13): [True: 0, False: 14.1k]
  |  |  ------------------
  |  |  405|  14.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (405:14): [Folded, False: 14.1k]
  |  |  ------------------
  ------------------
 1247|  14.1k|        ip += bSize;
 1248|  14.1k|        op += cSize;
 1249|  14.1k|    }
 1250|  14.1k|    return (size_t)(op - ostart);
 1251|  14.1k|}
lz4frame.c:LZ4F_makeBlock:
 1190|  31.2k|{
 1191|  31.2k|    BYTE* const cSizePtr = (BYTE*)dst;
 1192|  31.2k|    size_t const overhead = BHSize + (size_t)crcFlag * BFSize;
 1193|  31.2k|    int cCapacity = (srcSize > 1) ? (int)srcSize - 1 : 1;
  ------------------
  |  Branch (1193:21): [True: 30.7k, False: 443]
  ------------------
 1194|  31.2k|    U32 cSize;
 1195|  31.2k|    assert(compress != NULL);
  ------------------
  |  Branch (1195:5): [True: 0, False: 31.2k]
  |  Branch (1195:5): [True: 31.2k, False: 0]
  ------------------
 1196|  31.2k|    assert(srcSize > 0);
  ------------------
  |  Branch (1196:5): [True: 0, False: 31.2k]
  |  Branch (1196:5): [True: 31.2k, False: 0]
  ------------------
 1197|  31.2k|    RETURN_ERROR_IF(dstCapacity <= overhead, dstCapacity_tooSmall);
  ------------------
  |  |  394|  31.2k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  31.2k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 31.2k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  31.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 31.2k]
  |  |  ------------------
  ------------------
 1198|  31.2k|    if (dstCapacity - overhead < (size_t)cCapacity)
  ------------------
  |  Branch (1198:9): [True: 0, False: 31.2k]
  ------------------
 1199|      0|        cCapacity = (int)(dstCapacity - overhead);
 1200|  31.2k|    cSize = (U32)compress(lz4ctx, (const char*)src, (char*)(cSizePtr+BHSize),
 1201|  31.2k|                          (int)srcSize, cCapacity,
 1202|  31.2k|                          level, cdict);
 1203|       |
 1204|  31.2k|    if (cSize == 0 || cSize >= srcSize) {
  ------------------
  |  Branch (1204:9): [True: 5.65k, False: 25.5k]
  |  Branch (1204:23): [True: 0, False: 25.5k]
  ------------------
 1205|  5.65k|        RETURN_ERROR_IF(dstCapacity - overhead < srcSize, dstCapacity_tooSmall);
  ------------------
  |  |  394|  5.65k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  5.65k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 5.65k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  5.65k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 5.65k]
  |  |  ------------------
  ------------------
 1206|  5.65k|        cSize = (U32)srcSize;
 1207|  5.65k|        LZ4F_writeLE32(cSizePtr, cSize | LZ4F_BLOCKUNCOMPRESSED_FLAG);
  ------------------
  |  |  296|  5.65k|#define LZ4F_BLOCKUNCOMPRESSED_FLAG 0x80000000U
  ------------------
 1208|  5.65k|        LZ4_memcpy(cSizePtr+BHSize, src, srcSize);
  ------------------
  |  |  113|  5.65k|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 1209|  25.5k|    } else {
 1210|  25.5k|        LZ4F_writeLE32(cSizePtr, cSize);
 1211|  25.5k|    }
 1212|  31.2k|    if (crcFlag) {
  ------------------
  |  Branch (1212:9): [True: 11.4k, False: 19.7k]
  ------------------
 1213|  11.4k|        U32 const crc32 = XXH32(cSizePtr+BHSize, cSize, 0);  /* checksum of compressed data */
  ------------------
  |  |  128|  11.4k|#  define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
  |  |  ------------------
  |  |  |  |  126|  11.4k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  11.4k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1214|  11.4k|        LZ4F_writeLE32(cSizePtr+BHSize+cSize, crc32);
 1215|  11.4k|    }
 1216|  31.2k|    return BHSize + cSize + ((U32)crcFlag)*BFSize;
 1217|  31.2k|}
lz4frame.c:LZ4F_selectCompression:
 1306|  48.9k|{
 1307|  48.9k|    if (compressMode == LZ4B_UNCOMPRESSED)
  ------------------
  |  Branch (1307:9): [True: 0, False: 48.9k]
  ------------------
 1308|      0|        return LZ4F_doNotCompressBlock;
 1309|  48.9k|    if (level < LZ4HC_CLEVEL_MIN) {
  ------------------
  |  |   46|  48.9k|#define LZ4HC_CLEVEL_MIN         2
  ------------------
  |  Branch (1309:9): [True: 16.8k, False: 32.1k]
  ------------------
 1310|  16.8k|        if (blockMode == LZ4F_blockIndependent) return LZ4F_compressBlock;
  ------------------
  |  Branch (1310:13): [True: 6.15k, False: 10.6k]
  ------------------
 1311|  10.6k|        return LZ4F_compressBlock_continue;
 1312|  16.8k|    }
 1313|  32.1k|    if (blockMode == LZ4F_blockIndependent) return LZ4F_compressBlockHC;
  ------------------
  |  Branch (1313:9): [True: 10.2k, False: 21.9k]
  ------------------
 1314|  21.9k|    return LZ4F_compressBlockHC_continue;
 1315|  32.1k|}
lz4frame.c:LZ4F_compressBlock:
 1265|  3.69k|{
 1266|  3.69k|    int const acceleration = LZ4F_levelToAcceleration(level);
 1267|  3.69k|    DEBUGLOG(5, "LZ4F_compressBlock (srcSize=%i)", srcSize);
  ------------------
  |  |  208|  3.69k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1268|  3.69k|    LZ4F_initStream(ctx, cdict, level, LZ4F_blockIndependent);
 1269|  3.69k|    if (cdict) {
  ------------------
  |  Branch (1269:9): [True: 0, False: 3.69k]
  ------------------
 1270|      0|        return LZ4_compress_fast_continue((LZ4_stream_t*)ctx, src, dst, srcSize, dstCapacity, acceleration);
 1271|  3.69k|    } else {
 1272|  3.69k|        return LZ4_compress_fast_extState_fastReset(ctx, src, dst, srcSize, dstCapacity, acceleration);
 1273|  3.69k|    }
 1274|  3.69k|}
lz4frame.c:LZ4F_levelToAcceleration:
 1258|  11.3k|{
 1259|  11.3k|    if (level >= 0) return 1;
  ------------------
  |  Branch (1259:9): [True: 1.85k, False: 9.50k]
  ------------------
 1260|  9.50k|    if (level < 1 - LZ4_ACCELERATION_MAX) return LZ4_ACCELERATION_MAX;
  ------------------
  |  |  650|  9.50k|#define LZ4_ACCELERATION_MAX 65537
  ------------------
                  if (level < 1 - LZ4_ACCELERATION_MAX) return LZ4_ACCELERATION_MAX;
  ------------------
  |  |  650|      0|#define LZ4_ACCELERATION_MAX 65537
  ------------------
  |  Branch (1260:9): [True: 0, False: 9.50k]
  ------------------
 1261|  9.50k|    return -level + 1;
 1262|  9.50k|}
lz4frame.c:LZ4F_compressBlock_continue:
 1277|  7.66k|{
 1278|  7.66k|    int const acceleration = LZ4F_levelToAcceleration(level);
 1279|  7.66k|    (void)cdict; /* init once at beginning of frame */
 1280|  7.66k|    DEBUGLOG(5, "LZ4F_compressBlock_continue (srcSize=%i)", srcSize);
  ------------------
  |  |  208|  7.66k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1281|  7.66k|    return LZ4_compress_fast_continue((LZ4_stream_t*)ctx, src, dst, srcSize, dstCapacity, acceleration);
 1282|  7.66k|}
lz4frame.c:LZ4F_compressBlockHC:
 1285|  5.36k|{
 1286|  5.36k|    LZ4F_initStream(ctx, cdict, level, LZ4F_blockIndependent);
 1287|  5.36k|    if (cdict) {
  ------------------
  |  Branch (1287:9): [True: 0, False: 5.36k]
  ------------------
 1288|      0|        return LZ4_compress_HC_continue((LZ4_streamHC_t*)ctx, src, dst, srcSize, dstCapacity);
 1289|      0|    }
 1290|  5.36k|    return LZ4_compress_HC_extStateHC_fastReset(ctx, src, dst, srcSize, dstCapacity, level);
 1291|  5.36k|}
lz4frame.c:LZ4F_compressBlockHC_continue:
 1294|  14.4k|{
 1295|  14.4k|    (void)level; (void)cdict; /* init once at beginning of frame */
 1296|  14.4k|    return LZ4_compress_HC_continue((LZ4_streamHC_t*)ctx, src, dst, srcSize, dstCapacity);
 1297|  14.4k|}
lz4frame.c:LZ4F_st_update:
 2434|  39.8k|  {
 2435|  39.8k|    size_t const blockSize = cctxPtr->maxBlockSize;
 2436|  39.8k|    const BYTE* srcPtr = (const BYTE*)srcBuffer;
 2437|  39.8k|    const BYTE* const srcEnd = srcSize ? (assert(srcPtr!=NULL), srcPtr + srcSize) : srcPtr;
  ------------------
  |  Branch (2437:32): [True: 39.8k, False: 0]
  |  Branch (2437:43): [True: 0, False: 39.8k]
  |  Branch (2437:43): [True: 39.8k, False: 0]
  ------------------
 2438|  39.8k|    BYTE* const dstStart = (BYTE*)dstBuffer;
 2439|  39.8k|    BYTE* const dstEnd = dstStart + dstCapacity;
 2440|  39.8k|    BYTE* dstPtr = dstStart;
 2441|  39.8k|    LZ4F_lastBlockStatus lastBlockCompressed = notDone;
 2442|  39.8k|    compressFunc_t const compress = LZ4F_selectCompression(cctxPtr->prefs.frameInfo.blockMode, cctxPtr->prefs.compressionLevel, blockCompression);
 2443|  39.8k|    size_t bytesWritten;
 2444|  39.8k|    DEBUGLOG(4, "LZ4F_compressUpdate (srcSize=%zu)", srcSize);
  ------------------
  |  |  208|  39.8k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 2445|       |
 2446|  39.8k|    RETURN_ERROR_IF(cctxPtr->cStage != 1, compressionState_uninitialized);   /* state must be initialized and waiting for next block */
  ------------------
  |  |  394|  39.8k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  39.8k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 39.8k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  39.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 39.8k]
  |  |  ------------------
  ------------------
 2447|       |
 2448|       |    /* output left pending by an incomplete LZ4F_flush() */
 2449|  39.8k|    bytesWritten = LZ4F_emitPendingWhole(cctxPtr, dstPtr, dstCapacity);
 2450|  39.8k|    FORWARD_IF_ERROR_INVALIDATE(bytesWritten, cctxPtr);
  ------------------
  |  |  416|  39.8k|#define FORWARD_IF_ERROR_INVALIDATE(r, cctx) do { \
  |  |  417|  39.8k|        size_t const err_code = (r);               \
  |  |  418|  39.8k|        if (LZ4F_isError(err_code)) {              \
  |  |  ------------------
  |  |  |  Branch (418:13): [True: 0, False: 39.8k]
  |  |  ------------------
  |  |  419|      0|            LZ4F_invalidateFrame(cctx);            \
  |  |  420|      0|            return err_code;                       \
  |  |  421|      0|        }                                          \
  |  |  422|  39.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (422:14): [Folded, False: 39.8k]
  |  |  ------------------
  ------------------
 2451|  39.8k|    dstPtr += bytesWritten;
 2452|       |
 2453|       |    /* flush currently written block, to continue with new block compression */
 2454|  39.8k|    if (cctxPtr->blockCompressMode != blockCompression) {
  ------------------
  |  Branch (2454:9): [True: 0, False: 39.8k]
  ------------------
 2455|      0|        bytesWritten = LZ4F_flushBlock(cctxPtr, dstPtr, (size_t)(dstEnd - dstPtr));
 2456|      0|        FORWARD_IF_ERROR(bytesWritten);   /* note : a failed flush invalidates the frame */
  ------------------
  |  |  402|      0|#define FORWARD_IF_ERROR(r) do {                     \
  |  |  403|      0|        size_t const err_code = (r);                 \
  |  |  404|      0|        if (LZ4F_isError(err_code)) return err_code; \
  |  |  ------------------
  |  |  |  Branch (404:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  405|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (405:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2457|      0|        dstPtr += bytesWritten;
 2458|      0|        cctxPtr->blockCompressMode = blockCompression;
 2459|      0|        if ((blockCompression == LZ4B_UNCOMPRESSED) && (cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked)) {
  ------------------
  |  Branch (2459:13): [True: 0, False: 0]
  |  Branch (2459:56): [True: 0, False: 0]
  ------------------
 2460|       |            /* linked blocks : the decoder's history will contain uncompressed data, unknown to the LZ4 state :
 2461|       |             * history is dropped, blocks compressed next don't reference anything before them */
 2462|      0|            LZ4F_startStream(cctxPtr->lz4CtxPtr, &cctxPtr->prefs, NULL, NULL, 0);
 2463|      0|        }
 2464|      0|    }
 2465|       |
 2466|       |    /* complete tmp buffer */
 2467|  39.8k|    if (cctxPtr->tmpInSize > 0) {   /* some data already within tmp buffer */
  ------------------
  |  Branch (2467:9): [True: 9.90k, False: 29.9k]
  ------------------
 2468|  9.90k|        size_t const sizeToCopy = blockSize - cctxPtr->tmpInSize;
 2469|  9.90k|        assert(blockSize > cctxPtr->tmpInSize);
  ------------------
  |  Branch (2469:9): [True: 0, False: 9.90k]
  |  Branch (2469:9): [True: 9.90k, False: 0]
  ------------------
 2470|  9.90k|        if (sizeToCopy > srcSize) {
  ------------------
  |  Branch (2470:13): [True: 8.63k, False: 1.27k]
  ------------------
 2471|       |            /* add src to tmpIn buffer */
 2472|  8.63k|            LZ4_memcpy(cctxPtr->tmpIn + cctxPtr->tmpInSize, srcBuffer, srcSize);
  ------------------
  |  |  113|  8.63k|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 2473|  8.63k|            srcPtr = srcEnd;
 2474|  8.63k|            cctxPtr->tmpInSize += srcSize;
 2475|       |            /* still needs some CRC */
 2476|  8.63k|        } else {
 2477|       |            /* complete tmpIn block and then compress it */
 2478|  1.27k|            lastBlockCompressed = fromTmpBuffer;
 2479|  1.27k|            LZ4_memcpy(cctxPtr->tmpIn + cctxPtr->tmpInSize, srcBuffer, sizeToCopy);
  ------------------
  |  |  113|  1.27k|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 2480|  1.27k|            srcPtr += sizeToCopy;
 2481|       |
 2482|  1.27k|            bytesWritten = LZ4F_makeBlock(dstPtr, (size_t)(dstEnd - dstPtr),
 2483|  1.27k|                                          cctxPtr->tmpIn, blockSize,
 2484|  1.27k|                                          compress, cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel,
 2485|  1.27k|                                          cctxPtr->cdict,
 2486|  1.27k|                                          cctxPtr->prefs.frameInfo.blockChecksumFlag);
 2487|  1.27k|            FORWARD_IF_ERROR_INVALIDATE(bytesWritten, cctxPtr);
  ------------------
  |  |  416|  1.27k|#define FORWARD_IF_ERROR_INVALIDATE(r, cctx) do { \
  |  |  417|  1.27k|        size_t const err_code = (r);               \
  |  |  418|  1.27k|        if (LZ4F_isError(err_code)) {              \
  |  |  ------------------
  |  |  |  Branch (418:13): [True: 0, False: 1.27k]
  |  |  ------------------
  |  |  419|      0|            LZ4F_invalidateFrame(cctx);            \
  |  |  420|      0|            return err_code;                       \
  |  |  421|      0|        }                                          \
  |  |  422|  1.27k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (422:14): [Folded, False: 1.27k]
  |  |  ------------------
  ------------------
 2488|  1.27k|            dstPtr += bytesWritten;
 2489|  1.27k|            if (cctxPtr->prefs.frameInfo.blockMode==LZ4F_blockLinked) cctxPtr->tmpIn += blockSize;
  ------------------
  |  Branch (2489:17): [True: 1.03k, False: 237]
  ------------------
 2490|  1.27k|            cctxPtr->tmpInSize = 0;
 2491|  1.27k|    }   }
 2492|       |
 2493|       |    /* compress full blocks; with autoFlush, remaining input (< blockSize) is compressed too */
 2494|  39.8k|    {   size_t const remaining = (size_t)(srcEnd - srcPtr);
 2495|  39.8k|        size_t const toCompress = cctxPtr->prefs.autoFlush ? remaining : remaining - (remaining % blockSize);
  ------------------
  |  Branch (2495:35): [True: 19.6k, False: 20.2k]
  ------------------
 2496|       |        /* autoFlush, linked blocks, unstable input smaller than the history window (64 KB) :
 2497|       |         * compressed from @srcBuffer, it would become the only history of next blocks.
 2498|       |         * It's compressed from tmpBuff instead, right after the history, which remains whole. */
 2499|  39.8k|        int const viaTmp = cctxPtr->prefs.autoFlush
  ------------------
  |  Branch (2499:28): [True: 19.6k, False: 20.2k]
  ------------------
 2500|  19.6k|                        && (cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked)
  ------------------
  |  Branch (2500:28): [True: 14.6k, False: 4.94k]
  ------------------
 2501|  14.6k|                        && !compressOptionsPtr->stableSrc
  ------------------
  |  Branch (2501:28): [True: 14.6k, False: 0]
  ------------------
 2502|  14.6k|                        && (blockCompression == LZ4B_COMPRESSED)
  ------------------
  |  Branch (2502:28): [True: 14.6k, False: 0]
  ------------------
 2503|  14.6k|                        && (toCompress > 0) && (toCompress < 64 KB);
  ------------------
  |  |  285|  14.6k|#  define KB *(1<<10)
  ------------------
  |  Branch (2503:28): [True: 14.6k, False: 0]
  |  Branch (2503:48): [True: 6.69k, False: 7.99k]
  ------------------
 2504|  39.8k|        if (viaTmp) {
  ------------------
  |  Branch (2504:13): [True: 6.69k, False: 33.1k]
  ------------------
 2505|  6.69k|            if (cctxPtr->tmpIn + toCompress > cctxPtr->tmpBuff + cctxPtr->tmpBuffCapacity)
  ------------------
  |  Branch (2505:17): [True: 0, False: 6.69k]
  ------------------
 2506|      0|                LZ4F_localSaveDict(cctxPtr);   /* tmpBuff >= 128 KB : room after the history */
 2507|  6.69k|            LZ4_memcpy(cctxPtr->tmpIn, srcPtr, toCompress);
  ------------------
  |  |  113|  6.69k|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 2508|  6.69k|            lastBlockCompressed = fromTmpBuffer;
 2509|  6.69k|            bytesWritten = LZ4F_makeBlock(dstPtr, (size_t)(dstEnd - dstPtr),
 2510|  6.69k|                                          cctxPtr->tmpIn, toCompress,
 2511|  6.69k|                                          compress, cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel,
 2512|  6.69k|                                          cctxPtr->cdict,
 2513|  6.69k|                                          cctxPtr->prefs.frameInfo.blockChecksumFlag);
 2514|  6.69k|            FORWARD_IF_ERROR_INVALIDATE(bytesWritten, cctxPtr);
  ------------------
  |  |  416|  6.69k|#define FORWARD_IF_ERROR_INVALIDATE(r, cctx) do { \
  |  |  417|  6.69k|        size_t const err_code = (r);               \
  |  |  418|  6.69k|        if (LZ4F_isError(err_code)) {              \
  |  |  ------------------
  |  |  |  Branch (418:13): [True: 0, False: 6.69k]
  |  |  ------------------
  |  |  419|      0|            LZ4F_invalidateFrame(cctx);            \
  |  |  420|      0|            return err_code;                       \
  |  |  421|      0|        }                                          \
  |  |  422|  6.69k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (422:14): [Folded, False: 6.69k]
  |  |  ------------------
  ------------------
 2515|  6.69k|            dstPtr += bytesWritten;
 2516|  6.69k|            srcPtr += toCompress;
 2517|  6.69k|            cctxPtr->tmpIn += toCompress;
 2518|  33.1k|        } else if (toCompress) {
  ------------------
  |  Branch (2518:20): [True: 14.1k, False: 19.0k]
  ------------------
 2519|  14.1k|            lastBlockCompressed = fromSrcBuffer;
 2520|  14.1k|            bytesWritten = LZ4F_compressBlocks_internal(dstPtr, (size_t)(dstEnd - dstPtr),
 2521|  14.1k|                                          srcPtr, toCompress, blockSize,
 2522|  14.1k|                                          compress, cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel,
 2523|  14.1k|                                          cctxPtr->cdict,
 2524|  14.1k|                                          cctxPtr->prefs.frameInfo.blockChecksumFlag);
 2525|  14.1k|            FORWARD_IF_ERROR_INVALIDATE(bytesWritten, cctxPtr);
  ------------------
  |  |  416|  14.1k|#define FORWARD_IF_ERROR_INVALIDATE(r, cctx) do { \
  |  |  417|  14.1k|        size_t const err_code = (r);               \
  |  |  418|  14.1k|        if (LZ4F_isError(err_code)) {              \
  |  |  ------------------
  |  |  |  Branch (418:13): [True: 0, False: 14.1k]
  |  |  ------------------
  |  |  419|      0|            LZ4F_invalidateFrame(cctx);            \
  |  |  420|      0|            return err_code;                       \
  |  |  421|      0|        }                                          \
  |  |  422|  14.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (422:14): [Folded, False: 14.1k]
  |  |  ------------------
  ------------------
 2526|  14.1k|            dstPtr += bytesWritten;
 2527|  14.1k|            srcPtr += toCompress;
 2528|  14.1k|    }   }
 2529|       |
 2530|       |    /* preserve dictionary within @tmpBuff whenever necessary */
 2531|  39.8k|    if ((cctxPtr->prefs.frameInfo.blockMode==LZ4F_blockLinked) && (lastBlockCompressed==fromSrcBuffer)) {
  ------------------
  |  Branch (2531:9): [True: 27.1k, False: 12.6k]
  |  Branch (2531:67): [True: 8.99k, False: 18.1k]
  ------------------
 2532|       |        /* note : after uncompressed blocks, the LZ4 state is empty (history dropped), so is the saved dictionary */
 2533|  8.99k|        if (compressOptionsPtr->stableSrc) {
  ------------------
  |  Branch (2533:13): [True: 0, False: 8.99k]
  ------------------
 2534|      0|            cctxPtr->tmpIn = cctxPtr->tmpBuff;  /* src is stable : dictionary remains in src across invocations */
 2535|  8.99k|        } else {
 2536|  8.99k|            LZ4F_localSaveDict(cctxPtr);
 2537|  8.99k|        }
 2538|  8.99k|    }
 2539|       |
 2540|       |    /* keep tmpIn within limits */
 2541|  39.8k|    if (!(cctxPtr->prefs.autoFlush)  /* no autoflush : there may be some data left within internal buffer */
  ------------------
  |  Branch (2541:9): [True: 20.2k, False: 19.6k]
  ------------------
 2542|  20.2k|      && (cctxPtr->tmpIn + blockSize) > (cctxPtr->tmpBuff + cctxPtr->tmpBuffCapacity) )  /* not enough room to store next block */
  ------------------
  |  Branch (2542:10): [True: 444, False: 19.7k]
  ------------------
 2543|    444|    {
 2544|       |        /* only preserve 64KB within internal buffer. Ensures there is enough room for next block.
 2545|       |         * note: this situation necessarily implies lastBlockCompressed==fromTmpBuffer */
 2546|    444|        LZ4F_localSaveDict(cctxPtr);
 2547|    444|        assert((cctxPtr->tmpIn + blockSize) <= (cctxPtr->tmpBuff + cctxPtr->tmpBuffCapacity));
  ------------------
  |  Branch (2547:9): [True: 0, False: 444]
  |  Branch (2547:9): [True: 444, False: 0]
  ------------------
 2548|    444|    }
 2549|       |
 2550|       |    /* some input data left, necessarily < blockSize */
 2551|  39.8k|    if (srcPtr < srcEnd) {
  ------------------
  |  Branch (2551:9): [True: 10.3k, False: 29.4k]
  ------------------
 2552|       |        /* fill tmp buffer */
 2553|  10.3k|        size_t const sizeToCopy = (size_t)(srcEnd - srcPtr);
 2554|  10.3k|        LZ4_memcpy(cctxPtr->tmpIn, srcPtr, sizeToCopy);
  ------------------
  |  |  113|  10.3k|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 2555|  10.3k|        cctxPtr->tmpInSize = sizeToCopy;
 2556|  10.3k|    }
 2557|       |
 2558|  39.8k|    if (cctxPtr->prefs.frameInfo.contentChecksumFlag == LZ4F_contentChecksumEnabled)
  ------------------
  |  Branch (2558:9): [True: 15.8k, False: 24.0k]
  ------------------
 2559|  15.8k|        (void)XXH32_update(&(cctxPtr->xxh), srcBuffer, srcSize);
  ------------------
  |  |  132|  15.8k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  15.8k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  15.8k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2560|       |
 2561|  39.8k|    cctxPtr->totalInSize += srcSize;
 2562|  39.8k|    return (size_t)(dstPtr - dstStart);
 2563|  39.8k|}
lz4frame.c:LZ4F_emitPendingWhole:
 1366|  39.8k|{
 1367|  39.8k|    cctx->flushStage = 0;
 1368|  39.8k|    RETURN_ERROR_IF(cctx->pendingSize > dstCapacity, dstCapacity_tooSmall);
  ------------------
  |  |  394|  39.8k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  39.8k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 0, False: 39.8k]
  |  |  ------------------
  |  |  396|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      0|        }                          \
  |  |  399|  39.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 39.8k]
  |  |  ------------------
  ------------------
 1369|  39.8k|    return LZ4F_copyPending(cctx, dst, dstCapacity, 0);
 1370|  39.8k|}
lz4frame.c:LZ4F_flushBlock:
 1376|  15.6k|{
 1377|  15.6k|    compressFunc_t compress;
 1378|  15.6k|    size_t cSize;
 1379|       |
 1380|  15.6k|    DEBUGLOG(5, "LZ4F_flushBlock: %zu buffered bytes (saved dict size = %i) (dstCapacity=%u)",
  ------------------
  |  |  208|  15.6k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1381|  15.6k|            cctxPtr->tmpInSize, (int)(cctxPtr->tmpIn - cctxPtr->tmpBuff), (unsigned)dstCapacity);
 1382|  15.6k|    if (cctxPtr->tmpInSize == 0) return 0;   /* nothing to flush */
  ------------------
  |  Branch (1382:9): [True: 6.56k, False: 9.11k]
  ------------------
 1383|       |
 1384|       |    /* select compression function */
 1385|  9.11k|    compress = LZ4F_selectCompression(cctxPtr->prefs.frameInfo.blockMode, cctxPtr->prefs.compressionLevel, cctxPtr->blockCompressMode);
 1386|       |
 1387|       |    /* compress tmp buffer */
 1388|  9.11k|    cSize = LZ4F_makeBlock(dstBuffer, dstCapacity,
 1389|  9.11k|                           cctxPtr->tmpIn, cctxPtr->tmpInSize,
 1390|  9.11k|                           compress, cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel,
 1391|  9.11k|                           cctxPtr->cdict,
 1392|  9.11k|                           cctxPtr->prefs.frameInfo.blockChecksumFlag);
 1393|  9.11k|    FORWARD_IF_ERROR_INVALIDATE(cSize, cctxPtr);
  ------------------
  |  |  416|  9.11k|#define FORWARD_IF_ERROR_INVALIDATE(r, cctx) do { \
  |  |  417|  9.11k|        size_t const err_code = (r);               \
  |  |  418|  9.11k|        if (LZ4F_isError(err_code)) {              \
  |  |  ------------------
  |  |  |  Branch (418:13): [True: 0, False: 9.11k]
  |  |  ------------------
  |  |  419|      0|            LZ4F_invalidateFrame(cctx);            \
  |  |  420|      0|            return err_code;                       \
  |  |  421|      0|        }                                          \
  |  |  422|  9.11k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (422:14): [Folded, False: 9.11k]
  |  |  ------------------
  ------------------
 1394|  9.11k|    assert(((void)"flush overflows dstBuffer!", cSize <= dstCapacity));
  ------------------
  |  Branch (1394:5): [True: 0, False: 9.11k]
  |  Branch (1394:5): [True: 9.11k, False: 0]
  ------------------
 1395|       |
 1396|  9.11k|    if (cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked)
  ------------------
  |  Branch (1396:9): [True: 5.41k, False: 3.69k]
  ------------------
 1397|  5.41k|        cctxPtr->tmpIn += cctxPtr->tmpInSize;
 1398|  9.11k|    cctxPtr->tmpInSize = 0;
 1399|       |
 1400|       |    /* keep tmpIn within limits */
 1401|  9.11k|    if ((cctxPtr->tmpIn + cctxPtr->maxBlockSize) > (cctxPtr->tmpBuff + cctxPtr->tmpBuffCapacity)) {
  ------------------
  |  Branch (1401:9): [True: 179, False: 8.93k]
  ------------------
 1402|    179|        assert(cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked);
  ------------------
  |  Branch (1402:9): [True: 0, False: 179]
  |  Branch (1402:9): [True: 179, False: 0]
  ------------------
 1403|    179|        LZ4F_localSaveDict(cctxPtr);
 1404|    179|    }
 1405|       |
 1406|  9.11k|    return cSize;
 1407|  9.11k|}
lz4frame.c:LZ4F_localSaveDict:
 1319|  9.62k|{
 1320|  9.62k|    int const dictSize = (cctxPtr->prefs.compressionLevel < LZ4HC_CLEVEL_MIN) ?
  ------------------
  |  |   46|  9.62k|#define LZ4HC_CLEVEL_MIN         2
  ------------------
  |  Branch (1320:26): [True: 3.94k, False: 5.68k]
  ------------------
 1321|  3.94k|                    LZ4_saveDict ((LZ4_stream_t*)(cctxPtr->lz4CtxPtr), (char*)(cctxPtr->tmpBuff), 64 KB) :
  ------------------
  |  |  285|  3.94k|#  define KB *(1<<10)
  ------------------
 1322|  9.62k|                    LZ4_saveDictHC ((LZ4_streamHC_t*)(cctxPtr->lz4CtxPtr), (char*)(cctxPtr->tmpBuff), 64 KB);
  ------------------
  |  |  285|  5.68k|#  define KB *(1<<10)
  ------------------
 1323|  9.62k|    cctxPtr->tmpIn = cctxPtr->tmpBuff + dictSize;
 1324|  9.62k|}
lz4frame.c:LZ4F_flushPoint:
 2637|  15.6k|{
 2638|  15.6k|    size_t r = 0;
 2639|  15.6k|    if (cctx->mtActive) {
  ------------------
  |  Branch (2639:9): [True: 0, False: 15.6k]
  ------------------
 2640|      0|        LZ4F_mt_flushPoint(cctx->mt);
 2641|  15.6k|    } else {
 2642|  15.6k|        r = LZ4F_flushBlockPartial(cctx, dst, dstCapacity);
 2643|  15.6k|    }
 2644|  15.6k|    if (!LZ4F_isError(r)) cctx->flushStage = 1;
  ------------------
  |  Branch (2644:9): [True: 15.6k, False: 0]
  ------------------
 2645|  15.6k|    return r;
 2646|  15.6k|}
lz4frame.c:LZ4F_flushBlockPartial:
 1413|  15.6k|{
 1414|  15.6k|    size_t const worstCase = cctx->tmpInSize + BHSize + (size_t)cctx->prefs.frameInfo.blockChecksumFlag * BFSize;
 1415|  15.6k|    size_t cSize;
 1416|  15.6k|    if ((cctx->tmpInSize == 0) || (dstCapacity >= worstCase))
  ------------------
  |  Branch (1416:9): [True: 6.56k, False: 9.11k]
  |  Branch (1416:35): [True: 9.11k, False: 0]
  ------------------
 1417|  15.6k|        return LZ4F_flushBlock(cctx, dst, dstCapacity);
 1418|      0|    FORWARD_IF_ERROR_INVALIDATE(LZ4F_reserveStage(cctx), cctx);
  ------------------
  |  |  416|      0|#define FORWARD_IF_ERROR_INVALIDATE(r, cctx) do { \
  |  |  417|      0|        size_t const err_code = (r);               \
  |  |  418|      0|        if (LZ4F_isError(err_code)) {              \
  |  |  ------------------
  |  |  |  Branch (418:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  419|      0|            LZ4F_invalidateFrame(cctx);            \
  |  |  420|      0|            return err_code;                       \
  |  |  421|      0|        }                                          \
  |  |  422|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (422:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1419|      0|    cSize = LZ4F_flushBlock(cctx, cctx->stageBuff, cctx->stageCapacity);
 1420|      0|    FORWARD_IF_ERROR(cSize);   /* already invalidated */
  ------------------
  |  |  402|      0|#define FORWARD_IF_ERROR(r) do {                     \
  |  |  403|      0|        size_t const err_code = (r);                 \
  |  |  404|      0|        if (LZ4F_isError(err_code)) return err_code; \
  |  |  ------------------
  |  |  |  Branch (404:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  405|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (405:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1421|      0|    cctx->pending = cctx->stageBuff;
 1422|      0|    cctx->pendingSize = cSize;
 1423|      0|    return 0;
 1424|      0|}
lz4frame.c:LZ4F_emitPending:
 2611|  15.6k|{
 2612|  15.6k|    pos += LZ4F_copyPending(cctx, dst, dstCapacity, pos);
 2613|  15.6k|    if (cctx->mtActive && (cctx->pendingSize == 0)) {
  ------------------
  |  Branch (2613:9): [True: 0, False: 15.6k]
  |  Branch (2613:27): [True: 0, False: 0]
  ------------------
 2614|      0|        size_t const r = LZ4F_mt_emitPartial(cctx->mt, dst, dstCapacity, pos);
 2615|      0|        FORWARD_IF_ERROR_INVALIDATE(r, cctx);
  ------------------
  |  |  416|      0|#define FORWARD_IF_ERROR_INVALIDATE(r, cctx) do { \
  |  |  417|      0|        size_t const err_code = (r);               \
  |  |  418|      0|        if (LZ4F_isError(err_code)) {              \
  |  |  ------------------
  |  |  |  Branch (418:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  419|      0|            LZ4F_invalidateFrame(cctx);            \
  |  |  420|      0|            return err_code;                       \
  |  |  421|      0|        }                                          \
  |  |  422|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (422:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2616|      0|        pos += r;
 2617|      0|    }
 2618|  15.6k|    return pos;
 2619|  15.6k|}
lz4frame.c:LZ4F_outputPending:
 2622|  15.6k|{
 2623|  15.6k|    return (cctx->pendingSize > 0) || (cctx->mtActive && (cctx->mt->nbSubmitted > 0));
  ------------------
  |  Branch (2623:12): [True: 0, False: 15.6k]
  |  Branch (2623:40): [True: 0, False: 15.6k]
  |  Branch (2623:58): [True: 0, False: 0]
  ------------------
 2624|  15.6k|}
lz4frame.c:LZ4F_writeLE32:
  245|  80.4k|{
  246|  80.4k|    BYTE* const dstPtr = (BYTE*)dst;
  247|  80.4k|    dstPtr[0] = (BYTE)value32;
  248|  80.4k|    dstPtr[1] = (BYTE)(value32 >> 8);
  249|  80.4k|    dstPtr[2] = (BYTE)(value32 >> 16);
  250|  80.4k|    dstPtr[3] = (BYTE)(value32 >> 24);
  251|  80.4k|}
lz4frame.c:LZ4F_copyPending:
 1351|  71.1k|{
 1352|  71.1k|    size_t const n = MIN(cctx->pendingSize, dstCapacity - pos);
  ------------------
  |  |  443|  71.1k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (443:22): [True: 71.1k, False: 0]
  |  |  ------------------
  ------------------
 1353|  71.1k|    assert(pos <= dstCapacity);
  ------------------
  |  Branch (1353:5): [True: 0, False: 71.1k]
  |  Branch (1353:5): [True: 71.1k, False: 0]
  ------------------
 1354|  71.1k|    if (n) {
  ------------------
  |  Branch (1354:9): [True: 15.6k, False: 55.5k]
  ------------------
 1355|  15.6k|        LZ4_memcpy(dst + pos, cctx->pending, n);
  ------------------
  |  |  113|  15.6k|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 1356|  15.6k|        cctx->pending += n;
 1357|  15.6k|    }
 1358|  71.1k|    cctx->pendingSize -= n;
 1359|  71.1k|    return n;
 1360|  71.1k|}
lz4frame.c:LZ4F_readLE32:
  235|   241k|{
  236|   241k|    const BYTE* const srcPtr = (const BYTE*)src;
  237|   241k|    U32 value32 = srcPtr[0];
  238|   241k|    value32 |= ((U32)srcPtr[1])<< 8;
  239|   241k|    value32 |= ((U32)srcPtr[2])<<16;
  240|   241k|    value32 |= ((U32)srcPtr[3])<<24;
  241|   241k|    return value32;
  242|   241k|}
lz4frame.c:LZ4F_decodeHeader:
 2888|  50.1k|{
 2889|  50.1k|    unsigned blockMode, blockChecksumFlag, contentSizeFlag, contentChecksumFlag, dictIDFlag, blockSizeID;
 2890|  50.1k|    size_t frameHeaderSize;
 2891|  50.1k|    const BYTE* srcPtr = (const BYTE*)src;
 2892|       |
 2893|  50.1k|    DEBUGLOG(5, "LZ4F_decodeHeader");
  ------------------
  |  |  208|  50.1k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 2894|  50.1k|    assert(srcSize >= minFHSize);   /* minimal frame header size */
  ------------------
  |  Branch (2894:5): [True: 0, False: 50.1k]
  |  Branch (2894:5): [True: 50.1k, False: 0]
  ------------------
 2895|  50.1k|    MEM_INIT(&(dctx->frameInfo), 0, sizeof(dctx->frameInfo));
  ------------------
  |  |  122|  50.1k|#  define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  119|  50.1k|#  define LZ4_memset(p,v,n)  memset((p),(v),(n))
  |  |  ------------------
  ------------------
 2896|  50.1k|    dctx->frameEnded = 0;
 2897|       |
 2898|       |    /* special case : skippable frames */
 2899|  50.1k|    if ((LZ4F_readLE32(srcPtr) & 0xFFFFFFF0U) == LZ4F_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  530|  50.1k|#define LZ4F_MAGIC_SKIPPABLE_START 0x184D2A50U
  ------------------
  |  Branch (2899:9): [True: 4.15k, False: 45.9k]
  ------------------
 2900|  4.15k|        dctx->frameInfo.frameType = LZ4F_skippableFrame;
 2901|  4.15k|        dctx->dStage = dstage_getSFrameSize;
 2902|  4.15k|        if (src == (void*)(dctx->header)) {
  ------------------
  |  Branch (2902:13): [True: 3.81k, False: 342]
  ------------------
 2903|       |            /* the beginning of the frame size field is already gathered in header+4 */
 2904|  3.81k|            assert(srcSize <= 8);
  ------------------
  |  Branch (2904:13): [True: 0, False: 3.81k]
  |  Branch (2904:13): [True: 3.81k, False: 0]
  ------------------
 2905|  3.81k|            dctx->tmpInSize = srcSize - 4;
 2906|  3.81k|            return srcSize;
 2907|  3.81k|        } else {
 2908|    342|            dctx->tmpInSize = 0;
 2909|    342|            return 4;
 2910|    342|    }   }
 2911|       |
 2912|       |    /* control magic number */
 2913|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 2914|       |    if (LZ4F_readLE32(srcPtr) != LZ4F_MAGICNUMBER) {
 2915|       |        DEBUGLOG(4, "frame header error : unknown magic number");
 2916|       |        RETURN_ERROR(frameType_unknown);
 2917|       |    }
 2918|       |#endif
 2919|  45.9k|    dctx->frameInfo.frameType = LZ4F_frame;
 2920|       |
 2921|       |    /* Flags */
 2922|  45.9k|    {   U32 const FLG = srcPtr[4];
 2923|  45.9k|        U32 const version = (FLG>>6) & _2BITS;
  ------------------
  |  |  291|  45.9k|#define _2BITS 0x03
  ------------------
 2924|  45.9k|        blockChecksumFlag = (FLG>>4) & _1BIT;
  ------------------
  |  |  290|  45.9k|#define _1BIT  0x01
  ------------------
 2925|  45.9k|        blockMode = (FLG>>5) & _1BIT;
  ------------------
  |  |  290|  45.9k|#define _1BIT  0x01
  ------------------
 2926|  45.9k|        contentSizeFlag = (FLG>>3) & _1BIT;
  ------------------
  |  |  290|  45.9k|#define _1BIT  0x01
  ------------------
 2927|  45.9k|        contentChecksumFlag = (FLG>>2) & _1BIT;
  ------------------
  |  |  290|  45.9k|#define _1BIT  0x01
  ------------------
 2928|  45.9k|        dictIDFlag = FLG & _1BIT;
  ------------------
  |  |  290|  45.9k|#define _1BIT  0x01
  ------------------
 2929|       |        /* validate */
 2930|  45.9k|        if (((FLG>>1)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set); /* Reserved bit */
  ------------------
  |  |  290|  45.9k|#define _1BIT  0x01
  ------------------
                      if (((FLG>>1)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set); /* Reserved bit */
  ------------------
  |  |  392|  2.55k|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (2930:13): [True: 2.55k, False: 43.4k]
  ------------------
 2931|  43.4k|        if (version != 1) RETURN_ERROR(headerVersion_wrong);       /* Version Number, only supported value */
  ------------------
  |  |  392|  8.42k|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (2931:13): [True: 8.42k, False: 35.0k]
  ------------------
 2932|  43.4k|    }
 2933|  35.0k|    DEBUGLOG(6, "contentSizeFlag: %u", contentSizeFlag);
  ------------------
  |  |  208|  35.0k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 2934|       |
 2935|       |    /* Frame Header Size */
 2936|  35.0k|    frameHeaderSize = minFHSize + (contentSizeFlag?8:0) + (dictIDFlag?4:0);
  ------------------
  |  Branch (2936:36): [True: 1.99k, False: 33.0k]
  |  Branch (2936:60): [True: 3.46k, False: 31.5k]
  ------------------
 2937|       |
 2938|  35.0k|    if (srcSize < frameHeaderSize) {
  ------------------
  |  Branch (2938:9): [True: 1.20k, False: 33.8k]
  ------------------
 2939|       |        /* only the minimal header is gathered into dctx->header : gather the rest */
 2940|  1.20k|        assert(srcPtr == dctx->header);
  ------------------
  |  Branch (2940:9): [True: 0, False: 1.20k]
  |  Branch (2940:9): [True: 1.20k, False: 0]
  ------------------
 2941|  1.20k|        assert(dctx->dStage == dstage_storeFrameHeader);
  ------------------
  |  Branch (2941:9): [True: 0, False: 1.20k]
  |  Branch (2941:9): [True: 1.20k, False: 0]
  ------------------
 2942|  1.20k|        assert(dctx->tmpInSize == srcSize);
  ------------------
  |  Branch (2942:9): [True: 0, False: 1.20k]
  |  Branch (2942:9): [True: 1.20k, False: 0]
  ------------------
 2943|  1.20k|        dctx->tmpInTarget = frameHeaderSize;
 2944|  1.20k|        return srcSize;
 2945|  1.20k|    }
 2946|       |
 2947|  33.8k|    {   U32 const BD = srcPtr[5];
 2948|  33.8k|        blockSizeID = (BD>>4) & _3BITS;
  ------------------
  |  |  292|  33.8k|#define _3BITS 0x07
  ------------------
 2949|       |        /* validate */
 2950|  33.8k|        if (((BD>>7)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set);   /* Reserved bit */
  ------------------
  |  |  290|  33.8k|#define _1BIT  0x01
  ------------------
                      if (((BD>>7)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set);   /* Reserved bit */
  ------------------
  |  |  392|    189|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (2950:13): [True: 189, False: 33.6k]
  ------------------
 2951|  33.6k|        if (blockSizeID < 4) RETURN_ERROR(maxBlockSize_invalid);    /* 4-7 only supported values for the time being */
  ------------------
  |  |  392|    252|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (2951:13): [True: 252, False: 33.3k]
  ------------------
 2952|  33.3k|        if (((BD>>0)&_4BITS) != 0) RETURN_ERROR(reservedFlag_set);  /* Reserved bits */
  ------------------
  |  |  293|  33.3k|#define _4BITS 0x0F
  ------------------
                      if (((BD>>0)&_4BITS) != 0) RETURN_ERROR(reservedFlag_set);  /* Reserved bits */
  ------------------
  |  |  392|    221|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (2952:13): [True: 221, False: 33.1k]
  ------------------
 2953|  33.3k|    }
 2954|       |
 2955|       |    /* check header */
 2956|  33.3k|    assert(frameHeaderSize > 5);
  ------------------
  |  Branch (2956:5): [True: 0, False: 33.1k]
  |  Branch (2956:5): [True: 33.1k, False: 0]
  ------------------
 2957|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 2958|       |    {   BYTE const HC = LZ4F_headerChecksum(srcPtr+4, frameHeaderSize-5);
 2959|       |        RETURN_ERROR_IF(HC != srcPtr[frameHeaderSize-1], headerChecksum_invalid);
 2960|       |    }
 2961|       |#endif
 2962|       |
 2963|       |    /* save */
 2964|  33.1k|    dctx->frameInfo.blockMode = (LZ4F_blockMode_t)blockMode;
 2965|  33.1k|    dctx->frameInfo.blockChecksumFlag = (LZ4F_blockChecksum_t)blockChecksumFlag;
 2966|  33.1k|    dctx->frameInfo.contentChecksumFlag = (LZ4F_contentChecksum_t)contentChecksumFlag;
 2967|  33.1k|    dctx->frameInfo.blockSizeID = (LZ4F_blockSizeID_t)blockSizeID;
 2968|  33.1k|    dctx->maxBlockSize = LZ4F_getBlockSize((LZ4F_blockSizeID_t)blockSizeID);
 2969|  33.1k|    if (contentSizeFlag) {
  ------------------
  |  Branch (2969:9): [True: 1.37k, False: 31.7k]
  ------------------
 2970|  1.37k|        dctx->frameRemainingSize = dctx->frameInfo.contentSize = LZ4F_readLE64(srcPtr+6);
 2971|  1.37k|    }
 2972|  33.1k|    if (dictIDFlag)
  ------------------
  |  Branch (2972:9): [True: 1.91k, False: 31.2k]
  ------------------
 2973|  1.91k|        dctx->frameInfo.dictID = LZ4F_readLE32(srcPtr + frameHeaderSize - 5);
 2974|       |
 2975|  33.1k|    dctx->dStage = dstage_init;
 2976|       |
 2977|  33.1k|    return frameHeaderSize;
 2978|  33.1k|}
lz4frame.c:LZ4F_readLE64:
  254|  1.37k|{
  255|  1.37k|    const BYTE* const srcPtr = (const BYTE*)src;
  256|  1.37k|    U64 value64 = srcPtr[0];
  257|  1.37k|    value64 |= ((U64)srcPtr[1]<<8);
  258|  1.37k|    value64 |= ((U64)srcPtr[2]<<16);
  259|  1.37k|    value64 |= ((U64)srcPtr[3]<<24);
  260|  1.37k|    value64 |= ((U64)srcPtr[4]<<32);
  261|  1.37k|    value64 |= ((U64)srcPtr[5]<<40);
  262|  1.37k|    value64 |= ((U64)srcPtr[6]<<48);
  263|  1.37k|    value64 |= ((U64)srcPtr[7]<<56);
  264|  1.37k|    return value64;
  265|  1.37k|}
lz4frame.c:LZ4F_gatherInput:
 3283|   245k|{
 3284|   245k|    const BYTE* const srcPtr = *srcPtrPtr;
 3285|   245k|    size_t const available = (size_t)(srcEnd - srcPtr);
 3286|   245k|    if ((dctx->tmpInSize == 0) && (available >= wanted)) {
  ------------------
  |  Branch (3286:9): [True: 222k, False: 22.8k]
  |  Branch (3286:35): [True: 131k, False: 90.5k]
  ------------------
 3287|   131k|        *srcPtrPtr = srcPtr + wanted;
 3288|   131k|        return srcPtr;
 3289|   131k|    }
 3290|   113k|    {   size_t const sizeToCopy = MIN(wanted - dctx->tmpInSize, available);
  ------------------
  |  |  443|   113k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (443:22): [True: 15.1k, False: 98.2k]
  |  |  ------------------
  ------------------
 3291|   113k|        LZ4_memcpy(buffer + dctx->tmpInSize, srcPtr, sizeToCopy);
  ------------------
  |  |  113|   113k|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 3292|   113k|        dctx->tmpInSize += sizeToCopy;
 3293|   113k|        *srcPtrPtr = srcPtr + sizeToCopy;
 3294|   113k|    }
 3295|   113k|    if (dctx->tmpInSize < wanted) return NULL;
  ------------------
  |  Branch (3295:9): [True: 94.3k, False: 19.1k]
  ------------------
 3296|  19.1k|    dctx->tmpInSize = 0;   /* ready for next gathering */
 3297|  19.1k|    return buffer;
 3298|   113k|}
lz4frame.c:LZ4F_endMarkFollows:
 3170|  39.7k|{
 3171|  39.7k|    return ((size_t)(srcEnd - srcPtr) >= skip + BHSize) && (LZ4F_readLE32(srcPtr + skip) == 0);
  ------------------
  |  Branch (3171:12): [True: 38.7k, False: 1.00k]
  |  Branch (3171:60): [True: 12.6k, False: 26.1k]
  ------------------
 3172|  39.7k|}
lz4frame.c:LZ4F_updateDict:
 3105|  57.5k|{
 3106|  57.5k|    assert(dctx != NULL);
  ------------------
  |  Branch (3106:5): [True: 0, False: 57.5k]
  |  Branch (3106:5): [True: 57.5k, False: 0]
  ------------------
 3107|  57.5k|    assert(dstPtr != NULL);
  ------------------
  |  Branch (3107:5): [True: 0, False: 57.5k]
  |  Branch (3107:5): [True: 57.5k, False: 0]
  ------------------
 3108|  57.5k|    if (dctx->dictSize==0) dctx->dict = (const BYTE*)dstPtr;  /* will lead to prefix mode */
  ------------------
  |  Branch (3108:9): [True: 24.1k, False: 33.4k]
  ------------------
 3109|  57.5k|    assert(dctx->dict != NULL);
  ------------------
  |  Branch (3109:5): [True: 0, False: 57.5k]
  |  Branch (3109:5): [True: 57.5k, False: 0]
  ------------------
 3110|       |
 3111|       |    /* prefix mode : the output follows the history within the same buffer.
 3112|       |     * A history filling tmpOutBuffer can only be followed by another allocation : not a continuation. */
 3113|  57.5k|    if ( (dctx->dict + dctx->dictSize == dstPtr)
  ------------------
  |  Branch (3113:10): [True: 25.7k, False: 31.8k]
  ------------------
 3114|  25.7k|      && !((dctx->dict == dctx->tmpOutBuffer) && (dctx->dictSize >= dctx->tmpOutBufferCapacity)) ) {
  ------------------
  |  Branch (3114:12): [True: 0, False: 25.7k]
  |  Branch (3114:50): [True: 0, False: 0]
  ------------------
 3115|  25.7k|        dctx->dictSize += dstSize;
 3116|  25.7k|        return;
 3117|  25.7k|    }
 3118|       |
 3119|  57.5k|    assert(dstPtr >= dstBufferStart);
  ------------------
  |  Branch (3119:5): [True: 0, False: 31.8k]
  |  Branch (3119:5): [True: 31.8k, False: 0]
  ------------------
 3120|  31.8k|    if ((size_t)(dstPtr - dstBufferStart) + dstSize >= 64 KB) {  /* history in dstBuffer becomes large enough to become dictionary */
  ------------------
  |  |  285|  31.8k|#  define KB *(1<<10)
  ------------------
  |  Branch (3120:9): [True: 7.33k, False: 24.4k]
  ------------------
 3121|  7.33k|        dctx->dict = (const BYTE*)dstBufferStart;
 3122|  7.33k|        dctx->dictSize = (size_t)(dstPtr - dstBufferStart) + dstSize;
 3123|  7.33k|        return;
 3124|  7.33k|    }
 3125|       |
 3126|  31.8k|    assert(dstSize < 64 KB);   /* if dstSize >= 64 KB, dictionary would be set into dstBuffer directly */
  ------------------
  |  Branch (3126:5): [True: 0, False: 24.4k]
  |  Branch (3126:5): [True: 24.4k, False: 0]
  ------------------
 3127|       |
 3128|       |    /* dstBuffer does not contain whole useful history (64 KB), so it must be saved within tmpOutBuffer */
 3129|  24.4k|    assert(dctx->tmpOutBuffer != NULL);
  ------------------
  |  Branch (3129:5): [True: 0, False: 24.4k]
  |  Branch (3129:5): [True: 24.4k, False: 0]
  ------------------
 3130|       |
 3131|  24.4k|    if (withinTmp && (dctx->dict == dctx->tmpOutBuffer)) {   /* continue history within tmpOutBuffer */
  ------------------
  |  Branch (3131:9): [True: 15.5k, False: 8.98k]
  |  Branch (3131:22): [True: 15.5k, False: 0]
  ------------------
 3132|       |        /* withinTmp expectation : content of [dstPtr,dstSize] is same as [dict+dictSize,dstSize], so we just extend it */
 3133|  15.5k|        assert(dctx->dict + dctx->dictSize == dctx->tmpOut + dctx->tmpOutStart);
  ------------------
  |  Branch (3133:9): [True: 0, False: 15.5k]
  |  Branch (3133:9): [True: 15.5k, False: 0]
  ------------------
 3134|  15.5k|        dctx->dictSize += dstSize;
 3135|  15.5k|        return;
 3136|  15.5k|    }
 3137|       |
 3138|  8.98k|    if (withinTmp) { /* copy relevant dict portion in front of tmpOut within tmpOutBuffer */
  ------------------
  |  Branch (3138:9): [True: 0, False: 8.98k]
  ------------------
 3139|      0|        LZ4F_moveDictBeforeTmpOut(dctx, dstSize);
 3140|      0|        return;
 3141|      0|    }
 3142|       |
 3143|  8.98k|    if (dctx->dict == dctx->tmpOutBuffer) {    /* copy dst into tmp to complete dict */
  ------------------
  |  Branch (3143:9): [True: 8.98k, False: 0]
  ------------------
 3144|  8.98k|        if (dctx->dictSize + dstSize > dctx->tmpOutBufferCapacity) {  /* tmp buffer not large enough */
  ------------------
  |  Branch (3144:13): [True: 353, False: 8.63k]
  ------------------
 3145|    353|            size_t const preserveSize = 64 KB - dstSize;
  ------------------
  |  |  285|    353|#  define KB *(1<<10)
  ------------------
 3146|    353|            LZ4_memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - preserveSize, preserveSize);
  ------------------
  |  |  113|    353|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 3147|    353|            dctx->dictSize = preserveSize;
 3148|    353|        }
 3149|  8.98k|        LZ4_memcpy(dctx->tmpOutBuffer + dctx->dictSize, dstPtr, dstSize);
  ------------------
  |  |  113|  8.98k|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 3150|  8.98k|        dctx->dictSize += dstSize;
 3151|  8.98k|        return;
 3152|  8.98k|    }
 3153|       |
 3154|       |    /* join dict & dest into tmp */
 3155|      0|    {   size_t preserveSize = 64 KB - dstSize;
  ------------------
  |  |  285|      0|#  define KB *(1<<10)
  ------------------
 3156|      0|        if (preserveSize > dctx->dictSize) preserveSize = dctx->dictSize;
  ------------------
  |  Branch (3156:13): [True: 0, False: 0]
  ------------------
 3157|      0|        LZ4_memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - preserveSize, preserveSize);
  ------------------
  |  |  113|      0|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 3158|      0|        LZ4_memcpy(dctx->tmpOutBuffer + preserveSize, dstPtr, dstSize);
  ------------------
  |  |  113|      0|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 3159|      0|        dctx->dict = dctx->tmpOutBuffer;
 3160|      0|        dctx->dictSize = preserveSize + dstSize;
 3161|      0|    }
 3162|      0|}
lz4frame.c:LZ4F_decodeBlock:
 3205|  52.0k|{
 3206|  52.0k|    const char* dict = (const char*)dctx->dict;
 3207|  52.0k|    size_t dictSize = dctx->dictSize;
 3208|  52.0k|    int decodedSize;
 3209|  52.0k|    assert(dst != NULL);
  ------------------
  |  Branch (3209:5): [True: 0, False: 52.0k]
  |  Branch (3209:5): [True: 52.0k, False: 0]
  ------------------
 3210|  52.0k|    if (dict && dictSize > 1 GB) {
  ------------------
  |  |  287|  22.5k|#  define GB *(1<<30)
  ------------------
  |  Branch (3210:9): [True: 22.5k, False: 29.5k]
  |  Branch (3210:17): [True: 0, False: 22.5k]
  ------------------
 3211|       |        /* the dictSize param is an int, avoid truncation / sign issues */
 3212|      0|        dict += dictSize - 64 KB;
  ------------------
  |  |  285|      0|#  define KB *(1<<10)
  ------------------
 3213|      0|        dictSize = 64 KB;
  ------------------
  |  |  285|      0|#  define KB *(1<<10)
  ------------------
 3214|      0|    }
 3215|  52.0k|    if (seqSizePtr) {
  ------------------
  |  Branch (3215:9): [True: 0, False: 52.0k]
  ------------------
 3216|      0|        int seqSize = (int)srcSize;
 3217|      0|        decodedSize = LZ4_decompress_incomplete(
 3218|      0|                (const char*)src, (char*)dst,
 3219|      0|                &seqSize, (int)dstCapacity,
 3220|      0|                dict, (int)dictSize);
 3221|      0|        *seqSizePtr = (size_t)seqSize;
 3222|  52.0k|    } else {
 3223|  52.0k|        decodedSize = LZ4F_decodeDetached(
 3224|  52.0k|                (const char*)src, (int)srcSize,
 3225|  52.0k|                (char*)dst, (int)dstCapacity,
 3226|  52.0k|                dict, (int)dictSize);
 3227|  52.0k|    }
 3228|  52.0k|    RETURN_ERROR_IF(decodedSize < 0, decompressionFailed);
  ------------------
  |  |  394|  52.0k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|  52.0k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 2.62k, False: 49.4k]
  |  |  ------------------
  |  |  396|  2.62k|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|  2.62k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|  2.62k|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|  2.62k|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|  2.62k|        }                          \
  |  |  399|  52.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 49.4k]
  |  |  ------------------
  ------------------
 3229|  49.4k|    RETURN_ERROR_IF(dctx->frameInfo.contentSize && (U64)decodedSize > dctx->frameRemainingSize, frameSize_wrong);
  ------------------
  |  |  394|  49.4k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  395|   101k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (395:13): [True: 2.51k, False: 46.9k]
  |  |  |  Branch (395:13): [True: 2, False: 2.51k]
  |  |  ------------------
  |  |  396|      2|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  208|      2|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  397|      2|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  392|      2|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  398|      2|        }                          \
  |  |  399|  49.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (399:14): [Folded, False: 49.4k]
  |  |  ------------------
  ------------------
 3230|  49.4k|    if (dctx->frameInfo.contentChecksumFlag && !dctx->skipContentChecksum)
  ------------------
  |  Branch (3230:9): [True: 22.6k, False: 26.8k]
  |  Branch (3230:48): [True: 21.4k, False: 1.20k]
  ------------------
 3231|  21.4k|        XXH32_update(&(dctx->xxh), dst, (size_t)decodedSize);
  ------------------
  |  |  132|  21.4k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  21.4k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  21.4k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3232|  49.4k|    if (dctx->frameInfo.contentSize)
  ------------------
  |  Branch (3232:9): [True: 2.51k, False: 46.9k]
  ------------------
 3233|  2.51k|        dctx->frameRemainingSize -= (size_t)decodedSize;
 3234|  49.4k|    return (size_t)decodedSize;
 3235|  49.4k|}
lz4frame.c:LZ4F_decodeDetached:
 3190|  52.0k|{
 3191|  52.0k|    if ( (dstCapacity > LZ4F_DETACHED_PART) && (dictSize > 0) && (dict + dictSize != dst)
  ------------------
  |  | 3188|  52.0k|#define LZ4F_DETACHED_PART (64 KB + 512)
  |  |  ------------------
  |  |  |  |  285|  52.0k|#  define KB *(1<<10)
  |  |  ------------------
  ------------------
  |  Branch (3191:10): [True: 16.1k, False: 35.9k]
  |  Branch (3191:48): [True: 3.90k, False: 12.2k]
  |  Branch (3191:66): [True: 15, False: 3.89k]
  ------------------
 3192|     15|      && (((size_t)(src + srcSize) <= (size_t)dst) || ((size_t)src >= (size_t)(dst + dstCapacity))) ) {
  ------------------
  |  Branch (3192:11): [True: 15, False: 0]
  |  Branch (3192:55): [True: 0, False: 0]
  ------------------
 3193|     15|        int partSrcSize = srcSize;
 3194|     15|        int const partSize = LZ4_decompress_incomplete(src, dst, &partSrcSize, LZ4F_DETACHED_PART, dict, dictSize);
  ------------------
  |  | 3188|     15|#define LZ4F_DETACHED_PART (64 KB + 512)
  |  |  ------------------
  |  |  |  |  285|     15|#  define KB *(1<<10)
  |  |  ------------------
  ------------------
 3195|     15|        if (partSize >= 0) {
  ------------------
  |  Branch (3195:13): [True: 15, False: 0]
  ------------------
 3196|     15|            int const r = LZ4_decompress_safe_usingDict(src + partSrcSize, dst + partSize,
 3197|     15|                                    srcSize - partSrcSize, dstCapacity - partSize, dst, partSize);
 3198|     15|            if (r >= 0) return partSize + r;
  ------------------
  |  Branch (3198:17): [True: 9, False: 6]
  ------------------
 3199|     15|    }   }
 3200|  52.0k|    return LZ4_decompress_safe_usingDict(src, dst, srcSize, dstCapacity, dict, dictSize);
 3201|  52.0k|}
lz4frame.c:LZ4F_endBlock:
 3264|  49.4k|{
 3265|  49.4k|    if (dctx->blockDecoded && (dctx->frameInfo.blockMode == LZ4F_blockIndependent)) {
  ------------------
  |  Branch (3265:9): [True: 0, False: 49.4k]
  |  Branch (3265:31): [True: 0, False: 0]
  ------------------
 3266|      0|        dctx->dict = dctx->blockDict;
 3267|      0|        dctx->dictSize = dctx->blockDictSize;
 3268|      0|    }
 3269|  49.4k|    dctx->tmpInDecoded = 0;
 3270|  49.4k|    dctx->blockDecoded = 0;
 3271|  49.4k|}
lz4frame.c:LZ4F_endFrame:
 2874|  18.3k|{
 2875|  18.3k|    LZ4F_resetDecompressionContext(dctx);
 2876|  18.3k|    dctx->frameEnded = 1;
 2877|  18.3k|}
lz4frame.c:LZ4F_moveDictBeforeTmpOut:
 3080|  5.50k|{
 3081|  5.50k|    size_t const preserveSize = (size_t)(dctx->tmpOut - dctx->tmpOutBuffer);
 3082|  5.50k|    size_t copySize = 64 KB - dctx->tmpOutSize;
  ------------------
  |  |  285|  5.50k|#  define KB *(1<<10)
  ------------------
 3083|  5.50k|    const BYTE* const oldDictEnd = dctx->dict + dctx->dictSize - dctx->tmpOutStart;
 3084|  5.50k|    if (dctx->tmpOutSize > 64 KB) copySize = 0;
  ------------------
  |  |  285|  5.50k|#  define KB *(1<<10)
  ------------------
  |  Branch (3084:9): [True: 1.68k, False: 3.82k]
  ------------------
 3085|  5.50k|    if (copySize > preserveSize) copySize = preserveSize;
  ------------------
  |  Branch (3085:9): [True: 2.88k, False: 2.62k]
  ------------------
 3086|  5.50k|    assert(dctx->tmpOutBuffer != NULL);
  ------------------
  |  Branch (3086:5): [True: 0, False: 5.50k]
  |  Branch (3086:5): [True: 5.50k, False: 0]
  ------------------
 3087|       |
 3088|  5.50k|    LZ4_memcpy(dctx->tmpOutBuffer + preserveSize - copySize, oldDictEnd - copySize, copySize);
  ------------------
  |  |  113|  5.50k|#  define LZ4_memcpy(d,s,n)  memcpy((d),(s),(n))
  ------------------
 3089|       |
 3090|  5.50k|    dctx->dict = dctx->tmpOutBuffer;
 3091|  5.50k|    dctx->dictSize = preserveSize + dctx->tmpOutStart + flushSize;
 3092|  5.50k|}

LZ4_compress_HC_extStateHC_fastReset:
 1606|  5.36k|{
 1607|  5.36k|    LZ4HC_CCtx_internal* const ctx = &((LZ4_streamHC_t*)state)->internal_donotuse;
 1608|  5.36k|    if (!LZ4_isAligned(state, LZ4_streamHC_t_alignment())) return 0;
  ------------------
  |  Branch (1608:9): [True: 0, False: 5.36k]
  ------------------
 1609|  5.36k|    LZ4_resetStreamHC_fast((LZ4_streamHC_t*)state, compressionLevel);
 1610|  5.36k|    LZ4HC_init_internal (ctx, (const BYTE*)src);
 1611|  5.36k|    if (dstCapacity < LZ4_compressBound(srcSize))
  ------------------
  |  Branch (1611:9): [True: 5.36k, False: 0]
  ------------------
 1612|  5.36k|        return LZ4HC_compress_generic (ctx, src, dst, &srcSize, dstCapacity, compressionLevel, limitedOutput);
 1613|      0|    else
 1614|      0|        return LZ4HC_compress_generic (ctx, src, dst, &srcSize, dstCapacity, compressionLevel, notLimited);
 1615|  5.36k|}
LZ4_initStreamHC:
 1679|  10.3k|{
 1680|  10.3k|    LZ4_streamHC_t* const LZ4_streamHCPtr = (LZ4_streamHC_t*)buffer;
 1681|  10.3k|    DEBUGLOG(4, "LZ4_initStreamHC(%p, %u)", buffer, (unsigned)size);
  ------------------
  |  |  288|  10.3k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1682|       |    /* check conditions */
 1683|  10.3k|    if (buffer == NULL) return NULL;
  ------------------
  |  Branch (1683:9): [True: 0, False: 10.3k]
  ------------------
 1684|  10.3k|    if (size < sizeof(LZ4_streamHC_t)) return NULL;
  ------------------
  |  Branch (1684:9): [True: 0, False: 10.3k]
  ------------------
 1685|  10.3k|    if (!LZ4_isAligned(buffer, LZ4_streamHC_t_alignment())) return NULL;
  ------------------
  |  Branch (1685:9): [True: 0, False: 10.3k]
  ------------------
 1686|       |    /* init */
 1687|  10.3k|    { LZ4HC_CCtx_internal* const hcstate = &(LZ4_streamHCPtr->internal_donotuse);
 1688|  10.3k|      MEM_INIT(hcstate, 0, sizeof(*hcstate));
  ------------------
  |  |  235|  10.3k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  233|  10.3k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 1689|  10.3k|      hcstate->hasWorkspace = (size >= LZ4_STREAMHC_EXTSIZE); }
  ------------------
  |  |  380|  10.3k|#define LZ4_STREAMHC_EXTSIZE (sizeof(LZ4_streamHC_t) + 65584)   /* LZ4_streamHC_t exceeds LZ4_STREAMHC_MINSIZE with 16-byte pointers */
  ------------------
 1690|  10.3k|    LZ4_setCompressionLevel(LZ4_streamHCPtr, LZ4HC_CLEVEL_DEFAULT);
  ------------------
  |  |   47|  10.3k|#define LZ4HC_CLEVEL_DEFAULT     9
  ------------------
 1691|  10.3k|    return LZ4_streamHCPtr;
 1692|  10.3k|}
LZ4_resetStreamHC_fast:
 1708|  17.6k|{
 1709|  17.6k|    LZ4HC_CCtx_internal* const s = &LZ4_streamHCPtr->internal_donotuse;
 1710|  17.6k|    DEBUGLOG(5, "LZ4_resetStreamHC_fast(%p, %d)", LZ4_streamHCPtr, compressionLevel);
  ------------------
  |  |  288|  17.6k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1711|       |    /* also after a failed compression : its positions are below @end, hence out of reach of the next stream */
 1712|  17.6k|    assert(s->end >= s->prefixStart);
  ------------------
  |  Branch (1712:5): [True: 0, False: 17.6k]
  |  Branch (1712:5): [True: 17.6k, False: 0]
  ------------------
 1713|  17.6k|    s->dictLimit += (U32)(s->end - s->prefixStart);
 1714|  17.6k|    s->prefixStart = NULL;
 1715|  17.6k|    s->end = NULL;
 1716|       |    s->dictCtx = NULL;
 1717|  17.6k|    LZ4_setCompressionLevel(LZ4_streamHCPtr, compressionLevel);
 1718|  17.6k|}
LZ4_setCompressionLevel:
 1721|  38.4k|{
 1722|  38.4k|    DEBUGLOG(5, "LZ4_setCompressionLevel(%p, %d)", LZ4_streamHCPtr, compressionLevel);
  ------------------
  |  |  288|  38.4k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1723|  38.4k|    if (compressionLevel < 1) compressionLevel = LZ4HC_CLEVEL_DEFAULT;
  ------------------
  |  |   47|      0|#define LZ4HC_CLEVEL_DEFAULT     9
  ------------------
  |  Branch (1723:9): [True: 0, False: 38.4k]
  ------------------
 1724|  38.4k|    if (compressionLevel > LZ4HC_CLEVEL_MAX) compressionLevel = LZ4HC_CLEVEL_MAX;
  ------------------
  |  |   49|  38.4k|#define LZ4HC_CLEVEL_MAX        12
  ------------------
                  if (compressionLevel > LZ4HC_CLEVEL_MAX) compressionLevel = LZ4HC_CLEVEL_MAX;
  ------------------
  |  |   49|      0|#define LZ4HC_CLEVEL_MAX        12
  ------------------
  |  Branch (1724:9): [True: 0, False: 38.4k]
  ------------------
 1725|  38.4k|    LZ4_streamHCPtr->internal_donotuse.compressionLevel = (short)compressionLevel;
 1726|  38.4k|}
LZ4_favorDecompressionSpeed:
 1729|  10.3k|{
 1730|  10.3k|    LZ4_streamHCPtr->internal_donotuse.favorDecSpeed = (favor!=0);
 1731|  10.3k|}
LZ4_compress_HC_continue:
 1853|  14.4k|{
 1854|  14.4k|    DEBUGLOG(5, "LZ4_compress_HC_continue");
  ------------------
  |  |  288|  14.4k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1855|  14.4k|    if (dstCapacity < LZ4_compressBound(srcSize))
  ------------------
  |  Branch (1855:9): [True: 14.4k, False: 0]
  ------------------
 1856|  14.4k|        return LZ4_compressHC_continue_generic (LZ4_streamHCPtr, src, dst, &srcSize, dstCapacity, limitedOutput);
 1857|      0|    else
 1858|      0|        return LZ4_compressHC_continue_generic (LZ4_streamHCPtr, src, dst, &srcSize, dstCapacity, notLimited);
 1859|  14.4k|}
LZ4_saveDictHC:
 1873|  5.68k|{
 1874|  5.68k|    LZ4HC_CCtx_internal* const streamPtr = &LZ4_streamHCPtr->internal_donotuse;
 1875|  5.68k|    size_t const prefixSize = (size_t)(streamPtr->end - streamPtr->prefixStart);   /* can exceed INT_MAX */
 1876|  5.68k|    DEBUGLOG(5, "LZ4_saveDictHC(%p, %p, %d)", LZ4_streamHCPtr, safeBuffer, dictSize);
  ------------------
  |  |  288|  5.68k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1877|       |    /* nothing compressed yet (new or reset stream) : nothing to save,
 1878|       |     * the stream remains to be initialized by next compression (attached dictionary included) */
 1879|  5.68k|    if (streamPtr->prefixStart == NULL) return 0;
  ------------------
  |  Branch (1879:9): [True: 0, False: 5.68k]
  ------------------
 1880|  5.68k|    assert(streamPtr->end >= streamPtr->prefixStart);
  ------------------
  |  Branch (1880:5): [True: 0, False: 5.68k]
  |  Branch (1880:5): [True: 5.68k, False: 0]
  ------------------
 1881|  5.68k|    if (dictSize > 64 KB) dictSize = 64 KB;
  ------------------
  |  |  250|  5.68k|#define KB *(1 <<10)
  ------------------
                  if (dictSize > 64 KB) dictSize = 64 KB;
  ------------------
  |  |  250|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (1881:9): [True: 0, False: 5.68k]
  ------------------
 1882|  5.68k|    if (dictSize < 4) dictSize = 0;
  ------------------
  |  Branch (1882:9): [True: 0, False: 5.68k]
  ------------------
 1883|  5.68k|    if ((size_t)dictSize > prefixSize) dictSize = (int)prefixSize;   /* 0 <= dictSize <= 64 KB : prefixSize fits */
  ------------------
  |  Branch (1883:9): [True: 0, False: 5.68k]
  ------------------
 1884|  5.68k|    if (safeBuffer == NULL) assert(dictSize == 0); /* a NULL buffer with !0 size is invalid */
  ------------------
  |  Branch (1884:9): [True: 0, False: 5.68k]
  |  Branch (1884:29): [True: 0, False: 0]
  |  Branch (1884:29): [True: 0, False: 0]
  ------------------
 1885|  5.68k|    if (dictSize > 0)
  ------------------
  |  Branch (1885:9): [True: 5.68k, False: 0]
  ------------------
 1886|  5.68k|        LZ4_memmove(safeBuffer, streamPtr->end - dictSize, (size_t)dictSize);
  ------------------
  |  |  356|  5.68k|#    define LZ4_memmove __builtin_memmove
  ------------------
 1887|  5.68k|    {   U32 const endIndex = (U32)(streamPtr->end - streamPtr->prefixStart) + streamPtr->dictLimit;
 1888|  5.68k|        streamPtr->end = (safeBuffer == NULL) ? NULL : (const BYTE*)safeBuffer + dictSize;
  ------------------
  |  Branch (1888:26): [True: 0, False: 5.68k]
  ------------------
 1889|  5.68k|        streamPtr->prefixStart = (const BYTE*)safeBuffer;
 1890|  5.68k|        streamPtr->dictLimit = endIndex - (U32)dictSize;
 1891|  5.68k|        streamPtr->lowLimit = endIndex - (U32)dictSize;
 1892|  5.68k|        streamPtr->dictStart = streamPtr->prefixStart;
 1893|  5.68k|        if (streamPtr->nextToUpdate < streamPtr->dictLimit)
  ------------------
  |  Branch (1893:13): [True: 196, False: 5.48k]
  ------------------
 1894|    196|            streamPtr->nextToUpdate = streamPtr->dictLimit;
 1895|  5.68k|    }
 1896|  5.68k|    return dictSize;
 1897|  5.68k|}
lz4hc.c:LZ4_streamHC_t_alignment:
 1594|  15.7k|{
 1595|  15.7k|#if LZ4_ALIGN_TEST
 1596|  15.7k|    typedef struct { char c; LZ4_streamHC_t t; } t_a;
 1597|  15.7k|    return sizeof(t_a) - sizeof(LZ4_streamHC_t);
 1598|       |#else
 1599|       |    return 1;  /* effectively disabled */
 1600|       |#endif
 1601|  15.7k|}
lz4hc.c:LZ4HC_init_internal:
  257|  12.2k|{
  258|  12.2k|    size_t const bufferSize = (size_t)(hc4->end - hc4->prefixStart);
  259|  12.2k|    size_t newStartingOffset = bufferSize + hc4->dictLimit;
  260|  12.2k|    DEBUGLOG(5, "LZ4HC_init_internal");
  ------------------
  |  |  288|  12.2k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  261|  12.2k|    assert(newStartingOffset >= bufferSize);  /* check overflow */
  ------------------
  |  Branch (261:5): [True: 0, False: 12.2k]
  |  Branch (261:5): [True: 12.2k, False: 0]
  ------------------
  262|  12.2k|    if (newStartingOffset > 1 GB) {
  ------------------
  |  |  252|  12.2k|#define GB *(1U<<30)
  ------------------
  |  Branch (262:9): [True: 0, False: 12.2k]
  ------------------
  263|      0|        LZ4HC_clearTables(hc4);
  264|      0|        newStartingOffset = 0;
  265|      0|    }
  266|  12.2k|    newStartingOffset += 64 KB;
  ------------------
  |  |  250|  12.2k|#define KB *(1 <<10)
  ------------------
  267|  12.2k|    hc4->nextToUpdate = (U32)newStartingOffset;
  268|  12.2k|    hc4->prefixStart = start;
  269|  12.2k|    hc4->end = start;
  270|  12.2k|    hc4->dictStart = start;
  271|  12.2k|    hc4->dictLimit = (U32)newStartingOffset;
  272|  12.2k|    hc4->lowLimit = (U32)newStartingOffset;
  273|  12.2k|}
lz4hc.c:LZ4HC_compress_generic:
 1582|  19.8k|{
 1583|  19.8k|    if (ctx->dictCtx == NULL) {
  ------------------
  |  Branch (1583:9): [True: 19.8k, False: 0]
  ------------------
 1584|  19.8k|        return LZ4HC_compress_generic_noDictCtx(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit);
 1585|  19.8k|    } else {
 1586|      0|        return LZ4HC_compress_generic_dictCtx(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit);
 1587|      0|    }
 1588|  19.8k|}
lz4hc.c:LZ4HC_compress_generic_noDictCtx:
 1529|  19.8k|{
 1530|  19.8k|    assert(ctx->dictCtx == NULL);
  ------------------
  |  Branch (1530:5): [True: 0, False: 19.8k]
  |  Branch (1530:5): [True: 19.8k, False: 0]
  ------------------
 1531|  19.8k|    return LZ4HC_compress_generic_internal(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit, noDictCtx);
 1532|  19.8k|}
lz4hc.c:LZ4HC_compress_generic_internal:
 1467|  19.8k|{
 1468|  19.8k|    DEBUGLOG(5, "LZ4HC_compress_generic_internal(src=%p, srcSize=%d, dstCapacity=%d)",
  ------------------
  |  |  288|  19.8k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1469|  19.8k|                src, *srcSizePtr, dstCapacity);
 1470|       |
 1471|       |    /* input sanitization */
 1472|  19.8k|    if ((U32)*srcSizePtr > (U32)LZ4_MAX_INPUT_SIZE) return 0;  /* Unsupported input size (too large or negative) */
  ------------------
  |  |  260|  19.8k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  ------------------
  |  Branch (1472:9): [True: 0, False: 19.8k]
  ------------------
 1473|  19.8k|    if (dstCapacity < 1) return 0;   /* Invalid: impossible to store anything */
  ------------------
  |  Branch (1473:9): [True: 0, False: 19.8k]
  ------------------
 1474|  19.8k|    assert(dst); /* since dstCapacity >= 1, dst must be valid */
  ------------------
  |  Branch (1474:5): [True: 0, False: 19.8k]
  |  Branch (1474:5): [True: 19.8k, False: 0]
  ------------------
 1475|  19.8k|    if (*srcSizePtr == 0) { *dst = 0; return 1; }
  ------------------
  |  Branch (1475:9): [True: 0, False: 19.8k]
  ------------------
 1476|  19.8k|    assert(src != NULL); /* since *srcSizePtr >= 1, src must be valid */
  ------------------
  |  Branch (1476:5): [True: 0, False: 19.8k]
  |  Branch (1476:5): [True: 19.8k, False: 0]
  ------------------
 1477|       |
 1478|  19.8k|    ctx->end += *srcSizePtr;
 1479|  19.8k|    {   cParams_t const cParam = LZ4HC_getCLevelParams(cLevel);
 1480|  19.8k|        HCfavor_e const favor = ctx->favorDecSpeed ? favorDecompressionSpeed : favorCompressionRatio;
  ------------------
  |  Branch (1480:33): [True: 6.98k, False: 12.8k]
  ------------------
 1481|  19.8k|        int const srcSize = *srcSizePtr;
 1482|  19.8k|        int result;
 1483|       |
 1484|  19.8k|        if (cParam.strat == lz4mid) {
  ------------------
  |  Branch (1484:13): [True: 4.04k, False: 15.8k]
  ------------------
 1485|  4.04k|            result = LZ4MID_compress(ctx,
 1486|  4.04k|                                src, dst, srcSizePtr, dstCapacity,
 1487|  4.04k|                                limit, dict);
 1488|  15.8k|        } else if (cParam.strat == lz4hc) {
  ------------------
  |  Branch (1488:20): [True: 8.91k, False: 6.88k]
  ------------------
 1489|  8.91k|            result = LZ4HC_compress_hashChain(ctx,
 1490|  8.91k|                                src, dst, srcSizePtr, dstCapacity,
 1491|  8.91k|                                cParam.nbSearches, limit, dict);
 1492|  8.91k|        } else {
 1493|  6.88k|            assert(cParam.strat == lz4opt);
  ------------------
  |  Branch (1493:13): [True: 0, False: 6.88k]
  |  Branch (1493:13): [True: 6.88k, False: 0]
  ------------------
 1494|  6.88k|            result = LZ4HC_compress_optimal(ctx,
 1495|  6.88k|                                src, dst, srcSizePtr, dstCapacity,
 1496|  6.88k|                                cParam.nbSearches, cParam.nbSearchesSeq, (int)cParam.targetLength, limit,
 1497|  6.88k|                                dict, favor);
 1498|  6.88k|        }
 1499|  19.8k|        if ((limit == fillOutput) && (result > 0) && (*srcSizePtr < srcSize)) {
  ------------------
  |  Branch (1499:13): [True: 0, False: 19.8k]
  |  Branch (1499:38): [True: 0, False: 0]
  |  Branch (1499:54): [True: 0, False: 0]
  ------------------
 1500|       |            /* fillOutput : compression stopped before the end of input.
 1501|       |             * The rest of input is left to the next block : it isn't history yet,
 1502|       |             * and the positions already inserted into it are dropped (lz4mid drops its own).
 1503|       |             * Note : a failed compression is different : lz4frame stores its block uncompressed,
 1504|       |             * and the next block still references it. */
 1505|      0|            const BYTE* const consumedEnd = (const BYTE*)src + *srcSizePtr;
 1506|      0|            U32 const consumedIdx = ctx->dictLimit + (U32)(consumedEnd - ctx->prefixStart);
 1507|      0|            if ((cParam.strat != lz4mid) && (ctx->nextToUpdate > consumedIdx)) {
  ------------------
  |  Branch (1507:17): [True: 0, False: 0]
  |  Branch (1507:45): [True: 0, False: 0]
  ------------------
 1508|      0|                LZ4HC_dropPositions(ctx, consumedEnd, consumedEnd + (ctx->nextToUpdate - consumedIdx), cParam.strat);
 1509|      0|                ctx->nextToUpdate = consumedIdx;
 1510|      0|            }
 1511|      0|            ctx->end = consumedEnd;
 1512|      0|        }
 1513|  19.8k|        return result;
 1514|  19.8k|    }
 1515|  19.8k|}
lz4hc.c:LZ4MID_compress:
  725|  4.04k|{
  726|  4.04k|    U32* const hash4Table = ctx->hashTable;
  727|  4.04k|    U32* const hash8Table = hash4Table + LZ4MID_HASHTABLESIZE;
  ------------------
  |  |  157|  4.04k|#define LZ4MID_HASHTABLESIZE (1 << LZ4MID_HASHLOG)
  |  |  ------------------
  |  |  |  |  156|  4.04k|#define LZ4MID_HASHLOG (LZ4HC_HASH_LOG-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  238|  4.04k|#define LZ4HC_HASH_LOG 15
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  728|  4.04k|    const BYTE* ip = (const BYTE*)src;
  729|  4.04k|    const BYTE* anchor = ip;
  730|  4.04k|    const BYTE* const iend = ip + *srcSizePtr;
  731|  4.04k|    const BYTE* mflimit;      /* set after the size check : would precede a small input */
  732|  4.04k|    const BYTE* matchlimit;
  733|  4.04k|    const BYTE* ilimit;
  734|  4.04k|    BYTE* op = (BYTE*)dst;
  735|       |    /* fillOutput : keep room for the final run of literals (LZ4 format restriction) */
  736|  4.04k|    BYTE* const oend = op + maxOutputSize - ((limit == fillOutput) ? LASTLITERALS : 0);
  ------------------
  |  |  244|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (736:46): [True: 0, False: 4.04k]
  ------------------
  737|       |
  738|  4.04k|    const BYTE* const prefixPtr = ctx->prefixStart;
  739|  4.04k|    const U32 prefixIdx = ctx->dictLimit;
  740|  4.04k|    U32 ilimitIdx;
  741|  4.04k|    const BYTE* const dictStart = ctx->dictStart;
  742|  4.04k|    const U32 dictIdx = ctx->lowLimit;
  743|  4.04k|    const U32 gDictEndIndex = ctx->lowLimit;
  744|  4.04k|    const LZ4MID_searchIntoDict_f searchIntoDict = (dict == usingDictCtxHc) ? select_searchDict_function(ctx->dictCtx) : NULL;
  ------------------
  |  Branch (744:52): [True: 0, False: 4.04k]
  ------------------
  745|  4.04k|    const BYTE* refEnd = ip;   /* fillOutput : the hash tables reference positions before MAX(refEnd, ip) */
  746|       |
  747|  4.04k|    DEBUGLOG(5, "LZ4MID_compress (%i bytes)", *srcSizePtr);
  ------------------
  |  |  288|  4.04k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  748|       |
  749|       |    /* preconditions verifications */
  750|  4.04k|    if (dict == usingDictCtxHc) DEBUGLOG(5, "usingDictCtxHc");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  |  Branch (750:9): [True: 0, False: 4.04k]
  ------------------
  751|  4.04k|    assert(*srcSizePtr > 0);
  ------------------
  |  Branch (751:5): [True: 0, False: 4.04k]
  |  Branch (751:5): [True: 4.04k, False: 0]
  ------------------
  752|  4.04k|    assert(*srcSizePtr <= LZ4_MAX_INPUT_SIZE);
  ------------------
  |  Branch (752:5): [True: 0, False: 4.04k]
  |  Branch (752:5): [True: 4.04k, False: 0]
  ------------------
  753|  4.04k|    assert(src != NULL);
  ------------------
  |  Branch (753:5): [True: 0, False: 4.04k]
  |  Branch (753:5): [True: 4.04k, False: 0]
  ------------------
  754|  4.04k|    assert(maxOutputSize >= 1);
  ------------------
  |  Branch (754:5): [True: 0, False: 4.04k]
  |  Branch (754:5): [True: 4.04k, False: 0]
  ------------------
  755|  4.04k|    assert(dst != NULL);
  ------------------
  |  Branch (755:5): [True: 0, False: 4.04k]
  |  Branch (755:5): [True: 4.04k, False: 0]
  ------------------
  756|       |
  757|  4.04k|    if (*srcSizePtr < LZ4_minLength)
  ------------------
  |  Branch (757:9): [True: 189, False: 3.85k]
  ------------------
  758|    189|        goto _lz4mid_last_literals;  /* Input too small, no compression (all literals) */
  759|  3.85k|    mflimit = iend - MFLIMIT;
  ------------------
  |  |  245|  3.85k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  760|  3.85k|    matchlimit = (iend - LASTLITERALS);
  ------------------
  |  |  244|  3.85k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  761|  3.85k|    ilimit = (iend - LZ4MID_HASHSIZE);
  ------------------
  |  |  155|  3.85k|#define LZ4MID_HASHSIZE 8
  ------------------
  762|  3.85k|    ilimitIdx = (U32)(ilimit - prefixPtr) + prefixIdx;
  763|       |
  764|       |    /* main loop */
  765|  19.8M|    while (ip <= mflimit) {
  ------------------
  |  Branch (765:12): [True: 19.8M, False: 3.84k]
  ------------------
  766|  19.8M|        const U32 ipIndex = (U32)(ip - prefixPtr) + prefixIdx;
  767|  19.8M|        unsigned matchLength;
  768|  19.8M|        unsigned matchDistance;
  769|       |        /* search long match */
  770|  19.8M|        {   U32 const h8 = LZ4MID_hash8Ptr(ip);
  771|  19.8M|            U32 const pos8 = hash8Table[h8];
  772|  19.8M|            assert(h8 < LZ4MID_HASHTABLESIZE);
  ------------------
  |  Branch (772:13): [True: 0, False: 19.8M]
  |  Branch (772:13): [True: 19.8M, False: 0]
  ------------------
  773|  19.8M|            assert(pos8 < ipIndex);
  ------------------
  |  Branch (773:13): [True: 0, False: 19.8M]
  |  Branch (773:13): [True: 19.8M, False: 0]
  ------------------
  774|  19.8M|            LZ4MID_addPosition(hash8Table, h8, ipIndex);
  775|  19.8M|            matchLength = LZ4MID_countMatch(ip, ipIndex, pos8, matchlimit, prefixPtr, prefixIdx, dictStart, dictIdx);
  776|  19.8M|            matchDistance = ipIndex - pos8;
  777|  19.8M|        }
  778|       |        /* search short match */
  779|  19.8M|        if (matchLength < MINMATCH) {
  ------------------
  |  |  241|  19.8M|#define MINMATCH 4
  ------------------
  |  Branch (779:13): [True: 18.0M, False: 1.77M]
  ------------------
  780|  18.0M|            U32 const h4 = LZ4MID_hash4Ptr(ip);
  781|  18.0M|            U32 const pos4 = hash4Table[h4];
  782|  18.0M|            assert(h4 < LZ4MID_HASHTABLESIZE);
  ------------------
  |  Branch (782:13): [True: 0, False: 18.0M]
  |  Branch (782:13): [True: 18.0M, False: 0]
  ------------------
  783|  18.0M|            assert(pos4 < ipIndex);
  ------------------
  |  Branch (783:13): [True: 0, False: 18.0M]
  |  Branch (783:13): [True: 18.0M, False: 0]
  ------------------
  784|  18.0M|            LZ4MID_addPosition(hash4Table, h4, ipIndex);
  785|  18.0M|            matchLength = LZ4MID_countMatch(ip, ipIndex, pos4, matchlimit, prefixPtr, prefixIdx, dictStart, dictIdx);
  786|  18.0M|            matchDistance = ipIndex - pos4;
  787|  18.0M|        }
  788|  19.8M|        if (matchLength >= MINMATCH) {
  ------------------
  |  |  241|  19.8M|#define MINMATCH 4
  ------------------
  |  Branch (788:13): [True: 4.07M, False: 15.7M]
  ------------------
  789|  4.07M|            if ((matchLength < 8) && likely(ip < mflimit)) {
  ------------------
  |  |  177|  2.81M|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|  2.81M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 2.81M, False: 283]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (789:17): [True: 2.81M, False: 1.26M]
  ------------------
  790|       |                /* short match : check ip+1 for longer, except ip itself */
  791|  2.81M|                U32 const h8 = LZ4MID_hash8Ptr(ip+1);
  792|  2.81M|                U32 const pos8 = hash8Table[h8];
  793|  2.81M|                unsigned const ml2 = LZ4MID_countMatch(ip+1, ipIndex+1, pos8, matchlimit, prefixPtr, prefixIdx, dictStart, dictIdx);
  794|  2.81M|                if ((ml2 > matchLength) && (pos8 != ipIndex)) {
  ------------------
  |  Branch (794:21): [True: 514k, False: 2.29M]
  |  Branch (794:44): [True: 488k, False: 26.5k]
  ------------------
  795|   488k|                    LZ4MID_addPosition(hash8Table, h8, ipIndex+1);
  796|   488k|                    ip++;
  797|   488k|                    matchLength = ml2;
  798|   488k|                    matchDistance = ipIndex + 1 - pos8;
  799|   488k|            }   }
  800|  4.07M|            goto _lz4mid_encode_sequence;
  801|  4.07M|        }
  802|       |        /* no match found in prefix nor extDict : search into the attached dictionary */
  803|  15.7M|        if ( (dict == usingDictCtxHc)
  ------------------
  |  Branch (803:14): [True: 0, False: 15.7M]
  ------------------
  804|      0|          && (ipIndex - gDictEndIndex < LZ4_DISTANCE_MAX - 8) ) {
  ------------------
  |  |  745|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (804:14): [True: 0, False: 0]
  ------------------
  805|      0|            LZ4HC_match_t const dMatch = searchIntoDict(ip, ipIndex,
  806|      0|                    matchlimit,
  807|      0|                    ctx->dictCtx, gDictEndIndex);
  808|      0|            assert(dMatch.back == 0);
  ------------------
  |  Branch (808:13): [True: 0, False: 0]
  |  Branch (808:13): [True: 0, False: 0]
  ------------------
  809|      0|            matchLength = (unsigned)dMatch.len;
  810|      0|            matchDistance = (unsigned)dMatch.off;
  811|      0|            if (matchLength >= MINMATCH) goto _lz4mid_encode_sequence;
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
  |  Branch (811:17): [True: 0, False: 0]
  ------------------
  812|      0|        }
  813|       |        /* no match found */
  814|  15.7M|        ip += 1 + ((ip-anchor) >> 9);  /* skip faster over incompressible data */
  815|  15.7M|        continue;
  816|       |
  817|  4.07M|_lz4mid_encode_sequence:
  818|       |        /* match found at ip : matchLength, matchDistance */
  819|  4.07M|        DEBUGLOG(7, "found match at pos %u (len=%u, distance=%u)",
  ------------------
  |  |  288|  4.07M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  820|  4.07M|                    (U32)(ip - prefixPtr) + prefixIdx, matchLength, matchDistance);
  821|       |
  822|       |        /* catch back */
  823|  4.26M|        while (((ip > anchor) & ((U32)(ip-prefixPtr) > matchDistance)) && (unlikely(ip[-1] == ip[-(int)matchDistance-1]))) {
  ------------------
  |  |  180|  1.67M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  1.67M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (823:16): [True: 1.67M, False: 2.58M]
  |  Branch (823:75): [True: 189k, False: 1.48M]
  ------------------
  824|   189k|            ip--;  matchLength++;
  825|   189k|        };
  826|       |
  827|       |        /* fill table with beginning of match
  828|       |         * note : ip may have moved since ipIndex (longer match at ip+1, catch back) */
  829|  4.07M|        {   U32 const startMatchIdx = (U32)(ip-prefixPtr) + prefixIdx;
  830|  4.07M|            ADDPOS8(ip+1, startMatchIdx+1);
  ------------------
  |  |  648|  4.07M|#define ADDPOS8(_p, _idx) LZ4MID_addPosition(hash8Table, LZ4MID_hash8Ptr(_p), _idx)
  ------------------
  831|  4.07M|            ADDPOS8(ip+2, startMatchIdx+2);
  ------------------
  |  |  648|  4.07M|#define ADDPOS8(_p, _idx) LZ4MID_addPosition(hash8Table, LZ4MID_hash8Ptr(_p), _idx)
  ------------------
  832|  4.07M|            ADDPOS4(ip+1, startMatchIdx+1);
  ------------------
  |  |  649|  4.07M|#define ADDPOS4(_p, _idx) LZ4MID_addPosition(hash4Table, LZ4MID_hash4Ptr(_p), _idx)
  ------------------
  833|  4.07M|        }
  834|       |
  835|       |        /* encode */
  836|  4.07M|        if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  244|  4.07M|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (836:13): [True: 12, False: 4.07M]
  ------------------
  837|  4.07M|                (int)matchLength, (int)matchDistance,
  838|  4.07M|                limit, oend) ) {
  839|     12|            if (limit != fillOutput) return 0;  /* compression failed */
  ------------------
  |  Branch (839:17): [True: 12, False: 0]
  ------------------
  840|      0|            refEnd = ip + matchLength;
  841|      0|            LZ4HC_encodeLastSequence_fillOutput(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  244|      0|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  842|      0|                                (int)matchLength, (int)matchDistance, oend);
  843|      0|            break;
  844|     12|        }
  845|       |
  846|       |        /* fill table with end of match */
  847|  4.07M|        {   U32 endMatchIdx = (U32)(ip-prefixPtr) + prefixIdx;
  848|  4.07M|            U32 pos_m2 = endMatchIdx - 2;
  849|  4.07M|            if (pos_m2 < ilimitIdx) {
  ------------------
  |  Branch (849:17): [True: 4.07M, False: 1.81k]
  ------------------
  850|  4.07M|                if (likely(ip - prefixPtr > 5)) {
  ------------------
  |  |  177|  4.07M|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|  4.07M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 4.07M, False: 277]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  851|  4.07M|                    ADDPOS8(ip-5, endMatchIdx - 5);
  ------------------
  |  |  648|  4.07M|#define ADDPOS8(_p, _idx) LZ4MID_addPosition(hash8Table, LZ4MID_hash8Ptr(_p), _idx)
  ------------------
  852|  4.07M|                }
  853|  4.07M|                ADDPOS8(ip-3, endMatchIdx - 3);
  ------------------
  |  |  648|  4.07M|#define ADDPOS8(_p, _idx) LZ4MID_addPosition(hash8Table, LZ4MID_hash8Ptr(_p), _idx)
  ------------------
  854|  4.07M|                ADDPOS8(ip-2, endMatchIdx - 2);
  ------------------
  |  |  648|  4.07M|#define ADDPOS8(_p, _idx) LZ4MID_addPosition(hash8Table, LZ4MID_hash8Ptr(_p), _idx)
  ------------------
  855|  4.07M|                ADDPOS4(ip-2, endMatchIdx - 2);
  ------------------
  |  |  649|  4.07M|#define ADDPOS4(_p, _idx) LZ4MID_addPosition(hash4Table, LZ4MID_hash4Ptr(_p), _idx)
  ------------------
  856|  4.07M|                ADDPOS4(ip-1, endMatchIdx - 1);
  ------------------
  |  |  649|  4.07M|#define ADDPOS4(_p, _idx) LZ4MID_addPosition(hash4Table, LZ4MID_hash4Ptr(_p), _idx)
  ------------------
  857|  4.07M|            }
  858|  4.07M|        }
  859|  4.07M|    }
  860|       |
  861|  4.03k|_lz4mid_last_literals:
  862|  4.03k|    if (refEnd < ip) refEnd = ip;
  ------------------
  |  Branch (862:9): [True: 3.84k, False: 189]
  ------------------
  863|  4.03k|    if (LZ4HC_encodeLastLiterals(UPDATABLE(ip, op, anchor), iend, limit, oend))
  ------------------
  |  |  244|  4.03k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (863:9): [True: 526, False: 3.50k]
  ------------------
  864|    526|        return 0;  /* not enough space in @dst */
  865|  3.50k|    if (ip < refEnd)   /* fillOutput : the rest of input is left to the next block (input >= LZ4_minLength) */
  ------------------
  |  Branch (865:9): [True: 45, False: 3.46k]
  ------------------
  866|     45|        LZ4HC_dropPositions(ctx, ip, MIN(refEnd, iend - LZ4MID_HASHSIZE), lz4mid);
  ------------------
  |  |   91|     45|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (91:22): [True: 0, False: 45]
  |  |  ------------------
  ------------------
  867|       |
  868|       |    /* End */
  869|  3.50k|    DEBUGLOG(5, "compressed %i bytes into %i bytes", *srcSizePtr, (int)((char*)op - dst));
  ------------------
  |  |  288|  3.50k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  870|  3.50k|    assert(ip >= (const BYTE*)src);
  ------------------
  |  Branch (870:5): [True: 0, False: 3.50k]
  |  Branch (870:5): [True: 3.50k, False: 0]
  ------------------
  871|  3.50k|    assert(ip <= iend);
  ------------------
  |  Branch (871:5): [True: 0, False: 3.50k]
  |  Branch (871:5): [True: 3.50k, False: 0]
  ------------------
  872|  3.50k|    *srcSizePtr = (int)(ip - (const BYTE*)src);
  873|  3.50k|    assert((char*)op >= dst);
  ------------------
  |  Branch (873:5): [True: 0, False: 3.50k]
  |  Branch (873:5): [True: 3.50k, False: 0]
  ------------------
  874|  3.50k|    assert((char*)op - dst <= maxOutputSize);
  ------------------
  |  Branch (874:5): [True: 0, False: 3.50k]
  |  Branch (874:5): [True: 3.50k, False: 0]
  ------------------
  875|  3.50k|    assert((char*)op - dst < INT_MAX);
  ------------------
  |  Branch (875:5): [True: 0, False: 3.50k]
  |  Branch (875:5): [True: 3.50k, False: 0]
  ------------------
  876|  3.50k|    return (int)((char*)op - dst);
  877|  3.50k|}
lz4hc.c:LZ4HC_hashPtr:
  136|   550M|static U32 LZ4HC_hashPtr(const void* ptr) { return HASH_FUNCTION(LZ4_read32(ptr)); }
  ------------------
  |  |  135|   550M|#define HASH_FUNCTION(i)      (((i) * 2654435761U) >> ((MINMATCH*8)-LZ4HC_HASH_LOG))
  |  |  ------------------
  |  |  |  |  241|   550M|#define MINMATCH 4
  |  |  ------------------
  |  |               #define HASH_FUNCTION(i)      (((i) * 2654435761U) >> ((MINMATCH*8)-LZ4HC_HASH_LOG))
  |  |  ------------------
  |  |  |  |  238|   550M|#define LZ4HC_HASH_LOG 15
  |  |  ------------------
  ------------------
lz4hc.c:LZ4HC_countBack:
  221|   191M|{
  222|   191M|    int back = 0;
  223|   191M|    int const min = (int)MAX(iMin - ip, mMin - match);
  ------------------
  |  |   93|   191M|#define MAX(a,b)   ( (a) > (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (93:22): [True: 191M, False: 260k]
  |  |  ------------------
  ------------------
  224|   191M|    assert(min <= 0);
  ------------------
  |  Branch (224:5): [True: 0, False: 191M]
  |  Branch (224:5): [True: 191M, False: 0]
  ------------------
  225|   191M|    assert(ip >= iMin); assert((size_t)(ip-iMin) < (1U<<31));
  ------------------
  |  Branch (225:5): [True: 0, False: 191M]
  |  Branch (225:5): [True: 191M, False: 0]
  |  Branch (225:25): [True: 0, False: 191M]
  |  Branch (225:25): [True: 191M, False: 0]
  ------------------
  226|   191M|    assert(match >= mMin); assert((size_t)(match - mMin) < (1U<<31));
  ------------------
  |  Branch (226:5): [True: 0, False: 191M]
  |  Branch (226:5): [True: 191M, False: 0]
  |  Branch (226:28): [True: 0, False: 191M]
  |  Branch (226:28): [True: 191M, False: 0]
  ------------------
  227|       |
  228|   447M|    while ((back - min) > 3) {
  ------------------
  |  Branch (228:12): [True: 423M, False: 24.0M]
  ------------------
  229|   423M|        U32 const v = LZ4_read32(ip + back - 4) ^ LZ4_read32(match + back - 4);
  230|   423M|        if (v) {
  ------------------
  |  Branch (230:13): [True: 167M, False: 255M]
  ------------------
  231|   167M|            return (back - (int)LZ4HC_NbCommonBytes32(v));
  232|   255M|        } else back -= 4; /* 4-byte step */
  233|   423M|    }
  234|       |    /* check remainder if any */
  235|  34.8M|    while ( (back > min)
  ------------------
  |  Branch (235:13): [True: 34.1M, False: 713k]
  ------------------
  236|  34.1M|         && (ip[back-1] == match[back-1]) )
  ------------------
  |  Branch (236:13): [True: 10.8M, False: 23.3M]
  ------------------
  237|  10.8M|            back--;
  238|  24.0M|    return back;
  239|   191M|}
lz4hc.c:LZ4HC_NbCommonBytes32:
  183|   167M|{
  184|   167M|    assert(val != 0);
  ------------------
  |  Branch (184:5): [True: 0, False: 167M]
  |  Branch (184:5): [True: 167M, False: 0]
  ------------------
  185|   167M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (185:9): [True: 167M, False: 0]
  ------------------
  186|       |#     if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT)
  187|       |        unsigned long r;
  188|       |        _BitScanReverse(&r, val);
  189|       |        return (unsigned)((31 - r) >> 3);
  190|       |#     elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  191|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  192|       |                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  193|       |        return (unsigned)__builtin_clz(val) >> 3;
  194|       |#     else
  195|       |        val >>= 8;
  196|       |        val = ((((val + 0x00FFFF00) | 0x00FFFFFF) + val) |
  197|       |              (val + 0x00FF0000)) >> 24;
  198|       |        return (unsigned)val ^ 3;
  199|       |#     endif
  200|   167M|    } else {
  201|       |#     if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT)
  202|       |        unsigned long r;
  203|       |        _BitScanForward(&r, val);
  204|       |        return (unsigned)(r >> 3);
  205|       |#     elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  206|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  207|       |                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  208|       |        return (unsigned)__builtin_ctz(val) >> 3;
  209|       |#     else
  210|       |        const U32 m = 0x01010101;
  211|       |        return (unsigned)((((val - 1) ^ val) & (m - 1)) * m) >> 24;
  212|       |#     endif
  213|      0|    }
  214|   167M|}
lz4hc.c:LZ4MID_hash8Ptr:
  165|  43.0M|static U32 LZ4MID_hash8Ptr(const void* ptr) { return LZ4MID_hash7(LZ4_readLE64(ptr)); }
lz4hc.c:LZ4MID_hash7:
  163|  43.0M|static U32 LZ4MID_hash7(U64 v) { return (U32)(((v  << (64-56)) * 58295818150454627ULL) >> (64-LZ4MID_HASHLOG)) ; }
  ------------------
  |  |  156|  43.0M|#define LZ4MID_HASHLOG (LZ4HC_HASH_LOG-1)
  |  |  ------------------
  |  |  |  |  238|  43.0M|#define LZ4HC_HASH_LOG 15
  |  |  ------------------
  ------------------
lz4hc.c:LZ4_readLE64:
  168|  43.0M|{
  169|  43.0M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (169:9): [True: 43.0M, False: 0]
  ------------------
  170|  43.0M|        return LZ4_read64(memPtr);
  171|  43.0M|    } else {
  172|      0|        const BYTE* p = (const BYTE*)memPtr;
  173|       |        /* note: relies on the compiler to simplify this expression */
  174|      0|        return (U64)p[0] | ((U64)p[1]<<8) | ((U64)p[2]<<16) | ((U64)p[3]<<24)
  175|      0|            | ((U64)p[4]<<32) | ((U64)p[5]<<40) | ((U64)p[6]<<48) | ((U64)p[7]<<56);
  176|      0|    }
  177|  43.0M|}
lz4hc.c:LZ4_read64:
  145|  43.0M|static U64 LZ4_read64(const void* ptr) { return ((const LZ4_unalign64*)ptr)->u64; }
lz4hc.c:LZ4MID_addPosition:
  644|  70.9M|{
  645|  70.9M|    hTable[hValue] = index;
  646|  70.9M|}
lz4hc.c:LZ4MID_countMatch:
  694|  40.6M|{
  695|  40.6M|    if (ipIndex - pos > LZ4_DISTANCE_MAX) return 0;
  ------------------
  |  |  745|  40.6M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (695:9): [True: 11.5M, False: 29.1M]
  ------------------
  696|  29.1M|    if (pos >= prefixIdx) {
  ------------------
  |  Branch (696:9): [True: 25.7M, False: 3.40M]
  ------------------
  697|  25.7M|        const BYTE* const matchPtr = prefixPtr + (pos - prefixIdx);
  698|  25.7M|        assert(matchPtr < ip);
  ------------------
  |  Branch (698:9): [True: 0, False: 25.7M]
  |  Branch (698:9): [True: 25.7M, False: 0]
  ------------------
  699|  25.7M|        return LZ4_count(ip, matchPtr, matchlimit);
  700|  25.7M|    }
  701|  3.40M|    if (pos >= dictIdx) {
  ------------------
  |  Branch (701:9): [True: 3.40M, False: 0]
  ------------------
  702|       |        /* extDict : the match stops at the end of the dictionary */
  703|  3.40M|        const BYTE* const matchPtr = dictStart + (pos - dictIdx);
  704|  3.40M|        size_t const safeLen = MIN(prefixIdx - pos, (size_t)(matchlimit - ip));
  ------------------
  |  |   91|  3.40M|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (91:22): [True: 3.39M, False: 1.52k]
  |  |  ------------------
  ------------------
  705|  3.40M|        return LZ4_count(ip, matchPtr, ip + safeLen);
  706|  3.40M|    }
  707|      0|    return 0;
  708|  3.40M|}
lz4hc.c:LZ4MID_hash4Ptr:
  160|  30.2M|static U32 LZ4MID_hash4Ptr(const void* ptr) { return LZ4MID_hash4(LZ4_read32(ptr)); }
lz4hc.c:LZ4MID_hash4:
  159|  30.2M|static U32 LZ4MID_hash4(U32 v) { return (v * 2654435761U) >> (32-LZ4MID_HASHLOG); }
  ------------------
  |  |  156|  30.2M|#define LZ4MID_HASHLOG (LZ4HC_HASH_LOG-1)
  |  |  ------------------
  |  |  |  |  238|  30.2M|#define LZ4HC_HASH_LOG 15
  |  |  ------------------
  ------------------
lz4hc.c:LZ4HC_encodeSequence:
  314|  9.02M|{
  315|  9.02M|#define ip      (*_ip)
  316|  9.02M|#define op      (*_op)
  317|  9.02M|#define anchor  (*_anchor)
  318|       |
  319|  9.02M|    BYTE* const token = op++;
  ------------------
  |  |  316|  9.02M|#define op      (*_op)
  ------------------
  320|       |
  321|       |#if defined(LZ4_DEBUG) && (LZ4_DEBUG >= 6)
  322|       |    static const BYTE* start = NULL;
  323|       |    static U32 totalCost = 0;
  324|       |    U32 const pos = (start==NULL) ? 0 : (U32)(anchor - start); /* only works for single segment */
  325|       |    U32 const ll = (U32)(ip - anchor);
  326|       |    U32 const llAdd = (ll>=15) ? ((ll-15) / 255) + 1 : 0;
  327|       |    U32 const mlAdd = (matchLength>=19) ? ((matchLength-19) / 255) + 1 : 0;
  328|       |    U32 const cost = 1 + llAdd + ll + 2 + mlAdd;
  329|       |    if (start==NULL) start = anchor;  /* only works for single segment */
  330|       |    DEBUGLOG(6, "pos:%7u -- literals:%4u, match:%4i, offset:%5i, cost:%4u + %5u",
  331|       |                pos,
  332|       |                (U32)(ip - anchor), matchLength, offset,
  333|       |                cost, totalCost);
  334|       |# if 1 /* only works on single segment data */
  335|       |    HEX_CMP(7, ip, ip-offset, matchLength);
  336|       |# endif
  337|       |    totalCost += cost;
  338|       |#endif
  339|       |
  340|       |    /* Encode Literal length */
  341|  9.02M|    {   size_t litLen = (size_t)(ip - anchor);
  ------------------
  |  |  315|  9.02M|#define ip      (*_ip)
  ------------------
                  {   size_t litLen = (size_t)(ip - anchor);
  ------------------
  |  |  317|  9.02M|#define anchor  (*_anchor)
  ------------------
  342|  9.02M|        LZ4_STATIC_ASSERT(notLimited == 0);
  ------------------
  |  |  276|  9.02M|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
  343|       |        /* Check output limit : compares sizes, as op + size could exceed the address space (32-bit).
  344|       |         * Signed : in fillOutput mode, oend precedes op when dst is too small for any sequence */
  345|  9.02M|        if (limit && (oend - op < (ptrdiff_t)((litLen / 255) + litLen + (2 + 1 + LASTLITERALS)))) {
  ------------------
  |  |  316|  9.02M|#define op      (*_op)
  ------------------
                      if (limit && (oend - op < (ptrdiff_t)((litLen / 255) + litLen + (2 + 1 + LASTLITERALS)))) {
  ------------------
  |  |  244|  9.02M|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (345:13): [True: 9.02M, False: 0]
  |  Branch (345:22): [True: 55, False: 9.02M]
  ------------------
  346|     55|            DEBUGLOG(6, "Not enough room to write %i literals (%i bytes remaining)",
  ------------------
  |  |  288|     55|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  347|     55|                    (int)litLen, (int)(oend - op));
  348|     55|            op = token;
  ------------------
  |  |  316|     55|#define op      (*_op)
  ------------------
  349|     55|            return 1;
  350|     55|        }
  351|  9.02M|        if (litLen >= RUN_MASK) {
  ------------------
  |  |  262|  9.02M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  9.02M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  9.02M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (351:13): [True: 413k, False: 8.61M]
  ------------------
  352|   413k|            size_t len = litLen - RUN_MASK;
  ------------------
  |  |  262|   413k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   413k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|   413k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  353|   413k|            *token = (RUN_MASK << ML_BITS);
  ------------------
  |  |  262|   413k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   413k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|   413k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          *token = (RUN_MASK << ML_BITS);
  ------------------
  |  |  259|   413k|#define ML_BITS  4
  ------------------
  354|   610k|            for(; len >= 255 ; len -= 255) *op++ = 255;
  ------------------
  |  |  316|   196k|#define op      (*_op)
  ------------------
  |  Branch (354:19): [True: 196k, False: 413k]
  ------------------
  355|   413k|            *op++ = (BYTE)len;
  ------------------
  |  |  316|   413k|#define op      (*_op)
  ------------------
  356|  8.61M|        } else {
  357|  8.61M|            *token = (BYTE)(litLen << ML_BITS);
  ------------------
  |  |  259|  8.61M|#define ML_BITS  4
  ------------------
  358|  8.61M|        }
  359|       |
  360|       |        /* Copy Literals */
  361|  9.02M|        LZ4_wildCopy8(op, anchor, op + litLen);
  ------------------
  |  |  316|  9.02M|#define op      (*_op)
  ------------------
                      LZ4_wildCopy8(op, anchor, op + litLen);
  ------------------
  |  |  317|  9.02M|#define anchor  (*_anchor)
  ------------------
                      LZ4_wildCopy8(op, anchor, op + litLen);
  ------------------
  |  |  316|  9.02M|#define op      (*_op)
  ------------------
  362|  9.02M|        op += litLen;
  ------------------
  |  |  316|  9.02M|#define op      (*_op)
  ------------------
  363|  9.02M|    }
  364|       |
  365|       |    /* Encode Offset */
  366|  9.02M|    assert(offset <= LZ4_DISTANCE_MAX );
  ------------------
  |  Branch (366:5): [True: 0, False: 9.02M]
  |  Branch (366:5): [True: 9.02M, False: 0]
  ------------------
  367|  9.02M|    assert(offset > 0);
  ------------------
  |  Branch (367:5): [True: 0, False: 9.02M]
  |  Branch (367:5): [True: 9.02M, False: 0]
  ------------------
  368|  9.02M|    LZ4_writeLE16(op, (U16)(offset)); op += 2;
  ------------------
  |  |  316|  9.02M|#define op      (*_op)
  ------------------
                  LZ4_writeLE16(op, (U16)(offset)); op += 2;
  ------------------
  |  |  316|  9.02M|#define op      (*_op)
  ------------------
  369|       |
  370|       |    /* Encode MatchLength */
  371|  9.02M|    assert(matchLength >= MINMATCH);
  ------------------
  |  Branch (371:5): [True: 0, False: 9.02M]
  |  Branch (371:5): [True: 9.02M, False: 0]
  ------------------
  372|  9.02M|    {   size_t mlCode = (size_t)matchLength - MINMATCH;
  ------------------
  |  |  241|  9.02M|#define MINMATCH 4
  ------------------
  373|  9.02M|        if (limit && (oend - op < (ptrdiff_t)((mlCode / 255) + (1 + LASTLITERALS)))) {
  ------------------
  |  |  316|  9.02M|#define op      (*_op)
  ------------------
                      if (limit && (oend - op < (ptrdiff_t)((mlCode / 255) + (1 + LASTLITERALS)))) {
  ------------------
  |  |  244|  9.02M|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (373:13): [True: 9.02M, False: 0]
  |  Branch (373:22): [True: 11, False: 9.02M]
  ------------------
  374|     11|            DEBUGLOG(6, "Not enough room to write match length");
  ------------------
  |  |  288|     11|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  375|     11|            op = token;
  ------------------
  |  |  316|     11|#define op      (*_op)
  ------------------
  376|     11|            return 1;
  377|     11|        }
  378|  9.02M|        if (mlCode >= ML_MASK) {
  ------------------
  |  |  260|  9.02M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  9.02M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (378:13): [True: 1.53M, False: 7.49M]
  ------------------
  379|  1.53M|            *token += ML_MASK;
  ------------------
  |  |  260|  1.53M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  1.53M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  380|  1.53M|            mlCode -= ML_MASK;
  ------------------
  |  |  260|  1.53M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  1.53M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  381|  2.17M|            for(; mlCode >= 510 ; mlCode -= 510) { *op++ = 255; *op++ = 255; }
  ------------------
  |  |  316|   639k|#define op      (*_op)
  ------------------
                          for(; mlCode >= 510 ; mlCode -= 510) { *op++ = 255; *op++ = 255; }
  ------------------
  |  |  316|   639k|#define op      (*_op)
  ------------------
  |  Branch (381:19): [True: 639k, False: 1.53M]
  ------------------
  382|  1.53M|            if (mlCode >= 255) { mlCode -= 255; *op++ = 255; }
  ------------------
  |  |  316|   132k|#define op      (*_op)
  ------------------
  |  Branch (382:17): [True: 132k, False: 1.40M]
  ------------------
  383|  1.53M|            *op++ = (BYTE)mlCode;
  ------------------
  |  |  316|  1.53M|#define op      (*_op)
  ------------------
  384|  7.49M|        } else {
  385|  7.49M|            *token += (BYTE)(mlCode);
  386|  7.49M|    }   }
  387|       |
  388|       |    /* Prepare next loop */
  389|  9.02M|    ip += matchLength;
  ------------------
  |  |  315|  9.02M|#define ip      (*_ip)
  ------------------
  390|  9.02M|    anchor = ip;
  ------------------
  |  |  317|  9.02M|#define anchor  (*_anchor)
  ------------------
                  anchor = ip;
  ------------------
  |  |  315|  9.02M|#define ip      (*_ip)
  ------------------
  391|       |
  392|  9.02M|    return 0;
  393|       |
  394|  9.02M|#undef ip
  395|  9.02M|#undef op
  396|  9.02M|#undef anchor
  397|  9.02M|}
lz4hc.c:LZ4HC_encodeLastLiterals:
  412|  19.7k|{
  413|  19.7k|#define ip      (*_ip)
  414|  19.7k|#define op      (*_op)
  415|  19.7k|#define anchor  (*_anchor)
  416|       |
  417|  19.7k|    BYTE* const dstEnd = (limit == fillOutput) ? oend + LASTLITERALS : oend;
  ------------------
  |  |  244|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (417:26): [True: 0, False: 19.7k]
  ------------------
  418|  19.7k|    size_t lastRunSize = (size_t)(iend - anchor);  /* literals */
  ------------------
  |  |  415|  19.7k|#define anchor  (*_anchor)
  ------------------
  419|  19.7k|    size_t llAdd = (lastRunSize + 255 - RUN_MASK) / 255;
  ------------------
  |  |  262|  19.7k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  19.7k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  19.7k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  420|  19.7k|    size_t const totalSize = 1 + llAdd + lastRunSize;
  421|  19.7k|    assert(!limit || op <= dstEnd);
  ------------------
  |  Branch (421:5): [True: 19.7k, False: 0]
  |  Branch (421:5): [True: 0, False: 0]
  |  Branch (421:5): [True: 0, False: 19.7k]
  |  Branch (421:5): [True: 19.7k, False: 0]
  ------------------
  422|  19.7k|    if (limit && ((size_t)(dstEnd - op) < totalSize)) {   /* compares sizes, as op + totalSize could exceed the address space */
  ------------------
  |  |  414|  19.7k|#define op      (*_op)
  ------------------
  |  Branch (422:9): [True: 19.7k, False: 0]
  |  Branch (422:18): [True: 2.79k, False: 16.9k]
  ------------------
  423|  2.79k|        if (limit == limitedOutput) return 1;  /* not enough space in dst */
  ------------------
  |  Branch (423:13): [True: 2.79k, False: 0]
  ------------------
  424|       |        /* adapt lastRunSize to fill dst */
  425|      0|        lastRunSize  = (size_t)(dstEnd - op) - 1 /*token*/;
  ------------------
  |  |  414|      0|#define op      (*_op)
  ------------------
  426|      0|        llAdd = (lastRunSize + 256 - RUN_MASK) / 256;
  ------------------
  |  |  262|      0|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|      0|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|      0|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  427|      0|        lastRunSize -= llAdd;
  428|      0|    }
  429|  16.9k|    DEBUGLOG(6, "Final literal run : %i literals", (int)lastRunSize);
  ------------------
  |  |  288|  16.9k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  430|  16.9k|    ip = anchor + lastRunSize;  /* can be != iend if limit==fillOutput */
  ------------------
  |  |  413|  16.9k|#define ip      (*_ip)
  ------------------
                  ip = anchor + lastRunSize;  /* can be != iend if limit==fillOutput */
  ------------------
  |  |  415|  16.9k|#define anchor  (*_anchor)
  ------------------
  431|       |
  432|  16.9k|    if (lastRunSize >= RUN_MASK) {
  ------------------
  |  |  262|  16.9k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  16.9k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  16.9k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (432:9): [True: 1.44k, False: 15.5k]
  ------------------
  433|  1.44k|        size_t accumulator = lastRunSize - RUN_MASK;
  ------------------
  |  |  262|  1.44k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.44k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  1.44k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  434|  1.44k|        *op++ = (RUN_MASK << ML_BITS);
  ------------------
  |  |  414|  1.44k|#define op      (*_op)
  ------------------
                      *op++ = (RUN_MASK << ML_BITS);
  ------------------
  |  |  262|  1.44k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.44k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  1.44k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      *op++ = (RUN_MASK << ML_BITS);
  ------------------
  |  |  259|  1.44k|#define ML_BITS  4
  ------------------
  435|  26.5k|        for(; accumulator >= 255 ; accumulator -= 255) *op++ = 255;
  ------------------
  |  |  414|  25.1k|#define op      (*_op)
  ------------------
  |  Branch (435:15): [True: 25.1k, False: 1.44k]
  ------------------
  436|  1.44k|        *op++ = (BYTE) accumulator;
  ------------------
  |  |  414|  1.44k|#define op      (*_op)
  ------------------
  437|  15.5k|    } else {
  438|  15.5k|        *op++ = (BYTE)(lastRunSize << ML_BITS);
  ------------------
  |  |  414|  15.5k|#define op      (*_op)
  ------------------
                      *op++ = (BYTE)(lastRunSize << ML_BITS);
  ------------------
  |  |  259|  15.5k|#define ML_BITS  4
  ------------------
  439|  15.5k|    }
  440|  16.9k|    assert(lastRunSize <= (size_t)(dstEnd - op));
  ------------------
  |  Branch (440:5): [True: 0, False: 16.9k]
  |  Branch (440:5): [True: 16.9k, False: 0]
  ------------------
  441|  16.9k|    LZ4_memcpy(op, anchor, lastRunSize);
  ------------------
  |  |  348|  16.9k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  442|  16.9k|    op += lastRunSize;
  ------------------
  |  |  414|  16.9k|#define op      (*_op)
  ------------------
  443|  16.9k|    return 0;
  444|       |
  445|  16.9k|#undef ip
  446|  16.9k|#undef op
  447|  16.9k|#undef anchor
  448|  16.9k|}
lz4hc.c:LZ4HC_compress_hashChain:
 1277|  8.91k|{
 1278|  8.91k|    const int inputSize = *srcSizePtr;
 1279|  8.91k|    const int patternAnalysis = (maxNbAttempts > 128);   /* levels 9+ */
 1280|       |
 1281|  8.91k|    const BYTE* ip = (const BYTE*)src;
 1282|  8.91k|    const BYTE* anchor = ip;
 1283|  8.91k|    const BYTE* const iend = ip + inputSize;
 1284|  8.91k|    const BYTE* mflimit;      /* set after the size check : would precede a small input */
 1285|  8.91k|    const BYTE* matchlimit;
 1286|       |
 1287|  8.91k|    BYTE* op = (BYTE*) dst;
 1288|       |    /* fillOutput : keep room for the final run of literals (LZ4 format restriction) */
 1289|  8.91k|    BYTE* const oend = op + maxOutputSize - ((limit == fillOutput) ? LASTLITERALS : 0);
  ------------------
  |  |  244|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (1289:46): [True: 0, False: 8.91k]
  ------------------
 1290|       |
 1291|  8.91k|    const BYTE* start0;
 1292|  8.91k|    const BYTE* start2 = NULL;
 1293|  8.91k|    const BYTE* start3 = NULL;
 1294|  8.91k|    LZ4HC_match_t m0, m1, m2, m3;
 1295|  8.91k|    const LZ4HC_match_t nomatch = {0, 0, 0};
 1296|       |
 1297|       |    /* init */
 1298|  8.91k|    DEBUGLOG(5, "LZ4HC_compress_hashChain (dict?=>%i)", dict);
  ------------------
  |  |  288|  8.91k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1299|       |
 1300|       |    /* preconditions verifications */
 1301|  8.91k|    assert(*srcSizePtr >= 1);
  ------------------
  |  Branch (1301:5): [True: 0, False: 8.91k]
  |  Branch (1301:5): [True: 8.91k, False: 0]
  ------------------
 1302|  8.91k|    assert(src != NULL);
  ------------------
  |  Branch (1302:5): [True: 0, False: 8.91k]
  |  Branch (1302:5): [True: 8.91k, False: 0]
  ------------------
 1303|  8.91k|    assert(maxOutputSize >= 1);
  ------------------
  |  Branch (1303:5): [True: 0, False: 8.91k]
  |  Branch (1303:5): [True: 8.91k, False: 0]
  ------------------
 1304|  8.91k|    assert(dst != NULL);
  ------------------
  |  Branch (1304:5): [True: 0, False: 8.91k]
  |  Branch (1304:5): [True: 8.91k, False: 0]
  ------------------
 1305|       |
 1306|  8.91k|    *srcSizePtr = 0;
 1307|  8.91k|    if (inputSize < LZ4_minLength) goto _last_literals;             /* Input too small, no compression (all literals) */
  ------------------
  |  Branch (1307:9): [True: 411, False: 8.50k]
  ------------------
 1308|  8.50k|    mflimit = iend - MFLIMIT;
  ------------------
  |  |  245|  8.50k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1309|  8.50k|    matchlimit = (iend - LASTLITERALS);
  ------------------
  |  |  244|  8.50k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1310|       |
 1311|       |    /* Main Loop */
 1312|  45.7M|    while (ip <= mflimit) {
  ------------------
  |  Branch (1312:12): [True: 45.7M, False: 8.47k]
  ------------------
 1313|  45.7M|        m1 = LZ4HC_InsertAndFindBestMatch(ctx, ip, matchlimit, maxNbAttempts, patternAnalysis, dict);
 1314|  45.7M|        if (m1.len<MINMATCH) { ip++; continue; }
  ------------------
  |  |  241|  45.7M|#define MINMATCH 4
  ------------------
  |  Branch (1314:13): [True: 42.9M, False: 2.75M]
  ------------------
 1315|       |
 1316|       |        /* saved, in case we would skip too much */
 1317|  2.75M|        start0 = ip; m0 = m1;
 1318|       |
 1319|  3.90M|_Search2:
 1320|       |        /* m1 (at ip) is the next match to encode, m0 (at start0 <= ip) its fallback.
 1321|       |         * Search a longer match m2, starting before the end of m1. */
 1322|  3.90M|        DEBUGLOG(7, "_Search2 (currently found match of size %i)", m1.len);
  ------------------
  |  |  288|  3.90M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1323|  3.90M|        if (ip+m1.len <= mflimit) {
  ------------------
  |  Branch (1323:13): [True: 3.90M, False: 5.75k]
  ------------------
 1324|  3.90M|            start2 = ip + m1.len - 2;
 1325|  3.90M|            m2 = LZ4HC_InsertAndGetWiderMatch(ctx,
 1326|  3.90M|                            start2, ip + 0, matchlimit, m1.len,
 1327|  3.90M|                            maxNbAttempts, patternAnalysis, 0, dict, favorCompressionRatio);
 1328|  3.90M|            start2 += m2.back;
 1329|  3.90M|        } else {
 1330|  5.75k|            m2 = nomatch;  /* do not search further */
 1331|  5.75k|        }
 1332|       |
 1333|  3.90M|        if (m2.len <= m1.len) { /* No better match => encode m1 immediately */
  ------------------
  |  Branch (1333:13): [True: 2.43M, False: 1.47M]
  ------------------
 1334|  2.43M|            if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  244|  2.43M|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1334:17): [True: 22, False: 2.43M]
  ------------------
 1335|  2.43M|                    m1.len, m1.off,
 1336|  2.43M|                    limit, oend) )
 1337|     22|                goto _dest_overflow;
 1338|  2.43M|            continue;
 1339|  2.43M|        }
 1340|       |
 1341|  1.47M|        if ((start0 < ip) && (start2 < ip + m0.len)) {
  ------------------
  |  Branch (1341:13): [True: 253k, False: 1.21M]
  |  Branch (1341:30): [True: 161k, False: 92.2k]
  ------------------
 1342|       |            /* m1 was skipped at least once, and m2 starts early enough : restore m0 */
 1343|   161k|            ip = start0; m1 = m0;
 1344|   161k|        }
 1345|       |
 1346|  1.47M|        if ((start2 - ip) < 3) {  /* m1 too short before m2 : removed */
  ------------------
  |  Branch (1346:13): [True: 847k, False: 622k]
  ------------------
 1347|   847k|            ip = start2;
 1348|   847k|            m1 = m2;
 1349|   847k|            goto _Search2;
 1350|   847k|        }
 1351|       |
 1352|       |        /* m2 (at start2) is the candidate after m1.
 1353|       |         * Search a longer match m3, starting before the end of m2. */
 1354|   810k|        while (1) {
  ------------------
  |  Branch (1354:16): [True: 810k, Folded]
  ------------------
 1355|       |            /* m1 will be cut where m2 starts, but keeps up to OPTIMAL_ML bytes (no extra length byte) :
 1356|       |             * m2 is shifted after them, as long as it keeps at least MINMATCH bytes. */
 1357|   810k|            if ((start2 - ip) < OPTIMAL_ML) {
  ------------------
  |  |   85|   810k|#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  260|   810k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|   810k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  241|   810k|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (1357:17): [True: 728k, False: 82.6k]
  ------------------
 1358|   728k|                int const gap = (int)(start2 - ip);
 1359|   728k|                int newML = MIN(m1.len, OPTIMAL_ML);
  ------------------
  |  |   91|   728k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (91:22): [True: 612k, False: 115k]
  |  |  ------------------
  ------------------
 1360|   728k|                if (newML > gap + m2.len - MINMATCH)
  ------------------
  |  |  241|   728k|#define MINMATCH 4
  ------------------
  |  Branch (1360:21): [True: 520, False: 727k]
  ------------------
 1361|    520|                    newML = gap + m2.len - MINMATCH;
  ------------------
  |  |  241|    520|#define MINMATCH 4
  ------------------
 1362|   728k|                if (newML > gap) {   /* shift m2 */
  ------------------
  |  Branch (1362:21): [True: 652k, False: 75.3k]
  ------------------
 1363|   652k|                    start2 += newML - gap;
 1364|   652k|                    m2.len -= newML - gap;
 1365|   652k|                }
 1366|   728k|            }
 1367|       |
 1368|   810k|            if (start2 + m2.len <= mflimit) {
  ------------------
  |  Branch (1368:17): [True: 809k, False: 1.05k]
  ------------------
 1369|   809k|                start3 = start2 + m2.len - 3;
 1370|   809k|                m3 = LZ4HC_InsertAndGetWiderMatch(ctx,
 1371|   809k|                                start3, start2, matchlimit, m2.len,
 1372|   809k|                                maxNbAttempts, patternAnalysis, 0, dict, favorCompressionRatio);
 1373|   809k|                start3 += m3.back;
 1374|   809k|            } else {
 1375|  1.05k|                m3 = nomatch;  /* do not search further */
 1376|  1.05k|            }
 1377|       |
 1378|   810k|            if ((m3.len > m2.len) && (start3 < ip+m1.len+3)) {  /* not enough room for m2 between m1 and m3 */
  ------------------
  |  Branch (1378:17): [True: 494k, False: 316k]
  |  Branch (1378:38): [True: 327k, False: 166k]
  ------------------
 1379|   327k|                if (start3 >= (ip+m1.len)) {
  ------------------
  |  Branch (1379:21): [True: 306k, False: 21.4k]
  ------------------
 1380|       |                    /* m3 starts after m1 : encode m1, then m3 becomes m1,
 1381|       |                     * and m2, moved after m1 if needed (replaced by m3 if too short), becomes the fallback m0 */
 1382|   306k|                    if (start2 < ip+m1.len) {
  ------------------
  |  Branch (1382:25): [True: 20.7k, False: 285k]
  ------------------
 1383|  20.7k|                        int correction = (int)(ip+m1.len - start2);
 1384|  20.7k|                        start2 += correction;
 1385|  20.7k|                        m2.len -= correction;
 1386|  20.7k|                        if (m2.len < MINMATCH) {
  ------------------
  |  |  241|  20.7k|#define MINMATCH 4
  ------------------
  |  Branch (1386:29): [True: 196, False: 20.6k]
  ------------------
 1387|    196|                            start2 = start3;
 1388|    196|                            m2 = m3;
 1389|    196|                        }
 1390|  20.7k|                    }
 1391|       |
 1392|   306k|                    if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  244|   306k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1392:25): [True: 2, False: 306k]
  ------------------
 1393|   306k|                            m1.len, m1.off,
 1394|   306k|                            limit, oend) )
 1395|      2|                        goto _dest_overflow;
 1396|   306k|                    ip  = start3;
 1397|   306k|                    m1 = m3;
 1398|       |
 1399|   306k|                    start0 = start2;
 1400|   306k|                    m0 = m2;
 1401|   306k|                    goto _Search2;
 1402|   306k|                }
 1403|       |
 1404|       |                /* m3 starts within m1 : m3 replaces m2 */
 1405|  21.4k|                start2 = start3;
 1406|  21.4k|                m2 = m3;
 1407|  21.4k|                continue;
 1408|   327k|            }
 1409|       |
 1410|       |            /* encode m1, cut where m2 starts */
 1411|   483k|            if (start2 < ip+m1.len) m1.len = (int)(start2 - ip);
  ------------------
  |  Branch (1411:17): [True: 144k, False: 338k]
  ------------------
 1412|   483k|            if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  244|   483k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1412:17): [True: 2, False: 483k]
  ------------------
 1413|   483k|                    m1.len, m1.off,
 1414|   483k|                    limit, oend) )
 1415|      2|                goto _dest_overflow;
 1416|       |
 1417|       |            /* m2 becomes m1 */
 1418|   483k|            ip = start2; m1 = m2;
 1419|       |
 1420|   483k|            if (m3.len <= m1.len) {  /* No better match => encode m1 (former m2) */
  ------------------
  |  Branch (1420:17): [True: 316k, False: 166k]
  ------------------
 1421|   316k|                if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  244|   316k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1421:21): [True: 3, False: 316k]
  ------------------
 1422|   316k|                        m1.len, m1.off,
 1423|   316k|                        limit, oend) )
 1424|      3|                    goto _dest_overflow;
 1425|   316k|                break;
 1426|   316k|            }
 1427|       |
 1428|       |            /* m3 becomes m2 */
 1429|   166k|            start2 = start3; m2 = m3;
 1430|   166k|        }
 1431|   622k|    }
 1432|       |
 1433|  8.89k|_last_literals:
 1434|  8.89k|    if (LZ4HC_encodeLastLiterals(UPDATABLE(ip, op, anchor), iend, limit, oend))
  ------------------
  |  |  244|  8.89k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1434:9): [True: 1.07k, False: 7.81k]
  ------------------
 1435|  1.07k|        return 0;  /* not enough space in @dst */
 1436|       |
 1437|       |    /* End */
 1438|  7.81k|    *srcSizePtr = (int) (((const char*)ip) - src);
 1439|  7.81k|    return (int) (((char*)op)-dst);
 1440|       |
 1441|     29|_dest_overflow:
 1442|     29|    if (limit != fillOutput) return 0;  /* compression failed */
  ------------------
  |  Branch (1442:9): [True: 29, False: 0]
  ------------------
 1443|      0|    LZ4HC_encodeLastSequence_fillOutput(UPDATABLE(ip, op, anchor), m1.len, m1.off, oend);
  ------------------
  |  |  244|      0|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
 1444|      0|    goto _last_literals;
 1445|     29|}
lz4hc.c:LZ4HC_InsertAndFindBestMatch:
 1252|  45.7M|{
 1253|  45.7M|    DEBUGLOG(7, "LZ4HC_InsertAndFindBestMatch");
  ------------------
  |  |  288|  45.7M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1254|       |    /* note : LZ4HC_InsertAndGetWiderMatch() is able to modify the starting position of a match (*startpos),
 1255|       |     * but this won't be the case here, as we define iLowLimit==ip,
 1256|       |     * so LZ4HC_InsertAndGetWiderMatch() won't be allowed to search past ip */
 1257|  45.7M|    return LZ4HC_InsertAndGetWiderMatch(hc4, ip, ip, iLimit, MINMATCH-1, maxNbAttempts, patternAnalysis, 0 /*chainSwap*/, dict, favorCompressionRatio);
  ------------------
  |  |  241|  45.7M|#define MINMATCH 4
  ------------------
 1258|  45.7M|}
lz4hc.c:LZ4HC_InsertAndGetWiderMatch:
 1064|  86.5M|{
 1065|  86.5M|    U16* const chainTable = hc4->chainTable;
 1066|  86.5M|    U32* const hashTable = hc4->hashTable;
 1067|  86.5M|    const LZ4HC_CCtx_internal* const dictCtx = hc4->dictCtx;
 1068|  86.5M|    const BYTE* const prefixPtr = hc4->prefixStart;
 1069|  86.5M|    const U32 prefixIdx = hc4->dictLimit;
 1070|  86.5M|    const U32 ipIndex = (U32)(ip - prefixPtr) + prefixIdx;
 1071|  86.5M|    const int withinStartDistance = (hc4->lowLimit + (LZ4_DISTANCE_MAX + 1) > ipIndex);
  ------------------
  |  |  745|  86.5M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
 1072|  86.5M|    const U32 lowestMatchIndex = (withinStartDistance) ? hc4->lowLimit : ipIndex - LZ4_DISTANCE_MAX;
  ------------------
  |  |  745|  51.2M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1072:34): [True: 35.2M, False: 51.2M]
  ------------------
 1073|  86.5M|    const BYTE* const dictStart = hc4->dictStart;
 1074|  86.5M|    const U32 dictIdx = hc4->lowLimit;
 1075|  86.5M|    int const lookBackLength = (int)(ip-iLowLimit);
 1076|  86.5M|    int const maxLength = (int)(iHighLimit-iLowLimit);   /* no match can be longer */
 1077|  86.5M|    int nbAttempts = maxNbAttempts;
 1078|  86.5M|    U32 matchChainPos = 0;
 1079|  86.5M|    U32 const pattern = LZ4_read32(ip);
 1080|  86.5M|    U32 matchIndex;
 1081|  86.5M|    repeat_state_e repeat = rep_untested;
 1082|  86.5M|    size_t srcPatternLength = 0;
 1083|  86.5M|    int offset = 0, sBack = 0;
 1084|       |
 1085|  86.5M|    DEBUGLOG(7, "LZ4HC_InsertAndGetWiderMatch");
  ------------------
  |  |  288|  86.5M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1086|       |    /* First Match */
 1087|  86.5M|    LZ4HC_Insert(hc4, ip);  /* insert all prior positions up to ip (excluded) */
 1088|  86.5M|    matchIndex = hashTable[LZ4HC_hashPtr(ip)];
 1089|  86.5M|    DEBUGLOG(7, "First candidate match for pos %u found at index %u / %u (lowestMatchIndex)",
  ------------------
  |  |  288|  86.5M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1090|  86.5M|                ipIndex, matchIndex, lowestMatchIndex);
 1091|       |
 1092|       |    /* Candidates only replace the current match if strictly longer,
 1093|       |     * so stopping once @longest reaches @maxLength doesn't change the result. */
 1094|  1.64G|    while ((matchIndex>=lowestMatchIndex) && (nbAttempts>0) && (longest<maxLength)) {
  ------------------
  |  Branch (1094:12): [True: 1.56G, False: 83.4M]
  |  Branch (1094:46): [True: 1.55G, False: 3.08M]
  |  Branch (1094:64): [True: 1.55G, False: 12.2k]
  ------------------
 1095|  1.55G|        int matchLength=0;
 1096|  1.55G|        nbAttempts--;
 1097|  1.55G|        assert(matchIndex < ipIndex);
  ------------------
  |  Branch (1097:9): [True: 0, False: 1.55G]
  |  Branch (1097:9): [True: 1.55G, False: 0]
  ------------------
 1098|  1.55G|        if (favorDecSpeed && (ipIndex - matchIndex < 8)) {
  ------------------
  |  Branch (1098:13): [True: 550M, False: 1.00G]
  |  Branch (1098:30): [True: 579k, False: 549M]
  ------------------
 1099|       |            /* do nothing:
 1100|       |             * favorDecSpeed intentionally skips matches with offset < 8 */
 1101|  1.55G|        } else if (matchIndex >= prefixIdx) {   /* within current Prefix */
  ------------------
  |  Branch (1101:20): [True: 1.39G, False: 160M]
  ------------------
 1102|  1.39G|            const BYTE* const matchPtr = prefixPtr + (matchIndex - prefixIdx);
 1103|  1.39G|            assert(matchPtr < ip);
  ------------------
  |  Branch (1103:13): [True: 0, False: 1.39G]
  |  Branch (1103:13): [True: 1.39G, False: 0]
  ------------------
 1104|  1.39G|            assert(longest >= 1);
  ------------------
  |  Branch (1104:13): [True: 0, False: 1.39G]
  |  Branch (1104:13): [True: 1.39G, False: 0]
  ------------------
 1105|  1.39G|            if (LZ4_read16(iLowLimit + longest - 1) == LZ4_read16(matchPtr - lookBackLength + longest - 1)) {
  ------------------
  |  Branch (1105:17): [True: 245M, False: 1.15G]
  ------------------
 1106|   245M|                if (LZ4_read32(matchPtr) == pattern) {
  ------------------
  |  Branch (1106:21): [True: 227M, False: 17.7M]
  ------------------
 1107|   227M|                    int const back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, prefixPtr) : 0;
  ------------------
  |  Branch (1107:38): [True: 180M, False: 46.9M]
  ------------------
 1108|   227M|                    matchLength = MINMATCH + (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
  ------------------
  |  |  241|   227M|#define MINMATCH 4
  ------------------
                                  matchLength = MINMATCH + (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
  ------------------
  |  |  241|   227M|#define MINMATCH 4
  ------------------
                                  matchLength = MINMATCH + (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
  ------------------
  |  |  241|   227M|#define MINMATCH 4
  ------------------
 1109|   227M|                    matchLength -= back;
 1110|   227M|                    if (matchLength > longest) {
  ------------------
  |  Branch (1110:25): [True: 16.3M, False: 210M]
  ------------------
 1111|  16.3M|                        longest = matchLength;
 1112|  16.3M|                        offset = (int)(ipIndex - matchIndex);
 1113|  16.3M|                        sBack = back;
 1114|  16.3M|                        DEBUGLOG(7, "Found match of len=%i within prefix, offset=%i, back=%i", longest, offset, -back);
  ------------------
  |  |  288|  16.3M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1115|  16.3M|                        HEX_CMP(7, ip + back, ip + back - offset, (size_t)matchLength);
 1116|  16.3M|            }   }   }
 1117|  1.39G|        } else {   /* lowestMatchIndex <= matchIndex < dictLimit : within Ext Dict */
 1118|   160M|            const BYTE* const matchPtr = dictStart + (matchIndex - dictIdx);
 1119|   160M|            assert(matchIndex >= dictIdx);
  ------------------
  |  Branch (1119:13): [True: 0, False: 160M]
  |  Branch (1119:13): [True: 160M, False: 0]
  ------------------
 1120|   160M|            if ( likely(matchIndex <= prefixIdx - 4)
  ------------------
  |  |  177|   160M|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|   320M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 160M, False: 4.07k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1121|   160M|              && (LZ4_read32(matchPtr) == pattern) ) {
  ------------------
  |  Branch (1121:18): [True: 122M, False: 37.7M]
  ------------------
 1122|   122M|                int back = 0;
 1123|   122M|                const BYTE* vLimit = ip + (prefixIdx - matchIndex);
 1124|   122M|                if (vLimit > iHighLimit) vLimit = iHighLimit;
  ------------------
  |  Branch (1124:21): [True: 15.0k, False: 122M]
  ------------------
 1125|   122M|                matchLength = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  241|   122M|#define MINMATCH 4
  ------------------
                              matchLength = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  241|   122M|#define MINMATCH 4
  ------------------
                              matchLength = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  241|   122M|#define MINMATCH 4
  ------------------
 1126|   122M|                if ((ip+matchLength == vLimit) && (vLimit < iHighLimit))
  ------------------
  |  Branch (1126:21): [True: 568k, False: 121M]
  |  Branch (1126:51): [True: 568k, False: 151]
  ------------------
 1127|   568k|                    matchLength += LZ4_count(ip+matchLength, prefixPtr, iHighLimit);
 1128|   122M|                back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, dictStart) : 0;
  ------------------
  |  Branch (1128:24): [True: 11.6M, False: 110M]
  ------------------
 1129|   122M|                matchLength -= back;
 1130|   122M|                if (matchLength > longest) {
  ------------------
  |  Branch (1130:21): [True: 469k, False: 121M]
  ------------------
 1131|   469k|                    longest = matchLength;
 1132|   469k|                    offset = (int)(ipIndex - matchIndex);
 1133|   469k|                    sBack = back;
 1134|   469k|                    DEBUGLOG(7, "Found match of len=%i within dict, offset=%i, back=%i", longest, offset, -back);
  ------------------
  |  |  288|   469k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1135|   469k|                    HEX_CMP(7, ip + back, matchPtr + back, (size_t)matchLength);
 1136|   469k|        }   }   }
 1137|       |
 1138|  1.55G|        if (chainSwap && matchLength==longest && matchIndex + (U32)longest <= ipIndex) {   /* better match => select a better chain */
  ------------------
  |  Branch (1138:13): [True: 1.11G, False: 443M]
  |  Branch (1138:26): [True: 23.6M, False: 1.09G]
  |  Branch (1138:50): [True: 22.9M, False: 668k]
  ------------------
 1139|  22.9M|            U32 const distanceToNextMatch = LZ4HC_sparsestChain(chainTable, matchIndex, longest, &matchChainPos);
 1140|  22.9M|            assert(lookBackLength==0);   /* search forward only */
  ------------------
  |  Branch (1140:13): [True: 0, False: 22.9M]
  |  Branch (1140:13): [True: 22.9M, False: 0]
  ------------------
 1141|  22.9M|            if (distanceToNextMatch > 1) {
  ------------------
  |  Branch (1141:17): [True: 14.5M, False: 8.45M]
  ------------------
 1142|  14.5M|                if (distanceToNextMatch > matchIndex) break;   /* avoid overflow */
  ------------------
  |  Branch (1142:21): [True: 0, False: 14.5M]
  ------------------
 1143|  14.5M|                matchIndex -= distanceToNextMatch;
 1144|  14.5M|                continue;
 1145|  14.5M|        }   }
 1146|       |
 1147|  1.54G|        {   U32 const distNextMatch = DELTANEXTU16(chainTable, matchIndex);
  ------------------
  |  |  242|  1.54G|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
 1148|  1.54G|            if (patternAnalysis && distNextMatch==1 && matchChainPos==0) {
  ------------------
  |  Branch (1148:17): [True: 1.44G, False: 101M]
  |  Branch (1148:36): [True: 433M, False: 1.00G]
  |  Branch (1148:56): [True: 301M, False: 132M]
  ------------------
 1149|   301M|                U32 const matchCandidateIdx = matchIndex-1;
 1150|   301M|                size_t forwardPatternLength, backLength;
 1151|       |                /* may be a repeated pattern */
 1152|   301M|                if (repeat == rep_untested) {
  ------------------
  |  Branch (1152:21): [True: 2.01M, False: 299M]
  ------------------
 1153|  2.01M|                    if ( ((pattern & 0xFFFF) == (pattern >> 16))
  ------------------
  |  Branch (1153:26): [True: 1.99M, False: 16.5k]
  ------------------
 1154|  2.01M|                      &  ((pattern & 0xFF)   == (pattern >> 24)) ) {
 1155|  1.99M|                        DEBUGLOG(7, "Repeat pattern detected, char %02X", pattern >> 24);
  ------------------
  |  |  288|  1.99M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1156|  1.99M|                        repeat = rep_confirmed;
 1157|  1.99M|                        srcPatternLength = LZ4HC_countPattern(ip+sizeof(pattern), iHighLimit, pattern) + sizeof(pattern);
 1158|  1.99M|                    } else {
 1159|  16.5k|                        repeat = rep_not;
 1160|  16.5k|                }   }
 1161|   301M|                if ( (repeat == rep_confirmed) && (matchCandidateIdx >= lowestMatchIndex)
  ------------------
  |  Branch (1161:22): [True: 297M, False: 4.58M]
  |  Branch (1161:51): [True: 297M, False: 8.40k]
  ------------------
 1162|   297M|                  && LZ4HC_protectDictEnd(prefixIdx, matchCandidateIdx)
  ------------------
  |  Branch (1162:22): [True: 297M, False: 0]
  ------------------
 1163|   297M|                  && LZ4HC_patternSegment(hc4, matchCandidateIdx, pattern, iHighLimit, lowestMatchIndex,
  ------------------
  |  Branch (1163:22): [True: 296M, False: 135k]
  ------------------
 1164|   297M|                                          &forwardPatternLength, &backLength) ) {
 1165|   296M|                    size_t const currentSegmentLength = backLength + forwardPatternLength;
 1166|       |                    /* if the full source pattern fits (and hasn't been reached yet), jump to its best position :
 1167|       |                     * at the end of the segment, it might be followed by more match.
 1168|       |                     * Otherwise, jump to the farthest position in the segment : the longest match, plus maybe some back */
 1169|   296M|                    int const fullPatternFits = (currentSegmentLength >= srcPatternLength)
  ------------------
  |  Branch (1169:49): [True: 176M, False: 120M]
  ------------------
 1170|   176M|                                             && (forwardPatternLength <= srcPatternLength);
  ------------------
  |  Branch (1170:49): [True: 79.0M, False: 97.3M]
  ------------------
 1171|   296M|                    U32 const newMatchIndex = fullPatternFits ?
  ------------------
  |  Branch (1171:47): [True: 79.0M, False: 217M]
  ------------------
 1172|  79.0M|                                              matchCandidateIdx + (U32)forwardPatternLength - (U32)srcPatternLength :
 1173|   296M|                                              matchCandidateIdx - (U32)backLength;
 1174|   296M|                    if (!LZ4HC_protectDictEnd(prefixIdx, newMatchIndex)) {
  ------------------
  |  Branch (1174:25): [True: 8.62k, False: 296M]
  ------------------
 1175|       |                        /* Can only happen if started in the prefix */
 1176|  8.62k|                        assert(newMatchIndex >= prefixIdx - 3 && newMatchIndex < prefixIdx && matchCandidateIdx >= prefixIdx);
  ------------------
  |  Branch (1176:25): [True: 0, False: 8.62k]
  |  Branch (1176:25): [True: 0, False: 0]
  |  Branch (1176:25): [True: 0, False: 0]
  |  Branch (1176:25): [True: 8.62k, False: 0]
  |  Branch (1176:25): [True: 8.62k, False: 0]
  |  Branch (1176:25): [True: 8.62k, False: 0]
  ------------------
 1177|  8.62k|                        matchIndex = prefixIdx;
 1178|  8.62k|                        continue;
 1179|  8.62k|                    }
 1180|   296M|                    matchIndex = newMatchIndex;
 1181|   296M|                    if (!fullPatternFits && lookBackLength==0) {  /* no back possible : the match length is known */
  ------------------
  |  Branch (1181:25): [True: 217M, False: 79.0M]
  |  Branch (1181:45): [True: 199M, False: 18.0M]
  ------------------
 1182|   199M|                        size_t const maxML = MIN(currentSegmentLength, srcPatternLength);
  ------------------
  |  |   91|   199M|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (91:22): [True: 113M, False: 85.7M]
  |  |  ------------------
  ------------------
 1183|   199M|                        if ((size_t)longest < maxML) {
  ------------------
  |  Branch (1183:29): [True: 716k, False: 199M]
  ------------------
 1184|   716k|                            assert(prefixPtr - prefixIdx + matchIndex != ip);
  ------------------
  |  Branch (1184:29): [True: 0, False: 716k]
  |  Branch (1184:29): [True: 716k, False: 0]
  ------------------
 1185|   716k|                            if ((size_t)(ip - prefixPtr) + prefixIdx - matchIndex > LZ4_DISTANCE_MAX) break;
  ------------------
  |  |  745|   716k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1185:33): [True: 0, False: 716k]
  ------------------
 1186|   716k|                            assert(maxML < 2 GB);
  ------------------
  |  Branch (1186:29): [True: 0, False: 716k]
  |  Branch (1186:29): [True: 716k, False: 0]
  ------------------
 1187|   716k|                            longest = (int)maxML;
 1188|   716k|                            offset = (int)(ipIndex - matchIndex);
 1189|   716k|                            assert(sBack == 0);
  ------------------
  |  Branch (1189:29): [True: 0, False: 716k]
  |  Branch (1189:29): [True: 716k, False: 0]
  ------------------
 1190|   716k|                            DEBUGLOG(7, "Found repeat pattern match of len=%i, offset=%i", longest, offset);
  ------------------
  |  |  288|   716k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1191|   716k|                        }
 1192|   199M|                        {   U32 const distToNextPattern = DELTANEXTU16(chainTable, matchIndex);
  ------------------
  |  |  242|   199M|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
 1193|   199M|                            if (distToNextPattern > matchIndex) break;  /* avoid overflow */
  ------------------
  |  Branch (1193:33): [True: 0, False: 199M]
  ------------------
 1194|   199M|                            matchIndex -= distToNextPattern;
 1195|   199M|                    }   }
 1196|   296M|                    continue;
 1197|   296M|                }
 1198|   301M|        }   }   /* PA optimization */
 1199|       |
 1200|       |        /* follow current chain */
 1201|  1.24G|        matchIndex -= DELTANEXTU16(chainTable, matchIndex + matchChainPos);
  ------------------
  |  |  242|  1.24G|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
 1202|       |
 1203|  1.24G|    }  /* while ((matchIndex>=lowestMatchIndex) && (nbAttempts)) */
 1204|       |
 1205|  86.5M|    if ( dict == usingDictCtxHc
  ------------------
  |  Branch (1205:10): [True: 0, False: 86.5M]
  ------------------
 1206|      0|      && nbAttempts > 0
  ------------------
  |  Branch (1206:10): [True: 0, False: 0]
  ------------------
 1207|      0|      && longest < maxLength
  ------------------
  |  Branch (1207:10): [True: 0, False: 0]
  ------------------
 1208|      0|      && withinStartDistance) {
  ------------------
  |  Branch (1208:10): [True: 0, False: 0]
  ------------------
 1209|      0|        size_t const dictEndOffset = (size_t)(dictCtx->end - dictCtx->prefixStart) + dictCtx->dictLimit;
 1210|      0|        U32 dictMatchIndex = dictCtx->hashTable[LZ4HC_hashPtr(ip)];
 1211|      0|        assert(dictEndOffset <= 1 GB);
  ------------------
  |  Branch (1211:9): [True: 0, False: 0]
  |  Branch (1211:9): [True: 0, False: 0]
  ------------------
 1212|      0|        matchIndex = dictMatchIndex + lowestMatchIndex - (U32)dictEndOffset;
 1213|      0|        if (dictMatchIndex>0) DEBUGLOG(7, "dictEndOffset = %zu, dictMatchIndex = %u => relative matchIndex = %i", dictEndOffset, dictMatchIndex, (int)dictMatchIndex - (int)dictEndOffset);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  |  Branch (1213:13): [True: 0, False: 0]
  ------------------
 1214|      0|        while (ipIndex - matchIndex <= LZ4_DISTANCE_MAX && longest < maxLength && nbAttempts--) {
  ------------------
  |  |  745|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1214:16): [True: 0, False: 0]
  |  Branch (1214:60): [True: 0, False: 0]
  |  Branch (1214:83): [True: 0, False: 0]
  ------------------
 1215|      0|            const BYTE* const matchPtr = dictCtx->prefixStart - dictCtx->dictLimit + dictMatchIndex;
 1216|       |
 1217|      0|            if (LZ4_read32(matchPtr) == pattern) {
  ------------------
  |  Branch (1217:17): [True: 0, False: 0]
  ------------------
 1218|      0|                int mlt;
 1219|      0|                int back = 0;
 1220|      0|                const BYTE* vLimit = ip + (dictEndOffset - dictMatchIndex);
 1221|      0|                if (vLimit > iHighLimit) vLimit = iHighLimit;
  ------------------
  |  Branch (1221:21): [True: 0, False: 0]
  ------------------
 1222|      0|                mlt = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
                              mlt = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
                              mlt = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
 1223|      0|                back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, dictCtx->prefixStart) : 0;
  ------------------
  |  Branch (1223:24): [True: 0, False: 0]
  ------------------
 1224|      0|                mlt -= back;
 1225|      0|                if (mlt > longest) {
  ------------------
  |  Branch (1225:21): [True: 0, False: 0]
  ------------------
 1226|      0|                    longest = mlt;
 1227|      0|                    offset = (int)(ipIndex - matchIndex);
 1228|      0|                    sBack = back;
 1229|      0|                    DEBUGLOG(7, "found match of length %i within extDictCtx", longest);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1230|      0|            }   }
 1231|       |
 1232|      0|            {   U32 const nextOffset = DELTANEXTU16(dictCtx->chainTable, dictMatchIndex);
  ------------------
  |  |  242|      0|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
 1233|      0|                dictMatchIndex -= nextOffset;
 1234|      0|                matchIndex -= nextOffset;
 1235|      0|    }   }   }
 1236|       |
 1237|  86.5M|    {   LZ4HC_match_t md;
 1238|  86.5M|        assert(longest >= 0);
  ------------------
  |  Branch (1238:9): [True: 0, False: 86.5M]
  |  Branch (1238:9): [True: 86.5M, False: 0]
  ------------------
 1239|  86.5M|        md.len = longest;
 1240|  86.5M|        md.off = offset;
 1241|  86.5M|        md.back = sBack;
 1242|  86.5M|        return md;
 1243|  86.5M|    }
 1244|  86.5M|}
lz4hc.c:LZ4HC_sparsestChain:
  993|  22.9M|{
  994|  22.9M|    int const kTrigger = 4;
  995|  22.9M|    U32 distanceToNextMatch = 1;
  996|  22.9M|    int const end = longest - MINMATCH + 1;
  ------------------
  |  |  241|  22.9M|#define MINMATCH 4
  ------------------
  997|  22.9M|    int step = 1;
  998|  22.9M|    int accel = 1 << kTrigger;
  999|  22.9M|    int pos;
 1000|  1.16G|    for (pos = 0; pos < end; pos += step) {
  ------------------
  |  Branch (1000:19): [True: 1.13G, False: 22.9M]
  ------------------
 1001|  1.13G|        U32 const candidateDist = DELTANEXTU16(chainTable, matchIndex + (U32)pos);
  ------------------
  |  |  242|  1.13G|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
 1002|  1.13G|        step = (accel++ >> kTrigger);
 1003|  1.13G|        if (candidateDist > distanceToNextMatch) {
  ------------------
  |  Branch (1003:13): [True: 18.6M, False: 1.12G]
  ------------------
 1004|  18.6M|            distanceToNextMatch = candidateDist;
 1005|  18.6M|            *matchChainPosPtr = (U32)pos;
 1006|  18.6M|            accel = 1 << kTrigger;
 1007|  18.6M|    }   }
 1008|  22.9M|    return distanceToNextMatch;
 1009|  22.9M|}
lz4hc.c:LZ4HC_countPattern:
  926|   298M|{
  927|   298M|    const BYTE* const iStart = ip;
  928|   298M|    reg_t const pattern = (sizeof(pattern)==8) ?
  ------------------
  |  Branch (928:27): [True: 298M, Folded]
  ------------------
  929|   298M|        (reg_t)pattern32 + (((reg_t)pattern32) << (sizeof(pattern)*4)) : pattern32;
  930|       |
  931|   610M|    while (likely(ip < iEnd-(sizeof(pattern)-1))) {
  932|   610M|        reg_t const diff = LZ4_read_ARCH(ip) ^ pattern;
  933|   610M|        if (!diff) { ip+=sizeof(pattern); continue; }
  ------------------
  |  Branch (933:13): [True: 312M, False: 298M]
  ------------------
  934|   298M|        ip += LZ4_NbCommonBytes(diff);
  935|   298M|        return (unsigned)(ip - iStart);
  936|   610M|    }
  937|       |
  938|  61.3k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (938:9): [True: 61.3k, False: 0]
  ------------------
  939|  61.3k|        reg_t patternByte = pattern;
  940|   203k|        while ((ip<iEnd) && (*ip == (BYTE)patternByte)) {
  ------------------
  |  Branch (940:16): [True: 160k, False: 43.0k]
  |  Branch (940:29): [True: 141k, False: 18.3k]
  ------------------
  941|   141k|            ip++; patternByte >>= 8;
  942|   141k|        }
  943|  61.3k|    } else {  /* big endian */
  944|      0|        U32 bitOffset = (sizeof(pattern)*8) - 8;
  945|      0|        while (ip < iEnd) {
  ------------------
  |  Branch (945:16): [True: 0, False: 0]
  ------------------
  946|      0|            BYTE const byte = (BYTE)(pattern >> bitOffset);
  947|      0|            if (*ip != byte) break;
  ------------------
  |  Branch (947:17): [True: 0, False: 0]
  ------------------
  948|      0|            ip ++; bitOffset -= 8;
  949|      0|    }   }
  950|       |
  951|  61.3k|    return (unsigned)(ip - iStart);
  952|   298M|}
lz4hc.c:LZ4HC_protectDictEnd:
  980|   593M|{
  981|   593M|    return ((U32)((dictLimit - 1) - matchIndex) >= 3);
  982|   593M|}
lz4hc.c:LZ4HC_patternSegment:
 1020|   297M|{
 1021|   297M|    const BYTE* const prefixPtr = hc4->prefixStart;
 1022|   297M|    U32 const prefixIdx = hc4->dictLimit;
 1023|   297M|    const BYTE* const dictStart = hc4->dictStart;
 1024|   297M|    U32 const dictIdx = hc4->lowLimit;
 1025|   297M|    const BYTE* const dictEnd = dictStart + prefixIdx - dictIdx;
 1026|   297M|    int const extDict = candidateIdx < prefixIdx;
 1027|   297M|    const BYTE* const matchPtr = extDict ? dictStart + (candidateIdx - dictIdx) : prefixPtr + (candidateIdx - prefixIdx);
  ------------------
  |  Branch (1027:34): [True: 29.1M, False: 267M]
  ------------------
 1028|   297M|    size_t forward, back;
 1029|   297M|    if (LZ4_read32(matchPtr) != pattern) return 0;
  ------------------
  |  Branch (1029:9): [True: 135k, False: 296M]
  ------------------
 1030|       |
 1031|   296M|    {   const BYTE* const iLimit = extDict ? dictEnd : iHighLimit;
  ------------------
  |  Branch (1031:36): [True: 29.1M, False: 267M]
  ------------------
 1032|   296M|        forward = LZ4HC_countPattern(matchPtr+sizeof(pattern), iLimit, pattern) + sizeof(pattern);
 1033|   296M|        if (extDict && matchPtr + forward == iLimit) {   /* continues into the prefix */
  ------------------
  |  Branch (1033:13): [True: 29.1M, False: 267M]
  |  Branch (1033:24): [True: 30.9k, False: 29.0M]
  ------------------
 1034|  30.9k|            U32 const rotatedPattern = LZ4HC_rotatePattern(forward, pattern);
 1035|  30.9k|            forward += LZ4HC_countPattern(prefixPtr, iHighLimit, rotatedPattern);
 1036|  30.9k|    }   }
 1037|       |
 1038|   296M|    back = LZ4HC_reverseCountPattern(matchPtr, extDict ? dictStart : prefixPtr, pattern);
  ------------------
  |  Branch (1038:48): [True: 29.1M, False: 267M]
  ------------------
 1039|   296M|    if (!extDict && matchPtr - back == prefixPtr && dictIdx < prefixIdx) {   /* continues into the external dictionary */
  ------------------
  |  Branch (1039:9): [True: 267M, False: 29.1M]
  |  Branch (1039:21): [True: 186k, False: 267M]
  |  Branch (1039:53): [True: 124k, False: 62.3k]
  ------------------
 1040|   124k|        U32 const rotatedPattern = LZ4HC_rotatePattern((U32)(-(int)back), pattern);
 1041|   124k|        back += LZ4HC_reverseCountPattern(dictEnd, dictStart, rotatedPattern);
 1042|   124k|    }
 1043|       |    /* don't go below lowestMatchIndex */
 1044|   296M|    back = candidateIdx - MAX(candidateIdx - (U32)back, lowestMatchIndex);
  ------------------
  |  |   93|   296M|#define MAX(a,b)   ( (a) > (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (93:22): [True: 296M, False: 194k]
  |  |  ------------------
  ------------------
 1045|   296M|    assert(candidateIdx - back >= lowestMatchIndex);
  ------------------
  |  Branch (1045:5): [True: 0, False: 296M]
  |  Branch (1045:5): [True: 296M, False: 0]
  ------------------
 1046|       |
 1047|   296M|    *forwardPtr = forward;
 1048|   296M|    *backPtr = back;
 1049|   296M|    return 1;
 1050|   296M|}
lz4hc.c:LZ4HC_rotatePattern:
  916|   155k|{
  917|   155k|    size_t const bitsToRotate = (rotate & (sizeof(pattern) - 1)) << 3;
  918|   155k|    if (bitsToRotate == 0) return pattern;
  ------------------
  |  Branch (918:9): [True: 37.0k, False: 118k]
  ------------------
  919|   118k|    return LZ4HC_rotl32(pattern, (int)bitsToRotate);
  ------------------
  |  |  911|   118k|#  define LZ4HC_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  920|   155k|}
lz4hc.c:LZ4HC_reverseCountPattern:
  959|   297M|{
  960|   297M|    const BYTE* const iStart = ip;
  961|       |
  962|  4.49G|    while (likely(ip >= iLow+4)) {
  963|  4.49G|        if (LZ4_read32(ip-4) != pattern) break;
  ------------------
  |  Branch (963:13): [True: 296M, False: 4.19G]
  ------------------
  964|  4.19G|        ip -= 4;
  965|  4.19G|    }
  966|   297M|    {   const BYTE* bytePtr = (const BYTE*)(&pattern) + 3; /* works for any endianness */
  967|   758M|        while (likely(ip>iLow)) {
  968|   758M|            if (ip[-1] != *bytePtr) break;
  ------------------
  |  Branch (968:17): [True: 296M, False: 462M]
  ------------------
  969|   462M|            ip--; bytePtr--;
  970|   462M|    }   }
  971|   297M|    return (unsigned)(iStart - ip);
  972|   297M|}
lz4hc.c:LZ4HC_compress_optimal:
 2208|  6.88k|{
 2209|  6.88k|    LZ4_STATIC_ASSERT(LZ4_STREAMHC_EXTSIZE == sizeof(LZ4_streamHC_t) + sizeof(LZ4HC_optimal_t) * (LZ4_OPT_NUM + TRAILING_LITERALS));
  ------------------
  |  |  276|  6.88k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2210|  6.88k|    if (ctx->hasWorkspace) {   /* extended state : the buffer follows it */
  ------------------
  |  Branch (2210:9): [True: 6.88k, False: 0]
  ------------------
 2211|  6.88k|        LZ4HC_optimal_t* const opt = (LZ4HC_optimal_t*)(void*)((BYTE*)ctx + sizeof(LZ4_streamHC_t));
 2212|  6.88k|        return LZ4HC_compress_optimal_internal(ctx, source, dst, srcSizePtr, dstCapacity,
 2213|  6.88k|                    nbSearches, nbSearchesSeq, targetLength, limit, dict, favorDecSpeed, opt);
 2214|  6.88k|    }
 2215|      0|  { /* plain state */
 2216|      0|#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1
 2217|      0|    LZ4HC_optimal_t* const opt = (LZ4HC_optimal_t*)ALLOC(sizeof(LZ4HC_optimal_t) * (LZ4_OPT_NUM + TRAILING_LITERALS));
  ------------------
  |  |  224|      0|# define ALLOC(s)          malloc(s)
  ------------------
 2218|      0|    int result;
 2219|      0|    if (opt == NULL) return 0;
  ------------------
  |  Branch (2219:9): [True: 0, False: 0]
  ------------------
 2220|      0|    result = LZ4HC_compress_optimal_internal(ctx, source, dst, srcSizePtr, dstCapacity,
 2221|      0|                    nbSearches, nbSearchesSeq, targetLength, limit, dict, favorDecSpeed, opt);
 2222|      0|    FREEMEM(opt);
  ------------------
  |  |  226|      0|# define FREEMEM(p)        free(p)
  ------------------
 2223|      0|    return result;
 2224|       |#else
 2225|       |    LZ4HC_optimal_t opt[LZ4_OPT_NUM + TRAILING_LITERALS];   /* ~64 KB, which can be a bit large for some stacks... */
 2226|       |    return LZ4HC_compress_optimal_internal(ctx, source, dst, srcSizePtr, dstCapacity,
 2227|       |                    nbSearches, nbSearchesSeq, targetLength, limit, dict, favorDecSpeed, opt);
 2228|       |#endif
 2229|      0|  }
 2230|      0|}
lz4hc.c:LZ4HC_compress_optimal_internal:
 2061|  6.88k|{
 2062|  6.88k|    const BYTE* ip = (const BYTE*) source;
 2063|  6.88k|    const BYTE* anchor = ip;
 2064|  6.88k|    const int inputSize = *srcSizePtr;
 2065|  6.88k|    const BYTE* const iend = ip + inputSize;
 2066|  6.88k|    const BYTE* mflimit;      /* set after the size check : would precede a small input */
 2067|  6.88k|    const BYTE* matchlimit;
 2068|  6.88k|    BYTE* op = (BYTE*) dst;
 2069|       |    /* fillOutput : keep room for the final run of literals (LZ4 format restriction) */
 2070|  6.88k|    BYTE* const oend = op + dstCapacity - ((limit == fillOutput) ? LASTLITERALS : 0);
  ------------------
  |  |  244|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2070:44): [True: 0, False: 6.88k]
  ------------------
 2071|  6.88k|    int const sufficientLen = MIN(targetLength, LZ4_OPT_NUM-1);
  ------------------
  |  |   91|  6.88k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (91:22): [True: 1.90k, False: 4.97k]
  |  |  ------------------
  ------------------
 2072|       |
 2073|  6.88k|    DEBUGLOG(5, "LZ4HC_compress_optimal(dst=%p, dstCapa=%u)", dst, (unsigned)dstCapacity);
  ------------------
  |  |  288|  6.88k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2074|       |
 2075|       |    /* preconditions verifications */
 2076|  6.88k|    assert(dstCapacity > 0);
  ------------------
  |  Branch (2076:5): [True: 0, False: 6.88k]
  |  Branch (2076:5): [True: 6.88k, False: 0]
  ------------------
 2077|  6.88k|    assert(dst != NULL);
  ------------------
  |  Branch (2077:5): [True: 0, False: 6.88k]
  |  Branch (2077:5): [True: 6.88k, False: 0]
  ------------------
 2078|  6.88k|    assert(*srcSizePtr > 0);
  ------------------
  |  Branch (2078:5): [True: 0, False: 6.88k]
  |  Branch (2078:5): [True: 6.88k, False: 0]
  ------------------
 2079|  6.88k|    assert(source != NULL);
  ------------------
  |  Branch (2079:5): [True: 0, False: 6.88k]
  |  Branch (2079:5): [True: 6.88k, False: 0]
  ------------------
 2080|  6.88k|    assert(opt != NULL);
  ------------------
  |  Branch (2080:5): [True: 0, False: 6.88k]
  |  Branch (2080:5): [True: 6.88k, False: 0]
  ------------------
 2081|  6.88k|    assert(nbSearchesSeq >= 1);
  ------------------
  |  Branch (2081:5): [True: 0, False: 6.88k]
  |  Branch (2081:5): [True: 6.88k, False: 0]
  ------------------
 2082|       |
 2083|  6.88k|    *srcSizePtr = 0;
 2084|  6.88k|    if (inputSize < LZ4_minLength) goto _last_literals;
  ------------------
  |  Branch (2084:9): [True: 572, False: 6.31k]
  ------------------
 2085|  6.31k|    mflimit = iend - MFLIMIT;
  ------------------
  |  |  245|  6.31k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2086|  6.31k|    matchlimit = iend - LASTLITERALS;
  ------------------
  |  |  244|  6.31k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2087|       |
 2088|       |    /* Main Loop */
 2089|  32.1M|    while (ip <= mflimit) {
  ------------------
  |  Branch (2089:12): [True: 32.1M, False: 6.28k]
  ------------------
 2090|  32.1M|        int const llen = LZ4HC_pricedLitlen((int)(ip - anchor));
 2091|  32.1M|        int cur, lastPos;
 2092|  32.1M|        int lastSeqPos;         /* position of the last sequence to encode */
 2093|  32.1M|        LZ4HC_match_t lastSeq;
 2094|       |
 2095|  32.1M|        LZ4HC_match_t const firstMatch = LZ4HC_FindLongestMatch(ctx, ip, matchlimit, nbSearches, dict, favorDecSpeed);
 2096|  32.1M|        if (firstMatch.len==0) { ip++; continue; }
  ------------------
  |  Branch (2096:13): [True: 31.0M, False: 1.12M]
  ------------------
 2097|       |
 2098|  1.12M|        if (firstMatch.len > sufficientLen) {
  ------------------
  |  Branch (2098:13): [True: 33.2k, False: 1.09M]
  ------------------
 2099|       |            /* good enough solution : immediate encoding */
 2100|  33.2k|            lastSeqPos = 0;
 2101|  33.2k|            lastSeq = firstMatch;
 2102|  33.2k|            goto encode;
 2103|  33.2k|        }
 2104|       |
 2105|       |        /* set prices for first positions (literals) */
 2106|  1.09M|        {   int rPos;
 2107|  5.48M|            for (rPos = 0 ; rPos < MINMATCH ; rPos++)
  ------------------
  |  |  241|  5.48M|#define MINMATCH 4
  ------------------
  |  Branch (2107:29): [True: 4.38M, False: 1.09M]
  ------------------
 2108|  4.38M|                LZ4HC_setLiteral(opt, rPos, llen + rPos, LZ4HC_literalsPrice(llen + rPos));
 2109|  1.09M|        }
 2110|  1.09M|        lastPos = LZ4HC_addMatch(opt, 0, firstMatch, 0, favorDecSpeed);
 2111|       |
 2112|       |        /* check further positions */
 2113|  65.6M|        for (cur = 1; cur < lastPos; cur++) {
  ------------------
  |  Branch (2113:23): [True: 64.5M, False: 1.08M]
  ------------------
 2114|  64.5M|            const BYTE* const curPtr = ip + cur;
 2115|  64.5M|            LZ4HC_match_t newMatch;
 2116|  64.5M|            int nbS = nbSearches;
 2117|       |
 2118|  64.5M|            if (curPtr > mflimit) break;
  ------------------
  |  Branch (2118:17): [True: 4.10k, False: 64.5M]
  ------------------
 2119|  64.5M|            DEBUGLOG(7, "rPos:%u[%u] vs [%u]%u",
  ------------------
  |  |  288|  64.5M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2120|  64.5M|                    cur, opt[cur].price, opt[cur+1].price, cur+1);
 2121|       |            /* not useful to search here if next position has same (or lower) cost */
 2122|  64.5M|            if (opt[cur+1].price <= opt[cur].price) continue;
  ------------------
  |  Branch (2122:17): [True: 60.1M, False: 4.38M]
  ------------------
 2123|       |            /* favorDecSpeed : next position costs less than one more byte, the difference comes from sequences.
 2124|       |             * A match starting here might save some : worth a cheaper search, if close to lastPos */
 2125|  4.38M|            if (favorDecSpeed && (opt[cur+1].price < opt[cur].price + LZ4HC_PRICE_SCALE)) {
  ------------------
  |  | 1914|  2.13M|#define LZ4HC_PRICE_SCALE 4
  ------------------
  |  Branch (2125:17): [True: 2.13M, False: 2.24M]
  |  Branch (2125:34): [True: 617k, False: 1.51M]
  ------------------
 2126|   617k|                if (lastPos - cur > LZ4HC_SEQ_SEARCH_DIST) continue;
  ------------------
  |  | 1923|   617k|#define LZ4HC_SEQ_SEARCH_DIST  4
  ------------------
  |  Branch (2126:21): [True: 426k, False: 191k]
  ------------------
 2127|   191k|                nbS = nbSearchesSeq;
 2128|   191k|            }
 2129|       |
 2130|  3.95M|            newMatch = LZ4HC_FindLongestMatch(ctx, curPtr, matchlimit, nbS, dict, favorDecSpeed);
 2131|  3.95M|            if (!newMatch.len) continue;
  ------------------
  |  Branch (2131:17): [True: 700k, False: 3.25M]
  ------------------
 2132|       |
 2133|  3.25M|            if ( (newMatch.len > sufficientLen)
  ------------------
  |  Branch (2133:18): [True: 4.96k, False: 3.25M]
  ------------------
 2134|  3.25M|              || (newMatch.len + cur >= LZ4_OPT_NUM) ) {
  ------------------
  |  |   86|  3.25M|#define LZ4_OPT_NUM   (1<<12)
  ------------------
  |  Branch (2134:18): [True: 1.14k, False: 3.25M]
  ------------------
 2135|       |                /* immediate encoding */
 2136|  6.11k|                lastSeqPos = cur;
 2137|  6.11k|                lastSeq = newMatch;
 2138|  6.11k|                goto encode;
 2139|  6.11k|            }
 2140|       |
 2141|  3.25M|            lastPos = LZ4HC_addMatch(opt, cur, newMatch, lastPos, favorDecSpeed);
 2142|  3.25M|        }  /* for (cur = 1; cur < lastPos; cur++) */
 2143|       |
 2144|  1.09M|        assert(lastPos < LZ4_OPT_NUM + TRAILING_LITERALS);
  ------------------
  |  Branch (2144:9): [True: 0, False: 1.09M]
  |  Branch (2144:9): [True: 1.09M, False: 0]
  ------------------
 2145|  1.09M|        lastSeq.len = opt[lastPos].mlen;
 2146|  1.09M|        lastSeq.off = opt[lastPos].off;
 2147|  1.09M|        lastSeqPos = lastPos - lastSeq.len;
 2148|       |
 2149|  1.12M|encode: /* lastSeqPos and lastSeq must be set */
 2150|  1.12M|        assert(0 <= lastSeqPos && lastSeqPos < LZ4_OPT_NUM);
  ------------------
  |  Branch (2150:9): [True: 0, False: 1.12M]
  |  Branch (2150:9): [True: 0, False: 0]
  |  Branch (2150:9): [True: 1.12M, False: 0]
  |  Branch (2150:9): [True: 1.12M, False: 0]
  ------------------
 2151|  1.12M|        DEBUGLOG(6, "reverse traversal, looking for shortest path (lastSeqPos=%i)", lastSeqPos);
  ------------------
  |  |  288|  1.12M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2152|       |        /* opt[pos] describes the step ending at pos.
 2153|       |         * Walk the path backward, moving each step to its starting position instead */
 2154|  1.12M|        {   int pos = lastSeqPos;
 2155|  1.12M|            int mlen = lastSeq.len;
 2156|  1.12M|            int off = lastSeq.off;
 2157|  1.79M|            while (pos > 0) {
  ------------------
  |  Branch (2157:20): [True: 662k, False: 1.12M]
  ------------------
 2158|   662k|                int const prevMlen = opt[pos].mlen;
 2159|   662k|                int const prevOff = opt[pos].off;
 2160|   662k|                opt[pos].mlen = mlen;
 2161|   662k|                opt[pos].off = off;
 2162|   662k|                mlen = prevMlen;
 2163|   662k|                off = prevOff;
 2164|   662k|                assert(0 < mlen && mlen <= pos);
  ------------------
  |  Branch (2164:17): [True: 0, False: 662k]
  |  Branch (2164:17): [True: 0, False: 0]
  |  Branch (2164:17): [True: 662k, False: 0]
  |  Branch (2164:17): [True: 662k, False: 0]
  ------------------
 2165|   662k|                pos -= mlen;
 2166|   662k|            }
 2167|       |            /* first step of the path; note : opt[0] isn't necessarily initialized */
 2168|  1.12M|            opt[0].mlen = mlen;
 2169|  1.12M|            opt[0].off = off;
 2170|  1.12M|        }
 2171|       |
 2172|       |        /* encode all recorded sequences in order */
 2173|  1.12M|        {   int rPos = 0;  /* relative position (to ip) */
 2174|  2.92M|            while (rPos <= lastSeqPos) {
  ------------------
  |  Branch (2174:20): [True: 1.79M, False: 1.12M]
  ------------------
 2175|  1.79M|                int const ml = opt[rPos].mlen;
 2176|  1.79M|                int const offset = opt[rPos].off;
 2177|  1.79M|                if (ml == 1) { ip++; rPos++; continue; }  /* literal */
  ------------------
  |  Branch (2177:21): [True: 387k, False: 1.40M]
  ------------------
 2178|  1.40M|                rPos += ml;
 2179|  1.40M|                assert(ml >= MINMATCH);
  ------------------
  |  Branch (2179:17): [True: 0, False: 1.40M]
  |  Branch (2179:17): [True: 1.40M, False: 0]
  ------------------
 2180|  1.40M|                assert((offset >= 1) && (offset <= LZ4_DISTANCE_MAX));
  ------------------
  |  Branch (2180:17): [True: 0, False: 1.40M]
  |  Branch (2180:17): [True: 0, False: 0]
  |  Branch (2180:17): [True: 1.40M, False: 0]
  |  Branch (2180:17): [True: 1.40M, False: 0]
  ------------------
 2181|  1.40M|                if ( LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml, offset, limit, oend) ) {  /* updates ip, op and anchor */
  ------------------
  |  |  244|  1.40M|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (2181:22): [True: 25, False: 1.40M]
  ------------------
 2182|     25|                    if (limit != fillOutput) return 0;  /* compression failed */
  ------------------
  |  Branch (2182:25): [True: 25, False: 0]
  ------------------
 2183|      0|                    LZ4HC_encodeLastSequence_fillOutput(UPDATABLE(ip, op, anchor), ml, offset, oend);
  ------------------
  |  |  244|      0|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
 2184|      0|                    goto _last_literals;
 2185|     25|        }   }   }
 2186|  1.12M|    }  /* while (ip <= mflimit) */
 2187|       |
 2188|  6.86k|_last_literals:
 2189|  6.86k|    if (LZ4HC_encodeLastLiterals(UPDATABLE(ip, op, anchor), iend, limit, oend))
  ------------------
  |  |  244|  6.86k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (2189:9): [True: 1.19k, False: 5.67k]
  ------------------
 2190|  1.19k|        return 0;  /* not enough space in @dst */
 2191|       |
 2192|       |    /* End */
 2193|  5.67k|    *srcSizePtr = (int) (((const char*)ip) - source);
 2194|  5.67k|    return (int) ((char*)op-dst);
 2195|  6.86k|}
lz4hc.c:LZ4HC_pricedLitlen:
 1953|  32.1M|{
 1954|  32.1M|    int const reduceFrom = (int)RUN_MASK + 255;
  ------------------
  |  |  262|  32.1M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  32.1M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  32.1M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1955|  32.1M|    assert(llen >= 0);
  ------------------
  |  Branch (1955:5): [True: 0, False: 32.1M]
  |  Branch (1955:5): [True: 32.1M, False: 0]
  ------------------
 1956|  32.1M|    if (llen < reduceFrom) return llen;
  ------------------
  |  Branch (1956:9): [True: 8.92M, False: 23.2M]
  ------------------
 1957|  23.2M|    return reduceFrom + ((llen - (int)RUN_MASK) % 255);
  ------------------
  |  |  262|  23.2M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  23.2M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  23.2M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1958|  32.1M|}
lz4hc.c:LZ4HC_FindLongestMatch:
 1966|  36.0M|{
 1967|  36.0M|    LZ4HC_match_t const match0 = { 0 , 0, 0 };
 1968|       |    /* note : LZ4HC_InsertAndGetWiderMatch() can extend a match backward (md.back < 0),
 1969|       |     * but not here, since iLowLimit == ip */
 1970|  36.0M|    LZ4HC_match_t md = LZ4HC_InsertAndGetWiderMatch(ctx, ip, ip, iHighLimit, MINMATCH-1, nbSearches, 1 /*patternAnalysis*/, 1 /*chainSwap*/, dict, favorDecSpeed);
  ------------------
  |  |  241|  36.0M|#define MINMATCH 4
  ------------------
 1971|  36.0M|    assert(md.back == 0);
  ------------------
  |  Branch (1971:5): [True: 0, False: 36.0M]
  |  Branch (1971:5): [True: 36.0M, False: 0]
  ------------------
 1972|  36.0M|    if (md.len < MINMATCH) return match0;
  ------------------
  |  |  241|  36.0M|#define MINMATCH 4
  ------------------
  |  Branch (1972:9): [True: 31.7M, False: 4.38M]
  ------------------
 1973|  4.38M|    if (favorDecSpeed) {
  ------------------
  |  Branch (1973:9): [True: 1.95M, False: 2.43M]
  ------------------
 1974|  1.95M|        if ((md.len>18) & (md.len<=36)) md.len=18;   /* favor dec.speed (shortcut) */
  ------------------
  |  Branch (1974:13): [True: 429k, False: 1.52M]
  ------------------
 1975|  1.95M|    }
 1976|  4.38M|    return md;
 1977|  36.0M|}
lz4hc.c:LZ4HC_setLiteral:
 1981|  17.4M|{
 1982|  17.4M|    opt[pos].mlen = 1;
 1983|  17.4M|    opt[pos].off = 0;
 1984|  17.4M|    opt[pos].litlen = litlen;
 1985|  17.4M|    opt[pos].price = price;
 1986|  17.4M|    DEBUGLOG(7, "rPos:%3i => price:%3i (litlen=%i)", pos, price, litlen);
  ------------------
  |  |  288|  17.4M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1987|  17.4M|}
lz4hc.c:LZ4HC_literalsPrice:
 1926|   382M|{
 1927|   382M|    int price = litlen;
 1928|   382M|    assert(litlen >= 0);
  ------------------
  |  Branch (1928:5): [True: 0, False: 382M]
  |  Branch (1928:5): [True: 382M, False: 0]
  ------------------
 1929|   382M|    if (litlen >= (int)RUN_MASK)
  ------------------
  |  |  262|   382M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   382M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|   382M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1929:9): [True: 4.20M, False: 378M]
  ------------------
 1930|  4.20M|        price += 1 + ((litlen-(int)RUN_MASK) / 255);
  ------------------
  |  |  262|  4.20M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  4.20M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  4.20M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1931|   382M|    return price * LZ4HC_PRICE_SCALE;
  ------------------
  |  | 1914|   382M|#define LZ4HC_PRICE_SCALE 4
  ------------------
 1932|   382M|}
lz4hc.c:LZ4HC_addMatch:
 2014|  4.34M|{
 2015|  4.34M|    int const ll = opt[cur].litlen;
 2016|  4.34M|    int const basePrice = LZ4HC_runStartPrice(opt, cur) + (favorDecSpeed ? LZ4HC_SEQ_PRICE_FDS : 0);
  ------------------
  |  | 1922|  1.92M|#define LZ4HC_SEQ_PRICE_FDS    1
  ------------------
  |  Branch (2016:60): [True: 1.92M, False: 2.42M]
  ------------------
 2017|  4.34M|    int ml;
 2018|  4.34M|    assert(cur + match.len < LZ4_OPT_NUM);
  ------------------
  |  Branch (2018:5): [True: 0, False: 4.34M]
  |  Branch (2018:5): [True: 4.34M, False: 0]
  ------------------
 2019|  4.34M|    assert((U32)favorDecSpeed <= 1);
  ------------------
  |  Branch (2019:5): [True: 0, False: 4.34M]
  |  Branch (2019:5): [True: 4.34M, False: 0]
  ------------------
 2020|   369M|    for (ml = MINMATCH; ml <= match.len; ml++) {
  ------------------
  |  |  241|  4.34M|#define MINMATCH 4
  ------------------
  |  Branch (2020:25): [True: 365M, False: 4.34M]
  ------------------
 2021|   365M|        int const pos = cur + ml;
 2022|   365M|        int const price = basePrice + LZ4HC_sequencePrice(ll, ml);
 2023|       |        /* on equal price, favorDecSpeed keeps the existing solution */
 2024|   365M|        if ( pos > lastPos + TRAILING_LITERALS
  ------------------
  |  | 1910|   730M|#define TRAILING_LITERALS 3
  ------------------
  |  Branch (2024:14): [True: 62.7M, False: 302M]
  ------------------
 2025|   302M|          || price <= opt[pos].price - (int)favorDecSpeed) {
  ------------------
  |  Branch (2025:14): [True: 8.16M, False: 294M]
  ------------------
 2026|  70.8M|            LZ4HC_setMatch(opt, pos, ml, match.off, price);
 2027|  70.8M|            if ((ml == match.len) && (lastPos < pos)) lastPos = pos;
  ------------------
  |  Branch (2027:17): [True: 2.01M, False: 68.8M]
  |  Branch (2027:38): [True: 1.98M, False: 31.1k]
  ------------------
 2028|  70.8M|    }   }
 2029|       |
 2030|       |    /* complete following positions with literals */
 2031|  4.34M|    {   int addLit;
 2032|  4.34M|        assert(opt[lastPos].mlen >= MINMATCH);
  ------------------
  |  Branch (2032:9): [True: 0, False: 4.34M]
  |  Branch (2032:9): [True: 4.34M, False: 0]
  ------------------
 2033|  17.3M|        for (addLit = 1; addLit <= TRAILING_LITERALS; addLit++)
  ------------------
  |  | 1910|  17.3M|#define TRAILING_LITERALS 3
  ------------------
  |  Branch (2033:26): [True: 13.0M, False: 4.34M]
  ------------------
 2034|  13.0M|            LZ4HC_setLiteral(opt, lastPos + addLit, addLit,
 2035|  13.0M|                             opt[lastPos].price + LZ4HC_literalsPrice(addLit));
 2036|  4.34M|    }
 2037|  4.34M|    return lastPos;
 2038|  4.34M|}
lz4hc.c:LZ4HC_runStartPrice:
 2002|  4.34M|{
 2003|  4.34M|    int const ll = opt[pos].litlen;
 2004|  4.34M|    return (ll <= pos) ? opt[pos - ll].price : 0;
  ------------------
  |  Branch (2004:12): [True: 2.67M, False: 1.67M]
  ------------------
 2005|  4.34M|}
lz4hc.c:LZ4HC_sequencePrice:
 1936|   365M|{
 1937|   365M|    int price = 1 + 2 ; /* token + 16-bit offset */
 1938|   365M|    assert(litlen >= 0);
  ------------------
  |  Branch (1938:5): [True: 0, False: 365M]
  |  Branch (1938:5): [True: 365M, False: 0]
  ------------------
 1939|   365M|    assert(mlen >= MINMATCH);
  ------------------
  |  Branch (1939:5): [True: 0, False: 365M]
  |  Branch (1939:5): [True: 365M, False: 0]
  ------------------
 1940|       |
 1941|   365M|    if (mlen >= (int)(ML_MASK+MINMATCH))
  ------------------
  |  |  260|   365M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|   365M|#define ML_BITS  4
  |  |  ------------------
  ------------------
                  if (mlen >= (int)(ML_MASK+MINMATCH))
  ------------------
  |  |  241|   365M|#define MINMATCH 4
  ------------------
  |  Branch (1941:9): [True: 327M, False: 38.2M]
  ------------------
 1942|   327M|        price += 1 + ((mlen-(int)(ML_MASK+MINMATCH)) / 255);
  ------------------
  |  |  260|   327M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|   327M|#define ML_BITS  4
  |  |  ------------------
  ------------------
                      price += 1 + ((mlen-(int)(ML_MASK+MINMATCH)) / 255);
  ------------------
  |  |  241|   327M|#define MINMATCH 4
  ------------------
 1943|       |
 1944|   365M|    return price * LZ4HC_PRICE_SCALE + LZ4HC_literalsPrice(litlen);
  ------------------
  |  | 1914|   365M|#define LZ4HC_PRICE_SCALE 4
  ------------------
 1945|   365M|}
lz4hc.c:LZ4HC_setMatch:
 1991|  70.8M|{
 1992|  70.8M|    opt[pos].mlen = mlen;
 1993|  70.8M|    opt[pos].off = off;
 1994|  70.8M|    opt[pos].litlen = 0;
 1995|  70.8M|    opt[pos].price = price;
 1996|  70.8M|    DEBUGLOG(7, "rPos:%3i => price:%3i (matchlen=%i)", pos, price, mlen);
  ------------------
  |  |  288|  70.8M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1997|  70.8M|}
lz4hc.c:LZ4HC_dropPositions:
  614|     45|{
  615|     45|    U32* const hashTable = ctx->hashTable;
  616|     45|    U32 const startIdx = ctx->dictLimit + (U32)(start - ctx->prefixStart);
  617|     45|    if (end - start > LZ4HC_HASHTABLESIZE) {
  ------------------
  |  |  239|     45|#define LZ4HC_HASHTABLESIZE (1 << LZ4HC_HASH_LOG)
  |  |  ------------------
  |  |  |  |  238|     45|#define LZ4HC_HASH_LOG 15
  |  |  ------------------
  ------------------
  |  Branch (617:9): [True: 0, False: 45]
  ------------------
  618|      0|        int i;
  619|      0|        for (i = 0; i < LZ4HC_HASHTABLESIZE; i++) {
  ------------------
  |  |  239|      0|#define LZ4HC_HASHTABLESIZE (1 << LZ4HC_HASH_LOG)
  |  |  ------------------
  |  |  |  |  238|      0|#define LZ4HC_HASH_LOG 15
  |  |  ------------------
  ------------------
  |  Branch (619:21): [True: 0, False: 0]
  ------------------
  620|       |            /* branchless, so that it can be vectorized */
  621|      0|            hashTable[i] = (hashTable[i] >= startIdx) ? 0 : hashTable[i];
  ------------------
  |  Branch (621:28): [True: 0, False: 0]
  ------------------
  622|      0|        }
  623|     45|    } else {
  624|     45|        U32 idx = startIdx;
  625|     45|        const BYTE* p;
  626|     45|        for (p = start; p < end; p++, idx++) {
  ------------------
  |  Branch (626:25): [True: 0, False: 45]
  ------------------
  627|      0|            if (strat == lz4mid) {
  ------------------
  |  Branch (627:17): [True: 0, False: 0]
  ------------------
  628|      0|                U32 const h4 = LZ4MID_hash4Ptr(p);
  629|      0|                U32 const h8 = LZ4MID_HASHTABLESIZE + LZ4MID_hash8Ptr(p);
  ------------------
  |  |  157|      0|#define LZ4MID_HASHTABLESIZE (1 << LZ4MID_HASHLOG)
  |  |  ------------------
  |  |  |  |  156|      0|#define LZ4MID_HASHLOG (LZ4HC_HASH_LOG-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  238|      0|#define LZ4HC_HASH_LOG 15
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  630|      0|                if (hashTable[h4] == idx) hashTable[h4] = 0;
  ------------------
  |  Branch (630:21): [True: 0, False: 0]
  ------------------
  631|      0|                if (hashTable[h8] == idx) hashTable[h8] = 0;
  ------------------
  |  Branch (631:21): [True: 0, False: 0]
  ------------------
  632|      0|            } else {
  633|      0|                U32 const h = LZ4HC_hashPtr(p);
  634|      0|                if (hashTable[h] == idx) hashTable[h] = 0;
  ------------------
  |  Branch (634:21): [True: 0, False: 0]
  ------------------
  635|      0|    }   }   }
  636|     45|}
lz4hc.c:LZ4HC_setExternalDict:
 1786|  3.52k|{
 1787|  3.52k|    DEBUGLOG(4, "LZ4HC_setExternalDict(%p, %p)", ctxPtr, newBlock);
  ------------------
  |  |  288|  3.52k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1788|  3.52k|    if (LZ4HC_getCLevelParams(ctxPtr->compressionLevel).strat != lz4mid) {
  ------------------
  |  Branch (1788:9): [True: 2.57k, False: 952]
  ------------------
 1789|  2.57k|        U32 const endIdx = ctxPtr->dictLimit + (U32)(ctxPtr->end - ctxPtr->prefixStart);
 1790|  2.57k|        U32 idx;
 1791|  2.57k|        if (ctxPtr->end >= ctxPtr->prefixStart + 4)
  ------------------
  |  Branch (1791:13): [True: 2.57k, False: 0]
  ------------------
 1792|  2.57k|            LZ4HC_Insert (ctxPtr, ctxPtr->end-3);  /* Referencing remaining dictionary content */
 1793|       |        /* last positions can't be inserted : don't leave stale chains from previous history */
 1794|  10.2k|        for (idx = ctxPtr->nextToUpdate; idx < endIdx; idx++)
  ------------------
  |  Branch (1794:42): [True: 7.71k, False: 2.57k]
  ------------------
 1795|  7.71k|            DELTANEXTU16(ctxPtr->chainTable, idx) = 0;
  ------------------
  |  |  242|  7.71k|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
 1796|  2.57k|    }
 1797|       |
 1798|       |    /* Only one memory segment for extDict, so any previous extDict is lost at this stage */
 1799|  3.52k|    ctxPtr->lowLimit  = ctxPtr->dictLimit;
 1800|  3.52k|    ctxPtr->dictStart  = ctxPtr->prefixStart;
 1801|  3.52k|    ctxPtr->dictLimit += (U32)(ctxPtr->end - ctxPtr->prefixStart);
 1802|  3.52k|    ctxPtr->prefixStart = newBlock;
 1803|  3.52k|    ctxPtr->end  = newBlock;
 1804|  3.52k|    ctxPtr->nextToUpdate = ctxPtr->dictLimit;   /* match referencing will resume from there */
 1805|       |
 1806|       |    /* cannot reference an extDict and a dictCtx at the same time */
 1807|       |    ctxPtr->dictCtx = NULL;
 1808|  3.52k|}
lz4hc.c:LZ4HC_getCLevelParams:
  123|  23.3k|{
  124|       |    /* note : clevel convention is a bit different from lz4frame,
  125|       |     * possibly something worth revisiting for consistency */
  126|  23.3k|    if (cLevel < 1)
  ------------------
  |  Branch (126:9): [True: 0, False: 23.3k]
  ------------------
  127|      0|        cLevel = LZ4HC_CLEVEL_DEFAULT;
  ------------------
  |  |   47|      0|#define LZ4HC_CLEVEL_DEFAULT     9
  ------------------
  128|  23.3k|    cLevel = MIN(LZ4HC_CLEVEL_MAX, cLevel);
  ------------------
  |  |   91|  23.3k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (91:22): [True: 0, False: 23.3k]
  |  |  ------------------
  ------------------
  129|  23.3k|    return k_clTable[cLevel];
  130|  23.3k|}
lz4hc.c:LZ4HC_Insert:
  886|  86.5M|{
  887|  86.5M|    U16* const chainTable = hc4->chainTable;
  888|  86.5M|    U32* const hashTable  = hc4->hashTable;
  889|  86.5M|    const BYTE* const prefixPtr = hc4->prefixStart;
  890|  86.5M|    U32 const prefixIdx = hc4->dictLimit;
  891|  86.5M|    U32 const target = (U32)(ip - prefixPtr) + prefixIdx;
  892|  86.5M|    U32 idx = hc4->nextToUpdate;
  893|  86.5M|    assert(ip >= prefixPtr);
  ------------------
  |  Branch (893:5): [True: 0, False: 86.5M]
  |  Branch (893:5): [True: 86.5M, False: 0]
  ------------------
  894|  86.5M|    assert(target >= prefixIdx);
  ------------------
  |  Branch (894:5): [True: 0, False: 86.5M]
  |  Branch (894:5): [True: 86.5M, False: 0]
  ------------------
  895|       |
  896|   550M|    while (idx < target) {
  ------------------
  |  Branch (896:12): [True: 464M, False: 86.5M]
  ------------------
  897|   464M|        U32 const h = LZ4HC_hashPtr(prefixPtr+idx-prefixIdx);
  898|   464M|        size_t delta = idx - hashTable[h];
  899|   464M|        if (delta>LZ4_DISTANCE_MAX) delta = LZ4_DISTANCE_MAX;
  ------------------
  |  |  745|   464M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                      if (delta>LZ4_DISTANCE_MAX) delta = LZ4_DISTANCE_MAX;
  ------------------
  |  |  745|  32.9M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (899:13): [True: 32.9M, False: 431M]
  ------------------
  900|   464M|        DELTANEXTU16(chainTable, idx) = (U16)delta;
  ------------------
  |  |  242|   464M|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
  901|   464M|        hashTable[h] = idx;
  902|   464M|        idx++;
  903|   464M|    }
  904|       |
  905|  86.5M|    hc4->nextToUpdate = target;
  906|  86.5M|}
lz4hc.c:LZ4_compressHC_continue_generic:
 1815|  14.4k|{
 1816|  14.4k|    LZ4HC_CCtx_internal* const ctxPtr = &LZ4_streamHCPtr->internal_donotuse;
 1817|  14.4k|    DEBUGLOG(5, "LZ4_compressHC_continue_generic(ctx=%p, src=%p, srcSize=%d, limit=%d)",
  ------------------
  |  |  288|  14.4k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1818|  14.4k|                LZ4_streamHCPtr, src, *srcSizePtr, limit);
 1819|  14.4k|    assert(ctxPtr != NULL);
  ------------------
  |  Branch (1819:5): [True: 0, False: 14.4k]
  |  Branch (1819:5): [True: 14.4k, False: 0]
  ------------------
 1820|       |    /* auto-init if forgotten */
 1821|  14.4k|    if (ctxPtr->prefixStart == NULL)
  ------------------
  |  Branch (1821:9): [True: 6.88k, False: 7.59k]
  ------------------
 1822|  6.88k|        LZ4HC_init_internal (ctxPtr, (const BYTE*) src);
 1823|       |
 1824|       |    /* Check overflow */
 1825|  14.4k|    if ((size_t)(ctxPtr->end - ctxPtr->prefixStart) + ctxPtr->dictLimit > 2 GB) {
  ------------------
  |  |  252|  14.4k|#define GB *(1U<<30)
  ------------------
  |  Branch (1825:9): [True: 0, False: 14.4k]
  ------------------
 1826|      0|        size_t dictSize = (size_t)(ctxPtr->end - ctxPtr->prefixStart);
 1827|      0|        if (dictSize > 64 KB) dictSize = 64 KB;
  ------------------
  |  |  250|      0|#define KB *(1 <<10)
  ------------------
                      if (dictSize > 64 KB) dictSize = 64 KB;
  ------------------
  |  |  250|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (1827:13): [True: 0, False: 0]
  ------------------
 1828|      0|        LZ4_loadDictHC(LZ4_streamHCPtr, (const char*)(ctxPtr->end) - dictSize, (int)dictSize);
 1829|      0|    }
 1830|       |
 1831|       |    /* Check if blocks follow each other */
 1832|  14.4k|    if ((const BYTE*)src != ctxPtr->end)
  ------------------
  |  Branch (1832:9): [True: 3.52k, False: 10.9k]
  ------------------
 1833|  3.52k|        LZ4HC_setExternalDict(ctxPtr, (const BYTE*)src);
 1834|       |
 1835|       |    /* Check overlapping input/dictionary space */
 1836|  14.4k|    {   const BYTE* sourceEnd = (const BYTE*) src + *srcSizePtr;
 1837|  14.4k|        const BYTE* const dictBegin = ctxPtr->dictStart;
 1838|  14.4k|        const BYTE* const dictEnd   = ctxPtr->dictStart + (ctxPtr->dictLimit - ctxPtr->lowLimit);
 1839|  14.4k|        if ((sourceEnd > dictBegin) && ((const BYTE*)src < dictEnd)) {
  ------------------
  |  Branch (1839:13): [True: 12.0k, False: 2.39k]
  |  Branch (1839:40): [True: 0, False: 12.0k]
  ------------------
 1840|      0|            if (sourceEnd > dictEnd) sourceEnd = dictEnd;
  ------------------
  |  Branch (1840:17): [True: 0, False: 0]
  ------------------
 1841|      0|            ctxPtr->lowLimit += (U32)(sourceEnd - ctxPtr->dictStart);
 1842|      0|            ctxPtr->dictStart += (U32)(sourceEnd - ctxPtr->dictStart);
 1843|       |            /* invalidate dictionary is it's too small */
 1844|      0|            if (ctxPtr->dictLimit - ctxPtr->lowLimit < LZ4HC_HASHSIZE) {
  ------------------
  |  |  134|      0|#define LZ4HC_HASHSIZE 4
  ------------------
  |  Branch (1844:17): [True: 0, False: 0]
  ------------------
 1845|      0|                ctxPtr->lowLimit = ctxPtr->dictLimit;
 1846|      0|                ctxPtr->dictStart = ctxPtr->prefixStart;
 1847|      0|    }   }   }
 1848|       |
 1849|  14.4k|    return LZ4HC_compress_generic (ctxPtr, src, dst, srcSizePtr, dstCapacity, ctxPtr->compressionLevel, limit);
 1850|  14.4k|}

LZ4_XXH32:
  398|  48.1k|{
  399|       |#if 0
  400|       |    /* Simple version, good for code maintenance, but unfortunately slow for small inputs */
  401|       |    XXH32_state_t state;
  402|       |    XXH32_reset(&state, seed);
  403|       |    XXH32_update(&state, input, len);
  404|       |    return XXH32_digest(&state);
  405|       |#else
  406|  48.1k|    XXH_endianness endian_detected = (XXH_endianness)XXH_CPU_LITTLE_ENDIAN;
  ------------------
  |  |  225|  48.1k|#   define XXH_CPU_LITTLE_ENDIAN   XXH_isLittleEndian()
  ------------------
  407|       |
  408|  48.1k|    if (XXH_FORCE_ALIGN_CHECK) {
  ------------------
  |  |   95|  48.1k|#    define XXH_FORCE_ALIGN_CHECK 0
  |  |  ------------------
  |  |  |  Branch (95:35): [Folded, False: 48.1k]
  |  |  ------------------
  ------------------
  409|      0|        if ((((size_t)input) & 3) == 0) {   /* Input is 4-bytes aligned, leverage the speed benefit */
  ------------------
  |  Branch (409:13): [True: 0, False: 0]
  ------------------
  410|      0|            if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
  ------------------
  |  |   83|      0|#  define XXH_FORCE_NATIVE_FORMAT 0
  |  |  ------------------
  |  |  |  Branch (83:35): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (410:17): [True: 0, False: 0]
  ------------------
  411|      0|                return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned);
  412|      0|            else
  413|      0|                return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned);
  414|      0|    }   }
  415|       |
  416|  48.1k|    if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
  ------------------
  |  |   83|      0|#  define XXH_FORCE_NATIVE_FORMAT 0
  |  |  ------------------
  |  |  |  Branch (83:35): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (416:9): [True: 48.1k, False: 0]
  ------------------
  417|  48.1k|        return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned);
  418|      0|    else
  419|      0|        return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned);
  420|  48.1k|#endif
  421|  48.1k|}
LZ4_XXH32_reset:
  443|  34.8k|{
  444|  34.8k|    XXH32_state_t state;   /* using a local state to memcpy() in order to avoid strict-aliasing warnings */
  445|  34.8k|    memset(&state, 0, sizeof(state));
  446|  34.8k|    state.v1 = seed + PRIME32_1 + PRIME32_2;
  447|  34.8k|    state.v2 = seed + PRIME32_2;
  448|  34.8k|    state.v3 = seed + 0;
  449|  34.8k|    state.v4 = seed - PRIME32_1;
  450|       |    /* do not write into reserved, planned to be removed in a future version */
  451|  34.8k|    memcpy(statePtr, &state, sizeof(state) - sizeof(state.reserved));
  452|  34.8k|    return XXH_OK;
  453|  34.8k|}
LZ4_XXH32_update:
  521|  65.4k|{
  522|  65.4k|    XXH_endianness endian_detected = (XXH_endianness)XXH_CPU_LITTLE_ENDIAN;
  ------------------
  |  |  225|  65.4k|#   define XXH_CPU_LITTLE_ENDIAN   XXH_isLittleEndian()
  ------------------
  523|       |
  524|  65.4k|    if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
  ------------------
  |  |   83|      0|#  define XXH_FORCE_NATIVE_FORMAT 0
  |  |  ------------------
  |  |  |  Branch (83:35): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (524:9): [True: 65.4k, False: 0]
  ------------------
  525|  65.4k|        return XXH32_update_endian(state_in, input, len, XXH_littleEndian);
  526|      0|    else
  527|      0|        return XXH32_update_endian(state_in, input, len, XXH_bigEndian);
  528|  65.4k|}
LZ4_XXH32_digest:
  552|  14.1k|{
  553|  14.1k|    XXH_endianness endian_detected = (XXH_endianness)XXH_CPU_LITTLE_ENDIAN;
  ------------------
  |  |  225|  14.1k|#   define XXH_CPU_LITTLE_ENDIAN   XXH_isLittleEndian()
  ------------------
  554|       |
  555|  14.1k|    if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
  ------------------
  |  |   83|      0|#  define XXH_FORCE_NATIVE_FORMAT 0
  |  |  ------------------
  |  |  |  Branch (83:35): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (555:9): [True: 14.1k, False: 0]
  ------------------
  556|  14.1k|        return XXH32_digest_endian(state_in, XXH_littleEndian);
  557|      0|    else
  558|      0|        return XXH32_digest_endian(state_in, XXH_bigEndian);
  559|  14.1k|}
xxhash.c:XXH_isLittleEndian:
  221|   127k|{
  222|   127k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  223|   127k|    return one.c[0] ? XXH_littleEndian : XXH_bigEndian;
  ------------------
  |  Branch (223:12): [True: 127k, False: 0]
  ------------------
  224|   127k|}
xxhash.c:XXH32_endian_align:
  359|  48.1k|{
  360|  48.1k|    const BYTE* p = (const BYTE*)input;
  361|  48.1k|    const BYTE* bEnd = p + len;
  362|  48.1k|    U32 h32;
  363|       |
  364|       |#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1)
  365|       |    if (p==NULL) {
  366|       |        len=0;
  367|       |        bEnd=p=(const BYTE*)(size_t)16;
  368|       |    }
  369|       |#endif
  370|       |
  371|  48.1k|    if (len>=16) {
  ------------------
  |  Branch (371:9): [True: 27.5k, False: 20.6k]
  ------------------
  372|  27.5k|        const BYTE* const limit = bEnd - 15;
  373|  27.5k|        U32 v1 = seed + PRIME32_1 + PRIME32_2;
  374|  27.5k|        U32 v2 = seed + PRIME32_2;
  375|  27.5k|        U32 v3 = seed + 0;
  376|  27.5k|        U32 v4 = seed - PRIME32_1;
  377|       |
  378|  20.7M|        do {
  379|  20.7M|            v1 = XXH32_round(v1, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  293|  20.7M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  380|  20.7M|            v2 = XXH32_round(v2, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  293|  20.7M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  381|  20.7M|            v3 = XXH32_round(v3, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  293|  20.7M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  382|  20.7M|            v4 = XXH32_round(v4, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  293|  20.7M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  383|  20.7M|        } while (p < limit);
  ------------------
  |  Branch (383:18): [True: 20.7M, False: 27.5k]
  ------------------
  384|       |
  385|  27.5k|        h32 = XXH_rotl32(v1, 1)  + XXH_rotl32(v2, 7)
  ------------------
  |  |  194|  27.5k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
                      h32 = XXH_rotl32(v1, 1)  + XXH_rotl32(v2, 7)
  ------------------
  |  |  194|  27.5k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  386|  27.5k|            + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18);
  ------------------
  |  |  194|  27.5k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
                          + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18);
  ------------------
  |  |  194|  27.5k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  387|  27.5k|    } else {
  388|  20.6k|        h32  = seed + PRIME32_5;
  389|  20.6k|    }
  390|       |
  391|  48.1k|    h32 += (U32)len;
  392|       |
  393|  48.1k|    return XXH32_finalize(h32, p, len&15, endian, align);
  394|  48.1k|}
xxhash.c:XXH32_round:
  270|   404M|{
  271|   404M|    seed += input * PRIME32_2;
  272|   404M|    seed  = XXH_rotl32(seed, 13);
  ------------------
  |  |  194|   404M|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  273|   404M|    seed *= PRIME32_1;
  274|   404M|#if defined(__GNUC__) && (defined(__SSE2__) || defined(__aarch64__) || defined(__wasm_simd128__))
  275|       |    /* prevents autovectorization (slower), notably of XXH32_update() :
  276|       |     * up to 6x slower on x86-64 without SSE4.1, where 32-bit vector multiplies are emulated */
  277|   404M|    __asm__ ("" : "+r" (seed));
  278|   404M|#endif
  279|   404M|    return seed;
  280|   404M|}
xxhash.c:XXH_readLE32_align:
  235|   404M|{
  236|   404M|    if (align==XXH_unaligned)
  ------------------
  |  Branch (236:9): [True: 404M, False: 17.3k]
  ------------------
  237|   404M|        return endian==XXH_littleEndian ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr));
  ------------------
  |  Branch (237:16): [True: 404M, False: 0]
  ------------------
  238|  17.3k|    else
  239|  17.3k|        return endian==XXH_littleEndian ? *(const U32*)ptr : XXH_swap32(*(const U32*)ptr);
  ------------------
  |  Branch (239:16): [True: 17.3k, False: 0]
  ------------------
  240|   404M|}
xxhash.c:XXH_read32:
  175|   404M|{
  176|   404M|    U32 val;
  177|   404M|    memcpy(&val, memPtr, sizeof(val));
  178|   404M|    return val;
  179|   404M|}
xxhash.c:XXH32_finalize:
  299|  62.3k|{
  300|  62.3k|    const BYTE* p = (const BYTE*)ptr;
  301|       |
  302|  62.3k|#define PROCESS1               \
  303|  62.3k|    h32 += (*p++) * PRIME32_5; \
  304|  62.3k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  305|       |
  306|  62.3k|#define PROCESS4                         \
  307|  62.3k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  308|  62.3k|    p+=4;                                \
  309|  62.3k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  310|       |
  311|  62.3k|    switch(len&15)  /* or switch(bEnd - p) */
  ------------------
  |  Branch (311:12): [True: 62.3k, False: 0]
  ------------------
  312|  62.3k|    {
  313|  2.51k|      case 12:      PROCESS4;
  ------------------
  |  |  307|  2.51k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  293|  2.51k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  308|  2.51k|    p+=4;                                \
  |  |  309|  2.51k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  2.51k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (313:7): [True: 2.51k, False: 59.8k]
  ------------------
  314|       |                    /* fallthrough */
  315|  4.95k|      case 8:       PROCESS4;
  ------------------
  |  |  307|  4.95k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  293|  4.95k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  308|  4.95k|    p+=4;                                \
  |  |  309|  4.95k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  4.95k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (315:7): [True: 2.44k, False: 59.8k]
  ------------------
  316|       |                    /* fallthrough */
  317|  7.29k|      case 4:       PROCESS4;
  ------------------
  |  |  307|  7.29k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  293|  7.29k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  308|  7.29k|    p+=4;                                \
  |  |  309|  7.29k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  7.29k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (317:7): [True: 2.34k, False: 59.9k]
  ------------------
  318|  7.29k|                    return XXH32_avalanche(h32);
  319|       |
  320|  2.44k|      case 13:      PROCESS4;
  ------------------
  |  |  307|  2.44k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  293|  2.44k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  308|  2.44k|    p+=4;                                \
  |  |  309|  2.44k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  2.44k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (320:7): [True: 2.44k, False: 59.8k]
  ------------------
  321|       |                    /* fallthrough */
  322|  4.68k|      case 9:       PROCESS4;
  ------------------
  |  |  307|  4.68k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  293|  4.68k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  308|  4.68k|    p+=4;                                \
  |  |  309|  4.68k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  4.68k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (322:7): [True: 2.23k, False: 60.0k]
  ------------------
  323|       |                    /* fallthrough */
  324|  7.67k|      case 5:       PROCESS4;
  ------------------
  |  |  307|  7.67k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  293|  7.67k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  308|  7.67k|    p+=4;                                \
  |  |  309|  7.67k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  7.67k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (324:7): [True: 2.99k, False: 59.3k]
  ------------------
  325|  7.67k|                    PROCESS1;
  ------------------
  |  |  303|  7.67k|    h32 += (*p++) * PRIME32_5; \
  |  |  304|  7.67k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  7.67k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  326|  7.67k|                    return XXH32_avalanche(h32);
  327|       |
  328|  2.52k|      case 14:      PROCESS4;
  ------------------
  |  |  307|  2.52k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  293|  2.52k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  308|  2.52k|    p+=4;                                \
  |  |  309|  2.52k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  2.52k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (328:7): [True: 2.52k, False: 59.8k]
  ------------------
  329|       |                    /* fallthrough */
  330|  5.42k|      case 10:      PROCESS4;
  ------------------
  |  |  307|  5.42k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  293|  5.42k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  308|  5.42k|    p+=4;                                \
  |  |  309|  5.42k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  5.42k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (330:7): [True: 2.90k, False: 59.4k]
  ------------------
  331|       |                    /* fallthrough */
  332|  7.83k|      case 6:       PROCESS4;
  ------------------
  |  |  307|  7.83k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  293|  7.83k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  308|  7.83k|    p+=4;                                \
  |  |  309|  7.83k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  7.83k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (332:7): [True: 2.41k, False: 59.9k]
  ------------------
  333|  7.83k|                    PROCESS1;
  ------------------
  |  |  303|  7.83k|    h32 += (*p++) * PRIME32_5; \
  |  |  304|  7.83k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  7.83k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  334|  7.83k|                    PROCESS1;
  ------------------
  |  |  303|  7.83k|    h32 += (*p++) * PRIME32_5; \
  |  |  304|  7.83k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  7.83k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  335|  7.83k|                    return XXH32_avalanche(h32);
  336|       |
  337|  2.60k|      case 15:      PROCESS4;
  ------------------
  |  |  307|  2.60k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  293|  2.60k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  308|  2.60k|    p+=4;                                \
  |  |  309|  2.60k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  2.60k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (337:7): [True: 2.60k, False: 59.7k]
  ------------------
  338|       |                    /* fallthrough */
  339|  5.43k|      case 11:      PROCESS4;
  ------------------
  |  |  307|  5.43k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  293|  5.43k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  308|  5.43k|    p+=4;                                \
  |  |  309|  5.43k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  5.43k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (339:7): [True: 2.83k, False: 59.5k]
  ------------------
  340|       |                    /* fallthrough */
  341|  8.21k|      case 7:       PROCESS4;
  ------------------
  |  |  307|  8.21k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  293|  8.21k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  308|  8.21k|    p+=4;                                \
  |  |  309|  8.21k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  8.21k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (341:7): [True: 2.78k, False: 59.5k]
  ------------------
  342|       |                    /* fallthrough */
  343|  10.8k|      case 3:       PROCESS1;
  ------------------
  |  |  303|  10.8k|    h32 += (*p++) * PRIME32_5; \
  |  |  304|  10.8k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  10.8k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (343:7): [True: 2.59k, False: 59.7k]
  ------------------
  344|       |                    /* fallthrough */
  345|  29.2k|      case 2:       PROCESS1;
  ------------------
  |  |  303|  29.2k|    h32 += (*p++) * PRIME32_5; \
  |  |  304|  29.2k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  29.2k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (345:7): [True: 18.4k, False: 43.8k]
  ------------------
  346|       |                    /* fallthrough */
  347|  35.2k|      case 1:       PROCESS1;
  ------------------
  |  |  303|  35.2k|    h32 += (*p++) * PRIME32_5; \
  |  |  304|  35.2k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  35.2k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (347:7): [True: 5.98k, False: 56.3k]
  ------------------
  348|       |                    /* fallthrough */
  349|  39.5k|      case 0:       return XXH32_avalanche(h32);
  ------------------
  |  Branch (349:7): [True: 4.27k, False: 58.0k]
  ------------------
  350|  62.3k|    }
  351|  62.3k|    assert(0);
  ------------------
  |  Branch (351:5): [Folded, False: 0]
  |  Branch (351:5): [Folded, False: 0]
  ------------------
  352|      0|    return h32;   /* reaching this point is deemed impossible */
  353|      0|}
xxhash.c:XXH32_avalanche:
  284|  62.3k|{
  285|  62.3k|    h32 ^= h32 >> 15;
  286|  62.3k|    h32 *= PRIME32_2;
  287|  62.3k|    h32 ^= h32 >> 13;
  288|  62.3k|    h32 *= PRIME32_3;
  289|  62.3k|    h32 ^= h32 >> 16;
  290|  62.3k|    return(h32);
  291|  62.3k|}
xxhash.c:XXH32_update_endian:
  458|  65.4k|{
  459|  65.4k|    if (input==NULL)
  ------------------
  |  Branch (459:9): [True: 0, False: 65.4k]
  ------------------
  460|       |#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1)
  461|       |        return XXH_OK;
  462|       |#else
  463|      0|        return XXH_ERROR;
  464|  65.4k|#endif
  465|       |
  466|  65.4k|    {   const BYTE* p = (const BYTE*)input;
  467|  65.4k|        const BYTE* const bEnd = p + len;
  468|       |
  469|  65.4k|        state->total_len_32 += (unsigned)len;
  470|  65.4k|        state->large_len |= (len>=16) | (state->total_len_32>=16);
  471|       |
  472|  65.4k|        if (state->memsize + len < 16)  {   /* fill in tmp buffer */
  ------------------
  |  Branch (472:13): [True: 22.4k, False: 43.0k]
  ------------------
  473|  22.4k|            XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, len);
  474|  22.4k|            state->memsize += (unsigned)len;
  475|  22.4k|            return XXH_OK;
  476|  22.4k|        }
  477|       |
  478|  43.0k|        if (state->memsize) {   /* some data left from previous update */
  ------------------
  |  Branch (478:13): [True: 18.5k, False: 24.5k]
  ------------------
  479|  18.5k|            XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, 16-state->memsize);
  480|  18.5k|            {   const U32* p32 = state->mem32;
  481|  18.5k|                state->v1 = XXH32_round(state->v1, XXH_readLE32(p32, endian)); p32++;
  482|  18.5k|                state->v2 = XXH32_round(state->v2, XXH_readLE32(p32, endian)); p32++;
  483|  18.5k|                state->v3 = XXH32_round(state->v3, XXH_readLE32(p32, endian)); p32++;
  484|  18.5k|                state->v4 = XXH32_round(state->v4, XXH_readLE32(p32, endian));
  485|  18.5k|            }
  486|  18.5k|            p += 16-state->memsize;
  487|  18.5k|            state->memsize = 0;
  488|  18.5k|        }
  489|       |
  490|  43.0k|        if (p <= bEnd-16) {
  ------------------
  |  Branch (490:13): [True: 39.0k, False: 3.91k]
  ------------------
  491|  39.0k|            const BYTE* const limit = bEnd - 16;
  492|  39.0k|            U32 v1 = state->v1;
  493|  39.0k|            U32 v2 = state->v2;
  494|  39.0k|            U32 v3 = state->v3;
  495|  39.0k|            U32 v4 = state->v4;
  496|       |
  497|  80.2M|            do {
  498|  80.2M|                v1 = XXH32_round(v1, XXH_readLE32(p, endian)); p+=4;
  499|  80.2M|                v2 = XXH32_round(v2, XXH_readLE32(p, endian)); p+=4;
  500|  80.2M|                v3 = XXH32_round(v3, XXH_readLE32(p, endian)); p+=4;
  501|  80.2M|                v4 = XXH32_round(v4, XXH_readLE32(p, endian)); p+=4;
  502|  80.2M|            } while (p<=limit);
  ------------------
  |  Branch (502:22): [True: 80.1M, False: 39.0k]
  ------------------
  503|       |
  504|  39.0k|            state->v1 = v1;
  505|  39.0k|            state->v2 = v2;
  506|  39.0k|            state->v3 = v3;
  507|  39.0k|            state->v4 = v4;
  508|  39.0k|        }
  509|       |
  510|  43.0k|        if (p < bEnd) {
  ------------------
  |  Branch (510:13): [True: 32.3k, False: 10.6k]
  ------------------
  511|  32.3k|            XXH_memcpy(state->mem32, p, (size_t)(bEnd-p));
  512|  32.3k|            state->memsize = (unsigned)(bEnd-p);
  513|  32.3k|        }
  514|  43.0k|    }
  515|       |
  516|      0|    return XXH_OK;
  517|  65.4k|}
xxhash.c:XXH_memcpy:
  112|  73.2k|static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); }
xxhash.c:XXH_readLE32:
  243|   320M|{
  244|   320M|    return XXH_readLE32_align(ptr, endian, XXH_unaligned);
  245|   320M|}
xxhash.c:XXH32_digest_endian:
  533|  14.1k|{
  534|  14.1k|    U32 h32;
  535|       |
  536|  14.1k|    if (state->large_len) {
  ------------------
  |  Branch (536:9): [True: 11.3k, False: 2.78k]
  ------------------
  537|  11.3k|        h32 = XXH_rotl32(state->v1, 1)
  ------------------
  |  |  194|  11.3k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  538|  11.3k|            + XXH_rotl32(state->v2, 7)
  ------------------
  |  |  194|  11.3k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  539|  11.3k|            + XXH_rotl32(state->v3, 12)
  ------------------
  |  |  194|  11.3k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  540|  11.3k|            + XXH_rotl32(state->v4, 18);
  ------------------
  |  |  194|  11.3k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  541|  11.3k|    } else {
  542|  2.78k|        h32 = state->v3 /* == seed */ + PRIME32_5;
  543|  2.78k|    }
  544|       |
  545|  14.1k|    h32 += state->total_len_32;
  546|       |
  547|  14.1k|    return XXH32_finalize(h32, state->mem32, state->memsize, endian, XXH_aligned);
  548|  14.1k|}

LLVMFuzzerTestOneInput:
  164|  15.7k|{
  165|  15.7k|    FUZZ_dataProducer_t *producer = FUZZ_dataProducer_create(data, size);
  166|       |
  167|       |    /* consume the op script and preferences first; the front remainder of the
  168|       |     * input is the file contents both phases operate on */
  169|  15.7k|    LZ4F_preferences_t const prefs = FUZZ_dataProducer_preferences(producer);
  170|  15.7k|    file_op_t ops[FILE_FUZZ_MAX_OPS];
  171|  15.7k|    unsigned const nbOps = FUZZ_dataProducer_range32(producer, 1, FILE_FUZZ_MAX_OPS);
  ------------------
  |  |   28|  15.7k|#define FILE_FUZZ_MAX_OPS 16
  ------------------
  172|  15.7k|    unsigned op;
  173|       |
  174|  15.7k|    memset(ops, 0, sizeof(ops));
  175|  69.9k|    for (op = 0; op < nbOps; op++) {
  ------------------
  |  Branch (175:18): [True: 54.2k, False: 15.7k]
  ------------------
  176|  54.2k|        ops[op].kind = FUZZ_dataProducer_range32(producer, 0, 2);
  177|  54.2k|        if (ops[op].kind == 0) {
  ------------------
  |  Branch (177:13): [True: 19.6k, False: 34.5k]
  ------------------
  178|  19.6k|            ops[op].want = FUZZ_dataProducer_range32(producer, 0, FILE_FUZZ_BUF_CAP);
  ------------------
  |  |   29|  19.6k|#define FILE_FUZZ_BUF_CAP (64 * 1024)
  ------------------
  179|  34.5k|        } else if (ops[op].kind == 1) {
  ------------------
  |  Branch (179:20): [True: 18.6k, False: 15.9k]
  ------------------
  180|  18.6k|            long long const forward =
  181|  18.6k|                (long long)FUZZ_dataProducer_range32(producer, 0, 1u << 20);
  182|  18.6k|            long long const backward =
  183|  18.6k|                (long long)FUZZ_dataProducer_range32(producer, 0, 1u << 20);
  184|  18.6k|            ops[op].offset = forward - backward;
  185|  18.6k|            ops[op].origin = (FUZZ_dataProducer_range32(producer, 0, 1) == 0)
  ------------------
  |  Branch (185:30): [True: 12.0k, False: 6.56k]
  ------------------
  186|  18.6k|                           ? SEEK_SET : SEEK_CUR;
  187|  18.6k|        }
  188|  54.2k|    }
  189|       |
  190|  15.7k|    size = FUZZ_dataProducer_remainingBytes(producer);
  191|       |
  192|  15.7k|    if (size > 0) {
  ------------------
  |  Branch (192:9): [True: 15.6k, False: 56]
  ------------------
  193|  15.6k|        FILE* const fp = fmemopen((void*)data, size, "rb");
  194|  15.6k|        FUZZ_ASSERT(fp);
  ------------------
  |  |   47|  15.6k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  15.6k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 15.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  15.6k|          : (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()))
  |  |  ------------------
  ------------------
  195|  15.6k|        readFileOps(fp, ops, nbOps);
  196|  15.6k|        fclose(fp);
  197|       |
  198|  15.6k|        writeReadRoundTrip(&prefs, data, size, ops, nbOps);
  199|  15.6k|    }
  200|       |
  201|  15.7k|    FUZZ_dataProducer_free(producer);
  202|  15.7k|    return 0;
  203|  15.7k|}
file_fuzzer.c:readFileOps:
   58|  15.6k|{
   59|  15.6k|    LZ4_readFile_t* rf = NULL;
   60|  15.6k|    uint8_t* buf;
   61|  15.6k|    unsigned op;
   62|       |
   63|  15.6k|    if (LZ4F_isError(LZ4F_readOpen(&rf, fp)))
  ------------------
  |  Branch (63:9): [True: 11.9k, False: 3.71k]
  ------------------
   64|  11.9k|        return;
   65|       |
   66|  3.71k|    buf = (uint8_t*)malloc(FILE_FUZZ_BUF_CAP);
  ------------------
  |  |   29|  3.71k|#define FILE_FUZZ_BUF_CAP (64 * 1024)
  ------------------
   67|  3.71k|    FUZZ_ASSERT(buf);
  ------------------
  |  |   47|  3.71k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  3.71k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 3.71k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  3.71k|          : (fprintf(stderr, "%s: %u: Assertion: `%s' failed. %s\n", __FILE__, \
  |  |  |  |   45|      0|                     __LINE__, FUZZ_QUOTE(cond), (msg)),                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      0|#define FUZZ_QUOTE(str) FUZZ_QUOTE_IMPL(str)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   36|      0|#define FUZZ_QUOTE_IMPL(str) #str
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   46|      0|             abort()))
  |  |  ------------------
  ------------------
   68|       |
   69|  17.8k|    for (op = 0; op < nbOps; op++) {
  ------------------
  |  Branch (69:18): [True: 16.3k, False: 1.41k]
  ------------------
   70|  16.3k|        if (!runFileOp(rf, buf, &ops[op]))
  ------------------
  |  Branch (70:13): [True: 2.29k, False: 14.0k]
  ------------------
   71|  2.29k|            break;
   72|  16.3k|    }
   73|       |
   74|  3.71k|    free(buf);
   75|       |    FUZZ_ASSERT(!LZ4F_isError(LZ4F_readClose(rf)));
  ------------------
  |  |   47|  3.71k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  3.71k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 3.71k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  3.71k|          : (fprintf(stderr, "%s: %u: Assertion: `%s' failed. %s\n", __FILE__, \
  |  |  |  |   45|      0|                     __LINE__, FUZZ_QUOTE(cond), (msg)),                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      0|#define FUZZ_QUOTE(str) FUZZ_QUOTE_IMPL(str)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   36|      0|#define FUZZ_QUOTE_IMPL(str) #str
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   46|      0|             abort()))
  |  |  ------------------
  ------------------
   76|  3.71k|}
file_fuzzer.c:runFileOp:
   41|  16.3k|{
   42|  16.3k|    if (op->kind == 0) {
  ------------------
  |  Branch (42:9): [True: 4.05k, False: 12.3k]
  ------------------
   43|  4.05k|        size_t const got = LZ4F_read(rf, buf, op->want);
   44|  4.05k|        return !LZ4F_isError(got);
   45|  4.05k|    }
   46|  12.3k|    if (op->kind == 1) {
  ------------------
  |  Branch (46:9): [True: 9.18k, False: 3.15k]
  ------------------
   47|       |        /* errors are expected: seeking past the end or before the start */
   48|  9.18k|        (void)LZ4F_seek(rf, op->offset, op->origin);
   49|  9.18k|        return 1;
   50|  9.18k|    }
   51|  3.15k|    (void)LZ4F_tell(rf);
   52|  3.15k|    return 1;
   53|  12.3k|}
file_fuzzer.c:writeReadRoundTrip:
  112|  15.6k|{
  113|  15.6k|    char* compressed = NULL;
  114|  15.6k|    size_t compressedSize = 0;
  115|  15.6k|    FILE* const wfp = open_memstream(&compressed, &compressedSize);
  116|  15.6k|    FILE* rfp;
  117|  15.6k|    LZ4_writeFile_t* wf = NULL;
  118|  15.6k|    LZ4_readFile_t* rf;
  119|  15.6k|    uint8_t* back;
  120|  15.6k|    size_t first;
  121|  15.6k|    size_t total;
  122|       |
  123|  15.6k|    FUZZ_ASSERT(wfp);
  ------------------
  |  |   47|  15.6k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  15.6k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 15.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  15.6k|          : (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()))
  |  |  ------------------
  ------------------
  124|       |
  125|  15.6k|    if (!LZ4F_isError(LZ4F_writeOpen(&wf, wfp, prefs))) {
  ------------------
  |  Branch (125:9): [True: 15.6k, False: 0]
  ------------------
  126|       |        /* split in two writes to exercise the internal buffering */
  127|  15.6k|        first = size / 2;
  128|  15.6k|        if (!LZ4F_isError(LZ4F_write(wf, data, first)))
  ------------------
  |  Branch (128:13): [True: 15.6k, False: 0]
  ------------------
  129|  15.6k|            (void)LZ4F_write(wf, data + first, size - first);
  130|  15.6k|        FUZZ_ASSERT(!LZ4F_isError(LZ4F_writeClose(wf)));
  ------------------
  |  |   47|  15.6k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  15.6k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 15.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  15.6k|          : (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()))
  |  |  ------------------
  ------------------
  131|  15.6k|    }
  132|       |
  133|  15.6k|    fclose(wfp);   /* flushes and finalizes compressed/compressedSize */
  134|  15.6k|    FUZZ_ASSERT(compressed != NULL);
  ------------------
  |  |   47|  15.6k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  15.6k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 15.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  15.6k|          : (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()))
  |  |  ------------------
  ------------------
  135|  15.6k|    FUZZ_ASSERT(compressedSize > 0);
  ------------------
  |  |   47|  15.6k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  15.6k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 15.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  15.6k|          : (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()))
  |  |  ------------------
  ------------------
  136|       |
  137|  15.6k|    rfp = fmemopen(compressed, compressedSize, "rb");
  138|  15.6k|    FUZZ_ASSERT(rfp);
  ------------------
  |  |   47|  15.6k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  15.6k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 15.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  15.6k|          : (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()))
  |  |  ------------------
  ------------------
  139|       |
  140|  15.6k|    FUZZ_ASSERT(!LZ4F_isError(LZ4F_readOpen(&rf, rfp)));
  ------------------
  |  |   47|  15.6k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  15.6k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 15.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  15.6k|          : (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()))
  |  |  ------------------
  ------------------
  141|  15.6k|    back = (uint8_t*)malloc(size);
  142|  15.6k|    FUZZ_ASSERT(back);
  ------------------
  |  |   47|  15.6k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  15.6k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 15.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  15.6k|          : (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()))
  |  |  ------------------
  ------------------
  143|  15.6k|    total = 0;
  144|  31.3k|    while (total < size) {
  ------------------
  |  Branch (144:12): [True: 15.6k, False: 15.6k]
  ------------------
  145|  15.6k|        size_t const got = LZ4F_read(rf, back + total, size - total);
  146|       |        /* the frame was just written by this process: it must decode */
  147|  15.6k|        FUZZ_ASSERT(!LZ4F_isError(got));
  ------------------
  |  |   47|  15.6k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  15.6k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 15.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  15.6k|          : (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()))
  |  |  ------------------
  ------------------
  148|  15.6k|        if (got == 0)
  ------------------
  |  Branch (148:13): [True: 0, False: 15.6k]
  ------------------
  149|      0|            break;
  150|  15.6k|        total += got;
  151|  15.6k|    }
  152|  15.6k|    FUZZ_ASSERT_MSG(total == size, "lz4file round trip truncated the data");
  ------------------
  |  |   43|  15.6k|  ((cond) ? (void)0                                                            \
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 15.6k, False: 0]
  |  |  ------------------
  |  |   44|  15.6k|          : (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()))
  ------------------
  153|  15.6k|    FUZZ_ASSERT_MSG(memcmp(back, data, size) == 0,
  ------------------
  |  |   43|  15.6k|  ((cond) ? (void)0                                                            \
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 15.6k, False: 0]
  |  |  ------------------
  |  |   44|  15.6k|          : (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()))
  ------------------
  154|  15.6k|                    "lz4file round trip corrupted the data");
  155|  15.6k|    checkFileOps(rf, data, size, ops, nbOps);
  156|  15.6k|    free(back);
  157|  15.6k|    FUZZ_ASSERT(!LZ4F_isError(LZ4F_readClose(rf)));
  ------------------
  |  |   47|  15.6k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  15.6k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 15.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  15.6k|          : (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()))
  |  |  ------------------
  ------------------
  158|       |
  159|  15.6k|    fclose(rfp);
  160|  15.6k|    free(compressed);
  161|  15.6k|}
file_fuzzer.c:checkFileOps:
   82|  15.6k|{
   83|  15.6k|    uint8_t* const buf = (uint8_t*)malloc(FILE_FUZZ_BUF_CAP);
  ------------------
  |  |   29|  15.6k|#define FILE_FUZZ_BUF_CAP (64 * 1024)
  ------------------
   84|  15.6k|    unsigned long long pos = LZ4F_tell(rf);
   85|  15.6k|    unsigned op;
   86|       |
   87|  15.6k|    FUZZ_ASSERT(buf);
  ------------------
  |  |   47|  15.6k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  15.6k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 15.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  15.6k|          : (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()))
  |  |  ------------------
  ------------------
   88|  69.5k|    for (op = 0; op < nbOps; op++) {
  ------------------
  |  Branch (88:18): [True: 53.8k, False: 15.6k]
  ------------------
   89|  53.8k|        if (ops[op].kind == 0) {
  ------------------
  |  Branch (89:13): [True: 19.3k, False: 34.4k]
  ------------------
   90|  19.3k|            size_t const expected = MIN(ops[op].want, (size_t)(size - pos));
  ------------------
  |  |   33|  19.3k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (33:22): [True: 5.78k, False: 13.6k]
  |  |  ------------------
  ------------------
   91|  19.3k|            FUZZ_ASSERT(LZ4F_read(rf, buf, ops[op].want) == expected);
  ------------------
  |  |   47|  19.3k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  19.3k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 19.3k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  19.3k|          : (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()))
  |  |  ------------------
  ------------------
   92|  19.3k|            FUZZ_ASSERT(memcmp(buf, data + pos, expected) == 0);
  ------------------
  |  |   47|  19.3k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  19.3k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 19.3k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  19.3k|          : (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()))
  |  |  ------------------
  ------------------
   93|  19.3k|            pos += expected;
   94|  34.4k|        } else if (ops[op].kind == 1) {
  ------------------
  |  Branch (94:20): [True: 18.6k, False: 15.8k]
  ------------------
   95|  18.6k|            long long const magnitude = (ops[op].offset < 0) ? -ops[op].offset : ops[op].offset;
  ------------------
  |  Branch (95:41): [True: 4.98k, False: 13.6k]
  ------------------
   96|  18.6k|            unsigned long long const target = (unsigned long long)magnitude % (size + 1);
   97|  18.6k|            long long const offset = (ops[op].origin == SEEK_SET) ? (long long)target
  ------------------
  |  Branch (97:38): [True: 12.0k, False: 6.54k]
  ------------------
   98|  18.6k|                                                                  : (long long)target - (long long)pos;
   99|  18.6k|            FUZZ_ASSERT(!LZ4F_isError(LZ4F_seek(rf, offset, ops[op].origin)));
  ------------------
  |  |   47|  18.6k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  18.6k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 18.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  18.6k|          : (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()))
  |  |  ------------------
  ------------------
  100|  18.6k|            pos = target;
  101|  18.6k|        }
  102|  53.8k|        FUZZ_ASSERT(LZ4F_tell(rf) == pos);
  ------------------
  |  |   47|  53.8k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  53.8k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 53.8k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  53.8k|          : (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()))
  |  |  ------------------
  ------------------
  103|  53.8k|    }
  104|  15.6k|    free(buf);
  105|  15.6k|}

FUZZ_dataProducer_create:
    8|  15.7k|FUZZ_dataProducer_t* FUZZ_dataProducer_create(const uint8_t* data, size_t size) {
    9|  15.7k|  FUZZ_dataProducer_t* const producer = malloc(sizeof(FUZZ_dataProducer_t));
   10|       |
   11|  15.7k|  FUZZ_ASSERT(producer != NULL);
  ------------------
  |  |   47|  15.7k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  15.7k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 15.7k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  15.7k|          : (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|  15.7k|  producer->data = data;
   14|  15.7k|  producer->size = size;
   15|  15.7k|  return producer;
   16|  15.7k|}
FUZZ_dataProducer_free:
   18|  15.7k|void FUZZ_dataProducer_free(FUZZ_dataProducer_t *producer) { free(producer); }
FUZZ_dataProducer_retrieve32:
   20|   255k|uint32_t FUZZ_dataProducer_retrieve32(FUZZ_dataProducer_t *producer) {
   21|   255k|    const uint8_t* data = producer->data;
   22|   255k|    const size_t size = producer->size;
   23|   255k|    if (size == 0) {
  ------------------
  |  Branch (23:9): [True: 595, False: 255k]
  ------------------
   24|    595|        return 0;
   25|   255k|    } else if (size < 4) {
  ------------------
  |  Branch (25:16): [True: 356, False: 254k]
  ------------------
   26|    356|        producer->size -= 1;
   27|    356|        return (uint32_t)data[size - 1];
   28|   254k|    } else {
   29|   254k|        const uint8_t* const p = data + size - 4;
   30|   254k|        producer->size -= 4;
   31|   254k|        return (uint32_t)p[0] | ((uint32_t)p[1] << 8)
   32|   254k|            | ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24);
   33|   254k|    }
   34|   255k|}
FUZZ_getRange_from_uint32:
   37|   255k|{
   38|   255k|    uint32_t range = max - min;
   39|   255k|    if (range == 0xffffffff) {
  ------------------
  |  Branch (39:9): [True: 0, False: 255k]
  ------------------
   40|      0|      return seed;
   41|      0|    }
   42|   255k|    return min + seed % (range + 1);
   43|   255k|}
FUZZ_dataProducer_range32:
   47|   255k|{
   48|   255k|    uint32_t const seed = FUZZ_dataProducer_retrieve32(producer);
   49|   255k|    return FUZZ_getRange_from_uint32(seed, min, max);
   50|   255k|}
FUZZ_dataProducer_frameInfo:
   53|  15.7k|{
   54|  15.7k|    LZ4F_frameInfo_t info = LZ4F_INIT_FRAMEINFO;
  ------------------
  |  |  209|  15.7k|#define LZ4F_INIT_FRAMEINFO   { LZ4F_max64KB, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0ULL, 0U, LZ4F_noBlockChecksum }    /* v1.8.3+ */
  ------------------
   55|  15.7k|    info.blockSizeID = FUZZ_dataProducer_range32(producer, LZ4F_max64KB - 1, LZ4F_max4MB);
   56|  15.7k|    if (info.blockSizeID < LZ4F_max64KB) {
  ------------------
  |  Branch (56:9): [True: 5.78k, False: 9.94k]
  ------------------
   57|  5.78k|        info.blockSizeID = LZ4F_default;
   58|  5.78k|    }
   59|  15.7k|    info.blockMode = FUZZ_dataProducer_range32(producer, LZ4F_blockLinked, LZ4F_blockIndependent);
   60|  15.7k|    info.contentChecksumFlag = FUZZ_dataProducer_range32(producer, LZ4F_noContentChecksum,
   61|  15.7k|                                           LZ4F_contentChecksumEnabled);
   62|  15.7k|    info.blockChecksumFlag = FUZZ_dataProducer_range32(producer, LZ4F_noBlockChecksum,
   63|  15.7k|                                         LZ4F_blockChecksumEnabled);
   64|  15.7k|    return info;
   65|  15.7k|}
FUZZ_dataProducer_preferences:
   68|  15.7k|{
   69|  15.7k|    LZ4F_preferences_t prefs = LZ4F_INIT_PREFERENCES;
  ------------------
  |  |  228|  15.7k|#define LZ4F_INIT_PREFERENCES   { LZ4F_INIT_FRAMEINFO, 0, 0u, 0u, 0u, 0u, 0u }    /* v1.8.3+ */
  |  |  ------------------
  |  |  |  |  209|  15.7k|#define LZ4F_INIT_FRAMEINFO   { LZ4F_max64KB, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0ULL, 0U, LZ4F_noBlockChecksum }    /* v1.8.3+ */
  |  |  ------------------
  ------------------
   70|  15.7k|    prefs.frameInfo = FUZZ_dataProducer_frameInfo(producer);
   71|  15.7k|    prefs.compressionLevel = FUZZ_dataProducer_range32(producer, 0, LZ4HC_CLEVEL_MAX + 3) - 3;
  ------------------
  |  |   49|  15.7k|#define LZ4HC_CLEVEL_MAX        12
  ------------------
   72|  15.7k|    prefs.autoFlush = FUZZ_dataProducer_range32(producer, 0, 1);
   73|  15.7k|    prefs.favorDecSpeed = FUZZ_dataProducer_range32(producer, 0, 1);
   74|  15.7k|    return prefs;
   75|  15.7k|}
FUZZ_dataProducer_remainingBytes:
   77|  15.7k|size_t FUZZ_dataProducer_remainingBytes(FUZZ_dataProducer_t *producer){
   78|  15.7k|  return producer->size;
   79|  15.7k|}

