LZ4_compressBound:
  760|  7.10k|int LZ4_compressBound(int isize)  { return LZ4_COMPRESSBOUND(isize); }
  ------------------
  |  |  215|  7.10k|#define LZ4_COMPRESSBOUND(isize)  ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
  |  |  ------------------
  |  |  |  |  214|  7.10k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  |  |  ------------------
  |  |  |  Branch (215:36): [True: 0, False: 7.10k]
  |  |  ------------------
  ------------------
LZ4_compress_fast_extState:
 1392|  2.78k|{
 1393|  2.78k|    LZ4_stream_t_internal* const ctx = & LZ4_initStream(state, sizeof(LZ4_stream_t)) -> internal_donotuse;
 1394|  2.78k|    assert(ctx != NULL);
  ------------------
  |  Branch (1394:5): [True: 0, False: 2.78k]
  |  Branch (1394:5): [True: 2.78k, False: 0]
  ------------------
 1395|  2.78k|    if (acceleration < 1) acceleration = LZ4_ACCELERATION_DEFAULT;
  ------------------
  |  |   52|      0|#define LZ4_ACCELERATION_DEFAULT 1
  ------------------
  |  Branch (1395:9): [True: 0, False: 2.78k]
  ------------------
 1396|  2.78k|    if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX;
  ------------------
  |  |   58|  2.78k|#define LZ4_ACCELERATION_MAX 65537
  ------------------
                  if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX;
  ------------------
  |  |   58|      0|#define LZ4_ACCELERATION_MAX 65537
  ------------------
  |  Branch (1396:9): [True: 0, False: 2.78k]
  ------------------
 1397|  2.78k|    if (maxOutputSize >= LZ4_compressBound(inputSize)) {
  ------------------
  |  Branch (1397:9): [True: 1.23k, False: 1.54k]
  ------------------
 1398|  1.23k|        if (inputSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1398:13): [True: 1.23k, False: 0]
  ------------------
 1399|  1.23k|            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, 0, notLimited, byU16, noDict, noDictIssue, acceleration);
 1400|  1.23k|        } else {
 1401|      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 (1401:44): [Folded, False: 0]
  |  Branch (1401:66): [True: 0, False: 0]
  ------------------
 1402|      0|            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, 0, notLimited, tableType, noDict, noDictIssue, acceleration);
 1403|      0|        }
 1404|  1.54k|    } else {
 1405|  1.54k|        if (inputSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1405:13): [True: 1.27k, False: 276]
  ------------------
 1406|  1.27k|            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, byU16, noDict, noDictIssue, acceleration);
 1407|  1.27k|        } else {
 1408|    276|            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 (1408:44): [Folded, False: 276]
  |  Branch (1408:66): [True: 0, False: 0]
  ------------------
 1409|       |            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, noDict, noDictIssue, acceleration);
 1410|    276|        }
 1411|  1.54k|    }
 1412|  2.78k|}
LZ4_compress_fast:
 1463|  2.16k|{
 1464|  2.16k|    int result;
 1465|       |#if (LZ4_HEAPMODE)
 1466|       |    LZ4_stream_t* const ctxPtr = (LZ4_stream_t*)ALLOC(sizeof(LZ4_stream_t));   /* malloc-calloc always properly aligned */
 1467|       |    if (ctxPtr == NULL) return 0;
 1468|       |#else
 1469|  2.16k|    LZ4_stream_t ctx;
 1470|  2.16k|    LZ4_stream_t* const ctxPtr = &ctx;
 1471|  2.16k|#endif
 1472|  2.16k|    result = LZ4_compress_fast_extState(ctxPtr, src, dest, srcSize, dstCapacity, acceleration);
 1473|       |
 1474|       |#if (LZ4_HEAPMODE)
 1475|       |    FREEMEM(ctxPtr);
 1476|       |#endif
 1477|  2.16k|    return result;
 1478|  2.16k|}
LZ4_compress_default:
 1482|  2.16k|{
 1483|  2.16k|    return LZ4_compress_fast(src, dst, srcSize, dstCapacity, 1);
 1484|  2.16k|}
LZ4_compress_destSize:
 1516|  2.15k|{
 1517|       |#if (LZ4_HEAPMODE)
 1518|       |    LZ4_stream_t* const ctx = (LZ4_stream_t*)ALLOC(sizeof(LZ4_stream_t));   /* malloc-calloc always properly aligned */
 1519|       |    if (ctx == NULL) return 0;
 1520|       |#else
 1521|  2.15k|    LZ4_stream_t ctxBody;
 1522|  2.15k|    LZ4_stream_t* const ctx = &ctxBody;
 1523|  2.15k|#endif
 1524|       |
 1525|  2.15k|    int result = LZ4_compress_destSize_extState_internal(ctx, src, dst, srcSizePtr, targetDstSize, 1);
 1526|       |
 1527|       |#if (LZ4_HEAPMODE)
 1528|       |    FREEMEM(ctx);
 1529|       |#endif
 1530|  2.15k|    return result;
 1531|  2.15k|}
LZ4_initStream:
 1562|  4.93k|{
 1563|  4.93k|    DEBUGLOG(5, "LZ4_initStream");
  ------------------
  |  |  290|  4.93k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1564|  4.93k|    if (buffer == NULL) { return NULL; }
  ------------------
  |  Branch (1564:9): [True: 0, False: 4.93k]
  ------------------
 1565|  4.93k|    if (size < sizeof(LZ4_stream_t)) { return NULL; }
  ------------------
  |  Branch (1565:9): [True: 0, False: 4.93k]
  ------------------
 1566|  4.93k|    if (!LZ4_isAligned(buffer, LZ4_stream_t_alignment())) return NULL;
  ------------------
  |  Branch (1566:9): [True: 0, False: 4.93k]
  ------------------
 1567|  4.93k|    MEM_INIT(buffer, 0, sizeof(LZ4_stream_t_internal));
  ------------------
  |  |  237|  4.93k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  235|  4.93k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 1568|  4.93k|    return (LZ4_stream_t*)buffer;
 1569|  4.93k|}
LZ4_decompress_safe:
 2471|  3.75k|{
 2472|  3.75k|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2473|  3.75k|                                  decode_full_block, noDict,
 2474|       |                                  (BYTE*)dest, NULL, 0);
 2475|  3.75k|}
lz4.c:LZ4_compress_generic:
 1365|  4.31k|{
 1366|  4.31k|    DEBUGLOG(5, "LZ4_compress_generic: srcSize=%i, dstCapacity=%i",
  ------------------
  |  |  290|  4.31k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1367|  4.31k|                srcSize, dstCapacity);
 1368|       |
 1369|  4.31k|    if ((U32)srcSize > (U32)LZ4_MAX_INPUT_SIZE) { return 0; }  /* Unsupported srcSize, too large (or negative) */
  ------------------
  |  |  214|  4.31k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  ------------------
  |  Branch (1369:9): [True: 0, False: 4.31k]
  ------------------
 1370|  4.31k|    if (srcSize == 0) {   /* src == NULL supported if srcSize == 0 */
  ------------------
  |  Branch (1370:9): [True: 19, False: 4.30k]
  ------------------
 1371|     19|        if (outputDirective != notLimited && dstCapacity <= 0) return 0;  /* no output, can't write anything */
  ------------------
  |  Branch (1371:13): [True: 17, False: 2]
  |  Branch (1371:46): [True: 1, False: 16]
  ------------------
 1372|     18|        DEBUGLOG(5, "Generating an empty block");
  ------------------
  |  |  290|     18|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1373|     18|        assert(outputDirective == notLimited || dstCapacity >= 1);
  ------------------
  |  Branch (1373:9): [True: 18, False: 0]
  |  Branch (1373:9): [True: 0, False: 0]
  |  Branch (1373:9): [True: 2, False: 16]
  |  Branch (1373:9): [True: 16, False: 0]
  ------------------
 1374|     18|        assert(dst != NULL);
  ------------------
  |  Branch (1374:9): [True: 0, False: 18]
  |  Branch (1374:9): [True: 18, False: 0]
  ------------------
 1375|     18|        dst[0] = 0;
 1376|     18|        if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1376:13): [True: 8, False: 10]
  ------------------
 1377|      8|            assert (inputConsumed != NULL);
  ------------------
  |  Branch (1377:13): [True: 0, False: 8]
  |  Branch (1377:13): [True: 8, False: 0]
  ------------------
 1378|      8|            *inputConsumed = 0;
 1379|      8|        }
 1380|     18|        return 1;
 1381|     18|    }
 1382|  4.31k|    assert(src != NULL);
  ------------------
  |  Branch (1382:5): [True: 0, False: 4.30k]
  |  Branch (1382:5): [True: 4.30k, False: 0]
  ------------------
 1383|       |
 1384|  4.30k|    return LZ4_compress_generic_validated(cctx, src, dst, srcSize,
 1385|  4.30k|                inputConsumed, /* only written into if outputDirective == fillOutput */
 1386|  4.30k|                dstCapacity, outputDirective,
 1387|  4.30k|                tableType, dictDirective, dictIssue, acceleration);
 1388|  4.30k|}
