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

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

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

LZ4_XXH32:
  393|  28.6k|{
  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|  28.6k|    XXH_endianness endian_detected = (XXH_endianness)XXH_CPU_LITTLE_ENDIAN;
  ------------------
  |  |  225|  28.6k|#   define XXH_CPU_LITTLE_ENDIAN   XXH_isLittleEndian()
  ------------------
  402|       |
  403|  28.6k|    if (XXH_FORCE_ALIGN_CHECK) {
  ------------------
  |  |   95|  28.6k|#    define XXH_FORCE_ALIGN_CHECK 0
  |  |  ------------------
  |  |  |  Branch (95:35): [Folded, False: 28.6k]
  |  |  ------------------
  ------------------
  404|      0|        if ((((size_t)input) & 3) == 0) {   /* Input is 4-bytes aligned, leverage the speed benefit */
  ------------------
  |  Branch (404:13): [True: 0, False: 0]
  ------------------
  405|      0|            if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
  ------------------
  |  |   83|      0|#  define XXH_FORCE_NATIVE_FORMAT 0
  |  |  ------------------
  |  |  |  Branch (83:35): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (405:17): [True: 0, False: 0]
  ------------------
  406|      0|                return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned);
  407|      0|            else
  408|      0|                return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned);
  409|      0|    }   }
  410|       |
  411|  28.6k|    if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
  ------------------
  |  |   83|      0|#  define XXH_FORCE_NATIVE_FORMAT 0
  |  |  ------------------
  |  |  |  Branch (83:35): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (411:9): [True: 28.6k, False: 0]
  ------------------
  412|  28.6k|        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|  28.6k|#endif
  416|  28.6k|}
LZ4_XXH32_reset:
  438|  18.4k|{
  439|  18.4k|    XXH32_state_t state;   /* using a local state to memcpy() in order to avoid strict-aliasing warnings */
  440|  18.4k|    memset(&state, 0, sizeof(state));
  441|  18.4k|    state.v1 = seed + PRIME32_1 + PRIME32_2;
  442|  18.4k|    state.v2 = seed + PRIME32_2;
  443|  18.4k|    state.v3 = seed + 0;
  444|  18.4k|    state.v4 = seed - PRIME32_1;
  445|       |    /* do not write into reserved, planned to be removed in a future version */
  446|  18.4k|    memcpy(statePtr, &state, sizeof(state) - sizeof(state.reserved));
  447|  18.4k|    return XXH_OK;
  448|  18.4k|}
LZ4_XXH32_update:
  516|  27.2k|{
  517|  27.2k|    XXH_endianness endian_detected = (XXH_endianness)XXH_CPU_LITTLE_ENDIAN;
  ------------------
  |  |  225|  27.2k|#   define XXH_CPU_LITTLE_ENDIAN   XXH_isLittleEndian()
  ------------------
  518|       |
  519|  27.2k|    if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
  ------------------
  |  |   83|      0|#  define XXH_FORCE_NATIVE_FORMAT 0
  |  |  ------------------
  |  |  |  Branch (83:35): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (519:9): [True: 27.2k, False: 0]
  ------------------
  520|  27.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|  27.2k|}
LZ4_XXH32_digest:
  547|  12.6k|{
  548|  12.6k|    XXH_endianness endian_detected = (XXH_endianness)XXH_CPU_LITTLE_ENDIAN;
  ------------------
  |  |  225|  12.6k|#   define XXH_CPU_LITTLE_ENDIAN   XXH_isLittleEndian()
  ------------------
  549|       |
  550|  12.6k|    if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
  ------------------
  |  |   83|      0|#  define XXH_FORCE_NATIVE_FORMAT 0
  |  |  ------------------
  |  |  |  Branch (83:35): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (550:9): [True: 12.6k, False: 0]
  ------------------
  551|  12.6k|        return XXH32_digest_endian(state_in, XXH_littleEndian);
  552|      0|    else
  553|      0|        return XXH32_digest_endian(state_in, XXH_bigEndian);
  554|  12.6k|}
