LZ4_compressBound:
  747|  7.16k|int LZ4_compressBound(int isize)  { return LZ4_COMPRESSBOUND(isize); }
  ------------------
  |  |  215|  7.16k|#define LZ4_COMPRESSBOUND(isize)  ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
  |  |  ------------------
  |  |  |  |  214|  7.16k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  |  |  ------------------
  |  |  |  Branch (215:36): [True: 0, False: 7.16k]
  |  |  ------------------
  ------------------
LZ4_compress_fast_extState:
 1379|  2.80k|{
 1380|  2.80k|    LZ4_stream_t_internal* const ctx = & LZ4_initStream(state, sizeof(LZ4_stream_t)) -> internal_donotuse;
 1381|  2.80k|    assert(ctx != NULL);
  ------------------
  |  Branch (1381:5): [True: 0, False: 2.80k]
  |  Branch (1381:5): [True: 2.80k, False: 0]
  ------------------
 1382|  2.80k|    if (acceleration < 1) acceleration = LZ4_ACCELERATION_DEFAULT;
  ------------------
  |  |   52|      0|#define LZ4_ACCELERATION_DEFAULT 1
  ------------------
  |  Branch (1382:9): [True: 0, False: 2.80k]
  ------------------
 1383|  2.80k|    if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX;
  ------------------
  |  |   58|  2.80k|#define LZ4_ACCELERATION_MAX 65537
  ------------------
                  if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX;
  ------------------
  |  |   58|      0|#define LZ4_ACCELERATION_MAX 65537
  ------------------
  |  Branch (1383:9): [True: 0, False: 2.80k]
  ------------------
 1384|  2.80k|    if (maxOutputSize >= LZ4_compressBound(inputSize)) {
  ------------------
  |  Branch (1384:9): [True: 1.24k, False: 1.56k]
  ------------------
 1385|  1.24k|        if (inputSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1385:13): [True: 1.24k, False: 0]
  ------------------
 1386|  1.24k|            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, 0, notLimited, byU16, noDict, noDictIssue, acceleration);
 1387|  1.24k|        } else {
 1388|      0|            const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)source > LZ4_DISTANCE_MAX)) ? byPtr : byU32;
  ------------------
  |  |  676|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1388:44): [Folded, False: 0]
  |  Branch (1388:66): [True: 0, False: 0]
  ------------------
 1389|      0|            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, 0, notLimited, tableType, noDict, noDictIssue, acceleration);
 1390|      0|        }
 1391|  1.56k|    } else {
 1392|  1.56k|        if (inputSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1392:13): [True: 1.28k, False: 280]
  ------------------
 1393|  1.28k|            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, byU16, noDict, noDictIssue, acceleration);
 1394|  1.28k|        } else {
 1395|    280|            const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)source > LZ4_DISTANCE_MAX)) ? byPtr : byU32;
  ------------------
  |  |  676|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1395:44): [Folded, False: 280]
  |  Branch (1395:66): [True: 0, False: 0]
  ------------------
 1396|       |            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, noDict, noDictIssue, acceleration);
 1397|    280|        }
 1398|  1.56k|    }
 1399|  2.80k|}
LZ4_compress_fast:
 1450|  2.18k|{
 1451|  2.18k|    int result;
 1452|       |#if (LZ4_HEAPMODE)
 1453|       |    LZ4_stream_t* const ctxPtr = (LZ4_stream_t*)ALLOC(sizeof(LZ4_stream_t));   /* malloc-calloc always properly aligned */
 1454|       |    if (ctxPtr == NULL) return 0;
 1455|       |#else
 1456|  2.18k|    LZ4_stream_t ctx;
 1457|  2.18k|    LZ4_stream_t* const ctxPtr = &ctx;
 1458|  2.18k|#endif
 1459|  2.18k|    result = LZ4_compress_fast_extState(ctxPtr, src, dest, srcSize, dstCapacity, acceleration);
 1460|       |
 1461|       |#if (LZ4_HEAPMODE)
 1462|       |    FREEMEM(ctxPtr);
 1463|       |#endif
 1464|  2.18k|    return result;
 1465|  2.18k|}
LZ4_compress_default:
 1469|  2.18k|{
 1470|  2.18k|    return LZ4_compress_fast(src, dst, srcSize, dstCapacity, 1);
 1471|  2.18k|}
LZ4_compress_destSize:
 1503|  2.17k|{
 1504|       |#if (LZ4_HEAPMODE)
 1505|       |    LZ4_stream_t* const ctx = (LZ4_stream_t*)ALLOC(sizeof(LZ4_stream_t));   /* malloc-calloc always properly aligned */
 1506|       |    if (ctx == NULL) return 0;
 1507|       |#else
 1508|  2.17k|    LZ4_stream_t ctxBody;
 1509|  2.17k|    LZ4_stream_t* const ctx = &ctxBody;
 1510|  2.17k|#endif
 1511|       |
 1512|  2.17k|    int result = LZ4_compress_destSize_extState_internal(ctx, src, dst, srcSizePtr, targetDstSize, 1);
 1513|       |
 1514|       |#if (LZ4_HEAPMODE)
 1515|       |    FREEMEM(ctx);
 1516|       |#endif
 1517|  2.17k|    return result;
 1518|  2.17k|}
LZ4_initStream:
 1549|  4.97k|{
 1550|  4.97k|    DEBUGLOG(5, "LZ4_initStream");
  ------------------
  |  |  290|  4.97k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1551|  4.97k|    if (buffer == NULL) { return NULL; }
  ------------------
  |  Branch (1551:9): [True: 0, False: 4.97k]
  ------------------
 1552|  4.97k|    if (size < sizeof(LZ4_stream_t)) { return NULL; }
  ------------------
  |  Branch (1552:9): [True: 0, False: 4.97k]
  ------------------
 1553|  4.97k|    if (!LZ4_isAligned(buffer, LZ4_stream_t_alignment())) return NULL;
  ------------------
  |  Branch (1553:9): [True: 0, False: 4.97k]
  ------------------
 1554|  4.97k|    MEM_INIT(buffer, 0, sizeof(LZ4_stream_t_internal));
  ------------------
  |  |  237|  4.97k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  235|  4.97k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 1555|  4.97k|    return (LZ4_stream_t*)buffer;
 1556|  4.97k|}
LZ4_decompress_safe:
 2448|  3.77k|{
 2449|  3.77k|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2450|  3.77k|                                  decode_full_block, noDict,
 2451|       |                                  (BYTE*)dest, NULL, 0);
 2452|  3.77k|}
lz4.c:LZ4_compress_generic:
 1352|  4.35k|{
 1353|  4.35k|    DEBUGLOG(5, "LZ4_compress_generic: srcSize=%i, dstCapacity=%i",
  ------------------
  |  |  290|  4.35k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1354|  4.35k|                srcSize, dstCapacity);
 1355|       |
 1356|  4.35k|    if ((U32)srcSize > (U32)LZ4_MAX_INPUT_SIZE) { return 0; }  /* Unsupported srcSize, too large (or negative) */
  ------------------
  |  |  214|  4.35k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  ------------------
  |  Branch (1356:9): [True: 0, False: 4.35k]
  ------------------
 1357|  4.35k|    if (srcSize == 0) {   /* src == NULL supported if srcSize == 0 */
  ------------------
  |  Branch (1357:9): [True: 19, False: 4.33k]
  ------------------
 1358|     19|        if (outputDirective != notLimited && dstCapacity <= 0) return 0;  /* no output, can't write anything */
  ------------------
  |  Branch (1358:13): [True: 17, False: 2]
  |  Branch (1358:46): [True: 1, False: 16]
  ------------------
 1359|     18|        DEBUGLOG(5, "Generating an empty block");
  ------------------
  |  |  290|     18|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1360|     18|        assert(outputDirective == notLimited || dstCapacity >= 1);
  ------------------
  |  Branch (1360:9): [True: 18, False: 0]
  |  Branch (1360:9): [True: 0, False: 0]
  |  Branch (1360:9): [True: 2, False: 16]
  |  Branch (1360:9): [True: 16, False: 0]
  ------------------
 1361|     18|        assert(dst != NULL);
  ------------------
  |  Branch (1361:9): [True: 0, False: 18]
  |  Branch (1361:9): [True: 18, False: 0]
  ------------------
 1362|     18|        dst[0] = 0;
 1363|     18|        if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1363:13): [True: 8, False: 10]
  ------------------
 1364|      8|            assert (inputConsumed != NULL);
  ------------------
  |  Branch (1364:13): [True: 0, False: 8]
  |  Branch (1364:13): [True: 8, False: 0]
  ------------------
 1365|      8|            *inputConsumed = 0;
 1366|      8|        }
 1367|     18|        return 1;
 1368|     18|    }
 1369|  4.35k|    assert(src != NULL);
  ------------------
  |  Branch (1369:5): [True: 0, False: 4.33k]
  |  Branch (1369:5): [True: 4.33k, False: 0]
  ------------------
 1370|       |
 1371|  4.33k|    return LZ4_compress_generic_validated(cctx, src, dst, srcSize,
 1372|  4.33k|                inputConsumed, /* only written into if outputDirective == fillOutput */
 1373|  4.33k|                dstCapacity, outputDirective,
 1374|  4.33k|                tableType, dictDirective, dictIssue, acceleration);
 1375|  4.33k|}
