LZ4_compressBound:
  760|  5.67k|int LZ4_compressBound(int isize)  { return LZ4_COMPRESSBOUND(isize); }
  ------------------
  |  |  215|  5.67k|#define LZ4_COMPRESSBOUND(isize)  ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
  |  |  ------------------
  |  |  |  |  214|  5.67k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  |  |  ------------------
  |  |  |  Branch (215:36): [True: 0, False: 5.67k]
  |  |  ------------------
  ------------------
LZ4_compress_fast_extState:
 1413|  2.08k|{
 1414|  2.08k|    LZ4_stream_t_internal* const ctx = & LZ4_initStream(state, sizeof(LZ4_stream_t)) -> internal_donotuse;
 1415|  2.08k|    assert(ctx != NULL);
  ------------------
  |  Branch (1415:5): [True: 0, False: 2.08k]
  |  Branch (1415:5): [True: 2.08k, False: 0]
  ------------------
 1416|  2.08k|    acceleration = LZ4_clampAcceleration(acceleration);
 1417|  2.08k|    if (maxOutputSize >= LZ4_compressBound(inputSize)) {
  ------------------
  |  Branch (1417:9): [True: 568, False: 1.51k]
  ------------------
 1418|    568|        if (inputSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1418:13): [True: 560, False: 8]
  ------------------
 1419|    560|            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, 0, notLimited, byU16, noDict, noDictIssue, acceleration);
 1420|    560|        } else {
 1421|      8|            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, 0, notLimited, LZ4_largeInputTableType(source), noDict, noDictIssue, acceleration);
 1422|      8|        }
 1423|  1.51k|    } else {
 1424|  1.51k|        if (inputSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1424:13): [True: 1.27k, False: 247]
  ------------------
 1425|  1.27k|            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, byU16, noDict, noDictIssue, acceleration);
 1426|  1.27k|        } else {
 1427|       |            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, LZ4_largeInputTableType(source), noDict, noDictIssue, acceleration);
 1428|    247|        }
 1429|  1.51k|    }
 1430|  2.08k|}
LZ4_compress_fast:
 1480|  1.80k|{
 1481|  1.80k|    int result;
 1482|       |#if (LZ4_HEAPMODE)
 1483|       |    LZ4_stream_t* const ctxPtr = (LZ4_stream_t*)ALLOC(sizeof(LZ4_stream_t));   /* malloc-calloc always properly aligned */
 1484|       |    if (ctxPtr == NULL) return 0;
 1485|       |#else
 1486|  1.80k|    LZ4_stream_t ctx;
 1487|  1.80k|    LZ4_stream_t* const ctxPtr = &ctx;
 1488|  1.80k|#endif
 1489|  1.80k|    result = LZ4_compress_fast_extState(ctxPtr, src, dest, srcSize, dstCapacity, acceleration);
 1490|       |
 1491|       |#if (LZ4_HEAPMODE)
 1492|       |    FREEMEM(ctxPtr);
 1493|       |#endif
 1494|  1.80k|    return result;
 1495|  1.80k|}
LZ4_compress_default:
 1499|  1.80k|{
 1500|  1.80k|    return LZ4_compress_fast(src, dst, srcSize, dstCapacity, 1);
 1501|  1.80k|}
LZ4_compress_destSize:
 1533|  1.78k|{
 1534|       |#if (LZ4_HEAPMODE)
 1535|       |    LZ4_stream_t* const ctx = (LZ4_stream_t*)ALLOC(sizeof(LZ4_stream_t));   /* malloc-calloc always properly aligned */
 1536|       |    if (ctx == NULL) return 0;
 1537|       |#else
 1538|  1.78k|    LZ4_stream_t ctxBody;
 1539|  1.78k|    LZ4_stream_t* const ctx = &ctxBody;
 1540|  1.78k|#endif
 1541|       |
 1542|  1.78k|    int result = LZ4_compress_destSize_extState_internal(ctx, src, dst, srcSizePtr, targetDstSize, 1);
 1543|       |
 1544|       |#if (LZ4_HEAPMODE)
 1545|       |    FREEMEM(ctx);
 1546|       |#endif
 1547|  1.78k|    return result;
 1548|  1.78k|}
LZ4_initStream:
 1579|  3.87k|{
 1580|  3.87k|    DEBUGLOG(5, "LZ4_initStream");
  ------------------
  |  |  290|  3.87k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1581|  3.87k|    if (buffer == NULL) { return NULL; }
  ------------------
  |  Branch (1581:9): [True: 0, False: 3.87k]
  ------------------
 1582|  3.87k|    if (size < sizeof(LZ4_stream_t)) { return NULL; }
  ------------------
  |  Branch (1582:9): [True: 0, False: 3.87k]
  ------------------
 1583|  3.87k|    if (!LZ4_isAligned(buffer, LZ4_stream_t_alignment())) return NULL;
  ------------------
  |  Branch (1583:9): [True: 0, False: 3.87k]
  ------------------
 1584|  3.87k|    MEM_INIT(buffer, 0, sizeof(LZ4_stream_t_internal));
  ------------------
  |  |  237|  3.87k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  235|  3.87k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 1585|  3.87k|    return (LZ4_stream_t*)buffer;
 1586|  3.87k|}
LZ4_decompress_safe:
 2504|  3.24k|{
 2505|  3.24k|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2506|  3.24k|                                  decode_full_block, noDict,
 2507|       |                                  (BYTE*)dest, NULL, 0);
 2508|  3.24k|}
lz4.c:LZ4_clampAcceleration:
 1397|  3.87k|{
 1398|  3.87k|    if (acceleration < 1) return LZ4_ACCELERATION_DEFAULT;
  ------------------
  |  |   52|      0|#define LZ4_ACCELERATION_DEFAULT 1
  ------------------
  |  Branch (1398:9): [True: 0, False: 3.87k]
  ------------------
 1399|  3.87k|    if (acceleration > LZ4_ACCELERATION_MAX) return LZ4_ACCELERATION_MAX;
  ------------------
  |  |   58|  3.87k|#define LZ4_ACCELERATION_MAX 65537
  ------------------
                  if (acceleration > LZ4_ACCELERATION_MAX) return LZ4_ACCELERATION_MAX;
  ------------------
  |  |   58|      0|#define LZ4_ACCELERATION_MAX 65537
  ------------------
  |  Branch (1399:9): [True: 0, False: 3.87k]
  ------------------
 1400|  3.87k|    return acceleration;
 1401|  3.87k|}
lz4.c:LZ4_compress_generic:
 1369|  3.58k|{
 1370|  3.58k|    DEBUGLOG(5, "LZ4_compress_generic: srcSize=%i, dstCapacity=%i",
  ------------------
  |  |  290|  3.58k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1371|  3.58k|                srcSize, dstCapacity);
 1372|       |
 1373|  3.58k|    if ((U32)srcSize > (U32)LZ4_MAX_INPUT_SIZE) { return 0; }  /* Unsupported srcSize, too large (or negative) */
  ------------------
  |  |  214|  3.58k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  ------------------
  |  Branch (1373:9): [True: 0, False: 3.58k]
  ------------------
 1374|  3.58k|    if (srcSize == 0) {   /* src == NULL supported if srcSize == 0 */
  ------------------
  |  Branch (1374:9): [True: 15, False: 3.57k]
  ------------------
 1375|     15|        if (outputDirective != notLimited && dstCapacity <= 0) return 0;  /* no output, can't write anything */
  ------------------
  |  Branch (1375:13): [True: 13, False: 2]
  |  Branch (1375:46): [True: 1, False: 12]
  ------------------
 1376|     14|        DEBUGLOG(5, "Generating an empty block");
  ------------------
  |  |  290|     14|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1377|     14|        assert(outputDirective == notLimited || dstCapacity >= 1);
  ------------------
  |  Branch (1377:9): [True: 14, False: 0]
  |  Branch (1377:9): [True: 0, False: 0]
  |  Branch (1377:9): [True: 2, False: 12]
  |  Branch (1377:9): [True: 12, False: 0]
  ------------------
 1378|     14|        assert(dst != NULL);
  ------------------
  |  Branch (1378:9): [True: 0, False: 14]
  |  Branch (1378:9): [True: 14, False: 0]
  ------------------
 1379|     14|        dst[0] = 0;
 1380|     14|        if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1380:13): [True: 6, False: 8]
  ------------------
 1381|      6|            assert (inputConsumed != NULL);
  ------------------
  |  Branch (1381:13): [True: 0, False: 6]
  |  Branch (1381:13): [True: 6, False: 0]
  ------------------
 1382|      6|            *inputConsumed = 0;
 1383|      6|        }
 1384|     14|        return 1;
 1385|     14|    }
 1386|  3.58k|    assert(src != NULL);
  ------------------
  |  Branch (1386:5): [True: 0, False: 3.57k]
  |  Branch (1386:5): [True: 3.57k, False: 0]
  ------------------
 1387|       |
 1388|  3.57k|    return LZ4_compress_generic_validated(cctx, src, dst, srcSize,
 1389|  3.57k|                inputConsumed, /* only written into if outputDirective == fillOutput */
 1390|  3.57k|                dstCapacity, outputDirective,
 1391|  3.57k|                tableType, dictDirective, dictIssue, acceleration);
 1392|  3.57k|}
