LZ4_compressBound:
  760|  6.90k|int LZ4_compressBound(int isize)  { return LZ4_COMPRESSBOUND(isize); }
  ------------------
  |  |  215|  6.90k|#define LZ4_COMPRESSBOUND(isize)  ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
  |  |  ------------------
  |  |  |  |  214|  6.90k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  |  |  ------------------
  |  |  |  Branch (215:36): [True: 0, False: 6.90k]
  |  |  ------------------
  ------------------
LZ4_compress_fast_extState:
 1392|  2.70k|{
 1393|  2.70k|    LZ4_stream_t_internal* const ctx = & LZ4_initStream(state, sizeof(LZ4_stream_t)) -> internal_donotuse;
 1394|  2.70k|    assert(ctx != NULL);
  ------------------
  |  Branch (1394:5): [True: 0, False: 2.70k]
  |  Branch (1394:5): [True: 2.70k, False: 0]
  ------------------
 1395|  2.70k|    if (acceleration < 1) acceleration = LZ4_ACCELERATION_DEFAULT;
  ------------------
  |  |   52|      0|#define LZ4_ACCELERATION_DEFAULT 1
  ------------------
  |  Branch (1395:9): [True: 0, False: 2.70k]
  ------------------
 1396|  2.70k|    if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX;
  ------------------
  |  |   58|  2.70k|#define LZ4_ACCELERATION_MAX 65537
  ------------------
                  if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX;
  ------------------
  |  |   58|      0|#define LZ4_ACCELERATION_MAX 65537
  ------------------
  |  Branch (1396:9): [True: 0, False: 2.70k]
  ------------------
 1397|  2.70k|    if (maxOutputSize >= LZ4_compressBound(inputSize)) {
  ------------------
  |  Branch (1397:9): [True: 1.19k, False: 1.51k]
  ------------------
 1398|  1.19k|        if (inputSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1398:13): [True: 1.19k, False: 0]
  ------------------
 1399|  1.19k|            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, 0, notLimited, byU16, noDict, noDictIssue, acceleration);
 1400|  1.19k|        } else {
 1401|      0|            const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)source > LZ4_DISTANCE_MAX)) ? byPtr : byU32;
  ------------------
  |  |  676|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1401:44): [Folded, False: 0]
  |  Branch (1401:66): [True: 0, False: 0]
  ------------------
 1402|      0|            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, 0, notLimited, tableType, noDict, noDictIssue, acceleration);
 1403|      0|        }
 1404|  1.51k|    } else {
 1405|  1.51k|        if (inputSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1405:13): [True: 1.25k, False: 264]
  ------------------
 1406|  1.25k|            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, byU16, noDict, noDictIssue, acceleration);
 1407|  1.25k|        } else {
 1408|    264|            const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)source > LZ4_DISTANCE_MAX)) ? byPtr : byU32;
  ------------------
  |  |  676|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1408:44): [Folded, False: 264]
  |  Branch (1408:66): [True: 0, False: 0]
  ------------------
 1409|       |            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, noDict, noDictIssue, acceleration);
 1410|    264|        }
 1411|  1.51k|    }
 1412|  2.70k|}
LZ4_compress_fast:
 1463|  2.11k|{
 1464|  2.11k|    int result;
 1465|       |#if (LZ4_HEAPMODE)
 1466|       |    LZ4_stream_t* const ctxPtr = (LZ4_stream_t*)ALLOC(sizeof(LZ4_stream_t));   /* malloc-calloc always properly aligned */
 1467|       |    if (ctxPtr == NULL) return 0;
 1468|       |#else
 1469|  2.11k|    LZ4_stream_t ctx;
 1470|  2.11k|    LZ4_stream_t* const ctxPtr = &ctx;
 1471|  2.11k|#endif
 1472|  2.11k|    result = LZ4_compress_fast_extState(ctxPtr, src, dest, srcSize, dstCapacity, acceleration);
 1473|       |
 1474|       |#if (LZ4_HEAPMODE)
 1475|       |    FREEMEM(ctxPtr);
 1476|       |#endif
 1477|  2.11k|    return result;
 1478|  2.11k|}
LZ4_compress_default:
 1482|  2.11k|{
 1483|  2.11k|    return LZ4_compress_fast(src, dst, srcSize, dstCapacity, 1);
 1484|  2.11k|}
LZ4_compress_destSize:
 1516|  2.08k|{
 1517|       |#if (LZ4_HEAPMODE)
 1518|       |    LZ4_stream_t* const ctx = (LZ4_stream_t*)ALLOC(sizeof(LZ4_stream_t));   /* malloc-calloc always properly aligned */
 1519|       |    if (ctx == NULL) return 0;
 1520|       |#else
 1521|  2.08k|    LZ4_stream_t ctxBody;
 1522|  2.08k|    LZ4_stream_t* const ctx = &ctxBody;
 1523|  2.08k|#endif
 1524|       |
 1525|  2.08k|    int result = LZ4_compress_destSize_extState_internal(ctx, src, dst, srcSizePtr, targetDstSize, 1);
 1526|       |
 1527|       |#if (LZ4_HEAPMODE)
 1528|       |    FREEMEM(ctx);
 1529|       |#endif
 1530|  2.08k|    return result;
 1531|  2.08k|}
LZ4_initStream:
 1562|  4.79k|{
 1563|  4.79k|    DEBUGLOG(5, "LZ4_initStream");
  ------------------
  |  |  290|  4.79k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1564|  4.79k|    if (buffer == NULL) { return NULL; }
  ------------------
  |  Branch (1564:9): [True: 0, False: 4.79k]
  ------------------
 1565|  4.79k|    if (size < sizeof(LZ4_stream_t)) { return NULL; }
  ------------------
  |  Branch (1565:9): [True: 0, False: 4.79k]
  ------------------
 1566|  4.79k|    if (!LZ4_isAligned(buffer, LZ4_stream_t_alignment())) return NULL;
  ------------------
  |  Branch (1566:9): [True: 0, False: 4.79k]
  ------------------
 1567|  4.79k|    MEM_INIT(buffer, 0, sizeof(LZ4_stream_t_internal));
  ------------------
  |  |  237|  4.79k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  235|  4.79k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 1568|  4.79k|    return (LZ4_stream_t*)buffer;
 1569|  4.79k|}
LZ4_decompress_safe:
 2475|  3.66k|{
 2476|  3.66k|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2477|  3.66k|                                  decode_full_block, noDict,
 2478|       |                                  (BYTE*)dest, NULL, 0);
 2479|  3.66k|}
lz4.c:LZ4_compress_generic:
 1365|  4.19k|{
 1366|  4.19k|    DEBUGLOG(5, "LZ4_compress_generic: srcSize=%i, dstCapacity=%i",
  ------------------
  |  |  290|  4.19k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1367|  4.19k|                srcSize, dstCapacity);
 1368|       |
 1369|  4.19k|    if ((U32)srcSize > (U32)LZ4_MAX_INPUT_SIZE) { return 0; }  /* Unsupported srcSize, too large (or negative) */
  ------------------
  |  |  214|  4.19k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  ------------------
  |  Branch (1369:9): [True: 0, False: 4.19k]
  ------------------
 1370|  4.19k|    if (srcSize == 0) {   /* src == NULL supported if srcSize == 0 */
  ------------------
  |  Branch (1370:9): [True: 17, False: 4.18k]
  ------------------
 1371|     17|        if (outputDirective != notLimited && dstCapacity <= 0) return 0;  /* no output, can't write anything */
  ------------------
  |  Branch (1371:13): [True: 15, False: 2]
  |  Branch (1371:46): [True: 1, False: 14]
  ------------------
 1372|     16|        DEBUGLOG(5, "Generating an empty block");
  ------------------
  |  |  290|     16|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1373|     16|        assert(outputDirective == notLimited || dstCapacity >= 1);
  ------------------
  |  Branch (1373:9): [True: 16, False: 0]
  |  Branch (1373:9): [True: 0, False: 0]
  |  Branch (1373:9): [True: 2, False: 14]
  |  Branch (1373:9): [True: 14, False: 0]
  ------------------
 1374|     16|        assert(dst != NULL);
  ------------------
  |  Branch (1374:9): [True: 0, False: 16]
  |  Branch (1374:9): [True: 16, False: 0]
  ------------------
 1375|     16|        dst[0] = 0;
 1376|     16|        if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1376:13): [True: 7, False: 9]
  ------------------
 1377|      7|            assert (inputConsumed != NULL);
  ------------------
  |  Branch (1377:13): [True: 0, False: 7]
  |  Branch (1377:13): [True: 7, False: 0]
  ------------------
 1378|      7|            *inputConsumed = 0;
 1379|      7|        }
 1380|     16|        return 1;
 1381|     16|    }
 1382|  4.19k|    assert(src != NULL);
  ------------------
  |  Branch (1382:5): [True: 0, False: 4.18k]
  |  Branch (1382:5): [True: 4.18k, False: 0]
  ------------------
 1383|       |
 1384|  4.18k|    return LZ4_compress_generic_validated(cctx, src, dst, srcSize,
 1385|  4.18k|                inputConsumed, /* only written into if outputDirective == fillOutput */
 1386|  4.18k|                dstCapacity, outputDirective,
 1387|  4.18k|                tableType, dictDirective, dictIssue, acceleration);
 1388|  4.18k|}