lz4.c:LZ4_compress_generic_validated:
  951|  4.30k|{
  952|  4.30k|    int result;
  953|  4.30k|    const BYTE* ip = (const BYTE*)source;
  954|       |
  955|  4.30k|    U32 const startIndex = cctx->currentOffset;
  956|  4.30k|    const BYTE* base = (const BYTE*)source - startIndex;
  957|  4.30k|    const BYTE* lowLimit;
  958|       |
  959|  4.30k|    const LZ4_stream_t_internal* dictCtx = (const LZ4_stream_t_internal*) cctx->dictCtx;
  960|  4.30k|    const BYTE* const dictionary =
  961|  4.30k|        dictDirective == usingDictCtx ? dictCtx->dictionary : cctx->dictionary;
  ------------------
  |  Branch (961:9): [True: 0, False: 4.30k]
  ------------------
  962|  4.30k|    const U32 dictSize =
  963|  4.30k|        dictDirective == usingDictCtx ? dictCtx->dictSize : cctx->dictSize;
  ------------------
  |  Branch (963:9): [True: 0, False: 4.30k]
  ------------------
  964|  4.30k|    const U32 dictDelta =
  965|  4.30k|        (dictDirective == usingDictCtx) ? startIndex - dictCtx->currentOffset : 0;   /* make indexes in dictCtx comparable with indexes in current context */
  ------------------
  |  Branch (965:9): [True: 0, False: 4.30k]
  ------------------
  966|       |
  967|  4.30k|    int const maybe_extMem = (dictDirective == usingExtDict) || (dictDirective == usingDictCtx);
  ------------------
  |  Branch (967:30): [True: 0, False: 4.30k]
  |  Branch (967:65): [True: 0, False: 4.30k]
  ------------------
  968|  4.30k|    U32 const prefixIdxLimit = startIndex - dictSize;   /* used when dictDirective == dictSmall */
  969|  4.30k|    const BYTE* const dictEnd = dictionary ? dictionary + dictSize : dictionary;
  ------------------
  |  Branch (969:33): [True: 0, False: 4.30k]
  ------------------
  970|  4.30k|    const BYTE* anchor = (const BYTE*) source;
  971|  4.30k|    const BYTE* const iend = ip + inputSize;
  972|  4.30k|    const BYTE* const mflimitPlusOne = iend - MFLIMIT + 1;
  ------------------
  |  |  247|  4.30k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  973|  4.30k|    const BYTE* const matchlimit = iend - LASTLITERALS;
  ------------------
  |  |  246|  4.30k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  974|       |
  975|       |    /* the dictCtx currentOffset is indexed on the start of the dictionary,
  976|       |     * while a dictionary in the current context precedes the currentOffset */
  977|  4.30k|    const BYTE* dictBase = (dictionary == NULL) ? NULL :
  ------------------
  |  Branch (977:28): [True: 4.30k, False: 0]
  ------------------
  978|  4.30k|                           (dictDirective == usingDictCtx) ?
  ------------------
  |  Branch (978:28): [True: 0, False: 0]
  ------------------
  979|      0|                            dictionary + dictSize - dictCtx->currentOffset :
  980|      0|                            dictionary + dictSize - startIndex;
  981|       |
  982|  4.30k|    BYTE* op = (BYTE*) dest;
  983|  4.30k|    BYTE* const olimit = op + maxOutputSize;
  984|       |
  985|  4.30k|    U32 offset = 0;
  986|  4.30k|    U32 forwardH;
  987|       |
  988|  4.30k|    DEBUGLOG(5, "LZ4_compress_generic_validated: srcSize=%i, tableType=%u", inputSize, tableType);
  ------------------
  |  |  290|  4.30k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  989|  4.30k|    assert(ip != NULL);
  ------------------
  |  Branch (989:5): [True: 0, False: 4.30k]
  |  Branch (989:5): [True: 4.30k, False: 0]
  ------------------
  990|  4.30k|    if (tableType == byU16) assert(inputSize<LZ4_64Klimit);  /* Size too large (not within 64K limit) */
  ------------------
  |  Branch (990:9): [True: 3.75k, False: 545]
  |  Branch (990:29): [True: 0, False: 3.75k]
  |  Branch (990:29): [True: 3.75k, False: 0]
  ------------------
  991|  4.30k|    if (tableType == byPtr) assert(dictDirective==noDict);   /* only supported use case with byPtr */
  ------------------
  |  Branch (991:9): [True: 0, False: 4.30k]
  |  Branch (991:29): [True: 0, False: 0]
  |  Branch (991:29): [True: 0, False: 0]
  ------------------
  992|       |    /* If init conditions are not met, we don't have to mark stream
  993|       |     * as having dirty context, since no action was taken yet */
  994|  4.30k|    if (outputDirective == fillOutput && maxOutputSize < 1) { return 0; } /* Impossible to store anything */
  ------------------
  |  Branch (994:9): [True: 1.52k, False: 2.77k]
  |  Branch (994:42): [True: 0, False: 1.52k]
  ------------------
  995|  4.30k|    assert(acceleration >= 1);
  ------------------
  |  Branch (995:5): [True: 0, False: 4.30k]
  |  Branch (995:5): [True: 4.30k, False: 0]
  ------------------
  996|       |
  997|  4.30k|    lowLimit = (const BYTE*)source - (dictDirective == withPrefix64k ? dictSize : 0);
  ------------------
  |  Branch (997:39): [True: 0, False: 4.30k]
  ------------------
  998|       |
  999|       |    /* Update context state */
 1000|  4.30k|    if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1000:9): [True: 0, False: 4.30k]
  ------------------
 1001|       |        /* Subsequent linked blocks can't use the dictionary. */
 1002|       |        /* Instead, they use the block we just compressed. */
 1003|      0|        cctx->dictCtx = NULL;
 1004|      0|        cctx->dictSize = (U32)inputSize;
 1005|  4.30k|    } else {
 1006|  4.30k|        cctx->dictSize += (U32)inputSize;
 1007|  4.30k|    }
 1008|  4.30k|    cctx->currentOffset += (U32)inputSize;
 1009|  4.30k|    cctx->tableType = (U32)tableType;
 1010|       |
 1011|  4.30k|    if (inputSize<LZ4_minLength) goto _last_literals;        /* Input too small, no compression (all literals) */
  ------------------
  |  Branch (1011:9): [True: 60, False: 4.24k]
  ------------------
 1012|       |
 1013|       |    /* First Byte */
 1014|  4.24k|    {   U32 const h = LZ4_hashPosition(ip, tableType);
 1015|  4.24k|        if (tableType == byPtr) {
  ------------------
  |  Branch (1015:13): [True: 0, False: 4.24k]
  ------------------
 1016|      0|            LZ4_putPositionOnHash(ip, h, cctx->hashTable, byPtr);
 1017|  4.24k|        } else {
 1018|  4.24k|            LZ4_putIndexOnHash(startIndex, h, cctx->hashTable, tableType);
 1019|  4.24k|    }   }
 1020|  4.24k|    ip++; forwardH = LZ4_hashPosition(ip, tableType);
 1021|       |
 1022|       |    /* Main Loop */
 1023|  18.2k|    for ( ; ; ) {
 1024|  18.2k|        const BYTE* match;
 1025|  18.2k|        BYTE* token;
 1026|  18.2k|        const BYTE* filledIp;
 1027|       |
 1028|       |        /* Find a match */
 1029|  18.2k|        if (tableType == byPtr) {
  ------------------
  |  Branch (1029:13): [True: 0, False: 18.2k]
  ------------------
 1030|      0|            const BYTE* forwardIp = ip;
 1031|      0|            int step = 1;
 1032|      0|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1033|      0|            do {
 1034|      0|                U32 const h = forwardH;
 1035|      0|                ip = forwardIp;
 1036|      0|                forwardIp += step;
 1037|      0|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1038|       |
 1039|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1040|      0|                assert(ip < mflimitPlusOne);
  ------------------
  |  Branch (1040:17): [True: 0, False: 0]
  |  Branch (1040:17): [True: 0, False: 0]
  ------------------
 1041|       |
 1042|      0|                match = LZ4_getPositionOnHash(h, cctx->hashTable, tableType);
 1043|      0|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1044|      0|                LZ4_putPositionOnHash(ip, h, cctx->hashTable, tableType);
 1045|       |
 1046|      0|            } while ( (match+LZ4_DISTANCE_MAX < ip)
  ------------------
  |  |  676|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1046:23): [True: 0, False: 0]
  ------------------
 1047|      0|                   || (LZ4_read32(match) != LZ4_read32(ip)) );
  ------------------
  |  Branch (1047:23): [True: 0, False: 0]
  ------------------
 1048|       |
 1049|  18.2k|        } else {   /* byU32, byU16 */
 1050|       |
 1051|  18.2k|            const BYTE* forwardIp = ip;
 1052|  18.2k|            int step = 1;
 1053|  18.2k|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1054|   612k|            do {
 1055|   612k|                U32 const h = forwardH;
 1056|   612k|                U32 const current = (U32)(forwardIp - base);
 1057|   612k|                U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1058|   612k|                assert(matchIndex <= current);
  ------------------
  |  Branch (1058:17): [True: 0, False: 612k]
  |  Branch (1058:17): [True: 612k, False: 0]
  ------------------
 1059|   612k|                assert(forwardIp - base < (ptrdiff_t)(2 GB - 1));
  ------------------
  |  Branch (1059:17): [True: 0, False: 612k]
  |  Branch (1059:17): [True: 612k, False: 0]
  ------------------
 1060|   612k|                ip = forwardIp;
 1061|   612k|                forwardIp += step;
 1062|   612k|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1063|       |
 1064|   612k|                if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
  ------------------
  |  |  181|   612k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   612k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.67k, False: 611k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1065|   612k|                assert(ip < mflimitPlusOne);
  ------------------
  |  Branch (1065:17): [True: 0, False: 611k]
  |  Branch (1065:17): [True: 611k, False: 0]
  ------------------
 1066|       |
 1067|   611k|                if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1067:21): [True: 0, False: 611k]
  ------------------
 1068|      0|                    if (matchIndex < startIndex) {
  ------------------
  |  Branch (1068:25): [True: 0, False: 0]
  ------------------
 1069|       |                        /* there was no match, try the dictionary */
 1070|      0|                        assert(tableType == byU32);
  ------------------
  |  Branch (1070:25): [True: 0, False: 0]
  |  Branch (1070:25): [True: 0, False: 0]
  ------------------
 1071|      0|                        matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32);
 1072|      0|                        match = dictBase + matchIndex;
 1073|      0|                        matchIndex += dictDelta;   /* make dictCtx index comparable with current context */
 1074|      0|                        lowLimit = dictionary;
 1075|      0|                    } else {
 1076|      0|                        match = base + matchIndex;
 1077|      0|                        lowLimit = (const BYTE*)source;
 1078|      0|                    }
 1079|   611k|                } else if (dictDirective == usingExtDict) {
  ------------------
  |  Branch (1079:28): [True: 0, False: 611k]
  ------------------
 1080|      0|                    if (matchIndex < startIndex) {
  ------------------
  |  Branch (1080:25): [True: 0, False: 0]
  ------------------
 1081|      0|                        DEBUGLOG(7, "extDict candidate: matchIndex=%5u  <  startIndex=%5u", matchIndex, startIndex);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1082|      0|                        assert(startIndex - matchIndex >= MINMATCH);
  ------------------
  |  Branch (1082:25): [True: 0, False: 0]
  |  Branch (1082:25): [True: 0, False: 0]
  ------------------
 1083|      0|                        assert(dictBase);
  ------------------
  |  Branch (1083:25): [True: 0, False: 0]
  |  Branch (1083:25): [True: 0, False: 0]
  ------------------
 1084|      0|                        match = dictBase + matchIndex;
 1085|      0|                        lowLimit = dictionary;
 1086|      0|                    } else {
 1087|      0|                        match = base + matchIndex;
 1088|      0|                        lowLimit = (const BYTE*)source;
 1089|      0|                    }
 1090|   611k|                } else {   /* single continuous memory segment */
 1091|   611k|                    match = base + matchIndex;
 1092|   611k|                }
 1093|   611k|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1094|   611k|                LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1095|       |
 1096|   611k|                DEBUGLOG(7, "candidate at pos=%u  (offset=%u \n", matchIndex, current - matchIndex);
  ------------------
  |  |  290|   611k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1097|   611k|                if ((dictIssue == dictSmall) && (matchIndex < prefixIdxLimit)) { continue; }    /* match outside of valid area */
  ------------------
  |  Branch (1097:21): [True: 0, False: 611k]
  |  Branch (1097:49): [True: 0, False: 0]
  ------------------
 1098|   611k|                assert(matchIndex < current);
  ------------------
  |  Branch (1098:17): [True: 0, False: 611k]
  |  Branch (1098:17): [True: 611k, False: 0]
  ------------------
 1099|   611k|                if ( ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  676|  84.6k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                              if ( ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  256|  84.6k|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
  |  Branch (1099:23): [True: 526k, False: 84.6k]
  |  Branch (1099:47): [Folded, False: 0]
  ------------------
 1100|   526k|                  && (matchIndex+LZ4_DISTANCE_MAX < current)) {
  ------------------
  |  |  676|   526k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1100:22): [True: 232k, False: 294k]
  ------------------
 1101|   232k|                    continue;
 1102|   232k|                } /* too far */
 1103|   611k|                assert((current - matchIndex) <= LZ4_DISTANCE_MAX);  /* match now expected within distance */
  ------------------
  |  Branch (1103:17): [True: 0, False: 378k]
  |  Branch (1103:17): [True: 378k, False: 0]
  ------------------
 1104|       |
 1105|   378k|                if (LZ4_read32(match) == LZ4_read32(ip)) {
  ------------------
  |  Branch (1105:21): [True: 16.5k, False: 362k]
  ------------------
 1106|  16.5k|                    if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1106:25): [True: 0, False: 16.5k]
  ------------------
 1107|  16.5k|                    break;   /* match found */
 1108|  16.5k|                }
 1109|       |
 1110|   594k|            } while(1);
  ------------------
  |  Branch (1110:21): [True: 594k, Folded]
  ------------------
 1111|  18.2k|        }
 1112|       |
 1113|       |        /* Catch up */
 1114|  16.5k|        filledIp = ip;
 1115|  16.5k|        assert(ip > anchor); /* this is always true as ip has been advanced before entering the main loop */
  ------------------
  |  Branch (1115:9): [True: 0, False: 16.5k]
  |  Branch (1115:9): [True: 16.5k, False: 0]
  ------------------
 1116|  16.5k|        if ((match > lowLimit) && unlikely(ip[-1] == match[-1])) {
  ------------------
  |  |  181|  13.8k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  13.8k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.50k, False: 12.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1116:13): [True: 13.8k, False: 2.78k]
  ------------------
 1117|  9.98k|            do { ip--; match--; } while (((ip > anchor) & (match > lowLimit)) && (unlikely(ip[-1] == match[-1])));
  ------------------
  |  |  181|  8.98k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  8.98k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1117:42): [True: 8.98k, False: 1.00k]
  |  Branch (1117:82): [True: 8.47k, False: 506]
  ------------------
 1118|  1.50k|        }
 1119|       |
 1120|       |        /* Encode Literals */
 1121|  16.5k|        {   unsigned const litLength = (unsigned)(ip - anchor);
 1122|  16.5k|            token = op++;
 1123|  16.5k|            if ((outputDirective == limitedOutput) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1123:17): [True: 7.43k, False: 9.15k]
  ------------------
 1124|  7.43k|                (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength/255) > olimit)) ) {
  ------------------
  |  |  181|  7.43k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  7.43k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1124:17): [True: 172, False: 7.26k]
  ------------------
 1125|    172|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1126|    172|            }
 1127|  16.4k|            if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1127:17): [True: 7.39k, False: 9.01k]
  ------------------
 1128|  7.39k|                (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.39k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  7.39k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1128:17): [True: 234, False: 7.16k]
  ------------------
 1129|    234|                op--;
 1130|    234|                goto _last_literals;
 1131|    234|            }
 1132|  16.1k|            if (litLength >= RUN_MASK) {
  ------------------
  |  |  264|  16.1k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  16.1k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  16.1k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1132:17): [True: 890, False: 15.2k]
  ------------------
 1133|    890|                unsigned len = litLength - RUN_MASK;
  ------------------
  |  |  264|    890|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    890|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    890|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1134|    890|                *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  264|    890|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    890|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    890|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                              *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  261|    890|#define ML_BITS  4
  ------------------
 1135|    890|                for(; len >= 255 ; len-=255) *op++ = 255;
  ------------------
  |  Branch (1135:23): [True: 0, False: 890]
  ------------------
 1136|    890|                *op++ = (BYTE)len;
 1137|    890|            }
 1138|  15.2k|            else *token = (BYTE)(litLength<<ML_BITS);
  ------------------
  |  |  261|  15.2k|#define ML_BITS  4
  ------------------
 1139|       |
 1140|       |            /* Copy Literals */
 1141|  16.1k|            LZ4_wildCopy8(op, anchor, op+litLength);
 1142|  16.1k|            op+=litLength;
 1143|  16.1k|            DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  290|  16.1k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1144|  16.1k|                        (int)(anchor-(const BYTE*)source), litLength, (int)(ip-(const BYTE*)source));
 1145|  16.1k|        }
 1146|       |
 1147|  26.6k|_next_match:
 1148|       |        /* at this stage, the following variables must be correctly set :
 1149|       |         * - ip : at start of LZ operation
 1150|       |         * - match : at start of previous pattern occurrence; can be within current prefix, or within extDict
 1151|       |         * - offset : if maybe_ext_memSegment==1 (constant)
 1152|       |         * - lowLimit : must be == dictionary to mean "match is within extDict"; must be == source otherwise
 1153|       |         * - token and *token : position to write 4-bits for match length; higher 4-bits for literal length supposed already written
 1154|       |         */
 1155|       |
 1156|  26.6k|        if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1156:13): [True: 12.2k, False: 14.3k]
  ------------------
 1157|  12.2k|            (op + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit)) {
  ------------------
  |  |  247|  12.2k|#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.2k|#define MINMATCH 4
  ------------------
  |  Branch (1157:13): [True: 180, False: 12.0k]
  ------------------
 1158|       |            /* the match was too close to the end, rewind and go to last literals */
 1159|    180|            op = token;
 1160|    180|            goto _last_literals;
 1161|    180|        }
 1162|       |
 1163|       |        /* Encode Offset */
 1164|  26.4k|        if (maybe_extMem) {   /* static test */
  ------------------
  |  Branch (1164:13): [True: 0, False: 26.4k]
  ------------------
 1165|      0|            DEBUGLOG(6, "             with offset=%u  (ext if > %i)", offset, (int)(ip - (const BYTE*)source));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1166|      0|            assert(offset <= LZ4_DISTANCE_MAX && offset > 0);
  ------------------
  |  Branch (1166:13): [True: 0, False: 0]
  |  Branch (1166:13): [True: 0, False: 0]
  |  Branch (1166:13): [True: 0, False: 0]
  |  Branch (1166:13): [True: 0, False: 0]
  ------------------
 1167|      0|            LZ4_writeLE16(op, (U16)offset); op+=2;
 1168|  26.4k|        } else  {
 1169|  26.4k|            DEBUGLOG(6, "             with offset=%u  (same segment)", (U32)(ip - match));
  ------------------
  |  |  290|  26.4k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1170|  26.4k|            assert(ip-match <= LZ4_DISTANCE_MAX);
  ------------------
  |  Branch (1170:13): [True: 0, False: 26.4k]
  |  Branch (1170:13): [True: 26.4k, False: 0]
  ------------------
 1171|  26.4k|            LZ4_writeLE16(op, (U16)(ip - match)); op+=2;
 1172|  26.4k|        }
 1173|       |
 1174|       |        /* Encode MatchLength */
 1175|  26.4k|        {   unsigned matchCode;
 1176|       |
 1177|  26.4k|            if ( (dictDirective==usingExtDict || dictDirective==usingDictCtx)
  ------------------
  |  Branch (1177:19): [True: 0, False: 26.4k]
  |  Branch (1177:50): [True: 0, False: 26.4k]
  ------------------
 1178|      0|              && (lowLimit==dictionary) /* match within extDict */ ) {
  ------------------
  |  Branch (1178:18): [True: 0, False: 0]
  ------------------
 1179|      0|                const BYTE* limit = ip + (dictEnd-match);
 1180|      0|                assert(dictEnd > match);
  ------------------
  |  Branch (1180:17): [True: 0, False: 0]
  |  Branch (1180:17): [True: 0, False: 0]
  ------------------
 1181|      0|                if (limit > matchlimit) limit = matchlimit;
  ------------------
  |  Branch (1181:21): [True: 0, False: 0]
  ------------------
 1182|      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
  ------------------
 1183|      0|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
 1184|      0|                if (ip==limit) {
  ------------------
  |  Branch (1184:21): [True: 0, False: 0]
  ------------------
 1185|      0|                    unsigned const more = LZ4_count(limit, (const BYTE*)source, matchlimit);
 1186|      0|                    matchCode += more;
 1187|      0|                    ip += more;
 1188|      0|                }
 1189|      0|                DEBUGLOG(6, "             with matchLength=%u starting in extDict", matchCode+MINMATCH);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1190|  26.4k|            } else {
 1191|  26.4k|                matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  243|  26.4k|#define MINMATCH 4
  ------------------
                              matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  243|  26.4k|#define MINMATCH 4
  ------------------
 1192|  26.4k|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  243|  26.4k|#define MINMATCH 4
  ------------------
 1193|  26.4k|                DEBUGLOG(6, "             with matchLength=%u", matchCode+MINMATCH);
  ------------------
  |  |  290|  26.4k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1194|  26.4k|            }
 1195|       |
 1196|  26.4k|            if ((outputDirective) &&    /* Check output buffer overflow */
  ------------------
  |  Branch (1196:17): [True: 24.2k, False: 2.13k]
  ------------------
 1197|  24.2k|                (unlikely(op + (1 + LASTLITERALS) + (matchCode+240)/255 > olimit)) ) {
  ------------------
  |  |  181|  24.2k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  24.2k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1197:17): [True: 317, False: 23.9k]
  ------------------
 1198|    317|                if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1198:21): [True: 127, False: 190]
  ------------------
 1199|       |                    /* Match description too long : reduce it */
 1200|    127|                    U32 newMatchCode = 15 /* in token */ - 1 /* to avoid needing a zero byte */ + ((U32)(olimit - op) - 1 - LASTLITERALS) * 255;
  ------------------
  |  |  246|    127|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1201|    127|                    ip -= matchCode - newMatchCode;
 1202|    127|                    assert(newMatchCode < matchCode);
  ------------------
  |  Branch (1202:21): [True: 0, False: 127]
  |  Branch (1202:21): [True: 127, False: 0]
  ------------------
 1203|    127|                    matchCode = newMatchCode;
 1204|    127|                    if (unlikely(ip <= filledIp)) {
  ------------------
  |  |  181|    127|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    127|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 127]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1205|       |                        /* We have already filled up to filledIp so if ip ends up less than filledIp
 1206|       |                         * we have positions in the hash table beyond the current position. This is
 1207|       |                         * a problem if we reuse the hash table. So we have to remove these positions
 1208|       |                         * from the hash table.
 1209|       |                         */
 1210|      0|                        const BYTE* ptr;
 1211|      0|                        DEBUGLOG(5, "Clearing %u positions", (U32)(filledIp - ip));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1212|      0|                        for (ptr = ip; ptr <= filledIp; ++ptr) {
  ------------------
  |  Branch (1212:40): [True: 0, False: 0]
  ------------------
 1213|      0|                            U32 const h = LZ4_hashPosition(ptr, tableType);
 1214|      0|                            LZ4_clearHash(h, cctx->hashTable, tableType);
 1215|      0|                        }
 1216|      0|                    }
 1217|    190|                } else {
 1218|    190|                    assert(outputDirective == limitedOutput);
  ------------------
  |  Branch (1218:21): [True: 0, False: 190]
  |  Branch (1218:21): [True: 190, False: 0]
  ------------------
 1219|    190|                    return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1220|    190|                }
 1221|    317|            }
 1222|  26.2k|            if (matchCode >= ML_MASK) {
  ------------------
  |  |  262|  26.2k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  26.2k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (1222:17): [True: 10.8k, False: 15.4k]
  ------------------
 1223|  10.8k|                *token += ML_MASK;
  ------------------
  |  |  262|  10.8k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  10.8k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1224|  10.8k|                matchCode -= ML_MASK;
  ------------------
  |  |  262|  10.8k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  10.8k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1225|  10.8k|                LZ4_write32(op, 0xFFFFFFFF);
 1226|  28.3k|                while (matchCode >= 4*255) {
  ------------------
  |  Branch (1226:24): [True: 17.4k, False: 10.8k]
  ------------------
 1227|  17.4k|                    op+=4;
 1228|  17.4k|                    LZ4_write32(op, 0xFFFFFFFF);
 1229|  17.4k|                    matchCode -= 4*255;
 1230|  17.4k|                }
 1231|  10.8k|                op += matchCode / 255;
 1232|  10.8k|                *op++ = (BYTE)(matchCode % 255);
 1233|  10.8k|            } else
 1234|  15.4k|                *token += (BYTE)(matchCode);
 1235|  26.2k|        }
 1236|       |        /* Ensure we have enough space for the last literals. */
 1237|  26.2k|        assert(!(outputDirective == fillOutput && op + 1 + LASTLITERALS > olimit));
  ------------------
  |  Branch (1237:9): [True: 0, False: 26.2k]
  |  Branch (1237:9): [True: 0, False: 0]
  |  Branch (1237:9): [True: 12.0k, False: 14.1k]
  |  Branch (1237:9): [True: 0, False: 12.0k]
  ------------------
 1238|       |
 1239|  26.2k|        anchor = ip;
 1240|       |
 1241|       |        /* Test end of chunk */
 1242|  26.2k|        if (ip >= mflimitPlusOne) break;
  ------------------
  |  Branch (1242:13): [True: 1.78k, False: 24.4k]
  ------------------
 1243|       |
 1244|       |        /* Fill table */
 1245|  24.4k|        {   U32 const h = LZ4_hashPosition(ip-2, tableType);
 1246|  24.4k|            if (tableType == byPtr) {
  ------------------
  |  Branch (1246:17): [True: 0, False: 24.4k]
  ------------------
 1247|      0|                LZ4_putPositionOnHash(ip-2, h, cctx->hashTable, byPtr);
 1248|  24.4k|            } else {
 1249|  24.4k|                U32 const idx = (U32)((ip-2) - base);
 1250|  24.4k|                LZ4_putIndexOnHash(idx, h, cctx->hashTable, tableType);
 1251|  24.4k|        }   }
 1252|       |
 1253|       |        /* Test next position */
 1254|  24.4k|        if (tableType == byPtr) {
  ------------------
  |  Branch (1254:13): [True: 0, False: 24.4k]
  ------------------
 1255|       |
 1256|      0|            match = LZ4_getPosition(ip, cctx->hashTable, tableType);
 1257|      0|            LZ4_putPosition(ip, cctx->hashTable, tableType);
 1258|      0|            if ( (match+LZ4_DISTANCE_MAX >= ip)
  ------------------
  |  |  676|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1258:18): [True: 0, False: 0]
  ------------------
 1259|      0|              && (LZ4_read32(match) == LZ4_read32(ip)) )
  ------------------
  |  Branch (1259:18): [True: 0, False: 0]
  ------------------
 1260|      0|            { token=op++; *token=0; goto _next_match; }
 1261|       |
 1262|  24.4k|        } else {   /* byU32, byU16 */
 1263|       |
 1264|  24.4k|            U32 const h = LZ4_hashPosition(ip, tableType);
 1265|  24.4k|            U32 const current = (U32)(ip-base);
 1266|  24.4k|            U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1267|  24.4k|            assert(matchIndex < current);
  ------------------
  |  Branch (1267:13): [True: 0, False: 24.4k]
  |  Branch (1267:13): [True: 24.4k, False: 0]
  ------------------
 1268|  24.4k|            if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1268:17): [True: 0, False: 24.4k]
  ------------------
 1269|      0|                if (matchIndex < startIndex) {
  ------------------
  |  Branch (1269:21): [True: 0, False: 0]
  ------------------
 1270|       |                    /* there was no match, try the dictionary */
 1271|      0|                    assert(tableType == byU32);
  ------------------
  |  Branch (1271:21): [True: 0, False: 0]
  |  Branch (1271:21): [True: 0, False: 0]
  ------------------
 1272|      0|                    matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32);
 1273|      0|                    match = dictBase + matchIndex;
 1274|      0|                    lowLimit = dictionary;   /* required for match length counter */
 1275|      0|                    matchIndex += dictDelta;
 1276|      0|                } else {
 1277|      0|                    match = base + matchIndex;
 1278|      0|                    lowLimit = (const BYTE*)source;  /* required for match length counter */
 1279|      0|                }
 1280|  24.4k|            } else if (dictDirective==usingExtDict) {
  ------------------
  |  Branch (1280:24): [True: 0, False: 24.4k]
  ------------------
 1281|      0|                if (matchIndex < startIndex) {
  ------------------
  |  Branch (1281:21): [True: 0, False: 0]
  ------------------
 1282|      0|                    assert(dictBase);
  ------------------
  |  Branch (1282:21): [True: 0, False: 0]
  |  Branch (1282:21): [True: 0, False: 0]
  ------------------
 1283|      0|                    match = dictBase + matchIndex;
 1284|      0|                    lowLimit = dictionary;   /* required for match length counter */
 1285|      0|                } else {
 1286|      0|                    match = base + matchIndex;
 1287|      0|                    lowLimit = (const BYTE*)source;   /* required for match length counter */
 1288|      0|                }
 1289|  24.4k|            } else {   /* single memory segment */
 1290|  24.4k|                match = base + matchIndex;
 1291|  24.4k|            }
 1292|  24.4k|            LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1293|  24.4k|            assert(matchIndex < current);
  ------------------
  |  Branch (1293:13): [True: 0, False: 24.4k]
  |  Branch (1293:13): [True: 24.4k, False: 0]
  ------------------
 1294|  24.4k|            if ( ((dictIssue==dictSmall) ? (matchIndex >= prefixIdxLimit) : 1)
  ------------------
  |  Branch (1294:18): [True: 24.4k, False: 0]
  |  Branch (1294:19): [True: 0, False: 24.4k]
  ------------------
 1295|  24.4k|              && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  676|  15.1k|#  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.1k|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
                            && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  676|  9.28k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1295:18): [True: 24.4k, False: 0]
  |  Branch (1295:20): [True: 15.1k, False: 9.28k]
  |  Branch (1295:42): [True: 0, Folded]
  ------------------
 1296|  24.4k|              && (LZ4_read32(match) == LZ4_read32(ip)) ) {
  ------------------
  |  Branch (1296:18): [True: 10.4k, False: 14.0k]
  ------------------
 1297|  10.4k|                token=op++;
 1298|  10.4k|                *token=0;
 1299|  10.4k|                if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1299:21): [True: 0, False: 10.4k]
  ------------------
 1300|  10.4k|                DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  290|  10.4k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1301|  10.4k|                            (int)(anchor-(const BYTE*)source), 0, (int)(ip-(const BYTE*)source));
 1302|  10.4k|                goto _next_match;
 1303|  10.4k|            }
 1304|  24.4k|        }
 1305|       |
 1306|       |        /* Prepare next loop */
 1307|  14.0k|        forwardH = LZ4_hashPosition(++ip, tableType);
 1308|       |
 1309|  14.0k|    }
 1310|       |
 1311|  3.93k|_last_literals:
 1312|       |    /* Encode Last Literals */
 1313|  3.93k|    {   size_t lastRun = (size_t)(iend - anchor);
 1314|  3.93k|        if ( (outputDirective) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1314:14): [True: 2.70k, False: 1.23k]
  ------------------
 1315|  2.70k|            (op + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > olimit)) {
  ------------------
  |  |  264|  2.70k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  2.70k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  2.70k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1315:13): [True: 793, False: 1.91k]
  ------------------
 1316|    793|            if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1316:17): [True: 594, False: 199]
  ------------------
 1317|       |                /* adapt lastRun to fill 'dst' */
 1318|    594|                assert(olimit >= op);
  ------------------
  |  Branch (1318:17): [True: 0, False: 594]
  |  Branch (1318:17): [True: 594, False: 0]
  ------------------
 1319|    594|                lastRun  = (size_t)(olimit-op) - 1/*token*/;
 1320|    594|                lastRun -= (lastRun + 256 - RUN_MASK) / 256;  /*additional length tokens*/
  ------------------
  |  |  264|    594|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    594|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    594|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1321|    594|            } else {
 1322|    199|                assert(outputDirective == limitedOutput);
  ------------------
  |  Branch (1322:17): [True: 0, False: 199]
  |  Branch (1322:17): [True: 199, False: 0]
  ------------------
 1323|    199|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1324|    199|            }
 1325|    793|        }
 1326|  3.73k|        DEBUGLOG(6, "Final literal run : %i literals", (int)lastRun);
  ------------------
  |  |  290|  3.73k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1327|  3.73k|        if (lastRun >= RUN_MASK) {
  ------------------
  |  |  264|  3.73k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  3.73k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  3.73k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1327:13): [True: 459, False: 3.28k]
  ------------------
 1328|    459|            size_t accumulator = lastRun - RUN_MASK;
  ------------------
  |  |  264|    459|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    459|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    459|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1329|    459|            *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  264|    459|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    459|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    459|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  261|    459|#define ML_BITS  4
  ------------------
 1330|    459|            for(; accumulator >= 255 ; accumulator-=255) *op++ = 255;
  ------------------
  |  Branch (1330:19): [True: 0, False: 459]
  ------------------
 1331|    459|            *op++ = (BYTE) accumulator;
 1332|  3.28k|        } else {
 1333|  3.28k|            *op++ = (BYTE)(lastRun<<ML_BITS);
  ------------------
  |  |  261|  3.28k|#define ML_BITS  4
  ------------------
 1334|  3.28k|        }
 1335|  3.73k|        LZ4_memcpy(op, anchor, lastRun);
  ------------------
  |  |  350|  3.73k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 1336|  3.73k|        ip = anchor + lastRun;
 1337|  3.73k|        op += lastRun;
 1338|  3.73k|    }
 1339|       |
 1340|  3.73k|    if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1340:9): [True: 1.52k, False: 2.21k]
  ------------------
 1341|  1.52k|        *inputConsumed = (int) (((const char*)ip)-source);
 1342|  1.52k|    }
 1343|  3.73k|    result = (int)(((char*)op) - dest);
 1344|  3.73k|    assert(result > 0);
  ------------------
  |  Branch (1344:5): [True: 0, False: 3.73k]
  |  Branch (1344:5): [True: 3.73k, False: 0]
  ------------------
 1345|  3.73k|    DEBUGLOG(5, "LZ4_compress_generic: compressed %i bytes into %i bytes", inputSize, result);
  ------------------
  |  |  290|  3.73k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1346|  3.73k|    return result;
 1347|  3.73k|}