lz4.c:LZ4_compress_generic_validated:
  938|  4.33k|{
  939|  4.33k|    int result;
  940|  4.33k|    const BYTE* ip = (const BYTE*)source;
  941|       |
  942|  4.33k|    U32 const startIndex = cctx->currentOffset;
  943|  4.33k|    const BYTE* base = (const BYTE*)source - startIndex;
  944|  4.33k|    const BYTE* lowLimit;
  945|       |
  946|  4.33k|    const LZ4_stream_t_internal* dictCtx = (const LZ4_stream_t_internal*) cctx->dictCtx;
  947|  4.33k|    const BYTE* const dictionary =
  948|  4.33k|        dictDirective == usingDictCtx ? dictCtx->dictionary : cctx->dictionary;
  ------------------
  |  Branch (948:9): [True: 0, False: 4.33k]
  ------------------
  949|  4.33k|    const U32 dictSize =
  950|  4.33k|        dictDirective == usingDictCtx ? dictCtx->dictSize : cctx->dictSize;
  ------------------
  |  Branch (950:9): [True: 0, False: 4.33k]
  ------------------
  951|  4.33k|    const U32 dictDelta =
  952|  4.33k|        (dictDirective == usingDictCtx) ? startIndex - dictCtx->currentOffset : 0;   /* make indexes in dictCtx comparable with indexes in current context */
  ------------------
  |  Branch (952:9): [True: 0, False: 4.33k]
  ------------------
  953|       |
  954|  4.33k|    int const maybe_extMem = (dictDirective == usingExtDict) || (dictDirective == usingDictCtx);
  ------------------
  |  Branch (954:30): [True: 0, False: 4.33k]
  |  Branch (954:65): [True: 0, False: 4.33k]
  ------------------
  955|  4.33k|    U32 const prefixIdxLimit = startIndex - dictSize;   /* used when dictDirective == dictSmall */
  956|  4.33k|    const BYTE* const dictEnd = dictionary ? dictionary + dictSize : dictionary;
  ------------------
  |  Branch (956:33): [True: 0, False: 4.33k]
  ------------------
  957|  4.33k|    const BYTE* anchor = (const BYTE*) source;
  958|  4.33k|    const BYTE* const iend = ip + inputSize;
  959|  4.33k|    const BYTE* const mflimitPlusOne = iend - MFLIMIT + 1;
  ------------------
  |  |  247|  4.33k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  960|  4.33k|    const BYTE* const matchlimit = iend - LASTLITERALS;
  ------------------
  |  |  246|  4.33k|#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|  4.33k|    const BYTE* dictBase = (dictionary == NULL) ? NULL :
  ------------------
  |  Branch (964:28): [True: 4.33k, False: 0]
  ------------------
  965|  4.33k|                           (dictDirective == usingDictCtx) ?
  ------------------
  |  Branch (965:28): [True: 0, False: 0]
  ------------------
  966|      0|                            dictionary + dictSize - dictCtx->currentOffset :
  967|      0|                            dictionary + dictSize - startIndex;
  968|       |
  969|  4.33k|    BYTE* op = (BYTE*) dest;
  970|  4.33k|    BYTE* const olimit = op + maxOutputSize;
  971|       |
  972|  4.33k|    U32 offset = 0;
  973|  4.33k|    U32 forwardH;
  974|       |
  975|  4.33k|    DEBUGLOG(5, "LZ4_compress_generic_validated: srcSize=%i, tableType=%u", inputSize, tableType);
  ------------------
  |  |  290|  4.33k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  976|  4.33k|    assert(ip != NULL);
  ------------------
  |  Branch (976:5): [True: 0, False: 4.33k]
  |  Branch (976:5): [True: 4.33k, False: 0]
  ------------------
  977|  4.33k|    if (tableType == byU16) assert(inputSize<LZ4_64Klimit);  /* Size too large (not within 64K limit) */
  ------------------
  |  Branch (977:9): [True: 3.78k, False: 552]
  |  Branch (977:29): [True: 0, False: 3.78k]
  |  Branch (977:29): [True: 3.78k, False: 0]
  ------------------
  978|  4.33k|    if (tableType == byPtr) assert(dictDirective==noDict);   /* only supported use case with byPtr */
  ------------------
  |  Branch (978:9): [True: 0, False: 4.33k]
  |  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|  4.33k|    if (outputDirective == fillOutput && maxOutputSize < 1) { return 0; } /* Impossible to store anything */
  ------------------
  |  Branch (981:9): [True: 1.54k, False: 2.79k]
  |  Branch (981:42): [True: 0, False: 1.54k]
  ------------------
  982|  4.33k|    assert(acceleration >= 1);
  ------------------
  |  Branch (982:5): [True: 0, False: 4.33k]
  |  Branch (982:5): [True: 4.33k, False: 0]
  ------------------
  983|       |
  984|  4.33k|    lowLimit = (const BYTE*)source - (dictDirective == withPrefix64k ? dictSize : 0);
  ------------------
  |  Branch (984:39): [True: 0, False: 4.33k]
  ------------------
  985|       |
  986|       |    /* Update context state */
  987|  4.33k|    if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (987:9): [True: 0, False: 4.33k]
  ------------------
  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|  4.33k|    } else {
  993|  4.33k|        cctx->dictSize += (U32)inputSize;
  994|  4.33k|    }
  995|  4.33k|    cctx->currentOffset += (U32)inputSize;
  996|  4.33k|    cctx->tableType = (U32)tableType;
  997|       |
  998|  4.33k|    if (inputSize<LZ4_minLength) goto _last_literals;        /* Input too small, no compression (all literals) */
  ------------------
  |  Branch (998:9): [True: 58, False: 4.27k]
  ------------------
  999|       |
 1000|       |    /* First Byte */
 1001|  4.27k|    {   U32 const h = LZ4_hashPosition(ip, tableType);
 1002|  4.27k|        if (tableType == byPtr) {
  ------------------
  |  Branch (1002:13): [True: 0, False: 4.27k]
  ------------------
 1003|      0|            LZ4_putPositionOnHash(ip, h, cctx->hashTable, byPtr);
 1004|  4.27k|        } else {
 1005|  4.27k|            LZ4_putIndexOnHash(startIndex, h, cctx->hashTable, tableType);
 1006|  4.27k|    }   }
 1007|  4.27k|    ip++; forwardH = LZ4_hashPosition(ip, tableType);
 1008|       |
 1009|       |    /* Main Loop */
 1010|  17.9k|    for ( ; ; ) {
 1011|  17.9k|        const BYTE* match;
 1012|  17.9k|        BYTE* token;
 1013|  17.9k|        const BYTE* filledIp;
 1014|       |
 1015|       |        /* Find a match */
 1016|  17.9k|        if (tableType == byPtr) {
  ------------------
  |  Branch (1016:13): [True: 0, False: 17.9k]
  ------------------
 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|  17.9k|        } else {   /* byU32, byU16 */
 1037|       |
 1038|  17.9k|            const BYTE* forwardIp = ip;
 1039|  17.9k|            int step = 1;
 1040|  17.9k|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1041|   543k|            do {
 1042|   543k|                U32 const h = forwardH;
 1043|   543k|                U32 const current = (U32)(forwardIp - base);
 1044|   543k|                U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1045|   543k|                assert(matchIndex <= current);
  ------------------
  |  Branch (1045:17): [True: 0, False: 543k]
  |  Branch (1045:17): [True: 543k, False: 0]
  ------------------
 1046|   543k|                assert(forwardIp - base < (ptrdiff_t)(2 GB - 1));
  ------------------
  |  Branch (1046:17): [True: 0, False: 543k]
  |  Branch (1046:17): [True: 543k, False: 0]
  ------------------
 1047|   543k|                ip = forwardIp;
 1048|   543k|                forwardIp += step;
 1049|   543k|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1050|       |
 1051|   543k|                if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
  ------------------
  |  |  181|   543k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   543k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.69k, False: 541k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1052|   543k|                assert(ip < mflimitPlusOne);
  ------------------
  |  Branch (1052:17): [True: 0, False: 541k]
  |  Branch (1052:17): [True: 541k, False: 0]
  ------------------
 1053|       |
 1054|   541k|                if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1054:21): [True: 0, False: 541k]
  ------------------
 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|   541k|                } else if (dictDirective == usingExtDict) {
  ------------------
  |  Branch (1066:28): [True: 0, False: 541k]
  ------------------
 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|   541k|                } else {   /* single continuous memory segment */
 1078|   541k|                    match = base + matchIndex;
 1079|   541k|                }
 1080|   541k|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1081|   541k|                LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1082|       |
 1083|   541k|                DEBUGLOG(7, "candidate at pos=%u  (offset=%u \n", matchIndex, current - matchIndex);
  ------------------
  |  |  290|   541k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1084|   541k|                if ((dictIssue == dictSmall) && (matchIndex < prefixIdxLimit)) { continue; }    /* match outside of valid area */
  ------------------
  |  Branch (1084:21): [True: 0, False: 541k]
  |  Branch (1084:49): [True: 0, False: 0]
  ------------------
 1085|   541k|                assert(matchIndex < current);
  ------------------
  |  Branch (1085:17): [True: 0, False: 541k]
  |  Branch (1085:17): [True: 541k, False: 0]
  ------------------
 1086|   541k|                if ( ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  676|  87.3k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                              if ( ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  256|  87.3k|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
  |  Branch (1086:23): [True: 454k, False: 87.3k]
  |  Branch (1086:47): [Folded, False: 0]
  ------------------
 1087|   454k|                  && (matchIndex+LZ4_DISTANCE_MAX < current)) {
  ------------------
  |  |  676|   454k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1087:22): [True: 173k, False: 280k]
  ------------------
 1088|   173k|                    continue;
 1089|   173k|                } /* too far */
 1090|   541k|                assert((current - matchIndex) <= LZ4_DISTANCE_MAX);  /* match now expected within distance */
  ------------------
  |  Branch (1090:17): [True: 0, False: 368k]
  |  Branch (1090:17): [True: 368k, False: 0]
  ------------------
 1091|       |
 1092|   368k|                if (LZ4_read32(match) == LZ4_read32(ip)) {
  ------------------
  |  Branch (1092:21): [True: 16.2k, False: 352k]
  ------------------
 1093|  16.2k|                    if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1093:25): [True: 0, False: 16.2k]
  ------------------
 1094|  16.2k|                    break;   /* match found */
 1095|  16.2k|                }
 1096|       |
 1097|   525k|            } while(1);
  ------------------
  |  Branch (1097:21): [True: 525k, Folded]
  ------------------
 1098|  17.9k|        }
 1099|       |
 1100|       |        /* Catch up */
 1101|  16.2k|        filledIp = ip;
 1102|  16.2k|        assert(ip > anchor); /* this is always true as ip has been advanced before entering the main loop */
  ------------------
  |  Branch (1102:9): [True: 0, False: 16.2k]
  |  Branch (1102:9): [True: 16.2k, False: 0]
  ------------------
 1103|  16.2k|        if ((match > lowLimit) && unlikely(ip[-1] == match[-1])) {
  ------------------
  |  |  181|  13.4k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  13.4k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.24k, False: 12.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1103:13): [True: 13.4k, False: 2.78k]
  ------------------
 1104|  30.4k|            do { ip--; match--; } while (((ip > anchor) & (match > lowLimit)) && (unlikely(ip[-1] == match[-1])));
  ------------------
  |  |  181|  29.7k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  29.7k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1104:42): [True: 29.7k, False: 678]
  |  Branch (1104:82): [True: 29.1k, False: 563]
  ------------------
 1105|  1.24k|        }
 1106|       |
 1107|       |        /* Encode Literals */
 1108|  16.2k|        {   unsigned const litLength = (unsigned)(ip - anchor);
 1109|  16.2k|            token = op++;
 1110|  16.2k|            if ((outputDirective == limitedOutput) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1110:17): [True: 7.27k, False: 9.00k]
  ------------------
 1111|  7.27k|                (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength/255) > olimit)) ) {
  ------------------
  |  |  181|  7.27k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  7.27k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1111:17): [True: 181, False: 7.09k]
  ------------------
 1112|    181|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1113|    181|            }
 1114|  16.0k|            if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1114:17): [True: 7.23k, False: 8.86k]
  ------------------
 1115|  7.23k|                (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|  7.23k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  7.23k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1115:17): [True: 246, False: 6.98k]
  ------------------
 1116|    246|                op--;
 1117|    246|                goto _last_literals;
 1118|    246|            }
 1119|  15.8k|            if (litLength >= RUN_MASK) {
  ------------------
  |  |  264|  15.8k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  15.8k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  15.8k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1119:17): [True: 968, False: 14.8k]
  ------------------
 1120|    968|                unsigned len = litLength - RUN_MASK;
  ------------------
  |  |  264|    968|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    968|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    968|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1121|    968|                *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  264|    968|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    968|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    968|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                              *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  261|    968|#define ML_BITS  4
  ------------------
 1122|    968|                for(; len >= 255 ; len-=255) *op++ = 255;
  ------------------
  |  Branch (1122:23): [True: 0, False: 968]
  ------------------
 1123|    968|                *op++ = (BYTE)len;
 1124|    968|            }
 1125|  14.8k|            else *token = (BYTE)(litLength<<ML_BITS);
  ------------------
  |  |  261|  14.8k|#define ML_BITS  4
  ------------------
 1126|       |
 1127|       |            /* Copy Literals */
 1128|  15.8k|            LZ4_wildCopy8(op, anchor, op+litLength);
 1129|  15.8k|            op+=litLength;
 1130|  15.8k|            DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  290|  15.8k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1131|  15.8k|                        (int)(anchor-(const BYTE*)source), litLength, (int)(ip-(const BYTE*)source));
 1132|  15.8k|        }
 1133|       |
 1134|  26.9k|_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|  26.9k|        if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1143:13): [True: 12.3k, False: 14.6k]
  ------------------
 1144|  12.3k|            (op + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit)) {
  ------------------
  |  |  247|  12.3k|#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|  12.3k|#define MINMATCH 4
  ------------------
  |  Branch (1144:13): [True: 185, False: 12.1k]
  ------------------
 1145|       |            /* the match was too close to the end, rewind and go to last literals */
 1146|    185|            op = token;
 1147|    185|            goto _last_literals;
 1148|    185|        }
 1149|       |
 1150|       |        /* Encode Offset */
 1151|  26.7k|        if (maybe_extMem) {   /* static test */
  ------------------
  |  Branch (1151:13): [True: 0, False: 26.7k]
  ------------------
 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|  26.7k|        } else  {
 1156|  26.7k|            DEBUGLOG(6, "             with offset=%u  (same segment)", (U32)(ip - match));
  ------------------
  |  |  290|  26.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1157|  26.7k|            assert(ip-match <= LZ4_DISTANCE_MAX);
  ------------------
  |  Branch (1157:13): [True: 0, False: 26.7k]
  |  Branch (1157:13): [True: 26.7k, False: 0]
  ------------------
 1158|  26.7k|            LZ4_writeLE16(op, (U16)(ip - match)); op+=2;
 1159|  26.7k|        }
 1160|       |
 1161|       |        /* Encode MatchLength */
 1162|  26.7k|        {   unsigned matchCode;
 1163|       |
 1164|  26.7k|            if ( (dictDirective==usingExtDict || dictDirective==usingDictCtx)
  ------------------
  |  Branch (1164:19): [True: 0, False: 26.7k]
  |  Branch (1164:50): [True: 0, False: 26.7k]
  ------------------
 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|  26.7k|            } else {
 1178|  26.7k|                matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  243|  26.7k|#define MINMATCH 4
  ------------------
                              matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  243|  26.7k|#define MINMATCH 4
  ------------------
 1179|  26.7k|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  243|  26.7k|#define MINMATCH 4
  ------------------
 1180|  26.7k|                DEBUGLOG(6, "             with matchLength=%u", matchCode+MINMATCH);
  ------------------
  |  |  290|  26.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1181|  26.7k|            }
 1182|       |
 1183|  26.7k|            if ((outputDirective) &&    /* Check output buffer overflow */
  ------------------
  |  Branch (1183:17): [True: 24.4k, False: 2.28k]
  ------------------
 1184|  24.4k|                (unlikely(op + (1 + LASTLITERALS) + (matchCode+240)/255 > olimit)) ) {
  ------------------
  |  |  181|  24.4k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  24.4k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1184:17): [True: 327, False: 24.1k]
  ------------------
 1185|    327|                if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1185:21): [True: 131, False: 196]
  ------------------
 1186|       |                    /* Match description too long : reduce it */
 1187|    131|                    U32 newMatchCode = 15 /* in token */ - 1 /* to avoid needing a zero byte */ + ((U32)(olimit - op) - 1 - LASTLITERALS) * 255;
  ------------------
  |  |  246|    131|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1188|    131|                    ip -= matchCode - newMatchCode;
 1189|    131|                    assert(newMatchCode < matchCode);
  ------------------
  |  Branch (1189:21): [True: 0, False: 131]
  |  Branch (1189:21): [True: 131, False: 0]
  ------------------
 1190|    131|                    matchCode = newMatchCode;
 1191|    131|                    if (unlikely(ip <= filledIp)) {
  ------------------
  |  |  181|    131|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    131|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 131]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 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|    196|                } else {
 1205|    196|                    assert(outputDirective == limitedOutput);
  ------------------
  |  Branch (1205:21): [True: 0, False: 196]
  |  Branch (1205:21): [True: 196, False: 0]
  ------------------
 1206|    196|                    return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1207|    196|                }
 1208|    327|            }
 1209|  26.5k|            if (matchCode >= ML_MASK) {
  ------------------
  |  |  262|  26.5k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  26.5k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (1209:17): [True: 11.3k, False: 15.1k]
  ------------------
 1210|  11.3k|                *token += ML_MASK;
  ------------------
  |  |  262|  11.3k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  11.3k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1211|  11.3k|                matchCode -= ML_MASK;
  ------------------
  |  |  262|  11.3k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  11.3k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1212|  11.3k|                LZ4_write32(op, 0xFFFFFFFF);
 1213|  29.4k|                while (matchCode >= 4*255) {
  ------------------
  |  Branch (1213:24): [True: 18.1k, False: 11.3k]
  ------------------
 1214|  18.1k|                    op+=4;
 1215|  18.1k|                    LZ4_write32(op, 0xFFFFFFFF);
 1216|  18.1k|                    matchCode -= 4*255;
 1217|  18.1k|                }
 1218|  11.3k|                op += matchCode / 255;
 1219|  11.3k|                *op++ = (BYTE)(matchCode % 255);
 1220|  11.3k|            } else
 1221|  15.1k|                *token += (BYTE)(matchCode);
 1222|  26.5k|        }
 1223|       |        /* Ensure we have enough space for the last literals. */
 1224|  26.5k|        assert(!(outputDirective == fillOutput && op + 1 + LASTLITERALS > olimit));
  ------------------
  |  Branch (1224:9): [True: 0, False: 26.5k]
  |  Branch (1224:9): [True: 0, False: 0]
  |  Branch (1224:9): [True: 12.1k, False: 14.4k]
  |  Branch (1224:9): [True: 0, False: 12.1k]
  ------------------
 1225|       |
 1226|  26.5k|        anchor = ip;
 1227|       |
 1228|       |        /* Test end of chunk */
 1229|  26.5k|        if (ip >= mflimitPlusOne) break;
  ------------------
  |  Branch (1229:13): [True: 1.77k, False: 24.7k]
  ------------------
 1230|       |
 1231|       |        /* Fill table */
 1232|  24.7k|        {   U32 const h = LZ4_hashPosition(ip-2, tableType);
 1233|  24.7k|            if (tableType == byPtr) {
  ------------------
  |  Branch (1233:17): [True: 0, False: 24.7k]
  ------------------
 1234|      0|                LZ4_putPositionOnHash(ip-2, h, cctx->hashTable, byPtr);
 1235|  24.7k|            } else {
 1236|  24.7k|                U32 const idx = (U32)((ip-2) - base);
 1237|  24.7k|                LZ4_putIndexOnHash(idx, h, cctx->hashTable, tableType);
 1238|  24.7k|        }   }
 1239|       |
 1240|       |        /* Test next position */
 1241|  24.7k|        if (tableType == byPtr) {
  ------------------
  |  Branch (1241:13): [True: 0, False: 24.7k]
  ------------------
 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|  24.7k|        } else {   /* byU32, byU16 */
 1250|       |
 1251|  24.7k|            U32 const h = LZ4_hashPosition(ip, tableType);
 1252|  24.7k|            U32 const current = (U32)(ip-base);
 1253|  24.7k|            U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1254|  24.7k|            assert(matchIndex < current);
  ------------------
  |  Branch (1254:13): [True: 0, False: 24.7k]
  |  Branch (1254:13): [True: 24.7k, False: 0]
  ------------------
 1255|  24.7k|            if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1255:17): [True: 0, False: 24.7k]
  ------------------
 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|  24.7k|            } else if (dictDirective==usingExtDict) {
  ------------------
  |  Branch (1267:24): [True: 0, False: 24.7k]
  ------------------
 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|  24.7k|            } else {   /* single memory segment */
 1277|  24.7k|                match = base + matchIndex;
 1278|  24.7k|            }
 1279|  24.7k|            LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1280|  24.7k|            assert(matchIndex < current);
  ------------------
  |  Branch (1280:13): [True: 0, False: 24.7k]
  |  Branch (1280:13): [True: 24.7k, False: 0]
  ------------------
 1281|  24.7k|            if ( ((dictIssue==dictSmall) ? (matchIndex >= prefixIdxLimit) : 1)
  ------------------
  |  Branch (1281:18): [True: 24.7k, False: 0]
  |  Branch (1281:19): [True: 0, False: 24.7k]
  ------------------
 1282|  24.7k|              && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  676|  15.5k|#  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|  15.5k|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
                            && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  676|  9.17k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1282:18): [True: 24.7k, False: 0]
  |  Branch (1282:20): [True: 15.5k, False: 9.17k]
  |  Branch (1282:42): [True: 0, Folded]
  ------------------
 1283|  24.7k|              && (LZ4_read32(match) == LZ4_read32(ip)) ) {
  ------------------
  |  Branch (1283:18): [True: 11.0k, False: 13.6k]
  ------------------
 1284|  11.0k|                token=op++;
 1285|  11.0k|                *token=0;
 1286|  11.0k|                if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1286:21): [True: 0, False: 11.0k]
  ------------------
 1287|  11.0k|                DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  290|  11.0k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1288|  11.0k|                            (int)(anchor-(const BYTE*)source), 0, (int)(ip-(const BYTE*)source));
 1289|  11.0k|                goto _next_match;
 1290|  11.0k|            }
 1291|  24.7k|        }
 1292|       |
 1293|       |        /* Prepare next loop */
 1294|  13.6k|        forwardH = LZ4_hashPosition(++ip, tableType);
 1295|       |
 1296|  13.6k|    }
 1297|       |
 1298|  3.96k|_last_literals:
 1299|       |    /* Encode Last Literals */
 1300|  3.96k|    {   size_t lastRun = (size_t)(iend - anchor);
 1301|  3.96k|        if ( (outputDirective) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1301:14): [True: 2.72k, False: 1.24k]
  ------------------
 1302|  2.72k|            (op + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > olimit)) {
  ------------------
  |  |  264|  2.72k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  2.72k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  2.72k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1302:13): [True: 814, False: 1.90k]
  ------------------
 1303|    814|            if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1303:17): [True: 611, False: 203]
  ------------------
 1304|       |                /* adapt lastRun to fill 'dst' */
 1305|    611|                assert(olimit >= op);
  ------------------
  |  Branch (1305:17): [True: 0, False: 611]
  |  Branch (1305:17): [True: 611, False: 0]
  ------------------
 1306|    611|                lastRun  = (size_t)(olimit-op) - 1/*token*/;
 1307|    611|                lastRun -= (lastRun + 256 - RUN_MASK) / 256;  /*additional length tokens*/
  ------------------
  |  |  264|    611|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    611|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    611|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1308|    611|            } else {
 1309|    203|                assert(outputDirective == limitedOutput);
  ------------------
  |  Branch (1309:17): [True: 0, False: 203]
  |  Branch (1309:17): [True: 203, False: 0]
  ------------------
 1310|    203|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1311|    203|            }
 1312|    814|        }
 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: 444, False: 3.31k]
  ------------------
 1315|    444|            size_t accumulator = lastRun - RUN_MASK;
  ------------------
  |  |  264|    444|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    444|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    444|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1316|    444|            *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  264|    444|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    444|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    444|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  261|    444|#define ML_BITS  4
  ------------------
 1317|    444|            for(; accumulator >= 255 ; accumulator-=255) *op++ = 255;
  ------------------
  |  Branch (1317:19): [True: 0, False: 444]
  ------------------
 1318|    444|            *op++ = (BYTE) accumulator;
 1319|  3.31k|        } else {
 1320|  3.31k|            *op++ = (BYTE)(lastRun<<ML_BITS);
  ------------------
  |  |  261|  3.31k|#define ML_BITS  4
  ------------------
 1321|  3.31k|        }
 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: 1.54k, False: 2.21k]
  ------------------
 1328|  1.54k|        *inputConsumed = (int) (((const char*)ip)-source);
 1329|  1.54k|    }
 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|   613k|{
  795|   613k|    if ((sizeof(reg_t)==8) && (tableType != byU16)) return LZ4_hash5(LZ4_read_ARCH(p), tableType);
  ------------------
  |  Branch (795:9): [True: 613k, Folded]
  |  Branch (795:31): [True: 479k, False: 134k]
  ------------------
  796|       |
  797|       |#ifdef LZ4_STATIC_LINKING_ONLY_ENDIANNESS_INDEPENDENT_OUTPUT
  798|       |    return LZ4_hash4(LZ4_readLE32(p), tableType);
  799|       |#else
  800|   134k|    return LZ4_hash4(LZ4_read32(p), tableType);
  801|   613k|#endif
  802|   613k|}
