LZ4_compressBound:
  733|  6.88k|int LZ4_compressBound(int isize)  { return LZ4_COMPRESSBOUND(isize); }
  ------------------
  |  |  213|  6.88k|#define LZ4_COMPRESSBOUND(isize)  ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
  |  |  ------------------
  |  |  |  |  212|  6.88k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  |  |  ------------------
  |  |  |  Branch (213:36): [True: 0, False: 6.88k]
  |  |  ------------------
  ------------------
LZ4_compress_fast_extState:
 1357|  2.66k|{
 1358|  2.66k|    LZ4_stream_t_internal* const ctx = & LZ4_initStream(state, sizeof(LZ4_stream_t)) -> internal_donotuse;
 1359|  2.66k|    assert(ctx != NULL);
 1360|  2.66k|    if (acceleration < 1) acceleration = LZ4_ACCELERATION_DEFAULT;
  ------------------
  |  |   52|      0|#define LZ4_ACCELERATION_DEFAULT 1
  ------------------
  |  Branch (1360:9): [True: 0, False: 2.66k]
  ------------------
 1361|  2.66k|    if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX;
  ------------------
  |  |   58|  2.66k|#define LZ4_ACCELERATION_MAX 65537
  ------------------
                  if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX;
  ------------------
  |  |   58|      0|#define LZ4_ACCELERATION_MAX 65537
  ------------------
  |  Branch (1361:9): [True: 0, False: 2.66k]
  ------------------
 1362|  2.66k|    if (maxOutputSize >= LZ4_compressBound(inputSize)) {
  ------------------
  |  Branch (1362:9): [True: 1.08k, False: 1.58k]
  ------------------
 1363|  1.08k|        if (inputSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1363:13): [True: 1.08k, False: 0]
  ------------------
 1364|  1.08k|            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, 0, notLimited, byU16, noDict, noDictIssue, acceleration);
 1365|  1.08k|        } else {
 1366|      0|            const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)source > LZ4_DISTANCE_MAX)) ? byPtr : byU32;
  ------------------
  |  |  653|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1366:44): [Folded - Ignored]
  |  Branch (1366:66): [True: 0, False: 0]
  ------------------
 1367|      0|            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, 0, notLimited, tableType, noDict, noDictIssue, acceleration);
 1368|      0|        }
 1369|  1.58k|    } else {
 1370|  1.58k|        if (inputSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1370:13): [True: 1.22k, False: 357]
  ------------------
 1371|  1.22k|            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, byU16, noDict, noDictIssue, acceleration);
 1372|  1.22k|        } else {
 1373|    357|            const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)source > LZ4_DISTANCE_MAX)) ? byPtr : byU32;
  ------------------
  |  |  653|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1373:44): [Folded - Ignored]
  |  Branch (1373:66): [True: 0, False: 0]
  ------------------
 1374|    357|            return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, noDict, noDictIssue, acceleration);
 1375|    357|        }
 1376|  1.58k|    }
 1377|  2.66k|}
LZ4_compress_fast:
 1428|  2.12k|{
 1429|  2.12k|    int result;
 1430|       |#if (LZ4_HEAPMODE)
 1431|       |    LZ4_stream_t* const ctxPtr = (LZ4_stream_t*)ALLOC(sizeof(LZ4_stream_t));   /* malloc-calloc always properly aligned */
 1432|       |    if (ctxPtr == NULL) return 0;
 1433|       |#else
 1434|  2.12k|    LZ4_stream_t ctx;
 1435|  2.12k|    LZ4_stream_t* const ctxPtr = &ctx;
 1436|  2.12k|#endif
 1437|  2.12k|    result = LZ4_compress_fast_extState(ctxPtr, src, dest, srcSize, dstCapacity, acceleration);
 1438|       |
 1439|       |#if (LZ4_HEAPMODE)
 1440|       |    FREEMEM(ctxPtr);
 1441|       |#endif
 1442|  2.12k|    return result;
 1443|  2.12k|}
LZ4_compress_default:
 1447|  2.12k|{
 1448|  2.12k|    return LZ4_compress_fast(src, dst, srcSize, dstCapacity, 1);
 1449|  2.12k|}
LZ4_compress_destSize:
 1473|  2.09k|{
 1474|       |#if (LZ4_HEAPMODE)
 1475|       |    LZ4_stream_t* const ctx = (LZ4_stream_t*)ALLOC(sizeof(LZ4_stream_t));   /* malloc-calloc always properly aligned */
 1476|       |    if (ctx == NULL) return 0;
 1477|       |#else
 1478|  2.09k|    LZ4_stream_t ctxBody;
 1479|  2.09k|    LZ4_stream_t* const ctx = &ctxBody;
 1480|  2.09k|#endif
 1481|       |
 1482|  2.09k|    int result = LZ4_compress_destSize_extState(ctx, src, dst, srcSizePtr, targetDstSize);
 1483|       |
 1484|       |#if (LZ4_HEAPMODE)
 1485|       |    FREEMEM(ctx);
 1486|       |#endif
 1487|  2.09k|    return result;
 1488|  2.09k|}
LZ4_initStream:
 1519|  4.76k|{
 1520|  4.76k|    DEBUGLOG(5, "LZ4_initStream");
  ------------------
  |  |  288|  4.76k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1521|  4.76k|    if (buffer == NULL) { return NULL; }
  ------------------
  |  Branch (1521:9): [True: 0, False: 4.76k]
  ------------------
 1522|  4.76k|    if (size < sizeof(LZ4_stream_t)) { return NULL; }
  ------------------
  |  Branch (1522:9): [True: 0, False: 4.76k]
  ------------------
 1523|  4.76k|    if (!LZ4_isAligned(buffer, LZ4_stream_t_alignment())) return NULL;
  ------------------
  |  Branch (1523:9): [True: 0, False: 4.76k]
  ------------------
 1524|  4.76k|    MEM_INIT(buffer, 0, sizeof(LZ4_stream_t_internal));
  ------------------
  |  |  235|  4.76k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  233|  4.76k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 1525|  4.76k|    return (LZ4_stream_t*)buffer;
 1526|  4.76k|}
LZ4_decompress_safe:
 2374|  3.57k|{
 2375|  3.57k|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2376|  3.57k|                                  decode_full_block, noDict,
 2377|  3.57k|                                  (BYTE*)dest, NULL, 0);
 2378|  3.57k|}
lz4.c:LZ4_compress_generic:
 1330|  4.22k|{
 1331|  4.22k|    DEBUGLOG(5, "LZ4_compress_generic: srcSize=%i, dstCapacity=%i",
  ------------------
  |  |  288|  4.22k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1332|  4.22k|                srcSize, dstCapacity);
 1333|       |
 1334|  4.22k|    if ((U32)srcSize > (U32)LZ4_MAX_INPUT_SIZE) { return 0; }  /* Unsupported srcSize, too large (or negative) */
  ------------------
  |  |  212|  4.22k|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  ------------------
  |  Branch (1334:9): [True: 0, False: 4.22k]
  ------------------
 1335|  4.22k|    if (srcSize == 0) {   /* src == NULL supported if srcSize == 0 */
  ------------------
  |  Branch (1335:9): [True: 17, False: 4.20k]
  ------------------
 1336|     17|        if (outputDirective != notLimited && dstCapacity <= 0) return 0;  /* no output, can't write anything */
  ------------------
  |  Branch (1336:13): [True: 13, False: 4]
  |  Branch (1336:46): [True: 1, False: 12]
  ------------------
 1337|     16|        DEBUGLOG(5, "Generating an empty block");
  ------------------
  |  |  288|     16|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1338|     16|        assert(outputDirective == notLimited || dstCapacity >= 1);
 1339|     16|        assert(dst != NULL);
 1340|     16|        dst[0] = 0;
 1341|     16|        if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1341:13): [True: 6, False: 10]
  ------------------
 1342|      6|            assert (inputConsumed != NULL);
 1343|      6|            *inputConsumed = 0;
 1344|      6|        }
 1345|     16|        return 1;
 1346|     16|    }
 1347|  4.20k|    assert(src != NULL);
 1348|       |
 1349|  4.20k|    return LZ4_compress_generic_validated(cctx, src, dst, srcSize,
 1350|  4.20k|                inputConsumed, /* only written into if outputDirective == fillOutput */
 1351|  4.20k|                dstCapacity, outputDirective,
 1352|  4.20k|                tableType, dictDirective, dictIssue, acceleration);
 1353|  4.20k|}