lz4.c:LZ4_hashPosition:
  807|   682k|{
  808|   682k|    if ((sizeof(reg_t)==8) && (tableType != byU16)) return LZ4_hash5(LZ4_read_ARCH(p), tableType);
  ------------------
  |  Branch (808:9): [True: 682k, Folded]
  |  Branch (808:31): [True: 551k, False: 130k]
  ------------------
  809|       |
  810|       |#ifdef LZ4_STATIC_LINKING_ONLY_ENDIANNESS_INDEPENDENT_OUTPUT
  811|       |    return LZ4_hash4(LZ4_readLE32(p), tableType);
  812|       |#else
  813|   130k|    return LZ4_hash4(LZ4_read32(p), tableType);
  814|   682k|#endif
  815|   682k|}
lz4.c:LZ4_hash5:
  795|   551k|{
  796|   551k|    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|  1.10M|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  158|   551k|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   551k|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (796:25): [True: 0, False: 551k]
  ------------------
  797|   551k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (797:9): [True: 551k, False: 0]
  ------------------
  798|   551k|        const U64 prime5bytes = 889523592379ULL;
  799|   551k|        return (U32)(((sequence << 24) * prime5bytes) >> (64 - hashLog));
  800|   551k|    } else {
  801|      0|        const U64 prime8bytes = 11400714785074694791ULL;
  802|      0|        return (U32)(((sequence >> 24) * prime8bytes) >> (64 - hashLog));
  803|      0|    }
  804|   551k|}