lz4.c:LZ4_compress_generic_validated:
  951|  4.18k|{
  952|  4.18k|    int result;
  953|  4.18k|    const BYTE* ip = (const BYTE*)source;
  954|       |
  955|  4.18k|    U32 const startIndex = cctx->currentOffset;
  956|  4.18k|    const BYTE* base = (const BYTE*)source - startIndex;
  957|  4.18k|    const BYTE* lowLimit;
  958|       |
  959|  4.18k|    const LZ4_stream_t_internal* dictCtx = (const LZ4_stream_t_internal*) cctx->dictCtx;
  960|  4.18k|    const BYTE* const dictionary =
  961|  4.18k|        dictDirective == usingDictCtx ? dictCtx->dictionary : cctx->dictionary;
  ------------------
  |  Branch (961:9): [True: 0, False: 4.18k]
  ------------------
  962|  4.18k|    const U32 dictSize =
  963|  4.18k|        dictDirective == usingDictCtx ? dictCtx->dictSize : cctx->dictSize;
  ------------------
  |  Branch (963:9): [True: 0, False: 4.18k]
  ------------------
  964|  4.18k|    const U32 dictDelta =
  965|  4.18k|        (dictDirective == usingDictCtx) ? startIndex - dictCtx->currentOffset : 0;   /* make indexes in dictCtx comparable with indexes in current context */
  ------------------
  |  Branch (965:9): [True: 0, False: 4.18k]
  ------------------
  966|       |
  967|  4.18k|    int const maybe_extMem = (dictDirective == usingExtDict) || (dictDirective == usingDictCtx);
  ------------------
  |  Branch (967:30): [True: 0, False: 4.18k]
  |  Branch (967:65): [True: 0, False: 4.18k]
  ------------------
  968|  4.18k|    U32 const prefixIdxLimit = startIndex - dictSize;   /* used when dictDirective == dictSmall */
  969|  4.18k|    const BYTE* const dictEnd = dictionary ? dictionary + dictSize : dictionary;
  ------------------
  |  Branch (969:33): [True: 0, False: 4.18k]
  ------------------
  970|  4.18k|    const BYTE* anchor = (const BYTE*) source;
  971|  4.18k|    const BYTE* const iend = ip + inputSize;
  972|  4.18k|    const BYTE* const mflimitPlusOne = iend - MFLIMIT + 1;
  ------------------
  |  |  247|  4.18k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  973|  4.18k|    const BYTE* const matchlimit = iend - LASTLITERALS;
  ------------------
  |  |  246|  4.18k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  974|       |
  975|       |    /* the dictCtx currentOffset is indexed on the start of the dictionary,
  976|       |     * while a dictionary in the current context precedes the currentOffset */
  977|  4.18k|    const BYTE* dictBase = (dictionary == NULL) ? NULL :
  ------------------
  |  Branch (977:28): [True: 4.18k, False: 0]
  ------------------
  978|  4.18k|                           (dictDirective == usingDictCtx) ?
  ------------------
  |  Branch (978:28): [True: 0, False: 0]
  ------------------
  979|      0|                            dictionary + dictSize - dictCtx->currentOffset :
  980|      0|                            dictionary + dictSize - startIndex;
  981|       |
  982|  4.18k|    BYTE* op = (BYTE*) dest;
  983|  4.18k|    BYTE* const olimit = op + maxOutputSize;
  984|       |
  985|  4.18k|    U32 offset = 0;
  986|  4.18k|    U32 forwardH;
  987|       |
  988|  4.18k|    DEBUGLOG(5, "LZ4_compress_generic_validated: srcSize=%i, tableType=%u", inputSize, tableType);
  ------------------
  |  |  290|  4.18k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  989|  4.18k|    assert(ip != NULL);
  ------------------
  |  Branch (989:5): [True: 0, False: 4.18k]
  |  Branch (989:5): [True: 4.18k, False: 0]
  ------------------
  990|  4.18k|    if (tableType == byU16) assert(inputSize<LZ4_64Klimit);  /* Size too large (not within 64K limit) */
  ------------------
  |  Branch (990:9): [True: 3.66k, False: 518]
  |  Branch (990:29): [True: 0, False: 3.66k]
  |  Branch (990:29): [True: 3.66k, False: 0]
  ------------------
  991|  4.18k|    if (tableType == byPtr) assert(dictDirective==noDict);   /* only supported use case with byPtr */
  ------------------
  |  Branch (991:9): [True: 0, False: 4.18k]
  |  Branch (991:29): [True: 0, False: 0]
  |  Branch (991:29): [True: 0, False: 0]
  ------------------
  992|       |    /* If init conditions are not met, we don't have to mark stream
  993|       |     * as having dirty context, since no action was taken yet */
  994|  4.18k|    if (outputDirective == fillOutput && maxOutputSize < 1) { return 0; } /* Impossible to store anything */
  ------------------
  |  Branch (994:9): [True: 1.48k, False: 2.69k]
  |  Branch (994:42): [True: 0, False: 1.48k]
  ------------------
  995|  4.18k|    assert(acceleration >= 1);
  ------------------
  |  Branch (995:5): [True: 0, False: 4.18k]
  |  Branch (995:5): [True: 4.18k, False: 0]
  ------------------
  996|       |
  997|  4.18k|    lowLimit = (const BYTE*)source - (dictDirective == withPrefix64k ? dictSize : 0);
  ------------------
  |  Branch (997:39): [True: 0, False: 4.18k]
  ------------------
  998|       |
  999|       |    /* Update context state */
 1000|  4.18k|    if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1000:9): [True: 0, False: 4.18k]
  ------------------
 1001|       |        /* Subsequent linked blocks can't use the dictionary. */
 1002|       |        /* Instead, they use the block we just compressed. */
 1003|      0|        cctx->dictCtx = NULL;
 1004|      0|        cctx->dictSize = (U32)inputSize;
 1005|  4.18k|    } else {
 1006|  4.18k|        cctx->dictSize += (U32)inputSize;
 1007|  4.18k|    }
 1008|  4.18k|    cctx->currentOffset += (U32)inputSize;
 1009|  4.18k|    cctx->tableType = (U32)tableType;
 1010|       |
 1011|  4.18k|    if (inputSize<LZ4_minLength) goto _last_literals;        /* Input too small, no compression (all literals) */
  ------------------
  |  Branch (1011:9): [True: 54, False: 4.12k]
  ------------------
 1012|       |
 1013|       |    /* First Byte */
 1014|  4.12k|    {   U32 const h = LZ4_hashPosition(ip, tableType);
 1015|  4.12k|        if (tableType == byPtr) {
  ------------------
  |  Branch (1015:13): [True: 0, False: 4.12k]
  ------------------
 1016|      0|            LZ4_putPositionOnHash(ip, h, cctx->hashTable, byPtr);
 1017|  4.12k|        } else {
 1018|  4.12k|            LZ4_putIndexOnHash(startIndex, h, cctx->hashTable, tableType);
 1019|  4.12k|    }   }
 1020|  4.12k|    ip++; forwardH = LZ4_hashPosition(ip, tableType);
 1021|       |
 1022|       |    /* Main Loop */
 1023|  17.0k|    for ( ; ; ) {
 1024|  17.0k|        const BYTE* match;
 1025|  17.0k|        BYTE* token;
 1026|  17.0k|        const BYTE* filledIp;
 1027|       |
 1028|       |        /* Find a match */
 1029|  17.0k|        if (tableType == byPtr) {
  ------------------
  |  Branch (1029:13): [True: 0, False: 17.0k]
  ------------------
 1030|      0|            const BYTE* forwardIp = ip;
 1031|      0|            int step = 1;
 1032|      0|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1033|      0|            do {
 1034|      0|                U32 const h = forwardH;
 1035|      0|                ip = forwardIp;
 1036|      0|                forwardIp += step;
 1037|      0|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1038|       |
 1039|      0|                if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
  ------------------
  |  |  181|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1040|      0|                assert(ip < mflimitPlusOne);
  ------------------
  |  Branch (1040:17): [True: 0, False: 0]
  |  Branch (1040:17): [True: 0, False: 0]
  ------------------
 1041|       |
 1042|      0|                match = LZ4_getPositionOnHash(h, cctx->hashTable, tableType);
 1043|      0|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1044|      0|                LZ4_putPositionOnHash(ip, h, cctx->hashTable, tableType);
 1045|       |
 1046|      0|            } while ( (match+LZ4_DISTANCE_MAX < ip)
  ------------------
  |  |  676|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1046:23): [True: 0, False: 0]
  ------------------
 1047|      0|                   || (LZ4_read32(match) != LZ4_read32(ip)) );
  ------------------
  |  Branch (1047:23): [True: 0, False: 0]
  ------------------
 1048|       |
 1049|  17.0k|        } else {   /* byU32, byU16 */
 1050|       |
 1051|  17.0k|            const BYTE* forwardIp = ip;
 1052|  17.0k|            int step = 1;
 1053|  17.0k|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1054|   538k|            do {
 1055|   538k|                U32 const h = forwardH;
 1056|   538k|                U32 const current = (U32)(forwardIp - base);
 1057|   538k|                U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1058|   538k|                assert(matchIndex <= current);
  ------------------
  |  Branch (1058:17): [True: 0, False: 538k]
  |  Branch (1058:17): [True: 538k, False: 0]
  ------------------
 1059|   538k|                assert(forwardIp - base < (ptrdiff_t)(2 GB - 1));
  ------------------
  |  Branch (1059:17): [True: 0, False: 538k]
  |  Branch (1059:17): [True: 538k, False: 0]
  ------------------
 1060|   538k|                ip = forwardIp;
 1061|   538k|                forwardIp += step;
 1062|   538k|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1063|       |
 1064|   538k|                if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
  ------------------
  |  |  181|   538k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|   538k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.65k, False: 537k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1065|   538k|                assert(ip < mflimitPlusOne);
  ------------------
  |  Branch (1065:17): [True: 0, False: 537k]
  |  Branch (1065:17): [True: 537k, False: 0]
  ------------------
 1066|       |
 1067|   537k|                if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1067:21): [True: 0, False: 537k]
  ------------------
 1068|      0|                    if (matchIndex < startIndex) {
  ------------------
  |  Branch (1068:25): [True: 0, False: 0]
  ------------------
 1069|       |                        /* there was no match, try the dictionary */
 1070|      0|                        assert(tableType == byU32);
  ------------------
  |  Branch (1070:25): [True: 0, False: 0]
  |  Branch (1070:25): [True: 0, False: 0]
  ------------------
 1071|      0|                        matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32);
 1072|      0|                        match = dictBase + matchIndex;
 1073|      0|                        matchIndex += dictDelta;   /* make dictCtx index comparable with current context */
 1074|      0|                        lowLimit = dictionary;
 1075|      0|                    } else {
 1076|      0|                        match = base + matchIndex;
 1077|      0|                        lowLimit = (const BYTE*)source;
 1078|      0|                    }
 1079|   537k|                } else if (dictDirective == usingExtDict) {
  ------------------
  |  Branch (1079:28): [True: 0, False: 537k]
  ------------------
 1080|      0|                    if (matchIndex < startIndex) {
  ------------------
  |  Branch (1080:25): [True: 0, False: 0]
  ------------------
 1081|      0|                        DEBUGLOG(7, "extDict candidate: matchIndex=%5u  <  startIndex=%5u", matchIndex, startIndex);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1082|      0|                        assert(startIndex - matchIndex >= MINMATCH);
  ------------------
  |  Branch (1082:25): [True: 0, False: 0]
  |  Branch (1082:25): [True: 0, False: 0]
  ------------------
 1083|      0|                        assert(dictBase);
  ------------------
  |  Branch (1083:25): [True: 0, False: 0]
  |  Branch (1083:25): [True: 0, False: 0]
  ------------------
 1084|      0|                        match = dictBase + matchIndex;
 1085|      0|                        lowLimit = dictionary;
 1086|      0|                    } else {
 1087|      0|                        match = base + matchIndex;
 1088|      0|                        lowLimit = (const BYTE*)source;
 1089|      0|                    }
 1090|   537k|                } else {   /* single continuous memory segment */
 1091|   537k|                    match = base + matchIndex;
 1092|   537k|                }
 1093|   537k|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1094|   537k|                LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1095|       |
 1096|   537k|                DEBUGLOG(7, "candidate at pos=%u  (offset=%u \n", matchIndex, current - matchIndex);
  ------------------
  |  |  290|   537k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1097|   537k|                if ((dictIssue == dictSmall) && (matchIndex < prefixIdxLimit)) { continue; }    /* match outside of valid area */
  ------------------
  |  Branch (1097:21): [True: 0, False: 537k]
  |  Branch (1097:49): [True: 0, False: 0]
  ------------------
 1098|   537k|                assert(matchIndex < current);
  ------------------
  |  Branch (1098:17): [True: 0, False: 537k]
  |  Branch (1098:17): [True: 537k, False: 0]
  ------------------
 1099|   537k|                if ( ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  676|  74.1k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                              if ( ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  256|  74.1k|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
  |  Branch (1099:23): [True: 462k, False: 74.1k]
  |  Branch (1099:47): [Folded, False: 0]
  ------------------
 1100|   462k|                  && (matchIndex+LZ4_DISTANCE_MAX < current)) {
  ------------------
  |  |  676|   462k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1100:22): [True: 193k, False: 269k]
  ------------------
 1101|   193k|                    continue;
 1102|   193k|                } /* too far */
 1103|   537k|                assert((current - matchIndex) <= LZ4_DISTANCE_MAX);  /* match now expected within distance */
  ------------------
  |  Branch (1103:17): [True: 0, False: 343k]
  |  Branch (1103:17): [True: 343k, False: 0]
  ------------------
 1104|       |
 1105|   343k|                if (LZ4_read32(match) == LZ4_read32(ip)) {
  ------------------
  |  Branch (1105:21): [True: 15.3k, False: 328k]
  ------------------
 1106|  15.3k|                    if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1106:25): [True: 0, False: 15.3k]
  ------------------
 1107|  15.3k|                    break;   /* match found */
 1108|  15.3k|                }
 1109|       |
 1110|   521k|            } while(1);
  ------------------
  |  Branch (1110:21): [True: 521k, Folded]
  ------------------
 1111|  17.0k|        }
 1112|       |
 1113|       |        /* Catch up */
 1114|  15.3k|        filledIp = ip;
 1115|  15.3k|        assert(ip > anchor); /* this is always true as ip has been advanced before entering the main loop */
  ------------------
  |  Branch (1115:9): [True: 0, False: 15.3k]
  |  Branch (1115:9): [True: 15.3k, False: 0]
  ------------------
 1116|  15.3k|        if ((match > lowLimit) && unlikely(ip[-1] == match[-1])) {
  ------------------
  |  |  181|  12.6k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  12.6k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.20k, False: 11.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1116:13): [True: 12.6k, False: 2.74k]
  ------------------
 1117|  11.7k|            do { ip--; match--; } while (((ip > anchor) & (match > lowLimit)) && (unlikely(ip[-1] == match[-1])));
  ------------------
  |  |  181|  11.0k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  11.0k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1117:42): [True: 11.0k, False: 670]
  |  Branch (1117:82): [True: 10.5k, False: 533]
  ------------------
 1118|  1.20k|        }
 1119|       |
 1120|       |        /* Encode Literals */
 1121|  15.3k|        {   unsigned const litLength = (unsigned)(ip - anchor);
 1122|  15.3k|            token = op++;
 1123|  15.3k|            if ((outputDirective == limitedOutput) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1123:17): [True: 6.89k, False: 8.48k]
  ------------------
 1124|  6.89k|                (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength/255) > olimit)) ) {
  ------------------
  |  |  181|  6.89k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  6.89k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1124:17): [True: 167, False: 6.72k]
  ------------------
 1125|    167|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1126|    167|            }
 1127|  15.2k|            if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1127:17): [True: 6.85k, False: 8.35k]
  ------------------
 1128|  6.85k|                (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|  6.85k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  6.85k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1128:17): [True: 224, False: 6.63k]
  ------------------
 1129|    224|                op--;
 1130|    224|                goto _last_literals;
 1131|    224|            }
 1132|  14.9k|            if (litLength >= RUN_MASK) {
  ------------------
  |  |  264|  14.9k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  14.9k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  14.9k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1132:17): [True: 835, False: 14.1k]
  ------------------
 1133|    835|                unsigned len = litLength - RUN_MASK;
  ------------------
  |  |  264|    835|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    835|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    835|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1134|    835|                *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  264|    835|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    835|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    835|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                              *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  261|    835|#define ML_BITS  4
  ------------------
 1135|    835|                for(; len >= 255 ; len-=255) *op++ = 255;
  ------------------
  |  Branch (1135:23): [True: 0, False: 835]
  ------------------
 1136|    835|                *op++ = (BYTE)len;
 1137|    835|            }
 1138|  14.1k|            else *token = (BYTE)(litLength<<ML_BITS);
  ------------------
  |  |  261|  14.1k|#define ML_BITS  4
  ------------------
 1139|       |
 1140|       |            /* Copy Literals */
 1141|  14.9k|            LZ4_wildCopy8(op, anchor, op+litLength);
 1142|  14.9k|            op+=litLength;
 1143|  14.9k|            DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  290|  14.9k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1144|  14.9k|                        (int)(anchor-(const BYTE*)source), litLength, (int)(ip-(const BYTE*)source));
 1145|  14.9k|        }
 1146|       |
 1147|  24.8k|_next_match:
 1148|       |        /* at this stage, the following variables must be correctly set :
 1149|       |         * - ip : at start of LZ operation
 1150|       |         * - match : at start of previous pattern occurrence; can be within current prefix, or within extDict
 1151|       |         * - offset : if maybe_ext_memSegment==1 (constant)
 1152|       |         * - lowLimit : must be == dictionary to mean "match is within extDict"; must be == source otherwise
 1153|       |         * - token and *token : position to write 4-bits for match length; higher 4-bits for literal length supposed already written
 1154|       |         */
 1155|       |
 1156|  24.8k|        if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1156:13): [True: 11.4k, False: 13.4k]
  ------------------
 1157|  11.4k|            (op + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit)) {
  ------------------
  |  |  247|  11.4k|#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|  11.4k|#define MINMATCH 4
  ------------------
  |  Branch (1157:13): [True: 166, False: 11.2k]
  ------------------
 1158|       |            /* the match was too close to the end, rewind and go to last literals */
 1159|    166|            op = token;
 1160|    166|            goto _last_literals;
 1161|    166|        }
 1162|       |
 1163|       |        /* Encode Offset */
 1164|  24.7k|        if (maybe_extMem) {   /* static test */
  ------------------
  |  Branch (1164:13): [True: 0, False: 24.7k]
  ------------------
 1165|      0|            DEBUGLOG(6, "             with offset=%u  (ext if > %i)", offset, (int)(ip - (const BYTE*)source));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1166|      0|            assert(offset <= LZ4_DISTANCE_MAX && offset > 0);
  ------------------
  |  Branch (1166:13): [True: 0, False: 0]
  |  Branch (1166:13): [True: 0, False: 0]
  |  Branch (1166:13): [True: 0, False: 0]
  |  Branch (1166:13): [True: 0, False: 0]
  ------------------
 1167|      0|            LZ4_writeLE16(op, (U16)offset); op+=2;
 1168|  24.7k|        } else  {
 1169|  24.7k|            DEBUGLOG(6, "             with offset=%u  (same segment)", (U32)(ip - match));
  ------------------
  |  |  290|  24.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1170|  24.7k|            assert(ip-match <= LZ4_DISTANCE_MAX);
  ------------------
  |  Branch (1170:13): [True: 0, False: 24.7k]
  |  Branch (1170:13): [True: 24.7k, False: 0]
  ------------------
 1171|  24.7k|            LZ4_writeLE16(op, (U16)(ip - match)); op+=2;
 1172|  24.7k|        }
 1173|       |
 1174|       |        /* Encode MatchLength */
 1175|  24.7k|        {   unsigned matchCode;
 1176|       |
 1177|  24.7k|            if ( (dictDirective==usingExtDict || dictDirective==usingDictCtx)
  ------------------
  |  Branch (1177:19): [True: 0, False: 24.7k]
  |  Branch (1177:50): [True: 0, False: 24.7k]
  ------------------
 1178|      0|              && (lowLimit==dictionary) /* match within extDict */ ) {
  ------------------
  |  Branch (1178:18): [True: 0, False: 0]
  ------------------
 1179|      0|                const BYTE* limit = ip + (dictEnd-match);
 1180|      0|                assert(dictEnd > match);
  ------------------
  |  Branch (1180:17): [True: 0, False: 0]
  |  Branch (1180:17): [True: 0, False: 0]
  ------------------
 1181|      0|                if (limit > matchlimit) limit = matchlimit;
  ------------------
  |  Branch (1181:21): [True: 0, False: 0]
  ------------------
 1182|      0|                matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, limit);
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
                              matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, limit);
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
 1183|      0|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
 1184|      0|                if (ip==limit) {
  ------------------
  |  Branch (1184:21): [True: 0, False: 0]
  ------------------
 1185|      0|                    unsigned const more = LZ4_count(limit, (const BYTE*)source, matchlimit);
 1186|      0|                    matchCode += more;
 1187|      0|                    ip += more;
 1188|      0|                }
 1189|      0|                DEBUGLOG(6, "             with matchLength=%u starting in extDict", matchCode+MINMATCH);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1190|  24.7k|            } else {
 1191|  24.7k|                matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  243|  24.7k|#define MINMATCH 4
  ------------------
                              matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  243|  24.7k|#define MINMATCH 4
  ------------------
 1192|  24.7k|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  243|  24.7k|#define MINMATCH 4
  ------------------
 1193|  24.7k|                DEBUGLOG(6, "             with matchLength=%u", matchCode+MINMATCH);
  ------------------
  |  |  290|  24.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1194|  24.7k|            }
 1195|       |
 1196|  24.7k|            if ((outputDirective) &&    /* Check output buffer overflow */
  ------------------
  |  Branch (1196:17): [True: 22.6k, False: 2.03k]
  ------------------
 1197|  22.6k|                (unlikely(op + (1 + LASTLITERALS) + (matchCode+240)/255 > olimit)) ) {
  ------------------
  |  |  181|  22.6k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  22.6k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1197:17): [True: 295, False: 22.3k]
  ------------------
 1198|    295|                if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1198:21): [True: 115, False: 180]
  ------------------
 1199|       |                    /* Match description too long : reduce it */
 1200|    115|                    U32 newMatchCode = 15 /* in token */ - 1 /* to avoid needing a zero byte */ + ((U32)(olimit - op) - 1 - LASTLITERALS) * 255;
  ------------------
  |  |  246|    115|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1201|    115|                    ip -= matchCode - newMatchCode;
 1202|    115|                    assert(newMatchCode < matchCode);
  ------------------
  |  Branch (1202:21): [True: 0, False: 115]
  |  Branch (1202:21): [True: 115, False: 0]
  ------------------
 1203|    115|                    matchCode = newMatchCode;
 1204|    115|                    if (unlikely(ip <= filledIp)) {
  ------------------
  |  |  181|    115|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    115|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 115]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1205|       |                        /* We have already filled up to filledIp so if ip ends up less than filledIp
 1206|       |                         * we have positions in the hash table beyond the current position. This is
 1207|       |                         * a problem if we reuse the hash table. So we have to remove these positions
 1208|       |                         * from the hash table.
 1209|       |                         */
 1210|      0|                        const BYTE* ptr;
 1211|      0|                        DEBUGLOG(5, "Clearing %u positions", (U32)(filledIp - ip));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1212|      0|                        for (ptr = ip; ptr <= filledIp; ++ptr) {
  ------------------
  |  Branch (1212:40): [True: 0, False: 0]
  ------------------
 1213|      0|                            U32 const h = LZ4_hashPosition(ptr, tableType);
 1214|      0|                            LZ4_clearHash(h, cctx->hashTable, tableType);
 1215|      0|                        }
 1216|      0|                    }
 1217|    180|                } else {
 1218|    180|                    assert(outputDirective == limitedOutput);
  ------------------
  |  Branch (1218:21): [True: 0, False: 180]
  |  Branch (1218:21): [True: 180, False: 0]
  ------------------
 1219|    180|                    return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1220|    180|                }
 1221|    295|            }
 1222|  24.5k|            if (matchCode >= ML_MASK) {
  ------------------
  |  |  262|  24.5k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  24.5k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (1222:17): [True: 10.4k, False: 14.0k]
  ------------------
 1223|  10.4k|                *token += ML_MASK;
  ------------------
  |  |  262|  10.4k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  10.4k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1224|  10.4k|                matchCode -= ML_MASK;
  ------------------
  |  |  262|  10.4k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  10.4k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1225|  10.4k|                LZ4_write32(op, 0xFFFFFFFF);
 1226|  27.6k|                while (matchCode >= 4*255) {
  ------------------
  |  Branch (1226:24): [True: 17.2k, False: 10.4k]
  ------------------
 1227|  17.2k|                    op+=4;
 1228|  17.2k|                    LZ4_write32(op, 0xFFFFFFFF);
 1229|  17.2k|                    matchCode -= 4*255;
 1230|  17.2k|                }
 1231|  10.4k|                op += matchCode / 255;
 1232|  10.4k|                *op++ = (BYTE)(matchCode % 255);
 1233|  10.4k|            } else
 1234|  14.0k|                *token += (BYTE)(matchCode);
 1235|  24.5k|        }
 1236|       |        /* Ensure we have enough space for the last literals. */
 1237|  24.5k|        assert(!(outputDirective == fillOutput && op + 1 + LASTLITERALS > olimit));
  ------------------
  |  Branch (1237:9): [True: 0, False: 24.5k]
  |  Branch (1237:9): [True: 0, False: 0]
  |  Branch (1237:9): [True: 11.2k, False: 13.2k]
  |  Branch (1237:9): [True: 0, False: 11.2k]
  ------------------
 1238|       |
 1239|  24.5k|        anchor = ip;
 1240|       |
 1241|       |        /* Test end of chunk */
 1242|  24.5k|        if (ip >= mflimitPlusOne) break;
  ------------------
  |  Branch (1242:13): [True: 1.73k, False: 22.7k]
  ------------------
 1243|       |
 1244|       |        /* Fill table */
 1245|  22.7k|        {   U32 const h = LZ4_hashPosition(ip-2, tableType);
 1246|  22.7k|            if (tableType == byPtr) {
  ------------------
  |  Branch (1246:17): [True: 0, False: 22.7k]
  ------------------
 1247|      0|                LZ4_putPositionOnHash(ip-2, h, cctx->hashTable, byPtr);
 1248|  22.7k|            } else {
 1249|  22.7k|                U32 const idx = (U32)((ip-2) - base);
 1250|  22.7k|                LZ4_putIndexOnHash(idx, h, cctx->hashTable, tableType);
 1251|  22.7k|        }   }
 1252|       |
 1253|       |        /* Test next position */
 1254|  22.7k|        if (tableType == byPtr) {
  ------------------
  |  Branch (1254:13): [True: 0, False: 22.7k]
  ------------------
 1255|       |
 1256|      0|            match = LZ4_getPosition(ip, cctx->hashTable, tableType);
 1257|      0|            LZ4_putPosition(ip, cctx->hashTable, tableType);
 1258|      0|            if ( (match+LZ4_DISTANCE_MAX >= ip)
  ------------------
  |  |  676|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1258:18): [True: 0, False: 0]
  ------------------
 1259|      0|              && (LZ4_read32(match) == LZ4_read32(ip)) )
  ------------------
  |  Branch (1259:18): [True: 0, False: 0]
  ------------------
 1260|      0|            { token=op++; *token=0; goto _next_match; }
 1261|       |
 1262|  22.7k|        } else {   /* byU32, byU16 */
 1263|       |
 1264|  22.7k|            U32 const h = LZ4_hashPosition(ip, tableType);
 1265|  22.7k|            U32 const current = (U32)(ip-base);
 1266|  22.7k|            U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1267|  22.7k|            assert(matchIndex < current);
  ------------------
  |  Branch (1267:13): [True: 0, False: 22.7k]
  |  Branch (1267:13): [True: 22.7k, False: 0]
  ------------------
 1268|  22.7k|            if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1268:17): [True: 0, False: 22.7k]
  ------------------
 1269|      0|                if (matchIndex < startIndex) {
  ------------------
  |  Branch (1269:21): [True: 0, False: 0]
  ------------------
 1270|       |                    /* there was no match, try the dictionary */
 1271|      0|                    assert(tableType == byU32);
  ------------------
  |  Branch (1271:21): [True: 0, False: 0]
  |  Branch (1271:21): [True: 0, False: 0]
  ------------------
 1272|      0|                    matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32);
 1273|      0|                    match = dictBase + matchIndex;
 1274|      0|                    lowLimit = dictionary;   /* required for match length counter */
 1275|      0|                    matchIndex += dictDelta;
 1276|      0|                } else {
 1277|      0|                    match = base + matchIndex;
 1278|      0|                    lowLimit = (const BYTE*)source;  /* required for match length counter */
 1279|      0|                }
 1280|  22.7k|            } else if (dictDirective==usingExtDict) {
  ------------------
  |  Branch (1280:24): [True: 0, False: 22.7k]
  ------------------
 1281|      0|                if (matchIndex < startIndex) {
  ------------------
  |  Branch (1281:21): [True: 0, False: 0]
  ------------------
 1282|      0|                    assert(dictBase);
  ------------------
  |  Branch (1282:21): [True: 0, False: 0]
  |  Branch (1282:21): [True: 0, False: 0]
  ------------------
 1283|      0|                    match = dictBase + matchIndex;
 1284|      0|                    lowLimit = dictionary;   /* required for match length counter */
 1285|      0|                } else {
 1286|      0|                    match = base + matchIndex;
 1287|      0|                    lowLimit = (const BYTE*)source;   /* required for match length counter */
 1288|      0|                }
 1289|  22.7k|            } else {   /* single memory segment */
 1290|  22.7k|                match = base + matchIndex;
 1291|  22.7k|            }
 1292|  22.7k|            LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1293|  22.7k|            assert(matchIndex < current);
  ------------------
  |  Branch (1293:13): [True: 0, False: 22.7k]
  |  Branch (1293:13): [True: 22.7k, False: 0]
  ------------------
 1294|  22.7k|            if ( ((dictIssue==dictSmall) ? (matchIndex >= prefixIdxLimit) : 1)
  ------------------
  |  Branch (1294:18): [True: 22.7k, False: 0]
  |  Branch (1294:19): [True: 0, False: 22.7k]
  ------------------
 1295|  22.7k|              && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  676|  14.3k|#  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|  14.3k|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
                            && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  676|  8.42k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1295:18): [True: 22.7k, False: 0]
  |  Branch (1295:20): [True: 14.3k, False: 8.42k]
  |  Branch (1295:42): [True: 0, Folded]
  ------------------
 1296|  22.7k|              && (LZ4_read32(match) == LZ4_read32(ip)) ) {
  ------------------
  |  Branch (1296:18): [True: 9.88k, False: 12.9k]
  ------------------
 1297|  9.88k|                token=op++;
 1298|  9.88k|                *token=0;
 1299|  9.88k|                if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1299:21): [True: 0, False: 9.88k]
  ------------------
 1300|  9.88k|                DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  290|  9.88k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1301|  9.88k|                            (int)(anchor-(const BYTE*)source), 0, (int)(ip-(const BYTE*)source));
 1302|  9.88k|                goto _next_match;
 1303|  9.88k|            }
 1304|  22.7k|        }
 1305|       |
 1306|       |        /* Prepare next loop */
 1307|  12.9k|        forwardH = LZ4_hashPosition(++ip, tableType);
 1308|       |
 1309|  12.9k|    }
 1310|       |
 1311|  3.83k|_last_literals:
 1312|       |    /* Encode Last Literals */
 1313|  3.83k|    {   size_t lastRun = (size_t)(iend - anchor);
 1314|  3.83k|        if ( (outputDirective) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1314:14): [True: 2.64k, False: 1.19k]
  ------------------
 1315|  2.64k|            (op + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > olimit)) {
  ------------------
  |  |  264|  2.64k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  2.64k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  2.64k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1315:13): [True: 742, False: 1.90k]
  ------------------
 1316|    742|            if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1316:17): [True: 557, False: 185]
  ------------------
 1317|       |                /* adapt lastRun to fill 'dst' */
 1318|    557|                assert(olimit >= op);
  ------------------
  |  Branch (1318:17): [True: 0, False: 557]
  |  Branch (1318:17): [True: 557, False: 0]
  ------------------
 1319|    557|                lastRun  = (size_t)(olimit-op) - 1/*token*/;
 1320|    557|                lastRun -= (lastRun + 256 - RUN_MASK) / 256;  /*additional length tokens*/
  ------------------
  |  |  264|    557|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    557|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    557|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1321|    557|            } else {
 1322|    185|                assert(outputDirective == limitedOutput);
  ------------------
  |  Branch (1322:17): [True: 0, False: 185]
  |  Branch (1322:17): [True: 185, False: 0]
  ------------------
 1323|    185|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1324|    185|            }
 1325|    742|        }
 1326|  3.64k|        DEBUGLOG(6, "Final literal run : %i literals", (int)lastRun);
  ------------------
  |  |  290|  3.64k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1327|  3.64k|        if (lastRun >= RUN_MASK) {
  ------------------
  |  |  264|  3.64k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  3.64k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  3.64k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1327:13): [True: 433, False: 3.21k]
  ------------------
 1328|    433|            size_t accumulator = lastRun - RUN_MASK;
  ------------------
  |  |  264|    433|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    433|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    433|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1329|    433|            *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  264|    433|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    433|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    433|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  261|    433|#define ML_BITS  4
  ------------------
 1330|    433|            for(; accumulator >= 255 ; accumulator-=255) *op++ = 255;
  ------------------
  |  Branch (1330:19): [True: 0, False: 433]
  ------------------
 1331|    433|            *op++ = (BYTE) accumulator;
 1332|  3.21k|        } else {
 1333|  3.21k|            *op++ = (BYTE)(lastRun<<ML_BITS);
  ------------------
  |  |  261|  3.21k|#define ML_BITS  4
  ------------------
 1334|  3.21k|        }
 1335|  3.64k|        LZ4_memcpy(op, anchor, lastRun);
  ------------------
  |  |  350|  3.64k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 1336|  3.64k|        ip = anchor + lastRun;
 1337|  3.64k|        op += lastRun;
 1338|  3.64k|    }
 1339|       |
 1340|  3.64k|    if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1340:9): [True: 1.48k, False: 2.16k]
  ------------------
 1341|  1.48k|        *inputConsumed = (int) (((const char*)ip)-source);
 1342|  1.48k|    }
 1343|  3.64k|    result = (int)(((char*)op) - dest);
 1344|  3.64k|    assert(result > 0);
  ------------------
  |  Branch (1344:5): [True: 0, False: 3.64k]
  |  Branch (1344:5): [True: 3.64k, False: 0]
  ------------------
 1345|  3.64k|    DEBUGLOG(5, "LZ4_compress_generic: compressed %i bytes into %i bytes", inputSize, result);
  ------------------
  |  |  290|  3.64k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1346|  3.64k|    return result;
 1347|  3.64k|}