lz4.c:LZ4_hash5:
  782|   479k|{
  783|   479k|    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|   958k|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  158|   479k|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   479k|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (783:25): [True: 0, False: 479k]
  ------------------
  784|   479k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (784:9): [True: 479k, False: 0]
  ------------------
  785|   479k|        const U64 prime5bytes = 889523592379ULL;
  786|   479k|        return (U32)(((sequence << 24) * prime5bytes) >> (64 - hashLog));
  787|   479k|    } else {
  788|      0|        const U64 prime8bytes = 11400714785074694791ULL;
  789|      0|        return (U32)(((sequence >> 24) * prime8bytes) >> (64 - hashLog));
  790|      0|    }
  791|   479k|}
lz4.c:LZ4_isLittleEndian:
  365|   550k|{
  366|   550k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  367|   550k|    return one.c[0];
  368|   550k|}
lz4.c:LZ4_read_ARCH:
  396|  6.78M|static reg_t LZ4_read_ARCH(const void* ptr) { return ((const LZ4_unalignST*)ptr)->uArch; }
lz4.c:LZ4_hash4:
  774|   134k|{
  775|   134k|    if (tableType == byU16)
  ------------------
  |  Branch (775:9): [True: 134k, False: 0]
  ------------------
  776|   134k|        return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
  ------------------
  |  |  243|   134k|#define MINMATCH 4
  ------------------
                      return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
  ------------------
  |  |  697|   134k|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  158|   134k|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   134k|#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|   134k|}
lz4.c:LZ4_putIndexOnHash:
  817|   595k|{
  818|   595k|    switch (tableType)
  819|   595k|    {
  820|      0|    default: /* fallthrough */
  ------------------
  |  Branch (820:5): [True: 0, False: 595k]
  ------------------
  821|      0|    case clearedTable: /* fallthrough */
  ------------------
  |  Branch (821:5): [True: 0, False: 595k]
  ------------------
  822|      0|    case byPtr: { /* illegal! */ assert(0); return; }
  ------------------
  |  Branch (822:5): [True: 0, False: 595k]
  |  Branch (822:34): [Folded, False: 0]
  |  Branch (822:34): [Folded, False: 0]
  ------------------
  823|   473k|    case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = idx; return; }
  ------------------
  |  Branch (823:5): [True: 473k, False: 122k]
  ------------------
  824|   122k|    case byU16: { U16* hashTable = (U16*) tableBase; assert(idx < 65536); hashTable[h] = (U16)idx; return; }
  ------------------
  |  Branch (824:5): [True: 122k, False: 473k]
  |  Branch (824:54): [True: 0, False: 122k]
  |  Branch (824:54): [True: 122k, False: 0]
  ------------------
  825|   595k|    }
  826|   595k|}