lz4.c:LZ4_isLittleEndian:
  365|   622k|{
  366|   622k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  367|   622k|    return one.c[0];
  368|   622k|}
lz4.c:LZ4_read_ARCH:
  396|  6.56M|static reg_t LZ4_read_ARCH(const void* ptr) { return ((const LZ4_unalignST*)ptr)->uArch; }
lz4.c:LZ4_hash4:
  787|   130k|{
  788|   130k|    if (tableType == byU16)
  ------------------
  |  Branch (788:9): [True: 130k, False: 0]
  ------------------
  789|   130k|        return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
  ------------------
  |  |  243|   130k|#define MINMATCH 4
  ------------------
                      return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
  ------------------
  |  |  697|   130k|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  158|   130k|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   130k|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  790|      0|    else
  791|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  792|   130k|}
lz4.c:LZ4_putIndexOnHash:
  830|   664k|{
  831|   664k|    switch (tableType)
  832|   664k|    {
  833|      0|    default: /* fallthrough */
  ------------------
  |  Branch (833:5): [True: 0, False: 664k]
  ------------------
  834|      0|    case clearedTable: /* fallthrough */
  ------------------
  |  Branch (834:5): [True: 0, False: 664k]
  ------------------
  835|      0|    case byPtr: { /* illegal! */ assert(0); return; }
  ------------------
  |  Branch (835:5): [True: 0, False: 664k]
  |  Branch (835:34): [Folded, False: 0]
  |  Branch (835:34): [Folded, False: 0]
  ------------------
  836|   545k|    case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = idx; return; }
  ------------------
  |  Branch (836:5): [True: 545k, False: 118k]
  ------------------
  837|   118k|    case byU16: { U16* hashTable = (U16*) tableBase; assert(idx < 65536); hashTable[h] = (U16)idx; return; }
  ------------------
  |  Branch (837:5): [True: 118k, False: 545k]
  |  Branch (837:54): [True: 0, False: 118k]
  |  Branch (837:54): [True: 118k, False: 0]
  ------------------
  838|   664k|    }
  839|   664k|}
lz4.c:LZ4_read32:
  395|   939k|static U32 LZ4_read32(const void* ptr) { return ((const LZ4_unalign32*)ptr)->u32; }
lz4.c:LZ4_getIndexOnHash:
  863|   637k|{
  864|   637k|    LZ4_STATIC_ASSERT(LZ4_MEMORY_USAGE > 2);
  ------------------
  |  |  278|   637k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
  865|   637k|    if (tableType == byU32) {
  ------------------
  |  Branch (865:9): [True: 535k, False: 101k]
  ------------------
  866|   535k|        const U32* const hashTable = (const U32*) tableBase;
  867|   535k|        assert(h < (1U << (LZ4_MEMORY_USAGE-2)));
  ------------------
  |  Branch (867:9): [True: 0, False: 535k]
  |  Branch (867:9): [True: 535k, False: 0]
  ------------------
  868|   535k|        return hashTable[h];
  869|   535k|    }
  870|   101k|    if (tableType == byU16) {
  ------------------
  |  Branch (870:9): [True: 101k, False: 0]
  ------------------
  871|   101k|        const U16* const hashTable = (const U16*) tableBase;
  872|   101k|        assert(h < (1U << (LZ4_MEMORY_USAGE-1)));
  ------------------
  |  Branch (872:9): [True: 0, False: 101k]
  |  Branch (872:9): [True: 101k, False: 0]
  ------------------
  873|   101k|        return hashTable[h];
  874|   101k|    }
  875|   101k|    assert(0); return 0;  /* forbidden case */
  ------------------
  |  Branch (875:5): [Folded, False: 0]
  |  Branch (875:5): [Folded, False: 0]
  ------------------
  876|      0|}
lz4.c:LZ4_wildCopy8:
  467|  22.8k|{
  468|  22.8k|    BYTE* d = (BYTE*)dstPtr;
  469|  22.8k|    const BYTE* s = (const BYTE*)srcPtr;
  470|  22.8k|    BYTE* const e = (BYTE*)dstEnd;
  471|       |
  472|   180k|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  350|   180k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (472:50): [True: 157k, False: 22.8k]
  ------------------
  473|  22.8k|}