lz4.c:LZ4_compress_generic_validated:
  955|  3.57k|{
  956|  3.57k|    int result;
  957|  3.57k|    const BYTE* ip = (const BYTE*)source;
  958|       |
  959|  3.57k|    U32 const startIndex = cctx->currentOffset;
  960|  3.57k|    const BYTE* base = (const BYTE*)source - startIndex;
  961|  3.57k|    const BYTE* lowLimit;
  962|       |
  963|  3.57k|    const LZ4_stream_t_internal* dictCtx = (const LZ4_stream_t_internal*) cctx->dictCtx;
  964|  3.57k|    const BYTE* const dictionary =
  965|  3.57k|        dictDirective == usingDictCtx ? dictCtx->dictionary : cctx->dictionary;
  ------------------
  |  Branch (965:9): [True: 0, False: 3.57k]
  ------------------
  966|  3.57k|    const U32 dictSize =
  967|  3.57k|        dictDirective == usingDictCtx ? dictCtx->dictSize : cctx->dictSize;
  ------------------
  |  Branch (967:9): [True: 0, False: 3.57k]
  ------------------
  968|  3.57k|    const U32 dictDelta =
  969|  3.57k|        (dictDirective == usingDictCtx) ? startIndex - dictCtx->currentOffset : 0;   /* make indexes in dictCtx comparable with indexes in current context */
  ------------------
  |  Branch (969:9): [True: 0, False: 3.57k]
  ------------------
  970|       |
  971|  3.57k|    int const maybe_extMem = (dictDirective == usingExtDict) || (dictDirective == usingDictCtx);
  ------------------
  |  Branch (971:30): [True: 0, False: 3.57k]
  |  Branch (971:65): [True: 0, False: 3.57k]
  ------------------
  972|  3.57k|    U32 const prefixIdxLimit = startIndex - dictSize;   /* used when dictDirective == dictSmall */
  973|  3.57k|    const BYTE* const dictEnd = dictionary ? dictionary + dictSize : dictionary;
  ------------------
  |  Branch (973:33): [True: 0, False: 3.57k]
  ------------------
  974|  3.57k|    const BYTE* anchor = (const BYTE*) source;
  975|  3.57k|    const BYTE* const iend = ip + inputSize;
  976|  3.57k|    const BYTE* const mflimitPlusOne = iend - MFLIMIT + 1;
  ------------------
  |  |  247|  3.57k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  977|  3.57k|    const BYTE* const matchlimit = iend - LASTLITERALS;
  ------------------
  |  |  246|  3.57k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  978|       |
  979|       |    /* the dictCtx currentOffset is indexed on the start of the dictionary,
  980|       |     * while a dictionary in the current context precedes the currentOffset */
  981|  3.57k|    const BYTE* dictBase = (dictionary == NULL) ? NULL :
  ------------------
  |  Branch (981:28): [True: 3.57k, False: 0]
  ------------------
  982|  3.57k|                           (dictDirective == usingDictCtx) ?
  ------------------
  |  Branch (982:28): [True: 0, False: 0]
  ------------------
  983|      0|                            dictionary + dictSize - dictCtx->currentOffset :
  984|      0|                            dictionary + dictSize - startIndex;
  985|       |
  986|  3.57k|    BYTE* op = (BYTE*) dest;
  987|  3.57k|    BYTE* const olimit = op + maxOutputSize;
  988|       |
  989|  3.57k|    U32 offset = 0;
  990|  3.57k|    U32 forwardH;
  991|       |
  992|  3.57k|    DEBUGLOG(5, "LZ4_compress_generic_validated: srcSize=%i, tableType=%u", inputSize, tableType);
  ------------------
  |  |  290|  3.57k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  993|  3.57k|    assert(ip != NULL);
  ------------------
  |  Branch (993:5): [True: 0, False: 3.57k]
  |  Branch (993:5): [True: 3.57k, False: 0]
  ------------------
  994|  3.57k|    if (tableType == byU16) assert(inputSize<LZ4_64Klimit);  /* Size too large (not within 64K limit) */
  ------------------
  |  Branch (994:9): [True: 3.07k, False: 497]
  |  Branch (994:29): [True: 0, False: 3.07k]
  |  Branch (994:29): [True: 3.07k, False: 0]
  ------------------
  995|  3.57k|    if (tableType == byPtr) assert(dictDirective==noDict);   /* only supported use case with byPtr */
  ------------------
  |  Branch (995:9): [True: 0, False: 3.57k]
  |  Branch (995:29): [True: 0, False: 0]
  |  Branch (995:29): [True: 0, False: 0]
  ------------------
  996|       |    /* If init conditions are not met, we don't have to mark stream
  997|       |     * as having dirty context, since no action was taken yet */
  998|  3.57k|    if (outputDirective == fillOutput && maxOutputSize < 1) { return 0; } /* Impossible to store anything */
  ------------------
  |  Branch (998:9): [True: 1.49k, False: 2.07k]
  |  Branch (998:42): [True: 0, False: 1.49k]
  ------------------
  999|  3.57k|    assert(acceleration >= 1);
  ------------------
  |  Branch (999:5): [True: 0, False: 3.57k]
  |  Branch (999:5): [True: 3.57k, False: 0]
  ------------------
 1000|       |
 1001|  3.57k|    lowLimit = (const BYTE*)source - (dictDirective == withPrefix64k ? dictSize : 0);
  ------------------
  |  Branch (1001:39): [True: 0, False: 3.57k]
  ------------------
 1002|       |
 1003|       |    /* Update context state */
 1004|  3.57k|    if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1004:9): [True: 0, False: 3.57k]
  ------------------
 1005|       |        /* Subsequent linked blocks can't use the dictionary. */
 1006|       |        /* Instead, they use the block we just compressed. */
 1007|      0|        cctx->dictCtx = NULL;
 1008|      0|        cctx->dictSize = (U32)inputSize;
 1009|  3.57k|    } else {
 1010|  3.57k|        cctx->dictSize += (U32)inputSize;
 1011|  3.57k|    }
 1012|  3.57k|    cctx->currentOffset += (U32)inputSize;
 1013|  3.57k|    cctx->tableType = (U32)tableType;
 1014|       |
 1015|  3.57k|    if (inputSize<LZ4_minLength) goto _last_literals;        /* Input too small, no compression (all literals) */
  ------------------
  |  Branch (1015:9): [True: 58, False: 3.51k]
  ------------------
 1016|       |
 1017|       |    /* First Byte */
 1018|  3.51k|    {   U32 const h = LZ4_hashPosition(ip, tableType);
 1019|  3.51k|        if (tableType == byPtr) {
  ------------------
  |  Branch (1019:13): [True: 0, False: 3.51k]
  ------------------
 1020|      0|            LZ4_putPositionOnHash(ip, h, cctx->hashTable, byPtr);
 1021|  3.51k|        } else {
 1022|  3.51k|            LZ4_putIndexOnHash(startIndex, h, cctx->hashTable, tableType);
 1023|  3.51k|    }   }
 1024|  3.51k|    ip++; forwardH = LZ4_hashPosition(ip, tableType);
 1025|       |
 1026|       |    /* Main Loop */
 1027|   368k|    for ( ; ; ) {
 1028|   368k|        const BYTE* match;
 1029|   368k|        BYTE* token;
 1030|   368k|        const BYTE* filledIp;
 1031|       |
 1032|       |        /* Find a match */
 1033|   368k|        if (tableType == byPtr) {
  ------------------
  |  Branch (1033:13): [True: 0, False: 368k]
  ------------------
 1034|      0|            const BYTE* forwardIp = ip;
 1035|      0|            int step = 1;
 1036|      0|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1037|      0|            do {
 1038|      0|                U32 const h = forwardH;
 1039|      0|                ip = forwardIp;
 1040|      0|                forwardIp += step;
 1041|      0|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1042|       |
 1043|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1044|      0|                assert(ip < mflimitPlusOne);
  ------------------
  |  Branch (1044:17): [True: 0, False: 0]
  |  Branch (1044:17): [True: 0, False: 0]
  ------------------
 1045|       |
 1046|      0|                match = LZ4_getPositionOnHash(h, cctx->hashTable, tableType);
 1047|      0|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1048|      0|                LZ4_putPositionOnHash(ip, h, cctx->hashTable, tableType);
 1049|       |
 1050|      0|            } while ( (match+LZ4_DISTANCE_MAX < ip)
  ------------------
  |  |  678|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1050:23): [True: 0, False: 0]
  ------------------
 1051|      0|                   || (LZ4_read32(match) != LZ4_read32(ip)) );
  ------------------
  |  Branch (1051:23): [True: 0, False: 0]
  ------------------
 1052|       |
 1053|   368k|        } else {   /* byU32, byU16 */
 1054|       |
 1055|   368k|            const BYTE* forwardIp = ip;
 1056|   368k|            int step = 1;
 1057|   368k|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1058|  2.31M|            do {
 1059|  2.31M|                U32 const h = forwardH;
 1060|  2.31M|                U32 const current = (U32)(forwardIp - base);
 1061|  2.31M|                U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1062|  2.31M|                assert(matchIndex <= current);
  ------------------
  |  Branch (1062:17): [True: 0, False: 2.31M]
  |  Branch (1062:17): [True: 2.31M, False: 0]
  ------------------
 1063|  2.31M|                assert(forwardIp - base < (ptrdiff_t)(2 GB - 1));
  ------------------
  |  Branch (1063:17): [True: 0, False: 2.31M]
  |  Branch (1063:17): [True: 2.31M, False: 0]
  ------------------
 1064|  2.31M|                ip = forwardIp;
 1065|  2.31M|                forwardIp += step;
 1066|  2.31M|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1067|       |
 1068|  2.31M|                if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
  ------------------
  |  |  181|  2.31M|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  2.31M|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.41k, False: 2.31M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1069|  2.31M|                assert(ip < mflimitPlusOne);
  ------------------
  |  Branch (1069:17): [True: 0, False: 2.31M]
  |  Branch (1069:17): [True: 2.31M, False: 0]
  ------------------
 1070|       |
 1071|  2.31M|                if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1071:21): [True: 0, False: 2.31M]
  ------------------
 1072|      0|                    if (matchIndex < startIndex) {
  ------------------
  |  Branch (1072:25): [True: 0, False: 0]
  ------------------
 1073|       |                        /* there was no match, try the dictionary */
 1074|      0|                        assert(tableType == byU32);
  ------------------
  |  Branch (1074:25): [True: 0, False: 0]
  |  Branch (1074:25): [True: 0, False: 0]
  ------------------
 1075|      0|                        matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32);
 1076|      0|                        match = dictBase + matchIndex;
 1077|      0|                        matchIndex += dictDelta;   /* make dictCtx index comparable with current context */
 1078|      0|                        lowLimit = dictionary;
 1079|      0|                    } else {
 1080|      0|                        match = base + matchIndex;
 1081|      0|                        lowLimit = (const BYTE*)source;
 1082|      0|                    }
 1083|  2.31M|                } else if (dictDirective == usingExtDict) {
  ------------------
  |  Branch (1083:28): [True: 0, False: 2.31M]
  ------------------
 1084|      0|                    if (matchIndex < startIndex) {
  ------------------
  |  Branch (1084:25): [True: 0, False: 0]
  ------------------
 1085|      0|                        DEBUGLOG(7, "extDict candidate: matchIndex=%5u  <  startIndex=%5u", matchIndex, startIndex);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1086|      0|                        assert(startIndex - matchIndex >= MINMATCH);
  ------------------
  |  Branch (1086:25): [True: 0, False: 0]
  |  Branch (1086:25): [True: 0, False: 0]
  ------------------
 1087|      0|                        assert(dictBase);
  ------------------
  |  Branch (1087:25): [True: 0, False: 0]
  |  Branch (1087:25): [True: 0, False: 0]
  ------------------
 1088|      0|                        match = dictBase + matchIndex;
 1089|      0|                        lowLimit = dictionary;
 1090|      0|                    } else {
 1091|      0|                        match = base + matchIndex;
 1092|      0|                        lowLimit = (const BYTE*)source;
 1093|      0|                    }
 1094|  2.31M|                } else {   /* single continuous memory segment */
 1095|  2.31M|                    match = base + matchIndex;
 1096|  2.31M|                }
 1097|  2.31M|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1098|  2.31M|                LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1099|       |
 1100|  2.31M|                DEBUGLOG(7, "candidate at pos=%u  (offset=%u \n", matchIndex, current - matchIndex);
  ------------------
  |  |  290|  2.31M|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1101|  2.31M|                if ((dictIssue == dictSmall) && (matchIndex < prefixIdxLimit)) { continue; }    /* match outside of valid area */
  ------------------
  |  Branch (1101:21): [True: 0, False: 2.31M]
  |  Branch (1101:49): [True: 0, False: 0]
  ------------------
 1102|  2.31M|                assert(matchIndex < current);
  ------------------
  |  Branch (1102:17): [True: 0, False: 2.31M]
  |  Branch (1102:17): [True: 2.31M, False: 0]
  ------------------
 1103|  2.31M|                if ( ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  678|   232k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                              if ( ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  256|   232k|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
  |  Branch (1103:23): [True: 2.08M, False: 232k]
  |  Branch (1103:47): [Folded, False: 0]
  ------------------
 1104|  2.08M|                  && (matchIndex+LZ4_DISTANCE_MAX < current)) {
  ------------------
  |  |  678|  2.08M|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1104:22): [True: 637k, False: 1.44M]
  ------------------
 1105|   637k|                    continue;
 1106|   637k|                } /* too far */
 1107|  2.31M|                assert((current - matchIndex) <= LZ4_DISTANCE_MAX);  /* match now expected within distance */
  ------------------
  |  Branch (1107:17): [True: 0, False: 1.67M]
  |  Branch (1107:17): [True: 1.67M, False: 0]
  ------------------
 1108|       |
 1109|  1.67M|                if (LZ4_read32(match) == LZ4_read32(ip)) {
  ------------------
  |  Branch (1109:21): [True: 367k, False: 1.31M]
  ------------------
 1110|   367k|                    if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1110:25): [True: 0, False: 367k]
  ------------------
 1111|   367k|                    break;   /* match found */
 1112|   367k|                }
 1113|       |
 1114|  1.94M|            } while(1);
  ------------------
  |  Branch (1114:21): [True: 1.94M, Folded]
  ------------------
 1115|   368k|        }
 1116|       |
 1117|       |        /* Catch up */
 1118|   367k|        filledIp = ip;
 1119|   367k|        assert(ip > anchor); /* this is always true as ip has been advanced before entering the main loop */
  ------------------
  |  Branch (1119:9): [True: 0, False: 367k]
  |  Branch (1119:9): [True: 367k, False: 0]
  ------------------
 1120|   367k|        if ((match > lowLimit) && unlikely(ip[-1] == match[-1])) {
  ------------------
  |  |  181|   364k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   364k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 6.35k, False: 358k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1120:13): [True: 364k, False: 2.43k]
  ------------------
 1121|   137k|            do { ip--; match--; } while (((ip > anchor) & (match > lowLimit)) && (unlikely(ip[-1] == match[-1])));
  ------------------
  |  |  181|   134k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   134k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1121:42): [True: 134k, False: 2.29k]
  |  Branch (1121:82): [True: 130k, False: 4.05k]
  ------------------
 1122|  6.35k|        }
 1123|       |
 1124|       |        /* Encode Literals */
 1125|   367k|        {   unsigned const litLength = (unsigned)(ip - anchor);
 1126|   367k|            token = op++;
 1127|   367k|            if ((outputDirective == limitedOutput) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1127:17): [True: 182k, False: 184k]
  ------------------
 1128|   182k|                (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength/255) > olimit)) ) {
  ------------------
  |  |  181|   182k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   182k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1128:17): [True: 103, False: 182k]
  ------------------
 1129|    103|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1130|    103|            }
 1131|   367k|            if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1131:17): [True: 182k, False: 184k]
  ------------------
 1132|   182k|                (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|   182k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   182k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1132:17): [True: 160, False: 182k]
  ------------------
 1133|    160|                op--;
 1134|    160|                goto _last_literals;
 1135|    160|            }
 1136|   367k|            if (litLength >= RUN_MASK) {
  ------------------
  |  |  264|   367k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|   367k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|   367k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1136:17): [True: 2.87k, False: 364k]
  ------------------
 1137|  2.87k|                unsigned len = litLength - RUN_MASK;
  ------------------
  |  |  264|  2.87k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  2.87k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  2.87k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1138|  2.87k|                *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  264|  2.87k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  2.87k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  2.87k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                              *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  261|  2.87k|#define ML_BITS  4
  ------------------
 1139|  64.7k|                for(; len >= 255 ; len-=255) *op++ = 255;
  ------------------
  |  Branch (1139:23): [True: 61.9k, False: 2.87k]
  ------------------
 1140|  2.87k|                *op++ = (BYTE)len;
 1141|  2.87k|            }
 1142|   364k|            else *token = (BYTE)(litLength<<ML_BITS);
  ------------------
  |  |  261|   364k|#define ML_BITS  4
  ------------------
 1143|       |
 1144|       |            /* Copy Literals */
 1145|   367k|            LZ4_wildCopy8(op, anchor, op+litLength);
 1146|   367k|            op+=litLength;
 1147|   367k|            DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  290|   367k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1148|   367k|                        (int)(anchor-(const BYTE*)source), litLength, (int)(ip-(const BYTE*)source));
 1149|   367k|        }
 1150|       |
 1151|   504k|_next_match:
 1152|       |        /* at this stage, the following variables must be correctly set :
 1153|       |         * - ip : at start of LZ operation
 1154|       |         * - match : at start of previous pattern occurrence; can be within current prefix, or within extDict
 1155|       |         * - offset : if maybe_ext_memSegment==1 (constant)
 1156|       |         * - lowLimit : must be == dictionary to mean "match is within extDict"; must be == source otherwise
 1157|       |         * - token and *token : position to write 4-bits for match length; higher 4-bits for literal length supposed already written
 1158|       |         */
 1159|       |
 1160|   504k|        if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1160:13): [True: 250k, False: 254k]
  ------------------
 1161|   250k|            (op + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit)) {
  ------------------
  |  |  247|   250k|#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|   250k|#define MINMATCH 4
  ------------------
  |  Branch (1161:13): [True: 16, False: 250k]
  ------------------
 1162|       |            /* the match was too close to the end, rewind and go to last literals */
 1163|     16|            op = token;
 1164|     16|            goto _last_literals;
 1165|     16|        }
 1166|       |
 1167|       |        /* Encode Offset */
 1168|   504k|        if (maybe_extMem) {   /* static test */
  ------------------
  |  Branch (1168:13): [True: 0, False: 504k]
  ------------------
 1169|      0|            DEBUGLOG(6, "             with offset=%u  (ext if > %i)", offset, (int)(ip - (const BYTE*)source));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1170|      0|            assert(offset <= LZ4_DISTANCE_MAX && offset > 0);
  ------------------
  |  Branch (1170:13): [True: 0, False: 0]
  |  Branch (1170:13): [True: 0, False: 0]
  |  Branch (1170:13): [True: 0, False: 0]
  |  Branch (1170:13): [True: 0, False: 0]
  ------------------
 1171|      0|            LZ4_writeLE16(op, (U16)offset); op+=2;
 1172|   504k|        } else  {
 1173|   504k|            DEBUGLOG(6, "             with offset=%u  (same segment)", (U32)(ip - match));
  ------------------
  |  |  290|   504k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1174|   504k|            assert(ip-match <= LZ4_DISTANCE_MAX);
  ------------------
  |  Branch (1174:13): [True: 0, False: 504k]
  |  Branch (1174:13): [True: 504k, False: 0]
  ------------------
 1175|   504k|            LZ4_writeLE16(op, (U16)(ip - match)); op+=2;
 1176|   504k|        }
 1177|       |
 1178|       |        /* Encode MatchLength */
 1179|   504k|        {   unsigned matchCode;
 1180|       |
 1181|   504k|            if ( (dictDirective==usingExtDict || dictDirective==usingDictCtx)
  ------------------
  |  Branch (1181:19): [True: 0, False: 504k]
  |  Branch (1181:50): [True: 0, False: 504k]
  ------------------
 1182|      0|              && (lowLimit==dictionary) /* match within extDict */ ) {
  ------------------
  |  Branch (1182:18): [True: 0, False: 0]
  ------------------
 1183|      0|                const BYTE* limit = ip + (dictEnd-match);
 1184|      0|                assert(dictEnd > match);
  ------------------
  |  Branch (1184:17): [True: 0, False: 0]
  |  Branch (1184:17): [True: 0, False: 0]
  ------------------
 1185|      0|                if (limit > matchlimit) limit = matchlimit;
  ------------------
  |  Branch (1185:21): [True: 0, False: 0]
  ------------------
 1186|      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
  ------------------
 1187|      0|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
 1188|      0|                if (ip==limit) {
  ------------------
  |  Branch (1188:21): [True: 0, False: 0]
  ------------------
 1189|      0|                    unsigned const more = LZ4_count(limit, (const BYTE*)source, matchlimit);
 1190|      0|                    matchCode += more;
 1191|      0|                    ip += more;
 1192|      0|                }
 1193|      0|                DEBUGLOG(6, "             with matchLength=%u starting in extDict", matchCode+MINMATCH);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1194|   504k|            } else {
 1195|   504k|                matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  243|   504k|#define MINMATCH 4
  ------------------
                              matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  243|   504k|#define MINMATCH 4
  ------------------
 1196|   504k|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  243|   504k|#define MINMATCH 4
  ------------------
 1197|   504k|                DEBUGLOG(6, "             with matchLength=%u", matchCode+MINMATCH);
  ------------------
  |  |  290|   504k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1198|   504k|            }
 1199|       |
 1200|   504k|            if ((outputDirective) &&    /* Check output buffer overflow */
  ------------------
  |  Branch (1200:17): [True: 500k, False: 4.30k]
  ------------------
 1201|   500k|                (unlikely(op + (1 + LASTLITERALS) + (matchCode+240)/255 > olimit)) ) {
  ------------------
  |  |  181|   500k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   500k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1201:17): [True: 18, False: 500k]
  ------------------
 1202|     18|                if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1202:21): [True: 4, False: 14]
  ------------------
 1203|       |                    /* Match description too long : reduce it */
 1204|      4|                    U32 newMatchCode = 15 /* in token */ - 1 /* to avoid needing a zero byte */ + ((U32)(olimit - op) - 1 - LASTLITERALS) * 255;
  ------------------
  |  |  246|      4|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1205|      4|                    ip -= matchCode - newMatchCode;
 1206|      4|                    assert(newMatchCode < matchCode);
  ------------------
  |  Branch (1206:21): [True: 0, False: 4]
  |  Branch (1206:21): [True: 4, False: 0]
  ------------------
 1207|      4|                    matchCode = newMatchCode;
 1208|      4|                    if (unlikely(ip <= filledIp)) {
  ------------------
  |  |  181|      4|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|      4|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1209|       |                        /* We have already filled up to filledIp so if ip ends up less than filledIp
 1210|       |                         * we have positions in the hash table beyond the current position. This is
 1211|       |                         * a problem if we reuse the hash table. So we have to remove these positions
 1212|       |                         * from the hash table.
 1213|       |                         */
 1214|      0|                        const BYTE* ptr;
 1215|      0|                        DEBUGLOG(5, "Clearing %u positions", (U32)(filledIp - ip));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1216|      0|                        for (ptr = ip; ptr <= filledIp; ++ptr) {
  ------------------
  |  Branch (1216:40): [True: 0, False: 0]
  ------------------
 1217|      0|                            U32 const h = LZ4_hashPosition(ptr, tableType);
 1218|      0|                            LZ4_clearHash(h, cctx->hashTable, tableType);
 1219|      0|                        }
 1220|      0|                    }
 1221|     14|                } else {
 1222|     14|                    assert(outputDirective == limitedOutput);
  ------------------
  |  Branch (1222:21): [True: 0, False: 14]
  |  Branch (1222:21): [True: 14, False: 0]
  ------------------
 1223|     14|                    return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1224|     14|                }
 1225|     18|            }
 1226|   504k|            if (matchCode >= ML_MASK) {
  ------------------
  |  |  262|   504k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   504k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (1226:17): [True: 458k, False: 46.4k]
  ------------------
 1227|   458k|                *token += ML_MASK;
  ------------------
  |  |  262|   458k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   458k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1228|   458k|                matchCode -= ML_MASK;
  ------------------
  |  |  262|   458k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   458k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1229|   458k|                LZ4_write32(op, 0xFFFFFFFF);
 1230|   491k|                while (matchCode >= 4*255) {
  ------------------
  |  Branch (1230:24): [True: 33.6k, False: 458k]
  ------------------
 1231|  33.6k|                    op+=4;
 1232|  33.6k|                    LZ4_write32(op, 0xFFFFFFFF);
 1233|  33.6k|                    matchCode -= 4*255;
 1234|  33.6k|                }
 1235|   458k|                op += matchCode / 255;
 1236|   458k|                *op++ = (BYTE)(matchCode % 255);
 1237|   458k|            } else
 1238|  46.4k|                *token += (BYTE)(matchCode);
 1239|   504k|        }
 1240|       |        /* Ensure we have enough space for the last literals. */
 1241|   504k|        assert(!(outputDirective == fillOutput && op + 1 + LASTLITERALS > olimit));
  ------------------
  |  Branch (1241:9): [True: 0, False: 504k]
  |  Branch (1241:9): [True: 0, False: 0]
  |  Branch (1241:9): [True: 250k, False: 254k]
  |  Branch (1241:9): [True: 0, False: 250k]
  ------------------
 1242|       |
 1243|   504k|        anchor = ip;
 1244|       |
 1245|       |        /* Test end of chunk */
 1246|   504k|        if (ip >= mflimitPlusOne) break;
  ------------------
  |  Branch (1246:13): [True: 1.81k, False: 502k]
  ------------------
 1247|       |
 1248|       |        /* Fill table */
 1249|   502k|        {   U32 const h = LZ4_hashPosition(ip-2, tableType);
 1250|   502k|            if (tableType == byPtr) {
  ------------------
  |  Branch (1250:17): [True: 0, False: 502k]
  ------------------
 1251|      0|                LZ4_putPositionOnHash(ip-2, h, cctx->hashTable, byPtr);
 1252|   502k|            } else {
 1253|   502k|                U32 const idx = (U32)((ip-2) - base);
 1254|   502k|                LZ4_putIndexOnHash(idx, h, cctx->hashTable, tableType);
 1255|   502k|        }   }
 1256|       |
 1257|       |        /* Test next position */
 1258|   502k|        if (tableType == byPtr) {
  ------------------
  |  Branch (1258:13): [True: 0, False: 502k]
  ------------------
 1259|       |
 1260|      0|            match = LZ4_getPosition(ip, cctx->hashTable, tableType);
 1261|      0|            LZ4_putPosition(ip, cctx->hashTable, tableType);
 1262|      0|            if ( (match+LZ4_DISTANCE_MAX >= ip)
  ------------------
  |  |  678|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1262:18): [True: 0, False: 0]
  ------------------
 1263|      0|              && (LZ4_read32(match) == LZ4_read32(ip)) )
  ------------------
  |  Branch (1263:18): [True: 0, False: 0]
  ------------------
 1264|      0|            { token=op++; *token=0; goto _next_match; }
 1265|       |
 1266|   502k|        } else {   /* byU32, byU16 */
 1267|       |
 1268|   502k|            U32 const h = LZ4_hashPosition(ip, tableType);
 1269|   502k|            U32 const current = (U32)(ip-base);
 1270|   502k|            U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1271|   502k|            assert(matchIndex < current);
  ------------------
  |  Branch (1271:13): [True: 0, False: 502k]
  |  Branch (1271:13): [True: 502k, False: 0]
  ------------------
 1272|   502k|            if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1272:17): [True: 0, False: 502k]
  ------------------
 1273|      0|                if (matchIndex < startIndex) {
  ------------------
  |  Branch (1273:21): [True: 0, False: 0]
  ------------------
 1274|       |                    /* there was no match, try the dictionary */
 1275|      0|                    assert(tableType == byU32);
  ------------------
  |  Branch (1275:21): [True: 0, False: 0]
  |  Branch (1275:21): [True: 0, False: 0]
  ------------------
 1276|      0|                    matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32);
 1277|      0|                    match = dictBase + matchIndex;
 1278|      0|                    lowLimit = dictionary;   /* required for match length counter */
 1279|      0|                    matchIndex += dictDelta;
 1280|      0|                } else {
 1281|      0|                    match = base + matchIndex;
 1282|      0|                    lowLimit = (const BYTE*)source;  /* required for match length counter */
 1283|      0|                }
 1284|   502k|            } else if (dictDirective==usingExtDict) {
  ------------------
  |  Branch (1284:24): [True: 0, False: 502k]
  ------------------
 1285|      0|                if (matchIndex < startIndex) {
  ------------------
  |  Branch (1285:21): [True: 0, False: 0]
  ------------------
 1286|      0|                    assert(dictBase);
  ------------------
  |  Branch (1286:21): [True: 0, False: 0]
  |  Branch (1286:21): [True: 0, False: 0]
  ------------------
 1287|      0|                    match = dictBase + matchIndex;
 1288|      0|                    lowLimit = dictionary;   /* required for match length counter */
 1289|      0|                } else {
 1290|      0|                    match = base + matchIndex;
 1291|      0|                    lowLimit = (const BYTE*)source;   /* required for match length counter */
 1292|      0|                }
 1293|   502k|            } else {   /* single memory segment */
 1294|   502k|                match = base + matchIndex;
 1295|   502k|            }
 1296|   502k|            LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1297|   502k|            assert(matchIndex < current);
  ------------------
  |  Branch (1297:13): [True: 0, False: 502k]
  |  Branch (1297:13): [True: 502k, False: 0]
  ------------------
 1298|   502k|            if ( ((dictIssue==dictSmall) ? (matchIndex >= prefixIdxLimit) : 1)
  ------------------
  |  Branch (1298:18): [True: 502k, False: 0]
  |  Branch (1298:19): [True: 0, False: 502k]
  ------------------
 1299|   502k|              && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  678|  28.9k|#  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|  28.9k|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
                            && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  678|   473k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1299:18): [True: 376k, False: 126k]
  |  Branch (1299:20): [True: 28.9k, False: 473k]
  |  Branch (1299:42): [True: 0, Folded]
  ------------------
 1300|   376k|              && (LZ4_read32(match) == LZ4_read32(ip)) ) {
  ------------------
  |  Branch (1300:18): [True: 137k, False: 238k]
  ------------------
 1301|   137k|                token=op++;
 1302|   137k|                *token=0;
 1303|   137k|                if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1303:21): [True: 0, False: 137k]
  ------------------
 1304|   137k|                DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  290|   137k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1305|   137k|                            (int)(anchor-(const BYTE*)source), 0, (int)(ip-(const BYTE*)source));
 1306|   137k|                goto _next_match;
 1307|   137k|            }
 1308|   502k|        }
 1309|       |
 1310|       |        /* Prepare next loop */
 1311|   365k|        forwardH = LZ4_hashPosition(++ip, tableType);
 1312|       |
 1313|   365k|    }
 1314|       |
 1315|  3.45k|_last_literals:
 1316|       |    /* Encode Last Literals */
 1317|  3.45k|    {   size_t lastRun = (size_t)(iend - anchor);
 1318|  3.45k|        if ( (outputDirective) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1318:14): [True: 2.89k, False: 566]
  ------------------
 1319|  2.89k|            (op + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > olimit)) {
  ------------------
  |  |  264|  2.89k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  2.89k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  2.89k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1319:13): [True: 575, False: 2.31k]
  ------------------
 1320|    575|            if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1320:17): [True: 348, False: 227]
  ------------------
 1321|       |                /* adapt lastRun to fill 'dst' */
 1322|    348|                assert(olimit >= op);
  ------------------
  |  Branch (1322:17): [True: 0, False: 348]
  |  Branch (1322:17): [True: 348, False: 0]
  ------------------
 1323|    348|                lastRun  = (size_t)(olimit-op) - 1/*token*/;
 1324|    348|                lastRun -= (lastRun + 256 - RUN_MASK) / 256;  /*additional length tokens*/
  ------------------
  |  |  264|    348|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    348|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    348|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1325|    348|            } else {
 1326|    227|                assert(outputDirective == limitedOutput);
  ------------------
  |  Branch (1326:17): [True: 0, False: 227]
  |  Branch (1326:17): [True: 227, False: 0]
  ------------------
 1327|    227|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1328|    227|            }
 1329|    575|        }
 1330|  3.23k|        DEBUGLOG(6, "Final literal run : %i literals", (int)lastRun);
  ------------------
  |  |  290|  3.23k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1331|  3.23k|        if (lastRun >= RUN_MASK) {
  ------------------
  |  |  264|  3.23k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  3.23k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  3.23k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1331:13): [True: 513, False: 2.71k]
  ------------------
 1332|    513|            size_t accumulator = lastRun - RUN_MASK;
  ------------------
  |  |  264|    513|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    513|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    513|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1333|    513|            *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  264|    513|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    513|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    513|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  261|    513|#define ML_BITS  4
  ------------------
 1334|  42.3k|            for(; accumulator >= 255 ; accumulator-=255) *op++ = 255;
  ------------------
  |  Branch (1334:19): [True: 41.8k, False: 513]
  ------------------
 1335|    513|            *op++ = (BYTE) accumulator;
 1336|  2.71k|        } else {
 1337|  2.71k|            *op++ = (BYTE)(lastRun<<ML_BITS);
  ------------------
  |  |  261|  2.71k|#define ML_BITS  4
  ------------------
 1338|  2.71k|        }
 1339|  3.23k|        LZ4_memcpy(op, anchor, lastRun);
  ------------------
  |  |  350|  3.23k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 1340|  3.23k|        ip = anchor + lastRun;
 1341|  3.23k|        op += lastRun;
 1342|  3.23k|    }
 1343|       |
 1344|  3.23k|    if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1344:9): [True: 1.49k, False: 1.73k]
  ------------------
 1345|  1.49k|        *inputConsumed = (int) (((const char*)ip)-source);
 1346|  1.49k|    }
 1347|  3.23k|    result = (int)(((char*)op) - dest);
 1348|  3.23k|    assert(result > 0);
  ------------------
  |  Branch (1348:5): [True: 0, False: 3.23k]
  |  Branch (1348:5): [True: 3.23k, False: 0]
  ------------------
 1349|  3.23k|    DEBUGLOG(5, "LZ4_compress_generic: compressed %i bytes into %i bytes", inputSize, result);
  ------------------
  |  |  290|  3.23k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1350|  3.23k|    return result;
 1351|  3.23k|}