lz4.c:LZ4_hashPosition:
  807|   603k|{
  808|   603k|    if ((sizeof(reg_t)==8) && (tableType != byU16)) return LZ4_hash5(LZ4_read_ARCH(p), tableType);
  ------------------
  |  Branch (808:9): [True: 603k, Folded]
  |  Branch (808:31): [True: 485k, False: 118k]
  ------------------
  809|       |
  810|       |#ifdef LZ4_STATIC_LINKING_ONLY_ENDIANNESS_INDEPENDENT_OUTPUT
  811|       |    return LZ4_hash4(LZ4_readLE32(p), tableType);
  812|       |#else
  813|   118k|    return LZ4_hash4(LZ4_read32(p), tableType);
  814|   603k|#endif
  815|   603k|}
lz4.c:LZ4_hash5:
  795|   485k|{
  796|   485k|    const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  697|      0|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  158|      0|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  697|   971k|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  158|   485k|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   485k|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (796:25): [True: 0, False: 485k]
  ------------------
  797|   485k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (797:9): [True: 485k, False: 0]
  ------------------
  798|   485k|        const U64 prime5bytes = 889523592379ULL;
  799|   485k|        return (U32)(((sequence << 24) * prime5bytes) >> (64 - hashLog));
  800|   485k|    } else {
  801|      0|        const U64 prime8bytes = 11400714785074694791ULL;
  802|      0|        return (U32)(((sequence >> 24) * prime8bytes) >> (64 - hashLog));
  803|      0|    }
  804|   485k|}