lz4.c:LZ4_writeLE16:
  454|  26.4k|{
  455|  26.4k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (455:9): [True: 26.4k, False: 0]
  ------------------
  456|  26.4k|        LZ4_write16(memPtr, value);
  457|  26.4k|    } else {
  458|      0|        BYTE* p = (BYTE*)memPtr;
  459|      0|        p[0] = (BYTE) value;
  460|      0|        p[1] = (BYTE)(value>>8);
  461|      0|    }
  462|  26.4k|}
lz4.c:LZ4_write16:
  398|  26.4k|static void LZ4_write16(void* memPtr, U16 value) { ((LZ4_unalign16*)memPtr)->u16 = value; }
lz4.c:LZ4_count:
  690|  26.4k|{
  691|  26.4k|    const BYTE* const pStart = pIn;
  692|       |
  693|  26.4k|    if (likely(pIn < pInLimit-(STEPSIZE-1))) {
  ------------------
  |  |  178|  26.4k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  26.4k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 24.9k, False: 1.45k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  694|  24.9k|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  695|  24.9k|        if (!diff) {
  ------------------
  |  Branch (695:13): [True: 13.5k, False: 11.4k]
  ------------------
  696|  13.5k|            pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  687|  13.5k|#define STEPSIZE sizeof(reg_t)
  ------------------
                          pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  687|  13.5k|#define STEPSIZE sizeof(reg_t)
  ------------------
  697|  13.5k|        } else {
  698|  11.4k|            return LZ4_NbCommonBytes(diff);
  699|  11.4k|    }   }
  700|       |
  701|  2.98M|    while (likely(pIn < pInLimit-(STEPSIZE-1))) {
  702|  2.98M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  703|  2.98M|        if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  687|  2.97M|#define STEPSIZE sizeof(reg_t)
  ------------------
                      if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  687|  2.97M|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (703:13): [True: 2.97M, False: 12.9k]
  ------------------
  704|  12.9k|        pIn += LZ4_NbCommonBytes(diff);
  705|  12.9k|        return (unsigned)(pIn - pStart);
  706|  2.98M|    }
  707|       |
  708|  2.05k|    if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  |  687|  2.05k|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (708:9): [True: 2.05k, Folded]
  |  Branch (708:26): [True: 1.18k, False: 871]
  |  Branch (708:48): [True: 284, False: 902]
  ------------------
  709|  2.05k|    if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (709:9): [True: 1.84k, False: 213]
  |  Branch (709:31): [True: 585, False: 1.25k]
  ------------------
  710|  2.05k|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (710:9): [True: 1.81k, False: 240]
  |  Branch (710:27): [True: 646, False: 1.17k]
  ------------------
  711|  2.05k|    return (unsigned)(pIn - pStart);
  712|  15.0k|}
lz4.c:LZ4_NbCommonBytes:
  589|  24.3k|{
  590|  24.3k|    assert(val != 0);
  ------------------
  |  Branch (590:5): [True: 0, False: 24.3k]
  |  Branch (590:5): [True: 24.3k, False: 0]
  ------------------
  591|  24.3k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (591:9): [True: 24.3k, False: 0]
  ------------------
  592|  24.3k|        if (sizeof(val) == 8) {
  ------------------
  |  Branch (592:13): [True: 24.3k, Folded]
  ------------------
  593|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1800) && (defined(_M_AMD64) && !defined(_M_ARM64EC)) && !defined(LZ4_FORCE_SW_BITCOUNT)
  594|       |/*-*************************************************************************************************
  595|       |* ARM64EC is a Microsoft-designed ARM64 ABI compatible with AMD64 applications on ARM64 Windows 11.
  596|       |* The ARM64EC ABI does not support AVX/AVX2/AVX512 instructions, nor their relevant intrinsics
  597|       |* including _tzcnt_u64. Therefore, we need to neuter the _tzcnt_u64 code path for ARM64EC.
  598|       |****************************************************************************************************/
  599|       |#         if defined(__clang__) && (__clang_major__ < 10)
  600|       |            /* Avoid undefined clang-cl intrinsics issue.
  601|       |             * See https://github.com/lz4/lz4/pull/1017 for details. */
  602|       |            return (unsigned)__builtin_ia32_tzcnt_u64(val) >> 3;
  603|       |#         else
  604|       |            /* x64 CPUS without BMI support interpret `TZCNT` as `REP BSF` */
  605|       |            return (unsigned)_tzcnt_u64(val) >> 3;
  606|       |#         endif
  607|       |#       elif defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT)
  608|       |            unsigned long r = 0;
  609|       |            _BitScanForward64(&r, (U64)val);
  610|       |            return (unsigned)r >> 3;
  611|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  612|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  613|       |                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  614|       |            return (unsigned)__builtin_ctzll((U64)val) >> 3;
  615|       |#       else
  616|       |            const U64 m = 0x0101010101010101ULL;
  617|       |            val ^= val - 1;
  618|       |            return (unsigned)(((U64)((val & (m - 1)) * m)) >> 56);
  619|       |#       endif
  620|  24.3k|        } else /* 32 bits */ {
  621|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT)
  622|       |            unsigned long r;
  623|       |            _BitScanForward(&r, (U32)val);
  624|       |            return (unsigned)r >> 3;
  625|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  626|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  627|       |                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  628|       |            return (unsigned)__builtin_ctz((U32)val) >> 3;
  629|       |#       else
  630|       |            const U32 m = 0x01010101;
  631|       |            return (unsigned)((((val - 1) ^ val) & (m - 1)) * m) >> 24;
  632|       |#       endif
  633|      0|        }
  634|  24.3k|    } else   /* Big Endian CPU */ {
  635|      0|        if (sizeof(val)==8) {
  ------------------
  |  Branch (635:13): [True: 0, Folded]
  ------------------
  636|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  637|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  638|      0|                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  639|      0|            return (unsigned)__builtin_clzll((U64)val) >> 3;
  640|       |#       else
  641|       |#if 1
  642|       |            /* this method is probably faster,
  643|       |             * but adds a 128 bytes lookup table */
  644|       |            static const unsigned char ctz7_tab[128] = {
  645|       |                7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  646|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  647|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  648|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  649|       |                6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  650|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  651|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  652|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  653|       |            };
  654|       |            U64 const mask = 0x0101010101010101ULL;
  655|       |            U64 const t = (((val >> 8) - mask) | val) & mask;
  656|       |            return ctz7_tab[(t * 0x0080402010080402ULL) >> 57];
  657|       |#else
  658|       |            /* this method doesn't consume memory space like the previous one,
  659|       |             * but it contains several branches,
  660|       |             * that may end up slowing execution */
  661|       |            static const U32 by32 = sizeof(val)*4;  /* 32 on 64 bits (goal), 16 on 32 bits.
  662|       |            Just to avoid some static analyzer complaining about shift by 32 on 32-bits target.
  663|       |            Note that this code path is never triggered in 32-bits mode. */
  664|       |            unsigned r;
  665|       |            if (!(val>>by32)) { r=4; } else { r=0; val>>=by32; }
  666|       |            if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; }
  667|       |            r += (!val);
  668|       |            return r;
  669|       |#endif
  670|       |#       endif
  671|      0|        } else /* 32 bits */ {
  672|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  673|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  674|      0|                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  675|      0|            return (unsigned)__builtin_clz((U32)val) >> 3;
  676|       |#       else
  677|       |            val >>= 8;
  678|       |            val = ((((val + 0x00FFFF00) | 0x00FFFFFF) + val) |
  679|       |              (val + 0x00FF0000)) >> 24;
  680|       |            return (unsigned)val ^ 3;
  681|       |#       endif
  682|      0|        }
  683|      0|    }
  684|  24.3k|}
lz4.c:LZ4_read16:
  394|  23.6k|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  399|  33.6k|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_compress_destSize_extState_internal:
 1491|  2.15k|{
 1492|  2.15k|    void* const s = LZ4_initStream(state, sizeof (*state));
 1493|  2.15k|    assert(s != NULL); (void)s;
  ------------------
  |  Branch (1493:5): [True: 0, False: 2.15k]
  |  Branch (1493:5): [True: 2.15k, False: 0]
  ------------------
 1494|       |
 1495|  2.15k|    if (targetDstSize >= LZ4_compressBound(*srcSizePtr)) {  /* compression success is guaranteed */
  ------------------
  |  Branch (1495:9): [True: 618, False: 1.53k]
  ------------------
 1496|    618|        return LZ4_compress_fast_extState(state, src, dst, *srcSizePtr, targetDstSize, acceleration);
 1497|  1.53k|    } else {
 1498|  1.53k|        if (*srcSizePtr < LZ4_64Klimit) {
  ------------------
  |  Branch (1498:13): [True: 1.26k, False: 269]
  ------------------
 1499|  1.26k|            return LZ4_compress_generic(&state->internal_donotuse, src, dst, *srcSizePtr, srcSizePtr, targetDstSize, fillOutput, byU16, noDict, noDictIssue, acceleration);
 1500|  1.26k|        } else {
 1501|    269|            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 (1501:43): [Folded, False: 269]
  |  Branch (1501:65): [True: 0, False: 0]
  ------------------
 1502|    269|            return LZ4_compress_generic(&state->internal_donotuse, src, dst, *srcSizePtr, srcSizePtr, targetDstSize, fillOutput, addrMode, noDict, noDictIssue, acceleration);
 1503|    269|    }   }
 1504|  2.15k|}
lz4.c:LZ4_isAligned:
  294|  4.93k|{
  295|  4.93k|    return ((size_t)ptr & (alignment -1)) == 0;
  296|  4.93k|}
lz4.c:LZ4_stream_t_alignment:
 1552|  4.93k|{
 1553|  4.93k|#if LZ4_ALIGN_TEST
 1554|  4.93k|    typedef struct { char c; LZ4_stream_t t; } t_a;
 1555|  4.93k|    return sizeof(t_a) - sizeof(LZ4_stream_t);
 1556|       |#else
 1557|       |    return 1;  /* effectively disabled */
 1558|       |#endif
 1559|  4.93k|}
