LZ4_compressBound:
  733|  25.9k|int LZ4_compressBound(int isize)  { return LZ4_COMPRESSBOUND(isize); }
  ------------------
  |  |  213|  25.9k|#define LZ4_COMPRESSBOUND(isize)  ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
  |  |  ------------------
  |  |  |  |  212|  25.9k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  |  |  ------------------
  |  |  |  Branch (213:36): [True: 0, False: 25.9k]
  |  |  ------------------
  ------------------
LZ4_sizeofState:
  734|  2.04k|int LZ4_sizeofState(void) { return sizeof(LZ4_stream_t); }
LZ4_compress_fast_extState_fastReset:
 1389|  4.31k|{
 1390|  4.31k|    LZ4_stream_t_internal* const ctx = &((LZ4_stream_t*)state)->internal_donotuse;
 1391|  4.31k|    if (acceleration < 1) acceleration = LZ4_ACCELERATION_DEFAULT;
  ------------------
  |  |   52|      0|#define LZ4_ACCELERATION_DEFAULT 1
  ------------------
  |  Branch (1391:9): [True: 0, False: 4.31k]
  ------------------
 1392|  4.31k|    if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX;
  ------------------
  |  |   58|  4.31k|#define LZ4_ACCELERATION_MAX 65537
  ------------------
                  if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX;
  ------------------
  |  |   58|      0|#define LZ4_ACCELERATION_MAX 65537
  ------------------
  |  Branch (1392:9): [True: 0, False: 4.31k]
  ------------------
 1393|  4.31k|    assert(ctx != NULL);
 1394|       |
 1395|  4.31k|    if (dstCapacity >= LZ4_compressBound(srcSize)) {
  ------------------
  |  Branch (1395:9): [True: 0, False: 4.31k]
  ------------------
 1396|      0|        if (srcSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1396:13): [True: 0, False: 0]
  ------------------
 1397|      0|            const tableType_t tableType = byU16;
 1398|      0|            LZ4_prepareTable(ctx, srcSize, tableType);
 1399|      0|            if (ctx->currentOffset) {
  ------------------
  |  Branch (1399:17): [True: 0, False: 0]
  ------------------
 1400|      0|                return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, 0, notLimited, tableType, noDict, dictSmall, acceleration);
 1401|      0|            } else {
 1402|      0|                return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, 0, notLimited, tableType, noDict, noDictIssue, acceleration);
 1403|      0|            }
 1404|      0|        } else {
 1405|      0|            const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)src > LZ4_DISTANCE_MAX)) ? byPtr : byU32;
  ------------------
  |  |  653|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1405:44): [Folded - Ignored]
  |  Branch (1405:66): [True: 0, False: 0]
  ------------------
 1406|      0|            LZ4_prepareTable(ctx, srcSize, tableType);
 1407|      0|            return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, 0, notLimited, tableType, noDict, noDictIssue, acceleration);
 1408|      0|        }
 1409|  4.31k|    } else {
 1410|  4.31k|        if (srcSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1410:13): [True: 3.94k, False: 371]
  ------------------
 1411|  3.94k|            const tableType_t tableType = byU16;
 1412|  3.94k|            LZ4_prepareTable(ctx, srcSize, tableType);
 1413|  3.94k|            if (ctx->currentOffset) {
  ------------------
  |  Branch (1413:17): [True: 662, False: 3.28k]
  ------------------
 1414|    662|                return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, dstCapacity, limitedOutput, tableType, noDict, dictSmall, acceleration);
 1415|  3.28k|            } else {
 1416|  3.28k|                return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, dstCapacity, limitedOutput, tableType, noDict, noDictIssue, acceleration);
 1417|  3.28k|            }
 1418|  3.94k|        } else {
 1419|    371|            const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)src > LZ4_DISTANCE_MAX)) ? byPtr : byU32;
  ------------------
  |  |  653|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1419:44): [Folded - Ignored]
  |  Branch (1419:66): [True: 0, False: 0]
  ------------------
 1420|    371|            LZ4_prepareTable(ctx, srcSize, tableType);
 1421|    371|            return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, dstCapacity, limitedOutput, tableType, noDict, noDictIssue, acceleration);
 1422|    371|        }
 1423|  4.31k|    }
 1424|  4.31k|}
LZ4_initStream:
 1519|  2.04k|{
 1520|  2.04k|    DEBUGLOG(5, "LZ4_initStream");
  ------------------
  |  |  288|  2.04k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1521|  2.04k|    if (buffer == NULL) { return NULL; }
  ------------------
  |  Branch (1521:9): [True: 0, False: 2.04k]
  ------------------
 1522|  2.04k|    if (size < sizeof(LZ4_stream_t)) { return NULL; }
  ------------------
  |  Branch (1522:9): [True: 0, False: 2.04k]
  ------------------
 1523|  2.04k|    if (!LZ4_isAligned(buffer, LZ4_stream_t_alignment())) return NULL;
  ------------------
  |  Branch (1523:9): [True: 0, False: 2.04k]
  ------------------
 1524|  2.04k|    MEM_INIT(buffer, 0, sizeof(LZ4_stream_t_internal));
  ------------------
  |  |  235|  2.04k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  233|  2.04k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 1525|  2.04k|    return (LZ4_stream_t*)buffer;
 1526|  2.04k|}
LZ4_attach_dictionary:
 1596|  4.31k|{
 1597|  4.31k|    const LZ4_stream_t_internal* dictCtx = (dictionaryStream == NULL) ? NULL :
  ------------------
  |  Branch (1597:44): [True: 4.31k, False: 0]
  ------------------
 1598|  4.31k|        &(dictionaryStream->internal_donotuse);
 1599|       |
 1600|  4.31k|    DEBUGLOG(4, "LZ4_attach_dictionary (%p, %p, size %u)",
  ------------------
  |  |  288|  4.31k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1601|  4.31k|             workingStream, dictionaryStream,
 1602|  4.31k|             dictCtx != NULL ? dictCtx->dictSize : 0);
 1603|       |
 1604|  4.31k|    if (dictCtx != NULL) {
  ------------------
  |  Branch (1604:9): [True: 0, False: 4.31k]
  ------------------
 1605|       |        /* If the current offset is zero, we will never look in the
 1606|       |         * external dictionary context, since there is no value a table
 1607|       |         * entry can take that indicate a miss. In that case, we need
 1608|       |         * to bump the offset to something non-zero.
 1609|       |         */
 1610|      0|        if (workingStream->internal_donotuse.currentOffset == 0) {
  ------------------
  |  Branch (1610:13): [True: 0, False: 0]
  ------------------
 1611|      0|            workingStream->internal_donotuse.currentOffset = 64 KB;
  ------------------
  |  |  250|      0|#define KB *(1 <<10)
  ------------------
 1612|      0|        }
 1613|       |
 1614|       |        /* Don't actually attach an empty dictionary.
 1615|       |         */
 1616|      0|        if (dictCtx->dictSize == 0) {
  ------------------
  |  Branch (1616:13): [True: 0, False: 0]
  ------------------
 1617|      0|            dictCtx = NULL;
 1618|      0|        }
 1619|      0|    }
 1620|  4.31k|    workingStream->internal_donotuse.dictCtx = dictCtx;
 1621|  4.31k|}
LZ4_decompress_safe:
 2374|  12.8k|{
 2375|  12.8k|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2376|  12.8k|                                  decode_full_block, noDict,
 2377|  12.8k|                                  (BYTE*)dest, NULL, 0);
 2378|  12.8k|}
LZ4_decompress_safe_usingDict:
 2642|  12.8k|{
 2643|  12.8k|    if (dictSize==0)
  ------------------
  |  Branch (2643:9): [True: 12.8k, False: 0]
  ------------------
 2644|  12.8k|        return LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize);
 2645|      0|    if (dictStart+dictSize == dest) {
  ------------------
  |  Branch (2645:9): [True: 0, False: 0]
  ------------------
 2646|      0|        if (dictSize >= 64 KB - 1) {
  ------------------
  |  |  250|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (2646:13): [True: 0, False: 0]
  ------------------
 2647|      0|            return LZ4_decompress_safe_withPrefix64k(source, dest, compressedSize, maxOutputSize);
 2648|      0|        }
 2649|      0|        assert(dictSize >= 0);
 2650|      0|        return LZ4_decompress_safe_withSmallPrefix(source, dest, compressedSize, maxOutputSize, (size_t)dictSize);
 2651|      0|    }
 2652|      0|    assert(dictSize >= 0);
 2653|      0|    return LZ4_decompress_safe_forceExtDict(source, dest, compressedSize, maxOutputSize, dictStart, (size_t)dictSize);
 2654|      0|}
lz4.c:LZ4_compress_generic:
 1330|  4.31k|{
 1331|  4.31k|    DEBUGLOG(5, "LZ4_compress_generic: srcSize=%i, dstCapacity=%i",
  ------------------
  |  |  288|  4.31k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1332|  4.31k|                srcSize, dstCapacity);
 1333|       |
 1334|  4.31k|    if ((U32)srcSize > (U32)LZ4_MAX_INPUT_SIZE) { return 0; }  /* Unsupported srcSize, too large (or negative) */
  ------------------
  |  |  212|  4.31k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  ------------------
  |  Branch (1334:9): [True: 0, False: 4.31k]
  ------------------
 1335|  4.31k|    if (srcSize == 0) {   /* src == NULL supported if srcSize == 0 */
  ------------------
  |  Branch (1335:9): [True: 0, False: 4.31k]
  ------------------
 1336|      0|        if (outputDirective != notLimited && dstCapacity <= 0) return 0;  /* no output, can't write anything */
  ------------------
  |  Branch (1336:13): [True: 0, False: 0]
  |  Branch (1336:46): [True: 0, False: 0]
  ------------------
 1337|      0|        DEBUGLOG(5, "Generating an empty block");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1338|      0|        assert(outputDirective == notLimited || dstCapacity >= 1);
 1339|      0|        assert(dst != NULL);
 1340|      0|        dst[0] = 0;
 1341|      0|        if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1341:13): [True: 0, False: 0]
  ------------------
 1342|      0|            assert (inputConsumed != NULL);
 1343|      0|            *inputConsumed = 0;
 1344|      0|        }
 1345|      0|        return 1;
 1346|      0|    }
 1347|  4.31k|    assert(src != NULL);
 1348|       |
 1349|  4.31k|    return LZ4_compress_generic_validated(cctx, src, dst, srcSize,
 1350|  4.31k|                inputConsumed, /* only written into if outputDirective == fillOutput */
 1351|  4.31k|                dstCapacity, outputDirective,
 1352|  4.31k|                tableType, dictDirective, dictIssue, acceleration);
 1353|  4.31k|}
lz4.c:LZ4_compress_generic_validated:
  919|  4.31k|{
  920|  4.31k|    int result;
  921|  4.31k|    const BYTE* ip = (const BYTE*)source;
  922|       |
  923|  4.31k|    U32 const startIndex = cctx->currentOffset;
  924|  4.31k|    const BYTE* base = (const BYTE*)source - startIndex;
  925|  4.31k|    const BYTE* lowLimit;
  926|       |
  927|  4.31k|    const LZ4_stream_t_internal* dictCtx = (const LZ4_stream_t_internal*) cctx->dictCtx;
  928|  4.31k|    const BYTE* const dictionary =
  929|  4.31k|        dictDirective == usingDictCtx ? dictCtx->dictionary : cctx->dictionary;
  ------------------
  |  Branch (929:9): [True: 0, False: 4.31k]
  ------------------
  930|  4.31k|    const U32 dictSize =
  931|  4.31k|        dictDirective == usingDictCtx ? dictCtx->dictSize : cctx->dictSize;
  ------------------
  |  Branch (931:9): [True: 0, False: 4.31k]
  ------------------
  932|  4.31k|    const U32 dictDelta =
  933|  4.31k|        (dictDirective == usingDictCtx) ? startIndex - dictCtx->currentOffset : 0;   /* make indexes in dictCtx comparable with indexes in current context */
  ------------------
  |  Branch (933:9): [True: 0, False: 4.31k]
  ------------------
  934|       |
  935|  4.31k|    int const maybe_extMem = (dictDirective == usingExtDict) || (dictDirective == usingDictCtx);
  ------------------
  |  Branch (935:30): [True: 0, False: 4.31k]
  |  Branch (935:65): [True: 0, False: 4.31k]
  ------------------
  936|  4.31k|    U32 const prefixIdxLimit = startIndex - dictSize;   /* used when dictDirective == dictSmall */
  937|  4.31k|    const BYTE* const dictEnd = dictionary ? dictionary + dictSize : dictionary;
  ------------------
  |  Branch (937:33): [True: 0, False: 4.31k]
  ------------------
  938|  4.31k|    const BYTE* anchor = (const BYTE*) source;
  939|  4.31k|    const BYTE* const iend = ip + inputSize;
  940|  4.31k|    const BYTE* const mflimitPlusOne = iend - MFLIMIT + 1;
  ------------------
  |  |  245|  4.31k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  941|  4.31k|    const BYTE* const matchlimit = iend - LASTLITERALS;
  ------------------
  |  |  244|  4.31k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  942|       |
  943|       |    /* the dictCtx currentOffset is indexed on the start of the dictionary,
  944|       |     * while a dictionary in the current context precedes the currentOffset */
  945|  4.31k|    const BYTE* dictBase = (dictionary == NULL) ? NULL :
  ------------------
  |  Branch (945:28): [True: 4.31k, False: 0]
  ------------------
  946|  4.31k|                           (dictDirective == usingDictCtx) ?
  ------------------
  |  Branch (946:28): [True: 0, False: 0]
  ------------------
  947|      0|                            dictionary + dictSize - dictCtx->currentOffset :
  948|      0|                            dictionary + dictSize - startIndex;
  949|       |
  950|  4.31k|    BYTE* op = (BYTE*) dest;
  951|  4.31k|    BYTE* const olimit = op + maxOutputSize;
  952|       |
  953|  4.31k|    U32 offset = 0;
  954|  4.31k|    U32 forwardH;
  955|       |
  956|  4.31k|    DEBUGLOG(5, "LZ4_compress_generic_validated: srcSize=%i, tableType=%u", inputSize, tableType);
  ------------------
  |  |  288|  4.31k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  957|  4.31k|    assert(ip != NULL);
  958|  4.31k|    if (tableType == byU16) assert(inputSize<LZ4_64Klimit);  /* Size too large (not within 64K limit) */
  ------------------
  |  Branch (958:9): [True: 3.94k, False: 371]
  ------------------
  959|  4.31k|    if (tableType == byPtr) assert(dictDirective==noDict);   /* only supported use case with byPtr */
  ------------------
  |  Branch (959:9): [True: 0, False: 4.31k]
  ------------------
  960|       |    /* If init conditions are not met, we don't have to mark stream
  961|       |     * as having dirty context, since no action was taken yet */
  962|  4.31k|    if (outputDirective == fillOutput && maxOutputSize < 1) { return 0; } /* Impossible to store anything */
  ------------------
  |  Branch (962:9): [True: 0, False: 4.31k]
  |  Branch (962:42): [True: 0, False: 0]
  ------------------
  963|  4.31k|    assert(acceleration >= 1);
  964|       |
  965|  4.31k|    lowLimit = (const BYTE*)source - (dictDirective == withPrefix64k ? dictSize : 0);
  ------------------
  |  Branch (965:39): [True: 0, False: 4.31k]
  ------------------
  966|       |
  967|       |    /* Update context state */
  968|  4.31k|    if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (968:9): [True: 0, False: 4.31k]
  ------------------
  969|       |        /* Subsequent linked blocks can't use the dictionary. */
  970|       |        /* Instead, they use the block we just compressed. */
  971|      0|        cctx->dictCtx = NULL;
  972|      0|        cctx->dictSize = (U32)inputSize;
  973|  4.31k|    } else {
  974|  4.31k|        cctx->dictSize += (U32)inputSize;
  975|  4.31k|    }
  976|  4.31k|    cctx->currentOffset += (U32)inputSize;
  977|  4.31k|    cctx->tableType = (U32)tableType;
  978|       |
  979|  4.31k|    if (inputSize<LZ4_minLength) goto _last_literals;        /* Input too small, no compression (all literals) */
  ------------------
  |  Branch (979:9): [True: 715, False: 3.60k]
  ------------------
  980|       |
  981|       |    /* First Byte */
  982|  3.60k|    {   U32 const h = LZ4_hashPosition(ip, tableType);
  983|  3.60k|        if (tableType == byPtr) {
  ------------------
  |  Branch (983:13): [True: 0, False: 3.60k]
  ------------------
  984|      0|            LZ4_putPositionOnHash(ip, h, cctx->hashTable, byPtr);
  985|  3.60k|        } else {
  986|  3.60k|            LZ4_putIndexOnHash(startIndex, h, cctx->hashTable, tableType);
  987|  3.60k|    }   }
  988|  3.60k|    ip++; forwardH = LZ4_hashPosition(ip, tableType);
  989|       |
  990|       |    /* Main Loop */
  991|  1.08M|    for ( ; ; ) {
  992|  1.08M|        const BYTE* match;
  993|  1.08M|        BYTE* token;
  994|  1.08M|        const BYTE* filledIp;
  995|       |
  996|       |        /* Find a match */
  997|  1.08M|        if (tableType == byPtr) {
  ------------------
  |  Branch (997:13): [True: 0, False: 1.08M]
  ------------------
  998|      0|            const BYTE* forwardIp = ip;
  999|      0|            int step = 1;
 1000|      0|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1001|      0|            do {
 1002|      0|                U32 const h = forwardH;
 1003|      0|                ip = forwardIp;
 1004|      0|                forwardIp += step;
 1005|      0|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1006|       |
 1007|      0|                if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
  ------------------
  |  |  179|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1008|      0|                assert(ip < mflimitPlusOne);
 1009|       |
 1010|      0|                match = LZ4_getPositionOnHash(h, cctx->hashTable, tableType);
 1011|      0|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1012|      0|                LZ4_putPositionOnHash(ip, h, cctx->hashTable, tableType);
 1013|       |
 1014|      0|            } while ( (match+LZ4_DISTANCE_MAX < ip)
  ------------------
  |  |  653|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1014:23): [True: 0, False: 0]
  ------------------
 1015|      0|                   || (LZ4_read32(match) != LZ4_read32(ip)) );
  ------------------
  |  Branch (1015:23): [True: 0, False: 0]
  ------------------
 1016|       |
 1017|  1.08M|        } else {   /* byU32, byU16 */
 1018|       |
 1019|  1.08M|            const BYTE* forwardIp = ip;
 1020|  1.08M|            int step = 1;
 1021|  1.08M|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1022|  11.5M|            do {
 1023|  11.5M|                U32 const h = forwardH;
 1024|  11.5M|                U32 const current = (U32)(forwardIp - base);
 1025|  11.5M|                U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1026|  11.5M|                assert(matchIndex <= current);
 1027|  11.5M|                assert(forwardIp - base < (ptrdiff_t)(2 GB - 1));
 1028|  11.5M|                ip = forwardIp;
 1029|  11.5M|                forwardIp += step;
 1030|  11.5M|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1031|       |
 1032|  11.5M|                if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
  ------------------
  |  |  179|  11.5M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  11.5M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 1.47k, False: 11.5M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1033|  11.5M|                assert(ip < mflimitPlusOne);
 1034|       |
 1035|  11.5M|                if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1035:21): [True: 0, False: 11.5M]
  ------------------
 1036|      0|                    if (matchIndex < startIndex) {
  ------------------
  |  Branch (1036:25): [True: 0, False: 0]
  ------------------
 1037|       |                        /* there was no match, try the dictionary */
 1038|      0|                        assert(tableType == byU32);
 1039|      0|                        matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32);
 1040|      0|                        match = dictBase + matchIndex;
 1041|      0|                        matchIndex += dictDelta;   /* make dictCtx index comparable with current context */
 1042|      0|                        lowLimit = dictionary;
 1043|      0|                    } else {
 1044|      0|                        match = base + matchIndex;
 1045|      0|                        lowLimit = (const BYTE*)source;
 1046|      0|                    }
 1047|  11.5M|                } else if (dictDirective == usingExtDict) {
  ------------------
  |  Branch (1047:28): [True: 0, False: 11.5M]
  ------------------
 1048|      0|                    if (matchIndex < startIndex) {
  ------------------
  |  Branch (1048:25): [True: 0, False: 0]
  ------------------
 1049|      0|                        DEBUGLOG(7, "extDict candidate: matchIndex=%5u  <  startIndex=%5u", matchIndex, startIndex);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1050|      0|                        assert(startIndex - matchIndex >= MINMATCH);
 1051|      0|                        assert(dictBase);
 1052|      0|                        match = dictBase + matchIndex;
 1053|      0|                        lowLimit = dictionary;
 1054|      0|                    } else {
 1055|      0|                        match = base + matchIndex;
 1056|      0|                        lowLimit = (const BYTE*)source;
 1057|      0|                    }
 1058|  11.5M|                } else {   /* single continuous memory segment */
 1059|  11.5M|                    match = base + matchIndex;
 1060|  11.5M|                }
 1061|  11.5M|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1062|  11.5M|                LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1063|       |
 1064|  11.5M|                DEBUGLOG(7, "candidate at pos=%u  (offset=%u \n", matchIndex, current - matchIndex);
  ------------------
  |  |  288|  11.5M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1065|  11.5M|                if ((dictIssue == dictSmall) && (matchIndex < prefixIdxLimit)) { continue; }    /* match outside of valid area */
  ------------------
  |  Branch (1065:21): [True: 37.9k, False: 11.5M]
  |  Branch (1065:49): [True: 32.2k, False: 5.70k]
  ------------------
 1066|  11.5M|                assert(matchIndex < current);
 1067|  11.5M|                if ( ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  653|  6.70M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                              if ( ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  254|  6.70M|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
  |  Branch (1067:23): [True: 4.84M, False: 6.70M]
  |  Branch (1067:47): [Folded - Ignored]
  ------------------
 1068|  11.5M|                  && (matchIndex+LZ4_DISTANCE_MAX < current)) {
  ------------------
  |  |  653|  4.84M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1068:22): [True: 558k, False: 4.28M]
  ------------------
 1069|   558k|                    continue;
 1070|   558k|                } /* too far */
 1071|  10.9M|                assert((current - matchIndex) <= LZ4_DISTANCE_MAX);  /* match now expected within distance */
 1072|       |
 1073|  10.9M|                if (LZ4_read32(match) == LZ4_read32(ip)) {
  ------------------
  |  Branch (1073:21): [True: 1.08M, False: 9.91M]
  ------------------
 1074|  1.08M|                    if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1074:25): [True: 0, False: 1.08M]
  ------------------
 1075|  1.08M|                    break;   /* match found */
 1076|  1.08M|                }
 1077|       |
 1078|  10.9M|            } while(1);
  ------------------
  |  Branch (1078:21): [Folded - Ignored]
  ------------------
 1079|  1.08M|        }
 1080|       |
 1081|       |        /* Catch up */
 1082|  1.08M|        filledIp = ip;
 1083|  1.74M|        while (((ip>anchor) & (match > lowLimit)) && (unlikely(ip[-1]==match[-1]))) { ip--; match--; }
  ------------------
  |  |  179|  1.68M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  1.68M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1083:16): [True: 1.68M, False: 59.6k]
  |  Branch (1083:54): [True: 667k, False: 1.02M]
  ------------------
 1084|       |
 1085|       |        /* Encode Literals */
 1086|  1.08M|        {   unsigned const litLength = (unsigned)(ip - anchor);
 1087|  1.08M|            token = op++;
 1088|  1.08M|            if ((outputDirective == limitedOutput) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1088:17): [True: 1.08M, False: 0]
  ------------------
 1089|  1.08M|                (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength/255) > olimit)) ) {
  ------------------
  |  |  179|  1.08M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  1.08M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1089:17): [True: 27, False: 1.08M]
  ------------------
 1090|     27|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1091|     27|            }
 1092|  1.08M|            if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1092:17): [True: 0, False: 1.08M]
  ------------------
 1093|  1.08M|                (unlikely(op + (litLength+240)/255 /* litlen */ + litLength /* literals */ + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit))) {
  ------------------
  |  |  179|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1093:17): [True: 0, False: 0]
  ------------------
 1094|      0|                op--;
 1095|      0|                goto _last_literals;
 1096|      0|            }
 1097|  1.08M|            if (litLength >= RUN_MASK) {
  ------------------
  |  |  262|  1.08M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.08M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  1.08M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1097:17): [True: 142k, False: 938k]
  ------------------
 1098|   142k|                int len = (int)(litLength - RUN_MASK);
  ------------------
  |  |  262|   142k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   142k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|   142k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1099|   142k|                *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  262|   142k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   142k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|   142k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                              *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  259|   142k|#define ML_BITS  4
  ------------------
 1100|   266k|                for(; len >= 255 ; len-=255) *op++ = 255;
  ------------------
  |  Branch (1100:23): [True: 123k, False: 142k]
  ------------------
 1101|   142k|                *op++ = (BYTE)len;
 1102|   142k|            }
 1103|   938k|            else *token = (BYTE)(litLength<<ML_BITS);
  ------------------
  |  |  259|   938k|#define ML_BITS  4
  ------------------
 1104|       |
 1105|       |            /* Copy Literals */
 1106|  1.08M|            LZ4_wildCopy8(op, anchor, op+litLength);
 1107|  1.08M|            op+=litLength;
 1108|  1.08M|            DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  288|  1.08M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1109|  1.08M|                        (int)(anchor-(const BYTE*)source), litLength, (int)(ip-(const BYTE*)source));
 1110|  1.08M|        }
 1111|       |
 1112|  2.82M|_next_match:
 1113|       |        /* at this stage, the following variables must be correctly set :
 1114|       |         * - ip : at start of LZ operation
 1115|       |         * - match : at start of previous pattern occurrence; can be within current prefix, or within extDict
 1116|       |         * - offset : if maybe_ext_memSegment==1 (constant)
 1117|       |         * - lowLimit : must be == dictionary to mean "match is within extDict"; must be == source otherwise
 1118|       |         * - token and *token : position to write 4-bits for match length; higher 4-bits for literal length supposed already written
 1119|       |         */
 1120|       |
 1121|  2.82M|        if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1121:13): [True: 0, False: 2.82M]
  ------------------
 1122|  2.82M|            (op + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit)) {
  ------------------
  |  |  245|      0|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          (op + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit)) {
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
  |  Branch (1122:13): [True: 0, False: 0]
  ------------------
 1123|       |            /* the match was too close to the end, rewind and go to last literals */
 1124|      0|            op = token;
 1125|      0|            goto _last_literals;
 1126|      0|        }
 1127|       |
 1128|       |        /* Encode Offset */
 1129|  2.82M|        if (maybe_extMem) {   /* static test */
  ------------------
  |  Branch (1129:13): [True: 0, False: 2.82M]
  ------------------
 1130|      0|            DEBUGLOG(6, "             with offset=%u  (ext if > %i)", offset, (int)(ip - (const BYTE*)source));
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1131|      0|            assert(offset <= LZ4_DISTANCE_MAX && offset > 0);
 1132|      0|            LZ4_writeLE16(op, (U16)offset); op+=2;
 1133|  2.82M|        } else  {
 1134|  2.82M|            DEBUGLOG(6, "             with offset=%u  (same segment)", (U32)(ip - match));
  ------------------
  |  |  288|  2.82M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1135|  2.82M|            assert(ip-match <= LZ4_DISTANCE_MAX);
 1136|  2.82M|            LZ4_writeLE16(op, (U16)(ip - match)); op+=2;
 1137|  2.82M|        }
 1138|       |
 1139|       |        /* Encode MatchLength */
 1140|  2.82M|        {   unsigned matchCode;
 1141|       |
 1142|  2.82M|            if ( (dictDirective==usingExtDict || dictDirective==usingDictCtx)
  ------------------
  |  Branch (1142:19): [True: 0, False: 2.82M]
  |  Branch (1142:50): [True: 0, False: 2.82M]
  ------------------
 1143|  2.82M|              && (lowLimit==dictionary) /* match within extDict */ ) {
  ------------------
  |  Branch (1143:18): [True: 0, False: 0]
  ------------------
 1144|      0|                const BYTE* limit = ip + (dictEnd-match);
 1145|      0|                assert(dictEnd > match);
 1146|      0|                if (limit > matchlimit) limit = matchlimit;
  ------------------
  |  Branch (1146:21): [True: 0, False: 0]
  ------------------
 1147|      0|                matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, limit);
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
                              matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, limit);
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
 1148|      0|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
 1149|      0|                if (ip==limit) {
  ------------------
  |  Branch (1149:21): [True: 0, False: 0]
  ------------------
 1150|      0|                    unsigned const more = LZ4_count(limit, (const BYTE*)source, matchlimit);
 1151|      0|                    matchCode += more;
 1152|      0|                    ip += more;
 1153|      0|                }
 1154|      0|                DEBUGLOG(6, "             with matchLength=%u starting in extDict", matchCode+MINMATCH);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1155|  2.82M|            } else {
 1156|  2.82M|                matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  241|  2.82M|#define MINMATCH 4
  ------------------
                              matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  241|  2.82M|#define MINMATCH 4
  ------------------
 1157|  2.82M|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  241|  2.82M|#define MINMATCH 4
  ------------------
 1158|  2.82M|                DEBUGLOG(6, "             with matchLength=%u", matchCode+MINMATCH);
  ------------------
  |  |  288|  2.82M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1159|  2.82M|            }
 1160|       |
 1161|  2.82M|            if ((outputDirective) &&    /* Check output buffer overflow */
  ------------------
  |  Branch (1161:17): [True: 2.82M, False: 0]
  ------------------
 1162|  2.82M|                (unlikely(op + (1 + LASTLITERALS) + (matchCode+240)/255 > olimit)) ) {
  ------------------
  |  |  179|  2.82M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  2.82M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1162:17): [True: 22, False: 2.82M]
  ------------------
 1163|     22|                if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1163:21): [True: 0, False: 22]
  ------------------
 1164|       |                    /* Match description too long : reduce it */
 1165|      0|                    U32 newMatchCode = 15 /* in token */ - 1 /* to avoid needing a zero byte */ + ((U32)(olimit - op) - 1 - LASTLITERALS) * 255;
  ------------------
  |  |  244|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1166|      0|                    ip -= matchCode - newMatchCode;
 1167|      0|                    assert(newMatchCode < matchCode);
 1168|      0|                    matchCode = newMatchCode;
 1169|      0|                    if (unlikely(ip <= filledIp)) {
  ------------------
  |  |  179|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1170|       |                        /* We have already filled up to filledIp so if ip ends up less than filledIp
 1171|       |                         * we have positions in the hash table beyond the current position. This is
 1172|       |                         * a problem if we reuse the hash table. So we have to remove these positions
 1173|       |                         * from the hash table.
 1174|       |                         */
 1175|      0|                        const BYTE* ptr;
 1176|      0|                        DEBUGLOG(5, "Clearing %u positions", (U32)(filledIp - ip));
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1177|      0|                        for (ptr = ip; ptr <= filledIp; ++ptr) {
  ------------------
  |  Branch (1177:40): [True: 0, False: 0]
  ------------------
 1178|      0|                            U32 const h = LZ4_hashPosition(ptr, tableType);
 1179|      0|                            LZ4_clearHash(h, cctx->hashTable, tableType);
 1180|      0|                        }
 1181|      0|                    }
 1182|     22|                } else {
 1183|     22|                    assert(outputDirective == limitedOutput);
 1184|     22|                    return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1185|     22|                }
 1186|     22|            }
 1187|  2.82M|            if (matchCode >= ML_MASK) {
  ------------------
  |  |  260|  2.82M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  2.82M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (1187:17): [True: 593k, False: 2.23M]
  ------------------
 1188|   593k|                *token += ML_MASK;
  ------------------
  |  |  260|   593k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|   593k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1189|   593k|                matchCode -= ML_MASK;
  ------------------
  |  |  260|   593k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|   593k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1190|   593k|                LZ4_write32(op, 0xFFFFFFFF);
 1191|   643k|                while (matchCode >= 4*255) {
  ------------------
  |  Branch (1191:24): [True: 49.3k, False: 593k]
  ------------------
 1192|  49.3k|                    op+=4;
 1193|  49.3k|                    LZ4_write32(op, 0xFFFFFFFF);
 1194|  49.3k|                    matchCode -= 4*255;
 1195|  49.3k|                }
 1196|   593k|                op += matchCode / 255;
 1197|   593k|                *op++ = (BYTE)(matchCode % 255);
 1198|   593k|            } else
 1199|  2.23M|                *token += (BYTE)(matchCode);
 1200|  2.82M|        }
 1201|       |        /* Ensure we have enough space for the last literals. */
 1202|      0|        assert(!(outputDirective == fillOutput && op + 1 + LASTLITERALS > olimit));
 1203|       |
 1204|  2.82M|        anchor = ip;
 1205|       |
 1206|       |        /* Test end of chunk */
 1207|  2.82M|        if (ip >= mflimitPlusOne) break;
  ------------------
  |  Branch (1207:13): [True: 2.08k, False: 2.82M]
  ------------------
 1208|       |
 1209|       |        /* Fill table */
 1210|  2.82M|        {   U32 const h = LZ4_hashPosition(ip-2, tableType);
 1211|  2.82M|            if (tableType == byPtr) {
  ------------------
  |  Branch (1211:17): [True: 0, False: 2.82M]
  ------------------
 1212|      0|                LZ4_putPositionOnHash(ip-2, h, cctx->hashTable, byPtr);
 1213|  2.82M|            } else {
 1214|  2.82M|                U32 const idx = (U32)((ip-2) - base);
 1215|  2.82M|                LZ4_putIndexOnHash(idx, h, cctx->hashTable, tableType);
 1216|  2.82M|        }   }
 1217|       |
 1218|       |        /* Test next position */
 1219|  2.82M|        if (tableType == byPtr) {
  ------------------
  |  Branch (1219:13): [True: 0, False: 2.82M]
  ------------------
 1220|       |
 1221|      0|            match = LZ4_getPosition(ip, cctx->hashTable, tableType);
 1222|      0|            LZ4_putPosition(ip, cctx->hashTable, tableType);
 1223|      0|            if ( (match+LZ4_DISTANCE_MAX >= ip)
  ------------------
  |  |  653|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1223:18): [True: 0, False: 0]
  ------------------
 1224|      0|              && (LZ4_read32(match) == LZ4_read32(ip)) )
  ------------------
  |  Branch (1224:18): [True: 0, False: 0]
  ------------------
 1225|      0|            { token=op++; *token=0; goto _next_match; }
 1226|       |
 1227|  2.82M|        } else {   /* byU32, byU16 */
 1228|       |
 1229|  2.82M|            U32 const h = LZ4_hashPosition(ip, tableType);
 1230|  2.82M|            U32 const current = (U32)(ip-base);
 1231|  2.82M|            U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1232|  2.82M|            assert(matchIndex < current);
 1233|  2.82M|            if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1233:17): [True: 0, False: 2.82M]
  ------------------
 1234|      0|                if (matchIndex < startIndex) {
  ------------------
  |  Branch (1234:21): [True: 0, False: 0]
  ------------------
 1235|       |                    /* there was no match, try the dictionary */
 1236|      0|                    assert(tableType == byU32);
 1237|      0|                    matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32);
 1238|      0|                    match = dictBase + matchIndex;
 1239|      0|                    lowLimit = dictionary;   /* required for match length counter */
 1240|      0|                    matchIndex += dictDelta;
 1241|      0|                } else {
 1242|      0|                    match = base + matchIndex;
 1243|      0|                    lowLimit = (const BYTE*)source;  /* required for match length counter */
 1244|      0|                }
 1245|  2.82M|            } else if (dictDirective==usingExtDict) {
  ------------------
  |  Branch (1245:24): [True: 0, False: 2.82M]
  ------------------
 1246|      0|                if (matchIndex < startIndex) {
  ------------------
  |  Branch (1246:21): [True: 0, False: 0]
  ------------------
 1247|      0|                    assert(dictBase);
 1248|      0|                    match = dictBase + matchIndex;
 1249|      0|                    lowLimit = dictionary;   /* required for match length counter */
 1250|      0|                } else {
 1251|      0|                    match = base + matchIndex;
 1252|      0|                    lowLimit = (const BYTE*)source;   /* required for match length counter */
 1253|      0|                }
 1254|  2.82M|            } else {   /* single memory segment */
 1255|  2.82M|                match = base + matchIndex;
 1256|  2.82M|            }
 1257|  2.82M|            LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1258|  2.82M|            assert(matchIndex < current);
 1259|  2.82M|            if ( ((dictIssue==dictSmall) ? (matchIndex >= prefixIdxLimit) : 1)
  ------------------
  |  Branch (1259:18): [True: 2.82M, False: 3.03k]
  |  Branch (1259:19): [True: 6.44k, False: 2.81M]
  ------------------
 1260|  2.82M|              && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  653|  2.03M|#  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))
  ------------------
  |  |  254|  2.03M|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
                            && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  653|   784k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1260:18): [True: 2.76M, False: 59.0k]
  |  Branch (1260:20): [True: 2.03M, False: 784k]
  |  Branch (1260:42): [Folded - Ignored]
  ------------------
 1261|  2.82M|              && (LZ4_read32(match) == LZ4_read32(ip)) ) {
  ------------------
  |  Branch (1261:18): [True: 1.74M, False: 1.01M]
  ------------------
 1262|  1.74M|                token=op++;
 1263|  1.74M|                *token=0;
 1264|  1.74M|                if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1264:21): [True: 0, False: 1.74M]
  ------------------
 1265|  1.74M|                DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  288|  1.74M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1266|  1.74M|                            (int)(anchor-(const BYTE*)source), 0, (int)(ip-(const BYTE*)source));
 1267|  1.74M|                goto _next_match;
 1268|  1.74M|            }
 1269|  2.82M|        }
 1270|       |
 1271|       |        /* Prepare next loop */
 1272|  1.07M|        forwardH = LZ4_hashPosition(++ip, tableType);
 1273|       |
 1274|  1.07M|    }
 1275|       |
 1276|  4.27k|_last_literals:
 1277|       |    /* Encode Last Literals */
 1278|  4.27k|    {   size_t lastRun = (size_t)(iend - anchor);
 1279|  4.27k|        if ( (outputDirective) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1279:14): [True: 4.27k, False: 0]
  ------------------
 1280|  4.27k|            (op + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > olimit)) {
  ------------------
  |  |  262|  4.27k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  4.27k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  4.27k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1280:13): [True: 1.45k, False: 2.81k]
  ------------------
 1281|  1.45k|            if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1281:17): [True: 0, False: 1.45k]
  ------------------
 1282|       |                /* adapt lastRun to fill 'dst' */
 1283|      0|                assert(olimit >= op);
 1284|      0|                lastRun  = (size_t)(olimit-op) - 1/*token*/;
 1285|      0|                lastRun -= (lastRun + 256 - RUN_MASK) / 256;  /*additional length tokens*/
  ------------------
  |  |  262|      0|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|      0|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|      0|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1286|  1.45k|            } else {
 1287|  1.45k|                assert(outputDirective == limitedOutput);
 1288|  1.45k|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1289|  1.45k|            }
 1290|  1.45k|        }
 1291|  2.81k|        DEBUGLOG(6, "Final literal run : %i literals", (int)lastRun);
  ------------------
  |  |  288|  2.81k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1292|  2.81k|        if (lastRun >= RUN_MASK) {
  ------------------
  |  |  262|  2.81k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  2.81k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  2.81k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1292:13): [True: 578, False: 2.23k]
  ------------------
 1293|    578|            size_t accumulator = lastRun - RUN_MASK;
  ------------------
  |  |  262|    578|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|    578|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|    578|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1294|    578|            *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  262|    578|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|    578|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|    578|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  259|    578|#define ML_BITS  4
  ------------------
 1295|  23.5k|            for(; accumulator >= 255 ; accumulator-=255) *op++ = 255;
  ------------------
  |  Branch (1295:19): [True: 22.9k, False: 578]
  ------------------
 1296|    578|            *op++ = (BYTE) accumulator;
 1297|  2.23k|        } else {
 1298|  2.23k|            *op++ = (BYTE)(lastRun<<ML_BITS);
  ------------------
  |  |  259|  2.23k|#define ML_BITS  4
  ------------------
 1299|  2.23k|        }
 1300|  2.81k|        LZ4_memcpy(op, anchor, lastRun);
  ------------------
  |  |  348|  2.81k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 1301|  2.81k|        ip = anchor + lastRun;
 1302|  2.81k|        op += lastRun;
 1303|  2.81k|    }
 1304|       |
 1305|  2.81k|    if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1305:9): [True: 0, False: 2.81k]
  ------------------
 1306|      0|        *inputConsumed = (int) (((const char*)ip)-source);
 1307|      0|    }
 1308|  2.81k|    result = (int)(((char*)op) - dest);
 1309|  2.81k|    assert(result > 0);
 1310|  2.81k|    DEBUGLOG(5, "LZ4_compress_generic: compressed %i bytes into %i bytes", inputSize, result);
  ------------------
  |  |  288|  2.81k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1311|  2.81k|    return result;
 1312|  2.81k|}
lz4.c:LZ4_read32:
  388|  39.0M|static U32 LZ4_read32(const void* ptr) { return ((const LZ4_unalign32*)ptr)->u32; }
lz4.c:LZ4_getIndexOnHash:
  831|  14.4M|{
  832|  14.4M|    LZ4_STATIC_ASSERT(LZ4_MEMORY_USAGE > 2);
  ------------------
  |  |  276|  14.4M|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
  833|  14.4M|    if (tableType == byU32) {
  ------------------
  |  Branch (833:9): [True: 5.63M, False: 8.78M]
  ------------------
  834|  5.63M|        const U32* const hashTable = (const U32*) tableBase;
  835|  5.63M|        assert(h < (1U << (LZ4_MEMORY_USAGE-2)));
  836|  5.63M|        return hashTable[h];
  837|  5.63M|    }
  838|  8.78M|    if (tableType == byU16) {
  ------------------
  |  Branch (838:9): [True: 8.78M, False: 0]
  ------------------
  839|  8.78M|        const U16* const hashTable = (const U16*) tableBase;
  840|  8.78M|        assert(h < (1U << (LZ4_MEMORY_USAGE-1)));
  841|  8.78M|        return hashTable[h];
  842|  8.78M|    }
  843|      0|    assert(0); return 0;  /* forbidden case */
  844|      0|}
lz4.c:LZ4_wildCopy8:
  448|  1.19M|{
  449|  1.19M|    BYTE* d = (BYTE*)dstPtr;
  450|  1.19M|    const BYTE* s = (const BYTE*)srcPtr;
  451|  1.19M|    BYTE* const e = (BYTE*)dstEnd;
  452|       |
  453|  11.2M|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  348|  11.2M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (453:50): [True: 10.0M, False: 1.19M]
  ------------------
  454|  1.19M|}
lz4.c:LZ4_writeLE16:
  435|  2.82M|{
  436|  2.82M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (436:9): [True: 2.82M, False: 0]
  ------------------
  437|  2.82M|        LZ4_write16(memPtr, value);
  438|  2.82M|    } else {
  439|      0|        BYTE* p = (BYTE*)memPtr;
  440|      0|        p[0] = (BYTE) value;
  441|      0|        p[1] = (BYTE)(value>>8);
  442|      0|    }
  443|  2.82M|}
lz4.c:LZ4_isLittleEndian:
  363|  17.6M|{
  364|  17.6M|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  365|  17.6M|    return one.c[0];
  366|  17.6M|}
lz4.c:LZ4_write16:
  391|  2.82M|static void LZ4_write16(void* memPtr, U16 value) { ((LZ4_unalign16*)memPtr)->u16 = value; }
lz4.c:LZ4_count:
  663|  2.82M|{
  664|  2.82M|    const BYTE* const pStart = pIn;
  665|       |
  666|  2.82M|    if (likely(pIn < pInLimit-(STEPSIZE-1))) {
  ------------------
  |  |  176|  2.82M|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  170|  2.82M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 2.82M, False: 943]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  667|  2.82M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  668|  2.82M|        if (!diff) {
  ------------------
  |  Branch (668:13): [True: 740k, False: 2.08M]
  ------------------
  669|   740k|            pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  660|   740k|#define STEPSIZE sizeof(reg_t)
  ------------------
                          pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  660|   740k|#define STEPSIZE sizeof(reg_t)
  ------------------
  670|  2.08M|        } else {
  671|  2.08M|            return LZ4_NbCommonBytes(diff);
  672|  2.08M|    }   }
  673|       |
  674|  10.9M|    while (likely(pIn < pInLimit-(STEPSIZE-1))) {
  675|  10.9M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  676|  10.9M|        if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  660|  10.2M|#define STEPSIZE sizeof(reg_t)
  ------------------
                      if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  660|  10.2M|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (676:13): [True: 10.2M, False: 739k]
  ------------------
  677|   739k|        pIn += LZ4_NbCommonBytes(diff);
  678|   739k|        return (unsigned)(pIn - pStart);
  679|  10.9M|    }
  680|       |
  681|  2.11k|    if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  |  660|  2.11k|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (681:9): [Folded - Ignored]
  |  Branch (681:26): [True: 1.25k, False: 866]
  |  Branch (681:48): [True: 666, False: 587]
  ------------------
  682|  2.11k|    if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (682:9): [True: 1.57k, False: 547]
  |  Branch (682:31): [True: 842, False: 730]
  ------------------
  683|  2.11k|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (683:9): [True: 1.46k, False: 654]
  |  Branch (683:27): [True: 769, False: 696]
  ------------------
  684|  2.11k|    return (unsigned)(pIn - pStart);
  685|   741k|}
lz4.c:LZ4_read_ARCH:
  389|  34.3M|static reg_t LZ4_read_ARCH(const void* ptr) { return ((const LZ4_unalignST*)ptr)->uArch; }
lz4.c:LZ4_NbCommonBytes:
  562|  2.82M|{
  563|  2.82M|    assert(val != 0);
  564|  2.82M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (564:9): [True: 2.82M, False: 0]
  ------------------
  565|  2.82M|        if (sizeof(val) == 8) {
  ------------------
  |  Branch (565:13): [Folded - Ignored]
  ------------------
  566|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1800) && (defined(_M_AMD64) && !defined(_M_ARM64EC)) && !defined(LZ4_FORCE_SW_BITCOUNT)
  567|       |/*-*************************************************************************************************
  568|       |* ARM64EC is a Microsoft-designed ARM64 ABI compatible with AMD64 applications on ARM64 Windows 11.
  569|       |* The ARM64EC ABI does not support AVX/AVX2/AVX512 instructions, nor their relevant intrinsics
  570|       |* including _tzcnt_u64. Therefore, we need to neuter the _tzcnt_u64 code path for ARM64EC.
  571|       |****************************************************************************************************/
  572|       |#         if defined(__clang__) && (__clang_major__ < 10)
  573|       |            /* Avoid undefined clang-cl intrinsics issue.
  574|       |             * See https://github.com/lz4/lz4/pull/1017 for details. */
  575|       |            return (unsigned)__builtin_ia32_tzcnt_u64(val) >> 3;
  576|       |#         else
  577|       |            /* x64 CPUS without BMI support interpret `TZCNT` as `REP BSF` */
  578|       |            return (unsigned)_tzcnt_u64(val) >> 3;
  579|       |#         endif
  580|       |#       elif defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT)
  581|       |            unsigned long r = 0;
  582|       |            _BitScanForward64(&r, (U64)val);
  583|       |            return (unsigned)r >> 3;
  584|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  585|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  586|       |                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  587|  2.82M|            return (unsigned)__builtin_ctzll((U64)val) >> 3;
  588|       |#       else
  589|       |            const U64 m = 0x0101010101010101ULL;
  590|       |            val ^= val - 1;
  591|       |            return (unsigned)(((U64)((val & (m - 1)) * m)) >> 56);
  592|       |#       endif
  593|  2.82M|        } else /* 32 bits */ {
  594|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT)
  595|       |            unsigned long r;
  596|       |            _BitScanForward(&r, (U32)val);
  597|       |            return (unsigned)r >> 3;
  598|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  599|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  600|       |                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  601|      0|            return (unsigned)__builtin_ctz((U32)val) >> 3;
  602|       |#       else
  603|       |            const U32 m = 0x01010101;
  604|       |            return (unsigned)((((val - 1) ^ val) & (m - 1)) * m) >> 24;
  605|       |#       endif
  606|      0|        }
  607|  2.82M|    } else   /* Big Endian CPU */ {
  608|      0|        if (sizeof(val)==8) {
  ------------------
  |  Branch (608:13): [Folded - Ignored]
  ------------------
  609|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  610|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  611|      0|                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  612|      0|            return (unsigned)__builtin_clzll((U64)val) >> 3;
  613|       |#       else
  614|       |#if 1
  615|       |            /* this method is probably faster,
  616|       |             * but adds a 128 bytes lookup table */
  617|       |            static const unsigned char ctz7_tab[128] = {
  618|       |                7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  619|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  620|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  621|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  622|       |                6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  623|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  624|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  625|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  626|       |            };
  627|       |            U64 const mask = 0x0101010101010101ULL;
  628|       |            U64 const t = (((val >> 8) - mask) | val) & mask;
  629|       |            return ctz7_tab[(t * 0x0080402010080402ULL) >> 57];
  630|       |#else
  631|       |            /* this method doesn't consume memory space like the previous one,
  632|       |             * but it contains several branches,
  633|       |             * that may end up slowing execution */
  634|       |            static const U32 by32 = sizeof(val)*4;  /* 32 on 64 bits (goal), 16 on 32 bits.
  635|       |            Just to avoid some static analyzer complaining about shift by 32 on 32-bits target.
  636|       |            Note that this code path is never triggered in 32-bits mode. */
  637|       |            unsigned r;
  638|       |            if (!(val>>by32)) { r=4; } else { r=0; val>>=by32; }
  639|       |            if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; }
  640|       |            r += (!val);
  641|       |            return r;
  642|       |#endif
  643|       |#       endif
  644|      0|        } else /* 32 bits */ {
  645|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  646|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  647|      0|                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  648|      0|            return (unsigned)__builtin_clz((U32)val) >> 3;
  649|       |#       else
  650|       |            val >>= 8;
  651|       |            val = ((((val + 0x00FFFF00) | 0x00FFFFFF) + val) |
  652|       |              (val + 0x00FF0000)) >> 24;
  653|       |            return (unsigned)val ^ 3;
  654|       |#       endif
  655|      0|        }
  656|      0|    }
  657|  2.82M|}
lz4.c:LZ4_read16:
  387|  5.24M|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  392|   732k|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_prepareTable:
  863|  4.31k|           const tableType_t tableType) {
  864|       |    /* If the table hasn't been used, it's guaranteed to be zeroed out, and is
  865|       |     * therefore safe to use no matter what mode we're in. Otherwise, we figure
  866|       |     * out if it's safe to leave as is or whether it needs to be reset.
  867|       |     */
  868|  4.31k|    if ((tableType_t)cctx->tableType != clearedTable) {
  ------------------
  |  Branch (868:9): [True: 2.30k, False: 2.01k]
  ------------------
  869|  2.30k|        assert(inputSize >= 0);
  870|  2.30k|        if ((tableType_t)cctx->tableType != tableType
  ------------------
  |  Branch (870:13): [True: 119, False: 2.18k]
  ------------------
  871|  2.30k|          || ((tableType == byU16) && cctx->currentOffset + (unsigned)inputSize >= 0xFFFFU)
  ------------------
  |  Branch (871:15): [True: 2.09k, False: 95]
  |  Branch (871:39): [True: 1.36k, False: 734]
  ------------------
  872|  2.30k|          || ((tableType == byU32) && cctx->currentOffset > 1 GB)
  ------------------
  |  |  252|     95|#define GB *(1U<<30)
  ------------------
  |  Branch (872:15): [True: 95, False: 734]
  |  Branch (872:39): [True: 0, False: 95]
  ------------------
  873|  2.30k|          || tableType == byPtr
  ------------------
  |  Branch (873:14): [True: 0, False: 829]
  ------------------
  874|  2.30k|          || inputSize >= 4 KB)
  ------------------
  |  |  250|    829|#define KB *(1 <<10)
  ------------------
  |  Branch (874:14): [True: 167, False: 662]
  ------------------
  875|  1.64k|        {
  876|  1.64k|            DEBUGLOG(4, "LZ4_prepareTable: Resetting table in %p", cctx);
  ------------------
  |  |  288|  1.64k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  877|  1.64k|            MEM_INIT(cctx->hashTable, 0, LZ4_HASHTABLESIZE);
  ------------------
  |  |  235|  1.64k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  233|  1.64k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  878|  1.64k|            cctx->currentOffset = 0;
  879|  1.64k|            cctx->tableType = (U32)clearedTable;
  880|  1.64k|        } else {
  881|    662|            DEBUGLOG(4, "LZ4_prepareTable: Re-use hash table (no reset)");
  ------------------
  |  |  288|    662|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  882|    662|        }
  883|  2.30k|    }
  884|       |
  885|       |    /* Adding a gap, so all previous entries are > LZ4_DISTANCE_MAX back,
  886|       |     * is faster than compressing without a gap.
  887|       |     * However, compressing with currentOffset == 0 is faster still,
  888|       |     * so we preserve that case.
  889|       |     */
  890|  4.31k|    if (cctx->currentOffset != 0 && tableType == byU32) {
  ------------------
  |  Branch (890:9): [True: 662, False: 3.65k]
  |  Branch (890:37): [True: 0, False: 662]
  ------------------
  891|      0|        DEBUGLOG(5, "LZ4_prepareTable: adding 64KB to currentOffset");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  892|      0|        cctx->currentOffset += 64 KB;
  ------------------
  |  |  250|      0|#define KB *(1 <<10)
  ------------------
  893|      0|    }
  894|       |
  895|       |    /* Finally, clear history */
  896|  4.31k|    cctx->dictCtx = NULL;
  897|  4.31k|    cctx->dictionary = NULL;
  898|  4.31k|    cctx->dictSize = 0;
  899|  4.31k|}
lz4.c:LZ4_isAligned:
  292|  2.04k|{
  293|  2.04k|    return ((size_t)ptr & (alignment -1)) == 0;
  294|  2.04k|}
lz4.c:LZ4_stream_t_alignment:
 1509|  2.04k|{
 1510|  2.04k|#if LZ4_ALIGN_TEST
 1511|  2.04k|    typedef struct { char c; LZ4_stream_t t; } t_a;
 1512|  2.04k|    return sizeof(t_a) - sizeof(LZ4_stream_t);
 1513|       |#else
 1514|       |    return 1;  /* effectively disabled */
 1515|       |#endif
 1516|  2.04k|}
lz4.c:LZ4_hashPosition:
  780|  18.3M|{
  781|  18.3M|    if ((sizeof(reg_t)==8) && (tableType != byU16)) return LZ4_hash5(LZ4_read_ARCH(p), tableType);
  ------------------
  |  Branch (781:9): [Folded - Ignored]
  |  Branch (781:31): [True: 6.78M, False: 11.5M]
  ------------------
  782|  11.5M|    return LZ4_hash4(LZ4_read32(p), tableType);
  783|  18.3M|}
lz4.c:LZ4_hash5:
  768|  6.78M|{
  769|  6.78M|    const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  674|      0|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  161|      0|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|      0|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  674|  13.5M|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  161|  6.78M|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|  6.78M|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (769:25): [True: 0, False: 6.78M]
  ------------------
  770|  6.78M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (770:9): [True: 6.78M, False: 0]
  ------------------
  771|  6.78M|        const U64 prime5bytes = 889523592379ULL;
  772|  6.78M|        return (U32)(((sequence << 24) * prime5bytes) >> (64 - hashLog));
  773|  6.78M|    } else {
  774|      0|        const U64 prime8bytes = 11400714785074694791ULL;
  775|      0|        return (U32)(((sequence >> 24) * prime8bytes) >> (64 - hashLog));
  776|      0|    }
  777|  6.78M|}
lz4.c:LZ4_hash4:
  760|  11.5M|{
  761|  11.5M|    if (tableType == byU16)
  ------------------
  |  Branch (761:9): [True: 11.5M, False: 0]
  ------------------
  762|  11.5M|        return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
  ------------------
  |  |  241|  11.5M|#define MINMATCH 4
  ------------------
                      return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
  ------------------
  |  |  674|  11.5M|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  161|  11.5M|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|  11.5M|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  763|      0|    else
  764|      0|        return ((sequence * 2654435761U) >> ((MINMATCH*8)-LZ4_HASHLOG));
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
                      return ((sequence * 2654435761U) >> ((MINMATCH*8)-LZ4_HASHLOG));
  ------------------
  |  |  674|      0|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  161|      0|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|      0|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  765|  11.5M|}
lz4.c:LZ4_putIndexOnHash:
  798|  17.2M|{
  799|  17.2M|    switch (tableType)
  800|  17.2M|    {
  801|      0|    default: /* fallthrough */
  ------------------
  |  Branch (801:5): [True: 0, False: 17.2M]
  ------------------
  802|      0|    case clearedTable: /* fallthrough */
  ------------------
  |  Branch (802:5): [True: 0, False: 17.2M]
  ------------------
  803|      0|    case byPtr: { /* illegal! */ assert(0); return; }
  ------------------
  |  Branch (803:5): [True: 0, False: 17.2M]
  ------------------
  804|  6.41M|    case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = idx; return; }
  ------------------
  |  Branch (804:5): [True: 6.41M, False: 10.8M]
  ------------------
  805|  10.8M|    case byU16: { U16* hashTable = (U16*) tableBase; assert(idx < 65536); hashTable[h] = (U16)idx; return; }
  ------------------
  |  Branch (805:5): [True: 10.8M, False: 6.41M]
  ------------------
  806|  17.2M|    }
  807|  17.2M|}
lz4.c:LZ4_decompress_generic:
 1961|  12.8k|{
 1962|  12.8k|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (1962:9): [True: 0, False: 12.8k]
  |  Branch (1962:26): [True: 0, False: 12.8k]
  ------------------
 1963|       |
 1964|  12.8k|    {   const BYTE* ip = (const BYTE*) src;
 1965|  12.8k|        const BYTE* const iend = ip + srcSize;
 1966|       |
 1967|  12.8k|        BYTE* op = (BYTE*) dst;
 1968|  12.8k|        BYTE* const oend = op + outputSize;
 1969|  12.8k|        BYTE* cpy;
 1970|       |
 1971|  12.8k|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (1971:37): [True: 12.8k, False: 0]
  ------------------
 1972|       |
 1973|  12.8k|        const int checkOffset = (dictSize < (int)(64 KB));
  ------------------
  |  |  250|  12.8k|#define KB *(1 <<10)
  ------------------
 1974|       |
 1975|       |
 1976|       |        /* Set up the "end" pointers for the shortcut. */
 1977|  12.8k|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 1978|  12.8k|        const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/;
 1979|       |
 1980|  12.8k|        const BYTE* match;
 1981|  12.8k|        size_t offset;
 1982|  12.8k|        unsigned token;
 1983|  12.8k|        size_t length;
 1984|       |
 1985|       |
 1986|  12.8k|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  288|  12.8k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1987|       |
 1988|       |        /* Special cases */
 1989|  12.8k|        assert(lowPrefix <= op);
 1990|  12.8k|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  179|  12.8k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  12.8k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 12.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1991|       |            /* Empty output buffer */
 1992|      0|            if (partialDecoding) return 0;
  ------------------
  |  Branch (1992:17): [True: 0, False: 0]
  ------------------
 1993|      0|            return ((srcSize==1) && (*ip==0)) ? 0 : -1;
  ------------------
  |  Branch (1993:21): [True: 0, False: 0]
  |  Branch (1993:37): [True: 0, False: 0]
  ------------------
 1994|      0|        }
 1995|  12.8k|        if (unlikely(srcSize==0)) { return -1; }
  ------------------
  |  |  179|  12.8k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  12.8k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 12.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1996|       |
 1997|       |    /* LZ4_FAST_DEC_LOOP:
 1998|       |     * designed for modern OoO performance cpus,
 1999|       |     * where copying reliably 32-bytes is preferable to an unpredictable branch.
 2000|       |     * note : fast loop may show a regression for some client arm chips. */
 2001|  12.8k|#if LZ4_FAST_DEC_LOOP
 2002|  12.8k|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  247|  12.8k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2002:13): [True: 0, False: 12.8k]
  ------------------
 2003|      0|            DEBUGLOG(6, "skip fast decode loop");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2004|      0|            goto safe_decode;
 2005|      0|        }
 2006|       |
 2007|       |        /* Fast loop : decode sequences as long as output < oend-FASTLOOP_SAFE_DISTANCE */
 2008|  12.8k|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  288|  12.8k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2009|  5.24M|        while (1) {
  ------------------
  |  Branch (2009:16): [Folded - Ignored]
  ------------------
 2010|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2011|  5.24M|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
 2012|  5.24M|            assert(ip < iend);
 2013|  5.24M|            token = *ip++;
 2014|  5.24M|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  259|  5.24M|#define ML_BITS  4
  ------------------
 2015|       |
 2016|       |            /* decode literal length */
 2017|  5.24M|            if (length == RUN_MASK) {
  ------------------
  |  |  262|  5.24M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  5.24M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  5.24M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2017:17): [True: 321k, False: 4.91M]
  ------------------
 2018|   321k|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  262|   321k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   321k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|   321k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2019|   321k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2019:21): [True: 0, False: 321k]
  ------------------
 2020|      0|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2021|      0|                    goto _output_error;
 2022|      0|                }
 2023|   321k|                length += addl;
 2024|   321k|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  179|   321k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|   321k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 321k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2025|   321k|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  179|   321k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|   321k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 321k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2026|       |
 2027|       |                /* copy literals */
 2028|   321k|                cpy = op+length;
 2029|   321k|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  276|   321k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2030|   321k|                if ((cpy>oend-32) || (ip+length>iend-32)) { goto safe_literal_copy; }
  ------------------
  |  Branch (2030:21): [True: 352, False: 320k]
  |  Branch (2030:38): [True: 2.01k, False: 318k]
  ------------------
 2031|   318k|                LZ4_wildCopy32(op, ip, cpy);
 2032|   318k|                ip += length; op = cpy;
 2033|  4.91M|            } else {
 2034|  4.91M|                cpy = op+length;
 2035|  4.91M|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)length);
  ------------------
  |  |  288|  4.91M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2036|       |                /* We don't need to check oend, since we check it once for each loop below */
 2037|  4.91M|                if (ip > iend-(16 + 1/*max lit + offset + nextToken*/)) { goto safe_literal_copy; }
  ------------------
  |  Branch (2037:21): [True: 8.66k, False: 4.91M]
  ------------------
 2038|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2039|  4.91M|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  348|  4.91M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2040|  4.91M|                ip += length; op = cpy;
 2041|  4.91M|            }
 2042|       |
 2043|       |            /* get offset */
 2044|  5.22M|            offset = LZ4_readLE16(ip); ip+=2;
 2045|  5.22M|            DEBUGLOG(6, " offset = %zu", offset);
  ------------------
  |  |  288|  5.22M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2046|  5.22M|            match = op - offset;
 2047|  5.22M|            assert(match <= op);  /* overflow check */
 2048|       |
 2049|       |            /* get matchlength */
 2050|  5.22M|            length = token & ML_MASK;
  ------------------
  |  |  260|  5.22M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  5.22M|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2051|       |
 2052|  5.22M|            if (length == ML_MASK) {
  ------------------
  |  |  260|  5.22M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  5.22M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2052:17): [True: 1.05M, False: 4.16M]
  ------------------
 2053|  1.05M|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  244|  1.05M|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2054|  1.05M|                if (addl == rvl_error) {
  ------------------
  |  Branch (2054:21): [True: 0, False: 1.05M]
  ------------------
 2055|      0|                    DEBUGLOG(6, "error reading long match length");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2056|      0|                    goto _output_error;
 2057|      0|                }
 2058|  1.05M|                length += addl;
 2059|  1.05M|                length += MINMATCH;
  ------------------
  |  |  241|  1.05M|#define MINMATCH 4
  ------------------
 2060|  1.05M|                if (unlikely((uptrval)(op)+length<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  179|  1.05M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  1.05M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 1.05M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2061|  1.05M|                if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) {
  ------------------
  |  |  179|  1.05M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  1.05M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2061:21): [True: 1.05M, False: 0]
  |  Branch (2061:38): [True: 0, False: 1.05M]
  ------------------
 2062|      0|                    DEBUGLOG(6, "Error : offset outside buffers");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2063|      0|                    goto _output_error;
 2064|      0|                }
 2065|  1.05M|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  247|  1.05M|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2065:21): [True: 1.36k, False: 1.05M]
  ------------------
 2066|  1.36k|                    goto safe_match_copy;
 2067|  1.36k|                }
 2068|  4.16M|            } else {
 2069|  4.16M|                length += MINMATCH;
  ------------------
  |  |  241|  4.16M|#define MINMATCH 4
  ------------------
 2070|  4.16M|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  247|  4.16M|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2070:21): [True: 421, False: 4.16M]
  ------------------
 2071|    421|                    goto safe_match_copy;
 2072|    421|                }
 2073|       |
 2074|       |                /* Fastpath check: skip LZ4_wildCopy32 when true */
 2075|  4.16M|                if ((dict == withPrefix64k) || (match >= lowPrefix)) {
  ------------------
  |  Branch (2075:21): [True: 0, False: 4.16M]
  |  Branch (2075:48): [True: 4.16M, False: 0]
  ------------------
 2076|  4.16M|                    if (offset >= 8) {
  ------------------
  |  Branch (2076:25): [True: 3.66M, False: 500k]
  ------------------
 2077|  3.66M|                        assert(match >= lowPrefix);
 2078|  3.66M|                        assert(match <= op);
 2079|  3.66M|                        assert(op + 18 <= oend);
 2080|       |
 2081|  3.66M|                        LZ4_memcpy(op, match, 8);
  ------------------
  |  |  348|  3.66M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2082|  3.66M|                        LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  348|  3.66M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2083|  3.66M|                        LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  348|  3.66M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2084|  3.66M|                        op += length;
 2085|  3.66M|                        continue;
 2086|  3.66M|            }   }   }
 2087|       |
 2088|  1.55M|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  179|  1.55M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  1.55M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2088:18): [True: 1.55M, False: 0]
  |  Branch (2088:33): [True: 0, False: 1.55M]
  ------------------
 2089|      0|                DEBUGLOG(6, "Error : pos=%zi, offset=%zi => outside buffers", op-lowPrefix, op-match);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2090|      0|                goto _output_error;
 2091|      0|            }
 2092|       |            /* match starting within external dictionary */
 2093|  1.55M|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2093:17): [True: 0, False: 1.55M]
  |  Branch (2093:41): [True: 0, False: 0]
  ------------------
 2094|      0|                assert(dictEnd != NULL);
 2095|      0|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  179|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2096|      0|                    if (partialDecoding) {
  ------------------
  |  Branch (2096:25): [True: 0, False: 0]
  ------------------
 2097|      0|                        DEBUGLOG(7, "partialDecoding: dictionary match, close to dstEnd");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2098|      0|                        length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1782|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1782:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2099|      0|                    } else {
 2100|      0|                        DEBUGLOG(6, "end-of-block condition violated")
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2101|      0|                        goto _output_error;
 2102|      0|                }   }
 2103|       |
 2104|      0|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2104:21): [True: 0, False: 0]
  ------------------
 2105|       |                    /* match fits entirely within external dictionary : just copy */
 2106|      0|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  356|      0|#    define LZ4_memmove __builtin_memmove
  ------------------
 2107|      0|                    op += length;
 2108|      0|                } else {
 2109|       |                    /* match stretches into both external dictionary and current block */
 2110|      0|                    size_t const copySize = (size_t)(lowPrefix - match);
 2111|      0|                    size_t const restSize = length - copySize;
 2112|      0|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  348|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2113|      0|                    op += copySize;
 2114|      0|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2114:25): [True: 0, False: 0]
  ------------------
 2115|      0|                        BYTE* const endOfMatch = op + restSize;
 2116|      0|                        const BYTE* copyFrom = lowPrefix;
 2117|      0|                        while (op < endOfMatch) { *op++ = *copyFrom++; }
  ------------------
  |  Branch (2117:32): [True: 0, False: 0]
  ------------------
 2118|      0|                    } else {
 2119|      0|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  348|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2120|      0|                        op += restSize;
 2121|      0|                }   }
 2122|      0|                continue;
 2123|      0|            }
 2124|       |
 2125|       |            /* copy match within block */
 2126|  1.55M|            cpy = op + length;
 2127|       |
 2128|  1.55M|            assert((op <= oend) && (oend-op >= 32));
 2129|  1.55M|            if (unlikely(offset<16)) {
  ------------------
  |  |  179|  1.55M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  1.55M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 596k, False: 962k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2130|   596k|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2131|   962k|            } else {
 2132|   962k|                LZ4_wildCopy32(op, match, cpy);
 2133|   962k|            }
 2134|       |
 2135|  1.55M|            op = cpy;   /* wildcopy correction */
 2136|  1.55M|        }
 2137|      0|    safe_decode:
 2138|      0|#endif
 2139|       |
 2140|       |        /* Main Loop : decode remaining sequences where output < FASTLOOP_SAFE_DISTANCE */
 2141|      0|        DEBUGLOG(6, "using safe decode loop");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2142|  18.9k|        while (1) {
  ------------------
  |  Branch (2142:16): [Folded - Ignored]
  ------------------
 2143|  18.9k|            assert(ip < iend);
 2144|  18.9k|            token = *ip++;
 2145|  18.9k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  259|  18.9k|#define ML_BITS  4
  ------------------
 2146|       |
 2147|       |            /* A two-stage shortcut for the most common case:
 2148|       |             * 1) If the literal length is 0..14, and there is enough space,
 2149|       |             * enter the shortcut and copy 16 bytes on behalf of the literals
 2150|       |             * (in the fast mode, only 8 bytes can be safely copied this way).
 2151|       |             * 2) Further if the match length is 4..18, copy 18 bytes in a similar
 2152|       |             * manner; but we ensure that there's enough space in the output for
 2153|       |             * those 18 bytes earlier, upon entering the shortcut (in other words,
 2154|       |             * there is a combined check for both stages).
 2155|       |             */
 2156|  18.9k|            if ( (length != RUN_MASK)
  ------------------
  |  |  262|  18.9k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  18.9k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  18.9k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2156:18): [True: 18.6k, False: 337]
  ------------------
 2157|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2158|  18.9k|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  176|  18.6k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  170|  18.6k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 2.38k, False: 16.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2159|       |                /* Copy the literals */
 2160|  2.38k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  348|  2.38k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2161|  2.38k|                op += length; ip += length;
 2162|       |
 2163|       |                /* The second stage: prepare for match copying, decode full info.
 2164|       |                 * If it doesn't work out, the info won't be wasted. */
 2165|  2.38k|                length = token & ML_MASK; /* match length */
  ------------------
  |  |  260|  2.38k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  2.38k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2166|  2.38k|                offset = LZ4_readLE16(ip); ip += 2;
 2167|  2.38k|                match = op - offset;
 2168|  2.38k|                assert(match <= op); /* check overflow */
 2169|       |
 2170|       |                /* Do not deal with overlapping matches. */
 2171|  2.38k|                if ( (length != ML_MASK)
  ------------------
  |  |  260|  2.38k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  2.38k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2171:22): [True: 2.11k, False: 271]
  ------------------
 2172|  2.38k|                  && (offset >= 8)
  ------------------
  |  Branch (2172:22): [True: 1.66k, False: 446]
  ------------------
 2173|  2.38k|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2173:23): [True: 0, False: 1.66k]
  |  Branch (2173:46): [True: 1.66k, False: 0]
  ------------------
 2174|       |                    /* Copy the match. */
 2175|  1.66k|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  348|  1.66k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2176|  1.66k|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  348|  1.66k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2177|  1.66k|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  348|  1.66k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2178|  1.66k|                    op += length + MINMATCH;
  ------------------
  |  |  241|  1.66k|#define MINMATCH 4
  ------------------
 2179|       |                    /* Both stages worked, load the next token. */
 2180|  1.66k|                    continue;
 2181|  1.66k|                }
 2182|       |
 2183|       |                /* The second stage didn't work out, but the info is ready.
 2184|       |                 * Propel it right to the point of match copying. */
 2185|    717|                goto _copy_match;
 2186|  2.38k|            }
 2187|       |
 2188|       |            /* decode literal length */
 2189|  16.6k|            if (length == RUN_MASK) {
  ------------------
  |  |  262|  16.6k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  16.6k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  16.6k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2189:17): [True: 337, False: 16.2k]
  ------------------
 2190|    337|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  262|    337|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|    337|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|    337|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2191|    337|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2191:21): [True: 0, False: 337]
  ------------------
 2192|    337|                length += addl;
 2193|    337|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  179|    337|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|    337|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 337]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2194|    337|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  179|    337|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|    337|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 337]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2195|    337|            }
 2196|       |
 2197|       |            /* copy literals */
 2198|  16.6k|            cpy = op+length;
 2199|  16.6k|#if LZ4_FAST_DEC_LOOP
 2200|  27.6k|        safe_literal_copy:
 2201|  27.6k|#endif
 2202|  27.6k|            LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  276|  27.6k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2203|  27.6k|            if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  245|  27.6k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  244|  24.6k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2203:17): [True: 3.03k, False: 24.6k]
  |  Branch (2203:39): [True: 9.78k, False: 14.8k]
  ------------------
 2204|       |                /* We've either hit the input parsing restriction or the output parsing restriction.
 2205|       |                 * In the normal scenario, decoding a full block, it must be the last sequence,
 2206|       |                 * otherwise it's an error (invalid input or dimensions).
 2207|       |                 * In partialDecoding scenario, it's necessary to ensure there is no buffer overflow.
 2208|       |                 */
 2209|  12.8k|                if (partialDecoding) {
  ------------------
  |  Branch (2209:21): [True: 0, False: 12.8k]
  ------------------
 2210|       |                    /* Since we are partial decoding we may be in this block because of the output parsing
 2211|       |                     * restriction, which is not valid since the output buffer is allowed to be undersized.
 2212|       |                     */
 2213|      0|                    DEBUGLOG(7, "partialDecoding: copying literals, close to input or output end")
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2214|      0|                    DEBUGLOG(7, "partialDecoding: literal length = %u", (unsigned)length);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2215|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in dstBuffer : %i", (int)(oend - op));
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2216|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in srcBuffer : %i", (int)(iend - ip));
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2217|       |                    /* Finishing in the middle of a literals segment,
 2218|       |                     * due to lack of input.
 2219|       |                     */
 2220|      0|                    if (ip+length > iend) {
  ------------------
  |  Branch (2220:25): [True: 0, False: 0]
  ------------------
 2221|      0|                        length = (size_t)(iend-ip);
 2222|      0|                        cpy = op + length;
 2223|      0|                    }
 2224|       |                    /* Finishing in the middle of a literals segment,
 2225|       |                     * due to lack of output space.
 2226|       |                     */
 2227|      0|                    if (cpy > oend) {
  ------------------
  |  Branch (2227:25): [True: 0, False: 0]
  ------------------
 2228|      0|                        cpy = oend;
 2229|      0|                        assert(op<=oend);
 2230|      0|                        length = (size_t)(oend-op);
 2231|      0|                    }
 2232|  12.8k|                } else {
 2233|       |                     /* We must be on the last sequence (or invalid) because of the parsing limitations
 2234|       |                      * so check that we exactly consume the input and don't overrun the output buffer.
 2235|       |                      */
 2236|  12.8k|                    if ((ip+length != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2236:25): [True: 0, False: 12.8k]
  |  Branch (2236:48): [True: 0, False: 12.8k]
  ------------------
 2237|      0|                        DEBUGLOG(6, "should have been last run of literals")
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2238|      0|                        DEBUGLOG(6, "ip(%p) + length(%i) = %p != iend (%p)", ip, (int)length, ip+length, iend);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2239|      0|                        DEBUGLOG(6, "or cpy(%p) > oend(%p)", cpy, oend);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2240|      0|                        goto _output_error;
 2241|      0|                    }
 2242|  12.8k|                }
 2243|  12.8k|                LZ4_memmove(op, ip, length);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  356|  12.8k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2244|  12.8k|                ip += length;
 2245|  12.8k|                op += length;
 2246|       |                /* Necessarily EOF when !partialDecoding.
 2247|       |                 * When partialDecoding, it is EOF if we've either
 2248|       |                 * filled the output buffer or
 2249|       |                 * can't proceed with reading an offset for following match.
 2250|       |                 */
 2251|  12.8k|                if (!partialDecoding || (cpy == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2251:21): [True: 12.8k, False: 0]
  |  Branch (2251:41): [True: 0, False: 0]
  |  Branch (2251:58): [True: 0, False: 0]
  ------------------
 2252|  12.8k|                    break;
 2253|  12.8k|                }
 2254|  14.8k|            } else {
 2255|  14.8k|                LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2256|  14.8k|                ip += length; op = cpy;
 2257|  14.8k|            }
 2258|       |
 2259|       |            /* get offset */
 2260|  14.8k|            offset = LZ4_readLE16(ip); ip+=2;
 2261|  14.8k|            match = op - offset;
 2262|       |
 2263|       |            /* get matchlength */
 2264|  14.8k|            length = token & ML_MASK;
  ------------------
  |  |  260|  14.8k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  14.8k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2265|       |
 2266|  15.5k|    _copy_match:
 2267|  15.5k|            if (length == ML_MASK) {
  ------------------
  |  |  260|  15.5k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  15.5k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2267:17): [True: 4.08k, False: 11.4k]
  ------------------
 2268|  4.08k|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  244|  4.08k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2269|  4.08k|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2269:21): [True: 0, False: 4.08k]
  ------------------
 2270|  4.08k|                length += addl;
 2271|  4.08k|                if (unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  179|  4.08k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  4.08k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 4.08k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2272|  4.08k|            }
 2273|  15.5k|            length += MINMATCH;
  ------------------
  |  |  241|  15.5k|#define MINMATCH 4
  ------------------
 2274|       |
 2275|  15.5k|#if LZ4_FAST_DEC_LOOP
 2276|  17.3k|        safe_match_copy:
 2277|  17.3k|#endif
 2278|  17.3k|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error;   /* Error : offset outside buffers */
  ------------------
  |  |  179|  17.3k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  17.3k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2278:17): [True: 17.3k, False: 0]
  |  Branch (2278:34): [True: 0, False: 17.3k]
  ------------------
 2279|       |            /* match starting within external dictionary */
 2280|  17.3k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2280:17): [True: 0, False: 17.3k]
  |  Branch (2280:41): [True: 0, False: 0]
  ------------------
 2281|      0|                assert(dictEnd != NULL);
 2282|      0|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  179|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2283|      0|                    if (partialDecoding) length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1782|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1782:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2283:25): [True: 0, False: 0]
  ------------------
 2284|      0|                    else goto _output_error;   /* doesn't respect parsing restriction */
 2285|      0|                }
 2286|       |
 2287|      0|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2287:21): [True: 0, False: 0]
  ------------------
 2288|       |                    /* match fits entirely within external dictionary : just copy */
 2289|      0|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  356|      0|#    define LZ4_memmove __builtin_memmove
  ------------------
 2290|      0|                    op += length;
 2291|      0|                } else {
 2292|       |                    /* match stretches into both external dictionary and current block */
 2293|      0|                    size_t const copySize = (size_t)(lowPrefix - match);
 2294|      0|                    size_t const restSize = length - copySize;
 2295|      0|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  348|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2296|      0|                    op += copySize;
 2297|      0|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2297:25): [True: 0, False: 0]
  ------------------
 2298|      0|                        BYTE* const endOfMatch = op + restSize;
 2299|      0|                        const BYTE* copyFrom = lowPrefix;
 2300|      0|                        while (op < endOfMatch) *op++ = *copyFrom++;
  ------------------
  |  Branch (2300:32): [True: 0, False: 0]
  ------------------
 2301|      0|                    } else {
 2302|      0|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  348|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2303|      0|                        op += restSize;
 2304|      0|                }   }
 2305|      0|                continue;
 2306|      0|            }
 2307|  17.3k|            assert(match >= lowPrefix);
 2308|       |
 2309|       |            /* copy match within block */
 2310|  17.3k|            cpy = op + length;
 2311|       |
 2312|       |            /* partialDecoding : may end anywhere within the block */
 2313|  17.3k|            assert(op<=oend);
 2314|  17.3k|            if (partialDecoding && (cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  246|      0|#define MATCH_SAFEGUARD_DISTANCE  ((2*WILDCOPYLENGTH) - MINMATCH)   /* ensure it's possible to write 2 x wildcopyLength without overflowing output buffer */
  |  |  ------------------
  |  |  |  |  243|      0|#define WILDCOPYLENGTH 8
  |  |  ------------------
  |  |               #define MATCH_SAFEGUARD_DISTANCE  ((2*WILDCOPYLENGTH) - MINMATCH)   /* ensure it's possible to write 2 x wildcopyLength without overflowing output buffer */
  |  |  ------------------
  |  |  |  |  241|      0|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (2314:17): [True: 0, False: 17.3k]
  |  Branch (2314:36): [True: 0, False: 0]
  ------------------
 2315|      0|                size_t const mlen = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1782|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1782:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2316|      0|                const BYTE* const matchEnd = match + mlen;
 2317|      0|                BYTE* const copyEnd = op + mlen;
 2318|      0|                if (matchEnd > op) {   /* overlap copy */
  ------------------
  |  Branch (2318:21): [True: 0, False: 0]
  ------------------
 2319|      0|                    while (op < copyEnd) { *op++ = *match++; }
  ------------------
  |  Branch (2319:28): [True: 0, False: 0]
  ------------------
 2320|      0|                } else {
 2321|      0|                    LZ4_memcpy(op, match, mlen);
  ------------------
  |  |  348|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2322|      0|                }
 2323|      0|                op = copyEnd;
 2324|      0|                if (op == oend) { break; }
  ------------------
  |  Branch (2324:21): [True: 0, False: 0]
  ------------------
 2325|      0|                continue;
 2326|      0|            }
 2327|       |
 2328|  17.3k|            if (unlikely(offset<8)) {
  ------------------
  |  |  179|  17.3k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  17.3k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 7.41k, False: 9.91k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2329|  7.41k|                LZ4_write32(op, 0);   /* silence msan warning when offset==0 */
 2330|  7.41k|                op[0] = match[0];
 2331|  7.41k|                op[1] = match[1];
 2332|  7.41k|                op[2] = match[2];
 2333|  7.41k|                op[3] = match[3];
 2334|  7.41k|                match += inc32table[offset];
 2335|  7.41k|                LZ4_memcpy(op+4, match, 4);
  ------------------
  |  |  348|  7.41k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2336|  7.41k|                match -= dec64table[offset];
 2337|  9.91k|            } else {
 2338|  9.91k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  348|  9.91k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2339|  9.91k|                match += 8;
 2340|  9.91k|            }
 2341|  17.3k|            op += 8;
 2342|       |
 2343|  17.3k|            if (unlikely(cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  179|  17.3k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  17.3k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 2.54k, False: 14.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2344|  2.54k|                BYTE* const oCopyLimit = oend - (WILDCOPYLENGTH-1);
  ------------------
  |  |  243|  2.54k|#define WILDCOPYLENGTH 8
  ------------------
 2345|  2.54k|                if (cpy > oend-LASTLITERALS) { goto _output_error; } /* Error : last LASTLITERALS bytes must be literals (uncompressed) */
  ------------------
  |  |  244|  2.54k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2345:21): [True: 0, False: 2.54k]
  ------------------
 2346|  2.54k|                if (op < oCopyLimit) {
  ------------------
  |  Branch (2346:21): [True: 2.27k, False: 262]
  ------------------
 2347|  2.27k|                    LZ4_wildCopy8(op, match, oCopyLimit);
 2348|  2.27k|                    match += oCopyLimit - op;
 2349|  2.27k|                    op = oCopyLimit;
 2350|  2.27k|                }
 2351|  6.86k|                while (op < cpy) { *op++ = *match++; }
  ------------------
  |  Branch (2351:24): [True: 4.32k, False: 2.54k]
  ------------------
 2352|  14.7k|            } else {
 2353|  14.7k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  348|  14.7k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2354|  14.7k|                if (length > 16)  { LZ4_wildCopy8(op+8, match+8, cpy); }
  ------------------
  |  Branch (2354:21): [True: 4.18k, False: 10.5k]
  ------------------
 2355|  14.7k|            }
 2356|  17.3k|            op = cpy;   /* wildcopy correction */
 2357|  17.3k|        }
 2358|       |
 2359|       |        /* end of decoding */
 2360|  12.8k|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  288|  12.8k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2361|  12.8k|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2362|       |
 2363|       |        /* Overflow error detected */
 2364|      0|    _output_error:
 2365|      0|        return (int) (-(((const char*)ip)-src))-1;
 2366|      0|    }
 2367|      0|}
lz4.c:read_variable_length:
 1918|  1.38M|{
 1919|  1.38M|    Rvl_t s, length = 0;
 1920|  1.38M|    assert(ip != NULL);
 1921|  1.38M|    assert(*ip !=  NULL);
 1922|  1.38M|    assert(ilimit != NULL);
 1923|  1.38M|    if (initial_check && unlikely((*ip) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  179|   321k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|   321k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 321k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1923:9): [True: 321k, False: 1.06M]
  ------------------
 1924|      0|        return rvl_error;
 1925|      0|    }
 1926|  2.60M|    do {
 1927|  2.60M|        s = **ip;
 1928|  2.60M|        (*ip)++;
 1929|  2.60M|        length += s;
 1930|  2.60M|        if (unlikely((*ip) > ilimit)) {    /* read limit reached */
  ------------------
  |  |  179|  2.60M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  2.60M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 2.60M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1931|      0|            return rvl_error;
 1932|      0|        }
 1933|       |        /* accumulator overflow detection (32-bit mode only) */
 1934|  2.60M|        if ((sizeof(length)<8) && unlikely(length > ((Rvl_t)(-1)/2)) ) {
  ------------------
  |  |  179|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1934:13): [Folded - Ignored]
  ------------------
 1935|      0|            return rvl_error;
 1936|      0|        }
 1937|  2.60M|    } while (s==255);
  ------------------
  |  Branch (1937:14): [True: 1.21M, False: 1.38M]
  ------------------
 1938|       |
 1939|  1.38M|    return length;
 1940|  1.38M|}
lz4.c:LZ4_wildCopy32:
  505|  1.28M|{
  506|  1.28M|    BYTE* d = (BYTE*)dstPtr;
  507|  1.28M|    const BYTE* s = (const BYTE*)srcPtr;
  508|  1.28M|    BYTE* const e = (BYTE*)dstEnd;
  509|       |
  510|  8.82M|    do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  348|  8.82M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
                  do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  348|  8.82M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (510:79): [True: 7.54M, False: 1.28M]
  ------------------
  511|  1.28M|}
lz4.c:LZ4_readLE16:
  425|  5.24M|{
  426|  5.24M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (426:9): [True: 5.24M, False: 0]
  ------------------
  427|  5.24M|        return LZ4_read16(memPtr);
  428|  5.24M|    } else {
  429|      0|        const BYTE* p = (const BYTE*)memPtr;
  430|      0|        return (U16)((U16)p[0] + (p[1]<<8));
  431|      0|    }
  432|  5.24M|}
lz4.c:LZ4_memcpy_using_offset:
  518|   596k|{
  519|   596k|    BYTE v[8];
  520|       |
  521|   596k|    assert(dstEnd >= dstPtr + MINMATCH);
  522|       |
  523|   596k|    switch(offset) {
  524|  83.1k|    case 1:
  ------------------
  |  Branch (524:5): [True: 83.1k, False: 513k]
  ------------------
  525|  83.1k|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  235|  83.1k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  233|  83.1k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  526|  83.1k|        break;
  527|   277k|    case 2:
  ------------------
  |  Branch (527:5): [True: 277k, False: 318k]
  ------------------
  528|   277k|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  348|   277k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  529|   277k|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  348|   277k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  530|       |#if defined(_MSC_VER) && (_MSC_VER <= 1933) /* MSVC 2022 ver 17.3 or earlier */
  531|       |#  pragma warning(push)
  532|       |#  pragma warning(disable : 6385) /* warning C6385: Reading invalid data from 'v'. */
  533|       |#endif
  534|   277k|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  348|   277k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  535|       |#if defined(_MSC_VER) && (_MSC_VER <= 1933) /* MSVC 2022 ver 17.3 or earlier */
  536|       |#  pragma warning(pop)
  537|       |#endif
  538|   277k|        break;
  539|   146k|    case 4:
  ------------------
  |  Branch (539:5): [True: 146k, False: 449k]
  ------------------
  540|   146k|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  348|   146k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  541|   146k|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  348|   146k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  542|   146k|        break;
  543|  88.9k|    default:
  ------------------
  |  Branch (543:5): [True: 88.9k, False: 507k]
  ------------------
  544|  88.9k|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  545|  88.9k|        return;
  546|   596k|    }
  547|       |
  548|   507k|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  348|   507k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  549|   507k|    dstPtr += 8;
  550|  11.6M|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (550:12): [True: 11.0M, False: 507k]
  ------------------
  551|  11.0M|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  348|  11.0M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  552|  11.0M|        dstPtr += 8;
  553|  11.0M|    }
  554|   507k|}
lz4.c:LZ4_memcpy_using_offset_base:
  479|  88.9k|{
  480|  88.9k|    assert(srcPtr + offset == dstPtr);
  481|  88.9k|    if (offset < 8) {
  ------------------
  |  Branch (481:9): [True: 81.9k, False: 6.98k]
  ------------------
  482|  81.9k|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  483|  81.9k|        dstPtr[0] = srcPtr[0];
  484|  81.9k|        dstPtr[1] = srcPtr[1];
  485|  81.9k|        dstPtr[2] = srcPtr[2];
  486|  81.9k|        dstPtr[3] = srcPtr[3];
  487|  81.9k|        srcPtr += inc32table[offset];
  488|  81.9k|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  348|  81.9k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  489|  81.9k|        srcPtr -= dec64table[offset];
  490|  81.9k|        dstPtr += 8;
  491|  81.9k|    } else {
  492|  6.98k|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  348|  6.98k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  493|  6.98k|        dstPtr += 8;
  494|  6.98k|        srcPtr += 8;
  495|  6.98k|    }
  496|       |
  497|  88.9k|    LZ4_wildCopy8(dstPtr, srcPtr, dstEnd);
  498|  88.9k|}
lz4hc.c:LZ4_isAligned:
  292|  20.1k|{
  293|  20.1k|    return ((size_t)ptr & (alignment -1)) == 0;
  294|  20.1k|}
lz4hc.c:LZ4_read32:
  388|  2.00G|static U32 LZ4_read32(const void* ptr) { return ((const LZ4_unalign32*)ptr)->u32; }
lz4hc.c:LZ4_read16:
  387|   795M|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4hc.c:LZ4_count:
  663|  33.9M|{
  664|  33.9M|    const BYTE* const pStart = pIn;
  665|       |
  666|  33.9M|    if (likely(pIn < pInLimit-(STEPSIZE-1))) {
  ------------------
  |  |  176|  33.9M|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  170|  33.9M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 33.8M, False: 102k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  667|  33.8M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  668|  33.8M|        if (!diff) {
  ------------------
  |  Branch (668:13): [True: 10.7M, False: 23.1M]
  ------------------
  669|  10.7M|            pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  660|  10.7M|#define STEPSIZE sizeof(reg_t)
  ------------------
                          pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  660|  10.7M|#define STEPSIZE sizeof(reg_t)
  ------------------
  670|  23.1M|        } else {
  671|  23.1M|            return LZ4_NbCommonBytes(diff);
  672|  23.1M|    }   }
  673|       |
  674|   759M|    while (likely(pIn < pInLimit-(STEPSIZE-1))) {
  675|   759M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  676|   759M|        if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  660|   748M|#define STEPSIZE sizeof(reg_t)
  ------------------
                      if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  660|   748M|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (676:13): [True: 748M, False: 10.4M]
  ------------------
  677|  10.4M|        pIn += LZ4_NbCommonBytes(diff);
  678|  10.4M|        return (unsigned)(pIn - pStart);
  679|   759M|    }
  680|       |
  681|   409k|    if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  |  660|   409k|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (681:9): [Folded - Ignored]
  |  Branch (681:26): [True: 281k, False: 128k]
  |  Branch (681:48): [True: 224k, False: 56.9k]
  ------------------
  682|   409k|    if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (682:9): [True: 249k, False: 159k]
  |  Branch (682:31): [True: 184k, False: 65.3k]
  ------------------
  683|   409k|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (683:9): [True: 217k, False: 191k]
  |  Branch (683:27): [True: 153k, False: 63.8k]
  ------------------
  684|   409k|    return (unsigned)(pIn - pStart);
  685|  10.8M|}
lz4hc.c:LZ4_read_ARCH:
  389|  1.73G|static reg_t LZ4_read_ARCH(const void* ptr) { return ((const LZ4_unalignST*)ptr)->uArch; }
lz4hc.c:LZ4_NbCommonBytes:
  562|   102M|{
  563|   102M|    assert(val != 0);
  564|   102M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (564:9): [True: 102M, False: 0]
  ------------------
  565|   102M|        if (sizeof(val) == 8) {
  ------------------
  |  Branch (565:13): [Folded - Ignored]
  ------------------
  566|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1800) && (defined(_M_AMD64) && !defined(_M_ARM64EC)) && !defined(LZ4_FORCE_SW_BITCOUNT)
  567|       |/*-*************************************************************************************************
  568|       |* ARM64EC is a Microsoft-designed ARM64 ABI compatible with AMD64 applications on ARM64 Windows 11.
  569|       |* The ARM64EC ABI does not support AVX/AVX2/AVX512 instructions, nor their relevant intrinsics
  570|       |* including _tzcnt_u64. Therefore, we need to neuter the _tzcnt_u64 code path for ARM64EC.
  571|       |****************************************************************************************************/
  572|       |#         if defined(__clang__) && (__clang_major__ < 10)
  573|       |            /* Avoid undefined clang-cl intrinsics issue.
  574|       |             * See https://github.com/lz4/lz4/pull/1017 for details. */
  575|       |            return (unsigned)__builtin_ia32_tzcnt_u64(val) >> 3;
  576|       |#         else
  577|       |            /* x64 CPUS without BMI support interpret `TZCNT` as `REP BSF` */
  578|       |            return (unsigned)_tzcnt_u64(val) >> 3;
  579|       |#         endif
  580|       |#       elif defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT)
  581|       |            unsigned long r = 0;
  582|       |            _BitScanForward64(&r, (U64)val);
  583|       |            return (unsigned)r >> 3;
  584|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  585|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  586|       |                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  587|   102M|            return (unsigned)__builtin_ctzll((U64)val) >> 3;
  588|       |#       else
  589|       |            const U64 m = 0x0101010101010101ULL;
  590|       |            val ^= val - 1;
  591|       |            return (unsigned)(((U64)((val & (m - 1)) * m)) >> 56);
  592|       |#       endif
  593|   102M|        } else /* 32 bits */ {
  594|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT)
  595|       |            unsigned long r;
  596|       |            _BitScanForward(&r, (U32)val);
  597|       |            return (unsigned)r >> 3;
  598|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  599|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  600|       |                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  601|      0|            return (unsigned)__builtin_ctz((U32)val) >> 3;
  602|       |#       else
  603|       |            const U32 m = 0x01010101;
  604|       |            return (unsigned)((((val - 1) ^ val) & (m - 1)) * m) >> 24;
  605|       |#       endif
  606|      0|        }
  607|   102M|    } else   /* Big Endian CPU */ {
  608|      0|        if (sizeof(val)==8) {
  ------------------
  |  Branch (608:13): [Folded - Ignored]
  ------------------
  609|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  610|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  611|      0|                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  612|      0|            return (unsigned)__builtin_clzll((U64)val) >> 3;
  613|       |#       else
  614|       |#if 1
  615|       |            /* this method is probably faster,
  616|       |             * but adds a 128 bytes lookup table */
  617|       |            static const unsigned char ctz7_tab[128] = {
  618|       |                7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  619|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  620|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  621|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  622|       |                6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  623|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  624|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  625|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  626|       |            };
  627|       |            U64 const mask = 0x0101010101010101ULL;
  628|       |            U64 const t = (((val >> 8) - mask) | val) & mask;
  629|       |            return ctz7_tab[(t * 0x0080402010080402ULL) >> 57];
  630|       |#else
  631|       |            /* this method doesn't consume memory space like the previous one,
  632|       |             * but it contains several branches,
  633|       |             * that may end up slowing execution */
  634|       |            static const U32 by32 = sizeof(val)*4;  /* 32 on 64 bits (goal), 16 on 32 bits.
  635|       |            Just to avoid some static analyzer complaining about shift by 32 on 32-bits target.
  636|       |            Note that this code path is never triggered in 32-bits mode. */
  637|       |            unsigned r;
  638|       |            if (!(val>>by32)) { r=4; } else { r=0; val>>=by32; }
  639|       |            if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; }
  640|       |            r += (!val);
  641|       |            return r;
  642|       |#endif
  643|       |#       endif
  644|      0|        } else /* 32 bits */ {
  645|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  646|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  647|      0|                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  648|      0|            return (unsigned)__builtin_clz((U32)val) >> 3;
  649|       |#       else
  650|       |            val >>= 8;
  651|       |            val = ((((val + 0x00FFFF00) | 0x00FFFFFF) + val) |
  652|       |              (val + 0x00FF0000)) >> 24;
  653|       |            return (unsigned)val ^ 3;
  654|       |#       endif
  655|      0|        }
  656|      0|    }
  657|   102M|}
lz4hc.c:LZ4_isLittleEndian:
  363|   105M|{
  364|   105M|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  365|   105M|    return one.c[0];
  366|   105M|}
lz4hc.c:LZ4_wildCopy8:
  448|  2.42M|{
  449|  2.42M|    BYTE* d = (BYTE*)dstPtr;
  450|  2.42M|    const BYTE* s = (const BYTE*)srcPtr;
  451|  2.42M|    BYTE* const e = (BYTE*)dstEnd;
  452|       |
  453|  10.5M|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  348|  10.5M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (453:50): [True: 8.08M, False: 2.42M]
  ------------------
  454|  2.42M|}
lz4hc.c:LZ4_writeLE16:
  435|  2.42M|{
  436|  2.42M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (436:9): [True: 2.42M, False: 0]
  ------------------
  437|  2.42M|        LZ4_write16(memPtr, value);
  438|  2.42M|    } else {
  439|      0|        BYTE* p = (BYTE*)memPtr;
  440|      0|        p[0] = (BYTE) value;
  441|      0|        p[1] = (BYTE)(value>>8);
  442|      0|    }
  443|  2.42M|}
lz4hc.c:LZ4_write16:
  391|  2.42M|static void LZ4_write16(void* memPtr, U16 value) { ((LZ4_unalign16*)memPtr)->u16 = value; }

LZ4F_isError:
  291|  91.6k|{
  292|  91.6k|    return (code > (LZ4F_errorCode_t)(-LZ4F_ERROR_maxCode));
  293|  91.6k|}
LZ4F_getBlockSize:
  326|  61.0k|{
  327|  61.0k|    static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  236|  61.0k|#  define KB *(1<<10)
  ------------------
                  static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  236|  61.0k|#  define KB *(1<<10)
  ------------------
                  static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  237|  61.0k|#  define MB *(1<<20)
  ------------------
                  static const size_t blockSizes[4] = { 64 KB, 256 KB, 1 MB, 4 MB };
  ------------------
  |  |  237|  61.0k|#  define MB *(1<<20)
  ------------------
  328|       |
  329|  61.0k|    if (blockSizeID == 0) blockSizeID = LZ4F_BLOCKSIZEID_DEFAULT;
  ------------------
  |  |  248|  5.15k|#define LZ4F_BLOCKSIZEID_DEFAULT LZ4F_max64KB
  ------------------
  |  Branch (329:9): [True: 5.15k, False: 55.9k]
  ------------------
  330|  61.0k|    if (blockSizeID < LZ4F_max64KB || blockSizeID > LZ4F_max4MB)
  ------------------
  |  Branch (330:9): [True: 0, False: 61.0k]
  |  Branch (330:39): [True: 0, False: 61.0k]
  ------------------
  331|      0|        RETURN_ERROR(maxBlockSize_invalid);
  ------------------
  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  332|  61.0k|    {   int const blockSizeIdx = (int)blockSizeID - (int)LZ4F_max64KB;
  333|  61.0k|        return blockSizes[blockSizeIdx];
  334|  61.0k|}   }
LZ4F_compressFrameBound:
  399|  10.1k|{
  400|  10.1k|    LZ4F_preferences_t prefs;
  401|  10.1k|    size_t const headerSize = maxFHSize;      /* max header size, including optional fields */
  402|       |
  403|  10.1k|    if (preferencesPtr!=NULL) prefs = *preferencesPtr;
  ------------------
  |  Branch (403:9): [True: 10.1k, False: 0]
  ------------------
  404|      0|    else MEM_INIT(&prefs, 0, sizeof(prefs));
  ------------------
  |  |   90|      0|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
  405|  10.1k|    prefs.autoFlush = 1;
  406|       |
  407|  10.1k|    return headerSize + LZ4F_compressBound_internal(srcSize, &prefs, 0);;
  408|      0|}
LZ4F_createCompressionContext_advanced:
  587|  10.1k|{
  588|  10.1k|    LZ4F_cctx* const cctxPtr =
  589|  10.1k|        (LZ4F_cctx*)LZ4F_calloc(sizeof(LZ4F_cctx), customMem);
  590|  10.1k|    if (cctxPtr==NULL) return NULL;
  ------------------
  |  Branch (590:9): [True: 0, False: 10.1k]
  ------------------
  591|       |
  592|  10.1k|    cctxPtr->cmem = customMem;
  593|  10.1k|    cctxPtr->version = version;
  594|  10.1k|    cctxPtr->cStage = 0;   /* Uninitialized. Next stage : init cctx */
  595|       |
  596|  10.1k|    return cctxPtr;
  597|  10.1k|}
LZ4F_createCompressionContext:
  609|  10.1k|{
  610|  10.1k|    assert(LZ4F_compressionContextPtr != NULL); /* considered a violation of narrow contract */
  611|       |    /* in case it nonetheless happen in production */
  612|  10.1k|    RETURN_ERROR_IF(LZ4F_compressionContextPtr == NULL, parameter_null);
  ------------------
  |  |  317|  10.1k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 10.1k]
  |  |  ------------------
  ------------------
  613|       |
  614|  10.1k|    *LZ4F_compressionContextPtr = LZ4F_createCompressionContext_advanced(LZ4F_defaultCMem, version);
  615|  10.1k|    RETURN_ERROR_IF(*LZ4F_compressionContextPtr==NULL, allocation_failed);
  ------------------
  |  |  317|  10.1k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 10.1k]
  |  |  ------------------
  ------------------
  616|  10.1k|    return LZ4F_OK_NoError;
  617|  10.1k|}
LZ4F_freeCompressionContext:
  621|  10.1k|{
  622|  10.1k|    if (cctxPtr != NULL) {  /* support free on NULL */
  ------------------
  |  Branch (622:9): [True: 10.1k, False: 0]
  ------------------
  623|  10.1k|       LZ4F_free(cctxPtr->lz4CtxPtr, cctxPtr->cmem);  /* note: LZ4_streamHC_t and LZ4_stream_t are simple POD types */
  624|  10.1k|       LZ4F_free(cctxPtr->tmpBuff, cctxPtr->cmem);
  625|  10.1k|       LZ4F_free(cctxPtr, cctxPtr->cmem);
  626|  10.1k|    }
  627|  10.1k|    return LZ4F_OK_NoError;
  628|  10.1k|}
LZ4F_compressBegin_usingCDict:
  681|  10.1k|{
  682|  10.1k|    LZ4F_preferences_t const prefNull = LZ4F_INIT_PREFERENCES;
  ------------------
  |  |  200|  10.1k|#define LZ4F_INIT_PREFERENCES   { LZ4F_INIT_FRAMEINFO, 0, 0u, 0u, { 0u, 0u, 0u } }    /* v1.8.3+ */
  |  |  ------------------
  |  |  |  |  185|  10.1k|#define LZ4F_INIT_FRAMEINFO   { LZ4F_default, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0ULL, 0U, LZ4F_noBlockChecksum }    /* v1.8.3+ */
  |  |  ------------------
  ------------------
  683|  10.1k|    BYTE* const dstStart = (BYTE*)dstBuffer;
  684|  10.1k|    BYTE* dstPtr = dstStart;
  685|       |
  686|  10.1k|    RETURN_ERROR_IF(dstCapacity < maxFHSize, dstMaxSize_tooSmall);
  ------------------
  |  |  317|  10.1k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 10.1k]
  |  |  ------------------
  ------------------
  687|  10.1k|    if (preferencesPtr == NULL) preferencesPtr = &prefNull;
  ------------------
  |  Branch (687:9): [True: 0, False: 10.1k]
  ------------------
  688|  10.1k|    cctxPtr->prefs = *preferencesPtr;
  689|       |
  690|       |    /* cctx Management */
  691|  10.1k|    {   U16 const ctxTypeID = (cctxPtr->prefs.compressionLevel < LZ4HC_CLEVEL_MIN) ? 1 : 2;
  ------------------
  |  |   47|  10.1k|#define LZ4HC_CLEVEL_MIN         3
  ------------------
  |  Branch (691:31): [True: 2.04k, False: 8.13k]
  ------------------
  692|  10.1k|        int requiredSize = ctxTypeID_to_size(ctxTypeID);
  693|  10.1k|        int allocatedSize = ctxTypeID_to_size(cctxPtr->lz4CtxAlloc);
  694|  10.1k|        if (allocatedSize < requiredSize) {
  ------------------
  |  Branch (694:13): [True: 10.1k, False: 0]
  ------------------
  695|       |            /* not enough space allocated */
  696|  10.1k|            LZ4F_free(cctxPtr->lz4CtxPtr, cctxPtr->cmem);
  697|  10.1k|            if (cctxPtr->prefs.compressionLevel < LZ4HC_CLEVEL_MIN) {
  ------------------
  |  |   47|  10.1k|#define LZ4HC_CLEVEL_MIN         3
  ------------------
  |  Branch (697:17): [True: 2.04k, False: 8.13k]
  ------------------
  698|       |                /* must take ownership of memory allocation,
  699|       |                 * in order to respect custom allocator contract */
  700|  2.04k|                cctxPtr->lz4CtxPtr = LZ4F_malloc(sizeof(LZ4_stream_t), cctxPtr->cmem);
  701|  2.04k|                if (cctxPtr->lz4CtxPtr)
  ------------------
  |  Branch (701:21): [True: 2.04k, False: 0]
  ------------------
  702|  2.04k|                    LZ4_initStream(cctxPtr->lz4CtxPtr, sizeof(LZ4_stream_t));
  703|  8.13k|            } else {
  704|  8.13k|                cctxPtr->lz4CtxPtr = LZ4F_malloc(sizeof(LZ4_streamHC_t), cctxPtr->cmem);
  705|  8.13k|                if (cctxPtr->lz4CtxPtr)
  ------------------
  |  Branch (705:21): [True: 8.13k, False: 0]
  ------------------
  706|  8.13k|                    LZ4_initStreamHC(cctxPtr->lz4CtxPtr, sizeof(LZ4_streamHC_t));
  707|  8.13k|            }
  708|  10.1k|            RETURN_ERROR_IF(cctxPtr->lz4CtxPtr == NULL, allocation_failed);
  ------------------
  |  |  317|  10.1k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 10.1k]
  |  |  ------------------
  ------------------
  709|  10.1k|            cctxPtr->lz4CtxAlloc = ctxTypeID;
  710|  10.1k|            cctxPtr->lz4CtxState = ctxTypeID;
  711|  10.1k|        } else if (cctxPtr->lz4CtxState != ctxTypeID) {
  ------------------
  |  Branch (711:20): [True: 0, False: 0]
  ------------------
  712|       |            /* otherwise, a sufficient buffer is already allocated,
  713|       |             * but we need to reset it to the correct context type */
  714|      0|            if (cctxPtr->prefs.compressionLevel < LZ4HC_CLEVEL_MIN) {
  ------------------
  |  |   47|      0|#define LZ4HC_CLEVEL_MIN         3
  ------------------
  |  Branch (714:17): [True: 0, False: 0]
  ------------------
  715|      0|                LZ4_initStream((LZ4_stream_t*)cctxPtr->lz4CtxPtr, sizeof(LZ4_stream_t));
  716|      0|            } else {
  717|      0|                LZ4_initStreamHC((LZ4_streamHC_t*)cctxPtr->lz4CtxPtr, sizeof(LZ4_streamHC_t));
  718|      0|                LZ4_setCompressionLevel((LZ4_streamHC_t*)cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel);
  719|      0|            }
  720|      0|            cctxPtr->lz4CtxState = ctxTypeID;
  721|      0|    }   }
  722|       |
  723|       |    /* Buffer Management */
  724|  10.1k|    if (cctxPtr->prefs.frameInfo.blockSizeID == 0)
  ------------------
  |  Branch (724:9): [True: 5.15k, False: 5.02k]
  ------------------
  725|  5.15k|        cctxPtr->prefs.frameInfo.blockSizeID = LZ4F_BLOCKSIZEID_DEFAULT;
  ------------------
  |  |  248|  5.15k|#define LZ4F_BLOCKSIZEID_DEFAULT LZ4F_max64KB
  ------------------
  726|  10.1k|    cctxPtr->maxBlockSize = LZ4F_getBlockSize(cctxPtr->prefs.frameInfo.blockSizeID);
  727|       |
  728|  10.1k|    {   size_t const requiredBuffSize = preferencesPtr->autoFlush ?
  ------------------
  |  Branch (728:41): [True: 4.02k, False: 6.15k]
  ------------------
  729|  4.02k|                ((cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked) ? 64 KB : 0) :  /* only needs past data up to window size */
  ------------------
  |  |  236|      0|#  define KB *(1<<10)
  ------------------
  |  Branch (729:18): [True: 0, False: 4.02k]
  ------------------
  730|  10.1k|                cctxPtr->maxBlockSize + ((cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked) ? 128 KB : 0);
  ------------------
  |  |  236|      0|#  define KB *(1<<10)
  ------------------
  |  Branch (730:42): [True: 0, False: 6.15k]
  ------------------
  731|       |
  732|  10.1k|        if (cctxPtr->maxBufferSize < requiredBuffSize) {
  ------------------
  |  Branch (732:13): [True: 6.15k, False: 4.02k]
  ------------------
  733|  6.15k|            cctxPtr->maxBufferSize = 0;
  734|  6.15k|            LZ4F_free(cctxPtr->tmpBuff, cctxPtr->cmem);
  735|  6.15k|            cctxPtr->tmpBuff = (BYTE*)LZ4F_malloc(requiredBuffSize, cctxPtr->cmem);
  736|  6.15k|            RETURN_ERROR_IF(cctxPtr->tmpBuff == NULL, allocation_failed);
  ------------------
  |  |  317|  6.15k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 6.15k]
  |  |  ------------------
  ------------------
  737|  6.15k|            cctxPtr->maxBufferSize = requiredBuffSize;
  738|  6.15k|    }   }
  739|  10.1k|    cctxPtr->tmpIn = cctxPtr->tmpBuff;
  740|  10.1k|    cctxPtr->tmpInSize = 0;
  741|  10.1k|    (void)XXH32_reset(&(cctxPtr->xxh), 0);
  ------------------
  |  |  131|  10.1k|#  define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
  |  |  ------------------
  |  |  |  |  126|  10.1k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  10.1k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  742|       |
  743|       |    /* context init */
  744|  10.1k|    cctxPtr->cdict = cdict;
  745|  10.1k|    if (cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked) {
  ------------------
  |  Branch (745:9): [True: 0, False: 10.1k]
  ------------------
  746|       |        /* frame init only for blockLinked : blockIndependent will be init at each block */
  747|      0|        LZ4F_initStream(cctxPtr->lz4CtxPtr, cdict, cctxPtr->prefs.compressionLevel, LZ4F_blockLinked);
  748|      0|    }
  749|  10.1k|    if (preferencesPtr->compressionLevel >= LZ4HC_CLEVEL_MIN) {
  ------------------
  |  |   47|  10.1k|#define LZ4HC_CLEVEL_MIN         3
  ------------------
  |  Branch (749:9): [True: 8.13k, False: 2.04k]
  ------------------
  750|  8.13k|        LZ4_favorDecompressionSpeed((LZ4_streamHC_t*)cctxPtr->lz4CtxPtr, (int)preferencesPtr->favorDecSpeed);
  751|  8.13k|    }
  752|       |
  753|       |    /* Magic Number */
  754|  10.1k|    LZ4F_writeLE32(dstPtr, LZ4F_MAGICNUMBER);
  ------------------
  |  |  397|  10.1k|#define LZ4F_MAGICNUMBER 0x184D2204U
  ------------------
  755|  10.1k|    dstPtr += 4;
  756|  10.1k|    {   BYTE* const headerStart = dstPtr;
  757|       |
  758|       |        /* FLG Byte */
  759|  10.1k|        *dstPtr++ = (BYTE)(((1 & _2BITS) << 6)    /* Version('01') */
  ------------------
  |  |  242|  10.1k|#define _2BITS 0x03
  ------------------
  760|  10.1k|            + ((cctxPtr->prefs.frameInfo.blockMode & _1BIT ) << 5)
  ------------------
  |  |  241|  10.1k|#define _1BIT  0x01
  ------------------
  761|  10.1k|            + ((cctxPtr->prefs.frameInfo.blockChecksumFlag & _1BIT ) << 4)
  ------------------
  |  |  241|  10.1k|#define _1BIT  0x01
  ------------------
  762|  10.1k|            + ((unsigned)(cctxPtr->prefs.frameInfo.contentSize > 0) << 3)
  763|  10.1k|            + ((cctxPtr->prefs.frameInfo.contentChecksumFlag & _1BIT ) << 2)
  ------------------
  |  |  241|  10.1k|#define _1BIT  0x01
  ------------------
  764|  10.1k|            +  (cctxPtr->prefs.frameInfo.dictID > 0) );
  765|       |        /* BD Byte */
  766|  10.1k|        *dstPtr++ = (BYTE)((cctxPtr->prefs.frameInfo.blockSizeID & _3BITS) << 4);
  ------------------
  |  |  243|  10.1k|#define _3BITS 0x07
  ------------------
  767|       |        /* Optional Frame content size field */
  768|  10.1k|        if (cctxPtr->prefs.frameInfo.contentSize) {
  ------------------
  |  Branch (768:13): [True: 0, False: 10.1k]
  ------------------
  769|      0|            LZ4F_writeLE64(dstPtr, cctxPtr->prefs.frameInfo.contentSize);
  770|      0|            dstPtr += 8;
  771|      0|            cctxPtr->totalInSize = 0;
  772|      0|        }
  773|       |        /* Optional dictionary ID field */
  774|  10.1k|        if (cctxPtr->prefs.frameInfo.dictID) {
  ------------------
  |  Branch (774:13): [True: 0, False: 10.1k]
  ------------------
  775|      0|            LZ4F_writeLE32(dstPtr, cctxPtr->prefs.frameInfo.dictID);
  776|      0|            dstPtr += 4;
  777|      0|        }
  778|       |        /* Header CRC Byte */
  779|  10.1k|        *dstPtr = LZ4F_headerChecksum(headerStart, (size_t)(dstPtr - headerStart));
  780|  10.1k|        dstPtr++;
  781|  10.1k|    }
  782|       |
  783|  10.1k|    cctxPtr->cStage = 1;   /* header written, now request input data block */
  784|  10.1k|    return (size_t)(dstPtr - dstStart);
  785|  10.1k|}
LZ4F_compressBegin:
  798|  10.1k|{
  799|  10.1k|    return LZ4F_compressBegin_usingCDict(cctxPtr, dstBuffer, dstCapacity,
  800|  10.1k|                                         NULL, preferencesPtr);
  801|  10.1k|}
LZ4F_compressUpdate:
 1064|  20.3k|{
 1065|  20.3k|     return LZ4F_compressUpdateImpl(cctxPtr,
 1066|  20.3k|                                   dstBuffer, dstCapacity,
 1067|  20.3k|                                   srcBuffer, srcSize,
 1068|  20.3k|                                   compressOptionsPtr, LZ4B_COMPRESSED);
 1069|  20.3k|}
LZ4F_uncompressedUpdate:
 1087|  10.1k|                         const LZ4F_compressOptions_t* compressOptionsPtr) {
 1088|  10.1k|    return LZ4F_compressUpdateImpl(cctxPtr,
 1089|  10.1k|                                   dstBuffer, dstCapacity,
 1090|  10.1k|                                   srcBuffer, srcSize,
 1091|  10.1k|                                   compressOptionsPtr, LZ4B_UNCOMPRESSED);
 1092|  10.1k|}
LZ4F_flush:
 1106|  30.5k|{
 1107|  30.5k|    BYTE* const dstStart = (BYTE*)dstBuffer;
 1108|  30.5k|    BYTE* dstPtr = dstStart;
 1109|  30.5k|    compressFunc_t compress;
 1110|       |
 1111|  30.5k|    if (cctxPtr->tmpInSize == 0) return 0;   /* nothing to flush */
  ------------------
  |  Branch (1111:9): [True: 22.6k, False: 7.93k]
  ------------------
 1112|  7.93k|    RETURN_ERROR_IF(cctxPtr->cStage != 1, compressionState_uninitialized);
  ------------------
  |  |  317|  7.93k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 7.93k]
  |  |  ------------------
  ------------------
 1113|  7.93k|    RETURN_ERROR_IF(dstCapacity < (cctxPtr->tmpInSize + BHSize + BFSize), dstMaxSize_tooSmall);
  ------------------
  |  |  317|  7.93k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 7.93k]
  |  |  ------------------
  ------------------
 1114|  7.93k|    (void)compressOptionsPtr;   /* not useful (yet) */
 1115|       |
 1116|       |    /* select compression function */
 1117|  7.93k|    compress = LZ4F_selectCompression(cctxPtr->prefs.frameInfo.blockMode, cctxPtr->prefs.compressionLevel, cctxPtr->blockCompression);
 1118|       |
 1119|       |    /* compress tmp buffer */
 1120|  7.93k|    dstPtr += LZ4F_makeBlock(dstPtr,
 1121|  7.93k|                             cctxPtr->tmpIn, cctxPtr->tmpInSize,
 1122|  7.93k|                             compress, cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel,
 1123|  7.93k|                             cctxPtr->cdict,
 1124|  7.93k|                             cctxPtr->prefs.frameInfo.blockChecksumFlag);
 1125|  7.93k|    assert(((void)"flush overflows dstBuffer!", (size_t)(dstPtr - dstStart) <= dstCapacity));
 1126|       |
 1127|  7.93k|    if (cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked)
  ------------------
  |  Branch (1127:9): [True: 0, False: 7.93k]
  ------------------
 1128|      0|        cctxPtr->tmpIn += cctxPtr->tmpInSize;
 1129|  7.93k|    cctxPtr->tmpInSize = 0;
 1130|       |
 1131|       |    /* keep tmpIn within limits */
 1132|  7.93k|    if ((cctxPtr->tmpIn + cctxPtr->maxBlockSize) > (cctxPtr->tmpBuff + cctxPtr->maxBufferSize)) {  /* necessarily LZ4F_blockLinked */
  ------------------
  |  Branch (1132:9): [True: 0, False: 7.93k]
  ------------------
 1133|      0|        int const realDictSize = LZ4F_localSaveDict(cctxPtr);
 1134|      0|        cctxPtr->tmpIn = cctxPtr->tmpBuff + realDictSize;
 1135|      0|    }
 1136|       |
 1137|  7.93k|    return (size_t)(dstPtr - dstStart);
 1138|  7.93k|}
LZ4F_compressEnd:
 1153|  10.1k|{
 1154|  10.1k|    BYTE* const dstStart = (BYTE*)dstBuffer;
 1155|  10.1k|    BYTE* dstPtr = dstStart;
 1156|       |
 1157|  10.1k|    size_t const flushSize = LZ4F_flush(cctxPtr, dstBuffer, dstCapacity, compressOptionsPtr);
 1158|  10.1k|    DEBUGLOG(5,"LZ4F_compressEnd: dstCapacity=%u", (unsigned)dstCapacity);
  ------------------
  |  |  161|  10.1k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1159|  10.1k|    FORWARD_IF_ERROR(flushSize);
  ------------------
  |  |  319|  10.1k|#define FORWARD_IF_ERROR(r)  if (LZ4F_isError(r)) return (r)
  |  |  ------------------
  |  |  |  Branch (319:34): [True: 0, False: 10.1k]
  |  |  ------------------
  ------------------
 1160|  10.1k|    dstPtr += flushSize;
 1161|       |
 1162|  10.1k|    assert(flushSize <= dstCapacity);
 1163|  10.1k|    dstCapacity -= flushSize;
 1164|       |
 1165|  10.1k|    RETURN_ERROR_IF(dstCapacity < 4, dstMaxSize_tooSmall);
  ------------------
  |  |  317|  10.1k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 10.1k]
  |  |  ------------------
  ------------------
 1166|  10.1k|    LZ4F_writeLE32(dstPtr, 0);
 1167|  10.1k|    dstPtr += 4;   /* endMark */
 1168|       |
 1169|  10.1k|    if (cctxPtr->prefs.frameInfo.contentChecksumFlag == LZ4F_contentChecksumEnabled) {
  ------------------
  |  Branch (1169:9): [True: 4.73k, False: 5.44k]
  ------------------
 1170|  4.73k|        U32 const xxh = XXH32_digest(&(cctxPtr->xxh));
  ------------------
  |  |  133|  4.73k|#  define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
  |  |  ------------------
  |  |  |  |  126|  4.73k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  4.73k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1171|  4.73k|        RETURN_ERROR_IF(dstCapacity < 8, dstMaxSize_tooSmall);
  ------------------
  |  |  317|  4.73k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 4.73k]
  |  |  ------------------
  ------------------
 1172|  4.73k|        DEBUGLOG(5,"Writing 32-bit content checksum");
  ------------------
  |  |  161|  4.73k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1173|  4.73k|        LZ4F_writeLE32(dstPtr, xxh);
 1174|  4.73k|        dstPtr+=4;   /* content Checksum */
 1175|  4.73k|    }
 1176|       |
 1177|  10.1k|    cctxPtr->cStage = 0;   /* state is now re-usable (with identical preferences) */
 1178|       |
 1179|  10.1k|    if (cctxPtr->prefs.frameInfo.contentSize) {
  ------------------
  |  Branch (1179:9): [True: 0, False: 10.1k]
  ------------------
 1180|      0|        if (cctxPtr->prefs.frameInfo.contentSize != cctxPtr->totalInSize)
  ------------------
  |  Branch (1180:13): [True: 0, False: 0]
  ------------------
 1181|      0|            RETURN_ERROR(frameSize_wrong);
  ------------------
  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
 1182|      0|    }
 1183|       |
 1184|  10.1k|    return (size_t)(dstPtr - dstStart);
 1185|  10.1k|}
LZ4F_createDecompressionContext_advanced:
 1229|  10.1k|{
 1230|  10.1k|    LZ4F_dctx* const dctx = (LZ4F_dctx*)LZ4F_calloc(sizeof(LZ4F_dctx), customMem);
 1231|  10.1k|    if (dctx == NULL) return NULL;
  ------------------
  |  Branch (1231:9): [True: 0, False: 10.1k]
  ------------------
 1232|       |
 1233|  10.1k|    dctx->cmem = customMem;
 1234|  10.1k|    dctx->version = version;
 1235|  10.1k|    return dctx;
 1236|  10.1k|}
LZ4F_createDecompressionContext:
 1246|  10.1k|{
 1247|  10.1k|    assert(LZ4F_decompressionContextPtr != NULL);  /* violation of narrow contract */
 1248|  10.1k|    RETURN_ERROR_IF(LZ4F_decompressionContextPtr == NULL, parameter_null);  /* in case it nonetheless happen in production */
  ------------------
  |  |  317|  10.1k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 10.1k]
  |  |  ------------------
  ------------------
 1249|       |
 1250|  10.1k|    *LZ4F_decompressionContextPtr = LZ4F_createDecompressionContext_advanced(LZ4F_defaultCMem, versionNumber);
 1251|  10.1k|    if (*LZ4F_decompressionContextPtr == NULL) {  /* failed allocation */
  ------------------
  |  Branch (1251:9): [True: 0, False: 10.1k]
  ------------------
 1252|      0|        RETURN_ERROR(allocation_failed);
  ------------------
  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
 1253|      0|    }
 1254|  10.1k|    return LZ4F_OK_NoError;
 1255|  10.1k|}
LZ4F_freeDecompressionContext:
 1258|  10.1k|{
 1259|  10.1k|    LZ4F_errorCode_t result = LZ4F_OK_NoError;
 1260|  10.1k|    if (dctx != NULL) {   /* can accept NULL input, like free() */
  ------------------
  |  Branch (1260:9): [True: 10.1k, False: 0]
  ------------------
 1261|  10.1k|      result = (LZ4F_errorCode_t)dctx->dStage;
 1262|  10.1k|      LZ4F_free(dctx->tmpIn, dctx->cmem);
 1263|  10.1k|      LZ4F_free(dctx->tmpOutBuffer, dctx->cmem);
 1264|  10.1k|      LZ4F_free(dctx, dctx->cmem);
 1265|  10.1k|    }
 1266|  10.1k|    return result;
 1267|  10.1k|}
LZ4F_resetDecompressionContext:
 1273|  10.1k|{
 1274|  10.1k|    dctx->dStage = dstage_getFrameHeader;
 1275|  10.1k|    dctx->dict = NULL;
 1276|  10.1k|    dctx->dictSize = 0;
 1277|  10.1k|    dctx->skipChecksum = 0;
 1278|  10.1k|}
LZ4F_decompress:
 1558|  10.1k|{
 1559|  10.1k|    LZ4F_decompressOptions_t optionsNull;
 1560|  10.1k|    const BYTE* const srcStart = (const BYTE*)srcBuffer;
 1561|  10.1k|    const BYTE* const srcEnd = srcStart + *srcSizePtr;
 1562|  10.1k|    const BYTE* srcPtr = srcStart;
 1563|  10.1k|    BYTE* const dstStart = (BYTE*)dstBuffer;
 1564|  10.1k|    BYTE* const dstEnd = dstStart ? dstStart + *dstSizePtr : NULL;
  ------------------
  |  Branch (1564:26): [True: 10.1k, False: 0]
  ------------------
 1565|  10.1k|    BYTE* dstPtr = dstStart;
 1566|  10.1k|    const BYTE* selectedIn = NULL;
 1567|  10.1k|    unsigned doAnotherStage = 1;
 1568|  10.1k|    size_t nextSrcSizeHint = 1;
 1569|       |
 1570|       |
 1571|  10.1k|    DEBUGLOG(5, "LZ4F_decompress : %p,%u => %p,%u",
  ------------------
  |  |  161|  10.1k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1572|  10.1k|            srcBuffer, (unsigned)*srcSizePtr, dstBuffer, (unsigned)*dstSizePtr);
 1573|  10.1k|    if (dstBuffer == NULL) assert(*dstSizePtr == 0);
  ------------------
  |  Branch (1573:9): [True: 0, False: 10.1k]
  ------------------
 1574|  10.1k|    MEM_INIT(&optionsNull, 0, sizeof(optionsNull));
  ------------------
  |  |   90|  10.1k|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
 1575|  10.1k|    if (decompressOptionsPtr==NULL) decompressOptionsPtr = &optionsNull;
  ------------------
  |  Branch (1575:9): [True: 10.1k, False: 0]
  ------------------
 1576|  10.1k|    *srcSizePtr = 0;
 1577|  10.1k|    *dstSizePtr = 0;
 1578|  10.1k|    assert(dctx != NULL);
 1579|  10.1k|    dctx->skipChecksum |= (decompressOptionsPtr->skipChecksums != 0); /* once set, disable for the remainder of the frame */
 1580|       |
 1581|       |    /* behaves as a state machine */
 1582|       |
 1583|  77.2k|    while (doAnotherStage) {
  ------------------
  |  Branch (1583:12): [True: 67.0k, False: 10.1k]
  ------------------
 1584|       |
 1585|  67.0k|        switch(dctx->dStage)
  ------------------
  |  Branch (1585:16): [True: 0, False: 67.0k]
  ------------------
 1586|  67.0k|        {
 1587|       |
 1588|  10.1k|        case dstage_getFrameHeader:
  ------------------
  |  Branch (1588:9): [True: 10.1k, False: 56.8k]
  ------------------
 1589|  10.1k|            DEBUGLOG(6, "dstage_getFrameHeader");
  ------------------
  |  |  161|  10.1k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1590|  10.1k|            if ((size_t)(srcEnd-srcPtr) >= maxFHSize) {  /* enough to decode - shortcut */
  ------------------
  |  Branch (1590:17): [True: 10.1k, False: 54]
  ------------------
 1591|  10.1k|                size_t const hSize = LZ4F_decodeHeader(dctx, srcPtr, (size_t)(srcEnd-srcPtr));  /* will update dStage appropriately */
 1592|  10.1k|                FORWARD_IF_ERROR(hSize);
  ------------------
  |  |  319|  10.1k|#define FORWARD_IF_ERROR(r)  if (LZ4F_isError(r)) return (r)
  |  |  ------------------
  |  |  |  Branch (319:34): [True: 0, False: 10.1k]
  |  |  ------------------
  ------------------
 1593|  10.1k|                srcPtr += hSize;
 1594|  10.1k|                break;
 1595|  10.1k|            }
 1596|     54|            dctx->tmpInSize = 0;
 1597|     54|            if (srcEnd-srcPtr == 0) return minFHSize;   /* 0-size input */
  ------------------
  |  Branch (1597:17): [True: 0, False: 54]
  ------------------
 1598|     54|            dctx->tmpInTarget = minFHSize;   /* minimum size to decode header */
 1599|     54|            dctx->dStage = dstage_storeFrameHeader;
 1600|       |            /* fall-through */
 1601|       |
 1602|     54|        case dstage_storeFrameHeader:
  ------------------
  |  Branch (1602:9): [True: 0, False: 67.0k]
  ------------------
 1603|     54|            DEBUGLOG(6, "dstage_storeFrameHeader");
  ------------------
  |  |  161|     54|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1604|     54|            {   size_t const sizeToCopy = MIN(dctx->tmpInTarget - dctx->tmpInSize, (size_t)(srcEnd - srcPtr));
  ------------------
  |  |  339|     54|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (339:22): [True: 54, False: 0]
  |  |  ------------------
  ------------------
 1605|     54|                memcpy(dctx->header + dctx->tmpInSize, srcPtr, sizeToCopy);
 1606|     54|                dctx->tmpInSize += sizeToCopy;
 1607|     54|                srcPtr += sizeToCopy;
 1608|     54|            }
 1609|     54|            if (dctx->tmpInSize < dctx->tmpInTarget) {
  ------------------
  |  Branch (1609:17): [True: 0, False: 54]
  ------------------
 1610|      0|                nextSrcSizeHint = (dctx->tmpInTarget - dctx->tmpInSize) + BHSize;   /* rest of header + nextBlockHeader */
 1611|      0|                doAnotherStage = 0;   /* not enough src data, ask for some more */
 1612|      0|                break;
 1613|      0|            }
 1614|     54|            FORWARD_IF_ERROR( LZ4F_decodeHeader(dctx, dctx->header, dctx->tmpInTarget) ); /* will update dStage appropriately */
  ------------------
  |  |  319|     54|#define FORWARD_IF_ERROR(r)  if (LZ4F_isError(r)) return (r)
  |  |  ------------------
  |  |  |  Branch (319:34): [True: 0, False: 54]
  |  |  ------------------
  ------------------
 1615|     54|            break;
 1616|       |
 1617|  10.1k|        case dstage_init:
  ------------------
  |  Branch (1617:9): [True: 10.1k, False: 56.8k]
  ------------------
 1618|  10.1k|            DEBUGLOG(6, "dstage_init");
  ------------------
  |  |  161|  10.1k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1619|  10.1k|            if (dctx->frameInfo.contentChecksumFlag) (void)XXH32_reset(&(dctx->xxh), 0);
  ------------------
  |  |  131|  4.73k|#  define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
  |  |  ------------------
  |  |  |  |  126|  4.73k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  4.73k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1619:17): [True: 4.73k, False: 5.44k]
  ------------------
 1620|       |            /* internal buffers allocation */
 1621|  10.1k|            {   size_t const bufferNeeded = dctx->maxBlockSize
 1622|  10.1k|                    + ((dctx->frameInfo.blockMode==LZ4F_blockLinked) ? 128 KB : 0);
  ------------------
  |  |  236|      0|#  define KB *(1<<10)
  ------------------
  |  Branch (1622:24): [True: 0, False: 10.1k]
  ------------------
 1623|  10.1k|                if (bufferNeeded > dctx->maxBufferSize) {   /* tmp buffers too small */
  ------------------
  |  Branch (1623:21): [True: 10.1k, False: 0]
  ------------------
 1624|  10.1k|                    dctx->maxBufferSize = 0;   /* ensure allocation will be re-attempted on next entry*/
 1625|  10.1k|                    LZ4F_free(dctx->tmpIn, dctx->cmem);
 1626|  10.1k|                    dctx->tmpIn = (BYTE*)LZ4F_malloc(dctx->maxBlockSize + BFSize /* block checksum */, dctx->cmem);
 1627|  10.1k|                    RETURN_ERROR_IF(dctx->tmpIn == NULL, allocation_failed);
  ------------------
  |  |  317|  10.1k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 10.1k]
  |  |  ------------------
  ------------------
 1628|  10.1k|                    LZ4F_free(dctx->tmpOutBuffer, dctx->cmem);
 1629|  10.1k|                    dctx->tmpOutBuffer= (BYTE*)LZ4F_malloc(bufferNeeded, dctx->cmem);
 1630|  10.1k|                    RETURN_ERROR_IF(dctx->tmpOutBuffer== NULL, allocation_failed);
  ------------------
  |  |  317|  10.1k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 10.1k]
  |  |  ------------------
  ------------------
 1631|  10.1k|                    dctx->maxBufferSize = bufferNeeded;
 1632|  10.1k|            }   }
 1633|  10.1k|            dctx->tmpInSize = 0;
 1634|  10.1k|            dctx->tmpInTarget = 0;
 1635|  10.1k|            dctx->tmpOut = dctx->tmpOutBuffer;
 1636|  10.1k|            dctx->tmpOutStart = 0;
 1637|  10.1k|            dctx->tmpOutSize = 0;
 1638|       |
 1639|  10.1k|            dctx->dStage = dstage_getBlockHeader;
 1640|       |            /* fall-through */
 1641|       |
 1642|  27.2k|        case dstage_getBlockHeader:
  ------------------
  |  Branch (1642:9): [True: 17.1k, False: 49.9k]
  ------------------
 1643|  27.2k|            if ((size_t)(srcEnd - srcPtr) >= BHSize) {
  ------------------
  |  Branch (1643:17): [True: 27.2k, False: 0]
  ------------------
 1644|  27.2k|                selectedIn = srcPtr;
 1645|  27.2k|                srcPtr += BHSize;
 1646|  27.2k|            } else {
 1647|       |                /* not enough input to read cBlockSize field */
 1648|      0|                dctx->tmpInSize = 0;
 1649|      0|                dctx->dStage = dstage_storeBlockHeader;
 1650|      0|            }
 1651|       |
 1652|  27.2k|            if (dctx->dStage == dstage_storeBlockHeader)   /* can be skipped */
  ------------------
  |  Branch (1652:17): [True: 0, False: 27.2k]
  ------------------
 1653|      0|        case dstage_storeBlockHeader:
  ------------------
  |  Branch (1653:9): [True: 0, False: 67.0k]
  ------------------
 1654|      0|            {   size_t const remainingInput = (size_t)(srcEnd - srcPtr);
 1655|      0|                size_t const wantedData = BHSize - dctx->tmpInSize;
 1656|      0|                size_t const sizeToCopy = MIN(wantedData, remainingInput);
  ------------------
  |  |  339|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (339:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1657|      0|                memcpy(dctx->tmpIn + dctx->tmpInSize, srcPtr, sizeToCopy);
 1658|      0|                srcPtr += sizeToCopy;
 1659|      0|                dctx->tmpInSize += sizeToCopy;
 1660|       |
 1661|      0|                if (dctx->tmpInSize < BHSize) {   /* not enough input for cBlockSize */
  ------------------
  |  Branch (1661:21): [True: 0, False: 0]
  ------------------
 1662|      0|                    nextSrcSizeHint = BHSize - dctx->tmpInSize;
 1663|      0|                    doAnotherStage  = 0;
 1664|      0|                    break;
 1665|      0|                }
 1666|      0|                selectedIn = dctx->tmpIn;
 1667|      0|            }   /* if (dctx->dStage == dstage_storeBlockHeader) */
 1668|       |
 1669|       |        /* decode block header */
 1670|  27.2k|            {   U32 const blockHeader = LZ4F_readLE32(selectedIn);
 1671|  27.2k|                size_t const nextCBlockSize = blockHeader & 0x7FFFFFFFU;
 1672|  27.2k|                size_t const crcSize = dctx->frameInfo.blockChecksumFlag * BFSize;
 1673|  27.2k|                if (blockHeader==0) {  /* frameEnd signal, no more block */
  ------------------
  |  Branch (1673:21): [True: 10.1k, False: 17.1k]
  ------------------
 1674|  10.1k|                    DEBUGLOG(5, "end of frame");
  ------------------
  |  |  161|  10.1k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1675|  10.1k|                    dctx->dStage = dstage_getSuffix;
 1676|  10.1k|                    break;
 1677|  10.1k|                }
 1678|  17.1k|                if (nextCBlockSize > dctx->maxBlockSize) {
  ------------------
  |  Branch (1678:21): [True: 0, False: 17.1k]
  ------------------
 1679|      0|                    RETURN_ERROR(maxBlockSize_invalid);
  ------------------
  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
 1680|      0|                }
 1681|  17.1k|                if (blockHeader & LZ4F_BLOCKUNCOMPRESSED_FLAG) {
  ------------------
  |  |  247|  17.1k|#define LZ4F_BLOCKUNCOMPRESSED_FLAG 0x80000000U
  ------------------
  |  Branch (1681:21): [True: 4.29k, False: 12.8k]
  ------------------
 1682|       |                    /* next block is uncompressed */
 1683|  4.29k|                    dctx->tmpInTarget = nextCBlockSize;
 1684|  4.29k|                    DEBUGLOG(5, "next block is uncompressed (size %u)", (U32)nextCBlockSize);
  ------------------
  |  |  161|  4.29k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1685|  4.29k|                    if (dctx->frameInfo.blockChecksumFlag) {
  ------------------
  |  Branch (1685:25): [True: 2.29k, False: 1.99k]
  ------------------
 1686|  2.29k|                        (void)XXH32_reset(&dctx->blockChecksum, 0);
  ------------------
  |  |  131|  2.29k|#  define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
  |  |  ------------------
  |  |  |  |  126|  2.29k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  2.29k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1687|  2.29k|                    }
 1688|  4.29k|                    dctx->dStage = dstage_copyDirect;
 1689|  4.29k|                    break;
 1690|  4.29k|                }
 1691|       |                /* next block is a compressed block */
 1692|  12.8k|                dctx->tmpInTarget = nextCBlockSize + crcSize;
 1693|  12.8k|                dctx->dStage = dstage_getCBlock;
 1694|  12.8k|                if (dstPtr==dstEnd || srcPtr==srcEnd) {
  ------------------
  |  Branch (1694:21): [True: 0, False: 12.8k]
  |  Branch (1694:39): [True: 0, False: 12.8k]
  ------------------
 1695|      0|                    nextSrcSizeHint = BHSize + nextCBlockSize + crcSize;
 1696|      0|                    doAnotherStage = 0;
 1697|      0|                }
 1698|  12.8k|                break;
 1699|  17.1k|            }
 1700|       |
 1701|  4.29k|        case dstage_copyDirect:   /* uncompressed block */
  ------------------
  |  Branch (1701:9): [True: 4.29k, False: 62.7k]
  ------------------
 1702|  4.29k|            DEBUGLOG(6, "dstage_copyDirect");
  ------------------
  |  |  161|  4.29k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1703|  4.29k|            {   size_t sizeToCopy;
 1704|  4.29k|                if (dstPtr == NULL) {
  ------------------
  |  Branch (1704:21): [True: 0, False: 4.29k]
  ------------------
 1705|      0|                    sizeToCopy = 0;
 1706|  4.29k|                } else {
 1707|  4.29k|                    size_t const minBuffSize = MIN((size_t)(srcEnd-srcPtr), (size_t)(dstEnd-dstPtr));
  ------------------
  |  |  339|  4.29k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (339:22): [True: 4.29k, False: 0]
  |  |  ------------------
  ------------------
 1708|  4.29k|                    sizeToCopy = MIN(dctx->tmpInTarget, minBuffSize);
  ------------------
  |  |  339|  4.29k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (339:22): [True: 4.29k, False: 0]
  |  |  ------------------
  ------------------
 1709|  4.29k|                    memcpy(dstPtr, srcPtr, sizeToCopy);
 1710|  4.29k|                    if (!dctx->skipChecksum) {
  ------------------
  |  Branch (1710:25): [True: 4.29k, False: 0]
  ------------------
 1711|  4.29k|                        if (dctx->frameInfo.blockChecksumFlag) {
  ------------------
  |  Branch (1711:29): [True: 2.29k, False: 1.99k]
  ------------------
 1712|  2.29k|                            (void)XXH32_update(&dctx->blockChecksum, srcPtr, sizeToCopy);
  ------------------
  |  |  132|  2.29k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  2.29k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  2.29k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1713|  2.29k|                        }
 1714|  4.29k|                        if (dctx->frameInfo.contentChecksumFlag)
  ------------------
  |  Branch (1714:29): [True: 2.43k, False: 1.85k]
  ------------------
 1715|  2.43k|                            (void)XXH32_update(&dctx->xxh, srcPtr, sizeToCopy);
  ------------------
  |  |  132|  2.43k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  2.43k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  2.43k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1716|  4.29k|                    }
 1717|  4.29k|                    if (dctx->frameInfo.contentSize)
  ------------------
  |  Branch (1717:25): [True: 0, False: 4.29k]
  ------------------
 1718|      0|                        dctx->frameRemainingSize -= sizeToCopy;
 1719|       |
 1720|       |                    /* history management (linked blocks only)*/
 1721|  4.29k|                    if (dctx->frameInfo.blockMode == LZ4F_blockLinked) {
  ------------------
  |  Branch (1721:25): [True: 0, False: 4.29k]
  ------------------
 1722|      0|                        LZ4F_updateDict(dctx, dstPtr, sizeToCopy, dstStart, 0);
 1723|      0|                    }
 1724|  4.29k|                    srcPtr += sizeToCopy;
 1725|  4.29k|                    dstPtr += sizeToCopy;
 1726|  4.29k|                }
 1727|  4.29k|                if (sizeToCopy == dctx->tmpInTarget) {   /* all done */
  ------------------
  |  Branch (1727:21): [True: 4.29k, False: 0]
  ------------------
 1728|  4.29k|                    if (dctx->frameInfo.blockChecksumFlag) {
  ------------------
  |  Branch (1728:25): [True: 2.29k, False: 1.99k]
  ------------------
 1729|  2.29k|                        dctx->tmpInSize = 0;
 1730|  2.29k|                        dctx->dStage = dstage_getBlockChecksum;
 1731|  2.29k|                    } else
 1732|  1.99k|                        dctx->dStage = dstage_getBlockHeader;  /* new block */
 1733|  4.29k|                    break;
 1734|  4.29k|                }
 1735|      0|                dctx->tmpInTarget -= sizeToCopy;  /* need to copy more */
 1736|      0|            }
 1737|      0|            nextSrcSizeHint = dctx->tmpInTarget +
 1738|      0|                            +(dctx->frameInfo.blockChecksumFlag ? BFSize : 0)
  ------------------
  |  Branch (1738:31): [True: 0, False: 0]
  ------------------
 1739|      0|                            + BHSize /* next header size */;
 1740|      0|            doAnotherStage = 0;
 1741|      0|            break;
 1742|       |
 1743|       |        /* check block checksum for recently transferred uncompressed block */
 1744|  2.29k|        case dstage_getBlockChecksum:
  ------------------
  |  Branch (1744:9): [True: 2.29k, False: 64.7k]
  ------------------
 1745|  2.29k|            DEBUGLOG(6, "dstage_getBlockChecksum");
  ------------------
  |  |  161|  2.29k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1746|  2.29k|            {   const void* crcSrc;
 1747|  2.29k|                if ((srcEnd-srcPtr >= 4) && (dctx->tmpInSize==0)) {
  ------------------
  |  Branch (1747:21): [True: 2.29k, False: 0]
  |  Branch (1747:45): [True: 2.29k, False: 0]
  ------------------
 1748|  2.29k|                    crcSrc = srcPtr;
 1749|  2.29k|                    srcPtr += 4;
 1750|  2.29k|                } else {
 1751|      0|                    size_t const stillToCopy = 4 - dctx->tmpInSize;
 1752|      0|                    size_t const sizeToCopy = MIN(stillToCopy, (size_t)(srcEnd-srcPtr));
  ------------------
  |  |  339|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (339:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1753|      0|                    memcpy(dctx->header + dctx->tmpInSize, srcPtr, sizeToCopy);
 1754|      0|                    dctx->tmpInSize += sizeToCopy;
 1755|      0|                    srcPtr += sizeToCopy;
 1756|      0|                    if (dctx->tmpInSize < 4) {  /* all input consumed */
  ------------------
  |  Branch (1756:25): [True: 0, False: 0]
  ------------------
 1757|      0|                        doAnotherStage = 0;
 1758|      0|                        break;
 1759|      0|                    }
 1760|      0|                    crcSrc = dctx->header;
 1761|      0|                }
 1762|  2.29k|                if (!dctx->skipChecksum) {
  ------------------
  |  Branch (1762:21): [True: 2.29k, False: 0]
  ------------------
 1763|  2.29k|                    U32 const readCRC = LZ4F_readLE32(crcSrc);
 1764|  2.29k|                    U32 const calcCRC = XXH32_digest(&dctx->blockChecksum);
  ------------------
  |  |  133|  2.29k|#  define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
  |  |  ------------------
  |  |  |  |  126|  2.29k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  2.29k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1765|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 1766|       |                    DEBUGLOG(6, "compare block checksum");
 1767|       |                    if (readCRC != calcCRC) {
 1768|       |                        DEBUGLOG(4, "incorrect block checksum: %08X != %08X",
 1769|       |                                readCRC, calcCRC);
 1770|       |                        RETURN_ERROR(blockChecksum_invalid);
 1771|       |                    }
 1772|       |#else
 1773|  2.29k|                    (void)readCRC;
 1774|  2.29k|                    (void)calcCRC;
 1775|  2.29k|#endif
 1776|  2.29k|            }   }
 1777|      0|            dctx->dStage = dstage_getBlockHeader;  /* new block */
 1778|  2.29k|            break;
 1779|       |
 1780|  12.8k|        case dstage_getCBlock:
  ------------------
  |  Branch (1780:9): [True: 12.8k, False: 54.2k]
  ------------------
 1781|  12.8k|            DEBUGLOG(6, "dstage_getCBlock");
  ------------------
  |  |  161|  12.8k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1782|  12.8k|            if ((size_t)(srcEnd-srcPtr) < dctx->tmpInTarget) {
  ------------------
  |  Branch (1782:17): [True: 0, False: 12.8k]
  ------------------
 1783|      0|                dctx->tmpInSize = 0;
 1784|      0|                dctx->dStage = dstage_storeCBlock;
 1785|      0|                break;
 1786|      0|            }
 1787|       |            /* input large enough to read full block directly */
 1788|  12.8k|            selectedIn = srcPtr;
 1789|  12.8k|            srcPtr += dctx->tmpInTarget;
 1790|       |
 1791|  12.8k|            if (0)  /* always jump over next block */
  ------------------
  |  Branch (1791:17): [Folded - Ignored]
  ------------------
 1792|      0|        case dstage_storeCBlock:
  ------------------
  |  Branch (1792:9): [True: 0, False: 67.0k]
  ------------------
 1793|      0|            {   size_t const wantedData = dctx->tmpInTarget - dctx->tmpInSize;
 1794|      0|                size_t const inputLeft = (size_t)(srcEnd-srcPtr);
 1795|      0|                size_t const sizeToCopy = MIN(wantedData, inputLeft);
  ------------------
  |  |  339|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (339:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1796|      0|                memcpy(dctx->tmpIn + dctx->tmpInSize, srcPtr, sizeToCopy);
 1797|      0|                dctx->tmpInSize += sizeToCopy;
 1798|      0|                srcPtr += sizeToCopy;
 1799|      0|                if (dctx->tmpInSize < dctx->tmpInTarget) { /* need more input */
  ------------------
  |  Branch (1799:21): [True: 0, False: 0]
  ------------------
 1800|      0|                    nextSrcSizeHint = (dctx->tmpInTarget - dctx->tmpInSize)
 1801|      0|                                    + (dctx->frameInfo.blockChecksumFlag ? BFSize : 0)
  ------------------
  |  Branch (1801:40): [True: 0, False: 0]
  ------------------
 1802|      0|                                    + BHSize /* next header size */;
 1803|      0|                    doAnotherStage = 0;
 1804|      0|                    break;
 1805|      0|                }
 1806|      0|                selectedIn = dctx->tmpIn;
 1807|      0|            }
 1808|       |
 1809|       |            /* At this stage, input is large enough to decode a block */
 1810|       |
 1811|       |            /* First, decode and control block checksum if it exists */
 1812|  12.8k|            if (dctx->frameInfo.blockChecksumFlag) {
  ------------------
  |  Branch (1812:17): [True: 6.45k, False: 6.36k]
  ------------------
 1813|  6.45k|                assert(dctx->tmpInTarget >= 4);
 1814|  6.45k|                dctx->tmpInTarget -= 4;
 1815|  6.45k|                assert(selectedIn != NULL);  /* selectedIn is defined at this stage (either srcPtr, or dctx->tmpIn) */
 1816|  6.45k|                {   U32 const readBlockCrc = LZ4F_readLE32(selectedIn + dctx->tmpInTarget);
 1817|  6.45k|                    U32 const calcBlockCrc = XXH32(selectedIn, dctx->tmpInTarget, 0);
  ------------------
  |  |  128|  6.45k|#  define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
  |  |  ------------------
  |  |  |  |  126|  6.45k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  6.45k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1818|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 1819|       |                    RETURN_ERROR_IF(readBlockCrc != calcBlockCrc, blockChecksum_invalid);
 1820|       |#else
 1821|  6.45k|                    (void)readBlockCrc;
 1822|  6.45k|                    (void)calcBlockCrc;
 1823|  6.45k|#endif
 1824|  6.45k|            }   }
 1825|       |
 1826|       |            /* decode directly into destination buffer if there is enough room */
 1827|  12.8k|            if ( ((size_t)(dstEnd-dstPtr) >= dctx->maxBlockSize)
  ------------------
  |  Branch (1827:18): [True: 3.57k, False: 9.24k]
  ------------------
 1828|       |                 /* unless the dictionary is stored in tmpOut:
 1829|       |                  * in which case it's faster to decode within tmpOut
 1830|       |                  * to benefit from prefix speedup */
 1831|  12.8k|              && !(dctx->dict!= NULL && (const BYTE*)dctx->dict + dctx->dictSize == dctx->tmpOut) )
  ------------------
  |  Branch (1831:20): [True: 0, False: 3.57k]
  |  Branch (1831:41): [True: 0, False: 0]
  ------------------
 1832|  3.57k|            {
 1833|  3.57k|                const char* dict = (const char*)dctx->dict;
 1834|  3.57k|                size_t dictSize = dctx->dictSize;
 1835|  3.57k|                int decodedSize;
 1836|  3.57k|                assert(dstPtr != NULL);
 1837|  3.57k|                if (dict && dictSize > 1 GB) {
  ------------------
  |  |  238|      0|#  define GB *(1<<30)
  ------------------
  |  Branch (1837:21): [True: 0, False: 3.57k]
  |  Branch (1837:29): [True: 0, False: 0]
  ------------------
 1838|       |                    /* overflow control : dctx->dictSize is an int, avoid truncation / sign issues */
 1839|      0|                    dict += dictSize - 64 KB;
  ------------------
  |  |  236|      0|#  define KB *(1<<10)
  ------------------
 1840|      0|                    dictSize = 64 KB;
  ------------------
  |  |  236|      0|#  define KB *(1<<10)
  ------------------
 1841|      0|                }
 1842|  3.57k|                decodedSize = LZ4_decompress_safe_usingDict(
 1843|  3.57k|                        (const char*)selectedIn, (char*)dstPtr,
 1844|  3.57k|                        (int)dctx->tmpInTarget, (int)dctx->maxBlockSize,
 1845|  3.57k|                        dict, (int)dictSize);
 1846|  3.57k|                RETURN_ERROR_IF(decodedSize < 0, decompressionFailed);
  ------------------
  |  |  317|  3.57k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 3.57k]
  |  |  ------------------
  ------------------
 1847|  3.57k|                if ((dctx->frameInfo.contentChecksumFlag) && (!dctx->skipChecksum))
  ------------------
  |  Branch (1847:21): [True: 2.07k, False: 1.49k]
  |  Branch (1847:62): [True: 2.07k, False: 0]
  ------------------
 1848|  2.07k|                    XXH32_update(&(dctx->xxh), dstPtr, (size_t)decodedSize);
  ------------------
  |  |  132|  2.07k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  2.07k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  2.07k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1849|  3.57k|                if (dctx->frameInfo.contentSize)
  ------------------
  |  Branch (1849:21): [True: 0, False: 3.57k]
  ------------------
 1850|      0|                    dctx->frameRemainingSize -= (size_t)decodedSize;
 1851|       |
 1852|       |                /* dictionary management */
 1853|  3.57k|                if (dctx->frameInfo.blockMode==LZ4F_blockLinked) {
  ------------------
  |  Branch (1853:21): [True: 0, False: 3.57k]
  ------------------
 1854|      0|                    LZ4F_updateDict(dctx, dstPtr, (size_t)decodedSize, dstStart, 0);
 1855|      0|                }
 1856|       |
 1857|  3.57k|                dstPtr += decodedSize;
 1858|  3.57k|                dctx->dStage = dstage_getBlockHeader;  /* end of block, let's get another one */
 1859|  3.57k|                break;
 1860|  3.57k|            }
 1861|       |
 1862|       |            /* not enough place into dst : decode into tmpOut */
 1863|       |
 1864|       |            /* manage dictionary */
 1865|  9.24k|            if (dctx->frameInfo.blockMode == LZ4F_blockLinked) {
  ------------------
  |  Branch (1865:17): [True: 0, False: 9.24k]
  ------------------
 1866|      0|                if (dctx->dict == dctx->tmpOutBuffer) {
  ------------------
  |  Branch (1866:21): [True: 0, False: 0]
  ------------------
 1867|       |                    /* truncate dictionary to 64 KB if too big */
 1868|      0|                    if (dctx->dictSize > 128 KB) {
  ------------------
  |  |  236|      0|#  define KB *(1<<10)
  ------------------
  |  Branch (1868:25): [True: 0, False: 0]
  ------------------
 1869|      0|                        memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - 64 KB, 64 KB);
  ------------------
  |  |  236|      0|#  define KB *(1<<10)
  ------------------
                                      memcpy(dctx->tmpOutBuffer, dctx->dict + dctx->dictSize - 64 KB, 64 KB);
  ------------------
  |  |  236|      0|#  define KB *(1<<10)
  ------------------
 1870|      0|                        dctx->dictSize = 64 KB;
  ------------------
  |  |  236|      0|#  define KB *(1<<10)
  ------------------
 1871|      0|                    }
 1872|      0|                    dctx->tmpOut = dctx->tmpOutBuffer + dctx->dictSize;
 1873|      0|                } else {  /* dict not within tmpOut */
 1874|      0|                    size_t const reservedDictSpace = MIN(dctx->dictSize, 64 KB);
  ------------------
  |  |  339|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (339:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1875|      0|                    dctx->tmpOut = dctx->tmpOutBuffer + reservedDictSpace;
 1876|      0|            }   }
 1877|       |
 1878|       |            /* Decode block into tmpOut */
 1879|  9.24k|            {   const char* dict = (const char*)dctx->dict;
 1880|  9.24k|                size_t dictSize = dctx->dictSize;
 1881|  9.24k|                int decodedSize;
 1882|  9.24k|                if (dict && dictSize > 1 GB) {
  ------------------
  |  |  238|      0|#  define GB *(1<<30)
  ------------------
  |  Branch (1882:21): [True: 0, False: 9.24k]
  |  Branch (1882:29): [True: 0, False: 0]
  ------------------
 1883|       |                    /* the dictSize param is an int, avoid truncation / sign issues */
 1884|      0|                    dict += dictSize - 64 KB;
  ------------------
  |  |  236|      0|#  define KB *(1<<10)
  ------------------
 1885|      0|                    dictSize = 64 KB;
  ------------------
  |  |  236|      0|#  define KB *(1<<10)
  ------------------
 1886|      0|                }
 1887|  9.24k|                decodedSize = LZ4_decompress_safe_usingDict(
 1888|  9.24k|                        (const char*)selectedIn, (char*)dctx->tmpOut,
 1889|  9.24k|                        (int)dctx->tmpInTarget, (int)dctx->maxBlockSize,
 1890|  9.24k|                        dict, (int)dictSize);
 1891|  9.24k|                RETURN_ERROR_IF(decodedSize < 0, decompressionFailed);
  ------------------
  |  |  317|  9.24k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 9.24k]
  |  |  ------------------
  ------------------
 1892|  9.24k|                if (dctx->frameInfo.contentChecksumFlag && !dctx->skipChecksum)
  ------------------
  |  Branch (1892:21): [True: 4.26k, False: 4.98k]
  |  Branch (1892:60): [True: 4.26k, False: 0]
  ------------------
 1893|  4.26k|                    XXH32_update(&(dctx->xxh), dctx->tmpOut, (size_t)decodedSize);
  ------------------
  |  |  132|  4.26k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  4.26k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  4.26k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1894|  9.24k|                if (dctx->frameInfo.contentSize)
  ------------------
  |  Branch (1894:21): [True: 0, False: 9.24k]
  ------------------
 1895|      0|                    dctx->frameRemainingSize -= (size_t)decodedSize;
 1896|  9.24k|                dctx->tmpOutSize = (size_t)decodedSize;
 1897|  9.24k|                dctx->tmpOutStart = 0;
 1898|  9.24k|                dctx->dStage = dstage_flushOut;
 1899|  9.24k|            }
 1900|       |            /* fall-through */
 1901|       |
 1902|  9.24k|        case dstage_flushOut:  /* flush decoded data from tmpOut to dstBuffer */
  ------------------
  |  Branch (1902:9): [True: 0, False: 67.0k]
  ------------------
 1903|  9.24k|            DEBUGLOG(6, "dstage_flushOut");
  ------------------
  |  |  161|  9.24k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1904|  9.24k|            if (dstPtr != NULL) {
  ------------------
  |  Branch (1904:17): [True: 9.24k, False: 0]
  ------------------
 1905|  9.24k|                size_t const sizeToCopy = MIN(dctx->tmpOutSize - dctx->tmpOutStart, (size_t)(dstEnd-dstPtr));
  ------------------
  |  |  339|  9.24k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (339:22): [True: 9.24k, False: 0]
  |  |  ------------------
  ------------------
 1906|  9.24k|                memcpy(dstPtr, dctx->tmpOut + dctx->tmpOutStart, sizeToCopy);
 1907|       |
 1908|       |                /* dictionary management */
 1909|  9.24k|                if (dctx->frameInfo.blockMode == LZ4F_blockLinked)
  ------------------
  |  Branch (1909:21): [True: 0, False: 9.24k]
  ------------------
 1910|      0|                    LZ4F_updateDict(dctx, dstPtr, sizeToCopy, dstStart, 1 /*withinTmp*/);
 1911|       |
 1912|  9.24k|                dctx->tmpOutStart += sizeToCopy;
 1913|  9.24k|                dstPtr += sizeToCopy;
 1914|  9.24k|            }
 1915|  9.24k|            if (dctx->tmpOutStart == dctx->tmpOutSize) { /* all flushed */
  ------------------
  |  Branch (1915:17): [True: 9.24k, False: 0]
  ------------------
 1916|  9.24k|                dctx->dStage = dstage_getBlockHeader;  /* get next block */
 1917|  9.24k|                break;
 1918|  9.24k|            }
 1919|       |            /* could not flush everything : stop there, just request a block header */
 1920|      0|            doAnotherStage = 0;
 1921|      0|            nextSrcSizeHint = BHSize;
 1922|      0|            break;
 1923|       |
 1924|  10.1k|        case dstage_getSuffix:
  ------------------
  |  Branch (1924:9): [True: 10.1k, False: 56.8k]
  ------------------
 1925|  10.1k|            RETURN_ERROR_IF(dctx->frameRemainingSize, frameSize_wrong);   /* incorrect frame size decoded */
  ------------------
  |  |  317|  10.1k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 10.1k]
  |  |  ------------------
  ------------------
 1926|  10.1k|            if (!dctx->frameInfo.contentChecksumFlag) {  /* no checksum, frame is completed */
  ------------------
  |  Branch (1926:17): [True: 5.44k, False: 4.73k]
  ------------------
 1927|  5.44k|                nextSrcSizeHint = 0;
 1928|  5.44k|                LZ4F_resetDecompressionContext(dctx);
 1929|  5.44k|                doAnotherStage = 0;
 1930|  5.44k|                break;
 1931|  5.44k|            }
 1932|  4.73k|            if ((srcEnd - srcPtr) < 4) {  /* not enough size for entire CRC */
  ------------------
  |  Branch (1932:17): [True: 0, False: 4.73k]
  ------------------
 1933|      0|                dctx->tmpInSize = 0;
 1934|      0|                dctx->dStage = dstage_storeSuffix;
 1935|  4.73k|            } else {
 1936|  4.73k|                selectedIn = srcPtr;
 1937|  4.73k|                srcPtr += 4;
 1938|  4.73k|            }
 1939|       |
 1940|  4.73k|            if (dctx->dStage == dstage_storeSuffix)   /* can be skipped */
  ------------------
  |  Branch (1940:17): [True: 0, False: 4.73k]
  ------------------
 1941|      0|        case dstage_storeSuffix:
  ------------------
  |  Branch (1941:9): [True: 0, False: 67.0k]
  ------------------
 1942|      0|            {   size_t const remainingInput = (size_t)(srcEnd - srcPtr);
 1943|      0|                size_t const wantedData = 4 - dctx->tmpInSize;
 1944|      0|                size_t const sizeToCopy = MIN(wantedData, remainingInput);
  ------------------
  |  |  339|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (339:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1945|      0|                memcpy(dctx->tmpIn + dctx->tmpInSize, srcPtr, sizeToCopy);
 1946|      0|                srcPtr += sizeToCopy;
 1947|      0|                dctx->tmpInSize += sizeToCopy;
 1948|      0|                if (dctx->tmpInSize < 4) { /* not enough input to read complete suffix */
  ------------------
  |  Branch (1948:21): [True: 0, False: 0]
  ------------------
 1949|      0|                    nextSrcSizeHint = 4 - dctx->tmpInSize;
 1950|      0|                    doAnotherStage=0;
 1951|      0|                    break;
 1952|      0|                }
 1953|      0|                selectedIn = dctx->tmpIn;
 1954|      0|            }   /* if (dctx->dStage == dstage_storeSuffix) */
 1955|       |
 1956|       |        /* case dstage_checkSuffix: */   /* no direct entry, avoid initialization risks */
 1957|  4.73k|            if (!dctx->skipChecksum) {
  ------------------
  |  Branch (1957:17): [True: 4.73k, False: 0]
  ------------------
 1958|  4.73k|                U32 const readCRC = LZ4F_readLE32(selectedIn);
 1959|  4.73k|                U32 const resultCRC = XXH32_digest(&(dctx->xxh));
  ------------------
  |  |  133|  4.73k|#  define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
  |  |  ------------------
  |  |  |  |  126|  4.73k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  4.73k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1960|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 1961|       |                RETURN_ERROR_IF(readCRC != resultCRC, contentChecksum_invalid);
 1962|       |#else
 1963|  4.73k|                (void)readCRC;
 1964|  4.73k|                (void)resultCRC;
 1965|  4.73k|#endif
 1966|  4.73k|            }
 1967|  4.73k|            nextSrcSizeHint = 0;
 1968|  4.73k|            LZ4F_resetDecompressionContext(dctx);
 1969|  4.73k|            doAnotherStage = 0;
 1970|  4.73k|            break;
 1971|       |
 1972|      0|        case dstage_getSFrameSize:
  ------------------
  |  Branch (1972:9): [True: 0, False: 67.0k]
  ------------------
 1973|      0|            if ((srcEnd - srcPtr) >= 4) {
  ------------------
  |  Branch (1973:17): [True: 0, False: 0]
  ------------------
 1974|      0|                selectedIn = srcPtr;
 1975|      0|                srcPtr += 4;
 1976|      0|            } else {
 1977|       |                /* not enough input to read cBlockSize field */
 1978|      0|                dctx->tmpInSize = 4;
 1979|      0|                dctx->tmpInTarget = 8;
 1980|      0|                dctx->dStage = dstage_storeSFrameSize;
 1981|      0|            }
 1982|       |
 1983|      0|            if (dctx->dStage == dstage_storeSFrameSize)
  ------------------
  |  Branch (1983:17): [True: 0, False: 0]
  ------------------
 1984|      0|        case dstage_storeSFrameSize:
  ------------------
  |  Branch (1984:9): [True: 0, False: 67.0k]
  ------------------
 1985|      0|            {   size_t const sizeToCopy = MIN(dctx->tmpInTarget - dctx->tmpInSize,
  ------------------
  |  |  339|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (339:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1986|      0|                                             (size_t)(srcEnd - srcPtr) );
 1987|      0|                memcpy(dctx->header + dctx->tmpInSize, srcPtr, sizeToCopy);
 1988|      0|                srcPtr += sizeToCopy;
 1989|      0|                dctx->tmpInSize += sizeToCopy;
 1990|      0|                if (dctx->tmpInSize < dctx->tmpInTarget) {
  ------------------
  |  Branch (1990:21): [True: 0, False: 0]
  ------------------
 1991|       |                    /* not enough input to get full sBlockSize; wait for more */
 1992|      0|                    nextSrcSizeHint = dctx->tmpInTarget - dctx->tmpInSize;
 1993|      0|                    doAnotherStage = 0;
 1994|      0|                    break;
 1995|      0|                }
 1996|      0|                selectedIn = dctx->header + 4;
 1997|      0|            }   /* if (dctx->dStage == dstage_storeSFrameSize) */
 1998|       |
 1999|       |        /* case dstage_decodeSFrameSize: */   /* no direct entry */
 2000|      0|            {   size_t const SFrameSize = LZ4F_readLE32(selectedIn);
 2001|      0|                dctx->frameInfo.contentSize = SFrameSize;
 2002|      0|                dctx->tmpInTarget = SFrameSize;
 2003|      0|                dctx->dStage = dstage_skipSkippable;
 2004|      0|                break;
 2005|      0|            }
 2006|       |
 2007|      0|        case dstage_skipSkippable:
  ------------------
  |  Branch (2007:9): [True: 0, False: 67.0k]
  ------------------
 2008|      0|            {   size_t const skipSize = MIN(dctx->tmpInTarget, (size_t)(srcEnd-srcPtr));
  ------------------
  |  |  339|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (339:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2009|      0|                srcPtr += skipSize;
 2010|      0|                dctx->tmpInTarget -= skipSize;
 2011|      0|                doAnotherStage = 0;
 2012|      0|                nextSrcSizeHint = dctx->tmpInTarget;
 2013|      0|                if (nextSrcSizeHint) break;  /* still more to skip */
  ------------------
  |  Branch (2013:21): [True: 0, False: 0]
  ------------------
 2014|       |                /* frame fully skipped : prepare context for a new frame */
 2015|      0|                LZ4F_resetDecompressionContext(dctx);
 2016|      0|                break;
 2017|      0|            }
 2018|  67.0k|        }   /* switch (dctx->dStage) */
 2019|  67.0k|    }   /* while (doAnotherStage) */
 2020|       |
 2021|       |    /* preserve history within tmpOut whenever necessary */
 2022|  10.1k|    LZ4F_STATIC_ASSERT((unsigned)dstage_init == 2);
  ------------------
  |  |  149|  10.1k|#define LZ4F_STATIC_ASSERT(c)    { enum { LZ4F_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
 2023|  10.1k|    if ( (dctx->frameInfo.blockMode==LZ4F_blockLinked)  /* next block will use up to 64KB from previous ones */
  ------------------
  |  Branch (2023:10): [True: 0, False: 10.1k]
  ------------------
 2024|  10.1k|      && (dctx->dict != dctx->tmpOutBuffer)             /* dictionary is not already within tmp */
  ------------------
  |  Branch (2024:10): [True: 0, False: 0]
  ------------------
 2025|  10.1k|      && (dctx->dict != NULL)                           /* dictionary exists */
  ------------------
  |  Branch (2025:10): [True: 0, False: 0]
  ------------------
 2026|  10.1k|      && (!decompressOptionsPtr->stableDst)             /* cannot rely on dst data to remain there for next call */
  ------------------
  |  Branch (2026:10): [True: 0, False: 0]
  ------------------
 2027|  10.1k|      && ((unsigned)(dctx->dStage)-2 < (unsigned)(dstage_getSuffix)-2) )  /* valid stages : [init ... getSuffix[ */
  ------------------
  |  Branch (2027:10): [True: 0, False: 0]
  ------------------
 2028|      0|    {
 2029|      0|        if (dctx->dStage == dstage_flushOut) {
  ------------------
  |  Branch (2029:13): [True: 0, False: 0]
  ------------------
 2030|      0|            size_t const preserveSize = (size_t)(dctx->tmpOut - dctx->tmpOutBuffer);
 2031|      0|            size_t copySize = 64 KB - dctx->tmpOutSize;
  ------------------
  |  |  236|      0|#  define KB *(1<<10)
  ------------------
 2032|      0|            const BYTE* oldDictEnd = dctx->dict + dctx->dictSize - dctx->tmpOutStart;
 2033|      0|            if (dctx->tmpOutSize > 64 KB) copySize = 0;
  ------------------
  |  |  236|      0|#  define KB *(1<<10)
  ------------------
  |  Branch (2033:17): [True: 0, False: 0]
  ------------------
 2034|      0|            if (copySize > preserveSize) copySize = preserveSize;
  ------------------
  |  Branch (2034:17): [True: 0, False: 0]
  ------------------
 2035|      0|            assert(dctx->tmpOutBuffer != NULL);
 2036|       |
 2037|      0|            memcpy(dctx->tmpOutBuffer + preserveSize - copySize, oldDictEnd - copySize, copySize);
 2038|       |
 2039|      0|            dctx->dict = dctx->tmpOutBuffer;
 2040|      0|            dctx->dictSize = preserveSize + dctx->tmpOutStart;
 2041|      0|        } else {
 2042|      0|            const BYTE* const oldDictEnd = dctx->dict + dctx->dictSize;
 2043|      0|            size_t const newDictSize = MIN(dctx->dictSize, 64 KB);
  ------------------
  |  |  339|      0|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (339:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2044|       |
 2045|      0|            memcpy(dctx->tmpOutBuffer, oldDictEnd - newDictSize, newDictSize);
 2046|       |
 2047|      0|            dctx->dict = dctx->tmpOutBuffer;
 2048|      0|            dctx->dictSize = newDictSize;
 2049|      0|            dctx->tmpOut = dctx->tmpOutBuffer + newDictSize;
 2050|      0|        }
 2051|      0|    }
 2052|       |
 2053|  10.1k|    *srcSizePtr = (size_t)(srcPtr - srcStart);
 2054|  10.1k|    *dstSizePtr = (size_t)(dstPtr - dstStart);
 2055|  10.1k|    return nextSrcSizeHint;
 2056|  10.1k|}
lz4frame.c:LZ4F_compressBound_internal:
  374|  40.7k|{
  375|  40.7k|    LZ4F_preferences_t prefsNull = LZ4F_INIT_PREFERENCES;
  ------------------
  |  |  200|  40.7k|#define LZ4F_INIT_PREFERENCES   { LZ4F_INIT_FRAMEINFO, 0, 0u, 0u, { 0u, 0u, 0u } }    /* v1.8.3+ */
  |  |  ------------------
  |  |  |  |  185|  40.7k|#define LZ4F_INIT_FRAMEINFO   { LZ4F_default, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0ULL, 0U, LZ4F_noBlockChecksum }    /* v1.8.3+ */
  |  |  ------------------
  ------------------
  376|  40.7k|    prefsNull.frameInfo.contentChecksumFlag = LZ4F_contentChecksumEnabled;   /* worst case */
  377|  40.7k|    prefsNull.frameInfo.blockChecksumFlag = LZ4F_blockChecksumEnabled;   /* worst case */
  378|  40.7k|    {   const LZ4F_preferences_t* const prefsPtr = (preferencesPtr==NULL) ? &prefsNull : preferencesPtr;
  ------------------
  |  Branch (378:52): [True: 0, False: 40.7k]
  ------------------
  379|  40.7k|        U32 const flush = prefsPtr->autoFlush | (srcSize==0);
  380|  40.7k|        LZ4F_blockSizeID_t const blockID = prefsPtr->frameInfo.blockSizeID;
  381|  40.7k|        size_t const blockSize = LZ4F_getBlockSize(blockID);
  382|  40.7k|        size_t const maxBuffered = blockSize - 1;
  383|  40.7k|        size_t const bufferedSize = MIN(alreadyBuffered, maxBuffered);
  ------------------
  |  |  339|  40.7k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (339:22): [True: 40.7k, False: 0]
  |  |  ------------------
  ------------------
  384|  40.7k|        size_t const maxSrcSize = srcSize + bufferedSize;
  385|  40.7k|        unsigned const nbFullBlocks = (unsigned)(maxSrcSize / blockSize);
  386|  40.7k|        size_t const partialBlockSize = maxSrcSize & (blockSize-1);
  387|  40.7k|        size_t const lastBlockSize = flush ? partialBlockSize : 0;
  ------------------
  |  Branch (387:38): [True: 32.7k, False: 7.94k]
  ------------------
  388|  40.7k|        unsigned const nbBlocks = nbFullBlocks + (lastBlockSize>0);
  389|       |
  390|  40.7k|        size_t const blockCRCSize = BFSize * prefsPtr->frameInfo.blockChecksumFlag;
  391|  40.7k|        size_t const frameEnd = BHSize + (prefsPtr->frameInfo.contentChecksumFlag*BFSize);
  392|       |
  393|  40.7k|        return ((BHSize + blockCRCSize) * nbBlocks) +
  394|  40.7k|               (blockSize * nbFullBlocks) + lastBlockSize + frameEnd;
  395|  40.7k|    }
  396|  40.7k|}
lz4frame.c:LZ4F_free:
  127|  97.7k|{
  128|       |    /* custom malloc defined : use it */
  129|  97.7k|    if (cmem.customFree != NULL) {
  ------------------
  |  Branch (129:9): [True: 0, False: 97.7k]
  ------------------
  130|      0|        cmem.customFree(cmem.opaqueState, p);
  131|      0|        return;
  132|      0|    }
  133|       |    /* nothing defined : use default <stdlib.h>'s free() */
  134|  97.7k|    FREEMEM(p);
  ------------------
  |  |   97|  97.7k|#  define FREEMEM(p)        free(p)
  ------------------
  135|  97.7k|}
lz4frame.c:LZ4F_malloc:
  117|  36.6k|{
  118|       |    /* custom malloc defined : use it */
  119|  36.6k|    if (cmem.customAlloc != NULL) {
  ------------------
  |  Branch (119:9): [True: 0, False: 36.6k]
  ------------------
  120|      0|        return cmem.customAlloc(cmem.opaqueState, s);
  121|      0|    }
  122|       |    /* nothing defined : use default <stdlib.h>'s malloc() */
  123|  36.6k|    return ALLOC(s);
  ------------------
  |  |   95|  36.6k|#  define ALLOC(s)          malloc(s)
  ------------------
  124|  36.6k|}
lz4frame.c:LZ4F_calloc:
  101|  20.3k|{
  102|       |    /* custom calloc defined : use it */
  103|  20.3k|    if (cmem.customCalloc != NULL) {
  ------------------
  |  Branch (103:9): [True: 0, False: 20.3k]
  ------------------
  104|      0|        return cmem.customCalloc(cmem.opaqueState, s);
  105|      0|    }
  106|       |    /* nothing defined : use default <stdlib.h>'s calloc() */
  107|  20.3k|    if (cmem.customAlloc == NULL) {
  ------------------
  |  Branch (107:9): [True: 20.3k, False: 0]
  ------------------
  108|  20.3k|        return ALLOC_AND_ZERO(s);
  ------------------
  |  |   96|  20.3k|#  define ALLOC_AND_ZERO(s) calloc(1,(s))
  ------------------
  109|  20.3k|    }
  110|       |    /* only custom alloc defined : use it, and combine it with memset() */
  111|      0|    {   void* const p = cmem.customAlloc(cmem.opaqueState, s);
  112|      0|        if (p != NULL) MEM_INIT(p, 0, s);
  ------------------
  |  |   90|      0|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
  |  Branch (112:13): [True: 0, False: 0]
  ------------------
  113|      0|        return p;
  114|  20.3k|}   }
lz4frame.c:ctxTypeID_to_size:
  660|  20.3k|static int ctxTypeID_to_size(int ctxTypeID) {
  661|  20.3k|    switch(ctxTypeID) {
  662|  2.04k|    case 1:
  ------------------
  |  Branch (662:5): [True: 2.04k, False: 18.3k]
  ------------------
  663|  2.04k|        return LZ4_sizeofState();
  664|  8.13k|    case 2:
  ------------------
  |  Branch (664:5): [True: 8.13k, False: 12.2k]
  ------------------
  665|  8.13k|        return LZ4_sizeofStateHC();
  666|  10.1k|    default:
  ------------------
  |  Branch (666:5): [True: 10.1k, False: 10.1k]
  ------------------
  667|  10.1k|        return 0;
  668|  20.3k|    }
  669|  20.3k|}
lz4frame.c:LZ4F_initStream:
  642|  15.8k|                            LZ4F_blockMode_t blockMode) {
  643|  15.8k|    if (level < LZ4HC_CLEVEL_MIN) {
  ------------------
  |  |   47|  15.8k|#define LZ4HC_CLEVEL_MIN         3
  ------------------
  |  Branch (643:9): [True: 4.31k, False: 11.4k]
  ------------------
  644|  4.31k|        if (cdict != NULL || blockMode == LZ4F_blockLinked) {
  ------------------
  |  Branch (644:13): [True: 0, False: 4.31k]
  |  Branch (644:30): [True: 0, False: 4.31k]
  ------------------
  645|       |            /* In these cases, we will call LZ4_compress_fast_continue(),
  646|       |             * which needs an already reset context. Otherwise, we'll call a
  647|       |             * one-shot API. The non-continued APIs internally perform their own
  648|       |             * resets at the beginning of their calls, where they know what
  649|       |             * tableType they need the context to be in. So in that case this
  650|       |             * would be misguided / wasted work. */
  651|      0|            LZ4_resetStream_fast((LZ4_stream_t*)ctx);
  652|      0|        }
  653|  4.31k|        LZ4_attach_dictionary((LZ4_stream_t *)ctx, cdict ? cdict->fastCtx : NULL);
  ------------------
  |  Branch (653:52): [True: 0, False: 4.31k]
  ------------------
  654|  11.4k|    } else {
  655|  11.4k|        LZ4_resetStreamHC_fast((LZ4_streamHC_t*)ctx, level);
  656|  11.4k|        LZ4_attach_HC_dictionary((LZ4_streamHC_t *)ctx, cdict ? cdict->HCCtx : NULL);
  ------------------
  |  Branch (656:57): [True: 0, False: 11.4k]
  ------------------
  657|  11.4k|    }
  658|  15.8k|}
lz4frame.c:LZ4F_writeLE32:
  196|  50.9k|{
  197|  50.9k|    BYTE* const dstPtr = (BYTE*)dst;
  198|  50.9k|    dstPtr[0] = (BYTE)value32;
  199|  50.9k|    dstPtr[1] = (BYTE)(value32 >> 8);
  200|  50.9k|    dstPtr[2] = (BYTE)(value32 >> 16);
  201|  50.9k|    dstPtr[3] = (BYTE)(value32 >> 24);
  202|  50.9k|}
lz4frame.c:LZ4F_headerChecksum:
  342|  10.1k|{
  343|  10.1k|    U32 const xxh = XXH32(header, length, 0);
  ------------------
  |  |  128|  10.1k|#  define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
  |  |  ------------------
  |  |  |  |  126|  10.1k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  10.1k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  344|  10.1k|    return (BYTE)(xxh >> 8);
  345|  10.1k|}
lz4frame.c:LZ4F_compressUpdateImpl:
  935|  30.5k|  {
  936|  30.5k|    size_t const blockSize = cctxPtr->maxBlockSize;
  937|  30.5k|    const BYTE* srcPtr = (const BYTE*)srcBuffer;
  938|  30.5k|    const BYTE* const srcEnd = srcPtr + srcSize;
  939|  30.5k|    BYTE* const dstStart = (BYTE*)dstBuffer;
  940|  30.5k|    BYTE* dstPtr = dstStart;
  941|  30.5k|    LZ4F_lastBlockStatus lastBlockCompressed = notDone;
  942|  30.5k|    compressFunc_t const compress = LZ4F_selectCompression(cctxPtr->prefs.frameInfo.blockMode, cctxPtr->prefs.compressionLevel, blockCompression);
  943|  30.5k|    size_t bytesWritten;
  944|  30.5k|    DEBUGLOG(4, "LZ4F_compressUpdate (srcSize=%zu)", srcSize);
  ------------------
  |  |  161|  30.5k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
  945|       |
  946|  30.5k|    RETURN_ERROR_IF(cctxPtr->cStage != 1, compressionState_uninitialized);   /* state must be initialized and waiting for next block */
  ------------------
  |  |  317|  30.5k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 30.5k]
  |  |  ------------------
  ------------------
  947|  30.5k|    if (dstCapacity < LZ4F_compressBound_internal(srcSize, &(cctxPtr->prefs), cctxPtr->tmpInSize))
  ------------------
  |  Branch (947:9): [True: 0, False: 30.5k]
  ------------------
  948|      0|        RETURN_ERROR(dstMaxSize_tooSmall);
  ------------------
  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  949|       |
  950|  30.5k|    if (blockCompression == LZ4B_UNCOMPRESSED && dstCapacity < srcSize)
  ------------------
  |  Branch (950:9): [True: 10.1k, False: 20.3k]
  |  Branch (950:50): [True: 0, False: 10.1k]
  ------------------
  951|      0|        RETURN_ERROR(dstMaxSize_tooSmall);
  ------------------
  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  952|       |
  953|       |    /* flush currently written block, to continue with new block compression */
  954|  30.5k|    if (cctxPtr->blockCompression != blockCompression) {
  ------------------
  |  Branch (954:9): [True: 20.3k, False: 10.1k]
  ------------------
  955|  20.3k|        bytesWritten = LZ4F_flush(cctxPtr, dstBuffer, dstCapacity, compressOptionsPtr);
  956|  20.3k|        dstPtr += bytesWritten;
  957|  20.3k|        cctxPtr->blockCompression = blockCompression;
  958|  20.3k|    }
  959|       |
  960|  30.5k|    if (compressOptionsPtr == NULL) compressOptionsPtr = &k_cOptionsNull;
  ------------------
  |  Branch (960:9): [True: 30.5k, False: 0]
  ------------------
  961|       |
  962|       |    /* complete tmp buffer */
  963|  30.5k|    if (cctxPtr->tmpInSize > 0) {   /* some data already within tmp buffer */
  ------------------
  |  Branch (963:9): [True: 0, False: 30.5k]
  ------------------
  964|      0|        size_t const sizeToCopy = blockSize - cctxPtr->tmpInSize;
  965|      0|        assert(blockSize > cctxPtr->tmpInSize);
  966|      0|        if (sizeToCopy > srcSize) {
  ------------------
  |  Branch (966:13): [True: 0, False: 0]
  ------------------
  967|       |            /* add src to tmpIn buffer */
  968|      0|            memcpy(cctxPtr->tmpIn + cctxPtr->tmpInSize, srcBuffer, srcSize);
  969|      0|            srcPtr = srcEnd;
  970|      0|            cctxPtr->tmpInSize += srcSize;
  971|       |            /* still needs some CRC */
  972|      0|        } else {
  973|       |            /* complete tmpIn block and then compress it */
  974|      0|            lastBlockCompressed = fromTmpBuffer;
  975|      0|            memcpy(cctxPtr->tmpIn + cctxPtr->tmpInSize, srcBuffer, sizeToCopy);
  976|      0|            srcPtr += sizeToCopy;
  977|       |
  978|      0|            dstPtr += LZ4F_makeBlock(dstPtr,
  979|      0|                                     cctxPtr->tmpIn, blockSize,
  980|      0|                                     compress, cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel,
  981|      0|                                     cctxPtr->cdict,
  982|      0|                                     cctxPtr->prefs.frameInfo.blockChecksumFlag);
  983|      0|            if (cctxPtr->prefs.frameInfo.blockMode==LZ4F_blockLinked) cctxPtr->tmpIn += blockSize;
  ------------------
  |  Branch (983:17): [True: 0, False: 0]
  ------------------
  984|      0|            cctxPtr->tmpInSize = 0;
  985|      0|    }   }
  986|       |
  987|  33.9k|    while ((size_t)(srcEnd - srcPtr) >= blockSize) {
  ------------------
  |  Branch (987:12): [True: 3.45k, False: 30.5k]
  ------------------
  988|       |        /* compress full blocks */
  989|  3.45k|        lastBlockCompressed = fromSrcBuffer;
  990|  3.45k|        dstPtr += LZ4F_makeBlock(dstPtr,
  991|  3.45k|                                 srcPtr, blockSize,
  992|  3.45k|                                 compress, cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel,
  993|  3.45k|                                 cctxPtr->cdict,
  994|  3.45k|                                 cctxPtr->prefs.frameInfo.blockChecksumFlag);
  995|  3.45k|        srcPtr += blockSize;
  996|  3.45k|    }
  997|       |
  998|  30.5k|    if ((cctxPtr->prefs.autoFlush) && (srcPtr < srcEnd)) {
  ------------------
  |  Branch (998:9): [True: 12.0k, False: 18.4k]
  |  Branch (998:39): [True: 5.72k, False: 6.34k]
  ------------------
  999|       |        /* autoFlush : remaining input (< blockSize) is compressed */
 1000|  5.72k|        lastBlockCompressed = fromSrcBuffer;
 1001|  5.72k|        dstPtr += LZ4F_makeBlock(dstPtr,
 1002|  5.72k|                                 srcPtr, (size_t)(srcEnd - srcPtr),
 1003|  5.72k|                                 compress, cctxPtr->lz4CtxPtr, cctxPtr->prefs.compressionLevel,
 1004|  5.72k|                                 cctxPtr->cdict,
 1005|  5.72k|                                 cctxPtr->prefs.frameInfo.blockChecksumFlag);
 1006|  5.72k|        srcPtr = srcEnd;
 1007|  5.72k|    }
 1008|       |
 1009|       |    /* preserve dictionary within @tmpBuff whenever necessary */
 1010|  30.5k|    if ((cctxPtr->prefs.frameInfo.blockMode==LZ4F_blockLinked) && (lastBlockCompressed==fromSrcBuffer)) {
  ------------------
  |  Branch (1010:9): [True: 0, False: 30.5k]
  |  Branch (1010:67): [True: 0, False: 0]
  ------------------
 1011|       |        /* linked blocks are only supported in compressed mode, see LZ4F_uncompressedUpdate */
 1012|      0|        assert(blockCompression == LZ4B_COMPRESSED);
 1013|      0|        if (compressOptionsPtr->stableSrc) {
  ------------------
  |  Branch (1013:13): [True: 0, False: 0]
  ------------------
 1014|      0|            cctxPtr->tmpIn = cctxPtr->tmpBuff;  /* src is stable : dictionary remains in src across invocations */
 1015|      0|        } else {
 1016|      0|            int const realDictSize = LZ4F_localSaveDict(cctxPtr);
 1017|      0|            assert(0 <= realDictSize && realDictSize <= 64 KB);
 1018|      0|            cctxPtr->tmpIn = cctxPtr->tmpBuff + realDictSize;
 1019|      0|        }
 1020|      0|    }
 1021|       |
 1022|       |    /* keep tmpIn within limits */
 1023|  30.5k|    if (!(cctxPtr->prefs.autoFlush)  /* no autoflush : there may be some data left within internal buffer */
  ------------------
  |  Branch (1023:9): [True: 18.4k, False: 12.0k]
  ------------------
 1024|  30.5k|      && (cctxPtr->tmpIn + blockSize) > (cctxPtr->tmpBuff + cctxPtr->maxBufferSize) )  /* not enough room to store next block */
  ------------------
  |  Branch (1024:10): [True: 0, False: 18.4k]
  ------------------
 1025|      0|    {
 1026|       |        /* only preserve 64KB within internal buffer. Ensures there is enough room for next block.
 1027|       |         * note: this situation necessarily implies lastBlockCompressed==fromTmpBuffer */
 1028|      0|        int const realDictSize = LZ4F_localSaveDict(cctxPtr);
 1029|      0|        cctxPtr->tmpIn = cctxPtr->tmpBuff + realDictSize;
 1030|      0|        assert((cctxPtr->tmpIn + blockSize) <= (cctxPtr->tmpBuff + cctxPtr->maxBufferSize));
 1031|      0|    }
 1032|       |
 1033|       |    /* some input data left, necessarily < blockSize */
 1034|  30.5k|    if (srcPtr < srcEnd) {
  ------------------
  |  Branch (1034:9): [True: 7.93k, False: 22.6k]
  ------------------
 1035|       |        /* fill tmp buffer */
 1036|  7.93k|        size_t const sizeToCopy = (size_t)(srcEnd - srcPtr);
 1037|  7.93k|        memcpy(cctxPtr->tmpIn, srcPtr, sizeToCopy);
 1038|  7.93k|        cctxPtr->tmpInSize = sizeToCopy;
 1039|  7.93k|    }
 1040|       |
 1041|  30.5k|    if (cctxPtr->prefs.frameInfo.contentChecksumFlag == LZ4F_contentChecksumEnabled)
  ------------------
  |  Branch (1041:9): [True: 14.2k, False: 16.3k]
  ------------------
 1042|  14.2k|        (void)XXH32_update(&(cctxPtr->xxh), srcBuffer, srcSize);
  ------------------
  |  |  132|  14.2k|#  define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
  |  |  ------------------
  |  |  |  |  126|  14.2k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  14.2k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1043|       |
 1044|  30.5k|    cctxPtr->totalInSize += srcSize;
 1045|  30.5k|    return (size_t)(dstPtr - dstStart);
 1046|  30.5k|}
lz4frame.c:LZ4F_selectCompression:
  895|  38.4k|{
  896|  38.4k|    if (compressMode == LZ4B_UNCOMPRESSED) return LZ4F_doNotCompressBlock;
  ------------------
  |  Branch (896:9): [True: 10.8k, False: 27.6k]
  ------------------
  897|  27.6k|    if (level < LZ4HC_CLEVEL_MIN) {
  ------------------
  |  |   47|  27.6k|#define LZ4HC_CLEVEL_MIN         3
  ------------------
  |  Branch (897:9): [True: 6.02k, False: 21.6k]
  ------------------
  898|  6.02k|        if (blockMode == LZ4F_blockIndependent) return LZ4F_compressBlock;
  ------------------
  |  Branch (898:13): [True: 6.02k, False: 0]
  ------------------
  899|      0|        return LZ4F_compressBlock_continue;
  900|  6.02k|    }
  901|  21.6k|    if (blockMode == LZ4F_blockIndependent) return LZ4F_compressBlockHC;
  ------------------
  |  Branch (901:9): [True: 21.6k, False: 0]
  ------------------
  902|      0|    return LZ4F_compressBlockHC_continue;
  903|  21.6k|}
lz4frame.c:LZ4F_doNotCompressBlock:
  889|  1.30k|{
  890|  1.30k|    (void)ctx; (void)src; (void)dst; (void)srcSize; (void)dstCapacity; (void)level; (void)cdict;
  891|  1.30k|    return 0;
  892|  1.30k|}
lz4frame.c:LZ4F_compressBlock:
  854|  4.31k|{
  855|  4.31k|    int const acceleration = (level < 0) ? -level + 1 : 1;
  ------------------
  |  Branch (855:30): [True: 3.04k, False: 1.27k]
  ------------------
  856|  4.31k|    DEBUGLOG(5, "LZ4F_compressBlock (srcSize=%i)", srcSize);
  ------------------
  |  |  161|  4.31k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
  857|  4.31k|    LZ4F_initStream(ctx, cdict, level, LZ4F_blockIndependent);
  858|  4.31k|    if (cdict) {
  ------------------
  |  Branch (858:9): [True: 0, False: 4.31k]
  ------------------
  859|      0|        return LZ4_compress_fast_continue((LZ4_stream_t*)ctx, src, dst, srcSize, dstCapacity, acceleration);
  860|  4.31k|    } else {
  861|  4.31k|        return LZ4_compress_fast_extState_fastReset(ctx, src, dst, srcSize, dstCapacity, acceleration);
  862|  4.31k|    }
  863|  4.31k|}
lz4frame.c:LZ4F_compressBlockHC:
  874|  11.4k|{
  875|  11.4k|    LZ4F_initStream(ctx, cdict, level, LZ4F_blockIndependent);
  876|  11.4k|    if (cdict) {
  ------------------
  |  Branch (876:9): [True: 0, False: 11.4k]
  ------------------
  877|      0|        return LZ4_compress_HC_continue((LZ4_streamHC_t*)ctx, src, dst, srcSize, dstCapacity);
  878|      0|    }
  879|  11.4k|    return LZ4_compress_HC_extStateHC_fastReset(ctx, src, dst, srcSize, dstCapacity, level);
  880|  11.4k|}
lz4frame.c:LZ4F_makeBlock:
  830|  17.1k|{
  831|  17.1k|    BYTE* const cSizePtr = (BYTE*)dst;
  832|  17.1k|    U32 cSize;
  833|  17.1k|    assert(compress != NULL);
  834|  17.1k|    cSize = (U32)compress(lz4ctx, (const char*)src, (char*)(cSizePtr+BHSize),
  835|  17.1k|                          (int)(srcSize), (int)(srcSize-1),
  836|  17.1k|                          level, cdict);
  837|       |
  838|  17.1k|    if (cSize == 0 || cSize >= srcSize) {
  ------------------
  |  Branch (838:9): [True: 4.29k, False: 12.8k]
  |  Branch (838:23): [True: 0, False: 12.8k]
  ------------------
  839|  4.29k|        cSize = (U32)srcSize;
  840|  4.29k|        LZ4F_writeLE32(cSizePtr, cSize | LZ4F_BLOCKUNCOMPRESSED_FLAG);
  ------------------
  |  |  247|  4.29k|#define LZ4F_BLOCKUNCOMPRESSED_FLAG 0x80000000U
  ------------------
  841|  4.29k|        memcpy(cSizePtr+BHSize, src, srcSize);
  842|  12.8k|    } else {
  843|  12.8k|        LZ4F_writeLE32(cSizePtr, cSize);
  844|  12.8k|    }
  845|  17.1k|    if (crcFlag) {
  ------------------
  |  Branch (845:9): [True: 8.75k, False: 8.36k]
  ------------------
  846|  8.75k|        U32 const crc32 = XXH32(cSizePtr+BHSize, cSize, 0);  /* checksum of compressed data */
  ------------------
  |  |  128|  8.75k|#  define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
  |  |  ------------------
  |  |  |  |  126|  8.75k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|  8.75k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  847|  8.75k|        LZ4F_writeLE32(cSizePtr+BHSize+cSize, crc32);
  848|  8.75k|    }
  849|  17.1k|    return BHSize + cSize + ((U32)crcFlag)*BFSize;
  850|  17.1k|}
lz4frame.c:LZ4F_readLE32:
  186|  50.9k|{
  187|  50.9k|    const BYTE* const srcPtr = (const BYTE*)src;
  188|  50.9k|    U32 value32 = srcPtr[0];
  189|  50.9k|    value32 += ((U32)srcPtr[1])<< 8;
  190|  50.9k|    value32 += ((U32)srcPtr[2])<<16;
  191|  50.9k|    value32 += ((U32)srcPtr[3])<<24;
  192|  50.9k|    return value32;
  193|  50.9k|}
lz4frame.c:LZ4F_decodeHeader:
 1290|  10.1k|{
 1291|  10.1k|    unsigned blockMode, blockChecksumFlag, contentSizeFlag, contentChecksumFlag, dictIDFlag, blockSizeID;
 1292|  10.1k|    size_t frameHeaderSize;
 1293|  10.1k|    const BYTE* srcPtr = (const BYTE*)src;
 1294|       |
 1295|  10.1k|    DEBUGLOG(5, "LZ4F_decodeHeader");
  ------------------
  |  |  161|  10.1k|#  define DEBUGLOG(l, ...)      {}    /* disabled */
  ------------------
 1296|       |    /* need to decode header to get frameInfo */
 1297|  10.1k|    RETURN_ERROR_IF(srcSize < minFHSize, frameHeader_incomplete);   /* minimal frame header size */
  ------------------
  |  |  317|  10.1k|#define RETURN_ERROR_IF(c,e) if (c) RETURN_ERROR(e)
  |  |  ------------------
  |  |  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  |  |  ------------------
  |  |  |  Branch (317:34): [True: 0, False: 10.1k]
  |  |  ------------------
  ------------------
 1298|  10.1k|    MEM_INIT(&(dctx->frameInfo), 0, sizeof(dctx->frameInfo));
  ------------------
  |  |   90|  10.1k|#  define MEM_INIT(p,v,s)   memset((p),(v),(s))
  ------------------
 1299|       |
 1300|       |    /* special case : skippable frames */
 1301|  10.1k|    if ((LZ4F_readLE32(srcPtr) & 0xFFFFFFF0U) == LZ4F_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  398|  10.1k|#define LZ4F_MAGIC_SKIPPABLE_START 0x184D2A50U
  ------------------
  |  Branch (1301:9): [True: 0, False: 10.1k]
  ------------------
 1302|      0|        dctx->frameInfo.frameType = LZ4F_skippableFrame;
 1303|      0|        if (src == (void*)(dctx->header)) {
  ------------------
  |  Branch (1303:13): [True: 0, False: 0]
  ------------------
 1304|      0|            dctx->tmpInSize = srcSize;
 1305|      0|            dctx->tmpInTarget = 8;
 1306|      0|            dctx->dStage = dstage_storeSFrameSize;
 1307|      0|            return srcSize;
 1308|      0|        } else {
 1309|      0|            dctx->dStage = dstage_getSFrameSize;
 1310|      0|            return 4;
 1311|      0|    }   }
 1312|       |
 1313|       |    /* control magic number */
 1314|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 1315|       |    if (LZ4F_readLE32(srcPtr) != LZ4F_MAGICNUMBER) {
 1316|       |        DEBUGLOG(4, "frame header error : unknown magic number");
 1317|       |        RETURN_ERROR(frameType_unknown);
 1318|       |    }
 1319|       |#endif
 1320|  10.1k|    dctx->frameInfo.frameType = LZ4F_frame;
 1321|       |
 1322|       |    /* Flags */
 1323|  10.1k|    {   U32 const FLG = srcPtr[4];
 1324|  10.1k|        U32 const version = (FLG>>6) & _2BITS;
  ------------------
  |  |  242|  10.1k|#define _2BITS 0x03
  ------------------
 1325|  10.1k|        blockChecksumFlag = (FLG>>4) & _1BIT;
  ------------------
  |  |  241|  10.1k|#define _1BIT  0x01
  ------------------
 1326|  10.1k|        blockMode = (FLG>>5) & _1BIT;
  ------------------
  |  |  241|  10.1k|#define _1BIT  0x01
  ------------------
 1327|  10.1k|        contentSizeFlag = (FLG>>3) & _1BIT;
  ------------------
  |  |  241|  10.1k|#define _1BIT  0x01
  ------------------
 1328|  10.1k|        contentChecksumFlag = (FLG>>2) & _1BIT;
  ------------------
  |  |  241|  10.1k|#define _1BIT  0x01
  ------------------
 1329|  10.1k|        dictIDFlag = FLG & _1BIT;
  ------------------
  |  |  241|  10.1k|#define _1BIT  0x01
  ------------------
 1330|       |        /* validate */
 1331|  10.1k|        if (((FLG>>1)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set); /* Reserved bit */
  ------------------
  |  |  241|  10.1k|#define _1BIT  0x01
  ------------------
                      if (((FLG>>1)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set); /* Reserved bit */
  ------------------
  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (1331:13): [True: 0, False: 10.1k]
  ------------------
 1332|  10.1k|        if (version != 1) RETURN_ERROR(headerVersion_wrong);       /* Version Number, only supported value */
  ------------------
  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (1332:13): [True: 0, False: 10.1k]
  ------------------
 1333|  10.1k|    }
 1334|       |
 1335|       |    /* Frame Header Size */
 1336|  10.1k|    frameHeaderSize = minFHSize + (contentSizeFlag?8:0) + (dictIDFlag?4:0);
  ------------------
  |  Branch (1336:36): [True: 0, False: 10.1k]
  |  Branch (1336:60): [True: 0, False: 10.1k]
  ------------------
 1337|       |
 1338|  10.1k|    if (srcSize < frameHeaderSize) {
  ------------------
  |  Branch (1338:9): [True: 0, False: 10.1k]
  ------------------
 1339|       |        /* not enough input to fully decode frame header */
 1340|      0|        if (srcPtr != dctx->header)
  ------------------
  |  Branch (1340:13): [True: 0, False: 0]
  ------------------
 1341|      0|            memcpy(dctx->header, srcPtr, srcSize);
 1342|      0|        dctx->tmpInSize = srcSize;
 1343|      0|        dctx->tmpInTarget = frameHeaderSize;
 1344|      0|        dctx->dStage = dstage_storeFrameHeader;
 1345|      0|        return srcSize;
 1346|      0|    }
 1347|       |
 1348|  10.1k|    {   U32 const BD = srcPtr[5];
 1349|  10.1k|        blockSizeID = (BD>>4) & _3BITS;
  ------------------
  |  |  243|  10.1k|#define _3BITS 0x07
  ------------------
 1350|       |        /* validate */
 1351|  10.1k|        if (((BD>>7)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set);   /* Reserved bit */
  ------------------
  |  |  241|  10.1k|#define _1BIT  0x01
  ------------------
                      if (((BD>>7)&_1BIT) != 0) RETURN_ERROR(reservedFlag_set);   /* Reserved bit */
  ------------------
  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (1351:13): [True: 0, False: 10.1k]
  ------------------
 1352|  10.1k|        if (blockSizeID < 4) RETURN_ERROR(maxBlockSize_invalid);    /* 4-7 only supported values for the time being */
  ------------------
  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (1352:13): [True: 0, False: 10.1k]
  ------------------
 1353|  10.1k|        if (((BD>>0)&_4BITS) != 0) RETURN_ERROR(reservedFlag_set);  /* Reserved bits */
  ------------------
  |  |  244|  10.1k|#define _4BITS 0x0F
  ------------------
                      if (((BD>>0)&_4BITS) != 0) RETURN_ERROR(reservedFlag_set);  /* Reserved bits */
  ------------------
  |  |  315|      0|#define RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e)
  ------------------
  |  Branch (1353:13): [True: 0, False: 10.1k]
  ------------------
 1354|  10.1k|    }
 1355|       |
 1356|       |    /* check header */
 1357|  10.1k|    assert(frameHeaderSize > 5);
 1358|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 1359|       |    {   BYTE const HC = LZ4F_headerChecksum(srcPtr+4, frameHeaderSize-5);
 1360|       |        RETURN_ERROR_IF(HC != srcPtr[frameHeaderSize-1], headerChecksum_invalid);
 1361|       |    }
 1362|       |#endif
 1363|       |
 1364|       |    /* save */
 1365|  10.1k|    dctx->frameInfo.blockMode = (LZ4F_blockMode_t)blockMode;
 1366|  10.1k|    dctx->frameInfo.blockChecksumFlag = (LZ4F_blockChecksum_t)blockChecksumFlag;
 1367|  10.1k|    dctx->frameInfo.contentChecksumFlag = (LZ4F_contentChecksum_t)contentChecksumFlag;
 1368|  10.1k|    dctx->frameInfo.blockSizeID = (LZ4F_blockSizeID_t)blockSizeID;
 1369|  10.1k|    dctx->maxBlockSize = LZ4F_getBlockSize((LZ4F_blockSizeID_t)blockSizeID);
 1370|  10.1k|    if (contentSizeFlag)
  ------------------
  |  Branch (1370:9): [True: 0, False: 10.1k]
  ------------------
 1371|      0|        dctx->frameRemainingSize = dctx->frameInfo.contentSize = LZ4F_readLE64(srcPtr+6);
 1372|  10.1k|    if (dictIDFlag)
  ------------------
  |  Branch (1372:9): [True: 0, False: 10.1k]
  ------------------
 1373|      0|        dctx->frameInfo.dictID = LZ4F_readLE32(srcPtr + frameHeaderSize - 5);
 1374|       |
 1375|  10.1k|    dctx->dStage = dstage_init;
 1376|       |
 1377|  10.1k|    return frameHeaderSize;
 1378|  10.1k|}

LZ4_sizeofStateHC:
  938|  8.13k|int LZ4_sizeofStateHC(void) { return (int)sizeof(LZ4_streamHC_t); }
LZ4_compress_HC_extStateHC_fastReset:
  953|  11.4k|{
  954|  11.4k|    LZ4HC_CCtx_internal* const ctx = &((LZ4_streamHC_t*)state)->internal_donotuse;
  955|  11.4k|    if (!LZ4_isAligned(state, LZ4_streamHC_t_alignment())) return 0;
  ------------------
  |  Branch (955:9): [True: 0, False: 11.4k]
  ------------------
  956|  11.4k|    LZ4_resetStreamHC_fast((LZ4_streamHC_t*)state, compressionLevel);
  957|  11.4k|    LZ4HC_init_internal (ctx, (const BYTE*)src);
  958|  11.4k|    if (dstCapacity < LZ4_compressBound(srcSize))
  ------------------
  |  Branch (958:9): [True: 11.4k, False: 0]
  ------------------
  959|  11.4k|        return LZ4HC_compress_generic (ctx, src, dst, &srcSize, dstCapacity, compressionLevel, limitedOutput);
  960|      0|    else
  961|      0|        return LZ4HC_compress_generic (ctx, src, dst, &srcSize, dstCapacity, compressionLevel, notLimited);
  962|  11.4k|}
LZ4_initStreamHC:
 1026|  8.65k|{
 1027|  8.65k|    LZ4_streamHC_t* const LZ4_streamHCPtr = (LZ4_streamHC_t*)buffer;
 1028|  8.65k|    DEBUGLOG(4, "LZ4_initStreamHC(%p, %u)", buffer, (unsigned)size);
  ------------------
  |  |  288|  8.65k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1029|       |    /* check conditions */
 1030|  8.65k|    if (buffer == NULL) return NULL;
  ------------------
  |  Branch (1030:9): [True: 0, False: 8.65k]
  ------------------
 1031|  8.65k|    if (size < sizeof(LZ4_streamHC_t)) return NULL;
  ------------------
  |  Branch (1031:9): [True: 0, False: 8.65k]
  ------------------
 1032|  8.65k|    if (!LZ4_isAligned(buffer, LZ4_streamHC_t_alignment())) return NULL;
  ------------------
  |  Branch (1032:9): [True: 0, False: 8.65k]
  ------------------
 1033|       |    /* init */
 1034|  8.65k|    { LZ4HC_CCtx_internal* const hcstate = &(LZ4_streamHCPtr->internal_donotuse);
 1035|  8.65k|      MEM_INIT(hcstate, 0, sizeof(*hcstate)); }
  ------------------
  |  |  235|  8.65k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  233|  8.65k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 1036|  8.65k|    LZ4_setCompressionLevel(LZ4_streamHCPtr, LZ4HC_CLEVEL_DEFAULT);
  ------------------
  |  |   48|  8.65k|#define LZ4HC_CLEVEL_DEFAULT     9
  ------------------
 1037|  8.65k|    return LZ4_streamHCPtr;
 1038|  8.65k|}
LZ4_resetStreamHC_fast:
 1048|  22.9k|{
 1049|  22.9k|    LZ4HC_CCtx_internal* const s = &LZ4_streamHCPtr->internal_donotuse;
 1050|  22.9k|    DEBUGLOG(5, "LZ4_resetStreamHC_fast(%p, %d)", LZ4_streamHCPtr, compressionLevel);
  ------------------
  |  |  288|  22.9k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1051|  22.9k|    if (s->dirty) {
  ------------------
  |  Branch (1051:9): [True: 524, False: 22.4k]
  ------------------
 1052|    524|        LZ4_initStreamHC(LZ4_streamHCPtr, sizeof(*LZ4_streamHCPtr));
 1053|  22.4k|    } else {
 1054|  22.4k|        assert(s->end >= s->prefixStart);
 1055|  22.4k|        s->dictLimit += (U32)(s->end - s->prefixStart);
 1056|  22.4k|        s->prefixStart = NULL;
 1057|  22.4k|        s->end = NULL;
 1058|  22.4k|        s->dictCtx = NULL;
 1059|  22.4k|    }
 1060|  22.9k|    LZ4_setCompressionLevel(LZ4_streamHCPtr, compressionLevel);
 1061|  22.9k|}
LZ4_setCompressionLevel:
 1064|  31.6k|{
 1065|  31.6k|    DEBUGLOG(5, "LZ4_setCompressionLevel(%p, %d)", LZ4_streamHCPtr, compressionLevel);
  ------------------
  |  |  288|  31.6k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1066|  31.6k|    if (compressionLevel < 1) compressionLevel = LZ4HC_CLEVEL_DEFAULT;
  ------------------
  |  |   48|      0|#define LZ4HC_CLEVEL_DEFAULT     9
  ------------------
  |  Branch (1066:9): [True: 0, False: 31.6k]
  ------------------
 1067|  31.6k|    if (compressionLevel > LZ4HC_CLEVEL_MAX) compressionLevel = LZ4HC_CLEVEL_MAX;
  ------------------
  |  |   50|  31.6k|#define LZ4HC_CLEVEL_MAX        12
  ------------------
                  if (compressionLevel > LZ4HC_CLEVEL_MAX) compressionLevel = LZ4HC_CLEVEL_MAX;
  ------------------
  |  |   50|      0|#define LZ4HC_CLEVEL_MAX        12
  ------------------
  |  Branch (1067:9): [True: 0, False: 31.6k]
  ------------------
 1068|  31.6k|    LZ4_streamHCPtr->internal_donotuse.compressionLevel = (short)compressionLevel;
 1069|  31.6k|}
LZ4_favorDecompressionSpeed:
 1072|  8.13k|{
 1073|  8.13k|    LZ4_streamHCPtr->internal_donotuse.favorDecSpeed = (favor!=0);
 1074|  8.13k|}
LZ4_attach_HC_dictionary:
 1099|  11.4k|void LZ4_attach_HC_dictionary(LZ4_streamHC_t *working_stream, const LZ4_streamHC_t *dictionary_stream) {
 1100|  11.4k|    working_stream->internal_donotuse.dictCtx = dictionary_stream != NULL ? &(dictionary_stream->internal_donotuse) : NULL;
  ------------------
  |  Branch (1100:49): [True: 0, False: 11.4k]
  ------------------
 1101|  11.4k|}
lz4hc.c:LZ4_streamHC_t_alignment:
  941|  20.1k|{
  942|  20.1k|#if LZ4_ALIGN_TEST
  943|  20.1k|    typedef struct { char c; LZ4_streamHC_t t; } t_a;
  944|  20.1k|    return sizeof(t_a) - sizeof(LZ4_streamHC_t);
  945|       |#else
  946|       |    return 1;  /* effectively disabled */
  947|       |#endif
  948|  20.1k|}
lz4hc.c:LZ4HC_init_internal:
  103|  11.4k|{
  104|  11.4k|    size_t const bufferSize = (size_t)(hc4->end - hc4->prefixStart);
  105|  11.4k|    size_t newStartingOffset = bufferSize + hc4->dictLimit;
  106|  11.4k|    DEBUGLOG(5, "LZ4HC_init_internal");
  ------------------
  |  |  288|  11.4k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  107|  11.4k|    assert(newStartingOffset >= bufferSize);  /* check overflow */
  108|  11.4k|    if (newStartingOffset > 1 GB) {
  ------------------
  |  |  252|  11.4k|#define GB *(1U<<30)
  ------------------
  |  Branch (108:9): [True: 0, False: 11.4k]
  ------------------
  109|      0|        LZ4HC_clearTables(hc4);
  110|      0|        newStartingOffset = 0;
  111|      0|    }
  112|  11.4k|    newStartingOffset += 64 KB;
  ------------------
  |  |  250|  11.4k|#define KB *(1 <<10)
  ------------------
  113|  11.4k|    hc4->nextToUpdate = (U32)newStartingOffset;
  114|  11.4k|    hc4->prefixStart = start;
  115|  11.4k|    hc4->end = start;
  116|  11.4k|    hc4->dictStart = start;
  117|  11.4k|    hc4->dictLimit = (U32)newStartingOffset;
  118|  11.4k|    hc4->lowLimit = (U32)newStartingOffset;
  119|  11.4k|}
lz4hc.c:LZ4HC_compress_generic:
  929|  11.4k|{
  930|  11.4k|    if (ctx->dictCtx == NULL) {
  ------------------
  |  Branch (930:9): [True: 11.4k, False: 0]
  ------------------
  931|  11.4k|        return LZ4HC_compress_generic_noDictCtx(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit);
  932|  11.4k|    } else {
  933|      0|        return LZ4HC_compress_generic_dictCtx(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit);
  934|      0|    }
  935|  11.4k|}
lz4hc.c:LZ4HC_compress_generic_noDictCtx:
  888|  11.4k|{
  889|  11.4k|    assert(ctx->dictCtx == NULL);
  890|  11.4k|    return LZ4HC_compress_generic_internal(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit, noDictCtx);
  891|  11.4k|}
lz4hc.c:LZ4HC_compress_generic_internal:
  823|  11.4k|{
  824|  11.4k|    typedef enum { lz4hc, lz4opt } lz4hc_strat_e;
  825|  11.4k|    typedef struct {
  826|  11.4k|        lz4hc_strat_e strat;
  827|  11.4k|        int nbSearches;
  828|  11.4k|        U32 targetLength;
  829|  11.4k|    } cParams_t;
  830|  11.4k|    static const cParams_t clTable[LZ4HC_CLEVEL_MAX+1] = {
  831|  11.4k|        { lz4hc,     2, 16 },  /* 0, unused */
  832|  11.4k|        { lz4hc,     2, 16 },  /* 1, unused */
  833|  11.4k|        { lz4hc,     2, 16 },  /* 2, unused */
  834|  11.4k|        { lz4hc,     4, 16 },  /* 3 */
  835|  11.4k|        { lz4hc,     8, 16 },  /* 4 */
  836|  11.4k|        { lz4hc,    16, 16 },  /* 5 */
  837|  11.4k|        { lz4hc,    32, 16 },  /* 6 */
  838|  11.4k|        { lz4hc,    64, 16 },  /* 7 */
  839|  11.4k|        { lz4hc,   128, 16 },  /* 8 */
  840|  11.4k|        { lz4hc,   256, 16 },  /* 9 */
  841|  11.4k|        { lz4opt,   96, 64 },  /*10==LZ4HC_CLEVEL_OPT_MIN*/
  842|  11.4k|        { lz4opt,  512,128 },  /*11 */
  843|  11.4k|        { lz4opt,16384,LZ4_OPT_NUM },  /* 12==LZ4HC_CLEVEL_MAX */
  ------------------
  |  |   77|  11.4k|#define LZ4_OPT_NUM   (1<<12)
  ------------------
  844|  11.4k|    };
  845|       |
  846|  11.4k|    DEBUGLOG(5, "LZ4HC_compress_generic_internal(src=%p, srcSize=%d)",
  ------------------
  |  |  288|  11.4k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  847|  11.4k|                src, *srcSizePtr);
  848|       |
  849|  11.4k|    if (limit == fillOutput && dstCapacity < 1) return 0;   /* Impossible to store anything */
  ------------------
  |  Branch (849:9): [True: 0, False: 11.4k]
  |  Branch (849:32): [True: 0, False: 0]
  ------------------
  850|  11.4k|    if ((U32)*srcSizePtr > (U32)LZ4_MAX_INPUT_SIZE) return 0;    /* Unsupported input size (too large or negative) */
  ------------------
  |  |  212|  11.4k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  ------------------
  |  Branch (850:9): [True: 0, False: 11.4k]
  ------------------
  851|       |
  852|  11.4k|    ctx->end += *srcSizePtr;
  853|  11.4k|    if (cLevel < 1) cLevel = LZ4HC_CLEVEL_DEFAULT;   /* note : convention is different from lz4frame, maybe something to review */
  ------------------
  |  |   48|      0|#define LZ4HC_CLEVEL_DEFAULT     9
  ------------------
  |  Branch (853:9): [True: 0, False: 11.4k]
  ------------------
  854|  11.4k|    cLevel = MIN(LZ4HC_CLEVEL_MAX, cLevel);
  ------------------
  |  |   81|  11.4k|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (81:22): [True: 0, False: 11.4k]
  |  |  ------------------
  ------------------
  855|  11.4k|    {   cParams_t const cParam = clTable[cLevel];
  856|  11.4k|        HCfavor_e const favor = ctx->favorDecSpeed ? favorDecompressionSpeed : favorCompressionRatio;
  ------------------
  |  Branch (856:33): [True: 3.91k, False: 7.57k]
  ------------------
  857|  11.4k|        int result;
  858|       |
  859|  11.4k|        if (cParam.strat == lz4hc) {
  ------------------
  |  Branch (859:13): [True: 5.68k, False: 5.81k]
  ------------------
  860|  5.68k|            result = LZ4HC_compress_hashChain(ctx,
  861|  5.68k|                                src, dst, srcSizePtr, dstCapacity,
  862|  5.68k|                                cParam.nbSearches, limit, dict);
  863|  5.81k|        } else {
  864|  5.81k|            assert(cParam.strat == lz4opt);
  865|  5.81k|            result = LZ4HC_compress_optimal(ctx,
  866|  5.81k|                                src, dst, srcSizePtr, dstCapacity,
  867|  5.81k|                                cParam.nbSearches, cParam.targetLength, limit,
  868|  5.81k|                                cLevel == LZ4HC_CLEVEL_MAX,   /* ultra mode */
  ------------------
  |  |   50|  5.81k|#define LZ4HC_CLEVEL_MAX        12
  ------------------
  869|  5.81k|                                dict, favor);
  870|  5.81k|        }
  871|  11.4k|        if (result <= 0) ctx->dirty = 1;
  ------------------
  |  Branch (871:13): [True: 1.48k, False: 10.0k]
  ------------------
  872|  11.4k|        return result;
  873|  11.4k|    }
  874|  11.4k|}
lz4hc.c:LZ4HC_compress_hashChain:
  586|  5.68k|{
  587|  5.68k|    const int inputSize = *srcSizePtr;
  588|  5.68k|    const int patternAnalysis = (maxNbAttempts > 128);   /* levels 9+ */
  589|       |
  590|  5.68k|    const BYTE* ip = (const BYTE*) source;
  591|  5.68k|    const BYTE* anchor = ip;
  592|  5.68k|    const BYTE* const iend = ip + inputSize;
  593|  5.68k|    const BYTE* const mflimit = iend - MFLIMIT;
  ------------------
  |  |  245|  5.68k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  594|  5.68k|    const BYTE* const matchlimit = (iend - LASTLITERALS);
  ------------------
  |  |  244|  5.68k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  595|       |
  596|  5.68k|    BYTE* optr = (BYTE*) dest;
  597|  5.68k|    BYTE* op = (BYTE*) dest;
  598|  5.68k|    BYTE* oend = op + maxOutputSize;
  599|       |
  600|  5.68k|    const BYTE* start0;
  601|  5.68k|    const BYTE* start2 = NULL;
  602|  5.68k|    const BYTE* start3 = NULL;
  603|  5.68k|    LZ4HC_match_t m0, m1, m2, m3;
  604|  5.68k|    const LZ4HC_match_t nomatch = {0, 0};
  605|       |
  606|       |    /* init */
  607|  5.68k|    DEBUGLOG(5, "LZ4HC_compress_hashChain (dict?=>%i)", dict);
  ------------------
  |  |  288|  5.68k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  608|  5.68k|    *srcSizePtr = 0;
  609|  5.68k|    if (limit == fillOutput) oend -= LASTLITERALS;                  /* Hack for support LZ4 format restriction */
  ------------------
  |  |  244|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (609:9): [True: 0, False: 5.68k]
  ------------------
  610|  5.68k|    if (inputSize < LZ4_minLength) goto _last_literals;             /* Input too small, no compression (all literals) */
  ------------------
  |  Branch (610:9): [True: 128, False: 5.55k]
  ------------------
  611|       |
  612|       |    /* Main Loop */
  613|  35.1M|    while (ip <= mflimit) {
  ------------------
  |  Branch (613:12): [True: 35.1M, False: 5.48k]
  ------------------
  614|  35.1M|        m1 = LZ4HC_InsertAndFindBestMatch(ctx, ip, matchlimit, maxNbAttempts, patternAnalysis, dict);
  615|  35.1M|        if (m1.len<MINMATCH) { ip++; continue; }
  ------------------
  |  |  241|  35.1M|#define MINMATCH 4
  ------------------
  |  Branch (615:13): [True: 34.0M, False: 1.03M]
  ------------------
  616|       |
  617|       |        /* saved, in case we would skip too much */
  618|  1.03M|        start0 = ip; m0 = m1;
  619|       |
  620|  1.21M|_Search2:
  621|  1.21M|        DEBUGLOG(7, "_Search2 (currently found match of size %i)", m1.len);
  ------------------
  |  |  288|  1.21M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  622|  1.21M|        if (ip+m1.len <= mflimit) {
  ------------------
  |  Branch (622:13): [True: 1.21M, False: 3.23k]
  ------------------
  623|  1.21M|            m2 = LZ4HC_InsertAndGetWiderMatch(ctx,
  624|  1.21M|                            ip + m1.len - 2, ip + 0, matchlimit, m1.len, &start2,
  625|  1.21M|                            maxNbAttempts, patternAnalysis, 0, dict, favorCompressionRatio);
  626|  1.21M|        } else {
  627|  3.23k|            m2 = nomatch;  /* do not search further */
  628|  3.23k|        }
  629|       |
  630|  1.21M|        if (m2.len <= m1.len) { /* No better match => encode ML1 immediately */
  ------------------
  |  Branch (630:13): [True: 951k, False: 264k]
  ------------------
  631|   951k|            optr = op;
  632|   951k|            if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), m1.len, m1.off, limit, oend)) goto _dest_overflow;
  ------------------
  |  |   87|   951k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (632:17): [True: 43, False: 951k]
  ------------------
  633|   951k|            continue;
  634|   951k|        }
  635|       |
  636|   264k|        if (start0 < ip) {   /* first match was skipped at least once */
  ------------------
  |  Branch (636:13): [True: 33.4k, False: 231k]
  ------------------
  637|  33.4k|            if (start2 < ip + m0.len) {  /* squeezing ML1 between ML0(original ML1) and ML2 */
  ------------------
  |  Branch (637:17): [True: 18.5k, False: 14.9k]
  ------------------
  638|  18.5k|                ip = start0; m1 = m0;  /* restore initial Match1 */
  639|  18.5k|        }   }
  640|       |
  641|       |        /* Here, start0==ip */
  642|   264k|        if ((start2 - ip) < 3) {  /* First Match too small : removed */
  ------------------
  |  Branch (642:13): [True: 146k, False: 118k]
  ------------------
  643|   146k|            ip = start2;
  644|   146k|            m1 = m2;
  645|   146k|            goto _Search2;
  646|   146k|        }
  647|       |
  648|   154k|_Search3:
  649|   154k|        if ((start2 - ip) < OPTIMAL_ML) {
  ------------------
  |  |   76|   154k|#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  260|   154k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|   154k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  241|   154k|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (649:13): [True: 123k, False: 31.2k]
  ------------------
  650|   123k|            int correction;
  651|   123k|            int new_ml = m1.len;
  652|   123k|            if (new_ml > OPTIMAL_ML) new_ml = OPTIMAL_ML;
  ------------------
  |  |   76|   123k|#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  260|   123k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|   123k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  241|   123k|#define MINMATCH 4
  |  |  ------------------
  ------------------
                          if (new_ml > OPTIMAL_ML) new_ml = OPTIMAL_ML;
  ------------------
  |  |   76|  21.4k|#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  260|  21.4k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  21.4k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  241|  21.4k|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (652:17): [True: 21.4k, False: 102k]
  ------------------
  653|   123k|            if (ip+new_ml > start2 + m2.len - MINMATCH)
  ------------------
  |  |  241|   123k|#define MINMATCH 4
  ------------------
  |  Branch (653:17): [True: 161, False: 123k]
  ------------------
  654|    161|                new_ml = (int)(start2 - ip) + m2.len - MINMATCH;
  ------------------
  |  |  241|    161|#define MINMATCH 4
  ------------------
  655|   123k|            correction = new_ml - (int)(start2 - ip);
  656|   123k|            if (correction > 0) {
  ------------------
  |  Branch (656:17): [True: 114k, False: 8.80k]
  ------------------
  657|   114k|                start2 += correction;
  658|   114k|                m2.len -= correction;
  659|   114k|            }
  660|   123k|        }
  661|       |
  662|   154k|        if (start2 + m2.len <= mflimit) {
  ------------------
  |  Branch (662:13): [True: 154k, False: 877]
  ------------------
  663|   154k|            m3 = LZ4HC_InsertAndGetWiderMatch(ctx,
  664|   154k|                            start2 + m2.len - 3, start2, matchlimit, m2.len, &start3,
  665|   154k|                            maxNbAttempts, patternAnalysis, 0, dict, favorCompressionRatio);
  666|   154k|        } else {
  667|    877|            m3 = nomatch;  /* do not search further */
  668|    877|        }
  669|       |
  670|   154k|        if (m3.len <= m2.len) {  /* No better match => encode ML1 and ML2 */
  ------------------
  |  Branch (670:13): [True: 80.6k, False: 74.2k]
  ------------------
  671|       |            /* ip & ref are known; Now for ml */
  672|  80.6k|            if (start2 < ip+m1.len) m1.len = (int)(start2 - ip);
  ------------------
  |  Branch (672:17): [True: 34.0k, False: 46.5k]
  ------------------
  673|       |            /* Now, encode 2 sequences */
  674|  80.6k|            optr = op;
  675|  80.6k|            if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), m1.len, m1.off, limit, oend))
  ------------------
  |  |   87|  80.6k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (675:17): [True: 8, False: 80.6k]
  ------------------
  676|      8|                goto _dest_overflow;
  677|  80.6k|            ip = start2;
  678|  80.6k|            optr = op;
  679|  80.6k|            if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), m2.len, m2.off, limit, oend)) {
  ------------------
  |  |   87|  80.6k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (679:17): [True: 6, False: 80.5k]
  ------------------
  680|      6|                m1 = m2;
  681|      6|                goto _dest_overflow;
  682|      6|            }
  683|  80.5k|            continue;
  684|  80.6k|        }
  685|       |
  686|  74.2k|        if (start3 < ip+m1.len+3) {  /* Not enough space for match 2 : remove it */
  ------------------
  |  Branch (686:13): [True: 42.0k, False: 32.2k]
  ------------------
  687|  42.0k|            if (start3 >= (ip+m1.len)) {  /* can write Seq1 immediately ==> Seq2 is removed, so Seq3 becomes Seq1 */
  ------------------
  |  Branch (687:17): [True: 37.8k, False: 4.21k]
  ------------------
  688|  37.8k|                if (start2 < ip+m1.len) {
  ------------------
  |  Branch (688:21): [True: 3.89k, False: 33.9k]
  ------------------
  689|  3.89k|                    int correction = (int)(ip+m1.len - start2);
  690|  3.89k|                    start2 += correction;
  691|  3.89k|                    m2.len -= correction;
  692|  3.89k|                    if (m2.len < MINMATCH) {
  ------------------
  |  |  241|  3.89k|#define MINMATCH 4
  ------------------
  |  Branch (692:25): [True: 100, False: 3.79k]
  ------------------
  693|    100|                        start2 = start3;
  694|    100|                        m2 = m3;
  695|    100|                    }
  696|  3.89k|                }
  697|       |
  698|  37.8k|                optr = op;
  699|  37.8k|                if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), m1.len, m1.off, limit, oend)) goto _dest_overflow;
  ------------------
  |  |   87|  37.8k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (699:21): [True: 8, False: 37.8k]
  ------------------
  700|  37.8k|                ip  = start3;
  701|  37.8k|                m1 = m3;
  702|       |
  703|  37.8k|                start0 = start2;
  704|  37.8k|                m0 = m2;
  705|  37.8k|                goto _Search2;
  706|  37.8k|            }
  707|       |
  708|  4.21k|            start2 = start3;
  709|  4.21k|            m2 = m3;
  710|  4.21k|            goto _Search3;
  711|  42.0k|        }
  712|       |
  713|       |        /*
  714|       |        * OK, now we have 3 ascending matches;
  715|       |        * let's write the first one ML1.
  716|       |        * ip & ref are known; Now decide ml.
  717|       |        */
  718|  32.2k|        if (start2 < ip+m1.len) {
  ------------------
  |  Branch (718:13): [True: 10.5k, False: 21.6k]
  ------------------
  719|  10.5k|            if ((start2 - ip) < OPTIMAL_ML) {
  ------------------
  |  |   76|  10.5k|#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  260|  10.5k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  10.5k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  241|  10.5k|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (719:17): [True: 0, False: 10.5k]
  ------------------
  720|      0|                int correction;
  721|      0|                if (m1.len > OPTIMAL_ML) m1.len = OPTIMAL_ML;
  ------------------
  |  |   76|      0|#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  260|      0|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|      0|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  241|      0|#define MINMATCH 4
  |  |  ------------------
  ------------------
                              if (m1.len > OPTIMAL_ML) m1.len = OPTIMAL_ML;
  ------------------
  |  |   76|      0|#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  260|      0|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|      0|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
  |  |  ------------------
  |  |  |  |  241|      0|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (721:21): [True: 0, False: 0]
  ------------------
  722|      0|                if (ip + m1.len > start2 + m2.len - MINMATCH)
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
  |  Branch (722:21): [True: 0, False: 0]
  ------------------
  723|      0|                    m1.len = (int)(start2 - ip) + m2.len - MINMATCH;
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
  724|      0|                correction = m1.len - (int)(start2 - ip);
  725|      0|                if (correction > 0) {
  ------------------
  |  Branch (725:21): [True: 0, False: 0]
  ------------------
  726|      0|                    start2 += correction;
  727|      0|                    m2.len -= correction;
  728|      0|                }
  729|  10.5k|            } else {
  730|  10.5k|                m1.len = (int)(start2 - ip);
  731|  10.5k|            }
  732|  10.5k|        }
  733|  32.2k|        optr = op;
  734|  32.2k|        if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), m1.len, m1.off, limit, oend)) goto _dest_overflow;
  ------------------
  |  |   87|  32.2k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (734:13): [True: 2, False: 32.2k]
  ------------------
  735|       |
  736|       |        /* ML2 becomes ML1 */
  737|  32.2k|        ip = start2; m1 = m2;
  738|       |
  739|       |        /* ML3 becomes ML2 */
  740|  32.2k|        start2 = start3; m2 = m3;
  741|       |
  742|       |        /* let's find a new ML3 */
  743|  32.2k|        goto _Search3;
  744|  32.2k|    }
  745|       |
  746|  5.61k|_last_literals:
  747|       |    /* Encode Last Literals */
  748|  5.61k|    {   size_t lastRunSize = (size_t)(iend - anchor);  /* literals */
  749|  5.61k|        size_t llAdd = (lastRunSize + 255 - RUN_MASK) / 255;
  ------------------
  |  |  262|  5.61k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  5.61k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  5.61k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  750|  5.61k|        size_t const totalSize = 1 + llAdd + lastRunSize;
  751|  5.61k|        if (limit == fillOutput) oend += LASTLITERALS;  /* restore correct value */
  ------------------
  |  |  244|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (751:13): [True: 0, False: 5.61k]
  ------------------
  752|  5.61k|        if (limit && (op + totalSize > oend)) {
  ------------------
  |  Branch (752:13): [True: 5.61k, False: 0]
  |  Branch (752:22): [True: 558, False: 5.05k]
  ------------------
  753|    558|            if (limit == limitedOutput) return 0;
  ------------------
  |  Branch (753:17): [True: 558, False: 0]
  ------------------
  754|       |            /* adapt lastRunSize to fill 'dest' */
  755|      0|            lastRunSize  = (size_t)(oend - op) - 1 /*token*/;
  756|      0|            llAdd = (lastRunSize + 256 - RUN_MASK) / 256;
  ------------------
  |  |  262|      0|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|      0|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|      0|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  757|      0|            lastRunSize -= llAdd;
  758|      0|        }
  759|  5.05k|        DEBUGLOG(6, "Final literal run : %i literals", (int)lastRunSize);
  ------------------
  |  |  288|  5.05k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  760|  5.05k|        ip = anchor + lastRunSize;  /* can be != iend if limit==fillOutput */
  761|       |
  762|  5.05k|        if (lastRunSize >= RUN_MASK) {
  ------------------
  |  |  262|  5.05k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  5.05k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  5.05k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (762:13): [True: 374, False: 4.68k]
  ------------------
  763|    374|            size_t accumulator = lastRunSize - RUN_MASK;
  ------------------
  |  |  262|    374|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|    374|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|    374|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  764|    374|            *op++ = (RUN_MASK << ML_BITS);
  ------------------
  |  |  262|    374|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|    374|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|    374|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          *op++ = (RUN_MASK << ML_BITS);
  ------------------
  |  |  259|    374|#define ML_BITS  4
  ------------------
  765|  3.74k|            for(; accumulator >= 255 ; accumulator -= 255) *op++ = 255;
  ------------------
  |  Branch (765:19): [True: 3.37k, False: 374]
  ------------------
  766|    374|            *op++ = (BYTE) accumulator;
  767|  4.68k|        } else {
  768|  4.68k|            *op++ = (BYTE)(lastRunSize << ML_BITS);
  ------------------
  |  |  259|  4.68k|#define ML_BITS  4
  ------------------
  769|  4.68k|        }
  770|  5.05k|        LZ4_memcpy(op, anchor, lastRunSize);
  ------------------
  |  |  348|  5.05k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  771|  5.05k|        op += lastRunSize;
  772|  5.05k|    }
  773|       |
  774|       |    /* End */
  775|      0|    *srcSizePtr = (int) (((const char*)ip) - source);
  776|  5.05k|    return (int) (((char*)op)-dest);
  777|       |
  778|     67|_dest_overflow:
  779|     67|    if (limit == fillOutput) {
  ------------------
  |  Branch (779:9): [True: 0, False: 67]
  ------------------
  780|       |        /* Assumption : ip, anchor, ml and ref must be set correctly */
  781|      0|        size_t const ll = (size_t)(ip - anchor);
  782|      0|        size_t const ll_addbytes = (ll + 240) / 255;
  783|      0|        size_t const ll_totalCost = 1 + ll_addbytes + ll;
  784|      0|        BYTE* const maxLitPos = oend - 3; /* 2 for offset, 1 for token */
  785|      0|        DEBUGLOG(6, "Last sequence overflowing");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  786|      0|        op = optr;  /* restore correct out pointer */
  787|      0|        if (op + ll_totalCost <= maxLitPos) {
  ------------------
  |  Branch (787:13): [True: 0, False: 0]
  ------------------
  788|       |            /* ll validated; now adjust match length */
  789|      0|            size_t const bytesLeftForMl = (size_t)(maxLitPos - (op+ll_totalCost));
  790|      0|            size_t const maxMlSize = MINMATCH + (ML_MASK-1) + (bytesLeftForMl * 255);
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
                          size_t const maxMlSize = MINMATCH + (ML_MASK-1) + (bytesLeftForMl * 255);
  ------------------
  |  |  260|      0|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|      0|#define ML_BITS  4
  |  |  ------------------
  ------------------
  791|      0|            assert(maxMlSize < INT_MAX); assert(m1.len >= 0);
  792|      0|            if ((size_t)m1.len > maxMlSize) m1.len = (int)maxMlSize;
  ------------------
  |  Branch (792:17): [True: 0, False: 0]
  ------------------
  793|      0|            if ((oend + LASTLITERALS) - (op + ll_totalCost + 2) - 1 + m1.len >= MFLIMIT) {
  ------------------
  |  |  244|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          if ((oend + LASTLITERALS) - (op + ll_totalCost + 2) - 1 + m1.len >= MFLIMIT) {
  ------------------
  |  |  245|      0|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (793:17): [True: 0, False: 0]
  ------------------
  794|      0|                LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), m1.len, m1.off, notLimited, oend);
  ------------------
  |  |   87|      0|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  795|      0|        }   }
  796|      0|        goto _last_literals;
  797|      0|    }
  798|       |    /* compression failed */
  799|     67|    return 0;
  800|     67|}
lz4hc.c:LZ4HC_InsertAndFindBestMatch:
  477|  35.1M|{
  478|  35.1M|    const BYTE* uselessPtr = ip;
  479|  35.1M|    DEBUGLOG(7, "LZ4HC_InsertAndFindBestMatch");
  ------------------
  |  |  288|  35.1M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  480|       |    /* note : LZ4HC_InsertAndGetWiderMatch() is able to modify the starting position of a match (*startpos),
  481|       |     * but this won't be the case here, as we define iLowLimit==ip,
  482|       |     * so LZ4HC_InsertAndGetWiderMatch() won't be allowed to search past ip */
  483|  35.1M|    return LZ4HC_InsertAndGetWiderMatch(hc4, ip, ip, iLimit, MINMATCH-1, &uselessPtr, maxNbAttempts, patternAnalysis, 0 /*chainSwap*/, dict, favorCompressionRatio);
  ------------------
  |  |  241|  35.1M|#define MINMATCH 4
  ------------------
  484|  35.1M|}
lz4hc.c:LZ4HC_InsertAndGetWiderMatch:
  258|  82.4M|{
  259|  82.4M|    U16* const chainTable = hc4->chainTable;
  260|  82.4M|    U32* const hashTable = hc4->hashTable;
  261|  82.4M|    const LZ4HC_CCtx_internal * const dictCtx = hc4->dictCtx;
  262|  82.4M|    const BYTE* const prefixPtr = hc4->prefixStart;
  263|  82.4M|    const U32 prefixIdx = hc4->dictLimit;
  264|  82.4M|    const U32 ipIndex = (U32)(ip - prefixPtr) + prefixIdx;
  265|  82.4M|    const int withinStartDistance = (hc4->lowLimit + (LZ4_DISTANCE_MAX + 1) > ipIndex);
  ------------------
  |  |  653|  82.4M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  266|  82.4M|    const U32 lowestMatchIndex = (withinStartDistance) ? hc4->lowLimit : ipIndex - LZ4_DISTANCE_MAX;
  ------------------
  |  |  653|  24.9M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (266:34): [True: 57.4M, False: 24.9M]
  ------------------
  267|  82.4M|    const BYTE* const dictStart = hc4->dictStart;
  268|  82.4M|    const U32 dictIdx = hc4->lowLimit;
  269|  82.4M|    const BYTE* const dictEnd = dictStart + prefixIdx - dictIdx;
  270|  82.4M|    int const lookBackLength = (int)(ip-iLowLimit);
  271|  82.4M|    int nbAttempts = maxNbAttempts;
  272|  82.4M|    U32 matchChainPos = 0;
  273|  82.4M|    U32 const pattern = LZ4_read32(ip);
  274|  82.4M|    U32 matchIndex;
  275|  82.4M|    repeat_state_e repeat = rep_untested;
  276|  82.4M|    size_t srcPatternLength = 0;
  277|  82.4M|    int offset = 0;
  278|       |
  279|  82.4M|    DEBUGLOG(7, "LZ4HC_InsertAndGetWiderMatch");
  ------------------
  |  |  288|  82.4M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  280|  82.4M|    assert(startpos != NULL);
  281|  82.4M|    *startpos = ip;  /* in case there is no solution */
  282|       |    /* First Match */
  283|  82.4M|    LZ4HC_Insert(hc4, ip);  /* insert all prior positions up to ip (excluded) */
  284|  82.4M|    matchIndex = hashTable[LZ4HC_hashPtr(ip)];
  285|  82.4M|    DEBUGLOG(7, "First candidate match for pos %u found at index %u / %u (lowestMatchIndex)",
  ------------------
  |  |  288|  82.4M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  286|  82.4M|                ipIndex, matchIndex, lowestMatchIndex);
  287|       |
  288|   480M|    while ((matchIndex>=lowestMatchIndex) && (nbAttempts>0)) {
  ------------------
  |  Branch (288:12): [True: 398M, False: 81.9M]
  |  Branch (288:46): [True: 397M, False: 468k]
  ------------------
  289|   397M|        int matchLength=0;
  290|   397M|        nbAttempts--;
  291|   397M|        assert(matchIndex < ipIndex);
  292|   397M|        if (favorDecSpeed && (ipIndex - matchIndex < 8)) {
  ------------------
  |  Branch (292:13): [True: 84.2M, False: 313M]
  |  Branch (292:30): [True: 235k, False: 83.9M]
  ------------------
  293|       |            /* do nothing:
  294|       |             * favorDecSpeed intentionally skips matches with offset < 8 */
  295|   397M|        } else if (matchIndex >= prefixIdx) {   /* within current Prefix */
  ------------------
  |  Branch (295:20): [True: 397M, False: 0]
  ------------------
  296|   397M|            const BYTE* const matchPtr = prefixPtr + (matchIndex - prefixIdx);
  297|   397M|            assert(matchPtr < ip);
  298|   397M|            assert(longest >= 1);
  299|   397M|            if (LZ4_read16(iLowLimit + longest - 1) == LZ4_read16(matchPtr - lookBackLength + longest - 1)) {
  ------------------
  |  Branch (299:17): [True: 40.8M, False: 356M]
  ------------------
  300|  40.8M|                if (LZ4_read32(matchPtr) == pattern) {
  ------------------
  |  Branch (300:21): [True: 33.9M, False: 6.91M]
  ------------------
  301|  33.9M|                    int const back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, prefixPtr) : 0;
  ------------------
  |  Branch (301:38): [True: 17.7M, False: 16.2M]
  ------------------
  302|  33.9M|                    matchLength = MINMATCH + (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
  ------------------
  |  |  241|  33.9M|#define MINMATCH 4
  ------------------
                                  matchLength = MINMATCH + (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
  ------------------
  |  |  241|  33.9M|#define MINMATCH 4
  ------------------
                                  matchLength = MINMATCH + (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
  ------------------
  |  |  241|  33.9M|#define MINMATCH 4
  ------------------
  303|  33.9M|                    matchLength -= back;
  304|  33.9M|                    if (matchLength > longest) {
  ------------------
  |  Branch (304:25): [True: 6.17M, False: 27.7M]
  ------------------
  305|  6.17M|                        longest = matchLength;
  306|  6.17M|                        offset = (int)(ipIndex - matchIndex);
  307|  6.17M|                        *startpos = ip + back;
  308|  6.17M|                        DEBUGLOG(7, "Found match of len=%i within prefix, offset=%i, back=%i", longest, offset, -back);
  ------------------
  |  |  288|  6.17M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  309|  6.17M|            }   }   }
  310|   397M|        } else {   /* lowestMatchIndex <= matchIndex < dictLimit : within Ext Dict */
  311|      0|            const BYTE* const matchPtr = dictStart + (matchIndex - dictIdx);
  312|      0|            assert(matchIndex >= dictIdx);
  313|      0|            if ( likely(matchIndex <= prefixIdx - 4)
  ------------------
  |  |  176|      0|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  170|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  314|      0|              && (LZ4_read32(matchPtr) == pattern) ) {
  ------------------
  |  Branch (314:18): [True: 0, False: 0]
  ------------------
  315|      0|                int back = 0;
  316|      0|                const BYTE* vLimit = ip + (prefixIdx - matchIndex);
  317|      0|                if (vLimit > iHighLimit) vLimit = iHighLimit;
  ------------------
  |  Branch (317:21): [True: 0, False: 0]
  ------------------
  318|      0|                matchLength = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
                              matchLength = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
                              matchLength = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
  319|      0|                if ((ip+matchLength == vLimit) && (vLimit < iHighLimit))
  ------------------
  |  Branch (319:21): [True: 0, False: 0]
  |  Branch (319:51): [True: 0, False: 0]
  ------------------
  320|      0|                    matchLength += LZ4_count(ip+matchLength, prefixPtr, iHighLimit);
  321|      0|                back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, dictStart) : 0;
  ------------------
  |  Branch (321:24): [True: 0, False: 0]
  ------------------
  322|      0|                matchLength -= back;
  323|      0|                if (matchLength > longest) {
  ------------------
  |  Branch (323:21): [True: 0, False: 0]
  ------------------
  324|      0|                    longest = matchLength;
  325|      0|                    offset = (int)(ipIndex - matchIndex);
  326|      0|                    *startpos = ip + back;
  327|      0|                    DEBUGLOG(7, "Found match of len=%i within dict, offset=%i, back=%i", longest, offset, -back);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  328|      0|        }   }   }
  329|       |
  330|   397M|        if (chainSwap && matchLength==longest) {   /* better match => select a better chain */
  ------------------
  |  Branch (330:13): [True: 312M, False: 84.7M]
  |  Branch (330:26): [True: 4.25M, False: 308M]
  ------------------
  331|  4.25M|            assert(lookBackLength==0);   /* search forward only */
  332|  4.25M|            if (matchIndex + (U32)longest <= ipIndex) {
  ------------------
  |  Branch (332:17): [True: 3.93M, False: 319k]
  ------------------
  333|  3.93M|                int const kTrigger = 4;
  334|  3.93M|                U32 distanceToNextMatch = 1;
  335|  3.93M|                int const end = longest - MINMATCH + 1;
  ------------------
  |  |  241|  3.93M|#define MINMATCH 4
  ------------------
  336|  3.93M|                int step = 1;
  337|  3.93M|                int accel = 1 << kTrigger;
  338|  3.93M|                int pos;
  339|   191M|                for (pos = 0; pos < end; pos += step) {
  ------------------
  |  Branch (339:31): [True: 187M, False: 3.93M]
  ------------------
  340|   187M|                    U32 const candidateDist = DELTANEXTU16(chainTable, matchIndex + (U32)pos);
  ------------------
  |  |   85|   187M|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
  341|   187M|                    step = (accel++ >> kTrigger);
  342|   187M|                    if (candidateDist > distanceToNextMatch) {
  ------------------
  |  Branch (342:25): [True: 5.01M, False: 182M]
  ------------------
  343|  5.01M|                        distanceToNextMatch = candidateDist;
  344|  5.01M|                        matchChainPos = (U32)pos;
  345|  5.01M|                        accel = 1 << kTrigger;
  346|  5.01M|                }   }
  347|  3.93M|                if (distanceToNextMatch > 1) {
  ------------------
  |  Branch (347:21): [True: 3.72M, False: 207k]
  ------------------
  348|  3.72M|                    if (distanceToNextMatch > matchIndex) break;   /* avoid overflow */
  ------------------
  |  Branch (348:25): [True: 0, False: 3.72M]
  ------------------
  349|  3.72M|                    matchIndex -= distanceToNextMatch;
  350|  3.72M|                    continue;
  351|  3.72M|        }   }   }
  352|       |
  353|   393M|        {   U32 const distNextMatch = DELTANEXTU16(chainTable, matchIndex);
  ------------------
  |  |   85|   393M|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
  354|   393M|            if (patternAnalysis && distNextMatch==1 && matchChainPos==0) {
  ------------------
  |  Branch (354:17): [True: 360M, False: 33.3M]
  |  Branch (354:36): [True: 104M, False: 256M]
  |  Branch (354:56): [True: 77.0M, False: 27.1M]
  ------------------
  355|  77.0M|                U32 const matchCandidateIdx = matchIndex-1;
  356|       |                /* may be a repeated pattern */
  357|  77.0M|                if (repeat == rep_untested) {
  ------------------
  |  Branch (357:21): [True: 728k, False: 76.3M]
  ------------------
  358|   728k|                    if ( ((pattern & 0xFFFF) == (pattern >> 16))
  ------------------
  |  Branch (358:26): [True: 707k, False: 20.7k]
  ------------------
  359|   728k|                      &  ((pattern & 0xFF)   == (pattern >> 24)) ) {
  360|   707k|                        DEBUGLOG(7, "Repeat pattern detected, char %02X", pattern >> 24);
  ------------------
  |  |  288|   707k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  361|   707k|                        repeat = rep_confirmed;
  362|   707k|                        srcPatternLength = LZ4HC_countPattern(ip+sizeof(pattern), iHighLimit, pattern) + sizeof(pattern);
  363|   707k|                    } else {
  364|  20.7k|                        repeat = rep_not;
  365|  20.7k|                }   }
  366|  77.0M|                if ( (repeat == rep_confirmed) && (matchCandidateIdx >= lowestMatchIndex)
  ------------------
  |  Branch (366:22): [True: 69.4M, False: 7.60M]
  |  Branch (366:51): [True: 69.4M, False: 2.17k]
  ------------------
  367|  77.0M|                  && LZ4HC_protectDictEnd(prefixIdx, matchCandidateIdx) ) {
  ------------------
  |  Branch (367:22): [True: 69.4M, False: 0]
  ------------------
  368|  69.4M|                    const int extDict = matchCandidateIdx < prefixIdx;
  369|  69.4M|                    const BYTE* const matchPtr = extDict ? dictStart + (matchCandidateIdx - dictIdx) : prefixPtr + (matchCandidateIdx - prefixIdx);
  ------------------
  |  Branch (369:50): [True: 0, False: 69.4M]
  ------------------
  370|  69.4M|                    if (LZ4_read32(matchPtr) == pattern) {  /* good candidate */
  ------------------
  |  Branch (370:25): [True: 68.6M, False: 824k]
  ------------------
  371|  68.6M|                        const BYTE* const iLimit = extDict ? dictEnd : iHighLimit;
  ------------------
  |  Branch (371:52): [True: 0, False: 68.6M]
  ------------------
  372|  68.6M|                        size_t forwardPatternLength = LZ4HC_countPattern(matchPtr+sizeof(pattern), iLimit, pattern) + sizeof(pattern);
  373|  68.6M|                        if (extDict && matchPtr + forwardPatternLength == iLimit) {
  ------------------
  |  Branch (373:29): [True: 0, False: 68.6M]
  |  Branch (373:40): [True: 0, False: 0]
  ------------------
  374|      0|                            U32 const rotatedPattern = LZ4HC_rotatePattern(forwardPatternLength, pattern);
  375|      0|                            forwardPatternLength += LZ4HC_countPattern(prefixPtr, iHighLimit, rotatedPattern);
  376|      0|                        }
  377|  68.6M|                        {   const BYTE* const lowestMatchPtr = extDict ? dictStart : prefixPtr;
  ------------------
  |  Branch (377:64): [True: 0, False: 68.6M]
  ------------------
  378|  68.6M|                            size_t backLength = LZ4HC_reverseCountPattern(matchPtr, lowestMatchPtr, pattern);
  379|  68.6M|                            size_t currentSegmentLength;
  380|  68.6M|                            if (!extDict
  ------------------
  |  Branch (380:33): [True: 68.6M, False: 0]
  ------------------
  381|  68.6M|                              && matchPtr - backLength == prefixPtr
  ------------------
  |  Branch (381:34): [True: 107k, False: 68.5M]
  ------------------
  382|  68.6M|                              && dictIdx < prefixIdx) {
  ------------------
  |  Branch (382:34): [True: 0, False: 107k]
  ------------------
  383|      0|                                U32 const rotatedPattern = LZ4HC_rotatePattern((U32)(-(int)backLength), pattern);
  384|      0|                                backLength += LZ4HC_reverseCountPattern(dictEnd, dictStart, rotatedPattern);
  385|      0|                            }
  386|       |                            /* Limit backLength not go further than lowestMatchIndex */
  387|  68.6M|                            backLength = matchCandidateIdx - MAX(matchCandidateIdx - (U32)backLength, lowestMatchIndex);
  ------------------
  |  |   82|  68.6M|#define MAX(a,b)   ( (a) > (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (82:22): [True: 68.4M, False: 129k]
  |  |  ------------------
  ------------------
  388|  68.6M|                            assert(matchCandidateIdx - backLength >= lowestMatchIndex);
  389|  68.6M|                            currentSegmentLength = backLength + forwardPatternLength;
  390|       |                            /* Adjust to end of pattern if the source pattern fits, otherwise the beginning of the pattern */
  391|  68.6M|                            if ( (currentSegmentLength >= srcPatternLength)   /* current pattern segment large enough to contain full srcPatternLength */
  ------------------
  |  Branch (391:34): [True: 41.4M, False: 27.1M]
  ------------------
  392|  68.6M|                              && (forwardPatternLength <= srcPatternLength) ) { /* haven't reached this position yet */
  ------------------
  |  Branch (392:34): [True: 18.5M, False: 22.9M]
  ------------------
  393|  18.5M|                                U32 const newMatchIndex = matchCandidateIdx + (U32)forwardPatternLength - (U32)srcPatternLength;  /* best position, full pattern, might be followed by more match */
  394|  18.5M|                                if (LZ4HC_protectDictEnd(prefixIdx, newMatchIndex))
  ------------------
  |  Branch (394:37): [True: 18.5M, False: 0]
  ------------------
  395|  18.5M|                                    matchIndex = newMatchIndex;
  396|      0|                                else {
  397|       |                                    /* Can only happen if started in the prefix */
  398|      0|                                    assert(newMatchIndex >= prefixIdx - 3 && newMatchIndex < prefixIdx && !extDict);
  399|      0|                                    matchIndex = prefixIdx;
  400|      0|                                }
  401|  50.1M|                            } else {
  402|  50.1M|                                U32 const newMatchIndex = matchCandidateIdx - (U32)backLength;   /* farthest position in current segment, will find a match of length currentSegmentLength + maybe some back */
  403|  50.1M|                                if (!LZ4HC_protectDictEnd(prefixIdx, newMatchIndex)) {
  ------------------
  |  Branch (403:37): [True: 0, False: 50.1M]
  ------------------
  404|      0|                                    assert(newMatchIndex >= prefixIdx - 3 && newMatchIndex < prefixIdx && !extDict);
  405|      0|                                    matchIndex = prefixIdx;
  406|  50.1M|                                } else {
  407|  50.1M|                                    matchIndex = newMatchIndex;
  408|  50.1M|                                    if (lookBackLength==0) {  /* no back possible */
  ------------------
  |  Branch (408:41): [True: 46.6M, False: 3.47M]
  ------------------
  409|  46.6M|                                        size_t const maxML = MIN(currentSegmentLength, srcPatternLength);
  ------------------
  |  |   81|  46.6M|#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (81:22): [True: 25.5M, False: 21.0M]
  |  |  ------------------
  ------------------
  410|  46.6M|                                        if ((size_t)longest < maxML) {
  ------------------
  |  Branch (410:45): [True: 240k, False: 46.3M]
  ------------------
  411|   240k|                                            assert(prefixPtr - prefixIdx + matchIndex != ip);
  412|   240k|                                            if ((size_t)(ip - prefixPtr) + prefixIdx - matchIndex > LZ4_DISTANCE_MAX) break;
  ------------------
  |  |  653|   240k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (412:49): [True: 0, False: 240k]
  ------------------
  413|   240k|                                            assert(maxML < 2 GB);
  414|   240k|                                            longest = (int)maxML;
  415|   240k|                                            offset = (int)(ipIndex - matchIndex);
  416|   240k|                                            *startpos = ip;
  417|   240k|                                            DEBUGLOG(7, "Found repeat pattern match of len=%i, offset=%i", longest, offset);
  ------------------
  |  |  288|   240k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  418|   240k|                                        }
  419|  46.6M|                                        {   U32 const distToNextPattern = DELTANEXTU16(chainTable, matchIndex);
  ------------------
  |  |   85|  46.6M|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
  420|  46.6M|                                            if (distToNextPattern > matchIndex) break;  /* avoid overflow */
  ------------------
  |  Branch (420:49): [True: 0, False: 46.6M]
  ------------------
  421|  46.6M|                                            matchIndex -= distToNextPattern;
  422|  46.6M|                        }   }   }   }   }
  423|  68.6M|                        continue;
  424|  68.6M|                }   }
  425|  77.0M|        }   }   /* PA optimization */
  426|       |
  427|       |        /* follow current chain */
  428|   325M|        matchIndex -= DELTANEXTU16(chainTable, matchIndex + matchChainPos);
  ------------------
  |  |   85|   325M|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
  429|       |
  430|   325M|    }  /* while ((matchIndex>=lowestMatchIndex) && (nbAttempts)) */
  431|       |
  432|  82.4M|    if ( dict == usingDictCtxHc
  ------------------
  |  Branch (432:10): [True: 0, False: 82.4M]
  ------------------
  433|  82.4M|      && nbAttempts > 0
  ------------------
  |  Branch (433:10): [True: 0, False: 0]
  ------------------
  434|  82.4M|      && ipIndex - lowestMatchIndex < LZ4_DISTANCE_MAX) {
  ------------------
  |  |  653|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (434:10): [True: 0, False: 0]
  ------------------
  435|      0|        size_t const dictEndOffset = (size_t)(dictCtx->end - dictCtx->prefixStart) + dictCtx->dictLimit;
  436|      0|        U32 dictMatchIndex = dictCtx->hashTable[LZ4HC_hashPtr(ip)];
  437|      0|        assert(dictEndOffset <= 1 GB);
  438|      0|        matchIndex = dictMatchIndex + lowestMatchIndex - (U32)dictEndOffset;
  439|      0|        if (dictMatchIndex>0) DEBUGLOG(7, "dictEndOffset = %zu, dictMatchIndex = %u => relative matchIndex = %i", dictEndOffset, dictMatchIndex, (int)dictMatchIndex - (int)dictEndOffset);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  |  Branch (439:13): [True: 0, False: 0]
  ------------------
  440|      0|        while (ipIndex - matchIndex <= LZ4_DISTANCE_MAX && nbAttempts--) {
  ------------------
  |  |  653|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (440:16): [True: 0, False: 0]
  |  Branch (440:60): [True: 0, False: 0]
  ------------------
  441|      0|            const BYTE* const matchPtr = dictCtx->prefixStart - dictCtx->dictLimit + dictMatchIndex;
  442|       |
  443|      0|            if (LZ4_read32(matchPtr) == pattern) {
  ------------------
  |  Branch (443:17): [True: 0, False: 0]
  ------------------
  444|      0|                int mlt;
  445|      0|                int back = 0;
  446|      0|                const BYTE* vLimit = ip + (dictEndOffset - dictMatchIndex);
  447|      0|                if (vLimit > iHighLimit) vLimit = iHighLimit;
  ------------------
  |  Branch (447:21): [True: 0, False: 0]
  ------------------
  448|      0|                mlt = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
                              mlt = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
                              mlt = (int)LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, vLimit) + MINMATCH;
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
  449|      0|                back = lookBackLength ? LZ4HC_countBack(ip, matchPtr, iLowLimit, dictCtx->prefixStart) : 0;
  ------------------
  |  Branch (449:24): [True: 0, False: 0]
  ------------------
  450|      0|                mlt -= back;
  451|      0|                if (mlt > longest) {
  ------------------
  |  Branch (451:21): [True: 0, False: 0]
  ------------------
  452|      0|                    longest = mlt;
  453|      0|                    offset = (int)(ipIndex - matchIndex);
  454|      0|                    *startpos = ip + back;
  455|      0|                    DEBUGLOG(7, "found match of length %i within extDictCtx", longest);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  456|      0|            }   }
  457|       |
  458|      0|            {   U32 const nextOffset = DELTANEXTU16(dictCtx->chainTable, dictMatchIndex);
  ------------------
  |  |   85|      0|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
  459|      0|                dictMatchIndex -= nextOffset;
  460|      0|                matchIndex -= nextOffset;
  461|      0|    }   }   }
  462|       |
  463|  82.4M|    {   LZ4HC_match_t md;
  464|  82.4M|        assert(longest >= 0);
  465|  82.4M|        md.len = longest;
  466|  82.4M|        md.off = offset;
  467|  82.4M|        return md;
  468|  82.4M|    }
  469|  82.4M|}
lz4hc.c:LZ4HC_hashPtr:
   90|   377M|static U32 LZ4HC_hashPtr(const void* ptr) { return HASH_FUNCTION(LZ4_read32(ptr)); }
  ------------------
  |  |   83|   377M|#define HASH_FUNCTION(i)         (((i) * 2654435761U) >> ((MINMATCH*8)-LZ4HC_HASH_LOG))
  |  |  ------------------
  |  |  |  |  241|   377M|#define MINMATCH 4
  |  |  ------------------
  |  |               #define HASH_FUNCTION(i)         (((i) * 2654435761U) >> ((MINMATCH*8)-LZ4HC_HASH_LOG))
  |  |  ------------------
  |  |  |  |  196|   377M|#define LZ4HC_HASH_LOG 15
  |  |  ------------------
  ------------------
lz4hc.c:LZ4HC_countBack:
  151|  17.7M|{
  152|  17.7M|    int back = 0;
  153|  17.7M|    int const min = (int)MAX(iMin - ip, mMin - match);
  ------------------
  |  |   82|  17.7M|#define MAX(a,b)   ( (a) > (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (82:22): [True: 17.6M, False: 87.2k]
  |  |  ------------------
  ------------------
  154|  17.7M|    assert(min <= 0);
  155|  17.7M|    assert(ip >= iMin); assert((size_t)(ip-iMin) < (1U<<31));
  156|  17.7M|    assert(match >= mMin); assert((size_t)(match - mMin) < (1U<<31));
  157|   299M|    while ( (back > min)
  ------------------
  |  Branch (157:13): [True: 299M, False: 88.5k]
  ------------------
  158|   299M|         && (ip[back-1] == match[back-1]) )
  ------------------
  |  Branch (158:13): [True: 281M, False: 17.6M]
  ------------------
  159|   281M|            back--;
  160|  17.7M|    return back;
  161|  17.7M|}
lz4hc.c:LZ4HC_countPattern:
  181|  69.3M|{
  182|  69.3M|    const BYTE* const iStart = ip;
  183|  69.3M|    reg_t const pattern = (sizeof(pattern)==8) ?
  ------------------
  |  Branch (183:27): [Folded - Ignored]
  ------------------
  184|  69.3M|        (reg_t)pattern32 + (((reg_t)pattern32) << (sizeof(pattern)*4)) : pattern32;
  185|       |
  186|   147M|    while (likely(ip < iEnd-(sizeof(pattern)-1))) {
  187|   147M|        reg_t const diff = LZ4_read_ARCH(ip) ^ pattern;
  188|   147M|        if (!diff) { ip+=sizeof(pattern); continue; }
  ------------------
  |  Branch (188:13): [True: 78.2M, False: 69.3M]
  ------------------
  189|  69.3M|        ip += LZ4_NbCommonBytes(diff);
  190|  69.3M|        return (unsigned)(ip - iStart);
  191|   147M|    }
  192|       |
  193|  16.9k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (193:9): [True: 16.9k, False: 0]
  ------------------
  194|  16.9k|        reg_t patternByte = pattern;
  195|  69.6k|        while ((ip<iEnd) && (*ip == (BYTE)patternByte)) {
  ------------------
  |  Branch (195:16): [True: 57.8k, False: 11.7k]
  |  Branch (195:29): [True: 52.6k, False: 5.12k]
  ------------------
  196|  52.6k|            ip++; patternByte >>= 8;
  197|  52.6k|        }
  198|  16.9k|    } else {  /* big endian */
  199|      0|        U32 bitOffset = (sizeof(pattern)*8) - 8;
  200|      0|        while (ip < iEnd) {
  ------------------
  |  Branch (200:16): [True: 0, False: 0]
  ------------------
  201|      0|            BYTE const byte = (BYTE)(pattern >> bitOffset);
  202|      0|            if (*ip != byte) break;
  ------------------
  |  Branch (202:17): [True: 0, False: 0]
  ------------------
  203|      0|            ip ++; bitOffset -= 8;
  204|      0|    }   }
  205|       |
  206|  16.9k|    return (unsigned)(ip - iStart);
  207|  69.3M|}
lz4hc.c:LZ4HC_protectDictEnd:
  235|   138M|{
  236|   138M|    return ((U32)((dictLimit - 1) - matchIndex) >= 3);
  237|   138M|}
lz4hc.c:LZ4HC_reverseCountPattern:
  214|  68.6M|{
  215|  68.6M|    const BYTE* const iStart = ip;
  216|       |
  217|  1.43G|    while (likely(ip >= iLow+4)) {
  218|  1.43G|        if (LZ4_read32(ip-4) != pattern) break;
  ------------------
  |  Branch (218:13): [True: 68.5M, False: 1.36G]
  ------------------
  219|  1.36G|        ip -= 4;
  220|  1.36G|    }
  221|  68.6M|    {   const BYTE* bytePtr = (const BYTE*)(&pattern) + 3; /* works for any endianness */
  222|   153M|        while (likely(ip>iLow)) {
  223|   153M|            if (ip[-1] != *bytePtr) break;
  ------------------
  |  Branch (223:17): [True: 68.5M, False: 84.5M]
  ------------------
  224|  84.5M|            ip--; bytePtr--;
  225|  84.5M|    }   }
  226|  68.6M|    return (unsigned)(iStart - ip);
  227|  68.6M|}
lz4hc.c:LZ4HC_encodeSequence:
  497|  2.42M|{
  498|  2.42M|#define ip      (*_ip)
  499|  2.42M|#define op      (*_op)
  500|  2.42M|#define anchor  (*_anchor)
  501|       |
  502|  2.42M|    size_t length;
  503|  2.42M|    BYTE* const token = op++;
  ------------------
  |  |  499|  2.42M|#define op      (*_op)
  ------------------
  504|       |
  505|       |#if defined(LZ4_DEBUG) && (LZ4_DEBUG >= 6)
  506|       |    static const BYTE* start = NULL;
  507|       |    static U32 totalCost = 0;
  508|       |    U32 const pos = (start==NULL) ? 0 : (U32)(anchor - start);
  509|       |    U32 const ll = (U32)(ip - anchor);
  510|       |    U32 const llAdd = (ll>=15) ? ((ll-15) / 255) + 1 : 0;
  511|       |    U32 const mlAdd = (matchLength>=19) ? ((matchLength-19) / 255) + 1 : 0;
  512|       |    U32 const cost = 1 + llAdd + ll + 2 + mlAdd;
  513|       |    if (start==NULL) start = anchor;  /* only works for single segment */
  514|       |    /* g_debuglog_enable = (pos >= 2228) & (pos <= 2262); */
  515|       |    DEBUGLOG(6, "pos:%7u -- literals:%4u, match:%4i, offset:%5i, cost:%4u + %5u",
  516|       |                pos,
  517|       |                (U32)(ip - anchor), matchLength, offset,
  518|       |                cost, totalCost);
  519|       |    totalCost += cost;
  520|       |#endif
  521|       |
  522|       |    /* Encode Literal length */
  523|  2.42M|    length = (size_t)(ip - anchor);
  ------------------
  |  |  498|  2.42M|#define ip      (*_ip)
  ------------------
                  length = (size_t)(ip - anchor);
  ------------------
  |  |  500|  2.42M|#define anchor  (*_anchor)
  ------------------
  524|  2.42M|    LZ4_STATIC_ASSERT(notLimited == 0);
  ------------------
  |  |  276|  2.42M|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
  525|       |    /* Check output limit */
  526|  2.42M|    if (limit && ((op + (length / 255) + length + (2 + 1 + LASTLITERALS)) > oend)) {
  ------------------
  |  |  499|  2.42M|#define op      (*_op)
  ------------------
                  if (limit && ((op + (length / 255) + length + (2 + 1 + LASTLITERALS)) > oend)) {
  ------------------
  |  |  244|  2.42M|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (526:9): [True: 2.42M, False: 0]
  |  Branch (526:18): [True: 131, False: 2.42M]
  ------------------
  527|    131|        DEBUGLOG(6, "Not enough room to write %i literals (%i bytes remaining)",
  ------------------
  |  |  288|    131|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  528|    131|                (int)length, (int)(oend - op));
  529|    131|        return 1;
  530|    131|    }
  531|  2.42M|    if (length >= RUN_MASK) {
  ------------------
  |  |  262|  2.42M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  2.42M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  2.42M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (531:9): [True: 183k, False: 2.24M]
  ------------------
  532|   183k|        size_t len = length - RUN_MASK;
  ------------------
  |  |  262|   183k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   183k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|   183k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  533|   183k|        *token = (RUN_MASK << ML_BITS);
  ------------------
  |  |  262|   183k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   183k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|   183k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      *token = (RUN_MASK << ML_BITS);
  ------------------
  |  |  259|   183k|#define ML_BITS  4
  ------------------
  534|   390k|        for(; len >= 255 ; len -= 255) *op++ = 255;
  ------------------
  |  |  499|   206k|#define op      (*_op)
  ------------------
  |  Branch (534:15): [True: 206k, False: 183k]
  ------------------
  535|   183k|        *op++ = (BYTE)len;
  ------------------
  |  |  499|   183k|#define op      (*_op)
  ------------------
  536|  2.24M|    } else {
  537|  2.24M|        *token = (BYTE)(length << ML_BITS);
  ------------------
  |  |  259|  2.24M|#define ML_BITS  4
  ------------------
  538|  2.24M|    }
  539|       |
  540|       |    /* Copy Literals */
  541|  2.42M|    LZ4_wildCopy8(op, anchor, op + length);
  ------------------
  |  |  499|  2.42M|#define op      (*_op)
  ------------------
                  LZ4_wildCopy8(op, anchor, op + length);
  ------------------
  |  |  500|  2.42M|#define anchor  (*_anchor)
  ------------------
                  LZ4_wildCopy8(op, anchor, op + length);
  ------------------
  |  |  499|  2.42M|#define op      (*_op)
  ------------------
  542|  2.42M|    op += length;
  ------------------
  |  |  499|  2.42M|#define op      (*_op)
  ------------------
  543|       |
  544|       |    /* Encode Offset */
  545|  2.42M|    assert(offset <= LZ4_DISTANCE_MAX );
  546|  2.42M|    assert(offset > 0);
  547|  2.42M|    LZ4_writeLE16(op, (U16)(offset)); op += 2;
  ------------------
  |  |  499|  2.42M|#define op      (*_op)
  ------------------
                  LZ4_writeLE16(op, (U16)(offset)); op += 2;
  ------------------
  |  |  499|  2.42M|#define op      (*_op)
  ------------------
  548|       |
  549|       |    /* Encode MatchLength */
  550|  2.42M|    assert(matchLength >= MINMATCH);
  551|  2.42M|    length = (size_t)matchLength - MINMATCH;
  ------------------
  |  |  241|  2.42M|#define MINMATCH 4
  ------------------
  552|  2.42M|    if (limit && (op + (length / 255) + (1 + LASTLITERALS) > oend)) {
  ------------------
  |  |  499|  2.42M|#define op      (*_op)
  ------------------
                  if (limit && (op + (length / 255) + (1 + LASTLITERALS) > oend)) {
  ------------------
  |  |  244|  2.42M|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (552:9): [True: 2.42M, False: 0]
  |  Branch (552:18): [True: 46, False: 2.42M]
  ------------------
  553|     46|        DEBUGLOG(6, "Not enough room to write match length");
  ------------------
  |  |  288|     46|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  554|     46|        return 1;   /* Check output limit */
  555|     46|    }
  556|  2.42M|    if (length >= ML_MASK) {
  ------------------
  |  |  260|  2.42M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  2.42M|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (556:9): [True: 470k, False: 1.95M]
  ------------------
  557|   470k|        *token += ML_MASK;
  ------------------
  |  |  260|   470k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|   470k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  558|   470k|        length -= ML_MASK;
  ------------------
  |  |  260|   470k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|   470k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  559|   810k|        for(; length >= 510 ; length -= 510) { *op++ = 255; *op++ = 255; }
  ------------------
  |  |  499|   340k|#define op      (*_op)
  ------------------
                      for(; length >= 510 ; length -= 510) { *op++ = 255; *op++ = 255; }
  ------------------
  |  |  499|   340k|#define op      (*_op)
  ------------------
  |  Branch (559:15): [True: 340k, False: 470k]
  ------------------
  560|   470k|        if (length >= 255) { length -= 255; *op++ = 255; }
  ------------------
  |  |  499|  54.4k|#define op      (*_op)
  ------------------
  |  Branch (560:13): [True: 54.4k, False: 416k]
  ------------------
  561|   470k|        *op++ = (BYTE)length;
  ------------------
  |  |  499|   470k|#define op      (*_op)
  ------------------
  562|  1.95M|    } else {
  563|  1.95M|        *token += (BYTE)(length);
  564|  1.95M|    }
  565|       |
  566|       |    /* Prepare next loop */
  567|  2.42M|    ip += matchLength;
  ------------------
  |  |  498|  2.42M|#define ip      (*_ip)
  ------------------
  568|  2.42M|    anchor = ip;
  ------------------
  |  |  500|  2.42M|#define anchor  (*_anchor)
  ------------------
                  anchor = ip;
  ------------------
  |  |  498|  2.42M|#define ip      (*_ip)
  ------------------
  569|       |
  570|  2.42M|    return 0;
  571|  2.42M|}
lz4hc.c:LZ4HC_compress_optimal:
 1348|  5.81k|{
 1349|  5.81k|    int retval = 0;
 1350|  5.81k|#define TRAILING_LITERALS 3
 1351|  5.81k|#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1
 1352|  5.81k|    LZ4HC_optimal_t* const opt = (LZ4HC_optimal_t*)ALLOC(sizeof(LZ4HC_optimal_t) * (LZ4_OPT_NUM + TRAILING_LITERALS));
  ------------------
  |  |  224|  5.81k|# define ALLOC(s)          malloc(s)
  ------------------
 1353|       |#else
 1354|       |    LZ4HC_optimal_t opt[LZ4_OPT_NUM + TRAILING_LITERALS];   /* ~64 KB, which is a bit large for stack... */
 1355|       |#endif
 1356|       |
 1357|  5.81k|    const BYTE* ip = (const BYTE*) source;
 1358|  5.81k|    const BYTE* anchor = ip;
 1359|  5.81k|    const BYTE* const iend = ip + *srcSizePtr;
 1360|  5.81k|    const BYTE* const mflimit = iend - MFLIMIT;
  ------------------
  |  |  245|  5.81k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1361|  5.81k|    const BYTE* const matchlimit = iend - LASTLITERALS;
  ------------------
  |  |  244|  5.81k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1362|  5.81k|    BYTE* op = (BYTE*) dst;
 1363|  5.81k|    BYTE* opSaved = (BYTE*) dst;
 1364|  5.81k|    BYTE* oend = op + dstCapacity;
 1365|  5.81k|    int ovml = MINMATCH;  /* overflow - last sequence */
  ------------------
  |  |  241|  5.81k|#define MINMATCH 4
  ------------------
 1366|  5.81k|    int ovoff = 0;
 1367|       |
 1368|       |    /* init */
 1369|  5.81k|#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1
 1370|  5.81k|    if (opt == NULL) goto _return_label;
  ------------------
  |  Branch (1370:9): [True: 0, False: 5.81k]
  ------------------
 1371|  5.81k|#endif
 1372|  5.81k|    DEBUGLOG(5, "LZ4HC_compress_optimal(dst=%p, dstCapa=%u)", dst, (unsigned)dstCapacity);
  ------------------
  |  |  288|  5.81k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1373|  5.81k|    *srcSizePtr = 0;
 1374|  5.81k|    if (limit == fillOutput) oend -= LASTLITERALS;   /* Hack for support LZ4 format restriction */
  ------------------
  |  |  244|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (1374:9): [True: 0, False: 5.81k]
  ------------------
 1375|  5.81k|    if (sufficient_len >= LZ4_OPT_NUM) sufficient_len = LZ4_OPT_NUM-1;
  ------------------
  |  |   77|  5.81k|#define LZ4_OPT_NUM   (1<<12)
  ------------------
                  if (sufficient_len >= LZ4_OPT_NUM) sufficient_len = LZ4_OPT_NUM-1;
  ------------------
  |  |   77|  3.15k|#define LZ4_OPT_NUM   (1<<12)
  ------------------
  |  Branch (1375:9): [True: 3.15k, False: 2.65k]
  ------------------
 1376|       |
 1377|       |    /* Main Loop */
 1378|  42.3M|    while (ip <= mflimit) {
  ------------------
  |  Branch (1378:12): [True: 42.3M, False: 5.70k]
  ------------------
 1379|  42.3M|         int const llen = (int)(ip - anchor);
 1380|  42.3M|         int best_mlen, best_off;
 1381|  42.3M|         int cur, last_match_pos = 0;
 1382|       |
 1383|  42.3M|         LZ4HC_match_t const firstMatch = LZ4HC_FindLongerMatch(ctx, ip, matchlimit, MINMATCH-1, nbSearches, dict, favorDecSpeed);
  ------------------
  |  |  241|  42.3M|#define MINMATCH 4
  ------------------
 1384|  42.3M|         if (firstMatch.len==0) { ip++; continue; }
  ------------------
  |  Branch (1384:14): [True: 41.3M, False: 967k]
  ------------------
 1385|       |
 1386|   967k|         if ((size_t)firstMatch.len > sufficient_len) {
  ------------------
  |  Branch (1386:14): [True: 31.7k, False: 935k]
  ------------------
 1387|       |             /* good enough solution : immediate encoding */
 1388|  31.7k|             int const firstML = firstMatch.len;
 1389|  31.7k|             opSaved = op;
 1390|  31.7k|             if ( LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), firstML, firstMatch.off, limit, oend) ) {  /* updates ip, op and anchor */
  ------------------
  |  |   87|  31.7k|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1390:19): [True: 25, False: 31.7k]
  ------------------
 1391|     25|                 ovml = firstML;
 1392|     25|                 ovoff = firstMatch.off;
 1393|     25|                 goto _dest_overflow;
 1394|     25|             }
 1395|  31.7k|             continue;
 1396|  31.7k|         }
 1397|       |
 1398|       |         /* set prices for first positions (literals) */
 1399|   935k|         {   int rPos;
 1400|  4.67M|             for (rPos = 0 ; rPos < MINMATCH ; rPos++) {
  ------------------
  |  |  241|  4.67M|#define MINMATCH 4
  ------------------
  |  Branch (1400:30): [True: 3.74M, False: 935k]
  ------------------
 1401|  3.74M|                 int const cost = LZ4HC_literalsPrice(llen + rPos);
 1402|  3.74M|                 opt[rPos].mlen = 1;
 1403|  3.74M|                 opt[rPos].off = 0;
 1404|  3.74M|                 opt[rPos].litlen = llen + rPos;
 1405|  3.74M|                 opt[rPos].price = cost;
 1406|  3.74M|                 DEBUGLOG(7, "rPos:%3i => price:%3i (litlen=%i) -- initial setup",
  ------------------
  |  |  288|  3.74M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1407|  3.74M|                             rPos, cost, opt[rPos].litlen);
 1408|  3.74M|         }   }
 1409|       |         /* set prices using initial match */
 1410|   935k|         {   int mlen = MINMATCH;
  ------------------
  |  |  241|   935k|#define MINMATCH 4
  ------------------
 1411|   935k|             int const matchML = firstMatch.len;   /* necessarily < sufficient_len < LZ4_OPT_NUM */
 1412|   935k|             int const offset = firstMatch.off;
 1413|   935k|             assert(matchML < LZ4_OPT_NUM);
 1414|  16.9M|             for ( ; mlen <= matchML ; mlen++) {
  ------------------
  |  Branch (1414:22): [True: 16.0M, False: 935k]
  ------------------
 1415|  16.0M|                 int const cost = LZ4HC_sequencePrice(llen, mlen);
 1416|  16.0M|                 opt[mlen].mlen = mlen;
 1417|  16.0M|                 opt[mlen].off = offset;
 1418|  16.0M|                 opt[mlen].litlen = llen;
 1419|  16.0M|                 opt[mlen].price = cost;
 1420|  16.0M|                 DEBUGLOG(7, "rPos:%3i => price:%3i (matchlen=%i) -- initial setup",
  ------------------
  |  |  288|  16.0M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1421|  16.0M|                             mlen, cost, mlen);
 1422|  16.0M|         }   }
 1423|      0|         last_match_pos = firstMatch.len;
 1424|   935k|         {   int addLit;
 1425|  3.74M|             for (addLit = 1; addLit <= TRAILING_LITERALS; addLit ++) {
  ------------------
  |  | 1350|  3.74M|#define TRAILING_LITERALS 3
  ------------------
  |  Branch (1425:31): [True: 2.80M, False: 935k]
  ------------------
 1426|  2.80M|                 opt[last_match_pos+addLit].mlen = 1; /* literal */
 1427|  2.80M|                 opt[last_match_pos+addLit].off = 0;
 1428|  2.80M|                 opt[last_match_pos+addLit].litlen = addLit;
 1429|  2.80M|                 opt[last_match_pos+addLit].price = opt[last_match_pos].price + LZ4HC_literalsPrice(addLit);
 1430|  2.80M|                 DEBUGLOG(7, "rPos:%3i => price:%3i (litlen=%i) -- initial setup",
  ------------------
  |  |  288|  2.80M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1431|  2.80M|                             last_match_pos+addLit, opt[last_match_pos+addLit].price, addLit);
 1432|  2.80M|         }   }
 1433|       |
 1434|       |         /* check further positions */
 1435|  30.5M|         for (cur = 1; cur < last_match_pos; cur++) {
  ------------------
  |  Branch (1435:24): [True: 29.5M, False: 925k]
  ------------------
 1436|  29.5M|             const BYTE* const curPtr = ip + cur;
 1437|  29.5M|             LZ4HC_match_t newMatch;
 1438|       |
 1439|  29.5M|             if (curPtr > mflimit) break;
  ------------------
  |  Branch (1439:18): [True: 3.58k, False: 29.5M]
  ------------------
 1440|  29.5M|             DEBUGLOG(7, "rPos:%u[%u] vs [%u]%u",
  ------------------
  |  |  288|  29.5M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1441|  29.5M|                     cur, opt[cur].price, opt[cur+1].price, cur+1);
 1442|  29.5M|             if (fullUpdate) {
  ------------------
  |  Branch (1442:18): [True: 22.9M, False: 6.62M]
  ------------------
 1443|       |                 /* not useful to search here if next position has same (or lower) cost */
 1444|  22.9M|                 if ( (opt[cur+1].price <= opt[cur].price)
  ------------------
  |  Branch (1444:23): [True: 21.5M, False: 1.42M]
  ------------------
 1445|       |                   /* in some cases, next position has same cost, but cost rises sharply after, so a small match would still be beneficial */
 1446|  22.9M|                   && (opt[cur+MINMATCH].price < opt[cur].price + 3/*min seq price*/) )
  ------------------
  |  |  241|  21.5M|#define MINMATCH 4
  ------------------
  |  Branch (1446:23): [True: 21.0M, False: 461k]
  ------------------
 1447|  21.0M|                     continue;
 1448|  22.9M|             } else {
 1449|       |                 /* not useful to search here if next position has same (or lower) cost */
 1450|  6.62M|                 if (opt[cur+1].price <= opt[cur].price) continue;
  ------------------
  |  Branch (1450:22): [True: 4.93M, False: 1.69M]
  ------------------
 1451|  6.62M|             }
 1452|       |
 1453|  3.58M|             DEBUGLOG(7, "search at rPos:%u", cur);
  ------------------
  |  |  288|  3.58M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1454|  3.58M|             if (fullUpdate)
  ------------------
  |  Branch (1454:18): [True: 1.88M, False: 1.69M]
  ------------------
 1455|  1.88M|                 newMatch = LZ4HC_FindLongerMatch(ctx, curPtr, matchlimit, MINMATCH-1, nbSearches, dict, favorDecSpeed);
  ------------------
  |  |  241|  1.88M|#define MINMATCH 4
  ------------------
 1456|  1.69M|             else
 1457|       |                 /* only test matches of minimum length; slightly faster, but misses a few bytes */
 1458|  1.69M|                 newMatch = LZ4HC_FindLongerMatch(ctx, curPtr, matchlimit, last_match_pos - cur, nbSearches, dict, favorDecSpeed);
 1459|  3.58M|             if (!newMatch.len) continue;
  ------------------
  |  Branch (1459:18): [True: 2.00M, False: 1.57M]
  ------------------
 1460|       |
 1461|  1.57M|             if ( ((size_t)newMatch.len > sufficient_len)
  ------------------
  |  Branch (1461:19): [True: 5.71k, False: 1.57M]
  ------------------
 1462|  1.57M|               || (newMatch.len + cur >= LZ4_OPT_NUM) ) {
  ------------------
  |  |   77|  1.57M|#define LZ4_OPT_NUM   (1<<12)
  ------------------
  |  Branch (1462:19): [True: 797, False: 1.56M]
  ------------------
 1463|       |                 /* immediate encoding */
 1464|  6.51k|                 best_mlen = newMatch.len;
 1465|  6.51k|                 best_off = newMatch.off;
 1466|  6.51k|                 last_match_pos = cur + 1;
 1467|  6.51k|                 goto encode;
 1468|  6.51k|             }
 1469|       |
 1470|       |             /* before match : set price with literals at beginning */
 1471|  1.56M|             {   int const baseLitlen = opt[cur].litlen;
 1472|  1.56M|                 int litlen;
 1473|  6.27M|                 for (litlen = 1; litlen < MINMATCH; litlen++) {
  ------------------
  |  |  241|  6.27M|#define MINMATCH 4
  ------------------
  |  Branch (1473:35): [True: 4.70M, False: 1.56M]
  ------------------
 1474|  4.70M|                     int const price = opt[cur].price - LZ4HC_literalsPrice(baseLitlen) + LZ4HC_literalsPrice(baseLitlen+litlen);
 1475|  4.70M|                     int const pos = cur + litlen;
 1476|  4.70M|                     if (price < opt[pos].price) {
  ------------------
  |  Branch (1476:26): [True: 0, False: 4.70M]
  ------------------
 1477|      0|                         opt[pos].mlen = 1; /* literal */
 1478|      0|                         opt[pos].off = 0;
 1479|      0|                         opt[pos].litlen = baseLitlen+litlen;
 1480|      0|                         opt[pos].price = price;
 1481|      0|                         DEBUGLOG(7, "rPos:%3i => price:%3i (litlen=%i)",
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1482|      0|                                     pos, price, opt[pos].litlen);
 1483|      0|             }   }   }
 1484|       |
 1485|       |             /* set prices using match at position = cur */
 1486|  1.56M|             {   int const matchML = newMatch.len;
 1487|  1.56M|                 int ml = MINMATCH;
  ------------------
  |  |  241|  1.56M|#define MINMATCH 4
  ------------------
 1488|       |
 1489|  1.56M|                 assert(cur + newMatch.len < LZ4_OPT_NUM);
 1490|   126M|                 for ( ; ml <= matchML ; ml++) {
  ------------------
  |  Branch (1490:26): [True: 125M, False: 1.56M]
  ------------------
 1491|   125M|                     int const pos = cur + ml;
 1492|   125M|                     int const offset = newMatch.off;
 1493|   125M|                     int price;
 1494|   125M|                     int ll;
 1495|   125M|                     DEBUGLOG(7, "testing price rPos %i (last_match_pos=%i)",
  ------------------
  |  |  288|   125M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1496|   125M|                                 pos, last_match_pos);
 1497|   125M|                     if (opt[cur].mlen == 1) {
  ------------------
  |  Branch (1497:26): [True: 45.1M, False: 79.8M]
  ------------------
 1498|  45.1M|                         ll = opt[cur].litlen;
 1499|  45.1M|                         price = ((cur > ll) ? opt[cur - ll].price : 0)
  ------------------
  |  Branch (1499:35): [True: 15.9M, False: 29.1M]
  ------------------
 1500|  45.1M|                               + LZ4HC_sequencePrice(ll, ml);
 1501|  79.8M|                     } else {
 1502|  79.8M|                         ll = 0;
 1503|  79.8M|                         price = opt[cur].price + LZ4HC_sequencePrice(0, ml);
 1504|  79.8M|                     }
 1505|       |
 1506|   125M|                    assert((U32)favorDecSpeed <= 1);
 1507|   125M|                     if (pos > last_match_pos+TRAILING_LITERALS
  ------------------
  |  | 1350|   250M|#define TRAILING_LITERALS 3
  ------------------
  |  Branch (1507:26): [True: 11.1M, False: 113M]
  ------------------
 1508|   125M|                      || price <= opt[pos].price - (int)favorDecSpeed) {
  ------------------
  |  Branch (1508:26): [True: 6.92M, False: 106M]
  ------------------
 1509|  18.0M|                         DEBUGLOG(7, "rPos:%3i => price:%3i (matchlen=%i)",
  ------------------
  |  |  288|  18.0M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1510|  18.0M|                                     pos, price, ml);
 1511|  18.0M|                         assert(pos < LZ4_OPT_NUM);
 1512|  18.0M|                         if ( (ml == matchML)  /* last pos of last match */
  ------------------
  |  Branch (1512:31): [True: 734k, False: 17.3M]
  ------------------
 1513|  18.0M|                           && (last_match_pos < pos) )
  ------------------
  |  Branch (1513:31): [True: 647k, False: 87.6k]
  ------------------
 1514|   647k|                             last_match_pos = pos;
 1515|  18.0M|                         opt[pos].mlen = ml;
 1516|  18.0M|                         opt[pos].off = offset;
 1517|  18.0M|                         opt[pos].litlen = ll;
 1518|  18.0M|                         opt[pos].price = price;
 1519|  18.0M|             }   }   }
 1520|       |             /* complete following positions with literals */
 1521|  1.56M|             {   int addLit;
 1522|  6.27M|                 for (addLit = 1; addLit <= TRAILING_LITERALS; addLit ++) {
  ------------------
  |  | 1350|  6.27M|#define TRAILING_LITERALS 3
  ------------------
  |  Branch (1522:35): [True: 4.70M, False: 1.56M]
  ------------------
 1523|  4.70M|                     opt[last_match_pos+addLit].mlen = 1; /* literal */
 1524|  4.70M|                     opt[last_match_pos+addLit].off = 0;
 1525|  4.70M|                     opt[last_match_pos+addLit].litlen = addLit;
 1526|  4.70M|                     opt[last_match_pos+addLit].price = opt[last_match_pos].price + LZ4HC_literalsPrice(addLit);
 1527|  4.70M|                     DEBUGLOG(7, "rPos:%3i => price:%3i (litlen=%i)", last_match_pos+addLit, opt[last_match_pos+addLit].price, addLit);
  ------------------
  |  |  288|  4.70M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1528|  4.70M|             }   }
 1529|  1.56M|         }  /* for (cur = 1; cur <= last_match_pos; cur++) */
 1530|       |
 1531|   929k|         assert(last_match_pos < LZ4_OPT_NUM + TRAILING_LITERALS);
 1532|   929k|         best_mlen = opt[last_match_pos].mlen;
 1533|   929k|         best_off = opt[last_match_pos].off;
 1534|   929k|         cur = last_match_pos - best_mlen;
 1535|       |
 1536|   935k|encode: /* cur, last_match_pos, best_mlen, best_off must be set */
 1537|   935k|         assert(cur < LZ4_OPT_NUM);
 1538|   935k|         assert(last_match_pos >= 1);  /* == 1 when only one candidate */
 1539|   935k|         DEBUGLOG(6, "reverse traversal, looking for shortest path (last_match_pos=%i)", last_match_pos);
  ------------------
  |  |  288|   935k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1540|   935k|         {   int candidate_pos = cur;
 1541|   935k|             int selected_matchLength = best_mlen;
 1542|   935k|             int selected_offset = best_off;
 1543|  1.46M|             while (1) {  /* from end to beginning */
  ------------------
  |  Branch (1543:21): [Folded - Ignored]
  ------------------
 1544|  1.46M|                 int const next_matchLength = opt[candidate_pos].mlen;  /* can be 1, means literal */
 1545|  1.46M|                 int const next_offset = opt[candidate_pos].off;
 1546|  1.46M|                 DEBUGLOG(7, "pos %i: sequence length %i", candidate_pos, selected_matchLength);
  ------------------
  |  |  288|  1.46M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1547|  1.46M|                 opt[candidate_pos].mlen = selected_matchLength;
 1548|  1.46M|                 opt[candidate_pos].off = selected_offset;
 1549|  1.46M|                 selected_matchLength = next_matchLength;
 1550|  1.46M|                 selected_offset = next_offset;
 1551|  1.46M|                 if (next_matchLength > candidate_pos) break; /* last match elected, first match to encode */
  ------------------
  |  Branch (1551:22): [True: 935k, False: 526k]
  ------------------
 1552|   526k|                 assert(next_matchLength > 0);  /* can be 1, means literal */
 1553|   526k|                 candidate_pos -= next_matchLength;
 1554|   526k|         }   }
 1555|       |
 1556|       |         /* encode all recorded sequences in order */
 1557|   935k|         {   int rPos = 0;  /* relative position (to ip) */
 1558|  2.39M|             while (rPos < last_match_pos) {
  ------------------
  |  Branch (1558:21): [True: 1.46M, False: 935k]
  ------------------
 1559|  1.46M|                 int const ml = opt[rPos].mlen;
 1560|  1.46M|                 int const offset = opt[rPos].off;
 1561|  1.46M|                 if (ml == 1) { ip++; rPos++; continue; }  /* literal; note: can end up with several literals, in which case, skip them */
  ------------------
  |  Branch (1561:22): [True: 248k, False: 1.21M]
  ------------------
 1562|  1.21M|                 rPos += ml;
 1563|  1.21M|                 assert(ml >= MINMATCH);
 1564|  1.21M|                 assert((offset >= 1) && (offset <= LZ4_DISTANCE_MAX));
 1565|  1.21M|                 opSaved = op;
 1566|  1.21M|                 if ( LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml, offset, limit, oend) ) {  /* updates ip, op and anchor */
  ------------------
  |  |   87|  1.21M|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
  |  Branch (1566:23): [True: 85, False: 1.21M]
  ------------------
 1567|     85|                     ovml = ml;
 1568|     85|                     ovoff = offset;
 1569|     85|                     goto _dest_overflow;
 1570|     85|         }   }   }
 1571|   935k|     }  /* while (ip <= mflimit) */
 1572|       |
 1573|  5.70k|_last_literals:
 1574|       |     /* Encode Last Literals */
 1575|  5.70k|     {   size_t lastRunSize = (size_t)(iend - anchor);  /* literals */
 1576|  5.70k|         size_t llAdd = (lastRunSize + 255 - RUN_MASK) / 255;
  ------------------
  |  |  262|  5.70k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  5.70k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  5.70k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1577|  5.70k|         size_t const totalSize = 1 + llAdd + lastRunSize;
 1578|  5.70k|         if (limit == fillOutput) oend += LASTLITERALS;  /* restore correct value */
  ------------------
  |  |  244|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (1578:14): [True: 0, False: 5.70k]
  ------------------
 1579|  5.70k|         if (limit && (op + totalSize > oend)) {
  ------------------
  |  Branch (1579:14): [True: 5.70k, False: 0]
  |  Branch (1579:23): [True: 749, False: 4.95k]
  ------------------
 1580|    749|             if (limit == limitedOutput) { /* Check output limit */
  ------------------
  |  Branch (1580:18): [True: 749, False: 0]
  ------------------
 1581|    749|                retval = 0;
 1582|    749|                goto _return_label;
 1583|    749|             }
 1584|       |             /* adapt lastRunSize to fill 'dst' */
 1585|      0|             lastRunSize  = (size_t)(oend - op) - 1 /*token*/;
 1586|      0|             llAdd = (lastRunSize + 256 - RUN_MASK) / 256;
  ------------------
  |  |  262|      0|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|      0|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|      0|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1587|      0|             lastRunSize -= llAdd;
 1588|      0|         }
 1589|  4.95k|         DEBUGLOG(6, "Final literal run : %i literals", (int)lastRunSize);
  ------------------
  |  |  288|  4.95k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1590|  4.95k|         ip = anchor + lastRunSize; /* can be != iend if limit==fillOutput */
 1591|       |
 1592|  4.95k|         if (lastRunSize >= RUN_MASK) {
  ------------------
  |  |  262|  4.95k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  4.95k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  4.95k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1592:14): [True: 359, False: 4.59k]
  ------------------
 1593|    359|             size_t accumulator = lastRunSize - RUN_MASK;
  ------------------
  |  |  262|    359|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|    359|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|    359|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1594|    359|             *op++ = (RUN_MASK << ML_BITS);
  ------------------
  |  |  262|    359|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|    359|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|    359|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                           *op++ = (RUN_MASK << ML_BITS);
  ------------------
  |  |  259|    359|#define ML_BITS  4
  ------------------
 1595|  4.84k|             for(; accumulator >= 255 ; accumulator -= 255) *op++ = 255;
  ------------------
  |  Branch (1595:20): [True: 4.48k, False: 359]
  ------------------
 1596|    359|             *op++ = (BYTE) accumulator;
 1597|  4.59k|         } else {
 1598|  4.59k|             *op++ = (BYTE)(lastRunSize << ML_BITS);
  ------------------
  |  |  259|  4.59k|#define ML_BITS  4
  ------------------
 1599|  4.59k|         }
 1600|  4.95k|         LZ4_memcpy(op, anchor, lastRunSize);
  ------------------
  |  |  348|  4.95k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 1601|  4.95k|         op += lastRunSize;
 1602|  4.95k|     }
 1603|       |
 1604|       |     /* End */
 1605|      0|     *srcSizePtr = (int) (((const char*)ip) - source);
 1606|  4.95k|     retval = (int) ((char*)op-dst);
 1607|  4.95k|     goto _return_label;
 1608|       |
 1609|    110|_dest_overflow:
 1610|    110|if (limit == fillOutput) {
  ------------------
  |  Branch (1610:5): [True: 0, False: 110]
  ------------------
 1611|       |     /* Assumption : ip, anchor, ovml and ovref must be set correctly */
 1612|      0|     size_t const ll = (size_t)(ip - anchor);
 1613|      0|     size_t const ll_addbytes = (ll + 240) / 255;
 1614|      0|     size_t const ll_totalCost = 1 + ll_addbytes + ll;
 1615|      0|     BYTE* const maxLitPos = oend - 3; /* 2 for offset, 1 for token */
 1616|      0|     DEBUGLOG(6, "Last sequence overflowing (only %i bytes remaining)", (int)(oend-1-opSaved));
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1617|      0|     op = opSaved;  /* restore correct out pointer */
 1618|      0|     if (op + ll_totalCost <= maxLitPos) {
  ------------------
  |  Branch (1618:10): [True: 0, False: 0]
  ------------------
 1619|       |         /* ll validated; now adjust match length */
 1620|      0|         size_t const bytesLeftForMl = (size_t)(maxLitPos - (op+ll_totalCost));
 1621|      0|         size_t const maxMlSize = MINMATCH + (ML_MASK-1) + (bytesLeftForMl * 255);
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
                       size_t const maxMlSize = MINMATCH + (ML_MASK-1) + (bytesLeftForMl * 255);
  ------------------
  |  |  260|      0|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|      0|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1622|      0|         assert(maxMlSize < INT_MAX); assert(ovml >= 0);
 1623|      0|         if ((size_t)ovml > maxMlSize) ovml = (int)maxMlSize;
  ------------------
  |  Branch (1623:14): [True: 0, False: 0]
  ------------------
 1624|      0|         if ((oend + LASTLITERALS) - (op + ll_totalCost + 2) - 1 + ovml >= MFLIMIT) {
  ------------------
  |  |  244|      0|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                       if ((oend + LASTLITERALS) - (op + ll_totalCost + 2) - 1 + ovml >= MFLIMIT) {
  ------------------
  |  |  245|      0|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (1624:14): [True: 0, False: 0]
  ------------------
 1625|      0|             DEBUGLOG(6, "Space to end : %i + ml (%i)", (int)((oend + LASTLITERALS) - (op + ll_totalCost + 2) - 1), ovml);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1626|      0|             DEBUGLOG(6, "Before : ip = %p, anchor = %p", ip, anchor);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1627|      0|             LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ovml, ovoff, notLimited, oend);
  ------------------
  |  |   87|      0|#define UPDATABLE(ip, op, anchor) &ip, &op, &anchor
  ------------------
 1628|      0|             DEBUGLOG(6, "After : ip = %p, anchor = %p", ip, anchor);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1629|      0|     }   }
 1630|      0|     goto _last_literals;
 1631|      0|}
 1632|  5.81k|_return_label:
 1633|  5.81k|#if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1
 1634|  5.81k|     FREEMEM(opt);
  ------------------
  |  |  226|  5.81k|# define FREEMEM(p)        free(p)
  ------------------
 1635|  5.81k|#endif
 1636|  5.81k|     return retval;
 1637|    110|}
lz4hc.c:LZ4HC_FindLongerMatch:
 1323|  45.9M|{
 1324|  45.9M|    LZ4HC_match_t const match0 = { 0 , 0 };
 1325|       |    /* note : LZ4HC_InsertAndGetWiderMatch() is able to modify the starting position of a match (*startpos),
 1326|       |     * but this won't be the case here, as we define iLowLimit==ip,
 1327|       |    ** so LZ4HC_InsertAndGetWiderMatch() won't be allowed to search past ip */
 1328|  45.9M|    LZ4HC_match_t md = LZ4HC_InsertAndGetWiderMatch(ctx, ip, ip, iHighLimit, minLen, &ip, nbSearches, 1 /*patternAnalysis*/, 1 /*chainSwap*/, dict, favorDecSpeed);
 1329|  45.9M|    if (md.len <= minLen) return match0;
  ------------------
  |  Branch (1329:9): [True: 43.3M, False: 2.54M]
  ------------------
 1330|  2.54M|    if (favorDecSpeed) {
  ------------------
  |  Branch (1330:9): [True: 555k, False: 1.98M]
  ------------------
 1331|   555k|        if ((md.len>18) & (md.len<=36)) md.len=18;   /* favor shortcut */
  ------------------
  |  Branch (1331:13): [True: 141k, False: 414k]
  ------------------
 1332|   555k|    }
 1333|  2.54M|    return md;
 1334|  45.9M|}
lz4hc.c:LZ4HC_literalsPrice:
 1291|   161M|{
 1292|   161M|    int price = litlen;
 1293|   161M|    assert(litlen >= 0);
 1294|   161M|    if (litlen >= (int)RUN_MASK)
  ------------------
  |  |  262|   161M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   161M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|   161M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1294:9): [True: 3.85M, False: 157M]
  ------------------
 1295|  3.85M|        price += 1 + ((litlen-(int)RUN_MASK) / 255);
  ------------------
  |  |  262|  3.85M|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  3.85M|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  3.85M|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1296|   161M|    return price;
 1297|   161M|}
lz4hc.c:LZ4HC_sequencePrice:
 1302|   141M|{
 1303|   141M|    int price = 1 + 2 ; /* token + 16-bit offset */
 1304|   141M|    assert(litlen >= 0);
 1305|   141M|    assert(mlen >= MINMATCH);
 1306|       |
 1307|   141M|    price += LZ4HC_literalsPrice(litlen);
 1308|       |
 1309|   141M|    if (mlen >= (int)(ML_MASK+MINMATCH))
  ------------------
  |  |  260|   141M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|   141M|#define ML_BITS  4
  |  |  ------------------
  ------------------
                  if (mlen >= (int)(ML_MASK+MINMATCH))
  ------------------
  |  |  241|   141M|#define MINMATCH 4
  ------------------
  |  Branch (1309:9): [True: 123M, False: 17.5M]
  ------------------
 1310|   123M|        price += 1 + ((mlen-(int)(ML_MASK+MINMATCH)) / 255);
  ------------------
  |  |  260|   123M|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|   123M|#define ML_BITS  4
  |  |  ------------------
  ------------------
                      price += 1 + ((mlen-(int)(ML_MASK+MINMATCH)) / 255);
  ------------------
  |  |  241|   123M|#define MINMATCH 4
  ------------------
 1311|       |
 1312|   141M|    return price;
 1313|   141M|}
lz4hc.c:LZ4HC_Insert:
  124|  82.4M|{
  125|  82.4M|    U16* const chainTable = hc4->chainTable;
  126|  82.4M|    U32* const hashTable  = hc4->hashTable;
  127|  82.4M|    const BYTE* const prefixPtr = hc4->prefixStart;
  128|  82.4M|    U32 const prefixIdx = hc4->dictLimit;
  129|  82.4M|    U32 const target = (U32)(ip - prefixPtr) + prefixIdx;
  130|  82.4M|    U32 idx = hc4->nextToUpdate;
  131|  82.4M|    assert(ip >= prefixPtr);
  132|  82.4M|    assert(target >= prefixIdx);
  133|       |
  134|   377M|    while (idx < target) {
  ------------------
  |  Branch (134:12): [True: 294M, False: 82.4M]
  ------------------
  135|   294M|        U32 const h = LZ4HC_hashPtr(prefixPtr+idx-prefixIdx);
  136|   294M|        size_t delta = idx - hashTable[h];
  137|   294M|        if (delta>LZ4_DISTANCE_MAX) delta = LZ4_DISTANCE_MAX;
  ------------------
  |  |  653|   294M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                      if (delta>LZ4_DISTANCE_MAX) delta = LZ4_DISTANCE_MAX;
  ------------------
  |  |  653|  37.3M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (137:13): [True: 37.3M, False: 257M]
  ------------------
  138|   294M|        DELTANEXTU16(chainTable, idx) = (U16)delta;
  ------------------
  |  |   85|   294M|#define DELTANEXTU16(table, pos) table[(U16)(pos)]   /* faster */
  ------------------
  139|   294M|        hashTable[h] = idx;
  140|   294M|        idx++;
  141|   294M|    }
  142|       |
  143|  82.4M|    hc4->nextToUpdate = target;
  144|  82.4M|}

LZ4_XXH32:
  393|  25.3k|{
  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|  25.3k|    XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN;
  ------------------
  |  |  225|  25.3k|#   define XXH_CPU_LITTLE_ENDIAN   XXH_isLittleEndian()
  ------------------
  402|       |
  403|  25.3k|    if (XXH_FORCE_ALIGN_CHECK) {
  ------------------
  |  |   95|  25.3k|#    define XXH_FORCE_ALIGN_CHECK 0
  |  |  ------------------
  |  |  |  Branch (95:35): [Folded - Ignored]
  |  |  ------------------
  ------------------
  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 - Ignored]
  |  |  ------------------
  ------------------
  |  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|  25.3k|    if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
  ------------------
  |  |   83|      0|#  define XXH_FORCE_NATIVE_FORMAT 0
  |  |  ------------------
  |  |  |  Branch (83:35): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (411:9): [True: 25.3k, False: 0]
  ------------------
  412|  25.3k|        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|  25.3k|#endif
  416|  25.3k|}
LZ4_XXH32_reset:
  438|  17.2k|{
  439|  17.2k|    XXH32_state_t state;   /* using a local state to memcpy() in order to avoid strict-aliasing warnings */
  440|  17.2k|    memset(&state, 0, sizeof(state));
  441|  17.2k|    state.v1 = seed + PRIME32_1 + PRIME32_2;
  442|  17.2k|    state.v2 = seed + PRIME32_2;
  443|  17.2k|    state.v3 = seed + 0;
  444|  17.2k|    state.v4 = seed - PRIME32_1;
  445|       |    /* do not write into reserved, planned to be removed in a future version */
  446|  17.2k|    memcpy(statePtr, &state, sizeof(state) - sizeof(state.reserved));
  447|  17.2k|    return XXH_OK;
  448|  17.2k|}
LZ4_XXH32_update:
  516|  25.2k|{
  517|  25.2k|    XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN;
  ------------------
  |  |  225|  25.2k|#   define XXH_CPU_LITTLE_ENDIAN   XXH_isLittleEndian()
  ------------------
  518|       |
  519|  25.2k|    if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
  ------------------
  |  |   83|      0|#  define XXH_FORCE_NATIVE_FORMAT 0
  |  |  ------------------
  |  |  |  Branch (83:35): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (519:9): [True: 25.2k, False: 0]
  ------------------
  520|  25.2k|        return XXH32_update_endian(state_in, input, len, XXH_littleEndian);
  521|      0|    else
  522|      0|        return XXH32_update_endian(state_in, input, len, XXH_bigEndian);
  523|  25.2k|}
LZ4_XXH32_digest:
  547|  11.7k|{
  548|  11.7k|    XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN;
  ------------------
  |  |  225|  11.7k|#   define XXH_CPU_LITTLE_ENDIAN   XXH_isLittleEndian()
  ------------------
  549|       |
  550|  11.7k|    if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
  ------------------
  |  |   83|      0|#  define XXH_FORCE_NATIVE_FORMAT 0
  |  |  ------------------
  |  |  |  Branch (83:35): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (550:9): [True: 11.7k, False: 0]
  ------------------
  551|  11.7k|        return XXH32_digest_endian(state_in, XXH_littleEndian);
  552|      0|    else
  553|      0|        return XXH32_digest_endian(state_in, XXH_bigEndian);
  554|  11.7k|}
xxhash.c:XXH_isLittleEndian:
  221|  62.4k|{
  222|  62.4k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  223|  62.4k|    return one.c[0];
  224|  62.4k|}
xxhash.c:XXH32_endian_align:
  354|  25.3k|{
  355|  25.3k|    const BYTE* p = (const BYTE*)input;
  356|  25.3k|    const BYTE* bEnd = p + len;
  357|  25.3k|    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|  25.3k|    if (len>=16) {
  ------------------
  |  Branch (366:9): [True: 12.8k, False: 12.5k]
  ------------------
  367|  12.8k|        const BYTE* const limit = bEnd - 15;
  368|  12.8k|        U32 v1 = seed + PRIME32_1 + PRIME32_2;
  369|  12.8k|        U32 v2 = seed + PRIME32_2;
  370|  12.8k|        U32 v3 = seed + 0;
  371|  12.8k|        U32 v4 = seed - PRIME32_1;
  372|       |
  373|  8.47M|        do {
  374|  8.47M|            v1 = XXH32_round(v1, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  288|  8.47M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  375|  8.47M|            v2 = XXH32_round(v2, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  288|  8.47M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  376|  8.47M|            v3 = XXH32_round(v3, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  288|  8.47M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  377|  8.47M|            v4 = XXH32_round(v4, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  288|  8.47M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  378|  8.47M|        } while (p < limit);
  ------------------
  |  Branch (378:18): [True: 8.46M, False: 12.8k]
  ------------------
  379|       |
  380|  12.8k|        h32 = XXH_rotl32(v1, 1)  + XXH_rotl32(v2, 7)
  ------------------
  |  |  194|  12.8k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
                      h32 = XXH_rotl32(v1, 1)  + XXH_rotl32(v2, 7)
  ------------------
  |  |  194|  12.8k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  381|  12.8k|            + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18);
  ------------------
  |  |  194|  12.8k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
                          + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18);
  ------------------
  |  |  194|  12.8k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  382|  12.8k|    } else {
  383|  12.5k|        h32  = seed + PRIME32_5;
  384|  12.5k|    }
  385|       |
  386|  25.3k|    h32 += (U32)len;
  387|       |
  388|  25.3k|    return XXH32_finalize(h32, p, len&15, endian, align);
  389|  25.3k|}
xxhash.c:XXH32_round:
  270|   172M|{
  271|   172M|    seed += input * PRIME32_2;
  272|   172M|    seed  = XXH_rotl32(seed, 13);
  ------------------
  |  |  194|   172M|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  273|   172M|    seed *= PRIME32_1;
  274|   172M|    return seed;
  275|   172M|}
xxhash.c:XXH_readLE32_align:
  235|   172M|{
  236|   172M|    if (align==XXH_unaligned)
  ------------------
  |  Branch (236:9): [True: 172M, False: 16.2k]
  ------------------
  237|   172M|        return endian==XXH_littleEndian ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr));
  ------------------
  |  Branch (237:16): [True: 172M, False: 0]
  ------------------
  238|  16.2k|    else
  239|  16.2k|        return endian==XXH_littleEndian ? *(const U32*)ptr : XXH_swap32(*(const U32*)ptr);
  ------------------
  |  Branch (239:16): [True: 16.2k, False: 0]
  ------------------
  240|   172M|}
xxhash.c:XXH_read32:
  175|   172M|{
  176|   172M|    U32 val;
  177|   172M|    memcpy(&val, memPtr, sizeof(val));
  178|   172M|    return val;
  179|   172M|}
xxhash.c:XXH32_finalize:
  294|  37.1k|{
  295|  37.1k|    const BYTE* p = (const BYTE*)ptr;
  296|       |
  297|  37.1k|#define PROCESS1               \
  298|  37.1k|    h32 += (*p++) * PRIME32_5; \
  299|  37.1k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  300|       |
  301|  37.1k|#define PROCESS4                         \
  302|  37.1k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  303|  37.1k|    p+=4;                                \
  304|  37.1k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  305|       |
  306|  37.1k|    switch(len&15)  /* or switch(bEnd - p) */
  ------------------
  |  Branch (306:12): [True: 0, False: 37.1k]
  ------------------
  307|  37.1k|    {
  308|  1.42k|      case 12:      PROCESS4;
  ------------------
  |  |  302|  1.42k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  1.42k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  1.42k|    p+=4;                                \
  |  |  304|  1.42k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  1.42k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (308:7): [True: 1.42k, False: 35.7k]
  ------------------
  309|       |                    /* fallthrough */
  310|  2.78k|      case 8:       PROCESS4;
  ------------------
  |  |  302|  2.78k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  2.78k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  2.78k|    p+=4;                                \
  |  |  304|  2.78k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  2.78k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (310:7): [True: 1.35k, False: 35.8k]
  ------------------
  311|       |                    /* fallthrough */
  312|  4.12k|      case 4:       PROCESS4;
  ------------------
  |  |  302|  4.12k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  4.12k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  4.12k|    p+=4;                                \
  |  |  304|  4.12k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  4.12k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (312:7): [True: 1.33k, False: 35.8k]
  ------------------
  313|  4.12k|                    return XXH32_avalanche(h32);
  314|       |
  315|  1.65k|      case 13:      PROCESS4;
  ------------------
  |  |  302|  1.65k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  1.65k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  1.65k|    p+=4;                                \
  |  |  304|  1.65k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  1.65k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (315:7): [True: 1.65k, False: 35.5k]
  ------------------
  316|       |                    /* fallthrough */
  317|  2.93k|      case 9:       PROCESS4;
  ------------------
  |  |  302|  2.93k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  2.93k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  2.93k|    p+=4;                                \
  |  |  304|  2.93k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  2.93k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (317:7): [True: 1.27k, False: 35.8k]
  ------------------
  318|       |                    /* fallthrough */
  319|  4.14k|      case 5:       PROCESS4;
  ------------------
  |  |  302|  4.14k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  4.14k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  4.14k|    p+=4;                                \
  |  |  304|  4.14k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  4.14k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (319:7): [True: 1.21k, False: 35.9k]
  ------------------
  320|  4.14k|                    PROCESS1;
  ------------------
  |  |  298|  4.14k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  4.14k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  4.14k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  321|  4.14k|                    return XXH32_avalanche(h32);
  322|       |
  323|  1.77k|      case 14:      PROCESS4;
  ------------------
  |  |  302|  1.77k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  1.77k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  1.77k|    p+=4;                                \
  |  |  304|  1.77k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  1.77k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (323:7): [True: 1.77k, False: 35.3k]
  ------------------
  324|       |                    /* fallthrough */
  325|  3.34k|      case 10:      PROCESS4;
  ------------------
  |  |  302|  3.34k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  3.34k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  3.34k|    p+=4;                                \
  |  |  304|  3.34k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  3.34k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (325:7): [True: 1.57k, False: 35.5k]
  ------------------
  326|       |                    /* fallthrough */
  327|  4.69k|      case 6:       PROCESS4;
  ------------------
  |  |  302|  4.69k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  4.69k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  4.69k|    p+=4;                                \
  |  |  304|  4.69k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  4.69k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (327:7): [True: 1.35k, False: 35.8k]
  ------------------
  328|  4.69k|                    PROCESS1;
  ------------------
  |  |  298|  4.69k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  4.69k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  4.69k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  329|  4.69k|                    PROCESS1;
  ------------------
  |  |  298|  4.69k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  4.69k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  4.69k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  330|  4.69k|                    return XXH32_avalanche(h32);
  331|       |
  332|  1.87k|      case 15:      PROCESS4;
  ------------------
  |  |  302|  1.87k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  1.87k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  1.87k|    p+=4;                                \
  |  |  304|  1.87k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  1.87k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (332:7): [True: 1.87k, False: 35.2k]
  ------------------
  333|       |                    /* fallthrough */
  334|  3.56k|      case 11:      PROCESS4;
  ------------------
  |  |  302|  3.56k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  3.56k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  3.56k|    p+=4;                                \
  |  |  304|  3.56k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  3.56k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (334:7): [True: 1.69k, False: 35.4k]
  ------------------
  335|       |                    /* fallthrough */
  336|  4.91k|      case 7:       PROCESS4;
  ------------------
  |  |  302|  4.91k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  4.91k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  4.91k|    p+=4;                                \
  |  |  304|  4.91k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  4.91k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (336:7): [True: 1.34k, False: 35.8k]
  ------------------
  337|       |                    /* fallthrough */
  338|  6.97k|      case 3:       PROCESS1;
  ------------------
  |  |  298|  6.97k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  6.97k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  6.97k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (338:7): [True: 2.06k, False: 35.0k]
  ------------------
  339|       |                    /* fallthrough */
  340|  19.2k|      case 2:       PROCESS1;
  ------------------
  |  |  298|  19.2k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  19.2k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  19.2k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (340:7): [True: 12.2k, False: 24.9k]
  ------------------
  341|       |                    /* fallthrough */
  342|  21.9k|      case 1:       PROCESS1;
  ------------------
  |  |  298|  21.9k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  21.9k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  21.9k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (342:7): [True: 2.69k, False: 34.4k]
  ------------------
  343|       |                    /* fallthrough */
  344|  24.2k|      case 0:       return XXH32_avalanche(h32);
  ------------------
  |  Branch (344:7): [True: 2.28k, False: 34.8k]
  ------------------
  345|  37.1k|    }
  346|      0|    assert(0);
  347|      0|    return h32;   /* reaching this point is deemed impossible */
  348|      0|}
xxhash.c:XXH32_avalanche:
  279|  37.1k|{
  280|  37.1k|    h32 ^= h32 >> 15;
  281|  37.1k|    h32 *= PRIME32_2;
  282|  37.1k|    h32 ^= h32 >> 13;
  283|  37.1k|    h32 *= PRIME32_3;
  284|  37.1k|    h32 ^= h32 >> 16;
  285|  37.1k|    return(h32);
  286|  37.1k|}
xxhash.c:XXH32_update_endian:
  453|  25.2k|{
  454|  25.2k|    if (input==NULL)
  ------------------
  |  Branch (454:9): [True: 0, False: 25.2k]
  ------------------
  455|       |#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1)
  456|       |        return XXH_OK;
  457|       |#else
  458|      0|        return XXH_ERROR;
  459|  25.2k|#endif
  460|       |
  461|  25.2k|    {   const BYTE* p = (const BYTE*)input;
  462|  25.2k|        const BYTE* const bEnd = p + len;
  463|       |
  464|  25.2k|        state->total_len_32 += (unsigned)len;
  465|  25.2k|        state->large_len |= (len>=16) | (state->total_len_32>=16);
  466|       |
  467|  25.2k|        if (state->memsize + len < 16)  {   /* fill in tmp buffer */
  ------------------
  |  Branch (467:13): [True: 10.4k, False: 14.8k]
  ------------------
  468|  10.4k|            XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, len);
  469|  10.4k|            state->memsize += (unsigned)len;
  470|  10.4k|            return XXH_OK;
  471|  10.4k|        }
  472|       |
  473|  14.8k|        if (state->memsize) {   /* some data left from previous update */
  ------------------
  |  Branch (473:13): [True: 5.02k, False: 9.78k]
  ------------------
  474|  5.02k|            XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, 16-state->memsize);
  475|  5.02k|            {   const U32* p32 = state->mem32;
  476|  5.02k|                state->v1 = XXH32_round(state->v1, XXH_readLE32(p32, endian)); p32++;
  477|  5.02k|                state->v2 = XXH32_round(state->v2, XXH_readLE32(p32, endian)); p32++;
  478|  5.02k|                state->v3 = XXH32_round(state->v3, XXH_readLE32(p32, endian)); p32++;
  479|  5.02k|                state->v4 = XXH32_round(state->v4, XXH_readLE32(p32, endian));
  480|  5.02k|            }
  481|  5.02k|            p += 16-state->memsize;
  482|  5.02k|            state->memsize = 0;
  483|  5.02k|        }
  484|       |
  485|  14.8k|        if (p <= bEnd-16) {
  ------------------
  |  Branch (485:13): [True: 14.1k, False: 700]
  ------------------
  486|  14.1k|            const BYTE* const limit = bEnd - 16;
  487|  14.1k|            U32 v1 = state->v1;
  488|  14.1k|            U32 v2 = state->v2;
  489|  14.1k|            U32 v3 = state->v3;
  490|  14.1k|            U32 v4 = state->v4;
  491|       |
  492|  34.5M|            do {
  493|  34.5M|                v1 = XXH32_round(v1, XXH_readLE32(p, endian)); p+=4;
  494|  34.5M|                v2 = XXH32_round(v2, XXH_readLE32(p, endian)); p+=4;
  495|  34.5M|                v3 = XXH32_round(v3, XXH_readLE32(p, endian)); p+=4;
  496|  34.5M|                v4 = XXH32_round(v4, XXH_readLE32(p, endian)); p+=4;
  497|  34.5M|            } while (p<=limit);
  ------------------
  |  Branch (497:22): [True: 34.5M, False: 14.1k]
  ------------------
  498|       |
  499|  14.1k|            state->v1 = v1;
  500|  14.1k|            state->v2 = v2;
  501|  14.1k|            state->v3 = v3;
  502|  14.1k|            state->v4 = v4;
  503|  14.1k|        }
  504|       |
  505|  14.8k|        if (p < bEnd) {
  ------------------
  |  Branch (505:13): [True: 13.2k, False: 1.59k]
  ------------------
  506|  13.2k|            XXH_memcpy(state->mem32, p, (size_t)(bEnd-p));
  507|  13.2k|            state->memsize = (unsigned)(bEnd-p);
  508|  13.2k|        }
  509|  14.8k|    }
  510|       |
  511|      0|    return XXH_OK;
  512|  25.2k|}
xxhash.c:XXH_memcpy:
  112|  28.7k|static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); }
xxhash.c:XXH_readLE32:
  243|   138M|{
  244|   138M|    return XXH_readLE32_align(ptr, endian, XXH_unaligned);
  245|   138M|}
xxhash.c:XXH32_digest_endian:
  528|  11.7k|{
  529|  11.7k|    U32 h32;
  530|       |
  531|  11.7k|    if (state->large_len) {
  ------------------
  |  Branch (531:9): [True: 10.1k, False: 1.66k]
  ------------------
  532|  10.1k|        h32 = XXH_rotl32(state->v1, 1)
  ------------------
  |  |  194|  10.1k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  533|  10.1k|            + XXH_rotl32(state->v2, 7)
  ------------------
  |  |  194|  10.1k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  534|  10.1k|            + XXH_rotl32(state->v3, 12)
  ------------------
  |  |  194|  10.1k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  535|  10.1k|            + XXH_rotl32(state->v4, 18);
  ------------------
  |  |  194|  10.1k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  536|  10.1k|    } else {
  537|  1.66k|        h32 = state->v3 /* == seed */ + PRIME32_5;
  538|  1.66k|    }
  539|       |
  540|  11.7k|    h32 += state->total_len_32;
  541|       |
  542|  11.7k|    return XXH32_finalize(h32, state->mem32, state->memsize, endian, XXH_aligned);
  543|  11.7k|}

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

LLVMFuzzerTestOneInput:
  131|  10.1k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
  132|  10.1k|    compress_independent_block_mode(data, size);
  133|  10.1k|    return 0;
  134|  10.1k|}
round_trip_frame_uncompressed_fuzzer.c:compress_independent_block_mode:
  123|  10.1k|static void compress_independent_block_mode(const uint8_t *data, size_t size) {
  124|  10.1k|    FUZZ_dataProducer_t *producer = FUZZ_dataProducer_create(data, size);
  125|  10.1k|    LZ4F_preferences_t prefs = FUZZ_dataProducer_preferences(producer);
  126|  10.1k|    prefs.frameInfo.blockMode = LZ4F_blockIndependent;
  127|  10.1k|    compress_round_trip(data, size, producer, prefs);
  128|  10.1k|}
round_trip_frame_uncompressed_fuzzer.c:compress_round_trip:
   44|  10.1k|                                FUZZ_dataProducer_t *producer, LZ4F_preferences_t const prefs) {
   45|       |
   46|       |    // Choose random uncompressed offset start and end by producing seeds from random data, calculate the remaining
   47|       |    // data size that will be used for compression later and use the seeds to actually calculate the offsets
   48|  10.1k|    size_t const uncompressedOffsetSeed = FUZZ_dataProducer_retrieve32(producer);
   49|  10.1k|    size_t const uncompressedEndOffsetSeed = FUZZ_dataProducer_retrieve32(producer);
   50|  10.1k|    size = FUZZ_dataProducer_remainingBytes(producer);
   51|       |
   52|  10.1k|    size_t const uncompressedOffset = FUZZ_getRange_from_uint32(uncompressedOffsetSeed, 0, size);
   53|  10.1k|    size_t const uncompressedEndOffset = FUZZ_getRange_from_uint32(uncompressedEndOffsetSeed, uncompressedOffset, size);
   54|  10.1k|    size_t const uncompressedSize = uncompressedEndOffset - uncompressedOffset;
   55|  10.1k|    FUZZ_ASSERT(uncompressedOffset <= uncompressedEndOffset);
  ------------------
  |  |   47|  10.1k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "");
  |  |  ------------------
  |  |  |  |   43|  10.1k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 10.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  10.1k|          : (fprintf(stderr, "%s: %u: Assertion: `%s' failed. %s\n", __FILE__, \
  |  |  |  |   45|      0|                     __LINE__, FUZZ_QUOTE(cond), (msg)),                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      0|#define FUZZ_QUOTE(str) FUZZ_QUOTE_IMPL(str)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   36|      0|#define FUZZ_QUOTE_IMPL(str) #str
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   46|      0|             abort()))
  |  |  ------------------
  ------------------
   56|  10.1k|    FUZZ_ASSERT(uncompressedEndOffset <= size);
  ------------------
  |  |   47|  10.1k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "");
  |  |  ------------------
  |  |  |  |   43|  10.1k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 10.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  10.1k|          : (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()))
  |  |  ------------------
  ------------------
   57|       |
   58|  10.1k|    const uint8_t *const uncompressedData = data + uncompressedOffset;
   59|       |
   60|  10.1k|    size_t const dstCapacity =
   61|  10.1k|            LZ4F_compressFrameBound(LZ4_compressBound(size), &prefs) +
   62|  10.1k|            uncompressedSize;
   63|  10.1k|    char *const dst = (char *) malloc(dstCapacity);
   64|  10.1k|    size_t rtCapacity = dstCapacity;
   65|  10.1k|    char *const rt = (char *) malloc(rtCapacity);
   66|       |
   67|  10.1k|    FUZZ_ASSERT(dst);
  ------------------
  |  |   47|  10.1k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "");
  |  |  ------------------
  |  |  |  |   43|  10.1k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 10.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  10.1k|          : (fprintf(stderr, "%s: %u: Assertion: `%s' failed. %s\n", __FILE__, \
  |  |  |  |   45|      0|                     __LINE__, FUZZ_QUOTE(cond), (msg)),                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      0|#define FUZZ_QUOTE(str) FUZZ_QUOTE_IMPL(str)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   36|      0|#define FUZZ_QUOTE_IMPL(str) #str
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   46|      0|             abort()))
  |  |  ------------------
  ------------------
   68|  10.1k|    FUZZ_ASSERT(rt);
  ------------------
  |  |   47|  10.1k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "");
  |  |  ------------------
  |  |  |  |   43|  10.1k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 10.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  10.1k|          : (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()))
  |  |  ------------------
  ------------------
   69|       |
   70|       |    /* Compression must succeed and round trip correctly. */
   71|  10.1k|    LZ4F_compressionContext_t ctx;
   72|  10.1k|    size_t const ctxCreation = LZ4F_createCompressionContext(&ctx, LZ4F_VERSION);
  ------------------
  |  |  252|  10.1k|#define LZ4F_VERSION 100    /* This number can be used to check for an incompatible API breaking change */
  ------------------
   73|  10.1k|    FUZZ_ASSERT(!LZ4F_isError(ctxCreation));
  ------------------
  |  |   47|  10.1k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "");
  |  |  ------------------
  |  |  |  |   43|  10.1k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 10.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  10.1k|          : (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()))
  |  |  ------------------
  ------------------
   74|       |
   75|  10.1k|    size_t const headerSize = LZ4F_compressBegin(ctx, dst, dstCapacity, &prefs);
   76|  10.1k|    FUZZ_ASSERT(!LZ4F_isError(headerSize));
  ------------------
  |  |   47|  10.1k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "");
  |  |  ------------------
  |  |  |  |   43|  10.1k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 10.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  10.1k|          : (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()))
  |  |  ------------------
  ------------------
   77|  10.1k|    size_t compressedSize = headerSize;
   78|       |
   79|       |    /* Compress data before uncompressed offset */
   80|  10.1k|    size_t lz4Return = LZ4F_compressUpdate(ctx, dst + compressedSize, dstCapacity,
   81|  10.1k|                                           data, uncompressedOffset, NULL);
   82|  10.1k|    FUZZ_ASSERT(!LZ4F_isError(lz4Return));
  ------------------
  |  |   47|  10.1k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "");
  |  |  ------------------
  |  |  |  |   43|  10.1k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 10.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  10.1k|          : (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()))
  |  |  ------------------
  ------------------
   83|  10.1k|    compressedSize += lz4Return;
   84|       |
   85|       |    /* Add uncompressed data */
   86|  10.1k|    lz4Return = LZ4F_uncompressedUpdate(ctx, dst + compressedSize, dstCapacity,
   87|  10.1k|                                        uncompressedData, uncompressedSize, NULL);
   88|  10.1k|    FUZZ_ASSERT(!LZ4F_isError(lz4Return));
  ------------------
  |  |   47|  10.1k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "");
  |  |  ------------------
  |  |  |  |   43|  10.1k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 10.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  10.1k|          : (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()))
  |  |  ------------------
  ------------------
   89|  10.1k|    compressedSize += lz4Return;
   90|       |
   91|       |    /* Compress data after uncompressed offset */
   92|  10.1k|    lz4Return = LZ4F_compressUpdate(ctx, dst + compressedSize, dstCapacity,
   93|  10.1k|                                    data + uncompressedEndOffset,
   94|  10.1k|                                    size - uncompressedEndOffset, NULL);
   95|  10.1k|    FUZZ_ASSERT(!LZ4F_isError(lz4Return));
  ------------------
  |  |   47|  10.1k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "");
  |  |  ------------------
  |  |  |  |   43|  10.1k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 10.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  10.1k|          : (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()))
  |  |  ------------------
  ------------------
   96|  10.1k|    compressedSize += lz4Return;
   97|       |
   98|       |    /* Finish compression */
   99|  10.1k|    lz4Return = LZ4F_compressEnd(ctx, dst + compressedSize, dstCapacity, NULL);
  100|  10.1k|    FUZZ_ASSERT(!LZ4F_isError(lz4Return));
  ------------------
  |  |   47|  10.1k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "");
  |  |  ------------------
  |  |  |  |   43|  10.1k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 10.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  10.1k|          : (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()))
  |  |  ------------------
  ------------------
  101|  10.1k|    compressedSize += lz4Return;
  102|       |
  103|  10.1k|    LZ4F_decompressOptions_t opts;
  104|  10.1k|    memset(&opts, 0, sizeof(opts));
  105|  10.1k|    opts.stableDst = 1;
  106|  10.1k|    LZ4F_dctx *dctx;
  107|  10.1k|    LZ4F_createDecompressionContext(&dctx, LZ4F_VERSION);
  ------------------
  |  |  252|  10.1k|#define LZ4F_VERSION 100    /* This number can be used to check for an incompatible API breaking change */
  ------------------
  108|  10.1k|    FUZZ_ASSERT(dctx);
  ------------------
  |  |   47|  10.1k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "");
  |  |  ------------------
  |  |  |  |   43|  10.1k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 10.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  10.1k|          : (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()))
  |  |  ------------------
  ------------------
  109|       |
  110|  10.1k|    decompress(dctx, dst, rt, rtCapacity, compressedSize);
  111|       |
  112|  10.1k|    LZ4F_freeDecompressionContext(dctx);
  113|       |
  114|  10.1k|    FUZZ_ASSERT_MSG(!memcmp(data, rt, size), "Corruption!");
  ------------------
  |  |   43|  10.1k|  ((cond) ? (void)0                                                            \
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 10.1k, False: 0]
  |  |  ------------------
  |  |   44|  10.1k|          : (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()))
  ------------------
  115|       |
  116|      0|    free(dst);
  117|  10.1k|    free(rt);
  118|       |
  119|  10.1k|    FUZZ_dataProducer_free(producer);
  120|  10.1k|    LZ4F_freeCompressionContext(ctx);
  121|  10.1k|}
round_trip_frame_uncompressed_fuzzer.c:decompress:
   19|  10.1k|                       size_t dstCapacity, size_t readSize) {
   20|  10.1k|    size_t ret = 1;
   21|  10.1k|    const void *srcPtr = (const char *) src;
   22|  10.1k|    void *dstPtr = (char *) dst;
   23|  10.1k|    const void *const srcEnd = (const char *) srcPtr + readSize;
   24|       |
   25|  20.3k|    while (ret != 0) {
  ------------------
  |  Branch (25:12): [True: 10.1k, False: 10.1k]
  ------------------
   26|  20.3k|        while (srcPtr < srcEnd && ret != 0) {
  ------------------
  |  Branch (26:16): [True: 10.1k, False: 10.1k]
  |  Branch (26:35): [True: 10.1k, False: 0]
  ------------------
   27|       |            /* Any data within dst has been flushed at this stage */
   28|  10.1k|            size_t dstSize = dstCapacity;
   29|  10.1k|            size_t srcSize = (const char *) srcEnd - (const char *) srcPtr;
   30|  10.1k|            ret = LZ4F_decompress(dctx, dstPtr, &dstSize, srcPtr, &srcSize,
   31|       |                    /* LZ4F_decompressOptions_t */ NULL);
   32|  10.1k|            FUZZ_ASSERT(!LZ4F_isError(ret));
  ------------------
  |  |   47|  10.1k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "");
  |  |  ------------------
  |  |  |  |   43|  10.1k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 10.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  10.1k|          : (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()))
  |  |  ------------------
  ------------------
   33|       |
   34|       |            /* Update input */
   35|  10.1k|            srcPtr = (const char *) srcPtr + srcSize;
   36|  10.1k|            dstPtr = (char *) dstPtr + dstSize;
   37|  10.1k|        }
   38|       |
   39|  10.1k|        FUZZ_ASSERT(srcPtr <= srcEnd);
  ------------------
  |  |   47|  10.1k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "");
  |  |  ------------------
  |  |  |  |   43|  10.1k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 10.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  10.1k|          : (fprintf(stderr, "%s: %u: Assertion: `%s' failed. %s\n", __FILE__, \
  |  |  |  |   45|      0|                     __LINE__, FUZZ_QUOTE(cond), (msg)),                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      0|#define FUZZ_QUOTE(str) FUZZ_QUOTE_IMPL(str)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   36|      0|#define FUZZ_QUOTE_IMPL(str) #str
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   46|      0|             abort()))
  |  |  ------------------
  ------------------
   40|  10.1k|    }
   41|  10.1k|}