lz4.c:LZ4_hashPosition:
  807|  3.69M|{
  808|  3.69M|    if ((sizeof(reg_t)==8) && (tableType != byU16)) return LZ4_hash5(LZ4_read_ARCH(p), tableType);
  ------------------
  |  Branch (808:9): [True: 3.69M, Folded]
  |  Branch (808:31): [True: 3.38M, False: 310k]
  ------------------
  809|       |
  810|       |#ifdef LZ4_STATIC_LINKING_ONLY_ENDIANNESS_INDEPENDENT_OUTPUT
  811|       |    return LZ4_hash4(LZ4_readLE32(p), tableType);
  812|       |#else
  813|   310k|    return LZ4_hash4(LZ4_read32(p), tableType);
  814|  3.69M|#endif
  815|  3.69M|}
lz4.c:LZ4_hash5:
  795|  3.38M|{
  796|  3.38M|    const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  699|      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;
  ------------------
  |  |  699|  6.76M|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  158|  3.38M|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  3.38M|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (796:25): [True: 0, False: 3.38M]
  ------------------
  797|  3.38M|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (797:9): [True: 3.38M, False: 0]
  ------------------
  798|  3.38M|        const U64 prime5bytes = 889523592379ULL;
  799|  3.38M|        return (U32)(((sequence << 24) * prime5bytes) >> (64 - hashLog));
  800|  3.38M|    } else {
  801|      0|        const U64 prime8bytes = 11400714785074694791ULL;
  802|      0|        return (U32)(((sequence >> 24) * prime8bytes) >> (64 - hashLog));
  803|      0|    }
  804|  3.38M|}