lz4.c:LZ4_read32:
  395|   923k|static U32 LZ4_read32(const void* ptr) { return ((const LZ4_unalign32*)ptr)->u32; }
lz4.c:LZ4_getIndexOnHash:
  850|   568k|{
  851|   568k|    LZ4_STATIC_ASSERT(LZ4_MEMORY_USAGE > 2);
  ------------------
  |  |  278|   568k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
  852|   568k|    if (tableType == byU32) {
  ------------------
  |  Branch (852:9): [True: 463k, False: 104k]
  ------------------
  853|   463k|        const U32* const hashTable = (const U32*) tableBase;
  854|   463k|        assert(h < (1U << (LZ4_MEMORY_USAGE-2)));
  ------------------
  |  Branch (854:9): [True: 0, False: 463k]
  |  Branch (854:9): [True: 463k, False: 0]
  ------------------
  855|   463k|        return hashTable[h];
  856|   463k|    }
  857|   104k|    if (tableType == byU16) {
  ------------------
  |  Branch (857:9): [True: 104k, False: 0]
  ------------------
  858|   104k|        const U16* const hashTable = (const U16*) tableBase;
  859|   104k|        assert(h < (1U << (LZ4_MEMORY_USAGE-1)));
  ------------------
  |  Branch (859:9): [True: 0, False: 104k]
  |  Branch (859:9): [True: 104k, False: 0]
  ------------------
  860|   104k|        return hashTable[h];
  861|   104k|    }
  862|   104k|    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|  22.3k|{
  468|  22.3k|    BYTE* d = (BYTE*)dstPtr;
  469|  22.3k|    const BYTE* s = (const BYTE*)srcPtr;
  470|  22.3k|    BYTE* const e = (BYTE*)dstEnd;
  471|       |
  472|   193k|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  350|   193k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (472:50): [True: 170k, False: 22.3k]
  ------------------
  473|  22.3k|}
lz4.c:LZ4_writeLE16:
  454|  26.7k|{
  455|  26.7k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (455:9): [True: 26.7k, False: 0]
  ------------------
  456|  26.7k|        LZ4_write16(memPtr, value);
  457|  26.7k|    } else {
  458|      0|        BYTE* p = (BYTE*)memPtr;
  459|      0|        p[0] = (BYTE) value;
  460|      0|        p[1] = (BYTE)(value>>8);
  461|      0|    }
  462|  26.7k|}
