LZ4_compressBound:
  747|  28.2k|int LZ4_compressBound(int isize)  { return LZ4_COMPRESSBOUND(isize); }
  ------------------
  |  |  215|  28.2k|#define LZ4_COMPRESSBOUND(isize)  ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
  |  |  ------------------
  |  |  |  |  214|  28.2k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  |  |  ------------------
  |  |  |  Branch (215:36): [True: 0, False: 28.2k]
  |  |  ------------------
  ------------------
LZ4_sizeofState:
  748|  4.03k|int LZ4_sizeofState(void) { return sizeof(LZ4_stream_t); }
LZ4_compress_fast_extState_fastReset:
 1411|  2.35k|{
 1412|  2.35k|    LZ4_stream_t_internal* const ctx = &((LZ4_stream_t*)state)->internal_donotuse;
 1413|  2.35k|    if (acceleration < 1) acceleration = LZ4_ACCELERATION_DEFAULT;
  ------------------
  |  |   52|      0|#define LZ4_ACCELERATION_DEFAULT 1
  ------------------
  |  Branch (1413:9): [True: 0, False: 2.35k]
  ------------------
 1414|  2.35k|    if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX;
  ------------------
  |  |   58|  2.35k|#define LZ4_ACCELERATION_MAX 65537
  ------------------
                  if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX;
  ------------------
  |  |   58|      0|#define LZ4_ACCELERATION_MAX 65537
  ------------------
  |  Branch (1414:9): [True: 0, False: 2.35k]
  ------------------
 1415|  2.35k|    assert(ctx != NULL);
  ------------------
  |  Branch (1415:5): [True: 0, False: 2.35k]
  |  Branch (1415:5): [True: 2.35k, False: 0]
  ------------------
 1416|       |
 1417|  2.35k|    if (dstCapacity >= LZ4_compressBound(srcSize)) {
  ------------------
  |  Branch (1417:9): [True: 0, False: 2.35k]
  ------------------
 1418|      0|        if (srcSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1418:13): [True: 0, False: 0]
  ------------------
 1419|      0|            const tableType_t tableType = byU16;
 1420|      0|            LZ4_prepareTable(ctx, srcSize, tableType);
 1421|      0|            if (ctx->currentOffset) {
  ------------------
  |  Branch (1421:17): [True: 0, False: 0]
  ------------------
 1422|      0|                return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, 0, notLimited, tableType, noDict, dictSmall, acceleration);
 1423|      0|            } else {
 1424|      0|                return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, 0, notLimited, tableType, noDict, noDictIssue, acceleration);
 1425|      0|            }
 1426|      0|        } else {
 1427|      0|            const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)src > LZ4_DISTANCE_MAX)) ? byPtr : byU32;
  ------------------
  |  |  676|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1427:44): [Folded, False: 0]
  |  Branch (1427:66): [True: 0, False: 0]
  ------------------
 1428|      0|            LZ4_prepareTable(ctx, srcSize, tableType);
 1429|      0|            return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, 0, notLimited, tableType, noDict, noDictIssue, acceleration);
 1430|      0|        }
 1431|  2.35k|    } else {
 1432|  2.35k|        if (srcSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1432:13): [True: 2.00k, False: 357]
  ------------------
 1433|  2.00k|            const tableType_t tableType = byU16;
 1434|  2.00k|            LZ4_prepareTable(ctx, srcSize, tableType);
 1435|  2.00k|            if (ctx->currentOffset) {
  ------------------
  |  Branch (1435:17): [True: 0, False: 2.00k]
  ------------------
 1436|      0|                return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, dstCapacity, limitedOutput, tableType, noDict, dictSmall, acceleration);
 1437|  2.00k|            } else {
 1438|  2.00k|                return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, dstCapacity, limitedOutput, tableType, noDict, noDictIssue, acceleration);
 1439|  2.00k|            }
 1440|  2.00k|        } else {
 1441|    357|            const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)src > LZ4_DISTANCE_MAX)) ? byPtr : byU32;
  ------------------
  |  |  676|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1441:44): [Folded, False: 357]
  |  Branch (1441:66): [True: 0, False: 0]
  ------------------
 1442|    357|            LZ4_prepareTable(ctx, srcSize, tableType);
 1443|       |            return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, dstCapacity, limitedOutput, tableType, noDict, noDictIssue, acceleration);
 1444|    357|        }
 1445|  2.35k|    }
 1446|  2.35k|}
LZ4_initStream:
 1549|  2.01k|{
 1550|  2.01k|    DEBUGLOG(5, "LZ4_initStream");
  ------------------
  |  |  290|  2.01k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1551|  2.01k|    if (buffer == NULL) { return NULL; }
  ------------------
  |  Branch (1551:9): [True: 0, False: 2.01k]
  ------------------
 1552|  2.01k|    if (size < sizeof(LZ4_stream_t)) { return NULL; }
  ------------------
  |  Branch (1552:9): [True: 0, False: 2.01k]
  ------------------
 1553|  2.01k|    if (!LZ4_isAligned(buffer, LZ4_stream_t_alignment())) return NULL;
  ------------------
  |  Branch (1553:9): [True: 0, False: 2.01k]
  ------------------
 1554|  2.01k|    MEM_INIT(buffer, 0, sizeof(LZ4_stream_t_internal));
  ------------------
  |  |  237|  2.01k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  235|  2.01k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 1555|  2.01k|    return (LZ4_stream_t*)buffer;
 1556|  2.01k|}
LZ4_resetStream_fast:
 1566|    729|void LZ4_resetStream_fast(LZ4_stream_t* ctx) {
 1567|    729|    LZ4_prepareTable(&(ctx->internal_donotuse), 0, byU32);
 1568|    729|}
LZ4_compress_fast_continue:
 1707|  3.23k|{
 1708|  3.23k|    const tableType_t tableType = byU32;
 1709|  3.23k|    LZ4_stream_t_internal* const streamPtr = &LZ4_stream->internal_donotuse;
 1710|  3.23k|    const char* dictEnd = streamPtr->dictSize ? (const char*)streamPtr->dictionary + streamPtr->dictSize : NULL;
  ------------------
  |  Branch (1710:27): [True: 2.50k, False: 729]
  ------------------
 1711|       |
 1712|  3.23k|    DEBUGLOG(5, "LZ4_compress_fast_continue (inputSize=%i, dictSize=%u)", inputSize, streamPtr->dictSize);
  ------------------
  |  |  290|  3.23k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1713|       |
 1714|  3.23k|    LZ4_renormDictT(streamPtr, inputSize);   /* fix index overflow */
 1715|  3.23k|    if (acceleration < 1) acceleration = LZ4_ACCELERATION_DEFAULT;
  ------------------
  |  |   52|      0|#define LZ4_ACCELERATION_DEFAULT 1
  ------------------
  |  Branch (1715:9): [True: 0, False: 3.23k]
  ------------------
 1716|  3.23k|    if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX;
  ------------------
  |  |   58|  3.23k|#define LZ4_ACCELERATION_MAX 65537
  ------------------
                  if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX;
  ------------------
  |  |   58|      0|#define LZ4_ACCELERATION_MAX 65537
  ------------------
  |  Branch (1716:9): [True: 0, False: 3.23k]
  ------------------
 1717|       |
 1718|       |    /* invalidate tiny dictionaries */
 1719|  3.23k|    if ( (streamPtr->dictSize < 4)     /* tiny dictionary : not enough for a hash */
  ------------------
  |  Branch (1719:10): [True: 729, False: 2.50k]
  ------------------
 1720|    729|      && (dictEnd != source)           /* prefix mode */
  ------------------
  |  Branch (1720:10): [True: 729, False: 0]
  ------------------
 1721|    729|      && (inputSize > 0)               /* tolerance : don't lose history, in case next invocation would use prefix mode */
  ------------------
  |  Branch (1721:10): [True: 729, False: 0]
  ------------------
 1722|    729|      && (streamPtr->dictCtx == NULL)  /* usingDictCtx */
  ------------------
  |  Branch (1722:10): [True: 729, False: 0]
  ------------------
 1723|  3.23k|      ) {
 1724|    729|        DEBUGLOG(5, "LZ4_compress_fast_continue: dictSize(%u) at addr:%p is too small", streamPtr->dictSize, (void*)streamPtr->dictionary);
  ------------------
  |  |  290|    729|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1725|       |        /* remove dictionary existence from history, to employ faster prefix mode */
 1726|    729|        streamPtr->dictSize = 0;
 1727|    729|        streamPtr->dictionary = (const BYTE*)source;
 1728|    729|        dictEnd = source;
 1729|    729|    }
 1730|       |
 1731|       |    /* Check overlapping input/dictionary space */
 1732|  3.23k|    {   const char* const sourceEnd = source + inputSize;
 1733|  3.23k|        if ((sourceEnd > (const char*)streamPtr->dictionary) && (sourceEnd < dictEnd)) {
  ------------------
  |  Branch (1733:13): [True: 3.23k, False: 0]
  |  Branch (1733:65): [True: 0, False: 3.23k]
  ------------------
 1734|      0|            streamPtr->dictSize = (U32)(dictEnd - sourceEnd);
 1735|      0|            if (streamPtr->dictSize > 64 KB) streamPtr->dictSize = 64 KB;
  ------------------
  |  |  252|      0|#define KB *(1 <<10)
  ------------------
                          if (streamPtr->dictSize > 64 KB) streamPtr->dictSize = 64 KB;
  ------------------
  |  |  252|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (1735:17): [True: 0, False: 0]
  ------------------
 1736|      0|            if (streamPtr->dictSize < 4) streamPtr->dictSize = 0;
  ------------------
  |  Branch (1736:17): [True: 0, False: 0]
  ------------------
 1737|      0|            streamPtr->dictionary = (const BYTE*)dictEnd - streamPtr->dictSize;
 1738|      0|        }
 1739|  3.23k|    }
 1740|       |
 1741|       |    /* prefix mode : source data follows dictionary */
 1742|  3.23k|    if (dictEnd == source) {
  ------------------
  |  Branch (1742:9): [True: 3.23k, False: 0]
  ------------------
 1743|  3.23k|        if ((streamPtr->dictSize < 64 KB) && (streamPtr->dictSize < streamPtr->currentOffset))
  ------------------
  |  |  252|  3.23k|#define KB *(1 <<10)
  ------------------
  |  Branch (1743:13): [True: 729, False: 2.50k]
  |  Branch (1743:46): [True: 0, False: 729]
  ------------------
 1744|      0|            return LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, withPrefix64k, dictSmall, acceleration);
 1745|  3.23k|        else
 1746|  3.23k|            return LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, withPrefix64k, noDictIssue, acceleration);
 1747|  3.23k|    }
 1748|       |
 1749|       |    /* external dictionary mode */
 1750|      0|    {   int result;
 1751|      0|        if (streamPtr->dictCtx) {
  ------------------
  |  Branch (1751:13): [True: 0, False: 0]
  ------------------
 1752|       |            /* We depend here on the fact that dictCtx'es (produced by
 1753|       |             * LZ4_loadDict) guarantee that their tables contain no references
 1754|       |             * to offsets between dictCtx->currentOffset - 64 KB and
 1755|       |             * dictCtx->currentOffset - dictCtx->dictSize. This makes it safe
 1756|       |             * to use noDictIssue even when the dict isn't a full 64 KB.
 1757|       |             */
 1758|      0|            if (inputSize > 4 KB) {
  ------------------
  |  |  252|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (1758:17): [True: 0, False: 0]
  ------------------
 1759|       |                /* For compressing large blobs, it is faster to pay the setup
 1760|       |                 * cost to copy the dictionary's tables into the active context,
 1761|       |                 * so that the compression loop is only looking into one table.
 1762|       |                 */
 1763|      0|                LZ4_memcpy(streamPtr, streamPtr->dictCtx, sizeof(*streamPtr));
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 1764|      0|                result = LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingExtDict, noDictIssue, acceleration);
 1765|      0|            } else {
 1766|      0|                result = LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingDictCtx, noDictIssue, acceleration);
 1767|      0|            }
 1768|      0|        } else {  /* small data <= 4 KB */
 1769|      0|            if ((streamPtr->dictSize < 64 KB) && (streamPtr->dictSize < streamPtr->currentOffset)) {
  ------------------
  |  |  252|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (1769:17): [True: 0, False: 0]
  |  Branch (1769:50): [True: 0, False: 0]
  ------------------
 1770|      0|                result = LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingExtDict, dictSmall, acceleration);
 1771|      0|            } else {
 1772|       |                result = LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingExtDict, noDictIssue, acceleration);
 1773|      0|            }
 1774|      0|        }
 1775|      0|        streamPtr->dictionary = (const BYTE*)source;
 1776|      0|        streamPtr->dictSize = (U32)inputSize;
 1777|      0|        return result;
 1778|  3.23k|    }
 1779|  3.23k|}
LZ4_decompress_safe:
 2448|  12.8k|{
 2449|  12.8k|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2450|  12.8k|                                  decode_full_block, noDict,
 2451|       |                                  (BYTE*)dest, NULL, 0);
 2452|  12.8k|}
LZ4_decompress_safe_withPrefix64k:
 2476|  3.57k|{
 2477|  3.57k|    return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
 2478|  3.57k|                                  decode_full_block, withPrefix64k,
 2479|  3.57k|                                  (BYTE*)dest - 64 KB, NULL, 0);
  ------------------
  |  |  252|  3.57k|#define KB *(1 <<10)
  ------------------
 2480|  3.57k|}
LZ4_decompress_safe_forceExtDict:
 2522|  1.26k|{
 2523|  1.26k|    DEBUGLOG(5, "LZ4_decompress_safe_forceExtDict");
  ------------------
  |  |  290|  1.26k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2524|  1.26k|    return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
 2525|  1.26k|                                  decode_full_block, usingExtDict,
 2526|  1.26k|                                  (BYTE*)dest, (const BYTE*)dictStart, dictSize);
 2527|  1.26k|}
LZ4_decompress_safe_usingDict:
 2716|  17.7k|{
 2717|  17.7k|    if (dictSize==0)
  ------------------
  |  Branch (2717:9): [True: 12.8k, False: 4.84k]
  ------------------
 2718|  12.8k|        return LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize);
 2719|  4.84k|    if (dictStart+dictSize == dest) {
  ------------------
  |  Branch (2719:9): [True: 3.57k, False: 1.26k]
  ------------------
 2720|  3.57k|        if (dictSize >= 64 KB - 1) {
  ------------------
  |  |  252|  3.57k|#define KB *(1 <<10)
  ------------------
  |  Branch (2720:13): [True: 3.57k, False: 0]
  ------------------
 2721|  3.57k|            return LZ4_decompress_safe_withPrefix64k(source, dest, compressedSize, maxOutputSize);
 2722|  3.57k|        }
 2723|  3.57k|        assert(dictSize >= 0);
  ------------------
  |  Branch (2723:9): [True: 0, False: 0]
  |  Branch (2723:9): [True: 0, False: 0]
  ------------------
 2724|      0|        return LZ4_decompress_safe_withSmallPrefix(source, dest, compressedSize, maxOutputSize, (size_t)dictSize);
 2725|      0|    }
 2726|  4.84k|    assert(dictSize >= 0);
  ------------------
  |  Branch (2726:5): [True: 0, False: 1.26k]
  |  Branch (2726:5): [True: 1.26k, False: 0]
  ------------------
 2727|  1.26k|    return LZ4_decompress_safe_forceExtDict(source, dest, compressedSize, maxOutputSize, dictStart, (size_t)dictSize);
 2728|  1.26k|}
lz4.c:LZ4_compress_generic:
 1352|  5.59k|{
 1353|  5.59k|    DEBUGLOG(5, "LZ4_compress_generic: srcSize=%i, dstCapacity=%i",
  ------------------
  |  |  290|  5.59k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1354|  5.59k|                srcSize, dstCapacity);
 1355|       |
 1356|  5.59k|    if ((U32)srcSize > (U32)LZ4_MAX_INPUT_SIZE) { return 0; }  /* Unsupported srcSize, too large (or negative) */
  ------------------
  |  |  214|  5.59k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  ------------------
  |  Branch (1356:9): [True: 0, False: 5.59k]
  ------------------
 1357|  5.59k|    if (srcSize == 0) {   /* src == NULL supported if srcSize == 0 */
  ------------------
  |  Branch (1357:9): [True: 0, False: 5.59k]
  ------------------
 1358|      0|        if (outputDirective != notLimited && dstCapacity <= 0) return 0;  /* no output, can't write anything */
  ------------------
  |  Branch (1358:13): [True: 0, False: 0]
  |  Branch (1358:46): [True: 0, False: 0]
  ------------------
 1359|      0|        DEBUGLOG(5, "Generating an empty block");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1360|      0|        assert(outputDirective == notLimited || dstCapacity >= 1);
  ------------------
  |  Branch (1360:9): [True: 0, False: 0]
  |  Branch (1360:9): [True: 0, False: 0]
  |  Branch (1360:9): [True: 0, False: 0]
  |  Branch (1360:9): [True: 0, False: 0]
  ------------------
 1361|      0|        assert(dst != NULL);
  ------------------
  |  Branch (1361:9): [True: 0, False: 0]
  |  Branch (1361:9): [True: 0, False: 0]
  ------------------
 1362|      0|        dst[0] = 0;
 1363|      0|        if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1363:13): [True: 0, False: 0]
  ------------------
 1364|      0|            assert (inputConsumed != NULL);
  ------------------
  |  Branch (1364:13): [True: 0, False: 0]
  |  Branch (1364:13): [True: 0, False: 0]
  ------------------
 1365|      0|            *inputConsumed = 0;
 1366|      0|        }
 1367|      0|        return 1;
 1368|      0|    }
 1369|  5.59k|    assert(src != NULL);
  ------------------
  |  Branch (1369:5): [True: 0, False: 5.59k]
  |  Branch (1369:5): [True: 5.59k, False: 0]
  ------------------
 1370|       |
 1371|  5.59k|    return LZ4_compress_generic_validated(cctx, src, dst, srcSize,
 1372|  5.59k|                inputConsumed, /* only written into if outputDirective == fillOutput */
 1373|  5.59k|                dstCapacity, outputDirective,
 1374|  5.59k|                tableType, dictDirective, dictIssue, acceleration);
 1375|  5.59k|}
lz4.c:LZ4_compress_generic_validated:
  938|  5.59k|{
  939|  5.59k|    int result;
  940|  5.59k|    const BYTE* ip = (const BYTE*)source;
  941|       |
  942|  5.59k|    U32 const startIndex = cctx->currentOffset;
  943|  5.59k|    const BYTE* base = (const BYTE*)source - startIndex;
  944|  5.59k|    const BYTE* lowLimit;
  945|       |
  946|  5.59k|    const LZ4_stream_t_internal* dictCtx = (const LZ4_stream_t_internal*) cctx->dictCtx;
  947|  5.59k|    const BYTE* const dictionary =
  948|  5.59k|        dictDirective == usingDictCtx ? dictCtx->dictionary : cctx->dictionary;
  ------------------
  |  Branch (948:9): [True: 0, False: 5.59k]
  ------------------
  949|  5.59k|    const U32 dictSize =
  950|  5.59k|        dictDirective == usingDictCtx ? dictCtx->dictSize : cctx->dictSize;
  ------------------
  |  Branch (950:9): [True: 0, False: 5.59k]
  ------------------
  951|  5.59k|    const U32 dictDelta =
  952|  5.59k|        (dictDirective == usingDictCtx) ? startIndex - dictCtx->currentOffset : 0;   /* make indexes in dictCtx comparable with indexes in current context */
  ------------------
  |  Branch (952:9): [True: 0, False: 5.59k]
  ------------------
  953|       |
  954|  5.59k|    int const maybe_extMem = (dictDirective == usingExtDict) || (dictDirective == usingDictCtx);
  ------------------
  |  Branch (954:30): [True: 0, False: 5.59k]
  |  Branch (954:65): [True: 0, False: 5.59k]
  ------------------
  955|  5.59k|    U32 const prefixIdxLimit = startIndex - dictSize;   /* used when dictDirective == dictSmall */
  956|  5.59k|    const BYTE* const dictEnd = dictionary ? dictionary + dictSize : dictionary;
  ------------------
  |  Branch (956:33): [True: 3.23k, False: 2.35k]
  ------------------
  957|  5.59k|    const BYTE* anchor = (const BYTE*) source;
  958|  5.59k|    const BYTE* const iend = ip + inputSize;
  959|  5.59k|    const BYTE* const mflimitPlusOne = iend - MFLIMIT + 1;
  ------------------
  |  |  247|  5.59k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  960|  5.59k|    const BYTE* const matchlimit = iend - LASTLITERALS;
  ------------------
  |  |  246|  5.59k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  961|       |
  962|       |    /* the dictCtx currentOffset is indexed on the start of the dictionary,
  963|       |     * while a dictionary in the current context precedes the currentOffset */
  964|  5.59k|    const BYTE* dictBase = (dictionary == NULL) ? NULL :
  ------------------
  |  Branch (964:28): [True: 2.35k, False: 3.23k]
  ------------------
  965|  5.59k|                           (dictDirective == usingDictCtx) ?
  ------------------
  |  Branch (965:28): [True: 0, False: 3.23k]
  ------------------
  966|      0|                            dictionary + dictSize - dictCtx->currentOffset :
  967|  3.23k|                            dictionary + dictSize - startIndex;
  968|       |
  969|  5.59k|    BYTE* op = (BYTE*) dest;
  970|  5.59k|    BYTE* const olimit = op + maxOutputSize;
  971|       |
  972|  5.59k|    U32 offset = 0;
  973|  5.59k|    U32 forwardH;
  974|       |
  975|  5.59k|    DEBUGLOG(5, "LZ4_compress_generic_validated: srcSize=%i, tableType=%u", inputSize, tableType);
  ------------------
  |  |  290|  5.59k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  976|  5.59k|    assert(ip != NULL);
  ------------------
  |  Branch (976:5): [True: 0, False: 5.59k]
  |  Branch (976:5): [True: 5.59k, False: 0]
  ------------------
  977|  5.59k|    if (tableType == byU16) assert(inputSize<LZ4_64Klimit);  /* Size too large (not within 64K limit) */
  ------------------
  |  Branch (977:9): [True: 2.00k, False: 3.59k]
  |  Branch (977:29): [True: 0, False: 2.00k]
  |  Branch (977:29): [True: 2.00k, False: 0]
  ------------------
  978|  5.59k|    if (tableType == byPtr) assert(dictDirective==noDict);   /* only supported use case with byPtr */
  ------------------
  |  Branch (978:9): [True: 0, False: 5.59k]
  |  Branch (978:29): [True: 0, False: 0]
  |  Branch (978:29): [True: 0, False: 0]
  ------------------
  979|       |    /* If init conditions are not met, we don't have to mark stream
  980|       |     * as having dirty context, since no action was taken yet */
  981|  5.59k|    if (outputDirective == fillOutput && maxOutputSize < 1) { return 0; } /* Impossible to store anything */
  ------------------
  |  Branch (981:9): [True: 0, False: 5.59k]
  |  Branch (981:42): [True: 0, False: 0]
  ------------------
  982|  5.59k|    assert(acceleration >= 1);
  ------------------
  |  Branch (982:5): [True: 0, False: 5.59k]
  |  Branch (982:5): [True: 5.59k, False: 0]
  ------------------
  983|       |
  984|  5.59k|    lowLimit = (const BYTE*)source - (dictDirective == withPrefix64k ? dictSize : 0);
  ------------------
  |  Branch (984:39): [True: 3.23k, False: 2.35k]
  ------------------
  985|       |
  986|       |    /* Update context state */
  987|  5.59k|    if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (987:9): [True: 0, False: 5.59k]
  ------------------
  988|       |        /* Subsequent linked blocks can't use the dictionary. */
  989|       |        /* Instead, they use the block we just compressed. */
  990|      0|        cctx->dictCtx = NULL;
  991|      0|        cctx->dictSize = (U32)inputSize;
  992|  5.59k|    } else {
  993|  5.59k|        cctx->dictSize += (U32)inputSize;
  994|  5.59k|    }
  995|  5.59k|    cctx->currentOffset += (U32)inputSize;
  996|  5.59k|    cctx->tableType = (U32)tableType;
  997|       |
  998|  5.59k|    if (inputSize<LZ4_minLength) goto _last_literals;        /* Input too small, no compression (all literals) */
  ------------------
  |  Branch (998:9): [True: 145, False: 5.45k]
  ------------------
  999|       |
 1000|       |    /* First Byte */
 1001|  5.45k|    {   U32 const h = LZ4_hashPosition(ip, tableType);
 1002|  5.45k|        if (tableType == byPtr) {
  ------------------
  |  Branch (1002:13): [True: 0, False: 5.45k]
  ------------------
 1003|      0|            LZ4_putPositionOnHash(ip, h, cctx->hashTable, byPtr);
 1004|  5.45k|        } else {
 1005|  5.45k|            LZ4_putIndexOnHash(startIndex, h, cctx->hashTable, tableType);
 1006|  5.45k|    }   }
 1007|  5.45k|    ip++; forwardH = LZ4_hashPosition(ip, tableType);
 1008|       |
 1009|       |    /* Main Loop */
 1010|  2.28M|    for ( ; ; ) {
 1011|  2.28M|        const BYTE* match;
 1012|  2.28M|        BYTE* token;
 1013|  2.28M|        const BYTE* filledIp;
 1014|       |
 1015|       |        /* Find a match */
 1016|  2.28M|        if (tableType == byPtr) {
  ------------------
  |  Branch (1016:13): [True: 0, False: 2.28M]
  ------------------
 1017|      0|            const BYTE* forwardIp = ip;
 1018|      0|            int step = 1;
 1019|      0|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1020|      0|            do {
 1021|      0|                U32 const h = forwardH;
 1022|      0|                ip = forwardIp;
 1023|      0|                forwardIp += step;
 1024|      0|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1025|       |
 1026|      0|                if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
  ------------------
  |  |  181|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1027|      0|                assert(ip < mflimitPlusOne);
  ------------------
  |  Branch (1027:17): [True: 0, False: 0]
  |  Branch (1027:17): [True: 0, False: 0]
  ------------------
 1028|       |
 1029|      0|                match = LZ4_getPositionOnHash(h, cctx->hashTable, tableType);
 1030|      0|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1031|      0|                LZ4_putPositionOnHash(ip, h, cctx->hashTable, tableType);
 1032|       |
 1033|      0|            } while ( (match+LZ4_DISTANCE_MAX < ip)
  ------------------
  |  |  676|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1033:23): [True: 0, False: 0]
  ------------------
 1034|      0|                   || (LZ4_read32(match) != LZ4_read32(ip)) );
  ------------------
  |  Branch (1034:23): [True: 0, False: 0]
  ------------------
 1035|       |
 1036|  2.28M|        } else {   /* byU32, byU16 */
 1037|       |
 1038|  2.28M|            const BYTE* forwardIp = ip;
 1039|  2.28M|            int step = 1;
 1040|  2.28M|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1041|  23.4M|            do {
 1042|  23.4M|                U32 const h = forwardH;
 1043|  23.4M|                U32 const current = (U32)(forwardIp - base);
 1044|  23.4M|                U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1045|  23.4M|                assert(matchIndex <= current);
  ------------------
  |  Branch (1045:17): [True: 0, False: 23.4M]
  |  Branch (1045:17): [True: 23.4M, False: 0]
  ------------------
 1046|  23.4M|                assert(forwardIp - base < (ptrdiff_t)(2 GB - 1));
  ------------------
  |  Branch (1046:17): [True: 0, False: 23.4M]
  |  Branch (1046:17): [True: 23.4M, False: 0]
  ------------------
 1047|  23.4M|                ip = forwardIp;
 1048|  23.4M|                forwardIp += step;
 1049|  23.4M|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1050|       |
 1051|  23.4M|                if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
  ------------------
  |  |  181|  23.4M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  23.4M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.71k, False: 23.4M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1052|  23.4M|                assert(ip < mflimitPlusOne);
  ------------------
  |  Branch (1052:17): [True: 0, False: 23.4M]
  |  Branch (1052:17): [True: 23.4M, False: 0]
  ------------------
 1053|       |
 1054|  23.4M|                if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1054:21): [True: 0, False: 23.4M]
  ------------------
 1055|      0|                    if (matchIndex < startIndex) {
  ------------------
  |  Branch (1055:25): [True: 0, False: 0]
  ------------------
 1056|       |                        /* there was no match, try the dictionary */
 1057|      0|                        assert(tableType == byU32);
  ------------------
  |  Branch (1057:25): [True: 0, False: 0]
  |  Branch (1057:25): [True: 0, False: 0]
  ------------------
 1058|      0|                        matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32);
 1059|      0|                        match = dictBase + matchIndex;
 1060|      0|                        matchIndex += dictDelta;   /* make dictCtx index comparable with current context */
 1061|      0|                        lowLimit = dictionary;
 1062|      0|                    } else {
 1063|      0|                        match = base + matchIndex;
 1064|      0|                        lowLimit = (const BYTE*)source;
 1065|      0|                    }
 1066|  23.4M|                } else if (dictDirective == usingExtDict) {
  ------------------
  |  Branch (1066:28): [True: 0, False: 23.4M]
  ------------------
 1067|      0|                    if (matchIndex < startIndex) {
  ------------------
  |  Branch (1067:25): [True: 0, False: 0]
  ------------------
 1068|      0|                        DEBUGLOG(7, "extDict candidate: matchIndex=%5u  <  startIndex=%5u", matchIndex, startIndex);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1069|      0|                        assert(startIndex - matchIndex >= MINMATCH);
  ------------------
  |  Branch (1069:25): [True: 0, False: 0]
  |  Branch (1069:25): [True: 0, False: 0]
  ------------------
 1070|      0|                        assert(dictBase);
  ------------------
  |  Branch (1070:25): [True: 0, False: 0]
  |  Branch (1070:25): [True: 0, False: 0]
  ------------------
 1071|      0|                        match = dictBase + matchIndex;
 1072|      0|                        lowLimit = dictionary;
 1073|      0|                    } else {
 1074|      0|                        match = base + matchIndex;
 1075|      0|                        lowLimit = (const BYTE*)source;
 1076|      0|                    }
 1077|  23.4M|                } else {   /* single continuous memory segment */
 1078|  23.4M|                    match = base + matchIndex;
 1079|  23.4M|                }
 1080|  23.4M|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1081|  23.4M|                LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1082|       |
 1083|  23.4M|                DEBUGLOG(7, "candidate at pos=%u  (offset=%u \n", matchIndex, current - matchIndex);
  ------------------
  |  |  290|  23.4M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1084|  23.4M|                if ((dictIssue == dictSmall) && (matchIndex < prefixIdxLimit)) { continue; }    /* match outside of valid area */
  ------------------
  |  Branch (1084:21): [True: 0, False: 23.4M]
  |  Branch (1084:49): [True: 0, False: 0]
  ------------------
 1085|  23.4M|                assert(matchIndex < current);
  ------------------
  |  Branch (1085:17): [True: 0, False: 23.4M]
  |  Branch (1085:17): [True: 23.4M, False: 0]
  ------------------
 1086|  23.4M|                if ( ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  676|  5.41M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                              if ( ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  256|  5.41M|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
  |  Branch (1086:23): [True: 18.0M, False: 5.41M]
  |  Branch (1086:47): [Folded, False: 0]
  ------------------
 1087|  18.0M|                  && (matchIndex+LZ4_DISTANCE_MAX < current)) {
  ------------------
  |  |  676|  18.0M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1087:22): [True: 1.63M, False: 16.3M]
  ------------------
 1088|  1.63M|                    continue;
 1089|  1.63M|                } /* too far */
 1090|  23.4M|                assert((current - matchIndex) <= LZ4_DISTANCE_MAX);  /* match now expected within distance */
  ------------------
  |  Branch (1090:17): [True: 0, False: 21.8M]
  |  Branch (1090:17): [True: 21.8M, False: 0]
  ------------------
 1091|       |
 1092|  21.8M|                if (LZ4_read32(match) == LZ4_read32(ip)) {
  ------------------
  |  Branch (1092:21): [True: 2.27M, False: 19.5M]
  ------------------
 1093|  2.27M|                    if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1093:25): [True: 0, False: 2.27M]
  ------------------
 1094|  2.27M|                    break;   /* match found */
 1095|  2.27M|                }
 1096|       |
 1097|  21.8M|            } while(1);
  ------------------
  |  Branch (1097:21): [True: 21.1M, Folded]
  ------------------
 1098|  2.28M|        }
 1099|       |
 1100|       |        /* Catch up */
 1101|  2.27M|        filledIp = ip;
 1102|  2.27M|        assert(ip > anchor); /* this is always true as ip has been advanced before entering the main loop */
  ------------------
  |  Branch (1102:9): [True: 0, False: 2.27M]
  |  Branch (1102:9): [True: 2.27M, False: 0]
  ------------------
 1103|  2.27M|        if ((match > lowLimit) && unlikely(ip[-1] == match[-1])) {
  ------------------
  |  |  181|  2.27M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  2.27M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 669k, False: 1.60M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1103:13): [True: 2.27M, False: 3.80k]
  ------------------
 1104|  1.80M|            do { ip--; match--; } while (((ip > anchor) & (match > lowLimit)) && (unlikely(ip[-1] == match[-1])));
  ------------------
  |  |  181|  1.67M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  1.67M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1104:42): [True: 1.67M, False: 124k]
  |  Branch (1104:82): [True: 1.13M, False: 545k]
  ------------------
 1105|   669k|        }
 1106|       |
 1107|       |        /* Encode Literals */
 1108|  2.27M|        {   unsigned const litLength = (unsigned)(ip - anchor);
 1109|  2.27M|            token = op++;
 1110|  2.27M|            if ((outputDirective == limitedOutput) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1110:17): [True: 2.27M, False: 0]
  ------------------
 1111|  2.27M|                (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength/255) > olimit)) ) {
  ------------------
  |  |  181|  2.27M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  2.27M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1111:17): [True: 58, False: 2.27M]
  ------------------
 1112|     58|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1113|     58|            }
 1114|  2.27M|            if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1114:17): [True: 0, False: 2.27M]
  ------------------
 1115|      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))) {
  ------------------
  |  |  181|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1115:17): [True: 0, False: 0]
  ------------------
 1116|      0|                op--;
 1117|      0|                goto _last_literals;
 1118|      0|            }
 1119|  2.27M|            if (litLength >= RUN_MASK) {
  ------------------
  |  |  264|  2.27M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  2.27M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  2.27M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1119:17): [True: 361k, False: 1.91M]
  ------------------
 1120|   361k|                unsigned len = litLength - RUN_MASK;
  ------------------
  |  |  264|   361k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|   361k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|   361k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1121|   361k|                *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  264|   361k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|   361k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|   361k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                              *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  261|   361k|#define ML_BITS  4
  ------------------
 1122|   584k|                for(; len >= 255 ; len-=255) *op++ = 255;
  ------------------
  |  Branch (1122:23): [True: 223k, False: 361k]
  ------------------
 1123|   361k|                *op++ = (BYTE)len;
 1124|   361k|            }
 1125|  1.91M|            else *token = (BYTE)(litLength<<ML_BITS);
  ------------------
  |  |  261|  1.91M|#define ML_BITS  4
  ------------------
 1126|       |
 1127|       |            /* Copy Literals */
 1128|  2.27M|            LZ4_wildCopy8(op, anchor, op+litLength);
 1129|  2.27M|            op+=litLength;
 1130|  2.27M|            DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  290|  2.27M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1131|  2.27M|                        (int)(anchor-(const BYTE*)source), litLength, (int)(ip-(const BYTE*)source));
 1132|  2.27M|        }
 1133|       |
 1134|  5.60M|_next_match:
 1135|       |        /* at this stage, the following variables must be correctly set :
 1136|       |         * - ip : at start of LZ operation
 1137|       |         * - match : at start of previous pattern occurrence; can be within current prefix, or within extDict
 1138|       |         * - offset : if maybe_ext_memSegment==1 (constant)
 1139|       |         * - lowLimit : must be == dictionary to mean "match is within extDict"; must be == source otherwise
 1140|       |         * - token and *token : position to write 4-bits for match length; higher 4-bits for literal length supposed already written
 1141|       |         */
 1142|       |
 1143|  5.60M|        if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1143:13): [True: 0, False: 5.60M]
  ------------------
 1144|      0|            (op + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit)) {
  ------------------
  |  |  247|      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)) {
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
  |  Branch (1144:13): [True: 0, False: 0]
  ------------------
 1145|       |            /* the match was too close to the end, rewind and go to last literals */
 1146|      0|            op = token;
 1147|      0|            goto _last_literals;
 1148|      0|        }
 1149|       |
 1150|       |        /* Encode Offset */
 1151|  5.60M|        if (maybe_extMem) {   /* static test */
  ------------------
  |  Branch (1151:13): [True: 0, False: 5.60M]
  ------------------
 1152|      0|            DEBUGLOG(6, "             with offset=%u  (ext if > %i)", offset, (int)(ip - (const BYTE*)source));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1153|      0|            assert(offset <= LZ4_DISTANCE_MAX && offset > 0);
  ------------------
  |  Branch (1153:13): [True: 0, False: 0]
  |  Branch (1153:13): [True: 0, False: 0]
  |  Branch (1153:13): [True: 0, False: 0]
  |  Branch (1153:13): [True: 0, False: 0]
  ------------------
 1154|      0|            LZ4_writeLE16(op, (U16)offset); op+=2;
 1155|  5.60M|        } else  {
 1156|  5.60M|            DEBUGLOG(6, "             with offset=%u  (same segment)", (U32)(ip - match));
  ------------------
  |  |  290|  5.60M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1157|  5.60M|            assert(ip-match <= LZ4_DISTANCE_MAX);
  ------------------
  |  Branch (1157:13): [True: 0, False: 5.60M]
  |  Branch (1157:13): [True: 5.60M, False: 0]
  ------------------
 1158|  5.60M|            LZ4_writeLE16(op, (U16)(ip - match)); op+=2;
 1159|  5.60M|        }
 1160|       |
 1161|       |        /* Encode MatchLength */
 1162|  5.60M|        {   unsigned matchCode;
 1163|       |
 1164|  5.60M|            if ( (dictDirective==usingExtDict || dictDirective==usingDictCtx)
  ------------------
  |  Branch (1164:19): [True: 0, False: 5.60M]
  |  Branch (1164:50): [True: 0, False: 5.60M]
  ------------------
 1165|      0|              && (lowLimit==dictionary) /* match within extDict */ ) {
  ------------------
  |  Branch (1165:18): [True: 0, False: 0]
  ------------------
 1166|      0|                const BYTE* limit = ip + (dictEnd-match);
 1167|      0|                assert(dictEnd > match);
  ------------------
  |  Branch (1167:17): [True: 0, False: 0]
  |  Branch (1167:17): [True: 0, False: 0]
  ------------------
 1168|      0|                if (limit > matchlimit) limit = matchlimit;
  ------------------
  |  Branch (1168:21): [True: 0, False: 0]
  ------------------
 1169|      0|                matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, limit);
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
                              matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, limit);
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
 1170|      0|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
 1171|      0|                if (ip==limit) {
  ------------------
  |  Branch (1171:21): [True: 0, False: 0]
  ------------------
 1172|      0|                    unsigned const more = LZ4_count(limit, (const BYTE*)source, matchlimit);
 1173|      0|                    matchCode += more;
 1174|      0|                    ip += more;
 1175|      0|                }
 1176|      0|                DEBUGLOG(6, "             with matchLength=%u starting in extDict", matchCode+MINMATCH);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1177|  5.60M|            } else {
 1178|  5.60M|                matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  243|  5.60M|#define MINMATCH 4
  ------------------
                              matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  243|  5.60M|#define MINMATCH 4
  ------------------
 1179|  5.60M|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  243|  5.60M|#define MINMATCH 4
  ------------------
 1180|  5.60M|                DEBUGLOG(6, "             with matchLength=%u", matchCode+MINMATCH);
  ------------------
  |  |  290|  5.60M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1181|  5.60M|            }
 1182|       |
 1183|  5.60M|            if ((outputDirective) &&    /* Check output buffer overflow */
  ------------------
  |  Branch (1183:17): [True: 5.60M, False: 0]
  ------------------
 1184|  5.60M|                (unlikely(op + (1 + LASTLITERALS) + (matchCode+240)/255 > olimit)) ) {
  ------------------
  |  |  181|  5.60M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  5.60M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1184:17): [True: 17, False: 5.60M]
  ------------------
 1185|     17|                if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1185:21): [True: 0, False: 17]
  ------------------
 1186|       |                    /* Match description too long : reduce it */
 1187|      0|                    U32 newMatchCode = 15 /* in token */ - 1 /* to avoid needing a zero byte */ + ((U32)(olimit - op) - 1 - LASTLITERALS) * 255;
  ------------------
  |  |  246|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1188|      0|                    ip -= matchCode - newMatchCode;
 1189|      0|                    assert(newMatchCode < matchCode);
  ------------------
  |  Branch (1189:21): [True: 0, False: 0]
  |  Branch (1189:21): [True: 0, False: 0]
  ------------------
 1190|      0|                    matchCode = newMatchCode;
 1191|      0|                    if (unlikely(ip <= filledIp)) {
  ------------------
  |  |  181|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1192|       |                        /* We have already filled up to filledIp so if ip ends up less than filledIp
 1193|       |                         * we have positions in the hash table beyond the current position. This is
 1194|       |                         * a problem if we reuse the hash table. So we have to remove these positions
 1195|       |                         * from the hash table.
 1196|       |                         */
 1197|      0|                        const BYTE* ptr;
 1198|      0|                        DEBUGLOG(5, "Clearing %u positions", (U32)(filledIp - ip));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1199|      0|                        for (ptr = ip; ptr <= filledIp; ++ptr) {
  ------------------
  |  Branch (1199:40): [True: 0, False: 0]
  ------------------
 1200|      0|                            U32 const h = LZ4_hashPosition(ptr, tableType);
 1201|      0|                            LZ4_clearHash(h, cctx->hashTable, tableType);
 1202|      0|                        }
 1203|      0|                    }
 1204|     17|                } else {
 1205|     17|                    assert(outputDirective == limitedOutput);
  ------------------
  |  Branch (1205:21): [True: 0, False: 17]
  |  Branch (1205:21): [True: 17, False: 0]
  ------------------
 1206|     17|                    return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1207|     17|                }
 1208|     17|            }
 1209|  5.60M|            if (matchCode >= ML_MASK) {
  ------------------
  |  |  262|  5.60M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  5.60M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (1209:17): [True: 1.21M, False: 4.38M]
  ------------------
 1210|  1.21M|                *token += ML_MASK;
  ------------------
  |  |  262|  1.21M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.21M|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1211|  1.21M|                matchCode -= ML_MASK;
  ------------------
  |  |  262|  1.21M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.21M|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1212|  1.21M|                LZ4_write32(op, 0xFFFFFFFF);
 1213|  1.34M|                while (matchCode >= 4*255) {
  ------------------
  |  Branch (1213:24): [True: 127k, False: 1.21M]
  ------------------
 1214|   127k|                    op+=4;
 1215|   127k|                    LZ4_write32(op, 0xFFFFFFFF);
 1216|   127k|                    matchCode -= 4*255;
 1217|   127k|                }
 1218|  1.21M|                op += matchCode / 255;
 1219|  1.21M|                *op++ = (BYTE)(matchCode % 255);
 1220|  1.21M|            } else
 1221|  4.38M|                *token += (BYTE)(matchCode);
 1222|  5.60M|        }
 1223|       |        /* Ensure we have enough space for the last literals. */
 1224|  5.60M|        assert(!(outputDirective == fillOutput && op + 1 + LASTLITERALS > olimit));
  ------------------
  |  Branch (1224:9): [True: 0, False: 5.60M]
  |  Branch (1224:9): [True: 0, False: 0]
  |  Branch (1224:9): [True: 0, False: 5.60M]
  |  Branch (1224:9): [True: 0, False: 0]
  ------------------
 1225|       |
 1226|  5.60M|        anchor = ip;
 1227|       |
 1228|       |        /* Test end of chunk */
 1229|  5.60M|        if (ip >= mflimitPlusOne) break;
  ------------------
  |  Branch (1229:13): [True: 3.65k, False: 5.59M]
  ------------------
 1230|       |
 1231|       |        /* Fill table */
 1232|  5.59M|        {   U32 const h = LZ4_hashPosition(ip-2, tableType);
 1233|  5.59M|            if (tableType == byPtr) {
  ------------------
  |  Branch (1233:17): [True: 0, False: 5.59M]
  ------------------
 1234|      0|                LZ4_putPositionOnHash(ip-2, h, cctx->hashTable, byPtr);
 1235|  5.59M|            } else {
 1236|  5.59M|                U32 const idx = (U32)((ip-2) - base);
 1237|  5.59M|                LZ4_putIndexOnHash(idx, h, cctx->hashTable, tableType);
 1238|  5.59M|        }   }
 1239|       |
 1240|       |        /* Test next position */
 1241|  5.59M|        if (tableType == byPtr) {
  ------------------
  |  Branch (1241:13): [True: 0, False: 5.59M]
  ------------------
 1242|       |
 1243|      0|            match = LZ4_getPosition(ip, cctx->hashTable, tableType);
 1244|      0|            LZ4_putPosition(ip, cctx->hashTable, tableType);
 1245|      0|            if ( (match+LZ4_DISTANCE_MAX >= ip)
  ------------------
  |  |  676|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1245:18): [True: 0, False: 0]
  ------------------
 1246|      0|              && (LZ4_read32(match) == LZ4_read32(ip)) )
  ------------------
  |  Branch (1246:18): [True: 0, False: 0]
  ------------------
 1247|      0|            { token=op++; *token=0; goto _next_match; }
 1248|       |
 1249|  5.59M|        } else {   /* byU32, byU16 */
 1250|       |
 1251|  5.59M|            U32 const h = LZ4_hashPosition(ip, tableType);
 1252|  5.59M|            U32 const current = (U32)(ip-base);
 1253|  5.59M|            U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1254|  5.59M|            assert(matchIndex < current);
  ------------------
  |  Branch (1254:13): [True: 0, False: 5.59M]
  |  Branch (1254:13): [True: 5.59M, False: 0]
  ------------------
 1255|  5.59M|            if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1255:17): [True: 0, False: 5.59M]
  ------------------
 1256|      0|                if (matchIndex < startIndex) {
  ------------------
  |  Branch (1256:21): [True: 0, False: 0]
  ------------------
 1257|       |                    /* there was no match, try the dictionary */
 1258|      0|                    assert(tableType == byU32);
  ------------------
  |  Branch (1258:21): [True: 0, False: 0]
  |  Branch (1258:21): [True: 0, False: 0]
  ------------------
 1259|      0|                    matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32);
 1260|      0|                    match = dictBase + matchIndex;
 1261|      0|                    lowLimit = dictionary;   /* required for match length counter */
 1262|      0|                    matchIndex += dictDelta;
 1263|      0|                } else {
 1264|      0|                    match = base + matchIndex;
 1265|      0|                    lowLimit = (const BYTE*)source;  /* required for match length counter */
 1266|      0|                }
 1267|  5.59M|            } else if (dictDirective==usingExtDict) {
  ------------------
  |  Branch (1267:24): [True: 0, False: 5.59M]
  ------------------
 1268|      0|                if (matchIndex < startIndex) {
  ------------------
  |  Branch (1268:21): [True: 0, False: 0]
  ------------------
 1269|      0|                    assert(dictBase);
  ------------------
  |  Branch (1269:21): [True: 0, False: 0]
  |  Branch (1269:21): [True: 0, False: 0]
  ------------------
 1270|      0|                    match = dictBase + matchIndex;
 1271|      0|                    lowLimit = dictionary;   /* required for match length counter */
 1272|      0|                } else {
 1273|      0|                    match = base + matchIndex;
 1274|      0|                    lowLimit = (const BYTE*)source;   /* required for match length counter */
 1275|      0|                }
 1276|  5.59M|            } else {   /* single memory segment */
 1277|  5.59M|                match = base + matchIndex;
 1278|  5.59M|            }
 1279|  5.59M|            LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1280|  5.59M|            assert(matchIndex < current);
  ------------------
  |  Branch (1280:13): [True: 0, False: 5.59M]
  |  Branch (1280:13): [True: 5.59M, False: 0]
  ------------------
 1281|  5.59M|            if ( ((dictIssue==dictSmall) ? (matchIndex >= prefixIdxLimit) : 1)
  ------------------
  |  Branch (1281:18): [True: 5.59M, False: 0]
  |  Branch (1281:19): [True: 0, False: 5.59M]
  ------------------
 1282|  5.59M|              && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  676|  1.75M|#  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 >= current))
  ------------------
  |  |  256|  1.75M|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
                            && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  676|  3.84M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1282:18): [True: 5.25M, False: 339k]
  |  Branch (1282:20): [True: 1.75M, False: 3.84M]
  |  Branch (1282:42): [True: 0, Folded]
  ------------------
 1283|  5.25M|              && (LZ4_read32(match) == LZ4_read32(ip)) ) {
  ------------------
  |  Branch (1283:18): [True: 3.32M, False: 1.93M]
  ------------------
 1284|  3.32M|                token=op++;
 1285|  3.32M|                *token=0;
 1286|  3.32M|                if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1286:21): [True: 0, False: 3.32M]
  ------------------
 1287|  3.32M|                DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  290|  3.32M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1288|  3.32M|                            (int)(anchor-(const BYTE*)source), 0, (int)(ip-(const BYTE*)source));
 1289|  3.32M|                goto _next_match;
 1290|  3.32M|            }
 1291|  5.59M|        }
 1292|       |
 1293|       |        /* Prepare next loop */
 1294|  2.27M|        forwardH = LZ4_hashPosition(++ip, tableType);
 1295|       |
 1296|  2.27M|    }
 1297|       |
 1298|  5.52k|_last_literals:
 1299|       |    /* Encode Last Literals */
 1300|  5.52k|    {   size_t lastRun = (size_t)(iend - anchor);
 1301|  5.52k|        if ( (outputDirective) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1301:14): [True: 5.52k, False: 0]
  ------------------
 1302|  5.52k|            (op + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > olimit)) {
  ------------------
  |  |  264|  5.52k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  5.52k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  5.52k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1302:13): [True: 688, False: 4.83k]
  ------------------
 1303|    688|            if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1303:17): [True: 0, False: 688]
  ------------------
 1304|       |                /* adapt lastRun to fill 'dst' */
 1305|      0|                assert(olimit >= op);
  ------------------
  |  Branch (1305:17): [True: 0, False: 0]
  |  Branch (1305:17): [True: 0, False: 0]
  ------------------
 1306|      0|                lastRun  = (size_t)(olimit-op) - 1/*token*/;
 1307|      0|                lastRun -= (lastRun + 256 - RUN_MASK) / 256;  /*additional length tokens*/
  ------------------
  |  |  264|      0|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|      0|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|      0|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1308|    688|            } else {
 1309|    688|                assert(outputDirective == limitedOutput);
  ------------------
  |  Branch (1309:17): [True: 0, False: 688]
  |  Branch (1309:17): [True: 688, False: 0]
  ------------------
 1310|    688|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1311|    688|            }
 1312|    688|        }
 1313|  4.83k|        DEBUGLOG(6, "Final literal run : %i literals", (int)lastRun);
  ------------------
  |  |  290|  4.83k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1314|  4.83k|        if (lastRun >= RUN_MASK) {
  ------------------
  |  |  264|  4.83k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  4.83k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  4.83k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1314:13): [True: 1.02k, False: 3.80k]
  ------------------
 1315|  1.02k|            size_t accumulator = lastRun - RUN_MASK;
  ------------------
  |  |  264|  1.02k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  1.02k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  1.02k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1316|  1.02k|            *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  264|  1.02k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  1.02k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  1.02k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  261|  1.02k|#define ML_BITS  4
  ------------------
 1317|  23.1k|            for(; accumulator >= 255 ; accumulator-=255) *op++ = 255;
  ------------------
  |  Branch (1317:19): [True: 22.0k, False: 1.02k]
  ------------------
 1318|  1.02k|            *op++ = (BYTE) accumulator;
 1319|  3.80k|        } else {
 1320|  3.80k|            *op++ = (BYTE)(lastRun<<ML_BITS);
  ------------------
  |  |  261|  3.80k|#define ML_BITS  4
  ------------------
 1321|  3.80k|        }
 1322|  4.83k|        LZ4_memcpy(op, anchor, lastRun);
  ------------------
  |  |  350|  4.83k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 1323|  4.83k|        ip = anchor + lastRun;
 1324|  4.83k|        op += lastRun;
 1325|  4.83k|    }
 1326|       |
 1327|  4.83k|    if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1327:9): [True: 0, False: 4.83k]
  ------------------
 1328|      0|        *inputConsumed = (int) (((const char*)ip)-source);
 1329|      0|    }
 1330|  4.83k|    result = (int)(((char*)op) - dest);
 1331|  4.83k|    assert(result > 0);
  ------------------
  |  Branch (1331:5): [True: 0, False: 4.83k]
  |  Branch (1331:5): [True: 4.83k, False: 0]
  ------------------
 1332|  4.83k|    DEBUGLOG(5, "LZ4_compress_generic: compressed %i bytes into %i bytes", inputSize, result);
  ------------------
  |  |  290|  4.83k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1333|  4.83k|    return result;
 1334|  4.83k|}
lz4.c:LZ4_hashPosition:
  794|  36.9M|{
  795|  36.9M|    if ((sizeof(reg_t)==8) && (tableType != byU16)) return LZ4_hash5(LZ4_read_ARCH(p), tableType);
  ------------------
  |  Branch (795:9): [True: 36.9M, Folded]
  |  Branch (795:31): [True: 27.5M, False: 9.38M]
  ------------------
  796|       |
  797|       |#ifdef LZ4_STATIC_LINKING_ONLY_ENDIANNESS_INDEPENDENT_OUTPUT
  798|       |    return LZ4_hash4(LZ4_readLE32(p), tableType);
  799|       |#else
  800|  9.38M|    return LZ4_hash4(LZ4_read32(p), tableType);
  801|  36.9M|#endif
  802|  36.9M|}
lz4.c:LZ4_hash5:
  782|  27.5M|{
  783|  27.5M|    const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  697|      0|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  158|      0|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  697|  55.0M|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  158|  27.5M|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  27.5M|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (783:25): [True: 0, False: 27.5M]
  ------------------
  784|  27.5M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (784:9): [True: 27.5M, False: 0]
  ------------------
  785|  27.5M|        const U64 prime5bytes = 889523592379ULL;
  786|  27.5M|        return (U32)(((sequence << 24) * prime5bytes) >> (64 - hashLog));
  787|  27.5M|    } else {
  788|      0|        const U64 prime8bytes = 11400714785074694791ULL;
  789|      0|        return (U32)(((sequence >> 24) * prime8bytes) >> (64 - hashLog));
  790|      0|    }
  791|  27.5M|}
lz4.c:LZ4_isLittleEndian:
  365|  57.0M|{
  366|  57.0M|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  367|  57.0M|    return one.c[0];
  368|  57.0M|}
lz4.c:LZ4_read_ARCH:
  396|  93.9M|static reg_t LZ4_read_ARCH(const void* ptr) { return ((const LZ4_unalignST*)ptr)->uArch; }
lz4.c:LZ4_hash4:
  774|  9.38M|{
  775|  9.38M|    if (tableType == byU16)
  ------------------
  |  Branch (775:9): [True: 9.38M, False: 0]
  ------------------
  776|  9.38M|        return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
  ------------------
  |  |  243|  9.38M|#define MINMATCH 4
  ------------------
                      return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
  ------------------
  |  |  697|  9.38M|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  158|  9.38M|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  9.38M|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  777|      0|    else
  778|      0|        return ((sequence * 2654435761U) >> ((MINMATCH*8)-LZ4_HASHLOG));
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
                      return ((sequence * 2654435761U) >> ((MINMATCH*8)-LZ4_HASHLOG));
  ------------------
  |  |  697|      0|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  158|      0|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  779|  9.38M|}
lz4.c:LZ4_putIndexOnHash:
  817|  34.6M|{
  818|  34.6M|    switch (tableType)
  819|  34.6M|    {
  820|      0|    default: /* fallthrough */
  ------------------
  |  Branch (820:5): [True: 0, False: 34.6M]
  ------------------
  821|      0|    case clearedTable: /* fallthrough */
  ------------------
  |  Branch (821:5): [True: 0, False: 34.6M]
  ------------------
  822|      0|    case byPtr: { /* illegal! */ assert(0); return; }
  ------------------
  |  Branch (822:5): [True: 0, False: 34.6M]
  |  Branch (822:34): [Folded, False: 0]
  |  Branch (822:34): [Folded, False: 0]
  ------------------
  823|  25.7M|    case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = idx; return; }
  ------------------
  |  Branch (823:5): [True: 25.7M, False: 8.92M]
  ------------------
  824|  8.92M|    case byU16: { U16* hashTable = (U16*) tableBase; assert(idx < 65536); hashTable[h] = (U16)idx; return; }
  ------------------
  |  Branch (824:5): [True: 8.92M, False: 25.7M]
  |  Branch (824:54): [True: 0, False: 8.92M]
  |  Branch (824:54): [True: 8.92M, False: 0]
  ------------------
  825|  34.6M|    }
  826|  34.6M|}
lz4.c:LZ4_read32:
  395|  63.5M|static U32 LZ4_read32(const void* ptr) { return ((const LZ4_unalign32*)ptr)->u32; }
lz4.c:LZ4_getIndexOnHash:
  850|  29.0M|{
  851|  29.0M|    LZ4_STATIC_ASSERT(LZ4_MEMORY_USAGE > 2);
  ------------------
  |  |  278|  29.0M|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
  852|  29.0M|    if (tableType == byU32) {
  ------------------
  |  Branch (852:9): [True: 21.8M, False: 7.17M]
  ------------------
  853|  21.8M|        const U32* const hashTable = (const U32*) tableBase;
  854|  21.8M|        assert(h < (1U << (LZ4_MEMORY_USAGE-2)));
  ------------------
  |  Branch (854:9): [True: 0, False: 21.8M]
  |  Branch (854:9): [True: 21.8M, False: 0]
  ------------------
  855|  21.8M|        return hashTable[h];
  856|  21.8M|    }
  857|  7.17M|    if (tableType == byU16) {
  ------------------
  |  Branch (857:9): [True: 7.17M, False: 0]
  ------------------
  858|  7.17M|        const U16* const hashTable = (const U16*) tableBase;
  859|  7.17M|        assert(h < (1U << (LZ4_MEMORY_USAGE-1)));
  ------------------
  |  Branch (859:9): [True: 0, False: 7.17M]
  |  Branch (859:9): [True: 7.17M, False: 0]
  ------------------
  860|  7.17M|        return hashTable[h];
  861|  7.17M|    }
  862|  7.17M|    assert(0); return 0;  /* forbidden case */
  ------------------
  |  Branch (862:5): [Folded, False: 0]
  |  Branch (862:5): [Folded, False: 0]
  ------------------
  863|      0|}
lz4.c:LZ4_wildCopy8:
  467|  2.46M|{
  468|  2.46M|    BYTE* d = (BYTE*)dstPtr;
  469|  2.46M|    const BYTE* s = (const BYTE*)srcPtr;
  470|  2.46M|    BYTE* const e = (BYTE*)dstEnd;
  471|       |
  472|  28.5M|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  350|  28.5M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (472:50): [True: 26.0M, False: 2.46M]
  ------------------
  473|  2.46M|}
lz4.c:LZ4_writeLE16:
  454|  5.60M|{
  455|  5.60M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (455:9): [True: 5.60M, False: 0]
  ------------------
  456|  5.60M|        LZ4_write16(memPtr, value);
  457|  5.60M|    } else {
  458|      0|        BYTE* p = (BYTE*)memPtr;
  459|      0|        p[0] = (BYTE) value;
  460|      0|        p[1] = (BYTE)(value>>8);
  461|      0|    }
  462|  5.60M|}
lz4.c:LZ4_write16:
  398|  5.60M|static void LZ4_write16(void* memPtr, U16 value) { ((LZ4_unalign16*)memPtr)->u16 = value; }
lz4.c:LZ4_count:
  677|  5.60M|{
  678|  5.60M|    const BYTE* const pStart = pIn;
  679|       |
  680|  5.60M|    if (likely(pIn < pInLimit-(STEPSIZE-1))) {
  ------------------
  |  |  178|  5.60M|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  5.60M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 5.59M, False: 960]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  681|  5.59M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  682|  5.59M|        if (!diff) {
  ------------------
  |  Branch (682:13): [True: 1.80M, False: 3.79M]
  ------------------
  683|  1.80M|            pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  674|  1.80M|#define STEPSIZE sizeof(reg_t)
  ------------------
                          pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  674|  1.80M|#define STEPSIZE sizeof(reg_t)
  ------------------
  684|  3.79M|        } else {
  685|  3.79M|            return LZ4_NbCommonBytes(diff);
  686|  3.79M|    }   }
  687|       |
  688|  27.5M|    while (likely(pIn < pInLimit-(STEPSIZE-1))) {
  689|  27.5M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  690|  27.5M|        if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  674|  25.7M|#define STEPSIZE sizeof(reg_t)
  ------------------
                      if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  674|  25.7M|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (690:13): [True: 25.7M, False: 1.80M]
  ------------------
  691|  1.80M|        pIn += LZ4_NbCommonBytes(diff);
  692|  1.80M|        return (unsigned)(pIn - pStart);
  693|  27.5M|    }
  694|       |
  695|  3.60k|    if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  |  674|  3.60k|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (695:9): [True: 3.60k, Folded]
  |  Branch (695:26): [True: 2.24k, False: 1.35k]
  |  Branch (695:48): [True: 1.62k, False: 628]
  ------------------
  696|  3.60k|    if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (696:9): [True: 2.52k, False: 1.08k]
  |  Branch (696:31): [True: 1.87k, False: 646]
  ------------------
  697|  3.60k|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (697:9): [True: 2.42k, False: 1.18k]
  |  Branch (697:27): [True: 1.79k, False: 627]
  ------------------
  698|  3.60k|    return (unsigned)(pIn - pStart);
  699|  1.80M|}
lz4.c:LZ4_NbCommonBytes:
  576|  5.59M|{
  577|  5.59M|    assert(val != 0);
  ------------------
  |  Branch (577:5): [True: 0, False: 5.59M]
  |  Branch (577:5): [True: 5.59M, False: 0]
  ------------------
  578|  5.59M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (578:9): [True: 5.59M, False: 0]
  ------------------
  579|  5.59M|        if (sizeof(val) == 8) {
  ------------------
  |  Branch (579:13): [True: 5.59M, Folded]
  ------------------
  580|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1800) && (defined(_M_AMD64) && !defined(_M_ARM64EC)) && !defined(LZ4_FORCE_SW_BITCOUNT)
  581|       |/*-*************************************************************************************************
  582|       |* ARM64EC is a Microsoft-designed ARM64 ABI compatible with AMD64 applications on ARM64 Windows 11.
  583|       |* The ARM64EC ABI does not support AVX/AVX2/AVX512 instructions, nor their relevant intrinsics
  584|       |* including _tzcnt_u64. Therefore, we need to neuter the _tzcnt_u64 code path for ARM64EC.
  585|       |****************************************************************************************************/
  586|       |#         if defined(__clang__) && (__clang_major__ < 10)
  587|       |            /* Avoid undefined clang-cl intrinsics issue.
  588|       |             * See https://github.com/lz4/lz4/pull/1017 for details. */
  589|       |            return (unsigned)__builtin_ia32_tzcnt_u64(val) >> 3;
  590|       |#         else
  591|       |            /* x64 CPUS without BMI support interpret `TZCNT` as `REP BSF` */
  592|       |            return (unsigned)_tzcnt_u64(val) >> 3;
  593|       |#         endif
  594|       |#       elif defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT)
  595|       |            unsigned long r = 0;
  596|       |            _BitScanForward64(&r, (U64)val);
  597|       |            return (unsigned)r >> 3;
  598|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  599|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  600|       |                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  601|       |            return (unsigned)__builtin_ctzll((U64)val) >> 3;
  602|       |#       else
  603|       |            const U64 m = 0x0101010101010101ULL;
  604|       |            val ^= val - 1;
  605|       |            return (unsigned)(((U64)((val & (m - 1)) * m)) >> 56);
  606|       |#       endif
  607|  5.59M|        } else /* 32 bits */ {
  608|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT)
  609|       |            unsigned long r;
  610|       |            _BitScanForward(&r, (U32)val);
  611|       |            return (unsigned)r >> 3;
  612|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  613|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  614|       |                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  615|       |            return (unsigned)__builtin_ctz((U32)val) >> 3;
  616|       |#       else
  617|       |            const U32 m = 0x01010101;
  618|       |            return (unsigned)((((val - 1) ^ val) & (m - 1)) * m) >> 24;
  619|       |#       endif
  620|      0|        }
  621|  5.59M|    } else   /* Big Endian CPU */ {
  622|      0|        if (sizeof(val)==8) {
  ------------------
  |  Branch (622:13): [True: 0, Folded]
  ------------------
  623|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  624|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  625|      0|                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  626|      0|            return (unsigned)__builtin_clzll((U64)val) >> 3;
  627|       |#       else
  628|       |#if 1
  629|       |            /* this method is probably faster,
  630|       |             * but adds a 128 bytes lookup table */
  631|       |            static const unsigned char ctz7_tab[128] = {
  632|       |                7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  633|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  634|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  635|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  636|       |                6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  637|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  638|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  639|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  640|       |            };
  641|       |            U64 const mask = 0x0101010101010101ULL;
  642|       |            U64 const t = (((val >> 8) - mask) | val) & mask;
  643|       |            return ctz7_tab[(t * 0x0080402010080402ULL) >> 57];
  644|       |#else
  645|       |            /* this method doesn't consume memory space like the previous one,
  646|       |             * but it contains several branches,
  647|       |             * that may end up slowing execution */
  648|       |            static const U32 by32 = sizeof(val)*4;  /* 32 on 64 bits (goal), 16 on 32 bits.
  649|       |            Just to avoid some static analyzer complaining about shift by 32 on 32-bits target.
  650|       |            Note that this code path is never triggered in 32-bits mode. */
  651|       |            unsigned r;
  652|       |            if (!(val>>by32)) { r=4; } else { r=0; val>>=by32; }
  653|       |            if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; }
  654|       |            r += (!val);
  655|       |            return r;
  656|       |#endif
  657|       |#       endif
  658|      0|        } else /* 32 bits */ {
  659|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  660|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  661|      0|                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  662|      0|            return (unsigned)__builtin_clz((U32)val) >> 3;
  663|       |#       else
  664|       |            val >>= 8;
  665|       |            val = ((((val + 0x00FFFF00) | 0x00FFFFFF) + val) |
  666|       |              (val + 0x00FF0000)) >> 24;
  667|       |            return (unsigned)val ^ 3;
  668|       |#       endif
  669|      0|        }
  670|      0|    }
  671|  5.59M|}
lz4.c:LZ4_read16:
  394|  18.2M|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  399|  1.48M|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_prepareTable:
  882|  3.08k|           const tableType_t tableType) {
  883|       |    /* If the table hasn't been used, it's guaranteed to be zeroed out, and is
  884|       |     * therefore safe to use no matter what mode we're in. Otherwise, we figure
  885|       |     * out if it's safe to leave as is or whether it needs to be reset.
  886|       |     */
  887|  3.08k|    if ((tableType_t)cctx->tableType != clearedTable) {
  ------------------
  |  Branch (887:9): [True: 1.09k, False: 1.99k]
  ------------------
  888|  1.09k|        assert(inputSize >= 0);
  ------------------
  |  Branch (888:9): [True: 0, False: 1.09k]
  |  Branch (888:9): [True: 1.09k, False: 0]
  ------------------
  889|  1.09k|        if ((tableType_t)cctx->tableType != tableType
  ------------------
  |  Branch (889:13): [True: 5, False: 1.08k]
  ------------------
  890|  1.08k|          || ((tableType == byU16) && cctx->currentOffset + (unsigned)inputSize >= 0xFFFFU)
  ------------------
  |  Branch (890:15): [True: 964, False: 124]
  |  Branch (890:39): [True: 964, False: 0]
  ------------------
  891|    124|          || ((tableType == byU32) && cctx->currentOffset > 1 GB)
  ------------------
  |  |  254|    124|#define GB *(1U<<30)
  ------------------
  |  Branch (891:15): [True: 124, False: 0]
  |  Branch (891:39): [True: 0, False: 124]
  ------------------
  892|    124|          || tableType == byPtr
  ------------------
  |  Branch (892:14): [True: 0, False: 124]
  ------------------
  893|    124|          || inputSize >= 4 KB)
  ------------------
  |  |  252|    124|#define KB *(1 <<10)
  ------------------
  |  Branch (893:14): [True: 124, False: 0]
  ------------------
  894|  1.09k|        {
  895|  1.09k|            DEBUGLOG(4, "LZ4_prepareTable: Resetting table in %p", (void*)cctx);
  ------------------
  |  |  290|  1.09k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  896|  1.09k|            MEM_INIT(cctx->hashTable, 0, LZ4_HASHTABLESIZE);
  ------------------
  |  |  237|  1.09k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  235|  1.09k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  897|  1.09k|            cctx->currentOffset = 0;
  898|  1.09k|            cctx->tableType = (U32)clearedTable;
  899|  1.09k|        } else {
  900|      0|            DEBUGLOG(4, "LZ4_prepareTable: Re-use hash table (no reset)");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  901|      0|        }
  902|  1.09k|    }
  903|       |
  904|       |    /* Adding a gap, so all previous entries are > LZ4_DISTANCE_MAX back,
  905|       |     * is faster than compressing without a gap.
  906|       |     * However, compressing with currentOffset == 0 is faster still,
  907|       |     * so we preserve that case.
  908|       |     */
  909|  3.08k|    if (cctx->currentOffset != 0 && tableType == byU32) {
  ------------------
  |  Branch (909:9): [True: 0, False: 3.08k]
  |  Branch (909:37): [True: 0, False: 0]
  ------------------
  910|      0|        DEBUGLOG(5, "LZ4_prepareTable: adding 64KB to currentOffset");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  911|      0|        cctx->currentOffset += 64 KB;
  ------------------
  |  |  252|      0|#define KB *(1 <<10)
  ------------------
  912|      0|    }
  913|       |
  914|       |    /* Finally, clear history */
  915|  3.08k|    cctx->dictCtx = NULL;
  916|       |    cctx->dictionary = NULL;
  917|  3.08k|    cctx->dictSize = 0;
  918|  3.08k|}
lz4.c:LZ4_isAligned:
  294|  2.01k|{
  295|  2.01k|    return ((size_t)ptr & (alignment -1)) == 0;
  296|  2.01k|}
lz4.c:LZ4_stream_t_alignment:
 1539|  2.01k|{
 1540|  2.01k|#if LZ4_ALIGN_TEST
 1541|  2.01k|    typedef struct { char c; LZ4_stream_t t; } t_a;
 1542|  2.01k|    return sizeof(t_a) - sizeof(LZ4_stream_t);
 1543|       |#else
 1544|       |    return 1;  /* effectively disabled */
 1545|       |#endif
 1546|  2.01k|}
lz4.c:LZ4_renormDictT:
 1684|  3.23k|{
 1685|  3.23k|    assert(nextSize >= 0);
  ------------------
  |  Branch (1685:5): [True: 0, False: 3.23k]
  |  Branch (1685:5): [True: 3.23k, False: 0]
  ------------------
 1686|  3.23k|    if (LZ4_dict->currentOffset + (unsigned)nextSize > 0x80000000) {   /* potential ptrdiff_t overflow (32-bits mode) */
  ------------------
  |  Branch (1686:9): [True: 0, False: 3.23k]
  ------------------
 1687|       |        /* rescale hash table */
 1688|      0|        U32 const delta = LZ4_dict->currentOffset - 64 KB;
  ------------------
  |  |  252|      0|#define KB *(1 <<10)
  ------------------
 1689|      0|        const BYTE* dictEnd = LZ4_dict->dictionary + LZ4_dict->dictSize;
 1690|      0|        int i;
 1691|      0|        DEBUGLOG(4, "LZ4_renormDictT");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1692|      0|        for (i=0; i<LZ4_HASH_SIZE_U32; i++) {
  ------------------
  |  |  699|      0|#define LZ4_HASH_SIZE_U32 (1 << LZ4_HASHLOG)       /* required as macro for static allocation */
  |  |  ------------------
  |  |  |  |  697|      0|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|      0|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  163|      0|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1692:19): [True: 0, False: 0]
  ------------------
 1693|      0|            if (LZ4_dict->hashTable[i] < delta) LZ4_dict->hashTable[i]=0;
  ------------------
  |  Branch (1693:17): [True: 0, False: 0]
  ------------------
 1694|      0|            else LZ4_dict->hashTable[i] -= delta;
 1695|      0|        }
 1696|      0|        LZ4_dict->currentOffset = 64 KB;
  ------------------
  |  |  252|      0|#define KB *(1 <<10)
  ------------------
 1697|      0|        if (LZ4_dict->dictSize > 64 KB) LZ4_dict->dictSize = 64 KB;
  ------------------
  |  |  252|      0|#define KB *(1 <<10)
  ------------------
                      if (LZ4_dict->dictSize > 64 KB) LZ4_dict->dictSize = 64 KB;
  ------------------
  |  |  252|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (1697:13): [True: 0, False: 0]
  ------------------
 1698|      0|        LZ4_dict->dictionary = dictEnd - LZ4_dict->dictSize;
 1699|      0|    }
 1700|  3.23k|}
lz4.c:LZ4_decompress_generic:
 2031|  17.7k|{
 2032|  17.7k|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (2032:9): [True: 0, False: 17.7k]
  |  Branch (2032:26): [True: 0, False: 17.7k]
  ------------------
 2033|       |
 2034|  17.7k|    {   const BYTE* ip = (const BYTE*) src;
 2035|  17.7k|        const BYTE* const iend = ip + srcSize;
 2036|       |
 2037|  17.7k|        BYTE* op = (BYTE*) dst;
 2038|  17.7k|        BYTE* const oend = op + outputSize;
 2039|  17.7k|        BYTE* cpy;
 2040|       |
 2041|  17.7k|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (2041:37): [True: 16.4k, False: 1.26k]
  ------------------
 2042|       |
 2043|  17.7k|        const int checkOffset = (dictSize < (int)(64 KB));
  ------------------
  |  |  252|  17.7k|#define KB *(1 <<10)
  ------------------
 2044|       |
 2045|       |
 2046|       |        /* Set up the "end" pointers for the shortcut. */
 2047|  17.7k|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 2048|  17.7k|        const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/;
 2049|       |
 2050|  17.7k|        const BYTE* match;
 2051|  17.7k|        size_t offset;
 2052|  17.7k|        unsigned token;
 2053|  17.7k|        size_t length;
 2054|       |
 2055|       |
 2056|  17.7k|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  290|  17.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2057|       |
 2058|       |        /* Special cases */
 2059|  17.7k|        assert(lowPrefix <= op);
  ------------------
  |  Branch (2059:9): [True: 0, False: 17.7k]
  |  Branch (2059:9): [True: 17.7k, False: 0]
  ------------------
 2060|  17.7k|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  181|  17.7k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  17.7k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 17.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2061|       |            /* Empty output buffer */
 2062|      0|            if (partialDecoding) return 0;
  ------------------
  |  Branch (2062:17): [True: 0, False: 0]
  ------------------
 2063|      0|            return ((srcSize==1) && (*ip==0)) ? 0 : -1;
  ------------------
  |  Branch (2063:21): [True: 0, False: 0]
  |  Branch (2063:37): [True: 0, False: 0]
  ------------------
 2064|      0|        }
 2065|  17.7k|        if (unlikely(srcSize==0)) { return -1; }
  ------------------
  |  |  181|  17.7k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  17.7k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 17.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2066|       |
 2067|       |    /* LZ4_FAST_DEC_LOOP:
 2068|       |     * designed for modern OoO performance cpus,
 2069|       |     * where copying reliably 32-bytes is preferable to an unpredictable branch.
 2070|       |     * note : fast loop may show a regression for some client arm chips. */
 2071|  17.7k|#if LZ4_FAST_DEC_LOOP
 2072|  17.7k|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  17.7k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2072:13): [True: 0, False: 17.7k]
  ------------------
 2073|      0|            DEBUGLOG(6, "move to safe decode loop");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2074|      0|            goto safe_decode;
 2075|      0|        }
 2076|       |
 2077|       |        /* Fast loop : decode sequences as long as output < oend-FASTLOOP_SAFE_DISTANCE */
 2078|  17.7k|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  290|  17.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2079|  18.2M|        while (1) {
  ------------------
  |  Branch (2079:16): [True: 18.2M, Folded]
  ------------------
 2080|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2081|  18.2M|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  Branch (2081:13): [True: 0, False: 18.2M]
  |  Branch (2081:13): [True: 18.2M, False: 0]
  ------------------
 2082|  18.2M|            assert(ip < iend);
  ------------------
  |  Branch (2082:13): [True: 0, False: 18.2M]
  |  Branch (2082:13): [True: 18.2M, False: 0]
  ------------------
 2083|  18.2M|            token = *ip++;
 2084|  18.2M|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  261|  18.2M|#define ML_BITS  4
  ------------------
 2085|  18.2M|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  18.2M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2086|       |
 2087|       |            /* decode literal length */
 2088|  18.2M|            if (length == RUN_MASK) {
  ------------------
  |  |  264|  18.2M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  18.2M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  18.2M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2088:17): [True: 1.23M, False: 17.0M]
  ------------------
 2089|  1.23M|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  264|  1.23M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  1.23M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  1.23M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2090|  1.23M|                if (addl == rvl_error) {
  ------------------
  |  Branch (2090:21): [True: 0, False: 1.23M]
  ------------------
 2091|      0|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2092|      0|                    goto _output_error;
 2093|      0|                }
 2094|  1.23M|                length += addl;
 2095|  1.23M|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|  1.23M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  1.23M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 1.23M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2096|  1.23M|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|  1.23M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  1.23M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 1.23M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2097|       |
 2098|       |                /* copy literals */
 2099|  1.23M|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  278|  1.23M|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2100|  1.23M|                if ((op+length>oend-32) || (ip+length>iend-32)) { goto safe_literal_copy; }
  ------------------
  |  Branch (2100:21): [True: 1.14k, False: 1.22M]
  |  Branch (2100:44): [True: 2.20k, False: 1.22M]
  ------------------
 2101|  1.22M|                LZ4_wildCopy32(op, ip, op+length);
 2102|  1.22M|                ip += length; op += length;
 2103|  17.0M|            } else if (ip <= iend-(16 + 1/*max lit + offset + nextToken*/)) {
  ------------------
  |  Branch (2103:24): [True: 17.0M, False: 9.28k]
  ------------------
 2104|       |                /* We don't need to check oend, since we check it once for each loop below */
 2105|  17.0M|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)length);
  ------------------
  |  |  290|  17.0M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2106|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2107|  17.0M|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  350|  17.0M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2108|  17.0M|                ip += length; op += length;
 2109|  17.0M|            } else {
 2110|  9.28k|                goto safe_literal_copy;
 2111|  9.28k|            }
 2112|       |
 2113|       |            /* get offset */
 2114|  18.2M|            offset = LZ4_readLE16(ip); ip+=2;
 2115|  18.2M|            DEBUGLOG(6, "blockPos%6u: offset = %u", (unsigned)(op-(BYTE*)dst), (unsigned)offset);
  ------------------
  |  |  290|  18.2M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2116|  18.2M|            match = op - offset;
 2117|  18.2M|            assert(match <= op);  /* overflow check */
  ------------------
  |  Branch (2117:13): [True: 0, False: 18.2M]
  |  Branch (2117:13): [True: 18.2M, False: 0]
  ------------------
 2118|       |
 2119|       |            /* get matchlength */
 2120|  18.2M|            length = token & ML_MASK;
  ------------------
  |  |  262|  18.2M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  18.2M|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2121|  18.2M|            DEBUGLOG(7, "  match length token = %u (len==%u)", (unsigned)length, (unsigned)length+MINMATCH);
  ------------------
  |  |  290|  18.2M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2122|       |
 2123|  18.2M|            if (length == ML_MASK) {
  ------------------
  |  |  262|  18.2M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  18.2M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2123:17): [True: 2.47M, False: 15.7M]
  ------------------
 2124|  2.47M|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  246|  2.47M|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2125|  2.47M|                if (addl == rvl_error) {
  ------------------
  |  Branch (2125:21): [True: 0, False: 2.47M]
  ------------------
 2126|      0|                    DEBUGLOG(5, "error reading long match length");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2127|      0|                    goto _output_error;
 2128|      0|                }
 2129|  2.47M|                length += addl;
 2130|  2.47M|                length += MINMATCH;
  ------------------
  |  |  243|  2.47M|#define MINMATCH 4
  ------------------
 2131|  2.47M|                DEBUGLOG(7, "  long match length == %u", (unsigned)length);
  ------------------
  |  |  290|  2.47M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2132|  2.47M|                if (unlikely((uptrval)(op)+length<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|  2.47M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  2.47M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 2.47M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2133|  2.47M|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  2.47M|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2133:21): [True: 3.29k, False: 2.47M]
  ------------------
 2134|  3.29k|                    goto safe_match_copy;
 2135|  3.29k|                }
 2136|  15.7M|            } else {
 2137|  15.7M|                length += MINMATCH;
  ------------------
  |  |  243|  15.7M|#define MINMATCH 4
  ------------------
 2138|  15.7M|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  15.7M|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2138:21): [True: 1.78k, False: 15.7M]
  ------------------
 2139|  1.78k|                    DEBUGLOG(7, "moving to safe_match_copy (ml==%u)", (unsigned)length);
  ------------------
  |  |  290|  1.78k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2140|  1.78k|                    goto safe_match_copy;
 2141|  1.78k|                }
 2142|       |
 2143|       |                /* Fastpath check: skip LZ4_wildCopy32 when true */
 2144|  15.7M|                if ((dict == withPrefix64k) || (match >= lowPrefix)) {
  ------------------
  |  Branch (2144:21): [True: 5.21M, False: 10.5M]
  |  Branch (2144:48): [True: 10.4M, False: 65.3k]
  ------------------
 2145|  15.7M|                    if (offset >= 8) {
  ------------------
  |  Branch (2145:25): [True: 14.9M, False: 768k]
  ------------------
 2146|  14.9M|                        assert(match >= lowPrefix);
  ------------------
  |  Branch (2146:25): [True: 0, False: 14.9M]
  |  Branch (2146:25): [True: 14.9M, False: 0]
  ------------------
 2147|  14.9M|                        assert(match <= op);
  ------------------
  |  Branch (2147:25): [True: 0, False: 14.9M]
  |  Branch (2147:25): [True: 14.9M, False: 0]
  ------------------
 2148|  14.9M|                        assert(op + 18 <= oend);
  ------------------
  |  Branch (2148:25): [True: 0, False: 14.9M]
  |  Branch (2148:25): [True: 14.9M, False: 0]
  ------------------
 2149|       |
 2150|  14.9M|                        LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  14.9M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2151|  14.9M|                        LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  350|  14.9M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2152|  14.9M|                        LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  350|  14.9M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2153|  14.9M|                        op += length;
 2154|  14.9M|                        continue;
 2155|  14.9M|            }   }   }
 2156|       |
 2157|  3.30M|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  181|  3.11M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  3.11M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2157:18): [True: 3.11M, False: 187k]
  |  Branch (2157:33): [True: 0, False: 3.11M]
  ------------------
 2158|      0|                DEBUGLOG(5, "Error : pos=%zi, offset=%zi => outside buffers", op-lowPrefix, op-match);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2159|      0|                goto _output_error;
 2160|      0|            }
 2161|       |            /* match starting within external dictionary */
 2162|  3.30M|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2162:17): [True: 187k, False: 3.11M]
  |  Branch (2162:41): [True: 82.2k, False: 105k]
  ------------------
 2163|  82.2k|                assert(dictEnd != NULL);
  ------------------
  |  Branch (2163:17): [True: 0, False: 82.2k]
  |  Branch (2163:17): [True: 82.2k, False: 0]
  ------------------
 2164|  82.2k|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  181|  82.2k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  82.2k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 82.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2165|      0|                    if (partialDecoding) {
  ------------------
  |  Branch (2165:25): [True: 0, False: 0]
  ------------------
 2166|      0|                        DEBUGLOG(7, "partialDecoding: dictionary match, close to dstEnd");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2167|      0|                        length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1841|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1841:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2168|      0|                    } else {
 2169|      0|                        DEBUGLOG(6, "end-of-block condition violated")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2170|      0|                        goto _output_error;
 2171|      0|                }   }
 2172|       |
 2173|  82.2k|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2173:21): [True: 81.7k, False: 520]
  ------------------
 2174|       |                    /* match fits entirely within external dictionary : just copy */
 2175|  81.7k|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  358|  81.7k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2176|  81.7k|                    op += length;
 2177|  81.7k|                } else {
 2178|       |                    /* match stretches into both external dictionary and current block */
 2179|    520|                    size_t const copySize = (size_t)(lowPrefix - match);
 2180|    520|                    size_t const restSize = length - copySize;
 2181|    520|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  350|    520|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2182|    520|                    op += copySize;
 2183|    520|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2183:25): [True: 246, False: 274]
  ------------------
 2184|    246|                        BYTE* const endOfMatch = op + restSize;
 2185|    246|                        const BYTE* copyFrom = lowPrefix;
 2186|  1.73M|                        while (op < endOfMatch) { *op++ = *copyFrom++; }
  ------------------
  |  Branch (2186:32): [True: 1.73M, False: 246]
  ------------------
 2187|    274|                    } else {
 2188|    274|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  350|    274|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2189|    274|                        op += restSize;
 2190|    274|                }   }
 2191|  82.2k|                continue;
 2192|  82.2k|            }
 2193|       |
 2194|       |            /* copy match within block */
 2195|  3.22M|            cpy = op + length;
 2196|       |
 2197|  3.22M|            assert((op <= oend) && (oend-op >= 32));
  ------------------
  |  Branch (2197:13): [True: 0, False: 3.22M]
  |  Branch (2197:13): [True: 0, False: 0]
  |  Branch (2197:13): [True: 3.22M, False: 0]
  |  Branch (2197:13): [True: 3.22M, False: 0]
  ------------------
 2198|  3.22M|            if (unlikely(offset<16)) {
  ------------------
  |  |  181|  3.22M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  3.22M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.06M, False: 2.15M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2199|  1.06M|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2200|  2.15M|            } else {
 2201|  2.15M|                LZ4_wildCopy32(op, match, cpy);
 2202|  2.15M|            }
 2203|       |
 2204|  3.22M|            op = cpy;   /* wildcopy correction */
 2205|  3.22M|        }
 2206|      0|    safe_decode:
 2207|      0|#endif
 2208|       |
 2209|       |        /* Main Loop : decode remaining sequences where output < FASTLOOP_SAFE_DISTANCE */
 2210|      0|        DEBUGLOG(6, "using safe decode loop");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2211|  31.8k|        while (1) {
  ------------------
  |  Branch (2211:16): [True: 31.8k, Folded]
  ------------------
 2212|  31.8k|            assert(ip < iend);
  ------------------
  |  Branch (2212:13): [True: 0, False: 31.8k]
  |  Branch (2212:13): [True: 31.8k, False: 0]
  ------------------
 2213|  31.8k|            token = *ip++;
 2214|  31.8k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  261|  31.8k|#define ML_BITS  4
  ------------------
 2215|  31.8k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  31.8k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2216|       |
 2217|       |            /* A two-stage shortcut for the most common case:
 2218|       |             * 1) If the literal length is 0..14, and there is enough space,
 2219|       |             * enter the shortcut and copy 16 bytes on behalf of the literals
 2220|       |             * (in the fast mode, only 8 bytes can be safely copied this way).
 2221|       |             * 2) Further if the match length is 4..18, copy 18 bytes in a similar
 2222|       |             * manner; but we ensure that there's enough space in the output for
 2223|       |             * those 18 bytes earlier, upon entering the shortcut (in other words,
 2224|       |             * there is a combined check for both stages).
 2225|       |             */
 2226|  31.8k|            if ( (length != RUN_MASK)
  ------------------
  |  |  264|  31.8k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  31.8k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  31.8k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2226:18): [True: 30.8k, False: 1.01k]
  ------------------
 2227|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2228|  30.8k|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  178|  30.8k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  30.8k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 6.85k, False: 24.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2229|       |                /* Copy the literals */
 2230|  6.85k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  350|  6.85k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2231|  6.85k|                op += length; ip += length;
 2232|       |
 2233|       |                /* The second stage: prepare for match copying, decode full info.
 2234|       |                 * If it doesn't work out, the info won't be wasted. */
 2235|  6.85k|                length = token & ML_MASK; /* match length */
  ------------------
  |  |  262|  6.85k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  6.85k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2236|  6.85k|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u (len=%u)", (unsigned)(op-(BYTE*)dst), (unsigned)length, (unsigned)length + 4);
  ------------------
  |  |  290|  6.85k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2237|  6.85k|                offset = LZ4_readLE16(ip); ip += 2;
 2238|  6.85k|                match = op - offset;
 2239|  6.85k|                assert(match <= op); /* check overflow */
  ------------------
  |  Branch (2239:17): [True: 0, False: 6.85k]
  |  Branch (2239:17): [True: 6.85k, False: 0]
  ------------------
 2240|       |
 2241|       |                /* Do not deal with overlapping matches. */
 2242|  6.85k|                if ( (length != ML_MASK)
  ------------------
  |  |  262|  6.85k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  6.85k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2242:22): [True: 6.23k, False: 620]
  ------------------
 2243|  6.23k|                  && (offset >= 8)
  ------------------
  |  Branch (2243:22): [True: 5.57k, False: 663]
  ------------------
 2244|  5.57k|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2244:23): [True: 2.18k, False: 3.39k]
  |  Branch (2244:46): [True: 3.33k, False: 57]
  ------------------
 2245|       |                    /* Copy the match. */
 2246|  5.51k|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  350|  5.51k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2247|  5.51k|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  350|  5.51k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2248|  5.51k|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  350|  5.51k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2249|  5.51k|                    op += length + MINMATCH;
  ------------------
  |  |  243|  5.51k|#define MINMATCH 4
  ------------------
 2250|       |                    /* Both stages worked, load the next token. */
 2251|  5.51k|                    continue;
 2252|  5.51k|                }
 2253|       |
 2254|       |                /* The second stage didn't work out, but the info is ready.
 2255|       |                 * Propel it right to the point of match copying. */
 2256|  1.34k|                goto _copy_match;
 2257|  6.85k|            }
 2258|       |
 2259|       |            /* decode literal length */
 2260|  25.0k|            if (length == RUN_MASK) {
  ------------------
  |  |  264|  25.0k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  25.0k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  25.0k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2260:17): [True: 1.01k, False: 24.0k]
  ------------------
 2261|  1.01k|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  264|  1.01k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  1.01k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  1.01k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2262|  1.01k|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2262:21): [True: 0, False: 1.01k]
  ------------------
 2263|  1.01k|                length += addl;
 2264|  1.01k|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|  1.01k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  1.01k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 1.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2265|  1.01k|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|  1.01k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  1.01k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 1.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2266|  1.01k|            }
 2267|       |
 2268|  25.0k|#if LZ4_FAST_DEC_LOOP
 2269|  37.6k|        safe_literal_copy:
 2270|  37.6k|#endif
 2271|       |            /* copy literals */
 2272|  37.6k|            cpy = op+length;
 2273|       |
 2274|  37.6k|            LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  278|  37.6k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2275|  37.6k|            if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  247|  37.6k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  246|  29.6k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2275:17): [True: 7.98k, False: 29.6k]
  |  Branch (2275:39): [True: 9.72k, False: 19.9k]
  ------------------
 2276|       |                /* We've either hit the input parsing restriction or the output parsing restriction.
 2277|       |                 * In the normal scenario, decoding a full block, it must be the last sequence,
 2278|       |                 * otherwise it's an error (invalid input or dimensions).
 2279|       |                 * In partialDecoding scenario, it's necessary to ensure there is no buffer overflow.
 2280|       |                 */
 2281|  17.7k|                if (partialDecoding) {
  ------------------
  |  Branch (2281:21): [True: 0, False: 17.7k]
  ------------------
 2282|       |                    /* Since we are partial decoding we may be in this block because of the output parsing
 2283|       |                     * restriction, which is not valid since the output buffer is allowed to be undersized.
 2284|       |                     */
 2285|      0|                    DEBUGLOG(7, "partialDecoding: copying literals, close to input or output end")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2286|      0|                    DEBUGLOG(7, "partialDecoding: literal length = %u", (unsigned)length);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2287|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in dstBuffer : %i", (int)(oend - op));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2288|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in srcBuffer : %i", (int)(iend - ip));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2289|       |                    /* Finishing in the middle of a literals segment,
 2290|       |                     * due to lack of input.
 2291|       |                     */
 2292|      0|                    if (ip+length > iend) {
  ------------------
  |  Branch (2292:25): [True: 0, False: 0]
  ------------------
 2293|      0|                        length = (size_t)(iend-ip);
 2294|      0|                        cpy = op + length;
 2295|      0|                    }
 2296|       |                    /* Finishing in the middle of a literals segment,
 2297|       |                     * due to lack of output space.
 2298|       |                     */
 2299|      0|                    if (cpy > oend) {
  ------------------
  |  Branch (2299:25): [True: 0, False: 0]
  ------------------
 2300|      0|                        cpy = oend;
 2301|      0|                        assert(op<=oend);
  ------------------
  |  Branch (2301:25): [True: 0, False: 0]
  |  Branch (2301:25): [True: 0, False: 0]
  ------------------
 2302|      0|                        length = (size_t)(oend-op);
 2303|      0|                    }
 2304|  17.7k|                } else {
 2305|       |                     /* We must be on the last sequence (or invalid) because of the parsing limitations
 2306|       |                      * so check that we exactly consume the input and don't overrun the output buffer.
 2307|       |                      */
 2308|  17.7k|                    if ((ip+length != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2308:25): [True: 0, False: 17.7k]
  |  Branch (2308:48): [True: 0, False: 17.7k]
  ------------------
 2309|      0|                        DEBUGLOG(5, "should have been last run of literals")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2310|      0|                        DEBUGLOG(5, "ip(%p) + length(%i) = %p != iend (%p)", (void*)ip, (int)length, (void*)(ip+length), (void*)iend);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2311|      0|                        DEBUGLOG(5, "or cpy(%p) > (oend-MFLIMIT)(%p)", (void*)cpy, (void*)(oend-MFLIMIT));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2312|      0|                        DEBUGLOG(5, "after writing %u bytes / %i bytes available", (unsigned)(op-(BYTE*)dst), outputSize);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2313|      0|                        goto _output_error;
 2314|      0|                    }
 2315|  17.7k|                }
 2316|  17.7k|                LZ4_memmove(op, ip, length);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  358|  17.7k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2317|  17.7k|                ip += length;
 2318|  17.7k|                op += length;
 2319|       |                /* Necessarily EOF when !partialDecoding.
 2320|       |                 * When partialDecoding, it is EOF if we've either
 2321|       |                 * filled the output buffer or
 2322|       |                 * can't proceed with reading an offset for following match.
 2323|       |                 */
 2324|  17.7k|                if (!partialDecoding || (cpy == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2324:21): [True: 17.7k, False: 0]
  |  Branch (2324:41): [True: 0, False: 0]
  |  Branch (2324:58): [True: 0, False: 0]
  ------------------
 2325|  17.7k|                    break;
 2326|  17.7k|                }
 2327|  19.9k|            } else {
 2328|  19.9k|                LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2329|  19.9k|                ip += length; op = cpy;
 2330|  19.9k|            }
 2331|       |
 2332|       |            /* get offset */
 2333|  19.9k|            offset = LZ4_readLE16(ip); ip+=2;
 2334|  19.9k|            match = op - offset;
 2335|       |
 2336|       |            /* get matchlength */
 2337|  19.9k|            length = token & ML_MASK;
  ------------------
  |  |  262|  19.9k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  19.9k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2338|  19.9k|            DEBUGLOG(7, "blockPos%6u: matchLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  19.9k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2339|       |
 2340|  21.2k|    _copy_match:
 2341|  21.2k|            if (length == ML_MASK) {
  ------------------
  |  |  262|  21.2k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  21.2k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2341:17): [True: 6.27k, False: 15.0k]
  ------------------
 2342|  6.27k|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  246|  6.27k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2343|  6.27k|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2343:21): [True: 0, False: 6.27k]
  ------------------
 2344|  6.27k|                length += addl;
 2345|  6.27k|                if (unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  181|  6.27k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  6.27k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 6.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2346|  6.27k|            }
 2347|  21.2k|            length += MINMATCH;
  ------------------
  |  |  243|  21.2k|#define MINMATCH 4
  ------------------
 2348|       |
 2349|  21.2k|#if LZ4_FAST_DEC_LOOP
 2350|  26.3k|        safe_match_copy:
 2351|  26.3k|#endif
 2352|  26.3k|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error;   /* Error : offset outside buffers */
  ------------------
  |  |  181|  24.5k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  24.5k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2352:17): [True: 24.5k, False: 1.77k]
  |  Branch (2352:34): [True: 0, False: 24.5k]
  ------------------
 2353|       |            /* match starting within external dictionary */
 2354|  26.3k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2354:17): [True: 1.77k, False: 24.5k]
  |  Branch (2354:41): [True: 742, False: 1.03k]
  ------------------
 2355|    742|                assert(dictEnd != NULL);
  ------------------
  |  Branch (2355:17): [True: 0, False: 742]
  |  Branch (2355:17): [True: 742, False: 0]
  ------------------
 2356|    742|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  181|    742|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    742|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 742]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2357|      0|                    if (partialDecoding) length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1841|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1841:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2357:25): [True: 0, False: 0]
  ------------------
 2358|      0|                    else goto _output_error;   /* doesn't respect parsing restriction */
 2359|      0|                }
 2360|       |
 2361|    742|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2361:21): [True: 528, False: 214]
  ------------------
 2362|       |                    /* match fits entirely within external dictionary : just copy */
 2363|    528|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  358|    528|#    define LZ4_memmove __builtin_memmove
  ------------------
 2364|    528|                    op += length;
 2365|    528|                } else {
 2366|       |                    /* match stretches into both external dictionary and current block */
 2367|    214|                    size_t const copySize = (size_t)(lowPrefix - match);
 2368|    214|                    size_t const restSize = length - copySize;
 2369|    214|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  350|    214|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2370|    214|                    op += copySize;
 2371|    214|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2371:25): [True: 164, False: 50]
  ------------------
 2372|    164|                        BYTE* const endOfMatch = op + restSize;
 2373|    164|                        const BYTE* copyFrom = lowPrefix;
 2374|  4.18M|                        while (op < endOfMatch) *op++ = *copyFrom++;
  ------------------
  |  Branch (2374:32): [True: 4.18M, False: 164]
  ------------------
 2375|    164|                    } else {
 2376|     50|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  350|     50|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2377|     50|                        op += restSize;
 2378|     50|                }   }
 2379|    742|                continue;
 2380|    742|            }
 2381|  26.3k|            assert(match >= lowPrefix);
  ------------------
  |  Branch (2381:13): [True: 0, False: 25.6k]
  |  Branch (2381:13): [True: 25.6k, False: 0]
  ------------------
 2382|       |
 2383|       |            /* copy match within block */
 2384|  25.6k|            cpy = op + length;
 2385|       |
 2386|       |            /* partialDecoding : may end anywhere within the block */
 2387|  25.6k|            assert(op<=oend);
  ------------------
  |  Branch (2387:13): [True: 0, False: 25.6k]
  |  Branch (2387:13): [True: 25.6k, False: 0]
  ------------------
 2388|  25.6k|            if (partialDecoding && (cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  248|      0|#define MATCH_SAFEGUARD_DISTANCE  ((2*WILDCOPYLENGTH) - MINMATCH)   /* ensure it's possible to write 2 x wildcopyLength without overflowing output buffer */
  |  |  ------------------
  |  |  |  |  245|      0|#define WILDCOPYLENGTH 8
  |  |  ------------------
  |  |               #define MATCH_SAFEGUARD_DISTANCE  ((2*WILDCOPYLENGTH) - MINMATCH)   /* ensure it's possible to write 2 x wildcopyLength without overflowing output buffer */
  |  |  ------------------
  |  |  |  |  243|      0|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (2388:17): [True: 0, False: 25.6k]
  |  Branch (2388:36): [True: 0, False: 0]
  ------------------
 2389|      0|                size_t const mlen = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1841|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1841:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2390|      0|                const BYTE* const matchEnd = match + mlen;
 2391|      0|                BYTE* const copyEnd = op + mlen;
 2392|      0|                if (matchEnd > op) {   /* overlap copy */
  ------------------
  |  Branch (2392:21): [True: 0, False: 0]
  ------------------
 2393|      0|                    while (op < copyEnd) { *op++ = *match++; }
  ------------------
  |  Branch (2393:28): [True: 0, False: 0]
  ------------------
 2394|      0|                } else {
 2395|      0|                    LZ4_memcpy(op, match, mlen);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2396|      0|                }
 2397|      0|                op = copyEnd;
 2398|      0|                if (op == oend) { break; }
  ------------------
  |  Branch (2398:21): [True: 0, False: 0]
  ------------------
 2399|      0|                continue;
 2400|      0|            }
 2401|       |
 2402|  25.6k|            if (unlikely(offset<8)) {
  ------------------
  |  |  181|  25.6k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  25.6k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 8.44k, False: 17.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2403|  8.44k|                LZ4_write32(op, 0);   /* silence msan warning when offset==0 */
 2404|  8.44k|                op[0] = match[0];
 2405|  8.44k|                op[1] = match[1];
 2406|  8.44k|                op[2] = match[2];
 2407|  8.44k|                op[3] = match[3];
 2408|  8.44k|                match += inc32table[offset];
 2409|  8.44k|                LZ4_memcpy(op+4, match, 4);
  ------------------
  |  |  350|  8.44k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2410|  8.44k|                match -= dec64table[offset];
 2411|  17.1k|            } else {
 2412|  17.1k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  17.1k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2413|  17.1k|                match += 8;
 2414|  17.1k|            }
 2415|  25.6k|            op += 8;
 2416|       |
 2417|  25.6k|            if (unlikely(cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  181|  25.6k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  25.6k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 6.30k, False: 19.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2418|  6.30k|                BYTE* const oCopyLimit = oend - (WILDCOPYLENGTH-1);
  ------------------
  |  |  245|  6.30k|#define WILDCOPYLENGTH 8
  ------------------
 2419|  6.30k|                if (cpy > oend-LASTLITERALS) { goto _output_error; } /* Error : last LASTLITERALS bytes must be literals (uncompressed) */
  ------------------
  |  |  246|  6.30k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2419:21): [True: 0, False: 6.30k]
  ------------------
 2420|  6.30k|                if (op < oCopyLimit) {
  ------------------
  |  Branch (2420:21): [True: 5.36k, False: 940]
  ------------------
 2421|  5.36k|                    LZ4_wildCopy8(op, match, oCopyLimit);
 2422|  5.36k|                    match += oCopyLimit - op;
 2423|  5.36k|                    op = oCopyLimit;
 2424|  5.36k|                }
 2425|  16.2k|                while (op < cpy) { *op++ = *match++; }
  ------------------
  |  Branch (2425:24): [True: 9.91k, False: 6.30k]
  ------------------
 2426|  19.3k|            } else {
 2427|  19.3k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  19.3k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2428|  19.3k|                if (length > 16) { LZ4_wildCopy8(op+8, match+8, cpy); }
  ------------------
  |  Branch (2428:21): [True: 5.56k, False: 13.7k]
  ------------------
 2429|  19.3k|            }
 2430|  25.6k|            op = cpy;   /* wildcopy correction */
 2431|  25.6k|        }
 2432|       |
 2433|       |        /* end of decoding */
 2434|  17.7k|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  290|  17.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2435|  17.7k|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2436|       |
 2437|       |        /* Overflow error detected */
 2438|      0|    _output_error:
 2439|      0|        return (int) (-(((const char*)ip)-src))-1;
 2440|      0|    }
 2441|      0|}
lz4.c:read_variable_length:
 1977|  3.71M|{
 1978|  3.71M|    Rvl_t s, length = 0;
 1979|  3.71M|    assert(ip != NULL);
  ------------------
  |  Branch (1979:5): [True: 0, False: 3.71M]
  |  Branch (1979:5): [True: 3.71M, False: 0]
  ------------------
 1980|  3.71M|    assert(*ip !=  NULL);
  ------------------
  |  Branch (1980:5): [True: 0, False: 3.71M]
  |  Branch (1980:5): [True: 3.71M, False: 0]
  ------------------
 1981|  3.71M|    assert(ilimit != NULL);
  ------------------
  |  Branch (1981:5): [True: 0, False: 3.71M]
  |  Branch (1981:5): [True: 3.71M, False: 0]
  ------------------
 1982|  3.71M|    if (initial_check && unlikely((*ip) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|  1.23M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  1.23M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 1.23M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1982:9): [True: 1.23M, False: 2.48M]
  ------------------
 1983|      0|        return rvl_error;
 1984|      0|    }
 1985|  3.71M|    s = **ip;
 1986|  3.71M|    (*ip)++;
 1987|  3.71M|    length += s;
 1988|  3.71M|    if (unlikely((*ip) > ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|  3.71M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  3.71M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 3.71M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1989|      0|        return rvl_error;
 1990|      0|    }
 1991|       |    /* accumulator overflow detection (32-bit mode only) */
 1992|  3.71M|    if ((sizeof(length) < 8) && unlikely(length > ((Rvl_t)(-1)/2)) ) {
  ------------------
  |  |  181|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1992:9): [Folded, False: 3.71M]
  ------------------
 1993|      0|        return rvl_error;
 1994|      0|    }
 1995|  3.71M|    if (likely(s != 255)) return length;
  ------------------
  |  |  178|  3.71M|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  3.71M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 3.44M, False: 265k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1996|  2.11M|    do {
 1997|  2.11M|        s = **ip;
 1998|  2.11M|        (*ip)++;
 1999|  2.11M|        length += s;
 2000|  2.11M|        if (unlikely((*ip) > ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|  2.11M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  2.11M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 2.11M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2001|      0|            return rvl_error;
 2002|      0|        }
 2003|       |        /* accumulator overflow detection (32-bit mode only) */
 2004|  2.11M|        if ((sizeof(length) < 8) && unlikely(length > ((Rvl_t)(-1)/2)) ) {
  ------------------
  |  |  181|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2004:13): [Folded, False: 2.11M]
  ------------------
 2005|      0|            return rvl_error;
 2006|      0|        }
 2007|  2.11M|    } while (s == 255);
  ------------------
  |  Branch (2007:14): [True: 1.84M, False: 265k]
  ------------------
 2008|       |
 2009|   265k|    return length;
 2010|   265k|}
lz4.c:LZ4_wildCopy32:
  519|  3.38M|{
  520|  3.38M|    BYTE* d = (BYTE*)dstPtr;
  521|  3.38M|    const BYTE* s = (const BYTE*)srcPtr;
  522|  3.38M|    BYTE* const e = (BYTE*)dstEnd;
  523|       |
  524|  16.2M|    do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  350|  16.2M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
                  do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  350|  16.2M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (524:79): [True: 12.8M, False: 3.38M]
  ------------------
  525|  3.38M|}
lz4.c:LZ4_readLE16:
  432|  18.2M|{
  433|  18.2M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (433:9): [True: 18.2M, False: 0]
  ------------------
  434|  18.2M|        return LZ4_read16(memPtr);
  435|  18.2M|    } else {
  436|      0|        const BYTE* p = (const BYTE*)memPtr;
  437|      0|        return (U16)((U16)p[0] | (p[1]<<8));
  438|      0|    }
  439|  18.2M|}
lz4.c:LZ4_memcpy_using_offset:
  532|  1.06M|{
  533|  1.06M|    BYTE v[8];
  534|       |
  535|  1.06M|    assert(dstEnd >= dstPtr + MINMATCH);
  ------------------
  |  Branch (535:5): [True: 0, False: 1.06M]
  |  Branch (535:5): [True: 1.06M, False: 0]
  ------------------
  536|       |
  537|  1.06M|    switch(offset) {
  538|   158k|    case 1:
  ------------------
  |  Branch (538:5): [True: 158k, False: 907k]
  ------------------
  539|   158k|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  237|   158k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  235|   158k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  540|   158k|        break;
  541|   673k|    case 2:
  ------------------
  |  Branch (541:5): [True: 673k, False: 392k]
  ------------------
  542|   673k|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  350|   673k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  543|   673k|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  350|   673k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  544|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  545|       |#  pragma warning(push)
  546|       |#  pragma warning(disable : 6385) /* warning C6385: Reading invalid data from 'v'. */
  547|       |#endif
  548|   673k|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  350|   673k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  549|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  550|       |#  pragma warning(pop)
  551|       |#endif
  552|   673k|        break;
  553|  77.9k|    case 4:
  ------------------
  |  Branch (553:5): [True: 77.9k, False: 988k]
  ------------------
  554|  77.9k|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  350|  77.9k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  555|  77.9k|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  350|  77.9k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  556|  77.9k|        break;
  557|   156k|    default:
  ------------------
  |  Branch (557:5): [True: 156k, False: 910k]
  ------------------
  558|   156k|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  559|   156k|        return;
  560|  1.06M|    }
  561|       |
  562|   910k|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  350|   910k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  563|   910k|    dstPtr += 8;
  564|  17.1M|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (564:12): [True: 16.2M, False: 910k]
  ------------------
  565|  16.2M|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  350|  16.2M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  566|  16.2M|        dstPtr += 8;
  567|  16.2M|    }
  568|   910k|}
lz4.c:LZ4_memcpy_using_offset_base:
  493|   156k|{
  494|   156k|    assert(srcPtr + offset == dstPtr);
  ------------------
  |  Branch (494:5): [True: 0, False: 156k]
  |  Branch (494:5): [True: 156k, False: 0]
  ------------------
  495|   156k|    if (offset < 8) {
  ------------------
  |  Branch (495:9): [True: 132k, False: 23.2k]
  ------------------
  496|   132k|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  497|   132k|        dstPtr[0] = srcPtr[0];
  498|   132k|        dstPtr[1] = srcPtr[1];
  499|   132k|        dstPtr[2] = srcPtr[2];
  500|   132k|        dstPtr[3] = srcPtr[3];
  501|   132k|        srcPtr += inc32table[offset];
  502|   132k|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  350|   132k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  503|   132k|        srcPtr -= dec64table[offset];
  504|   132k|        dstPtr += 8;
  505|   132k|    } else {
  506|  23.2k|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  350|  23.2k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  507|  23.2k|        dstPtr += 8;
  508|  23.2k|        srcPtr += 8;
  509|  23.2k|    }
  510|       |
  511|   156k|    LZ4_wildCopy8(dstPtr, srcPtr, dstEnd);
  512|   156k|}
lz4hc.c:LZ4_isAligned:
  294|  20.4k|{
  295|  20.4k|    return ((size_t)ptr & (alignment -1)) == 0;
  296|  20.4k|}
lz4hc.c:LZ4_read32:
  395|  3.52G|static U32 LZ4_read32(const void* ptr) { return ((const LZ4_unalign32*)ptr)->u32; }
lz4hc.c:LZ4_isLittleEndian:
  365|   558M|{
  366|   558M|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  367|   558M|    return one.c[0];
  368|   558M|}
lz4hc.c:LZ4_count:
  677|   178M|{
  678|   178M|    const BYTE* const pStart = pIn;
  679|       |
  680|   178M|    if (likely(pIn < pInLimit-(STEPSIZE-1))) {
  ------------------
  |  |  178|   178M|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|   178M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 177M, False: 175k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  681|   177M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  682|   177M|        if (!diff) {
  ------------------
  |  Branch (682:13): [True: 24.5M, False: 153M]
  ------------------
  683|  24.5M|            pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  674|  24.5M|#define STEPSIZE sizeof(reg_t)
  ------------------
                          pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  674|  24.5M|#define STEPSIZE sizeof(reg_t)
  ------------------
  684|   153M|        } else {
  685|   153M|            return LZ4_NbCommonBytes(diff);
  686|   153M|    }   }
  687|       |
  688|   523M|    while (likely(pIn < pInLimit-(STEPSIZE-1))) {
  689|   523M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  690|   523M|        if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  674|   499M|#define STEPSIZE sizeof(reg_t)
  ------------------
                      if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  674|   499M|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (690:13): [True: 499M, False: 23.8M]
  ------------------
  691|  23.8M|        pIn += LZ4_NbCommonBytes(diff);
  692|  23.8M|        return (unsigned)(pIn - pStart);
  693|   523M|    }
  694|       |
  695|   903k|    if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  |  674|   903k|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (695:9): [True: 903k, Folded]
  |  Branch (695:26): [True: 546k, False: 356k]
  |  Branch (695:48): [True: 458k, False: 88.1k]
  ------------------
  696|   903k|    if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (696:9): [True: 483k, False: 420k]
  |  Branch (696:31): [True: 375k, False: 108k]
  ------------------
  697|   903k|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (697:9): [True: 528k, False: 375k]
  |  Branch (697:27): [True: 422k, False: 105k]
  ------------------
  698|   903k|    return (unsigned)(pIn - pStart);
  699|  24.7M|}
lz4hc.c:LZ4_read_ARCH:
  396|  1.76G|static reg_t LZ4_read_ARCH(const void* ptr) { return ((const LZ4_unalignST*)ptr)->uArch; }
lz4hc.c:LZ4_NbCommonBytes:
  576|   431M|{
  577|   431M|    assert(val != 0);
  ------------------
  |  Branch (577:5): [True: 0, False: 431M]
  |  Branch (577:5): [True: 431M, False: 0]
  ------------------
  578|   431M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (578:9): [True: 431M, False: 0]
  ------------------
  579|   431M|        if (sizeof(val) == 8) {
  ------------------
  |  Branch (579:13): [True: 431M, Folded]
  ------------------
  580|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1800) && (defined(_M_AMD64) && !defined(_M_ARM64EC)) && !defined(LZ4_FORCE_SW_BITCOUNT)
  581|       |/*-*************************************************************************************************
  582|       |* ARM64EC is a Microsoft-designed ARM64 ABI compatible with AMD64 applications on ARM64 Windows 11.
  583|       |* The ARM64EC ABI does not support AVX/AVX2/AVX512 instructions, nor their relevant intrinsics
  584|       |* including _tzcnt_u64. Therefore, we need to neuter the _tzcnt_u64 code path for ARM64EC.
  585|       |****************************************************************************************************/
  586|       |#         if defined(__clang__) && (__clang_major__ < 10)
  587|       |            /* Avoid undefined clang-cl intrinsics issue.
  588|       |             * See https://github.com/lz4/lz4/pull/1017 for details. */
  589|       |            return (unsigned)__builtin_ia32_tzcnt_u64(val) >> 3;
  590|       |#         else
  591|       |            /* x64 CPUS without BMI support interpret `TZCNT` as `REP BSF` */
  592|       |            return (unsigned)_tzcnt_u64(val) >> 3;
  593|       |#         endif
  594|       |#       elif defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT)
  595|       |            unsigned long r = 0;
  596|       |            _BitScanForward64(&r, (U64)val);
  597|       |            return (unsigned)r >> 3;
  598|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  599|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  600|       |                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  601|       |            return (unsigned)__builtin_ctzll((U64)val) >> 3;
  602|       |#       else
  603|       |            const U64 m = 0x0101010101010101ULL;
  604|       |            val ^= val - 1;
  605|       |            return (unsigned)(((U64)((val & (m - 1)) * m)) >> 56);
  606|       |#       endif
  607|   431M|        } else /* 32 bits */ {
  608|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT)
  609|       |            unsigned long r;
  610|       |            _BitScanForward(&r, (U32)val);
  611|       |            return (unsigned)r >> 3;
  612|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  613|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  614|       |                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  615|       |            return (unsigned)__builtin_ctz((U32)val) >> 3;
  616|       |#       else
  617|       |            const U32 m = 0x01010101;
  618|       |            return (unsigned)((((val - 1) ^ val) & (m - 1)) * m) >> 24;
  619|       |#       endif
  620|      0|        }
  621|   431M|    } else   /* Big Endian CPU */ {
  622|      0|        if (sizeof(val)==8) {
  ------------------
  |  Branch (622:13): [True: 0, Folded]
  ------------------
  623|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  624|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  625|      0|                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  626|      0|            return (unsigned)__builtin_clzll((U64)val) >> 3;
  627|       |#       else
  628|       |#if 1
  629|       |            /* this method is probably faster,
  630|       |             * but adds a 128 bytes lookup table */
  631|       |            static const unsigned char ctz7_tab[128] = {
  632|       |                7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  633|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  634|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  635|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  636|       |                6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  637|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  638|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  639|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  640|       |            };
  641|       |            U64 const mask = 0x0101010101010101ULL;
  642|       |            U64 const t = (((val >> 8) - mask) | val) & mask;
  643|       |            return ctz7_tab[(t * 0x0080402010080402ULL) >> 57];
  644|       |#else
  645|       |            /* this method doesn't consume memory space like the previous one,
  646|       |             * but it contains several branches,
  647|       |             * that may end up slowing execution */
  648|       |            static const U32 by32 = sizeof(val)*4;  /* 32 on 64 bits (goal), 16 on 32 bits.
  649|       |            Just to avoid some static analyzer complaining about shift by 32 on 32-bits target.
  650|       |            Note that this code path is never triggered in 32-bits mode. */
  651|       |            unsigned r;
  652|       |            if (!(val>>by32)) { r=4; } else { r=0; val>>=by32; }
  653|       |            if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; }
  654|       |            r += (!val);
  655|       |            return r;
  656|       |#endif
  657|       |#       endif
  658|      0|        } else /* 32 bits */ {
  659|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  660|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  661|      0|                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  662|      0|            return (unsigned)__builtin_clz((U32)val) >> 3;
  663|       |#       else
  664|       |            val >>= 8;
  665|       |            val = ((((val + 0x00FFFF00) | 0x00FFFFFF) + val) |
  666|       |              (val + 0x00FF0000)) >> 24;
  667|       |            return (unsigned)val ^ 3;
  668|       |#       endif
  669|      0|        }
  670|      0|    }
  671|   431M|}
lz4hc.c:LZ4_read16:
  394|  3.37G|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4hc.c:LZ4_wildCopy8:
  467|  12.7M|{
  468|  12.7M|    BYTE* d = (BYTE*)dstPtr;
  469|  12.7M|    const BYTE* s = (const BYTE*)srcPtr;
  470|  12.7M|    BYTE* const e = (BYTE*)dstEnd;
  471|       |
  472|  30.4M|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  350|  30.4M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (472:50): [True: 17.7M, False: 12.7M]
  ------------------
  473|  12.7M|}
lz4hc.c:LZ4_writeLE16:
  454|  12.7M|{
  455|  12.7M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (455:9): [True: 12.7M, False: 0]
  ------------------
  456|  12.7M|        LZ4_write16(memPtr, value);
  457|  12.7M|    } else {
  458|      0|        BYTE* p = (BYTE*)memPtr;
  459|      0|        p[0] = (BYTE) value;
  460|      0|        p[1] = (BYTE)(value>>8);
  461|      0|    }
  462|  12.7M|}
lz4hc.c:LZ4_write16:
  398|  12.7M|static void LZ4_write16(void* memPtr, U16 value) { ((LZ4_unalign16*)memPtr)->u16 = value; }

LZ4F_isError:
  296|  79.7k|{
  297|  79.7k|    return (code > (LZ4F_errorCode_t)(-LZ4F_ERROR_maxCode));
  298|  79.7k|}
LZ4F_getBlockSize:
  336|  68.3k|{
  337|  68.3k|    static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  240|  68.3k|#  define KB *(1<<10)
  ------------------
                  static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  240|  68.3k|#  define KB *(1<<10)
  ------------------
                  static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  241|  68.3k|#  define MB *(1<<20)
  ------------------
                  static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  241|  68.3k|#  define MB *(1<<20)
  ------------------
  338|       |
  339|  68.3k|    if (blockSizeID == 0) blockSizeID = LZ4F_BLOCKSIZEID_DEFAULT;
  ------------------
  |  |  252|  18.1k|#define LZ4F_BLOCKSIZEID_DEFAULT LZ4F_max64KB
  ------------------
  |  Branch (339:9): [True: 18.1k, False: 50.2k]
  ------------------
  340|  68.3k|    if (blockSizeID < LZ4F_max64KB || blockSizeID > LZ4F_max4MB)
  ------------------
  |  Branch (340:9): [True: 0, False: 68.3k]
  |  Branch (340:39): [True: 0, False: 68.3k]
  ------------------
  341|      0|        RETURN_ERROR(maxBlockSize_invalid);
  ------------------
  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  342|  68.3k|    {   int const blockSizeIdx = (int)blockSizeID - (int)LZ4F_max64KB;
  343|  68.3k|        return blockSizes[blockSizeIdx];
  344|  68.3k|}   }
LZ4F_compressFrameBound:
  409|  22.7k|{
  410|  22.7k|    LZ4F_preferences_t prefs;
  411|  22.7k|    size_t const headerSize = maxFHSize;      /* max header size, including optional fields */
  412|       |
  413|  22.7k|    if (preferencesPtr!=NULL) prefs = *preferencesPtr;
  ------------------
  |  Branch (413:9): [True: 22.7k, False: 0]
  ------------------
  414|      0|    else MEM_INIT(&prefs, 0, sizeof(prefs));
  ------------------
  |  |   91|      0|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
  415|  22.7k|    prefs.autoFlush = 1;
  416|       |
  417|  22.7k|    return headerSize + LZ4F_compressBound_internal(srcSize, &prefs, 0);;
  418|      0|}
LZ4F_compressFrame_usingCDict:
  435|  11.3k|{
  436|  11.3k|    LZ4F_preferences_t prefs;
  437|  11.3k|    LZ4F_compressOptions_t options;
  438|  11.3k|    BYTE* const dstStart = (BYTE*) dstBuffer;
  439|  11.3k|    BYTE* dstPtr = dstStart;
  440|  11.3k|    BYTE* const dstEnd = dstStart + dstCapacity;
  441|       |
  442|  11.3k|    DEBUGLOG(4, "LZ4F_compressFrame_usingCDict (srcSize=%u)", (unsigned)srcSize);
  ------------------
  |  |  163|  11.3k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
  443|  11.3k|    if (preferencesPtr!=NULL)
  ------------------
  |  Branch (443:9): [True: 11.3k, False: 0]
  ------------------
  444|  11.3k|        prefs = *preferencesPtr;
  445|      0|    else
  446|      0|        MEM_INIT(&prefs, 0, sizeof(prefs));
  ------------------
  |  |   91|      0|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
  447|  11.3k|    if (prefs.frameInfo.contentSize != 0)
  ------------------
  |  Branch (447:9): [True: 0, False: 11.3k]
  ------------------
  448|      0|        prefs.frameInfo.contentSize = (U64)srcSize;   /* auto-correct content size if selected (!=0) */
  449|       |
  450|  11.3k|    prefs.frameInfo.blockSizeID = LZ4F_optimalBSID(prefs.frameInfo.blockSizeID, srcSize);
  451|  11.3k|    prefs.autoFlush = 1;
  452|  11.3k|    if (srcSize <= LZ4F_getBlockSize(prefs.frameInfo.blockSizeID))
  ------------------
  |  Branch (452:9): [True: 9.23k, False: 2.15k]
  ------------------
  453|  9.23k|        prefs.frameInfo.blockMode = LZ4F_blockIndependent;   /* only one block => no need for inter-block link */
  454|       |
  455|  11.3k|    MEM_INIT(&options, 0, sizeof(options));
  ------------------
  |  |   91|  11.3k|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
  456|  11.3k|    options.stableSrc = 1;
  457|       |
  458|  11.3k|    RETURN_ERROR_IF(dstCapacity < LZ4F_compressFrameBound(srcSize, &prefs), dstMaxSize_tooSmall);
  ------------------
  |  |  322|  11.3k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  11.3k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 11.3k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  11.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
  459|       |
  460|  11.3k|    { size_t const headerSize = LZ4F_compressBegin_usingCDict(cctx, dstBuffer, dstCapacity, cdict, &prefs);  /* write header */
  461|  11.3k|      FORWARD_IF_ERROR(headerSize);
  ------------------
  |  |  329|  11.3k|#define FORWARD_IF_ERROR(r) do { if (LZ4F_isError(r)) return (r); } while (0)
  |  |  ------------------
  |  |  |  Branch (329:38): [True: 0, False: 11.3k]
  |  |  |  Branch (329:76): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
  462|  11.3k|      dstPtr += headerSize;   /* header size */ }
  463|       |
  464|  11.3k|    assert(dstEnd >= dstPtr);
  ------------------
  |  Branch (464:5): [True: 0, False: 11.3k]
  |  Branch (464:5): [True: 11.3k, False: 0]
  ------------------
  465|  11.3k|    { size_t const cSize = LZ4F_compressUpdate(cctx, dstPtr, (size_t)(dstEnd-dstPtr), srcBuffer, srcSize, &options);
  466|  11.3k|      FORWARD_IF_ERROR(cSize);
  ------------------
  |  |  329|  11.3k|#define FORWARD_IF_ERROR(r) do { if (LZ4F_isError(r)) return (r); } while (0)
  |  |  ------------------
  |  |  |  Branch (329:38): [True: 0, False: 11.3k]
  |  |  |  Branch (329:76): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
  467|  11.3k|      dstPtr += cSize; }
  468|       |
  469|  11.3k|    assert(dstEnd >= dstPtr);
  ------------------
  |  Branch (469:5): [True: 0, False: 11.3k]
  |  Branch (469:5): [True: 11.3k, False: 0]
  ------------------
  470|  11.3k|    { size_t const tailSize = LZ4F_compressEnd(cctx, dstPtr, (size_t)(dstEnd-dstPtr), &options);   /* flush last block, and generate suffix */
  471|  11.3k|      FORWARD_IF_ERROR(tailSize);
  ------------------
  |  |  329|  11.3k|#define FORWARD_IF_ERROR(r) do { if (LZ4F_isError(r)) return (r); } while (0)
  |  |  ------------------
  |  |  |  Branch (329:38): [True: 0, False: 11.3k]
  |  |  |  Branch (329:76): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
  472|  11.3k|      dstPtr += tailSize; }
  473|       |
  474|  11.3k|    assert(dstEnd >= dstStart);
  ------------------
  |  Branch (474:5): [True: 0, False: 11.3k]
  |  Branch (474:5): [True: 11.3k, False: 0]
  ------------------
  475|  11.3k|    return (size_t)(dstPtr - dstStart);
  476|  11.3k|}
LZ4F_compressFrame:
  489|  11.3k|{
  490|  11.3k|    size_t result;
  491|       |#if (LZ4F_HEAPMODE)
  492|       |    LZ4F_cctx_t* cctxPtr;
  493|       |    result = LZ4F_createCompressionContext(&cctxPtr, LZ4F_VERSION);
  494|       |    FORWARD_IF_ERROR(result);
  495|       |#else
  496|  11.3k|    LZ4F_cctx_t cctx;
  497|  11.3k|    LZ4_stream_t lz4ctx;
  498|  11.3k|    LZ4F_cctx_t* const cctxPtr = &cctx;
  499|       |
  500|  11.3k|    MEM_INIT(&cctx, 0, sizeof(cctx));
  ------------------
  |  |   91|  11.3k|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
  501|  11.3k|    cctx.version = LZ4F_VERSION;
  ------------------
  |  |  257|  11.3k|#define LZ4F_VERSION 100    /* This number can be used to check for an incompatible API breaking change */
  ------------------
  502|  11.3k|    cctx.maxBufferSize = 5 MB;   /* mess with real buffer size to prevent dynamic allocation; works only because autoflush==1 & stableSrc==1 */
  ------------------
  |  |  241|  11.3k|#  define MB *(1<<20)
  ------------------
  503|  11.3k|    if ( preferencesPtr == NULL
  ------------------
  |  Branch (503:10): [True: 0, False: 11.3k]
  ------------------
  504|  11.3k|      || preferencesPtr->compressionLevel < LZ4HC_CLEVEL_MIN ) {
  ------------------
  |  |   47|  11.3k|#define LZ4HC_CLEVEL_MIN         2
  ------------------
  |  Branch (504:10): [True: 2.01k, False: 9.37k]
  ------------------
  505|  2.01k|        LZ4_initStream(&lz4ctx, sizeof(lz4ctx));
  506|  2.01k|        cctxPtr->lz4CtxPtr = &lz4ctx;
  507|  2.01k|        cctxPtr->lz4CtxAlloc = 1;
  508|  2.01k|        cctxPtr->lz4CtxType = ctxFast;
  509|  2.01k|    }
  510|  11.3k|#endif
  511|  11.3k|    DEBUGLOG(4, "LZ4F_compressFrame");
  ------------------
  |  |  163|  11.3k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
  512|       |
  513|  11.3k|    result = LZ4F_compressFrame_usingCDict(cctxPtr, dstBuffer, dstCapacity,
  514|  11.3k|                                           srcBuffer, srcSize,
  515|  11.3k|                                           NULL, preferencesPtr);
  516|       |
  517|       |#if (LZ4F_HEAPMODE)
  518|       |    LZ4F_freeCompressionContext(cctxPtr);
  519|       |#else
  520|  11.3k|    if ( preferencesPtr != NULL
  ------------------
  |  Branch (520:10): [True: 11.3k, False: 0]
  ------------------
  521|  11.3k|      && preferencesPtr->compressionLevel >= LZ4HC_CLEVEL_MIN ) {
  ------------------
  |  |   47|  11.3k|#define LZ4HC_CLEVEL_MIN         2
  ------------------
  |  Branch (521:10): [True: 9.37k, False: 2.01k]
  ------------------
  522|  9.37k|        LZ4F_free(cctxPtr->lz4CtxPtr, cctxPtr->cmem);
  523|  9.37k|    }
  524|  11.3k|#endif
  525|  11.3k|    return result;
  526|  11.3k|}
LZ4F_compressBegin_usingCDict:
  872|  11.3k|{
  873|  11.3k|    return LZ4F_compressBegin_internal(cctx, dstBuffer, dstCapacity,
  874|       |                                        NULL, 0,
  875|  11.3k|                                       cdict, preferencesPtr);
  876|  11.3k|}
LZ4F_compressUpdate:
 1139|  11.3k|{
 1140|  11.3k|     return LZ4F_compressUpdateImpl(cctxPtr,
 1141|  11.3k|                                   dstBuffer, dstCapacity,
 1142|  11.3k|                                   srcBuffer, srcSize,
 1143|  11.3k|                                   compressOptionsPtr, LZ4B_COMPRESSED);
 1144|  11.3k|}
LZ4F_flush:
 1178|  11.3k|{
 1179|  11.3k|    BYTE* const dstStart = (BYTE*)dstBuffer;
 1180|  11.3k|    BYTE* dstPtr = dstStart;
 1181|  11.3k|    compressFunc_t compress;
 1182|       |
 1183|  11.3k|    DEBUGLOG(5, "LZ4F_flush: %zu buffered bytes (saved dict size = %i) (dstCapacity=%u)",
  ------------------
  |  |  163|  11.3k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1184|  11.3k|            cctxPtr->tmpInSize, (int)(cctxPtr->tmpIn - cctxPtr->tmpBuff), (unsigned)dstCapacity);
 1185|  11.3k|    if (cctxPtr->tmpInSize == 0) return 0;   /* nothing to flush */
  ------------------
  |  Branch (1185:9): [True: 11.3k, False: 0]
  ------------------
 1186|      0|    RETURN_ERROR_IF(cctxPtr->cStage != 1, compressionState_uninitialized);
  ------------------
  |  |  322|      0|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|      0|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1187|      0|    RETURN_ERROR_IF(dstCapacity < (cctxPtr->tmpInSize + BHSize + BFSize), dstMaxSize_tooSmall);
  ------------------
  |  |  322|      0|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|      0|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1188|      0|    (void)compressOptionsPtr;   /* not useful (yet) */
 1189|       |
 1190|       |    /* select compression function */
 1191|      0|    compress = LZ4F_selectCompression(cctxPtr->prefs.frameInfo.blockMode, cctxPtr->prefs.compressionLevel, cctxPtr->blockCompressMode);
 1192|       |
 1193|       |    /* compress tmp buffer */
 1194|      0|    dstPtr += LZ4F_makeBlock(dstPtr,
 1195|      0|                             cctxPtr->tmpIn, cctxPtr->tmpInSize,
 1196|      0|                             compress, cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel,
 1197|      0|                             cctxPtr->cdict,
 1198|      0|                             cctxPtr->prefs.frameInfo.blockChecksumFlag);
 1199|      0|    assert(((void)"flush overflows dstBuffer!", (size_t)(dstPtr - dstStart) <= dstCapacity));
  ------------------
  |  Branch (1199:5): [True: 0, False: 0]
  |  Branch (1199:5): [True: 0, False: 0]
  ------------------
 1200|       |
 1201|      0|    if (cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked)
  ------------------
  |  Branch (1201:9): [True: 0, False: 0]
  ------------------
 1202|      0|        cctxPtr->tmpIn += cctxPtr->tmpInSize;
 1203|      0|    cctxPtr->tmpInSize = 0;
 1204|       |
 1205|       |    /* keep tmpIn within limits */
 1206|      0|    if ((cctxPtr->tmpIn + cctxPtr->maxBlockSize) > (cctxPtr->tmpBuff + cctxPtr->maxBufferSize)) {
  ------------------
  |  Branch (1206:9): [True: 0, False: 0]
  ------------------
 1207|      0|        assert(cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked);
  ------------------
  |  Branch (1207:9): [True: 0, False: 0]
  |  Branch (1207:9): [True: 0, False: 0]
  ------------------
 1208|      0|        LZ4F_localSaveDict(cctxPtr);
 1209|      0|    }
 1210|       |
 1211|      0|    return (size_t)(dstPtr - dstStart);
 1212|      0|}
LZ4F_compressEnd:
 1227|  11.3k|{
 1228|  11.3k|    BYTE* const dstStart = (BYTE*)dstBuffer;
 1229|  11.3k|    BYTE* dstPtr = dstStart;
 1230|       |
 1231|  11.3k|    size_t const flushSize = LZ4F_flush(cctxPtr, dstBuffer, dstCapacity, compressOptionsPtr);
 1232|  11.3k|    DEBUGLOG(5,"LZ4F_compressEnd: dstCapacity=%u", (unsigned)dstCapacity);
  ------------------
  |  |  163|  11.3k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1233|  11.3k|    FORWARD_IF_ERROR(flushSize);
  ------------------
  |  |  329|  11.3k|#define FORWARD_IF_ERROR(r) do { if (LZ4F_isError(r)) return (r); } while (0)
  |  |  ------------------
  |  |  |  Branch (329:38): [True: 0, False: 11.3k]
  |  |  |  Branch (329:76): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
 1234|  11.3k|    dstPtr += flushSize;
 1235|       |
 1236|  11.3k|    assert(flushSize <= dstCapacity);
  ------------------
  |  Branch (1236:5): [True: 0, False: 11.3k]
  |  Branch (1236:5): [True: 11.3k, False: 0]
  ------------------
 1237|  11.3k|    dstCapacity -= flushSize;
 1238|       |
 1239|  11.3k|    RETURN_ERROR_IF(dstCapacity < 4, dstMaxSize_tooSmall);
  ------------------
  |  |  322|  11.3k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  11.3k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 11.3k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  11.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
 1240|  11.3k|    LZ4F_writeLE32(dstPtr, 0);
 1241|  11.3k|    dstPtr += 4;   /* endMark */
 1242|       |
 1243|  11.3k|    if (cctxPtr->prefs.frameInfo.contentChecksumFlag == LZ4F_contentChecksumEnabled) {
  ------------------
  |  Branch (1243:9): [True: 5.64k, False: 5.74k]
  ------------------
 1244|  5.64k|        U32 const xxh = XXH32_digest(&(cctxPtr->xxh));
  ------------------
  |  |  133|  5.64k|#  define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
  |  |  ------------------
  |  |  |  |  126|  5.64k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  5.64k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1245|  5.64k|        RETURN_ERROR_IF(dstCapacity < 8, dstMaxSize_tooSmall);
  ------------------
  |  |  322|  5.64k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  5.64k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 5.64k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  5.64k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 5.64k]
  |  |  ------------------
  ------------------
 1246|  5.64k|        DEBUGLOG(5,"Writing 32-bit content checksum (0x%0X)", xxh);
  ------------------
  |  |  163|  5.64k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1247|  5.64k|        LZ4F_writeLE32(dstPtr, xxh);
 1248|  5.64k|        dstPtr+=4;   /* content Checksum */
 1249|  5.64k|    }
 1250|       |
 1251|  11.3k|    cctxPtr->cStage = 0;   /* state is now re-usable (with identical preferences) */
 1252|       |
 1253|  11.3k|    if (cctxPtr->prefs.frameInfo.contentSize) {
  ------------------
  |  Branch (1253:9): [True: 0, False: 11.3k]
  ------------------
 1254|      0|        if (cctxPtr->prefs.frameInfo.contentSize != cctxPtr->totalInSize)
  ------------------
  |  Branch (1254:13): [True: 0, False: 0]
  ------------------
 1255|      0|            RETURN_ERROR(frameSize_wrong);
  ------------------
  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
 1256|      0|    }
 1257|       |
 1258|  11.3k|    return (size_t)(dstPtr - dstStart);
 1259|  11.3k|}
LZ4F_createDecompressionContext_advanced:
 1303|  11.3k|{
 1304|  11.3k|    LZ4F_dctx* const dctx = (LZ4F_dctx*)LZ4F_calloc(sizeof(LZ4F_dctx), customMem);
 1305|  11.3k|    if (dctx == NULL) return NULL;
  ------------------
  |  Branch (1305:9): [True: 0, False: 11.3k]
  ------------------
 1306|       |
 1307|  11.3k|    dctx->cmem = customMem;
 1308|  11.3k|    dctx->version = version;
 1309|  11.3k|    return dctx;
 1310|  11.3k|}
LZ4F_createDecompressionContext:
 1320|  11.3k|{
 1321|  11.3k|    assert(LZ4F_decompressionContextPtr != NULL);  /* violation of narrow contract */
  ------------------
  |  Branch (1321:5): [True: 0, False: 11.3k]
  |  Branch (1321:5): [True: 11.3k, False: 0]
  ------------------
 1322|  11.3k|    RETURN_ERROR_IF(LZ4F_decompressionContextPtr == NULL, parameter_null);  /* in case it nonetheless happen in production */
  ------------------
  |  |  322|  11.3k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  11.3k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 11.3k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  11.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
 1323|       |
 1324|  11.3k|    *LZ4F_decompressionContextPtr = LZ4F_createDecompressionContext_advanced(LZ4F_defaultCMem, versionNumber);
 1325|  11.3k|    if (*LZ4F_decompressionContextPtr == NULL) {  /* failed allocation */
  ------------------
  |  Branch (1325:9): [True: 0, False: 11.3k]
  ------------------
 1326|      0|        RETURN_ERROR(allocation_failed);
  ------------------
  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
 1327|      0|    }
 1328|  11.3k|    return LZ4F_OK_NoError;
 1329|  11.3k|}
LZ4F_freeDecompressionContext:
 1332|  11.3k|{
 1333|  11.3k|    LZ4F_errorCode_t result = LZ4F_OK_NoError;
 1334|  11.3k|    if (dctx != NULL) {   /* can accept NULL input, like free() */
  ------------------
  |  Branch (1334:9): [True: 11.3k, False: 0]
  ------------------
 1335|  11.3k|      result = (LZ4F_errorCode_t)dctx->dStage;
 1336|  11.3k|      LZ4F_free(dctx->tmpIn, dctx->cmem);
 1337|  11.3k|      LZ4F_free(dctx->tmpOutBuffer, dctx->cmem);
 1338|  11.3k|      LZ4F_free(dctx, dctx->cmem);
 1339|  11.3k|    }
 1340|  11.3k|    return result;
 1341|  11.3k|}
LZ4F_resetDecompressionContext:
 1355|  11.3k|{
 1356|  11.3k|    DEBUGLOG(5, "LZ4F_resetDecompressionContext");
  ------------------
  |  |  163|  11.3k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1357|  11.3k|    dctx->dStage = dstage_getFrameHeader;
 1358|       |    dctx->dict = NULL;
 1359|  11.3k|    dctx->dictSize = 0;
 1360|  11.3k|    dctx->skipChecksum = 0;
 1361|  11.3k|    dctx->frameRemainingSize = 0;
 1362|  11.3k|}
LZ4F_decompress:
 1648|  11.3k|{
 1649|  11.3k|    LZ4F_decompressOptions_t optionsNull;
 1650|  11.3k|    const BYTE* const srcStart = (const BYTE*)srcBuffer;
 1651|  11.3k|    const BYTE* const srcEnd = srcStart + *srcSizePtr;
 1652|  11.3k|    const BYTE* srcPtr = srcStart;
 1653|  11.3k|    BYTE* const dstStart = (BYTE*)dstBuffer;
 1654|  11.3k|    BYTE* const dstEnd = dstStart ? dstStart + *dstSizePtr : NULL;
  ------------------
  |  Branch (1654:26): [True: 11.3k, False: 0]
  ------------------
 1655|  11.3k|    BYTE* dstPtr = dstStart;
 1656|  11.3k|    const BYTE* selectedIn = NULL;
 1657|  11.3k|    unsigned doAnotherStage = 1;
 1658|  11.3k|    size_t nextSrcSizeHint = 1;
 1659|       |
 1660|       |
 1661|  11.3k|    DEBUGLOG(5, "LZ4F_decompress: src[%p](%u) => dst[%p](%u)",
  ------------------
  |  |  163|  11.3k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1662|  11.3k|            srcBuffer, (unsigned)*srcSizePtr, dstBuffer, (unsigned)*dstSizePtr);
 1663|  11.3k|    if (dstBuffer == NULL) assert(*dstSizePtr == 0);
  ------------------
  |  Branch (1663:9): [True: 0, False: 11.3k]
  |  Branch (1663:28): [True: 0, False: 0]
  |  Branch (1663:28): [True: 0, False: 0]
  ------------------
 1664|  11.3k|    MEM_INIT(&optionsNull, 0, sizeof(optionsNull));
  ------------------
  |  |   91|  11.3k|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
 1665|  11.3k|    if (decompressOptionsPtr==NULL) decompressOptionsPtr = &optionsNull;
  ------------------
  |  Branch (1665:9): [True: 0, False: 11.3k]
  ------------------
 1666|  11.3k|    *srcSizePtr = 0;
 1667|  11.3k|    *dstSizePtr = 0;
 1668|  11.3k|    assert(dctx != NULL);
  ------------------
  |  Branch (1668:5): [True: 0, False: 11.3k]
  |  Branch (1668:5): [True: 11.3k, False: 0]
  ------------------
 1669|  11.3k|    dctx->skipChecksum |= (decompressOptionsPtr->skipChecksums != 0); /* once set, disable for the remainder of the frame */
 1670|       |
 1671|       |    /* behaves as a state machine */
 1672|       |
 1673|  87.2k|    while (doAnotherStage) {
  ------------------
  |  Branch (1673:12): [True: 75.8k, False: 11.3k]
  ------------------
 1674|       |
 1675|  75.8k|        switch(dctx->dStage)
  ------------------
  |  Branch (1675:16): [True: 75.8k, False: 0]
  ------------------
 1676|  75.8k|        {
 1677|       |
 1678|  11.3k|        case dstage_getFrameHeader:
  ------------------
  |  Branch (1678:9): [True: 11.3k, False: 64.4k]
  ------------------
 1679|  11.3k|            DEBUGLOG(6, "dstage_getFrameHeader");
  ------------------
  |  |  163|  11.3k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1680|  11.3k|            if ((size_t)(srcEnd-srcPtr) >= maxFHSize) {  /* enough to decode - shortcut */
  ------------------
  |  Branch (1680:17): [True: 11.3k, False: 42]
  ------------------
 1681|  11.3k|                size_t const hSize = LZ4F_decodeHeader(dctx, srcPtr, (size_t)(srcEnd-srcPtr));  /* will update dStage appropriately */
 1682|  11.3k|                FORWARD_IF_ERROR(hSize);
  ------------------
  |  |  329|  11.3k|#define FORWARD_IF_ERROR(r) do { if (LZ4F_isError(r)) return (r); } while (0)
  |  |  ------------------
  |  |  |  Branch (329:38): [True: 0, False: 11.3k]
  |  |  |  Branch (329:76): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
 1683|  11.3k|                srcPtr += hSize;
 1684|  11.3k|                break;
 1685|  11.3k|            }
 1686|     42|            dctx->tmpInSize = 0;
 1687|     42|            if (srcEnd-srcPtr == 0) return minFHSize;   /* 0-size input */
  ------------------
  |  Branch (1687:17): [True: 0, False: 42]
  ------------------
 1688|     42|            dctx->tmpInTarget = minFHSize;   /* minimum size to decode header */
 1689|     42|            dctx->dStage = dstage_storeFrameHeader;
 1690|       |            /* fall-through */
 1691|       |
 1692|     42|        case dstage_storeFrameHeader:
  ------------------
  |  Branch (1692:9): [True: 0, False: 75.8k]
  ------------------
 1693|     42|            DEBUGLOG(6, "dstage_storeFrameHeader");
  ------------------
  |  |  163|     42|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1694|     42|            {   size_t const sizeToCopy = MIN(dctx->tmpInTarget - dctx->tmpInSize, (size_t)(srcEnd - srcPtr));
  ------------------
  |  |  349|     42|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 42, False: 0]
  |  |  ------------------
  ------------------
 1695|     42|                memcpy(dctx->header + dctx->tmpInSize, srcPtr, sizeToCopy);
 1696|     42|                dctx->tmpInSize += sizeToCopy;
 1697|     42|                srcPtr += sizeToCopy;
 1698|     42|            }
 1699|     42|            if (dctx->tmpInSize < dctx->tmpInTarget) {
  ------------------
  |  Branch (1699:17): [True: 0, False: 42]
  ------------------
 1700|      0|                nextSrcSizeHint = (dctx->tmpInTarget - dctx->tmpInSize) + BHSize;   /* rest of header + nextBlockHeader */
 1701|      0|                doAnotherStage = 0;   /* not enough src data, ask for some more */
 1702|      0|                break;
 1703|      0|            }
 1704|     42|            FORWARD_IF_ERROR( LZ4F_decodeHeader(dctx, dctx->header, dctx->tmpInTarget) ); /* will update dStage appropriately */
  ------------------
  |  |  329|     42|#define FORWARD_IF_ERROR(r) do { if (LZ4F_isError(r)) return (r); } while (0)
  |  |  ------------------
  |  |  |  Branch (329:38): [True: 0, False: 42]
  |  |  |  Branch (329:76): [Folded, False: 42]
  |  |  ------------------
  ------------------
 1705|     42|            break;
 1706|       |
 1707|  11.3k|        case dstage_init:
  ------------------
  |  Branch (1707:9): [True: 11.3k, False: 64.4k]
  ------------------
 1708|  11.3k|            DEBUGLOG(6, "dstage_init");
  ------------------
  |  |  163|  11.3k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1709|  11.3k|            if (dctx->frameInfo.contentChecksumFlag) (void)XXH32_reset(&(dctx->xxh), 0);
  ------------------
  |  |  131|  5.64k|#  define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
  |  |  ------------------
  |  |  |  |  126|  5.64k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  5.64k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1709:17): [True: 5.64k, False: 5.74k]
  ------------------
 1710|       |            /* internal buffers allocation */
 1711|  11.3k|            {   size_t const bufferNeeded = dctx->maxBlockSize
 1712|  11.3k|                    + ((dctx->frameInfo.blockMode==LZ4F_blockLinked) ? 128 KB : 0);
  ------------------
  |  |  240|  1.59k|#  define KB *(1<<10)
  ------------------
  |  Branch (1712:24): [True: 1.59k, False: 9.80k]
  ------------------
 1713|  11.3k|                if (bufferNeeded > dctx->maxBufferSize) {   /* tmp buffers too small */
  ------------------
  |  Branch (1713:21): [True: 11.3k, False: 0]
  ------------------
 1714|  11.3k|                    dctx->maxBufferSize = 0;   /* ensure allocation will be re-attempted on next entry*/
 1715|  11.3k|                    LZ4F_free(dctx->tmpIn, dctx->cmem);
 1716|  11.3k|                    dctx->tmpIn = (BYTE*)LZ4F_malloc(dctx->maxBlockSize + BFSize /* block checksum */, dctx->cmem);
 1717|  11.3k|                    RETURN_ERROR_IF(dctx->tmpIn == NULL, allocation_failed);
  ------------------
  |  |  322|  11.3k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  11.3k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 11.3k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  11.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
 1718|  11.3k|                    LZ4F_free(dctx->tmpOutBuffer, dctx->cmem);
 1719|  11.3k|                    dctx->tmpOutBuffer= (BYTE*)LZ4F_malloc(bufferNeeded, dctx->cmem);
 1720|  11.3k|                    RETURN_ERROR_IF(dctx->tmpOutBuffer== NULL, allocation_failed);
  ------------------
  |  |  322|  11.3k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  11.3k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 11.3k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  11.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
 1721|  11.3k|                    dctx->maxBufferSize = bufferNeeded;
 1722|  11.3k|            }   }
 1723|  11.3k|            dctx->tmpInSize = 0;
 1724|  11.3k|            dctx->tmpInTarget = 0;
 1725|  11.3k|            dctx->tmpOut = dctx->tmpOutBuffer;
 1726|  11.3k|            dctx->tmpOutStart = 0;
 1727|  11.3k|            dctx->tmpOutSize = 0;
 1728|       |
 1729|  11.3k|            dctx->dStage = dstage_getBlockHeader;
 1730|       |            /* fall-through */
 1731|       |
 1732|  31.5k|        case dstage_getBlockHeader:
  ------------------
  |  Branch (1732:9): [True: 20.1k, False: 55.6k]
  ------------------
 1733|  31.5k|            if ((size_t)(srcEnd - srcPtr) >= BHSize) {
  ------------------
  |  Branch (1733:17): [True: 31.5k, False: 0]
  ------------------
 1734|  31.5k|                selectedIn = srcPtr;
 1735|  31.5k|                srcPtr += BHSize;
 1736|  31.5k|            } else {
 1737|       |                /* not enough input to read cBlockSize field */
 1738|      0|                dctx->tmpInSize = 0;
 1739|      0|                dctx->dStage = dstage_storeBlockHeader;
 1740|      0|            }
 1741|       |
 1742|  31.5k|            if (dctx->dStage == dstage_storeBlockHeader)   /* can be skipped */
  ------------------
  |  Branch (1742:17): [True: 0, False: 31.5k]
  ------------------
 1743|      0|        case dstage_storeBlockHeader:
  ------------------
  |  Branch (1743:9): [True: 0, False: 75.8k]
  ------------------
 1744|      0|            {   size_t const remainingInput = (size_t)(srcEnd - srcPtr);
 1745|      0|                size_t const wantedData = BHSize - dctx->tmpInSize;
 1746|      0|                size_t const sizeToCopy = MIN(wantedData, remainingInput);
  ------------------
  |  |  349|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1747|      0|                memcpy(dctx->tmpIn + dctx->tmpInSize, srcPtr, sizeToCopy);
 1748|      0|                srcPtr += sizeToCopy;
 1749|      0|                dctx->tmpInSize += sizeToCopy;
 1750|       |
 1751|      0|                if (dctx->tmpInSize < BHSize) {   /* not enough input for cBlockSize */
  ------------------
  |  Branch (1751:21): [True: 0, False: 0]
  ------------------
 1752|      0|                    nextSrcSizeHint = BHSize - dctx->tmpInSize;
 1753|      0|                    doAnotherStage  = 0;
 1754|      0|                    break;
 1755|      0|                }
 1756|      0|                selectedIn = dctx->tmpIn;
 1757|      0|            }   /* if (dctx->dStage == dstage_storeBlockHeader) */
 1758|       |
 1759|       |        /* decode block header */
 1760|  31.5k|            {   U32 const blockHeader = LZ4F_readLE32(selectedIn);
 1761|  31.5k|                size_t const nextCBlockSize = blockHeader & 0x7FFFFFFFU;
 1762|  31.5k|                size_t const crcSize = dctx->frameInfo.blockChecksumFlag * BFSize;
 1763|  31.5k|                if (blockHeader==0) {  /* frameEnd signal, no more block */
  ------------------
  |  Branch (1763:21): [True: 11.3k, False: 20.1k]
  ------------------
 1764|  11.3k|                    DEBUGLOG(5, "end of frame");
  ------------------
  |  |  163|  11.3k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1765|  11.3k|                    dctx->dStage = dstage_getSuffix;
 1766|  11.3k|                    break;
 1767|  11.3k|                }
 1768|  20.1k|                if (nextCBlockSize > dctx->maxBlockSize) {
  ------------------
  |  Branch (1768:21): [True: 0, False: 20.1k]
  ------------------
 1769|      0|                    RETURN_ERROR(maxBlockSize_invalid);
  ------------------
  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
 1770|      0|                }
 1771|  20.1k|                if (blockHeader & LZ4F_BLOCKUNCOMPRESSED_FLAG) {
  ------------------
  |  |  251|  20.1k|#define LZ4F_BLOCKUNCOMPRESSED_FLAG 0x80000000U
  ------------------
  |  Branch (1771:21): [True: 2.41k, False: 17.7k]
  ------------------
 1772|       |                    /* next block is uncompressed */
 1773|  2.41k|                    dctx->tmpInTarget = nextCBlockSize;
 1774|  2.41k|                    DEBUGLOG(5, "next block is uncompressed (size %u)", (U32)nextCBlockSize);
  ------------------
  |  |  163|  2.41k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1775|  2.41k|                    if (dctx->frameInfo.blockChecksumFlag) {
  ------------------
  |  Branch (1775:25): [True: 1.37k, False: 1.04k]
  ------------------
 1776|  1.37k|                        (void)XXH32_reset(&dctx->blockChecksum, 0);
  ------------------
  |  |  131|  1.37k|#  define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
  |  |  ------------------
  |  |  |  |  126|  1.37k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  1.37k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1777|  1.37k|                    }
 1778|  2.41k|                    dctx->dStage = dstage_copyDirect;
 1779|  2.41k|                    break;
 1780|  2.41k|                }
 1781|       |                /* next block is a compressed block */
 1782|  17.7k|                dctx->tmpInTarget = nextCBlockSize + crcSize;
 1783|  17.7k|                dctx->dStage = dstage_getCBlock;
 1784|  17.7k|                if (dstPtr==dstEnd || srcPtr==srcEnd) {
  ------------------
  |  Branch (1784:21): [True: 0, False: 17.7k]
  |  Branch (1784:39): [True: 0, False: 17.7k]
  ------------------
 1785|      0|                    nextSrcSizeHint = BHSize + nextCBlockSize + crcSize;
 1786|      0|                    doAnotherStage = 0;
 1787|      0|                }
 1788|  17.7k|                break;
 1789|  20.1k|            }
 1790|       |
 1791|  2.41k|        case dstage_copyDirect:   /* uncompressed block */
  ------------------
  |  Branch (1791:9): [True: 2.41k, False: 73.3k]
  ------------------
 1792|  2.41k|            DEBUGLOG(6, "dstage_copyDirect");
  ------------------
  |  |  163|  2.41k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1793|  2.41k|            {   size_t sizeToCopy;
 1794|  2.41k|                if (dstPtr == NULL) {
  ------------------
  |  Branch (1794:21): [True: 0, False: 2.41k]
  ------------------
 1795|      0|                    sizeToCopy = 0;
 1796|  2.41k|                } else {
 1797|  2.41k|                    size_t const minBuffSize = MIN((size_t)(srcEnd-srcPtr), (size_t)(dstEnd-dstPtr));
  ------------------
  |  |  349|  2.41k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 172, False: 2.24k]
  |  |  ------------------
  ------------------
 1798|  2.41k|                    sizeToCopy = MIN(dctx->tmpInTarget, minBuffSize);
  ------------------
  |  |  349|  2.41k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 931, False: 1.48k]
  |  |  ------------------
  ------------------
 1799|  2.41k|                    memcpy(dstPtr, srcPtr, sizeToCopy);
 1800|  2.41k|                    if (!dctx->skipChecksum) {
  ------------------
  |  Branch (1800:25): [True: 2.41k, False: 0]
  ------------------
 1801|  2.41k|                        if (dctx->frameInfo.blockChecksumFlag) {
  ------------------
  |  Branch (1801:29): [True: 1.37k, False: 1.04k]
  ------------------
 1802|  1.37k|                            (void)XXH32_update(&dctx->blockChecksum, srcPtr, sizeToCopy);
  ------------------
  |  |  132|  1.37k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  1.37k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  1.37k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1803|  1.37k|                        }
 1804|  2.41k|                        if (dctx->frameInfo.contentChecksumFlag)
  ------------------
  |  Branch (1804:29): [True: 1.33k, False: 1.07k]
  ------------------
 1805|  1.33k|                            (void)XXH32_update(&dctx->xxh, srcPtr, sizeToCopy);
  ------------------
  |  |  132|  1.33k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  1.33k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  1.33k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1806|  2.41k|                    }
 1807|  2.41k|                    if (dctx->frameInfo.contentSize)
  ------------------
  |  Branch (1807:25): [True: 0, False: 2.41k]
  ------------------
 1808|      0|                        dctx->frameRemainingSize -= sizeToCopy;
 1809|       |
 1810|       |                    /* history management (linked blocks only)*/
 1811|  2.41k|                    if (dctx->frameInfo.blockMode == LZ4F_blockLinked) {
  ------------------
  |  Branch (1811:25): [True: 681, False: 1.73k]
  ------------------
 1812|    681|                        LZ4F_updateDict(dctx, dstPtr, sizeToCopy, dstStart, 0);
 1813|    681|                    }
 1814|  2.41k|                    srcPtr += sizeToCopy;
 1815|  2.41k|                    dstPtr += sizeToCopy;
 1816|  2.41k|                }
 1817|  2.41k|                if (sizeToCopy == dctx->tmpInTarget) {   /* all done */
  ------------------
  |  Branch (1817:21): [True: 2.41k, False: 0]
  ------------------
 1818|  2.41k|                    if (dctx->frameInfo.blockChecksumFlag) {
  ------------------
  |  Branch (1818:25): [True: 1.37k, False: 1.04k]
  ------------------
 1819|  1.37k|                        dctx->tmpInSize = 0;
 1820|  1.37k|                        dctx->dStage = dstage_getBlockChecksum;
 1821|  1.37k|                    } else
 1822|  1.04k|                        dctx->dStage = dstage_getBlockHeader;  /* new block */
 1823|  2.41k|                    break;
 1824|  2.41k|                }
 1825|      0|                dctx->tmpInTarget -= sizeToCopy;  /* need to copy more */
 1826|      0|            }
 1827|      0|            nextSrcSizeHint = dctx->tmpInTarget +
 1828|      0|                            +(dctx->frameInfo.blockChecksumFlag ? BFSize : 0)
  ------------------
  |  Branch (1828:31): [True: 0, False: 0]
  ------------------
 1829|      0|                            + BHSize /* next header size */;
 1830|      0|            doAnotherStage = 0;
 1831|      0|            break;
 1832|       |
 1833|       |        /* check block checksum for recently transferred uncompressed block */
 1834|  1.37k|        case dstage_getBlockChecksum:
  ------------------
  |  Branch (1834:9): [True: 1.37k, False: 74.4k]
  ------------------
 1835|  1.37k|            DEBUGLOG(6, "dstage_getBlockChecksum");
  ------------------
  |  |  163|  1.37k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1836|  1.37k|            {   const void* crcSrc;
 1837|  1.37k|                if ((srcEnd-srcPtr >= 4) && (dctx->tmpInSize==0)) {
  ------------------
  |  Branch (1837:21): [True: 1.37k, False: 0]
  |  Branch (1837:45): [True: 1.37k, False: 0]
  ------------------
 1838|  1.37k|                    crcSrc = srcPtr;
 1839|  1.37k|                    srcPtr += 4;
 1840|  1.37k|                } else {
 1841|      0|                    size_t const stillToCopy = 4 - dctx->tmpInSize;
 1842|      0|                    size_t const sizeToCopy = MIN(stillToCopy, (size_t)(srcEnd-srcPtr));
  ------------------
  |  |  349|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1843|      0|                    memcpy(dctx->header + dctx->tmpInSize, srcPtr, sizeToCopy);
 1844|      0|                    dctx->tmpInSize += sizeToCopy;
 1845|      0|                    srcPtr += sizeToCopy;
 1846|      0|                    if (dctx->tmpInSize < 4) {  /* all input consumed */
  ------------------
  |  Branch (1846:25): [True: 0, False: 0]
  ------------------
 1847|      0|                        doAnotherStage = 0;
 1848|      0|                        break;
 1849|      0|                    }
 1850|      0|                    crcSrc = dctx->header;
 1851|      0|                }
 1852|  1.37k|                if (!dctx->skipChecksum) {
  ------------------
  |  Branch (1852:21): [True: 1.37k, False: 0]
  ------------------
 1853|  1.37k|                    U32 const readCRC = LZ4F_readLE32(crcSrc);
 1854|  1.37k|                    U32 const calcCRC = XXH32_digest(&dctx->blockChecksum);
  ------------------
  |  |  133|  1.37k|#  define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
  |  |  ------------------
  |  |  |  |  126|  1.37k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  1.37k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1855|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 1856|       |                    DEBUGLOG(6, "compare block checksum");
 1857|       |                    if (readCRC != calcCRC) {
 1858|       |                        DEBUGLOG(4, "incorrect block checksum: %08X != %08X",
 1859|       |                                readCRC, calcCRC);
 1860|       |                        RETURN_ERROR(blockChecksum_invalid);
 1861|       |                    }
 1862|       |#else
 1863|  1.37k|                    (void)readCRC;
 1864|  1.37k|                    (void)calcCRC;
 1865|  1.37k|#endif
 1866|  1.37k|            }   }
 1867|      0|            dctx->dStage = dstage_getBlockHeader;  /* new block */
 1868|  1.37k|            break;
 1869|       |
 1870|  17.7k|        case dstage_getCBlock:
  ------------------
  |  Branch (1870:9): [True: 17.7k, False: 58.0k]
  ------------------
 1871|  17.7k|            DEBUGLOG(6, "dstage_getCBlock");
  ------------------
  |  |  163|  17.7k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1872|  17.7k|            if ((size_t)(srcEnd-srcPtr) < dctx->tmpInTarget) {
  ------------------
  |  Branch (1872:17): [True: 0, False: 17.7k]
  ------------------
 1873|      0|                dctx->tmpInSize = 0;
 1874|      0|                dctx->dStage = dstage_storeCBlock;
 1875|      0|                break;
 1876|      0|            }
 1877|       |            /* input large enough to read full block directly */
 1878|  17.7k|            selectedIn = srcPtr;
 1879|  17.7k|            srcPtr += dctx->tmpInTarget;
 1880|       |
 1881|  17.7k|            if (0)  /* always jump over next block */
  ------------------
  |  Branch (1881:17): [Folded, False: 17.7k]
  ------------------
 1882|      0|        case dstage_storeCBlock:
  ------------------
  |  Branch (1882:9): [True: 0, False: 75.8k]
  ------------------
 1883|      0|            {   size_t const wantedData = dctx->tmpInTarget - dctx->tmpInSize;
 1884|      0|                size_t const inputLeft = (size_t)(srcEnd-srcPtr);
 1885|      0|                size_t const sizeToCopy = MIN(wantedData, inputLeft);
  ------------------
  |  |  349|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1886|      0|                memcpy(dctx->tmpIn + dctx->tmpInSize, srcPtr, sizeToCopy);
 1887|      0|                dctx->tmpInSize += sizeToCopy;
 1888|      0|                srcPtr += sizeToCopy;
 1889|      0|                if (dctx->tmpInSize < dctx->tmpInTarget) { /* need more input */
  ------------------
  |  Branch (1889:21): [True: 0, False: 0]
  ------------------
 1890|      0|                    nextSrcSizeHint = (dctx->tmpInTarget - dctx->tmpInSize)
 1891|      0|                                    + (dctx->frameInfo.blockChecksumFlag ? BFSize : 0)
  ------------------
  |  Branch (1891:40): [True: 0, False: 0]
  ------------------
 1892|      0|                                    + BHSize /* next header size */;
 1893|      0|                    doAnotherStage = 0;
 1894|      0|                    break;
 1895|      0|                }
 1896|      0|                selectedIn = dctx->tmpIn;
 1897|      0|            }
 1898|       |
 1899|       |            /* At this stage, input is large enough to decode a block */
 1900|       |
 1901|       |            /* First, decode and control block checksum if it exists */
 1902|  17.7k|            if (dctx->frameInfo.blockChecksumFlag) {
  ------------------
  |  Branch (1902:17): [True: 9.06k, False: 8.65k]
  ------------------
 1903|  9.06k|                assert(dctx->tmpInTarget >= 4);
  ------------------
  |  Branch (1903:17): [True: 0, False: 9.06k]
  |  Branch (1903:17): [True: 9.06k, False: 0]
  ------------------
 1904|  9.06k|                dctx->tmpInTarget -= 4;
 1905|  9.06k|                assert(selectedIn != NULL);  /* selectedIn is defined at this stage (either srcPtr, or dctx->tmpIn) */
  ------------------
  |  Branch (1905:17): [True: 0, False: 9.06k]
  |  Branch (1905:17): [True: 9.06k, False: 0]
  ------------------
 1906|  9.06k|                {   U32 const readBlockCrc = LZ4F_readLE32(selectedIn + dctx->tmpInTarget);
 1907|  9.06k|                    U32 const calcBlockCrc = XXH32(selectedIn, dctx->tmpInTarget, 0);
  ------------------
  |  |  128|  9.06k|#  define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
  |  |  ------------------
  |  |  |  |  126|  9.06k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  9.06k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1908|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 1909|       |                    RETURN_ERROR_IF(readBlockCrc != calcBlockCrc, blockChecksum_invalid);
 1910|       |#else
 1911|  9.06k|                    (void)readBlockCrc;
 1912|  9.06k|                    (void)calcBlockCrc;
 1913|  9.06k|#endif
 1914|  9.06k|            }   }
 1915|       |
 1916|       |            /* decode directly into destination buffer if there is enough room */
 1917|  17.7k|            if ( ((size_t)(dstEnd-dstPtr) >= dctx->maxBlockSize)
  ------------------
  |  Branch (1917:18): [True: 7.93k, False: 9.78k]
  ------------------
 1918|       |                 /* unless the dictionary is stored in tmpOut:
 1919|       |                  * in which case it's faster to decode within tmpOut
 1920|       |                  * to benefit from prefix speedup */
 1921|  7.93k|              && !(dctx->dict!= NULL && (const BYTE*)dctx->dict + dctx->dictSize == dctx->tmpOut) )
  ------------------
  |  Branch (1921:20): [True: 3.57k, False: 4.35k]
  |  Branch (1921:41): [True: 0, False: 3.57k]
  ------------------
 1922|  7.93k|            {
 1923|  7.93k|                const char* dict = (const char*)dctx->dict;
 1924|  7.93k|                size_t dictSize = dctx->dictSize;
 1925|  7.93k|                int decodedSize;
 1926|  7.93k|                assert(dstPtr != NULL);
  ------------------
  |  Branch (1926:17): [True: 0, False: 7.93k]
  |  Branch (1926:17): [True: 7.93k, False: 0]
  ------------------
 1927|  7.93k|                if (dict && dictSize > 1 GB) {
  ------------------
  |  |  242|  3.57k|#  define GB *(1<<30)
  ------------------
  |  Branch (1927:21): [True: 3.57k, False: 4.35k]
  |  Branch (1927:29): [True: 0, False: 3.57k]
  ------------------
 1928|       |                    /* overflow control : dctx->dictSize is an int, avoid truncation / sign issues */
 1929|      0|                    dict += dictSize - 64 KB;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 1930|      0|                    dictSize = 64 KB;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 1931|      0|                }
 1932|  7.93k|                decodedSize = LZ4_decompress_safe_usingDict(
 1933|  7.93k|                        (const char*)selectedIn, (char*)dstPtr,
 1934|  7.93k|                        (int)dctx->tmpInTarget, (int)dctx->maxBlockSize,
 1935|  7.93k|                        dict, (int)dictSize);
 1936|  7.93k|                RETURN_ERROR_IF(decodedSize < 0, decompressionFailed);
  ------------------
  |  |  322|  7.93k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  7.93k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 7.93k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  7.93k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 7.93k]
  |  |  ------------------
  ------------------
 1937|  7.93k|                if ((dctx->frameInfo.contentChecksumFlag) && (!dctx->skipChecksum))
  ------------------
  |  Branch (1937:21): [True: 3.87k, False: 4.05k]
  |  Branch (1937:62): [True: 3.87k, False: 0]
  ------------------
 1938|  3.87k|                    XXH32_update(&(dctx->xxh), dstPtr, (size_t)decodedSize);
  ------------------
  |  |  132|  3.87k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  3.87k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  3.87k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1939|  7.93k|                if (dctx->frameInfo.contentSize)
  ------------------
  |  Branch (1939:21): [True: 0, False: 7.93k]
  ------------------
 1940|      0|                    dctx->frameRemainingSize -= (size_t)decodedSize;
 1941|       |
 1942|       |                /* dictionary management */
 1943|  7.93k|                if (dctx->frameInfo.blockMode==LZ4F_blockLinked) {
  ------------------
  |  Branch (1943:21): [True: 5.07k, False: 2.85k]
  ------------------
 1944|  5.07k|                    LZ4F_updateDict(dctx, dstPtr, (size_t)decodedSize, dstStart, 0);
 1945|  5.07k|                }
 1946|       |
 1947|  7.93k|                dstPtr += decodedSize;
 1948|  7.93k|                dctx->dStage = dstage_getBlockHeader;  /* end of block, let's get another one */
 1949|  7.93k|                break;
 1950|  7.93k|            }
 1951|       |
 1952|       |            /* not enough place into dst : decode into tmpOut */
 1953|       |
 1954|       |            /* manage dictionary */
 1955|  9.78k|            if (dctx->frameInfo.blockMode == LZ4F_blockLinked) {
  ------------------
  |  Branch (1955:17): [True: 1.26k, False: 8.51k]
  ------------------
 1956|  1.26k|                if (dctx->dict == dctx->tmpOutBuffer) {
  ------------------
  |  Branch (1956:21): [True: 0, False: 1.26k]
  ------------------
 1957|       |                    /* truncate dictionary to 64 KB if too big */
 1958|      0|                    if (dctx->dictSize > 128 KB) {
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
  |  Branch (1958:25): [True: 0, False: 0]
  ------------------
 1959|      0|                        memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - 64 KB, 64 KB);
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
                                      memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - 64 KB, 64 KB);
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 1960|      0|                        dctx->dictSize = 64 KB;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 1961|      0|                    }
 1962|      0|                    dctx->tmpOut = dctx->tmpOutBuffer + dctx->dictSize;
 1963|  1.26k|                } else {  /* dict not within tmpOut */
 1964|  1.26k|                    size_t const reservedDictSpace = MIN(dctx->dictSize, 64 KB);
  ------------------
  |  |  349|  1.26k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 0, False: 1.26k]
  |  |  ------------------
  ------------------
 1965|  1.26k|                    dctx->tmpOut = dctx->tmpOutBuffer + reservedDictSpace;
 1966|  1.26k|            }   }
 1967|       |
 1968|       |            /* Decode block into tmpOut */
 1969|  9.78k|            {   const char* dict = (const char*)dctx->dict;
 1970|  9.78k|                size_t dictSize = dctx->dictSize;
 1971|  9.78k|                int decodedSize;
 1972|  9.78k|                if (dict && dictSize > 1 GB) {
  ------------------
  |  |  242|  1.26k|#  define GB *(1<<30)
  ------------------
  |  Branch (1972:21): [True: 1.26k, False: 8.51k]
  |  Branch (1972:29): [True: 0, False: 1.26k]
  ------------------
 1973|       |                    /* the dictSize param is an int, avoid truncation / sign issues */
 1974|      0|                    dict += dictSize - 64 KB;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 1975|      0|                    dictSize = 64 KB;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 1976|      0|                }
 1977|  9.78k|                decodedSize = LZ4_decompress_safe_usingDict(
 1978|  9.78k|                        (const char*)selectedIn, (char*)dctx->tmpOut,
 1979|  9.78k|                        (int)dctx->tmpInTarget, (int)dctx->maxBlockSize,
 1980|  9.78k|                        dict, (int)dictSize);
 1981|  9.78k|                RETURN_ERROR_IF(decodedSize < 0, decompressionFailed);
  ------------------
  |  |  322|  9.78k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  9.78k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 9.78k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  9.78k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 9.78k]
  |  |  ------------------
  ------------------
 1982|  9.78k|                if (dctx->frameInfo.contentChecksumFlag && !dctx->skipChecksum)
  ------------------
  |  Branch (1982:21): [True: 4.82k, False: 4.95k]
  |  Branch (1982:60): [True: 4.82k, False: 0]
  ------------------
 1983|  4.82k|                    XXH32_update(&(dctx->xxh), dctx->tmpOut, (size_t)decodedSize);
  ------------------
  |  |  132|  4.82k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  4.82k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  4.82k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1984|  9.78k|                if (dctx->frameInfo.contentSize)
  ------------------
  |  Branch (1984:21): [True: 0, False: 9.78k]
  ------------------
 1985|      0|                    dctx->frameRemainingSize -= (size_t)decodedSize;
 1986|  9.78k|                dctx->tmpOutSize = (size_t)decodedSize;
 1987|  9.78k|                dctx->tmpOutStart = 0;
 1988|  9.78k|                dctx->dStage = dstage_flushOut;
 1989|  9.78k|            }
 1990|       |            /* fall-through */
 1991|       |
 1992|  9.78k|        case dstage_flushOut:  /* flush decoded data from tmpOut to dstBuffer */
  ------------------
  |  Branch (1992:9): [True: 0, False: 75.8k]
  ------------------
 1993|  9.78k|            DEBUGLOG(6, "dstage_flushOut");
  ------------------
  |  |  163|  9.78k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1994|  9.78k|            if (dstPtr != NULL) {
  ------------------
  |  Branch (1994:17): [True: 9.78k, False: 0]
  ------------------
 1995|  9.78k|                size_t const sizeToCopy = MIN(dctx->tmpOutSize - dctx->tmpOutStart, (size_t)(dstEnd-dstPtr));
  ------------------
  |  |  349|  9.78k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 0, False: 9.78k]
  |  |  ------------------
  ------------------
 1996|  9.78k|                memcpy(dstPtr, dctx->tmpOut + dctx->tmpOutStart, sizeToCopy);
 1997|       |
 1998|       |                /* dictionary management */
 1999|  9.78k|                if (dctx->frameInfo.blockMode == LZ4F_blockLinked)
  ------------------
  |  Branch (1999:21): [True: 1.26k, False: 8.51k]
  ------------------
 2000|  1.26k|                    LZ4F_updateDict(dctx, dstPtr, sizeToCopy, dstStart, 1 /*withinTmp*/);
 2001|       |
 2002|  9.78k|                dctx->tmpOutStart += sizeToCopy;
 2003|  9.78k|                dstPtr += sizeToCopy;
 2004|  9.78k|            }
 2005|  9.78k|            if (dctx->tmpOutStart == dctx->tmpOutSize) { /* all flushed */
  ------------------
  |  Branch (2005:17): [True: 9.78k, False: 0]
  ------------------
 2006|  9.78k|                dctx->dStage = dstage_getBlockHeader;  /* get next block */
 2007|  9.78k|                break;
 2008|  9.78k|            }
 2009|       |            /* could not flush everything : stop there, just request a block header */
 2010|      0|            doAnotherStage = 0;
 2011|      0|            nextSrcSizeHint = BHSize;
 2012|      0|            break;
 2013|       |
 2014|  11.3k|        case dstage_getSuffix:
  ------------------
  |  Branch (2014:9): [True: 11.3k, False: 64.4k]
  ------------------
 2015|  11.3k|            RETURN_ERROR_IF(dctx->frameRemainingSize, frameSize_wrong);   /* incorrect frame size decoded */
  ------------------
  |  |  322|  11.3k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  11.3k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 11.3k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  11.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
 2016|  11.3k|            if (!dctx->frameInfo.contentChecksumFlag) {  /* no checksum, frame is completed */
  ------------------
  |  Branch (2016:17): [True: 5.74k, False: 5.64k]
  ------------------
 2017|  5.74k|                nextSrcSizeHint = 0;
 2018|  5.74k|                LZ4F_resetDecompressionContext(dctx);
 2019|  5.74k|                doAnotherStage = 0;
 2020|  5.74k|                break;
 2021|  5.74k|            }
 2022|  5.64k|            if ((srcEnd - srcPtr) < 4) {  /* not enough size for entire CRC */
  ------------------
  |  Branch (2022:17): [True: 0, False: 5.64k]
  ------------------
 2023|      0|                dctx->tmpInSize = 0;
 2024|      0|                dctx->dStage = dstage_storeSuffix;
 2025|  5.64k|            } else {
 2026|  5.64k|                selectedIn = srcPtr;
 2027|  5.64k|                srcPtr += 4;
 2028|  5.64k|            }
 2029|       |
 2030|  5.64k|            if (dctx->dStage == dstage_storeSuffix)   /* can be skipped */
  ------------------
  |  Branch (2030:17): [True: 0, False: 5.64k]
  ------------------
 2031|      0|        case dstage_storeSuffix:
  ------------------
  |  Branch (2031:9): [True: 0, False: 75.8k]
  ------------------
 2032|      0|            {   size_t const remainingInput = (size_t)(srcEnd - srcPtr);
 2033|      0|                size_t const wantedData = 4 - dctx->tmpInSize;
 2034|      0|                size_t const sizeToCopy = MIN(wantedData, remainingInput);
  ------------------
  |  |  349|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2035|      0|                memcpy(dctx->tmpIn + dctx->tmpInSize, srcPtr, sizeToCopy);
 2036|      0|                srcPtr += sizeToCopy;
 2037|      0|                dctx->tmpInSize += sizeToCopy;
 2038|      0|                if (dctx->tmpInSize < 4) { /* not enough input to read complete suffix */
  ------------------
  |  Branch (2038:21): [True: 0, False: 0]
  ------------------
 2039|      0|                    nextSrcSizeHint = 4 - dctx->tmpInSize;
 2040|      0|                    doAnotherStage=0;
 2041|      0|                    break;
 2042|      0|                }
 2043|      0|                selectedIn = dctx->tmpIn;
 2044|      0|            }   /* if (dctx->dStage == dstage_storeSuffix) */
 2045|       |
 2046|       |        /* case dstage_checkSuffix: */   /* no direct entry, avoid initialization risks */
 2047|  5.64k|            if (!dctx->skipChecksum) {
  ------------------
  |  Branch (2047:17): [True: 5.64k, False: 0]
  ------------------
 2048|  5.64k|                U32 const readCRC = LZ4F_readLE32(selectedIn);
 2049|  5.64k|                U32 const resultCRC = XXH32_digest(&(dctx->xxh));
  ------------------
  |  |  133|  5.64k|#  define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
  |  |  ------------------
  |  |  |  |  126|  5.64k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  5.64k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2050|  5.64k|                DEBUGLOG(4, "frame checksum: stored 0x%0X vs 0x%0X processed", readCRC, resultCRC);
  ------------------
  |  |  163|  5.64k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 2051|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 2052|       |                RETURN_ERROR_IF(readCRC != resultCRC, contentChecksum_invalid);
 2053|       |#else
 2054|  5.64k|                (void)readCRC;
 2055|  5.64k|                (void)resultCRC;
 2056|  5.64k|#endif
 2057|  5.64k|            }
 2058|  5.64k|            nextSrcSizeHint = 0;
 2059|  5.64k|            LZ4F_resetDecompressionContext(dctx);
 2060|  5.64k|            doAnotherStage = 0;
 2061|  5.64k|            break;
 2062|       |
 2063|      0|        case dstage_getSFrameSize:
  ------------------
  |  Branch (2063:9): [True: 0, False: 75.8k]
  ------------------
 2064|      0|            if ((srcEnd - srcPtr) >= 4) {
  ------------------
  |  Branch (2064:17): [True: 0, False: 0]
  ------------------
 2065|      0|                selectedIn = srcPtr;
 2066|      0|                srcPtr += 4;
 2067|      0|            } else {
 2068|       |                /* not enough input to read cBlockSize field */
 2069|      0|                dctx->tmpInSize = 4;
 2070|      0|                dctx->tmpInTarget = 8;
 2071|      0|                dctx->dStage = dstage_storeSFrameSize;
 2072|      0|            }
 2073|       |
 2074|      0|            if (dctx->dStage == dstage_storeSFrameSize)
  ------------------
  |  Branch (2074:17): [True: 0, False: 0]
  ------------------
 2075|      0|        case dstage_storeSFrameSize:
  ------------------
  |  Branch (2075:9): [True: 0, False: 75.8k]
  ------------------
 2076|      0|            {   size_t const sizeToCopy = MIN(dctx->tmpInTarget - dctx->tmpInSize,
  ------------------
  |  |  349|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2077|      0|                                             (size_t)(srcEnd - srcPtr) );
 2078|      0|                memcpy(dctx->header + dctx->tmpInSize, srcPtr, sizeToCopy);
 2079|      0|                srcPtr += sizeToCopy;
 2080|      0|                dctx->tmpInSize += sizeToCopy;
 2081|      0|                if (dctx->tmpInSize < dctx->tmpInTarget) {
  ------------------
  |  Branch (2081:21): [True: 0, False: 0]
  ------------------
 2082|       |                    /* not enough input to get full sBlockSize; wait for more */
 2083|      0|                    nextSrcSizeHint = dctx->tmpInTarget - dctx->tmpInSize;
 2084|      0|                    doAnotherStage = 0;
 2085|      0|                    break;
 2086|      0|                }
 2087|      0|                selectedIn = dctx->header + 4;
 2088|      0|            }   /* if (dctx->dStage == dstage_storeSFrameSize) */
 2089|       |
 2090|       |        /* case dstage_decodeSFrameSize: */   /* no direct entry */
 2091|      0|            {   size_t const SFrameSize = LZ4F_readLE32(selectedIn);
 2092|      0|                dctx->frameInfo.contentSize = SFrameSize;
 2093|      0|                dctx->tmpInTarget = SFrameSize;
 2094|      0|                dctx->dStage = dstage_skipSkippable;
 2095|      0|                break;
 2096|      0|            }
 2097|       |
 2098|      0|        case dstage_skipSkippable:
  ------------------
  |  Branch (2098:9): [True: 0, False: 75.8k]
  ------------------
 2099|      0|            {   size_t const skipSize = MIN(dctx->tmpInTarget, (size_t)(srcEnd-srcPtr));
  ------------------
  |  |  349|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2100|      0|                srcPtr += skipSize;
 2101|      0|                dctx->tmpInTarget -= skipSize;
 2102|      0|                doAnotherStage = 0;
 2103|      0|                nextSrcSizeHint = dctx->tmpInTarget;
 2104|      0|                if (nextSrcSizeHint) break;  /* still more to skip */
  ------------------
  |  Branch (2104:21): [True: 0, False: 0]
  ------------------
 2105|       |                /* frame fully skipped : prepare context for a new frame */
 2106|      0|                LZ4F_resetDecompressionContext(dctx);
 2107|      0|                break;
 2108|      0|            }
 2109|  75.8k|        }   /* switch (dctx->dStage) */
 2110|  75.8k|    }   /* while (doAnotherStage) */
 2111|       |
 2112|       |    /* preserve history within tmpOut whenever necessary */
 2113|  11.3k|    LZ4F_STATIC_ASSERT((unsigned)dstage_init == 2);
  ------------------
  |  |  151|  11.3k|#define LZ4F_STATIC_ASSERT(c)    { enum { LZ4F_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
 2114|  11.3k|    if ( (dctx->frameInfo.blockMode==LZ4F_blockLinked)  /* next block will use up to 64KB from previous ones */
  ------------------
  |  Branch (2114:10): [True: 1.59k, False: 9.80k]
  ------------------
 2115|  1.59k|      && (dctx->dict != dctx->tmpOutBuffer)             /* dictionary is not already within tmp */
  ------------------
  |  Branch (2115:10): [True: 1.59k, False: 0]
  ------------------
 2116|  1.59k|      && (dctx->dict != NULL)                           /* dictionary exists */
  ------------------
  |  Branch (2116:10): [True: 0, False: 1.59k]
  ------------------
 2117|      0|      && (!decompressOptionsPtr->stableDst)             /* cannot rely on dst data to remain there for next call */
  ------------------
  |  Branch (2117:10): [True: 0, False: 0]
  ------------------
 2118|      0|      && ((unsigned)(dctx->dStage)-2 < (unsigned)(dstage_getSuffix)-2) )  /* valid stages : [init ... getSuffix[ */
  ------------------
  |  Branch (2118:10): [True: 0, False: 0]
  ------------------
 2119|      0|    {
 2120|      0|        if (dctx->dStage == dstage_flushOut) {
  ------------------
  |  Branch (2120:13): [True: 0, False: 0]
  ------------------
 2121|      0|            size_t const preserveSize = (size_t)(dctx->tmpOut - dctx->tmpOutBuffer);
 2122|      0|            size_t copySize = 64 KB - dctx->tmpOutSize;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 2123|      0|            const BYTE* oldDictEnd = dctx->dict + dctx->dictSize - dctx->tmpOutStart;
 2124|      0|            if (dctx->tmpOutSize > 64 KB) copySize = 0;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
  |  Branch (2124:17): [True: 0, False: 0]
  ------------------
 2125|      0|            if (copySize > preserveSize) copySize = preserveSize;
  ------------------
  |  Branch (2125:17): [True: 0, False: 0]
  ------------------
 2126|      0|            assert(dctx->tmpOutBuffer != NULL);
  ------------------
  |  Branch (2126:13): [True: 0, False: 0]
  |  Branch (2126:13): [True: 0, False: 0]
  ------------------
 2127|       |
 2128|      0|            memcpy(dctx->tmpOutBuffer + preserveSize - copySize, oldDictEnd - copySize, copySize);
 2129|       |
 2130|      0|            dctx->dict = dctx->tmpOutBuffer;
 2131|      0|            dctx->dictSize = preserveSize + dctx->tmpOutStart;
 2132|      0|        } else {
 2133|      0|            const BYTE* const oldDictEnd = dctx->dict + dctx->dictSize;
 2134|      0|            size_t const newDictSize = MIN(dctx->dictSize, 64 KB);
  ------------------
  |  |  349|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2135|       |
 2136|      0|            memcpy(dctx->tmpOutBuffer, oldDictEnd - newDictSize, newDictSize);
 2137|       |
 2138|      0|            dctx->dict = dctx->tmpOutBuffer;
 2139|      0|            dctx->dictSize = newDictSize;
 2140|      0|            dctx->tmpOut = dctx->tmpOutBuffer + newDictSize;
 2141|      0|        }
 2142|      0|    }
 2143|       |
 2144|  11.3k|    *srcSizePtr = (size_t)(srcPtr - srcStart);
 2145|  11.3k|    *dstSizePtr = (size_t)(dstPtr - dstStart);
 2146|  11.3k|    return nextSrcSizeHint;
 2147|  11.3k|}
lz4frame.c:LZ4F_compressBound_internal:
  384|  34.1k|{
  385|  34.1k|    LZ4F_preferences_t prefsNull = LZ4F_INIT_PREFERENCES;
  ------------------
  |  |  201|  34.1k|#define LZ4F_INIT_PREFERENCES   { LZ4F_INIT_FRAMEINFO, 0, 0u, 0u, { 0u, 0u, 0u } }    /* v1.8.3+ */
  |  |  ------------------
  |  |  |  |  186|  34.1k|#define LZ4F_INIT_FRAMEINFO   { LZ4F_max64KB, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0ULL, 0U, LZ4F_noBlockChecksum }    /* v1.8.3+ */
  |  |  ------------------
  ------------------
  386|  34.1k|    prefsNull.frameInfo.contentChecksumFlag = LZ4F_contentChecksumEnabled;   /* worst case */
  387|  34.1k|    prefsNull.frameInfo.blockChecksumFlag = LZ4F_blockChecksumEnabled;   /* worst case */
  388|  34.1k|    {   const LZ4F_preferences_t* const prefsPtr = (preferencesPtr==NULL) ? &prefsNull : preferencesPtr;
  ------------------
  |  Branch (388:52): [True: 0, False: 34.1k]
  ------------------
  389|  34.1k|        U32 const flush = prefsPtr->autoFlush | (srcSize==0);
  390|  34.1k|        LZ4F_blockSizeID_t const blockID = prefsPtr->frameInfo.blockSizeID;
  391|  34.1k|        size_t const blockSize = LZ4F_getBlockSize(blockID);
  392|  34.1k|        size_t const maxBuffered = blockSize - 1;
  393|  34.1k|        size_t const bufferedSize = MIN(alreadyBuffered, maxBuffered);
  ------------------
  |  |  349|  34.1k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (349:22): [True: 34.1k, False: 0]
  |  |  ------------------
  ------------------
  394|  34.1k|        size_t const maxSrcSize = srcSize + bufferedSize;
  395|  34.1k|        unsigned const nbFullBlocks = (unsigned)(maxSrcSize / blockSize);
  396|  34.1k|        size_t const partialBlockSize = maxSrcSize & (blockSize-1);
  397|  34.1k|        size_t const lastBlockSize = flush ? partialBlockSize : 0;
  ------------------
  |  Branch (397:38): [True: 34.1k, False: 0]
  ------------------
  398|  34.1k|        unsigned const nbBlocks = nbFullBlocks + (lastBlockSize>0);
  399|       |
  400|  34.1k|        size_t const blockCRCSize = BFSize * prefsPtr->frameInfo.blockChecksumFlag;
  401|  34.1k|        size_t const frameEnd = BHSize + (prefsPtr->frameInfo.contentChecksumFlag*BFSize);
  402|       |
  403|  34.1k|        return ((BHSize + blockCRCSize) * nbBlocks) +
  404|  34.1k|               (blockSize * nbFullBlocks) + lastBlockSize + frameEnd;
  405|  34.1k|    }
  406|  34.1k|}
lz4frame.c:LZ4F_optimalBSID:
  363|  11.3k|{
  364|  11.3k|    LZ4F_blockSizeID_t proposedBSID = LZ4F_max64KB;
  365|  11.3k|    size_t maxBlockSize = 64 KB;
  ------------------
  |  |  240|  11.3k|#  define KB *(1<<10)
  ------------------
  366|  12.4k|    while (requestedBSID > proposedBSID) {
  ------------------
  |  Branch (366:12): [True: 4.33k, False: 8.15k]
  ------------------
  367|  4.33k|        if (srcSize <= maxBlockSize)
  ------------------
  |  Branch (367:13): [True: 3.24k, False: 1.09k]
  ------------------
  368|  3.24k|            return proposedBSID;
  369|  1.09k|        proposedBSID = (LZ4F_blockSizeID_t)((int)proposedBSID + 1);
  370|  1.09k|        maxBlockSize <<= 2;
  371|  1.09k|    }
  372|  8.15k|    return requestedBSID;
  373|  11.3k|}
lz4frame.c:LZ4F_free:
  128|  75.7k|{
  129|  75.7k|    if (p == NULL) return;
  ------------------
  |  Branch (129:9): [True: 32.1k, False: 43.5k]
  ------------------
  130|  43.5k|    if (cmem.customFree != NULL) {
  ------------------
  |  Branch (130:9): [True: 0, False: 43.5k]
  ------------------
  131|       |        /* custom allocation defined : use it */
  132|      0|        cmem.customFree(cmem.opaqueState, p);
  133|      0|        return;
  134|      0|    }
  135|       |    /* nothing defined : use default <stdlib.h>'s free() */
  136|  43.5k|    FREEMEM(p);
  ------------------
  |  |   98|  43.5k|#  define FREEMEM(p)        free(p)
  ------------------
  137|  43.5k|}
lz4frame.c:LZ4F_malloc:
  118|  32.1k|{
  119|       |    /* custom malloc defined : use it */
  120|  32.1k|    if (cmem.customAlloc != NULL) {
  ------------------
  |  Branch (120:9): [True: 0, False: 32.1k]
  ------------------
  121|      0|        return cmem.customAlloc(cmem.opaqueState, s);
  122|      0|    }
  123|       |    /* nothing defined : use default <stdlib.h>'s malloc() */
  124|  32.1k|    return ALLOC(s);
  ------------------
  |  |   96|  32.1k|#  define ALLOC(s)          malloc(s)
  ------------------
  125|  32.1k|}
lz4frame.c:LZ4F_calloc:
  102|  11.3k|{
  103|       |    /* custom calloc defined : use it */
  104|  11.3k|    if (cmem.customCalloc != NULL) {
  ------------------
  |  Branch (104:9): [True: 0, False: 11.3k]
  ------------------
  105|      0|        return cmem.customCalloc(cmem.opaqueState, s);
  106|      0|    }
  107|       |    /* nothing defined : use default <stdlib.h>'s calloc() */
  108|  11.3k|    if (cmem.customAlloc == NULL) {
  ------------------
  |  Branch (108:9): [True: 11.3k, False: 0]
  ------------------
  109|  11.3k|        return ALLOC_AND_ZERO(s);
  ------------------
  |  |   97|  11.3k|#  define ALLOC_AND_ZERO(s) calloc(1,(s))
  ------------------
  110|  11.3k|    }
  111|       |    /* only custom alloc defined : use it, and combine it with memset() */
  112|      0|    {   void* const p = cmem.customAlloc(cmem.opaqueState, s);
  113|      0|        if (p != NULL) MEM_INIT(p, 0, s);
  ------------------
  |  |   91|      0|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
  |  Branch (113:13): [True: 0, False: 0]
  ------------------
  114|      0|        return p;
  115|  11.3k|}   }
lz4frame.c:ctxTypeID_to_size:
  685|  22.7k|static int ctxTypeID_to_size(int ctxTypeID) {
  686|  22.7k|    switch(ctxTypeID) {
  687|  4.03k|    case 1:
  ------------------
  |  Branch (687:5): [True: 4.03k, False: 18.7k]
  ------------------
  688|  4.03k|        return LZ4_sizeofState();
  689|  9.37k|    case 2:
  ------------------
  |  Branch (689:5): [True: 9.37k, False: 13.4k]
  ------------------
  690|  9.37k|        return LZ4_sizeofStateHC();
  691|  9.37k|    default:
  ------------------
  |  Branch (691:5): [True: 9.37k, False: 13.4k]
  ------------------
  692|  9.37k|        return 0;
  693|  22.7k|    }
  694|  22.7k|}
lz4frame.c:LZ4F_compressBegin_internal:
  711|  11.3k|{
  712|  11.3k|    LZ4F_preferences_t const prefNull = LZ4F_INIT_PREFERENCES;
  ------------------
  |  |  201|  11.3k|#define LZ4F_INIT_PREFERENCES   { LZ4F_INIT_FRAMEINFO, 0, 0u, 0u, { 0u, 0u, 0u } }    /* v1.8.3+ */
  |  |  ------------------
  |  |  |  |  186|  11.3k|#define LZ4F_INIT_FRAMEINFO   { LZ4F_max64KB, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0ULL, 0U, LZ4F_noBlockChecksum }    /* v1.8.3+ */
  |  |  ------------------
  ------------------
  713|  11.3k|    BYTE* const dstStart = (BYTE*)dstBuffer;
  714|  11.3k|    BYTE* dstPtr = dstStart;
  715|       |
  716|  11.3k|    RETURN_ERROR_IF(dstCapacity < maxFHSize, dstMaxSize_tooSmall);
  ------------------
  |  |  322|  11.3k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  11.3k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 11.3k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  11.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
  717|  11.3k|    if (preferencesPtr == NULL) preferencesPtr = &prefNull;
  ------------------
  |  Branch (717:9): [True: 0, False: 11.3k]
  ------------------
  718|  11.3k|    cctx->prefs = *preferencesPtr;
  719|  11.3k|    DEBUGLOG(5, "LZ4F_compressBegin_internal: Independent_blocks=%u", cctx->prefs.frameInfo.blockMode);
  ------------------
  |  |  163|  11.3k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
  720|       |
  721|       |    /* cctx Management */
  722|  11.3k|    {   U16 const ctxTypeID = (cctx->prefs.compressionLevel < LZ4HC_CLEVEL_MIN) ? 1 : 2;
  ------------------
  |  |   47|  11.3k|#define LZ4HC_CLEVEL_MIN         2
  ------------------
  |  Branch (722:31): [True: 2.01k, False: 9.37k]
  ------------------
  723|  11.3k|        int requiredSize = ctxTypeID_to_size(ctxTypeID);
  724|  11.3k|        int allocatedSize = ctxTypeID_to_size(cctx->lz4CtxAlloc);
  725|  11.3k|        if (allocatedSize < requiredSize) {
  ------------------
  |  Branch (725:13): [True: 9.37k, False: 2.01k]
  ------------------
  726|       |            /* not enough space allocated */
  727|  9.37k|            LZ4F_free(cctx->lz4CtxPtr, cctx->cmem);
  728|  9.37k|            if (cctx->prefs.compressionLevel < LZ4HC_CLEVEL_MIN) {
  ------------------
  |  |   47|  9.37k|#define LZ4HC_CLEVEL_MIN         2
  ------------------
  |  Branch (728:17): [True: 0, False: 9.37k]
  ------------------
  729|       |                /* must take ownership of memory allocation,
  730|       |                 * in order to respect custom allocator contract */
  731|      0|                cctx->lz4CtxPtr = LZ4F_malloc(sizeof(LZ4_stream_t), cctx->cmem);
  732|      0|                if (cctx->lz4CtxPtr)
  ------------------
  |  Branch (732:21): [True: 0, False: 0]
  ------------------
  733|      0|                    LZ4_initStream(cctx->lz4CtxPtr, sizeof(LZ4_stream_t));
  734|  9.37k|            } else {
  735|  9.37k|                cctx->lz4CtxPtr = LZ4F_malloc(sizeof(LZ4_streamHC_t), cctx->cmem);
  736|  9.37k|                if (cctx->lz4CtxPtr)
  ------------------
  |  Branch (736:21): [True: 9.37k, False: 0]
  ------------------
  737|  9.37k|                    LZ4_initStreamHC(cctx->lz4CtxPtr, sizeof(LZ4_streamHC_t));
  738|  9.37k|            }
  739|  9.37k|            RETURN_ERROR_IF(cctx->lz4CtxPtr == NULL, allocation_failed);
  ------------------
  |  |  322|  9.37k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  9.37k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 9.37k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  9.37k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 9.37k]
  |  |  ------------------
  ------------------
  740|  9.37k|            cctx->lz4CtxAlloc = ctxTypeID;
  741|  9.37k|            cctx->lz4CtxType = ctxTypeID;
  742|  9.37k|        } else if (cctx->lz4CtxType != ctxTypeID) {
  ------------------
  |  Branch (742:20): [True: 0, False: 2.01k]
  ------------------
  743|       |            /* otherwise, a sufficient buffer is already allocated,
  744|       |             * but we need to reset it to the correct context type */
  745|      0|            if (cctx->prefs.compressionLevel < LZ4HC_CLEVEL_MIN) {
  ------------------
  |  |   47|      0|#define LZ4HC_CLEVEL_MIN         2
  ------------------
  |  Branch (745:17): [True: 0, False: 0]
  ------------------
  746|      0|                LZ4_initStream((LZ4_stream_t*)cctx->lz4CtxPtr, sizeof(LZ4_stream_t));
  747|      0|            } else {
  748|      0|                LZ4_initStreamHC((LZ4_streamHC_t*)cctx->lz4CtxPtr, sizeof(LZ4_streamHC_t));
  749|      0|                LZ4_setCompressionLevel((LZ4_streamHC_t*)cctx->lz4CtxPtr, cctx->prefs.compressionLevel);
  750|      0|            }
  751|      0|            cctx->lz4CtxType = ctxTypeID;
  752|      0|    }   }
  753|       |
  754|       |    /* Buffer Management */
  755|  11.3k|    if (cctx->prefs.frameInfo.blockSizeID == 0)
  ------------------
  |  Branch (755:9): [True: 6.05k, False: 5.34k]
  ------------------
  756|  6.05k|        cctx->prefs.frameInfo.blockSizeID = LZ4F_BLOCKSIZEID_DEFAULT;
  ------------------
  |  |  252|  6.05k|#define LZ4F_BLOCKSIZEID_DEFAULT LZ4F_max64KB
  ------------------
  757|  11.3k|    cctx->maxBlockSize = LZ4F_getBlockSize(cctx->prefs.frameInfo.blockSizeID);
  758|       |
  759|  11.3k|    {   size_t const requiredBuffSize = preferencesPtr->autoFlush ?
  ------------------
  |  Branch (759:41): [True: 11.3k, False: 0]
  ------------------
  760|  11.3k|                ((cctx->prefs.frameInfo.blockMode == LZ4F_blockLinked) ? 64 KB : 0) :  /* only needs past data up to window size */
  ------------------
  |  |  240|  1.59k|#  define KB *(1<<10)
  ------------------
  |  Branch (760:18): [True: 1.59k, False: 9.80k]
  ------------------
  761|  11.3k|                cctx->maxBlockSize + ((cctx->prefs.frameInfo.blockMode == LZ4F_blockLinked) ? 128 KB : 0);
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
  |  Branch (761:39): [True: 0, False: 0]
  ------------------
  762|       |
  763|  11.3k|        if (cctx->maxBufferSize < requiredBuffSize) {
  ------------------
  |  Branch (763:13): [True: 0, False: 11.3k]
  ------------------
  764|      0|            cctx->maxBufferSize = 0;
  765|      0|            LZ4F_free(cctx->tmpBuff, cctx->cmem);
  766|      0|            cctx->tmpBuff = (BYTE*)LZ4F_malloc(requiredBuffSize, cctx->cmem);
  767|      0|            RETURN_ERROR_IF(cctx->tmpBuff == NULL, allocation_failed);
  ------------------
  |  |  322|      0|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|      0|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  768|      0|            cctx->maxBufferSize = requiredBuffSize;
  769|      0|    }   }
  770|  11.3k|    cctx->tmpIn = cctx->tmpBuff;
  771|  11.3k|    cctx->tmpInSize = 0;
  772|  11.3k|    (void)XXH32_reset(&(cctx->xxh), 0);
  ------------------
  |  |  131|  11.3k|#  define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
  |  |  ------------------
  |  |  |  |  126|  11.3k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  11.3k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  773|       |
  774|       |    /* context init */
  775|  11.3k|    cctx->cdict = cdict;
  776|  11.3k|    if (cctx->prefs.frameInfo.blockMode == LZ4F_blockLinked) {
  ------------------
  |  Branch (776:9): [True: 1.59k, False: 9.80k]
  ------------------
  777|       |        /* frame init only for blockLinked : blockIndependent will be init at each block */
  778|  1.59k|        LZ4F_initStream(cctx->lz4CtxPtr, cdict, cctx->prefs.compressionLevel, LZ4F_blockLinked);
  779|  1.59k|    }
  780|  11.3k|    if (preferencesPtr->compressionLevel >= LZ4HC_CLEVEL_MIN) {
  ------------------
  |  |   47|  11.3k|#define LZ4HC_CLEVEL_MIN         2
  ------------------
  |  Branch (780:9): [True: 9.37k, False: 2.01k]
  ------------------
  781|  9.37k|        LZ4_favorDecompressionSpeed((LZ4_streamHC_t*)cctx->lz4CtxPtr, (int)preferencesPtr->favorDecSpeed);
  782|  9.37k|    }
  783|  11.3k|    if (dictBuffer) {
  ------------------
  |  Branch (783:9): [True: 0, False: 11.3k]
  ------------------
  784|      0|        assert(cdict == NULL);
  ------------------
  |  Branch (784:9): [True: 0, False: 0]
  |  Branch (784:9): [True: 0, False: 0]
  ------------------
  785|      0|        RETURN_ERROR_IF(dictSize > INT_MAX, parameter_invalid);
  ------------------
  |  |  322|      0|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|      0|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  786|      0|        if (cctx->lz4CtxType == ctxFast) {
  ------------------
  |  Branch (786:13): [True: 0, False: 0]
  ------------------
  787|       |            /* lz4 fast*/
  788|      0|            LZ4_loadDict((LZ4_stream_t*)cctx->lz4CtxPtr, (const char*)dictBuffer, (int)dictSize);
  789|      0|        } else {
  790|       |            /* lz4hc */
  791|      0|            assert(cctx->lz4CtxType == ctxHC);
  ------------------
  |  Branch (791:13): [True: 0, False: 0]
  |  Branch (791:13): [True: 0, False: 0]
  ------------------
  792|      0|            LZ4_loadDictHC((LZ4_streamHC_t*)cctx->lz4CtxPtr, (const char*)dictBuffer, (int)dictSize);
  793|      0|        }
  794|      0|    }
  795|       |
  796|       |    /* Stage 2 : Write Frame Header */
  797|       |
  798|       |    /* Magic Number */
  799|  11.3k|    LZ4F_writeLE32(dstPtr, LZ4F_MAGICNUMBER);
  ------------------
  |  |  406|  11.3k|#define LZ4F_MAGICNUMBER 0x184D2204U
  ------------------
  800|  11.3k|    dstPtr += 4;
  801|  11.3k|    {   BYTE* const headerStart = dstPtr;
  802|       |
  803|       |        /* FLG Byte */
  804|  11.3k|        *dstPtr++ = (BYTE)(((1 & _2BITS) << 6)    /* Version('01') */
  ------------------
  |  |  246|  11.3k|#define _2BITS 0x03
  ------------------
  805|  11.3k|            + ((cctx->prefs.frameInfo.blockMode & _1BIT ) << 5)
  ------------------
  |  |  245|  11.3k|#define _1BIT  0x01
  ------------------
  806|  11.3k|            + ((cctx->prefs.frameInfo.blockChecksumFlag & _1BIT ) << 4)
  ------------------
  |  |  245|  11.3k|#define _1BIT  0x01
  ------------------
  807|  11.3k|            + ((unsigned)(cctx->prefs.frameInfo.contentSize > 0) << 3)
  808|  11.3k|            + ((cctx->prefs.frameInfo.contentChecksumFlag & _1BIT ) << 2)
  ------------------
  |  |  245|  11.3k|#define _1BIT  0x01
  ------------------
  809|  11.3k|            +  (cctx->prefs.frameInfo.dictID > 0) );
  810|       |        /* BD Byte */
  811|  11.3k|        *dstPtr++ = (BYTE)((cctx->prefs.frameInfo.blockSizeID & _3BITS) << 4);
  ------------------
  |  |  247|  11.3k|#define _3BITS 0x07
  ------------------
  812|       |        /* Optional Frame content size field */
  813|  11.3k|        if (cctx->prefs.frameInfo.contentSize) {
  ------------------
  |  Branch (813:13): [True: 0, False: 11.3k]
  ------------------
  814|      0|            LZ4F_writeLE64(dstPtr, cctx->prefs.frameInfo.contentSize);
  815|      0|            dstPtr += 8;
  816|      0|            cctx->totalInSize = 0;
  817|      0|        }
  818|       |        /* Optional dictionary ID field */
  819|  11.3k|        if (cctx->prefs.frameInfo.dictID) {
  ------------------
  |  Branch (819:13): [True: 0, False: 11.3k]
  ------------------
  820|      0|            LZ4F_writeLE32(dstPtr, cctx->prefs.frameInfo.dictID);
  821|      0|            dstPtr += 4;
  822|      0|        }
  823|       |        /* Header CRC Byte */
  824|  11.3k|        *dstPtr = LZ4F_headerChecksum(headerStart, (size_t)(dstPtr - headerStart));
  825|  11.3k|        dstPtr++;
  826|  11.3k|    }
  827|       |
  828|  11.3k|    cctx->cStage = 1;   /* header written, now request input data block */
  829|  11.3k|    return (size_t)(dstPtr - dstStart);
  830|  11.3k|}
lz4frame.c:LZ4F_initStream:
  660|  14.6k|                            LZ4F_blockMode_t blockMode) {
  661|  14.6k|    if (level < LZ4HC_CLEVEL_MIN) {
  ------------------
  |  |   47|  14.6k|#define LZ4HC_CLEVEL_MIN         2
  ------------------
  |  Branch (661:9): [True: 3.08k, False: 11.6k]
  ------------------
  662|  3.08k|        if (cdict || blockMode == LZ4F_blockLinked) {
  ------------------
  |  Branch (662:13): [True: 0, False: 3.08k]
  |  Branch (662:22): [True: 729, False: 2.35k]
  ------------------
  663|       |            /* In these cases, we will call LZ4_compress_fast_continue(),
  664|       |             * which needs an already reset context. Otherwise, we'll call a
  665|       |             * one-shot API. The non-continued APIs internally perform their own
  666|       |             * resets at the beginning of their calls, where they know what
  667|       |             * tableType they need the context to be in. So in that case this
  668|       |             * would be misguided / wasted work. */
  669|    729|            LZ4_resetStream_fast((LZ4_stream_t*)ctx);
  670|    729|            if (cdict)
  ------------------
  |  Branch (670:17): [True: 0, False: 729]
  ------------------
  671|      0|                LZ4_attach_dictionary((LZ4_stream_t*)ctx, cdict->fastCtx);
  672|    729|        }
  673|       |        /* In these cases, we'll call a one-shot API.
  674|       |         * The non-continued APIs internally perform their own resets
  675|       |         * at the beginning of their calls, where they know
  676|       |         * which tableType they need the context to be in.
  677|       |         * Therefore, a reset here would be wasted work. */
  678|  11.6k|    } else {
  679|  11.6k|        LZ4_resetStreamHC_fast((LZ4_streamHC_t*)ctx, level);
  680|  11.6k|        if (cdict)
  ------------------
  |  Branch (680:13): [True: 0, False: 11.6k]
  ------------------
  681|      0|            LZ4_attach_HC_dictionary((LZ4_streamHC_t*)ctx, cdict->HCCtx);
  682|  11.6k|    }
  683|  14.6k|}
lz4frame.c:LZ4F_headerChecksum:
  352|  11.3k|{
  353|  11.3k|    U32 const xxh = XXH32(header, length, 0);
  ------------------
  |  |  128|  11.3k|#  define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
  |  |  ------------------
  |  |  |  |  126|  11.3k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  11.3k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  354|  11.3k|    return (BYTE)(xxh >> 8);
  355|  11.3k|}
lz4frame.c:LZ4F_compressUpdateImpl:
 1013|  11.3k|  {
 1014|  11.3k|    size_t const blockSize = cctxPtr->maxBlockSize;
 1015|  11.3k|    const BYTE* srcPtr = (const BYTE*)srcBuffer;
 1016|  11.3k|    const BYTE* const srcEnd = srcSize ? (assert(srcPtr!=NULL), srcPtr + srcSize) : srcPtr;
  ------------------
  |  Branch (1016:32): [True: 11.3k, False: 35]
  |  Branch (1016:43): [True: 0, False: 11.3k]
  |  Branch (1016:43): [True: 11.3k, False: 0]
  ------------------
 1017|  11.3k|    BYTE* const dstStart = (BYTE*)dstBuffer;
 1018|  11.3k|    BYTE* dstPtr = dstStart;
 1019|  11.3k|    LZ4F_lastBlockStatus lastBlockCompressed = notDone;
 1020|  11.3k|    compressFunc_t const compress = LZ4F_selectCompression(cctxPtr->prefs.frameInfo.blockMode, cctxPtr->prefs.compressionLevel, blockCompression);
 1021|  11.3k|    size_t bytesWritten;
 1022|  11.3k|    DEBUGLOG(4, "LZ4F_compressUpdate (srcSize=%zu)", srcSize);
  ------------------
  |  |  163|  11.3k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1023|       |
 1024|  11.3k|    RETURN_ERROR_IF(cctxPtr->cStage != 1, compressionState_uninitialized);   /* state must be initialized and waiting for next block */
  ------------------
  |  |  322|  11.3k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  11.3k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 11.3k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  11.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
 1025|  11.3k|    if (dstCapacity < LZ4F_compressBound_internal(srcSize, &(cctxPtr->prefs), cctxPtr->tmpInSize))
  ------------------
  |  Branch (1025:9): [True: 0, False: 11.3k]
  ------------------
 1026|      0|        RETURN_ERROR(dstMaxSize_tooSmall);
  ------------------
  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
 1027|       |
 1028|  11.3k|    if (blockCompression == LZ4B_UNCOMPRESSED && dstCapacity < srcSize)
  ------------------
  |  Branch (1028:9): [True: 0, False: 11.3k]
  |  Branch (1028:50): [True: 0, False: 0]
  ------------------
 1029|      0|        RETURN_ERROR(dstMaxSize_tooSmall);
  ------------------
  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
 1030|       |
 1031|       |    /* flush currently written block, to continue with new block compression */
 1032|  11.3k|    if (cctxPtr->blockCompressMode != blockCompression) {
  ------------------
  |  Branch (1032:9): [True: 0, False: 11.3k]
  ------------------
 1033|      0|        bytesWritten = LZ4F_flush(cctxPtr, dstBuffer, dstCapacity, compressOptionsPtr);
 1034|      0|        dstPtr += bytesWritten;
 1035|      0|        cctxPtr->blockCompressMode = blockCompression;
 1036|      0|    }
 1037|       |
 1038|  11.3k|    if (compressOptionsPtr == NULL) compressOptionsPtr = &k_cOptionsNull;
  ------------------
  |  Branch (1038:9): [True: 0, False: 11.3k]
  ------------------
 1039|       |
 1040|       |    /* complete tmp buffer */
 1041|  11.3k|    if (cctxPtr->tmpInSize > 0) {   /* some data already within tmp buffer */
  ------------------
  |  Branch (1041:9): [True: 0, False: 11.3k]
  ------------------
 1042|      0|        size_t const sizeToCopy = blockSize - cctxPtr->tmpInSize;
 1043|      0|        assert(blockSize > cctxPtr->tmpInSize);
  ------------------
  |  Branch (1043:9): [True: 0, False: 0]
  |  Branch (1043:9): [True: 0, False: 0]
  ------------------
 1044|      0|        if (sizeToCopy > srcSize) {
  ------------------
  |  Branch (1044:13): [True: 0, False: 0]
  ------------------
 1045|       |            /* add src to tmpIn buffer */
 1046|      0|            memcpy(cctxPtr->tmpIn + cctxPtr->tmpInSize, srcBuffer, srcSize);
 1047|      0|            srcPtr = srcEnd;
 1048|      0|            cctxPtr->tmpInSize += srcSize;
 1049|       |            /* still needs some CRC */
 1050|      0|        } else {
 1051|       |            /* complete tmpIn block and then compress it */
 1052|      0|            lastBlockCompressed = fromTmpBuffer;
 1053|      0|            memcpy(cctxPtr->tmpIn + cctxPtr->tmpInSize, srcBuffer, sizeToCopy);
 1054|      0|            srcPtr += sizeToCopy;
 1055|       |
 1056|      0|            dstPtr += LZ4F_makeBlock(dstPtr,
 1057|      0|                                     cctxPtr->tmpIn, blockSize,
 1058|      0|                                     compress, cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel,
 1059|      0|                                     cctxPtr->cdict,
 1060|      0|                                     cctxPtr->prefs.frameInfo.blockChecksumFlag);
 1061|      0|            if (cctxPtr->prefs.frameInfo.blockMode==LZ4F_blockLinked) cctxPtr->tmpIn += blockSize;
  ------------------
  |  Branch (1061:17): [True: 0, False: 0]
  ------------------
 1062|      0|            cctxPtr->tmpInSize = 0;
 1063|      0|    }   }
 1064|       |
 1065|  20.2k|    while ((size_t)(srcEnd - srcPtr) >= blockSize) {
  ------------------
  |  Branch (1065:12): [True: 8.86k, False: 11.3k]
  ------------------
 1066|       |        /* compress full blocks */
 1067|  8.86k|        lastBlockCompressed = fromSrcBuffer;
 1068|  8.86k|        dstPtr += LZ4F_makeBlock(dstPtr,
 1069|  8.86k|                                 srcPtr, blockSize,
 1070|  8.86k|                                 compress, cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel,
 1071|  8.86k|                                 cctxPtr->cdict,
 1072|  8.86k|                                 cctxPtr->prefs.frameInfo.blockChecksumFlag);
 1073|  8.86k|        srcPtr += blockSize;
 1074|  8.86k|    }
 1075|       |
 1076|  11.3k|    if ((cctxPtr->prefs.autoFlush) && (srcPtr < srcEnd)) {
  ------------------
  |  Branch (1076:9): [True: 11.3k, False: 0]
  |  Branch (1076:39): [True: 11.2k, False: 130]
  ------------------
 1077|       |        /* autoFlush : remaining input (< blockSize) is compressed */
 1078|  11.2k|        lastBlockCompressed = fromSrcBuffer;
 1079|  11.2k|        dstPtr += LZ4F_makeBlock(dstPtr,
 1080|  11.2k|                                 srcPtr, (size_t)(srcEnd - srcPtr),
 1081|  11.2k|                                 compress, cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel,
 1082|  11.2k|                                 cctxPtr->cdict,
 1083|  11.2k|                                 cctxPtr->prefs.frameInfo.blockChecksumFlag);
 1084|  11.2k|        srcPtr = srcEnd;
 1085|  11.2k|    }
 1086|       |
 1087|       |    /* preserve dictionary within @tmpBuff whenever necessary */
 1088|  11.3k|    if ((cctxPtr->prefs.frameInfo.blockMode==LZ4F_blockLinked) && (lastBlockCompressed==fromSrcBuffer)) {
  ------------------
  |  Branch (1088:9): [True: 1.59k, False: 9.80k]
  |  Branch (1088:67): [True: 1.59k, False: 0]
  ------------------
 1089|       |        /* linked blocks are only supported in compressed mode, see LZ4F_uncompressedUpdate */
 1090|  1.59k|        assert(blockCompression == LZ4B_COMPRESSED);
  ------------------
  |  Branch (1090:9): [True: 0, False: 1.59k]
  |  Branch (1090:9): [True: 1.59k, False: 0]
  ------------------
 1091|  1.59k|        if (compressOptionsPtr->stableSrc) {
  ------------------
  |  Branch (1091:13): [True: 1.59k, False: 0]
  ------------------
 1092|  1.59k|            cctxPtr->tmpIn = cctxPtr->tmpBuff;  /* src is stable : dictionary remains in src across invocations */
 1093|  1.59k|        } else {
 1094|      0|            LZ4F_localSaveDict(cctxPtr);
 1095|      0|        }
 1096|  1.59k|    }
 1097|       |
 1098|       |    /* keep tmpIn within limits */
 1099|  11.3k|    if (!(cctxPtr->prefs.autoFlush)  /* no autoflush : there may be some data left within internal buffer */
  ------------------
  |  Branch (1099:9): [True: 0, False: 11.3k]
  ------------------
 1100|      0|      && (cctxPtr->tmpIn + blockSize) > (cctxPtr->tmpBuff + cctxPtr->maxBufferSize) )  /* not enough room to store next block */
  ------------------
  |  Branch (1100:10): [True: 0, False: 0]
  ------------------
 1101|      0|    {
 1102|       |        /* only preserve 64KB within internal buffer. Ensures there is enough room for next block.
 1103|       |         * note: this situation necessarily implies lastBlockCompressed==fromTmpBuffer */
 1104|      0|        LZ4F_localSaveDict(cctxPtr);
 1105|      0|        assert((cctxPtr->tmpIn + blockSize) <= (cctxPtr->tmpBuff + cctxPtr->maxBufferSize));
  ------------------
  |  Branch (1105:9): [True: 0, False: 0]
  |  Branch (1105:9): [True: 0, False: 0]
  ------------------
 1106|      0|    }
 1107|       |
 1108|       |    /* some input data left, necessarily < blockSize */
 1109|  11.3k|    if (srcPtr < srcEnd) {
  ------------------
  |  Branch (1109:9): [True: 0, False: 11.3k]
  ------------------
 1110|       |        /* fill tmp buffer */
 1111|      0|        size_t const sizeToCopy = (size_t)(srcEnd - srcPtr);
 1112|      0|        memcpy(cctxPtr->tmpIn, srcPtr, sizeToCopy);
 1113|      0|        cctxPtr->tmpInSize = sizeToCopy;
 1114|      0|    }
 1115|       |
 1116|  11.3k|    if (cctxPtr->prefs.frameInfo.contentChecksumFlag == LZ4F_contentChecksumEnabled)
  ------------------
  |  Branch (1116:9): [True: 5.64k, False: 5.74k]
  ------------------
 1117|  5.64k|        (void)XXH32_update(&(cctxPtr->xxh), srcBuffer, srcSize);
  ------------------
  |  |  132|  5.64k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  5.64k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  5.64k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1118|       |
 1119|  11.3k|    cctxPtr->totalInSize += srcSize;
 1120|  11.3k|    return (size_t)(dstPtr - dstStart);
 1121|  11.3k|}
lz4frame.c:LZ4F_selectCompression:
  971|  11.3k|{
  972|  11.3k|    if (compressMode == LZ4B_UNCOMPRESSED)
  ------------------
  |  Branch (972:9): [True: 0, False: 11.3k]
  ------------------
  973|      0|        return LZ4F_doNotCompressBlock;
  974|  11.3k|    if (level < LZ4HC_CLEVEL_MIN) {
  ------------------
  |  |   47|  11.3k|#define LZ4HC_CLEVEL_MIN         2
  ------------------
  |  Branch (974:9): [True: 2.01k, False: 9.37k]
  ------------------
  975|  2.01k|        if (blockMode == LZ4F_blockIndependent) return LZ4F_compressBlock;
  ------------------
  |  Branch (975:13): [True: 1.29k, False: 729]
  ------------------
  976|    729|        return LZ4F_compressBlock_continue;
  977|  2.01k|    }
  978|  9.37k|    if (blockMode == LZ4F_blockIndependent) return LZ4F_compressBlockHC;
  ------------------
  |  Branch (978:9): [True: 8.51k, False: 862]
  ------------------
  979|    862|    return LZ4F_compressBlockHC_continue;
  980|  9.37k|}
lz4frame.c:LZ4F_compressBlock:
  930|  2.35k|{
  931|  2.35k|    int const acceleration = (level < 0) ? -level + 1 : 1;
  ------------------
  |  Branch (931:30): [True: 1.83k, False: 524]
  ------------------
  932|  2.35k|    DEBUGLOG(5, "LZ4F_compressBlock (srcSize=%i)", srcSize);
  ------------------
  |  |  163|  2.35k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
  933|  2.35k|    LZ4F_initStream(ctx, cdict, level, LZ4F_blockIndependent);
  934|  2.35k|    if (cdict) {
  ------------------
  |  Branch (934:9): [True: 0, False: 2.35k]
  ------------------
  935|      0|        return LZ4_compress_fast_continue((LZ4_stream_t*)ctx, src, dst, srcSize, dstCapacity, acceleration);
  936|  2.35k|    } else {
  937|  2.35k|        return LZ4_compress_fast_extState_fastReset(ctx, src, dst, srcSize, dstCapacity, acceleration);
  938|  2.35k|    }
  939|  2.35k|}
lz4frame.c:LZ4F_compressBlock_continue:
  942|  3.23k|{
  943|  3.23k|    int const acceleration = (level < 0) ? -level + 1 : 1;
  ------------------
  |  Branch (943:30): [True: 2.61k, False: 620]
  ------------------
  944|  3.23k|    (void)cdict; /* init once at beginning of frame */
  945|  3.23k|    DEBUGLOG(5, "LZ4F_compressBlock_continue (srcSize=%i)", srcSize);
  ------------------
  |  |  163|  3.23k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
  946|  3.23k|    return LZ4_compress_fast_continue((LZ4_stream_t*)ctx, src, dst, srcSize, dstCapacity, acceleration);
  947|  3.23k|}
lz4frame.c:LZ4F_compressBlockHC:
  950|  10.7k|{
  951|  10.7k|    LZ4F_initStream(ctx, cdict, level, LZ4F_blockIndependent);
  952|  10.7k|    if (cdict) {
  ------------------
  |  Branch (952:9): [True: 0, False: 10.7k]
  ------------------
  953|      0|        return LZ4_compress_HC_continue((LZ4_streamHC_t*)ctx, src, dst, srcSize, dstCapacity);
  954|      0|    }
  955|  10.7k|    return LZ4_compress_HC_extStateHC_fastReset(ctx, src, dst, srcSize, dstCapacity, level);
  956|  10.7k|}
lz4frame.c:LZ4F_compressBlockHC_continue:
  959|  3.78k|{
  960|  3.78k|    (void)level; (void)cdict; /* init once at beginning of frame */
  961|  3.78k|    return LZ4_compress_HC_continue((LZ4_streamHC_t*)ctx, src, dst, srcSize, dstCapacity);
  962|  3.78k|}
lz4frame.c:LZ4F_makeBlock:
  905|  20.1k|{
  906|  20.1k|    BYTE* const cSizePtr = (BYTE*)dst;
  907|  20.1k|    int dstCapacity = (srcSize > 1) ? (int)srcSize - 1 : 1;
  ------------------
  |  Branch (907:23): [True: 20.0k, False: 96]
  ------------------
  908|  20.1k|    U32 cSize;
  909|  20.1k|    assert(compress != NULL);
  ------------------
  |  Branch (909:5): [True: 0, False: 20.1k]
  |  Branch (909:5): [True: 20.1k, False: 0]
  ------------------
  910|  20.1k|    cSize = (U32)compress(lz4ctx, (const char*)src, (char*)(cSizePtr+BHSize),
  911|  20.1k|                          (int)srcSize, dstCapacity,
  912|  20.1k|                          level, cdict);
  913|       |
  914|  20.1k|    if (cSize == 0 || cSize >= srcSize) {
  ------------------
  |  Branch (914:9): [True: 2.41k, False: 17.7k]
  |  Branch (914:23): [True: 0, False: 17.7k]
  ------------------
  915|  2.41k|        cSize = (U32)srcSize;
  916|  2.41k|        LZ4F_writeLE32(cSizePtr, cSize | LZ4F_BLOCKUNCOMPRESSED_FLAG);
  ------------------
  |  |  251|  2.41k|#define LZ4F_BLOCKUNCOMPRESSED_FLAG 0x80000000U
  ------------------
  917|  2.41k|        memcpy(cSizePtr+BHSize, src, srcSize);
  918|  17.7k|    } else {
  919|  17.7k|        LZ4F_writeLE32(cSizePtr, cSize);
  920|  17.7k|    }
  921|  20.1k|    if (crcFlag) {
  ------------------
  |  Branch (921:9): [True: 10.4k, False: 9.69k]
  ------------------
  922|  10.4k|        U32 const crc32 = XXH32(cSizePtr+BHSize, cSize, 0);  /* checksum of compressed data */
  ------------------
  |  |  128|  10.4k|#  define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
  |  |  ------------------
  |  |  |  |  126|  10.4k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  10.4k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  923|  10.4k|        LZ4F_writeLE32(cSizePtr+BHSize+cSize, crc32);
  924|  10.4k|    }
  925|  20.1k|    return BHSize + cSize + ((U32)crcFlag)*BFSize;
  926|  20.1k|}
lz4frame.c:LZ4F_writeLE32:
  200|  58.9k|{
  201|  58.9k|    BYTE* const dstPtr = (BYTE*)dst;
  202|  58.9k|    dstPtr[0] = (BYTE)value32;
  203|  58.9k|    dstPtr[1] = (BYTE)(value32 >> 8);
  204|  58.9k|    dstPtr[2] = (BYTE)(value32 >> 16);
  205|  58.9k|    dstPtr[3] = (BYTE)(value32 >> 24);
  206|  58.9k|}
lz4frame.c:LZ4F_readLE32:
  190|  58.9k|{
  191|  58.9k|    const BYTE* const srcPtr = (const BYTE*)src;
  192|  58.9k|    U32 value32 = srcPtr[0];
  193|  58.9k|    value32 |= ((U32)srcPtr[1])<< 8;
  194|  58.9k|    value32 |= ((U32)srcPtr[2])<<16;
  195|  58.9k|    value32 |= ((U32)srcPtr[3])<<24;
  196|  58.9k|    return value32;
  197|  58.9k|}
lz4frame.c:LZ4F_decodeHeader:
 1374|  11.3k|{
 1375|  11.3k|    unsigned blockMode, blockChecksumFlag, contentSizeFlag, contentChecksumFlag, dictIDFlag, blockSizeID;
 1376|  11.3k|    size_t frameHeaderSize;
 1377|  11.3k|    const BYTE* srcPtr = (const BYTE*)src;
 1378|       |
 1379|  11.3k|    DEBUGLOG(5, "LZ4F_decodeHeader");
  ------------------
  |  |  163|  11.3k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1380|       |    /* need to decode header to get frameInfo */
 1381|  11.3k|    RETURN_ERROR_IF(srcSize < minFHSize, frameHeader_incomplete);   /* minimal frame header size */
  ------------------
  |  |  322|  11.3k|#define RETURN_ERROR_IF(c,e) do {  \
  |  |  323|  11.3k|        if (c) {                   \
  |  |  ------------------
  |  |  |  Branch (323:13): [True: 0, False: 11.3k]
  |  |  ------------------
  |  |  324|      0|            DEBUGLOG(3, "Error: " #c); \
  |  |  ------------------
  |  |  |  |  163|      0|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  |  |  ------------------
  |  |  325|      0|            RETURN_ERROR(e);       \
  |  |  ------------------
  |  |  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  326|      0|        }                          \
  |  |  327|  11.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (327:14): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
 1382|  11.3k|    MEM_INIT(&(dctx->frameInfo), 0, sizeof(dctx->frameInfo));
  ------------------
  |  |   91|  11.3k|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
 1383|       |
 1384|       |    /* special case : skippable frames */
 1385|  11.3k|    if ((LZ4F_readLE32(srcPtr) & 0xFFFFFFF0U) == LZ4F_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  407|  11.3k|#define LZ4F_MAGIC_SKIPPABLE_START 0x184D2A50U
  ------------------
  |  Branch (1385:9): [True: 0, False: 11.3k]
  ------------------
 1386|      0|        dctx->frameInfo.frameType = LZ4F_skippableFrame;
 1387|      0|        if (src == (void*)(dctx->header)) {
  ------------------
  |  Branch (1387:13): [True: 0, False: 0]
  ------------------
 1388|      0|            dctx->tmpInSize = srcSize;
 1389|      0|            dctx->tmpInTarget = 8;
 1390|      0|            dctx->dStage = dstage_storeSFrameSize;
 1391|      0|            return srcSize;
 1392|      0|        } else {
 1393|      0|            dctx->dStage = dstage_getSFrameSize;
 1394|      0|            return 4;
 1395|      0|    }   }
 1396|       |
 1397|       |    /* control magic number */
 1398|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 1399|       |    if (LZ4F_readLE32(srcPtr) != LZ4F_MAGICNUMBER) {
 1400|       |        DEBUGLOG(4, "frame header error : unknown magic number");
 1401|       |        RETURN_ERROR(frameType_unknown);
 1402|       |    }
 1403|       |#endif
 1404|  11.3k|    dctx->frameInfo.frameType = LZ4F_frame;
 1405|       |
 1406|       |    /* Flags */
 1407|  11.3k|    {   U32 const FLG = srcPtr[4];
 1408|  11.3k|        U32 const version = (FLG>>6) & _2BITS;
  ------------------
  |  |  246|  11.3k|#define _2BITS 0x03
  ------------------
 1409|  11.3k|        blockChecksumFlag = (FLG>>4) & _1BIT;
  ------------------
  |  |  245|  11.3k|#define _1BIT  0x01
  ------------------
 1410|  11.3k|        blockMode = (FLG>>5) & _1BIT;
  ------------------
  |  |  245|  11.3k|#define _1BIT  0x01
  ------------------
 1411|  11.3k|        contentSizeFlag = (FLG>>3) & _1BIT;
  ------------------
  |  |  245|  11.3k|#define _1BIT  0x01
  ------------------
 1412|  11.3k|        contentChecksumFlag = (FLG>>2) & _1BIT;
  ------------------
  |  |  245|  11.3k|#define _1BIT  0x01
  ------------------
 1413|  11.3k|        dictIDFlag = FLG & _1BIT;
  ------------------
  |  |  245|  11.3k|#define _1BIT  0x01
  ------------------
 1414|       |        /* validate */
 1415|  11.3k|        if (((FLG>>1)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set); /* Reserved bit */
  ------------------
  |  |  245|  11.3k|#define _1BIT  0x01
  ------------------
                      if (((FLG>>1)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set); /* Reserved bit */
  ------------------
  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (1415:13): [True: 0, False: 11.3k]
  ------------------
 1416|  11.3k|        if (version != 1) RETURN_ERROR(headerVersion_wrong);       /* Version Number, only supported value */
  ------------------
  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (1416:13): [True: 0, False: 11.3k]
  ------------------
 1417|  11.3k|    }
 1418|  11.3k|    DEBUGLOG(6, "contentSizeFlag: %u", contentSizeFlag);
  ------------------
  |  |  163|  11.3k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1419|       |
 1420|       |    /* Frame Header Size */
 1421|  11.3k|    frameHeaderSize = minFHSize + (contentSizeFlag?8:0) + (dictIDFlag?4:0);
  ------------------
  |  Branch (1421:36): [True: 0, False: 11.3k]
  |  Branch (1421:60): [True: 0, False: 11.3k]
  ------------------
 1422|       |
 1423|  11.3k|    if (srcSize < frameHeaderSize) {
  ------------------
  |  Branch (1423:9): [True: 0, False: 11.3k]
  ------------------
 1424|       |        /* not enough input to fully decode frame header */
 1425|      0|        if (srcPtr != dctx->header)
  ------------------
  |  Branch (1425:13): [True: 0, False: 0]
  ------------------
 1426|      0|            memcpy(dctx->header, srcPtr, srcSize);
 1427|      0|        dctx->tmpInSize = srcSize;
 1428|      0|        dctx->tmpInTarget = frameHeaderSize;
 1429|      0|        dctx->dStage = dstage_storeFrameHeader;
 1430|      0|        return srcSize;
 1431|      0|    }
 1432|       |
 1433|  11.3k|    {   U32 const BD = srcPtr[5];
 1434|  11.3k|        blockSizeID = (BD>>4) & _3BITS;
  ------------------
  |  |  247|  11.3k|#define _3BITS 0x07
  ------------------
 1435|       |        /* validate */
 1436|  11.3k|        if (((BD>>7)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set);   /* Reserved bit */
  ------------------
  |  |  245|  11.3k|#define _1BIT  0x01
  ------------------
                      if (((BD>>7)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set);   /* Reserved bit */
  ------------------
  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (1436:13): [True: 0, False: 11.3k]
  ------------------
 1437|  11.3k|        if (blockSizeID < 4) RETURN_ERROR(maxBlockSize_invalid);    /* 4-7 only supported values for the time being */
  ------------------
  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (1437:13): [True: 0, False: 11.3k]
  ------------------
 1438|  11.3k|        if (((BD>>0)&_4BITS) != 0) RETURN_ERROR(reservedFlag_set);  /* Reserved bits */
  ------------------
  |  |  248|  11.3k|#define _4BITS 0x0F
  ------------------
                      if (((BD>>0)&_4BITS) != 0) RETURN_ERROR(reservedFlag_set);  /* Reserved bits */
  ------------------
  |  |  320|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (1438:13): [True: 0, False: 11.3k]
  ------------------
 1439|  11.3k|    }
 1440|       |
 1441|       |    /* check header */
 1442|  11.3k|    assert(frameHeaderSize > 5);
  ------------------
  |  Branch (1442:5): [True: 0, False: 11.3k]
  |  Branch (1442:5): [True: 11.3k, False: 0]
  ------------------
 1443|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 1444|       |    {   BYTE const HC = LZ4F_headerChecksum(srcPtr+4, frameHeaderSize-5);
 1445|       |        RETURN_ERROR_IF(HC != srcPtr[frameHeaderSize-1], headerChecksum_invalid);
 1446|       |    }
 1447|       |#endif
 1448|       |
 1449|       |    /* save */
 1450|  11.3k|    dctx->frameInfo.blockMode = (LZ4F_blockMode_t)blockMode;
 1451|  11.3k|    dctx->frameInfo.blockChecksumFlag = (LZ4F_blockChecksum_t)blockChecksumFlag;
 1452|  11.3k|    dctx->frameInfo.contentChecksumFlag = (LZ4F_contentChecksum_t)contentChecksumFlag;
 1453|  11.3k|    dctx->frameInfo.blockSizeID = (LZ4F_blockSizeID_t)blockSizeID;
 1454|  11.3k|    dctx->maxBlockSize = LZ4F_getBlockSize((LZ4F_blockSizeID_t)blockSizeID);
 1455|  11.3k|    if (contentSizeFlag) {
  ------------------
  |  Branch (1455:9): [True: 0, False: 11.3k]
  ------------------
 1456|      0|        dctx->frameRemainingSize = dctx->frameInfo.contentSize = LZ4F_readLE64(srcPtr+6);
 1457|      0|    }
 1458|  11.3k|    if (dictIDFlag)
  ------------------
  |  Branch (1458:9): [True: 0, False: 11.3k]
  ------------------
 1459|      0|        dctx->frameInfo.dictID = LZ4F_readLE32(srcPtr + frameHeaderSize - 5);
 1460|       |
 1461|  11.3k|    dctx->dStage = dstage_init;
 1462|       |
 1463|  11.3k|    return frameHeaderSize;
 1464|  11.3k|}
lz4frame.c:LZ4F_updateDict:
 1561|  7.02k|{
 1562|  7.02k|    assert(dstPtr != NULL);
  ------------------
  |  Branch (1562:5): [True: 0, False: 7.02k]
  |  Branch (1562:5): [True: 7.02k, False: 0]
  ------------------
 1563|  7.02k|    if (dctx->dictSize==0) dctx->dict = (const BYTE*)dstPtr;  /* will lead to prefix mode */
  ------------------
  |  Branch (1563:9): [True: 1.59k, False: 5.43k]
  ------------------
 1564|  7.02k|    assert(dctx->dict != NULL);
  ------------------
  |  Branch (1564:5): [True: 0, False: 7.02k]
  |  Branch (1564:5): [True: 7.02k, False: 0]
  ------------------
 1565|       |
 1566|  7.02k|    if (dctx->dict + dctx->dictSize == dstPtr) {  /* prefix mode, everything within dstBuffer */
  ------------------
  |  Branch (1566:9): [True: 7.02k, False: 0]
  ------------------
 1567|  7.02k|        dctx->dictSize += dstSize;
 1568|  7.02k|        return;
 1569|  7.02k|    }
 1570|       |
 1571|  7.02k|    assert(dstPtr >= dstBufferStart);
  ------------------
  |  Branch (1571:5): [True: 0, False: 0]
  |  Branch (1571:5): [True: 0, False: 0]
  ------------------
 1572|      0|    if ((size_t)(dstPtr - dstBufferStart) + dstSize >= 64 KB) {  /* history in dstBuffer becomes large enough to become dictionary */
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
  |  Branch (1572:9): [True: 0, False: 0]
  ------------------
 1573|      0|        dctx->dict = (const BYTE*)dstBufferStart;
 1574|      0|        dctx->dictSize = (size_t)(dstPtr - dstBufferStart) + dstSize;
 1575|      0|        return;
 1576|      0|    }
 1577|       |
 1578|      0|    assert(dstSize < 64 KB);   /* if dstSize >= 64 KB, dictionary would be set into dstBuffer directly */
  ------------------
  |  Branch (1578:5): [True: 0, False: 0]
  |  Branch (1578:5): [True: 0, False: 0]
  ------------------
 1579|       |
 1580|       |    /* dstBuffer does not contain whole useful history (64 KB), so it must be saved within tmpOutBuffer */
 1581|      0|    assert(dctx->tmpOutBuffer != NULL);
  ------------------
  |  Branch (1581:5): [True: 0, False: 0]
  |  Branch (1581:5): [True: 0, False: 0]
  ------------------
 1582|       |
 1583|      0|    if (withinTmp && (dctx->dict == dctx->tmpOutBuffer)) {   /* continue history within tmpOutBuffer */
  ------------------
  |  Branch (1583:9): [True: 0, False: 0]
  |  Branch (1583:22): [True: 0, False: 0]
  ------------------
 1584|       |        /* withinTmp expectation : content of [dstPtr,dstSize] is same as [dict+dictSize,dstSize], so we just extend it */
 1585|      0|        assert(dctx->dict + dctx->dictSize == dctx->tmpOut + dctx->tmpOutStart);
  ------------------
  |  Branch (1585:9): [True: 0, False: 0]
  |  Branch (1585:9): [True: 0, False: 0]
  ------------------
 1586|      0|        dctx->dictSize += dstSize;
 1587|      0|        return;
 1588|      0|    }
 1589|       |
 1590|      0|    if (withinTmp) { /* copy relevant dict portion in front of tmpOut within tmpOutBuffer */
  ------------------
  |  Branch (1590:9): [True: 0, False: 0]
  ------------------
 1591|      0|        size_t const preserveSize = (size_t)(dctx->tmpOut - dctx->tmpOutBuffer);
 1592|      0|        size_t copySize = 64 KB - dctx->tmpOutSize;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 1593|      0|        const BYTE* const oldDictEnd = dctx->dict + dctx->dictSize - dctx->tmpOutStart;
 1594|      0|        if (dctx->tmpOutSize > 64 KB) copySize = 0;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
  |  Branch (1594:13): [True: 0, False: 0]
  ------------------
 1595|      0|        if (copySize > preserveSize) copySize = preserveSize;
  ------------------
  |  Branch (1595:13): [True: 0, False: 0]
  ------------------
 1596|       |
 1597|      0|        memcpy(dctx->tmpOutBuffer + preserveSize - copySize, oldDictEnd - copySize, copySize);
 1598|       |
 1599|      0|        dctx->dict = dctx->tmpOutBuffer;
 1600|      0|        dctx->dictSize = preserveSize + dctx->tmpOutStart + dstSize;
 1601|      0|        return;
 1602|      0|    }
 1603|       |
 1604|      0|    if (dctx->dict == dctx->tmpOutBuffer) {    /* copy dst into tmp to complete dict */
  ------------------
  |  Branch (1604:9): [True: 0, False: 0]
  ------------------
 1605|      0|        if (dctx->dictSize + dstSize > dctx->maxBufferSize) {  /* tmp buffer not large enough */
  ------------------
  |  Branch (1605:13): [True: 0, False: 0]
  ------------------
 1606|      0|            size_t const preserveSize = 64 KB - dstSize;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 1607|      0|            memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - preserveSize, preserveSize);
 1608|      0|            dctx->dictSize = preserveSize;
 1609|      0|        }
 1610|      0|        memcpy(dctx->tmpOutBuffer + dctx->dictSize, dstPtr, dstSize);
 1611|      0|        dctx->dictSize += dstSize;
 1612|      0|        return;
 1613|      0|    }
 1614|       |
 1615|       |    /* join dict & dest into tmp */
 1616|      0|    {   size_t preserveSize = 64 KB - dstSize;
  ------------------
  |  |  240|      0|#  define KB *(1<<10)
  ------------------
 1617|      0|        if (preserveSize > dctx->dictSize) preserveSize = dctx->dictSize;
  ------------------
  |  Branch (1617:13): [True: 0, False: 0]
  ------------------
 1618|      0|        memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - preserveSize, preserveSize);
 1619|      0|        memcpy(dctx->tmpOutBuffer + preserveSize, dstPtr, dstSize);
 1620|      0|        dctx->dict = dctx->tmpOutBuffer;
 1621|      0|        dctx->dictSize = preserveSize + dstSize;
 1622|      0|    }
 1623|      0|}

LZ4_sizeofStateHC:
 1535|  9.37k|int LZ4_sizeofStateHC(void) { return (int)sizeof(LZ4_streamHC_t); }
LZ4_compress_HC_extStateHC_fastReset:
 1550|  10.7k|{
 1551|  10.7k|    LZ4HC_CCtx_internal* const ctx = &((LZ4_streamHC_t*)state)->internal_donotuse;
 1552|  10.7k|    if (!LZ4_isAligned(state, LZ4_streamHC_t_alignment())) return 0;
  ------------------
  |  Branch (1552:9): [True: 0, False: 10.7k]
  ------------------
 1553|  10.7k|    LZ4_resetStreamHC_fast((LZ4_streamHC_t*)state, compressionLevel);
 1554|  10.7k|    LZ4HC_init_internal (ctx, (const BYTE*)src);
 1555|  10.7k|    if (dstCapacity < LZ4_compressBound(srcSize))
  ------------------
  |  Branch (1555:9): [True: 10.7k, False: 0]
  ------------------
 1556|  10.7k|        return LZ4HC_compress_generic (ctx, src, dst, &srcSize, dstCapacity, compressionLevel, limitedOutput);
 1557|      0|    else
 1558|      0|        return LZ4HC_compress_generic (ctx, src, dst, &srcSize, dstCapacity, compressionLevel, notLimited);
 1559|  10.7k|}
LZ4_initStreamHC:
 1623|  9.67k|{
 1624|  9.67k|    LZ4_streamHC_t* const LZ4_streamHCPtr = (LZ4_streamHC_t*)buffer;
 1625|  9.67k|    DEBUGLOG(4, "LZ4_initStreamHC(%p, %u)", buffer, (unsigned)size);
  ------------------
  |  |  290|  9.67k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1626|       |    /* check conditions */
 1627|  9.67k|    if (buffer == NULL) return NULL;
  ------------------
  |  Branch (1627:9): [True: 0, False: 9.67k]
  ------------------
 1628|  9.67k|    if (size < sizeof(LZ4_streamHC_t)) return NULL;
  ------------------
  |  Branch (1628:9): [True: 0, False: 9.67k]
  ------------------
 1629|  9.67k|    if (!LZ4_isAligned(buffer, LZ4_streamHC_t_alignment())) return NULL;
  ------------------
  |  Branch (1629:9): [True: 0, False: 9.67k]
  ------------------
 1630|       |    /* init */
 1631|  9.67k|    { LZ4HC_CCtx_internal* const hcstate = &(LZ4_streamHCPtr->internal_donotuse);
 1632|  9.67k|      MEM_INIT(hcstate, 0, sizeof(*hcstate)); }
  ------------------
  |  |  237|  9.67k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  235|  9.67k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 1633|  9.67k|    LZ4_setCompressionLevel(LZ4_streamHCPtr, LZ4HC_CLEVEL_DEFAULT);
  ------------------
  |  |   48|  9.67k|#define LZ4HC_CLEVEL_DEFAULT     9
  ------------------
 1634|  9.67k|    return LZ4_streamHCPtr;
 1635|  9.67k|}
LZ4_resetStreamHC_fast:
 1645|  22.3k|{
 1646|  22.3k|    LZ4HC_CCtx_internal* const s = &LZ4_streamHCPtr->internal_donotuse;
 1647|  22.3k|    DEBUGLOG(5, "LZ4_resetStreamHC_fast(%p, %d)", LZ4_streamHCPtr, compressionLevel);
  ------------------
  |  |  290|  22.3k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1648|  22.3k|    if (s->dirty) {
  ------------------
  |  Branch (1648:9): [True: 304, False: 22.0k]
  ------------------
 1649|    304|        LZ4_initStreamHC(LZ4_streamHCPtr, sizeof(*LZ4_streamHCPtr));
 1650|  22.0k|    } else {
 1651|  22.0k|        assert(s->end >= s->prefixStart);
  ------------------
  |  Branch (1651:9): [True: 0, False: 22.0k]
  |  Branch (1651:9): [True: 22.0k, False: 0]
  ------------------
 1652|  22.0k|        s->dictLimit += (U32)(s->end - s->prefixStart);
 1653|  22.0k|        s->prefixStart = NULL;
 1654|  22.0k|        s->end = NULL;
 1655|  22.0k|        s->dictCtx = NULL;
 1656|  22.0k|    }
 1657|  22.3k|    LZ4_setCompressionLevel(LZ4_streamHCPtr, compressionLevel);
 1658|  22.3k|}
LZ4_setCompressionLevel:
 1661|  32.0k|{
 1662|  32.0k|    DEBUGLOG(5, "LZ4_setCompressionLevel(%p, %d)", LZ4_streamHCPtr, compressionLevel);
  ------------------
  |  |  290|  32.0k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1663|  32.0k|    if (compressionLevel < 1) compressionLevel = LZ4HC_CLEVEL_DEFAULT;
  ------------------
  |  |   48|      0|#define LZ4HC_CLEVEL_DEFAULT     9
  ------------------
  |  Branch (1663:9): [True: 0, False: 32.0k]
  ------------------
 1664|  32.0k|    if (compressionLevel > LZ4HC_CLEVEL_MAX) compressionLevel = LZ4HC_CLEVEL_MAX;
  ------------------
  |  |   50|  32.0k|#define LZ4HC_CLEVEL_MAX        12
  ------------------
                  if (compressionLevel > LZ4HC_CLEVEL_MAX) compressionLevel = LZ4HC_CLEVEL_MAX;
  ------------------
  |  |   50|      0|#define LZ4HC_CLEVEL_MAX        12
  ------------------
  |  Branch (1664:9): [True: 0, False: 32.0k]
  ------------------
 1665|  32.0k|    LZ4_streamHCPtr->internal_donotuse.compressionLevel = (short)compressionLevel;
 1666|  32.0k|}
LZ4_favorDecompressionSpeed:
 1669|  9.37k|{
 1670|  9.37k|    LZ4_streamHCPtr->internal_donotuse.favorDecSpeed = (favor!=0);
 1671|  9.37k|}
LZ4_compress_HC_continue:
 1772|  3.78k|{
 1773|  3.78k|    DEBUGLOG(5, "LZ4_compress_HC_continue");
  ------------------
  |  |  290|  3.78k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1774|  3.78k|    if (dstCapacity < LZ4_compressBound(srcSize))
  ------------------
  |  Branch (1774:9): [True: 3.78k, False: 0]
  ------------------
 1775|  3.78k|        return LZ4_compressHC_continue_generic (LZ4_streamHCPtr, src, dst, &srcSize, dstCapacity, limitedOutput);
 1776|      0|    else
 1777|      0|        return LZ4_compressHC_continue_generic (LZ4_streamHCPtr, src, dst, &srcSize, dstCapacity, notLimited);
 1778|  3.78k|}
lz4hc.c:LZ4_streamHC_t_alignment:
 1538|  20.4k|{
 1539|  20.4k|#if LZ4_ALIGN_TEST
 1540|  20.4k|    typedef struct { char c; LZ4_streamHC_t t; } t_a;
 1541|  20.4k|    return sizeof(t_a) - sizeof(LZ4_streamHC_t);
 1542|       |#else
 1543|       |    return 1;  /* effectively disabled */
 1544|       |#endif
 1545|  20.4k|}
lz4hc.c:LZ4HC_init_internal:
  243|  11.6k|{
  244|  11.6k|    size_t const bufferSize = (size_t)(hc4->end - hc4->prefixStart);
  245|  11.6k|    size_t newStartingOffset = bufferSize + hc4->dictLimit;
  246|  11.6k|    DEBUGLOG(5, "LZ4HC_init_internal");
  ------------------
  |  |  290|  11.6k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  247|  11.6k|    assert(newStartingOffset >= bufferSize);  /* check overflow */
  ------------------
  |  Branch (247:5): [True: 0, False: 11.6k]
  |  Branch (247:5): [True: 11.6k, False: 0]
  ------------------
  248|  11.6k|    if (newStartingOffset > 1 GB) {
  ------------------
  |  |  254|  11.6k|#define GB *(1U<<30)
  ------------------
  |  Branch (248:9): [True: 0, False: 11.6k]
  ------------------
  249|      0|        LZ4HC_clearTables(hc4);
  250|      0|        newStartingOffset = 0;
  251|      0|    }
  252|  11.6k|    newStartingOffset += 64 KB;
  ------------------
  |  |  252|  11.6k|#define KB *(1 <<10)
  ------------------
  253|  11.6k|    hc4->nextToUpdate = (U32)newStartingOffset;
  254|  11.6k|    hc4->prefixStart = start;
  255|  11.6k|    hc4->end = start;
  256|  11.6k|    hc4->dictStart = start;
  257|  11.6k|    hc4->dictLimit = (U32)newStartingOffset;
  258|  11.6k|    hc4->lowLimit = (U32)newStartingOffset;
  259|  11.6k|}
lz4hc.c:LZ4HC_compress_generic:
 1526|  14.5k|{
 1527|  14.5k|    if (ctx->dictCtx == NULL) {
  ------------------
  |  Branch (1527:9): [True: 14.5k, False: 0]
  ------------------
 1528|  14.5k|        return LZ4HC_compress_generic_noDictCtx(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit);
 1529|  14.5k|    } else {
 1530|      0|        return LZ4HC_compress_generic_dictCtx(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit);
 1531|      0|    }
 1532|  14.5k|}
lz4hc.c:LZ4HC_compress_generic_noDictCtx:
 1478|  14.5k|{
 1479|  14.5k|    assert(ctx->dictCtx == NULL);
  ------------------
  |  Branch (1479:5): [True: 0, False: 14.5k]
  |  Branch (1479:5): [True: 14.5k, False: 0]
  ------------------
 1480|  14.5k|    return LZ4HC_compress_generic_internal(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit, noDictCtx);
 1481|  14.5k|}
lz4hc.c:LZ4HC_compress_generic_internal:
 1429|  14.5k|{
 1430|  14.5k|    DEBUGLOG(5, "LZ4HC_compress_generic_internal(src=%p, srcSize=%d, dstCapacity=%d)",
  ------------------
  |  |  290|  14.5k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1431|  14.5k|                src, *srcSizePtr, dstCapacity);
 1432|       |
 1433|       |    /* input sanitization */
 1434|  14.5k|    if ((U32)*srcSizePtr > (U32)LZ4_MAX_INPUT_SIZE) return 0;  /* Unsupported input size (too large or negative) */
  ------------------
  |  |  214|  14.5k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  ------------------
  |  Branch (1434:9): [True: 0, False: 14.5k]
  ------------------
 1435|  14.5k|    if (dstCapacity < 1) return 0;   /* Invalid: impossible to store anything */
  ------------------
  |  Branch (1435:9): [True: 0, False: 14.5k]
  ------------------
 1436|  14.5k|    assert(dst); /* since dstCapacity >= 1, dst must be valid */
  ------------------
  |  Branch (1436:5): [True: 0, False: 14.5k]
  |  Branch (1436:5): [True: 14.5k, False: 0]
  ------------------
 1437|  14.5k|    if (*srcSizePtr == 0) { *dst = 0; return 1; }
  ------------------
  |  Branch (1437:9): [True: 0, False: 14.5k]
  ------------------
 1438|  14.5k|    assert(src != NULL); /* since *srcSizePtr >= 1, src must be valid */
  ------------------
  |  Branch (1438:5): [True: 0, False: 14.5k]
  |  Branch (1438:5): [True: 14.5k, False: 0]
  ------------------
 1439|       |
 1440|  14.5k|    ctx->end += *srcSizePtr;
 1441|  14.5k|    {   cParams_t const cParam = LZ4HC_getCLevelParams(cLevel);
 1442|  14.5k|        HCfavor_e const favor = ctx->favorDecSpeed ? favorDecompressionSpeed : favorCompressionRatio;
  ------------------
  |  Branch (1442:33): [True: 6.72k, False: 7.81k]
  ------------------
 1443|  14.5k|        int result;
 1444|       |
 1445|  14.5k|        if (cParam.strat == lz4mid) {
  ------------------
  |  Branch (1445:13): [True: 2.47k, False: 12.0k]
  ------------------
 1446|  2.47k|            result = LZ4MID_compress(ctx,
 1447|  2.47k|                                src, dst, srcSizePtr, dstCapacity,
 1448|  2.47k|                                limit, dict);
 1449|  12.0k|        } else if (cParam.strat == lz4hc) {
  ------------------
  |  Branch (1449:20): [True: 6.01k, False: 6.04k]
  ------------------
 1450|  6.01k|            result = LZ4HC_compress_hashChain(ctx,
 1451|  6.01k|                                src, dst, srcSizePtr, dstCapacity,
 1452|  6.01k|                                cParam.nbSearches, limit, dict);
 1453|  6.04k|        } else {
 1454|  6.04k|            assert(cParam.strat == lz4opt);
  ------------------
  |  Branch (1454:13): [True: 0, False: 6.04k]
  |  Branch (1454:13): [True: 6.04k, False: 0]
  ------------------
 1455|  6.04k|            result = LZ4HC_compress_optimal(ctx,
 1456|  6.04k|                                src, dst, srcSizePtr, dstCapacity,
 1457|  6.04k|                                cParam.nbSearches, cParam.targetLength, limit,
 1458|  6.04k|                                cLevel >= LZ4HC_CLEVEL_MAX,   /* ultra mode */
  ------------------
  |  |   50|  6.04k|#define LZ4HC_CLEVEL_MAX        12
  ------------------
 1459|  6.04k|                                dict, favor);
 1460|  6.04k|        }
 1461|  14.5k|        if (result <= 0) ctx->dirty = 1;
  ------------------
  |  Branch (1461:13): [True: 1.65k, False: 12.8k]
  ------------------
 1462|  14.5k|        return result;
 1463|  14.5k|    }
 1464|  14.5k|}
lz4hc.c:LZ4MID_compress:
  563|  2.47k|{
  564|  2.47k|    U32* const hash4Table = ctx->hashTable;
  565|  2.47k|    U32* const hash8Table = hash4Table + LZ4MID_HASHTABLESIZE;
  ------------------
  |  |  143|  2.47k|#define LZ4MID_HASHTABLESIZE (1 << LZ4MID_HASHLOG)
  |  |  ------------------
  |  |  |  |  142|  2.47k|#define LZ4MID_HASHLOG (LZ4HC_HASH_LOG-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  233|  2.47k|#define LZ4HC_HASH_LOG 15
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  566|  2.47k|    const BYTE* ip = (const BYTE*)src;
  567|  2.47k|    const BYTE* anchor = ip;
  568|  2.47k|    const BYTE* const iend = ip + *srcSizePtr;
  569|  2.47k|    const BYTE* const mflimit = iend - MFLIMIT;
  ------------------
  |  |  247|  2.47k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  570|  2.47k|    const BYTE* const matchlimit = (iend - LASTLITERALS);
  ------------------
  |  |  246|  2.47k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  571|  2.47k|    const BYTE* const ilimit = (iend - LZ4MID_HASHSIZE);
  ------------------
  |  |  141|  2.47k|#define LZ4MID_HASHSIZE 8
  ------------------
  572|  2.47k|    BYTE* op = (BYTE*)dst;
  573|  2.47k|    BYTE* oend = op + maxOutputSize;
  574|       |
  575|  2.47k|    const BYTE* const prefixPtr = ctx->prefixStart;
  576|  2.47k|    const U32 prefixIdx = ctx->dictLimit;
  577|  2.47k|    const U32 ilimitIdx = (U32)(ilimit - prefixPtr) + prefixIdx;
  578|  2.47k|    const BYTE* const dictStart = ctx->dictStart;
  579|  2.47k|    const U32 dictIdx = ctx->lowLimit;
  580|  2.47k|    const U32 gDictEndIndex = ctx->lowLimit;
  581|  2.47k|    const LZ4MID_searchIntoDict_f searchIntoDict = (dict == usingDictCtxHc) ? select_searchDict_function(ctx->dictCtx) : NULL;
  ------------------
  |  Branch (581:52): [True: 0, False: 2.47k]
  ------------------
  582|  2.47k|    unsigned matchLength;
  583|  2.47k|    unsigned matchDistance;
  584|       |
  585|  2.47k|    DEBUGLOG(5, "LZ4MID_compress (%i bytes)", *srcSizePtr);
  ------------------
  |  |  290|  2.47k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  586|       |
  587|       |    /* preconditions verifications */
  588|  2.47k|    if (dict == usingDictCtxHc) DEBUGLOG(5, "usingDictCtxHc");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  |  Branch (588:9): [True: 0, False: 2.47k]
  ------------------
  589|  2.47k|    assert(*srcSizePtr > 0);
  ------------------
  |  Branch (589:5): [True: 0, False: 2.47k]
  |  Branch (589:5): [True: 2.47k, False: 0]
  ------------------
  590|  2.47k|    assert(*srcSizePtr <= LZ4_MAX_INPUT_SIZE);
  ------------------
  |  Branch (590:5): [True: 0, False: 2.47k]
  |  Branch (590:5): [True: 2.47k, False: 0]
  ------------------
  591|  2.47k|    assert(src != NULL);
  ------------------
  |  Branch (591:5): [True: 0, False: 2.47k]
  |  Branch (591:5): [True: 2.47k, False: 0]
  ------------------
  592|  2.47k|    assert(maxOutputSize >= 1);
  ------------------
  |  Branch (592:5): [True: 0, False: 2.47k]
  |  Branch (592:5): [True: 2.47k, False: 0]
  ------------------
  593|  2.47k|    assert(dst != NULL);
  ------------------
  |  Branch (593:5): [True: 0, False: 2.47k]
  |  Branch (593:5): [True: 2.47k, False: 0]
  ------------------
  594|       |
  595|  2.47k|    if (limit == fillOutput) oend -= LASTLITERALS;  /* Hack for support LZ4 format restriction */
  ------------------
  |  |  246|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (595:9): [True: 0, False: 2.47k]
  ------------------
  596|  2.47k|    if (*srcSizePtr < LZ4_minLength)
  ------------------
  |  Branch (596:9): [True: 27, False: 2.45k]
  ------------------
  597|     27|        goto _lz4mid_last_literals;  /* Input too small, no compression (all literals) */
  598|       |
  599|       |    /* main loop */
  600|  17.9M|    while (ip <= mflimit) {
  ------------------
  |  Branch (600:12): [True: 17.9M, False: 2.43k]
  ------------------
  601|  17.9M|        const U32 ipIndex = (U32)(ip - prefixPtr) + prefixIdx;
  602|       |        /* search long match */
  603|  17.9M|        {   U32 const h8 = LZ4MID_hash8Ptr(ip);
  604|  17.9M|            U32 const pos8 = hash8Table[h8];
  605|  17.9M|            assert(h8 < LZ4MID_HASHTABLESIZE);
  ------------------
  |  Branch (605:13): [True: 0, False: 17.9M]
  |  Branch (605:13): [True: 17.9M, False: 0]
  ------------------
  606|  17.9M|            assert(pos8 < ipIndex);
  ------------------
  |  Branch (606:13): [True: 0, False: 17.9M]
  |  Branch (606:13): [True: 17.9M, False: 0]
  ------------------
  607|  17.9M|            LZ4MID_addPosition(hash8Table, h8, ipIndex);
  608|  17.9M|            if (ipIndex - pos8 <= LZ4_DISTANCE_MAX) {
  ------------------
  |  |  676|  17.9M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (608:17): [True: 12.5M, False: 5.41M]
  ------------------
  609|       |                /* match candidate found */
  610|  12.5M|                if (pos8 >= prefixIdx) {
  ------------------
  |  Branch (610:21): [True: 12.5M, False: 0]
  ------------------
  611|  12.5M|                    const BYTE* const matchPtr = prefixPtr + pos8 - prefixIdx;
  612|  12.5M|                    assert(matchPtr < ip);
  ------------------
  |  Branch (612:21): [True: 0, False: 12.5M]
  |  Branch (612:21): [True: 12.5M, False: 0]
  ------------------
  613|  12.5M|                    matchLength = LZ4_count(ip, matchPtr, matchlimit);
  614|  12.5M|                    if (matchLength >= MINMATCH) {
  ------------------
  |  |  243|  12.5M|#define MINMATCH 4
  ------------------
  |  Branch (614:25): [True: 521k, False: 12.0M]
  ------------------
  615|   521k|                        DEBUGLOG(7, "found long match at pos %u (len=%u)", pos8, matchLength);
  ------------------
  |  |  290|   521k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  616|   521k|                        matchDistance = ipIndex - pos8;
  617|   521k|                        goto _lz4mid_encode_sequence;
  618|   521k|                    }
  619|  12.5M|                } else {
  620|      0|                    if (pos8 >= dictIdx) {
  ------------------
  |  Branch (620:25): [True: 0, False: 0]
  ------------------
  621|       |                        /* extDict match candidate */
  622|      0|                        const BYTE* const matchPtr = dictStart + (pos8 - dictIdx);
  623|      0|                        const size_t safeLen = MIN(prefixIdx - pos8, (size_t)(matchlimit - ip));
  ------------------
  |  |   81|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (81:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  624|      0|                        matchLength = LZ4_count(ip, matchPtr, ip + safeLen);
  625|      0|                        if (matchLength >= MINMATCH) {
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
  |  Branch (625:29): [True: 0, False: 0]
  ------------------
  626|      0|                            DEBUGLOG(7, "found long match at ExtDict pos %u (len=%u)", pos8, matchLength);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  627|      0|                            matchDistance = ipIndex - pos8;
  628|      0|                            goto _lz4mid_encode_sequence;
  629|      0|                        }
  630|      0|                    }
  631|      0|                }
  632|  12.5M|        }   }
  633|       |        /* search short match */
  634|  17.4M|        {   U32 const h4 = LZ4MID_hash4Ptr(ip);
  635|  17.4M|            U32 const pos4 = hash4Table[h4];
  636|  17.4M|            assert(h4 < LZ4MID_HASHTABLESIZE);
  ------------------
  |  Branch (636:13): [True: 0, False: 17.4M]
  |  Branch (636:13): [True: 17.4M, False: 0]
  ------------------
  637|  17.4M|            assert(pos4 < ipIndex);
  ------------------
  |  Branch (637:13): [True: 0, False: 17.4M]
  |  Branch (637:13): [True: 17.4M, False: 0]
  ------------------
  638|  17.4M|            LZ4MID_addPosition(hash4Table, h4, ipIndex);
  639|  17.4M|            if (ipIndex - pos4 <= LZ4_DISTANCE_MAX) {
  ------------------
  |  |  676|  17.4M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (639:17): [True: 12.1M, False: 5.30M]
  ------------------
  640|       |                /* match candidate found */
  641|  12.1M|                if (pos4 >= prefixIdx) {
  ------------------
  |  Branch (641:21): [True: 12.1M, False: 0]
  ------------------
  642|       |                /* only search within prefix */
  643|  12.1M|                    const BYTE* const matchPtr = prefixPtr + (pos4 - prefixIdx);
  644|  12.1M|                    assert(matchPtr < ip);
  ------------------
  |  Branch (644:21): [True: 0, False: 12.1M]
  |  Branch (644:21): [True: 12.1M, False: 0]
  ------------------
  645|  12.1M|                    assert(matchPtr >= prefixPtr);
  ------------------
  |  Branch (645:21): [True: 0, False: 12.1M]
  |  Branch (645:21): [True: 12.1M, False: 0]
  ------------------
  646|  12.1M|                    matchLength = LZ4_count(ip, matchPtr, matchlimit);
  647|  12.1M|                    if (matchLength >= MINMATCH) {
  ------------------
  |  |  243|  12.1M|#define MINMATCH 4
  ------------------
  |  Branch (647:25): [True: 1.69M, False: 10.4M]
  ------------------
  648|       |                        /* short match found, let's just check ip+1 for longer */
  649|  1.69M|                        U32 const h8 = LZ4MID_hash8Ptr(ip+1);
  650|  1.69M|                        U32 const pos8 = hash8Table[h8];
  651|  1.69M|                        U32 const m2Distance = ipIndex + 1 - pos8;
  652|  1.69M|                        matchDistance = ipIndex - pos4;
  653|  1.69M|                        if ( m2Distance <= LZ4_DISTANCE_MAX
  ------------------
  |  |  676|  3.38M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (653:30): [True: 1.25M, False: 440k]
  ------------------
  654|  1.25M|                        && pos8 >= prefixIdx /* only search within prefix */
  ------------------
  |  Branch (654:28): [True: 1.25M, False: 0]
  ------------------
  655|  1.25M|                        && likely(ip < mflimit)
  ------------------
  |  |  178|  1.25M|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  1.25M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.25M, False: 79]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  656|  1.69M|                        ) {
  657|  1.25M|                            const BYTE* const m2Ptr = prefixPtr + (pos8 - prefixIdx);
  658|  1.25M|                            unsigned ml2 = LZ4_count(ip+1, m2Ptr, matchlimit);
  659|  1.25M|                            if (ml2 > matchLength) {
  ------------------
  |  Branch (659:33): [True: 74.2k, False: 1.17M]
  ------------------
  660|  74.2k|                                LZ4MID_addPosition(hash8Table, h8, ipIndex+1);
  661|  74.2k|                                ip++;
  662|  74.2k|                                matchLength = ml2;
  663|  74.2k|                                matchDistance = m2Distance;
  664|  74.2k|                        }   }
  665|  1.69M|                        goto _lz4mid_encode_sequence;
  666|  1.69M|                    }
  667|  12.1M|                } else {
  668|      0|                    if (pos4 >= dictIdx) {
  ------------------
  |  Branch (668:25): [True: 0, False: 0]
  ------------------
  669|       |                        /* extDict match candidate */
  670|      0|                        const BYTE* const matchPtr = dictStart + (pos4 - dictIdx);
  671|      0|                        const size_t safeLen = MIN(prefixIdx - pos4, (size_t)(matchlimit - ip));
  ------------------
  |  |   81|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (81:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  672|      0|                        matchLength = LZ4_count(ip, matchPtr, ip + safeLen);
  673|      0|                        if (matchLength >= MINMATCH) {
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
  |  Branch (673:29): [True: 0, False: 0]
  ------------------
  674|      0|                            DEBUGLOG(7, "found match at ExtDict pos %u (len=%u)", pos4, matchLength);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  675|      0|                            matchDistance = ipIndex - pos4;
  676|      0|                            goto _lz4mid_encode_sequence;
  677|      0|                        }
  678|      0|                    }
  679|      0|                }
  680|  12.1M|        }   }
  681|       |        /* no match found in prefix */
  682|  15.7M|        if ( (dict == usingDictCtxHc)
  ------------------
  |  Branch (682:14): [True: 0, False: 15.7M]
  ------------------
  683|      0|          && (ipIndex - gDictEndIndex < LZ4_DISTANCE_MAX - 8) ) {
  ------------------
  |  |  676|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (683:14): [True: 0, False: 0]
  ------------------
  684|       |            /* search a match into external dictionary */
  685|      0|            LZ4HC_match_t dMatch = searchIntoDict(ip, ipIndex,
  686|      0|                    matchlimit,
  687|      0|                    ctx->dictCtx, gDictEndIndex);
  688|      0|            if (dMatch.len >= MINMATCH) {
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
  |  Branch (688:17): [True: 0, False: 0]
  ------------------
  689|      0|                DEBUGLOG(7, "found Dictionary match (offset=%i)", dMatch.off);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  690|      0|                assert(dMatch.back == 0);
  ------------------
  |  Branch (690:17): [True: 0, False: 0]
  |  Branch (690:17): [True: 0, False: 0]
  ------------------
  691|      0|                matchLength = (unsigned)dMatch.len;
  692|      0|                matchDistance = (unsigned)dMatch.off;
  693|      0|                goto _lz4mid_encode_sequence;
  694|      0|            }
  695|      0|        }
  696|       |        /* no match found */
  697|  15.7M|        ip += 1 + ((ip-anchor) >> 9);  /* skip faster over incompressible data */
  698|  15.7M|        continue;
  699|       |
  700|  2.21M|_lz4mid_encode_sequence:
  701|       |        /* catch back */
  702|  2.37M|        while (((ip > anchor) & ((U32)(ip-prefixPtr) > matchDistance)) && (unlikely(ip[-1] == ip[-(int)matchDistance-1]))) {
  ------------------
  |  |  181|   961k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   961k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (702:16): [True: 961k, False: 1.41M]
  |  Branch (702:75): [True: 162k, False: 798k]
  ------------------
  703|   162k|            ip--;  matchLength++;
  704|   162k|        };
  705|       |
  706|       |        /* fill table with beginning of match */
  707|  2.21M|        ADDPOS8(ip+1, ipIndex+1);
  ------------------
  |  |  508|  2.21M|#define ADDPOS8(_p, _idx) LZ4MID_addPosition(hash8Table, LZ4MID_hash8Ptr(_p), _idx)
  ------------------
  708|  2.21M|        ADDPOS8(ip+2, ipIndex+2);
  ------------------
  |  |  508|  2.21M|#define ADDPOS8(_p, _idx) LZ4MID_addPosition(hash8Table, LZ4MID_hash8Ptr(_p), _idx)
  ------------------
  709|  2.21M|        ADDPOS4(ip+1, ipIndex+1);
  ------------------
  |  |  509|  2.21M|#define ADDPOS4(_p, _idx) LZ4MID_addPosition(hash4Table, LZ4MID_hash4Ptr(_p), _idx)
  ------------------
  710|       |
  711|       |        /* encode */
  712|  2.21M|        {   BYTE* const saved_op = op;
  713|       |            /* LZ4HC_encodeSequence always updates @op; on success, it updates @ip and @anchor */
  714|  2.21M|            if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  230|  2.21M|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (714:17): [True: 19, False: 2.21M]
  ------------------
  715|  2.21M|                    (int)matchLength, (int)matchDistance,
  716|  2.21M|                    limit, oend) ) {
  717|     19|                op = saved_op;  /* restore @op value before failed LZ4HC_encodeSequence */
  718|     19|                goto _lz4mid_dest_overflow;
  719|     19|            }
  720|  2.21M|        }
  721|       |
  722|       |        /* fill table with end of match */
  723|  2.21M|        {   U32 endMatchIdx = (U32)(ip-prefixPtr) + prefixIdx;
  724|  2.21M|            U32 pos_m2 = endMatchIdx - 2;
  725|  2.21M|            if (pos_m2 < ilimitIdx) {
  ------------------
  |  Branch (725:17): [True: 2.21M, False: 927]
  ------------------
  726|  2.21M|                if (likely(ip - prefixPtr > 5)) {
  ------------------
  |  |  178|  2.21M|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  2.21M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 2.21M, False: 128]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  727|  2.21M|                    ADDPOS8(ip-5, endMatchIdx - 5);
  ------------------
  |  |  508|  2.21M|#define ADDPOS8(_p, _idx) LZ4MID_addPosition(hash8Table, LZ4MID_hash8Ptr(_p), _idx)
  ------------------
  728|  2.21M|                }
  729|  2.21M|                ADDPOS8(ip-3, endMatchIdx - 3);
  ------------------
  |  |  508|  2.21M|#define ADDPOS8(_p, _idx) LZ4MID_addPosition(hash8Table, LZ4MID_hash8Ptr(_p), _idx)
  ------------------
  730|  2.21M|                ADDPOS8(ip-2, endMatchIdx - 2);
  ------------------
  |  |  508|  2.21M|#define ADDPOS8(_p, _idx) LZ4MID_addPosition(hash8Table, LZ4MID_hash8Ptr(_p), _idx)
  ------------------
  731|  2.21M|                ADDPOS4(ip-2, endMatchIdx - 2);
  ------------------
  |  |  509|  2.21M|#define ADDPOS4(_p, _idx) LZ4MID_addPosition(hash4Table, LZ4MID_hash4Ptr(_p), _idx)
  ------------------
  732|  2.21M|                ADDPOS4(ip-1, endMatchIdx - 1);
  ------------------
  |  |  509|  2.21M|#define ADDPOS4(_p, _idx) LZ4MID_addPosition(hash4Table, LZ4MID_hash4Ptr(_p), _idx)
  ------------------
  733|  2.21M|            }
  734|  2.21M|        }
  735|  2.21M|    }
  736|       |
  737|  2.45k|_lz4mid_last_literals:
  738|       |    /* Encode Last Literals */
  739|  2.45k|    {   size_t lastRunSize = (size_t)(iend - anchor);  /* literals */
  740|  2.45k|        size_t llAdd = (lastRunSize + 255 - RUN_MASK) / 255;
  ------------------
  |  |  264|  2.45k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  2.45k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  2.45k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  741|  2.45k|        size_t const totalSize = 1 + llAdd + lastRunSize;
  742|  2.45k|        if (limit == fillOutput) oend += LASTLITERALS;  /* restore correct value */
  ------------------
  |  |  246|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (742:13): [True: 0, False: 2.45k]
  ------------------
  743|  2.45k|        if (limit && (op + totalSize > oend)) {
  ------------------
  |  Branch (743:13): [True: 2.45k, False: 0]
  |  Branch (743:22): [True: 363, False: 2.09k]
  ------------------
  744|    363|            if (limit == limitedOutput) return 0;  /* not enough space in @dst */
  ------------------
  |  Branch (744:17): [True: 363, False: 0]
  ------------------
  745|       |            /* adapt lastRunSize to fill 'dest' */
  746|      0|            lastRunSize  = (size_t)(oend - op) - 1 /*token*/;
  747|      0|            llAdd = (lastRunSize + 256 - RUN_MASK) / 256;
  ------------------
  |  |  264|      0|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|      0|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|      0|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  748|      0|            lastRunSize -= llAdd;
  749|      0|        }
  750|  2.09k|        DEBUGLOG(6, "Final literal run : %i literals", (int)lastRunSize);
  ------------------
  |  |  290|  2.09k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  751|  2.09k|        ip = anchor + lastRunSize;  /* can be != iend if limit==fillOutput */
  752|       |
  753|  2.09k|        if (lastRunSize >= RUN_MASK) {
  ------------------
  |  |  264|  2.09k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  2.09k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  2.09k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (753:13): [True: 375, False: 1.72k]
  ------------------
  754|    375|            size_t accumulator = lastRunSize - RUN_MASK;
  ------------------
  |  |  264|    375|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    375|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    375|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  755|    375|            *op++ = (RUN_MASK << ML_BITS);
  ------------------
  |  |  264|    375|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    375|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    375|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          *op++ = (RUN_MASK << ML_BITS);
  ------------------
  |  |  261|    375|#define ML_BITS  4
  ------------------
  756|  15.9k|            for(; accumulator >= 255 ; accumulator -= 255)
  ------------------
  |  Branch (756:19): [True: 15.5k, False: 375]
  ------------------
  757|  15.5k|                *op++ = 255;
  758|    375|            *op++ = (BYTE) accumulator;
  759|  1.72k|        } else {
  760|  1.72k|            *op++ = (BYTE)(lastRunSize << ML_BITS);
  ------------------
  |  |  261|  1.72k|#define ML_BITS  4
  ------------------
  761|  1.72k|        }
  762|  2.09k|        assert(lastRunSize <= (size_t)(oend - op));
  ------------------
  |  Branch (762:9): [True: 0, False: 2.09k]
  |  Branch (762:9): [True: 2.09k, False: 0]
  ------------------
  763|  2.09k|        LZ4_memcpy(op, anchor, lastRunSize);
  ------------------
  |  |  350|  2.09k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  764|  2.09k|        op += lastRunSize;
  765|  2.09k|    }
  766|       |
  767|       |    /* End */
  768|  2.09k|    DEBUGLOG(5, "compressed %i bytes into %i bytes", *srcSizePtr, (int)((char*)op - dst));
  ------------------
  |  |  290|  2.09k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  769|  2.09k|    assert(ip >= (const BYTE*)src);
  ------------------
  |  Branch (769:5): [True: 0, False: 2.09k]
  |  Branch (769:5): [True: 2.09k, False: 0]
  ------------------
  770|  2.09k|    assert(ip <= iend);
  ------------------
  |  Branch (770:5): [True: 0, False: 2.09k]
  |  Branch (770:5): [True: 2.09k, False: 0]
  ------------------
  771|  2.09k|    *srcSizePtr = (int)(ip - (const BYTE*)src);
  772|  2.09k|    assert((char*)op >= dst);
  ------------------
  |  Branch (772:5): [True: 0, False: 2.09k]
  |  Branch (772:5): [True: 2.09k, False: 0]
  ------------------
  773|  2.09k|    assert(op <= oend);
  ------------------
  |  Branch (773:5): [True: 0, False: 2.09k]
  |  Branch (773:5): [True: 2.09k, False: 0]
  ------------------
  774|  2.09k|    assert((char*)op - dst < INT_MAX);
  ------------------
  |  Branch (774:5): [True: 0, False: 2.09k]
  |  Branch (774:5): [True: 2.09k, False: 0]
  ------------------
  775|  2.09k|    return (int)((char*)op - dst);
  776|       |
  777|     19|_lz4mid_dest_overflow:
  778|     19|    if (limit == fillOutput) {
  ------------------
  |  Branch (778:9): [True: 0, False: 19]
  ------------------
  779|       |        /* Assumption : @ip, @anchor, @optr and @matchLength must be set correctly */
  780|      0|        size_t const ll = (size_t)(ip - anchor);
  781|      0|        size_t const ll_addbytes = (ll + 240) / 255;
  782|      0|        size_t const ll_totalCost = 1 + ll_addbytes + ll;
  783|      0|        BYTE* const maxLitPos = oend - 3; /* 2 for offset, 1 for token */
  784|      0|        DEBUGLOG(6, "Last sequence is overflowing : %u literals, %u remaining space",
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  785|      0|                (unsigned)ll, (unsigned)(oend-op));
  786|      0|        if (op + ll_totalCost <= maxLitPos) {
  ------------------
  |  Branch (786:13): [True: 0, False: 0]
  ------------------
  787|       |            /* ll validated; now adjust match length */
  788|      0|            size_t const bytesLeftForMl = (size_t)(maxLitPos - (op+ll_totalCost));
  789|      0|            size_t const maxMlSize = MINMATCH + (ML_MASK-1) + (bytesLeftForMl * 255);
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
                          size_t const maxMlSize = MINMATCH + (ML_MASK-1) + (bytesLeftForMl * 255);
  ------------------
  |  |  262|      0|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|      0|#define ML_BITS  4
  |  |  ------------------
  ------------------
  790|      0|            assert(maxMlSize < INT_MAX);
  ------------------
  |  Branch (790:13): [True: 0, False: 0]
  |  Branch (790:13): [True: 0, False: 0]
  ------------------
  791|      0|            if ((size_t)matchLength > maxMlSize) matchLength= (unsigned)maxMlSize;
  ------------------
  |  Branch (791:17): [True: 0, False: 0]
  ------------------
  792|      0|            if ((oend + LASTLITERALS) - (op + ll_totalCost + 2) - 1 + matchLength >= MFLIMIT) {
  ------------------
  |  |  246|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          if ((oend + LASTLITERALS) - (op + ll_totalCost + 2) - 1 + matchLength >= MFLIMIT) {
  ------------------
  |  |  247|      0|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (792:17): [True: 0, False: 0]
  ------------------
  793|      0|            DEBUGLOG(6, "Let's encode a last sequence (ll=%u, ml=%u)", (unsigned)ll, matchLength);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  794|      0|                LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  230|      0|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  795|      0|                        (int)matchLength, (int)matchDistance,
  796|      0|                        notLimited, oend);
  797|      0|        }   }
  798|      0|        DEBUGLOG(6, "Let's finish with a run of literals (%u bytes left)", (unsigned)(oend-op));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  799|      0|        goto _lz4mid_last_literals;
  800|      0|    }
  801|       |    /* compression failed */
  802|     19|    return 0;
  803|     19|}
lz4hc.c:LZ4HC_hashPtr:
  122|   620M|static U32 LZ4HC_hashPtr(const void* ptr) { return HASH_FUNCTION(LZ4_read32(ptr)); }
  ------------------
  |  |  121|   620M|#define HASH_FUNCTION(i)      (((i) * 2654435761U) >> ((MINMATCH*8)-LZ4HC_HASH_LOG))
  |  |  ------------------
  |  |  |  |  243|   620M|#define MINMATCH 4
  |  |  ------------------
  |  |               #define HASH_FUNCTION(i)      (((i) * 2654435761U) >> ((MINMATCH*8)-LZ4HC_HASH_LOG))
  |  |  ------------------
  |  |  |  |  233|   620M|#define LZ4HC_HASH_LOG 15
  |  |  ------------------
  ------------------
lz4hc.c:LZ4HC_countBack:
  207|  92.1M|{
  208|  92.1M|    int back = 0;
  209|  92.1M|    int const min = (int)MAX(iMin - ip, mMin - match);
  ------------------
  |  |   82|  92.1M|#define MAX(a,b)   ( (a) > (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (82:22): [True: 92.1M, False: 66.0k]
  |  |  ------------------
  ------------------
  210|  92.1M|    assert(min <= 0);
  ------------------
  |  Branch (210:5): [True: 0, False: 92.1M]
  |  Branch (210:5): [True: 92.1M, False: 0]
  ------------------
  211|  92.1M|    assert(ip >= iMin); assert((size_t)(ip-iMin) < (1U<<31));
  ------------------
  |  Branch (211:5): [True: 0, False: 92.1M]
  |  Branch (211:5): [True: 92.1M, False: 0]
  |  Branch (211:25): [True: 0, False: 92.1M]
  |  Branch (211:25): [True: 92.1M, False: 0]
  ------------------
  212|  92.1M|    assert(match >= mMin); assert((size_t)(match - mMin) < (1U<<31));
  ------------------
  |  Branch (212:5): [True: 0, False: 92.1M]
  |  Branch (212:5): [True: 92.1M, False: 0]
  |  Branch (212:28): [True: 0, False: 92.1M]
  |  Branch (212:28): [True: 92.1M, False: 0]
  ------------------
  213|       |
  214|   218M|    while ((back - min) > 3) {
  ------------------
  |  Branch (214:12): [True: 209M, False: 8.45M]
  ------------------
  215|   209M|        U32 const v = LZ4_read32(ip + back - 4) ^ LZ4_read32(match + back - 4);
  216|   209M|        if (v) {
  ------------------
  |  Branch (216:13): [True: 83.7M, False: 126M]
  ------------------
  217|  83.7M|            return (back - (int)LZ4HC_NbCommonBytes32(v));
  218|   126M|        } else back -= 4; /* 4-byte step */
  219|   209M|    }
  220|       |    /* check remainder if any */
  221|  14.6M|    while ( (back > min)
  ------------------
  |  Branch (221:13): [True: 13.9M, False: 695k]
  ------------------
  222|  13.9M|         && (ip[back-1] == match[back-1]) )
  ------------------
  |  Branch (222:13): [True: 6.20M, False: 7.75M]
  ------------------
  223|  6.20M|            back--;
  224|  8.45M|    return back;
  225|  92.1M|}
lz4hc.c:LZ4HC_NbCommonBytes32:
  169|  83.7M|{
  170|  83.7M|    assert(val != 0);
  ------------------
  |  Branch (170:5): [True: 0, False: 83.7M]
  |  Branch (170:5): [True: 83.7M, False: 0]
  ------------------
  171|  83.7M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (171:9): [True: 83.7M, False: 0]
  ------------------
  172|       |#     if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT)
  173|       |        unsigned long r;
  174|       |        _BitScanReverse(&r, val);
  175|       |        return (unsigned)((31 - r) >> 3);
  176|       |#     elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  177|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  178|       |                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  179|       |        return (unsigned)__builtin_clz(val) >> 3;
  180|       |#     else
  181|       |        val >>= 8;
  182|       |        val = ((((val + 0x00FFFF00) | 0x00FFFFFF) + val) |
  183|       |              (val + 0x00FF0000)) >> 24;
  184|       |        return (unsigned)val ^ 3;
  185|       |#     endif
  186|  83.7M|    } else {
  187|       |#     if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT)
  188|       |        unsigned long r;
  189|       |        _BitScanForward(&r, val);
  190|       |        return (unsigned)(r >> 3);
  191|       |#     elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  192|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  193|       |                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  194|       |        return (unsigned)__builtin_ctz(val) >> 3;
  195|       |#     else
  196|       |        const U32 m = 0x01010101;
  197|       |        return (unsigned)((((val - 1) ^ val) & (m - 1)) * m) >> 24;
  198|       |#     endif
  199|      0|    }
  200|  83.7M|}
lz4hc.c:LZ4MID_hash8Ptr:
  151|  30.7M|static U32 LZ4MID_hash8Ptr(const void* ptr) { return LZ4MID_hash7(LZ4_readLE64(ptr)); }
lz4hc.c:LZ4MID_hash7:
  149|  30.7M|static U32 LZ4MID_hash7(U64 v) { return (U32)(((v  << (64-56)) * 58295818150454627ULL) >> (64-LZ4MID_HASHLOG)) ; }
  ------------------
  |  |  142|  30.7M|#define LZ4MID_HASHLOG (LZ4HC_HASH_LOG-1)
  |  |  ------------------
  |  |  |  |  233|  30.7M|#define LZ4HC_HASH_LOG 15
  |  |  ------------------
  ------------------
lz4hc.c:LZ4_readLE64:
  154|  30.7M|{
  155|  30.7M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (155:9): [True: 30.7M, False: 0]
  ------------------
  156|  30.7M|        return LZ4_read64(memPtr);
  157|  30.7M|    } else {
  158|      0|        const BYTE* p = (const BYTE*)memPtr;
  159|       |        /* note: relies on the compiler to simplify this expression */
  160|      0|        return (U64)p[0] | ((U64)p[1]<<8) | ((U64)p[2]<<16) | ((U64)p[3]<<24)
  161|      0|            | ((U64)p[4]<<32) | ((U64)p[5]<<40) | ((U64)p[6]<<48) | ((U64)p[7]<<56);
  162|      0|    }
  163|  30.7M|}
lz4hc.c:LZ4_read64:
  131|  30.7M|static U64 LZ4_read64(const void* ptr) { return ((const LZ4_unalign64*)ptr)->u64; }
lz4hc.c:LZ4MID_addPosition:
  504|  53.2M|{
  505|  53.2M|    hTable[hValue] = index;
  506|  53.2M|}
lz4hc.c:LZ4MID_hash4Ptr:
  146|  24.1M|static U32 LZ4MID_hash4Ptr(const void* ptr) { return LZ4MID_hash4(LZ4_read32(ptr)); }
lz4hc.c:LZ4MID_hash4:
  145|  24.1M|static U32 LZ4MID_hash4(U32 v) { return (v * 2654435761U) >> (32-LZ4MID_HASHLOG); }
  ------------------
  |  |  142|  24.1M|#define LZ4MID_HASHLOG (LZ4HC_HASH_LOG-1)
  |  |  ------------------
  |  |  |  |  233|  24.1M|#define LZ4HC_HASH_LOG 15
  |  |  ------------------
  ------------------
lz4hc.c:LZ4HC_encodeSequence:
  300|  12.7M|{
  301|  12.7M|#define ip      (*_ip)
  302|  12.7M|#define op      (*_op)
  303|  12.7M|#define anchor  (*_anchor)
  304|       |
  305|  12.7M|    BYTE* const token = op++;
  ------------------
  |  |  302|  12.7M|#define op      (*_op)
  ------------------
  306|       |
  307|       |#if defined(LZ4_DEBUG) && (LZ4_DEBUG >= 6)
  308|       |    static const BYTE* start = NULL;
  309|       |    static U32 totalCost = 0;
  310|       |    U32 const pos = (start==NULL) ? 0 : (U32)(anchor - start); /* only works for single segment */
  311|       |    U32 const ll = (U32)(ip - anchor);
  312|       |    U32 const llAdd = (ll>=15) ? ((ll-15) / 255) + 1 : 0;
  313|       |    U32 const mlAdd = (matchLength>=19) ? ((matchLength-19) / 255) + 1 : 0;
  314|       |    U32 const cost = 1 + llAdd + ll + 2 + mlAdd;
  315|       |    if (start==NULL) start = anchor;  /* only works for single segment */
  316|       |    DEBUGLOG(6, "pos:%7u -- literals:%4u, match:%4i, offset:%5i, cost:%4u + %5u",
  317|       |                pos,
  318|       |                (U32)(ip - anchor), matchLength, offset,
  319|       |                cost, totalCost);
  320|       |# if 1 /* only works on single segment data */
  321|       |    HEX_CMP(7, ip, ip-offset, matchLength);
  322|       |# endif
  323|       |    totalCost += cost;
  324|       |#endif
  325|       |
  326|       |    /* Encode Literal length */
  327|  12.7M|    {   size_t litLen = (size_t)(ip - anchor);
  ------------------
  |  |  301|  12.7M|#define ip      (*_ip)
  ------------------
                  {   size_t litLen = (size_t)(ip - anchor);
  ------------------
  |  |  303|  12.7M|#define anchor  (*_anchor)
  ------------------
  328|  12.7M|        LZ4_STATIC_ASSERT(notLimited == 0);
  ------------------
  |  |  278|  12.7M|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
  329|       |        /* Check output limit */
  330|  12.7M|        if (limit && ((op + (litLen / 255) + litLen + (2 + 1 + LASTLITERALS)) > oend)) {
  ------------------
  |  |  302|  12.7M|#define op      (*_op)
  ------------------
                      if (limit && ((op + (litLen / 255) + litLen + (2 + 1 + LASTLITERALS)) > oend)) {
  ------------------
  |  |  246|  12.7M|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (330:13): [True: 12.7M, False: 0]
  |  Branch (330:22): [True: 162, False: 12.7M]
  ------------------
  331|    162|            DEBUGLOG(6, "Not enough room to write %i literals (%i bytes remaining)",
  ------------------
  |  |  290|    162|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  332|    162|                    (int)litLen, (int)(oend - op));
  333|    162|            return 1;
  334|    162|        }
  335|  12.7M|        if (litLen >= RUN_MASK) {
  ------------------
  |  |  264|  12.7M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  12.7M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  12.7M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (335:13): [True: 896k, False: 11.8M]
  ------------------
  336|   896k|            size_t len = litLen - RUN_MASK;
  ------------------
  |  |  264|   896k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|   896k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|   896k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  337|   896k|            *token = (RUN_MASK << ML_BITS);
  ------------------
  |  |  264|   896k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|   896k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|   896k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          *token = (RUN_MASK << ML_BITS);
  ------------------
  |  |  261|   896k|#define ML_BITS  4
  ------------------
  338|  1.26M|            for(; len >= 255 ; len -= 255) *op++ = 255;
  ------------------
  |  |  302|   364k|#define op      (*_op)
  ------------------
  |  Branch (338:19): [True: 364k, False: 896k]
  ------------------
  339|   896k|            *op++ = (BYTE)len;
  ------------------
  |  |  302|   896k|#define op      (*_op)
  ------------------
  340|  11.8M|        } else {
  341|  11.8M|            *token = (BYTE)(litLen << ML_BITS);
  ------------------
  |  |  261|  11.8M|#define ML_BITS  4
  ------------------
  342|  11.8M|        }
  343|       |
  344|       |        /* Copy Literals */
  345|  12.7M|        LZ4_wildCopy8(op, anchor, op + litLen);
  ------------------
  |  |  302|  12.7M|#define op      (*_op)
  ------------------
                      LZ4_wildCopy8(op, anchor, op + litLen);
  ------------------
  |  |  303|  12.7M|#define anchor  (*_anchor)
  ------------------
                      LZ4_wildCopy8(op, anchor, op + litLen);
  ------------------
  |  |  302|  12.7M|#define op      (*_op)
  ------------------
  346|  12.7M|        op += litLen;
  ------------------
  |  |  302|  12.7M|#define op      (*_op)
  ------------------
  347|  12.7M|    }
  348|       |
  349|       |    /* Encode Offset */
  350|  12.7M|    assert(offset <= LZ4_DISTANCE_MAX );
  ------------------
  |  Branch (350:5): [True: 0, False: 12.7M]
  |  Branch (350:5): [True: 12.7M, False: 0]
  ------------------
  351|  12.7M|    assert(offset > 0);
  ------------------
  |  Branch (351:5): [True: 0, False: 12.7M]
  |  Branch (351:5): [True: 12.7M, False: 0]
  ------------------
  352|  12.7M|    LZ4_writeLE16(op, (U16)(offset)); op += 2;
  ------------------
  |  |  302|  12.7M|#define op      (*_op)
  ------------------
                  LZ4_writeLE16(op, (U16)(offset)); op += 2;
  ------------------
  |  |  302|  12.7M|#define op      (*_op)
  ------------------
  353|       |
  354|       |    /* Encode MatchLength */
  355|  12.7M|    assert(matchLength >= MINMATCH);
  ------------------
  |  Branch (355:5): [True: 0, False: 12.7M]
  |  Branch (355:5): [True: 12.7M, False: 0]
  ------------------
  356|  12.7M|    {   size_t mlCode = (size_t)matchLength - MINMATCH;
  ------------------
  |  |  243|  12.7M|#define MINMATCH 4
  ------------------
  357|  12.7M|        if (limit && (op + (mlCode / 255) + (1 + LASTLITERALS) > oend)) {
  ------------------
  |  |  302|  12.7M|#define op      (*_op)
  ------------------
                      if (limit && (op + (mlCode / 255) + (1 + LASTLITERALS) > oend)) {
  ------------------
  |  |  246|  12.7M|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (357:13): [True: 12.7M, False: 0]
  |  Branch (357:22): [True: 50, False: 12.7M]
  ------------------
  358|     50|            DEBUGLOG(6, "Not enough room to write match length");
  ------------------
  |  |  290|     50|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  359|     50|            return 1;   /* Check output limit */
  360|     50|        }
  361|  12.7M|        if (mlCode >= ML_MASK) {
  ------------------
  |  |  262|  12.7M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  12.7M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (361:13): [True: 1.26M, False: 11.4M]
  ------------------
  362|  1.26M|            *token += ML_MASK;
  ------------------
  |  |  262|  1.26M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.26M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  363|  1.26M|            mlCode -= ML_MASK;
  ------------------
  |  |  262|  1.26M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.26M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  364|  1.75M|            for(; mlCode >= 510 ; mlCode -= 510) { *op++ = 255; *op++ = 255; }
  ------------------
  |  |  302|   486k|#define op      (*_op)
  ------------------
                          for(; mlCode >= 510 ; mlCode -= 510) { *op++ = 255; *op++ = 255; }
  ------------------
  |  |  302|   486k|#define op      (*_op)
  ------------------
  |  Branch (364:19): [True: 486k, False: 1.26M]
  ------------------
  365|  1.26M|            if (mlCode >= 255) { mlCode -= 255; *op++ = 255; }
  ------------------
  |  |  302|  69.0k|#define op      (*_op)
  ------------------
  |  Branch (365:17): [True: 69.0k, False: 1.19M]
  ------------------
  366|  1.26M|            *op++ = (BYTE)mlCode;
  ------------------
  |  |  302|  1.26M|#define op      (*_op)
  ------------------
  367|  11.4M|        } else {
  368|  11.4M|            *token += (BYTE)(mlCode);
  369|  11.4M|    }   }
  370|       |
  371|       |    /* Prepare next loop */
  372|  12.7M|    ip += matchLength;
  ------------------
  |  |  301|  12.7M|#define ip      (*_ip)
  ------------------
  373|  12.7M|    anchor = ip;
  ------------------
  |  |  303|  12.7M|#define anchor  (*_anchor)
  ------------------
                  anchor = ip;
  ------------------
  |  |  301|  12.7M|#define ip      (*_ip)
  ------------------
  374|       |
  375|  12.7M|    return 0;
  376|       |
  377|  12.7M|#undef ip
  378|  12.7M|#undef op
  379|  12.7M|#undef anchor
  380|  12.7M|}
lz4hc.c:LZ4HC_compress_hashChain:
 1169|  6.01k|{
 1170|  6.01k|    const int inputSize = *srcSizePtr;
 1171|  6.01k|    const int patternAnalysis = (maxNbAttempts > 128);   /* levels 9+ */
 1172|       |
 1173|  6.01k|    const BYTE* ip = (const BYTE*)src;
 1174|  6.01k|    const BYTE* anchor = ip;
 1175|  6.01k|    const BYTE* const iend = ip + inputSize;
 1176|  6.01k|    const BYTE* const mflimit = iend - MFLIMIT;
  ------------------
  |  |  247|  6.01k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1177|  6.01k|    const BYTE* const matchlimit = (iend - LASTLITERALS);
  ------------------
  |  |  246|  6.01k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1178|       |
 1179|  6.01k|    BYTE* optr = (BYTE*) dst;
 1180|  6.01k|    BYTE* op = (BYTE*) dst;
 1181|  6.01k|    BYTE* oend = op + maxOutputSize;
 1182|       |
 1183|  6.01k|    const BYTE* start0;
 1184|  6.01k|    const BYTE* start2 = NULL;
 1185|  6.01k|    const BYTE* start3 = NULL;
 1186|  6.01k|    LZ4HC_match_t m0, m1, m2, m3;
 1187|  6.01k|    const LZ4HC_match_t nomatch = {0, 0, 0};
 1188|       |
 1189|       |    /* init */
 1190|  6.01k|    DEBUGLOG(5, "LZ4HC_compress_hashChain (dict?=>%i)", dict);
  ------------------
  |  |  290|  6.01k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1191|       |
 1192|       |    /* preconditions verifications */
 1193|  6.01k|    assert(*srcSizePtr >= 1);
  ------------------
  |  Branch (1193:5): [True: 0, False: 6.01k]
  |  Branch (1193:5): [True: 6.01k, False: 0]
  ------------------
 1194|  6.01k|    assert(src != NULL);
  ------------------
  |  Branch (1194:5): [True: 0, False: 6.01k]
  |  Branch (1194:5): [True: 6.01k, False: 0]
  ------------------
 1195|  6.01k|    assert(maxOutputSize >= 1);
  ------------------
  |  Branch (1195:5): [True: 0, False: 6.01k]
  |  Branch (1195:5): [True: 6.01k, False: 0]
  ------------------
 1196|  6.01k|    assert(dst != NULL);
  ------------------
  |  Branch (1196:5): [True: 0, False: 6.01k]
  |  Branch (1196:5): [True: 6.01k, False: 0]
  ------------------
 1197|       |
 1198|  6.01k|    *srcSizePtr = 0;
 1199|  6.01k|    if (limit == fillOutput) oend -= LASTLITERALS;                  /* Hack for support LZ4 format restriction */
  ------------------
  |  |  246|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (1199:9): [True: 0, False: 6.01k]
  ------------------
 1200|  6.01k|    if (inputSize < LZ4_minLength) goto _last_literals;             /* Input too small, no compression (all literals) */
  ------------------
  |  Branch (1200:9): [True: 29, False: 5.98k]
  ------------------
 1201|       |
 1202|       |    /* Main Loop */
 1203|  82.3M|    while (ip <= mflimit) {
  ------------------
  |  Branch (1203:12): [True: 82.3M, False: 5.91k]
  ------------------
 1204|  82.3M|        m1 = LZ4HC_InsertAndFindBestMatch(ctx, ip, matchlimit, maxNbAttempts, patternAnalysis, dict);
 1205|  82.3M|        if (m1.len<MINMATCH) { ip++; continue; }
  ------------------
  |  |  243|  82.3M|#define MINMATCH 4
  ------------------
  |  Branch (1205:13): [True: 76.8M, False: 5.45M]
  ------------------
 1206|       |
 1207|       |        /* saved, in case we would skip too much */
 1208|  5.45M|        start0 = ip; m0 = m1;
 1209|       |
 1210|  6.43M|_Search2:
 1211|  6.43M|        DEBUGLOG(7, "_Search2 (currently found match of size %i)", m1.len);
  ------------------
  |  |  290|  6.43M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1212|  6.43M|        if (ip+m1.len <= mflimit) {
  ------------------
  |  Branch (1212:13): [True: 6.43M, False: 3.57k]
  ------------------
 1213|  6.43M|            start2 = ip + m1.len - 2;
 1214|  6.43M|            m2 = LZ4HC_InsertAndGetWiderMatch(ctx,
 1215|  6.43M|                            start2, ip + 0, matchlimit, m1.len,
 1216|  6.43M|                            maxNbAttempts, patternAnalysis, 0, dict, favorCompressionRatio);
 1217|  6.43M|            start2 += m2.back;
 1218|  6.43M|        } else {
 1219|  3.57k|            m2 = nomatch;  /* do not search further */
 1220|  3.57k|        }
 1221|       |
 1222|  6.43M|        if (m2.len <= m1.len) { /* No better match => encode ML1 immediately */
  ------------------
  |  Branch (1222:13): [True: 5.11M, False: 1.31M]
  ------------------
 1223|  5.11M|            optr = op;
 1224|  5.11M|            if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  230|  5.11M|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1224:17): [True: 58, False: 5.11M]
  ------------------
 1225|  5.11M|                    m1.len, m1.off,
 1226|  5.11M|                    limit, oend) )
 1227|     58|                goto _dest_overflow;
 1228|  5.11M|            continue;
 1229|  5.11M|        }
 1230|       |
 1231|  1.31M|        if (start0 < ip) {   /* first match was skipped at least once */
  ------------------
  |  Branch (1231:13): [True: 164k, False: 1.15M]
  ------------------
 1232|   164k|            if (start2 < ip + m0.len) {  /* squeezing ML1 between ML0(original ML1) and ML2 */
  ------------------
  |  Branch (1232:17): [True: 109k, False: 54.8k]
  ------------------
 1233|   109k|                ip = start0; m1 = m0;  /* restore initial Match1 */
 1234|   109k|        }   }
 1235|       |
 1236|       |        /* Here, start0==ip */
 1237|  1.31M|        if ((start2 - ip) < 3) {  /* First Match too small : removed */
  ------------------
  |  Branch (1237:13): [True: 738k, False: 580k]
  ------------------
 1238|   738k|            ip = start2;
 1239|   738k|            m1 = m2;
 1240|   738k|            goto _Search2;
 1241|   738k|        }
 1242|       |
 1243|   788k|_Search3:
 1244|   788k|        if ((start2 - ip) < OPTIMAL_ML) {
  ------------------
  |  |   76|   788k|#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  262|   788k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|   788k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  243|   788k|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (1244:13): [True: 710k, False: 78.3k]
  ------------------
 1245|   710k|            int correction;
 1246|   710k|            int new_ml = m1.len;
 1247|   710k|            if (new_ml > OPTIMAL_ML) new_ml = OPTIMAL_ML;
  ------------------
  |  |   76|   710k|#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  262|   710k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|   710k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  243|   710k|#define MINMATCH 4
  |  |  ------------------
  ------------------
                          if (new_ml > OPTIMAL_ML) new_ml = OPTIMAL_ML;
  ------------------
  |  |   76|  99.4k|#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  262|  99.4k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  99.4k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  243|  99.4k|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (1247:17): [True: 99.4k, False: 611k]
  ------------------
 1248|   710k|            if (ip+new_ml > start2 + m2.len - MINMATCH)
  ------------------
  |  |  243|   710k|#define MINMATCH 4
  ------------------
  |  Branch (1248:17): [True: 705, False: 709k]
  ------------------
 1249|    705|                new_ml = (int)(start2 - ip) + m2.len - MINMATCH;
  ------------------
  |  |  243|    705|#define MINMATCH 4
  ------------------
 1250|   710k|            correction = new_ml - (int)(start2 - ip);
 1251|   710k|            if (correction > 0) {
  ------------------
  |  Branch (1251:17): [True: 678k, False: 32.4k]
  ------------------
 1252|   678k|                start2 += correction;
 1253|   678k|                m2.len -= correction;
 1254|   678k|            }
 1255|   710k|        }
 1256|       |
 1257|   788k|        if (start2 + m2.len <= mflimit) {
  ------------------
  |  Branch (1257:13): [True: 788k, False: 729]
  ------------------
 1258|   788k|            start3 = start2 + m2.len - 3;
 1259|   788k|            m3 = LZ4HC_InsertAndGetWiderMatch(ctx,
 1260|   788k|                            start3, start2, matchlimit, m2.len,
 1261|   788k|                            maxNbAttempts, patternAnalysis, 0, dict, favorCompressionRatio);
 1262|   788k|            start3 += m3.back;
 1263|   788k|        } else {
 1264|    729|            m3 = nomatch;  /* do not search further */
 1265|    729|        }
 1266|       |
 1267|   788k|        if (m3.len <= m2.len) {  /* No better match => encode ML1 and ML2 */
  ------------------
  |  Branch (1267:13): [True: 333k, False: 454k]
  ------------------
 1268|       |            /* ip & ref are known; Now for ml */
 1269|   333k|            if (start2 < ip+m1.len) m1.len = (int)(start2 - ip);
  ------------------
  |  Branch (1269:17): [True: 109k, False: 224k]
  ------------------
 1270|       |            /* Now, encode 2 sequences */
 1271|   333k|            optr = op;
 1272|   333k|            if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  230|   333k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1272:17): [True: 3, False: 333k]
  ------------------
 1273|   333k|                    m1.len, m1.off,
 1274|   333k|                    limit, oend) )
 1275|      3|                goto _dest_overflow;
 1276|   333k|            ip = start2;
 1277|   333k|            optr = op;
 1278|   333k|            if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  230|   333k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1278:17): [True: 3, False: 333k]
  ------------------
 1279|   333k|                    m2.len, m2.off,
 1280|   333k|                    limit, oend) ) {
 1281|      3|                m1 = m2;
 1282|      3|                goto _dest_overflow;
 1283|      3|            }
 1284|   333k|            continue;
 1285|   333k|        }
 1286|       |
 1287|   454k|        if (start3 < ip+m1.len+3) {  /* Not enough space for match 2 : remove it */
  ------------------
  |  Branch (1287:13): [True: 270k, False: 184k]
  ------------------
 1288|   270k|            if (start3 >= (ip+m1.len)) {  /* can write Seq1 immediately ==> Seq2 is removed, so Seq3 becomes Seq1 */
  ------------------
  |  Branch (1288:17): [True: 246k, False: 23.4k]
  ------------------
 1289|   246k|                if (start2 < ip+m1.len) {
  ------------------
  |  Branch (1289:21): [True: 8.38k, False: 238k]
  ------------------
 1290|  8.38k|                    int correction = (int)(ip+m1.len - start2);
 1291|  8.38k|                    start2 += correction;
 1292|  8.38k|                    m2.len -= correction;
 1293|  8.38k|                    if (m2.len < MINMATCH) {
  ------------------
  |  |  243|  8.38k|#define MINMATCH 4
  ------------------
  |  Branch (1293:25): [True: 601, False: 7.78k]
  ------------------
 1294|    601|                        start2 = start3;
 1295|    601|                        m2 = m3;
 1296|    601|                    }
 1297|  8.38k|                }
 1298|       |
 1299|   246k|                optr = op;
 1300|   246k|                if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  230|   246k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1300:21): [True: 2, False: 246k]
  ------------------
 1301|   246k|                        m1.len, m1.off,
 1302|   246k|                        limit, oend) )
 1303|      2|                    goto _dest_overflow;
 1304|   246k|                ip  = start3;
 1305|   246k|                m1 = m3;
 1306|       |
 1307|   246k|                start0 = start2;
 1308|   246k|                m0 = m2;
 1309|   246k|                goto _Search2;
 1310|   246k|            }
 1311|       |
 1312|  23.4k|            start2 = start3;
 1313|  23.4k|            m2 = m3;
 1314|  23.4k|            goto _Search3;
 1315|   270k|        }
 1316|       |
 1317|       |        /*
 1318|       |        * OK, now we have 3 ascending matches;
 1319|       |        * let's write the first one ML1.
 1320|       |        * ip & ref are known; Now decide ml.
 1321|       |        */
 1322|   184k|        if (start2 < ip+m1.len) {
  ------------------
  |  Branch (1322:13): [True: 36.5k, False: 148k]
  ------------------
 1323|  36.5k|            if ((start2 - ip) < OPTIMAL_ML) {
  ------------------
  |  |   76|  36.5k|#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  262|  36.5k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  36.5k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  243|  36.5k|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (1323:17): [True: 0, False: 36.5k]
  ------------------
 1324|      0|                int correction;
 1325|      0|                if (m1.len > OPTIMAL_ML) m1.len = OPTIMAL_ML;
  ------------------
  |  |   76|      0|#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  262|      0|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|      0|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  243|      0|#define MINMATCH 4
  |  |  ------------------
  ------------------
                              if (m1.len > OPTIMAL_ML) m1.len = OPTIMAL_ML;
  ------------------
  |  |   76|      0|#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  262|      0|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|      0|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  243|      0|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (1325:21): [True: 0, False: 0]
  ------------------
 1326|      0|                if (ip + m1.len > start2 + m2.len - MINMATCH)
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
  |  Branch (1326:21): [True: 0, False: 0]
  ------------------
 1327|      0|                    m1.len = (int)(start2 - ip) + m2.len - MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
 1328|      0|                correction = m1.len - (int)(start2 - ip);
 1329|      0|                if (correction > 0) {
  ------------------
  |  Branch (1329:21): [True: 0, False: 0]
  ------------------
 1330|      0|                    start2 += correction;
 1331|      0|                    m2.len -= correction;
 1332|      0|                }
 1333|  36.5k|            } else {
 1334|  36.5k|                m1.len = (int)(start2 - ip);
 1335|  36.5k|            }
 1336|  36.5k|        }
 1337|   184k|        optr = op;
 1338|   184k|        if ( LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor),
  ------------------
  |  |  230|   184k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1338:14): [True: 4, False: 184k]
  ------------------
 1339|   184k|                m1.len, m1.off,
 1340|   184k|                limit, oend) )
 1341|      4|            goto _dest_overflow;
 1342|       |
 1343|       |        /* ML2 becomes ML1 */
 1344|   184k|        ip = start2; m1 = m2;
 1345|       |
 1346|       |        /* ML3 becomes ML2 */
 1347|   184k|        start2 = start3; m2 = m3;
 1348|       |
 1349|       |        /* let's find a new ML3 */
 1350|   184k|        goto _Search3;
 1351|   184k|    }
 1352|       |
 1353|  5.94k|_last_literals:
 1354|       |    /* Encode Last Literals */
 1355|  5.94k|    {   size_t lastRunSize = (size_t)(iend - anchor);  /* literals */
 1356|  5.94k|        size_t llAdd = (lastRunSize + 255 - RUN_MASK) / 255;
  ------------------
  |  |  264|  5.94k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  5.94k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  5.94k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1357|  5.94k|        size_t const totalSize = 1 + llAdd + lastRunSize;
 1358|  5.94k|        if (limit == fillOutput) oend += LASTLITERALS;  /* restore correct value */
  ------------------
  |  |  246|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (1358:13): [True: 0, False: 5.94k]
  ------------------
 1359|  5.94k|        if (limit && (op + totalSize > oend)) {
  ------------------
  |  Branch (1359:13): [True: 5.94k, False: 0]
  |  Branch (1359:22): [True: 526, False: 5.41k]
  ------------------
 1360|    526|            if (limit == limitedOutput) return 0;
  ------------------
  |  Branch (1360:17): [True: 526, False: 0]
  ------------------
 1361|       |            /* adapt lastRunSize to fill 'dest' */
 1362|      0|            lastRunSize  = (size_t)(oend - op) - 1 /*token*/;
 1363|      0|            llAdd = (lastRunSize + 256 - RUN_MASK) / 256;
  ------------------
  |  |  264|      0|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|      0|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|      0|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1364|      0|            lastRunSize -= llAdd;
 1365|      0|        }
 1366|  5.41k|        DEBUGLOG(6, "Final literal run : %i literals", (int)lastRunSize);
  ------------------
  |  |  290|  5.41k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1367|  5.41k|        ip = anchor + lastRunSize;  /* can be != iend if limit==fillOutput */
 1368|       |
 1369|  5.41k|        if (lastRunSize >= RUN_MASK) {
  ------------------
  |  |  264|  5.41k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  5.41k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  5.41k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1369:13): [True: 570, False: 4.84k]
  ------------------
 1370|    570|            size_t accumulator = lastRunSize - RUN_MASK;
  ------------------
  |  |  264|    570|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    570|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    570|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1371|    570|            *op++ = (RUN_MASK << ML_BITS);
  ------------------
  |  |  264|    570|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    570|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    570|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          *op++ = (RUN_MASK << ML_BITS);
  ------------------
  |  |  261|    570|#define ML_BITS  4
  ------------------
 1372|  4.01k|            for(; accumulator >= 255 ; accumulator -= 255) *op++ = 255;
  ------------------
  |  Branch (1372:19): [True: 3.44k, False: 570]
  ------------------
 1373|    570|            *op++ = (BYTE) accumulator;
 1374|  4.84k|        } else {
 1375|  4.84k|            *op++ = (BYTE)(lastRunSize << ML_BITS);
  ------------------
  |  |  261|  4.84k|#define ML_BITS  4
  ------------------
 1376|  4.84k|        }
 1377|  5.41k|        LZ4_memcpy(op, anchor, lastRunSize);
  ------------------
  |  |  350|  5.41k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 1378|  5.41k|        op += lastRunSize;
 1379|  5.41k|    }
 1380|       |
 1381|       |    /* End */
 1382|      0|    *srcSizePtr = (int) (((const char*)ip) - src);
 1383|  5.41k|    return (int) (((char*)op)-dst);
 1384|       |
 1385|     70|_dest_overflow:
 1386|     70|    if (limit == fillOutput) {
  ------------------
  |  Branch (1386:9): [True: 0, False: 70]
  ------------------
 1387|       |        /* Assumption : @ip, @anchor, @optr and @m1 must be set correctly */
 1388|      0|        size_t const ll = (size_t)(ip - anchor);
 1389|      0|        size_t const ll_addbytes = (ll + 240) / 255;
 1390|      0|        size_t const ll_totalCost = 1 + ll_addbytes + ll;
 1391|      0|        BYTE* const maxLitPos = oend - 3; /* 2 for offset, 1 for token */
 1392|      0|        DEBUGLOG(6, "Last sequence overflowing");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1393|      0|        op = optr;  /* restore correct out pointer */
 1394|      0|        if (op + ll_totalCost <= maxLitPos) {
  ------------------
  |  Branch (1394:13): [True: 0, False: 0]
  ------------------
 1395|       |            /* ll validated; now adjust match length */
 1396|      0|            size_t const bytesLeftForMl = (size_t)(maxLitPos - (op+ll_totalCost));
 1397|      0|            size_t const maxMlSize = MINMATCH + (ML_MASK-1) + (bytesLeftForMl * 255);
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
                          size_t const maxMlSize = MINMATCH + (ML_MASK-1) + (bytesLeftForMl * 255);
  ------------------
  |  |  262|      0|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|      0|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1398|      0|            assert(maxMlSize < INT_MAX); assert(m1.len >= 0);
  ------------------
  |  Branch (1398:13): [True: 0, False: 0]
  |  Branch (1398:13): [True: 0, False: 0]
  |  Branch (1398:42): [True: 0, False: 0]
  |  Branch (1398:42): [True: 0, False: 0]
  ------------------
 1399|      0|            if ((size_t)m1.len > maxMlSize) m1.len = (int)maxMlSize;
  ------------------
  |  Branch (1399:17): [True: 0, False: 0]
  ------------------
 1400|      0|            if ((oend + LASTLITERALS) - (op + ll_totalCost + 2) - 1 + m1.len >= MFLIMIT) {
  ------------------
  |  |  246|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          if ((oend + LASTLITERALS) - (op + ll_totalCost + 2) - 1 + m1.len >= MFLIMIT) {
  ------------------
  |  |  247|      0|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (1400:17): [True: 0, False: 0]
  ------------------
 1401|      0|                LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), m1.len, m1.off, notLimited, oend);
  ------------------
  |  |  230|      0|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
 1402|      0|        }   }
 1403|      0|        goto _last_literals;
 1404|      0|    }
 1405|       |    /* compression failed */
 1406|     70|    return 0;
 1407|     70|}
lz4hc.c:LZ4HC_InsertAndFindBestMatch:
 1144|  82.3M|{
 1145|  82.3M|    DEBUGLOG(7, "LZ4HC_InsertAndFindBestMatch");
  ------------------
  |  |  290|  82.3M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1146|       |    /* note : LZ4HC_InsertAndGetWiderMatch() is able to modify the starting position of a match (*startpos),
 1147|       |     * but this won't be the case here, as we define iLowLimit==ip,
 1148|       |     * so LZ4HC_InsertAndGetWiderMatch() won't be allowed to search past ip */
 1149|  82.3M|    return LZ4HC_InsertAndGetWiderMatch(hc4, ip, ip, iLimit, MINMATCH-1, maxNbAttempts, patternAnalysis, 0 /*chainSwap*/, dict, favorCompressionRatio);
  ------------------
  |  |  243|  82.3M|#define MINMATCH 4
  ------------------
 1150|  82.3M|}
lz4hc.c:LZ4HC_InsertAndGetWiderMatch:
  924|   171M|{
  925|   171M|    U16* const chainTable = hc4->chainTable;
  926|   171M|    U32* const hashTable = hc4->hashTable;
  927|   171M|    const LZ4HC_CCtx_internal* const dictCtx = hc4->dictCtx;
  928|   171M|    const BYTE* const prefixPtr = hc4->prefixStart;
  929|   171M|    const U32 prefixIdx = hc4->dictLimit;
  930|   171M|    const U32 ipIndex = (U32)(ip - prefixPtr) + prefixIdx;
  931|   171M|    const int withinStartDistance = (hc4->lowLimit + (LZ4_DISTANCE_MAX + 1) > ipIndex);
  ------------------
  |  |  676|   171M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  932|   171M|    const U32 lowestMatchIndex = (withinStartDistance) ? hc4->lowLimit : ipIndex - LZ4_DISTANCE_MAX;
  ------------------
  |  |  676|  92.4M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (932:34): [True: 78.6M, False: 92.4M]
  ------------------
  933|   171M|    const BYTE* const dictStart = hc4->dictStart;
  934|   171M|    const U32 dictIdx = hc4->lowLimit;
  935|   171M|    const BYTE* const dictEnd = dictStart + prefixIdx - dictIdx;
  936|   171M|    int const lookBackLength = (int)(ip-iLowLimit);
  937|   171M|    int nbAttempts = maxNbAttempts;
  938|   171M|    U32 matchChainPos = 0;
  939|   171M|    U32 const pattern = LZ4_read32(ip);
  940|   171M|    U32 matchIndex;
  941|   171M|    repeat_state_e repeat = rep_untested;
  942|   171M|    size_t srcPatternLength = 0;
  943|   171M|    int offset = 0, sBack = 0;
  944|       |
  945|   171M|    DEBUGLOG(7, "LZ4HC_InsertAndGetWiderMatch");
  ------------------
  |  |  290|   171M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  946|       |    /* First Match */
  947|   171M|    LZ4HC_Insert(hc4, ip);  /* insert all prior positions up to ip (excluded) */
  948|   171M|    matchIndex = hashTable[LZ4HC_hashPtr(ip)];
  949|   171M|    DEBUGLOG(7, "First candidate match for pos %u found at index %u / %u (lowestMatchIndex)",
  ------------------
  |  |  290|   171M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  950|   171M|                ipIndex, matchIndex, lowestMatchIndex);
  951|       |
  952|  1.85G|    while ((matchIndex>=lowestMatchIndex) && (nbAttempts>0)) {
  ------------------
  |  Branch (952:12): [True: 1.68G, False: 167M]
  |  Branch (952:46): [True: 1.68G, False: 3.47M]
  ------------------
  953|  1.68G|        int matchLength=0;
  954|  1.68G|        nbAttempts--;
  955|  1.68G|        assert(matchIndex < ipIndex);
  ------------------
  |  Branch (955:9): [True: 0, False: 1.68G]
  |  Branch (955:9): [True: 1.68G, False: 0]
  ------------------
  956|  1.68G|        if (favorDecSpeed && (ipIndex - matchIndex < 8)) {
  ------------------
  |  Branch (956:13): [True: 922M, False: 763M]
  |  Branch (956:30): [True: 1.24M, False: 921M]
  ------------------
  957|       |            /* do nothing:
  958|       |             * favorDecSpeed intentionally skips matches with offset < 8 */
  959|  1.68G|        } else if (matchIndex >= prefixIdx) {   /* within current Prefix */
  ------------------
  |  Branch (959:20): [True: 1.68G, False: 0]
  ------------------
  960|  1.68G|            const BYTE* const matchPtr = prefixPtr + (matchIndex - prefixIdx);
  961|  1.68G|            assert(matchPtr < ip);
  ------------------
  |  Branch (961:13): [True: 0, False: 1.68G]
  |  Branch (961:13): [True: 1.68G, False: 0]
  ------------------
  962|  1.68G|            assert(longest >= 1);
  ------------------
  |  Branch (962:13): [True: 0, False: 1.68G]
  |  Branch (962:13): [True: 1.68G, False: 0]
  ------------------
  963|  1.68G|            if (LZ4_read16(iLowLimit + longest - 1) == LZ4_read16(matchPtr - lookBackLength + longest - 1)) {
  ------------------
  |  Branch (963:17): [True: 186M, False: 1.49G]
  ------------------
  964|   186M|                if (LZ4_read32(matchPtr) == pattern) {
  ------------------
  |  Branch (964:21): [True: 152M, False: 34.0M]
  ------------------
  965|   152M|                    int const back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, prefixPtr) : 0;
  ------------------
  |  Branch (965:38): [True: 92.1M, False: 59.8M]
  ------------------
  966|   152M|                    matchLength = MINMATCH + (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
  ------------------
  |  |  243|   152M|#define MINMATCH 4
  ------------------
                                  matchLength = MINMATCH + (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
  ------------------
  |  |  243|   152M|#define MINMATCH 4
  ------------------
                                  matchLength = MINMATCH + (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
  ------------------
  |  |  243|   152M|#define MINMATCH 4
  ------------------
  967|   152M|                    matchLength -= back;
  968|   152M|                    if (matchLength > longest) {
  ------------------
  |  Branch (968:25): [True: 25.0M, False: 127M]
  ------------------
  969|  25.0M|                        longest = matchLength;
  970|  25.0M|                        offset = (int)(ipIndex - matchIndex);
  971|  25.0M|                        sBack = back;
  972|  25.0M|                        DEBUGLOG(7, "Found match of len=%i within prefix, offset=%i, back=%i", longest, offset, -back);
  ------------------
  |  |  290|  25.0M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  973|  25.0M|                        HEX_CMP(7, ip + back, ip + back - offset, (size_t)matchLength);
  974|  25.0M|            }   }   }
  975|  1.68G|        } else {   /* lowestMatchIndex <= matchIndex < dictLimit : within Ext Dict */
  976|      0|            const BYTE* const matchPtr = dictStart + (matchIndex - dictIdx);
  977|      0|            assert(matchIndex >= dictIdx);
  ------------------
  |  Branch (977:13): [True: 0, False: 0]
  |  Branch (977:13): [True: 0, False: 0]
  ------------------
  978|      0|            if ( likely(matchIndex <= prefixIdx - 4)
  ------------------
  |  |  178|      0|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  979|      0|              && (LZ4_read32(matchPtr) == pattern) ) {
  ------------------
  |  Branch (979:18): [True: 0, False: 0]
  ------------------
  980|      0|                int back = 0;
  981|      0|                const BYTE* vLimit = ip + (prefixIdx - matchIndex);
  982|      0|                if (vLimit > iHighLimit) vLimit = iHighLimit;
  ------------------
  |  Branch (982:21): [True: 0, False: 0]
  ------------------
  983|      0|                matchLength = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
                              matchLength = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
                              matchLength = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
  984|      0|                if ((ip+matchLength == vLimit) && (vLimit < iHighLimit))
  ------------------
  |  Branch (984:21): [True: 0, False: 0]
  |  Branch (984:51): [True: 0, False: 0]
  ------------------
  985|      0|                    matchLength += LZ4_count(ip+matchLength, prefixPtr, iHighLimit);
  986|      0|                back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, dictStart) : 0;
  ------------------
  |  Branch (986:24): [True: 0, False: 0]
  ------------------
  987|      0|                matchLength -= back;
  988|      0|                if (matchLength > longest) {
  ------------------
  |  Branch (988:21): [True: 0, False: 0]
  ------------------
  989|      0|                    longest = matchLength;
  990|      0|                    offset = (int)(ipIndex - matchIndex);
  991|      0|                    sBack = back;
  992|      0|                    DEBUGLOG(7, "Found match of len=%i within dict, offset=%i, back=%i", longest, offset, -back);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  993|      0|                    HEX_CMP(7, ip + back, matchPtr + back, (size_t)matchLength);
  994|      0|        }   }   }
  995|       |
  996|  1.68G|        if (chainSwap && matchLength==longest) {   /* better match => select a better chain */
  ------------------
  |  Branch (996:13): [True: 1.33G, False: 351M]
  |  Branch (996:26): [True: 15.3M, False: 1.31G]
  ------------------
  997|  15.3M|            assert(lookBackLength==0);   /* search forward only */
  ------------------
  |  Branch (997:13): [True: 0, False: 15.3M]
  |  Branch (997:13): [True: 15.3M, False: 0]
  ------------------
  998|  15.3M|            if (matchIndex + (U32)longest <= ipIndex) {
  ------------------
  |  Branch (998:17): [True: 14.8M, False: 424k]
  ------------------
  999|  14.8M|                int const kTrigger = 4;
 1000|  14.8M|                U32 distanceToNextMatch = 1;
 1001|  14.8M|                int const end = longest - MINMATCH + 1;
  ------------------
  |  |  243|  14.8M|#define MINMATCH 4
  ------------------
 1002|  14.8M|                int step = 1;
 1003|  14.8M|                int accel = 1 << kTrigger;
 1004|  14.8M|                int pos;
 1005|   304M|                for (pos = 0; pos < end; pos += step) {
  ------------------
  |  Branch (1005:31): [True: 289M, False: 14.8M]
  ------------------
 1006|   289M|                    U32 const candidateDist = DELTANEXTU16(chainTable, matchIndex + (U32)pos);
  ------------------
  |  |  228|   289M|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
 1007|   289M|                    step = (accel++ >> kTrigger);
 1008|   289M|                    if (candidateDist > distanceToNextMatch) {
  ------------------
  |  Branch (1008:25): [True: 19.3M, False: 270M]
  ------------------
 1009|  19.3M|                        distanceToNextMatch = candidateDist;
 1010|  19.3M|                        matchChainPos = (U32)pos;
 1011|  19.3M|                        accel = 1 << kTrigger;
 1012|  19.3M|                }   }
 1013|  14.8M|                if (distanceToNextMatch > 1) {
  ------------------
  |  Branch (1013:21): [True: 14.4M, False: 475k]
  ------------------
 1014|  14.4M|                    if (distanceToNextMatch > matchIndex) break;   /* avoid overflow */
  ------------------
  |  Branch (1014:25): [True: 0, False: 14.4M]
  ------------------
 1015|  14.4M|                    matchIndex -= distanceToNextMatch;
 1016|  14.4M|                    continue;
 1017|  14.4M|        }   }   }
 1018|       |
 1019|  1.67G|        {   U32 const distNextMatch = DELTANEXTU16(chainTable, matchIndex);
  ------------------
  |  |  228|  1.67G|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
 1020|  1.67G|            if (patternAnalysis && distNextMatch==1 && matchChainPos==0) {
  ------------------
  |  Branch (1020:17): [True: 1.46G, False: 201M]
  |  Branch (1020:36): [True: 437M, False: 1.03G]
  |  Branch (1020:56): [True: 258M, False: 178M]
  ------------------
 1021|   258M|                U32 const matchCandidateIdx = matchIndex-1;
 1022|       |                /* may be a repeated pattern */
 1023|   258M|                if (repeat == rep_untested) {
  ------------------
  |  Branch (1023:21): [True: 1.44M, False: 256M]
  ------------------
 1024|  1.44M|                    if ( ((pattern & 0xFFFF) == (pattern >> 16))
  ------------------
  |  Branch (1024:26): [True: 1.42M, False: 23.1k]
  ------------------
 1025|  1.44M|                      &  ((pattern & 0xFF)   == (pattern >> 24)) ) {
 1026|  1.42M|                        DEBUGLOG(7, "Repeat pattern detected, char %02X", pattern >> 24);
  ------------------
  |  |  290|  1.42M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1027|  1.42M|                        repeat = rep_confirmed;
 1028|  1.42M|                        srcPatternLength = LZ4HC_countPattern(ip+sizeof(pattern), iHighLimit, pattern) + sizeof(pattern);
 1029|  1.42M|                    } else {
 1030|  23.1k|                        repeat = rep_not;
 1031|  23.1k|                }   }
 1032|   258M|                if ( (repeat == rep_confirmed) && (matchCandidateIdx >= lowestMatchIndex)
  ------------------
  |  Branch (1032:22): [True: 253M, False: 5.29M]
  |  Branch (1032:51): [True: 253M, False: 2.99k]
  ------------------
 1033|   253M|                  && LZ4HC_protectDictEnd(prefixIdx, matchCandidateIdx) ) {
  ------------------
  |  Branch (1033:22): [True: 253M, False: 0]
  ------------------
 1034|   253M|                    const int extDict = matchCandidateIdx < prefixIdx;
 1035|   253M|                    const BYTE* const matchPtr = extDict ? dictStart + (matchCandidateIdx - dictIdx) : prefixPtr + (matchCandidateIdx - prefixIdx);
  ------------------
  |  Branch (1035:50): [True: 0, False: 253M]
  ------------------
 1036|   253M|                    if (LZ4_read32(matchPtr) == pattern) {  /* good candidate */
  ------------------
  |  Branch (1036:25): [True: 252M, False: 417k]
  ------------------
 1037|   252M|                        const BYTE* const iLimit = extDict ? dictEnd : iHighLimit;
  ------------------
  |  Branch (1037:52): [True: 0, False: 252M]
  ------------------
 1038|   252M|                        size_t forwardPatternLength = LZ4HC_countPattern(matchPtr+sizeof(pattern), iLimit, pattern) + sizeof(pattern);
 1039|   252M|                        if (extDict && matchPtr + forwardPatternLength == iLimit) {
  ------------------
  |  Branch (1039:29): [True: 0, False: 252M]
  |  Branch (1039:40): [True: 0, False: 0]
  ------------------
 1040|      0|                            U32 const rotatedPattern = LZ4HC_rotatePattern(forwardPatternLength, pattern);
 1041|      0|                            forwardPatternLength += LZ4HC_countPattern(prefixPtr, iHighLimit, rotatedPattern);
 1042|      0|                        }
 1043|   252M|                        {   const BYTE* const lowestMatchPtr = extDict ? dictStart : prefixPtr;
  ------------------
  |  Branch (1043:64): [True: 0, False: 252M]
  ------------------
 1044|   252M|                            size_t backLength = LZ4HC_reverseCountPattern(matchPtr, lowestMatchPtr, pattern);
 1045|   252M|                            size_t currentSegmentLength;
 1046|   252M|                            if (!extDict
  ------------------
  |  Branch (1046:33): [True: 252M, False: 0]
  ------------------
 1047|   252M|                              && matchPtr - backLength == prefixPtr
  ------------------
  |  Branch (1047:34): [True: 88.3k, False: 252M]
  ------------------
 1048|  88.3k|                              && dictIdx < prefixIdx) {
  ------------------
  |  Branch (1048:34): [True: 0, False: 88.3k]
  ------------------
 1049|      0|                                U32 const rotatedPattern = LZ4HC_rotatePattern((U32)(-(int)backLength), pattern);
 1050|      0|                                backLength += LZ4HC_reverseCountPattern(dictEnd, dictStart, rotatedPattern);
 1051|      0|                            }
 1052|       |                            /* Limit backLength not go further than lowestMatchIndex */
 1053|   252M|                            backLength = matchCandidateIdx - MAX(matchCandidateIdx - (U32)backLength, lowestMatchIndex);
  ------------------
  |  |   82|   252M|#define MAX(a,b)   ( (a) > (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (82:22): [True: 252M, False: 125k]
  |  |  ------------------
  ------------------
 1054|   252M|                            assert(matchCandidateIdx - backLength >= lowestMatchIndex);
  ------------------
  |  Branch (1054:29): [True: 0, False: 252M]
  |  Branch (1054:29): [True: 252M, False: 0]
  ------------------
 1055|   252M|                            currentSegmentLength = backLength + forwardPatternLength;
 1056|       |                            /* Adjust to end of pattern if the source pattern fits, otherwise the beginning of the pattern */
 1057|   252M|                            if ( (currentSegmentLength >= srcPatternLength)   /* current pattern segment large enough to contain full srcPatternLength */
  ------------------
  |  Branch (1057:34): [True: 175M, False: 76.9M]
  ------------------
 1058|   175M|                              && (forwardPatternLength <= srcPatternLength) ) { /* haven't reached this position yet */
  ------------------
  |  Branch (1058:34): [True: 86.3M, False: 89.3M]
  ------------------
 1059|  86.3M|                                U32 const newMatchIndex = matchCandidateIdx + (U32)forwardPatternLength - (U32)srcPatternLength;  /* best position, full pattern, might be followed by more match */
 1060|  86.3M|                                if (LZ4HC_protectDictEnd(prefixIdx, newMatchIndex))
  ------------------
  |  Branch (1060:37): [True: 86.3M, False: 0]
  ------------------
 1061|  86.3M|                                    matchIndex = newMatchIndex;
 1062|      0|                                else {
 1063|       |                                    /* Can only happen if started in the prefix */
 1064|      0|                                    assert(newMatchIndex >= prefixIdx - 3 && newMatchIndex < prefixIdx && !extDict);
  ------------------
  |  Branch (1064:37): [True: 0, False: 0]
  |  Branch (1064:37): [True: 0, False: 0]
  |  Branch (1064:37): [True: 0, False: 0]
  |  Branch (1064:37): [True: 0, False: 0]
  |  Branch (1064:37): [True: 0, False: 0]
  |  Branch (1064:37): [True: 0, False: 0]
  ------------------
 1065|      0|                                    matchIndex = prefixIdx;
 1066|      0|                                }
 1067|   166M|                            } else {
 1068|   166M|                                U32 const newMatchIndex = matchCandidateIdx - (U32)backLength;   /* farthest position in current segment, will find a match of length currentSegmentLength + maybe some back */
 1069|   166M|                                if (!LZ4HC_protectDictEnd(prefixIdx, newMatchIndex)) {
  ------------------
  |  Branch (1069:37): [True: 0, False: 166M]
  ------------------
 1070|      0|                                    assert(newMatchIndex >= prefixIdx - 3 && newMatchIndex < prefixIdx && !extDict);
  ------------------
  |  Branch (1070:37): [True: 0, False: 0]
  |  Branch (1070:37): [True: 0, False: 0]
  |  Branch (1070:37): [True: 0, False: 0]
  |  Branch (1070:37): [True: 0, False: 0]
  |  Branch (1070:37): [True: 0, False: 0]
  |  Branch (1070:37): [True: 0, False: 0]
  ------------------
 1071|      0|                                    matchIndex = prefixIdx;
 1072|   166M|                                } else {
 1073|   166M|                                    matchIndex = newMatchIndex;
 1074|   166M|                                    if (lookBackLength==0) {  /* no back possible */
  ------------------
  |  Branch (1074:41): [True: 161M, False: 5.25M]
  ------------------
 1075|   161M|                                        size_t const maxML = MIN(currentSegmentLength, srcPatternLength);
  ------------------
  |  |   81|   161M|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (81:22): [True: 75.1M, False: 85.9M]
  |  |  ------------------
  ------------------
 1076|   161M|                                        if ((size_t)longest < maxML) {
  ------------------
  |  Branch (1076:45): [True: 593k, False: 160M]
  ------------------
 1077|   593k|                                            assert(prefixPtr - prefixIdx + matchIndex != ip);
  ------------------
  |  Branch (1077:45): [True: 0, False: 593k]
  |  Branch (1077:45): [True: 593k, False: 0]
  ------------------
 1078|   593k|                                            if ((size_t)(ip - prefixPtr) + prefixIdx - matchIndex > LZ4_DISTANCE_MAX) break;
  ------------------
  |  |  676|   593k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1078:49): [True: 0, False: 593k]
  ------------------
 1079|   593k|                                            assert(maxML < 2 GB);
  ------------------
  |  Branch (1079:45): [True: 0, False: 593k]
  |  Branch (1079:45): [True: 593k, False: 0]
  ------------------
 1080|   593k|                                            longest = (int)maxML;
 1081|   593k|                                            offset = (int)(ipIndex - matchIndex);
 1082|   593k|                                            assert(sBack == 0);
  ------------------
  |  Branch (1082:45): [True: 0, False: 593k]
  |  Branch (1082:45): [True: 593k, False: 0]
  ------------------
 1083|   593k|                                            DEBUGLOG(7, "Found repeat pattern match of len=%i, offset=%i", longest, offset);
  ------------------
  |  |  290|   593k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1084|   593k|                                        }
 1085|   161M|                                        {   U32 const distToNextPattern = DELTANEXTU16(chainTable, matchIndex);
  ------------------
  |  |  228|   161M|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
 1086|   161M|                                            if (distToNextPattern > matchIndex) break;  /* avoid overflow */
  ------------------
  |  Branch (1086:49): [True: 0, False: 161M]
  ------------------
 1087|   161M|                                            matchIndex -= distToNextPattern;
 1088|   161M|                        }   }   }   }   }
 1089|   252M|                        continue;
 1090|   252M|                }   }
 1091|   258M|        }   }   /* PA optimization */
 1092|       |
 1093|       |        /* follow current chain */
 1094|  1.41G|        matchIndex -= DELTANEXTU16(chainTable, matchIndex + matchChainPos);
  ------------------
  |  |  228|  1.41G|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
 1095|       |
 1096|  1.41G|    }  /* while ((matchIndex>=lowestMatchIndex) && (nbAttempts)) */
 1097|       |
 1098|   171M|    if ( dict == usingDictCtxHc
  ------------------
  |  Branch (1098:10): [True: 0, False: 171M]
  ------------------
 1099|      0|      && nbAttempts > 0
  ------------------
  |  Branch (1099:10): [True: 0, False: 0]
  ------------------
 1100|      0|      && withinStartDistance) {
  ------------------
  |  Branch (1100:10): [True: 0, False: 0]
  ------------------
 1101|      0|        size_t const dictEndOffset = (size_t)(dictCtx->end - dictCtx->prefixStart) + dictCtx->dictLimit;
 1102|      0|        U32 dictMatchIndex = dictCtx->hashTable[LZ4HC_hashPtr(ip)];
 1103|      0|        assert(dictEndOffset <= 1 GB);
  ------------------
  |  Branch (1103:9): [True: 0, False: 0]
  |  Branch (1103:9): [True: 0, False: 0]
  ------------------
 1104|      0|        matchIndex = dictMatchIndex + lowestMatchIndex - (U32)dictEndOffset;
 1105|      0|        if (dictMatchIndex>0) DEBUGLOG(7, "dictEndOffset = %zu, dictMatchIndex = %u => relative matchIndex = %i", dictEndOffset, dictMatchIndex, (int)dictMatchIndex - (int)dictEndOffset);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  |  Branch (1105:13): [True: 0, False: 0]
  ------------------
 1106|      0|        while (ipIndex - matchIndex <= LZ4_DISTANCE_MAX && nbAttempts--) {
  ------------------
  |  |  676|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1106:16): [True: 0, False: 0]
  |  Branch (1106:60): [True: 0, False: 0]
  ------------------
 1107|      0|            const BYTE* const matchPtr = dictCtx->prefixStart - dictCtx->dictLimit + dictMatchIndex;
 1108|       |
 1109|      0|            if (LZ4_read32(matchPtr) == pattern) {
  ------------------
  |  Branch (1109:17): [True: 0, False: 0]
  ------------------
 1110|      0|                int mlt;
 1111|      0|                int back = 0;
 1112|      0|                const BYTE* vLimit = ip + (dictEndOffset - dictMatchIndex);
 1113|      0|                if (vLimit > iHighLimit) vLimit = iHighLimit;
  ------------------
  |  Branch (1113:21): [True: 0, False: 0]
  ------------------
 1114|      0|                mlt = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
                              mlt = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
                              mlt = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
 1115|      0|                back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, dictCtx->prefixStart) : 0;
  ------------------
  |  Branch (1115:24): [True: 0, False: 0]
  ------------------
 1116|      0|                mlt -= back;
 1117|      0|                if (mlt > longest) {
  ------------------
  |  Branch (1117:21): [True: 0, False: 0]
  ------------------
 1118|      0|                    longest = mlt;
 1119|      0|                    offset = (int)(ipIndex - matchIndex);
 1120|      0|                    sBack = back;
 1121|      0|                    DEBUGLOG(7, "found match of length %i within extDictCtx", longest);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1122|      0|            }   }
 1123|       |
 1124|      0|            {   U32 const nextOffset = DELTANEXTU16(dictCtx->chainTable, dictMatchIndex);
  ------------------
  |  |  228|      0|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
 1125|      0|                dictMatchIndex -= nextOffset;
 1126|      0|                matchIndex -= nextOffset;
 1127|      0|    }   }   }
 1128|       |
 1129|   171M|    {   LZ4HC_match_t md;
 1130|   171M|        assert(longest >= 0);
  ------------------
  |  Branch (1130:9): [True: 0, False: 171M]
  |  Branch (1130:9): [True: 171M, False: 0]
  ------------------
 1131|   171M|        md.len = longest;
 1132|   171M|        md.off = offset;
 1133|   171M|        md.back = sBack;
 1134|   171M|        return md;
 1135|   171M|    }
 1136|   171M|}
lz4hc.c:LZ4HC_countPattern:
  852|   254M|{
  853|   254M|    const BYTE* const iStart = ip;
  854|   254M|    reg_t const pattern = (sizeof(pattern)==8) ?
  ------------------
  |  Branch (854:27): [True: 254M, Folded]
  ------------------
  855|   254M|        (reg_t)pattern32 + (((reg_t)pattern32) << (sizeof(pattern)*4)) : pattern32;
  856|       |
  857|   357M|    while (likely(ip < iEnd-(sizeof(pattern)-1))) {
  858|   357M|        reg_t const diff = LZ4_read_ARCH(ip) ^ pattern;
  859|   357M|        if (!diff) { ip+=sizeof(pattern); continue; }
  ------------------
  |  Branch (859:13): [True: 103M, False: 254M]
  ------------------
  860|   254M|        ip += LZ4_NbCommonBytes(diff);
  861|   254M|        return (unsigned)(ip - iStart);
  862|   357M|    }
  863|       |
  864|  15.5k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (864:9): [True: 15.5k, False: 0]
  ------------------
  865|  15.5k|        reg_t patternByte = pattern;
  866|  64.1k|        while ((ip<iEnd) && (*ip == (BYTE)patternByte)) {
  ------------------
  |  Branch (866:16): [True: 53.6k, False: 10.5k]
  |  Branch (866:29): [True: 48.6k, False: 5.00k]
  ------------------
  867|  48.6k|            ip++; patternByte >>= 8;
  868|  48.6k|        }
  869|  15.5k|    } else {  /* big endian */
  870|      0|        U32 bitOffset = (sizeof(pattern)*8) - 8;
  871|      0|        while (ip < iEnd) {
  ------------------
  |  Branch (871:16): [True: 0, False: 0]
  ------------------
  872|      0|            BYTE const byte = (BYTE)(pattern >> bitOffset);
  873|      0|            if (*ip != byte) break;
  ------------------
  |  Branch (873:17): [True: 0, False: 0]
  ------------------
  874|      0|            ip ++; bitOffset -= 8;
  875|      0|    }   }
  876|       |
  877|  15.5k|    return (unsigned)(ip - iStart);
  878|   254M|}
lz4hc.c:LZ4HC_protectDictEnd:
  906|   505M|{
  907|   505M|    return ((U32)((dictLimit - 1) - matchIndex) >= 3);
  908|   505M|}
lz4hc.c:LZ4HC_reverseCountPattern:
  885|   252M|{
  886|   252M|    const BYTE* const iStart = ip;
  887|       |
  888|  1.84G|    while (likely(ip >= iLow+4)) {
  889|  1.84G|        if (LZ4_read32(ip-4) != pattern) break;
  ------------------
  |  Branch (889:13): [True: 252M, False: 1.59G]
  ------------------
  890|  1.59G|        ip -= 4;
  891|  1.59G|    }
  892|   252M|    {   const BYTE* bytePtr = (const BYTE*)(&pattern) + 3; /* works for any endianness */
  893|   570M|        while (likely(ip>iLow)) {
  894|   570M|            if (ip[-1] != *bytePtr) break;
  ------------------
  |  Branch (894:17): [True: 252M, False: 317M]
  ------------------
  895|   317M|            ip--; bytePtr--;
  896|   317M|    }   }
  897|   252M|    return (unsigned)(iStart - ip);
  898|   252M|}
lz4hc.c:LZ4HC_compress_optimal:
 1890|  6.04k|{
 1891|  6.04k|    int retval = 0;
 1892|  6.04k|#define TRAILING_LITERALS 3
 1893|  6.04k|#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1
 1894|  6.04k|    LZ4HC_optimal_t* const opt = (LZ4HC_optimal_t*)ALLOC(sizeof(LZ4HC_optimal_t) * (LZ4_OPT_NUM + TRAILING_LITERALS));
  ------------------
  |  |  226|  6.04k|# define ALLOC(s)          malloc(s)
  ------------------
 1895|       |#else
 1896|       |    LZ4HC_optimal_t opt[LZ4_OPT_NUM + TRAILING_LITERALS];   /* ~64 KB, which can be a bit large for some stacks... */
 1897|       |#endif
 1898|       |
 1899|  6.04k|    const BYTE* ip = (const BYTE*) source;
 1900|  6.04k|    const BYTE* anchor = ip;
 1901|  6.04k|    const BYTE* const iend = ip + *srcSizePtr;
 1902|  6.04k|    const BYTE* const mflimit = iend - MFLIMIT;
  ------------------
  |  |  247|  6.04k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1903|  6.04k|    const BYTE* const matchlimit = iend - LASTLITERALS;
  ------------------
  |  |  246|  6.04k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1904|  6.04k|    BYTE* op = (BYTE*) dst;
 1905|  6.04k|    BYTE* opSaved = (BYTE*) dst;
 1906|  6.04k|    BYTE* oend = op + dstCapacity;
 1907|  6.04k|    int ovml = MINMATCH;  /* overflow - last sequence */
  ------------------
  |  |  243|  6.04k|#define MINMATCH 4
  ------------------
 1908|  6.04k|    int ovoff = 0;
 1909|       |
 1910|       |    /* init */
 1911|  6.04k|    DEBUGLOG(5, "LZ4HC_compress_optimal(dst=%p, dstCapa=%u)", dst, (unsigned)dstCapacity);
  ------------------
  |  |  290|  6.04k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1912|  6.04k|#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1
 1913|  6.04k|    if (opt == NULL) goto _return_label;
  ------------------
  |  Branch (1913:9): [True: 0, False: 6.04k]
  ------------------
 1914|  6.04k|#endif
 1915|       |
 1916|       |    /* preconditions verifications */
 1917|  6.04k|    assert(dstCapacity > 0);
  ------------------
  |  Branch (1917:5): [True: 0, False: 6.04k]
  |  Branch (1917:5): [True: 6.04k, False: 0]
  ------------------
 1918|  6.04k|    assert(dst != NULL);
  ------------------
  |  Branch (1918:5): [True: 0, False: 6.04k]
  |  Branch (1918:5): [True: 6.04k, False: 0]
  ------------------
 1919|  6.04k|    assert(*srcSizePtr > 0);
  ------------------
  |  Branch (1919:5): [True: 0, False: 6.04k]
  |  Branch (1919:5): [True: 6.04k, False: 0]
  ------------------
 1920|  6.04k|    assert(source != NULL);
  ------------------
  |  Branch (1920:5): [True: 0, False: 6.04k]
  |  Branch (1920:5): [True: 6.04k, False: 0]
  ------------------
 1921|       |
 1922|  6.04k|    *srcSizePtr = 0;
 1923|  6.04k|    if (limit == fillOutput) oend -= LASTLITERALS;   /* Hack for support LZ4 format restriction */
  ------------------
  |  |  246|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (1923:9): [True: 0, False: 6.04k]
  ------------------
 1924|  6.04k|    if (sufficient_len >= LZ4_OPT_NUM) sufficient_len = LZ4_OPT_NUM-1;
  ------------------
  |  |   77|  6.04k|#define LZ4_OPT_NUM   (1<<12)
  ------------------
                  if (sufficient_len >= LZ4_OPT_NUM) sufficient_len = LZ4_OPT_NUM-1;
  ------------------
  |  |   77|  3.29k|#define LZ4_OPT_NUM   (1<<12)
  ------------------
  |  Branch (1924:9): [True: 3.29k, False: 2.74k]
  ------------------
 1925|       |
 1926|       |    /* Main Loop */
 1927|  67.2M|    while (ip <= mflimit) {
  ------------------
  |  Branch (1927:12): [True: 67.2M, False: 5.92k]
  ------------------
 1928|  67.2M|         int const llen = (int)(ip - anchor);
 1929|  67.2M|         int best_mlen, best_off;
 1930|  67.2M|         int cur, last_match_pos = 0;
 1931|       |
 1932|  67.2M|         LZ4HC_match_t const firstMatch = LZ4HC_FindLongerMatch(ctx, ip, matchlimit, MINMATCH-1, nbSearches, dict, favorDecSpeed);
  ------------------
  |  |  243|  67.2M|#define MINMATCH 4
  ------------------
 1933|  67.2M|         if (firstMatch.len==0) { ip++; continue; }
  ------------------
  |  Branch (1933:14): [True: 64.7M, False: 2.56M]
  ------------------
 1934|       |
 1935|  2.56M|         if ((size_t)firstMatch.len > sufficient_len) {
  ------------------
  |  Branch (1935:14): [True: 38.9k, False: 2.52M]
  ------------------
 1936|       |             /* good enough solution : immediate encoding */
 1937|  38.9k|             int const firstML = firstMatch.len;
 1938|  38.9k|             opSaved = op;
 1939|  38.9k|             if ( LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), firstML, firstMatch.off, limit, oend) ) {  /* updates ip, op and anchor */
  ------------------
  |  |  230|  38.9k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1939:19): [True: 20, False: 38.8k]
  ------------------
 1940|     20|                 ovml = firstML;
 1941|     20|                 ovoff = firstMatch.off;
 1942|     20|                 goto _dest_overflow;
 1943|     20|             }
 1944|  38.8k|             continue;
 1945|  38.9k|         }
 1946|       |
 1947|       |         /* set prices for first positions (literals) */
 1948|  2.52M|         {   int rPos;
 1949|  12.6M|             for (rPos = 0 ; rPos < MINMATCH ; rPos++) {
  ------------------
  |  |  243|  12.6M|#define MINMATCH 4
  ------------------
  |  Branch (1949:30): [True: 10.1M, False: 2.52M]
  ------------------
 1950|  10.1M|                 int const cost = LZ4HC_literalsPrice(llen + rPos);
 1951|  10.1M|                 opt[rPos].mlen = 1;
 1952|  10.1M|                 opt[rPos].off = 0;
 1953|  10.1M|                 opt[rPos].litlen = llen + rPos;
 1954|  10.1M|                 opt[rPos].price = cost;
 1955|  10.1M|                 DEBUGLOG(7, "rPos:%3i => price:%3i (litlen=%i) -- initial setup",
  ------------------
  |  |  290|  10.1M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1956|  10.1M|                             rPos, cost, opt[rPos].litlen);
 1957|  10.1M|         }   }
 1958|       |         /* set prices using initial match */
 1959|  2.52M|         {   int const matchML = firstMatch.len;   /* necessarily < sufficient_len < LZ4_OPT_NUM */
 1960|  2.52M|             int const offset = firstMatch.off;
 1961|  2.52M|             int mlen;
 1962|  2.52M|             assert(matchML < LZ4_OPT_NUM);
  ------------------
  |  Branch (1962:14): [True: 0, False: 2.52M]
  |  Branch (1962:14): [True: 2.52M, False: 0]
  ------------------
 1963|  23.6M|             for (mlen = MINMATCH ; mlen <= matchML ; mlen++) {
  ------------------
  |  |  243|  2.52M|#define MINMATCH 4
  ------------------
  |  Branch (1963:37): [True: 21.0M, False: 2.52M]
  ------------------
 1964|  21.0M|                 int const cost = LZ4HC_sequencePrice(llen, mlen);
 1965|  21.0M|                 opt[mlen].mlen = mlen;
 1966|  21.0M|                 opt[mlen].off = offset;
 1967|  21.0M|                 opt[mlen].litlen = llen;
 1968|  21.0M|                 opt[mlen].price = cost;
 1969|  21.0M|                 DEBUGLOG(7, "rPos:%3i => price:%3i (matchlen=%i) -- initial setup",
  ------------------
  |  |  290|  21.0M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1970|  21.0M|                             mlen, cost, mlen);
 1971|  21.0M|         }   }
 1972|  2.52M|         last_match_pos = firstMatch.len;
 1973|  2.52M|         {   int addLit;
 1974|  10.1M|             for (addLit = 1; addLit <= TRAILING_LITERALS; addLit ++) {
  ------------------
  |  | 1892|  10.1M|#define TRAILING_LITERALS 3
  ------------------
  |  Branch (1974:31): [True: 7.58M, False: 2.52M]
  ------------------
 1975|  7.58M|                 opt[last_match_pos+addLit].mlen = 1; /* literal */
 1976|  7.58M|                 opt[last_match_pos+addLit].off = 0;
 1977|  7.58M|                 opt[last_match_pos+addLit].litlen = addLit;
 1978|  7.58M|                 opt[last_match_pos+addLit].price = opt[last_match_pos].price + LZ4HC_literalsPrice(addLit);
 1979|  7.58M|                 DEBUGLOG(7, "rPos:%3i => price:%3i (litlen=%i) -- initial setup",
  ------------------
  |  |  290|  7.58M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1980|  7.58M|                             last_match_pos+addLit, opt[last_match_pos+addLit].price, addLit);
 1981|  7.58M|         }   }
 1982|       |
 1983|       |         /* check further positions */
 1984|  53.1M|         for (cur = 1; cur < last_match_pos; cur++) {
  ------------------
  |  Branch (1984:24): [True: 50.6M, False: 2.51M]
  ------------------
 1985|  50.6M|             const BYTE* const curPtr = ip + cur;
 1986|  50.6M|             LZ4HC_match_t newMatch;
 1987|       |
 1988|  50.6M|             if (curPtr > mflimit) break;
  ------------------
  |  Branch (1988:18): [True: 3.48k, False: 50.6M]
  ------------------
 1989|  50.6M|             DEBUGLOG(7, "rPos:%u[%u] vs [%u]%u",
  ------------------
  |  |  290|  50.6M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1990|  50.6M|                     cur, opt[cur].price, opt[cur+1].price, cur+1);
 1991|  50.6M|             if (fullUpdate) {
  ------------------
  |  Branch (1991:18): [True: 38.3M, False: 12.3M]
  ------------------
 1992|       |                 /* not useful to search here if next position has same (or lower) cost */
 1993|  38.3M|                 if ( (opt[cur+1].price <= opt[cur].price)
  ------------------
  |  Branch (1993:23): [True: 30.6M, False: 7.72M]
  ------------------
 1994|       |                   /* in some cases, next position has same cost, but cost rises sharply after, so a small match would still be beneficial */
 1995|  30.6M|                   && (opt[cur+MINMATCH].price < opt[cur].price + 3/*min seq price*/) )
  ------------------
  |  |  243|  30.6M|#define MINMATCH 4
  ------------------
  |  Branch (1995:23): [True: 28.1M, False: 2.49M]
  ------------------
 1996|  28.1M|                     continue;
 1997|  38.3M|             } else {
 1998|       |                 /* not useful to search here if next position has same (or lower) cost */
 1999|  12.3M|                 if (opt[cur+1].price <= opt[cur].price) continue;
  ------------------
  |  Branch (1999:22): [True: 8.24M, False: 4.10M]
  ------------------
 2000|  12.3M|             }
 2001|       |
 2002|  14.3M|             DEBUGLOG(7, "search at rPos:%u", cur);
  ------------------
  |  |  290|  14.3M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2003|  14.3M|             if (fullUpdate)
  ------------------
  |  Branch (2003:18): [True: 10.2M, False: 4.10M]
  ------------------
 2004|  10.2M|                 newMatch = LZ4HC_FindLongerMatch(ctx, curPtr, matchlimit, MINMATCH-1, nbSearches, dict, favorDecSpeed);
  ------------------
  |  |  243|  10.2M|#define MINMATCH 4
  ------------------
 2005|  4.10M|             else
 2006|       |                 /* only test matches of minimum length; slightly faster, but misses a few bytes */
 2007|  4.10M|                 newMatch = LZ4HC_FindLongerMatch(ctx, curPtr, matchlimit, last_match_pos - cur, nbSearches, dict, favorDecSpeed);
 2008|  14.3M|             if (!newMatch.len) continue;
  ------------------
  |  Branch (2008:18): [True: 7.34M, False: 6.97M]
  ------------------
 2009|       |
 2010|  6.97M|             if ( ((size_t)newMatch.len > sufficient_len)
  ------------------
  |  Branch (2010:19): [True: 7.20k, False: 6.97M]
  ------------------
 2011|  6.97M|               || (newMatch.len + cur >= LZ4_OPT_NUM) ) {
  ------------------
  |  |   77|  6.97M|#define LZ4_OPT_NUM   (1<<12)
  ------------------
  |  Branch (2011:19): [True: 960, False: 6.96M]
  ------------------
 2012|       |                 /* immediate encoding */
 2013|  8.16k|                 best_mlen = newMatch.len;
 2014|  8.16k|                 best_off = newMatch.off;
 2015|  8.16k|                 last_match_pos = cur + 1;
 2016|  8.16k|                 goto encode;
 2017|  8.16k|             }
 2018|       |
 2019|       |             /* before match : set price with literals at beginning */
 2020|  6.96M|             {   int const baseLitlen = opt[cur].litlen;
 2021|  6.96M|                 int litlen;
 2022|  27.8M|                 for (litlen = 1; litlen < MINMATCH; litlen++) {
  ------------------
  |  |  243|  27.8M|#define MINMATCH 4
  ------------------
  |  Branch (2022:35): [True: 20.9M, False: 6.96M]
  ------------------
 2023|  20.9M|                     int const price = opt[cur].price - LZ4HC_literalsPrice(baseLitlen) + LZ4HC_literalsPrice(baseLitlen+litlen);
 2024|  20.9M|                     int const pos = cur + litlen;
 2025|  20.9M|                     if (price < opt[pos].price) {
  ------------------
  |  Branch (2025:26): [True: 0, False: 20.9M]
  ------------------
 2026|      0|                         opt[pos].mlen = 1; /* literal */
 2027|      0|                         opt[pos].off = 0;
 2028|      0|                         opt[pos].litlen = baseLitlen+litlen;
 2029|      0|                         opt[pos].price = price;
 2030|      0|                         DEBUGLOG(7, "rPos:%3i => price:%3i (litlen=%i)",
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2031|      0|                                     pos, price, opt[pos].litlen);
 2032|      0|             }   }   }
 2033|       |
 2034|       |             /* set prices using match at position = cur */
 2035|  6.96M|             {   int const matchML = newMatch.len;
 2036|  6.96M|                 int ml = MINMATCH;
  ------------------
  |  |  243|  6.96M|#define MINMATCH 4
  ------------------
 2037|       |
 2038|  6.96M|                 assert(cur + newMatch.len < LZ4_OPT_NUM);
  ------------------
  |  Branch (2038:18): [True: 0, False: 6.96M]
  |  Branch (2038:18): [True: 6.96M, False: 0]
  ------------------
 2039|   154M|                 for ( ; ml <= matchML ; ml++) {
  ------------------
  |  Branch (2039:26): [True: 147M, False: 6.96M]
  ------------------
 2040|   147M|                     int const pos = cur + ml;
 2041|   147M|                     int const offset = newMatch.off;
 2042|   147M|                     int price;
 2043|   147M|                     int ll;
 2044|   147M|                     DEBUGLOG(7, "testing price rPos %i (last_match_pos=%i)",
  ------------------
  |  |  290|   147M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2045|   147M|                                 pos, last_match_pos);
 2046|   147M|                     if (opt[cur].mlen == 1) {
  ------------------
  |  Branch (2046:26): [True: 59.9M, False: 87.9M]
  ------------------
 2047|  59.9M|                         ll = opt[cur].litlen;
 2048|  59.9M|                         price = ((cur > ll) ? opt[cur - ll].price : 0)
  ------------------
  |  Branch (2048:35): [True: 25.8M, False: 34.0M]
  ------------------
 2049|  59.9M|                               + LZ4HC_sequencePrice(ll, ml);
 2050|  87.9M|                     } else {
 2051|  87.9M|                         ll = 0;
 2052|  87.9M|                         price = opt[cur].price + LZ4HC_sequencePrice(0, ml);
 2053|  87.9M|                     }
 2054|       |
 2055|   147M|                    assert((U32)favorDecSpeed <= 1);
  ------------------
  |  Branch (2055:21): [True: 0, False: 147M]
  |  Branch (2055:21): [True: 147M, False: 0]
  ------------------
 2056|   147M|                     if (pos > last_match_pos+TRAILING_LITERALS
  ------------------
  |  | 1892|   295M|#define TRAILING_LITERALS 3
  ------------------
  |  Branch (2056:26): [True: 17.3M, False: 130M]
  ------------------
 2057|   130M|                      || price <= opt[pos].price - (int)favorDecSpeed) {
  ------------------
  |  Branch (2057:26): [True: 7.60M, False: 122M]
  ------------------
 2058|  24.9M|                         DEBUGLOG(7, "rPos:%3i => price:%3i (matchlen=%i)",
  ------------------
  |  |  290|  24.9M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2059|  24.9M|                                     pos, price, ml);
 2060|  24.9M|                         assert(pos < LZ4_OPT_NUM);
  ------------------
  |  Branch (2060:26): [True: 0, False: 24.9M]
  |  Branch (2060:26): [True: 24.9M, False: 0]
  ------------------
 2061|  24.9M|                         if ( (ml == matchML)  /* last pos of last match */
  ------------------
  |  Branch (2061:31): [True: 3.72M, False: 21.1M]
  ------------------
 2062|  3.72M|                           && (last_match_pos < pos) )
  ------------------
  |  Branch (2062:31): [True: 2.92M, False: 803k]
  ------------------
 2063|  2.92M|                             last_match_pos = pos;
 2064|  24.9M|                         opt[pos].mlen = ml;
 2065|  24.9M|                         opt[pos].off = offset;
 2066|  24.9M|                         opt[pos].litlen = ll;
 2067|  24.9M|                         opt[pos].price = price;
 2068|  24.9M|             }   }   }
 2069|       |             /* complete following positions with literals */
 2070|  6.96M|             {   int addLit;
 2071|  27.8M|                 for (addLit = 1; addLit <= TRAILING_LITERALS; addLit ++) {
  ------------------
  |  | 1892|  27.8M|#define TRAILING_LITERALS 3
  ------------------
  |  Branch (2071:35): [True: 20.9M, False: 6.96M]
  ------------------
 2072|  20.9M|                     opt[last_match_pos+addLit].mlen = 1; /* literal */
 2073|  20.9M|                     opt[last_match_pos+addLit].off = 0;
 2074|  20.9M|                     opt[last_match_pos+addLit].litlen = addLit;
 2075|  20.9M|                     opt[last_match_pos+addLit].price = opt[last_match_pos].price + LZ4HC_literalsPrice(addLit);
 2076|  20.9M|                     DEBUGLOG(7, "rPos:%3i => price:%3i (litlen=%i)", last_match_pos+addLit, opt[last_match_pos+addLit].price, addLit);
  ------------------
  |  |  290|  20.9M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2077|  20.9M|             }   }
 2078|  6.96M|         }  /* for (cur = 1; cur <= last_match_pos; cur++) */
 2079|       |
 2080|  2.52M|         assert(last_match_pos < LZ4_OPT_NUM + TRAILING_LITERALS);
  ------------------
  |  Branch (2080:10): [True: 0, False: 2.51M]
  |  Branch (2080:10): [True: 2.51M, False: 0]
  ------------------
 2081|  2.51M|         best_mlen = opt[last_match_pos].mlen;
 2082|  2.51M|         best_off = opt[last_match_pos].off;
 2083|  2.51M|         cur = last_match_pos - best_mlen;
 2084|       |
 2085|  2.52M|encode: /* cur, last_match_pos, best_mlen, best_off must be set */
 2086|  2.52M|         assert(cur < LZ4_OPT_NUM);
  ------------------
  |  Branch (2086:10): [True: 0, False: 2.52M]
  |  Branch (2086:10): [True: 2.52M, False: 0]
  ------------------
 2087|  2.52M|         assert(last_match_pos >= 1);  /* == 1 when only one candidate */
  ------------------
  |  Branch (2087:10): [True: 0, False: 2.52M]
  |  Branch (2087:10): [True: 2.52M, False: 0]
  ------------------
 2088|  2.52M|         DEBUGLOG(6, "reverse traversal, looking for shortest path (last_match_pos=%i)", last_match_pos);
  ------------------
  |  |  290|  2.52M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2089|  2.52M|         {   int candidate_pos = cur;
 2090|  2.52M|             int selected_matchLength = best_mlen;
 2091|  2.52M|             int selected_offset = best_off;
 2092|  5.66M|             while (1) {  /* from end to beginning */
  ------------------
  |  Branch (2092:21): [True: 5.66M, Folded]
  ------------------
 2093|  5.66M|                 int const next_matchLength = opt[candidate_pos].mlen;  /* can be 1, means literal */
 2094|  5.66M|                 int const next_offset = opt[candidate_pos].off;
 2095|  5.66M|                 DEBUGLOG(7, "pos %i: sequence length %i", candidate_pos, selected_matchLength);
  ------------------
  |  |  290|  5.66M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2096|  5.66M|                 opt[candidate_pos].mlen = selected_matchLength;
 2097|  5.66M|                 opt[candidate_pos].off = selected_offset;
 2098|  5.66M|                 selected_matchLength = next_matchLength;
 2099|  5.66M|                 selected_offset = next_offset;
 2100|  5.66M|                 if (next_matchLength > candidate_pos) break; /* last match elected, first match to encode */
  ------------------
  |  Branch (2100:22): [True: 2.52M, False: 3.13M]
  ------------------
 2101|  5.66M|                 assert(next_matchLength > 0);  /* can be 1, means literal */
  ------------------
  |  Branch (2101:18): [True: 0, False: 3.13M]
  |  Branch (2101:18): [True: 3.13M, False: 0]
  ------------------
 2102|  3.13M|                 candidate_pos -= next_matchLength;
 2103|  3.13M|         }   }
 2104|       |
 2105|       |         /* encode all recorded sequences in order */
 2106|  2.52M|         {   int rPos = 0;  /* relative position (to ip) */
 2107|  8.19M|             while (rPos < last_match_pos) {
  ------------------
  |  Branch (2107:21): [True: 5.66M, False: 2.52M]
  ------------------
 2108|  5.66M|                 int const ml = opt[rPos].mlen;
 2109|  5.66M|                 int const offset = opt[rPos].off;
 2110|  5.66M|                 if (ml == 1) { ip++; rPos++; continue; }  /* literal; note: can end up with several literals, in which case, skip them */
  ------------------
  |  Branch (2110:22): [True: 1.43M, False: 4.23M]
  ------------------
 2111|  4.23M|                 rPos += ml;
 2112|  4.23M|                 assert(ml >= MINMATCH);
  ------------------
  |  Branch (2112:18): [True: 0, False: 4.23M]
  |  Branch (2112:18): [True: 4.23M, False: 0]
  ------------------
 2113|  4.23M|                 assert((offset >= 1) && (offset <= LZ4_DISTANCE_MAX));
  ------------------
  |  Branch (2113:18): [True: 0, False: 4.23M]
  |  Branch (2113:18): [True: 0, False: 0]
  |  Branch (2113:18): [True: 4.23M, False: 0]
  |  Branch (2113:18): [True: 4.23M, False: 0]
  ------------------
 2114|  4.23M|                 opSaved = op;
 2115|  4.23M|                 if ( LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml, offset, limit, oend) ) {  /* updates ip, op and anchor */
  ------------------
  |  |  230|  4.23M|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (2115:23): [True: 103, False: 4.23M]
  ------------------
 2116|    103|                     ovml = ml;
 2117|    103|                     ovoff = offset;
 2118|    103|                     goto _dest_overflow;
 2119|    103|         }   }   }
 2120|  2.52M|     }  /* while (ip <= mflimit) */
 2121|       |
 2122|  5.92k|_last_literals:
 2123|       |     /* Encode Last Literals */
 2124|  5.92k|     {   size_t lastRunSize = (size_t)(iend - anchor);  /* literals */
 2125|  5.92k|         size_t llAdd = (lastRunSize + 255 - RUN_MASK) / 255;
  ------------------
  |  |  264|  5.92k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  5.92k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  5.92k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2126|  5.92k|         size_t const totalSize = 1 + llAdd + lastRunSize;
 2127|  5.92k|         if (limit == fillOutput) oend += LASTLITERALS;  /* restore correct value */
  ------------------
  |  |  246|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2127:14): [True: 0, False: 5.92k]
  ------------------
 2128|  5.92k|         if (limit && (op + totalSize > oend)) {
  ------------------
  |  Branch (2128:14): [True: 5.92k, False: 0]
  |  Branch (2128:23): [True: 549, False: 5.37k]
  ------------------
 2129|    549|             if (limit == limitedOutput) { /* Check output limit */
  ------------------
  |  Branch (2129:18): [True: 549, False: 0]
  ------------------
 2130|    549|                retval = 0;
 2131|    549|                goto _return_label;
 2132|    549|             }
 2133|       |             /* adapt lastRunSize to fill 'dst' */
 2134|      0|             lastRunSize  = (size_t)(oend - op) - 1 /*token*/;
 2135|      0|             llAdd = (lastRunSize + 256 - RUN_MASK) / 256;
  ------------------
  |  |  264|      0|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|      0|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|      0|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2136|      0|             lastRunSize -= llAdd;
 2137|      0|         }
 2138|  5.37k|         DEBUGLOG(6, "Final literal run : %i literals", (int)lastRunSize);
  ------------------
  |  |  290|  5.37k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2139|  5.37k|         ip = anchor + lastRunSize; /* can be != iend if limit==fillOutput */
 2140|       |
 2141|  5.37k|         if (lastRunSize >= RUN_MASK) {
  ------------------
  |  |  264|  5.37k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  5.37k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  5.37k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2141:14): [True: 478, False: 4.89k]
  ------------------
 2142|    478|             size_t accumulator = lastRunSize - RUN_MASK;
  ------------------
  |  |  264|    478|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    478|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    478|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2143|    478|             *op++ = (RUN_MASK << ML_BITS);
  ------------------
  |  |  264|    478|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    478|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    478|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                           *op++ = (RUN_MASK << ML_BITS);
  ------------------
  |  |  261|    478|#define ML_BITS  4
  ------------------
 2144|  5.61k|             for(; accumulator >= 255 ; accumulator -= 255) *op++ = 255;
  ------------------
  |  Branch (2144:20): [True: 5.13k, False: 478]
  ------------------
 2145|    478|             *op++ = (BYTE) accumulator;
 2146|  4.89k|         } else {
 2147|  4.89k|             *op++ = (BYTE)(lastRunSize << ML_BITS);
  ------------------
  |  |  261|  4.89k|#define ML_BITS  4
  ------------------
 2148|  4.89k|         }
 2149|  5.37k|         LZ4_memcpy(op, anchor, lastRunSize);
  ------------------
  |  |  350|  5.37k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2150|  5.37k|         op += lastRunSize;
 2151|  5.37k|     }
 2152|       |
 2153|       |     /* End */
 2154|      0|     *srcSizePtr = (int) (((const char*)ip) - source);
 2155|  5.37k|     retval = (int) ((char*)op-dst);
 2156|  5.37k|     goto _return_label;
 2157|       |
 2158|    123|_dest_overflow:
 2159|    123|if (limit == fillOutput) {
  ------------------
  |  Branch (2159:5): [True: 0, False: 123]
  ------------------
 2160|       |     /* Assumption : ip, anchor, ovml and ovref must be set correctly */
 2161|      0|     size_t const ll = (size_t)(ip - anchor);
 2162|      0|     size_t const ll_addbytes = (ll + 240) / 255;
 2163|      0|     size_t const ll_totalCost = 1 + ll_addbytes + ll;
 2164|      0|     BYTE* const maxLitPos = oend - 3; /* 2 for offset, 1 for token */
 2165|      0|     DEBUGLOG(6, "Last sequence overflowing (only %i bytes remaining)", (int)(oend-1-opSaved));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2166|      0|     op = opSaved;  /* restore correct out pointer */
 2167|      0|     if (op + ll_totalCost <= maxLitPos) {
  ------------------
  |  Branch (2167:10): [True: 0, False: 0]
  ------------------
 2168|       |         /* ll validated; now adjust match length */
 2169|      0|         size_t const bytesLeftForMl = (size_t)(maxLitPos - (op+ll_totalCost));
 2170|      0|         size_t const maxMlSize = MINMATCH + (ML_MASK-1) + (bytesLeftForMl * 255);
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
                       size_t const maxMlSize = MINMATCH + (ML_MASK-1) + (bytesLeftForMl * 255);
  ------------------
  |  |  262|      0|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|      0|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2171|      0|         assert(maxMlSize < INT_MAX); assert(ovml >= 0);
  ------------------
  |  Branch (2171:10): [True: 0, False: 0]
  |  Branch (2171:10): [True: 0, False: 0]
  |  Branch (2171:39): [True: 0, False: 0]
  |  Branch (2171:39): [True: 0, False: 0]
  ------------------
 2172|      0|         if ((size_t)ovml > maxMlSize) ovml = (int)maxMlSize;
  ------------------
  |  Branch (2172:14): [True: 0, False: 0]
  ------------------
 2173|      0|         if ((oend + LASTLITERALS) - (op + ll_totalCost + 2) - 1 + ovml >= MFLIMIT) {
  ------------------
  |  |  246|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                       if ((oend + LASTLITERALS) - (op + ll_totalCost + 2) - 1 + ovml >= MFLIMIT) {
  ------------------
  |  |  247|      0|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2173:14): [True: 0, False: 0]
  ------------------
 2174|      0|             DEBUGLOG(6, "Space to end : %i + ml (%i)", (int)((oend + LASTLITERALS) - (op + ll_totalCost + 2) - 1), ovml);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2175|      0|             DEBUGLOG(6, "Before : ip = %p, anchor = %p", ip, anchor);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2176|      0|             LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ovml, ovoff, notLimited, oend);
  ------------------
  |  |  230|      0|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
 2177|      0|             DEBUGLOG(6, "After : ip = %p, anchor = %p", ip, anchor);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2178|      0|     }   }
 2179|      0|     goto _last_literals;
 2180|      0|}
 2181|  6.04k|_return_label:
 2182|  6.04k|#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1
 2183|  6.04k|     if (opt) FREEMEM(opt);
  ------------------
  |  |  228|  6.04k|# define FREEMEM(p)        free(p)
  ------------------
  |  Branch (2183:10): [True: 6.04k, False: 0]
  ------------------
 2184|  6.04k|#endif
 2185|  6.04k|     return retval;
 2186|    123|}
lz4hc.c:LZ4HC_FindLongerMatch:
 1857|  81.6M|{
 1858|  81.6M|    LZ4HC_match_t const match0 = { 0 , 0, 0 };
 1859|       |    /* note : LZ4HC_InsertAndGetWiderMatch() is able to modify the starting position of a match (*startpos),
 1860|       |     * but this won't be the case here, as we define iLowLimit==ip,
 1861|       |    ** so LZ4HC_InsertAndGetWiderMatch() won't be allowed to search past ip */
 1862|  81.6M|    LZ4HC_match_t md = LZ4HC_InsertAndGetWiderMatch(ctx, ip, ip, iHighLimit, minLen, nbSearches, 1 /*patternAnalysis*/, 1 /*chainSwap*/, dict, favorDecSpeed);
 1863|  81.6M|    assert(md.back == 0);
  ------------------
  |  Branch (1863:5): [True: 0, False: 81.6M]
  |  Branch (1863:5): [True: 81.6M, False: 0]
  ------------------
 1864|  81.6M|    if (md.len <= minLen) return match0;
  ------------------
  |  Branch (1864:9): [True: 72.0M, False: 9.54M]
  ------------------
 1865|  9.54M|    if (favorDecSpeed) {
  ------------------
  |  Branch (1865:9): [True: 4.96M, False: 4.58M]
  ------------------
 1866|  4.96M|        if ((md.len>18) & (md.len<=36)) md.len=18;   /* favor dec.speed (shortcut) */
  ------------------
  |  Branch (1866:13): [True: 662k, False: 4.29M]
  ------------------
 1867|  4.96M|    }
 1868|  9.54M|    return md;
 1869|  81.6M|}
lz4hc.c:LZ4HC_literalsPrice:
 1828|   249M|{
 1829|   249M|    int price = litlen;
 1830|   249M|    assert(litlen >= 0);
  ------------------
  |  Branch (1830:5): [True: 0, False: 249M]
  |  Branch (1830:5): [True: 249M, False: 0]
  ------------------
 1831|   249M|    if (litlen >= (int)RUN_MASK)
  ------------------
  |  |  264|   249M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|   249M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|   249M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1831:9): [True: 6.55M, False: 242M]
  ------------------
 1832|  6.55M|        price += 1 + ((litlen-(int)RUN_MASK) / 255);
  ------------------
  |  |  264|  6.55M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  6.55M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  6.55M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1833|   249M|    return price;
 1834|   249M|}
lz4hc.c:LZ4HC_sequencePrice:
 1838|   168M|{
 1839|   168M|    int price = 1 + 2 ; /* token + 16-bit offset */
 1840|   168M|    assert(litlen >= 0);
  ------------------
  |  Branch (1840:5): [True: 0, False: 168M]
  |  Branch (1840:5): [True: 168M, False: 0]
  ------------------
 1841|   168M|    assert(mlen >= MINMATCH);
  ------------------
  |  Branch (1841:5): [True: 0, False: 168M]
  |  Branch (1841:5): [True: 168M, False: 0]
  ------------------
 1842|       |
 1843|   168M|    price += LZ4HC_literalsPrice(litlen);
 1844|       |
 1845|   168M|    if (mlen >= (int)(ML_MASK+MINMATCH))
  ------------------
  |  |  262|   168M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   168M|#define ML_BITS  4
  |  |  ------------------
  ------------------
                  if (mlen >= (int)(ML_MASK+MINMATCH))
  ------------------
  |  |  243|   168M|#define MINMATCH 4
  ------------------
  |  Branch (1845:9): [True: 121M, False: 47.8M]
  ------------------
 1846|   121M|        price += 1 + ((mlen-(int)(ML_MASK+MINMATCH)) / 255);
  ------------------
  |  |  262|   121M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   121M|#define ML_BITS  4
  |  |  ------------------
  ------------------
                      price += 1 + ((mlen-(int)(ML_MASK+MINMATCH)) / 255);
  ------------------
  |  |  243|   121M|#define MINMATCH 4
  ------------------
 1847|       |
 1848|   168M|    return price;
 1849|   168M|}
lz4hc.c:LZ4HC_getCLevelParams:
  109|  14.5k|{
  110|       |    /* note : clevel convention is a bit different from lz4frame,
  111|       |     * possibly something worth revisiting for consistency */
  112|  14.5k|    if (cLevel < 1)
  ------------------
  |  Branch (112:9): [True: 0, False: 14.5k]
  ------------------
  113|      0|        cLevel = LZ4HC_CLEVEL_DEFAULT;
  ------------------
  |  |   48|      0|#define LZ4HC_CLEVEL_DEFAULT     9
  ------------------
  114|  14.5k|    cLevel = MIN(LZ4HC_CLEVEL_MAX, cLevel);
  ------------------
  |  |   81|  14.5k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (81:22): [True: 0, False: 14.5k]
  |  |  ------------------
  ------------------
  115|  14.5k|    return k_clTable[cLevel];
  116|  14.5k|}
lz4hc.c:LZ4HC_Insert:
  812|   171M|{
  813|   171M|    U16* const chainTable = hc4->chainTable;
  814|   171M|    U32* const hashTable  = hc4->hashTable;
  815|   171M|    const BYTE* const prefixPtr = hc4->prefixStart;
  816|   171M|    U32 const prefixIdx = hc4->dictLimit;
  817|   171M|    U32 const target = (U32)(ip - prefixPtr) + prefixIdx;
  818|   171M|    U32 idx = hc4->nextToUpdate;
  819|   171M|    assert(ip >= prefixPtr);
  ------------------
  |  Branch (819:5): [True: 0, False: 171M]
  |  Branch (819:5): [True: 171M, False: 0]
  ------------------
  820|   171M|    assert(target >= prefixIdx);
  ------------------
  |  Branch (820:5): [True: 0, False: 171M]
  |  Branch (820:5): [True: 171M, False: 0]
  ------------------
  821|       |
  822|   620M|    while (idx < target) {
  ------------------
  |  Branch (822:12): [True: 449M, False: 171M]
  ------------------
  823|   449M|        U32 const h = LZ4HC_hashPtr(prefixPtr+idx-prefixIdx);
  824|   449M|        size_t delta = idx - hashTable[h];
  825|   449M|        if (delta>LZ4_DISTANCE_MAX) delta = LZ4_DISTANCE_MAX;
  ------------------
  |  |  676|   449M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                      if (delta>LZ4_DISTANCE_MAX) delta = LZ4_DISTANCE_MAX;
  ------------------
  |  |  676|  63.7M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (825:13): [True: 63.7M, False: 385M]
  ------------------
  826|   449M|        DELTANEXTU16(chainTable, idx) = (U16)delta;
  ------------------
  |  |  228|   449M|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
  827|   449M|        hashTable[h] = idx;
  828|   449M|        idx++;
  829|   449M|    }
  830|       |
  831|   171M|    hc4->nextToUpdate = target;
  832|   171M|}
lz4hc.c:LZ4_compressHC_continue_generic:
 1734|  3.78k|{
 1735|  3.78k|    LZ4HC_CCtx_internal* const ctxPtr = &LZ4_streamHCPtr->internal_donotuse;
 1736|  3.78k|    DEBUGLOG(5, "LZ4_compressHC_continue_generic(ctx=%p, src=%p, srcSize=%d, limit=%d)",
  ------------------
  |  |  290|  3.78k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1737|  3.78k|                LZ4_streamHCPtr, src, *srcSizePtr, limit);
 1738|  3.78k|    assert(ctxPtr != NULL);
  ------------------
  |  Branch (1738:5): [True: 0, False: 3.78k]
  |  Branch (1738:5): [True: 3.78k, False: 0]
  ------------------
 1739|       |    /* auto-init if forgotten */
 1740|  3.78k|    if (ctxPtr->prefixStart == NULL)
  ------------------
  |  Branch (1740:9): [True: 862, False: 2.92k]
  ------------------
 1741|    862|        LZ4HC_init_internal (ctxPtr, (const BYTE*) src);
 1742|       |
 1743|       |    /* Check overflow */
 1744|  3.78k|    if ((size_t)(ctxPtr->end - ctxPtr->prefixStart) + ctxPtr->dictLimit > 2 GB) {
  ------------------
  |  |  254|  3.78k|#define GB *(1U<<30)
  ------------------
  |  Branch (1744:9): [True: 0, False: 3.78k]
  ------------------
 1745|      0|        size_t dictSize = (size_t)(ctxPtr->end - ctxPtr->prefixStart);
 1746|      0|        if (dictSize > 64 KB) dictSize = 64 KB;
  ------------------
  |  |  252|      0|#define KB *(1 <<10)
  ------------------
                      if (dictSize > 64 KB) dictSize = 64 KB;
  ------------------
  |  |  252|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (1746:13): [True: 0, False: 0]
  ------------------
 1747|      0|        LZ4_loadDictHC(LZ4_streamHCPtr, (const char*)(ctxPtr->end) - dictSize, (int)dictSize);
 1748|      0|    }
 1749|       |
 1750|       |    /* Check if blocks follow each other */
 1751|  3.78k|    if ((const BYTE*)src != ctxPtr->end)
  ------------------
  |  Branch (1751:9): [True: 0, False: 3.78k]
  ------------------
 1752|      0|        LZ4HC_setExternalDict(ctxPtr, (const BYTE*)src);
 1753|       |
 1754|       |    /* Check overlapping input/dictionary space */
 1755|  3.78k|    {   const BYTE* sourceEnd = (const BYTE*) src + *srcSizePtr;
 1756|  3.78k|        const BYTE* const dictBegin = ctxPtr->dictStart;
 1757|  3.78k|        const BYTE* const dictEnd   = ctxPtr->dictStart + (ctxPtr->dictLimit - ctxPtr->lowLimit);
 1758|  3.78k|        if ((sourceEnd > dictBegin) && ((const BYTE*)src < dictEnd)) {
  ------------------
  |  Branch (1758:13): [True: 3.78k, False: 0]
  |  Branch (1758:40): [True: 0, False: 3.78k]
  ------------------
 1759|      0|            if (sourceEnd > dictEnd) sourceEnd = dictEnd;
  ------------------
  |  Branch (1759:17): [True: 0, False: 0]
  ------------------
 1760|      0|            ctxPtr->lowLimit += (U32)(sourceEnd - ctxPtr->dictStart);
 1761|      0|            ctxPtr->dictStart += (U32)(sourceEnd - ctxPtr->dictStart);
 1762|       |            /* invalidate dictionary is it's too small */
 1763|      0|            if (ctxPtr->dictLimit - ctxPtr->lowLimit < LZ4HC_HASHSIZE) {
  ------------------
  |  |  120|      0|#define LZ4HC_HASHSIZE 4
  ------------------
  |  Branch (1763:17): [True: 0, False: 0]
  ------------------
 1764|      0|                ctxPtr->lowLimit = ctxPtr->dictLimit;
 1765|      0|                ctxPtr->dictStart = ctxPtr->prefixStart;
 1766|      0|    }   }   }
 1767|       |
 1768|  3.78k|    return LZ4HC_compress_generic (ctxPtr, src, dst, srcSizePtr, dstCapacity, ctxPtr->compressionLevel, limit);
 1769|  3.78k|}

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

FUZZ_dataProducer_create:
    8|  11.3k|FUZZ_dataProducer_t* FUZZ_dataProducer_create(const uint8_t* data, size_t size) {
    9|  11.3k|  FUZZ_dataProducer_t* const producer = malloc(sizeof(FUZZ_dataProducer_t));
   10|       |
   11|  11.3k|  FUZZ_ASSERT(producer != NULL);
  ------------------
  |  |   47|  11.3k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  11.3k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 11.3k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  11.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()))
  |  |  ------------------
  ------------------
   12|       |
   13|  11.3k|  producer->data = data;
   14|  11.3k|  producer->size = size;
   15|  11.3k|  return producer;
   16|  11.3k|}
FUZZ_dataProducer_free:
   18|  11.3k|void FUZZ_dataProducer_free(FUZZ_dataProducer_t *producer) { free(producer); }
FUZZ_dataProducer_retrieve32:
   20|  79.7k|uint32_t FUZZ_dataProducer_retrieve32(FUZZ_dataProducer_t *producer) {
   21|  79.7k|    const uint8_t* data = producer->data;
   22|  79.7k|    const size_t size = producer->size;
   23|  79.7k|    if (size == 0) {
  ------------------
  |  Branch (23:9): [True: 103, False: 79.6k]
  ------------------
   24|    103|        return 0;
   25|  79.6k|    } else if (size < 4) {
  ------------------
  |  Branch (25:16): [True: 95, False: 79.5k]
  ------------------
   26|     95|        producer->size -= 1;
   27|     95|        return (uint32_t)data[size - 1];
   28|  79.5k|    } else {
   29|  79.5k|        producer->size -= 4;
   30|  79.5k|        return *(data + size - 4);
   31|  79.5k|    }
   32|  79.7k|}
FUZZ_getRange_from_uint32:
   35|  79.7k|{
   36|  79.7k|    uint32_t range = max - min;
   37|  79.7k|    if (range == 0xffffffff) {
  ------------------
  |  Branch (37:9): [True: 0, False: 79.7k]
  ------------------
   38|      0|      return seed;
   39|      0|    }
   40|  79.7k|    return min + seed % (range + 1);
   41|  79.7k|}
FUZZ_dataProducer_range32:
   45|  79.7k|{
   46|  79.7k|    size_t const seed = FUZZ_dataProducer_retrieve32(producer);
   47|  79.7k|    return FUZZ_getRange_from_uint32(seed, min, max);
   48|  79.7k|}
FUZZ_dataProducer_frameInfo:
   51|  11.3k|{
   52|  11.3k|    LZ4F_frameInfo_t info = LZ4F_INIT_FRAMEINFO;
  ------------------
  |  |  186|  11.3k|#define LZ4F_INIT_FRAMEINFO   { LZ4F_max64KB, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0ULL, 0U, LZ4F_noBlockChecksum }    /* v1.8.3+ */
  ------------------
   53|  11.3k|    info.blockSizeID = FUZZ_dataProducer_range32(producer, LZ4F_max64KB - 1, LZ4F_max4MB);
   54|  11.3k|    if (info.blockSizeID < LZ4F_max64KB) {
  ------------------
  |  Branch (54:9): [True: 6.05k, False: 5.34k]
  ------------------
   55|  6.05k|        info.blockSizeID = LZ4F_default;
   56|  6.05k|    }
   57|  11.3k|    info.blockMode = FUZZ_dataProducer_range32(producer, LZ4F_blockLinked, LZ4F_blockIndependent);
   58|  11.3k|    info.contentChecksumFlag = FUZZ_dataProducer_range32(producer, LZ4F_noContentChecksum,
   59|  11.3k|                                           LZ4F_contentChecksumEnabled);
   60|  11.3k|    info.blockChecksumFlag = FUZZ_dataProducer_range32(producer, LZ4F_noBlockChecksum,
   61|  11.3k|                                         LZ4F_blockChecksumEnabled);
   62|  11.3k|    return info;
   63|  11.3k|}
FUZZ_dataProducer_preferences:
   66|  11.3k|{
   67|  11.3k|    LZ4F_preferences_t prefs = LZ4F_INIT_PREFERENCES;
  ------------------
  |  |  201|  11.3k|#define LZ4F_INIT_PREFERENCES   { LZ4F_INIT_FRAMEINFO, 0, 0u, 0u, { 0u, 0u, 0u } }    /* v1.8.3+ */
  |  |  ------------------
  |  |  |  |  186|  11.3k|#define LZ4F_INIT_FRAMEINFO   { LZ4F_max64KB, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0ULL, 0U, LZ4F_noBlockChecksum }    /* v1.8.3+ */
  |  |  ------------------
  ------------------
   68|  11.3k|    prefs.frameInfo = FUZZ_dataProducer_frameInfo(producer);
   69|  11.3k|    prefs.compressionLevel = FUZZ_dataProducer_range32(producer, 0, LZ4HC_CLEVEL_MAX + 3) - 3;
  ------------------
  |  |   50|  11.3k|#define LZ4HC_CLEVEL_MAX        12
  ------------------
   70|  11.3k|    prefs.autoFlush = FUZZ_dataProducer_range32(producer, 0, 1);
   71|  11.3k|    prefs.favorDecSpeed = FUZZ_dataProducer_range32(producer, 0, 1);
   72|  11.3k|    return prefs;
   73|  11.3k|}
FUZZ_dataProducer_remainingBytes:
   75|  22.7k|size_t FUZZ_dataProducer_remainingBytes(FUZZ_dataProducer_t *producer){
   76|  22.7k|  return producer->size;
   77|  22.7k|}

FUZZ_decompressFrame:
   32|  11.3k|{
   33|  11.3k|    LZ4F_decompressOptions_t opts;
   34|  11.3k|    memset(&opts, 0, sizeof(opts));
   35|  11.3k|    opts.stableDst = 1;
   36|  11.3k|    LZ4F_dctx* dctx;
   37|  11.3k|    LZ4F_createDecompressionContext(&dctx, LZ4F_VERSION);
  ------------------
  |  |  257|  11.3k|#define LZ4F_VERSION 100    /* This number can be used to check for an incompatible API breaking change */
  ------------------
   38|  11.3k|    FUZZ_ASSERT(dctx);
  ------------------
  |  |   47|  11.3k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  11.3k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 11.3k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  11.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()))
  |  |  ------------------
  ------------------
   39|       |
   40|  11.3k|    size_t dstSize = dstCapacity;
   41|  11.3k|    size_t srcConsumed = srcSize;
   42|  11.3k|    size_t const rc =
   43|  11.3k|            LZ4F_decompress(dctx, dst, &dstSize, src, &srcConsumed, &opts);
   44|  11.3k|    FUZZ_ASSERT(!LZ4F_isError(rc));
  ------------------
  |  |   47|  11.3k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  11.3k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 11.3k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  11.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()))
  |  |  ------------------
  ------------------
   45|  11.3k|    FUZZ_ASSERT(rc == 0);
  ------------------
  |  |   47|  11.3k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  11.3k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 11.3k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  11.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()))
  |  |  ------------------
  ------------------
   46|  11.3k|    FUZZ_ASSERT(srcConsumed == srcSize);
  ------------------
  |  |   47|  11.3k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  11.3k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 11.3k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  11.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()))
  |  |  ------------------
  ------------------
   47|       |
   48|  11.3k|    LZ4F_freeDecompressionContext(dctx);
   49|       |
   50|  11.3k|    return dstSize;
   51|  11.3k|}

LLVMFuzzerTestOneInput:
   18|  11.3k|{
   19|  11.3k|    FUZZ_dataProducer_t* producer = FUZZ_dataProducer_create(data, size);
   20|  11.3k|    LZ4F_preferences_t const prefs = FUZZ_dataProducer_preferences(producer);
   21|  11.3k|    size = FUZZ_dataProducer_remainingBytes(producer);
   22|       |
   23|  11.3k|    size_t const dstCapacity = LZ4F_compressFrameBound(LZ4_compressBound(size), &prefs);
   24|  11.3k|    char* const dst = (char*)malloc(dstCapacity);
   25|  11.3k|    char* const rt = (char*)malloc(FUZZ_dataProducer_remainingBytes(producer));
   26|       |
   27|  11.3k|    FUZZ_ASSERT(dst);
  ------------------
  |  |   47|  11.3k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  11.3k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 11.3k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  11.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()))
  |  |  ------------------
  ------------------
   28|  11.3k|    FUZZ_ASSERT(rt);
  ------------------
  |  |   47|  11.3k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  11.3k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 11.3k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  11.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()))
  |  |  ------------------
  ------------------
   29|       |
   30|       |    /* Compression must succeed and round trip correctly. */
   31|  11.3k|    size_t const dstSize =
   32|  11.3k|            LZ4F_compressFrame(dst, dstCapacity, data, size, &prefs);
   33|  11.3k|    FUZZ_ASSERT(!LZ4F_isError(dstSize));
  ------------------
  |  |   47|  11.3k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  11.3k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 11.3k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  11.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()))
  |  |  ------------------
  ------------------
   34|  11.3k|    size_t const rtSize = FUZZ_decompressFrame(rt, size, dst, dstSize);
   35|  11.3k|    FUZZ_ASSERT_MSG(rtSize == size, "Incorrect regenerated size");
  ------------------
  |  |   43|  11.3k|  ((cond) ? (void)0                                                            \
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 11.3k, False: 0]
  |  |  ------------------
  |  |   44|  11.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()))
  ------------------
   36|  11.3k|    FUZZ_ASSERT_MSG(!memcmp(data, rt, size), "Corruption!");
  ------------------
  |  |   43|  11.3k|  ((cond) ? (void)0                                                            \
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 11.3k, False: 0]
  |  |  ------------------
  |  |   44|  11.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()))
  ------------------
   37|       |
   38|  11.3k|    free(dst);
   39|  11.3k|    free(rt);
   40|  11.3k|    FUZZ_dataProducer_free(producer);
   41|       |
   42|  11.3k|    return 0;
   43|  11.3k|}