lz4.c:LZ4_isLittleEndian:
  365|  4.89M|{
  366|  4.89M|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  367|  4.89M|    return one.c[0];
  368|  4.89M|}
lz4.c:LZ4_read_ARCH:
  396|  17.6M|static reg_t LZ4_read_ARCH(const void* ptr) { return ((const LZ4_unalignST*)ptr)->uArch; }
lz4.c:LZ4_hash4:
  787|   310k|{
  788|   310k|    if (tableType == byU16)
  ------------------
  |  Branch (788:9): [True: 310k, False: 0]
  ------------------
  789|   310k|        return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
  ------------------
  |  |  243|   310k|#define MINMATCH 4
  ------------------
                      return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
  ------------------
  |  |  699|   310k|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  158|   310k|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   310k|#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));
  ------------------
  |  |  699|      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|   310k|}
lz4.c:LZ4_putIndexOnHash:
  830|  3.32M|{
  831|  3.32M|    switch (tableType)
  832|  3.32M|    {
  833|      0|    default: /* fallthrough */
  ------------------
  |  Branch (833:5): [True: 0, False: 3.32M]
  ------------------
  834|      0|    case clearedTable: /* fallthrough */
  ------------------
  |  Branch (834:5): [True: 0, False: 3.32M]
  ------------------
  835|      0|    case byPtr: { /* illegal! */ assert(0); return; }
  ------------------
  |  Branch (835:5): [True: 0, False: 3.32M]
  |  Branch (835:34): [Folded, False: 0]
  |  Branch (835:34): [Folded, False: 0]
  ------------------
  836|  3.03M|    case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = idx; return; }
  ------------------
  |  Branch (836:5): [True: 3.03M, False: 293k]
  ------------------
  837|   293k|    case byU16: { U16* hashTable = (U16*) tableBase; assert(idx < 65536); hashTable[h] = (U16)idx; return; }
  ------------------
  |  Branch (837:5): [True: 293k, False: 3.03M]
  |  Branch (837:54): [True: 0, False: 293k]
  |  Branch (837:54): [True: 293k, False: 0]
  ------------------
  838|  3.32M|    }
  839|  3.32M|}