lz4.c:LZ4_write16:
  398|  26.7k|static void LZ4_write16(void* memPtr, U16 value) { ((LZ4_unalign16*)memPtr)->u16 = value; }
lz4.c:LZ4_count:
  677|  26.7k|{
  678|  26.7k|    const BYTE* const pStart = pIn;
  679|       |
  680|  26.7k|    if (likely(pIn < pInLimit-(STEPSIZE-1))) {
  ------------------
  |  |  178|  26.7k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  26.7k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 25.2k, False: 1.43k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  681|  25.2k|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  682|  25.2k|        if (!diff) {
  ------------------
  |  Branch (682:13): [True: 14.1k, False: 11.0k]
  ------------------
  683|  14.1k|            pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  674|  14.1k|#define STEPSIZE sizeof(reg_t)
  ------------------
                          pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  674|  14.1k|#define STEPSIZE sizeof(reg_t)
  ------------------
  684|  14.1k|        } else {
  685|  11.0k|            return LZ4_NbCommonBytes(diff);
  686|  11.0k|    }   }
  687|       |
  688|  3.12M|    while (likely(pIn < pInLimit-(STEPSIZE-1))) {
  689|  3.12M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  690|  3.12M|        if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  674|  3.11M|#define STEPSIZE sizeof(reg_t)
  ------------------
                      if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  674|  3.11M|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (690:13): [True: 3.11M, False: 13.5k]
  ------------------
  691|  13.5k|        pIn += LZ4_NbCommonBytes(diff);
  692|  13.5k|        return (unsigned)(pIn - pStart);
  693|  3.12M|    }
  694|       |
  695|  2.05k|    if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  |  674|  2.05k|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (695:9): [True: 2.05k, Folded]
  |  Branch (695:26): [True: 1.20k, False: 847]
  |  Branch (695:48): [True: 284, False: 921]
  ------------------
  696|  2.05k|    if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (696:9): [True: 1.84k, False: 208]
  |  Branch (696:31): [True: 550, False: 1.29k]
  ------------------
  697|  2.05k|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (697:9): [True: 1.81k, False: 241]
  |  Branch (697:27): [True: 578, False: 1.23k]
  ------------------
  698|  2.05k|    return (unsigned)(pIn - pStart);
  699|  15.6k|}
lz4.c:LZ4_NbCommonBytes:
  576|  24.6k|{
  577|  24.6k|    assert(val != 0);
  ------------------
  |  Branch (577:5): [True: 0, False: 24.6k]
  |  Branch (577:5): [True: 24.6k, False: 0]
  ------------------
  578|  24.6k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (578:9): [True: 24.6k, False: 0]
  ------------------
  579|  24.6k|        if (sizeof(val) == 8) {
  ------------------
  |  Branch (579:13): [True: 24.6k, 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|  24.6k|        } 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|  24.6k|    } 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|  24.6k|}
lz4.c:LZ4_read16:
  394|  23.5k|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  399|  34.5k|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_compress_destSize_extState_internal:
 1478|  2.17k|{
 1479|  2.17k|    void* const s = LZ4_initStream(state, sizeof (*state));
 1480|  2.17k|    assert(s != NULL); (void)s;
  ------------------
  |  Branch (1480:5): [True: 0, False: 2.17k]
  |  Branch (1480:5): [True: 2.17k, False: 0]
  ------------------
 1481|       |
 1482|  2.17k|    if (targetDstSize >= LZ4_compressBound(*srcSizePtr)) {  /* compression success is guaranteed */
  ------------------
  |  Branch (1482:9): [True: 621, False: 1.54k]
  ------------------
 1483|    621|        return LZ4_compress_fast_extState(state, src, dst, *srcSizePtr, targetDstSize, acceleration);
 1484|  1.54k|    } else {
 1485|  1.54k|        if (*srcSizePtr < LZ4_64Klimit) {
  ------------------
  |  Branch (1485:13): [True: 1.27k, False: 272]
  ------------------
 1486|  1.27k|            return LZ4_compress_generic(&state->internal_donotuse, src, dst, *srcSizePtr, srcSizePtr, targetDstSize, fillOutput, byU16, noDict, noDictIssue, acceleration);
 1487|  1.27k|        } else {
 1488|    272|            tableType_t const addrMode = ((sizeof(void*)==4) && ((uptrval)src > LZ4_DISTANCE_MAX)) ? byPtr : byU32;
  ------------------
  |  |  676|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1488:43): [Folded, False: 272]
  |  Branch (1488:65): [True: 0, False: 0]
  ------------------
 1489|    272|            return LZ4_compress_generic(&state->internal_donotuse, src, dst, *srcSizePtr, srcSizePtr, targetDstSize, fillOutput, addrMode, noDict, noDictIssue, acceleration);
 1490|    272|    }   }
 1491|  2.17k|}
lz4.c:LZ4_isAligned:
  294|  4.97k|{
  295|  4.97k|    return ((size_t)ptr & (alignment -1)) == 0;
  296|  4.97k|}
lz4.c:LZ4_stream_t_alignment:
 1539|  4.97k|{
 1540|  4.97k|#if LZ4_ALIGN_TEST
 1541|  4.97k|    typedef struct { char c; LZ4_stream_t t; } t_a;
 1542|  4.97k|    return sizeof(t_a) - sizeof(LZ4_stream_t);
 1543|       |#else
 1544|       |    return 1;  /* effectively disabled */
 1545|       |#endif
 1546|  4.97k|}