lz4.c:LZ4_decompress_generic:
 2034|  3.75k|{
 2035|  3.75k|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (2035:9): [True: 0, False: 3.75k]
  |  Branch (2035:26): [True: 0, False: 3.75k]
  ------------------
 2036|       |
 2037|  3.75k|    {   const BYTE* ip = (const BYTE*) src;
 2038|  3.75k|        const BYTE* const iend = ip + srcSize;
 2039|       |
 2040|  3.75k|        BYTE* op = (BYTE*) dst;
 2041|  3.75k|        BYTE* const oend = op + outputSize;
 2042|  3.75k|        BYTE* cpy;
 2043|       |
 2044|  3.75k|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (2044:37): [True: 3.75k, False: 0]
  ------------------
 2045|       |
 2046|  3.75k|        const int checkOffset = (dictSize < (int)(64 KB));
  ------------------
  |  |  252|  3.75k|#define KB *(1 <<10)
  ------------------
 2047|       |
 2048|       |
 2049|       |        /* Set up the "end" pointers for the shortcut. */
 2050|  3.75k|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 2051|  3.75k|        const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/;
 2052|       |
 2053|  3.75k|        const BYTE* match;
 2054|  3.75k|        size_t offset;
 2055|  3.75k|        unsigned token;
 2056|  3.75k|        size_t length;
 2057|       |
 2058|       |
 2059|  3.75k|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  290|  3.75k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2060|       |
 2061|       |        /* Special cases */
 2062|  3.75k|        assert(lowPrefix <= op);
  ------------------
  |  Branch (2062:9): [True: 0, False: 3.75k]
  |  Branch (2062:9): [True: 3.75k, False: 0]
  ------------------
 2063|  3.75k|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  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: 18, False: 3.73k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2064|       |            /* Empty output buffer */
 2065|     18|            if (partialDecoding) return 0;
  ------------------
  |  Branch (2065:17): [True: 0, False: 18]
  ------------------
 2066|     18|            return ((srcSize==1) && (*ip==0)) ? 0 : -1;
  ------------------
  |  Branch (2066:21): [True: 18, False: 0]
  |  Branch (2066:37): [True: 18, False: 0]
  ------------------
 2067|     18|        }
 2068|  3.73k|        if (unlikely(srcSize==0)) { return -1; }
  ------------------
  |  |  181|  3.73k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  3.73k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 3.73k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2069|       |
 2070|       |    /* LZ4_FAST_DEC_LOOP:
 2071|       |     * designed for modern OoO performance cpus,
 2072|       |     * where copying reliably 32-bytes is preferable to an unpredictable branch.
 2073|       |     * note : fast loop may show a regression for some client arm chips. */
 2074|  3.73k|#if LZ4_FAST_DEC_LOOP
 2075|  3.73k|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  3.73k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2075:13): [True: 2.28k, False: 1.45k]
  ------------------
 2076|  2.28k|            DEBUGLOG(6, "move to safe decode loop");
  ------------------
  |  |  290|  2.28k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2077|  2.28k|            goto safe_decode;
 2078|  2.28k|        }
 2079|       |
 2080|       |        /* Fast loop : decode sequences as long as output < oend-FASTLOOP_SAFE_DISTANCE */
 2081|  1.45k|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  290|  1.45k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2082|  14.8k|        while (1) {
  ------------------
  |  Branch (2082:16): [True: 14.8k, Folded]
  ------------------
 2083|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2084|  14.8k|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  Branch (2084:13): [True: 0, False: 14.8k]
  |  Branch (2084:13): [True: 14.8k, False: 0]
  ------------------
 2085|  14.8k|            assert(ip < iend);
  ------------------
  |  Branch (2085:13): [True: 0, False: 14.8k]
  |  Branch (2085:13): [True: 14.8k, False: 0]
  ------------------
 2086|  14.8k|            token = *ip++;
 2087|  14.8k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  261|  14.8k|#define ML_BITS  4
  ------------------
 2088|  14.8k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  14.8k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2089|       |
 2090|  14.8k|            if (ip > iend-(16 + 1/*max lit + offset + nextToken*/)) { goto safe_literal_copy_early; }
  ------------------
  |  Branch (2090:17): [True: 401, False: 14.4k]
  ------------------
 2091|       |
 2092|       |            /* decode literal length */
 2093|  14.4k|            if (length == RUN_MASK) {
  ------------------
  |  |  264|  14.4k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  14.4k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  14.4k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2093:17): [True: 644, False: 13.8k]
  ------------------
 2094|       |                /* literal length >= RUN_MASK means >= RUN_MASK literal bytes follow the extension bytes,
 2095|       |                 * so extension bytes cannot reach the last RUN_MASK bytes of input */
 2096|    644|                size_t const addl = read_variable_length(&ip, iend - RUN_MASK);
  ------------------
  |  |  264|    644|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    644|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    644|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2097|    644|                if (addl == rvl_error) {
  ------------------
  |  Branch (2097:21): [True: 0, False: 644]
  ------------------
 2098|      0|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2099|      0|                    goto _output_error;
 2100|      0|                }
 2101|    644|                length += addl;
 2102|    644|                cpy = op+length;
 2103|    644|                if (unlikely((uptrval)(cpy)<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|    644|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    644|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 644]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2104|    644|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|    644|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    644|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 644]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2105|       |
 2106|       |                /* copy literals */
 2107|    644|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  278|    644|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2108|       |              #ifdef __aarch64__
 2109|       |                if ((cpy>oend-64) || (ip+length>iend-64)) { goto safe_literal_copy; }
 2110|       |                LZ4_wildCopy64(op, ip, cpy);
 2111|       |              #else
 2112|    644|                if ((cpy>oend-32) || (ip+length>iend-32)) { goto safe_literal_copy; }
  ------------------
  |  Branch (2112:21): [True: 105, False: 539]
  |  Branch (2112:38): [True: 166, False: 373]
  ------------------
 2113|    373|                LZ4_wildCopy32(op, ip, cpy);
 2114|    373|              #endif
 2115|    373|                ip += length; op = cpy;
 2116|  13.8k|            } else {
 2117|  13.8k|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)length);
  ------------------
  |  |  290|  13.8k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2118|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2119|  13.8k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  350|  13.8k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2120|  13.8k|                ip += length; op += length;
 2121|  13.8k|            }
 2122|       |
 2123|       |            /* get offset */
 2124|  14.1k|            offset = LZ4_readLE16(ip); ip+=2;
 2125|  14.1k|            DEBUGLOG(6, "blockPos%6u: offset = %u", (unsigned)(op-(BYTE*)dst), (unsigned)offset);
  ------------------
  |  |  290|  14.1k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2126|  14.1k|            match = op - offset;
 2127|  14.1k|            assert(match <= op);  /* overflow check */
  ------------------
  |  Branch (2127:13): [True: 0, False: 14.1k]
  |  Branch (2127:13): [True: 14.1k, False: 0]
  ------------------
 2128|       |
 2129|       |            /* get matchlength */
 2130|  14.1k|            length = token & ML_MASK;
  ------------------
  |  |  262|  14.1k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  14.1k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2131|  14.1k|            DEBUGLOG(7, "  match length token = %u (len==%u)", (unsigned)length, (unsigned)length+MINMATCH);
  ------------------
  |  |  290|  14.1k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2132|       |
 2133|  14.1k|            if (length == ML_MASK) {
  ------------------
  |  |  262|  14.1k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  14.1k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2133:17): [True: 6.75k, False: 7.44k]
  ------------------
 2134|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2135|  6.75k|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  246|  6.75k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2136|  6.75k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2136:21): [True: 0, False: 6.75k]
  ------------------
 2137|      0|                    DEBUGLOG(5, "error reading long match length");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2138|      0|                    goto _output_error;
 2139|      0|                }
 2140|  6.75k|                length += addl;
 2141|  6.75k|                length += MINMATCH;
  ------------------
  |  |  243|  6.75k|#define MINMATCH 4
  ------------------
 2142|  6.75k|                DEBUGLOG(7, "  long match length == %u", (unsigned)length);
  ------------------
  |  |  290|  6.75k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2143|  6.75k|                if (unlikely((uptrval)(op)+length<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|  6.75k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  6.75k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 6.75k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2144|  6.75k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  6.75k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2144:21): [True: 336, False: 6.42k]
  ------------------
 2145|    336|                    goto safe_match_copy;
 2146|    336|                }
 2147|  7.44k|            } else {
 2148|  7.44k|                length += MINMATCH;
  ------------------
  |  |  243|  7.44k|#define MINMATCH 4
  ------------------
 2149|  7.44k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  7.44k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2149:21): [True: 451, False: 6.99k]
  ------------------
 2150|    451|                    DEBUGLOG(7, "moving to safe_match_copy (ml==%u)", (unsigned)length);
  ------------------
  |  |  290|    451|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2151|    451|                    goto safe_match_copy;
 2152|    451|                }
 2153|       |
 2154|       |                /* Fastpath check: skip LZ4_wildCopy32 when true */
 2155|  6.99k|                if ((dict == withPrefix64k) || (match >= lowPrefix)) {
  ------------------
  |  Branch (2155:21): [True: 0, False: 6.99k]
  |  Branch (2155:48): [True: 6.99k, False: 0]
  ------------------
 2156|  6.99k|                    if (offset >= 8) {
  ------------------
  |  Branch (2156:25): [True: 3.63k, False: 3.35k]
  ------------------
 2157|  3.63k|                        assert(match >= lowPrefix);
  ------------------
  |  Branch (2157:25): [True: 0, False: 3.63k]
  |  Branch (2157:25): [True: 3.63k, False: 0]
  ------------------
 2158|  3.63k|                        assert(match <= op);
  ------------------
  |  Branch (2158:25): [True: 0, False: 3.63k]
  |  Branch (2158:25): [True: 3.63k, False: 0]
  ------------------
 2159|  3.63k|                        assert(op + 18 <= oend);
  ------------------
  |  Branch (2159:25): [True: 0, False: 3.63k]
  |  Branch (2159:25): [True: 3.63k, False: 0]
  ------------------
 2160|       |
 2161|  3.63k|                        LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  3.63k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2162|  3.63k|                        LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  350|  3.63k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2163|  3.63k|                        LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  350|  3.63k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2164|  3.63k|                        op += length;
 2165|  3.63k|                        continue;
 2166|  3.63k|            }   }   }
 2167|       |
 2168|  9.78k|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  181|  9.78k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  9.78k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2168:18): [True: 9.78k, False: 0]
  |  Branch (2168:33): [True: 0, False: 9.78k]
  ------------------
 2169|      0|                DEBUGLOG(5, "Error : pos=%zi, offset=%zi => outside buffers", op-lowPrefix, op-match);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2170|      0|                goto _output_error;
 2171|      0|            }
 2172|       |            /* match starting within external dictionary */
 2173|  9.78k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2173:17): [True: 0, False: 9.78k]
  |  Branch (2173:41): [True: 0, False: 0]
  ------------------
 2174|      0|                assert(dictEnd != NULL);
  ------------------
  |  Branch (2174:17): [True: 0, False: 0]
  |  Branch (2174:17): [True: 0, False: 0]
  ------------------
 2175|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2176|      0|                    if (partialDecoding) {
  ------------------
  |  Branch (2176:25): [True: 0, False: 0]
  ------------------
 2177|      0|                        DEBUGLOG(7, "partialDecoding: dictionary match, close to dstEnd");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2178|      0|                        length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1854|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1854:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2179|      0|                    } else {
 2180|      0|                        DEBUGLOG(6, "end-of-block condition violated")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2181|      0|                        goto _output_error;
 2182|      0|                }   }
 2183|       |
 2184|      0|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2184:21): [True: 0, False: 0]
  ------------------
 2185|       |                    /* match fits entirely within external dictionary : just copy */
 2186|      0|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  358|      0|#    define LZ4_memmove __builtin_memmove
  ------------------
 2187|      0|                    op += length;
 2188|      0|                } else {
 2189|       |                    /* match stretches into both external dictionary and current block */
 2190|      0|                    size_t const copySize = (size_t)(lowPrefix - match);
 2191|      0|                    size_t const restSize = length - copySize;
 2192|      0|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2193|      0|                    op += copySize;
 2194|      0|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2194:25): [True: 0, False: 0]
  ------------------
 2195|      0|                        BYTE* const endOfMatch = op + restSize;
 2196|      0|                        const BYTE* copyFrom = lowPrefix;
 2197|      0|                        while (op < endOfMatch) { *op++ = *copyFrom++; }
  ------------------
  |  Branch (2197:32): [True: 0, False: 0]
  ------------------
 2198|      0|                    } else {
 2199|      0|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2200|      0|                        op += restSize;
 2201|      0|                }   }
 2202|      0|                continue;
 2203|      0|            }
 2204|       |
 2205|       |            /* copy match within block */
 2206|  9.78k|            cpy = op + length;
 2207|       |
 2208|  9.78k|            assert((op <= oend) && (oend-op >= 64));
  ------------------
  |  Branch (2208:13): [True: 0, False: 9.78k]
  |  Branch (2208:13): [True: 0, False: 0]
  |  Branch (2208:13): [True: 9.78k, False: 0]
  |  Branch (2208:13): [True: 9.78k, False: 0]
  ------------------
 2209|  9.78k|            if (unlikely(offset<16)) {
  ------------------
  |  |  181|  9.78k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  9.78k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 6.29k, False: 3.48k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2210|  6.29k|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2211|       |    #ifdef __aarch64__
 2212|       |            } else if (offset >= 64) {
 2213|       |                LZ4_wildCopy64(op, match, cpy);
 2214|       |    #endif
 2215|  6.29k|            } else {
 2216|  3.48k|                LZ4_wildCopy32(op, match, cpy);
 2217|  3.48k|            }
 2218|       |
 2219|  9.78k|            op = cpy;   /* wildcopy correction */
 2220|  9.78k|        }
 2221|  2.28k|    safe_decode:
 2222|  2.28k|#endif
 2223|       |
 2224|       |        /* Main Loop : decode remaining sequences where output < FASTLOOP_SAFE_DISTANCE */
 2225|  2.28k|        DEBUGLOG(6, "using safe decode loop");
  ------------------
  |  |  290|  2.28k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2226|  8.85k|        while (1) {
  ------------------
  |  Branch (2226:16): [True: 8.85k, Folded]
  ------------------
 2227|  8.85k|            assert(ip < iend);
  ------------------
  |  Branch (2227:13): [True: 0, False: 8.85k]
  |  Branch (2227:13): [True: 8.85k, False: 0]
  ------------------
 2228|  8.85k|            token = *ip++;
 2229|  8.85k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  261|  8.85k|#define ML_BITS  4
  ------------------
 2230|  8.85k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  8.85k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2231|       |
 2232|       |            /* A two-stage shortcut for the most common case:
 2233|       |             * 1) If the literal length is 0..14, and there is enough space,
 2234|       |             * enter the shortcut and copy 16 bytes on behalf of the literals
 2235|       |             * (in the fast mode, only 8 bytes can be safely copied this way).
 2236|       |             * 2) Further if the match length is 4..18, copy 18 bytes in a similar
 2237|       |             * manner; but we ensure that there's enough space in the output for
 2238|       |             * those 18 bytes earlier, upon entering the shortcut (in other words,
 2239|       |             * there is a combined check for both stages).
 2240|       |             */
 2241|  8.85k|            if ( (length != RUN_MASK)
  ------------------
  |  |  264|  8.85k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  8.85k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  8.85k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2241:18): [True: 8.36k, False: 490]
  ------------------
 2242|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2243|  8.36k|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  178|  8.36k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  8.36k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.75k, False: 6.61k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2244|       |                /* Copy the literals */
 2245|  1.75k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  350|  1.75k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2246|  1.75k|                op += length; ip += length;
 2247|       |
 2248|       |                /* The second stage: prepare for match copying, decode full info.
 2249|       |                 * If it doesn't work out, the info won't be wasted. */
 2250|  1.75k|                length = token & ML_MASK; /* match length */
  ------------------
  |  |  262|  1.75k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.75k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2251|  1.75k|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u (len=%u)", (unsigned)(op-(BYTE*)dst), (unsigned)length, (unsigned)length + 4);
  ------------------
  |  |  290|  1.75k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2252|  1.75k|                offset = LZ4_readLE16(ip); ip += 2;
 2253|  1.75k|                match = op - offset;
 2254|  1.75k|                assert(match <= op); /* check overflow */
  ------------------
  |  Branch (2254:17): [True: 0, False: 1.75k]
  |  Branch (2254:17): [True: 1.75k, False: 0]
  ------------------
 2255|       |
 2256|       |                /* Do not deal with overlapping matches. */
 2257|  1.75k|                if ( (length != ML_MASK)
  ------------------
  |  |  262|  1.75k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.75k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2257:22): [True: 1.59k, False: 158]
  ------------------
 2258|  1.59k|                  && (offset >= 8)
  ------------------
  |  Branch (2258:22): [True: 720, False: 874]
  ------------------
 2259|    720|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2259:23): [True: 0, False: 720]
  |  Branch (2259:46): [True: 720, False: 0]
  ------------------
 2260|       |                    /* Copy the match. */
 2261|    720|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  350|    720|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2262|    720|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  350|    720|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2263|    720|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  350|    720|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2264|    720|                    op += length + MINMATCH;
  ------------------
  |  |  243|    720|#define MINMATCH 4
  ------------------
 2265|       |                    /* Both stages worked, load the next token. */
 2266|    720|                    continue;
 2267|    720|                }
 2268|       |
 2269|       |                /* The second stage didn't work out, but the info is ready.
 2270|       |                 * Propel it right to the point of match copying. */
 2271|  1.03k|                goto _copy_match;
 2272|  1.75k|            }
 2273|       |
 2274|  7.10k|#if LZ4_FAST_DEC_LOOP
 2275|  7.50k|        safe_literal_copy_early:
 2276|  7.50k|#endif
 2277|       |
 2278|       |            /* decode literal length */
 2279|  7.50k|            if (length == RUN_MASK) {
  ------------------
  |  |  264|  7.50k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  7.50k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  7.50k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2279:17): [True: 494, False: 7.01k]
  ------------------
 2280|       |                /* literal length >= RUN_MASK means >= RUN_MASK literal bytes follow the extension bytes,
 2281|       |                 * so extension bytes cannot reach the last RUN_MASK bytes of input */
 2282|    494|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK);
  ------------------
  |  |  264|    494|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    494|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    494|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2283|    494|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2283:21): [True: 0, False: 494]
  ------------------
 2284|    494|                length += addl;
 2285|    494|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|    494|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    494|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 494]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2286|    494|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|    494|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    494|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 494]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2287|    494|            }
 2288|       |
 2289|       |            /* copy literals */
 2290|  7.50k|            cpy = op+length;
 2291|       |
 2292|  7.50k|#if LZ4_FAST_DEC_LOOP
 2293|  7.77k|        safe_literal_copy:
 2294|  7.77k|#endif
 2295|       |
 2296|  7.77k|            LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  278|  7.77k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2297|  7.77k|            if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  247|  7.77k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  246|  4.45k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2297:17): [True: 3.32k, False: 4.45k]
  |  Branch (2297:39): [True: 418, False: 4.03k]
  ------------------
 2298|       |                /* We've either hit the input parsing restriction or the output parsing restriction.
 2299|       |                 * In the normal scenario, decoding a full block, it must be the last sequence,
 2300|       |                 * otherwise it's an error (invalid input or dimensions).
 2301|       |                 * In partialDecoding scenario, it's necessary to ensure there is no buffer overflow.
 2302|       |                 */
 2303|  3.73k|                if (partialDecoding) {
  ------------------
  |  Branch (2303:21): [True: 0, False: 3.73k]
  ------------------
 2304|       |                    /* Since we are partial decoding we may be in this block because of the output parsing
 2305|       |                     * restriction, which is not valid since the output buffer is allowed to be undersized.
 2306|       |                     */
 2307|      0|                    DEBUGLOG(7, "partialDecoding: copying literals, close to input or output end")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2308|      0|                    DEBUGLOG(7, "partialDecoding: literal length = %u", (unsigned)length);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2309|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in dstBuffer : %i", (int)(oend - op));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2310|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in srcBuffer : %i", (int)(iend - ip));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2311|       |                    /* Finishing in the middle of a literals segment,
 2312|       |                     * due to lack of input.
 2313|       |                     */
 2314|      0|                    if (ip+length > iend) {
  ------------------
  |  Branch (2314:25): [True: 0, False: 0]
  ------------------
 2315|      0|                        length = (size_t)(iend-ip);
 2316|      0|                        cpy = op + length;
 2317|      0|                    }
 2318|       |                    /* Finishing in the middle of a literals segment,
 2319|       |                     * due to lack of output space.
 2320|       |                     */
 2321|      0|                    if (cpy > oend) {
  ------------------
  |  Branch (2321:25): [True: 0, False: 0]
  ------------------
 2322|      0|                        cpy = oend;
 2323|      0|                        assert(op<=oend);
  ------------------
  |  Branch (2323:25): [True: 0, False: 0]
  |  Branch (2323:25): [True: 0, False: 0]
  ------------------
 2324|      0|                        length = (size_t)(oend-op);
 2325|      0|                    }
 2326|  3.73k|                } else {
 2327|       |                     /* We must be on the last sequence (or invalid) because of the parsing limitations
 2328|       |                      * so check that we exactly consume the input and don't overrun the output buffer.
 2329|       |                      */
 2330|  3.73k|                    if ((ip+length != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2330:25): [True: 0, False: 3.73k]
  |  Branch (2330:48): [True: 0, False: 3.73k]
  ------------------
 2331|      0|                        DEBUGLOG(5, "should have been last run of literals")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2332|      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 */
  ------------------
 2333|      0|                        DEBUGLOG(5, "or cpy(%p) > (oend-MFLIMIT)(%p)", (void*)cpy, (void*)(oend-MFLIMIT));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2334|      0|                        DEBUGLOG(5, "after writing %u bytes / %i bytes available", (unsigned)(op-(BYTE*)dst), outputSize);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2335|      0|                        goto _output_error;
 2336|      0|                    }
 2337|  3.73k|                }
 2338|  3.73k|                LZ4_memmove(op, ip, length);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  358|  3.73k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2339|  3.73k|                ip += length;
 2340|  3.73k|                op += length;
 2341|       |                /* Necessarily EOF when !partialDecoding.
 2342|       |                 * When partialDecoding, it is EOF if we've either
 2343|       |                 * filled the output buffer or
 2344|       |                 * can't proceed with reading an offset for following match.
 2345|       |                 */
 2346|  3.73k|                if (!partialDecoding || (cpy == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2346:21): [True: 3.73k, False: 0]
  |  Branch (2346:41): [True: 0, False: 0]
  |  Branch (2346:58): [True: 0, False: 0]
  ------------------
 2347|  3.73k|                    break;
 2348|  3.73k|                }
 2349|  4.03k|            } else {
 2350|  4.03k|                LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2351|  4.03k|                ip += length; op = cpy;
 2352|  4.03k|            }
 2353|       |
 2354|       |            /* get offset */
 2355|  4.03k|            offset = LZ4_readLE16(ip); ip+=2;
 2356|  4.03k|            match = op - offset;
 2357|       |
 2358|       |            /* get matchlength */
 2359|  4.03k|            length = token & ML_MASK;
  ------------------
  |  |  262|  4.03k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  4.03k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2360|  4.03k|            DEBUGLOG(7, "blockPos%6u: matchLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  4.03k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2361|       |
 2362|  5.07k|    _copy_match:
 2363|  5.07k|            if (length == ML_MASK) {
  ------------------
  |  |  262|  5.07k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  5.07k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2363:17): [True: 684, False: 4.38k]
  ------------------
 2364|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2365|    684|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  246|    684|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2366|    684|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2366:21): [True: 0, False: 684]
  ------------------
 2367|    684|                length += addl;
 2368|    684|                if (unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  181|    684|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    684|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 684]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2369|    684|            }
 2370|  5.07k|            length += MINMATCH;
  ------------------
  |  |  243|  5.07k|#define MINMATCH 4
  ------------------
 2371|       |
 2372|  5.07k|#if LZ4_FAST_DEC_LOOP
 2373|  5.85k|        safe_match_copy:
 2374|  5.85k|#endif
 2375|  5.85k|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error;   /* Error : offset outside buffers */
  ------------------
  |  |  181|  5.85k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  5.85k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2375:17): [True: 5.85k, False: 0]
  |  Branch (2375:34): [True: 0, False: 5.85k]
  ------------------
 2376|       |            /* match starting within external dictionary */
 2377|  5.85k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2377:17): [True: 0, False: 5.85k]
  |  Branch (2377:41): [True: 0, False: 0]
  ------------------
 2378|      0|                assert(dictEnd != NULL);
  ------------------
  |  Branch (2378:17): [True: 0, False: 0]
  |  Branch (2378:17): [True: 0, False: 0]
  ------------------
 2379|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2380|      0|                    if (partialDecoding) length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1854|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1854:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2380:25): [True: 0, False: 0]
  ------------------
 2381|      0|                    else goto _output_error;   /* doesn't respect parsing restriction */
 2382|      0|                }
 2383|       |
 2384|      0|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2384:21): [True: 0, False: 0]
  ------------------
 2385|       |                    /* match fits entirely within external dictionary : just copy */
 2386|      0|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  358|      0|#    define LZ4_memmove __builtin_memmove
  ------------------
 2387|      0|                    op += length;
 2388|      0|                } else {
 2389|       |                    /* match stretches into both external dictionary and current block */
 2390|      0|                    size_t const copySize = (size_t)(lowPrefix - match);
 2391|      0|                    size_t const restSize = length - copySize;
 2392|      0|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2393|      0|                    op += copySize;
 2394|      0|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2394:25): [True: 0, False: 0]
  ------------------
 2395|      0|                        BYTE* const endOfMatch = op + restSize;
 2396|      0|                        const BYTE* copyFrom = lowPrefix;
 2397|      0|                        while (op < endOfMatch) *op++ = *copyFrom++;
  ------------------
  |  Branch (2397:32): [True: 0, False: 0]
  ------------------
 2398|      0|                    } else {
 2399|      0|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2400|      0|                        op += restSize;
 2401|      0|                }   }
 2402|      0|                continue;
 2403|      0|            }
 2404|  5.85k|            assert(match >= lowPrefix);
  ------------------
  |  Branch (2404:13): [True: 0, False: 5.85k]
  |  Branch (2404:13): [True: 5.85k, False: 0]
  ------------------
 2405|       |
 2406|       |            /* copy match within block */
 2407|  5.85k|            cpy = op + length;
 2408|       |
 2409|       |            /* partialDecoding : may end anywhere within the block */
 2410|  5.85k|            assert(op<=oend);
  ------------------
  |  Branch (2410:13): [True: 0, False: 5.85k]
  |  Branch (2410:13): [True: 5.85k, False: 0]
  ------------------
 2411|  5.85k|            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 (2411:17): [True: 0, False: 5.85k]
  |  Branch (2411:36): [True: 0, False: 0]
  ------------------
 2412|      0|                size_t const mlen = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1854|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1854:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2413|      0|                const BYTE* const matchEnd = match + mlen;
 2414|      0|                BYTE* const copyEnd = op + mlen;
 2415|      0|                if (matchEnd > op) {   /* overlap copy */
  ------------------
  |  Branch (2415:21): [True: 0, False: 0]
  ------------------
 2416|      0|                    while (op < copyEnd) { *op++ = *match++; }
  ------------------
  |  Branch (2416:28): [True: 0, False: 0]
  ------------------
 2417|      0|                } else {
 2418|      0|                    LZ4_memcpy(op, match, mlen);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2419|      0|                }
 2420|      0|                op = copyEnd;
 2421|      0|                if (op == oend) { break; }
  ------------------
  |  Branch (2421:21): [True: 0, False: 0]
  ------------------
 2422|      0|                continue;
 2423|      0|            }
 2424|       |
 2425|  5.85k|            if (unlikely(offset<8)) {
  ------------------
  |  |  181|  5.85k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  5.85k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 4.17k, False: 1.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2426|  4.17k|                LZ4_write32(op, 0);   /* silence msan warning when offset==0 */
 2427|  4.17k|                op[0] = match[0];
 2428|  4.17k|                op[1] = match[1];
 2429|  4.17k|                op[2] = match[2];
 2430|  4.17k|                op[3] = match[3];
 2431|  4.17k|                match += inc32table[offset];
 2432|  4.17k|                LZ4_memcpy(op+4, match, 4);
  ------------------
  |  |  350|  4.17k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2433|  4.17k|                match -= dec64table[offset];
 2434|  4.17k|            } else {
 2435|  1.68k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  1.68k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2436|  1.68k|                match += 8;
 2437|  1.68k|            }
 2438|  5.85k|            op += 8;
 2439|       |
 2440|  5.85k|            if (unlikely(cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  181|  5.85k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  5.85k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.73k, False: 4.11k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2441|  1.73k|                BYTE* const oCopyLimit = oend - (WILDCOPYLENGTH-1);
  ------------------
  |  |  245|  1.73k|#define WILDCOPYLENGTH 8
  ------------------
 2442|  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 (2442:21): [True: 0, False: 1.73k]
  ------------------
 2443|  1.73k|                if (op < oCopyLimit) {
  ------------------
  |  Branch (2443:21): [True: 682, False: 1.05k]
  ------------------
 2444|    682|                    LZ4_wildCopy8(op, match, oCopyLimit);
 2445|    682|                    match += oCopyLimit - op;
 2446|    682|                    op = oCopyLimit;
 2447|    682|                }
 2448|  2.55k|                while (op < cpy) { *op++ = *match++; }
  ------------------
  |  Branch (2448:24): [True: 811, False: 1.73k]
  ------------------
 2449|  4.11k|            } else {
 2450|  4.11k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  4.11k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2451|  4.11k|                if (length > 16) { LZ4_wildCopy8(op+8, match+8, cpy); }
  ------------------
  |  Branch (2451:21): [True: 707, False: 3.41k]
  ------------------
 2452|  4.11k|            }
 2453|  5.85k|            op = cpy;   /* wildcopy correction */
 2454|  5.85k|        }
 2455|       |
 2456|       |        /* end of decoding */
 2457|  3.73k|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  290|  3.73k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2458|  3.73k|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2459|       |
 2460|       |        /* Overflow error detected */
 2461|      0|    _output_error:
 2462|      0|        return (int) (-(((const char*)ip)-src))-1;
 2463|  2.28k|    }
 2464|  2.28k|}