lz4.c:LZ4_compress_generic_validated:
  919|  4.20k|{
  920|  4.20k|    int result;
  921|  4.20k|    const BYTE* ip = (const BYTE*)source;
  922|       |
  923|  4.20k|    U32 const startIndex = cctx->currentOffset;
  924|  4.20k|    const BYTE* base = (const BYTE*)source - startIndex;
  925|  4.20k|    const BYTE* lowLimit;
  926|       |
  927|  4.20k|    const LZ4_stream_t_internal* dictCtx = (const LZ4_stream_t_internal*) cctx->dictCtx;
  928|  4.20k|    const BYTE* const dictionary =
  929|  4.20k|        dictDirective == usingDictCtx ? dictCtx->dictionary : cctx->dictionary;
  ------------------
  |  Branch (929:9): [True: 0, False: 4.20k]
  ------------------
  930|  4.20k|    const U32 dictSize =
  931|  4.20k|        dictDirective == usingDictCtx ? dictCtx->dictSize : cctx->dictSize;
  ------------------
  |  Branch (931:9): [True: 0, False: 4.20k]
  ------------------
  932|  4.20k|    const U32 dictDelta =
  933|  4.20k|        (dictDirective == usingDictCtx) ? startIndex - dictCtx->currentOffset : 0;   /* make indexes in dictCtx comparable with indexes in current context */
  ------------------
  |  Branch (933:9): [True: 0, False: 4.20k]
  ------------------
  934|       |
  935|  4.20k|    int const maybe_extMem = (dictDirective == usingExtDict) || (dictDirective == usingDictCtx);
  ------------------
  |  Branch (935:30): [True: 0, False: 4.20k]
  |  Branch (935:65): [True: 0, False: 4.20k]
  ------------------
  936|  4.20k|    U32 const prefixIdxLimit = startIndex - dictSize;   /* used when dictDirective == dictSmall */
  937|  4.20k|    const BYTE* const dictEnd = dictionary ? dictionary + dictSize : dictionary;
  ------------------
  |  Branch (937:33): [True: 0, False: 4.20k]
  ------------------
  938|  4.20k|    const BYTE* anchor = (const BYTE*) source;
  939|  4.20k|    const BYTE* const iend = ip + inputSize;
  940|  4.20k|    const BYTE* const mflimitPlusOne = iend - MFLIMIT + 1;
  ------------------
  |  |  245|  4.20k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  941|  4.20k|    const BYTE* const matchlimit = iend - LASTLITERALS;
  ------------------
  |  |  244|  4.20k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  942|       |
  943|       |    /* the dictCtx currentOffset is indexed on the start of the dictionary,
  944|       |     * while a dictionary in the current context precedes the currentOffset */
  945|  4.20k|    const BYTE* dictBase = (dictionary == NULL) ? NULL :
  ------------------
  |  Branch (945:28): [True: 4.20k, False: 0]
  ------------------
  946|  4.20k|                           (dictDirective == usingDictCtx) ?
  ------------------
  |  Branch (946:28): [True: 0, False: 0]
  ------------------
  947|      0|                            dictionary + dictSize - dictCtx->currentOffset :
  948|      0|                            dictionary + dictSize - startIndex;
  949|       |
  950|  4.20k|    BYTE* op = (BYTE*) dest;
  951|  4.20k|    BYTE* const olimit = op + maxOutputSize;
  952|       |
  953|  4.20k|    U32 offset = 0;
  954|  4.20k|    U32 forwardH;
  955|       |
  956|  4.20k|    DEBUGLOG(5, "LZ4_compress_generic_validated: srcSize=%i, tableType=%u", inputSize, tableType);
  ------------------
  |  |  288|  4.20k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  957|  4.20k|    assert(ip != NULL);
  958|  4.20k|    if (tableType == byU16) assert(inputSize<LZ4_64Klimit);  /* Size too large (not within 64K limit) */
  ------------------
  |  Branch (958:9): [True: 3.49k, False: 704]
  ------------------
  959|  4.20k|    if (tableType == byPtr) assert(dictDirective==noDict);   /* only supported use case with byPtr */
  ------------------
  |  Branch (959:9): [True: 0, False: 4.20k]
  ------------------
  960|       |    /* If init conditions are not met, we don't have to mark stream
  961|       |     * as having dirty context, since no action was taken yet */
  962|  4.20k|    if (outputDirective == fillOutput && maxOutputSize < 1) { return 0; } /* Impossible to store anything */
  ------------------
  |  Branch (962:9): [True: 1.54k, False: 2.65k]
  |  Branch (962:42): [True: 0, False: 1.54k]
  ------------------
  963|  4.20k|    assert(acceleration >= 1);
  964|       |
  965|  4.20k|    lowLimit = (const BYTE*)source - (dictDirective == withPrefix64k ? dictSize : 0);
  ------------------
  |  Branch (965:39): [True: 0, False: 4.20k]
  ------------------
  966|       |
  967|       |    /* Update context state */
  968|  4.20k|    if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (968:9): [True: 0, False: 4.20k]
  ------------------
  969|       |        /* Subsequent linked blocks can't use the dictionary. */
  970|       |        /* Instead, they use the block we just compressed. */
  971|      0|        cctx->dictCtx = NULL;
  972|      0|        cctx->dictSize = (U32)inputSize;
  973|  4.20k|    } else {
  974|  4.20k|        cctx->dictSize += (U32)inputSize;
  975|  4.20k|    }
  976|  4.20k|    cctx->currentOffset += (U32)inputSize;
  977|  4.20k|    cctx->tableType = (U32)tableType;
  978|       |
  979|  4.20k|    if (inputSize<LZ4_minLength) goto _last_literals;        /* Input too small, no compression (all literals) */
  ------------------
  |  Branch (979:9): [True: 56, False: 4.14k]
  ------------------
  980|       |
  981|       |    /* First Byte */
  982|  4.14k|    {   U32 const h = LZ4_hashPosition(ip, tableType);
  983|  4.14k|        if (tableType == byPtr) {
  ------------------
  |  Branch (983:13): [True: 0, False: 4.14k]
  ------------------
  984|      0|            LZ4_putPositionOnHash(ip, h, cctx->hashTable, byPtr);
  985|  4.14k|        } else {
  986|  4.14k|            LZ4_putIndexOnHash(startIndex, h, cctx->hashTable, tableType);
  987|  4.14k|    }   }
  988|  4.14k|    ip++; forwardH = LZ4_hashPosition(ip, tableType);
  989|       |
  990|       |    /* Main Loop */
  991|  19.3k|    for ( ; ; ) {
  992|  19.3k|        const BYTE* match;
  993|  19.3k|        BYTE* token;
  994|  19.3k|        const BYTE* filledIp;
  995|       |
  996|       |        /* Find a match */
  997|  19.3k|        if (tableType == byPtr) {
  ------------------
  |  Branch (997:13): [True: 0, False: 19.3k]
  ------------------
  998|      0|            const BYTE* forwardIp = ip;
  999|      0|            int step = 1;
 1000|      0|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1001|      0|            do {
 1002|      0|                U32 const h = forwardH;
 1003|      0|                ip = forwardIp;
 1004|      0|                forwardIp += step;
 1005|      0|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1006|       |
 1007|      0|                if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
  ------------------
  |  |  179|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1008|      0|                assert(ip < mflimitPlusOne);
 1009|       |
 1010|      0|                match = LZ4_getPositionOnHash(h, cctx->hashTable, tableType);
 1011|      0|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1012|      0|                LZ4_putPositionOnHash(ip, h, cctx->hashTable, tableType);
 1013|       |
 1014|      0|            } while ( (match+LZ4_DISTANCE_MAX < ip)
  ------------------
  |  |  653|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1014:23): [True: 0, False: 0]
  ------------------
 1015|      0|                   || (LZ4_read32(match) != LZ4_read32(ip)) );
  ------------------
  |  Branch (1015:23): [True: 0, False: 0]
  ------------------
 1016|       |
 1017|  19.3k|        } else {   /* byU32, byU16 */
 1018|       |
 1019|  19.3k|            const BYTE* forwardIp = ip;
 1020|  19.3k|            int step = 1;
 1021|  19.3k|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1022|   398k|            do {
 1023|   398k|                U32 const h = forwardH;
 1024|   398k|                U32 const current = (U32)(forwardIp - base);
 1025|   398k|                U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1026|   398k|                assert(matchIndex <= current);
 1027|   398k|                assert(forwardIp - base < (ptrdiff_t)(2 GB - 1));
 1028|   398k|                ip = forwardIp;
 1029|   398k|                forwardIp += step;
 1030|   398k|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1031|       |
 1032|   398k|                if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
  ------------------
  |  |  179|   398k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|   398k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 1.59k, False: 397k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1033|   397k|                assert(ip < mflimitPlusOne);
 1034|       |
 1035|   397k|                if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1035:21): [True: 0, False: 397k]
  ------------------
 1036|      0|                    if (matchIndex < startIndex) {
  ------------------
  |  Branch (1036:25): [True: 0, False: 0]
  ------------------
 1037|       |                        /* there was no match, try the dictionary */
 1038|      0|                        assert(tableType == byU32);
 1039|      0|                        matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32);
 1040|      0|                        match = dictBase + matchIndex;
 1041|      0|                        matchIndex += dictDelta;   /* make dictCtx index comparable with current context */
 1042|      0|                        lowLimit = dictionary;
 1043|      0|                    } else {
 1044|      0|                        match = base + matchIndex;
 1045|      0|                        lowLimit = (const BYTE*)source;
 1046|      0|                    }
 1047|   397k|                } else if (dictDirective == usingExtDict) {
  ------------------
  |  Branch (1047:28): [True: 0, False: 397k]
  ------------------
 1048|      0|                    if (matchIndex < startIndex) {
  ------------------
  |  Branch (1048:25): [True: 0, False: 0]
  ------------------
 1049|      0|                        DEBUGLOG(7, "extDict candidate: matchIndex=%5u  <  startIndex=%5u", matchIndex, startIndex);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1050|      0|                        assert(startIndex - matchIndex >= MINMATCH);
 1051|      0|                        assert(dictBase);
 1052|      0|                        match = dictBase + matchIndex;
 1053|      0|                        lowLimit = dictionary;
 1054|      0|                    } else {
 1055|      0|                        match = base + matchIndex;
 1056|      0|                        lowLimit = (const BYTE*)source;
 1057|      0|                    }
 1058|   397k|                } else {   /* single continuous memory segment */
 1059|   397k|                    match = base + matchIndex;
 1060|   397k|                }
 1061|   397k|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1062|   397k|                LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1063|       |
 1064|   397k|                DEBUGLOG(7, "candidate at pos=%u  (offset=%u \n", matchIndex, current - matchIndex);
  ------------------
  |  |  288|   397k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1065|   397k|                if ((dictIssue == dictSmall) && (matchIndex < prefixIdxLimit)) { continue; }    /* match outside of valid area */
  ------------------
  |  Branch (1065:21): [True: 0, False: 397k]
  |  Branch (1065:49): [True: 0, False: 0]
  ------------------
 1066|   397k|                assert(matchIndex < current);
 1067|   397k|                if ( ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  653|  61.5k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                              if ( ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  254|  61.5k|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
  |  Branch (1067:23): [True: 335k, False: 61.5k]
  |  Branch (1067:47): [Folded - Ignored]
  ------------------
 1068|   397k|                  && (matchIndex+LZ4_DISTANCE_MAX < current)) {
  ------------------
  |  |  653|   335k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1068:22): [True: 120k, False: 215k]
  ------------------
 1069|   120k|                    continue;
 1070|   120k|                } /* too far */
 1071|   276k|                assert((current - matchIndex) <= LZ4_DISTANCE_MAX);  /* match now expected within distance */
 1072|       |
 1073|   276k|                if (LZ4_read32(match) == LZ4_read32(ip)) {
  ------------------
  |  Branch (1073:21): [True: 17.7k, False: 259k]
  ------------------
 1074|  17.7k|                    if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1074:25): [True: 0, False: 17.7k]
  ------------------
 1075|  17.7k|                    break;   /* match found */
 1076|  17.7k|                }
 1077|       |
 1078|   379k|            } while(1);
  ------------------
  |  Branch (1078:21): [Folded - Ignored]
  ------------------
 1079|  19.3k|        }
 1080|       |
 1081|       |        /* Catch up */
 1082|  17.7k|        filledIp = ip;
 1083|  21.5k|        while (((ip>anchor) & (match > lowLimit)) && (unlikely(ip[-1]==match[-1]))) { ip--; match--; }
  ------------------
  |  |  179|  18.2k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  18.2k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1083:16): [True: 18.2k, False: 3.32k]
  |  Branch (1083:54): [True: 3.78k, False: 14.4k]
  ------------------
 1084|       |
 1085|       |        /* Encode Literals */
 1086|  17.7k|        {   unsigned const litLength = (unsigned)(ip - anchor);
 1087|  17.7k|            token = op++;
 1088|  17.7k|            if ((outputDirective == limitedOutput) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1088:17): [True: 8.16k, False: 9.60k]
  ------------------
 1089|  17.7k|                (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength/255) > olimit)) ) {
  ------------------
  |  |  179|  8.16k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  8.16k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1089:17): [True: 209, False: 7.95k]
  ------------------
 1090|    209|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1091|    209|            }
 1092|  17.5k|            if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1092:17): [True: 8.11k, False: 9.44k]
  ------------------
 1093|  17.5k|                (unlikely(op + (litLength+240)/255 /* litlen */ + litLength /* literals */ + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit))) {
  ------------------
  |  |  179|  8.11k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  8.11k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1093:17): [True: 265, False: 7.85k]
  ------------------
 1094|    265|                op--;
 1095|    265|                goto _last_literals;
 1096|    265|            }
 1097|  17.2k|            if (litLength >= RUN_MASK) {
  ------------------
  |  |  262|  17.2k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  17.2k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  17.2k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1097:17): [True: 880, False: 16.4k]
  ------------------
 1098|    880|                int len = (int)(litLength - RUN_MASK);
  ------------------
  |  |  262|    880|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|    880|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|    880|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1099|    880|                *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  262|    880|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|    880|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|    880|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                              *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  259|    880|#define ML_BITS  4
  ------------------
 1100|    880|                for(; len >= 255 ; len-=255) *op++ = 255;
  ------------------
  |  Branch (1100:23): [True: 0, False: 880]
  ------------------
 1101|    880|                *op++ = (BYTE)len;
 1102|    880|            }
 1103|  16.4k|            else *token = (BYTE)(litLength<<ML_BITS);
  ------------------
  |  |  259|  16.4k|#define ML_BITS  4
  ------------------
 1104|       |
 1105|       |            /* Copy Literals */
 1106|  17.2k|            LZ4_wildCopy8(op, anchor, op+litLength);
 1107|  17.2k|            op+=litLength;
 1108|  17.2k|            DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  288|  17.2k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1109|  17.2k|                        (int)(anchor-(const BYTE*)source), litLength, (int)(ip-(const BYTE*)source));
 1110|  17.2k|        }
 1111|       |
 1112|  29.7k|_next_match:
 1113|       |        /* at this stage, the following variables must be correctly set :
 1114|       |         * - ip : at start of LZ operation
 1115|       |         * - match : at start of previous pattern occurrence; can be within current prefix, or within extDict
 1116|       |         * - offset : if maybe_ext_memSegment==1 (constant)
 1117|       |         * - lowLimit : must be == dictionary to mean "match is within extDict"; must be == source otherwise
 1118|       |         * - token and *token : position to write 4-bits for match length; higher 4-bits for literal length supposed already written
 1119|       |         */
 1120|       |
 1121|  29.7k|        if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1121:13): [True: 13.9k, False: 15.8k]
  ------------------
 1122|  29.7k|            (op + 2 /* offset */ + 1 /* token */ + MFLIMIT - MINMATCH /* min last literals so last match is <= end - MFLIMIT */ > olimit)) {
  ------------------
  |  |  245|  13.9k|#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)) {
  ------------------
  |  |  241|  13.9k|#define MINMATCH 4
  ------------------
  |  Branch (1122:13): [True: 248, False: 13.6k]
  ------------------
 1123|       |            /* the match was too close to the end, rewind and go to last literals */
 1124|    248|            op = token;
 1125|    248|            goto _last_literals;
 1126|    248|        }
 1127|       |
 1128|       |        /* Encode Offset */
 1129|  29.4k|        if (maybe_extMem) {   /* static test */
  ------------------
  |  Branch (1129:13): [True: 0, False: 29.4k]
  ------------------
 1130|      0|            DEBUGLOG(6, "             with offset=%u  (ext if > %i)", offset, (int)(ip - (const BYTE*)source));
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1131|      0|            assert(offset <= LZ4_DISTANCE_MAX && offset > 0);
 1132|      0|            LZ4_writeLE16(op, (U16)offset); op+=2;
 1133|  29.4k|        } else  {
 1134|  29.4k|            DEBUGLOG(6, "             with offset=%u  (same segment)", (U32)(ip - match));
  ------------------
  |  |  288|  29.4k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1135|  29.4k|            assert(ip-match <= LZ4_DISTANCE_MAX);
 1136|  29.4k|            LZ4_writeLE16(op, (U16)(ip - match)); op+=2;
 1137|  29.4k|        }
 1138|       |
 1139|       |        /* Encode MatchLength */
 1140|  29.4k|        {   unsigned matchCode;
 1141|       |
 1142|  29.4k|            if ( (dictDirective==usingExtDict || dictDirective==usingDictCtx)
  ------------------
  |  Branch (1142:19): [True: 0, False: 29.4k]
  |  Branch (1142:50): [True: 0, False: 29.4k]
  ------------------
 1143|  29.4k|              && (lowLimit==dictionary) /* match within extDict */ ) {
  ------------------
  |  Branch (1143:18): [True: 0, False: 0]
  ------------------
 1144|      0|                const BYTE* limit = ip + (dictEnd-match);
 1145|      0|                assert(dictEnd > match);
 1146|      0|                if (limit > matchlimit) limit = matchlimit;
  ------------------
  |  Branch (1146:21): [True: 0, False: 0]
  ------------------
 1147|      0|                matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, limit);
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
                              matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, limit);
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
 1148|      0|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
 1149|      0|                if (ip==limit) {
  ------------------
  |  Branch (1149:21): [True: 0, False: 0]
  ------------------
 1150|      0|                    unsigned const more = LZ4_count(limit, (const BYTE*)source, matchlimit);
 1151|      0|                    matchCode += more;
 1152|      0|                    ip += more;
 1153|      0|                }
 1154|      0|                DEBUGLOG(6, "             with matchLength=%u starting in extDict", matchCode+MINMATCH);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1155|  29.4k|            } else {
 1156|  29.4k|                matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  241|  29.4k|#define MINMATCH 4
  ------------------
                              matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  241|  29.4k|#define MINMATCH 4
  ------------------
 1157|  29.4k|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  241|  29.4k|#define MINMATCH 4
  ------------------
 1158|  29.4k|                DEBUGLOG(6, "             with matchLength=%u", matchCode+MINMATCH);
  ------------------
  |  |  288|  29.4k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1159|  29.4k|            }
 1160|       |
 1161|  29.4k|            if ((outputDirective) &&    /* Check output buffer overflow */
  ------------------
  |  Branch (1161:17): [True: 27.5k, False: 1.91k]
  ------------------
 1162|  29.4k|                (unlikely(op + (1 + LASTLITERALS) + (matchCode+240)/255 > olimit)) ) {
  ------------------
  |  |  179|  27.5k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  27.5k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1162:17): [True: 456, False: 27.1k]
  ------------------
 1163|    456|                if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1163:21): [True: 182, False: 274]
  ------------------
 1164|       |                    /* Match description too long : reduce it */
 1165|    182|                    U32 newMatchCode = 15 /* in token */ - 1 /* to avoid needing a zero byte */ + ((U32)(olimit - op) - 1 - LASTLITERALS) * 255;
  ------------------
  |  |  244|    182|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1166|    182|                    ip -= matchCode - newMatchCode;
 1167|    182|                    assert(newMatchCode < matchCode);
 1168|    182|                    matchCode = newMatchCode;
 1169|    182|                    if (unlikely(ip <= filledIp)) {
  ------------------
  |  |  179|    182|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|    182|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 182]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1170|       |                        /* We have already filled up to filledIp so if ip ends up less than filledIp
 1171|       |                         * we have positions in the hash table beyond the current position. This is
 1172|       |                         * a problem if we reuse the hash table. So we have to remove these positions
 1173|       |                         * from the hash table.
 1174|       |                         */
 1175|      0|                        const BYTE* ptr;
 1176|      0|                        DEBUGLOG(5, "Clearing %u positions", (U32)(filledIp - ip));
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1177|      0|                        for (ptr = ip; ptr <= filledIp; ++ptr) {
  ------------------
  |  Branch (1177:40): [True: 0, False: 0]
  ------------------
 1178|      0|                            U32 const h = LZ4_hashPosition(ptr, tableType);
 1179|      0|                            LZ4_clearHash(h, cctx->hashTable, tableType);
 1180|      0|                        }
 1181|      0|                    }
 1182|    274|                } else {
 1183|    274|                    assert(outputDirective == limitedOutput);
 1184|    274|                    return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1185|    274|                }
 1186|    456|            }
 1187|  29.2k|            if (matchCode >= ML_MASK) {
  ------------------
  |  |  260|  29.2k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  29.2k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (1187:17): [True: 14.2k, False: 14.9k]
  ------------------
 1188|  14.2k|                *token += ML_MASK;
  ------------------
  |  |  260|  14.2k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  14.2k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1189|  14.2k|                matchCode -= ML_MASK;
  ------------------
  |  |  260|  14.2k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  14.2k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1190|  14.2k|                LZ4_write32(op, 0xFFFFFFFF);
 1191|  33.9k|                while (matchCode >= 4*255) {
  ------------------
  |  Branch (1191:24): [True: 19.7k, False: 14.2k]
  ------------------
 1192|  19.7k|                    op+=4;
 1193|  19.7k|                    LZ4_write32(op, 0xFFFFFFFF);
 1194|  19.7k|                    matchCode -= 4*255;
 1195|  19.7k|                }
 1196|  14.2k|                op += matchCode / 255;
 1197|  14.2k|                *op++ = (BYTE)(matchCode % 255);
 1198|  14.2k|            } else
 1199|  14.9k|                *token += (BYTE)(matchCode);
 1200|  29.2k|        }
 1201|       |        /* Ensure we have enough space for the last literals. */
 1202|      0|        assert(!(outputDirective == fillOutput && op + 1 + LASTLITERALS > olimit));
 1203|       |
 1204|  29.2k|        anchor = ip;
 1205|       |
 1206|       |        /* Test end of chunk */
 1207|  29.2k|        if (ip >= mflimitPlusOne) break;
  ------------------
  |  Branch (1207:13): [True: 1.55k, False: 27.6k]
  ------------------
 1208|       |
 1209|       |        /* Fill table */
 1210|  27.6k|        {   U32 const h = LZ4_hashPosition(ip-2, tableType);
 1211|  27.6k|            if (tableType == byPtr) {
  ------------------
  |  Branch (1211:17): [True: 0, False: 27.6k]
  ------------------
 1212|      0|                LZ4_putPositionOnHash(ip-2, h, cctx->hashTable, byPtr);
 1213|  27.6k|            } else {
 1214|  27.6k|                U32 const idx = (U32)((ip-2) - base);
 1215|  27.6k|                LZ4_putIndexOnHash(idx, h, cctx->hashTable, tableType);
 1216|  27.6k|        }   }
 1217|       |
 1218|       |        /* Test next position */
 1219|  27.6k|        if (tableType == byPtr) {
  ------------------
  |  Branch (1219:13): [True: 0, False: 27.6k]
  ------------------
 1220|       |
 1221|      0|            match = LZ4_getPosition(ip, cctx->hashTable, tableType);
 1222|      0|            LZ4_putPosition(ip, cctx->hashTable, tableType);
 1223|      0|            if ( (match+LZ4_DISTANCE_MAX >= ip)
  ------------------
  |  |  653|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1223:18): [True: 0, False: 0]
  ------------------
 1224|      0|              && (LZ4_read32(match) == LZ4_read32(ip)) )
  ------------------
  |  Branch (1224:18): [True: 0, False: 0]
  ------------------
 1225|      0|            { token=op++; *token=0; goto _next_match; }
 1226|       |
 1227|  27.6k|        } else {   /* byU32, byU16 */
 1228|       |
 1229|  27.6k|            U32 const h = LZ4_hashPosition(ip, tableType);
 1230|  27.6k|            U32 const current = (U32)(ip-base);
 1231|  27.6k|            U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1232|  27.6k|            assert(matchIndex < current);
 1233|  27.6k|            if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1233:17): [True: 0, False: 27.6k]
  ------------------
 1234|      0|                if (matchIndex < startIndex) {
  ------------------
  |  Branch (1234:21): [True: 0, False: 0]
  ------------------
 1235|       |                    /* there was no match, try the dictionary */
 1236|      0|                    assert(tableType == byU32);
 1237|      0|                    matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32);
 1238|      0|                    match = dictBase + matchIndex;
 1239|      0|                    lowLimit = dictionary;   /* required for match length counter */
 1240|      0|                    matchIndex += dictDelta;
 1241|      0|                } else {
 1242|      0|                    match = base + matchIndex;
 1243|      0|                    lowLimit = (const BYTE*)source;  /* required for match length counter */
 1244|      0|                }
 1245|  27.6k|            } else if (dictDirective==usingExtDict) {
  ------------------
  |  Branch (1245:24): [True: 0, False: 27.6k]
  ------------------
 1246|      0|                if (matchIndex < startIndex) {
  ------------------
  |  Branch (1246:21): [True: 0, False: 0]
  ------------------
 1247|      0|                    assert(dictBase);
 1248|      0|                    match = dictBase + matchIndex;
 1249|      0|                    lowLimit = dictionary;   /* required for match length counter */
 1250|      0|                } else {
 1251|      0|                    match = base + matchIndex;
 1252|      0|                    lowLimit = (const BYTE*)source;   /* required for match length counter */
 1253|      0|                }
 1254|  27.6k|            } else {   /* single memory segment */
 1255|  27.6k|                match = base + matchIndex;
 1256|  27.6k|            }
 1257|  27.6k|            LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1258|  27.6k|            assert(matchIndex < current);
 1259|  27.6k|            if ( ((dictIssue==dictSmall) ? (matchIndex >= prefixIdxLimit) : 1)
  ------------------
  |  Branch (1259:18): [True: 27.6k, False: 0]
  |  Branch (1259:19): [True: 0, False: 27.6k]
  ------------------
 1260|  27.6k|              && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  653|  15.4k|#  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))
  ------------------
  |  |  254|  15.4k|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
                            && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  653|  12.2k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1260:18): [True: 27.6k, False: 0]
  |  Branch (1260:20): [True: 15.4k, False: 12.2k]
  |  Branch (1260:42): [Folded - Ignored]
  ------------------
 1261|  27.6k|              && (LZ4_read32(match) == LZ4_read32(ip)) ) {
  ------------------
  |  Branch (1261:18): [True: 12.4k, False: 15.2k]
  ------------------
 1262|  12.4k|                token=op++;
 1263|  12.4k|                *token=0;
 1264|  12.4k|                if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1264:21): [True: 0, False: 12.4k]
  ------------------
 1265|  12.4k|                DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  288|  12.4k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1266|  12.4k|                            (int)(anchor-(const BYTE*)source), 0, (int)(ip-(const BYTE*)source));
 1267|  12.4k|                goto _next_match;
 1268|  12.4k|            }
 1269|  27.6k|        }
 1270|       |
 1271|       |        /* Prepare next loop */
 1272|  15.2k|        forwardH = LZ4_hashPosition(++ip, tableType);
 1273|       |
 1274|  15.2k|    }
 1275|       |
 1276|  3.72k|_last_literals:
 1277|       |    /* Encode Last Literals */
 1278|  3.72k|    {   size_t lastRun = (size_t)(iend - anchor);
 1279|  3.72k|        if ( (outputDirective) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1279:14): [True: 2.64k, False: 1.08k]
  ------------------
 1280|  3.72k|            (op + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > olimit)) {
  ------------------
  |  |  262|  2.64k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  2.64k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  2.64k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1280:13): [True: 836, False: 1.80k]
  ------------------
 1281|    836|            if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1281:17): [True: 671, False: 165]
  ------------------
 1282|       |                /* adapt lastRun to fill 'dst' */
 1283|    671|                assert(olimit >= op);
 1284|    671|                lastRun  = (size_t)(olimit-op) - 1/*token*/;
 1285|    671|                lastRun -= (lastRun + 256 - RUN_MASK) / 256;  /*additional length tokens*/
  ------------------
  |  |  262|    671|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|    671|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|    671|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1286|    671|            } else {
 1287|    165|                assert(outputDirective == limitedOutput);
 1288|    165|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1289|    165|            }
 1290|    836|        }
 1291|  3.55k|        DEBUGLOG(6, "Final literal run : %i literals", (int)lastRun);
  ------------------
  |  |  288|  3.55k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1292|  3.55k|        if (lastRun >= RUN_MASK) {
  ------------------
  |  |  262|  3.55k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  3.55k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  3.55k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1292:13): [True: 398, False: 3.15k]
  ------------------
 1293|    398|            size_t accumulator = lastRun - RUN_MASK;
  ------------------
  |  |  262|    398|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|    398|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|    398|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1294|    398|            *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  262|    398|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|    398|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|    398|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  259|    398|#define ML_BITS  4
  ------------------
 1295|    398|            for(; accumulator >= 255 ; accumulator-=255) *op++ = 255;
  ------------------
  |  Branch (1295:19): [True: 0, False: 398]
  ------------------
 1296|    398|            *op++ = (BYTE) accumulator;
 1297|  3.15k|        } else {
 1298|  3.15k|            *op++ = (BYTE)(lastRun<<ML_BITS);
  ------------------
  |  |  259|  3.15k|#define ML_BITS  4
  ------------------
 1299|  3.15k|        }
 1300|  3.55k|        LZ4_memcpy(op, anchor, lastRun);
  ------------------
  |  |  348|  3.55k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 1301|  3.55k|        ip = anchor + lastRun;
 1302|  3.55k|        op += lastRun;
 1303|  3.55k|    }
 1304|       |
 1305|  3.55k|    if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1305:9): [True: 1.54k, False: 2.00k]
  ------------------
 1306|  1.54k|        *inputConsumed = (int) (((const char*)ip)-source);
 1307|  1.54k|    }
 1308|  3.55k|    result = (int)(((char*)op) - dest);
 1309|  3.55k|    assert(result > 0);
 1310|  3.55k|    DEBUGLOG(5, "LZ4_compress_generic: compressed %i bytes into %i bytes", inputSize, result);
  ------------------
  |  |  288|  3.55k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1311|  3.55k|    return result;
 1312|  3.55k|}