lz4.c:LZ4_decompress_generic:
 2031|  3.77k|{
 2032|  3.77k|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (2032:9): [True: 0, False: 3.77k]
  |  Branch (2032:26): [True: 0, False: 3.77k]
  ------------------
 2033|       |
 2034|  3.77k|    {   const BYTE* ip = (const BYTE*) src;
 2035|  3.77k|        const BYTE* const iend = ip + srcSize;
 2036|       |
 2037|  3.77k|        BYTE* op = (BYTE*) dst;
 2038|  3.77k|        BYTE* const oend = op + outputSize;
 2039|  3.77k|        BYTE* cpy;
 2040|       |
 2041|  3.77k|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (2041:37): [True: 3.77k, False: 0]
  ------------------
 2042|       |
 2043|  3.77k|        const int checkOffset = (dictSize < (int)(64 KB));
  ------------------
  |  |  252|  3.77k|#define KB *(1 <<10)
  ------------------
 2044|       |
 2045|       |
 2046|       |        /* Set up the "end" pointers for the shortcut. */
 2047|  3.77k|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 2048|  3.77k|        const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/;
 2049|       |
 2050|  3.77k|        const BYTE* match;
 2051|  3.77k|        size_t offset;
 2052|  3.77k|        unsigned token;
 2053|  3.77k|        size_t length;
 2054|       |
 2055|       |
 2056|  3.77k|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  290|  3.77k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2057|       |
 2058|       |        /* Special cases */
 2059|  3.77k|        assert(lowPrefix <= op);
  ------------------
  |  Branch (2059:9): [True: 0, False: 3.77k]
  |  Branch (2059:9): [True: 3.77k, False: 0]
  ------------------
 2060|  3.77k|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  181|  3.77k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  3.77k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 18, False: 3.75k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2061|       |            /* Empty output buffer */
 2062|     18|            if (partialDecoding) return 0;
  ------------------
  |  Branch (2062:17): [True: 0, False: 18]
  ------------------
 2063|     18|            return ((srcSize==1) && (*ip==0)) ? 0 : -1;
  ------------------
  |  Branch (2063:21): [True: 18, False: 0]
  |  Branch (2063:37): [True: 18, False: 0]
  ------------------
 2064|     18|        }
 2065|  3.75k|        if (unlikely(srcSize==0)) { return -1; }
  ------------------
  |  |  181|  3.75k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  3.75k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 3.75k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 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|  3.75k|#if LZ4_FAST_DEC_LOOP
 2072|  3.75k|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  3.75k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2072:13): [True: 2.29k, False: 1.46k]
  ------------------
 2073|  2.29k|            DEBUGLOG(6, "move to safe decode loop");
  ------------------
  |  |  290|  2.29k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2074|  2.29k|            goto safe_decode;
 2075|  2.29k|        }
 2076|       |
 2077|       |        /* Fast loop : decode sequences as long as output < oend-FASTLOOP_SAFE_DISTANCE */
 2078|  1.46k|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  290|  1.46k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2079|  14.8k|        while (1) {
  ------------------
  |  Branch (2079:16): [True: 14.8k, Folded]
  ------------------
 2080|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2081|  14.8k|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  Branch (2081:13): [True: 0, False: 14.8k]
  |  Branch (2081:13): [True: 14.8k, False: 0]
  ------------------
 2082|  14.8k|            assert(ip < iend);
  ------------------
  |  Branch (2082:13): [True: 0, False: 14.8k]
  |  Branch (2082:13): [True: 14.8k, False: 0]
  ------------------
 2083|  14.8k|            token = *ip++;
 2084|  14.8k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  261|  14.8k|#define ML_BITS  4
  ------------------
 2085|  14.8k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  14.8k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2086|       |
 2087|       |            /* decode literal length */
 2088|  14.8k|            if (length == RUN_MASK) {
  ------------------
  |  |  264|  14.8k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  14.8k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  14.8k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2088:17): [True: 699, False: 14.1k]
  ------------------
 2089|    699|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  264|    699|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    699|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    699|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2090|    699|                if (addl == rvl_error) {
  ------------------
  |  Branch (2090:21): [True: 0, False: 699]
  ------------------
 2091|      0|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2092|      0|                    goto _output_error;
 2093|      0|                }
 2094|    699|                length += addl;
 2095|    699|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|    699|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    699|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 699]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2096|    699|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|    699|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    699|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 699]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2097|       |
 2098|       |                /* copy literals */
 2099|    699|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  278|    699|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2100|    699|                if ((op+length>oend-32) || (ip+length>iend-32)) { goto safe_literal_copy; }
  ------------------
  |  Branch (2100:21): [True: 105, False: 594]
  |  Branch (2100:44): [True: 160, False: 434]
  ------------------
 2101|    434|                LZ4_wildCopy32(op, ip, op+length);
 2102|    434|                ip += length; op += length;
 2103|  14.1k|            } else if (ip <= iend-(16 + 1/*max lit + offset + nextToken*/)) {
  ------------------
  |  Branch (2103:24): [True: 13.6k, False: 411]
  ------------------
 2104|       |                /* We don't need to check oend, since we check it once for each loop below */
 2105|  13.6k|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)length);
  ------------------
  |  |  290|  13.6k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2106|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2107|  13.6k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  350|  13.6k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2108|  13.6k|                ip += length; op += length;
 2109|  13.6k|            } else {
 2110|    411|                goto safe_literal_copy;
 2111|    411|            }
 2112|       |
 2113|       |            /* get offset */
 2114|  14.1k|            offset = LZ4_readLE16(ip); ip+=2;
 2115|  14.1k|            DEBUGLOG(6, "blockPos%6u: offset = %u", (unsigned)(op-(BYTE*)dst), (unsigned)offset);
  ------------------
  |  |  290|  14.1k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2116|  14.1k|            match = op - offset;
 2117|  14.1k|            assert(match <= op);  /* overflow check */
  ------------------
  |  Branch (2117:13): [True: 0, False: 14.1k]
  |  Branch (2117:13): [True: 14.1k, False: 0]
  ------------------
 2118|       |
 2119|       |            /* get matchlength */
 2120|  14.1k|            length = token & ML_MASK;
  ------------------
  |  |  262|  14.1k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  14.1k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2121|  14.1k|            DEBUGLOG(7, "  match length token = %u (len==%u)", (unsigned)length, (unsigned)length+MINMATCH);
  ------------------
  |  |  290|  14.1k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2122|       |
 2123|  14.1k|            if (length == ML_MASK) {
  ------------------
  |  |  262|  14.1k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  14.1k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2123:17): [True: 6.95k, False: 7.17k]
  ------------------
 2124|  6.95k|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  246|  6.95k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2125|  6.95k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2125:21): [True: 0, False: 6.95k]
  ------------------
 2126|      0|                    DEBUGLOG(5, "error reading long match length");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2127|      0|                    goto _output_error;
 2128|      0|                }
 2129|  6.95k|                length += addl;
 2130|  6.95k|                length += MINMATCH;
  ------------------
  |  |  243|  6.95k|#define MINMATCH 4
  ------------------
 2131|  6.95k|                DEBUGLOG(7, "  long match length == %u", (unsigned)length);
  ------------------
  |  |  290|  6.95k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2132|  6.95k|                if (unlikely((uptrval)(op)+length<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|  6.95k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  6.95k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 6.95k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2133|  6.95k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  6.95k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2133:21): [True: 357, False: 6.59k]
  ------------------
 2134|    357|                    goto safe_match_copy;
 2135|    357|                }
 2136|  7.17k|            } else {
 2137|  7.17k|                length += MINMATCH;
  ------------------
  |  |  243|  7.17k|#define MINMATCH 4
  ------------------
 2138|  7.17k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  7.17k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2138:21): [True: 427, False: 6.74k]
  ------------------
 2139|    427|                    DEBUGLOG(7, "moving to safe_match_copy (ml==%u)", (unsigned)length);
  ------------------
  |  |  290|    427|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2140|    427|                    goto safe_match_copy;
 2141|    427|                }
 2142|       |
 2143|       |                /* Fastpath check: skip LZ4_wildCopy32 when true */
 2144|  6.74k|                if ((dict == withPrefix64k) || (match >= lowPrefix)) {
  ------------------
  |  Branch (2144:21): [True: 0, False: 6.74k]
  |  Branch (2144:48): [True: 6.74k, False: 0]
  ------------------
 2145|  6.74k|                    if (offset >= 8) {
  ------------------
  |  Branch (2145:25): [True: 3.44k, False: 3.30k]
  ------------------
 2146|  3.44k|                        assert(match >= lowPrefix);
  ------------------
  |  Branch (2146:25): [True: 0, False: 3.44k]
  |  Branch (2146:25): [True: 3.44k, False: 0]
  ------------------
 2147|  3.44k|                        assert(match <= op);
  ------------------
  |  Branch (2147:25): [True: 0, False: 3.44k]
  |  Branch (2147:25): [True: 3.44k, False: 0]
  ------------------
 2148|  3.44k|                        assert(op + 18 <= oend);
  ------------------
  |  Branch (2148:25): [True: 0, False: 3.44k]
  |  Branch (2148:25): [True: 3.44k, False: 0]
  ------------------
 2149|       |
 2150|  3.44k|                        LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  3.44k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2151|  3.44k|                        LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  350|  3.44k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2152|  3.44k|                        LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  350|  3.44k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2153|  3.44k|                        op += length;
 2154|  3.44k|                        continue;
 2155|  3.44k|            }   }   }
 2156|       |
 2157|  9.89k|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  181|  9.89k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  9.89k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2157:18): [True: 9.89k, False: 0]
  |  Branch (2157:33): [True: 0, False: 9.89k]
  ------------------
 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|  9.89k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2162:17): [True: 0, False: 9.89k]
  |  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|  9.89k|            cpy = op + length;
 2196|       |
 2197|  9.89k|            assert((op <= oend) && (oend-op >= 32));
  ------------------
  |  Branch (2197:13): [True: 0, False: 9.89k]
  |  Branch (2197:13): [True: 0, False: 0]
  |  Branch (2197:13): [True: 9.89k, False: 0]
  |  Branch (2197:13): [True: 9.89k, False: 0]
  ------------------
 2198|  9.89k|            if (unlikely(offset<16)) {
  ------------------
  |  |  181|  9.89k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  9.89k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 6.29k, False: 3.60k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2199|  6.29k|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2200|  6.29k|            } else {
 2201|  3.60k|                LZ4_wildCopy32(op, match, cpy);
 2202|  3.60k|            }
 2203|       |
 2204|  9.89k|            op = cpy;   /* wildcopy correction */
 2205|  9.89k|        }
 2206|  2.29k|    safe_decode:
 2207|  2.29k|#endif
 2208|       |
 2209|       |        /* Main Loop : decode remaining sequences where output < FASTLOOP_SAFE_DISTANCE */
 2210|  2.29k|        DEBUGLOG(6, "using safe decode loop");
  ------------------
  |  |  290|  2.29k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2211|  8.82k|        while (1) {
  ------------------
  |  Branch (2211:16): [True: 8.82k, Folded]
  ------------------
 2212|  8.82k|            assert(ip < iend);
  ------------------
  |  Branch (2212:13): [True: 0, False: 8.82k]
  |  Branch (2212:13): [True: 8.82k, False: 0]
  ------------------
 2213|  8.82k|            token = *ip++;
 2214|  8.82k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  261|  8.82k|#define ML_BITS  4
  ------------------
 2215|  8.82k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  8.82k|#  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|  8.82k|            if ( (length != RUN_MASK)
  ------------------
  |  |  264|  8.82k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  8.82k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  8.82k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2226:18): [True: 8.35k, False: 466]
  ------------------
 2227|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2228|  8.35k|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  178|  8.35k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  8.35k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.69k, False: 6.66k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2229|       |                /* Copy the literals */
 2230|  1.69k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  350|  1.69k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2231|  1.69k|                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|  1.69k|                length = token & ML_MASK; /* match length */
  ------------------
  |  |  262|  1.69k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.69k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2236|  1.69k|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u (len=%u)", (unsigned)(op-(BYTE*)dst), (unsigned)length, (unsigned)length + 4);
  ------------------
  |  |  290|  1.69k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2237|  1.69k|                offset = LZ4_readLE16(ip); ip += 2;
 2238|  1.69k|                match = op - offset;
 2239|  1.69k|                assert(match <= op); /* check overflow */
  ------------------
  |  Branch (2239:17): [True: 0, False: 1.69k]
  |  Branch (2239:17): [True: 1.69k, False: 0]
  ------------------
 2240|       |
 2241|       |                /* Do not deal with overlapping matches. */
 2242|  1.69k|                if ( (length != ML_MASK)
  ------------------
  |  |  262|  1.69k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.69k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2242:22): [True: 1.56k, False: 129]
  ------------------
 2243|  1.56k|                  && (offset >= 8)
  ------------------
  |  Branch (2243:22): [True: 716, False: 850]
  ------------------
 2244|    716|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2244:23): [True: 0, False: 716]
  |  Branch (2244:46): [True: 716, False: 0]
  ------------------
 2245|       |                    /* Copy the match. */
 2246|    716|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  350|    716|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2247|    716|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  350|    716|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2248|    716|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  350|    716|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2249|    716|                    op += length + MINMATCH;
  ------------------
  |  |  243|    716|#define MINMATCH 4
  ------------------
 2250|       |                    /* Both stages worked, load the next token. */
 2251|    716|                    continue;
 2252|    716|                }
 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|    979|                goto _copy_match;
 2257|  1.69k|            }
 2258|       |
 2259|       |            /* decode literal length */
 2260|  7.12k|            if (length == RUN_MASK) {
  ------------------
  |  |  264|  7.12k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  7.12k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  7.12k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2260:17): [True: 466, False: 6.66k]
  ------------------
 2261|    466|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  264|    466|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    466|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    466|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2262|    466|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2262:21): [True: 0, False: 466]
  ------------------
 2263|    466|                length += addl;
 2264|    466|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|    466|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    466|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 466]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2265|    466|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|    466|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    466|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 466]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2266|    466|            }
 2267|       |
 2268|  7.12k|#if LZ4_FAST_DEC_LOOP
 2269|  7.80k|        safe_literal_copy:
 2270|  7.80k|#endif
 2271|       |            /* copy literals */
 2272|  7.80k|            cpy = op+length;
 2273|       |
 2274|  7.80k|            LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  278|  7.80k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2275|  7.80k|            if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  247|  7.80k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  246|  4.47k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2275:17): [True: 3.32k, False: 4.47k]
  |  Branch (2275:39): [True: 429, False: 4.04k]
  ------------------
 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|  3.75k|                if (partialDecoding) {
  ------------------
  |  Branch (2281:21): [True: 0, False: 3.75k]
  ------------------
 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|  3.75k|                } 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|  3.75k|                    if ((ip+length != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2308:25): [True: 0, False: 3.75k]
  |  Branch (2308:48): [True: 0, False: 3.75k]
  ------------------
 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|  3.75k|                }
 2316|  3.75k|                LZ4_memmove(op, ip, length);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  358|  3.75k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2317|  3.75k|                ip += length;
 2318|  3.75k|                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|  3.75k|                if (!partialDecoding || (cpy == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2324:21): [True: 3.75k, False: 0]
  |  Branch (2324:41): [True: 0, False: 0]
  |  Branch (2324:58): [True: 0, False: 0]
  ------------------
 2325|  3.75k|                    break;
 2326|  3.75k|                }
 2327|  4.04k|            } else {
 2328|  4.04k|                LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2329|  4.04k|                ip += length; op = cpy;
 2330|  4.04k|            }
 2331|       |
 2332|       |            /* get offset */
 2333|  4.04k|            offset = LZ4_readLE16(ip); ip+=2;
 2334|  4.04k|            match = op - offset;
 2335|       |
 2336|       |            /* get matchlength */
 2337|  4.04k|            length = token & ML_MASK;
  ------------------
  |  |  262|  4.04k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  4.04k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2338|  4.04k|            DEBUGLOG(7, "blockPos%6u: matchLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  4.04k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2339|       |
 2340|  5.02k|    _copy_match:
 2341|  5.02k|            if (length == ML_MASK) {
  ------------------
  |  |  262|  5.02k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  5.02k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2341:17): [True: 650, False: 4.37k]
  ------------------
 2342|    650|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  246|    650|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2343|    650|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2343:21): [True: 0, False: 650]
  ------------------
 2344|    650|                length += addl;
 2345|    650|                if (unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  181|    650|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    650|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 650]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2346|    650|            }
 2347|  5.02k|            length += MINMATCH;
  ------------------
  |  |  243|  5.02k|#define MINMATCH 4
  ------------------
 2348|       |
 2349|  5.02k|#if LZ4_FAST_DEC_LOOP
 2350|  5.81k|        safe_match_copy:
 2351|  5.81k|#endif
 2352|  5.81k|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error;   /* Error : offset outside buffers */
  ------------------
  |  |  181|  5.81k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  5.81k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2352:17): [True: 5.81k, False: 0]
  |  Branch (2352:34): [True: 0, False: 5.81k]
  ------------------
 2353|       |            /* match starting within external dictionary */
 2354|  5.81k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2354:17): [True: 0, False: 5.81k]
  |  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|  5.81k|            assert(match >= lowPrefix);
  ------------------
  |  Branch (2381:13): [True: 0, False: 5.81k]
  |  Branch (2381:13): [True: 5.81k, False: 0]
  ------------------
 2382|       |
 2383|       |            /* copy match within block */
 2384|  5.81k|            cpy = op + length;
 2385|       |
 2386|       |            /* partialDecoding : may end anywhere within the block */
 2387|  5.81k|            assert(op<=oend);
  ------------------
  |  Branch (2387:13): [True: 0, False: 5.81k]
  |  Branch (2387:13): [True: 5.81k, False: 0]
  ------------------
 2388|  5.81k|            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: 5.81k]
  |  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|  5.81k|            if (unlikely(offset<8)) {
  ------------------
  |  |  181|  5.81k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  5.81k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 4.13k, False: 1.67k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2403|  4.13k|                LZ4_write32(op, 0);   /* silence msan warning when offset==0 */
 2404|  4.13k|                op[0] = match[0];
 2405|  4.13k|                op[1] = match[1];
 2406|  4.13k|                op[2] = match[2];
 2407|  4.13k|                op[3] = match[3];
 2408|  4.13k|                match += inc32table[offset];
 2409|  4.13k|                LZ4_memcpy(op+4, match, 4);
  ------------------
  |  |  350|  4.13k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2410|  4.13k|                match -= dec64table[offset];
 2411|  4.13k|            } else {
 2412|  1.67k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  1.67k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2413|  1.67k|                match += 8;
 2414|  1.67k|            }
 2415|  5.81k|            op += 8;
 2416|       |
 2417|  5.81k|            if (unlikely(cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  181|  5.81k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  5.81k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.73k, False: 4.07k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2418|  1.73k|                BYTE* const oCopyLimit = oend - (WILDCOPYLENGTH-1);
  ------------------
  |  |  245|  1.73k|#define WILDCOPYLENGTH 8
  ------------------
 2419|  1.73k|                if (cpy > oend-LASTLITERALS) { goto _output_error; } /* Error : last LASTLITERALS bytes must be literals (uncompressed) */
  ------------------
  |  |  246|  1.73k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2419:21): [True: 0, False: 1.73k]
  ------------------
 2420|  1.73k|                if (op < oCopyLimit) {
  ------------------
  |  Branch (2420:21): [True: 679, False: 1.06k]
  ------------------
 2421|    679|                    LZ4_wildCopy8(op, match, oCopyLimit);
 2422|    679|                    match += oCopyLimit - op;
 2423|    679|                    op = oCopyLimit;
 2424|    679|                }
 2425|  2.53k|                while (op < cpy) { *op++ = *match++; }
  ------------------
  |  Branch (2425:24): [True: 796, False: 1.73k]
  ------------------
 2426|  4.07k|            } else {
 2427|  4.07k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  4.07k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2428|  4.07k|                if (length > 16) { LZ4_wildCopy8(op+8, match+8, cpy); }
  ------------------
  |  Branch (2428:21): [True: 689, False: 3.38k]
  ------------------
 2429|  4.07k|            }
 2430|  5.81k|            op = cpy;   /* wildcopy correction */
 2431|  5.81k|        }
 2432|       |
 2433|       |        /* end of decoding */
 2434|  3.75k|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  290|  3.75k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2435|  3.75k|        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|  2.29k|    }
 2441|  2.29k|}