lz4.c:read_variable_length:
 1987|  8.57k|{
 1988|  8.57k|    Rvl_t s, length = 0;
 1989|  8.57k|    assert(ipPtr != NULL);
  ------------------
  |  Branch (1989:5): [True: 0, False: 8.57k]
  |  Branch (1989:5): [True: 8.57k, False: 0]
  ------------------
 1990|  8.57k|    assert(*ipPtr !=  NULL);
  ------------------
  |  Branch (1990:5): [True: 0, False: 8.57k]
  |  Branch (1990:5): [True: 8.57k, False: 0]
  ------------------
 1991|  8.57k|    assert(ilimit != NULL);
  ------------------
  |  Branch (1991:5): [True: 0, False: 8.57k]
  |  Branch (1991:5): [True: 8.57k, False: 0]
  ------------------
 1992|  8.57k|    if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|  8.57k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  8.57k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 8.57k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1993|      0|        return rvl_error;
 1994|      0|    }
 1995|  8.57k|    s = **ipPtr;
 1996|  8.57k|    (*ipPtr)++;
 1997|  8.57k|    length += s;
 1998|  8.57k|    if (likely(s != 255)) return length;
  ------------------
  |  |  178|  8.57k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  8.57k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 5.51k, False: 3.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1999|  44.1k|    do {
 2000|  44.1k|        if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|  44.1k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  44.1k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 44.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2001|      0|            return rvl_error;
 2002|      0|        }
 2003|  44.1k|        s = **ipPtr;
 2004|  44.1k|        (*ipPtr)++;
 2005|  44.1k|        length += s;
 2006|       |        /* accumulator overflow detection (32-bit mode only) */
 2007|  44.1k|        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 (2007:13): [Folded, False: 44.1k]
  ------------------
 2008|      0|            return rvl_error;
 2009|      0|        }
 2010|  44.1k|    } while (s == 255);
  ------------------
  |  Branch (2010:14): [True: 41.0k, False: 3.06k]
  ------------------
 2011|       |
 2012|  3.06k|    return length;
 2013|  3.06k|}