lz4.c:LZ4_isLittleEndian:
  365|   551k|{
  366|   551k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  367|   551k|    return one.c[0];
  368|   551k|}
lz4.c:LZ4_read_ARCH:
  396|  6.45M|static reg_t LZ4_read_ARCH(const void* ptr) { return ((const LZ4_unalignST*)ptr)->uArch; }
lz4.c:LZ4_hash4:
  787|   118k|{
  788|   118k|    if (tableType == byU16)
  ------------------
  |  Branch (788:9): [True: 118k, False: 0]
  ------------------
  789|   118k|        return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
  ------------------
  |  |  243|   118k|#define MINMATCH 4
  ------------------
                      return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
  ------------------
  |  |  697|   118k|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  158|   118k|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   118k|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  790|      0|    else
  791|      0|        return ((sequence * 2654435761U) >> ((MINMATCH*8)-LZ4_HASHLOG));
  ------------------
  |  |  243|      0|#define MINMATCH 4
  ------------------
                      return ((sequence * 2654435761U) >> ((MINMATCH*8)-LZ4_HASHLOG));
  ------------------
  |  |  697|      0|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  158|      0|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|      0|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  792|   118k|}
lz4.c:LZ4_putIndexOnHash:
  830|   586k|{
  831|   586k|    switch (tableType)
  832|   586k|    {
  833|      0|    default: /* fallthrough */
  ------------------
  |  Branch (833:5): [True: 0, False: 586k]
  ------------------
  834|      0|    case clearedTable: /* fallthrough */
  ------------------
  |  Branch (834:5): [True: 0, False: 586k]
  ------------------
  835|      0|    case byPtr: { /* illegal! */ assert(0); return; }
  ------------------
  |  Branch (835:5): [True: 0, False: 586k]
  |  Branch (835:34): [Folded, False: 0]
  |  Branch (835:34): [Folded, False: 0]
  ------------------
  836|   480k|    case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = idx; return; }
  ------------------
  |  Branch (836:5): [True: 480k, False: 106k]
  ------------------
  837|   106k|    case byU16: { U16* hashTable = (U16*) tableBase; assert(idx < 65536); hashTable[h] = (U16)idx; return; }
  ------------------
  |  Branch (837:5): [True: 106k, False: 480k]
  |  Branch (837:54): [True: 0, False: 106k]
  |  Branch (837:54): [True: 106k, False: 0]
  ------------------
  838|   586k|    }
  839|   586k|}