lz4.c:read_variable_length:
 1977|  8.76k|{
 1978|  8.76k|    Rvl_t s, length = 0;
 1979|  8.76k|    assert(ip != NULL);
  ------------------
  |  Branch (1979:5): [True: 0, False: 8.76k]
  |  Branch (1979:5): [True: 8.76k, False: 0]
  ------------------
 1980|  8.76k|    assert(*ip !=  NULL);
  ------------------
  |  Branch (1980:5): [True: 0, False: 8.76k]
  |  Branch (1980:5): [True: 8.76k, False: 0]
  ------------------
 1981|  8.76k|    assert(ilimit != NULL);
  ------------------
  |  Branch (1981:5): [True: 0, False: 8.76k]
  |  Branch (1981:5): [True: 8.76k, False: 0]
  ------------------
 1982|  8.76k|    if (initial_check && unlikely((*ip) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|  1.16k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  1.16k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 1.16k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1982:9): [True: 1.16k, False: 7.60k]
  ------------------
 1983|      0|        return rvl_error;
 1984|      0|    }
 1985|  8.76k|    s = **ip;
 1986|  8.76k|    (*ip)++;
 1987|  8.76k|    length += s;
 1988|  8.76k|    if (unlikely((*ip) > ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|  8.76k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  8.76k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 8.76k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1989|      0|        return rvl_error;
 1990|      0|    }
 1991|       |    /* accumulator overflow detection (32-bit mode only) */
 1992|  8.76k|    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: 8.76k]
  ------------------
 1993|      0|        return rvl_error;
 1994|      0|    }
 1995|  8.76k|    if (likely(s != 255)) return length;
  ------------------
  |  |  178|  8.76k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  8.76k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 5.66k, False: 3.10k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1996|  46.2k|    do {
 1997|  46.2k|        s = **ip;
 1998|  46.2k|        (*ip)++;
 1999|  46.2k|        length += s;
 2000|  46.2k|        if (unlikely((*ip) > ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|  46.2k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  46.2k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 46.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2001|      0|            return rvl_error;
 2002|      0|        }
 2003|       |        /* accumulator overflow detection (32-bit mode only) */
 2004|  46.2k|        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: 46.2k]
  ------------------
 2005|      0|            return rvl_error;
 2006|      0|        }
 2007|  46.2k|    } while (s == 255);
  ------------------
  |  Branch (2007:14): [True: 43.1k, False: 3.10k]
  ------------------
 2008|       |
 2009|  3.10k|    return length;
 2010|  3.10k|}