lz4.c:LZ4_wildCopy32:
  532|  3.85k|{
  533|  3.85k|    BYTE* d = (BYTE*)dstPtr;
  534|  3.85k|    const BYTE* s = (const BYTE*)srcPtr;
  535|  3.85k|    BYTE* const e = (BYTE*)dstEnd;
  536|       |
  537|   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 (537:79): [True: 96.7k, False: 3.85k]
  ------------------
  538|  3.85k|}
lz4.c:LZ4_readLE16:
  432|  19.9k|{
  433|  19.9k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (433:9): [True: 19.9k, False: 0]
  ------------------
  434|  19.9k|        return LZ4_read16(memPtr);
  435|  19.9k|    } else {
  436|      0|        const BYTE* p = (const BYTE*)memPtr;
  437|      0|        return (U16)((U16)p[0] | (p[1]<<8));
  438|      0|    }
  439|  19.9k|}
lz4.c:LZ4_memcpy_using_offset:
  545|  6.29k|{
  546|  6.29k|    BYTE v[8];
  547|       |
  548|  6.29k|    assert(dstEnd >= dstPtr + MINMATCH);
  ------------------
  |  Branch (548:5): [True: 0, False: 6.29k]
  |  Branch (548:5): [True: 6.29k, False: 0]
  ------------------
  549|       |
  550|  6.29k|    switch(offset) {
  551|  1.74k|    case 1:
  ------------------
  |  Branch (551:5): [True: 1.74k, False: 4.55k]
  ------------------
  552|  1.74k|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  237|  1.74k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  235|  1.74k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  553|  1.74k|        break;
  554|  2.98k|    case 2:
  ------------------
  |  Branch (554:5): [True: 2.98k, False: 3.31k]
  ------------------
  555|  2.98k|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  350|  2.98k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  556|  2.98k|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  350|  2.98k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  557|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  558|       |#  pragma warning(push)
  559|       |#  pragma warning(disable : 6385) /* warning C6385: Reading invalid data from 'v'. */
  560|       |#endif
  561|  2.98k|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  350|  2.98k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  562|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  563|       |#  pragma warning(pop)
  564|       |#endif
  565|  2.98k|        break;
  566|    305|    case 4:
  ------------------
  |  Branch (566:5): [True: 305, False: 5.99k]
  ------------------
  567|    305|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  350|    305|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  568|    305|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  350|    305|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  569|    305|        break;
  570|  1.25k|    default:
  ------------------
  |  Branch (570:5): [True: 1.25k, False: 5.03k]
  ------------------
  571|  1.25k|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  572|  1.25k|        return;
  573|  6.29k|    }
  574|       |
  575|  5.03k|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  350|  5.03k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  576|  5.03k|    dstPtr += 8;
  577|   957k|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (577:12): [True: 952k, False: 5.03k]
  ------------------
  578|   952k|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  350|   952k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  579|   952k|        dstPtr += 8;
  580|   952k|    }
  581|  5.03k|}
lz4.c:LZ4_memcpy_using_offset_base:
  493|  1.25k|{
  494|  1.25k|    assert(srcPtr + offset == dstPtr);
  ------------------
  |  Branch (494:5): [True: 0, False: 1.25k]
  |  Branch (494:5): [True: 1.25k, False: 0]
  ------------------
  495|  1.25k|    if (offset < 8) {
  ------------------
  |  Branch (495:9): [True: 1.14k, False: 111]
  ------------------
  496|  1.14k|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  497|  1.14k|        assert(offset != 1);   /* offset==0 happens on testing */
  ------------------
  |  Branch (497:9): [True: 0, False: 1.14k]
  |  Branch (497:9): [True: 1.14k, False: 0]
  ------------------
  498|  1.14k|        LZ4_memcpy(dstPtr, srcPtr, 2);
  ------------------
  |  |  350|  1.14k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  499|  1.14k|        LZ4_memcpy(dstPtr + 2, srcPtr + 2, 2);
  ------------------
  |  |  350|  1.14k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  500|  1.14k|        srcPtr += inc32table[offset];
  501|  1.14k|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  350|  1.14k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  502|  1.14k|        srcPtr -= dec64table[offset];
  503|  1.14k|        dstPtr += 8;
  504|  1.14k|    } else {
  505|    111|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  350|    111|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  506|    111|        dstPtr += 8;
  507|    111|        srcPtr += 8;
  508|    111|    }
  509|       |
  510|  1.25k|    LZ4_wildCopy8(dstPtr, srcPtr, dstEnd);
  511|  1.25k|}

LLVMFuzzerTestOneInput:
   17|  2.16k|{
   18|  2.16k|    FUZZ_dataProducer_t *producer = FUZZ_dataProducer_create(data, size);
   19|  2.16k|    size_t const dstCapacitySeed = FUZZ_dataProducer_retrieve32(producer);
   20|  2.16k|    size = FUZZ_dataProducer_remainingBytes(producer);
   21|       |
   22|  2.16k|    size_t const compressBound = LZ4_compressBound(size);
   23|  2.16k|    size_t const dstCapacity = FUZZ_getRange_from_uint32(dstCapacitySeed, 0, compressBound);
   24|       |
   25|  2.16k|    char* const dst = (char*)malloc(dstCapacity);
   26|  2.16k|    char* const rt = (char*)malloc(size);
   27|       |
   28|  2.16k|    FUZZ_ASSERT(dst);
  ------------------
  |  |   47|  2.16k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  2.16k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 2.16k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  2.16k|          : (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.16k|    FUZZ_ASSERT(rt);
  ------------------
  |  |   47|  2.16k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  2.16k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 2.16k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  2.16k|          : (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.16k|    {
   33|  2.16k|        int const dstSize = LZ4_compress_default((const char*)data, dst,
   34|  2.16k|                                                 size, dstCapacity);
   35|  2.16k|        if (dstSize > 0) {
  ------------------
  |  Branch (35:13): [True: 1.60k, False: 562]
  ------------------
   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.16k|    }
   41|       |
   42|  2.16k|    if (dstCapacity > 0) {
  ------------------
  |  Branch (42:9): [True: 2.15k, False: 11]
  ------------------
   43|       |        /* Compression succeeds and must round trip correctly. */
   44|  2.15k|        int compressedSize = size;
   45|  2.15k|        int const dstSize = LZ4_compress_destSize((const char*)data, dst,
   46|  2.15k|                                                  &compressedSize, dstCapacity);
   47|  2.15k|        FUZZ_ASSERT(dstSize > 0);
  ------------------
  |  |   47|  2.15k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  2.15k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 2.15k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  2.15k|          : (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.15k|        int const rtSize = LZ4_decompress_safe(dst, rt, dstSize, size);
   49|  2.15k|        FUZZ_ASSERT_MSG(rtSize == compressedSize, "Incorrect regenerated size");
  ------------------
  |  |   43|  2.15k|  ((cond) ? (void)0                                                            \
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 2.15k, False: 0]
  |  |  ------------------
  |  |   44|  2.15k|          : (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.15k|        FUZZ_ASSERT_MSG(!memcmp(data, rt, compressedSize), "Corruption!");
  ------------------
  |  |   43|  2.15k|  ((cond) ? (void)0                                                            \
  |  |  ------------------
  |  |  |  Branch (43:4): [True: 2.15k, False: 0]
  |  |  ------------------
  |  |   44|  2.15k|          : (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.15k|    }
   52|       |
   53|  2.16k|    free(dst);
   54|  2.16k|    free(rt);
   55|  2.16k|    FUZZ_dataProducer_free(producer);
   56|       |
   57|  2.16k|    return 0;
   58|  2.16k|}

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