xxhash.c:XXH_isLittleEndian:
  221|  68.5k|{
  222|  68.5k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  223|  68.5k|    return one.c[0];
  224|  68.5k|}
xxhash.c:XXH32_endian_align:
  354|  28.6k|{
  355|  28.6k|    const BYTE* p = (const BYTE*)input;
  356|  28.6k|    const BYTE* bEnd = p + len;
  357|  28.6k|    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|  28.6k|    if (len>=16) {
  ------------------
  |  Branch (366:9): [True: 15.5k, False: 13.0k]
  ------------------
  367|  15.5k|        const BYTE* const limit = bEnd - 15;
  368|  15.5k|        U32 v1 = seed + PRIME32_1 + PRIME32_2;
  369|  15.5k|        U32 v2 = seed + PRIME32_2;
  370|  15.5k|        U32 v3 = seed + 0;
  371|  15.5k|        U32 v4 = seed - PRIME32_1;
  372|       |
  373|  15.4M|        do {
  374|  15.4M|            v1 = XXH32_round(v1, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  288|  15.4M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  375|  15.4M|            v2 = XXH32_round(v2, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  288|  15.4M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  376|  15.4M|            v3 = XXH32_round(v3, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  288|  15.4M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  377|  15.4M|            v4 = XXH32_round(v4, XXH_get32bits(p)); p+=4;
  ------------------
  |  |  288|  15.4M|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  ------------------
  378|  15.4M|        } while (p < limit);
  ------------------
  |  Branch (378:18): [True: 15.4M, False: 15.5k]
  ------------------
  379|       |
  380|  15.5k|        h32 = XXH_rotl32(v1, 1)  + XXH_rotl32(v2, 7)
  ------------------
  |  |  194|  15.5k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
                      h32 = XXH_rotl32(v1, 1)  + XXH_rotl32(v2, 7)
  ------------------
  |  |  194|  15.5k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  381|  15.5k|            + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18);
  ------------------
  |  |  194|  15.5k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
                          + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18);
  ------------------
  |  |  194|  15.5k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  382|  15.5k|    } else {
  383|  13.0k|        h32  = seed + PRIME32_5;
  384|  13.0k|    }
  385|       |
  386|  28.6k|    h32 += (U32)len;
  387|       |
  388|  28.6k|    return XXH32_finalize(h32, p, len&15, endian, align);
  389|  28.6k|}
xxhash.c:XXH32_round:
  270|   243M|{
  271|   243M|    seed += input * PRIME32_2;
  272|   243M|    seed  = XXH_rotl32(seed, 13);
  ------------------
  |  |  194|   243M|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  273|   243M|    seed *= PRIME32_1;
  274|   243M|    return seed;
  275|   243M|}
xxhash.c:XXH_readLE32_align:
  235|   243M|{
  236|   243M|    if (align==XXH_unaligned)
  ------------------
  |  Branch (236:9): [True: 243M, False: 18.1k]
  ------------------
  237|   243M|        return endian==XXH_littleEndian ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr));
  ------------------
  |  Branch (237:16): [True: 243M, False: 0]
  ------------------
  238|  18.1k|    else
  239|  18.1k|        return endian==XXH_littleEndian ? *(const U32*)ptr : XXH_swap32(*(const U32*)ptr);
  ------------------
  |  Branch (239:16): [True: 18.1k, False: 0]
  ------------------
  240|   243M|}
xxhash.c:XXH_read32:
  175|   243M|{
  176|   243M|    U32 val;
  177|   243M|    memcpy(&val, memPtr, sizeof(val));
  178|   243M|    return val;
  179|   243M|}