lz4.c:LZ4_read32:
  395|   853k|static U32 LZ4_read32(const void* ptr) { return ((const LZ4_unalign32*)ptr)->u32; }
lz4.c:LZ4_getIndexOnHash:
  863|   561k|{
  864|   561k|    LZ4_STATIC_ASSERT(LZ4_MEMORY_USAGE > 2);
  ------------------
  |  |  278|   561k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
  865|   561k|    if (tableType == byU32) {
  ------------------
  |  Branch (865:9): [True: 471k, False: 90.1k]
  ------------------
  866|   471k|        const U32* const hashTable = (const U32*) tableBase;
  867|   471k|        assert(h < (1U << (LZ4_MEMORY_USAGE-2)));
  ------------------
  |  Branch (867:9): [True: 0, False: 471k]
  |  Branch (867:9): [True: 471k, False: 0]
  ------------------
  868|   471k|        return hashTable[h];
  869|   471k|    }
  870|  90.1k|    if (tableType == byU16) {
  ------------------
  |  Branch (870:9): [True: 90.1k, False: 0]
  ------------------
  871|  90.1k|        const U16* const hashTable = (const U16*) tableBase;
  872|  90.1k|        assert(h < (1U << (LZ4_MEMORY_USAGE-1)));
  ------------------
  |  Branch (872:9): [True: 0, False: 90.1k]
  |  Branch (872:9): [True: 90.1k, False: 0]
  ------------------
  873|  90.1k|        return hashTable[h];
  874|  90.1k|    }
  875|  90.1k|    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|  21.2k|{
  468|  21.2k|    BYTE* d = (BYTE*)dstPtr;
  469|  21.2k|    const BYTE* s = (const BYTE*)srcPtr;
  470|  21.2k|    BYTE* const e = (BYTE*)dstEnd;
  471|       |
  472|   181k|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  350|   181k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (472:50): [True: 160k, False: 21.2k]
  ------------------
  473|  21.2k|}
lz4.c:LZ4_writeLE16:
  454|  24.7k|{
  455|  24.7k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (455:9): [True: 24.7k, False: 0]
  ------------------
  456|  24.7k|        LZ4_write16(memPtr, value);
  457|  24.7k|    } else {
  458|      0|        BYTE* p = (BYTE*)memPtr;
  459|      0|        p[0] = (BYTE) value;
  460|      0|        p[1] = (BYTE)(value>>8);
  461|      0|    }
  462|  24.7k|}
lz4.c:LZ4_write16:
  398|  24.7k|static void LZ4_write16(void* memPtr, U16 value) { ((LZ4_unalign16*)memPtr)->u16 = value; }
lz4.c:LZ4_count:
  690|  24.7k|{
  691|  24.7k|    const BYTE* const pStart = pIn;
  692|       |
  693|  24.7k|    if (likely(pIn < pInLimit-(STEPSIZE-1))) {
  ------------------
  |  |  178|  24.7k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  24.7k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 23.2k, False: 1.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  694|  23.2k|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  695|  23.2k|        if (!diff) {
  ------------------
  |  Branch (695:13): [True: 13.1k, False: 10.1k]
  ------------------
  696|  13.1k|            pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  687|  13.1k|#define STEPSIZE sizeof(reg_t)
  ------------------
                          pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  687|  13.1k|#define STEPSIZE sizeof(reg_t)
  ------------------
  697|  13.1k|        } else {
  698|  10.1k|            return LZ4_NbCommonBytes(diff);
  699|  10.1k|    }   }
  700|       |
  701|  2.96M|    while (likely(pIn < pInLimit-(STEPSIZE-1))) {
  702|  2.96M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  703|  2.96M|        if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  687|  2.94M|#define STEPSIZE sizeof(reg_t)
  ------------------
                      if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  687|  2.94M|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (703:13): [True: 2.94M, False: 12.5k]
  ------------------
  704|  12.5k|        pIn += LZ4_NbCommonBytes(diff);
  705|  12.5k|        return (unsigned)(pIn - pStart);
  706|  2.96M|    }
  707|       |
  708|  2.01k|    if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  |  687|  2.01k|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (708:9): [True: 2.01k, Folded]
  |  Branch (708:26): [True: 1.16k, False: 850]
  |  Branch (708:48): [True: 286, False: 881]
  ------------------
  709|  2.01k|    if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (709:9): [True: 1.79k, False: 224]
  |  Branch (709:31): [True: 562, False: 1.23k]
  ------------------
  710|  2.01k|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (710:9): [True: 1.77k, False: 242]
  |  Branch (710:27): [True: 649, False: 1.12k]
  ------------------
  711|  2.01k|    return (unsigned)(pIn - pStart);
  712|  14.5k|}
lz4.c:LZ4_NbCommonBytes:
  589|  22.6k|{
  590|  22.6k|    assert(val != 0);
  ------------------
  |  Branch (590:5): [True: 0, False: 22.6k]
  |  Branch (590:5): [True: 22.6k, False: 0]
  ------------------
  591|  22.6k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (591:9): [True: 22.6k, False: 0]
  ------------------
  592|  22.6k|        if (sizeof(val) == 8) {
  ------------------
  |  Branch (592:13): [True: 22.6k, 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|  22.6k|        } 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|  22.6k|    } 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|  22.6k|}
lz4.c:LZ4_read16:
  394|  22.1k|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  399|  32.5k|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_compress_destSize_extState_internal:
 1491|  2.08k|{
 1492|  2.08k|    void* const s = LZ4_initStream(state, sizeof (*state));
 1493|  2.08k|    assert(s != NULL); (void)s;
  ------------------
  |  Branch (1493:5): [True: 0, False: 2.08k]
  |  Branch (1493:5): [True: 2.08k, False: 0]
  ------------------
 1494|       |
 1495|  2.08k|    if (targetDstSize >= LZ4_compressBound(*srcSizePtr)) {  /* compression success is guaranteed */
  ------------------
  |  Branch (1495:9): [True: 596, False: 1.49k]
  ------------------
 1496|    596|        return LZ4_compress_fast_extState(state, src, dst, *srcSizePtr, targetDstSize, acceleration);
 1497|  1.49k|    } else {
 1498|  1.49k|        if (*srcSizePtr < LZ4_64Klimit) {
  ------------------
  |  Branch (1498:13): [True: 1.23k, False: 254]
  ------------------
 1499|  1.23k|            return LZ4_compress_generic(&state->internal_donotuse, src, dst, *srcSizePtr, srcSizePtr, targetDstSize, fillOutput, byU16, noDict, noDictIssue, acceleration);
 1500|  1.23k|        } else {
 1501|    254|            tableType_t const addrMode = ((sizeof(void*)==4) && ((uptrval)src > LZ4_DISTANCE_MAX)) ? byPtr : byU32;
  ------------------
  |  |  676|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1501:43): [Folded, False: 254]
  |  Branch (1501:65): [True: 0, False: 0]
  ------------------
 1502|    254|            return LZ4_compress_generic(&state->internal_donotuse, src, dst, *srcSizePtr, srcSizePtr, targetDstSize, fillOutput, addrMode, noDict, noDictIssue, acceleration);
 1503|    254|    }   }
 1504|  2.08k|}
lz4.c:LZ4_isAligned:
  294|  4.79k|{
  295|  4.79k|    return ((size_t)ptr & (alignment -1)) == 0;
  296|  4.79k|}
lz4.c:LZ4_stream_t_alignment:
 1552|  4.79k|{
 1553|  4.79k|#if LZ4_ALIGN_TEST
 1554|  4.79k|    typedef struct { char c; LZ4_stream_t t; } t_a;
 1555|  4.79k|    return sizeof(t_a) - sizeof(LZ4_stream_t);
 1556|       |#else
 1557|       |    return 1;  /* effectively disabled */
 1558|       |#endif
 1559|  4.79k|}