lz4.c:LZ4_read32:
  388|   718k|static U32 LZ4_read32(const void* ptr) { return ((const LZ4_unalign32*)ptr)->u32; }
lz4.c:LZ4_getIndexOnHash:
  831|   426k|{
  832|   426k|    LZ4_STATIC_ASSERT(LZ4_MEMORY_USAGE > 2);
  ------------------
  |  |  276|   426k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
  833|   426k|    if (tableType == byU32) {
  ------------------
  |  Branch (833:9): [True: 348k, False: 78.5k]
  ------------------
  834|   348k|        const U32* const hashTable = (const U32*) tableBase;
  835|   348k|        assert(h < (1U << (LZ4_MEMORY_USAGE-2)));
  836|   348k|        return hashTable[h];
  837|   348k|    }
  838|  78.5k|    if (tableType == byU16) {
  ------------------
  |  Branch (838:9): [True: 78.5k, False: 0]
  ------------------
  839|  78.5k|        const U16* const hashTable = (const U16*) tableBase;
  840|  78.5k|        assert(h < (1U << (LZ4_MEMORY_USAGE-1)));
  841|  78.5k|        return hashTable[h];
  842|  78.5k|    }
  843|      0|    assert(0); return 0;  /* forbidden case */
  844|      0|}
lz4.c:LZ4_wildCopy8:
  448|  23.5k|{
  449|  23.5k|    BYTE* d = (BYTE*)dstPtr;
  450|  23.5k|    const BYTE* s = (const BYTE*)srcPtr;
  451|  23.5k|    BYTE* const e = (BYTE*)dstEnd;
  452|       |
  453|   211k|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  348|   211k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (453:50): [True: 188k, False: 23.5k]
  ------------------
  454|  23.5k|}