xxhash.c:XXH32_finalize:
  294|  41.3k|{
  295|  41.3k|    const BYTE* p = (const BYTE*)ptr;
  296|       |
  297|  41.3k|#define PROCESS1               \
  298|  41.3k|    h32 += (*p++) * PRIME32_5; \
  299|  41.3k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  300|       |
  301|  41.3k|#define PROCESS4                         \
  302|  41.3k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  303|  41.3k|    p+=4;                                \
  304|  41.3k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  305|       |
  306|  41.3k|    switch(len&15)  /* or switch(bEnd - p) */
  ------------------
  |  Branch (306:12): [True: 41.3k, False: 0]
  ------------------
  307|  41.3k|    {
  308|  1.81k|      case 12:      PROCESS4;
  ------------------
  |  |  302|  1.81k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  1.81k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  1.81k|    p+=4;                                \
  |  |  304|  1.81k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  1.81k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (308:7): [True: 1.81k, False: 39.4k]
  ------------------
  309|       |                    /* fallthrough */
  310|  3.41k|      case 8:       PROCESS4;
  ------------------
  |  |  302|  3.41k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  3.41k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  3.41k|    p+=4;                                \
  |  |  304|  3.41k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  3.41k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (310:7): [True: 1.59k, False: 39.7k]
  ------------------
  311|       |                    /* fallthrough */
  312|  4.96k|      case 4:       PROCESS4;
  ------------------
  |  |  302|  4.96k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  4.96k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  4.96k|    p+=4;                                \
  |  |  304|  4.96k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  4.96k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (312:7): [True: 1.54k, False: 39.7k]
  ------------------
  313|  4.96k|                    return XXH32_avalanche(h32);
  314|       |
  315|  1.77k|      case 13:      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 (315:7): [True: 1.77k, False: 39.5k]
  ------------------
  316|       |                    /* fallthrough */
  317|  3.18k|      case 9:       PROCESS4;
  ------------------
  |  |  302|  3.18k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  3.18k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  3.18k|    p+=4;                                \
  |  |  304|  3.18k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  3.18k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (317:7): [True: 1.41k, False: 39.8k]
  ------------------
  318|       |                    /* fallthrough */
  319|  4.95k|      case 5:       PROCESS4;
  ------------------
  |  |  302|  4.95k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  4.95k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  4.95k|    p+=4;                                \
  |  |  304|  4.95k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  4.95k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (319:7): [True: 1.76k, False: 39.5k]
  ------------------
  320|  4.95k|                    PROCESS1;
  ------------------
  |  |  298|  4.95k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  4.95k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  4.95k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  321|  4.95k|                    return XXH32_avalanche(h32);
  322|       |
  323|  2.07k|      case 14:      PROCESS4;
  ------------------
  |  |  302|  2.07k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  2.07k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  2.07k|    p+=4;                                \
  |  |  304|  2.07k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  2.07k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (323:7): [True: 2.07k, False: 39.2k]
  ------------------
  324|       |                    /* fallthrough */
  325|  3.65k|      case 10:      PROCESS4;
  ------------------
  |  |  302|  3.65k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  3.65k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  3.65k|    p+=4;                                \
  |  |  304|  3.65k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  3.65k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (325:7): [True: 1.57k, False: 39.7k]
  ------------------
  326|       |                    /* fallthrough */
  327|  5.25k|      case 6:       PROCESS4;
  ------------------
  |  |  302|  5.25k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  5.25k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  5.25k|    p+=4;                                \
  |  |  304|  5.25k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  5.25k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (327:7): [True: 1.60k, False: 39.7k]
  ------------------
  328|  5.25k|                    PROCESS1;
  ------------------
  |  |  298|  5.25k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  5.25k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  5.25k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  329|  5.25k|                    PROCESS1;
  ------------------
  |  |  298|  5.25k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  5.25k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  5.25k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  330|  5.25k|                    return XXH32_avalanche(h32);
  331|       |
  332|  2.10k|      case 15:      PROCESS4;
  ------------------
  |  |  302|  2.10k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  2.10k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  2.10k|    p+=4;                                \
  |  |  304|  2.10k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  2.10k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (332:7): [True: 2.10k, False: 39.2k]
  ------------------
  333|       |                    /* fallthrough */
  334|  4.15k|      case 11:      PROCESS4;
  ------------------
  |  |  302|  4.15k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  4.15k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  4.15k|    p+=4;                                \
  |  |  304|  4.15k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  4.15k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (334:7): [True: 2.05k, False: 39.2k]
  ------------------
  335|       |                    /* fallthrough */
  336|  5.78k|      case 7:       PROCESS4;
  ------------------
  |  |  302|  5.78k|    h32 += XXH_get32bits(p) * PRIME32_3; \
  |  |  ------------------
  |  |  |  |  288|  5.78k|#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
  |  |  ------------------
  |  |  303|  5.78k|    p+=4;                                \
  |  |  304|  5.78k|    h32  = XXH_rotl32(h32, 17) * PRIME32_4 ;
  |  |  ------------------
  |  |  |  |  194|  5.78k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (336:7): [True: 1.62k, False: 39.6k]
  ------------------
  337|       |                    /* fallthrough */
  338|  7.70k|      case 3:       PROCESS1;
  ------------------
  |  |  298|  7.70k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  7.70k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  7.70k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (338:7): [True: 1.92k, False: 39.3k]
  ------------------
  339|       |                    /* fallthrough */
  340|  20.7k|      case 2:       PROCESS1;
  ------------------
  |  |  298|  20.7k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  20.7k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  20.7k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (340:7): [True: 13.0k, False: 28.2k]
  ------------------
  341|       |                    /* fallthrough */
  342|  23.4k|      case 1:       PROCESS1;
  ------------------
  |  |  298|  23.4k|    h32 += (*p++) * PRIME32_5; \
  |  |  299|  23.4k|    h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
  |  |  ------------------
  |  |  |  |  194|  23.4k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  |  |  ------------------
  ------------------
  |  Branch (342:7): [True: 2.69k, False: 38.6k]
  ------------------
  343|       |                    /* fallthrough */
  344|  26.1k|      case 0:       return XXH32_avalanche(h32);
  ------------------
  |  Branch (344:7): [True: 2.70k, False: 38.6k]
  ------------------
  345|  41.3k|    }
  346|  41.3k|    assert(0);
  ------------------
  |  Branch (346:5): [Folded, False: 0]
  |  Branch (346:5): [Folded, False: 0]
  ------------------
  347|      0|    return h32;   /* reaching this point is deemed impossible */
  348|      0|}