lz4.c:LZ4_decompress_generic:
 2044|  3.66k|{
 2045|  3.66k|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (2045:9): [True: 0, False: 3.66k]
  |  Branch (2045:26): [True: 0, False: 3.66k]
  ------------------
 2046|       |
 2047|  3.66k|    {   const BYTE* ip = (const BYTE*) src;
 2048|  3.66k|        const BYTE* const iend = ip + srcSize;
 2049|       |
 2050|  3.66k|        BYTE* op = (BYTE*) dst;
 2051|  3.66k|        BYTE* const oend = op + outputSize;
 2052|  3.66k|        BYTE* cpy;
 2053|       |
 2054|  3.66k|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (2054:37): [True: 3.66k, False: 0]
  ------------------
 2055|       |
 2056|  3.66k|        const int checkOffset = (dictSize < (int)(64 KB));
  ------------------
  |  |  252|  3.66k|#define KB *(1 <<10)
  ------------------
 2057|       |
 2058|       |
 2059|       |        /* Set up the "end" pointers for the shortcut. */
 2060|  3.66k|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 2061|  3.66k|        const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/;
 2062|       |
 2063|  3.66k|        const BYTE* match;
 2064|  3.66k|        size_t offset;
 2065|  3.66k|        unsigned token;
 2066|  3.66k|        size_t length;
 2067|       |
 2068|       |
 2069|  3.66k|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  290|  3.66k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2070|       |
 2071|       |        /* Special cases */
 2072|  3.66k|        assert(lowPrefix <= op);
  ------------------
  |  Branch (2072:9): [True: 0, False: 3.66k]
  |  Branch (2072:9): [True: 3.66k, False: 0]
  ------------------
 2073|  3.66k|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  181|  3.66k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  3.66k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 16, False: 3.64k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2074|       |            /* Empty output buffer */
 2075|     16|            if (partialDecoding) return 0;
  ------------------
  |  Branch (2075:17): [True: 0, False: 16]
  ------------------
 2076|     16|            return ((srcSize==1) && (*ip==0)) ? 0 : -1;
  ------------------
  |  Branch (2076:21): [True: 16, False: 0]
  |  Branch (2076:37): [True: 16, False: 0]
  ------------------
 2077|     16|        }
 2078|  3.64k|        if (unlikely(srcSize==0)) { return -1; }
  ------------------
  |  |  181|  3.64k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  3.64k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 3.64k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2079|       |
 2080|       |    /* LZ4_FAST_DEC_LOOP:
 2081|       |     * designed for modern OoO performance cpus,
 2082|       |     * where copying reliably 32-bytes is preferable to an unpredictable branch.
 2083|       |     * note : fast loop may show a regression for some client arm chips. */
 2084|  3.64k|#if LZ4_FAST_DEC_LOOP
 2085|  3.64k|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  3.64k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2085:13): [True: 2.25k, False: 1.39k]
  ------------------
 2086|  2.25k|            DEBUGLOG(6, "move to safe decode loop");
  ------------------
  |  |  290|  2.25k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2087|  2.25k|            goto safe_decode;
 2088|  2.25k|        }
 2089|       |
 2090|       |        /* Fast loop : decode sequences as long as output < oend-FASTLOOP_SAFE_DISTANCE */
 2091|  1.39k|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  290|  1.39k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2092|  13.6k|        while (1) {
  ------------------
  |  Branch (2092:16): [True: 13.6k, Folded]
  ------------------
 2093|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2094|  13.6k|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  Branch (2094:13): [True: 0, False: 13.6k]
  |  Branch (2094:13): [True: 13.6k, False: 0]
  ------------------
 2095|  13.6k|            assert(ip < iend);
  ------------------
  |  Branch (2095:13): [True: 0, False: 13.6k]
  |  Branch (2095:13): [True: 13.6k, False: 0]
  ------------------
 2096|  13.6k|            token = *ip++;
 2097|  13.6k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  261|  13.6k|#define ML_BITS  4
  ------------------
 2098|  13.6k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  13.6k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2099|       |
 2100|  13.6k|            if (ip > iend-(16 + 1/*max lit + offset + nextToken*/)) { goto safe_literal_copy_early; }
  ------------------
  |  Branch (2100:17): [True: 401, False: 13.2k]
  ------------------
 2101|       |
 2102|       |            /* decode literal length */
 2103|  13.2k|            if (length == RUN_MASK) {
  ------------------
  |  |  264|  13.2k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  13.2k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  13.2k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2103:17): [True: 638, False: 12.6k]
  ------------------
 2104|    638|                size_t const addl = read_variable_length(&ip, iend, 0);
 2105|    638|                if (addl == rvl_error) {
  ------------------
  |  Branch (2105:21): [True: 0, False: 638]
  ------------------
 2106|      0|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2107|      0|                    goto _output_error;
 2108|      0|                }
 2109|    638|                length += addl;
 2110|    638|                cpy = op+length;
 2111|    638|                if (unlikely((uptrval)(cpy)<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|    638|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    638|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 638]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2112|    638|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|    638|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    638|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 638]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2113|       |
 2114|       |                /* copy literals */
 2115|    638|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  278|    638|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2116|       |              #ifdef __aarch64__
 2117|       |                if ((cpy>oend-64) || (ip+length>iend-64)) { goto safe_literal_copy; }
 2118|       |                LZ4_wildCopy64(op, ip, cpy);
 2119|       |              #else
 2120|    638|                if ((cpy>oend-32) || (ip+length>iend-32)) { goto safe_literal_copy; }
  ------------------
  |  Branch (2120:21): [True: 93, False: 545]
  |  Branch (2120:38): [True: 164, False: 381]
  ------------------
 2121|    381|                LZ4_wildCopy32(op, ip, cpy);
 2122|    381|              #endif
 2123|    381|                ip += length; op = cpy;
 2124|  12.6k|            } else {
 2125|  12.6k|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)length);
  ------------------
  |  |  290|  12.6k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2126|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2127|  12.6k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  350|  12.6k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2128|  12.6k|                ip += length; op += length;
 2129|  12.6k|            }
 2130|       |
 2131|       |            /* get offset */
 2132|  12.9k|            offset = LZ4_readLE16(ip); ip+=2;
 2133|  12.9k|            DEBUGLOG(6, "blockPos%6u: offset = %u", (unsigned)(op-(BYTE*)dst), (unsigned)offset);
  ------------------
  |  |  290|  12.9k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2134|  12.9k|            match = op - offset;
 2135|  12.9k|            assert(match <= op);  /* overflow check */
  ------------------
  |  Branch (2135:13): [True: 0, False: 12.9k]
  |  Branch (2135:13): [True: 12.9k, False: 0]
  ------------------
 2136|       |
 2137|       |            /* get matchlength */
 2138|  12.9k|            length = token & ML_MASK;
  ------------------
  |  |  262|  12.9k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  12.9k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2139|  12.9k|            DEBUGLOG(7, "  match length token = %u (len==%u)", (unsigned)length, (unsigned)length+MINMATCH);
  ------------------
  |  |  290|  12.9k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2140|       |
 2141|  12.9k|            if (length == ML_MASK) {
  ------------------
  |  |  262|  12.9k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  12.9k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2141:17): [True: 6.42k, False: 6.56k]
  ------------------
 2142|  6.42k|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  246|  6.42k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2143|  6.42k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2143:21): [True: 0, False: 6.42k]
  ------------------
 2144|      0|                    DEBUGLOG(5, "error reading long match length");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2145|      0|                    goto _output_error;
 2146|      0|                }
 2147|  6.42k|                length += addl;
 2148|  6.42k|                length += MINMATCH;
  ------------------
  |  |  243|  6.42k|#define MINMATCH 4
  ------------------
 2149|  6.42k|                DEBUGLOG(7, "  long match length == %u", (unsigned)length);
  ------------------
  |  |  290|  6.42k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2150|  6.42k|                if (unlikely((uptrval)(op)+length<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|  6.42k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  6.42k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 6.42k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2151|  6.42k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  6.42k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2151:21): [True: 328, False: 6.09k]
  ------------------
 2152|    328|                    goto safe_match_copy;
 2153|    328|                }
 2154|  6.56k|            } else {
 2155|  6.56k|                length += MINMATCH;
  ------------------
  |  |  243|  6.56k|#define MINMATCH 4
  ------------------
 2156|  6.56k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  249|  6.56k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2156:21): [True: 412, False: 6.15k]
  ------------------
 2157|    412|                    DEBUGLOG(7, "moving to safe_match_copy (ml==%u)", (unsigned)length);
  ------------------
  |  |  290|    412|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2158|    412|                    goto safe_match_copy;
 2159|    412|                }
 2160|       |
 2161|       |                /* Fastpath check: skip LZ4_wildCopy32 when true */
 2162|  6.15k|                if ((dict == withPrefix64k) || (match >= lowPrefix)) {
  ------------------
  |  Branch (2162:21): [True: 0, False: 6.15k]
  |  Branch (2162:48): [True: 6.15k, False: 0]
  ------------------
 2163|  6.15k|                    if (offset >= 8) {
  ------------------
  |  Branch (2163:25): [True: 3.14k, False: 3.00k]
  ------------------
 2164|  3.14k|                        assert(match >= lowPrefix);
  ------------------
  |  Branch (2164:25): [True: 0, False: 3.14k]
  |  Branch (2164:25): [True: 3.14k, False: 0]
  ------------------
 2165|  3.14k|                        assert(match <= op);
  ------------------
  |  Branch (2165:25): [True: 0, False: 3.14k]
  |  Branch (2165:25): [True: 3.14k, False: 0]
  ------------------
 2166|  3.14k|                        assert(op + 18 <= oend);
  ------------------
  |  Branch (2166:25): [True: 0, False: 3.14k]
  |  Branch (2166:25): [True: 3.14k, False: 0]
  ------------------
 2167|       |
 2168|  3.14k|                        LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  3.14k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2169|  3.14k|                        LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  350|  3.14k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2170|  3.14k|                        LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  350|  3.14k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2171|  3.14k|                        op += length;
 2172|  3.14k|                        continue;
 2173|  3.14k|            }   }   }
 2174|       |
 2175|  9.10k|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  181|  9.10k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  9.10k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2175:18): [True: 9.10k, False: 0]
  |  Branch (2175:33): [True: 0, False: 9.10k]
  ------------------
 2176|      0|                DEBUGLOG(5, "Error : pos=%zi, offset=%zi => outside buffers", op-lowPrefix, op-match);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2177|      0|                goto _output_error;
 2178|      0|            }
 2179|       |            /* match starting within external dictionary */
 2180|  9.10k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2180:17): [True: 0, False: 9.10k]
  |  Branch (2180:41): [True: 0, False: 0]
  ------------------
 2181|      0|                assert(dictEnd != NULL);
  ------------------
  |  Branch (2181:17): [True: 0, False: 0]
  |  Branch (2181:17): [True: 0, False: 0]
  ------------------
 2182|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2183|      0|                    if (partialDecoding) {
  ------------------
  |  Branch (2183:25): [True: 0, False: 0]
  ------------------
 2184|      0|                        DEBUGLOG(7, "partialDecoding: dictionary match, close to dstEnd");
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2185|      0|                        length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1854|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1854:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2186|      0|                    } else {
 2187|      0|                        DEBUGLOG(6, "end-of-block condition violated")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2188|      0|                        goto _output_error;
 2189|      0|                }   }
 2190|       |
 2191|      0|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2191:21): [True: 0, False: 0]
  ------------------
 2192|       |                    /* match fits entirely within external dictionary : just copy */
 2193|      0|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  358|      0|#    define LZ4_memmove __builtin_memmove
  ------------------
 2194|      0|                    op += length;
 2195|      0|                } else {
 2196|       |                    /* match stretches into both external dictionary and current block */
 2197|      0|                    size_t const copySize = (size_t)(lowPrefix - match);
 2198|      0|                    size_t const restSize = length - copySize;
 2199|      0|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2200|      0|                    op += copySize;
 2201|      0|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2201:25): [True: 0, False: 0]
  ------------------
 2202|      0|                        BYTE* const endOfMatch = op + restSize;
 2203|      0|                        const BYTE* copyFrom = lowPrefix;
 2204|      0|                        while (op < endOfMatch) { *op++ = *copyFrom++; }
  ------------------
  |  Branch (2204:32): [True: 0, False: 0]
  ------------------
 2205|      0|                    } else {
 2206|      0|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2207|      0|                        op += restSize;
 2208|      0|                }   }
 2209|      0|                continue;
 2210|      0|            }
 2211|       |
 2212|       |            /* copy match within block */
 2213|  9.10k|            cpy = op + length;
 2214|       |
 2215|  9.10k|            assert((op <= oend) && (oend-op >= 64));
  ------------------
  |  Branch (2215:13): [True: 0, False: 9.10k]
  |  Branch (2215:13): [True: 0, False: 0]
  |  Branch (2215:13): [True: 9.10k, False: 0]
  |  Branch (2215:13): [True: 9.10k, False: 0]
  ------------------
 2216|  9.10k|            if (unlikely(offset<16)) {
  ------------------
  |  |  181|  9.10k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  9.10k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 5.82k, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2217|  5.82k|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2218|       |    #ifdef __aarch64__
 2219|       |            } else if (offset >= 64) {
 2220|       |                LZ4_wildCopy64(op, match, cpy);
 2221|       |    #endif
 2222|  5.82k|            } else {
 2223|  3.27k|                LZ4_wildCopy32(op, match, cpy);
 2224|  3.27k|            }
 2225|       |
 2226|  9.10k|            op = cpy;   /* wildcopy correction */
 2227|  9.10k|        }
 2228|  2.25k|    safe_decode:
 2229|  2.25k|#endif
 2230|       |
 2231|       |        /* Main Loop : decode remaining sequences where output < FASTLOOP_SAFE_DISTANCE */
 2232|  2.25k|        DEBUGLOG(6, "using safe decode loop");
  ------------------
  |  |  290|  2.25k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2233|  8.51k|        while (1) {
  ------------------
  |  Branch (2233:16): [True: 8.51k, Folded]
  ------------------
 2234|  8.51k|            assert(ip < iend);
  ------------------
  |  Branch (2234:13): [True: 0, False: 8.51k]
  |  Branch (2234:13): [True: 8.51k, False: 0]
  ------------------
 2235|  8.51k|            token = *ip++;
 2236|  8.51k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  261|  8.51k|#define ML_BITS  4
  ------------------
 2237|  8.51k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  8.51k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2238|       |
 2239|       |            /* A two-stage shortcut for the most common case:
 2240|       |             * 1) If the literal length is 0..14, and there is enough space,
 2241|       |             * enter the shortcut and copy 16 bytes on behalf of the literals
 2242|       |             * (in the fast mode, only 8 bytes can be safely copied this way).
 2243|       |             * 2) Further if the match length is 4..18, copy 18 bytes in a similar
 2244|       |             * manner; but we ensure that there's enough space in the output for
 2245|       |             * those 18 bytes earlier, upon entering the shortcut (in other words,
 2246|       |             * there is a combined check for both stages).
 2247|       |             */
 2248|  8.51k|            if ( (length != RUN_MASK)
  ------------------
  |  |  264|  8.51k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  8.51k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  8.51k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2248:18): [True: 8.06k, False: 450]
  ------------------
 2249|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2250|  8.06k|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  178|  8.06k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  8.06k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.60k, False: 6.46k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2251|       |                /* Copy the literals */
 2252|  1.60k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  350|  1.60k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2253|  1.60k|                op += length; ip += length;
 2254|       |
 2255|       |                /* The second stage: prepare for match copying, decode full info.
 2256|       |                 * If it doesn't work out, the info won't be wasted. */
 2257|  1.60k|                length = token & ML_MASK; /* match length */
  ------------------
  |  |  262|  1.60k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.60k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2258|  1.60k|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u (len=%u)", (unsigned)(op-(BYTE*)dst), (unsigned)length, (unsigned)length + 4);
  ------------------
  |  |  290|  1.60k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2259|  1.60k|                offset = LZ4_readLE16(ip); ip += 2;
 2260|  1.60k|                match = op - offset;
 2261|  1.60k|                assert(match <= op); /* check overflow */
  ------------------
  |  Branch (2261:17): [True: 0, False: 1.60k]
  |  Branch (2261:17): [True: 1.60k, False: 0]
  ------------------
 2262|       |
 2263|       |                /* Do not deal with overlapping matches. */
 2264|  1.60k|                if ( (length != ML_MASK)
  ------------------
  |  |  262|  1.60k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  1.60k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2264:22): [True: 1.45k, False: 149]
  ------------------
 2265|  1.45k|                  && (offset >= 8)
  ------------------
  |  Branch (2265:22): [True: 688, False: 763]
  ------------------
 2266|    688|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2266:23): [True: 0, False: 688]
  |  Branch (2266:46): [True: 688, False: 0]
  ------------------
 2267|       |                    /* Copy the match. */
 2268|    688|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  350|    688|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2269|    688|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  350|    688|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2270|    688|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  350|    688|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2271|    688|                    op += length + MINMATCH;
  ------------------
  |  |  243|    688|#define MINMATCH 4
  ------------------
 2272|       |                    /* Both stages worked, load the next token. */
 2273|    688|                    continue;
 2274|    688|                }
 2275|       |
 2276|       |                /* The second stage didn't work out, but the info is ready.
 2277|       |                 * Propel it right to the point of match copying. */
 2278|    912|                goto _copy_match;
 2279|  1.60k|            }
 2280|       |
 2281|  6.91k|#if LZ4_FAST_DEC_LOOP
 2282|  7.31k|        safe_literal_copy_early:
 2283|  7.31k|#endif
 2284|       |
 2285|       |            /* decode literal length */
 2286|  7.31k|            if (length == RUN_MASK) {
  ------------------
  |  |  264|  7.31k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|  7.31k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|  7.31k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2286:17): [True: 454, False: 6.86k]
  ------------------
 2287|    454|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  264|    454|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  263|    454|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  261|    454|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2288|    454|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2288:21): [True: 0, False: 454]
  ------------------
 2289|    454|                length += addl;
 2290|    454|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|    454|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    454|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 454]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2291|    454|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  181|    454|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    454|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 454]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2292|    454|            }
 2293|       |
 2294|       |            /* copy literals */
 2295|  7.31k|            cpy = op+length;
 2296|       |
 2297|  7.31k|#if LZ4_FAST_DEC_LOOP
 2298|  7.57k|        safe_literal_copy:
 2299|  7.57k|#endif
 2300|       |
 2301|  7.57k|            LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  278|  7.57k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2302|  7.57k|            if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  247|  7.57k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  246|  4.30k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2302:17): [True: 3.26k, False: 4.30k]
  |  Branch (2302:39): [True: 386, False: 3.92k]
  ------------------
 2303|       |                /* We've either hit the input parsing restriction or the output parsing restriction.
 2304|       |                 * In the normal scenario, decoding a full block, it must be the last sequence,
 2305|       |                 * otherwise it's an error (invalid input or dimensions).
 2306|       |                 * In partialDecoding scenario, it's necessary to ensure there is no buffer overflow.
 2307|       |                 */
 2308|  3.64k|                if (partialDecoding) {
  ------------------
  |  Branch (2308:21): [True: 0, False: 3.64k]
  ------------------
 2309|       |                    /* Since we are partial decoding we may be in this block because of the output parsing
 2310|       |                     * restriction, which is not valid since the output buffer is allowed to be undersized.
 2311|       |                     */
 2312|      0|                    DEBUGLOG(7, "partialDecoding: copying literals, close to input or output end")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2313|      0|                    DEBUGLOG(7, "partialDecoding: literal length = %u", (unsigned)length);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2314|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in dstBuffer : %i", (int)(oend - op));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2315|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in srcBuffer : %i", (int)(iend - ip));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2316|       |                    /* Finishing in the middle of a literals segment,
 2317|       |                     * due to lack of input.
 2318|       |                     */
 2319|      0|                    if (ip+length > iend) {
  ------------------
  |  Branch (2319:25): [True: 0, False: 0]
  ------------------
 2320|      0|                        length = (size_t)(iend-ip);
 2321|      0|                        cpy = op + length;
 2322|      0|                    }
 2323|       |                    /* Finishing in the middle of a literals segment,
 2324|       |                     * due to lack of output space.
 2325|       |                     */
 2326|      0|                    if (cpy > oend) {
  ------------------
  |  Branch (2326:25): [True: 0, False: 0]
  ------------------
 2327|      0|                        cpy = oend;
 2328|      0|                        assert(op<=oend);
  ------------------
  |  Branch (2328:25): [True: 0, False: 0]
  |  Branch (2328:25): [True: 0, False: 0]
  ------------------
 2329|      0|                        length = (size_t)(oend-op);
 2330|      0|                    }
 2331|  3.64k|                } else {
 2332|       |                     /* We must be on the last sequence (or invalid) because of the parsing limitations
 2333|       |                      * so check that we exactly consume the input and don't overrun the output buffer.
 2334|       |                      */
 2335|  3.64k|                    if ((ip+length != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2335:25): [True: 0, False: 3.64k]
  |  Branch (2335:48): [True: 0, False: 3.64k]
  ------------------
 2336|      0|                        DEBUGLOG(5, "should have been last run of literals")
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2337|      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 */
  ------------------
 2338|      0|                        DEBUGLOG(5, "or cpy(%p) > (oend-MFLIMIT)(%p)", (void*)cpy, (void*)(oend-MFLIMIT));
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2339|      0|                        DEBUGLOG(5, "after writing %u bytes / %i bytes available", (unsigned)(op-(BYTE*)dst), outputSize);
  ------------------
  |  |  290|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2340|      0|                        goto _output_error;
 2341|      0|                    }
 2342|  3.64k|                }
 2343|  3.64k|                LZ4_memmove(op, ip, length);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  358|  3.64k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2344|  3.64k|                ip += length;
 2345|  3.64k|                op += length;
 2346|       |                /* Necessarily EOF when !partialDecoding.
 2347|       |                 * When partialDecoding, it is EOF if we've either
 2348|       |                 * filled the output buffer or
 2349|       |                 * can't proceed with reading an offset for following match.
 2350|       |                 */
 2351|  3.64k|                if (!partialDecoding || (cpy == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2351:21): [True: 3.64k, False: 0]
  |  Branch (2351:41): [True: 0, False: 0]
  |  Branch (2351:58): [True: 0, False: 0]
  ------------------
 2352|  3.64k|                    break;
 2353|  3.64k|                }
 2354|  3.92k|            } else {
 2355|  3.92k|                LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2356|  3.92k|                ip += length; op = cpy;
 2357|  3.92k|            }
 2358|       |
 2359|       |            /* get offset */
 2360|  3.92k|            offset = LZ4_readLE16(ip); ip+=2;
 2361|  3.92k|            match = op - offset;
 2362|       |
 2363|       |            /* get matchlength */
 2364|  3.92k|            length = token & ML_MASK;
  ------------------
  |  |  262|  3.92k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  3.92k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2365|  3.92k|            DEBUGLOG(7, "blockPos%6u: matchLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)length);
  ------------------
  |  |  290|  3.92k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2366|       |
 2367|  4.83k|    _copy_match:
 2368|  4.83k|            if (length == ML_MASK) {
  ------------------
  |  |  262|  4.83k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  4.83k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2368:17): [True: 663, False: 4.17k]
  ------------------
 2369|    663|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  246|    663|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2370|    663|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2370:21): [True: 0, False: 663]
  ------------------
 2371|    663|                length += addl;
 2372|    663|                if (unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  181|    663|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    663|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 663]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2373|    663|            }
 2374|  4.83k|            length += MINMATCH;
  ------------------
  |  |  243|  4.83k|#define MINMATCH 4
  ------------------
 2375|       |
 2376|  4.83k|#if LZ4_FAST_DEC_LOOP
 2377|  5.57k|        safe_match_copy:
 2378|  5.57k|#endif
 2379|  5.57k|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error;   /* Error : offset outside buffers */
  ------------------
  |  |  181|  5.57k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  5.57k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2379:17): [True: 5.57k, False: 0]
  |  Branch (2379:34): [True: 0, False: 5.57k]
  ------------------
 2380|       |            /* match starting within external dictionary */
 2381|  5.57k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2381:17): [True: 0, False: 5.57k]
  |  Branch (2381:41): [True: 0, False: 0]
  ------------------
 2382|      0|                assert(dictEnd != NULL);
  ------------------
  |  Branch (2382:17): [True: 0, False: 0]
  |  Branch (2382:17): [True: 0, False: 0]
  ------------------
 2383|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2384|      0|                    if (partialDecoding) length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1854|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1854:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2384:25): [True: 0, False: 0]
  ------------------
 2385|      0|                    else goto _output_error;   /* doesn't respect parsing restriction */
 2386|      0|                }
 2387|       |
 2388|      0|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2388:21): [True: 0, False: 0]
  ------------------
 2389|       |                    /* match fits entirely within external dictionary : just copy */
 2390|      0|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  358|      0|#    define LZ4_memmove __builtin_memmove
  ------------------
 2391|      0|                    op += length;
 2392|      0|                } else {
 2393|       |                    /* match stretches into both external dictionary and current block */
 2394|      0|                    size_t const copySize = (size_t)(lowPrefix - match);
 2395|      0|                    size_t const restSize = length - copySize;
 2396|      0|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2397|      0|                    op += copySize;
 2398|      0|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2398:25): [True: 0, False: 0]
  ------------------
 2399|      0|                        BYTE* const endOfMatch = op + restSize;
 2400|      0|                        const BYTE* copyFrom = lowPrefix;
 2401|      0|                        while (op < endOfMatch) *op++ = *copyFrom++;
  ------------------
  |  Branch (2401:32): [True: 0, False: 0]
  ------------------
 2402|      0|                    } else {
 2403|      0|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2404|      0|                        op += restSize;
 2405|      0|                }   }
 2406|      0|                continue;
 2407|      0|            }
 2408|  5.57k|            assert(match >= lowPrefix);
  ------------------
  |  Branch (2408:13): [True: 0, False: 5.57k]
  |  Branch (2408:13): [True: 5.57k, False: 0]
  ------------------
 2409|       |
 2410|       |            /* copy match within block */
 2411|  5.57k|            cpy = op + length;
 2412|       |
 2413|       |            /* partialDecoding : may end anywhere within the block */
 2414|  5.57k|            assert(op<=oend);
  ------------------
  |  Branch (2414:13): [True: 0, False: 5.57k]
  |  Branch (2414:13): [True: 5.57k, False: 0]
  ------------------
 2415|  5.57k|            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 (2415:17): [True: 0, False: 5.57k]
  |  Branch (2415:36): [True: 0, False: 0]
  ------------------
 2416|      0|                size_t const mlen = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1854|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1854:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2417|      0|                const BYTE* const matchEnd = match + mlen;
 2418|      0|                BYTE* const copyEnd = op + mlen;
 2419|      0|                if (matchEnd > op) {   /* overlap copy */
  ------------------
  |  Branch (2419:21): [True: 0, False: 0]
  ------------------
 2420|      0|                    while (op < copyEnd) { *op++ = *match++; }
  ------------------
  |  Branch (2420:28): [True: 0, False: 0]
  ------------------
 2421|      0|                } else {
 2422|      0|                    LZ4_memcpy(op, match, mlen);
  ------------------
  |  |  350|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2423|      0|                }
 2424|      0|                op = copyEnd;
 2425|      0|                if (op == oend) { break; }
  ------------------
  |  Branch (2425:21): [True: 0, False: 0]
  ------------------
 2426|      0|                continue;
 2427|      0|            }
 2428|       |
 2429|  5.57k|            if (unlikely(offset<8)) {
  ------------------
  |  |  181|  5.57k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  5.57k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 4.00k, False: 1.56k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2430|  4.00k|                LZ4_write32(op, 0);   /* silence msan warning when offset==0 */
 2431|  4.00k|                op[0] = match[0];
 2432|  4.00k|                op[1] = match[1];
 2433|  4.00k|                op[2] = match[2];
 2434|  4.00k|                op[3] = match[3];
 2435|  4.00k|                match += inc32table[offset];
 2436|  4.00k|                LZ4_memcpy(op+4, match, 4);
  ------------------
  |  |  350|  4.00k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2437|  4.00k|                match -= dec64table[offset];
 2438|  4.00k|            } else {
 2439|  1.56k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  1.56k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2440|  1.56k|                match += 8;
 2441|  1.56k|            }
 2442|  5.57k|            op += 8;
 2443|       |
 2444|  5.57k|            if (unlikely(cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  181|  5.57k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  5.57k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 1.71k, False: 3.86k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2445|  1.71k|                BYTE* const oCopyLimit = oend - (WILDCOPYLENGTH-1);
  ------------------
  |  |  245|  1.71k|#define WILDCOPYLENGTH 8
  ------------------
 2446|  1.71k|                if (cpy > oend-LASTLITERALS) { goto _output_error; } /* Error : last LASTLITERALS bytes must be literals (uncompressed) */
  ------------------
  |  |  246|  1.71k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2446:21): [True: 0, False: 1.71k]
  ------------------
 2447|  1.71k|                if (op < oCopyLimit) {
  ------------------
  |  Branch (2447:21): [True: 671, False: 1.04k]
  ------------------
 2448|    671|                    LZ4_wildCopy8(op, match, oCopyLimit);
 2449|    671|                    match += oCopyLimit - op;
 2450|    671|                    op = oCopyLimit;
 2451|    671|                }
 2452|  2.54k|                while (op < cpy) { *op++ = *match++; }
  ------------------
  |  Branch (2452:24): [True: 831, False: 1.71k]
  ------------------
 2453|  3.86k|            } else {
 2454|  3.86k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  350|  3.86k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2455|  3.86k|                if (length > 16) { LZ4_wildCopy8(op+8, match+8, cpy); }
  ------------------
  |  Branch (2455:21): [True: 671, False: 3.19k]
  ------------------
 2456|  3.86k|            }
 2457|  5.57k|            op = cpy;   /* wildcopy correction */
 2458|  5.57k|        }
 2459|       |
 2460|       |        /* end of decoding */
 2461|  3.64k|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  290|  3.64k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2462|  3.64k|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2463|       |
 2464|       |        /* Overflow error detected */
 2465|      0|    _output_error:
 2466|      0|        return (int) (-(((const char*)ip)-src))-1;
 2467|  2.25k|    }
 2468|  2.25k|}