lz4.c:LZ4_writeLE16:
  435|  29.4k|{
  436|  29.4k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (436:9): [True: 29.4k, False: 0]
  ------------------
  437|  29.4k|        LZ4_write16(memPtr, value);
  438|  29.4k|    } else {
  439|      0|        BYTE* p = (BYTE*)memPtr;
  440|      0|        p[0] = (BYTE) value;
  441|      0|        p[1] = (BYTE)(value>>8);
  442|      0|    }
  443|  29.4k|}
lz4.c:LZ4_isLittleEndian:
  363|   446k|{
  364|   446k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  365|   446k|    return one.c[0];
  366|   446k|}
lz4.c:LZ4_write16:
  391|  29.4k|static void LZ4_write16(void* memPtr, U16 value) { ((LZ4_unalign16*)memPtr)->u16 = value; }
lz4.c:LZ4_count:
  663|  29.4k|{
  664|  29.4k|    const BYTE* const pStart = pIn;
  665|       |
  666|  29.4k|    if (likely(pIn < pInLimit-(STEPSIZE-1))) {
  ------------------
  |  |  176|  29.4k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  170|  29.4k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 28.2k, False: 1.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  667|  28.2k|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  668|  28.2k|        if (!diff) {
  ------------------
  |  Branch (668:13): [True: 16.9k, False: 11.3k]
  ------------------
  669|  16.9k|            pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  660|  16.9k|#define STEPSIZE sizeof(reg_t)
  ------------------
                          pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  660|  16.9k|#define STEPSIZE sizeof(reg_t)
  ------------------
  670|  16.9k|        } else {
  671|  11.3k|            return LZ4_NbCommonBytes(diff);
  672|  11.3k|    }   }
  673|       |
  674|  4.84M|    while (likely(pIn < pInLimit-(STEPSIZE-1))) {
  675|  4.84M|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  676|  4.84M|        if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  660|  4.82M|#define STEPSIZE sizeof(reg_t)
  ------------------
                      if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  660|  4.82M|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (676:13): [True: 4.82M, False: 16.3k]
  ------------------
  677|  16.3k|        pIn += LZ4_NbCommonBytes(diff);
  678|  16.3k|        return (unsigned)(pIn - pStart);
  679|  4.84M|    }
  680|       |
  681|  1.82k|    if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  |  660|  1.82k|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (681:9): [Folded - Ignored]
  |  Branch (681:26): [True: 1.08k, False: 746]
  |  Branch (681:48): [True: 258, False: 824]
  ------------------
  682|  1.82k|    if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (682:9): [True: 1.63k, False: 191]
  |  Branch (682:31): [True: 479, False: 1.15k]
  ------------------
  683|  1.82k|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (683:9): [True: 1.61k, False: 213]
  |  Branch (683:27): [True: 556, False: 1.05k]
  ------------------
  684|  1.82k|    return (unsigned)(pIn - pStart);
  685|  18.1k|}
lz4.c:LZ4_read_ARCH:
  389|  10.1M|static reg_t LZ4_read_ARCH(const void* ptr) { return ((const LZ4_unalignST*)ptr)->uArch; }