lz4.c:LZ4_read32:
  395|  4.42M|static U32 LZ4_read32(const void* ptr) { return ((const LZ4_unalign32*)ptr)->u32; }
lz4.c:LZ4_getIndexOnHash:
  863|  2.82M|{
  864|  2.82M|    LZ4_STATIC_ASSERT(LZ4_MEMORY_USAGE > 2);
  ------------------
  |  |  278|  2.82M|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
  865|  2.82M|    if (tableType == byU32) {
  ------------------
  |  Branch (865:9): [True: 2.55M, False: 262k]
  ------------------
  866|  2.55M|        const U32* const hashTable = (const U32*) tableBase;
  867|  2.55M|        assert(h < (1U << (LZ4_MEMORY_USAGE-2)));
  ------------------
  |  Branch (867:9): [True: 0, False: 2.55M]
  |  Branch (867:9): [True: 2.55M, False: 0]
  ------------------
  868|  2.55M|        return hashTable[h];
  869|  2.55M|    }
  870|   262k|    if (tableType == byU16) {
  ------------------
  |  Branch (870:9): [True: 262k, False: 0]
  ------------------
  871|   262k|        const U16* const hashTable = (const U16*) tableBase;
  872|   262k|        assert(h < (1U << (LZ4_MEMORY_USAGE-1)));
  ------------------
  |  Branch (872:9): [True: 0, False: 262k]
  |  Branch (872:9): [True: 262k, False: 0]
  ------------------
  873|   262k|        return hashTable[h];
  874|   262k|    }
  875|   262k|    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|   374k|{
  468|   374k|    BYTE* d = (BYTE*)dstPtr;
  469|   374k|    const BYTE* s = (const BYTE*)srcPtr;
  470|   374k|    BYTE* const e = (BYTE*)dstEnd;
  471|       |
  472|  2.94M|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  350|  2.94M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (472:50): [True: 2.56M, False: 374k]
  ------------------
  473|   374k|}
lz4.c:LZ4_writeLE16:
  454|   504k|{
  455|   504k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (455:9): [True: 504k, False: 0]
  ------------------
  456|   504k|        LZ4_write16(memPtr, value);
  457|   504k|    } else {
  458|      0|        BYTE* p = (BYTE*)memPtr;
  459|      0|        p[0] = (BYTE) value;
  460|      0|        p[1] = (BYTE)(value>>8);
  461|      0|    }
  462|   504k|}
lz4.c:LZ4_write16:
  398|   504k|static void LZ4_write16(void* memPtr, U16 value) { ((LZ4_unalign16*)memPtr)->u16 = value; }
lz4.c:LZ4_count:
  690|   504k|{
  691|   504k|    const BYTE* const pStart = pIn;
  692|       |
  693|   504k|    if (likely(pIn < pInLimit-(STEPSIZE-1))) {
  ------------------
  |  |  178|   504k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|   504k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 503k, False: 1.10k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  694|   503k|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  695|   503k|        if (!diff) {
  ------------------
  |  Branch (695:13): [True: 465k, False: 37.6k]
  ------------------
  696|   465k|            pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  687|   465k|#define STEPSIZE sizeof(reg_t)
  ------------------
                          pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  687|   465k|#define STEPSIZE sizeof(reg_t)
  ------------------
  697|   465k|        } else {
  698|  37.6k|            return LZ4_NbCommonBytes(diff);
  699|  37.6k|    }   }
  700|       |
  701|  6.63M|    while (likely(pIn < pInLimit-(STEPSIZE-1))) {
  702|  6.63M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  703|  6.63M|        if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  687|  6.17M|#define STEPSIZE sizeof(reg_t)
  ------------------
                      if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  687|  6.17M|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (703:13): [True: 6.17M, False: 465k]
  ------------------
  704|   465k|        pIn += LZ4_NbCommonBytes(diff);
  705|   465k|        return (unsigned)(pIn - pStart);
  706|  6.63M|    }
  707|       |
  708|  1.78k|    if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  |  687|  1.78k|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (708:9): [True: 1.78k, Folded]
  |  Branch (708:26): [True: 1.10k, False: 678]
  |  Branch (708:48): [True: 340, False: 768]
  ------------------
  709|  1.78k|    if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (709:9): [True: 1.53k, False: 249]
  |  Branch (709:31): [True: 572, False: 965]
  ------------------
  710|  1.78k|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (710:9): [True: 1.49k, False: 287]
  |  Branch (710:27): [True: 619, False: 880]
  ------------------
  711|  1.78k|    return (unsigned)(pIn - pStart);
  712|   467k|}
lz4.c:LZ4_NbCommonBytes:
  589|   502k|{
  590|   502k|    assert(val != 0);
  ------------------
  |  Branch (590:5): [True: 0, False: 502k]
  |  Branch (590:5): [True: 502k, False: 0]
  ------------------
  591|   502k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (591:9): [True: 502k, False: 0]
  ------------------
  592|   502k|        if (sizeof(val) == 8) {
  ------------------
  |  Branch (592:13): [True: 502k, 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|   502k|        } 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|   502k|    } 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|   502k|}
lz4.c:LZ4_read16:
  394|   502k|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  399|   497k|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_largeInputTableType:
 1407|    497|{
 1408|    497|    (void)src;   /* unused on 64-bit systems */
 1409|    497|    return ((sizeof(void*)==4) && ((uptrval)src > LZ4_DISTANCE_MAX)) ? byPtr : byU32;
  ------------------
  |  |  678|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1409:13): [Folded, False: 497]
  |  Branch (1409:35): [True: 0, False: 0]
  ------------------
 1410|    497|}
lz4.c:LZ4_compress_destSize_extState_internal:
 1508|  1.78k|{
 1509|  1.78k|    void* const s = LZ4_initStream(state, sizeof (*state));
 1510|  1.78k|    assert(s != NULL); (void)s;
  ------------------
  |  Branch (1510:5): [True: 0, False: 1.78k]
  |  Branch (1510:5): [True: 1.78k, False: 0]
  ------------------
 1511|  1.78k|    acceleration = LZ4_clampAcceleration(acceleration);
 1512|       |
 1513|  1.78k|    if (targetDstSize >= LZ4_compressBound(*srcSizePtr)) {  /* compression success is guaranteed */
  ------------------
  |  Branch (1513:9): [True: 284, False: 1.50k]
  ------------------
 1514|    284|        return LZ4_compress_fast_extState(state, src, dst, *srcSizePtr, targetDstSize, acceleration);
 1515|  1.50k|    } else {
 1516|  1.50k|        if (*srcSizePtr < LZ4_64Klimit) {
  ------------------
  |  Branch (1516:13): [True: 1.26k, False: 242]
  ------------------
 1517|  1.26k|            return LZ4_compress_generic(&state->internal_donotuse, src, dst, *srcSizePtr, srcSizePtr, targetDstSize, fillOutput, byU16, noDict, noDictIssue, acceleration);
 1518|  1.26k|        } else {
 1519|    242|            return LZ4_compress_generic(&state->internal_donotuse, src, dst, *srcSizePtr, srcSizePtr, targetDstSize, fillOutput, LZ4_largeInputTableType(src), noDict, noDictIssue, acceleration);
 1520|    242|    }   }
 1521|  1.78k|}
lz4.c:LZ4_isAligned:
  294|  3.87k|{
  295|  3.87k|    return ((size_t)ptr & (alignment -1)) == 0;
  296|  3.87k|}
lz4.c:LZ4_stream_t_alignment:
 1569|  3.87k|{
 1570|  3.87k|#if LZ4_ALIGN_TEST
 1571|  3.87k|    typedef struct { char c; LZ4_stream_t t; } t_a;
 1572|  3.87k|    return sizeof(t_a) - sizeof(LZ4_stream_t);
 1573|       |#else
 1574|       |    return 1;  /* effectively disabled */
 1575|       |#endif
 1576|  3.87k|}