xxhash.c:XXH32_avalanche:
  279|  41.3k|{
  280|  41.3k|    h32 ^= h32 >> 15;
  281|  41.3k|    h32 *= PRIME32_2;
  282|  41.3k|    h32 ^= h32 >> 13;
  283|  41.3k|    h32 *= PRIME32_3;
  284|  41.3k|    h32 ^= h32 >> 16;
  285|  41.3k|    return(h32);
  286|  41.3k|}
xxhash.c:XXH32_update_endian:
  453|  27.2k|{
  454|  27.2k|    if (input==NULL)
  ------------------
  |  Branch (454:9): [True: 0, False: 27.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|  27.2k|#endif
  460|       |
  461|  27.2k|    {   const BYTE* p = (const BYTE*)input;
  462|  27.2k|        const BYTE* const bEnd = p + len;
  463|       |
  464|  27.2k|        state->total_len_32 += (unsigned)len;
  465|  27.2k|        state->large_len |= (len>=16) | (state->total_len_32>=16);
  466|       |
  467|  27.2k|        if (state->memsize + len < 16)  {   /* fill in tmp buffer */
  ------------------
  |  Branch (467:13): [True: 10.8k, False: 16.4k]
  ------------------
  468|  10.8k|            XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, len);
  469|  10.8k|            state->memsize += (unsigned)len;
  470|  10.8k|            return XXH_OK;
  471|  10.8k|        }
  472|       |
  473|  16.4k|        if (state->memsize) {   /* some data left from previous update */
  ------------------
  |  Branch (473:13): [True: 5.90k, False: 10.5k]
  ------------------
  474|  5.90k|            XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, 16-state->memsize);
  475|  5.90k|            {   const U32* p32 = state->mem32;
  476|  5.90k|                state->v1 = XXH32_round(state->v1, XXH_readLE32(p32, endian)); p32++;
  477|  5.90k|                state->v2 = XXH32_round(state->v2, XXH_readLE32(p32, endian)); p32++;
  478|  5.90k|                state->v3 = XXH32_round(state->v3, XXH_readLE32(p32, endian)); p32++;
  479|  5.90k|                state->v4 = XXH32_round(state->v4, XXH_readLE32(p32, endian));
  480|  5.90k|            }
  481|  5.90k|            p += 16-state->memsize;
  482|  5.90k|            state->memsize = 0;
  483|  5.90k|        }
  484|       |
  485|  16.4k|        if (p <= bEnd-16) {
  ------------------
  |  Branch (485:13): [True: 15.6k, False: 741]
  ------------------
  486|  15.6k|            const BYTE* const limit = bEnd - 16;
  487|  15.6k|            U32 v1 = state->v1;
  488|  15.6k|            U32 v2 = state->v2;
  489|  15.6k|            U32 v3 = state->v3;
  490|  15.6k|            U32 v4 = state->v4;
  491|       |
  492|  45.2M|            do {
  493|  45.2M|                v1 = XXH32_round(v1, XXH_readLE32(p, endian)); p+=4;
  494|  45.2M|                v2 = XXH32_round(v2, XXH_readLE32(p, endian)); p+=4;
  495|  45.2M|                v3 = XXH32_round(v3, XXH_readLE32(p, endian)); p+=4;
  496|  45.2M|                v4 = XXH32_round(v4, XXH_readLE32(p, endian)); p+=4;
  497|  45.2M|            } while (p<=limit);
  ------------------
  |  Branch (497:22): [True: 45.2M, False: 15.6k]
  ------------------
  498|       |
  499|  15.6k|            state->v1 = v1;
  500|  15.6k|            state->v2 = v2;
  501|  15.6k|            state->v3 = v3;
  502|  15.6k|            state->v4 = v4;
  503|  15.6k|        }
  504|       |
  505|  16.4k|        if (p < bEnd) {
  ------------------
  |  Branch (505:13): [True: 14.6k, False: 1.72k]
  ------------------
  506|  14.6k|            XXH_memcpy(state->mem32, p, (size_t)(bEnd-p));
  507|  14.6k|            state->memsize = (unsigned)(bEnd-p);
  508|  14.6k|        }
  509|  16.4k|    }
  510|       |
  511|      0|    return XXH_OK;
  512|  27.2k|}