lz4.c:LZ4_NbCommonBytes:
  562|  27.6k|{
  563|  27.6k|    assert(val != 0);
  564|  27.6k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (564:9): [True: 27.6k, False: 0]
  ------------------
  565|  27.6k|        if (sizeof(val) == 8) {
  ------------------
  |  Branch (565:13): [Folded - Ignored]
  ------------------
  566|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1800) && (defined(_M_AMD64) && !defined(_M_ARM64EC)) && !defined(LZ4_FORCE_SW_BITCOUNT)
  567|       |/*-*************************************************************************************************
  568|       |* ARM64EC is a Microsoft-designed ARM64 ABI compatible with AMD64 applications on ARM64 Windows 11.
  569|       |* The ARM64EC ABI does not support AVX/AVX2/AVX512 instructions, nor their relevant intrinsics
  570|       |* including _tzcnt_u64. Therefore, we need to neuter the _tzcnt_u64 code path for ARM64EC.
  571|       |****************************************************************************************************/
  572|       |#         if defined(__clang__) && (__clang_major__ < 10)
  573|       |            /* Avoid undefined clang-cl intrinsics issue.
  574|       |             * See https://github.com/lz4/lz4/pull/1017 for details. */
  575|       |            return (unsigned)__builtin_ia32_tzcnt_u64(val) >> 3;
  576|       |#         else
  577|       |            /* x64 CPUS without BMI support interpret `TZCNT` as `REP BSF` */
  578|       |            return (unsigned)_tzcnt_u64(val) >> 3;
  579|       |#         endif
  580|       |#       elif defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT)
  581|       |            unsigned long r = 0;
  582|       |            _BitScanForward64(&r, (U64)val);
  583|       |            return (unsigned)r >> 3;
  584|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  585|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  586|       |                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  587|  27.6k|            return (unsigned)__builtin_ctzll((U64)val) >> 3;
  588|       |#       else
  589|       |            const U64 m = 0x0101010101010101ULL;
  590|       |            val ^= val - 1;
  591|       |            return (unsigned)(((U64)((val & (m - 1)) * m)) >> 56);
  592|       |#       endif
  593|  27.6k|        } else /* 32 bits */ {
  594|       |#       if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(LZ4_FORCE_SW_BITCOUNT)
  595|       |            unsigned long r;
  596|       |            _BitScanForward(&r, (U32)val);
  597|       |            return (unsigned)r >> 3;
  598|       |#       elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  599|       |                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  600|       |                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  601|      0|            return (unsigned)__builtin_ctz((U32)val) >> 3;
  602|       |#       else
  603|       |            const U32 m = 0x01010101;
  604|       |            return (unsigned)((((val - 1) ^ val) & (m - 1)) * m) >> 24;
  605|       |#       endif
  606|      0|        }
  607|  27.6k|    } else   /* Big Endian CPU */ {
  608|      0|        if (sizeof(val)==8) {
  ------------------
  |  Branch (608:13): [Folded - Ignored]
  ------------------
  609|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  610|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  611|      0|                        !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
  612|      0|            return (unsigned)__builtin_clzll((U64)val) >> 3;
  613|       |#       else
  614|       |#if 1
  615|       |            /* this method is probably faster,
  616|       |             * but adds a 128 bytes lookup table */
  617|       |            static const unsigned char ctz7_tab[128] = {
  618|       |                7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  619|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  620|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  621|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  622|       |                6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  623|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  624|       |                5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  625|       |                4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
  626|       |            };
  627|       |            U64 const mask = 0x0101010101010101ULL;
  628|       |            U64 const t = (((val >> 8) - mask) | val) & mask;
  629|       |            return ctz7_tab[(t * 0x0080402010080402ULL) >> 57];
  630|       |#else
  631|       |            /* this method doesn't consume memory space like the previous one,
  632|       |             * but it contains several branches,
  633|       |             * that may end up slowing execution */
  634|       |            static const U32 by32 = sizeof(val)*4;  /* 32 on 64 bits (goal), 16 on 32 bits.
  635|       |            Just to avoid some static analyzer complaining about shift by 32 on 32-bits target.
  636|       |            Note that this code path is never triggered in 32-bits mode. */
  637|       |            unsigned r;
  638|       |            if (!(val>>by32)) { r=4; } else { r=0; val>>=by32; }
  639|       |            if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; }
  640|       |            r += (!val);
  641|       |            return r;
  642|       |#endif
  643|       |#       endif
  644|      0|        } else /* 32 bits */ {
  645|      0|#       if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
  646|      0|                            ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
  647|      0|                                        !defined(LZ4_FORCE_SW_BITCOUNT)
  648|      0|            return (unsigned)__builtin_clz((U32)val) >> 3;
  649|       |#       else
  650|       |            val >>= 8;
  651|       |            val = ((((val + 0x00FFFF00) | 0x00FFFFFF) + val) |
  652|       |              (val + 0x00FF0000)) >> 24;
  653|       |            return (unsigned)val ^ 3;
  654|       |#       endif
  655|      0|        }
  656|      0|    }
  657|  27.6k|}
lz4.c:LZ4_read16:
  387|  24.2k|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  392|  38.7k|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_compress_destSize_extState:
 1456|  2.09k|{
 1457|  2.09k|    void* const s = LZ4_initStream(state, sizeof (*state));
 1458|  2.09k|    assert(s != NULL); (void)s;
 1459|       |
 1460|  2.09k|    if (targetDstSize >= LZ4_compressBound(*srcSizePtr)) {  /* compression success is guaranteed */
  ------------------
  |  Branch (1460:9): [True: 542, False: 1.55k]
  ------------------
 1461|    542|        return LZ4_compress_fast_extState(state, src, dst, *srcSizePtr, targetDstSize, 1);
 1462|  1.55k|    } else {
 1463|  1.55k|        if (*srcSizePtr < LZ4_64Klimit) {
  ------------------
  |  Branch (1463:13): [True: 1.20k, False: 347]
  ------------------
 1464|  1.20k|            return LZ4_compress_generic(&state->internal_donotuse, src, dst, *srcSizePtr, srcSizePtr, targetDstSize, fillOutput, byU16, noDict, noDictIssue, 1);
 1465|  1.20k|        } else {
 1466|    347|            tableType_t const addrMode = ((sizeof(void*)==4) && ((uptrval)src > LZ4_DISTANCE_MAX)) ? byPtr : byU32;
  ------------------
  |  |  653|      0|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
  |  Branch (1466:43): [Folded - Ignored]
  |  Branch (1466:65): [True: 0, False: 0]
  ------------------
 1467|    347|            return LZ4_compress_generic(&state->internal_donotuse, src, dst, *srcSizePtr, srcSizePtr, targetDstSize, fillOutput, addrMode, noDict, noDictIssue, 1);
 1468|    347|    }   }
 1469|  2.09k|}
lz4.c:LZ4_isAligned:
  292|  4.76k|{
  293|  4.76k|    return ((size_t)ptr & (alignment -1)) == 0;
  294|  4.76k|}
lz4.c:LZ4_stream_t_alignment:
 1509|  4.76k|{
 1510|  4.76k|#if LZ4_ALIGN_TEST
 1511|  4.76k|    typedef struct { char c; LZ4_stream_t t; } t_a;
 1512|  4.76k|    return sizeof(t_a) - sizeof(LZ4_stream_t);
 1513|       |#else
 1514|       |    return 1;  /* effectively disabled */
 1515|       |#endif
 1516|  4.76k|}
lz4.c:LZ4_hashPosition:
  780|   476k|{
  781|   476k|    if ((sizeof(reg_t)==8) && (tableType != byU16)) return LZ4_hash5(LZ4_read_ARCH(p), tableType);
  ------------------
  |  Branch (781:9): [Folded - Ignored]
  |  Branch (781:31): [True: 368k, False: 107k]
  ------------------
  782|   107k|    return LZ4_hash4(LZ4_read32(p), tableType);
  783|   476k|}
lz4.c:LZ4_hash5:
  768|   368k|{
  769|   368k|    const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  674|      0|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  161|      0|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|      0|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  674|   736k|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  161|   368k|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|   368k|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (769:25): [True: 0, False: 368k]
  ------------------
  770|   368k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (770:9): [True: 368k, False: 0]
  ------------------
  771|   368k|        const U64 prime5bytes = 889523592379ULL;
  772|   368k|        return (U32)(((sequence << 24) * prime5bytes) >> (64 - hashLog));
  773|   368k|    } else {
  774|      0|        const U64 prime8bytes = 11400714785074694791ULL;
  775|      0|        return (U32)(((sequence >> 24) * prime8bytes) >> (64 - hashLog));
  776|      0|    }
  777|   368k|}
lz4.c:LZ4_hash4:
  760|   107k|{
  761|   107k|    if (tableType == byU16)
  ------------------
  |  Branch (761:9): [True: 107k, False: 0]
  ------------------
  762|   107k|        return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
  ------------------
  |  |  241|   107k|#define MINMATCH 4
  ------------------
                      return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
  ------------------
  |  |  674|   107k|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  161|   107k|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|   107k|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  763|      0|    else
  764|      0|        return ((sequence * 2654435761U) >> ((MINMATCH*8)-LZ4_HASHLOG));
  ------------------
  |  |  241|      0|#define MINMATCH 4
  ------------------
                      return ((sequence * 2654435761U) >> ((MINMATCH*8)-LZ4_HASHLOG));
  ------------------
  |  |  674|      0|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  161|      0|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|      0|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  765|   107k|}
lz4.c:LZ4_putIndexOnHash:
  798|   456k|{
  799|   456k|    switch (tableType)
  800|   456k|    {
  801|      0|    default: /* fallthrough */
  ------------------
  |  Branch (801:5): [True: 0, False: 456k]
  ------------------
  802|      0|    case clearedTable: /* fallthrough */
  ------------------
  |  Branch (802:5): [True: 0, False: 456k]
  ------------------
  803|      0|    case byPtr: { /* illegal! */ assert(0); return; }
  ------------------
  |  Branch (803:5): [True: 0, False: 456k]
  ------------------
  804|   361k|    case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = idx; return; }
  ------------------
  |  Branch (804:5): [True: 361k, False: 95.8k]
  ------------------
  805|  95.8k|    case byU16: { U16* hashTable = (U16*) tableBase; assert(idx < 65536); hashTable[h] = (U16)idx; return; }
  ------------------
  |  Branch (805:5): [True: 95.8k, False: 361k]
  ------------------
  806|   456k|    }
  807|   456k|}