lz4.c:LZ4_decompress_generic:
 2067|  3.24k|{
 2068|  3.24k|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (2068:9): [True: 0, False: 3.24k]
  |  Branch (2068:26): [True: 0, False: 3.24k]
  ------------------
 2069|       |
 2070|  3.24k|    {   const BYTE* ip = (const BYTE*) src;
 2071|  3.24k|        const BYTE* const iend = ip + srcSize;
 2072|       |
 2073|  3.24k|        BYTE* op = (BYTE*) dst;
 2074|  3.24k|        BYTE* const oend = op + outputSize;
 2075|  3.24k|        BYTE* cpy;
 2076|       |
 2077|  3.24k|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (2077:37): [True: 3.24k, False: 0]
  ------------------
 2078|       |
 2079|  3.24k|        const int checkOffset = (dictSize < (int)(64 KB));
  ------------------
  |  |  252|  3.24k|#define KB *(1 <<10)
  ------------------
 2080|       |
 2081|       |
 2082|       |        /* Set up the "end" pointers for the shortcut. */
 2083|  3.24k|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 2084|  3.24k|        const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/;
 2085|       |
 2086|  3.24k|        const BYTE* match;
 2087|  3.24k|        size_t offset;
 2088|  3.24k|        unsigned token;
 2089|  3.24k|        size_t length;
 2090|       |
 2091|       |
 2092|  3.24k|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  290|  3.24k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2093|       |
 2094|       |        /* Special cases */
 2095|  3.24k|        assert(lowPrefix <= op);
  ------------------
  |  Branch (2095:9): [True: 0, False: 3.24k]
  |  Branch (2095:9): [True: 3.24k, False: 0]
  ------------------
 2096|  3.24k|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  181|  3.24k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  3.24k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 14, False: 3.23k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2097|       |            /* Empty output buffer */
 2098|     14|            if (partialDecoding) return 0;
  ------------------
  |  Branch (2098:17): [True: 0, False: 14]
  ------------------
 2099|     14|            return ((srcSize==1) && (*ip==0)) ? 0 : -1;
  ------------------
  |  Branch (2099:21): [True: 14, False: 0]
  |  Branch (2099:37): [True: 14, False: 0]
  ------------------
 2100|     14|        }
 2101|  3.23k|        if (unlikely(srcSize==0)) { return -1; }
  ------------------
  |  |  181|  3.23k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  3.23k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 3.23k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2102|       |
 2103|       |    /* LZ4_FAST_DEC_LOOP:
 2104|       |     * designed for modern OoO performance cpus,
 2105|       |     * where copying reliably 32-bytes is preferable to an unpredictable branch.
 2106|       |     * note : fast loop may show a regression for some client arm chips. */
 2107|  3.23k|#if LZ4_FAST_DEC_LOOP
 2108|  3.23k|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  3.23k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2108:13): [True: 1.53k, False: 1.69k]
  ------------------
 2109|  1.53k|            DEBUGLOG(6, "move to safe decode loop");
  ------------------
  |  |  290|  1.53k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2110|  1.53k|            goto safe_decode;
 2111|  1.53k|        }
 2112|       |
 2113|       |        /* Fast loop : decode sequences as long as output < oend-FASTLOOP_SAFE_DISTANCE */
 2114|  1.69k|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  290|  1.69k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2115|   494k|        while (1) {
  ------------------
  |  Branch (2115:16): [True: 494k, Folded]
  ------------------
 2116|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2117|   494k|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  Branch (2117:13): [True: 0, False: 494k]
  |  Branch (2117:13): [True: 494k, False: 0]
  ------------------
 2118|   494k|            assert(ip < iend);
  ------------------
  |  Branch (2118:13): [True: 0, False: 494k]
  |  Branch (2118:13): [True: 494k, False: 0]
  ------------------
 2119|   494k|            token = *ip++;
 2120|   494k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  261|   494k|#define ML_BITS  4
  ------------------
 2121|   494k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|   494k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2122|       |
 2123|   494k|            if (ip > iend-(16 + 1/*max lit + offset + nextToken*/)) { goto safe_literal_copy_early; }
  ------------------
  |  Branch (2123:17): [True: 243, False: 494k]
  ------------------
 2124|       |
 2125|       |            /* decode literal length */
 2126|   494k|            if (length == RUN_MASK) {
  ------------------
  |  |  264|   494k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|   494k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|   494k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2126:17): [True: 2.75k, False: 491k]
  ------------------
 2127|       |                /* literal length >= RUN_MASK means >= RUN_MASK literal bytes follow the extension bytes,
 2128|       |                 * so extension bytes cannot reach the last RUN_MASK bytes of input */
 2129|  2.75k|                size_t const addl = read_variable_length(&ip, iend - RUN_MASK);
  ------------------
  |  |  264|  2.75k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  2.75k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  2.75k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2130|  2.75k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2130:21): [True: 0, False: 2.75k]
  ------------------
 2131|      0|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2132|      0|                    goto _output_error;
 2133|      0|                }
 2134|  2.75k|                length += addl;
 2135|  2.75k|                cpy = op+length;
 2136|  2.75k|                if (unlikely((uptrval)(cpy)<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|  2.75k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  2.75k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 2.75k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2137|  2.75k|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|  2.75k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  2.75k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 2.75k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2138|       |
 2139|       |                /* copy literals */
 2140|  2.75k|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  278|  2.75k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2141|       |              #ifdef __aarch64__
 2142|       |                if ((cpy>oend-64) || (ip+length>iend-64)) { goto safe_literal_copy; }
 2143|       |                LZ4_wildCopy64(op, ip, cpy);
 2144|       |              #else
 2145|  2.75k|                if ((cpy>oend-32) || (ip+length>iend-32)) { goto safe_literal_copy; }
  ------------------
  |  Branch (2145:21): [True: 180, False: 2.57k]
  |  Branch (2145:38): [True: 182, False: 2.39k]
  ------------------
 2146|  2.39k|                LZ4_wildCopy32(op, ip, cpy);
 2147|  2.39k|              #endif
 2148|  2.39k|                ip += length; op = cpy;
 2149|   491k|            } else {
 2150|   491k|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)length);
  ------------------
  |  |  290|   491k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2151|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2152|   491k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  350|   491k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2153|   491k|                ip += length; op += length;
 2154|   491k|            }
 2155|       |
 2156|       |            /* get offset */
 2157|   494k|            offset = LZ4_readLE16(ip); ip+=2;
 2158|   494k|            DEBUGLOG(6, "blockPos%6u: offset = %u", (unsigned)(op-(BYTE*)dst), (unsigned)offset);
  ------------------
  |  |  290|   494k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2159|   494k|            match = op - offset;
 2160|   494k|            assert(match <= op);  /* overflow check */
  ------------------
  |  Branch (2160:13): [True: 0, False: 494k]
  |  Branch (2160:13): [True: 494k, False: 0]
  ------------------
 2161|       |
 2162|       |            /* get matchlength */
 2163|   494k|            length = token & ML_MASK;
  ------------------
  |  |  262|   494k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   494k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2164|   494k|            DEBUGLOG(7, "  match length token = %u (len==%u)", (unsigned)length, (unsigned)length+MINMATCH);
  ------------------
  |  |  290|   494k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2165|       |
 2166|   494k|            if (length == ML_MASK) {
  ------------------
  |  |  262|   494k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|   494k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2166:17): [True: 453k, False: 40.1k]
  ------------------
 2167|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2168|   453k|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  246|   453k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2169|   453k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2169:21): [True: 0, False: 453k]
  ------------------
 2170|      0|                    DEBUGLOG(5, "error reading long match length");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2171|      0|                    goto _output_error;
 2172|      0|                }
 2173|   453k|                length += addl;
 2174|   453k|                length += MINMATCH;
  ------------------
  |  |  243|   453k|#define MINMATCH 4
  ------------------
 2175|   453k|                DEBUGLOG(7, "  long match length == %u", (unsigned)length);
  ------------------
  |  |  290|   453k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2176|   453k|                if (unlikely((uptrval)(op)+length<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|   453k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   453k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 453k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2177|   453k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|   453k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2177:21): [True: 653, False: 453k]
  ------------------
 2178|    653|                    goto safe_match_copy;
 2179|    653|                }
 2180|   453k|            } else {
 2181|  40.1k|                length += MINMATCH;
  ------------------
  |  |  243|  40.1k|#define MINMATCH 4
  ------------------
 2182|  40.1k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  40.1k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2182:21): [True: 435, False: 39.7k]
  ------------------
 2183|    435|                    DEBUGLOG(7, "moving to safe_match_copy (ml==%u)", (unsigned)length);
  ------------------
  |  |  290|    435|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2184|    435|                    goto safe_match_copy;
 2185|    435|                }
 2186|       |
 2187|       |                /* Fastpath check: skip LZ4_wildCopy32 when true */
 2188|  39.7k|                if ((dict == withPrefix64k) || (match >= lowPrefix)) {
  ------------------
  |  Branch (2188:21): [True: 0, False: 39.7k]
  |  Branch (2188:48): [True: 39.7k, False: 0]
  ------------------
 2189|  39.7k|                    if (offset >= 8) {
  ------------------
  |  Branch (2189:25): [True: 32.2k, False: 7.49k]
  ------------------
 2190|  32.2k|                        assert(match >= lowPrefix);
  ------------------
  |  Branch (2190:25): [True: 0, False: 32.2k]
  |  Branch (2190:25): [True: 32.2k, False: 0]
  ------------------
 2191|  32.2k|                        assert(match <= op);
  ------------------
  |  Branch (2191:25): [True: 0, False: 32.2k]
  |  Branch (2191:25): [True: 32.2k, False: 0]
  ------------------
 2192|  32.2k|                        assert(op + 18 <= oend);
  ------------------
  |  Branch (2192:25): [True: 0, False: 32.2k]
  |  Branch (2192:25): [True: 32.2k, False: 0]
  ------------------
 2193|       |
 2194|  32.2k|                        LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  32.2k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2195|  32.2k|                        LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  350|  32.2k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2196|  32.2k|                        LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  350|  32.2k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2197|  32.2k|                        op += length;
 2198|  32.2k|                        continue;
 2199|  32.2k|            }   }   }
 2200|       |
 2201|   460k|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  181|   460k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   460k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2201:18): [True: 460k, False: 0]
  |  Branch (2201:33): [True: 0, False: 460k]
  ------------------
 2202|      0|                DEBUGLOG(5, "Error : pos=%zi, offset=%zi => outside buffers", op-lowPrefix, op-match);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2203|      0|                goto _output_error;
 2204|      0|            }
 2205|       |            /* match starting within external dictionary */
 2206|   460k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2206:17): [True: 0, False: 460k]
  |  Branch (2206:41): [True: 0, False: 0]
  ------------------
 2207|      0|                assert(dictEnd != NULL);
  ------------------
  |  Branch (2207:17): [True: 0, False: 0]
  |  Branch (2207:17): [True: 0, False: 0]
  ------------------
 2208|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2209|      0|                    if (partialDecoding) {
  ------------------
  |  Branch (2209:25): [True: 0, False: 0]
  ------------------
 2210|      0|                        DEBUGLOG(7, "partialDecoding: dictionary match, close to dstEnd");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2211|      0|                        length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1887|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1887:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2212|      0|                    } else {
 2213|      0|                        DEBUGLOG(6, "end-of-block condition violated")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2214|      0|                        goto _output_error;
 2215|      0|                }   }
 2216|       |
 2217|      0|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2217:21): [True: 0, False: 0]
  ------------------
 2218|       |                    /* match fits entirely within external dictionary : just copy */
 2219|      0|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  358|      0|#    define LZ4_memmove __builtin_memmove
  ------------------
 2220|      0|                    op += length;
 2221|      0|                } else {
 2222|       |                    /* match stretches into both external dictionary and current block */
 2223|      0|                    size_t const copySize = (size_t)(lowPrefix - match);
 2224|      0|                    size_t const restSize = length - copySize;
 2225|      0|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2226|      0|                    op += copySize;
 2227|      0|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2227:25): [True: 0, False: 0]
  ------------------
 2228|      0|                        BYTE* const endOfMatch = op + restSize;
 2229|      0|                        const BYTE* copyFrom = lowPrefix;
 2230|      0|                        while (op < endOfMatch) { *op++ = *copyFrom++; }
  ------------------
  |  Branch (2230:32): [True: 0, False: 0]
  ------------------
 2231|      0|                    } else {
 2232|      0|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2233|      0|                        op += restSize;
 2234|      0|                }   }
 2235|      0|                continue;
 2236|      0|            }
 2237|       |
 2238|       |            /* copy match within block */
 2239|   460k|            cpy = op + length;
 2240|       |
 2241|   460k|            assert((op <= oend) && (oend-op >= 64));
  ------------------
  |  Branch (2241:13): [True: 0, False: 460k]
  |  Branch (2241:13): [True: 0, False: 0]
  |  Branch (2241:13): [True: 460k, False: 0]
  |  Branch (2241:13): [True: 460k, False: 0]
  ------------------
 2242|   460k|            if (unlikely(offset<16)) {
  ------------------
  |  |  181|   460k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   460k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 19.1k, False: 441k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2243|  19.1k|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2244|       |    #ifdef __aarch64__
 2245|       |            } else if (offset >= 64) {
 2246|       |                LZ4_wildCopy64(op, match, cpy);
 2247|       |    #endif
 2248|   441k|            } else {
 2249|   441k|                LZ4_wildCopy32(op, match, cpy);
 2250|   441k|            }
 2251|       |
 2252|   460k|            op = cpy;   /* wildcopy correction */
 2253|   460k|        }
 2254|  1.53k|    safe_decode:
 2255|  1.53k|#endif
 2256|       |
 2257|       |        /* Main Loop : decode remaining sequences where output < FASTLOOP_SAFE_DISTANCE */
 2258|  1.53k|        DEBUGLOG(6, "using safe decode loop");
  ------------------
  |  |  290|  1.53k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2259|  7.81k|        while (1) {
  ------------------
  |  Branch (2259:16): [True: 7.81k, Folded]
  ------------------
 2260|  7.81k|            assert(ip < iend);
  ------------------
  |  Branch (2260:13): [True: 0, False: 7.81k]
  |  Branch (2260:13): [True: 7.81k, False: 0]
  ------------------
 2261|  7.81k|            token = *ip++;
 2262|  7.81k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  261|  7.81k|#define ML_BITS  4
  ------------------
 2263|  7.81k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  7.81k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2264|       |
 2265|       |            /* A two-stage shortcut for the most common case:
 2266|       |             * 1) If the literal length is 0..14, and there is enough space,
 2267|       |             * enter the shortcut and copy 16 bytes on behalf of the literals
 2268|       |             * (in the fast mode, only 8 bytes can be safely copied this way).
 2269|       |             * 2) Further if the match length is 4..18, copy 18 bytes in a similar
 2270|       |             * manner; but we ensure that there's enough space in the output for
 2271|       |             * those 18 bytes earlier, upon entering the shortcut (in other words,
 2272|       |             * there is a combined check for both stages).
 2273|       |             */
 2274|  7.81k|            if ( (length != RUN_MASK)
  ------------------
  |  |  264|  7.81k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  7.81k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  7.81k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2274:18): [True: 7.39k, False: 417]
  ------------------
 2275|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2276|  7.39k|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  178|  7.39k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  7.39k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.77k, False: 5.61k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2277|       |                /* Copy the literals */
 2278|  1.77k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  350|  1.77k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2279|  1.77k|                op += length; ip += length;
 2280|       |
 2281|       |                /* The second stage: prepare for match copying, decode full info.
 2282|       |                 * If it doesn't work out, the info won't be wasted. */
 2283|  1.77k|                length = token & ML_MASK; /* match length */
  ------------------
  |  |  262|  1.77k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.77k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2284|  1.77k|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u (len=%u)", (unsigned)(op-(BYTE*)dst), (unsigned)length, (unsigned)length + 4);
  ------------------
  |  |  290|  1.77k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2285|  1.77k|                offset = LZ4_readLE16(ip); ip += 2;
 2286|  1.77k|                match = op - offset;
 2287|  1.77k|                assert(match <= op); /* check overflow */
  ------------------
  |  Branch (2287:17): [True: 0, False: 1.77k]
  |  Branch (2287:17): [True: 1.77k, False: 0]
  ------------------
 2288|       |
 2289|       |                /* Do not deal with overlapping matches. */
 2290|  1.77k|                if ( (length != ML_MASK)
  ------------------
  |  |  262|  1.77k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.77k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2290:22): [True: 1.60k, False: 174]
  ------------------
 2291|  1.60k|                  && (offset >= 8)
  ------------------
  |  Branch (2291:22): [True: 881, False: 724]
  ------------------
 2292|    881|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2292:23): [True: 0, False: 881]
  |  Branch (2292:46): [True: 881, False: 0]
  ------------------
 2293|       |                    /* Copy the match. */
 2294|    881|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  350|    881|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2295|    881|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  350|    881|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2296|    881|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  350|    881|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2297|    881|                    op += length + MINMATCH;
  ------------------
  |  |  243|    881|#define MINMATCH 4
  ------------------
 2298|       |                    /* Both stages worked, load the next token. */
 2299|    881|                    continue;
 2300|    881|                }
 2301|       |
 2302|       |                /* The second stage didn't work out, but the info is ready.
 2303|       |                 * Propel it right to the point of match copying. */
 2304|    898|                goto _copy_match;
 2305|  1.77k|            }
 2306|       |
 2307|  6.03k|#if LZ4_FAST_DEC_LOOP
 2308|  6.27k|        safe_literal_copy_early:
 2309|  6.27k|#endif
 2310|       |
 2311|       |            /* decode literal length */
 2312|  6.27k|            if (length == RUN_MASK) {
  ------------------
  |  |  264|  6.27k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  6.27k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  6.27k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2312:17): [True: 417, False: 5.86k]
  ------------------
 2313|       |                /* literal length >= RUN_MASK means >= RUN_MASK literal bytes follow the extension bytes,
 2314|       |                 * so extension bytes cannot reach the last RUN_MASK bytes of input */
 2315|    417|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK);
  ------------------
  |  |  264|    417|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    417|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    417|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2316|    417|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2316:21): [True: 0, False: 417]
  ------------------
 2317|    417|                length += addl;
 2318|    417|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|    417|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    417|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 417]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2319|    417|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|    417|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    417|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 417]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2320|    417|            }
 2321|       |
 2322|       |            /* copy literals */
 2323|  6.27k|            cpy = op+length;
 2324|       |
 2325|  6.27k|#if LZ4_FAST_DEC_LOOP
 2326|  6.63k|        safe_literal_copy:
 2327|  6.63k|#endif
 2328|       |
 2329|  6.63k|            LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  278|  6.63k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2330|  6.63k|            if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  247|  6.63k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  246|  3.58k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2330:17): [True: 3.05k, False: 3.58k]
  |  Branch (2330:39): [True: 177, False: 3.40k]
  ------------------
 2331|       |                /* We've either hit the input parsing restriction or the output parsing restriction.
 2332|       |                 * In the normal scenario, decoding a full block, it must be the last sequence,
 2333|       |                 * otherwise it's an error (invalid input or dimensions).
 2334|       |                 * In partialDecoding scenario, it's necessary to ensure there is no buffer overflow.
 2335|       |                 */
 2336|  3.23k|                if (partialDecoding) {
  ------------------
  |  Branch (2336:21): [True: 0, False: 3.23k]
  ------------------
 2337|       |                    /* Since we are partial decoding we may be in this block because of the output parsing
 2338|       |                     * restriction, which is not valid since the output buffer is allowed to be undersized.
 2339|       |                     */
 2340|      0|                    DEBUGLOG(7, "partialDecoding: copying literals, close to input or output end")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2341|      0|                    DEBUGLOG(7, "partialDecoding: literal length = %u", (unsigned)length);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2342|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in dstBuffer : %i", (int)(oend - op));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2343|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in srcBuffer : %i", (int)(iend - ip));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2344|       |                    /* Finishing in the middle of a literals segment,
 2345|       |                     * due to lack of input.
 2346|       |                     */
 2347|      0|                    if (ip+length > iend) {
  ------------------
  |  Branch (2347:25): [True: 0, False: 0]
  ------------------
 2348|      0|                        length = (size_t)(iend-ip);
 2349|      0|                        cpy = op + length;
 2350|      0|                    }
 2351|       |                    /* Finishing in the middle of a literals segment,
 2352|       |                     * due to lack of output space.
 2353|       |                     */
 2354|      0|                    if (cpy > oend) {
  ------------------
  |  Branch (2354:25): [True: 0, False: 0]
  ------------------
 2355|      0|                        cpy = oend;
 2356|      0|                        assert(op<=oend);
  ------------------
  |  Branch (2356:25): [True: 0, False: 0]
  |  Branch (2356:25): [True: 0, False: 0]
  ------------------
 2357|      0|                        length = (size_t)(oend-op);
 2358|      0|                    }
 2359|  3.23k|                } else {
 2360|       |                     /* We must be on the last sequence (or invalid) because of the parsing limitations
 2361|       |                      * so check that we exactly consume the input and don't overrun the output buffer.
 2362|       |                      */
 2363|  3.23k|                    if ((ip+length != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2363:25): [True: 0, False: 3.23k]
  |  Branch (2363:48): [True: 0, False: 3.23k]
  ------------------
 2364|      0|                        DEBUGLOG(5, "should have been last run of literals")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2365|      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 */
  ------------------
 2366|      0|                        DEBUGLOG(5, "or cpy(%p) > (oend-MFLIMIT)(%p)", (void*)cpy, (void*)(oend-MFLIMIT));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2367|      0|                        DEBUGLOG(5, "after writing %u bytes / %i bytes available", (unsigned)(op-(BYTE*)dst), outputSize);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2368|      0|                        goto _output_error;
 2369|      0|                    }
 2370|  3.23k|                }
 2371|  3.23k|                LZ4_memmove(op, ip, length);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  358|  3.23k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2372|  3.23k|                ip += length;
 2373|  3.23k|                op += length;
 2374|       |                /* Necessarily EOF when !partialDecoding.
 2375|       |                 * When partialDecoding, it is EOF if we've either
 2376|       |                 * filled the output buffer or
 2377|       |                 * can't proceed with reading an offset for following match.
 2378|       |                 */
 2379|  3.23k|                if (!partialDecoding || (cpy == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2379:21): [True: 3.23k, False: 0]
  |  Branch (2379:41): [True: 0, False: 0]
  |  Branch (2379:58): [True: 0, False: 0]
  ------------------
 2380|  3.23k|                    break;
 2381|  3.23k|                }
 2382|  3.40k|            } else {
 2383|  3.40k|                LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2384|  3.40k|                ip += length; op = cpy;
 2385|  3.40k|            }
 2386|       |
 2387|       |            /* get offset */
 2388|  3.40k|            offset = LZ4_readLE16(ip); ip+=2;
 2389|  3.40k|            match = op - offset;
 2390|       |
 2391|       |            /* get matchlength */
 2392|  3.40k|            length = token & ML_MASK;
  ------------------
  |  |  262|  3.40k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  3.40k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2393|  3.40k|            DEBUGLOG(7, "blockPos%6u: matchLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  3.40k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2394|       |
 2395|  4.30k|    _copy_match:
 2396|  4.30k|            if (length == ML_MASK) {
  ------------------
  |  |  262|  4.30k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  4.30k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2396:17): [True: 745, False: 3.56k]
  ------------------
 2397|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2398|    745|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  246|    745|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2399|    745|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2399:21): [True: 0, False: 745]
  ------------------
 2400|    745|                length += addl;
 2401|    745|                if (unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  181|    745|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    745|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 745]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2402|    745|            }
 2403|  4.30k|            length += MINMATCH;
  ------------------
  |  |  243|  4.30k|#define MINMATCH 4
  ------------------
 2404|       |
 2405|  4.30k|#if LZ4_FAST_DEC_LOOP
 2406|  5.39k|        safe_match_copy:
 2407|  5.39k|#endif
 2408|  5.39k|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error;   /* Error : offset outside buffers */
  ------------------
  |  |  181|  5.39k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  5.39k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2408:17): [True: 5.39k, False: 0]
  |  Branch (2408:34): [True: 0, False: 5.39k]
  ------------------
 2409|       |            /* match starting within external dictionary */
 2410|  5.39k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2410:17): [True: 0, False: 5.39k]
  |  Branch (2410:41): [True: 0, False: 0]
  ------------------
 2411|      0|                assert(dictEnd != NULL);
  ------------------
  |  Branch (2411:17): [True: 0, False: 0]
  |  Branch (2411:17): [True: 0, False: 0]
  ------------------
 2412|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2413|      0|                    if (partialDecoding) length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1887|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1887:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2413:25): [True: 0, False: 0]
  ------------------
 2414|      0|                    else goto _output_error;   /* doesn't respect parsing restriction */
 2415|      0|                }
 2416|       |
 2417|      0|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2417:21): [True: 0, False: 0]
  ------------------
 2418|       |                    /* match fits entirely within external dictionary : just copy */
 2419|      0|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  358|      0|#    define LZ4_memmove __builtin_memmove
  ------------------
 2420|      0|                    op += length;
 2421|      0|                } else {
 2422|       |                    /* match stretches into both external dictionary and current block */
 2423|      0|                    size_t const copySize = (size_t)(lowPrefix - match);
 2424|      0|                    size_t const restSize = length - copySize;
 2425|      0|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2426|      0|                    op += copySize;
 2427|      0|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2427:25): [True: 0, False: 0]
  ------------------
 2428|      0|                        BYTE* const endOfMatch = op + restSize;
 2429|      0|                        const BYTE* copyFrom = lowPrefix;
 2430|      0|                        while (op < endOfMatch) *op++ = *copyFrom++;
  ------------------
  |  Branch (2430:32): [True: 0, False: 0]
  ------------------
 2431|      0|                    } else {
 2432|      0|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2433|      0|                        op += restSize;
 2434|      0|                }   }
 2435|      0|                continue;
 2436|      0|            }
 2437|  5.39k|            assert(match >= lowPrefix);
  ------------------
  |  Branch (2437:13): [True: 0, False: 5.39k]
  |  Branch (2437:13): [True: 5.39k, False: 0]
  ------------------
 2438|       |
 2439|       |            /* copy match within block */
 2440|  5.39k|            cpy = op + length;
 2441|       |
 2442|       |            /* partialDecoding : may end anywhere within the block */
 2443|  5.39k|            assert(op<=oend);
  ------------------
  |  Branch (2443:13): [True: 0, False: 5.39k]
  |  Branch (2443:13): [True: 5.39k, False: 0]
  ------------------
 2444|  5.39k|            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 (2444:17): [True: 0, False: 5.39k]
  |  Branch (2444:36): [True: 0, False: 0]
  ------------------
 2445|      0|                size_t const mlen = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1887|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1887:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2446|      0|                const BYTE* const matchEnd = match + mlen;
 2447|      0|                BYTE* const copyEnd = op + mlen;
 2448|      0|                if (matchEnd > op) {   /* overlap copy */
  ------------------
  |  Branch (2448:21): [True: 0, False: 0]
  ------------------
 2449|      0|                    while (op < copyEnd) { *op++ = *match++; }
  ------------------
  |  Branch (2449:28): [True: 0, False: 0]
  ------------------
 2450|      0|                } else {
 2451|      0|                    LZ4_memcpy(op, match, mlen);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2452|      0|                }
 2453|      0|                op = copyEnd;
 2454|      0|                if (op == oend) { break; }
  ------------------
  |  Branch (2454:21): [True: 0, False: 0]
  ------------------
 2455|      0|                continue;
 2456|      0|            }
 2457|       |
 2458|  5.39k|            if (unlikely(offset<8)) {
  ------------------
  |  |  181|  5.39k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  5.39k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 3.33k, False: 2.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2459|  3.33k|                LZ4_write32(op, 0);   /* silence msan warning when offset==0 */
 2460|  3.33k|                op[0] = match[0];
 2461|  3.33k|                op[1] = match[1];
 2462|  3.33k|                op[2] = match[2];
 2463|  3.33k|                op[3] = match[3];
 2464|  3.33k|                match += inc32table[offset];
 2465|  3.33k|                LZ4_memcpy(op+4, match, 4);
  ------------------
  |  |  350|  3.33k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2466|  3.33k|                match -= dec64table[offset];
 2467|  3.33k|            } else {
 2468|  2.06k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  2.06k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2469|  2.06k|                match += 8;
 2470|  2.06k|            }
 2471|  5.39k|            op += 8;
 2472|       |
 2473|  5.39k|            if (unlikely(cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  181|  5.39k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  5.39k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.77k, False: 3.62k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2474|  1.77k|                BYTE* const oCopyLimit = oend - (WILDCOPYLENGTH-1);
  ------------------
  |  |  245|  1.77k|#define WILDCOPYLENGTH 8
  ------------------
 2475|  1.77k|                if (cpy > oend-LASTLITERALS) { goto _output_error; } /* Error : last LASTLITERALS bytes must be literals (uncompressed) */
  ------------------
  |  |  246|  1.77k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2475:21): [True: 0, False: 1.77k]
  ------------------
 2476|  1.77k|                if (op < oCopyLimit) {
  ------------------
  |  Branch (2476:21): [True: 951, False: 821]
  ------------------
 2477|    951|                    LZ4_wildCopy8(op, match, oCopyLimit);
 2478|    951|                    match += oCopyLimit - op;
 2479|    951|                    op = oCopyLimit;
 2480|    951|                }
 2481|  2.75k|                while (op < cpy) { *op++ = *match++; }
  ------------------
  |  Branch (2481:24): [True: 979, False: 1.77k]
  ------------------
 2482|  3.62k|            } else {
 2483|  3.62k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  3.62k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2484|  3.62k|                if (length > 16) { LZ4_wildCopy8(op+8, match+8, cpy); }
  ------------------
  |  Branch (2484:21): [True: 803, False: 2.82k]
  ------------------
 2485|  3.62k|            }
 2486|  5.39k|            op = cpy;   /* wildcopy correction */
 2487|  5.39k|        }
 2488|       |
 2489|       |        /* end of decoding */
 2490|  3.23k|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  290|  3.23k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2491|  3.23k|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2492|       |
 2493|       |        /* Overflow error detected */
 2494|      0|    _output_error:
 2495|      0|        return (int) (-(((const char*)ip)-src))-1;
 2496|  1.53k|    }
 2497|  1.53k|}