xxhash.c:XXH_memcpy:
  112|  31.4k|static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); }
xxhash.c:XXH_readLE32:
  243|   181M|{
  244|   181M|    return XXH_readLE32_align(ptr, endian, XXH_unaligned);
  245|   181M|}
xxhash.c:XXH32_digest_endian:
  528|  12.6k|{
  529|  12.6k|    U32 h32;
  530|       |
  531|  12.6k|    if (state->large_len) {
  ------------------
  |  Branch (531:9): [True: 10.8k, False: 1.81k]
  ------------------
  532|  10.8k|        h32 = XXH_rotl32(state->v1, 1)
  ------------------
  |  |  194|  10.8k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  533|  10.8k|            + XXH_rotl32(state->v2, 7)
  ------------------
  |  |  194|  10.8k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  534|  10.8k|            + XXH_rotl32(state->v3, 12)
  ------------------
  |  |  194|  10.8k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  535|  10.8k|            + XXH_rotl32(state->v4, 18);
  ------------------
  |  |  194|  10.8k|#  define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
  ------------------
  536|  10.8k|    } else {
  537|  1.81k|        h32 = state->v3 /* == seed */ + PRIME32_5;
  538|  1.81k|    }
  539|       |
  540|  12.6k|    h32 += state->total_len_32;
  541|       |
  542|  12.6k|    return XXH32_finalize(h32, state->mem32, state->memsize, endian, XXH_aligned);
  543|  12.6k|}

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

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