lz4.c:LZ4_decompress_generic:
 1961|  3.57k|{
 1962|  3.57k|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (1962:9): [True: 0, False: 3.57k]
  |  Branch (1962:26): [True: 0, False: 3.57k]
  ------------------
 1963|       |
 1964|  3.57k|    {   const BYTE* ip = (const BYTE*) src;
 1965|  3.57k|        const BYTE* const iend = ip + srcSize;
 1966|       |
 1967|  3.57k|        BYTE* op = (BYTE*) dst;
 1968|  3.57k|        BYTE* const oend = op + outputSize;
 1969|  3.57k|        BYTE* cpy;
 1970|       |
 1971|  3.57k|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (1971:37): [True: 3.57k, False: 0]
  ------------------
 1972|       |
 1973|  3.57k|        const int checkOffset = (dictSize < (int)(64 KB));
  ------------------
  |  |  250|  3.57k|#define KB *(1 <<10)
  ------------------
 1974|       |
 1975|       |
 1976|       |        /* Set up the "end" pointers for the shortcut. */
 1977|  3.57k|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 1978|  3.57k|        const BYTE* const shortoend = oend - 14 /*maxLL*/ - 18 /*maxML*/;
 1979|       |
 1980|  3.57k|        const BYTE* match;
 1981|  3.57k|        size_t offset;
 1982|  3.57k|        unsigned token;
 1983|  3.57k|        size_t length;
 1984|       |
 1985|       |
 1986|  3.57k|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  288|  3.57k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1987|       |
 1988|       |        /* Special cases */
 1989|  3.57k|        assert(lowPrefix <= op);
 1990|  3.57k|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  179|  3.57k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  3.57k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 16, False: 3.55k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1991|       |            /* Empty output buffer */
 1992|     16|            if (partialDecoding) return 0;
  ------------------
  |  Branch (1992:17): [True: 0, False: 16]
  ------------------
 1993|     16|            return ((srcSize==1) && (*ip==0)) ? 0 : -1;
  ------------------
  |  Branch (1993:21): [True: 16, False: 0]
  |  Branch (1993:37): [True: 16, False: 0]
  ------------------
 1994|     16|        }
 1995|  3.55k|        if (unlikely(srcSize==0)) { return -1; }
  ------------------
  |  |  179|  3.55k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  3.55k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 3.55k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1996|       |
 1997|       |    /* LZ4_FAST_DEC_LOOP:
 1998|       |     * designed for modern OoO performance cpus,
 1999|       |     * where copying reliably 32-bytes is preferable to an unpredictable branch.
 2000|       |     * note : fast loop may show a regression for some client arm chips. */
 2001|  3.55k|#if LZ4_FAST_DEC_LOOP
 2002|  3.55k|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  247|  3.55k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2002:13): [True: 2.08k, False: 1.47k]
  ------------------
 2003|  2.08k|            DEBUGLOG(6, "skip fast decode loop");
  ------------------
  |  |  288|  2.08k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2004|  2.08k|            goto safe_decode;
 2005|  2.08k|        }
 2006|       |
 2007|       |        /* Fast loop : decode sequences as long as output < oend-FASTLOOP_SAFE_DISTANCE */
 2008|  1.47k|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  288|  1.47k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2009|  16.4k|        while (1) {
  ------------------
  |  Branch (2009:16): [Folded - Ignored]
  ------------------
 2010|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2011|  16.4k|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
 2012|  16.4k|            assert(ip < iend);
 2013|  16.4k|            token = *ip++;
 2014|  16.4k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  259|  16.4k|#define ML_BITS  4
  ------------------
 2015|       |
 2016|       |            /* decode literal length */
 2017|  16.4k|            if (length == RUN_MASK) {
  ------------------
  |  |  262|  16.4k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  16.4k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  16.4k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2017:17): [True: 590, False: 15.8k]
  ------------------
 2018|    590|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  262|    590|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|    590|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|    590|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2019|    590|                if (addl == rvl_error) {
  ------------------
  |  Branch (2019:21): [True: 0, False: 590]
  ------------------
 2020|      0|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2021|      0|                    goto _output_error;
 2022|      0|                }
 2023|    590|                length += addl;
 2024|    590|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  179|    590|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|    590|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 590]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2025|    590|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  179|    590|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|    590|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 590]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2026|       |
 2027|       |                /* copy literals */
 2028|    590|                cpy = op+length;
 2029|    590|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  276|    590|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2030|    590|                if ((cpy>oend-32) || (ip+length>iend-32)) { goto safe_literal_copy; }
  ------------------
  |  Branch (2030:21): [True: 85, False: 505]
  |  Branch (2030:38): [True: 151, False: 354]
  ------------------
 2031|    354|                LZ4_wildCopy32(op, ip, cpy);
 2032|    354|                ip += length; op = cpy;
 2033|  15.8k|            } else {
 2034|  15.8k|                cpy = op+length;
 2035|  15.8k|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)length);
  ------------------
  |  |  288|  15.8k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2036|       |                /* We don't need to check oend, since we check it once for each loop below */
 2037|  15.8k|                if (ip > iend-(16 + 1/*max lit + offset + nextToken*/)) { goto safe_literal_copy; }
  ------------------
  |  Branch (2037:21): [True: 519, False: 15.3k]
  ------------------
 2038|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2039|  15.3k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  348|  15.3k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2040|  15.3k|                ip += length; op = cpy;
 2041|  15.3k|            }
 2042|       |
 2043|       |            /* get offset */
 2044|  15.6k|            offset = LZ4_readLE16(ip); ip+=2;
 2045|  15.6k|            DEBUGLOG(6, " offset = %zu", offset);
  ------------------
  |  |  288|  15.6k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2046|  15.6k|            match = op - offset;
 2047|  15.6k|            assert(match <= op);  /* overflow check */
 2048|       |
 2049|       |            /* get matchlength */
 2050|  15.6k|            length = token & ML_MASK;
  ------------------
  |  |  260|  15.6k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  15.6k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2051|       |
 2052|  15.6k|            if (length == ML_MASK) {
  ------------------
  |  |  260|  15.6k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  15.6k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2052:17): [True: 8.37k, False: 7.29k]
  ------------------
 2053|  8.37k|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  244|  8.37k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2054|  8.37k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2054:21): [True: 0, False: 8.37k]
  ------------------
 2055|      0|                    DEBUGLOG(6, "error reading long match length");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2056|      0|                    goto _output_error;
 2057|      0|                }
 2058|  8.37k|                length += addl;
 2059|  8.37k|                length += MINMATCH;
  ------------------
  |  |  241|  8.37k|#define MINMATCH 4
  ------------------
 2060|  8.37k|                if (unlikely((uptrval)(op)+length<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  179|  8.37k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  8.37k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 8.37k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2061|  8.37k|                if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) {
  ------------------
  |  |  179|  8.37k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  8.37k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2061:21): [True: 8.37k, False: 0]
  |  Branch (2061:38): [True: 0, False: 8.37k]
  ------------------
 2062|      0|                    DEBUGLOG(6, "Error : offset outside buffers");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2063|      0|                    goto _output_error;
 2064|      0|                }
 2065|  8.37k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  247|  8.37k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2065:21): [True: 317, False: 8.05k]
  ------------------
 2066|    317|                    goto safe_match_copy;
 2067|    317|                }
 2068|  8.37k|            } else {
 2069|  7.29k|                length += MINMATCH;
  ------------------
  |  |  241|  7.29k|#define MINMATCH 4
  ------------------
 2070|  7.29k|                if (op + length >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  247|  7.29k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2070:21): [True: 402, False: 6.89k]
  ------------------
 2071|    402|                    goto safe_match_copy;
 2072|    402|                }
 2073|       |
 2074|       |                /* Fastpath check: skip LZ4_wildCopy32 when true */
 2075|  6.89k|                if ((dict == withPrefix64k) || (match >= lowPrefix)) {
  ------------------
  |  Branch (2075:21): [True: 0, False: 6.89k]
  |  Branch (2075:48): [True: 6.89k, False: 0]
  ------------------
 2076|  6.89k|                    if (offset >= 8) {
  ------------------
  |  Branch (2076:25): [True: 3.70k, False: 3.19k]
  ------------------
 2077|  3.70k|                        assert(match >= lowPrefix);
 2078|  3.70k|                        assert(match <= op);
 2079|  3.70k|                        assert(op + 18 <= oend);
 2080|       |
 2081|  3.70k|                        LZ4_memcpy(op, match, 8);
  ------------------
  |  |  348|  3.70k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2082|  3.70k|                        LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  348|  3.70k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2083|  3.70k|                        LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  348|  3.70k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2084|  3.70k|                        op += length;
 2085|  3.70k|                        continue;
 2086|  3.70k|            }   }   }
 2087|       |
 2088|  11.2k|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  179|  11.2k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  11.2k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2088:18): [True: 11.2k, False: 0]
  |  Branch (2088:33): [True: 0, False: 11.2k]
  ------------------
 2089|      0|                DEBUGLOG(6, "Error : pos=%zi, offset=%zi => outside buffers", op-lowPrefix, op-match);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2090|      0|                goto _output_error;
 2091|      0|            }
 2092|       |            /* match starting within external dictionary */
 2093|  11.2k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2093:17): [True: 0, False: 11.2k]
  |  Branch (2093:41): [True: 0, False: 0]
  ------------------
 2094|      0|                assert(dictEnd != NULL);
 2095|      0|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  179|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2096|      0|                    if (partialDecoding) {
  ------------------
  |  Branch (2096:25): [True: 0, False: 0]
  ------------------
 2097|      0|                        DEBUGLOG(7, "partialDecoding: dictionary match, close to dstEnd");
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2098|      0|                        length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1782|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1782:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2099|      0|                    } else {
 2100|      0|                        DEBUGLOG(6, "end-of-block condition violated")
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2101|      0|                        goto _output_error;
 2102|      0|                }   }
 2103|       |
 2104|      0|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2104:21): [True: 0, False: 0]
  ------------------
 2105|       |                    /* match fits entirely within external dictionary : just copy */
 2106|      0|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  356|      0|#    define LZ4_memmove __builtin_memmove
  ------------------
 2107|      0|                    op += length;
 2108|      0|                } else {
 2109|       |                    /* match stretches into both external dictionary and current block */
 2110|      0|                    size_t const copySize = (size_t)(lowPrefix - match);
 2111|      0|                    size_t const restSize = length - copySize;
 2112|      0|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  348|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2113|      0|                    op += copySize;
 2114|      0|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2114:25): [True: 0, False: 0]
  ------------------
 2115|      0|                        BYTE* const endOfMatch = op + restSize;
 2116|      0|                        const BYTE* copyFrom = lowPrefix;
 2117|      0|                        while (op < endOfMatch) { *op++ = *copyFrom++; }
  ------------------
  |  Branch (2117:32): [True: 0, False: 0]
  ------------------
 2118|      0|                    } else {
 2119|      0|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  348|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2120|      0|                        op += restSize;
 2121|      0|                }   }
 2122|      0|                continue;
 2123|      0|            }
 2124|       |
 2125|       |            /* copy match within block */
 2126|  11.2k|            cpy = op + length;
 2127|       |
 2128|  11.2k|            assert((op <= oend) && (oend-op >= 32));
 2129|  11.2k|            if (unlikely(offset<16)) {
  ------------------
  |  |  179|  11.2k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  11.2k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 6.64k, False: 4.60k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2130|  6.64k|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2131|  6.64k|            } else {
 2132|  4.60k|                LZ4_wildCopy32(op, match, cpy);
 2133|  4.60k|            }
 2134|       |
 2135|  11.2k|            op = cpy;   /* wildcopy correction */
 2136|  11.2k|        }
 2137|  2.08k|    safe_decode:
 2138|  2.08k|#endif
 2139|       |
 2140|       |        /* Main Loop : decode remaining sequences where output < FASTLOOP_SAFE_DISTANCE */
 2141|  2.08k|        DEBUGLOG(6, "using safe decode loop");
  ------------------
  |  |  288|  2.08k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2142|  8.11k|        while (1) {
  ------------------
  |  Branch (2142:16): [Folded - Ignored]
  ------------------
 2143|  8.11k|            assert(ip < iend);
 2144|  8.11k|            token = *ip++;
 2145|  8.11k|            length = token >> ML_BITS;  /* literal length */
  ------------------
  |  |  259|  8.11k|#define ML_BITS  4
  ------------------
 2146|       |
 2147|       |            /* A two-stage shortcut for the most common case:
 2148|       |             * 1) If the literal length is 0..14, and there is enough space,
 2149|       |             * enter the shortcut and copy 16 bytes on behalf of the literals
 2150|       |             * (in the fast mode, only 8 bytes can be safely copied this way).
 2151|       |             * 2) Further if the match length is 4..18, copy 18 bytes in a similar
 2152|       |             * manner; but we ensure that there's enough space in the output for
 2153|       |             * those 18 bytes earlier, upon entering the shortcut (in other words,
 2154|       |             * there is a combined check for both stages).
 2155|       |             */
 2156|  8.11k|            if ( (length != RUN_MASK)
  ------------------
  |  |  262|  8.11k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  8.11k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  8.11k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2156:18): [True: 7.66k, False: 454]
  ------------------
 2157|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2158|  8.11k|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  176|  7.66k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  170|  7.66k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 1.63k, False: 6.02k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2159|       |                /* Copy the literals */
 2160|  1.63k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  348|  1.63k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2161|  1.63k|                op += length; ip += length;
 2162|       |
 2163|       |                /* The second stage: prepare for match copying, decode full info.
 2164|       |                 * If it doesn't work out, the info won't be wasted. */
 2165|  1.63k|                length = token & ML_MASK; /* match length */
  ------------------
  |  |  260|  1.63k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  1.63k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2166|  1.63k|                offset = LZ4_readLE16(ip); ip += 2;
 2167|  1.63k|                match = op - offset;
 2168|  1.63k|                assert(match <= op); /* check overflow */
 2169|       |
 2170|       |                /* Do not deal with overlapping matches. */
 2171|  1.63k|                if ( (length != ML_MASK)
  ------------------
  |  |  260|  1.63k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  1.63k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2171:22): [True: 1.50k, False: 128]
  ------------------
 2172|  1.63k|                  && (offset >= 8)
  ------------------
  |  Branch (2172:22): [True: 765, False: 743]
  ------------------
 2173|  1.63k|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2173:23): [True: 0, False: 765]
  |  Branch (2173:46): [True: 765, False: 0]
  ------------------
 2174|       |                    /* Copy the match. */
 2175|    765|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  348|    765|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2176|    765|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  348|    765|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2177|    765|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  348|    765|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2178|    765|                    op += length + MINMATCH;
  ------------------
  |  |  241|    765|#define MINMATCH 4
  ------------------
 2179|       |                    /* Both stages worked, load the next token. */
 2180|    765|                    continue;
 2181|    765|                }
 2182|       |
 2183|       |                /* The second stage didn't work out, but the info is ready.
 2184|       |                 * Propel it right to the point of match copying. */
 2185|    871|                goto _copy_match;
 2186|  1.63k|            }
 2187|       |
 2188|       |            /* decode literal length */
 2189|  6.48k|            if (length == RUN_MASK) {
  ------------------
  |  |  262|  6.48k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|  6.48k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|  6.48k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2189:17): [True: 454, False: 6.02k]
  ------------------
 2190|    454|                size_t const addl = read_variable_length(&ip, iend-RUN_MASK, 1);
  ------------------
  |  |  262|    454|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  261|    454|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|    454|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2191|    454|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2191:21): [True: 0, False: 454]
  ------------------
 2192|    454|                length += addl;
 2193|    454|                if (unlikely((uptrval)(op)+length<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  179|    454|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|    454|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 454]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2194|    454|                if (unlikely((uptrval)(ip)+length<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  179|    454|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|    454|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 454]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2195|    454|            }
 2196|       |
 2197|       |            /* copy literals */
 2198|  6.48k|            cpy = op+length;
 2199|  6.48k|#if LZ4_FAST_DEC_LOOP
 2200|  7.23k|        safe_literal_copy:
 2201|  7.23k|#endif
 2202|  7.23k|            LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  276|  7.23k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2203|  7.23k|            if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  245|  7.23k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                          if ((cpy>oend-MFLIMIT) || (ip+length>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  244|  4.21k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2203:17): [True: 3.02k, False: 4.21k]
  |  Branch (2203:39): [True: 532, False: 3.68k]
  ------------------
 2204|       |                /* We've either hit the input parsing restriction or the output parsing restriction.
 2205|       |                 * In the normal scenario, decoding a full block, it must be the last sequence,
 2206|       |                 * otherwise it's an error (invalid input or dimensions).
 2207|       |                 * In partialDecoding scenario, it's necessary to ensure there is no buffer overflow.
 2208|       |                 */
 2209|  3.55k|                if (partialDecoding) {
  ------------------
  |  Branch (2209:21): [True: 0, False: 3.55k]
  ------------------
 2210|       |                    /* Since we are partial decoding we may be in this block because of the output parsing
 2211|       |                     * restriction, which is not valid since the output buffer is allowed to be undersized.
 2212|       |                     */
 2213|      0|                    DEBUGLOG(7, "partialDecoding: copying literals, close to input or output end")
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2214|      0|                    DEBUGLOG(7, "partialDecoding: literal length = %u", (unsigned)length);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2215|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in dstBuffer : %i", (int)(oend - op));
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2216|      0|                    DEBUGLOG(7, "partialDecoding: remaining space in srcBuffer : %i", (int)(iend - ip));
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2217|       |                    /* Finishing in the middle of a literals segment,
 2218|       |                     * due to lack of input.
 2219|       |                     */
 2220|      0|                    if (ip+length > iend) {
  ------------------
  |  Branch (2220:25): [True: 0, False: 0]
  ------------------
 2221|      0|                        length = (size_t)(iend-ip);
 2222|      0|                        cpy = op + length;
 2223|      0|                    }
 2224|       |                    /* Finishing in the middle of a literals segment,
 2225|       |                     * due to lack of output space.
 2226|       |                     */
 2227|      0|                    if (cpy > oend) {
  ------------------
  |  Branch (2227:25): [True: 0, False: 0]
  ------------------
 2228|      0|                        cpy = oend;
 2229|      0|                        assert(op<=oend);
 2230|      0|                        length = (size_t)(oend-op);
 2231|      0|                    }
 2232|  3.55k|                } else {
 2233|       |                     /* We must be on the last sequence (or invalid) because of the parsing limitations
 2234|       |                      * so check that we exactly consume the input and don't overrun the output buffer.
 2235|       |                      */
 2236|  3.55k|                    if ((ip+length != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2236:25): [True: 0, False: 3.55k]
  |  Branch (2236:48): [True: 0, False: 3.55k]
  ------------------
 2237|      0|                        DEBUGLOG(6, "should have been last run of literals")
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2238|      0|                        DEBUGLOG(6, "ip(%p) + length(%i) = %p != iend (%p)", ip, (int)length, ip+length, iend);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2239|      0|                        DEBUGLOG(6, "or cpy(%p) > oend(%p)", cpy, oend);
  ------------------
  |  |  288|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2240|      0|                        goto _output_error;
 2241|      0|                    }
 2242|  3.55k|                }
 2243|  3.55k|                LZ4_memmove(op, ip, length);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  356|  3.55k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2244|  3.55k|                ip += length;
 2245|  3.55k|                op += length;
 2246|       |                /* Necessarily EOF when !partialDecoding.
 2247|       |                 * When partialDecoding, it is EOF if we've either
 2248|       |                 * filled the output buffer or
 2249|       |                 * can't proceed with reading an offset for following match.
 2250|       |                 */
 2251|  3.55k|                if (!partialDecoding || (cpy == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2251:21): [True: 3.55k, False: 0]
  |  Branch (2251:41): [True: 0, False: 0]
  |  Branch (2251:58): [True: 0, False: 0]
  ------------------
 2252|  3.55k|                    break;
 2253|  3.55k|                }
 2254|  3.68k|            } else {
 2255|  3.68k|                LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2256|  3.68k|                ip += length; op = cpy;
 2257|  3.68k|            }
 2258|       |
 2259|       |            /* get offset */
 2260|  3.68k|            offset = LZ4_readLE16(ip); ip+=2;
 2261|  3.68k|            match = op - offset;
 2262|       |
 2263|       |            /* get matchlength */
 2264|  3.68k|            length = token & ML_MASK;
  ------------------
  |  |  260|  3.68k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  3.68k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2265|       |
 2266|  4.55k|    _copy_match:
 2267|  4.55k|            if (length == ML_MASK) {
  ------------------
  |  |  260|  4.55k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  259|  4.55k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2267:17): [True: 677, False: 3.87k]
  ------------------
 2268|    677|                size_t const addl = read_variable_length(&ip, iend - LASTLITERALS + 1, 0);
  ------------------
  |  |  244|    677|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2269|    677|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2269:21): [True: 0, False: 677]
  ------------------
 2270|    677|                length += addl;
 2271|    677|                if (unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  179|    677|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|    677|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 677]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2272|    677|            }
 2273|  4.55k|            length += MINMATCH;
  ------------------
  |  |  241|  4.55k|#define MINMATCH 4
  ------------------
 2274|       |
 2275|  4.55k|#if LZ4_FAST_DEC_LOOP
 2276|  5.27k|        safe_match_copy:
 2277|  5.27k|#endif
 2278|  5.27k|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _output_error;   /* Error : offset outside buffers */
  ------------------
  |  |  179|  5.27k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  5.27k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2278:17): [True: 5.27k, False: 0]
  |  Branch (2278:34): [True: 0, False: 5.27k]
  ------------------
 2279|       |            /* match starting within external dictionary */
 2280|  5.27k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2280:17): [True: 0, False: 5.27k]
  |  Branch (2280:41): [True: 0, False: 0]
  ------------------
 2281|      0|                assert(dictEnd != NULL);
 2282|      0|                if (unlikely(op+length > oend-LASTLITERALS)) {
  ------------------
  |  |  179|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2283|      0|                    if (partialDecoding) length = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1782|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1782:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2283:25): [True: 0, False: 0]
  ------------------
 2284|      0|                    else goto _output_error;   /* doesn't respect parsing restriction */
 2285|      0|                }
 2286|       |
 2287|      0|                if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2287:21): [True: 0, False: 0]
  ------------------
 2288|       |                    /* match fits entirely within external dictionary : just copy */
 2289|      0|                    LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  356|      0|#    define LZ4_memmove __builtin_memmove
  ------------------
 2290|      0|                    op += length;
 2291|      0|                } else {
 2292|       |                    /* match stretches into both external dictionary and current block */
 2293|      0|                    size_t const copySize = (size_t)(lowPrefix - match);
 2294|      0|                    size_t const restSize = length - copySize;
 2295|      0|                    LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  348|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2296|      0|                    op += copySize;
 2297|      0|                    if (restSize > (size_t)(op - lowPrefix)) {  /* overlap copy */
  ------------------
  |  Branch (2297:25): [True: 0, False: 0]
  ------------------
 2298|      0|                        BYTE* const endOfMatch = op + restSize;
 2299|      0|                        const BYTE* copyFrom = lowPrefix;
 2300|      0|                        while (op < endOfMatch) *op++ = *copyFrom++;
  ------------------
  |  Branch (2300:32): [True: 0, False: 0]
  ------------------
 2301|      0|                    } else {
 2302|      0|                        LZ4_memcpy(op, lowPrefix, restSize);
  ------------------
  |  |  348|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2303|      0|                        op += restSize;
 2304|      0|                }   }
 2305|      0|                continue;
 2306|      0|            }
 2307|  5.27k|            assert(match >= lowPrefix);
 2308|       |
 2309|       |            /* copy match within block */
 2310|  5.27k|            cpy = op + length;
 2311|       |
 2312|       |            /* partialDecoding : may end anywhere within the block */
 2313|  5.27k|            assert(op<=oend);
 2314|  5.27k|            if (partialDecoding && (cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  246|      0|#define MATCH_SAFEGUARD_DISTANCE  ((2*WILDCOPYLENGTH) - MINMATCH)   /* ensure it's possible to write 2 x wildcopyLength without overflowing output buffer */
  |  |  ------------------
  |  |  |  |  243|      0|#define WILDCOPYLENGTH 8
  |  |  ------------------
  |  |               #define MATCH_SAFEGUARD_DISTANCE  ((2*WILDCOPYLENGTH) - MINMATCH)   /* ensure it's possible to write 2 x wildcopyLength without overflowing output buffer */
  |  |  ------------------
  |  |  |  |  241|      0|#define MINMATCH 4
  |  |  ------------------
  ------------------
  |  Branch (2314:17): [True: 0, False: 5.27k]
  |  Branch (2314:36): [True: 0, False: 0]
  ------------------
 2315|      0|                size_t const mlen = MIN(length, (size_t)(oend-op));
  ------------------
  |  | 1782|      0|#define MIN(a,b)    ( (a) < (b) ? (a) : (b) )
  |  |  ------------------
  |  |  |  Branch (1782:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2316|      0|                const BYTE* const matchEnd = match + mlen;
 2317|      0|                BYTE* const copyEnd = op + mlen;
 2318|      0|                if (matchEnd > op) {   /* overlap copy */
  ------------------
  |  Branch (2318:21): [True: 0, False: 0]
  ------------------
 2319|      0|                    while (op < copyEnd) { *op++ = *match++; }
  ------------------
  |  Branch (2319:28): [True: 0, False: 0]
  ------------------
 2320|      0|                } else {
 2321|      0|                    LZ4_memcpy(op, match, mlen);
  ------------------
  |  |  348|      0|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2322|      0|                }
 2323|      0|                op = copyEnd;
 2324|      0|                if (op == oend) { break; }
  ------------------
  |  Branch (2324:21): [True: 0, False: 0]
  ------------------
 2325|      0|                continue;
 2326|      0|            }
 2327|       |
 2328|  5.27k|            if (unlikely(offset<8)) {
  ------------------
  |  |  179|  5.27k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  5.27k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 3.72k, False: 1.55k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2329|  3.72k|                LZ4_write32(op, 0);   /* silence msan warning when offset==0 */
 2330|  3.72k|                op[0] = match[0];
 2331|  3.72k|                op[1] = match[1];
 2332|  3.72k|                op[2] = match[2];
 2333|  3.72k|                op[3] = match[3];
 2334|  3.72k|                match += inc32table[offset];
 2335|  3.72k|                LZ4_memcpy(op+4, match, 4);
  ------------------
  |  |  348|  3.72k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2336|  3.72k|                match -= dec64table[offset];
 2337|  3.72k|            } else {
 2338|  1.55k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  348|  1.55k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2339|  1.55k|                match += 8;
 2340|  1.55k|            }
 2341|  5.27k|            op += 8;
 2342|       |
 2343|  5.27k|            if (unlikely(cpy > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  179|  5.27k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  5.27k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 1.53k, False: 3.74k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2344|  1.53k|                BYTE* const oCopyLimit = oend - (WILDCOPYLENGTH-1);
  ------------------
  |  |  243|  1.53k|#define WILDCOPYLENGTH 8
  ------------------
 2345|  1.53k|                if (cpy > oend-LASTLITERALS) { goto _output_error; } /* Error : last LASTLITERALS bytes must be literals (uncompressed) */
  ------------------
  |  |  244|  1.53k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2345:21): [True: 0, False: 1.53k]
  ------------------
 2346|  1.53k|                if (op < oCopyLimit) {
  ------------------
  |  Branch (2346:21): [True: 639, False: 892]
  ------------------
 2347|    639|                    LZ4_wildCopy8(op, match, oCopyLimit);
 2348|    639|                    match += oCopyLimit - op;
 2349|    639|                    op = oCopyLimit;
 2350|    639|                }
 2351|  2.28k|                while (op < cpy) { *op++ = *match++; }
  ------------------
  |  Branch (2351:24): [True: 758, False: 1.53k]
  ------------------
 2352|  3.74k|            } else {
 2353|  3.74k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  348|  3.74k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2354|  3.74k|                if (length > 16)  { LZ4_wildCopy8(op+8, match+8, cpy); }
  ------------------
  |  Branch (2354:21): [True: 697, False: 3.04k]
  ------------------
 2355|  3.74k|            }
 2356|  5.27k|            op = cpy;   /* wildcopy correction */
 2357|  5.27k|        }
 2358|       |
 2359|       |        /* end of decoding */
 2360|  3.55k|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  288|  3.55k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2361|  3.55k|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2362|       |
 2363|       |        /* Overflow error detected */
 2364|      0|    _output_error:
 2365|      0|        return (int) (-(((const char*)ip)-src))-1;
 2366|  2.08k|    }
 2367|  2.08k|}