lz4.c:read_variable_length:
 2020|   457k|{
 2021|   457k|    Rvl_t s, length = 0;
 2022|   457k|    assert(ipPtr != NULL);
  ------------------
  |  Branch (2022:5): [True: 0, False: 457k]
  |  Branch (2022:5): [True: 457k, False: 0]
  ------------------
 2023|   457k|    assert(*ipPtr !=  NULL);
  ------------------
  |  Branch (2023:5): [True: 0, False: 457k]
  |  Branch (2023:5): [True: 457k, False: 0]
  ------------------
 2024|   457k|    assert(ilimit != NULL);
  ------------------
  |  Branch (2024:5): [True: 0, False: 457k]
  |  Branch (2024:5): [True: 457k, False: 0]
  ------------------
 2025|   457k|    if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|   457k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   457k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 457k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2026|      0|        return rvl_error;
 2027|      0|    }
 2028|   457k|    s = **ipPtr;
 2029|   457k|    (*ipPtr)++;
 2030|   457k|    length += s;
 2031|   457k|    if (likely(s != 255)) return length;
  ------------------
  |  |  178|   457k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|   457k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 443k, False: 14.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2032|   248k|    do {
 2033|   248k|        if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|   248k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   248k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 248k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2034|      0|            return rvl_error;
 2035|      0|        }
 2036|   248k|        s = **ipPtr;
 2037|   248k|        (*ipPtr)++;
 2038|   248k|        length += s;
 2039|       |        /* accumulator overflow detection (32-bit mode only) */
 2040|   248k|        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 (2040:13): [Folded, False: 248k]
  ------------------
 2041|      0|            return rvl_error;
 2042|      0|        }
 2043|   248k|    } while (s == 255);
  ------------------
  |  Branch (2043:14): [True: 233k, False: 14.6k]
  ------------------
 2044|       |
 2045|  14.6k|    return length;
 2046|  14.6k|}