lz4.c:read_variable_length:
 1990|  8.18k|{
 1991|  8.18k|    Rvl_t s, length = 0;
 1992|  8.18k|    assert(ip != NULL);
  ------------------
  |  Branch (1992:5): [True: 0, False: 8.18k]
  |  Branch (1992:5): [True: 8.18k, False: 0]
  ------------------
 1993|  8.18k|    assert(*ip !=  NULL);
  ------------------
  |  Branch (1993:5): [True: 0, False: 8.18k]
  |  Branch (1993:5): [True: 8.18k, False: 0]
  ------------------
 1994|  8.18k|    assert(ilimit != NULL);
  ------------------
  |  Branch (1994:5): [True: 0, False: 8.18k]
  |  Branch (1994:5): [True: 8.18k, False: 0]
  ------------------
 1995|  8.18k|    if (initial_check && unlikely((*ip) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|    454|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|    454|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 454]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1995:9): [True: 454, False: 7.72k]
  ------------------
 1996|      0|        return rvl_error;
 1997|      0|    }
 1998|  8.18k|    s = **ip;
 1999|  8.18k|    (*ip)++;
 2000|  8.18k|    length += s;
 2001|  8.18k|    if (unlikely((*ip) > ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|  8.18k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  8.18k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 8.18k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2002|      0|        return rvl_error;
 2003|      0|    }
 2004|       |    /* accumulator overflow detection (32-bit mode only) */
 2005|  8.18k|    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 (2005:9): [Folded, False: 8.18k]
  ------------------
 2006|      0|        return rvl_error;
 2007|      0|    }
 2008|  8.18k|    if (likely(s != 255)) return length;
  ------------------
  |  |  178|  8.18k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  172|  8.18k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 5.23k, False: 2.95k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2009|  43.8k|    do {
 2010|  43.8k|        s = **ip;
 2011|  43.8k|        (*ip)++;
 2012|  43.8k|        length += s;
 2013|  43.8k|        if (unlikely((*ip) > ilimit)) {    /* read limit reached */
  ------------------
  |  |  181|  43.8k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  172|  43.8k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:33): [True: 0, False: 43.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2014|      0|            return rvl_error;
 2015|      0|        }
 2016|       |        /* accumulator overflow detection (32-bit mode only) */
 2017|  43.8k|        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 (2017:13): [Folded, False: 43.8k]
  ------------------
 2018|      0|            return rvl_error;
 2019|      0|        }
 2020|  43.8k|    } while (s == 255);
  ------------------
  |  Branch (2020:14): [True: 40.8k, False: 2.95k]
  ------------------
 2021|       |
 2022|  2.95k|    return length;
 2023|  2.95k|}