lz4.c:LZ4_wildCopy32:
  519|  4.03k|{
  520|  4.03k|    BYTE* d = (BYTE*)dstPtr;
  521|  4.03k|    const BYTE* s = (const BYTE*)srcPtr;
  522|  4.03k|    BYTE* const e = (BYTE*)dstEnd;
  523|       |
  524|   100k|    do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  350|   100k|#    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|   100k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (524:79): [True: 96.1k, False: 4.03k]
  ------------------
  525|  4.03k|}
lz4.c:LZ4_readLE16:
  432|  19.8k|{
  433|  19.8k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (433:9): [True: 19.8k, False: 0]
  ------------------
  434|  19.8k|        return LZ4_read16(memPtr);
  435|  19.8k|    } else {
  436|      0|        const BYTE* p = (const BYTE*)memPtr;
  437|      0|        return (U16)((U16)p[0] | (p[1]<<8));
  438|      0|    }
  439|  19.8k|}
lz4.c:LZ4_memcpy_using_offset:
  532|  6.29k|{
  533|  6.29k|    BYTE v[8];
  534|       |
  535|  6.29k|    assert(dstEnd >= dstPtr + MINMATCH);
  ------------------
  |  Branch (535:5): [True: 0, False: 6.29k]
  |  Branch (535:5): [True: 6.29k, False: 0]
  ------------------
  536|       |
  537|  6.29k|    switch(offset) {
  538|  1.75k|    case 1:
  ------------------
  |  Branch (538:5): [True: 1.75k, False: 4.53k]
  ------------------
  539|  1.75k|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  237|  1.75k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  235|  1.75k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  540|  1.75k|        break;
  541|  3.08k|    case 2:
  ------------------
  |  Branch (541:5): [True: 3.08k, False: 3.21k]
  ------------------
  542|  3.08k|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  350|  3.08k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  543|  3.08k|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  350|  3.08k|#    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|  3.08k|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  350|  3.08k|#    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|  3.08k|        break;
  553|    384|    case 4:
  ------------------
  |  Branch (553:5): [True: 384, False: 5.90k]
  ------------------
  554|    384|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  350|    384|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  555|    384|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  350|    384|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  556|    384|        break;
  557|  1.06k|    default:
  ------------------
  |  Branch (557:5): [True: 1.06k, False: 5.22k]
  ------------------
  558|  1.06k|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  559|  1.06k|        return;
  560|  6.29k|    }
  561|       |
  562|  5.22k|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  350|  5.22k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  563|  5.22k|    dstPtr += 8;
  564|  1.01M|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (564:12): [True: 1.01M, False: 5.22k]
  ------------------
  565|  1.01M|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  350|  1.01M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  566|  1.01M|        dstPtr += 8;
  567|  1.01M|    }
  568|  5.22k|}
lz4.c:LZ4_memcpy_using_offset_base:
  493|  1.06k|{
  494|  1.06k|    assert(srcPtr + offset == dstPtr);
  ------------------
  |  Branch (494:5): [True: 0, False: 1.06k]
  |  Branch (494:5): [True: 1.06k, False: 0]
  ------------------
  495|  1.06k|    if (offset < 8) {
  ------------------
  |  Branch (495:9): [True: 973, False: 96]
  ------------------
  496|    973|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  497|    973|        dstPtr[0] = srcPtr[0];
  498|    973|        dstPtr[1] = srcPtr[1];
  499|    973|        dstPtr[2] = srcPtr[2];
  500|    973|        dstPtr[3] = srcPtr[3];
  501|    973|        srcPtr += inc32table[offset];
  502|    973|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  350|    973|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  503|    973|        srcPtr -= dec64table[offset];
  504|    973|        dstPtr += 8;
  505|    973|    } else {
  506|     96|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  350|     96|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  507|     96|        dstPtr += 8;
  508|     96|        srcPtr += 8;
  509|     96|    }
  510|       |
  511|  1.06k|    LZ4_wildCopy8(dstPtr, srcPtr, dstEnd);
  512|  1.06k|}

LLVMFuzzerTestOneInput:
   17|  2.18k|{
   18|  2.18k|    FUZZ_dataProducer_t *producer = FUZZ_dataProducer_create(data, size);
   19|  2.18k|    size_t const dstCapacitySeed = FUZZ_dataProducer_retrieve32(producer);
   20|  2.18k|    size = FUZZ_dataProducer_remainingBytes(producer);
   21|       |
   22|  2.18k|    size_t const compressBound = LZ4_compressBound(size);
   23|  2.18k|    size_t const dstCapacity = FUZZ_getRange_from_uint32(dstCapacitySeed, 0, compressBound);
   24|       |
   25|  2.18k|    char* const dst = (char*)malloc(dstCapacity);
   26|  2.18k|    char* const rt = (char*)malloc(size);
   27|       |
   28|  2.18k|    FUZZ_ASSERT(dst);
  ------------------
  |  |   47|  2.18k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  2.18k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 2.18k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  2.18k|          : (fprintf(stderr, "%s: %u: Assertion: `%s' failed. %s\n", __FILE__, \
  |  |  |  |   45|      0|                     __LINE__, FUZZ_QUOTE(cond), (msg)),                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      0|#define FUZZ_QUOTE(str) FUZZ_QUOTE_IMPL(str)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   36|      0|#define FUZZ_QUOTE_IMPL(str) #str
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   46|      0|             abort()))
  |  |  ------------------
  ------------------
   29|  2.18k|    FUZZ_ASSERT(rt);
  ------------------
  |  |   47|  2.18k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  2.18k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 2.18k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  2.18k|          : (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()))
  |  |  ------------------
  ------------------
   30|       |
   31|       |    /* If compression succeeds it must round trip correctly. */
   32|  2.18k|    {
   33|  2.18k|        int const dstSize = LZ4_compress_default((const char*)data, dst,
   34|  2.18k|                                                 size, dstCapacity);
   35|  2.18k|        if (dstSize > 0) {
  ------------------
  |  Branch (35:13): [True: 1.60k, False: 581]
  ------------------
   36|  1.60k|            int const rtSize = LZ4_decompress_safe(dst, rt, dstSize, size);
   37|  1.60k|            FUZZ_ASSERT_MSG(rtSize == size, "Incorrect regenerated size");
  ------------------
  |  |   43|  1.60k|  ((cond) ? (void)0                                                            \
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 1.60k, False: 0]
  |  |  ------------------
  |  |   44|  1.60k|          : (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()))
  ------------------
   38|  1.60k|            FUZZ_ASSERT_MSG(!memcmp(data, rt, size), "Corruption!");
  ------------------
  |  |   43|  1.60k|  ((cond) ? (void)0                                                            \
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 1.60k, False: 0]
  |  |  ------------------
  |  |   44|  1.60k|          : (fprintf(stderr, "%s: %u: Assertion: `%s' failed. %s\n", __FILE__, \
  |  |   45|      0|                     __LINE__, FUZZ_QUOTE(cond), (msg)),                       \
  |  |  ------------------
  |  |  |  |   37|      0|#define FUZZ_QUOTE(str) FUZZ_QUOTE_IMPL(str)
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      0|#define FUZZ_QUOTE_IMPL(str) #str
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   46|      0|             abort()))
  ------------------
   39|  1.60k|        }
   40|  2.18k|    }
   41|       |
   42|  2.18k|    if (dstCapacity > 0) {
  ------------------
  |  Branch (42:9): [True: 2.17k, False: 16]
  ------------------
   43|       |        /* Compression succeeds and must round trip correctly. */
   44|  2.17k|        int compressedSize = size;
   45|  2.17k|        int const dstSize = LZ4_compress_destSize((const char*)data, dst,
   46|  2.17k|                                                  &compressedSize, dstCapacity);
   47|  2.17k|        FUZZ_ASSERT(dstSize > 0);
  ------------------
  |  |   47|  2.17k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  2.17k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 2.17k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  2.17k|          : (fprintf(stderr, "%s: %u: Assertion: `%s' failed. %s\n", __FILE__, \
  |  |  |  |   45|      0|                     __LINE__, FUZZ_QUOTE(cond), (msg)),                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      0|#define FUZZ_QUOTE(str) FUZZ_QUOTE_IMPL(str)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   36|      0|#define FUZZ_QUOTE_IMPL(str) #str
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   46|      0|             abort()))
  |  |  ------------------
  ------------------
   48|  2.17k|        int const rtSize = LZ4_decompress_safe(dst, rt, dstSize, size);
   49|  2.17k|        FUZZ_ASSERT_MSG(rtSize == compressedSize, "Incorrect regenerated size");
  ------------------
  |  |   43|  2.17k|  ((cond) ? (void)0                                                            \
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 2.17k, False: 0]
  |  |  ------------------
  |  |   44|  2.17k|          : (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()))
  ------------------
   50|  2.17k|        FUZZ_ASSERT_MSG(!memcmp(data, rt, compressedSize), "Corruption!");
  ------------------
  |  |   43|  2.17k|  ((cond) ? (void)0                                                            \
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 2.17k, False: 0]
  |  |  ------------------
  |  |   44|  2.17k|          : (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()))
  ------------------
   51|  2.17k|    }
   52|       |
   53|  2.18k|    free(dst);
   54|  2.18k|    free(rt);
   55|  2.18k|    FUZZ_dataProducer_free(producer);
   56|       |
   57|  2.18k|    return 0;
   58|  2.18k|}

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