lz4.c:read_variable_length:
 1918|  10.0k|{
 1919|  10.0k|    Rvl_t s, length = 0;
 1920|  10.0k|    assert(ip != NULL);
 1921|  10.0k|    assert(*ip !=  NULL);
 1922|  10.0k|    assert(ilimit != NULL);
 1923|  10.0k|    if (initial_check && unlikely((*ip) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  179|  1.04k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  1.04k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 1.04k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1923:9): [True: 1.04k, False: 9.04k]
  ------------------
 1924|      0|        return rvl_error;
 1925|      0|    }
 1926|  63.0k|    do {
 1927|  63.0k|        s = **ip;
 1928|  63.0k|        (*ip)++;
 1929|  63.0k|        length += s;
 1930|  63.0k|        if (unlikely((*ip) > ilimit)) {    /* read limit reached */
  ------------------
  |  |  179|  63.0k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|  63.0k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 63.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1931|      0|            return rvl_error;
 1932|      0|        }
 1933|       |        /* accumulator overflow detection (32-bit mode only) */
 1934|  63.0k|        if ((sizeof(length)<8) && unlikely(length > ((Rvl_t)(-1)/2)) ) {
  ------------------
  |  |  179|      0|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  170|      0|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:33): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1934:13): [Folded - Ignored]
  ------------------
 1935|      0|            return rvl_error;
 1936|      0|        }
 1937|  63.0k|    } while (s==255);
  ------------------
  |  Branch (1937:14): [True: 52.9k, False: 10.0k]
  ------------------
 1938|       |
 1939|  10.0k|    return length;
 1940|  10.0k|}