lz4.c:LZ4_wildCopy32:
  532|  3.65k|{
  533|  3.65k|    BYTE* d = (BYTE*)dstPtr;
  534|  3.65k|    const BYTE* s = (const BYTE*)srcPtr;
  535|  3.65k|    BYTE* const e = (BYTE*)dstEnd;
  536|       |
  537|  95.3k|    do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  350|  95.3k|#    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|  95.3k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (537:79): [True: 91.6k, False: 3.65k]
  ------------------
  538|  3.65k|}
lz4.c:LZ4_readLE16:
  432|  18.5k|{
  433|  18.5k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (433:9): [True: 18.5k, False: 0]
  ------------------
  434|  18.5k|        return LZ4_read16(memPtr);
  435|  18.5k|    } else {
  436|      0|        const BYTE* p = (const BYTE*)memPtr;
  437|      0|        return (U16)((U16)p[0] | (p[1]<<8));
  438|      0|    }
  439|  18.5k|}
lz4.c:LZ4_memcpy_using_offset:
  545|  5.82k|{
  546|  5.82k|    BYTE v[8];
  547|       |
  548|  5.82k|    assert(dstEnd >= dstPtr + MINMATCH);
  ------------------
  |  Branch (548:5): [True: 0, False: 5.82k]
  |  Branch (548:5): [True: 5.82k, False: 0]
  ------------------
  549|       |
  550|  5.82k|    switch(offset) {
  551|  1.70k|    case 1:
  ------------------
  |  Branch (551:5): [True: 1.70k, False: 4.12k]
  ------------------
  552|  1.70k|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  237|  1.70k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  235|  1.70k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  553|  1.70k|        break;
  554|  2.80k|    case 2:
  ------------------
  |  Branch (554:5): [True: 2.80k, False: 3.02k]
  ------------------
  555|  2.80k|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  350|  2.80k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  556|  2.80k|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  350|  2.80k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  557|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  558|       |#  pragma warning(push)
  559|       |#  pragma warning(disable : 6385) /* warning C6385: Reading invalid data from 'v'. */
  560|       |#endif
  561|  2.80k|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  350|  2.80k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  562|       |#if defined(_MSC_VER) && (_MSC_VER <= 1937) /* MSVC 2022 ver 17.7 or earlier */
  563|       |#  pragma warning(pop)
  564|       |#endif
  565|  2.80k|        break;
  566|    309|    case 4:
  ------------------
  |  Branch (566:5): [True: 309, False: 5.51k]
  ------------------
  567|    309|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  350|    309|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  568|    309|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  350|    309|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  569|    309|        break;
  570|  1.01k|    default:
  ------------------
  |  Branch (570:5): [True: 1.01k, False: 4.81k]
  ------------------
  571|  1.01k|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  572|  1.01k|        return;
  573|  5.82k|    }
  574|       |
  575|  4.81k|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  350|  4.81k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  576|  4.81k|    dstPtr += 8;
  577|   959k|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (577:12): [True: 955k, False: 4.81k]
  ------------------
  578|   955k|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  350|   955k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  579|   955k|        dstPtr += 8;
  580|   955k|    }
  581|  4.81k|}
lz4.c:LZ4_memcpy_using_offset_base:
  493|  1.01k|{
  494|  1.01k|    assert(srcPtr + offset == dstPtr);
  ------------------
  |  Branch (494:5): [True: 0, False: 1.01k]
  |  Branch (494:5): [True: 1.01k, False: 0]
  ------------------
  495|  1.01k|    if (offset < 8) {
  ------------------
  |  Branch (495:9): [True: 912, False: 102]
  ------------------
  496|    912|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  497|    912|        assert(offset != 1);   /* offset==0 happens on testing */
  ------------------
  |  Branch (497:9): [True: 0, False: 912]
  |  Branch (497:9): [True: 912, False: 0]
  ------------------
  498|    912|        LZ4_memcpy(dstPtr, srcPtr, 2);
  ------------------
  |  |  350|    912|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  499|    912|        LZ4_memcpy(dstPtr + 2, srcPtr + 2, 2);
  ------------------
  |  |  350|    912|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  500|    912|        srcPtr += inc32table[offset];
  501|    912|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  350|    912|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  502|    912|        srcPtr -= dec64table[offset];
  503|    912|        dstPtr += 8;
  504|    912|    } else {
  505|    102|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  350|    102|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  506|    102|        dstPtr += 8;
  507|    102|        srcPtr += 8;
  508|    102|    }
  509|       |
  510|  1.01k|    LZ4_wildCopy8(dstPtr, srcPtr, dstEnd);
  511|  1.01k|}

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

FUZZ_dataProducer_create:
    8|  2.11k|FUZZ_dataProducer_t* FUZZ_dataProducer_create(const uint8_t* data, size_t size) {
    9|  2.11k|  FUZZ_dataProducer_t* const producer = malloc(sizeof(FUZZ_dataProducer_t));
   10|       |
   11|  2.11k|  FUZZ_ASSERT(producer != NULL);
  ------------------
  |  |   47|  2.11k|#define FUZZ_ASSERT(cond) FUZZ_ASSERT_MSG((cond), "")
  |  |  ------------------
  |  |  |  |   43|  2.11k|  ((cond) ? (void)0                                                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:4): [True: 2.11k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   44|  2.11k|          : (fprintf(stderr, "%s: %u: Assertion: `%s' failed. %s\n", __FILE__, \
  |  |  |  |   45|      0|                     __LINE__, FUZZ_QUOTE(cond), (msg)),                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      0|#define FUZZ_QUOTE(str) FUZZ_QUOTE_IMPL(str)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   36|      0|#define FUZZ_QUOTE_IMPL(str) #str
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   46|      0|             abort()))
  |  |  ------------------
  ------------------
   12|       |
   13|  2.11k|  producer->data = data;
   14|  2.11k|  producer->size = size;
   15|  2.11k|  return producer;
   16|  2.11k|}
FUZZ_dataProducer_free:
   18|  2.11k|void FUZZ_dataProducer_free(FUZZ_dataProducer_t *producer) { free(producer); }
FUZZ_dataProducer_retrieve32:
   20|  2.11k|uint32_t FUZZ_dataProducer_retrieve32(FUZZ_dataProducer_t *producer) {
   21|  2.11k|    const uint8_t* data = producer->data;
   22|  2.11k|    const size_t size = producer->size;
   23|  2.11k|    if (size == 0) {
  ------------------
  |  Branch (23:9): [True: 0, False: 2.11k]
  ------------------
   24|      0|        return 0;
   25|  2.11k|    } else if (size < 4) {
  ------------------
  |  Branch (25:16): [True: 16, False: 2.09k]
  ------------------
   26|     16|        producer->size -= 1;
   27|     16|        return (uint32_t)data[size - 1];
   28|  2.09k|    } else {
   29|  2.09k|        producer->size -= 4;
   30|  2.09k|        return *(data + size - 4);
   31|  2.09k|    }
   32|  2.11k|}
FUZZ_getRange_from_uint32:
   35|  2.11k|{
   36|  2.11k|    uint32_t range = max - min;
   37|  2.11k|    if (range == 0xffffffff) {
  ------------------
  |  Branch (37:9): [True: 0, False: 2.11k]
  ------------------
   38|      0|      return seed;
   39|      0|    }
   40|  2.11k|    return min + seed % (range + 1);
   41|  2.11k|}
FUZZ_dataProducer_remainingBytes:
   75|  2.11k|size_t FUZZ_dataProducer_remainingBytes(FUZZ_dataProducer_t *producer){
   76|  2.11k|  return producer->size;
   77|  2.11k|}