lz4.c:LZ4_wildCopy32:
  532|   443k|{
  533|   443k|    BYTE* d = (BYTE*)dstPtr;
  534|   443k|    const BYTE* s = (const BYTE*)srcPtr;
  535|   443k|    BYTE* const e = (BYTE*)dstEnd;
  536|       |
  537|  1.75M|    do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  350|  1.75M|#    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|  1.75M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (537:79): [True: 1.31M, False: 443k]
  ------------------
  538|   443k|}
lz4.c:LZ4_readLE16:
  432|   499k|{
  433|   499k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (433:9): [True: 499k, False: 0]
  ------------------
  434|   499k|        return LZ4_read16(memPtr);
  435|   499k|    } else {
  436|      0|        const BYTE* p = (const BYTE*)memPtr;
  437|      0|        return (U16)((U16)p[0] | (p[1]<<8));
  438|      0|    }
  439|   499k|}
lz4.c:LZ4_memcpy_using_offset:
  545|  19.1k|{
  546|  19.1k|    BYTE v[8];
  547|       |
  548|  19.1k|    assert(dstEnd >= dstPtr + MINMATCH);
  ------------------
  |  Branch (548:5): [True: 0, False: 19.1k]
  |  Branch (548:5): [True: 19.1k, False: 0]
  ------------------
  549|       |
  550|  19.1k|    switch(offset) {
  551|  3.27k|    case 1:
  ------------------
  |  Branch (551:5): [True: 3.27k, False: 15.9k]
  ------------------
  552|  3.27k|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  237|  3.27k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  235|  3.27k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  553|  3.27k|        break;
  554|  12.5k|    case 2:
  ------------------
  |  Branch (554:5): [True: 12.5k, False: 6.59k]
  ------------------
  555|  12.5k|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  350|  12.5k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  556|  12.5k|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  350|  12.5k|#    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|  12.5k|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  350|  12.5k|#    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|  12.5k|        break;
  566|    609|    case 4:
  ------------------
  |  Branch (566:5): [True: 609, False: 18.5k]
  ------------------
  567|    609|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  350|    609|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  568|    609|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  350|    609|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  569|    609|        break;
  570|  2.70k|    default:
  ------------------
  |  Branch (570:5): [True: 2.70k, False: 16.4k]
  ------------------
  571|  2.70k|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  572|  2.70k|        return;
  573|  19.1k|    }
  574|       |
  575|  16.4k|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  350|  16.4k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  576|  16.4k|    dstPtr += 8;
  577|  2.79M|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (577:12): [True: 2.77M, False: 16.4k]
  ------------------
  578|  2.77M|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  350|  2.77M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  579|  2.77M|        dstPtr += 8;
  580|  2.77M|    }
  581|  16.4k|}
lz4.c:LZ4_memcpy_using_offset_base:
  493|  2.70k|{
  494|  2.70k|    assert(srcPtr + offset == dstPtr);
  ------------------
  |  Branch (494:5): [True: 0, False: 2.70k]
  |  Branch (494:5): [True: 2.70k, False: 0]
  ------------------
  495|  2.70k|    if (offset < 8) {
  ------------------
  |  Branch (495:9): [True: 2.47k, False: 238]
  ------------------
  496|  2.47k|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  497|  2.47k|        assert(offset != 1);   /* offset==0 happens on testing */
  ------------------
  |  Branch (497:9): [True: 0, False: 2.47k]
  |  Branch (497:9): [True: 2.47k, False: 0]
  ------------------
  498|  2.47k|        LZ4_memcpy(dstPtr, srcPtr, 2);
  ------------------
  |  |  350|  2.47k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  499|  2.47k|        LZ4_memcpy(dstPtr + 2, srcPtr + 2, 2);
  ------------------
  |  |  350|  2.47k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  500|  2.47k|        srcPtr += inc32table[offset];
  501|  2.47k|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  350|  2.47k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  502|  2.47k|        srcPtr -= dec64table[offset];
  503|  2.47k|        dstPtr += 8;
  504|  2.47k|    } else {
  505|    238|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  350|    238|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  506|    238|        dstPtr += 8;
  507|    238|        srcPtr += 8;
  508|    238|    }
  509|       |
  510|  2.70k|    LZ4_wildCopy8(dstPtr, srcPtr, dstEnd);
  511|  2.70k|}

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

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