lz4.c:LZ4_wildCopy32:
  505|  4.95k|{
  506|  4.95k|    BYTE* d = (BYTE*)dstPtr;
  507|  4.95k|    const BYTE* s = (const BYTE*)srcPtr;
  508|  4.95k|    BYTE* const e = (BYTE*)dstEnd;
  509|       |
  510|   122k|    do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  348|   122k|#    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);
  ------------------
  |  |  348|   122k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (510:79): [True: 117k, False: 4.95k]
  ------------------
  511|  4.95k|}
lz4.c:LZ4_readLE16:
  425|  20.9k|{
  426|  20.9k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (426:9): [True: 20.9k, False: 0]
  ------------------
  427|  20.9k|        return LZ4_read16(memPtr);
  428|  20.9k|    } else {
  429|      0|        const BYTE* p = (const BYTE*)memPtr;
  430|      0|        return (U16)((U16)p[0] + (p[1]<<8));
  431|      0|    }
  432|  20.9k|}
lz4.c:LZ4_memcpy_using_offset:
  518|  6.64k|{
  519|  6.64k|    BYTE v[8];
  520|       |
  521|  6.64k|    assert(dstEnd >= dstPtr + MINMATCH);
  522|       |
  523|  6.64k|    switch(offset) {
  524|  1.79k|    case 1:
  ------------------
  |  Branch (524:5): [True: 1.79k, False: 4.84k]
  ------------------
  525|  1.79k|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  235|  1.79k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  233|  1.79k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  526|  1.79k|        break;
  527|  3.28k|    case 2:
  ------------------
  |  Branch (527:5): [True: 3.28k, False: 3.36k]
  ------------------
  528|  3.28k|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  348|  3.28k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  529|  3.28k|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  348|  3.28k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  530|       |#if defined(_MSC_VER) && (_MSC_VER <= 1933) /* MSVC 2022 ver 17.3 or earlier */
  531|       |#  pragma warning(push)
  532|       |#  pragma warning(disable : 6385) /* warning C6385: Reading invalid data from 'v'. */
  533|       |#endif
  534|  3.28k|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  348|  3.28k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  535|       |#if defined(_MSC_VER) && (_MSC_VER <= 1933) /* MSVC 2022 ver 17.3 or earlier */
  536|       |#  pragma warning(pop)
  537|       |#endif
  538|  3.28k|        break;
  539|    358|    case 4:
  ------------------
  |  Branch (539:5): [True: 358, False: 6.28k]
  ------------------
  540|    358|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  348|    358|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  541|    358|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  348|    358|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  542|    358|        break;
  543|  1.21k|    default:
  ------------------
  |  Branch (543:5): [True: 1.21k, False: 5.43k]
  ------------------
  544|  1.21k|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  545|  1.21k|        return;
  546|  6.64k|    }
  547|       |
  548|  5.43k|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  348|  5.43k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  549|  5.43k|    dstPtr += 8;
  550|  1.15M|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (550:12): [True: 1.15M, False: 5.43k]
  ------------------
  551|  1.15M|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  348|  1.15M|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  552|  1.15M|        dstPtr += 8;
  553|  1.15M|    }
  554|  5.43k|}
lz4.c:LZ4_memcpy_using_offset_base:
  479|  1.21k|{
  480|  1.21k|    assert(srcPtr + offset == dstPtr);
  481|  1.21k|    if (offset < 8) {
  ------------------
  |  Branch (481:9): [True: 1.09k, False: 120]
  ------------------
  482|  1.09k|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  483|  1.09k|        dstPtr[0] = srcPtr[0];
  484|  1.09k|        dstPtr[1] = srcPtr[1];
  485|  1.09k|        dstPtr[2] = srcPtr[2];
  486|  1.09k|        dstPtr[3] = srcPtr[3];
  487|  1.09k|        srcPtr += inc32table[offset];
  488|  1.09k|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  348|  1.09k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  489|  1.09k|        srcPtr -= dec64table[offset];
  490|  1.09k|        dstPtr += 8;
  491|  1.09k|    } else {
  492|    120|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  348|    120|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  493|    120|        dstPtr += 8;
  494|    120|        srcPtr += 8;
  495|    120|    }
  496|       |
  497|  1.21k|    LZ4_wildCopy8(dstPtr, srcPtr, dstEnd);
  498|  1.21k|}

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

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

