adler32_avx2.c:adler32_copy_tail:
  134|   338M|                                                uint32_t sum2, const int REBASE, const int MAX_LEN, const int COPY) {
  135|   338M|    if (len) {
  ------------------
  |  Branch (135:9): [True: 338M, False: 0]
  ------------------
  136|   338M|        Z_UNUSED(MAX_LEN);
  ------------------
  |  |  154|   338M|#define Z_UNUSED(var) (void)(var)
  ------------------
  137|       |        /* Process using packed 64-bit arithmetic when source is aligned */
  138|   338M|        while (len >= 8 && ((uintptr_t)buf & 7) == 0) {
  ------------------
  |  Branch (138:16): [True: 0, False: 338M]
  |  Branch (138:28): [True: 0, False: 0]
  ------------------
  139|      0|            size_t chunk = MIN(ALIGN_DOWN(len, (size_t)8), (size_t)ADLER32_SWAR_MAX_BYTES);
  ------------------
  |  |  148|      0|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  140|      0|            adler32_swar(&adler, dst, buf, chunk, &sum2, COPY);
  141|      0|            buf += chunk;
  142|      0|            if (COPY)
  ------------------
  |  Branch (142:17): [True: 0, False: 0]
  ------------------
  143|      0|                dst += chunk;
  144|      0|            len -= chunk;
  145|      0|        }
  146|       |        /* DO4 loop avoids GCC x86 register pressure from hoisted DO8/DO16 loads. */
  147|   338M|        while (len >= 4) {
  ------------------
  |  Branch (147:16): [True: 0, False: 338M]
  ------------------
  148|      0|            if (COPY) {
  ------------------
  |  Branch (148:17): [True: 0, False: 0]
  ------------------
  149|      0|                memcpy(dst, buf, 4);
  150|      0|                dst += 4;
  151|      0|            }
  152|      0|            len -= 4;
  153|      0|            ADLER_DO4(adler, sum2, buf, 0);
  ------------------
  |  |   21|      0|#define ADLER_DO4(sum1, sum2, buf, i)  {ADLER_DO2(sum1, sum2, buf, i); ADLER_DO2(sum1, sum2, buf, i+2);}
  |  |  ------------------
  |  |  |  |   20|      0|#define ADLER_DO2(sum1, sum2, buf, i)  {ADLER_DO1(sum1, sum2, buf, i); ADLER_DO1(sum1, sum2, buf, i+1);}
  |  |  |  |  ------------------
  |  |  |  |  |  |   19|      0|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  |  |  |  |  ------------------
  |  |  |  |               #define ADLER_DO2(sum1, sum2, buf, i)  {ADLER_DO1(sum1, sum2, buf, i); ADLER_DO1(sum1, sum2, buf, i+1);}
  |  |  |  |  ------------------
  |  |  |  |  |  |   19|      0|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ADLER_DO4(sum1, sum2, buf, i)  {ADLER_DO2(sum1, sum2, buf, i); ADLER_DO2(sum1, sum2, buf, i+2);}
  |  |  ------------------
  |  |  |  |   20|      0|#define ADLER_DO2(sum1, sum2, buf, i)  {ADLER_DO1(sum1, sum2, buf, i); ADLER_DO1(sum1, sum2, buf, i+1);}
  |  |  |  |  ------------------
  |  |  |  |  |  |   19|      0|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  |  |  |  |  ------------------
  |  |  |  |               #define ADLER_DO2(sum1, sum2, buf, i)  {ADLER_DO1(sum1, sum2, buf, i); ADLER_DO1(sum1, sum2, buf, i+1);}
  |  |  |  |  ------------------
  |  |  |  |  |  |   19|      0|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  154|      0|            buf += 4;
  155|      0|        }
  156|   338M|        if (len & 2) {
  ------------------
  |  Branch (156:13): [True: 0, False: 338M]
  ------------------
  157|      0|            if (COPY) {
  ------------------
  |  Branch (157:17): [True: 0, False: 0]
  ------------------
  158|      0|                memcpy(dst, buf, 2);
  159|      0|                dst += 2;
  160|      0|            }
  161|      0|            ADLER_DO2(adler, sum2, buf, 0);
  ------------------
  |  |   20|      0|#define ADLER_DO2(sum1, sum2, buf, i)  {ADLER_DO1(sum1, sum2, buf, i); ADLER_DO1(sum1, sum2, buf, i+1);}
  |  |  ------------------
  |  |  |  |   19|      0|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  |  |  ------------------
  |  |               #define ADLER_DO2(sum1, sum2, buf, i)  {ADLER_DO1(sum1, sum2, buf, i); ADLER_DO1(sum1, sum2, buf, i+1);}
  |  |  ------------------
  |  |  |  |   19|      0|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  |  |  ------------------
  ------------------
  162|      0|            buf += 2;
  163|      0|        }
  164|   338M|        if (len & 1) {
  ------------------
  |  Branch (164:13): [True: 338M, False: 0]
  ------------------
  165|   338M|            if (COPY)
  ------------------
  |  Branch (165:17): [True: 338M, False: 0]
  ------------------
  166|   338M|                *dst = *buf;
  167|   338M|            ADLER_DO1(adler, sum2, buf, 0);
  ------------------
  |  |   19|   338M|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  ------------------
  168|   338M|        }
  169|   338M|    }
  170|   338M|    if (REBASE) {
  ------------------
  |  Branch (170:9): [True: 338M, False: 0]
  ------------------
  171|   338M|        adler %= BASE;
  ------------------
  |  |   13|   338M|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  172|   338M|        sum2 %= BASE;
  ------------------
  |  |   13|   338M|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  173|   338M|    }
  174|       |    /* D = B * 65536 + A, see: https://en.wikipedia.org/wiki/Adler-32. */
  175|   338M|    return adler | (sum2 << 16);
  176|   338M|}

adler32_copy_avx2:
  168|   338M|Z_INTERNAL uint32_t adler32_copy_avx2(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len) {
  169|   338M|    return adler32_copy_impl(adler, dst, src, len, 1);
  170|   338M|}
adler32_avx2.c:adler32_copy_impl:
   21|   338M|Z_FORCEINLINE static uint32_t adler32_copy_impl(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len, const int COPY) {
   22|   338M|    uint32_t adler0, adler1;
   23|   338M|    adler1 = (adler >> 16) & 0xffff;
   24|   338M|    adler0 = adler & 0xffff;
   25|       |
   26|   338M|rem_peel:
   27|   338M|    if (len < 16) {
  ------------------
  |  Branch (27:9): [True: 338M, False: 0]
  ------------------
   28|   338M|        return adler32_copy_tail(adler0, dst, src, len, adler1, 1, 15, COPY);
   29|   338M|    } else if (len < 32) {
  ------------------
  |  Branch (29:16): [True: 0, False: 0]
  ------------------
   30|      0|        if (COPY) {
  ------------------
  |  Branch (30:13): [True: 0, False: 0]
  ------------------
   31|      0|            return adler32_copy_sse42(adler, dst, src, len);
   32|      0|        } else {
   33|      0|            return adler32_ssse3(adler, src, len);
   34|      0|        }
   35|      0|    }
   36|       |
   37|      0|    __m256i vs1, vs2, vs2_0;
   38|       |
   39|      0|    const __m256i dot2v = _mm256_setr_epi8(64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47,
   40|      0|                                           46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33);
   41|      0|    const __m256i dot2v_0 = _mm256_setr_epi8(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15,
   42|      0|                                             14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
   43|      0|    const __m256i dot3v = _mm256_set1_epi16(1);
   44|      0|    const __m256i zero = _mm256_setzero_si256();
   45|       |
   46|      0|    while (len >= 32) {
  ------------------
  |  Branch (46:12): [True: 0, False: 0]
  ------------------
   47|      0|        vs1 = _mm256_zextsi128_si256(_mm_cvtsi32_si128(adler0));
   48|      0|        vs2 = _mm256_zextsi128_si256(_mm_cvtsi32_si128(adler1));
   49|      0|        __m256i vs1_0 = vs1;
   50|      0|        __m256i vs3 = _mm256_setzero_si256();
   51|      0|        vs2_0 = vs3;
   52|       |
   53|      0|        size_t k = ALIGN_DOWN(MIN(len, NMAX), 32);
  ------------------
  |  |  293|      0|    ((value) & ~((align) - 1))
  |  |  ------------------
  |  |  |  Branch (293:7): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   54|      0|        len -= k;
   55|       |
   56|      0|        while (k >= 64) {
  ------------------
  |  Branch (56:16): [True: 0, False: 0]
  ------------------
   57|      0|            __m256i vbuf = _mm256_loadu_si256((__m256i*)src);
   58|      0|            __m256i vbuf_0 = _mm256_loadu_si256((__m256i*)(src + 32));
   59|      0|            src += 64;
   60|      0|            k -= 64;
   61|       |
   62|      0|            __m256i vs1_sad = _mm256_sad_epu8(vbuf, zero);
   63|      0|            __m256i vs1_sad2 = _mm256_sad_epu8(vbuf_0, zero);
   64|       |
   65|      0|            if (COPY) {
  ------------------
  |  Branch (65:17): [True: 0, False: 0]
  ------------------
   66|      0|                _mm256_storeu_si256((__m256i*)dst, vbuf);
   67|      0|                _mm256_storeu_si256((__m256i*)(dst + 32), vbuf_0);
   68|      0|                dst += 64;
   69|      0|            }
   70|       |
   71|      0|            vs1 = _mm256_add_epi32(vs1, vs1_sad);
   72|      0|            vs3 = _mm256_add_epi32(vs3, vs1_0);
   73|      0|            __m256i v_short_sum2 = _mm256_maddubs_epi16(vbuf, dot2v); // sum 32 uint8s to 16 shorts
   74|      0|            __m256i v_short_sum2_0 = _mm256_maddubs_epi16(vbuf_0, dot2v_0); // sum 32 uint8s to 16 shorts
   75|      0|            __m256i vsum2 = _mm256_madd_epi16(v_short_sum2, dot3v); // sum 16 shorts to 8 uint32s
   76|      0|            __m256i vsum2_0 = _mm256_madd_epi16(v_short_sum2_0, dot3v); // sum 16 shorts to 8 uint32s
   77|      0|            vs1 = _mm256_add_epi32(vs1_sad2, vs1);
   78|      0|            vs2 = _mm256_add_epi32(vsum2, vs2);
   79|      0|            vs2_0 = _mm256_add_epi32(vsum2_0, vs2_0);
   80|      0|            vs1_0 = vs1;
   81|      0|        }
   82|       |
   83|      0|        vs2 = _mm256_add_epi32(vs2_0, vs2);
   84|      0|        vs3 = _mm256_slli_epi32(vs3, 6);
   85|      0|        vs2 = _mm256_add_epi32(vs3, vs2);
   86|      0|        vs3 = _mm256_setzero_si256();
   87|       |
   88|      0|        while (k >= 32) {
  ------------------
  |  Branch (88:16): [True: 0, False: 0]
  ------------------
   89|       |            /*
   90|       |               vs1 = adler + sum(c[i])
   91|       |               vs2 = sum2 + 32 vs1 + sum( (32-i+1) c[i] )
   92|       |            */
   93|      0|            __m256i vbuf = _mm256_loadu_si256((__m256i*)src);
   94|      0|            src += 32;
   95|      0|            k -= 32;
   96|       |
   97|      0|            __m256i vs1_sad = _mm256_sad_epu8(vbuf, zero); // Sum of abs diff, resulting in 2 x int32's
   98|       |
   99|      0|            if (COPY) {
  ------------------
  |  Branch (99:17): [True: 0, False: 0]
  ------------------
  100|      0|                _mm256_storeu_si256((__m256i*)dst, vbuf);
  101|      0|                dst += 32;
  102|      0|            }
  103|       |
  104|      0|            vs1 = _mm256_add_epi32(vs1, vs1_sad);
  105|      0|            vs3 = _mm256_add_epi32(vs3, vs1_0);
  106|      0|            __m256i v_short_sum2 = _mm256_maddubs_epi16(vbuf, dot2v_0); // sum 32 uint8s to 16 shorts
  107|      0|            __m256i vsum2 = _mm256_madd_epi16(v_short_sum2, dot3v); // sum 16 shorts to 8 uint32s
  108|      0|            vs2 = _mm256_add_epi32(vsum2, vs2);
  109|      0|            vs1_0 = vs1;
  110|      0|        }
  111|       |
  112|       |        /* Defer the multiplication with 32 to outside of the loop */
  113|      0|        vs3 = _mm256_slli_epi32(vs3, 5);
  114|      0|        vs2 = _mm256_add_epi32(vs2, vs3);
  115|       |
  116|       |        /* The compiler is generating the following sequence for this integer modulus
  117|       |         * when done the scalar way, in GPRs:
  118|       |
  119|       |         adler = (s1_unpack[0] % BASE) + (s1_unpack[1] % BASE) + (s1_unpack[2] % BASE) + (s1_unpack[3] % BASE) +
  120|       |                 (s1_unpack[4] % BASE) + (s1_unpack[5] % BASE) + (s1_unpack[6] % BASE) + (s1_unpack[7] % BASE);
  121|       |
  122|       |         mov    $0x80078071,%edi // move magic constant into 32 bit register %edi
  123|       |         ...
  124|       |         vmovd  %xmm1,%esi // move vector lane 0 to 32 bit register %esi
  125|       |         mov    %rsi,%rax  // zero-extend this value to 64 bit precision in %rax
  126|       |         imul   %rdi,%rsi // do a signed multiplication with magic constant and vector element
  127|       |         shr    $0x2f,%rsi // shift right by 47
  128|       |         imul   $0xfff1,%esi,%esi // do a signed multiplication with value truncated to 32 bits with 0xfff1
  129|       |         sub    %esi,%eax // subtract lower 32 bits of original vector value from modified one above
  130|       |         ...
  131|       |         // repeats for each element with vpextract instructions
  132|       |
  133|       |         This is tricky with AVX2 for a number of reasons:
  134|       |             1.) There's no 64 bit multiplication instruction, but there is a sequence to get there
  135|       |             2.) There's ways to extend vectors to 64 bit precision, but no simple way to truncate
  136|       |                 back down to 32 bit precision later (there is in AVX512)
  137|       |             3.) Full width integer multiplications aren't cheap
  138|       |
  139|       |         We can, however, do a relatively cheap sequence for horizontal sums.
  140|       |         Then, we simply do the integer modulus on the resulting 64 bit GPR, on a scalar value. It was
  141|       |         previously thought that casting to 64 bit precision was needed prior to the horizontal sum, but
  142|       |         that is simply not the case, as NMAX is defined as the maximum number of scalar sums that can be
  143|       |         performed on the maximum possible inputs before overflow
  144|       |         */
  145|       |
  146|       |
  147|       |         /* In AVX2-land, this trip through GPRs will probably be unavoidable, as there's no cheap and easy
  148|       |          * conversion from 64 bit integer to 32 bit (needed for the inexpensive modulus with a constant).
  149|       |          * This casting to 32 bit is cheap through GPRs (just register aliasing). See above for exactly
  150|       |          * what the compiler is doing to avoid integer divisions. */
  151|      0|         adler0 = partial_hsum256(vs1) % BASE;
  ------------------
  |  |   13|      0|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  152|      0|         adler1 = hsum256(vs2) % BASE;
  ------------------
  |  |   13|      0|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  153|      0|    }
  154|       |
  155|      0|    adler = adler0 | (adler1 << 16);
  156|       |
  157|      0|    if (len) {
  ------------------
  |  Branch (157:9): [True: 0, False: 0]
  ------------------
  158|      0|        goto rem_peel;
  159|      0|    }
  160|       |
  161|      0|    return adler;
  162|      0|}

compare256_avx2.c:compare256_avx2_static:
   19|  1.12M|Z_FORCEINLINE static uint32_t compare256_avx2_static(const uint8_t *src0, const uint8_t *src1) {
   20|  1.12M|    uint32_t len = 0;
   21|       |
   22|  1.47M|    do {
   23|  1.47M|        __m256i ymm_src0, ymm_src1, ymm_cmp;
   24|  1.47M|        ymm_src0 = _mm256_loadu_si256((__m256i*)src0);
   25|  1.47M|        ymm_src1 = _mm256_loadu_si256((__m256i*)src1);
   26|  1.47M|        ymm_cmp = _mm256_cmpeq_epi8(ymm_src0, ymm_src1); /* non-identical bytes = 00, identical bytes = FF */
   27|  1.47M|        unsigned mask = (unsigned)_mm256_movemask_epi8(ymm_cmp);
   28|  1.47M|        if (mask != 0xFFFFFFFF)
  ------------------
  |  Branch (28:13): [True: 789k, False: 681k]
  ------------------
   29|   789k|            return len + zng_ctz32(~mask); /* Invert bits so identical = 0 */
   30|       |
   31|   681k|        src0 += 32, src1 += 32, len += 32;
   32|       |
   33|   681k|        ymm_src0 = _mm256_loadu_si256((__m256i*)src0);
   34|   681k|        ymm_src1 = _mm256_loadu_si256((__m256i*)src1);
   35|   681k|        ymm_cmp = _mm256_cmpeq_epi8(ymm_src0, ymm_src1);
   36|   681k|        mask = (unsigned)_mm256_movemask_epi8(ymm_cmp);
   37|   681k|        if (mask != 0xFFFFFFFF)
  ------------------
  |  Branch (37:13): [True: 264k, False: 416k]
  ------------------
   38|   264k|            return len + zng_ctz32(~mask);
   39|       |
   40|   416k|        src0 += 32, src1 += 32, len += 32;
   41|   416k|    } while (len < 256);
  ------------------
  |  Branch (41:14): [True: 347k, False: 69.0k]
  ------------------
   42|       |
   43|  69.0k|    return 256;
   44|  1.12M|}

slide_hash_avx2:
   39|  4.05k|Z_INTERNAL void slide_hash_avx2(deflate_state *s) {
   40|  4.05k|    Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t");
   41|  4.05k|    uint16_t wsize = (uint16_t)s->w_size;
   42|  4.05k|    const __m256i ymm_wsize = _mm256_set1_epi16((short)wsize);
   43|       |
   44|  4.05k|    slide_hash_chain(s->head, HASH_SIZE, ymm_wsize);
  ------------------
  |  |   84|  4.05k|#  define HASH_SIZE 65536u         /* number of elements in hash table */
  ------------------
   45|  4.05k|    slide_hash_chain(s->prev, wsize, ymm_wsize);
   46|  4.05k|}
slide_hash_avx2.c:slide_hash_chain:
   20|  8.10k|static inline void slide_hash_chain(Pos *table, uint32_t entries, const __m256i wsize) {
   21|  8.10k|    table += entries;
   22|  8.10k|    table -= 32;
   23|       |
   24|  12.4M|    do {
   25|  12.4M|        __m256i value1, value2, result1, result2;
   26|       |
   27|  12.4M|        value1 = _mm256_load_si256((__m256i *)table);
   28|  12.4M|        value2 = _mm256_load_si256((__m256i *)(table+16));
   29|  12.4M|        result1 = _mm256_subs_epu16(value1, wsize);
   30|  12.4M|        result2 = _mm256_subs_epu16(value2, wsize);
   31|  12.4M|        _mm256_store_si256((__m256i *)table, result1);
   32|  12.4M|        _mm256_store_si256((__m256i *)(table+16), result2);
   33|       |
   34|  12.4M|        table -= 32;
   35|  12.4M|        entries -= 32;
   36|  12.4M|    } while (entries > 0);
  ------------------
  |  Branch (36:14): [True: 12.4M, False: 8.10k]
  ------------------
   37|  8.10k|}

x86_check_features:
   78|      2|void Z_INTERNAL x86_check_features(struct x86_cpu_features *features) {
   79|      2|    unsigned eax, ebx, ecx, edx;
   80|      2|    unsigned maxbasic;
   81|       |
   82|      2|    cpuid(0, &maxbasic, &ebx, &ecx, &edx);
   83|      2|    cpuid(1 /*CPU_PROCINFO_AND_FEATUREBITS*/, &eax, &ebx, &ecx, &edx);
   84|       |
   85|      2|    features->has_sse2 = edx & 0x4000000;
   86|      2|    features->has_ssse3 = ecx & 0x200;
   87|      2|    features->has_sse41 = ecx & 0x80000;
   88|      2|    features->has_sse42 = ecx & 0x100000;
   89|      2|    features->has_pclmulqdq = ecx & 0x2;
   90|       |
   91|      2|    if (ecx & 0x08000000) {
  ------------------
  |  Branch (91:9): [True: 2, False: 0]
  ------------------
   92|      2|        uint64_t xfeature = xgetbv(0);
   93|       |
   94|      2|        features->has_os_save_ymm = ((xfeature & 0x06) == 0x06);
   95|      2|        features->has_os_save_zmm = ((xfeature & 0xe6) == 0xe6);
   96|      2|    }
   97|       |
   98|      2|    if (maxbasic >= 7) {
  ------------------
  |  Branch (98:9): [True: 2, False: 0]
  ------------------
   99|       |        // Reference: https://software.intel.com/sites/default/files/article/405250/how-to-detect-new-instruction-support-in-the-4th-generation-intel-core-processor-family.pdf
  100|      2|        cpuidex(7, 0, &eax, &ebx, &ecx, &edx);
  101|       |
  102|       |        // check BMI2 bit
  103|      2|        features->has_bmi2 = ebx & 0x100;
  104|       |
  105|       |        // check AVX2 bit if the OS supports saving YMM registers
  106|      2|        if (features->has_os_save_ymm) {
  ------------------
  |  Branch (106:13): [True: 2, False: 0]
  ------------------
  107|      2|            features->has_avx2 = ebx & 0x20;
  108|      2|            features->has_vpclmulqdq = ecx & 0x400;
  109|      2|        }
  110|       |
  111|       |        // check AVX512 bits if the OS supports saving ZMM registers
  112|      2|        if (features->has_os_save_zmm) {
  ------------------
  |  Branch (112:13): [True: 0, False: 2]
  ------------------
  113|      0|            features->has_avx512f = ebx & 0x00010000;
  114|      0|            if (features->has_avx512f) {
  ------------------
  |  Branch (114:17): [True: 0, False: 0]
  ------------------
  115|       |                // According to the Intel Software Developer's Manual, AVX512F must be enabled too in order to enable
  116|       |                // AVX512(DQ,BW,VL).
  117|      0|                features->has_avx512dq = ebx & 0x00020000;
  118|      0|                features->has_avx512bw = ebx & 0x40000000;
  119|      0|                features->has_avx512vl = ebx & 0x80000000;
  120|      0|            }
  121|      0|            features->has_avx512_common = features->has_avx512f && features->has_avx512dq && features->has_avx512bw \
  ------------------
  |  Branch (121:43): [True: 0, False: 0]
  |  Branch (121:68): [True: 0, False: 0]
  |  Branch (121:94): [True: 0, False: 0]
  ------------------
  122|      0|              && features->has_avx512vl && features->has_bmi2;
  ------------------
  |  Branch (122:18): [True: 0, False: 0]
  |  Branch (122:44): [True: 0, False: 0]
  ------------------
  123|      0|            features->has_avx512vnni = ecx & 0x800;
  124|      0|        }
  125|       |
  126|      2|        if (features->has_os_save_ymm) {
  ------------------
  |  Branch (126:13): [True: 2, False: 0]
  ------------------
  127|      2|            cpuidex(7, 1, &eax, &ebx, &ecx, &edx);
  128|      2|            features->has_avx2vnni = eax & 0x10;
  129|      2|        }
  130|       |
  131|      2|    }
  132|      2|}
x86_features.c:cpuid:
   29|      4|static inline void cpuid(int info, unsigned* eax, unsigned* ebx, unsigned* ecx, unsigned* edx) {
   30|       |#if defined(HAVE_CPUID_MS)
   31|       |    unsigned int registers[4];
   32|       |    __cpuid((int *)registers, info);
   33|       |
   34|       |    *eax = registers[0];
   35|       |    *ebx = registers[1];
   36|       |    *ecx = registers[2];
   37|       |    *edx = registers[3];
   38|       |#elif defined(HAVE_CPUID_GNU)
   39|       |    *eax = *ebx = *ecx = *edx = 0;
   40|      4|    __cpuid(info, *eax, *ebx, *ecx, *edx);
   41|       |#else
   42|       |    /* When using this fallback, the faster SSE/AVX code is disabled */
   43|       |    *eax = *ebx = *ecx = *edx = 0;
   44|       |#endif
   45|      4|}
x86_features.c:xgetbv:
   65|      2|static inline uint64_t xgetbv(unsigned int xcr) {
   66|      2|#if defined(_MSC_VER) || defined(X86_HAVE_XSAVE_INTRIN)
   67|      2|    return _xgetbv(xcr);
   68|       |#elif defined(__GNUC__)
   69|       |    uint32_t eax, edx;
   70|       |    __asm__ ( ".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c"(xcr));
   71|       |    return (uint64_t)(edx) << 32 | eax;
   72|       |#else
   73|       |    /* When using this fallback, some of the faster code is disabled */
   74|       |    return 0;
   75|       |#endif
   76|      2|}
x86_features.c:cpuidex:
   47|      4|static inline void cpuidex(int info, int subinfo, unsigned* eax, unsigned* ebx, unsigned* ecx, unsigned* edx) {
   48|       |#if defined(HAVE_CPUID_MS)
   49|       |    unsigned int registers[4];
   50|       |    __cpuidex((int *)registers, info, subinfo);
   51|       |
   52|       |    *eax = registers[0];
   53|       |    *ebx = registers[1];
   54|       |    *ecx = registers[2];
   55|       |    *edx = registers[3];
   56|       |#elif defined(HAVE_CPUID_GNU)
   57|       |    *eax = *ebx = *ecx = *edx = 0;
   58|      4|    __cpuid_count(info, subinfo, *eax, *ebx, *ecx, *edx);
   59|       |#else
   60|       |    /* When using this fallback, the faster SSE/AVX code is disabled */
   61|       |    *eax = *ebx = *ecx = *edx = 0;
   62|       |#endif
   63|      4|}

zng_compressBound:
   93|  3.55k|size_t Z_EXPORT PREFIX(compressBound)(size_t sourceLen) {
   94|  3.55k|#endif
   95|  3.55k|    z_size_t complen = DEFLATE_BOUND_COMPLEN(sourceLen);
  ------------------
  |  |  126|  3.55k|#  define z_size_t size_t
  ------------------
                  z_size_t complen = DEFLATE_BOUND_COMPLEN(sourceLen);
  ------------------
  |  |   19|  3.55k|#  define DEFLATE_BOUND_COMPLEN(source_len) 0
  ------------------
   96|  3.55k|    z_size_t bound;
  ------------------
  |  |  126|  3.55k|#  define z_size_t size_t
  ------------------
   97|       |
   98|  3.55k|    if (complen > 0) {
  ------------------
  |  Branch (98:9): [True: 0, False: 3.55k]
  ------------------
   99|       |        /* Architecture-specific code provided an upper bound. */
  100|      0|        bound = complen + ZLIB_WRAPLEN;
  ------------------
  |  |   73|      0|#define ZLIB_WRAPLEN 6      /* zlib format overhead */
  ------------------
  101|      0|        return bound < sourceLen ? (z_size_t)-1 : bound;
  ------------------
  |  Branch (101:16): [True: 0, False: 0]
  ------------------
  102|      0|    }
  103|       |
  104|  3.55k|#ifndef NO_QUICK_STRATEGY
  105|  3.55k|    bound = sourceLen                      /* The source size itself */
  106|  3.55k|      + (sourceLen == 0 ? 1 : 0)           /* Always at least one byte for any input */
  ------------------
  |  Branch (106:10): [True: 0, False: 3.55k]
  ------------------
  107|  3.55k|      + (sourceLen < 9 ? 1 : 0)            /* One extra byte for lengths less than 9 */
  ------------------
  |  Branch (107:10): [True: 162, False: 3.38k]
  ------------------
  108|  3.55k|      + DEFLATE_QUICK_OVERHEAD(sourceLen)  /* Source encoding overhead, padded to next full byte */
  ------------------
  |  |   83|  3.55k|#define DEFLATE_QUICK_OVERHEAD(x) ((x * (DEFLATE_QUICK_LIT_MAX_BITS - 8) + 7) >> 3)
  |  |  ------------------
  |  |  |  |   82|  3.55k|#define DEFLATE_QUICK_LIT_MAX_BITS 9
  |  |  ------------------
  ------------------
  109|  3.55k|      + DEFLATE_BLOCK_OVERHEAD             /* Deflate block overhead bytes */
  ------------------
  |  |   79|  3.55k|#define DEFLATE_BLOCK_OVERHEAD ((DEFLATE_HEADER_BITS + DEFLATE_EOBS_BITS + DEFLATE_PAD_BITS) >> 3)
  |  |  ------------------
  |  |  |  |   76|  3.55k|#define DEFLATE_HEADER_BITS 3
  |  |  ------------------
  |  |               #define DEFLATE_BLOCK_OVERHEAD ((DEFLATE_HEADER_BITS + DEFLATE_EOBS_BITS + DEFLATE_PAD_BITS) >> 3)
  |  |  ------------------
  |  |  |  |   77|  3.55k|#define DEFLATE_EOBS_BITS   15
  |  |  ------------------
  |  |               #define DEFLATE_BLOCK_OVERHEAD ((DEFLATE_HEADER_BITS + DEFLATE_EOBS_BITS + DEFLATE_PAD_BITS) >> 3)
  |  |  ------------------
  |  |  |  |   78|  3.55k|#define DEFLATE_PAD_BITS    6
  |  |  ------------------
  ------------------
  110|  3.55k|      + ZLIB_WRAPLEN;                      /* zlib wrapper */
  ------------------
  |  |   73|  3.55k|#define ZLIB_WRAPLEN 6      /* zlib format overhead */
  ------------------
  111|       |#else
  112|       |    bound = sourceLen + (sourceLen >> 4) + 7 + ZLIB_WRAPLEN;
  113|       |#endif
  114|  3.55k|    return bound < sourceLen ? (z_size_t)-1 : bound;
  ------------------
  |  Branch (114:12): [True: 0, False: 3.55k]
  ------------------
  115|  3.55k|}

cpu_check_features:
   10|      2|Z_INTERNAL void cpu_check_features(struct cpu_features *features) {
   11|      2|    memset(features, 0, sizeof(struct cpu_features));
   12|      2|#if defined(X86_FEATURES)
   13|      2|    x86_check_features(&features->x86);
   14|       |#elif defined(ARM_FEATURES)
   15|       |    arm_check_features(&features->arm);
   16|       |#elif defined(MIPS_FEATURES)
   17|       |    mips_check_features(&features->mips);
   18|       |#elif defined(PPC_FEATURES) || defined(POWER_FEATURES)
   19|       |    power_check_features(&features->power);
   20|       |#elif defined(S390_FEATURES)
   21|       |    s390_check_features(&features->s390);
   22|       |#elif defined(RISCV_FEATURES)
   23|       |    riscv_check_features(&features->riscv);
   24|       |#elif defined(LOONGARCH_FEATURES)
   25|       |    loongarch_check_features(&features->loongarch);
   26|       |#endif
   27|      2|}

alloc_deflate:
  192|  3.55k|Z_INTERNAL deflate_allocs* alloc_deflate(PREFIX3(stream) *strm, int windowBits, int lit_bufsize) {
  193|  3.55k|    int curr_size = 0;
  194|       |
  195|       |    /* Define sizes */
  196|  3.55k|    int window_size = DEFLATE_ADJUST_WINDOW_SIZE((1 << windowBits) * 2);
  ------------------
  |  |  479|  3.55k|#  define DEFLATE_ADJUST_WINDOW_SIZE(n) (n)
  ------------------
  197|  3.55k|    int prev_size = (1 << windowBits) * (int)sizeof(Pos);
  198|  3.55k|    int head_size = HASH_SIZE * sizeof(Pos);
  ------------------
  |  |   84|  3.55k|#  define HASH_SIZE 65536u         /* number of elements in hash table */
  ------------------
  199|  3.55k|    int pending_size = PENDING_BUF_SIZE(lit_bufsize);
  ------------------
  |  |  186|  3.55k|#define PENDING_BUF_SIZE(lit_bufsize) (((lit_bufsize) * LIT_BUFS) + 1 + PENDING_BUF_PAD)
  |  |  ------------------
  |  |  |  |  305|  3.55k|#   define LIT_BUFS 4
  |  |  ------------------
  |  |               #define PENDING_BUF_SIZE(lit_bufsize) (((lit_bufsize) * LIT_BUFS) + 1 + PENDING_BUF_PAD)
  |  |  ------------------
  |  |  |  |  184|  3.55k|#define PENDING_BUF_PAD 8
  |  |  ------------------
  ------------------
  200|  3.55k|    int state_size = sizeof(deflate_state);
  201|  3.55k|    int alloc_size = sizeof(deflate_allocs);
  202|       |
  203|       |    /* Calculate relative buffer positions and paddings */
  204|  3.55k|    LOGSZP("window", window_size, PAD_WINDOW(curr_size), PADSZ(curr_size,WINDOW_PAD_SIZE));
  205|  3.55k|    int window_pos = PAD_WINDOW(curr_size);
  ------------------
  |  |  475|  3.55k|#  define PAD_WINDOW            PAD_64
  |  |  ------------------
  |  |  |  |  301|  3.55k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  |  |  ------------------
  |  |  |  |  |  |  299|  3.55k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  206|  3.55k|    curr_size = window_pos + window_size;
  207|       |
  208|  3.55k|    LOGSZP("prev", prev_size, PAD_64(curr_size), PADSZ(curr_size,64));
  209|  3.55k|    int prev_pos = PAD_64(curr_size);
  ------------------
  |  |  301|  3.55k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  299|  3.55k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  210|  3.55k|    curr_size = prev_pos + prev_size;
  211|       |
  212|  3.55k|    LOGSZP("head", head_size, PAD_64(curr_size), PADSZ(curr_size,64));
  213|  3.55k|    int head_pos = PAD_64(curr_size);
  ------------------
  |  |  301|  3.55k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  299|  3.55k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  214|  3.55k|    curr_size = head_pos + head_size;
  215|       |
  216|  3.55k|    LOGSZP("pending", pending_size, PAD_64(curr_size), PADSZ(curr_size,64));
  217|  3.55k|    int pending_pos = PAD_64(curr_size);
  ------------------
  |  |  301|  3.55k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  299|  3.55k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  218|  3.55k|    curr_size = pending_pos + pending_size;
  219|       |
  220|  3.55k|    LOGSZP("state", state_size, PAD_64(curr_size), PADSZ(curr_size,64));
  221|  3.55k|    int state_pos = PAD_64(curr_size);
  ------------------
  |  |  301|  3.55k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  299|  3.55k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  222|  3.55k|    curr_size = state_pos + state_size;
  223|       |
  224|  3.55k|    LOGSZP("alloc", alloc_size, PAD_16(curr_size), PADSZ(curr_size,16));
  225|  3.55k|    int alloc_pos = PAD_16(curr_size);
  ------------------
  |  |  300|  3.55k|#define PAD_16(bpos) ((bpos) + PADSZ((bpos),16))
  |  |  ------------------
  |  |  |  |  299|  3.55k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  226|  3.55k|    curr_size = alloc_pos + alloc_size;
  227|       |
  228|       |    /* Add 64-1 or 4096-1 to allow window alignment, and round size of buffer up to multiple of 64 */
  229|  3.55k|    int total_size = PAD_64(curr_size + (WINDOW_PAD_SIZE - 1));
  ------------------
  |  |  301|  3.55k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  299|  3.55k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  230|       |
  231|       |    /* Allocate buffer, align to 64-byte cacheline, and zerofill the resulting buffer */
  232|  3.55k|    char *original_buf = (char *)strm->zalloc(strm->opaque, 1, total_size);
  233|  3.55k|    if (original_buf == NULL)
  ------------------
  |  Branch (233:9): [True: 0, False: 3.55k]
  ------------------
  234|      0|        return NULL;
  235|       |
  236|  3.55k|    char *buff = (char *)HINT_ALIGNED_WINDOW((char *)PAD_WINDOW(original_buf));
  ------------------
  |  |  477|  3.55k|#  define HINT_ALIGNED_WINDOW   HINT_ALIGNED_64
  |  |  ------------------
  |  |  |  |  280|  3.55k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  275|  3.55k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  237|  3.55k|    LOGSZPL("Buffer alloc", total_size, PADSZ((uintptr_t)original_buf,WINDOW_PAD_SIZE), PADSZ(curr_size,WINDOW_PAD_SIZE));
  238|       |
  239|       |    /* Initialize alloc_bufs */
  240|  3.55k|    deflate_allocs *alloc_bufs  = (struct deflate_allocs_s *)(buff + alloc_pos);
  241|  3.55k|    alloc_bufs->buf_start = original_buf;
  242|  3.55k|    alloc_bufs->zfree = strm->zfree;
  243|       |
  244|       |    /* Assign buffers */
  245|  3.55k|    alloc_bufs->window = (unsigned char *)HINT_ALIGNED_WINDOW(buff + window_pos);
  ------------------
  |  |  477|  3.55k|#  define HINT_ALIGNED_WINDOW   HINT_ALIGNED_64
  |  |  ------------------
  |  |  |  |  280|  3.55k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  275|  3.55k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  246|  3.55k|    alloc_bufs->prev = (Pos *)HINT_ALIGNED_64(buff + prev_pos);
  ------------------
  |  |  280|  3.55k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  ------------------
  |  |  |  |  275|  3.55k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  ------------------
  ------------------
  247|  3.55k|    alloc_bufs->head = (Pos *)HINT_ALIGNED_64(buff + head_pos);
  ------------------
  |  |  280|  3.55k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  ------------------
  |  |  |  |  275|  3.55k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  ------------------
  ------------------
  248|  3.55k|    alloc_bufs->pending_buf = (unsigned char *)HINT_ALIGNED_64(buff + pending_pos);
  ------------------
  |  |  280|  3.55k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  ------------------
  |  |  |  |  275|  3.55k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  ------------------
  ------------------
  249|  3.55k|    alloc_bufs->state = (deflate_state *)HINT_ALIGNED_16(buff + state_pos);
  ------------------
  |  |  279|  3.55k|#define HINT_ALIGNED_16(p) HINT_ALIGNED((p),16)
  |  |  ------------------
  |  |  |  |  275|  3.55k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  ------------------
  ------------------
  250|       |
  251|  3.55k|    memset(alloc_bufs->prev, 0, prev_size);
  252|       |
  253|  3.55k|    return alloc_bufs;
  254|  3.55k|}
zng_deflateInit2:
  274|  3.55k|                                            int32_t memLevel, int32_t strategy) {
  275|       |    /* Todo: ignore strm->next_in if we use it as window */
  276|  3.55k|    deflate_state *s;
  277|  3.55k|    int wrap = 1;
  278|       |
  279|       |    /* Initialize functable */
  280|  3.55k|    FUNCTABLE_INIT;
  ------------------
  |  |   47|  3.55k|#  define FUNCTABLE_INIT if (functable.force_init()) {return Z_VERSION_ERROR;}
  |  |  ------------------
  |  |  |  |  188|      0|#define Z_VERSION_ERROR (-6)
  |  |  ------------------
  |  |  |  Branch (47:30): [True: 0, False: 3.55k]
  |  |  ------------------
  ------------------
  281|       |
  282|  3.55k|    if (strm == NULL)
  ------------------
  |  Branch (282:9): [True: 0, False: 3.55k]
  ------------------
  283|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  284|       |
  285|  3.55k|    strm->msg = NULL;
  286|  3.55k|    if (strm->zalloc == NULL) {
  ------------------
  |  Branch (286:9): [True: 3.55k, False: 0]
  ------------------
  287|  3.55k|        strm->zalloc = PREFIX(zcalloc);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
  288|  3.55k|        strm->opaque = NULL;
  289|  3.55k|    }
  290|  3.55k|    if (strm->zfree == NULL)
  ------------------
  |  Branch (290:9): [True: 3.55k, False: 0]
  ------------------
  291|  3.55k|        strm->zfree = PREFIX(zcfree);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
  292|       |
  293|  3.55k|    if (level == Z_DEFAULT_COMPRESSION)
  ------------------
  |  |  196|  3.55k|#define Z_DEFAULT_COMPRESSION  (-1)
  ------------------
  |  Branch (293:9): [True: 3.55k, False: 0]
  ------------------
  294|  3.55k|        level = 6;
  295|       |
  296|  3.55k|    if (windowBits < 0) { /* suppress zlib wrapper */
  ------------------
  |  Branch (296:9): [True: 0, False: 3.55k]
  ------------------
  297|      0|        wrap = 0;
  298|      0|        if (windowBits < -MAX_WBITS)
  ------------------
  |  |   40|      0|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (298:13): [True: 0, False: 0]
  ------------------
  299|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  300|      0|        windowBits = -windowBits;
  301|      0|#ifdef GZIP
  302|  3.55k|    } else if (windowBits > MAX_WBITS) {
  ------------------
  |  |   40|  3.55k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (302:16): [True: 0, False: 3.55k]
  ------------------
  303|      0|        wrap = 2;       /* write gzip wrapper instead */
  304|      0|        windowBits -= 16;
  305|      0|#endif
  306|      0|    }
  307|  3.55k|    if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < MIN_WBITS ||
  ------------------
  |  |   28|  7.10k|#  define MAX_MEM_LEVEL 9
  ------------------
                  if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < MIN_WBITS ||
  ------------------
  |  |  212|  7.10k|#define Z_DEFLATED   8
  ------------------
                  if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < MIN_WBITS ||
  ------------------
  |  |   37|  7.10k|#  define MIN_WBITS   8  /* 256 LZ77 window */
  ------------------
  |  Branch (307:9): [True: 0, False: 3.55k]
  |  Branch (307:25): [True: 0, False: 3.55k]
  |  Branch (307:53): [True: 0, False: 3.55k]
  |  Branch (307:77): [True: 0, False: 3.55k]
  ------------------
  308|  3.55k|        windowBits > MAX_WBITS || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED ||
  ------------------
  |  |   40|  7.10k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
                      windowBits > MAX_WBITS || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED ||
  ------------------
  |  |  202|  7.10k|#define Z_FIXED               4
  ------------------
  |  Branch (308:9): [True: 0, False: 3.55k]
  |  Branch (308:35): [True: 0, False: 3.55k]
  |  Branch (308:48): [True: 0, False: 3.55k]
  |  Branch (308:61): [True: 0, False: 3.55k]
  |  Branch (308:77): [True: 0, False: 3.55k]
  ------------------
  309|  3.55k|        (windowBits == 8 && wrap != 1)) {
  ------------------
  |  Branch (309:10): [True: 0, False: 3.55k]
  |  Branch (309:29): [True: 0, False: 0]
  ------------------
  310|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  311|      0|    }
  312|  3.55k|    if (windowBits == 8)
  ------------------
  |  Branch (312:9): [True: 0, False: 3.55k]
  ------------------
  313|      0|        windowBits = 9;  /* until 256-byte window bug fixed */
  314|       |
  315|       |    /* Allocate buffers */
  316|  3.55k|    int lit_bufsize = 1 << (memLevel + 6);
  317|  3.55k|    deflate_allocs *alloc_bufs = alloc_deflate(strm, windowBits, lit_bufsize);
  318|  3.55k|    if (alloc_bufs == NULL)
  ------------------
  |  Branch (318:9): [True: 0, False: 3.55k]
  ------------------
  319|      0|        return Z_MEM_ERROR;
  ------------------
  |  |  186|      0|#define Z_MEM_ERROR    (-4)
  ------------------
  320|       |
  321|  3.55k|    s = alloc_bufs->state;
  322|  3.55k|    s->alloc_bufs = alloc_bufs;
  323|  3.55k|    s->window = alloc_bufs->window;
  324|  3.55k|    s->prev = alloc_bufs->prev;
  325|  3.55k|    s->head = alloc_bufs->head;
  326|  3.55k|    s->pending_buf = alloc_bufs->pending_buf;
  327|       |
  328|  3.55k|    strm->state = (struct internal_state *)s;
  329|  3.55k|    s->strm = strm;
  330|  3.55k|    s->status = INIT_STATE;     /* to pass state test in deflateReset() */
  ------------------
  |  |   66|  3.55k|#define INIT_STATE      1    /* zlib header -> BUSY_STATE */
  ------------------
  331|       |
  332|  3.55k|    s->wrap = wrap;
  333|  3.55k|    s->w_size = 1 << windowBits;
  334|       |
  335|  3.55k|    s->high_water = 0;      /* nothing written to s->window yet */
  336|       |
  337|  3.55k|    s->lit_bufsize = lit_bufsize; /* 16K elements by default */
  338|       |
  339|       |    /* We overlay pending_buf and sym_buf. This works since the average size
  340|       |     * for length/distance pairs over any compressed block is assured to be 31
  341|       |     * bits or less.
  342|       |     *
  343|       |     * Analysis: The longest fixed codes are a length code of 8 bits plus 5
  344|       |     * extra bits, for lengths 131 to 257. The longest fixed distance codes are
  345|       |     * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest
  346|       |     * possible fixed-codes length/distance pair is then 31 bits total.
  347|       |     *
  348|       |     * sym_buf starts one-fourth of the way into pending_buf. So there are
  349|       |     * three bytes in sym_buf for every four bytes in pending_buf. Each symbol
  350|       |     * in sym_buf is three bytes -- two for the distance and one for the
  351|       |     * literal/length. As each symbol is consumed, the pointer to the next
  352|       |     * sym_buf value to read moves forward three bytes. From that symbol, up to
  353|       |     * 31 bits are written to pending_buf. The closest the written pending_buf
  354|       |     * bits gets to the next sym_buf symbol to read is just before the last
  355|       |     * code is written. At that time, 31*(n-2) bits have been written, just
  356|       |     * after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at
  357|       |     * 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1
  358|       |     * symbols are written.) The closest the writing gets to what is unread is
  359|       |     * then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and
  360|       |     * can range from 128 to 32768.
  361|       |     *
  362|       |     * Therefore, at a minimum, there are 142 bits of space between what is
  363|       |     * written and what is read in the overlain buffers, so the symbols cannot
  364|       |     * be overwritten by the compressed data. That space is actually 139 bits,
  365|       |     * due to the three-bit fixed-code block header.
  366|       |     *
  367|       |     * That covers the case where either Z_FIXED is specified, forcing fixed
  368|       |     * codes, or when the use of fixed codes is chosen, because that choice
  369|       |     * results in a smaller compressed block than dynamic codes. That latter
  370|       |     * condition then assures that the above analysis also covers all dynamic
  371|       |     * blocks. A dynamic-code block will only be chosen to be emitted if it has
  372|       |     * fewer bits than a fixed-code block would for the same set of symbols.
  373|       |     * Therefore its average symbol length is assured to be less than 31. So
  374|       |     * the compressed data for a dynamic block also cannot overwrite the
  375|       |     * symbols from which it is being constructed.
  376|       |     */
  377|       |
  378|  3.55k|    s->pending_buf_size = s->lit_bufsize * 4;
  379|       |
  380|       |#ifdef LIT_MEM
  381|       |    s->d_buf = (uint16_t *)(s->pending_buf + (s->lit_bufsize << 1) + PENDING_BUF_PAD);
  382|       |    s->l_buf = s->pending_buf + (s->lit_bufsize << 2) + PENDING_BUF_PAD;
  383|       |    s->sym_end = s->lit_bufsize - 1;
  384|       |#else
  385|  3.55k|    s->sym_buf = s->pending_buf + s->lit_bufsize + PENDING_BUF_PAD;
  ------------------
  |  |  184|  3.55k|#define PENDING_BUF_PAD 8
  ------------------
  386|  3.55k|    s->sym_end = (s->lit_bufsize - 1) * 3;
  387|  3.55k|#endif
  388|       |    /* We avoid equality with lit_bufsize*3 because of wraparound at 64K
  389|       |     * on 16 bit machines and because stored blocks are restricted to
  390|       |     * 64K-1 bytes.
  391|       |     */
  392|       |
  393|  3.55k|    s->level = level;
  394|  3.55k|    s->strategy = strategy;
  395|  3.55k|    s->block_open = 0;
  396|  3.55k|    s->reproducible = 0;
  397|       |
  398|  3.55k|    return PREFIX(deflateReset)(strm);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
  399|  3.55k|}
zng_deflateInit:
  402|  3.55k|int32_t Z_EXPORT PREFIX(deflateInit)(PREFIX3(stream) *strm, int32_t level) {
  403|  3.55k|    return PREFIX(deflateInit2)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
                  return PREFIX(deflateInit2)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
  ------------------
  |  |  212|  3.55k|#define Z_DEFLATED   8
  ------------------
                  return PREFIX(deflateInit2)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
  ------------------
  |  |   40|  3.55k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
                  return PREFIX(deflateInit2)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
  ------------------
  |  |   50|  3.55k|#  define DEF_MEM_LEVEL 8
  ------------------
                  return PREFIX(deflateInit2)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
  ------------------
  |  |  203|  3.55k|#define Z_DEFAULT_STRATEGY    0
  ------------------
  404|  3.55k|}
zng_deflateResetKeep:
  521|  3.55k|int32_t Z_EXPORT PREFIX(deflateResetKeep)(PREFIX3(stream) *strm) {
  522|  3.55k|    deflate_state *s;
  523|       |
  524|  3.55k|    if (deflateStateCheck(strm))
  ------------------
  |  Branch (524:9): [True: 0, False: 3.55k]
  ------------------
  525|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  526|       |
  527|  3.55k|    strm->total_in = strm->total_out = 0;
  528|  3.55k|    strm->msg = NULL; /* use zfree if we ever allocate msg dynamically */
  529|  3.55k|    strm->data_type = Z_UNKNOWN;
  ------------------
  |  |  209|  3.55k|#define Z_UNKNOWN  2
  ------------------
  530|       |
  531|  3.55k|    s = (deflate_state *)strm->state;
  532|  3.55k|    s->pending = 0;
  533|  3.55k|    s->pending_out = s->pending_buf;
  534|       |
  535|  3.55k|    if (s->wrap < 0)
  ------------------
  |  Branch (535:9): [True: 0, False: 3.55k]
  ------------------
  536|      0|        s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
  537|       |
  538|  3.55k|    s->status =
  539|  3.55k|#ifdef GZIP
  540|  3.55k|        s->wrap == 2 ? GZIP_STATE :
  ------------------
  |  |   68|      0|#  define GZIP_STATE    4    /* gzip header -> BUSY_STATE | EXTRA_STATE */
  ------------------
  |  Branch (540:9): [True: 0, False: 3.55k]
  ------------------
  541|  3.55k|#endif
  542|  3.55k|        INIT_STATE;
  ------------------
  |  |   66|  7.10k|#define INIT_STATE      1    /* zlib header -> BUSY_STATE */
  ------------------
  543|       |
  544|  3.55k|#ifdef GZIP
  545|  3.55k|    if (s->wrap == 2) {
  ------------------
  |  Branch (545:9): [True: 0, False: 3.55k]
  ------------------
  546|      0|        strm->adler = CRC32_INITIAL_VALUE;
  ------------------
  |  |   71|      0|#define CRC32_INITIAL_VALUE   0 /* initial crc-32 hash value */
  ------------------
  547|      0|    } else
  548|  3.55k|#endif
  549|  3.55k|        strm->adler = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   70|  3.55k|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
  550|  3.55k|    s->last_flush = -2;
  551|       |
  552|  3.55k|    s->gzhead = NULL; /* reset the gzip header */
  553|       |
  554|  3.55k|    zng_tr_init(s);
  555|       |
  556|  3.55k|    DEFLATE_RESET_KEEP_HOOK(strm);  /* hook for IBM Z DFLTCC */
  ------------------
  |  |  485|  3.55k|#  define DEFLATE_RESET_KEEP_HOOK(strm) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (485:54): [Folded, False: 3.55k]
  |  |  ------------------
  ------------------
  557|       |
  558|  3.55k|    return Z_OK;
  ------------------
  |  |  180|  3.55k|#define Z_OK            0
  ------------------
  559|  3.55k|}
zng_deflateReset:
  562|  3.55k|int32_t Z_EXPORT PREFIX(deflateReset)(PREFIX3(stream) *strm) {
  563|  3.55k|    int ret = PREFIX(deflateResetKeep)(strm);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
  564|  3.55k|    if (ret == Z_OK)
  ------------------
  |  |  180|  3.55k|#define Z_OK            0
  ------------------
  |  Branch (564:9): [True: 3.55k, False: 0]
  ------------------
  565|  3.55k|        lm_init(strm->state);
  566|  3.55k|    return ret;
  567|  3.55k|}
zng_flush_pending:
  804|  14.7k|Z_INTERNAL void PREFIX(flush_pending)(PREFIX3(stream) *strm) {
  805|  14.7k|    flush_pending_inline(strm);
  806|  14.7k|}
zng_deflate:
  990|   295M|int32_t Z_EXPORT PREFIX(deflate)(PREFIX3(stream) *strm, int32_t flush) {
  991|   295M|    int32_t old_flush; /* value of flush param for previous deflate call */
  992|   295M|    deflate_state *s;
  993|       |
  994|   295M|    if (deflateStateCheck(strm) || flush > Z_BLOCK || flush < 0)
  ------------------
  |  |  176|   590M|#define Z_BLOCK         5
  ------------------
  |  Branch (994:9): [True: 0, False: 295M]
  |  Branch (994:36): [True: 0, False: 295M]
  |  Branch (994:55): [True: 0, False: 295M]
  ------------------
  995|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  996|   295M|    s = strm->state;
  997|       |
  998|   295M|    if (strm->next_out == NULL || (strm->avail_in != 0 && strm->next_in == NULL)
  ------------------
  |  Branch (998:9): [True: 0, False: 295M]
  |  Branch (998:36): [True: 285M, False: 9.29M]
  |  Branch (998:59): [True: 0, False: 285M]
  ------------------
  999|   295M|        || (s->status == FINISH_STATE && flush != Z_FINISH)) {
  ------------------
  |  |   75|   590M|#define FINISH_STATE    3    /* stream complete */
  ------------------
                      || (s->status == FINISH_STATE && flush != Z_FINISH)) {
  ------------------
  |  |  175|  4.90M|#define Z_FINISH        4
  ------------------
  |  Branch (999:13): [True: 4.90M, False: 290M]
  |  Branch (999:42): [True: 0, False: 4.90M]
  ------------------
 1000|      0|        ERR_RETURN(strm, Z_STREAM_ERROR);
  ------------------
  |  |   29|      0|#define ERR_RETURN(strm, err) return (strm->msg = ERR_MSG(err), (err))
  |  |  ------------------
  |  |  |  |   27|      0|#define ERR_MSG(err) PREFIX(z_errmsg)[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
  |  |  |  |  ------------------
  |  |  |  |  |  |  121|      0|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (27:39): [Folded, False: 0]
  |  |  |  |  |  Branch (27:53): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1001|      0|    }
 1002|   295M|    if (strm->avail_out == 0) {
  ------------------
  |  Branch (1002:9): [True: 0, False: 295M]
  ------------------
 1003|      0|        ERR_RETURN(strm, Z_BUF_ERROR);
  ------------------
  |  |   29|      0|#define ERR_RETURN(strm, err) return (strm->msg = ERR_MSG(err), (err))
  |  |  ------------------
  |  |  |  |   27|      0|#define ERR_MSG(err) PREFIX(z_errmsg)[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
  |  |  |  |  ------------------
  |  |  |  |  |  |  121|      0|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (27:39): [Folded, False: 0]
  |  |  |  |  |  Branch (27:53): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1004|      0|    }
 1005|       |
 1006|   295M|    old_flush = s->last_flush;
 1007|   295M|    s->last_flush = flush;
 1008|       |
 1009|       |    /* Flush as much pending output as possible */
 1010|   295M|    if (s->pending != 0) {
  ------------------
  |  Branch (1010:9): [True: 125M, False: 169M]
  ------------------
 1011|   125M|        flush_pending_inline(strm);
 1012|   125M|        if (strm->avail_out == 0) {
  ------------------
  |  Branch (1012:13): [True: 125M, False: 0]
  ------------------
 1013|       |            /* Since avail_out is 0, deflate will be called again with
 1014|       |             * more output space, but possibly with both pending and
 1015|       |             * avail_in equal to zero. There won't be anything to do,
 1016|       |             * but this is not an error situation so make sure we
 1017|       |             * return OK instead of BUF_ERROR at next call of deflate:
 1018|       |             */
 1019|   125M|            s->last_flush = -1;
 1020|   125M|            return Z_OK;
  ------------------
  |  |  180|   125M|#define Z_OK            0
  ------------------
 1021|   125M|        }
 1022|       |
 1023|       |        /* Make sure there is something to do and avoid duplicate consecutive
 1024|       |         * flushes. For repeated and useless calls with Z_FINISH, we keep
 1025|       |         * returning Z_STREAM_END instead of Z_BUF_ERROR.
 1026|       |         */
 1027|   169M|    } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && flush != Z_FINISH) {
  ------------------
  |  |  151|  10.9k|#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
  |  |  ------------------
  |  |  |  Branch (151:31): [True: 0, False: 10.9k]
  |  |  ------------------
  ------------------
                  } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && flush != Z_FINISH) {
  ------------------
  |  |  151|   169M|#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
  |  |  ------------------
  |  |  |  Branch (151:31): [True: 0, False: 10.9k]
  |  |  ------------------
  ------------------
                  } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && flush != Z_FINISH) {
  ------------------
  |  |  175|      0|#define Z_FINISH        4
  ------------------
  |  Branch (1027:16): [True: 10.9k, False: 169M]
  |  Branch (1027:39): [True: 0, False: 10.9k]
  |  Branch (1027:73): [True: 0, False: 0]
  ------------------
 1028|      0|        ERR_RETURN(strm, Z_BUF_ERROR);
  ------------------
  |  |   29|      0|#define ERR_RETURN(strm, err) return (strm->msg = ERR_MSG(err), (err))
  |  |  ------------------
  |  |  |  |   27|      0|#define ERR_MSG(err) PREFIX(z_errmsg)[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
  |  |  |  |  ------------------
  |  |  |  |  |  |  121|      0|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (27:39): [Folded, False: 0]
  |  |  |  |  |  Branch (27:53): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1029|      0|    }
 1030|       |
 1031|       |    /* User must not provide more input after the first FINISH: */
 1032|   169M|    if (s->status == FINISH_STATE && strm->avail_in != 0)   {
  ------------------
  |  |   75|   338M|#define FINISH_STATE    3    /* stream complete */
  ------------------
  |  Branch (1032:9): [True: 7.10k, False: 169M]
  |  Branch (1032:38): [True: 0, False: 7.10k]
  ------------------
 1033|      0|        ERR_RETURN(strm, Z_BUF_ERROR);
  ------------------
  |  |   29|      0|#define ERR_RETURN(strm, err) return (strm->msg = ERR_MSG(err), (err))
  |  |  ------------------
  |  |  |  |   27|      0|#define ERR_MSG(err) PREFIX(z_errmsg)[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
  |  |  |  |  ------------------
  |  |  |  |  |  |  121|      0|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (27:39): [Folded, False: 0]
  |  |  |  |  |  Branch (27:53): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1034|      0|    }
 1035|       |
 1036|       |    /* Skip headers if raw deflate stream was requested */
 1037|   169M|    if (s->status == INIT_STATE && s->wrap == 0) {
  ------------------
  |  |   66|   338M|#define INIT_STATE      1    /* zlib header -> BUSY_STATE */
  ------------------
  |  Branch (1037:9): [True: 3.55k, False: 169M]
  |  Branch (1037:36): [True: 0, False: 3.55k]
  ------------------
 1038|      0|        s->status = BUSY_STATE;
  ------------------
  |  |   74|      0|#define BUSY_STATE      2    /* deflate -> FINISH_STATE */
  ------------------
 1039|      0|    }
 1040|       |
 1041|   169M|    if (s->status != BUSY_STATE && s->status != FINISH_STATE && s->wrap != 0) {
  ------------------
  |  |   74|   338M|#define BUSY_STATE      2    /* deflate -> FINISH_STATE */
  ------------------
                  if (s->status != BUSY_STATE && s->status != FINISH_STATE && s->wrap != 0) {
  ------------------
  |  |   75|   169M|#define FINISH_STATE    3    /* stream complete */
  ------------------
  |  Branch (1041:9): [True: 10.6k, False: 169M]
  |  Branch (1041:36): [True: 3.55k, False: 7.10k]
  |  Branch (1041:65): [True: 3.55k, False: 0]
  ------------------
 1042|       |        /* Write the header */
 1043|  3.55k|        if (deflateHeaders(s, strm) == Z_OK) {
  ------------------
  |  |  180|  3.55k|#define Z_OK            0
  ------------------
  |  Branch (1043:13): [True: 3.55k, False: 0]
  ------------------
 1044|  3.55k|            return Z_OK;
  ------------------
  |  |  180|  3.55k|#define Z_OK            0
  ------------------
 1045|  3.55k|        }
 1046|  3.55k|    }
 1047|       |
 1048|       |    /* Start a new block or continue the current one. */
 1049|   169M|    if (strm->avail_in != 0 || s->lookahead != 0 || (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
  ------------------
  |  |  171|  14.2k|#define Z_NO_FLUSH      0
  ------------------
                  if (strm->avail_in != 0 || s->lookahead != 0 || (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
  ------------------
  |  |   75|  7.14k|#define FINISH_STATE    3    /* stream complete */
  ------------------
  |  Branch (1049:9): [True: 169M, False: 10.9k]
  |  Branch (1049:32): [True: 3.78k, False: 7.14k]
  |  Branch (1049:54): [True: 7.14k, False: 0]
  |  Branch (1049:77): [True: 38, False: 7.10k]
  ------------------
 1050|   169M|        block_state bstate;
 1051|       |
 1052|   169M|#ifndef _MSC_VER
 1053|   169M|        if (DEFLATE_HOOK(strm, flush, &bstate) == 0) /* hook for IBM Z DFLTCC */
  ------------------
  |  |  497|   169M|#  define DEFLATE_HOOK(strm, flush, bstate) 0
  ------------------
  |  Branch (1053:13): [True: 169M, Folded]
  ------------------
 1054|   169M|#endif
 1055|   169M|            bstate = s->level == 0 ? deflate_stored(s, flush) :
  ------------------
  |  Branch (1055:22): [True: 0, False: 169M]
  ------------------
 1056|   169M|                 s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
  ------------------
  |  |  200|   169M|#define Z_HUFFMAN_ONLY        2
  ------------------
  |  Branch (1056:18): [True: 0, False: 169M]
  ------------------
 1057|   169M|                 s->strategy == Z_RLE ? deflate_rle(s, flush) :
  ------------------
  |  |  201|   169M|#define Z_RLE                 3
  ------------------
  |  Branch (1057:18): [True: 0, False: 169M]
  ------------------
 1058|   169M|                 (*(configuration_table[s->level].func))(s, flush);
 1059|       |
 1060|   169M|        if (bstate == finish_started || bstate == finish_done) {
  ------------------
  |  Branch (1060:13): [True: 3.55k, False: 169M]
  |  Branch (1060:41): [True: 0, False: 169M]
  ------------------
 1061|  3.55k|            s->status = FINISH_STATE;
  ------------------
  |  |   75|  3.55k|#define FINISH_STATE    3    /* stream complete */
  ------------------
 1062|  3.55k|        }
 1063|   169M|        if (bstate == need_more || bstate == finish_started) {
  ------------------
  |  Branch (1063:13): [True: 169M, False: 3.55k]
  |  Branch (1063:36): [True: 3.55k, False: 0]
  ------------------
 1064|   169M|            if (strm->avail_out == 0) {
  ------------------
  |  Branch (1064:17): [True: 11.2k, False: 169M]
  ------------------
 1065|  11.2k|                s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
 1066|  11.2k|            }
 1067|   169M|            return Z_OK;
  ------------------
  |  |  180|   169M|#define Z_OK            0
  ------------------
 1068|       |            /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
 1069|       |             * of deflate should use the same flush parameter to make sure
 1070|       |             * that the flush is complete. So we don't have to output an
 1071|       |             * empty block here, this will be done at next call. This also
 1072|       |             * ensures that for a very small output buffer, we emit at most
 1073|       |             * one empty block.
 1074|       |             */
 1075|   169M|        }
 1076|      0|        if (bstate == block_done) {
  ------------------
  |  Branch (1076:13): [True: 0, False: 0]
  ------------------
 1077|      0|            if (flush == Z_PARTIAL_FLUSH) {
  ------------------
  |  |  172|      0|#define Z_PARTIAL_FLUSH 1
  ------------------
  |  Branch (1077:17): [True: 0, False: 0]
  ------------------
 1078|      0|                zng_tr_align(s);
 1079|      0|            } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
  ------------------
  |  |  176|      0|#define Z_BLOCK         5
  ------------------
  |  Branch (1079:24): [True: 0, False: 0]
  ------------------
 1080|      0|                zng_tr_stored_block(s, NULL, 0L, 0);
 1081|       |                /* For a full flush, this empty block will be recognized
 1082|       |                 * as a special marker by inflate_sync().
 1083|       |                 */
 1084|      0|                if (flush == Z_FULL_FLUSH) {
  ------------------
  |  |  174|      0|#define Z_FULL_FLUSH    3
  ------------------
  |  Branch (1084:21): [True: 0, False: 0]
  ------------------
 1085|      0|                    CLEAR_HASH(s);             /* forget history */
  ------------------
  |  |  157|      0|#define CLEAR_HASH(s) do { \
  |  |  158|      0|    memset((unsigned char *)s->head, 0, HASH_SIZE * sizeof(*s->head)); \
  |  |  ------------------
  |  |  |  |   84|      0|#  define HASH_SIZE 65536u         /* number of elements in hash table */
  |  |  ------------------
  |  |  159|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (159:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1086|      0|                    if (s->lookahead == 0) {
  ------------------
  |  Branch (1086:25): [True: 0, False: 0]
  ------------------
 1087|      0|                        s->strstart = 0;
 1088|      0|                        s->block_start = 0;
 1089|      0|                        s->insert = 0;
 1090|      0|                    }
 1091|      0|                }
 1092|      0|            }
 1093|      0|            PREFIX(flush_pending)(strm);
  ------------------
  |  |  121|      0|#  define PREFIX(x) zng_ ## x
  ------------------
 1094|      0|            if (strm->avail_out == 0) {
  ------------------
  |  Branch (1094:17): [True: 0, False: 0]
  ------------------
 1095|      0|                s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
 1096|      0|                return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
 1097|      0|            }
 1098|      0|        }
 1099|      0|    }
 1100|       |
 1101|  7.10k|    if (flush != Z_FINISH)
  ------------------
  |  |  175|  7.10k|#define Z_FINISH        4
  ------------------
  |  Branch (1101:9): [True: 0, False: 7.10k]
  ------------------
 1102|      0|        return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
 1103|       |
 1104|       |    /* Write the trailer */
 1105|  7.10k|#ifdef GZIP
 1106|  7.10k|    if (s->wrap == 2) {
  ------------------
  |  Branch (1106:9): [True: 0, False: 7.10k]
  ------------------
 1107|      0|        put_uint32(s, strm->adler);
 1108|      0|        put_uint32(s, (uint32_t)strm->total_in);
 1109|      0|    } else
 1110|  7.10k|#endif
 1111|  7.10k|    {
 1112|  7.10k|        if (s->wrap == 1)
  ------------------
  |  Branch (1112:13): [True: 3.55k, False: 3.55k]
  ------------------
 1113|  3.55k|            put_uint32_msb(s, strm->adler);
 1114|  7.10k|    }
 1115|  7.10k|    flush_pending_inline(strm);
 1116|       |    /* If avail_out is zero, the application will call deflate again
 1117|       |     * to flush the rest.
 1118|       |     */
 1119|  7.10k|    if (s->wrap > 0)
  ------------------
  |  Branch (1119:9): [True: 3.55k, False: 3.55k]
  ------------------
 1120|  3.55k|        s->wrap = -s->wrap; /* write the trailer only once! */
 1121|  7.10k|    if (s->pending == 0) {
  ------------------
  |  Branch (1121:9): [True: 3.55k, False: 3.55k]
  ------------------
 1122|  3.55k|        Assert(s->bi_valid == 0, "bi_buf not flushed");
 1123|  3.55k|        return Z_STREAM_END;
  ------------------
  |  |  181|  3.55k|#define Z_STREAM_END    1
  ------------------
 1124|  3.55k|    }
 1125|  3.55k|    return Z_OK;
  ------------------
  |  |  180|  3.55k|#define Z_OK            0
  ------------------
 1126|  7.10k|}
zng_deflateEnd:
 1129|  3.55k|int32_t Z_EXPORT PREFIX(deflateEnd)(PREFIX3(stream) *strm) {
 1130|  3.55k|    if (deflateStateCheck(strm))
  ------------------
  |  Branch (1130:9): [True: 0, False: 3.55k]
  ------------------
 1131|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1132|       |
 1133|  3.55k|    int32_t status = strm->state->status;
 1134|       |
 1135|       |    /* Free allocated buffers */
 1136|  3.55k|    free_deflate(strm);
 1137|       |
 1138|  3.55k|    return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
  ------------------
  |  |   74|  3.55k|#define BUSY_STATE      2    /* deflate -> FINISH_STATE */
  ------------------
                  return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
  ------------------
  |  |  185|      0|#define Z_DATA_ERROR   (-3)
  ------------------
                  return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
  ------------------
  |  |  180|  3.55k|#define Z_OK            0
  ------------------
  |  Branch (1138:12): [True: 0, False: 3.55k]
  ------------------
 1139|  3.55k|}
zng_fill_window:
 1252|   300M|void Z_INTERNAL PREFIX(fill_window)(deflate_state *s) {
 1253|   300M|    PREFIX3(stream) *strm = s->strm;
  ------------------
  |  |  123|   300M|#  define PREFIX3(x) zng_ ## x
  ------------------
 1254|   300M|    insert_batch_func insert_batch = s->insert_batch;
 1255|   300M|    unsigned char *window = s->window;
 1256|   300M|    unsigned n;
 1257|   300M|    unsigned int more;    /* Amount of free space at the end of the window. */
 1258|   300M|    unsigned int wsize = s->w_size;
 1259|   300M|    int level = s->level;
 1260|       |
 1261|   300M|    Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
 1262|       |
 1263|   300M|    do {
 1264|   300M|        more = s->window_size - s->lookahead - s->strstart;
 1265|       |
 1266|       |        /* If the window is almost full and there is insufficient lookahead,
 1267|       |         * move the upper half to the lower one to make room in the upper half.
 1268|       |         */
 1269|   300M|        if (s->strstart >= wsize+MAX_DIST(s)) {
  ------------------
  |  |  419|   300M|#define MAX_DIST(s)  ((s)->w_size - MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  414|   300M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   300M|#define STD_MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|   300M|#define STD_MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1269:13): [True: 4.05k, False: 300M]
  ------------------
 1270|  4.05k|            memcpy(window, window + wsize, (unsigned)wsize);
 1271|  4.05k|            if (s->match_start >= wsize) {
  ------------------
  |  Branch (1271:17): [True: 3.18k, False: 869]
  ------------------
 1272|  3.18k|                s->match_start -= wsize;
 1273|  3.18k|            } else {
 1274|    869|                s->match_start = 0;
 1275|    869|                s->prev_length = 0;
 1276|    869|            }
 1277|  4.05k|            s->strstart    -= wsize; /* we now have strstart >= MAX_DIST */
 1278|  4.05k|            s->block_start -= (int)wsize;
 1279|  4.05k|            if (s->insert > s->strstart)
  ------------------
  |  Branch (1279:17): [True: 0, False: 4.05k]
  ------------------
 1280|      0|                s->insert = s->strstart;
 1281|  4.05k|            if (!HASHLESS(level, s->strategy)) {
  ------------------
  |  |  165|  4.05k|    ((level) == 0 || (strategy) == Z_HUFFMAN_ONLY || (strategy) == Z_RLE)
  |  |  ------------------
  |  |  |  |  200|  8.10k|#define Z_HUFFMAN_ONLY        2
  |  |  ------------------
  |  |                   ((level) == 0 || (strategy) == Z_HUFFMAN_ONLY || (strategy) == Z_RLE)
  |  |  ------------------
  |  |  |  |  201|  4.05k|#define Z_RLE                 3
  |  |  ------------------
  |  |  |  Branch (165:6): [True: 0, False: 4.05k]
  |  |  |  Branch (165:22): [True: 0, False: 4.05k]
  |  |  |  Branch (165:54): [True: 0, False: 4.05k]
  |  |  ------------------
  ------------------
 1282|       |                /* deflate_quick reads the chain head but never walks prev, so it
 1283|       |                 * slides head only. */
 1284|  4.05k|                if (HAVE_QUICK_STRATEGY && level == 1)
  ------------------
  |  |  147|  8.10k|#  define HAVE_QUICK_STRATEGY 1
  |  |  ------------------
  |  |  |  Branch (147:31): [True: 4.05k, Folded]
  |  |  ------------------
  ------------------
  |  Branch (1284:44): [True: 0, False: 4.05k]
  ------------------
 1285|      0|                    FUNCTABLE_CALL(slide_hash_head)(s);
  ------------------
  |  |   48|      0|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
 1286|  4.05k|                else
 1287|  4.05k|                    FUNCTABLE_CALL(slide_hash)(s);
  ------------------
  |  |   48|  4.05k|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
 1288|  4.05k|            }
 1289|  4.05k|            more += wsize;
 1290|  4.05k|        }
 1291|   300M|        if (strm->avail_in == 0)
  ------------------
  |  Branch (1291:13): [True: 130M, False: 169M]
  ------------------
 1292|   130M|            break;
 1293|       |
 1294|       |        /* If there was no sliding:
 1295|       |         *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
 1296|       |         *    more == window_size - lookahead - strstart
 1297|       |         * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
 1298|       |         * => more >= window_size - 2*WSIZE + 2
 1299|       |         * In the BIG_MEM or MMAP case (not yet supported),
 1300|       |         *   window_size == input_size + MIN_LOOKAHEAD  &&
 1301|       |         *   strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
 1302|       |         * Otherwise, window_size == 2*WSIZE so more >= 2.
 1303|       |         * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
 1304|       |         */
 1305|   169M|        Assert(more >= 2, "more < 2");
 1306|       |
 1307|   169M|        n = read_buf(strm, window + s->strstart + s->lookahead, more);
 1308|   169M|        s->lookahead += n;
 1309|       |
 1310|       |        /* Initialize the hash value now that we have some input: */
 1311|   169M|        if (!HASHLESS(level, s->strategy) && s->lookahead + s->insert >= STD_MIN_MATCH) {
  ------------------
  |  |  165|   338M|    ((level) == 0 || (strategy) == Z_HUFFMAN_ONLY || (strategy) == Z_RLE)
  |  |  ------------------
  |  |  |  |  200|   338M|#define Z_HUFFMAN_ONLY        2
  |  |  ------------------
  |  |                   ((level) == 0 || (strategy) == Z_HUFFMAN_ONLY || (strategy) == Z_RLE)
  |  |  ------------------
  |  |  |  |  201|   169M|#define Z_RLE                 3
  |  |  ------------------
  |  |  |  Branch (165:6): [True: 0, False: 169M]
  |  |  |  Branch (165:22): [True: 0, False: 169M]
  |  |  |  Branch (165:54): [True: 0, False: 169M]
  |  |  ------------------
  ------------------
                      if (!HASHLESS(level, s->strategy) && s->lookahead + s->insert >= STD_MIN_MATCH) {
  ------------------
  |  |   61|   169M|#define STD_MIN_MATCH  3
  ------------------
  |  Branch (1311:46): [True: 169M, False: 7.07k]
  ------------------
 1312|   169M|            unsigned int str = s->strstart - s->insert;
 1313|   169M|            if (UNLIKELY(level >= MIN_ROLL_LEVEL)) {
  ------------------
  |  |  258|   169M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 0, False: 169M]
  |  |  ------------------
  ------------------
 1314|      0|                s->ins_h = update_hash_roll(window[str], window[str+1]);
 1315|   169M|            } else if (str >= 1) {
  ------------------
  |  Branch (1315:24): [True: 168M, False: 522k]
  ------------------
 1316|   168M|                if (HAVE_QUICK_STRATEGY && level == 1)
  ------------------
  |  |  147|   337M|#  define HAVE_QUICK_STRATEGY 1
  |  |  ------------------
  |  |  |  Branch (147:31): [True: 168M, Folded]
  |  |  ------------------
  ------------------
  |  Branch (1316:44): [True: 0, False: 168M]
  ------------------
 1317|      0|                    insert_knuth_head(s, window, str + 2 - STD_MIN_MATCH);
  ------------------
  |  |   61|      0|#define STD_MIN_MATCH  3
  ------------------
 1318|   168M|                else
 1319|   168M|                    insert_knuth(s, window, str + 2 - STD_MIN_MATCH);
  ------------------
  |  |   61|   168M|#define STD_MIN_MATCH  3
  ------------------
 1320|   168M|            }
 1321|   169M|            unsigned int count = s->insert;
 1322|   169M|            if (UNLIKELY(s->lookahead == 1)) {
  ------------------
  |  |  258|   169M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 0, False: 169M]
  |  |  ------------------
  ------------------
 1323|      0|                count -= 1;
 1324|      0|            }
 1325|   169M|            if (count > 0) {
  ------------------
  |  Branch (1325:17): [True: 0, False: 169M]
  ------------------
 1326|      0|                insert_batch(s, window, str, count);
 1327|      0|                s->insert -= count;
 1328|      0|            }
 1329|   169M|        }
 1330|       |        /* If the whole input has less than STD_MIN_MATCH bytes, ins_h is garbage,
 1331|       |         * but this is not important since only literal bytes will be emitted.
 1332|       |         */
 1333|   169M|    } while (s->lookahead < MIN_LOOKAHEAD && strm->avail_in != 0);
  ------------------
  |  |  414|   338M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  ------------------
  |  |  |  |   62|   169M|#define STD_MAX_MATCH  258
  |  |  ------------------
  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  ------------------
  |  |  |  |   61|   169M|#define STD_MIN_MATCH  3
  |  |  ------------------
  ------------------
  |  Branch (1333:14): [True: 38.7M, False: 130M]
  |  Branch (1333:46): [True: 0, False: 38.7M]
  ------------------
 1334|       |
 1335|       |    /* If the WIN_INIT bytes after the end of the current data have never been
 1336|       |     * written, then zero those bytes in order to avoid memory check reports of
 1337|       |     * the use of uninitialized (or uninitialised as Julian writes) bytes by
 1338|       |     * the longest match routines.  Update the high water mark for the next
 1339|       |     * time through here.  WIN_INIT is set to STD_MAX_MATCH since the longest match
 1340|       |     * routines allow scanning to strstart + STD_MAX_MATCH, ignoring lookahead.
 1341|       |     */
 1342|   300M|    if (s->high_water < s->window_size) {
  ------------------
  |  Branch (1342:9): [True: 83.6M, False: 216M]
  ------------------
 1343|  83.6M|        unsigned int curr = s->strstart + s->lookahead;
 1344|  83.6M|        unsigned int init;
 1345|       |
 1346|  83.6M|        if (s->high_water < curr) {
  ------------------
  |  Branch (1346:13): [True: 3.55k, False: 83.6M]
  ------------------
 1347|       |            /* Previous high water mark below current data -- zero WIN_INIT
 1348|       |             * bytes or up to end of window, whichever is less.
 1349|       |             */
 1350|  3.55k|            init = s->window_size - curr;
 1351|  3.55k|            if (init > WIN_INIT)
  ------------------
  |  |  430|  3.55k|#define WIN_INIT STD_MAX_MATCH
  |  |  ------------------
  |  |  |  |   62|  3.55k|#define STD_MAX_MATCH  258
  |  |  ------------------
  ------------------
  |  Branch (1351:17): [True: 3.55k, False: 0]
  ------------------
 1352|  3.55k|                init = WIN_INIT;
  ------------------
  |  |  430|  3.55k|#define WIN_INIT STD_MAX_MATCH
  |  |  ------------------
  |  |  |  |   62|  3.55k|#define STD_MAX_MATCH  258
  |  |  ------------------
  ------------------
 1353|  3.55k|            memset(window + curr, 0, init);
 1354|  3.55k|            s->high_water = curr + init;
 1355|  83.6M|        } else if (s->high_water < curr + WIN_INIT) {
  ------------------
  |  |  430|  83.6M|#define WIN_INIT STD_MAX_MATCH
  |  |  ------------------
  |  |  |  |   62|  83.6M|#define STD_MAX_MATCH  258
  |  |  ------------------
  ------------------
  |  Branch (1355:20): [True: 47.5M, False: 36.0M]
  ------------------
 1356|       |            /* High water mark at or above current data, but below current data
 1357|       |             * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
 1358|       |             * to end of window, whichever is less.
 1359|       |             */
 1360|  47.5M|            init = curr + WIN_INIT - s->high_water;
  ------------------
  |  |  430|  47.5M|#define WIN_INIT STD_MAX_MATCH
  |  |  ------------------
  |  |  |  |   62|  47.5M|#define STD_MAX_MATCH  258
  |  |  ------------------
  ------------------
 1361|  47.5M|            if (init > s->window_size - s->high_water)
  ------------------
  |  Branch (1361:17): [True: 0, False: 47.5M]
  ------------------
 1362|      0|                init = s->window_size - s->high_water;
 1363|  47.5M|            memset(window + s->high_water, 0, init);
 1364|  47.5M|            s->high_water += init;
 1365|  47.5M|        }
 1366|  83.6M|    }
 1367|       |
 1368|   300M|    Assert((unsigned long)s->strstart <= s->window_size - MIN_LOOKAHEAD,
 1369|   300M|           "not enough room for search");
 1370|   300M|}
deflate.c:deflateStateCheck:
  425|   295M|static int deflateStateCheck(PREFIX3(stream) *strm) {
  426|   295M|    deflate_state *s;
  427|   295M|    if (strm == NULL || strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
  ------------------
  |  Branch (427:9): [True: 0, False: 295M]
  |  Branch (427:25): [True: 0, False: 295M]
  |  Branch (427:58): [True: 0, False: 295M]
  ------------------
  428|      0|        return 1;
  429|   295M|    s = strm->state;
  430|   295M|    if (s == NULL || s->alloc_bufs == NULL || s->strm != strm || (s->status < INIT_STATE || s->status > MAX_STATE))
  ------------------
  |  |   66|   590M|#define INIT_STATE      1    /* zlib header -> BUSY_STATE */
  ------------------
                  if (s == NULL || s->alloc_bufs == NULL || s->strm != strm || (s->status < INIT_STATE || s->status > MAX_STATE))
  ------------------
  |  |   77|   295M|#  define MAX_STATE     HCRC_STATE
  |  |  ------------------
  |  |  |  |   72|   295M|#  define HCRC_STATE    8    /* gzip header CRC -> BUSY_STATE */
  |  |  ------------------
  ------------------
  |  Branch (430:9): [True: 0, False: 295M]
  |  Branch (430:22): [True: 0, False: 295M]
  |  Branch (430:47): [True: 0, False: 295M]
  |  Branch (430:67): [True: 0, False: 295M]
  |  Branch (430:93): [True: 0, False: 295M]
  ------------------
  431|      0|        return 1;
  432|   295M|    return 0;
  433|   295M|}
deflate.c:deflateHeaders:
  820|  3.55k|static int deflateHeaders(deflate_state *s, PREFIX3(stream) *strm) {
  821|  3.55k|    if (s->status == INIT_STATE) {
  ------------------
  |  |   66|  3.55k|#define INIT_STATE      1    /* zlib header -> BUSY_STATE */
  ------------------
  |  Branch (821:9): [True: 3.55k, False: 0]
  ------------------
  822|       |        /* zlib header */
  823|  3.55k|        unsigned int header = (Z_DEFLATED + ((W_BITS(s)-8)<<4)) << 8;
  ------------------
  |  |  212|  3.55k|#define Z_DEFLATED   8
  ------------------
                      unsigned int header = (Z_DEFLATED + ((W_BITS(s)-8)<<4)) << 8;
  ------------------
  |  |  427|  3.55k|#define W_BITS(s)  zng_ctz32((s)->w_size)
  ------------------
  824|  3.55k|        unsigned int level_flags;
  825|       |
  826|  3.55k|        if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
  ------------------
  |  |  200|  7.10k|#define Z_HUFFMAN_ONLY        2
  ------------------
  |  Branch (826:13): [True: 0, False: 3.55k]
  |  Branch (826:46): [True: 0, False: 3.55k]
  ------------------
  827|      0|            level_flags = 0;
  828|  3.55k|        else if (s->level < 6)
  ------------------
  |  Branch (828:18): [True: 0, False: 3.55k]
  ------------------
  829|      0|            level_flags = 1;
  830|  3.55k|        else if (s->level == 6)
  ------------------
  |  Branch (830:18): [True: 3.55k, False: 0]
  ------------------
  831|  3.55k|            level_flags = 2;
  832|      0|        else
  833|      0|            level_flags = 3;
  834|  3.55k|        header |= (level_flags << 6);
  835|  3.55k|        if (s->strstart != 0)
  ------------------
  |  Branch (835:13): [True: 0, False: 3.55k]
  ------------------
  836|      0|            header |= PRESET_DICT;
  ------------------
  |  |   68|      0|#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
  ------------------
  837|  3.55k|        header += 31 - (header % 31);
  838|       |
  839|  3.55k|        put_short_msb(s, (uint16_t)header);
  840|       |
  841|       |        /* Save the adler32 of the preset dictionary: */
  842|  3.55k|        if (s->strstart != 0)
  ------------------
  |  Branch (842:13): [True: 0, False: 3.55k]
  ------------------
  843|      0|            put_uint32_msb(s, strm->adler);
  844|  3.55k|        strm->adler = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   70|  3.55k|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
  845|  3.55k|        s->status = BUSY_STATE;
  ------------------
  |  |   74|  3.55k|#define BUSY_STATE      2    /* deflate -> FINISH_STATE */
  ------------------
  846|       |
  847|       |        /* Compression must start with an empty pending buffer */
  848|  3.55k|        PREFIX(flush_pending)(strm);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
  849|  3.55k|        if (s->pending != 0) {
  ------------------
  |  Branch (849:13): [True: 3.55k, False: 0]
  ------------------
  850|  3.55k|            s->last_flush = -1;
  851|  3.55k|            return Z_OK;
  ------------------
  |  |  180|  3.55k|#define Z_OK            0
  ------------------
  852|  3.55k|        }
  853|  3.55k|    }
  854|      0|#ifdef GZIP
  855|      0|    if (s->status == GZIP_STATE) {
  ------------------
  |  |   68|      0|#  define GZIP_STATE    4    /* gzip header -> BUSY_STATE | EXTRA_STATE */
  ------------------
  |  Branch (855:9): [True: 0, False: 0]
  ------------------
  856|       |        /* gzip header */
  857|      0|        strm->adler = CRC32_INITIAL_VALUE;
  ------------------
  |  |   71|      0|#define CRC32_INITIAL_VALUE   0 /* initial crc-32 hash value */
  ------------------
  858|      0|        put_byte(s, 31);
  ------------------
  |  |  360|      0|#define put_byte(s, c) { \
  |  |  361|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  362|      0|}
  ------------------
  859|      0|        put_byte(s, 139);
  ------------------
  |  |  360|      0|#define put_byte(s, c) { \
  |  |  361|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  362|      0|}
  ------------------
  860|      0|        put_byte(s, 8);
  ------------------
  |  |  360|      0|#define put_byte(s, c) { \
  |  |  361|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  362|      0|}
  ------------------
  861|      0|        if (s->gzhead == NULL) {
  ------------------
  |  Branch (861:13): [True: 0, False: 0]
  ------------------
  862|      0|            put_uint32(s, 0);
  863|      0|            put_byte(s, 0);
  ------------------
  |  |  360|      0|#define put_byte(s, c) { \
  |  |  361|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  362|      0|}
  ------------------
  864|      0|            put_byte(s, s->level == 9 ? 2 :
  ------------------
  |  |  360|      0|#define put_byte(s, c) { \
  |  |  361|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  ------------------
  |  |  |  Branch (361:52): [True: 0, False: 0]
  |  |  |  Branch (361:52): [True: 0, False: 0]
  |  |  |  Branch (361:52): [True: 0, False: 0]
  |  |  ------------------
  |  |  362|      0|}
  ------------------
  865|      0|                     (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? 4 : 0));
  866|      0|            put_byte(s, OS_CODE);
  ------------------
  |  |  360|      0|#define put_byte(s, c) { \
  |  |  361|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  362|      0|}
  ------------------
  867|      0|            s->status = BUSY_STATE;
  ------------------
  |  |   74|      0|#define BUSY_STATE      2    /* deflate -> FINISH_STATE */
  ------------------
  868|       |
  869|       |            /* Compression must start with an empty pending buffer */
  870|      0|            PREFIX(flush_pending)(strm);
  ------------------
  |  |  121|      0|#  define PREFIX(x) zng_ ## x
  ------------------
  871|      0|            if (s->pending != 0) {
  ------------------
  |  Branch (871:17): [True: 0, False: 0]
  ------------------
  872|      0|                s->last_flush = -1;
  873|      0|                return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
  874|      0|            }
  875|      0|        } else {
  876|      0|            put_byte(s, (s->gzhead->text ? 1 : 0) +
  ------------------
  |  |  360|      0|#define put_byte(s, c) { \
  |  |  361|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  ------------------
  |  |  |  Branch (361:52): [True: 0, False: 0]
  |  |  |  Branch (361:52): [True: 0, False: 0]
  |  |  |  Branch (361:52): [True: 0, False: 0]
  |  |  |  Branch (361:52): [True: 0, False: 0]
  |  |  |  Branch (361:52): [True: 0, False: 0]
  |  |  ------------------
  |  |  362|      0|}
  ------------------
  877|      0|                     (s->gzhead->hcrc ? 2 : 0) +
  878|      0|                     (s->gzhead->extra == NULL ? 0 : 4) +
  879|      0|                     (s->gzhead->name == NULL ? 0 : 8) +
  880|      0|                     (s->gzhead->comment == NULL ? 0 : 16)
  881|      0|                     );
  882|      0|            put_uint32(s, s->gzhead->time);
  883|      0|            put_byte(s, s->level == 9 ? 2 : (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? 4 : 0));
  ------------------
  |  |  360|      0|#define put_byte(s, c) { \
  |  |  361|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  ------------------
  |  |  |  Branch (361:52): [True: 0, False: 0]
  |  |  |  Branch (361:52): [True: 0, False: 0]
  |  |  |  Branch (361:52): [True: 0, False: 0]
  |  |  ------------------
  |  |  362|      0|}
  ------------------
  884|      0|            put_byte(s, s->gzhead->os & 0xff);
  ------------------
  |  |  360|      0|#define put_byte(s, c) { \
  |  |  361|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  362|      0|}
  ------------------
  885|      0|            if (s->gzhead->extra != NULL)
  ------------------
  |  Branch (885:17): [True: 0, False: 0]
  ------------------
  886|      0|                put_short(s, (uint16_t)s->gzhead->extra_len);
  887|      0|            if (s->gzhead->hcrc)
  ------------------
  |  Branch (887:17): [True: 0, False: 0]
  ------------------
  888|      0|                strm->adler = crc32_small((uint32_t)strm->adler, s->pending_buf, s->pending);
  889|      0|            s->gzindex = 0;
  890|      0|            s->status = EXTRA_STATE;
  ------------------
  |  |   69|      0|#  define EXTRA_STATE   5    /* gzip extra block -> NAME_STATE */
  ------------------
  891|      0|        }
  892|      0|    }
  893|      0|    if (s->status == EXTRA_STATE) {
  ------------------
  |  |   69|      0|#  define EXTRA_STATE   5    /* gzip extra block -> NAME_STATE */
  ------------------
  |  Branch (893:9): [True: 0, False: 0]
  ------------------
  894|      0|        if (s->gzhead->extra != NULL) {
  ------------------
  |  Branch (894:13): [True: 0, False: 0]
  ------------------
  895|      0|            uint32_t beg = s->pending;   /* start of bytes to update crc */
  896|      0|            uint32_t left = (s->gzhead->extra_len & 0xffff) - s->gzindex;
  897|       |
  898|      0|            while (s->pending + left > s->pending_buf_size) {
  ------------------
  |  Branch (898:20): [True: 0, False: 0]
  ------------------
  899|      0|                uint32_t copy = s->pending_buf_size - s->pending;
  900|      0|                memcpy(s->pending_buf + s->pending, s->gzhead->extra + s->gzindex, copy);
  901|      0|                s->pending = s->pending_buf_size;
  902|      0|                HCRC_UPDATE(beg);
  ------------------
  |  |  812|      0|    do { \
  |  |  813|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (813:13): [True: 0, False: 0]
  |  |  |  Branch (813:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  814|      0|            strm->adler = crc32_small((uint32_t)strm->adler, s->pending_buf + (beg), s->pending - (beg)); \
  |  |  815|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (815:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  903|      0|                s->gzindex += copy;
  904|      0|                PREFIX(flush_pending)(strm);
  ------------------
  |  |  121|      0|#  define PREFIX(x) zng_ ## x
  ------------------
  905|      0|                if (s->pending != 0) {
  ------------------
  |  Branch (905:21): [True: 0, False: 0]
  ------------------
  906|      0|                    s->last_flush = -1;
  907|      0|                    return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
  908|      0|                }
  909|      0|                beg = 0;
  910|      0|                left -= copy;
  911|      0|            }
  912|      0|            memcpy(s->pending_buf + s->pending, s->gzhead->extra + s->gzindex, left);
  913|      0|            s->pending += left;
  914|      0|            HCRC_UPDATE(beg);
  ------------------
  |  |  812|      0|    do { \
  |  |  813|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (813:13): [True: 0, False: 0]
  |  |  |  Branch (813:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  814|      0|            strm->adler = crc32_small((uint32_t)strm->adler, s->pending_buf + (beg), s->pending - (beg)); \
  |  |  815|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (815:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  915|      0|            s->gzindex = 0;
  916|      0|        }
  917|      0|        s->status = NAME_STATE;
  ------------------
  |  |   70|      0|#  define NAME_STATE    6    /* gzip file name -> COMMENT_STATE */
  ------------------
  918|      0|    }
  919|      0|    if (s->status == NAME_STATE) {
  ------------------
  |  |   70|      0|#  define NAME_STATE    6    /* gzip file name -> COMMENT_STATE */
  ------------------
  |  Branch (919:9): [True: 0, False: 0]
  ------------------
  920|      0|        if (s->gzhead->name != NULL) {
  ------------------
  |  Branch (920:13): [True: 0, False: 0]
  ------------------
  921|      0|            uint32_t beg = s->pending;   /* start of bytes to update crc */
  922|      0|            unsigned char val;
  923|       |
  924|      0|            do {
  925|      0|                if (s->pending == s->pending_buf_size) {
  ------------------
  |  Branch (925:21): [True: 0, False: 0]
  ------------------
  926|      0|                    HCRC_UPDATE(beg);
  ------------------
  |  |  812|      0|    do { \
  |  |  813|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (813:13): [True: 0, False: 0]
  |  |  |  Branch (813:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  814|      0|            strm->adler = crc32_small((uint32_t)strm->adler, s->pending_buf + (beg), s->pending - (beg)); \
  |  |  815|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (815:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  927|      0|                    PREFIX(flush_pending)(strm);
  ------------------
  |  |  121|      0|#  define PREFIX(x) zng_ ## x
  ------------------
  928|      0|                    if (s->pending != 0) {
  ------------------
  |  Branch (928:25): [True: 0, False: 0]
  ------------------
  929|      0|                        s->last_flush = -1;
  930|      0|                        return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
  931|      0|                    }
  932|      0|                    beg = 0;
  933|      0|                }
  934|      0|                val = s->gzhead->name[s->gzindex++];
  935|      0|                put_byte(s, val);
  ------------------
  |  |  360|      0|#define put_byte(s, c) { \
  |  |  361|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  362|      0|}
  ------------------
  936|      0|            } while (val != 0);
  ------------------
  |  Branch (936:22): [True: 0, False: 0]
  ------------------
  937|      0|            HCRC_UPDATE(beg);
  ------------------
  |  |  812|      0|    do { \
  |  |  813|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (813:13): [True: 0, False: 0]
  |  |  |  Branch (813:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  814|      0|            strm->adler = crc32_small((uint32_t)strm->adler, s->pending_buf + (beg), s->pending - (beg)); \
  |  |  815|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (815:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  938|      0|            s->gzindex = 0;
  939|      0|        }
  940|      0|        s->status = COMMENT_STATE;
  ------------------
  |  |   71|      0|#  define COMMENT_STATE 7    /* gzip comment -> HCRC_STATE */
  ------------------
  941|      0|    }
  942|      0|    if (s->status == COMMENT_STATE) {
  ------------------
  |  |   71|      0|#  define COMMENT_STATE 7    /* gzip comment -> HCRC_STATE */
  ------------------
  |  Branch (942:9): [True: 0, False: 0]
  ------------------
  943|      0|        if (s->gzhead->comment != NULL) {
  ------------------
  |  Branch (943:13): [True: 0, False: 0]
  ------------------
  944|      0|            uint32_t beg = s->pending;  /* start of bytes to update crc */
  945|      0|            unsigned char val;
  946|       |
  947|      0|            do {
  948|      0|                if (s->pending == s->pending_buf_size) {
  ------------------
  |  Branch (948:21): [True: 0, False: 0]
  ------------------
  949|      0|                    HCRC_UPDATE(beg);
  ------------------
  |  |  812|      0|    do { \
  |  |  813|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (813:13): [True: 0, False: 0]
  |  |  |  Branch (813:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  814|      0|            strm->adler = crc32_small((uint32_t)strm->adler, s->pending_buf + (beg), s->pending - (beg)); \
  |  |  815|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (815:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  950|      0|                    PREFIX(flush_pending)(strm);
  ------------------
  |  |  121|      0|#  define PREFIX(x) zng_ ## x
  ------------------
  951|      0|                    if (s->pending != 0) {
  ------------------
  |  Branch (951:25): [True: 0, False: 0]
  ------------------
  952|      0|                        s->last_flush = -1;
  953|      0|                        return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
  954|      0|                    }
  955|      0|                    beg = 0;
  956|      0|                }
  957|      0|                val = s->gzhead->comment[s->gzindex++];
  958|      0|                put_byte(s, val);
  ------------------
  |  |  360|      0|#define put_byte(s, c) { \
  |  |  361|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  362|      0|}
  ------------------
  959|      0|            } while (val != 0);
  ------------------
  |  Branch (959:22): [True: 0, False: 0]
  ------------------
  960|      0|            HCRC_UPDATE(beg);
  ------------------
  |  |  812|      0|    do { \
  |  |  813|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (813:13): [True: 0, False: 0]
  |  |  |  Branch (813:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  814|      0|            strm->adler = crc32_small((uint32_t)strm->adler, s->pending_buf + (beg), s->pending - (beg)); \
  |  |  815|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (815:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  961|      0|        }
  962|      0|        s->status = HCRC_STATE;
  ------------------
  |  |   72|      0|#  define HCRC_STATE    8    /* gzip header CRC -> BUSY_STATE */
  ------------------
  963|      0|    }
  964|      0|    if (s->status == HCRC_STATE) {
  ------------------
  |  |   72|      0|#  define HCRC_STATE    8    /* gzip header CRC -> BUSY_STATE */
  ------------------
  |  Branch (964:9): [True: 0, False: 0]
  ------------------
  965|      0|        if (s->gzhead->hcrc) {
  ------------------
  |  Branch (965:13): [True: 0, False: 0]
  ------------------
  966|      0|            if (s->pending + 2 > s->pending_buf_size) {
  ------------------
  |  Branch (966:17): [True: 0, False: 0]
  ------------------
  967|      0|                PREFIX(flush_pending)(strm);
  ------------------
  |  |  121|      0|#  define PREFIX(x) zng_ ## x
  ------------------
  968|      0|                if (s->pending != 0) {
  ------------------
  |  Branch (968:21): [True: 0, False: 0]
  ------------------
  969|      0|                    s->last_flush = -1;
  970|      0|                    return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
  971|      0|                }
  972|      0|            }
  973|      0|            put_short(s, (uint16_t)strm->adler);
  974|      0|            strm->adler = CRC32_INITIAL_VALUE;
  ------------------
  |  |   71|      0|#define CRC32_INITIAL_VALUE   0 /* initial crc-32 hash value */
  ------------------
  975|      0|        }
  976|      0|        s->status = BUSY_STATE;
  ------------------
  |  |   74|      0|#define BUSY_STATE      2    /* deflate -> FINISH_STATE */
  ------------------
  977|       |
  978|       |        /* Compression must start with an empty pending buffer */
  979|      0|        flush_pending_inline(strm);
  980|      0|        if (s->pending != 0) {
  ------------------
  |  Branch (980:13): [True: 0, False: 0]
  ------------------
  981|      0|            s->last_flush = -1;
  982|      0|            return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
  983|      0|        }
  984|      0|    }
  985|      0|#endif
  986|      0|    return -1;
  987|      0|}
deflate.c:free_deflate:
  259|  3.55k|static inline void free_deflate(PREFIX3(stream) *strm) {
  260|  3.55k|    deflate_state *state = (deflate_state *)strm->state;
  261|       |
  262|  3.55k|    if (state->alloc_bufs != NULL) {
  ------------------
  |  Branch (262:9): [True: 3.55k, False: 0]
  ------------------
  263|  3.55k|        deflate_allocs *alloc_bufs = state->alloc_bufs;
  264|  3.55k|        alloc_bufs->zfree(strm->opaque, alloc_bufs->buf_start);
  265|       |        strm->state = NULL;
  266|  3.55k|    }
  267|  3.55k|}
deflate.c:lm_set_level:
 1199|  3.55k|static void lm_set_level(deflate_state *s, int level) {
 1200|  3.55k|    s->max_lazy_match   = configuration_table[level].max_lazy;
 1201|  3.55k|    s->good_match       = configuration_table[level].good_length;
 1202|  3.55k|    s->nice_match       = configuration_table[level].nice_length;
 1203|  3.55k|    s->max_chain_length = configuration_table[level].max_chain;
 1204|  3.55k|    if (level >= MIN_ROLL_LEVEL) {
  ------------------
  |  |  112|  3.55k|#define MIN_ROLL_LEVEL 9
  ------------------
  |  Branch (1204:9): [True: 0, False: 3.55k]
  ------------------
 1205|      0|        s->longest_match = FUNCTABLE_FPTR(longest_match_slow_roll);
  ------------------
  |  |   49|      0|#  define FUNCTABLE_FPTR(name) functable.name
  ------------------
 1206|      0|        s->insert_batch  = insert_roll_batch;
 1207|  3.55k|    } else {
 1208|  3.55k|        s->longest_match = FUNCTABLE_FPTR(longest_match_slow_knuth);
  ------------------
  |  |   49|  3.55k|#  define FUNCTABLE_FPTR(name) functable.name
  ------------------
 1209|  3.55k|        if (HAVE_QUICK_STRATEGY && level == 1)
  ------------------
  |  |  147|  7.10k|#  define HAVE_QUICK_STRATEGY 1
  |  |  ------------------
  |  |  |  Branch (147:31): [True: 3.55k, Folded]
  |  |  ------------------
  ------------------
  |  Branch (1209:36): [True: 0, False: 3.55k]
  ------------------
 1210|      0|            s->insert_batch = insert_knuth_batch_head;
 1211|  3.55k|        else
 1212|  3.55k|            s->insert_batch = insert_knuth_batch;
 1213|  3.55k|    }
 1214|  3.55k|    s->level = level;
 1215|  3.55k|}
deflate.c:lm_init:
 1220|  3.55k|static void lm_init(deflate_state *s) {
 1221|  3.55k|    s->window_size = 2 * s->w_size;
 1222|       |
 1223|  3.55k|    if (!HASHLESS(s->level, s->strategy)) {
  ------------------
  |  |  165|  3.55k|    ((level) == 0 || (strategy) == Z_HUFFMAN_ONLY || (strategy) == Z_RLE)
  |  |  ------------------
  |  |  |  |  200|  7.10k|#define Z_HUFFMAN_ONLY        2
  |  |  ------------------
  |  |                   ((level) == 0 || (strategy) == Z_HUFFMAN_ONLY || (strategy) == Z_RLE)
  |  |  ------------------
  |  |  |  |  201|  3.55k|#define Z_RLE                 3
  |  |  ------------------
  |  |  |  Branch (165:6): [True: 0, False: 3.55k]
  |  |  |  Branch (165:22): [True: 0, False: 3.55k]
  |  |  |  Branch (165:54): [True: 0, False: 3.55k]
  |  |  ------------------
  ------------------
 1224|  3.55k|        CLEAR_HASH(s);
  ------------------
  |  |  157|  3.55k|#define CLEAR_HASH(s) do { \
  |  |  158|  3.55k|    memset((unsigned char *)s->head, 0, HASH_SIZE * sizeof(*s->head)); \
  |  |  ------------------
  |  |  |  |   84|  3.55k|#  define HASH_SIZE 65536u         /* number of elements in hash table */
  |  |  ------------------
  |  |  159|  3.55k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (159:12): [Folded, False: 3.55k]
  |  |  ------------------
  ------------------
 1225|  3.55k|    }
 1226|       |
 1227|       |    /* Set the default configuration parameters:
 1228|       |     */
 1229|  3.55k|    lm_set_level(s, s->level);
 1230|       |
 1231|  3.55k|    s->strstart = 0;
 1232|  3.55k|    s->block_start = 0;
 1233|  3.55k|    s->lookahead = 0;
 1234|  3.55k|    s->insert = 0;
 1235|  3.55k|    s->prev_length = 0;
 1236|  3.55k|    s->match_available = 0;
 1237|  3.55k|    s->match_start = 0;
 1238|  3.55k|    s->ins_h = 0;
 1239|  3.55k|}

deflate.c:put_short_msb:
  378|  3.55k|static inline void put_short_msb(deflate_state *s, uint16_t w) {
  379|  3.55k|    w = Z_U16_TO_BE(w);
  ------------------
  |  |   89|  3.55k|#  define Z_U16_TO_BE(x)    ZSWAP16(x)
  |  |  ------------------
  |  |  |  |  213|  3.55k|#  define ZSWAP16(q) __builtin_bswap16(q)
  |  |  ------------------
  ------------------
  380|  3.55k|    zng_memwrite_2(&s->pending_buf[s->pending], w);
  381|  3.55k|    s->pending += 2;
  382|  3.55k|}
deflate.c:put_uint32_msb:
  398|  3.55k|static inline void put_uint32_msb(deflate_state *s, uint32_t dw) {
  399|  3.55k|    dw = Z_U32_TO_BE(dw);
  ------------------
  |  |   90|  3.55k|#  define Z_U32_TO_BE(x)    ZSWAP32(x)
  |  |  ------------------
  |  |  |  |  214|  3.55k|#  define ZSWAP32(q) __builtin_bswap32(q)
  |  |  ------------------
  ------------------
  400|  3.55k|    zng_memwrite_4(&s->pending_buf[s->pending], dw);
  401|  3.55k|    s->pending += 4;
  402|  3.55k|}
trees.c:put_uint64:
  408|  62.5k|static inline void put_uint64(deflate_state *s, uint64_t lld) {
  409|  62.5k|    lld = Z_U64_TO_LE(lld);
  ------------------
  |  |   85|  62.5k|#  define Z_U64_TO_LE(x)    (x)
  ------------------
  410|  62.5k|    zng_memwrite_8(&s->pending_buf[s->pending], lld);
  411|  62.5k|    s->pending += 8;
  412|  62.5k|}
trees.c:put_short:
  368|  11.7k|static inline void put_short(deflate_state *s, uint16_t w) {
  369|  11.7k|    w = Z_U16_TO_LE(w);
  ------------------
  |  |   83|  11.7k|#  define Z_U16_TO_LE(x)    (x)
  ------------------
  370|  11.7k|    zng_memwrite_2(&s->pending_buf[s->pending], w);
  371|  11.7k|    s->pending += 2;
  372|  11.7k|}
trees.c:put_uint32:
  388|  1.00k|static inline void put_uint32(deflate_state *s, uint32_t dw) {
  389|  1.00k|    dw = Z_U32_TO_LE(dw);
  ------------------
  |  |   84|  1.00k|#  define Z_U32_TO_LE(x)    (x)
  ------------------
  390|  1.00k|    zng_memwrite_4(&s->pending_buf[s->pending], dw);
  391|  1.00k|    s->pending += 4;
  392|  1.00k|}

deflate_medium_fizzle:
  154|   169M|Z_INTERNAL block_state SUFFIX(deflate_medium)(deflate_state *s, int flush) {
  155|   169M|    ALIGNED_(16) struct match current_match = {0};
  ------------------
  |  |  266|   169M|#  define ALIGNED_(x) __attribute__ ((aligned(x)))
  ------------------
  156|   169M|#ifdef USE_FIZZLE
  157|   169M|                 struct match next_match = {0};
  158|   169M|    uint32_t window_end = s->window_size - MIN_LOOKAHEAD;
  ------------------
  |  |  414|   169M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  ------------------
  |  |  |  |   62|   169M|#define STD_MAX_MATCH  258
  |  |  ------------------
  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  ------------------
  |  |  |  |   61|   169M|#define STD_MIN_MATCH  3
  |  |  ------------------
  ------------------
  159|   169M|#endif
  160|   169M|    uint32_t max_len = (16 * s->max_insert_length);
  ------------------
  |  |  257|   169M|#   define max_insert_length  max_lazy_match
  ------------------
  161|   169M|    unsigned char *window = s->window;
  162|   169M|    int32_t max_dist = MAX_DIST(s);
  ------------------
  |  |  419|   169M|#define MAX_DIST(s)  ((s)->w_size - MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  414|   169M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   169M|#define STD_MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|   169M|#define STD_MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  163|       |
  164|   300M|    for (;;) {
  165|   300M|        int bflush = 0;       /* set if current block must be flushed */
  166|   300M|        uint32_t curr_match_len;
  167|       |
  168|       |        /* Make sure that we always have enough lookahead, except
  169|       |         * at the end of the input file. We need STD_MAX_MATCH bytes
  170|       |         * for the next match, plus WANT_MIN_MATCH bytes to insert the
  171|       |         * string following the next current_match.
  172|       |         */
  173|   300M|        if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD)) {
  ------------------
  |  |  258|   300M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 300M, False: 0]
  |  |  ------------------
  ------------------
  174|   300M|            PREFIX(fill_window)(s);
  ------------------
  |  |  121|   300M|#  define PREFIX(x) zng_ ## x
  ------------------
  175|   300M|            if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH)) {
  ------------------
  |  |  258|   469M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 169M, False: 130M]
  |  |  |  Branch (258:53): [True: 169M, False: 130M]
  |  |  |  Branch (258:53): [True: 169M, False: 326k]
  |  |  ------------------
  ------------------
  176|   169M|                return need_more;
  177|   169M|            }
  178|   130M|            if (UNLIKELY(s->lookahead == 0))
  ------------------
  |  |  258|   130M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 3.55k, False: 130M]
  |  |  ------------------
  ------------------
  179|  3.55k|                break; /* flush the current block */
  180|   130M|#ifdef USE_FIZZLE
  181|   130M|            next_match.match_length = 0;
  182|   130M|#endif
  183|   130M|        }
  184|       |
  185|       |        /* Insert the string window[strstart .. strstart+2] in the
  186|       |         * dictionary, and set hash_head to the head of the hash chain:
  187|       |         */
  188|       |
  189|   130M|#ifdef USE_FIZZLE
  190|       |        /* If we already have a future match from a previous round, just use that */
  191|   130M|        if (next_match.match_length > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 130M]
  ------------------
  192|      0|            current_match = next_match;
  193|      0|            next_match.match_length = 0;
  194|   130M|        } else {
  195|   130M|            uint32_t hash_head = 0;   /* head of the hash chain */
  196|   130M|            if (LIKELY(s->lookahead >= WANT_MIN_MATCH)) {
  ------------------
  |  |  257|   130M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (257:33): [True: 130M, False: 6.35k]
  |  |  ------------------
  ------------------
  197|   130M|                hash_head = insert_knuth(s, window, s->strstart);
  198|   130M|            }
  199|       |
  200|   130M|            current_match = SUFFIX(find_best_match)(s, hash_head, max_dist);
  ------------------
  |  |   31|   130M|#define SUFFIX(name) name ## _fizzle
  ------------------
  201|   130M|        }
  202|   130M|        curr_match_len = current_match.match_length;
  203|       |
  204|   130M|        if (curr_match_len >= WANT_MIN_MATCH && s->lookahead > (unsigned int)(curr_match_len + WANT_MIN_MATCH )) {
  ------------------
  |  |   65|   261M|#define WANT_MIN_MATCH  4
  ------------------
                      if (curr_match_len >= WANT_MIN_MATCH && s->lookahead > (unsigned int)(curr_match_len + WANT_MIN_MATCH )) {
  ------------------
  |  |   65|  2.83M|#define WANT_MIN_MATCH  4
  ------------------
  |  Branch (204:13): [True: 2.83M, False: 128M]
  |  Branch (204:49): [True: 2.76M, False: 70.9k]
  ------------------
  205|  2.76M|            SUFFIX(insert_match)(s, window, current_match, max_len);
  ------------------
  |  |   31|  2.76M|#define SUFFIX(name) name ## _fizzle
  ------------------
  206|  2.76M|        }
  207|       |
  208|       |        /* now, look ahead one */
  209|   130M|        if (LIKELY(s->lookahead > MIN_LOOKAHEAD && (current_match.strstart + curr_match_len) < window_end)) {
  ------------------
  |  |  257|   130M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (257:33): [True: 0, False: 130M]
  |  |  |  Branch (257:53): [True: 0, False: 130M]
  |  |  |  Branch (257:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  210|      0|            s->strstart = current_match.strstart + curr_match_len;
  211|      0|            uint32_t hash_head = insert_knuth(s, window, s->strstart);
  212|       |
  213|      0|            next_match = SUFFIX(find_best_match)(s, hash_head, max_dist);
  ------------------
  |  |   31|      0|#define SUFFIX(name) name ## _fizzle
  ------------------
  214|       |
  215|      0|            uint32_t tmp_cmatch_len_sub = curr_match_len - 1;
  216|      0|            if (tmp_cmatch_len_sub
  ------------------
  |  Branch (216:17): [True: 0, False: 0]
  ------------------
  217|      0|                     && next_match.match_length >= WANT_MIN_MATCH
  ------------------
  |  |   65|      0|#define WANT_MIN_MATCH  4
  ------------------
  |  Branch (217:25): [True: 0, False: 0]
  ------------------
  218|      0|                     && tmp_cmatch_len_sub <= next_match.match_start) {
  ------------------
  |  Branch (218:25): [True: 0, False: 0]
  ------------------
  219|      0|                fizzle_matches(window, &current_match, &next_match, max_dist);
  220|      0|                curr_match_len = current_match.match_length;
  221|      0|            }
  222|       |
  223|      0|            s->strstart = current_match.strstart;
  224|      0|            if (curr_match_len == 0) {
  ------------------
  |  Branch (224:17): [True: 0, False: 0]
  ------------------
  225|       |                /* If current match fizzled out, jump to next loop iteration */
  226|      0|                continue;
  227|      0|            }
  228|   130M|        } else {
  229|   130M|            next_match.match_length = 0;
  230|   130M|        }
  231|       |#else
  232|       |        // WITHOUT_FIZZLE: We don't look for future matches, so code is much simplified
  233|       |        uint32_t hash_head = 0;   /* head of the hash chain */
  234|       |        if (LIKELY(s->lookahead >= WANT_MIN_MATCH)) {
  235|       |            hash_head = insert_knuth(s, window, s->strstart);
  236|       |        }
  237|       |
  238|       |        current_match = SUFFIX(find_best_match)(s, hash_head, max_dist);
  239|       |        curr_match_len = current_match.match_length;
  240|       |
  241|       |        if (curr_match_len >= WANT_MIN_MATCH && s->lookahead > (unsigned int)(curr_match_len + WANT_MIN_MATCH )) {
  242|       |            SUFFIX(insert_match)(s, window, current_match, max_len);
  243|       |        }
  244|       |#endif
  245|       |
  246|       |        /* now emit the current match */
  247|   130M|        s->lookahead -= curr_match_len;
  248|   130M|        if (LIKELY(curr_match_len == 1)) {
  ------------------
  |  |  257|   130M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (257:33): [True: 128M, False: 2.83M]
  |  |  ------------------
  ------------------
  249|       |            /* matches shorter than WANT_MIN_MATCH are set to 1, we need to emit these as literals */
  250|   128M|            bflush = zng_tr_tally_lit(s, window[current_match.strstart]);
  251|   128M|        } else {
  252|  2.83M|            check_match(s, current_match.strstart, current_match.match_start, curr_match_len);
  253|  2.83M|            bflush = zng_tr_tally_dist(s, current_match.strstart - current_match.match_start, curr_match_len - STD_MIN_MATCH);
  ------------------
  |  |   61|  2.83M|#define STD_MIN_MATCH  3
  ------------------
  254|  2.83M|        }
  255|       |
  256|       |        /* move the "cursor" forward */
  257|   130M|        s->strstart += curr_match_len;
  258|       |
  259|   130M|        if (UNLIKELY(bflush))
  ------------------
  |  |  258|   130M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 7.69k, False: 130M]
  |  |  ------------------
  ------------------
  260|   130M|            FLUSH_BLOCK(s, window, 0);
  ------------------
  |  |  202|  7.69k|#define FLUSH_BLOCK(s, window, last) { \
  |  |  203|  7.69k|    FLUSH_BLOCK_ONLY(s, window, last); \
  |  |  ------------------
  |  |  |  |  190|  7.69k|#define FLUSH_BLOCK_ONLY(s, window, last) { \
  |  |  |  |  191|  7.69k|    int block_start = s->block_start; \
  |  |  |  |  192|  7.69k|    zng_tr_flush_block(s, (block_start >= 0 ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (192:28): [True: 7.52k, False: 168]
  |  |  |  |  ------------------
  |  |  |  |  193|  7.69k|                   &window[(unsigned)block_start] : \
  |  |  |  |  194|  7.69k|                   NULL), \
  |  |  |  |  195|  7.69k|                   (uint32_t)((int)s->strstart - block_start), \
  |  |  |  |  196|  7.69k|                   (last)); \
  |  |  |  |  197|  7.69k|    s->block_start = (int)s->strstart; \
  |  |  |  |  198|  7.69k|    PREFIX(flush_pending)(s->strm); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  121|  7.69k|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  199|  7.69k|}
  |  |  ------------------
  |  |  204|  7.69k|    if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (204:9): [True: 7.69k, False: 0]
  |  |  |  Branch (204:41): [Folded, False: 7.69k]
  |  |  ------------------
  |  |  205|  7.69k|}
  ------------------
  261|   130M|    }
  262|       |
  263|  3.55k|    s->insert = s->strstart < (STD_MIN_MATCH - 1) ? s->strstart : (STD_MIN_MATCH - 1);
  ------------------
  |  |   61|  3.55k|#define STD_MIN_MATCH  3
  ------------------
                  s->insert = s->strstart < (STD_MIN_MATCH - 1) ? s->strstart : (STD_MIN_MATCH - 1);
  ------------------
  |  |   61|  3.52k|#define STD_MIN_MATCH  3
  ------------------
  |  Branch (263:17): [True: 27, False: 3.52k]
  ------------------
  264|  3.55k|    if (flush == Z_FINISH) {
  ------------------
  |  |  175|  3.55k|#define Z_FINISH        4
  ------------------
  |  Branch (264:9): [True: 3.55k, False: 0]
  ------------------
  265|  3.55k|        FLUSH_BLOCK(s, window, 1);
  ------------------
  |  |  202|  3.55k|#define FLUSH_BLOCK(s, window, last) { \
  |  |  203|  3.55k|    FLUSH_BLOCK_ONLY(s, window, last); \
  |  |  ------------------
  |  |  |  |  190|  3.55k|#define FLUSH_BLOCK_ONLY(s, window, last) { \
  |  |  |  |  191|  3.55k|    int block_start = s->block_start; \
  |  |  |  |  192|  3.55k|    zng_tr_flush_block(s, (block_start >= 0 ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (192:28): [True: 3.49k, False: 61]
  |  |  |  |  ------------------
  |  |  |  |  193|  3.55k|                   &window[(unsigned)block_start] : \
  |  |  |  |  194|  3.55k|                   NULL), \
  |  |  |  |  195|  3.55k|                   (uint32_t)((int)s->strstart - block_start), \
  |  |  |  |  196|  3.55k|                   (last)); \
  |  |  |  |  197|  3.55k|    s->block_start = (int)s->strstart; \
  |  |  |  |  198|  3.55k|    PREFIX(flush_pending)(s->strm); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  199|  3.55k|}
  |  |  ------------------
  |  |  204|  3.55k|    if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (204:9): [True: 3.55k, False: 0]
  |  |  |  Branch (204:41): [True: 3.55k, Folded]
  |  |  ------------------
  |  |  205|  3.55k|}
  ------------------
  266|      0|        return finish_done;
  267|  3.55k|    }
  268|      0|    if (UNLIKELY(s->sym_next))
  ------------------
  |  |  258|      0|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  269|      0|        FLUSH_BLOCK(s, window, 0);
  ------------------
  |  |  202|      0|#define FLUSH_BLOCK(s, window, last) { \
  |  |  203|      0|    FLUSH_BLOCK_ONLY(s, window, last); \
  |  |  ------------------
  |  |  |  |  190|      0|#define FLUSH_BLOCK_ONLY(s, window, last) { \
  |  |  |  |  191|      0|    int block_start = s->block_start; \
  |  |  |  |  192|      0|    zng_tr_flush_block(s, (block_start >= 0 ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (192:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  193|      0|                   &window[(unsigned)block_start] : \
  |  |  |  |  194|      0|                   NULL), \
  |  |  |  |  195|      0|                   (uint32_t)((int)s->strstart - block_start), \
  |  |  |  |  196|      0|                   (last)); \
  |  |  |  |  197|      0|    s->block_start = (int)s->strstart; \
  |  |  |  |  198|      0|    PREFIX(flush_pending)(s->strm); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  121|      0|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  199|      0|}
  |  |  ------------------
  |  |  204|      0|    if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (204:9): [True: 0, False: 0]
  |  |  |  Branch (204:41): [Folded, False: 0]
  |  |  ------------------
  |  |  205|      0|}
  ------------------
  270|       |
  271|      0|    return block_done;
  272|      0|}
deflate_medium.c:find_best_match_fizzle:
   40|   130M|Z_FORCEINLINE static struct match SUFFIX(find_best_match)(deflate_state *s, uint32_t hash_head, int32_t max_dist) {
   41|   130M|    struct match m;
   42|   130M|    int32_t dist;
   43|       |
   44|   130M|    m.strstart = s->strstart;
   45|   130M|#ifdef USE_FIZZLE
   46|   130M|    m.orgstart = m.strstart;
   47|       |#else
   48|       |    m.orgstart = 0; // For sanitizer
   49|       |#endif
   50|       |
   51|   130M|    dist = (int32_t)s->strstart - (int32_t)hash_head;
   52|   130M|    if (dist <= max_dist && dist > 0 && hash_head != 0) {
  ------------------
  |  Branch (52:9): [True: 64.0M, False: 66.8M]
  |  Branch (52:29): [True: 64.0M, False: 3.55k]
  |  Branch (52:41): [True: 45.9M, False: 18.1M]
  ------------------
   53|       |        /* To simplify the code, we prevent matches with the string
   54|       |         * of window index 0 (in particular we have to avoid a match
   55|       |         * of the string with itself at the start of the input file).
   56|       |         */
   57|  45.9M|        m.match_length = FUNCTABLE_CALL(longest_match)(s, hash_head);
  ------------------
  |  |   48|  45.9M|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
   58|  45.9M|        m.match_start = s->match_start;
   59|  45.9M|        if (UNLIKELY(m.match_length < WANT_MIN_MATCH))
  ------------------
  |  |  258|  45.9M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 43.0M, False: 2.83M]
  |  |  ------------------
  ------------------
   60|  43.0M|            m.match_length = 1;
   61|  45.9M|        if (UNLIKELY(m.match_start >= m.strstart)) {
  ------------------
  |  |  258|  45.9M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 0, False: 45.9M]
  |  |  ------------------
  ------------------
   62|       |            /* this can happen due to some restarts */
   63|      0|            m.match_length = 1;
   64|      0|        }
   65|  84.9M|    } else {
   66|       |        /* Set up the match to be a 1 byte literal */
   67|  84.9M|        m.match_start = 0;
   68|  84.9M|        m.match_length = 1;
   69|  84.9M|    }
   70|       |
   71|   130M|    return m;
   72|   130M|}
deflate_medium.c:insert_match_fizzle:
   16|  2.76M|static void SUFFIX(insert_match)(deflate_state *s, unsigned char *Z_RESTRICT window, struct match match, const uint32_t max_len) {
   17|  2.76M|    uint32_t start;
   18|  2.76M|    uint32_t match_len = match.match_length;
   19|  2.76M|    uint32_t strstart = match.strstart + 1; // string at strstart already in table
   20|  2.76M|    uint32_t end = strstart + match_len - 1;
   21|       |
   22|       |    /* Insert new strings in the hash table only if the match length
   23|       |     * is not too large. This saves time but degrades compression.
   24|       |     */
   25|  2.76M|    if (UNLIKELY(match_len > max_len)) {
  ------------------
  |  |  258|  2.76M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 672, False: 2.76M]
  |  |  ------------------
  ------------------
   26|       |        // For too long matches, insert only the tail position.
   27|    672|        start = end - 1;
   28|  2.76M|    } else {
   29|  2.76M|        start = strstart;
   30|  2.76M|    }
   31|       |
   32|  2.76M|#ifdef USE_FIZZLE
   33|  2.76M|    if (UNLIKELY(start < match.orgstart))
  ------------------
  |  |  258|  2.76M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 0, False: 2.76M]
  |  |  ------------------
  ------------------
   34|      0|        start = match.orgstart;
   35|  2.76M|#endif
   36|       |
   37|  2.76M|    insert_knuth_batch(s, window, start, end - start);
   38|  2.76M|}

deflate.c:flush_pending_inline:
  125|   125M|Z_FORCEINLINE static void flush_pending_inline(PREFIX3(stream) *strm) {
  126|   125M|    uint32_t len;
  127|   125M|    deflate_state *s = strm->state;
  128|       |
  129|   125M|    zng_tr_flush_bits(s);
  130|   125M|    len = MIN(s->pending, strm->avail_out);
  ------------------
  |  |  148|   125M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 125M, False: 21.8k]
  |  |  ------------------
  ------------------
  131|   125M|    if (len == 0)
  ------------------
  |  Branch (131:9): [True: 3.55k, False: 125M]
  ------------------
  132|  3.55k|        return;
  133|       |
  134|   125M|    Tracev((stderr, "[FLUSH]"));
  135|   125M|    memcpy(strm->next_out, s->pending_out, len);
  136|   125M|    strm->next_out  += len;
  137|   125M|    s->pending_out  += len;
  138|   125M|    strm->total_out += len;
  139|   125M|    strm->avail_out -= len;
  140|   125M|    s->pending      -= len;
  141|   125M|    if (s->pending == 0)
  ------------------
  |  Branch (141:9): [True: 18.3k, False: 125M]
  ------------------
  142|  18.3k|        s->pending_out = s->pending_buf;
  143|   125M|}
deflate.c:read_buf:
  161|   169M|Z_FORCEINLINE static unsigned read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size) {
  162|   169M|    deflate_state *s = strm->state;
  163|   169M|    uint32_t len = MIN(strm->avail_in, size);
  ------------------
  |  |  148|   169M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 0, False: 169M]
  |  |  ------------------
  ------------------
  164|       |
  165|   169M|    if (len == 0)
  ------------------
  |  Branch (165:9): [True: 0, False: 169M]
  ------------------
  166|      0|        return 0;
  167|       |
  168|   169M|    if (!DEFLATE_NEED_CHECKSUM(strm)) {
  ------------------
  |  |  499|   169M|#  define DEFLATE_NEED_CHECKSUM(strm) 1
  ------------------
  |  Branch (168:9): [Folded, False: 169M]
  ------------------
  169|      0|        memcpy(buf, strm->next_in, len);
  170|      0|#ifdef GZIP
  171|   169M|    } else if (s->wrap == 2) {
  ------------------
  |  Branch (171:16): [True: 0, False: 169M]
  ------------------
  172|      0|        strm->adler = FUNCTABLE_CALL(crc32_copy)(strm->adler, buf, strm->next_in, len);
  ------------------
  |  |   48|      0|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
  173|      0|#endif
  174|   169M|    } else if (s->wrap == 1) {
  ------------------
  |  Branch (174:16): [True: 169M, False: 0]
  ------------------
  175|   169M|        strm->adler = FUNCTABLE_CALL(adler32_copy)(strm->adler, buf, strm->next_in, len);
  ------------------
  |  |   48|   169M|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
  176|   169M|    } else {
  177|      0|        memcpy(buf, strm->next_in, len);
  178|      0|    }
  179|       |
  180|   169M|    strm->avail_in -= len;
  181|   169M|    strm->next_in  += len;
  182|   169M|    strm->total_in += len;
  183|   169M|    return len;
  184|   169M|}
deflate_medium.c:zng_tr_tally_lit:
   64|   128M|static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) {
   65|       |    /* c is the unmatched char */
   66|   128M|    unsigned int sym_next = s->sym_next;
   67|       |#ifdef LIT_MEM
   68|       |    s->d_buf[sym_next] = 0;
   69|       |    s->l_buf[sym_next] = c;
   70|       |    s->sym_next = sym_next + 1;
   71|       |#else
   72|   128M|#  if OPTIMAL_CMP >= 32
   73|   128M|    zng_memwrite_4(&s->sym_buf[sym_next], Z_U32_TO_LE((uint32_t)c << 16));
  ------------------
  |  |   84|   128M|#  define Z_U32_TO_LE(x)    (x)
  ------------------
   74|       |#  else
   75|       |    s->sym_buf[sym_next] = 0;
   76|       |    s->sym_buf[sym_next+1] = 0;
   77|       |    s->sym_buf[sym_next+2] = c;
   78|       |#  endif
   79|   128M|    s->sym_next = sym_next + 3;
   80|   128M|#endif
   81|   128M|    s->dyn_ltree[c].Freq++;
  ------------------
  |  |  135|   128M|#define Freq fc.freq
  ------------------
   82|   128M|    Tracevv((stderr, "%c", c));
   83|       |#ifdef ZLIB_DEBUG
   84|       |    uint32_t _c = c;
   85|       |    Assert(_c <= (STD_MAX_MATCH-STD_MIN_MATCH), "zng_tr_tally: bad literal");
   86|       |#endif
   87|   128M|    return (s->sym_next == s->sym_end);
   88|   128M|}
deflate_medium.c:zng_tr_tally_dist:
   90|  2.83M|static inline int zng_tr_tally_dist(deflate_state* s, uint32_t dist, uint32_t len) {
   91|       |    /* dist: distance of matched string */
   92|       |    /* len: match length-STD_MIN_MATCH */
   93|  2.83M|    unsigned int sym_next = s->sym_next;
   94|       |#ifdef LIT_MEM
   95|       |    Assert(dist <= UINT16_MAX, "dist should fit in uint16_t");
   96|       |    Assert(len <= UINT8_MAX, "len should fit in uint8_t");
   97|       |    s->d_buf[sym_next] = (uint16_t)dist;
   98|       |    s->l_buf[sym_next] = (uint8_t)len;
   99|       |    s->sym_next = sym_next + 1;
  100|       |#else
  101|  2.83M|#  if OPTIMAL_CMP >= 32
  102|  2.83M|    zng_memwrite_4(&s->sym_buf[sym_next], Z_U32_TO_LE(dist | ((uint32_t)len << 16)));
  ------------------
  |  |   84|  2.83M|#  define Z_U32_TO_LE(x)    (x)
  ------------------
  103|       |#  else
  104|       |    s->sym_buf[sym_next] = (uint8_t)(dist);
  105|       |    s->sym_buf[sym_next+1] = (uint8_t)(dist >> 8);
  106|       |    s->sym_buf[sym_next+2] = (uint8_t)len;
  107|       |#  endif
  108|  2.83M|    s->sym_next = sym_next + 3;
  109|  2.83M|#endif
  110|  2.83M|    dist--;
  111|  2.83M|    Assert(dist < MAX_DIST(s) && (uint16_t)d_code(dist) < (uint16_t)D_CODES,
  112|  2.83M|        "zng_tr_tally: bad match");
  113|       |
  114|  2.83M|    s->dyn_ltree[zng_length_code[len] + LITERALS + 1].Freq++;
  ------------------
  |  |   45|  2.83M|#define LITERALS  256
  ------------------
                  s->dyn_ltree[zng_length_code[len] + LITERALS + 1].Freq++;
  ------------------
  |  |  135|  2.83M|#define Freq fc.freq
  ------------------
  115|  2.83M|    s->dyn_dtree[d_code(dist)].Freq++;
  ------------------
  |  |  446|  2.83M|#define d_code(dist) ((dist) < 256 ? zng_dist_code[dist] : zng_dist_code[256+((dist)>>7)])
  |  |  ------------------
  |  |  |  Branch (446:23): [True: 562k, False: 2.27M]
  |  |  ------------------
  ------------------
                  s->dyn_dtree[d_code(dist)].Freq++;
  ------------------
  |  |  135|  2.83M|#define Freq fc.freq
  ------------------
  116|  2.83M|    return (s->sym_next == s->sym_end);
  117|  2.83M|}
trees.c:bi_reverse:
  148|  2.25M|Z_FORCEINLINE static uint16_t bi_reverse(uint16_t code, int len) {
  149|       |    /* code: the value to invert */
  150|       |    /* len: its bit length */
  151|  2.25M|    Assert(len >= 1 && len <= 15, "code length must be 1-15");
  152|  2.25M|    return zng_bitreverse16(code) >> (16 - len);
  153|  2.25M|}

deflate.c:zng_ctz32:
   20|  3.55k|Z_FORCEINLINE static uint32_t zng_ctz32(uint32_t value) {
   21|  3.55k|    Assert(value != 0, "Invalid input value: 0");
   22|  3.55k|#if __has_builtin(__builtin_ctz)
   23|  3.55k|    return (uint32_t)__builtin_ctz(value);
   24|       |#elif defined(_MSC_VER) && !defined(__clang__)
   25|       |#  if defined(X86_FEATURES) && !(_MSC_VER < 1700)
   26|       |    /* tzcnt falls back to bsf on cpus without BMI1, and is equal or faster on all x86 cpus. */
   27|       |    return (uint32_t)_tzcnt_u32(value);
   28|       |#  else
   29|       |    unsigned long trailing_zero;
   30|       |    _BitScanForward(&trailing_zero, value);
   31|       |    return (uint32_t)trailing_zero;
   32|       |#  endif
   33|       |#else
   34|       |    /* De Bruijn CTZ for 32-bit values */
   35|       |    static const uint8_t debruijn_ctz32[32] = {
   36|       |        0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
   37|       |        31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
   38|       |    };
   39|       |    uint32_t lsb = value & (~value + 1u);
   40|       |    return debruijn_ctz32[(lsb * 0x077CB531U) >> 27];
   41|       |#endif
   42|  3.55k|}
inftrees.c:zng_bitreverse16:
  141|  1.82M|Z_FORCEINLINE static uint16_t zng_bitreverse16(uint16_t value) {
  142|  1.82M|#if __has_builtin(__builtin_bitreverse16)
  143|  1.82M|    return (uint16_t)__builtin_bitreverse16(value);
  144|       |#elif defined(ARCH_ARM) && defined(ARCH_64BIT) && !defined(_MSC_VER)
  145|       |    /* ARM bit reversal for 16-bit values using rbit instruction */
  146|       |    uint32_t res;
  147|       |#    if __has_builtin(__builtin_rbit)
  148|       |    res = __builtin_rbit((uint32_t)value);
  149|       |#    else
  150|       |    __asm__ volatile("rbit %w0, %w1" : "=r"(res) : "r"((uint32_t)value));
  151|       |#    endif
  152|       |    return (uint16_t)(res >> 16);
  153|       |#elif defined(ARCH_LOONGARCH)
  154|       |    /* LoongArch bit reversal for 16-bit values */
  155|       |    uint32_t res;
  156|       |    __asm__ volatile("bitrev.w %0, %1" : "=r"(res) : "r"(value));
  157|       |    return (uint16_t)(res >> 16);
  158|       |#else
  159|       |    /* Bit reversal for 8-bit values using multiplication method */
  160|       |#  define bitrev8(value) \
  161|       |    (uint8_t)((((uint8_t)(value) * 0x80200802ULL) & 0x0884422110ULL) * 0x0101010101ULL >> 32)
  162|       |    /* General purpose bit reversal for 16-bit values */
  163|       |    return ((bitrev8(value >> 8) | (uint16_t)bitrev8(value) << 8));
  164|       |#  undef bitrev8
  165|       |#endif
  166|  1.82M|}
trees.c:zng_bitreverse16:
  141|  2.25M|Z_FORCEINLINE static uint16_t zng_bitreverse16(uint16_t value) {
  142|  2.25M|#if __has_builtin(__builtin_bitreverse16)
  143|  2.25M|    return (uint16_t)__builtin_bitreverse16(value);
  144|       |#elif defined(ARCH_ARM) && defined(ARCH_64BIT) && !defined(_MSC_VER)
  145|       |    /* ARM bit reversal for 16-bit values using rbit instruction */
  146|       |    uint32_t res;
  147|       |#    if __has_builtin(__builtin_rbit)
  148|       |    res = __builtin_rbit((uint32_t)value);
  149|       |#    else
  150|       |    __asm__ volatile("rbit %w0, %w1" : "=r"(res) : "r"((uint32_t)value));
  151|       |#    endif
  152|       |    return (uint16_t)(res >> 16);
  153|       |#elif defined(ARCH_LOONGARCH)
  154|       |    /* LoongArch bit reversal for 16-bit values */
  155|       |    uint32_t res;
  156|       |    __asm__ volatile("bitrev.w %0, %1" : "=r"(res) : "r"(value));
  157|       |    return (uint16_t)(res >> 16);
  158|       |#else
  159|       |    /* Bit reversal for 8-bit values using multiplication method */
  160|       |#  define bitrev8(value) \
  161|       |    (uint8_t)((((uint8_t)(value) * 0x80200802ULL) & 0x0884422110ULL) * 0x0101010101ULL >> 32)
  162|       |    /* General purpose bit reversal for 16-bit values */
  163|       |    return ((bitrev8(value >> 8) | (uint16_t)bitrev8(value) << 8));
  164|       |#  undef bitrev8
  165|       |#endif
  166|  2.25M|}
compare256_avx2.c:zng_ctz32:
   20|  1.05M|Z_FORCEINLINE static uint32_t zng_ctz32(uint32_t value) {
   21|  1.05M|    Assert(value != 0, "Invalid input value: 0");
   22|  1.05M|#if __has_builtin(__builtin_ctz)
   23|  1.05M|    return (uint32_t)__builtin_ctz(value);
   24|       |#elif defined(_MSC_VER) && !defined(__clang__)
   25|       |#  if defined(X86_FEATURES) && !(_MSC_VER < 1700)
   26|       |    /* tzcnt falls back to bsf on cpus without BMI1, and is equal or faster on all x86 cpus. */
   27|       |    return (uint32_t)_tzcnt_u32(value);
   28|       |#  else
   29|       |    unsigned long trailing_zero;
   30|       |    _BitScanForward(&trailing_zero, value);
   31|       |    return (uint32_t)trailing_zero;
   32|       |#  endif
   33|       |#else
   34|       |    /* De Bruijn CTZ for 32-bit values */
   35|       |    static const uint8_t debruijn_ctz32[32] = {
   36|       |        0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
   37|       |        31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
   38|       |    };
   39|       |    uint32_t lsb = value & (~value + 1u);
   40|       |    return debruijn_ctz32[(lsb * 0x077CB531U) >> 27];
   41|       |#endif
   42|  1.05M|}
compare256_avx2.c:zng_ctz64:
   44|  2.73M|Z_FORCEINLINE static uint32_t zng_ctz64(uint64_t value) {
   45|  2.73M|    Assert(value != 0, "Invalid input value: 0");
   46|  2.73M|#if __has_builtin(__builtin_ctzll)
   47|  2.73M|    return (uint32_t)__builtin_ctzll(value);
   48|       |#elif defined(_MSC_VER) && !defined(__clang__) && defined(ARCH_64BIT)
   49|       |#  if defined(X86_FEATURES) && !(_MSC_VER < 1700)
   50|       |    /* tzcnt falls back to bsf on cpus without BMI1, and is equal or faster on all x86 cpus. */
   51|       |    return (uint32_t)_tzcnt_u64(value);
   52|       |#  else
   53|       |    unsigned long trailing_zero;
   54|       |    _BitScanForward64(&trailing_zero, value);
   55|       |    return (uint32_t)trailing_zero;
   56|       |#  endif
   57|       |#else
   58|       |    /* De Bruijn CTZ for 64-bit values */
   59|       |    static const uint8_t debruijn_ctz64[64] = {
   60|       |        63, 0, 1, 52, 2, 6, 53, 26, 3, 37, 40, 7, 33, 54, 47, 27,
   61|       |        61, 4, 38, 45, 43, 41, 21, 8, 23, 34, 58, 55, 48, 17, 28, 10,
   62|       |        62, 51, 5, 25, 36, 39, 32, 46, 60, 44, 42, 20, 22, 57, 16, 9,
   63|       |        50, 24, 35, 31, 59, 19, 56, 15, 49, 30, 18, 14, 29, 13, 12, 11
   64|       |    };
   65|       |    uint64_t lsb = value & (~value + 1ull);
   66|       |    return debruijn_ctz64[(lsb * 0x045FBAC7992A70DAULL) >> 58];
   67|       |#endif
   68|  2.73M|}

functable.c:functable_constructor:
  504|      2|static void __attribute__((constructor)) functable_constructor(void) {
  505|      2|    FUNCTABLE_INIT_ABORT;
  ------------------
  |  |   57|      2|    if (init_functable()) { \
  |  |  ------------------
  |  |  |  Branch (57:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   58|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   59|      0|        abort(); \
  |  |   60|      2|    };
  ------------------
  506|      2|}
functable.c:init_functable:
   70|      2|static int init_functable(void) {
   71|      2|    struct functable_s ft;
   72|      2|    struct cpu_features cf;
   73|       |
   74|      2|    memset(&ft, 0, sizeof(struct functable_s));
   75|      2|    cpu_check_features(&cf);
   76|      2|    ft.force_init = &force_init_empty;
   77|       |
   78|       |    // Only use necessary generic functions when no suitable simd versions are available.
   79|      2|#ifdef ADLER32_FALLBACK
   80|      2|    ft.adler32 = &adler32_c;
   81|      2|    ft.adler32_copy = &adler32_copy_c;
   82|      2|#endif
   83|       |#ifdef CHUNKSET_FALLBACK
   84|       |    ft.chunkmemset_safe = &chunkmemset_safe_c;
   85|       |    ft.inflate_fast = &inflate_fast_c;
   86|       |    ft.inflate_fast_safe = &inflate_fast_safe_c;
   87|       |#endif
   88|       |#ifdef COMPARE256_FALLBACK
   89|       |    ft.compare256 = &compare256_c;
   90|       |    ft.longest_match = &longest_match_c;
   91|       |    ft.longest_match_slow_knuth = &longest_match_slow_knuth_c;
   92|       |    ft.longest_match_slow_roll = &longest_match_slow_roll_c;
   93|       |#endif
   94|      2|#ifdef CRC32_BRAID_FALLBACK
   95|      2|    ft.crc32 = &crc32_braid;
   96|      2|    ft.crc32_copy = &crc32_copy_braid;
   97|      2|#endif
   98|       |#ifdef SLIDE_HASH_FALLBACK
   99|       |    ft.slide_hash = &slide_hash_c;
  100|       |    ft.slide_hash_head = &slide_hash_head_c;
  101|       |#endif
  102|       |
  103|       |    // Select arch-optimized functions
  104|      2|#ifdef WITH_OPTIM
  105|       |
  106|       |    // Chorba generic C fallback
  107|      2|#ifdef CRC32_CHORBA_FALLBACK
  108|      2|    ft.crc32 = &crc32_chorba;
  109|      2|    ft.crc32_copy = &crc32_copy_chorba;
  110|      2|#endif
  111|       |
  112|       |    // X86 - SSE2
  113|      2|#ifdef X86_SSE2
  114|       |#  ifndef X86_SSE2_NATIVE
  115|       |    if (cf.x86.has_sse2)
  116|       |#  endif
  117|      2|    {
  118|      2|#  ifndef X86_AVX2_NATIVE
  119|      2|        ft.chunkmemset_safe = &chunkmemset_safe_sse2;
  120|      2|        ft.compare256 = &compare256_sse2;
  121|      2|        ft.inflate_fast = &inflate_fast_sse2;
  122|      2|        ft.inflate_fast_safe = &inflate_fast_safe_sse2;
  123|      2|        ft.longest_match = &longest_match_sse2;
  124|      2|        ft.longest_match_slow_knuth = &longest_match_slow_knuth_sse2;
  125|      2|        ft.longest_match_slow_roll = &longest_match_slow_roll_sse2;
  126|      2|        ft.slide_hash = &slide_hash_sse2;
  127|      2|        ft.slide_hash_head = &slide_hash_head_sse2;
  128|      2|#  endif
  129|      2|#  if defined(CRC32_CHORBA_SSE_FALLBACK) && !defined(X86_SSE41_NATIVE) && !defined(X86_PCLMULQDQ_NATIVE)
  130|      2|        ft.crc32 = &crc32_chorba_sse2;
  131|      2|        ft.crc32_copy = &crc32_copy_chorba_sse2;
  132|      2|#  endif
  133|      2|    }
  134|      2|#endif
  135|       |    // X86 - SSSE3
  136|      2|#ifdef X86_SSSE3
  137|      2|#  ifndef X86_SSSE3_NATIVE
  138|      2|    if (cf.x86.has_ssse3)
  ------------------
  |  Branch (138:9): [True: 2, False: 0]
  ------------------
  139|      2|#  endif
  140|      2|    {
  141|      2|        ft.adler32 = &adler32_ssse3;
  142|      2|        ft.adler32_copy = &adler32_copy_ssse3;
  143|      2|#  ifndef X86_AVX2_NATIVE
  144|      2|        ft.chunkmemset_safe = &chunkmemset_safe_ssse3;
  145|      2|        ft.inflate_fast = &inflate_fast_ssse3;
  146|      2|        ft.inflate_fast_safe = &inflate_fast_safe_ssse3;
  147|      2|#  endif
  148|      2|    }
  149|      2|#endif
  150|       |
  151|       |    // X86 - SSE4.1
  152|      2|#if defined(X86_SSE41) && !defined(X86_PCLMULQDQ_NATIVE)
  153|      2|#  ifndef X86_SSE41_NATIVE
  154|      2|    if (cf.x86.has_sse41)
  ------------------
  |  Branch (154:9): [True: 2, False: 0]
  ------------------
  155|      2|#  endif
  156|      2|    {
  157|      2|#  ifdef CRC32_CHORBA_SSE_FALLBACK
  158|      2|        ft.crc32 = &crc32_chorba_sse41;
  159|      2|        ft.crc32_copy = &crc32_copy_chorba_sse41;
  160|      2|#  endif
  161|      2|    }
  162|      2|#endif
  163|       |
  164|       |    // X86 - SSE4.2
  165|      2|#if defined(X86_SSE42) && !defined(X86_AVX512_NATIVE)
  166|      2|#  ifndef X86_SSE42_NATIVE
  167|      2|    if (cf.x86.has_sse42)
  ------------------
  |  Branch (167:9): [True: 2, False: 0]
  ------------------
  168|      2|#  endif
  169|      2|    {
  170|      2|        ft.adler32_copy = &adler32_copy_sse42;
  171|      2|    }
  172|      2|#endif
  173|       |    // X86 - PCLMUL
  174|      2|#if defined(X86_PCLMULQDQ_CRC) && !defined(X86_VPCLMULQDQ_NATIVE)
  175|      2|#  ifndef X86_PCLMULQDQ_NATIVE
  176|      2|    if (cf.x86.has_pclmulqdq)
  ------------------
  |  Branch (176:9): [True: 2, False: 0]
  ------------------
  177|      2|#  endif
  178|      2|    {
  179|      2|        ft.crc32 = &crc32_pclmulqdq;
  180|      2|        ft.crc32_copy = &crc32_copy_pclmulqdq;
  181|      2|    }
  182|      2|#endif
  183|       |    // X86 - AVX2
  184|      2|#ifdef X86_AVX2
  185|       |    /* BMI2 support is all but implicit with AVX2 but let's sanity check this just in case. Enabling BMI2 allows for
  186|       |     * flagless shifts, resulting in fewer flag stalls for the pipeline, and allows us to set destination registers
  187|       |     * for the shift results as an operand, eliminating several register-register moves when the original value needs
  188|       |     * to remain intact. They also allow for a count operand that isn't the CL register, avoiding contention there */
  189|      2|#  ifndef X86_AVX2_NATIVE
  190|      2|    if (cf.x86.has_avx2 && cf.x86.has_bmi2)
  ------------------
  |  Branch (190:9): [True: 2, False: 0]
  |  Branch (190:28): [True: 2, False: 0]
  ------------------
  191|      2|#  endif
  192|      2|    {
  193|      2|#  ifndef X86_AVX512_NATIVE
  194|      2|        ft.adler32 = &adler32_avx2;
  195|      2|        ft.adler32_copy = &adler32_copy_avx2;
  196|      2|        ft.chunkmemset_safe = &chunkmemset_safe_avx2;
  197|      2|        ft.compare256 = &compare256_avx2;
  198|      2|        ft.inflate_fast = &inflate_fast_avx2;
  199|      2|        ft.inflate_fast_safe = &inflate_fast_safe_avx2;
  200|      2|        ft.longest_match = &longest_match_avx2;
  201|      2|        ft.longest_match_slow_knuth = &longest_match_slow_knuth_avx2;
  202|      2|        ft.longest_match_slow_roll = &longest_match_slow_roll_avx2;
  203|      2|#  endif
  204|      2|        ft.slide_hash = &slide_hash_avx2;
  205|      2|        ft.slide_hash_head = &slide_hash_head_avx2;
  206|      2|    }
  207|      2|#endif
  208|      2|#ifdef X86_AVX2VNNI
  209|      2|    if (cf.x86.has_avx2vnni) {
  ------------------
  |  Branch (209:9): [True: 0, False: 2]
  ------------------
  210|      0|        ft.adler32 = &adler32_avx2_vnni;
  211|       |        //ft.adler32_copy = &adler32_copy_avx2_vnni;
  212|      0|    }
  213|      2|#endif
  214|       |    // X86 - AVX512 (F,DQ,BW,Vl)
  215|      2|#ifdef X86_AVX512
  216|      2|#  ifndef X86_AVX512_NATIVE
  217|      2|    if (cf.x86.has_avx512_common)
  ------------------
  |  Branch (217:9): [True: 0, False: 2]
  ------------------
  218|      0|#  endif
  219|      0|    {
  220|      0|#  ifndef X86_AVX512VNNI_NATIVE
  221|      0|        ft.adler32 = &adler32_avx512;
  222|      0|        ft.adler32_copy = &adler32_copy_avx512;
  223|      0|#  endif
  224|      0|        ft.chunkmemset_safe = &chunkmemset_safe_avx512;
  225|      0|        ft.compare256 = &compare256_avx512;
  226|      0|        ft.inflate_fast = &inflate_fast_avx512;
  227|      0|        ft.inflate_fast_safe = &inflate_fast_safe_avx512;
  228|      0|        ft.longest_match = &longest_match_avx512;
  229|      0|        ft.longest_match_slow_knuth = &longest_match_slow_knuth_avx512;
  230|      0|        ft.longest_match_slow_roll = &longest_match_slow_roll_avx512;
  231|      0|    }
  232|      2|#endif
  233|      2|#ifdef X86_AVX512VNNI
  234|      2|#  ifndef X86_AVX512VNNI_NATIVE
  235|      2|    if (cf.x86.has_avx512vnni)
  ------------------
  |  Branch (235:9): [True: 0, False: 2]
  ------------------
  236|      0|#  endif
  237|      0|    {
  238|      0|        ft.adler32 = &adler32_avx512_vnni;
  239|      0|        ft.adler32_copy = &adler32_copy_avx512_vnni;
  240|      0|    }
  241|      2|#endif
  242|       |    // X86 - VPCLMULQDQ (AVX2)
  243|      2|#ifdef X86_VPCLMULQDQ_AVX2
  244|      2|#  ifndef X86_VPCLMULQDQ_AVX2_NATIVE
  245|      2|    if (cf.x86.has_pclmulqdq && cf.x86.has_avx2 && cf.x86.has_vpclmulqdq)
  ------------------
  |  Branch (245:9): [True: 2, False: 0]
  |  Branch (245:33): [True: 2, False: 0]
  |  Branch (245:52): [True: 0, False: 2]
  ------------------
  246|      0|#  endif
  247|      0|    {
  248|      0|        ft.crc32 = &crc32_vpclmulqdq_avx2;
  249|      0|        ft.crc32_copy = &crc32_copy_vpclmulqdq_avx2;
  250|      0|    }
  251|      2|#endif
  252|       |    // X86 - VPCLMULQDQ (AVX-512)
  253|      2|#ifdef X86_VPCLMULQDQ_AVX512
  254|      2|#  ifndef X86_VPCLMULQDQ_AVX512_NATIVE
  255|      2|    if (cf.x86.has_pclmulqdq && cf.x86.has_avx512_common && cf.x86.has_vpclmulqdq)
  ------------------
  |  Branch (255:9): [True: 2, False: 0]
  |  Branch (255:33): [True: 0, False: 2]
  |  Branch (255:61): [True: 0, False: 0]
  ------------------
  256|      0|#  endif
  257|      0|    {
  258|      0|        ft.crc32 = &crc32_vpclmulqdq_avx512;
  259|      0|        ft.crc32_copy = &crc32_copy_vpclmulqdq_avx512;
  260|      0|    }
  261|      2|#endif
  262|       |
  263|       |
  264|       |    // ARM - SIMD
  265|       |#if defined(ARM_SIMD) && !defined(ARM_NEON_NATIVE)
  266|       |#  ifndef ARM_SIMD_NATIVE
  267|       |    if (cf.arm.has_simd)
  268|       |#  endif
  269|       |    {
  270|       |        ft.slide_hash = &slide_hash_armv6;
  271|       |        ft.slide_hash_head = &slide_hash_head_armv6;
  272|       |    }
  273|       |#endif
  274|       |    // ARM - NEON
  275|       |#ifdef ARM_NEON
  276|       |#  ifndef ARM_NEON_NATIVE
  277|       |    if (cf.arm.has_neon)
  278|       |#  endif
  279|       |    {
  280|       |        ft.adler32 = &adler32_neon;
  281|       |        ft.adler32_copy = &adler32_copy_neon;
  282|       |        ft.chunkmemset_safe = &chunkmemset_safe_neon;
  283|       |        ft.compare256 = &compare256_neon;
  284|       |        ft.inflate_fast = &inflate_fast_neon;
  285|       |        ft.inflate_fast_safe = &inflate_fast_safe_neon;
  286|       |        ft.longest_match = &longest_match_neon;
  287|       |        ft.longest_match_slow_knuth = &longest_match_slow_knuth_neon;
  288|       |        ft.longest_match_slow_roll = &longest_match_slow_roll_neon;
  289|       |        ft.slide_hash = &slide_hash_neon;
  290|       |        ft.slide_hash_head = &slide_hash_head_neon;
  291|       |    }
  292|       |#endif
  293|       |    // ARM - NEON DotProd
  294|       |#ifdef ARM_NEON_DOTPROD
  295|       |#  ifndef ARM_NEON_DOTPROD_NATIVE
  296|       |    if (cf.arm.has_neon && cf.arm.has_dotprod)
  297|       |#  endif
  298|       |    {
  299|       |        ft.adler32 = &adler32_neon_dotprod;
  300|       |        ft.adler32_copy = &adler32_copy_neon_dotprod;
  301|       |    }
  302|       |#endif
  303|       |    // ARM - CRC32
  304|       |#if defined(ARM_CRC32) && !defined(ARM_PMULL_EOR3_NATIVE)
  305|       |#  ifndef ARM_CRC32_NATIVE
  306|       |    if (cf.arm.has_crc32)
  307|       |#  endif
  308|       |    {
  309|       |        ft.crc32 = &crc32_armv8;
  310|       |        ft.crc32_copy = &crc32_copy_armv8;
  311|       |    }
  312|       |#endif
  313|       |    // ARM - PMULL EOR3
  314|       |#ifdef ARM_PMULL_EOR3
  315|       |#  ifndef ARM_PMULL_EOR3_NATIVE
  316|       |    if (cf.arm.has_crc32 && cf.arm.has_pmull && cf.arm.has_eor3 && cf.arm.has_fast_pmull)
  317|       |#  endif
  318|       |    {
  319|       |        ft.crc32 = &crc32_armv8_pmull_eor3;
  320|       |        ft.crc32_copy = &crc32_copy_armv8_pmull_eor3;
  321|       |    }
  322|       |#endif
  323|       |
  324|       |
  325|       |    // MIPS - MSA
  326|       |#ifdef MIPS_MSA
  327|       |#  ifndef MIPS_MSA_NATIVE
  328|       |    if (cf.mips.has_msa)
  329|       |#  endif
  330|       |    {
  331|       |        ft.adler32 = &adler32_msa;
  332|       |        ft.adler32_copy = &adler32_copy_msa;
  333|       |        ft.slide_hash = &slide_hash_msa;
  334|       |    }
  335|       |#endif
  336|       |
  337|       |
  338|       |    // Power - VMX
  339|       |#ifdef PPC_VMX
  340|       |#  ifndef PPC_VMX_NATIVE
  341|       |    if (cf.power.has_altivec)
  342|       |#  endif
  343|       |    {
  344|       |        ft.adler32 = &adler32_vmx;
  345|       |        ft.adler32_copy = &adler32_copy_vmx;
  346|       |        ft.slide_hash = &slide_hash_vmx;
  347|       |        ft.slide_hash_head = &slide_hash_head_vmx;
  348|       |    }
  349|       |#endif
  350|       |    // Power8 - VSX
  351|       |#ifdef POWER8_VSX
  352|       |#  ifndef POWER8_VSX_NATIVE
  353|       |    if (cf.power.has_arch_2_07)
  354|       |#  endif
  355|       |    {
  356|       |        ft.adler32 = &adler32_power8;
  357|       |        ft.adler32_copy = &adler32_copy_power8;
  358|       |        ft.chunkmemset_safe = &chunkmemset_safe_power8;
  359|       |        ft.inflate_fast = &inflate_fast_power8;
  360|       |        ft.inflate_fast_safe = &inflate_fast_safe_power8;
  361|       |        ft.slide_hash = &slide_hash_power8;
  362|       |        ft.slide_hash_head = &slide_hash_head_power8;
  363|       |    }
  364|       |#endif
  365|       |#ifdef POWER8_VSX_CRC32
  366|       |#  ifndef POWER8_VSX_CRC32_NATIVE
  367|       |    if (cf.power.has_arch_2_07)
  368|       |#  endif
  369|       |    {
  370|       |        ft.crc32 = &crc32_power8;
  371|       |        ft.crc32_copy = &crc32_copy_power8;
  372|       |    }
  373|       |#endif
  374|       |    // Power9
  375|       |#ifdef POWER9
  376|       |#  ifndef POWER9_NATIVE
  377|       |    if (cf.power.has_arch_3_00)
  378|       |#  endif
  379|       |    {
  380|       |        ft.compare256 = &compare256_power9;
  381|       |        ft.longest_match = &longest_match_power9;
  382|       |        ft.longest_match_slow_knuth = &longest_match_slow_knuth_power9;
  383|       |        ft.longest_match_slow_roll = &longest_match_slow_roll_power9;
  384|       |    }
  385|       |#endif
  386|       |
  387|       |
  388|       |    // RISCV - RVV
  389|       |#ifdef RISCV_RVV
  390|       |#  ifndef RISCV_RVV_NATIVE
  391|       |    if (cf.riscv.has_rvv)
  392|       |#  endif
  393|       |    {
  394|       |        ft.adler32 = &adler32_rvv;
  395|       |        ft.adler32_copy = &adler32_copy_rvv;
  396|       |        ft.chunkmemset_safe = &chunkmemset_safe_rvv;
  397|       |        ft.compare256 = &compare256_rvv;
  398|       |        ft.inflate_fast = &inflate_fast_rvv;
  399|       |        ft.inflate_fast_safe = &inflate_fast_safe_rvv;
  400|       |        ft.longest_match = &longest_match_rvv;
  401|       |        ft.longest_match_slow_knuth = &longest_match_slow_knuth_rvv;
  402|       |        ft.longest_match_slow_roll = &longest_match_slow_roll_rvv;
  403|       |        ft.slide_hash = &slide_hash_rvv;
  404|       |        ft.slide_hash_head = &slide_hash_head_rvv;
  405|       |    }
  406|       |#endif
  407|       |
  408|       |    // RISCV - ZBC
  409|       |#ifdef RISCV_CRC32_ZBC
  410|       |#  ifndef RISCV_ZBC_NATIVE
  411|       |    if (cf.riscv.has_zbc)
  412|       |#  endif
  413|       |    {
  414|       |        ft.crc32 = &crc32_riscv64_zbc;
  415|       |        ft.crc32_copy = &crc32_copy_riscv64_zbc;
  416|       |    }
  417|       |#endif
  418|       |
  419|       |    // S390
  420|       |#ifdef S390_VX
  421|       |#  ifndef S390_VX_NATIVE
  422|       |    if (cf.s390.has_vx)
  423|       |#  endif
  424|       |    {
  425|       |        ft.crc32 = &crc32_s390_vx;
  426|       |        ft.crc32_copy = &crc32_copy_s390_vx;
  427|       |        ft.slide_hash = &slide_hash_vx;
  428|       |        ft.slide_hash_head = &slide_hash_head_vx;
  429|       |    }
  430|       |#endif
  431|       |
  432|       |    // LOONGARCH
  433|       |#ifdef LOONGARCH_CRC
  434|       |#  ifndef LOONGARCH_CRC_NATIVE
  435|       |    if (cf.loongarch.has_crc)
  436|       |#  endif
  437|       |    {
  438|       |        ft.crc32 = &crc32_loongarch64;
  439|       |        ft.crc32_copy = &crc32_copy_loongarch64;
  440|       |    }
  441|       |#endif
  442|       |#if defined(LOONGARCH_LSX) && !defined(LOONGARCH_LASX_NATIVE)
  443|       |#  ifndef LOONGARCH_LSX_NATIVE
  444|       |    if (cf.loongarch.has_lsx)
  445|       |#  endif
  446|       |    {
  447|       |        ft.adler32 = &adler32_lsx;
  448|       |        ft.adler32_copy = &adler32_copy_lsx;
  449|       |        ft.chunkmemset_safe = &chunkmemset_safe_lsx;
  450|       |        ft.compare256 = &compare256_lsx;
  451|       |        ft.inflate_fast = &inflate_fast_lsx;
  452|       |        ft.inflate_fast_safe = &inflate_fast_safe_lsx;
  453|       |        ft.longest_match = &longest_match_lsx;
  454|       |        ft.longest_match_slow_knuth = &longest_match_slow_knuth_lsx;
  455|       |        ft.longest_match_slow_roll = &longest_match_slow_roll_lsx;
  456|       |        ft.slide_hash = &slide_hash_lsx;
  457|       |        ft.slide_hash_head = &slide_hash_head_lsx;
  458|       |    }
  459|       |#endif
  460|       |#ifdef LOONGARCH_LASX
  461|       |#  ifndef LOONGARCH_LASX_NATIVE
  462|       |    if (cf.loongarch.has_lasx)
  463|       |#  endif
  464|       |    {
  465|       |        ft.adler32 = &adler32_lasx;
  466|       |        ft.adler32_copy = &adler32_copy_lasx;
  467|       |        ft.chunkmemset_safe = &chunkmemset_safe_lasx;
  468|       |        ft.compare256 = &compare256_lasx;
  469|       |        ft.inflate_fast = &inflate_fast_lasx;
  470|       |        ft.inflate_fast_safe = &inflate_fast_safe_lasx;
  471|       |        ft.longest_match = &longest_match_lasx;
  472|       |        ft.longest_match_slow_knuth = &longest_match_slow_knuth_lasx;
  473|       |        ft.longest_match_slow_roll = &longest_match_slow_roll_lasx;
  474|       |        ft.slide_hash = &slide_hash_lasx;
  475|       |        ft.slide_hash_head = &slide_hash_head_lasx;
  476|       |    }
  477|       |#endif
  478|       |
  479|      2|#endif // WITH_OPTIM
  480|       |
  481|       |    // Assign function pointers individually for atomic operation
  482|      2|    FUNCTABLE_ASSIGN(ft, force_init);
  ------------------
  |  |   20|      2|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  ------------------
  483|      2|    FUNCTABLE_VERIFY_ASSIGN(ft, adler32);
  ------------------
  |  |   46|      2|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      2|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      2|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  484|      2|    FUNCTABLE_VERIFY_ASSIGN(ft, adler32_copy);
  ------------------
  |  |   46|      2|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      2|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      2|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  485|      2|    FUNCTABLE_VERIFY_ASSIGN(ft, chunkmemset_safe);
  ------------------
  |  |   46|      2|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      2|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      2|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  486|      2|    FUNCTABLE_VERIFY_ASSIGN(ft, compare256);
  ------------------
  |  |   46|      2|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      2|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      2|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  487|      2|    FUNCTABLE_VERIFY_ASSIGN(ft, crc32);
  ------------------
  |  |   46|      2|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      2|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      2|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  488|      2|    FUNCTABLE_VERIFY_ASSIGN(ft, crc32_copy);
  ------------------
  |  |   46|      2|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      2|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      2|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  489|      2|    FUNCTABLE_VERIFY_ASSIGN(ft, inflate_fast);
  ------------------
  |  |   46|      2|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      2|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      2|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  490|      2|    FUNCTABLE_VERIFY_ASSIGN(ft, inflate_fast_safe);
  ------------------
  |  |   46|      2|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      2|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      2|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  491|      2|    FUNCTABLE_VERIFY_ASSIGN(ft, longest_match);
  ------------------
  |  |   46|      2|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      2|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      2|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  492|      2|    FUNCTABLE_VERIFY_ASSIGN(ft, longest_match_slow_knuth);
  ------------------
  |  |   46|      2|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      2|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      2|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  493|      2|    FUNCTABLE_VERIFY_ASSIGN(ft, longest_match_slow_roll);
  ------------------
  |  |   46|      2|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      2|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      2|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  494|      2|    FUNCTABLE_VERIFY_ASSIGN(ft, slide_hash);
  ------------------
  |  |   46|      2|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      2|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      2|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  495|      2|    FUNCTABLE_VERIFY_ASSIGN(ft, slide_hash_head);
  ------------------
  |  |   46|      2|    if (!VAR.FUNC_NAME) { \
  |  |  ------------------
  |  |  |  Branch (46:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   47|      0|        fprintf(stderr, "Zlib-ng functable failed initialization!\n"); \
  |  |   48|      0|        return 1; \
  |  |   49|      0|    } \
  |  |   50|      2|    FUNCTABLE_ASSIGN(VAR, FUNC_NAME);
  |  |  ------------------
  |  |  |  |   20|      2|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  |  |  ------------------
  ------------------
  496|       |
  497|       |    // Memory barrier for weak memory order CPUs
  498|      2|    FUNCTABLE_BARRIER();
  ------------------
  |  |   21|      2|#  define FUNCTABLE_BARRIER() __atomic_thread_fence(__ATOMIC_SEQ_CST)
  ------------------
  499|       |
  500|      2|    return Z_OK;
  ------------------
  |  |  180|      2|#define Z_OK            0
  ------------------
  501|      2|}
functable.c:force_init_empty:
   63|  7.10k|static int force_init_empty(void) {
   64|  7.10k|    return 0;
   65|  7.10k|}

zng_inflateResetKeep:
   63|  3.55k|int32_t Z_EXPORT PREFIX(inflateResetKeep)(PREFIX3(stream) *strm) {
   64|  3.55k|    struct inflate_state *state;
   65|       |
   66|  3.55k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (66:9): [True: 0, False: 3.55k]
  ------------------
   67|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
   68|  3.55k|    state = (struct inflate_state *)strm->state;
   69|  3.55k|    strm->total_in = strm->total_out = state->total = 0;
   70|  3.55k|    strm->msg = NULL;
   71|  3.55k|    strm->data_type = 0;
   72|  3.55k|    if (state->wrap)        /* to support ill-conceived Java test suite */
  ------------------
  |  Branch (72:9): [True: 3.55k, False: 0]
  ------------------
   73|  3.55k|        strm->adler = state->wrap & 1;
   74|  3.55k|    state->mode = HEAD;
   75|  3.55k|    state->check = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   70|  3.55k|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
   76|  3.55k|    state->last = 0;
   77|  3.55k|    state->havedict = 0;
   78|  3.55k|    state->flags = -1;
   79|  3.55k|    state->head = NULL;
   80|  3.55k|    state->hold = 0;
   81|  3.55k|    state->bits = 0;
   82|  3.55k|    state->lencode = state->distcode = state->next = state->codes;
   83|  3.55k|    state->back = -1;
   84|       |#ifdef INFLATE_STRICT
   85|       |    state->dmax = 32768U;
   86|       |#endif
   87|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
   88|       |    state->sane = 1;
   89|       |#endif
   90|  3.55k|    INFLATE_RESET_KEEP_HOOK(strm);  /* hook for IBM Z DFLTCC */
  ------------------
  |  |   28|  3.55k|#  define INFLATE_RESET_KEEP_HOOK(strm) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (28:54): [Folded, False: 3.55k]
  |  |  ------------------
  ------------------
   91|  3.55k|    Tracev((stderr, "inflate: reset\n"));
   92|  3.55k|    return Z_OK;
  ------------------
  |  |  180|  3.55k|#define Z_OK            0
  ------------------
   93|  3.55k|}
zng_inflateReset:
   95|  3.55k|int32_t Z_EXPORT PREFIX(inflateReset)(PREFIX3(stream) *strm) {
   96|  3.55k|    struct inflate_state *state;
   97|       |
   98|  3.55k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (98:9): [True: 0, False: 3.55k]
  ------------------
   99|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  100|  3.55k|    state = (struct inflate_state *)strm->state;
  101|  3.55k|    state->wsize = 0;
  102|  3.55k|    state->whave = 0;
  103|  3.55k|    state->wnext = 0;
  104|  3.55k|    return PREFIX(inflateResetKeep)(strm);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
  105|  3.55k|}
zng_inflateReset2:
  107|  3.55k|int32_t Z_EXPORT PREFIX(inflateReset2)(PREFIX3(stream) *strm, int32_t windowBits) {
  108|  3.55k|    int wrap;
  109|  3.55k|    struct inflate_state *state;
  110|       |
  111|       |    /* get the state */
  112|  3.55k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (112:9): [True: 0, False: 3.55k]
  ------------------
  113|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  114|  3.55k|    state = (struct inflate_state *)strm->state;
  115|       |
  116|       |    /* extract wrap request from windowBits parameter */
  117|  3.55k|    if (windowBits < 0) {
  ------------------
  |  Branch (117:9): [True: 0, False: 3.55k]
  ------------------
  118|      0|        wrap = 0;
  119|      0|        if (windowBits < -MAX_WBITS)
  ------------------
  |  |   40|      0|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (119:13): [True: 0, False: 0]
  ------------------
  120|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  121|      0|        windowBits = -windowBits;
  122|  3.55k|    } else {
  123|  3.55k|        wrap = (windowBits >> 4) + 5;
  124|  3.55k|#ifdef GUNZIP
  125|  3.55k|        if (windowBits < 48)
  ------------------
  |  Branch (125:13): [True: 3.55k, False: 0]
  ------------------
  126|  3.55k|            windowBits &= MAX_WBITS;
  ------------------
  |  |   40|  3.55k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  127|  3.55k|#endif
  128|  3.55k|    }
  129|       |
  130|       |    /* set number of window bits */
  131|  3.55k|    if (windowBits && (windowBits < MIN_WBITS || windowBits > MAX_WBITS))
  ------------------
  |  |   37|  7.10k|#  define MIN_WBITS   8  /* 256 LZ77 window */
  ------------------
                  if (windowBits && (windowBits < MIN_WBITS || windowBits > MAX_WBITS))
  ------------------
  |  |   40|  3.55k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (131:9): [True: 3.55k, False: 0]
  |  Branch (131:24): [True: 0, False: 3.55k]
  |  Branch (131:50): [True: 0, False: 3.55k]
  ------------------
  132|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  133|       |
  134|       |    /* update state and reset the rest of it */
  135|  3.55k|    state->wrap = wrap;
  136|  3.55k|    state->wbits = (unsigned)windowBits;
  137|  3.55k|    return PREFIX(inflateReset)(strm);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
  138|  3.55k|}
alloc_inflate:
  155|  3.55k|Z_INTERNAL inflate_allocs* alloc_inflate(PREFIX3(stream) *strm) {
  156|  3.55k|    int curr_size = 0;
  157|       |
  158|       |    /* Define sizes */
  159|  3.55k|    int window_size = INFLATE_ADJUST_WINDOW_SIZE((1 << MAX_WBITS) + 64); /* 64B padding for chunksize */
  ------------------
  |  |   26|  3.55k|#  define INFLATE_ADJUST_WINDOW_SIZE(n) (n)
  ------------------
  160|  3.55k|    int state_size = sizeof(inflate_state);
  161|  3.55k|    int alloc_size = sizeof(inflate_allocs);
  162|       |
  163|       |    /* Calculate relative buffer positions and paddings */
  164|  3.55k|    LOGSZP("window", window_size, PAD_WINDOW(curr_size), PADSZ(curr_size,WINDOW_PAD_SIZE));
  165|  3.55k|    int window_pos = PAD_WINDOW(curr_size);
  ------------------
  |  |  475|  3.55k|#  define PAD_WINDOW            PAD_64
  |  |  ------------------
  |  |  |  |  301|  3.55k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  |  |  ------------------
  |  |  |  |  |  |  299|  3.55k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  166|  3.55k|    curr_size = window_pos + window_size;
  167|       |
  168|  3.55k|    LOGSZP("state", state_size, PAD_64(curr_size), PADSZ(curr_size,64));
  169|  3.55k|    int state_pos = PAD_64(curr_size);
  ------------------
  |  |  301|  3.55k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  299|  3.55k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  170|  3.55k|    curr_size = state_pos + state_size;
  171|       |
  172|  3.55k|    LOGSZP("alloc", alloc_size, PAD_16(curr_size), PADSZ(curr_size,16));
  173|  3.55k|    int alloc_pos = PAD_16(curr_size);
  ------------------
  |  |  300|  3.55k|#define PAD_16(bpos) ((bpos) + PADSZ((bpos),16))
  |  |  ------------------
  |  |  |  |  299|  3.55k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  174|  3.55k|    curr_size = alloc_pos + alloc_size;
  175|       |
  176|       |    /* Add 64-1 or 4096-1 to allow window alignment, and round size of buffer up to multiple of 64 */
  177|  3.55k|    int total_size = PAD_64(curr_size + (WINDOW_PAD_SIZE - 1));
  ------------------
  |  |  301|  3.55k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  299|  3.55k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  178|       |
  179|       |    /* Allocate buffer, align to 64-byte cacheline, and zerofill the resulting buffer */
  180|  3.55k|    char *original_buf = (char *)strm->zalloc(strm->opaque, 1, total_size);
  181|  3.55k|    if (original_buf == NULL)
  ------------------
  |  Branch (181:9): [True: 0, False: 3.55k]
  ------------------
  182|      0|        return NULL;
  183|       |
  184|  3.55k|    char *buff = (char *)HINT_ALIGNED_WINDOW((char *)PAD_WINDOW(original_buf));
  ------------------
  |  |  477|  3.55k|#  define HINT_ALIGNED_WINDOW   HINT_ALIGNED_64
  |  |  ------------------
  |  |  |  |  280|  3.55k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  275|  3.55k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  185|  3.55k|    LOGSZPL("Buffer alloc", total_size, PADSZ((uintptr_t)original_buf,WINDOW_PAD_SIZE), PADSZ(curr_size,WINDOW_PAD_SIZE));
  186|       |
  187|       |    /* Initialize alloc_bufs */
  188|  3.55k|    inflate_allocs *alloc_bufs  = (struct inflate_allocs_s *)(buff + alloc_pos);
  189|  3.55k|    alloc_bufs->buf_start = original_buf;
  190|  3.55k|    alloc_bufs->zfree = strm->zfree;
  191|       |
  192|  3.55k|    alloc_bufs->window =  (unsigned char *)HINT_ALIGNED_WINDOW((buff + window_pos));
  ------------------
  |  |  477|  3.55k|#  define HINT_ALIGNED_WINDOW   HINT_ALIGNED_64
  |  |  ------------------
  |  |  |  |  280|  3.55k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  275|  3.55k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  193|  3.55k|    alloc_bufs->state = (inflate_state *)HINT_ALIGNED_64((buff + state_pos));
  ------------------
  |  |  280|  3.55k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  ------------------
  |  |  |  |  275|  3.55k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  ------------------
  ------------------
  194|       |
  195|       |#ifdef Z_MEMORY_SANITIZER
  196|       |    /* This is _not_ to subvert the memory sanitizer but to instead unposion some
  197|       |       data we willingly and purposefully load uninitialized into vector registers
  198|       |       in order to safely read the last < chunksize bytes of the window. */
  199|       |    __msan_unpoison(alloc_bufs->window + window_size, 64);
  200|       |#endif
  201|       |
  202|  3.55k|    return alloc_bufs;
  203|  3.55k|}
free_inflate:
  208|  3.55k|Z_INTERNAL void free_inflate(PREFIX3(stream) *strm) {
  209|  3.55k|    struct inflate_state *state = (struct inflate_state *)strm->state;
  210|       |
  211|  3.55k|    if (state->alloc_bufs != NULL) {
  ------------------
  |  Branch (211:9): [True: 3.55k, False: 0]
  ------------------
  212|  3.55k|        inflate_allocs *alloc_bufs = state->alloc_bufs;
  213|  3.55k|        alloc_bufs->zfree(strm->opaque, alloc_bufs->buf_start);
  214|       |        strm->state = NULL;
  215|  3.55k|    }
  216|  3.55k|}
zng_inflateInit2:
  222|  3.55k|int32_t ZNG_CONDEXPORT PREFIX(inflateInit2)(PREFIX3(stream) *strm, int32_t windowBits) {
  223|  3.55k|    struct inflate_state *state;
  224|  3.55k|    int32_t ret;
  225|       |
  226|       |    /* Initialize functable */
  227|  3.55k|    FUNCTABLE_INIT;
  ------------------
  |  |   47|  3.55k|#  define FUNCTABLE_INIT if (functable.force_init()) {return Z_VERSION_ERROR;}
  |  |  ------------------
  |  |  |  |  188|      0|#define Z_VERSION_ERROR (-6)
  |  |  ------------------
  |  |  |  Branch (47:30): [True: 0, False: 3.55k]
  |  |  ------------------
  ------------------
  228|       |
  229|  3.55k|    if (strm == NULL)
  ------------------
  |  Branch (229:9): [True: 0, False: 3.55k]
  ------------------
  230|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  231|  3.55k|    strm->msg = NULL;                   /* in case we return an error */
  232|  3.55k|    if (strm->zalloc == NULL) {
  ------------------
  |  Branch (232:9): [True: 3.55k, False: 0]
  ------------------
  233|  3.55k|        strm->zalloc = PREFIX(zcalloc);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
  234|  3.55k|        strm->opaque = NULL;
  235|  3.55k|    }
  236|  3.55k|    if (strm->zfree == NULL)
  ------------------
  |  Branch (236:9): [True: 3.55k, False: 0]
  ------------------
  237|  3.55k|        strm->zfree = PREFIX(zcfree);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
  238|       |
  239|  3.55k|    inflate_allocs *alloc_bufs = alloc_inflate(strm);
  240|  3.55k|    if (alloc_bufs == NULL)
  ------------------
  |  Branch (240:9): [True: 0, False: 3.55k]
  ------------------
  241|      0|        return Z_MEM_ERROR;
  ------------------
  |  |  186|      0|#define Z_MEM_ERROR    (-4)
  ------------------
  242|       |
  243|  3.55k|    state = alloc_bufs->state;
  244|  3.55k|    state->window = alloc_bufs->window;
  245|  3.55k|    state->alloc_bufs = alloc_bufs;
  246|  3.55k|    state->wbufsize = INFLATE_ADJUST_WINDOW_SIZE((1 << MAX_WBITS) + 64);
  ------------------
  |  |   26|  3.55k|#  define INFLATE_ADJUST_WINDOW_SIZE(n) (n)
  ------------------
  247|  3.55k|    Tracev((stderr, "inflate: allocated\n"));
  248|       |
  249|  3.55k|    strm->state = (struct internal_state *)state;
  250|  3.55k|    state->strm = strm;
  251|  3.55k|    state->mode = HEAD;     /* to pass state test in inflateReset2() */
  252|  3.55k|    ret = PREFIX(inflateReset2)(strm, windowBits);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
  253|  3.55k|    if (ret != Z_OK) {
  ------------------
  |  |  180|  3.55k|#define Z_OK            0
  ------------------
  |  Branch (253:9): [True: 0, False: 3.55k]
  ------------------
  254|      0|        free_inflate(strm);
  255|      0|    }
  256|  3.55k|    return ret;
  257|  3.55k|}
zng_inflateInit:
  260|  3.55k|int32_t Z_EXPORT PREFIX(inflateInit)(PREFIX3(stream) *strm) {
  261|  3.55k|    return PREFIX(inflateInit2)(strm, DEF_WBITS);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
                  return PREFIX(inflateInit2)(strm, DEF_WBITS);
  ------------------
  |  |   37|  3.55k|#  define DEF_WBITS MAX_WBITS
  |  |  ------------------
  |  |  |  |   40|  3.55k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  |  |  ------------------
  ------------------
  262|  3.55k|}
zng_fixedtables:
  306|  1.84k|void Z_INTERNAL PREFIX(fixedtables)(struct inflate_state *state) {
  307|  1.84k|    state->lencode = lenfix;
  308|  1.84k|    state->lenbits = 9;
  309|  1.84k|    state->distcode = distfix;
  310|  1.84k|    state->distbits = 5;
  311|  1.84k|}
zng_inflate:
  478|   171M|int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) {
  479|   171M|    struct inflate_state *state;
  480|   171M|    const unsigned char *next;  /* next input */
  481|   171M|    unsigned char *put;         /* next output */
  482|   171M|    unsigned char *from;        /* where to copy match bytes from */
  483|   171M|    unsigned have, left;        /* available input and output */
  484|   171M|    uint64_t hold;              /* bit buffer */
  485|   171M|    bits_t bits;                /* bits in bit buffer */
  486|   171M|    uint32_t in, out;           /* save starting available input and output */
  487|   171M|    unsigned copy;              /* number of stored or match bytes to copy */
  488|   171M|    code here;                  /* current decoding table entry */
  489|   171M|    code last;                  /* parent table entry */
  490|   171M|    unsigned len;               /* length to copy for repeats, bits to drop */
  491|   171M|    unsigned code_bits;         /* bits in current/parent code */
  492|   171M|    int32_t ret;                /* return code */
  493|   171M|    static const uint16_t order[19] = /* permutation of code lengths */
  494|   171M|        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
  495|       |
  496|   171M|    if (inflateStateCheck(strm) || strm->next_out == NULL ||
  ------------------
  |  Branch (496:9): [True: 0, False: 171M]
  |  Branch (496:36): [True: 0, False: 171M]
  ------------------
  497|   171M|        (strm->next_in == NULL && strm->avail_in != 0))
  ------------------
  |  Branch (497:10): [True: 0, False: 171M]
  |  Branch (497:35): [True: 0, False: 0]
  ------------------
  498|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  499|       |
  500|   171M|    state = (struct inflate_state *)strm->state;
  501|   171M|    if (state->mode == TYPE)      /* skip check */
  ------------------
  |  Branch (501:9): [True: 7.22k, False: 171M]
  ------------------
  502|  7.22k|        state->mode = TYPEDO;
  503|   171M|    LOAD();
  ------------------
  |  |   83|   171M|    do { \
  |  |   84|   171M|        put = strm->next_out; \
  |  |   85|   171M|        left = strm->avail_out; \
  |  |   86|   171M|        next = strm->next_in; \
  |  |   87|   171M|        have = strm->avail_in; \
  |  |   88|   171M|        hold = state->hold; \
  |  |   89|   171M|        bits = (bits_t)state->bits; \
  |  |   90|   171M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (90:14): [Folded, False: 171M]
  |  |  ------------------
  ------------------
  504|   171M|    in = have;
  505|   171M|    out = left;
  506|   171M|    ret = Z_OK;
  ------------------
  |  |  180|   171M|#define Z_OK            0
  ------------------
  507|   171M|    for (;;)
  508|   447M|        switch (state->mode) {
  509|  7.10k|        case HEAD:
  ------------------
  |  Branch (509:9): [True: 7.10k, False: 447M]
  ------------------
  510|  7.10k|            if (state->wrap == 0) {
  ------------------
  |  Branch (510:17): [True: 0, False: 7.10k]
  ------------------
  511|      0|                state->mode = TYPEDO;
  512|      0|                break;
  513|      0|            }
  514|  7.10k|            NEEDBITS(16);
  ------------------
  |  |  120|  7.10k|    do { \
  |  |  121|  7.10k|        unsigned u = (unsigned)(n); \
  |  |  122|  14.2k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 10.6k, False: 3.55k]
  |  |  ------------------
  |  |  123|  10.6k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|  10.6k|    do { \
  |  |  |  |  390|  10.6k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 3.55k, False: 7.10k]
  |  |  |  |  ------------------
  |  |  |  |  391|  10.6k|        have--; \
  |  |  |  |  392|  7.10k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|  7.10k|        bits += 8; \
  |  |  |  |  394|  7.10k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 7.10k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  7.10k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 3.55k]
  |  |  ------------------
  ------------------
  515|  3.55k|#ifdef GUNZIP
  516|  3.55k|            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
  ------------------
  |  Branch (516:17): [True: 0, False: 3.55k]
  |  Branch (516:38): [True: 0, False: 0]
  ------------------
  517|      0|                if (state->wbits == 0)
  ------------------
  |  Branch (517:21): [True: 0, False: 0]
  ------------------
  518|      0|                    state->wbits = MAX_WBITS;
  ------------------
  |  |   40|      0|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  519|      0|                state->check = CRC32_INITIAL_VALUE;
  ------------------
  |  |   71|      0|#define CRC32_INITIAL_VALUE   0 /* initial crc-32 hash value */
  ------------------
  520|      0|                CRC2(state->check, hold);
  ------------------
  |  |   56|      0|    do { \
  |  |   57|      0|        uint32_t crc = ~(uint32_t)(check); \
  |  |   58|      0|        CRC_DO1_B(crc, (word)     ); \
  |  |  ------------------
  |  |  |  |   53|      0|#  define CRC_DO1_B(c, b)    c = crc_table[(c ^ (b)) & 0xff] ^ (c >> 8)
  |  |  ------------------
  |  |   59|      0|        CRC_DO1_B(crc, (word) >> 8); \
  |  |  ------------------
  |  |  |  |   53|      0|#  define CRC_DO1_B(c, b)    c = crc_table[(c ^ (b)) & 0xff] ^ (c >> 8)
  |  |  ------------------
  |  |   60|      0|        (check) = ~crc; \
  |  |   61|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (61:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  521|      0|                INITBITS();
  ------------------
  |  |  112|      0|    do { \
  |  |  113|      0|        hold = 0; \
  |  |  114|      0|        bits = 0; \
  |  |  115|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (115:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  522|      0|                state->mode = FLAGS;
  523|      0|                break;
  524|      0|            }
  525|  3.55k|            if (state->head != NULL)
  ------------------
  |  Branch (525:17): [True: 0, False: 3.55k]
  ------------------
  526|      0|                state->head->done = -1;
  527|  3.55k|            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
  ------------------
  |  Branch (527:17): [True: 0, False: 3.55k]
  ------------------
  528|       |#else
  529|       |            if (
  530|       |#endif
  531|  3.55k|                ((BITS(8) << 8) + (hold >> 8)) % 31) {
  ------------------
  |  |  128|  3.55k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  |  Branch (531:17): [True: 0, False: 3.55k]
  ------------------
  532|      0|                SET_BAD("incorrect header check");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  533|      0|                break;
  534|      0|            }
  535|  3.55k|            if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  128|  3.55k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
                          if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  212|  3.55k|#define Z_DEFLATED   8
  ------------------
  |  Branch (535:17): [True: 0, False: 3.55k]
  ------------------
  536|      0|                SET_BAD("unknown compression method");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  537|      0|                break;
  538|      0|            }
  539|  3.55k|            DROPBITS(4);
  ------------------
  |  |  132|  3.55k|    do { \
  |  |  133|  3.55k|        unsigned u = (unsigned)(n); \
  |  |  134|  3.55k|        hold >>= u; \
  |  |  135|  3.55k|        bits -= (bits_t)u; \
  |  |  136|  3.55k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 3.55k]
  |  |  ------------------
  ------------------
  540|  3.55k|            len = BITS(4) + 8;
  ------------------
  |  |  128|  3.55k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  541|  3.55k|            if (state->wbits == 0)
  ------------------
  |  Branch (541:17): [True: 0, False: 3.55k]
  ------------------
  542|      0|                state->wbits = len;
  543|  3.55k|            if (len > MAX_WBITS || len > state->wbits) {
  ------------------
  |  |   40|  7.10k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (543:17): [True: 0, False: 3.55k]
  |  Branch (543:36): [True: 0, False: 3.55k]
  ------------------
  544|      0|                SET_BAD("invalid window size");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  545|      0|                break;
  546|      0|            }
  547|       |#ifdef INFLATE_STRICT
  548|       |            state->dmax = 1U << len;
  549|       |#endif
  550|  3.55k|            state->flags = 0;               /* indicate zlib header */
  551|  3.55k|            Tracev((stderr, "inflate:   zlib header ok\n"));
  552|  3.55k|            strm->adler = state->check = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   70|  3.55k|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
  553|  3.55k|            state->mode = hold & 0x200 ? DICTID : TYPE;
  ------------------
  |  Branch (553:27): [True: 0, False: 3.55k]
  ------------------
  554|  3.55k|            INITBITS();
  ------------------
  |  |  112|  3.55k|    do { \
  |  |  113|  3.55k|        hold = 0; \
  |  |  114|  3.55k|        bits = 0; \
  |  |  115|  3.55k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (115:14): [Folded, False: 3.55k]
  |  |  ------------------
  ------------------
  555|  3.55k|            break;
  556|      0|#ifdef GUNZIP
  557|       |
  558|      0|        case FLAGS:
  ------------------
  |  Branch (558:9): [True: 0, False: 447M]
  ------------------
  559|      0|            NEEDBITS(16);
  ------------------
  |  |  120|      0|    do { \
  |  |  121|      0|        unsigned u = (unsigned)(n); \
  |  |  122|      0|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  123|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|      0|    do { \
  |  |  |  |  390|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  391|      0|        have--; \
  |  |  |  |  392|      0|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|      0|        bits += 8; \
  |  |  |  |  394|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  560|      0|            state->flags = (int)(hold);
  561|      0|            if ((state->flags & 0xff) != Z_DEFLATED) {
  ------------------
  |  |  212|      0|#define Z_DEFLATED   8
  ------------------
  |  Branch (561:17): [True: 0, False: 0]
  ------------------
  562|      0|                SET_BAD("unknown compression method");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  563|      0|                break;
  564|      0|            }
  565|      0|            if (state->flags & 0xe000) {
  ------------------
  |  Branch (565:17): [True: 0, False: 0]
  ------------------
  566|      0|                SET_BAD("unknown header flags set");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  567|      0|                break;
  568|      0|            }
  569|      0|            if (state->head != NULL)
  ------------------
  |  Branch (569:17): [True: 0, False: 0]
  ------------------
  570|      0|                state->head->text = (int)((hold >> 8) & 1);
  571|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (571:17): [True: 0, False: 0]
  |  Branch (571:44): [True: 0, False: 0]
  ------------------
  572|      0|                CRC2(state->check, hold);
  ------------------
  |  |   56|      0|    do { \
  |  |   57|      0|        uint32_t crc = ~(uint32_t)(check); \
  |  |   58|      0|        CRC_DO1_B(crc, (word)     ); \
  |  |  ------------------
  |  |  |  |   53|      0|#  define CRC_DO1_B(c, b)    c = crc_table[(c ^ (b)) & 0xff] ^ (c >> 8)
  |  |  ------------------
  |  |   59|      0|        CRC_DO1_B(crc, (word) >> 8); \
  |  |  ------------------
  |  |  |  |   53|      0|#  define CRC_DO1_B(c, b)    c = crc_table[(c ^ (b)) & 0xff] ^ (c >> 8)
  |  |  ------------------
  |  |   60|      0|        (check) = ~crc; \
  |  |   61|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (61:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  573|      0|            INITBITS();
  ------------------
  |  |  112|      0|    do { \
  |  |  113|      0|        hold = 0; \
  |  |  114|      0|        bits = 0; \
  |  |  115|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (115:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  574|      0|            state->mode = TIME;
  575|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   54|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  576|       |
  577|      0|        case TIME:
  ------------------
  |  Branch (577:9): [True: 0, False: 447M]
  ------------------
  578|      0|            NEEDBITS(32);
  ------------------
  |  |  120|      0|    do { \
  |  |  121|      0|        unsigned u = (unsigned)(n); \
  |  |  122|      0|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  123|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|      0|    do { \
  |  |  |  |  390|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  391|      0|        have--; \
  |  |  |  |  392|      0|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|      0|        bits += 8; \
  |  |  |  |  394|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  579|      0|            if (state->head != NULL)
  ------------------
  |  Branch (579:17): [True: 0, False: 0]
  ------------------
  580|      0|                state->head->time = (unsigned)(hold);
  581|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (581:17): [True: 0, False: 0]
  |  Branch (581:44): [True: 0, False: 0]
  ------------------
  582|      0|                CRC4(state->check, hold);
  ------------------
  |  |   64|      0|    do { \
  |  |   65|      0|        uint32_t crc = ~(uint32_t)(check); \
  |  |   66|      0|        CRC_DO1_B(crc, (word)      ); \
  |  |  ------------------
  |  |  |  |   53|      0|#  define CRC_DO1_B(c, b)    c = crc_table[(c ^ (b)) & 0xff] ^ (c >> 8)
  |  |  ------------------
  |  |   67|      0|        CRC_DO1_B(crc, (word) >>  8); \
  |  |  ------------------
  |  |  |  |   53|      0|#  define CRC_DO1_B(c, b)    c = crc_table[(c ^ (b)) & 0xff] ^ (c >> 8)
  |  |  ------------------
  |  |   68|      0|        CRC_DO1_B(crc, (word) >> 16); \
  |  |  ------------------
  |  |  |  |   53|      0|#  define CRC_DO1_B(c, b)    c = crc_table[(c ^ (b)) & 0xff] ^ (c >> 8)
  |  |  ------------------
  |  |   69|      0|        CRC_DO1_B(crc, (word) >> 24); \
  |  |  ------------------
  |  |  |  |   53|      0|#  define CRC_DO1_B(c, b)    c = crc_table[(c ^ (b)) & 0xff] ^ (c >> 8)
  |  |  ------------------
  |  |   70|      0|        (check) = ~crc; \
  |  |   71|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (71:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  583|      0|            INITBITS();
  ------------------
  |  |  112|      0|    do { \
  |  |  113|      0|        hold = 0; \
  |  |  114|      0|        bits = 0; \
  |  |  115|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (115:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  584|      0|            state->mode = OS;
  585|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   54|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  586|       |
  587|      0|        case OS:
  ------------------
  |  Branch (587:9): [True: 0, False: 447M]
  ------------------
  588|      0|            NEEDBITS(16);
  ------------------
  |  |  120|      0|    do { \
  |  |  121|      0|        unsigned u = (unsigned)(n); \
  |  |  122|      0|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  123|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|      0|    do { \
  |  |  |  |  390|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  391|      0|        have--; \
  |  |  |  |  392|      0|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|      0|        bits += 8; \
  |  |  |  |  394|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  589|      0|            if (state->head != NULL) {
  ------------------
  |  Branch (589:17): [True: 0, False: 0]
  ------------------
  590|      0|                state->head->xflags = (int)(hold & 0xff);
  591|      0|                state->head->os = (int)(hold >> 8);
  592|      0|            }
  593|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (593:17): [True: 0, False: 0]
  |  Branch (593:44): [True: 0, False: 0]
  ------------------
  594|      0|                CRC2(state->check, hold);
  ------------------
  |  |   56|      0|    do { \
  |  |   57|      0|        uint32_t crc = ~(uint32_t)(check); \
  |  |   58|      0|        CRC_DO1_B(crc, (word)     ); \
  |  |  ------------------
  |  |  |  |   53|      0|#  define CRC_DO1_B(c, b)    c = crc_table[(c ^ (b)) & 0xff] ^ (c >> 8)
  |  |  ------------------
  |  |   59|      0|        CRC_DO1_B(crc, (word) >> 8); \
  |  |  ------------------
  |  |  |  |   53|      0|#  define CRC_DO1_B(c, b)    c = crc_table[(c ^ (b)) & 0xff] ^ (c >> 8)
  |  |  ------------------
  |  |   60|      0|        (check) = ~crc; \
  |  |   61|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (61:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  595|      0|            INITBITS();
  ------------------
  |  |  112|      0|    do { \
  |  |  113|      0|        hold = 0; \
  |  |  114|      0|        bits = 0; \
  |  |  115|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (115:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  596|      0|            state->mode = EXLEN;
  597|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   54|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  598|       |
  599|      0|        case EXLEN:
  ------------------
  |  Branch (599:9): [True: 0, False: 447M]
  ------------------
  600|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (600:17): [True: 0, False: 0]
  ------------------
  601|      0|                NEEDBITS(16);
  ------------------
  |  |  120|      0|    do { \
  |  |  121|      0|        unsigned u = (unsigned)(n); \
  |  |  122|      0|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  123|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|      0|    do { \
  |  |  |  |  390|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  391|      0|        have--; \
  |  |  |  |  392|      0|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|      0|        bits += 8; \
  |  |  |  |  394|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  602|      0|                state->length = (uint16_t)hold;
  603|      0|                if (state->head != NULL)
  ------------------
  |  Branch (603:21): [True: 0, False: 0]
  ------------------
  604|      0|                    state->head->extra_len = (uint16_t)hold;
  605|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (605:21): [True: 0, False: 0]
  |  Branch (605:48): [True: 0, False: 0]
  ------------------
  606|      0|                    CRC2(state->check, hold);
  ------------------
  |  |   56|      0|    do { \
  |  |   57|      0|        uint32_t crc = ~(uint32_t)(check); \
  |  |   58|      0|        CRC_DO1_B(crc, (word)     ); \
  |  |  ------------------
  |  |  |  |   53|      0|#  define CRC_DO1_B(c, b)    c = crc_table[(c ^ (b)) & 0xff] ^ (c >> 8)
  |  |  ------------------
  |  |   59|      0|        CRC_DO1_B(crc, (word) >> 8); \
  |  |  ------------------
  |  |  |  |   53|      0|#  define CRC_DO1_B(c, b)    c = crc_table[(c ^ (b)) & 0xff] ^ (c >> 8)
  |  |  ------------------
  |  |   60|      0|        (check) = ~crc; \
  |  |   61|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (61:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  607|      0|                INITBITS();
  ------------------
  |  |  112|      0|    do { \
  |  |  113|      0|        hold = 0; \
  |  |  114|      0|        bits = 0; \
  |  |  115|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (115:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  608|      0|            } else if (state->head != NULL) {
  ------------------
  |  Branch (608:24): [True: 0, False: 0]
  ------------------
  609|      0|                state->head->extra = NULL;
  610|      0|            }
  611|      0|            state->mode = EXTRA;
  612|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   54|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  613|       |
  614|      0|        case EXTRA:
  ------------------
  |  Branch (614:9): [True: 0, False: 447M]
  ------------------
  615|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (615:17): [True: 0, False: 0]
  ------------------
  616|      0|                copy = state->length;
  617|      0|                if (copy > have)
  ------------------
  |  Branch (617:21): [True: 0, False: 0]
  ------------------
  618|      0|                    copy = have;
  619|      0|                if (copy) {
  ------------------
  |  Branch (619:21): [True: 0, False: 0]
  ------------------
  620|      0|                    if (state->head != NULL && state->head->extra != NULL) {
  ------------------
  |  Branch (620:25): [True: 0, False: 0]
  |  Branch (620:48): [True: 0, False: 0]
  ------------------
  621|      0|                        len = state->head->extra_len - state->length;
  622|      0|                        if (len < state->head->extra_max) {
  ------------------
  |  Branch (622:29): [True: 0, False: 0]
  ------------------
  623|      0|                            memcpy(state->head->extra + len, next,
  624|      0|                                    len + copy > state->head->extra_max ?
  ------------------
  |  Branch (624:37): [True: 0, False: 0]
  ------------------
  625|      0|                                    state->head->extra_max - len : copy);
  626|      0|                        }
  627|      0|                    }
  628|      0|                    if ((state->flags & 0x0200) && (state->wrap & 4)) {
  ------------------
  |  Branch (628:25): [True: 0, False: 0]
  |  Branch (628:52): [True: 0, False: 0]
  ------------------
  629|      0|                        state->check = crc32_small((uint32_t)state->check, next, copy);
  630|      0|                    }
  631|      0|                    have -= copy;
  632|      0|                    next += copy;
  633|      0|                    state->length -= copy;
  634|      0|                }
  635|      0|                if (state->length)
  ------------------
  |  Branch (635:21): [True: 0, False: 0]
  ------------------
  636|      0|                    goto inf_leave;
  637|      0|            }
  638|      0|            state->length = 0;
  639|      0|            state->mode = NAME;
  640|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   54|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  641|       |
  642|      0|        case NAME:
  ------------------
  |  Branch (642:9): [True: 0, False: 447M]
  ------------------
  643|      0|            if (state->flags & 0x0800) {
  ------------------
  |  Branch (643:17): [True: 0, False: 0]
  ------------------
  644|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (644:21): [True: 0, False: 0]
  ------------------
  645|      0|                copy = 0;
  646|      0|                do {
  647|      0|                    len = (unsigned)(next[copy++]);
  648|      0|                    if (state->head != NULL && state->head->name != NULL && state->length < state->head->name_max)
  ------------------
  |  Branch (648:25): [True: 0, False: 0]
  |  Branch (648:48): [True: 0, False: 0]
  |  Branch (648:77): [True: 0, False: 0]
  ------------------
  649|      0|                        state->head->name[state->length++] = (unsigned char)len;
  650|      0|                } while (len && copy < have);
  ------------------
  |  Branch (650:26): [True: 0, False: 0]
  |  Branch (650:33): [True: 0, False: 0]
  ------------------
  651|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (651:21): [True: 0, False: 0]
  |  Branch (651:48): [True: 0, False: 0]
  ------------------
  652|      0|                    state->check = crc32_small((uint32_t)state->check, next, copy);
  653|      0|                have -= copy;
  654|      0|                next += copy;
  655|      0|                if (len)
  ------------------
  |  Branch (655:21): [True: 0, False: 0]
  ------------------
  656|      0|                    goto inf_leave;
  657|      0|            } else if (state->head != NULL) {
  ------------------
  |  Branch (657:24): [True: 0, False: 0]
  ------------------
  658|      0|                state->head->name = NULL;
  659|      0|            }
  660|      0|            state->length = 0;
  661|      0|            state->mode = COMMENT;
  662|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   54|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  663|       |
  664|      0|        case COMMENT:
  ------------------
  |  Branch (664:9): [True: 0, False: 447M]
  ------------------
  665|      0|            if (state->flags & 0x1000) {
  ------------------
  |  Branch (665:17): [True: 0, False: 0]
  ------------------
  666|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (666:21): [True: 0, False: 0]
  ------------------
  667|      0|                copy = 0;
  668|      0|                do {
  669|      0|                    len = (unsigned)(next[copy++]);
  670|      0|                    if (state->head != NULL && state->head->comment != NULL
  ------------------
  |  Branch (670:25): [True: 0, False: 0]
  |  Branch (670:48): [True: 0, False: 0]
  ------------------
  671|      0|                        && state->length < state->head->comm_max)
  ------------------
  |  Branch (671:28): [True: 0, False: 0]
  ------------------
  672|      0|                        state->head->comment[state->length++] = (unsigned char)len;
  673|      0|                } while (len && copy < have);
  ------------------
  |  Branch (673:26): [True: 0, False: 0]
  |  Branch (673:33): [True: 0, False: 0]
  ------------------
  674|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (674:21): [True: 0, False: 0]
  |  Branch (674:48): [True: 0, False: 0]
  ------------------
  675|      0|                    state->check = crc32_small((uint32_t)state->check, next, copy);
  676|      0|                have -= copy;
  677|      0|                next += copy;
  678|      0|                if (len)
  ------------------
  |  Branch (678:21): [True: 0, False: 0]
  ------------------
  679|      0|                    goto inf_leave;
  680|      0|            } else if (state->head != NULL) {
  ------------------
  |  Branch (680:24): [True: 0, False: 0]
  ------------------
  681|      0|                state->head->comment = NULL;
  682|      0|            }
  683|      0|            state->mode = HCRC;
  684|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   54|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  685|       |
  686|      0|        case HCRC:
  ------------------
  |  Branch (686:9): [True: 0, False: 447M]
  ------------------
  687|      0|            if (state->flags & 0x0200) {
  ------------------
  |  Branch (687:17): [True: 0, False: 0]
  ------------------
  688|      0|                NEEDBITS(16);
  ------------------
  |  |  120|      0|    do { \
  |  |  121|      0|        unsigned u = (unsigned)(n); \
  |  |  122|      0|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  123|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|      0|    do { \
  |  |  |  |  390|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  391|      0|        have--; \
  |  |  |  |  392|      0|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|      0|        bits += 8; \
  |  |  |  |  394|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  689|      0|                if ((state->wrap & 4) && hold != (state->check & 0xffff)) {
  ------------------
  |  Branch (689:21): [True: 0, False: 0]
  |  Branch (689:42): [True: 0, False: 0]
  ------------------
  690|      0|                    SET_BAD("header crc mismatch");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  691|      0|                    break;
  692|      0|                }
  693|      0|                INITBITS();
  ------------------
  |  |  112|      0|    do { \
  |  |  113|      0|        hold = 0; \
  |  |  114|      0|        bits = 0; \
  |  |  115|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (115:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  694|      0|            }
  695|      0|            if (state->head != NULL) {
  ------------------
  |  Branch (695:17): [True: 0, False: 0]
  ------------------
  696|      0|                state->head->hcrc = (int)((state->flags >> 9) & 1);
  697|      0|                state->head->done = 1;
  698|      0|            }
  699|       |            /* compute crc32 checksum if not in raw mode */
  700|      0|            if ((state->wrap & 4) && state->flags)
  ------------------
  |  Branch (700:17): [True: 0, False: 0]
  |  Branch (700:38): [True: 0, False: 0]
  ------------------
  701|      0|                strm->adler = state->check = CRC32_INITIAL_VALUE;
  ------------------
  |  |   71|      0|#define CRC32_INITIAL_VALUE   0 /* initial crc-32 hash value */
  ------------------
  702|      0|            state->mode = TYPE;
  703|      0|            break;
  704|      0|#endif
  705|      0|        case DICTID:
  ------------------
  |  Branch (705:9): [True: 0, False: 447M]
  ------------------
  706|      0|            NEEDBITS(32);
  ------------------
  |  |  120|      0|    do { \
  |  |  121|      0|        unsigned u = (unsigned)(n); \
  |  |  122|      0|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  123|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|      0|    do { \
  |  |  |  |  390|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  391|      0|        have--; \
  |  |  |  |  392|      0|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|      0|        bits += 8; \
  |  |  |  |  394|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  707|      0|            strm->adler = state->check = ZSWAP32((unsigned)hold);
  ------------------
  |  |  214|      0|#  define ZSWAP32(q) __builtin_bswap32(q)
  ------------------
  708|      0|            INITBITS();
  ------------------
  |  |  112|      0|    do { \
  |  |  113|      0|        hold = 0; \
  |  |  114|      0|        bits = 0; \
  |  |  115|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (115:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  709|      0|            state->mode = DICT;
  710|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   54|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  711|       |
  712|      0|        case DICT:
  ------------------
  |  Branch (712:9): [True: 0, False: 447M]
  ------------------
  713|      0|            if (state->havedict == 0) {
  ------------------
  |  Branch (713:17): [True: 0, False: 0]
  ------------------
  714|      0|                RESTORE();
  ------------------
  |  |   94|      0|    do { \
  |  |   95|      0|        strm->next_out = put; \
  |  |   96|      0|        strm->avail_out = left; \
  |  |   97|      0|        strm->next_in = (z_const unsigned char *)next; \
  |  |   98|      0|        strm->avail_in = have; \
  |  |   99|      0|        state->hold = hold; \
  |  |  100|      0|        state->bits = bits; \
  |  |  101|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (101:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  715|      0|                return Z_NEED_DICT;
  ------------------
  |  |  182|      0|#define Z_NEED_DICT     2
  ------------------
  716|      0|            }
  717|      0|            strm->adler = state->check = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   70|      0|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
  718|      0|            state->mode = TYPE;
  719|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   54|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  720|       |
  721|  13.9k|        case TYPE:
  ------------------
  |  Branch (721:9): [True: 13.9k, False: 447M]
  ------------------
  722|  13.9k|            if (flush == Z_BLOCK || flush == Z_TREES)
  ------------------
  |  |  176|  27.8k|#define Z_BLOCK         5
  ------------------
                          if (flush == Z_BLOCK || flush == Z_TREES)
  ------------------
  |  |  177|  13.9k|#define Z_TREES         6
  ------------------
  |  Branch (722:17): [True: 0, False: 13.9k]
  |  Branch (722:37): [True: 0, False: 13.9k]
  ------------------
  723|      0|                goto inf_leave;
  724|  13.9k|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  13.9k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  725|       |
  726|  21.1k|        case TYPEDO:
  ------------------
  |  Branch (726:9): [True: 7.22k, False: 447M]
  ------------------
  727|       |            /* determine and dispatch block type */
  728|  21.1k|            INFLATE_TYPEDO_HOOK(strm, flush);  /* hook for IBM Z DFLTCC */
  ------------------
  |  |   32|  21.1k|#  define INFLATE_TYPEDO_HOOK(strm, flush) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (32:57): [Folded, False: 21.1k]
  |  |  ------------------
  ------------------
  729|  21.1k|            if (state->last) {
  ------------------
  |  Branch (729:17): [True: 2.69k, False: 18.4k]
  ------------------
  730|  2.69k|                BYTEBITS();
  ------------------
  |  |  140|  2.69k|    do { \
  |  |  141|  2.69k|        hold >>= bits & 7; \
  |  |  142|  2.69k|        bits -= bits & 7; \
  |  |  143|  2.69k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (143:14): [Folded, False: 2.69k]
  |  |  ------------------
  ------------------
  731|  2.69k|                state->mode = CHECK;
  732|  2.69k|                break;
  733|  2.69k|            }
  734|  18.4k|            NEEDBITS(3);
  ------------------
  |  |  120|  18.4k|    do { \
  |  |  121|  18.4k|        unsigned u = (unsigned)(n); \
  |  |  122|  25.6k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 14.4k, False: 11.2k]
  |  |  ------------------
  |  |  123|  18.4k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|  14.4k|    do { \
  |  |  |  |  390|  14.4k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 7.24k, False: 7.22k]
  |  |  |  |  ------------------
  |  |  |  |  391|  14.4k|        have--; \
  |  |  |  |  392|  7.22k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|  7.22k|        bits += 8; \
  |  |  |  |  394|  7.22k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 7.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  18.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 11.2k]
  |  |  ------------------
  ------------------
  735|  11.2k|            state->last = BITS(1);
  ------------------
  |  |  128|  11.2k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  736|  11.2k|            DROPBITS(1);
  ------------------
  |  |  132|  11.2k|    do { \
  |  |  133|  11.2k|        unsigned u = (unsigned)(n); \
  |  |  134|  11.2k|        hold >>= u; \
  |  |  135|  11.2k|        bits -= (bits_t)u; \
  |  |  136|  11.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 11.2k]
  |  |  ------------------
  ------------------
  737|  11.2k|            switch (BITS(2)) {
  ------------------
  |  |  128|  11.2k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  738|  1.57k|            case 0:                             /* stored block */
  ------------------
  |  Branch (738:13): [True: 1.57k, False: 9.64k]
  ------------------
  739|  1.57k|                Tracev((stderr, "inflate:     stored block%s\n", state->last ? " (last)" : ""));
  740|  1.57k|                state->mode = STORED;
  741|  1.57k|                break;
  742|  1.84k|            case 1:                             /* fixed block */
  ------------------
  |  Branch (742:13): [True: 1.84k, False: 9.37k]
  ------------------
  743|  1.84k|                PREFIX(fixedtables)(state);
  ------------------
  |  |  121|  1.84k|#  define PREFIX(x) zng_ ## x
  ------------------
  744|  1.84k|                Tracev((stderr, "inflate:     fixed codes block%s\n", state->last ? " (last)" : ""));
  745|  1.84k|                state->mode = LEN_;             /* decode codes */
  746|  1.84k|                if (flush == Z_TREES) {
  ------------------
  |  |  177|  1.84k|#define Z_TREES         6
  ------------------
  |  Branch (746:21): [True: 0, False: 1.84k]
  ------------------
  747|      0|                    DROPBITS(2);
  ------------------
  |  |  132|      0|    do { \
  |  |  133|      0|        unsigned u = (unsigned)(n); \
  |  |  134|      0|        hold >>= u; \
  |  |  135|      0|        bits -= (bits_t)u; \
  |  |  136|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  748|      0|                    goto inf_leave;
  749|      0|                }
  750|  1.84k|                break;
  751|  7.79k|            case 2:                             /* dynamic block */
  ------------------
  |  Branch (751:13): [True: 7.79k, False: 3.41k]
  ------------------
  752|  7.79k|                Tracev((stderr, "inflate:     dynamic codes block%s\n", state->last ? " (last)" : ""));
  753|  7.79k|                state->mode = TABLE;
  754|  7.79k|                break;
  755|      0|            default:
  ------------------
  |  Branch (755:13): [True: 0, False: 11.2k]
  ------------------
  756|      0|                SET_BAD("invalid block type");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  757|  11.2k|            }
  758|  11.2k|            DROPBITS(2);
  ------------------
  |  |  132|  11.2k|    do { \
  |  |  133|  11.2k|        unsigned u = (unsigned)(n); \
  |  |  134|  11.2k|        hold >>= u; \
  |  |  135|  11.2k|        bits -= (bits_t)u; \
  |  |  136|  11.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 11.2k]
  |  |  ------------------
  ------------------
  759|  11.2k|            break;
  760|       |
  761|  7.85k|        case STORED:
  ------------------
  |  Branch (761:9): [True: 7.85k, False: 447M]
  ------------------
  762|       |            /* get and verify stored block length */
  763|  7.85k|            BYTEBITS();                         /* go to byte boundary */
  ------------------
  |  |  140|  7.85k|    do { \
  |  |  141|  7.85k|        hold >>= bits & 7; \
  |  |  142|  7.85k|        bits -= bits & 7; \
  |  |  143|  7.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (143:14): [Folded, False: 7.85k]
  |  |  ------------------
  ------------------
  764|  7.85k|            NEEDBITS(32);
  ------------------
  |  |  120|  7.85k|    do { \
  |  |  121|  7.85k|        unsigned u = (unsigned)(n); \
  |  |  122|  14.1k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 12.5k, False: 1.57k]
  |  |  ------------------
  |  |  123|  12.5k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|  12.5k|    do { \
  |  |  |  |  390|  12.5k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 6.28k, False: 6.28k]
  |  |  |  |  ------------------
  |  |  |  |  391|  12.5k|        have--; \
  |  |  |  |  392|  6.28k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|  6.28k|        bits += 8; \
  |  |  |  |  394|  6.28k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 6.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  7.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 1.57k]
  |  |  ------------------
  ------------------
  765|  1.57k|            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
  ------------------
  |  Branch (765:17): [True: 0, False: 1.57k]
  ------------------
  766|      0|                SET_BAD("invalid stored block lengths");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  767|      0|                break;
  768|      0|            }
  769|  1.57k|            state->length = (uint16_t)hold;
  770|  1.57k|            Tracev((stderr, "inflate:       stored length %u\n", state->length));
  771|  1.57k|            INITBITS();
  ------------------
  |  |  112|  1.57k|    do { \
  |  |  113|  1.57k|        hold = 0; \
  |  |  114|  1.57k|        bits = 0; \
  |  |  115|  1.57k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (115:14): [Folded, False: 1.57k]
  |  |  ------------------
  ------------------
  772|  1.57k|            state->mode = COPY_;
  773|  1.57k|            if (flush == Z_TREES)
  ------------------
  |  |  177|  1.57k|#define Z_TREES         6
  ------------------
  |  Branch (773:17): [True: 0, False: 1.57k]
  ------------------
  774|      0|                goto inf_leave;
  775|  1.57k|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  1.57k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  776|       |
  777|  1.57k|        case COPY_:
  ------------------
  |  Branch (777:9): [True: 0, False: 447M]
  ------------------
  778|  1.57k|            state->mode = COPY;
  779|  1.57k|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  1.57k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  780|       |
  781|  43.6M|        case COPY:
  ------------------
  |  Branch (781:9): [True: 43.6M, False: 403M]
  ------------------
  782|       |            /* copy stored block from input to output */
  783|  43.6M|            copy = state->length;
  784|  43.6M|            if (copy) {
  ------------------
  |  Branch (784:17): [True: 43.6M, False: 1.57k]
  ------------------
  785|  43.6M|                copy = MIN(copy, have);
  ------------------
  |  |  148|  43.6M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 43.6M, False: 1.57k]
  |  |  ------------------
  ------------------
  786|  43.6M|                copy = MIN(copy, left);
  ------------------
  |  |  148|  43.6M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 0, False: 43.6M]
  |  |  ------------------
  ------------------
  787|  43.6M|                if (copy == 0)
  ------------------
  |  Branch (787:21): [True: 21.8M, False: 21.8M]
  ------------------
  788|  21.8M|                    goto inf_leave;
  789|  21.8M|                memcpy(put, next, copy);
  790|  21.8M|                have -= copy;
  791|  21.8M|                next += copy;
  792|  21.8M|                left -= copy;
  793|  21.8M|                put += copy;
  794|  21.8M|                state->length -= copy;
  795|  21.8M|                break;
  796|  43.6M|            }
  797|  1.57k|            Tracev((stderr, "inflate:       stored end\n"));
  798|  1.57k|            state->mode = TYPE;
  799|  1.57k|            break;
  800|       |
  801|  21.8k|        case TABLE:
  ------------------
  |  Branch (801:9): [True: 21.8k, False: 447M]
  ------------------
  802|       |            /* get dynamic table entries descriptor */
  803|  21.8k|            NEEDBITS(14);
  ------------------
  |  |  120|  21.8k|    do { \
  |  |  121|  21.8k|        unsigned u = (unsigned)(n); \
  |  |  122|  35.9k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 28.1k, False: 7.79k]
  |  |  ------------------
  |  |  123|  28.1k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|  28.1k|    do { \
  |  |  |  |  390|  28.1k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 14.0k, False: 14.0k]
  |  |  |  |  ------------------
  |  |  |  |  391|  28.1k|        have--; \
  |  |  |  |  392|  14.0k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|  14.0k|        bits += 8; \
  |  |  |  |  394|  14.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 14.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  21.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 7.79k]
  |  |  ------------------
  ------------------
  804|  7.79k|            state->nlen = BITS(5) + 257;
  ------------------
  |  |  128|  7.79k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  805|  7.79k|            DROPBITS(5);
  ------------------
  |  |  132|  7.79k|    do { \
  |  |  133|  7.79k|        unsigned u = (unsigned)(n); \
  |  |  134|  7.79k|        hold >>= u; \
  |  |  135|  7.79k|        bits -= (bits_t)u; \
  |  |  136|  7.79k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 7.79k]
  |  |  ------------------
  ------------------
  806|  7.79k|            state->ndist = BITS(5) + 1;
  ------------------
  |  |  128|  7.79k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  807|  7.79k|            DROPBITS(5);
  ------------------
  |  |  132|  7.79k|    do { \
  |  |  133|  7.79k|        unsigned u = (unsigned)(n); \
  |  |  134|  7.79k|        hold >>= u; \
  |  |  135|  7.79k|        bits -= (bits_t)u; \
  |  |  136|  7.79k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 7.79k]
  |  |  ------------------
  ------------------
  808|  7.79k|            state->ncode = BITS(4) + 4;
  ------------------
  |  |  128|  7.79k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  809|  7.79k|            DROPBITS(4);
  ------------------
  |  |  132|  7.79k|    do { \
  |  |  133|  7.79k|        unsigned u = (unsigned)(n); \
  |  |  134|  7.79k|        hold >>= u; \
  |  |  135|  7.79k|        bits -= (bits_t)u; \
  |  |  136|  7.79k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 7.79k]
  |  |  ------------------
  ------------------
  810|  7.79k|#ifndef PKZIP_BUG_WORKAROUND
  811|  7.79k|            if (state->nlen > 286 || state->ndist > 30) {
  ------------------
  |  Branch (811:17): [True: 0, False: 7.79k]
  |  Branch (811:38): [True: 0, False: 7.79k]
  ------------------
  812|      0|                SET_BAD("too many length or distance symbols");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  813|      0|                break;
  814|      0|            }
  815|  7.79k|#endif
  816|  7.79k|            Tracev((stderr, "inflate:       table sizes ok\n"));
  817|  7.79k|            state->have = 0;
  818|  7.79k|            state->mode = LENLENS;
  819|  7.79k|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  7.79k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  820|       |
  821|  57.0k|        case LENLENS:
  ------------------
  |  Branch (821:9): [True: 49.2k, False: 447M]
  ------------------
  822|       |            /* get code length code lengths (not a typo) */
  823|   190k|            while (state->have < state->ncode) {
  ------------------
  |  Branch (823:20): [True: 182k, False: 7.79k]
  ------------------
  824|   182k|                NEEDBITS(3);
  ------------------
  |  |  120|   182k|    do { \
  |  |  121|   182k|        unsigned u = (unsigned)(n); \
  |  |  122|   231k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 98.4k, False: 133k]
  |  |  ------------------
  |  |  123|   182k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|  98.4k|    do { \
  |  |  |  |  390|  98.4k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 49.2k, False: 49.2k]
  |  |  |  |  ------------------
  |  |  |  |  391|  98.4k|        have--; \
  |  |  |  |  392|  49.2k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|  49.2k|        bits += 8; \
  |  |  |  |  394|  49.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 49.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|   182k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 133k]
  |  |  ------------------
  ------------------
  825|   133k|                state->lens[order[state->have++]] = (uint16_t)BITS(3);
  ------------------
  |  |  128|   133k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  826|   133k|                DROPBITS(3);
  ------------------
  |  |  132|   133k|    do { \
  |  |  133|   133k|        unsigned u = (unsigned)(n); \
  |  |  134|   133k|        hold >>= u; \
  |  |  135|   133k|        bits -= (bits_t)u; \
  |  |  136|   133k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 133k]
  |  |  ------------------
  ------------------
  827|   133k|            }
  828|  22.4k|            while (state->have < 19)
  ------------------
  |  Branch (828:20): [True: 14.6k, False: 7.79k]
  ------------------
  829|  14.6k|                state->lens[order[state->have++]] = 0;
  830|  7.79k|            state->next = state->codes;
  831|  7.79k|            state->lencode = state->distcode = (const code *)(state->next);
  832|  7.79k|            state->lenbits = 7;
  833|  7.79k|            ret = zng_inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work);
  834|  7.79k|            if (ret) {
  ------------------
  |  Branch (834:17): [True: 0, False: 7.79k]
  ------------------
  835|      0|                SET_BAD("invalid code lengths set");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  836|      0|                break;
  837|      0|            }
  838|  7.79k|            Tracev((stderr, "inflate:       code lengths ok\n"));
  839|  7.79k|            state->have = 0;
  840|  7.79k|            state->mode = CODELENS;
  841|  7.79k|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  7.79k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  842|       |
  843|   469k|        case CODELENS:
  ------------------
  |  Branch (843:9): [True: 461k, False: 446M]
  ------------------
  844|       |            /* get length and distance code code lengths */
  845|  1.63M|            while (state->have < state->nlen + state->ndist) {
  ------------------
  |  Branch (845:20): [True: 1.62M, False: 7.79k]
  ------------------
  846|  2.02M|                for (;;) {
  847|  2.02M|                    here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  128|  2.02M|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  848|  2.02M|                    if (here.bits <= bits) break;
  ------------------
  |  Branch (848:25): [True: 1.22M, False: 795k]
  ------------------
  849|   795k|                    PULLBYTE();
  ------------------
  |  |  389|   795k|    do { \
  |  |  390|   795k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (390:13): [True: 397k, False: 397k]
  |  |  ------------------
  |  |  391|   795k|        have--; \
  |  |  392|   397k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  393|   397k|        bits += 8; \
  |  |  394|   397k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (394:14): [Folded, False: 397k]
  |  |  ------------------
  ------------------
  850|   795k|                }
  851|  1.22M|                if (here.val < 16) {
  ------------------
  |  Branch (851:21): [True: 955k, False: 269k]
  ------------------
  852|   955k|                    DROPBITS(here.bits);
  ------------------
  |  |  132|   955k|    do { \
  |  |  133|   955k|        unsigned u = (unsigned)(n); \
  |  |  134|   955k|        hold >>= u; \
  |  |  135|   955k|        bits -= (bits_t)u; \
  |  |  136|   955k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 955k]
  |  |  ------------------
  ------------------
  853|   955k|                    state->lens[state->have++] = here.val;
  854|   955k|                } else {
  855|   269k|                    if (here.val == 16) {
  ------------------
  |  Branch (855:25): [True: 203k, False: 66.6k]
  ------------------
  856|   203k|                        NEEDBITS(here.bits + 2);
  ------------------
  |  |  120|   203k|    do { \
  |  |  121|   203k|        unsigned u = (unsigned)(n); \
  |  |  122|   244k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 81.5k, False: 162k]
  |  |  ------------------
  |  |  123|   203k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|  81.5k|    do { \
  |  |  |  |  390|  81.5k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 40.7k, False: 40.7k]
  |  |  |  |  ------------------
  |  |  |  |  391|  81.5k|        have--; \
  |  |  |  |  392|  40.7k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|  40.7k|        bits += 8; \
  |  |  |  |  394|  40.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 40.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|   203k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 162k]
  |  |  ------------------
  ------------------
  857|   162k|                        DROPBITS(here.bits);
  ------------------
  |  |  132|   162k|    do { \
  |  |  133|   162k|        unsigned u = (unsigned)(n); \
  |  |  134|   162k|        hold >>= u; \
  |  |  135|   162k|        bits -= (bits_t)u; \
  |  |  136|   162k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 162k]
  |  |  ------------------
  ------------------
  858|   162k|                        if (state->have == 0) {
  ------------------
  |  Branch (858:29): [True: 0, False: 162k]
  ------------------
  859|      0|                            SET_BAD("invalid bit length repeat");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  860|      0|                            break;
  861|      0|                        }
  862|   162k|                        len = state->lens[state->have - 1];
  863|   162k|                        copy = 3 + BITS(2);
  ------------------
  |  |  128|   162k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  864|   162k|                        DROPBITS(2);
  ------------------
  |  |  132|   162k|    do { \
  |  |  133|   162k|        unsigned u = (unsigned)(n); \
  |  |  134|   162k|        hold >>= u; \
  |  |  135|   162k|        bits -= (bits_t)u; \
  |  |  136|   162k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 162k]
  |  |  ------------------
  ------------------
  865|   162k|                    } else if (here.val == 17) {
  ------------------
  |  Branch (865:32): [True: 42.0k, False: 24.5k]
  ------------------
  866|  42.0k|                        NEEDBITS(here.bits + 3);
  ------------------
  |  |  120|  42.0k|    do { \
  |  |  121|  42.0k|        unsigned u = (unsigned)(n); \
  |  |  122|  53.6k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 23.0k, False: 30.5k]
  |  |  ------------------
  |  |  123|  42.0k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|  23.0k|    do { \
  |  |  |  |  390|  23.0k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 11.5k, False: 11.5k]
  |  |  |  |  ------------------
  |  |  |  |  391|  23.0k|        have--; \
  |  |  |  |  392|  11.5k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|  11.5k|        bits += 8; \
  |  |  |  |  394|  11.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 11.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  42.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 30.5k]
  |  |  ------------------
  ------------------
  867|  30.5k|                        DROPBITS(here.bits);
  ------------------
  |  |  132|  30.5k|    do { \
  |  |  133|  30.5k|        unsigned u = (unsigned)(n); \
  |  |  134|  30.5k|        hold >>= u; \
  |  |  135|  30.5k|        bits -= (bits_t)u; \
  |  |  136|  30.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 30.5k]
  |  |  ------------------
  ------------------
  868|  30.5k|                        len = 0;
  869|  30.5k|                        copy = 3 + BITS(3);
  ------------------
  |  |  128|  30.5k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  870|  30.5k|                        DROPBITS(3);
  ------------------
  |  |  132|  30.5k|    do { \
  |  |  133|  30.5k|        unsigned u = (unsigned)(n); \
  |  |  134|  30.5k|        hold >>= u; \
  |  |  135|  30.5k|        bits -= (bits_t)u; \
  |  |  136|  30.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 30.5k]
  |  |  ------------------
  ------------------
  871|  30.5k|                    } else {
  872|  24.5k|                        NEEDBITS(here.bits + 7);
  ------------------
  |  |  120|  24.5k|    do { \
  |  |  121|  24.5k|        unsigned u = (unsigned)(n); \
  |  |  122|  35.9k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 22.7k, False: 13.1k]
  |  |  ------------------
  |  |  123|  24.5k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|  22.7k|    do { \
  |  |  |  |  390|  22.7k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 11.3k, False: 11.3k]
  |  |  |  |  ------------------
  |  |  |  |  391|  22.7k|        have--; \
  |  |  |  |  392|  11.3k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|  11.3k|        bits += 8; \
  |  |  |  |  394|  11.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 11.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  24.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 13.1k]
  |  |  ------------------
  ------------------
  873|  13.1k|                        DROPBITS(here.bits);
  ------------------
  |  |  132|  13.1k|    do { \
  |  |  133|  13.1k|        unsigned u = (unsigned)(n); \
  |  |  134|  13.1k|        hold >>= u; \
  |  |  135|  13.1k|        bits -= (bits_t)u; \
  |  |  136|  13.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 13.1k]
  |  |  ------------------
  ------------------
  874|  13.1k|                        len = 0;
  875|  13.1k|                        copy = 11 + BITS(7);
  ------------------
  |  |  128|  13.1k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  876|  13.1k|                        DROPBITS(7);
  ------------------
  |  |  132|  13.1k|    do { \
  |  |  133|  13.1k|        unsigned u = (unsigned)(n); \
  |  |  134|  13.1k|        hold >>= u; \
  |  |  135|  13.1k|        bits -= (bits_t)u; \
  |  |  136|  13.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 13.1k]
  |  |  ------------------
  ------------------
  877|  13.1k|                    }
  878|   206k|                    if (state->have + copy > state->nlen + state->ndist) {
  ------------------
  |  Branch (878:25): [True: 0, False: 206k]
  ------------------
  879|      0|                        SET_BAD("invalid bit length repeat");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  880|      0|                        break;
  881|      0|                    }
  882|  1.55M|                    while (copy) {
  ------------------
  |  Branch (882:28): [True: 1.34M, False: 206k]
  ------------------
  883|  1.34M|                        --copy;
  884|  1.34M|                        state->lens[state->have++] = (uint16_t)len;
  885|  1.34M|                    }
  886|   206k|                }
  887|  1.22M|            }
  888|       |
  889|       |            /* handle error breaks in while */
  890|  7.79k|            if (state->mode == BAD)
  ------------------
  |  Branch (890:17): [True: 0, False: 7.79k]
  ------------------
  891|      0|                break;
  892|       |
  893|       |            /* check for end-of-block code (better have one) */
  894|  7.79k|            if (state->lens[256] == 0) {
  ------------------
  |  Branch (894:17): [True: 0, False: 7.79k]
  ------------------
  895|      0|                SET_BAD("invalid code -- missing end-of-block");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  896|      0|                break;
  897|      0|            }
  898|       |
  899|       |            /* build code tables -- note: do not change the lenbits or distbits
  900|       |               values here (MAX_LEN_ROOT_BITS and 9) without reading the comments
  901|       |               in inftrees.h concerning the ENOUGH constants, which depend on
  902|       |               those values, and the refill comments in inffast_tpl.h, which
  903|       |               depend on lenbits never exceeding MAX_LEN_ROOT_BITS */
  904|  7.79k|            state->next = state->codes;
  905|  7.79k|            state->lencode = (const code *)(state->next);
  906|  7.79k|            state->lenbits = MAX_LEN_ROOT_BITS;
  ------------------
  |  |   45|  7.79k|#define MAX_LEN_ROOT_BITS 10
  ------------------
  907|  7.79k|            ret = zng_inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work);
  908|  7.79k|            if (ret) {
  ------------------
  |  Branch (908:17): [True: 0, False: 7.79k]
  ------------------
  909|      0|                SET_BAD("invalid literal/lengths set");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  910|      0|                break;
  911|      0|            }
  912|  7.79k|            state->distcode = (const code *)(state->next);
  913|  7.79k|            state->distbits = 9;
  914|  7.79k|            ret = zng_inflate_table(DISTS, state->lens + state->nlen, state->ndist,
  915|  7.79k|                            &(state->next), &(state->distbits), state->work);
  916|  7.79k|            if (ret) {
  ------------------
  |  Branch (916:17): [True: 0, False: 7.79k]
  ------------------
  917|      0|                SET_BAD("invalid distances set");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  918|      0|                break;
  919|      0|            }
  920|  7.79k|            Tracev((stderr, "inflate:       codes ok\n"));
  921|  7.79k|            state->mode = LEN_;
  922|  7.79k|            if (flush == Z_TREES)
  ------------------
  |  |  177|  7.79k|#define Z_TREES         6
  ------------------
  |  Branch (922:17): [True: 0, False: 7.79k]
  ------------------
  923|      0|                goto inf_leave;
  924|  7.79k|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  7.79k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  925|       |
  926|  9.64k|        case LEN_:
  ------------------
  |  Branch (926:9): [True: 1.84k, False: 447M]
  ------------------
  927|  9.64k|            state->mode = LEN;
  928|  9.64k|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  9.64k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  929|       |
  930|   141M|        case LEN:
  ------------------
  |  Branch (930:9): [True: 141M, False: 306M]
  ------------------
  931|       |            /* use inflate_fast() if we have enough input and output */
  932|   141M|            if (have >= INFLATE_FAST_MIN_HAVE && left >= INFLATE_FAST_MIN_SAFE) {
  ------------------
  |  |  201|   282M|#define INFLATE_FAST_MIN_HAVE 15
  ------------------
                          if (have >= INFLATE_FAST_MIN_HAVE && left >= INFLATE_FAST_MIN_SAFE) {
  ------------------
  |  |  203|      0|#define INFLATE_FAST_MIN_SAFE 3    /* max unchecked literal writes per iteration */
  ------------------
  |  Branch (932:17): [True: 0, False: 141M]
  |  Branch (932:50): [True: 0, False: 0]
  ------------------
  933|      0|                RESTORE();
  ------------------
  |  |   94|      0|    do { \
  |  |   95|      0|        strm->next_out = put; \
  |  |   96|      0|        strm->avail_out = left; \
  |  |   97|      0|        strm->next_in = (z_const unsigned char *)next; \
  |  |   98|      0|        strm->avail_in = have; \
  |  |   99|      0|        state->hold = hold; \
  |  |  100|      0|        state->bits = bits; \
  |  |  101|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (101:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  934|      0|                if (LIKELY(left >= INFLATE_FAST_MIN_LEFT))
  ------------------
  |  |  257|      0|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (257:33): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  935|      0|                    FUNCTABLE_CALL(inflate_fast)(strm, out);
  ------------------
  |  |   48|      0|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
  936|      0|                else
  937|      0|                    FUNCTABLE_CALL(inflate_fast_safe)(strm, out);
  ------------------
  |  |   48|      0|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
  938|      0|                LOAD();
  ------------------
  |  |   83|      0|    do { \
  |  |   84|      0|        put = strm->next_out; \
  |  |   85|      0|        left = strm->avail_out; \
  |  |   86|      0|        next = strm->next_in; \
  |  |   87|      0|        have = strm->avail_in; \
  |  |   88|      0|        hold = state->hold; \
  |  |   89|      0|        bits = (bits_t)state->bits; \
  |  |   90|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (90:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  939|      0|                if (state->mode == TYPE)
  ------------------
  |  Branch (939:21): [True: 0, False: 0]
  ------------------
  940|      0|                    state->back = -1;
  941|      0|                break;
  942|      0|            }
  943|   141M|            state->back = 0;
  944|       |
  945|       |            /* get a literal, length, or end-of-block code */
  946|   239M|            for (;;) {
  947|   239M|                here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  128|   239M|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  948|   239M|                if (CODE_BITS(here) <= bits)
  ------------------
  |  |  162|   239M|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 5.39M, False: 234M]
  |  |  ------------------
  ------------------
  |  Branch (948:21): [True: 109M, False: 130M]
  ------------------
  949|   109M|                    break;
  950|   130M|                PULLBYTE();
  ------------------
  |  |  389|   130M|    do { \
  |  |  390|   130M|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (390:13): [True: 31.8M, False: 98.6M]
  |  |  ------------------
  |  |  391|   130M|        have--; \
  |  |  392|  98.6M|        hold += ((uint64_t)(*next++) << bits); \
  |  |  393|  98.6M|        bits += 8; \
  |  |  394|  98.6M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (394:14): [Folded, False: 98.6M]
  |  |  ------------------
  ------------------
  951|   130M|            }
  952|   109M|            if (here.op && (here.op & 0xf0) == 0) {
  ------------------
  |  Branch (952:17): [True: 3.24M, False: 105M]
  |  Branch (952:28): [True: 532k, False: 2.71M]
  ------------------
  953|   532k|                unsigned last_bits;
  954|   532k|                last = here;
  955|   532k|                last_bits = CODE_BITS(last);
  ------------------
  |  |  162|   532k|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 0, False: 532k]
  |  |  ------------------
  ------------------
  956|   626k|                for (;;) {
  957|   626k|                    here = state->lencode[last.val + (BITS(last_bits + (last.op & 15)) >> last_bits)];
  ------------------
  |  |  128|   626k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  958|   626k|                    if (last_bits + CODE_BITS(here) <= bits)
  ------------------
  |  |  162|   626k|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 178k, False: 448k]
  |  |  ------------------
  ------------------
  |  Branch (958:25): [True: 437k, False: 189k]
  ------------------
  959|   437k|                        break;
  960|   189k|                    PULLBYTE();
  ------------------
  |  |  389|   189k|    do { \
  |  |  390|   189k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (390:13): [True: 94.8k, False: 94.7k]
  |  |  ------------------
  |  |  391|   189k|        have--; \
  |  |  392|  94.7k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  393|  94.7k|        bits += 8; \
  |  |  394|  94.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (394:14): [Folded, False: 94.7k]
  |  |  ------------------
  ------------------
  961|   189k|                }
  962|   437k|                DROPBITS(last_bits);
  ------------------
  |  |  132|   437k|    do { \
  |  |  133|   437k|        unsigned u = (unsigned)(n); \
  |  |  134|   437k|        hold >>= u; \
  |  |  135|   437k|        bits -= (bits_t)u; \
  |  |  136|   437k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 437k]
  |  |  ------------------
  ------------------
  963|   437k|                state->back += last_bits;
  964|   437k|            }
  965|   109M|            code_bits = CODE_BITS(here);
  ------------------
  |  |  162|   109M|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 2.83M, False: 106M]
  |  |  ------------------
  ------------------
  966|   109M|            DROPBITS(code_bits);
  ------------------
  |  |  132|   109M|    do { \
  |  |  133|   109M|        unsigned u = (unsigned)(n); \
  |  |  134|   109M|        hold >>= u; \
  |  |  135|   109M|        bits -= (bits_t)u; \
  |  |  136|   109M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 109M]
  |  |  ------------------
  ------------------
  967|   109M|            state->back += code_bits;
  968|   109M|            state->length = here.val;
  969|       |
  970|       |            /* process literal */
  971|   109M|            if ((int)(here.op) == 0) {
  ------------------
  |  Branch (971:17): [True: 106M, False: 2.84M]
  ------------------
  972|   106M|                TRACE_LITERAL(here.val);
  973|   106M|                state->mode = LIT;
  974|   106M|                break;
  975|   106M|            }
  976|       |
  977|       |            /* process end of block */
  978|  2.84M|            if (here.op & 32) {
  ------------------
  |  Branch (978:17): [True: 8.80k, False: 2.83M]
  ------------------
  979|  8.80k|                TRACE_END_OF_BLOCK();
  980|  8.80k|                state->back = -1;
  981|  8.80k|                state->mode = TYPE;
  982|  8.80k|                break;
  983|  8.80k|            }
  984|       |
  985|       |            /* invalid code */
  986|  2.83M|            if (here.op & 64) {
  ------------------
  |  Branch (986:17): [True: 0, False: 2.83M]
  ------------------
  987|      0|                SET_BAD("invalid literal/length code");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  988|      0|                break;
  989|      0|            }
  990|       |
  991|       |            /* length code */
  992|  2.83M|            state->extra = CODE_EXTRA(here);
  ------------------
  |  |  166|  2.83M|    ((unsigned)((here.op & 16) ? (here.bits - (here.op & 15)) : 0))
  |  |  ------------------
  |  |  |  Branch (166:17): [True: 2.83M, False: 0]
  |  |  ------------------
  ------------------
  993|  2.83M|            state->mode = LENEXT;
  994|  2.83M|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  2.83M|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  995|       |
  996|  2.88M|        case LENEXT:
  ------------------
  |  Branch (996:9): [True: 50.5k, False: 447M]
  ------------------
  997|       |            /* get extra bits, if any */
  998|  2.88M|            if (state->extra) {
  ------------------
  |  Branch (998:17): [True: 365k, False: 2.52M]
  ------------------
  999|   365k|                NEEDBITS(state->extra);
  ------------------
  |  |  120|   365k|    do { \
  |  |  121|   365k|        unsigned u = (unsigned)(n); \
  |  |  122|   451k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 136k, False: 314k]
  |  |  ------------------
  |  |  123|   365k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|   136k|    do { \
  |  |  |  |  390|   136k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 50.5k, False: 85.8k]
  |  |  |  |  ------------------
  |  |  |  |  391|   136k|        have--; \
  |  |  |  |  392|  85.8k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|  85.8k|        bits += 8; \
  |  |  |  |  394|  85.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 85.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|   365k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 314k]
  |  |  ------------------
  ------------------
 1000|   314k|                state->length += BITS(state->extra);
  ------------------
  |  |  128|   314k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
 1001|   314k|                DROPBITS(state->extra);
  ------------------
  |  |  132|   314k|    do { \
  |  |  133|   314k|        unsigned u = (unsigned)(n); \
  |  |  134|   314k|        hold >>= u; \
  |  |  135|   314k|        bits -= (bits_t)u; \
  |  |  136|   314k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 314k]
  |  |  ------------------
  ------------------
 1002|   314k|                state->back += state->extra;
 1003|   314k|            }
 1004|  2.83M|            TRACE_LENGTH(state->length);
 1005|  2.83M|            state->was = state->length;
 1006|  2.83M|            state->mode = DIST;
 1007|  2.83M|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  2.83M|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1008|       |
 1009|  3.38M|        case DIST:
  ------------------
  |  Branch (1009:9): [True: 547k, False: 446M]
  ------------------
 1010|       |            /* get distance code */
 1011|  4.67M|            for (;;) {
 1012|  4.67M|                here = state->distcode[BITS(state->distbits)];
  ------------------
  |  |  128|  4.67M|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
 1013|  4.67M|                if (CODE_BITS(here) <= bits)
  ------------------
  |  |  162|  4.67M|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 4.66M, False: 11.0k]
  |  |  ------------------
  ------------------
  |  Branch (1013:21): [True: 2.84M, False: 1.83M]
  ------------------
 1014|  2.84M|                    break;
 1015|  1.83M|                PULLBYTE();
  ------------------
  |  |  389|  1.83M|    do { \
  |  |  390|  1.83M|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (390:13): [True: 546k, False: 1.29M]
  |  |  ------------------
  |  |  391|  1.83M|        have--; \
  |  |  392|  1.29M|        hold += ((uint64_t)(*next++) << bits); \
  |  |  393|  1.29M|        bits += 8; \
  |  |  394|  1.29M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (394:14): [Folded, False: 1.29M]
  |  |  ------------------
  ------------------
 1016|  1.83M|            }
 1017|  2.84M|            if ((here.op & 0xf0) == 0) {
  ------------------
  |  Branch (1017:17): [True: 9.23k, False: 2.83M]
  ------------------
 1018|  9.23k|                unsigned last_bits;
 1019|  9.23k|                last = here;
 1020|  9.23k|                last_bits = CODE_BITS(last);
  ------------------
  |  |  162|  9.23k|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 0, False: 9.23k]
  |  |  ------------------
  ------------------
 1021|  10.7k|                for (;;) {
 1022|  10.7k|                    here = state->distcode[last.val + (BITS(last_bits + (last.op & 15)) >> last_bits)];
  ------------------
  |  |  128|  10.7k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
 1023|  10.7k|                    if (last_bits + CODE_BITS(here) <= bits)
  ------------------
  |  |  162|  10.7k|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 10.7k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1023:25): [True: 7.76k, False: 2.94k]
  ------------------
 1024|  7.76k|                        break;
 1025|  2.94k|                    PULLBYTE();
  ------------------
  |  |  389|  2.94k|    do { \
  |  |  390|  2.94k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (390:13): [True: 1.47k, False: 1.47k]
  |  |  ------------------
  |  |  391|  2.94k|        have--; \
  |  |  392|  1.47k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  393|  1.47k|        bits += 8; \
  |  |  394|  1.47k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (394:14): [Folded, False: 1.47k]
  |  |  ------------------
  ------------------
 1026|  2.94k|                }
 1027|  7.76k|                DROPBITS(last_bits);
  ------------------
  |  |  132|  7.76k|    do { \
  |  |  133|  7.76k|        unsigned u = (unsigned)(n); \
  |  |  134|  7.76k|        hold >>= u; \
  |  |  135|  7.76k|        bits -= (bits_t)u; \
  |  |  136|  7.76k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 7.76k]
  |  |  ------------------
  ------------------
 1028|  7.76k|                state->back += last_bits;
 1029|  7.76k|            }
 1030|  2.83M|            code_bits = CODE_BITS(here);
  ------------------
  |  |  162|  2.83M|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 2.83M, False: 0]
  |  |  ------------------
  ------------------
 1031|  2.83M|            DROPBITS(code_bits);
  ------------------
  |  |  132|  2.83M|    do { \
  |  |  133|  2.83M|        unsigned u = (unsigned)(n); \
  |  |  134|  2.83M|        hold >>= u; \
  |  |  135|  2.83M|        bits -= (bits_t)u; \
  |  |  136|  2.83M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 2.83M]
  |  |  ------------------
  ------------------
 1032|  2.83M|            state->back += code_bits;
 1033|  2.83M|            if (here.op & 64) {
  ------------------
  |  Branch (1033:17): [True: 0, False: 2.83M]
  ------------------
 1034|      0|                SET_BAD("invalid distance code");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1035|      0|                break;
 1036|      0|            }
 1037|  2.83M|            state->offset = here.val;
 1038|  2.83M|            state->extra = CODE_EXTRA(here);
  ------------------
  |  |  166|  2.83M|    ((unsigned)((here.op & 16) ? (here.bits - (here.op & 15)) : 0))
  |  |  ------------------
  |  |  |  Branch (166:17): [True: 2.83M, False: 0]
  |  |  ------------------
  ------------------
 1039|  2.83M|            state->mode = DISTEXT;
 1040|  2.83M|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  2.83M|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1041|       |
 1042|  5.86M|        case DISTEXT:
  ------------------
  |  Branch (1042:9): [True: 3.02M, False: 444M]
  ------------------
 1043|       |            /* get distance extra bits, if any */
 1044|  5.86M|            if (state->extra) {
  ------------------
  |  Branch (1044:17): [True: 5.79M, False: 67.3k]
  ------------------
 1045|  5.79M|                NEEDBITS(state->extra);
  ------------------
  |  |  120|  5.79M|    do { \
  |  |  121|  5.79M|        unsigned u = (unsigned)(n); \
  |  |  122|  9.16M|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 6.39M, False: 2.77M]
  |  |  ------------------
  |  |  123|  6.39M|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|  6.39M|    do { \
  |  |  |  |  390|  6.39M|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 3.02M, False: 3.37M]
  |  |  |  |  ------------------
  |  |  |  |  391|  6.39M|        have--; \
  |  |  |  |  392|  3.37M|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|  3.37M|        bits += 8; \
  |  |  |  |  394|  3.37M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 3.37M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  5.79M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 2.77M]
  |  |  ------------------
  ------------------
 1046|  2.77M|                state->offset += BITS(state->extra);
  ------------------
  |  |  128|  2.77M|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
 1047|  2.77M|                DROPBITS(state->extra);
  ------------------
  |  |  132|  2.77M|    do { \
  |  |  133|  2.77M|        unsigned u = (unsigned)(n); \
  |  |  134|  2.77M|        hold >>= u; \
  |  |  135|  2.77M|        bits -= (bits_t)u; \
  |  |  136|  2.77M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 2.77M]
  |  |  ------------------
  ------------------
 1048|  2.77M|                state->back += state->extra;
 1049|  2.77M|            }
 1050|       |#ifdef INFLATE_STRICT
 1051|       |            if (state->offset > state->dmax) {
 1052|       |                SET_BAD("invalid distance too far back");
 1053|       |                break;
 1054|       |            }
 1055|       |#endif
 1056|  2.83M|            TRACE_DISTANCE(state->offset);
 1057|  2.83M|            state->mode = MATCH;
 1058|  2.83M|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  2.83M|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1059|       |
 1060|  79.8M|        case MATCH:
  ------------------
  |  Branch (1060:9): [True: 77.0M, False: 370M]
  ------------------
 1061|       |            /* copy match from window to output */
 1062|  79.8M|            if (left == 0)
  ------------------
  |  Branch (1062:17): [True: 38.6M, False: 41.2M]
  ------------------
 1063|  38.6M|                goto inf_leave;
 1064|  41.2M|            copy = out - left;
 1065|  41.2M|            if (state->offset > copy) {         /* copy from window */
  ------------------
  |  Branch (1065:17): [True: 41.2M, False: 0]
  ------------------
 1066|  41.2M|                copy = state->offset - copy;
 1067|  41.2M|                if (copy > state->whave) {
  ------------------
  |  Branch (1067:21): [True: 0, False: 41.2M]
  ------------------
 1068|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
 1069|       |                    if (state->sane) {
 1070|       |                        SET_BAD("invalid distance too far back");
 1071|       |                        break;
 1072|       |                    }
 1073|       |                    Trace((stderr, "inflate.c too far\n"));
 1074|       |                    copy -= state->whave;
 1075|       |                    copy = MIN(copy, state->length);
 1076|       |                    copy = MIN(copy, left);
 1077|       |                    left -= copy;
 1078|       |                    state->length -= copy;
 1079|       |                    do {
 1080|       |                        *put++ = 0;
 1081|       |                    } while (--copy);
 1082|       |                    if (state->length == 0)
 1083|       |                        state->mode = LEN;
 1084|       |#else
 1085|      0|                    SET_BAD("invalid distance too far back");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1086|      0|#endif
 1087|      0|                    break;
 1088|      0|                }
 1089|  41.2M|                if (copy > state->wnext) {
  ------------------
  |  Branch (1089:21): [True: 8.46M, False: 32.7M]
  ------------------
 1090|  8.46M|                    copy -= state->wnext;
 1091|  8.46M|                    from = state->window + (state->wsize - copy);
 1092|  32.7M|                } else {
 1093|  32.7M|                    from = state->window + (state->wnext - copy);
 1094|  32.7M|                }
 1095|  41.2M|                copy = MIN(copy, state->length);
  ------------------
  |  |  148|  41.2M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 32.0M, False: 9.15M]
  |  |  ------------------
  ------------------
 1096|  41.2M|                copy = MIN(copy, left);
  ------------------
  |  |  148|  41.2M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 29.6M, False: 11.5M]
  |  |  ------------------
  ------------------
 1097|       |
 1098|  41.2M|                put = chunkcopy_safe(put, from, copy, put + left);
 1099|  41.2M|            } else {
 1100|      0|                copy = MIN(state->length, left);
  ------------------
  |  |  148|      0|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1101|       |
 1102|      0|                put = FUNCTABLE_CALL(chunkmemset_safe)(put, put - state->offset, copy, left);
  ------------------
  |  |   48|      0|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
 1103|      0|            }
 1104|  41.2M|            left -= copy;
 1105|  41.2M|            state->length -= copy;
 1106|  41.2M|            if (state->length == 0)
  ------------------
  |  Branch (1106:17): [True: 2.83M, False: 38.3M]
  ------------------
 1107|  2.83M|                state->mode = LEN;
 1108|  41.2M|            break;
 1109|       |
 1110|   181M|        case LIT:
  ------------------
  |  Branch (1110:9): [True: 181M, False: 265M]
  ------------------
 1111|   181M|            if (left == 0)
  ------------------
  |  Branch (1111:17): [True: 74.8M, False: 106M]
  ------------------
 1112|  74.8M|                goto inf_leave;
 1113|   106M|            *put++ = (unsigned char)(state->length);
 1114|   106M|            left--;
 1115|   106M|            state->mode = LEN;
 1116|   106M|            break;
 1117|       |
 1118|  2.69k|        case CHECK:
  ------------------
  |  Branch (1118:9): [True: 2.69k, False: 447M]
  ------------------
 1119|  2.69k|            if (state->wrap) {
  ------------------
  |  Branch (1119:17): [True: 2.69k, False: 0]
  ------------------
 1120|  2.69k|                NEEDBITS(32);
  ------------------
  |  |  120|  2.69k|    do { \
  |  |  121|  2.69k|        unsigned u = (unsigned)(n); \
  |  |  122|  3.11k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 3.11k, False: 0]
  |  |  ------------------
  |  |  123|  3.11k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|  3.11k|    do { \
  |  |  |  |  390|  3.11k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 2.69k, False: 425]
  |  |  |  |  ------------------
  |  |  |  |  391|  3.11k|        have--; \
  |  |  |  |  392|    425|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|    425|        bits += 8; \
  |  |  |  |  394|    425|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 425]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  2.69k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1121|      0|                out -= left;
 1122|      0|                strm->total_out += out;
 1123|      0|                state->total += out;
 1124|       |
 1125|       |                /* compute crc32 checksum if not in raw mode */
 1126|      0|                if (INFLATE_NEED_CHECKSUM(strm) && state->wrap & 4) {
  ------------------
  |  |   34|      0|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (34:39): [True: 0, Folded]
  |  |  ------------------
  ------------------
  |  Branch (1126:52): [True: 0, False: 0]
  ------------------
 1127|      0|                    if (out) {
  ------------------
  |  Branch (1127:25): [True: 0, False: 0]
  ------------------
 1128|      0|                        inf_chksum(strm, put - out, out);
 1129|      0|                    }
 1130|      0|                }
 1131|      0|                out = left;
 1132|      0|                if ((state->wrap & 4) && (
  ------------------
  |  Branch (1132:21): [True: 0, False: 0]
  |  Branch (1132:42): [True: 0, False: 0]
  ------------------
 1133|      0|#ifdef GUNZIP
 1134|      0|                     state->flags ? hold :
  ------------------
  |  Branch (1134:22): [True: 0, False: 0]
  ------------------
 1135|      0|#endif
 1136|      0|                     ZSWAP32((unsigned)hold)) != state->check) {
  ------------------
  |  |  214|      0|#  define ZSWAP32(q) __builtin_bswap32(q)
  ------------------
 1137|      0|                    SET_BAD("incorrect data check");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1138|      0|                    break;
 1139|      0|                }
 1140|      0|                INITBITS();
  ------------------
  |  |  112|      0|    do { \
  |  |  113|      0|        hold = 0; \
  |  |  114|      0|        bits = 0; \
  |  |  115|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (115:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1141|      0|                Tracev((stderr, "inflate:   check matches trailer\n"));
 1142|      0|            }
 1143|      0|#ifdef GUNZIP
 1144|      0|            state->mode = LENGTH;
 1145|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   54|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1146|       |
 1147|      0|        case LENGTH:
  ------------------
  |  Branch (1147:9): [True: 0, False: 447M]
  ------------------
 1148|      0|            if (state->wrap && state->flags) {
  ------------------
  |  Branch (1148:17): [True: 0, False: 0]
  |  Branch (1148:32): [True: 0, False: 0]
  ------------------
 1149|      0|                NEEDBITS(32);
  ------------------
  |  |  120|      0|    do { \
  |  |  121|      0|        unsigned u = (unsigned)(n); \
  |  |  122|      0|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  123|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  389|      0|    do { \
  |  |  |  |  390|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  391|      0|        have--; \
  |  |  |  |  392|      0|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  393|      0|        bits += 8; \
  |  |  |  |  394|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (394:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1150|      0|                if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) {
  ------------------
  |  Branch (1150:21): [True: 0, False: 0]
  |  Branch (1150:42): [True: 0, False: 0]
  ------------------
 1151|      0|                    SET_BAD("incorrect length check");
  ------------------
  |  |  147|      0|    do { \
  |  |  148|      0|        state->mode = BAD; \
  |  |  149|      0|        strm->msg = (z_const char *)errmsg; \
  |  |  150|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (150:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1152|      0|                    break;
 1153|      0|                }
 1154|      0|                INITBITS();
  ------------------
  |  |  112|      0|    do { \
  |  |  113|      0|        hold = 0; \
  |  |  114|      0|        bits = 0; \
  |  |  115|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (115:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1155|      0|                Tracev((stderr, "inflate:   length matches trailer\n"));
 1156|      0|            }
 1157|      0|#endif
 1158|      0|            state->mode = DONE;
 1159|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   54|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1160|       |
 1161|      0|        case DONE:
  ------------------
  |  Branch (1161:9): [True: 0, False: 447M]
  ------------------
 1162|       |            /* inflate stream terminated properly */
 1163|      0|            ret = Z_STREAM_END;
  ------------------
  |  |  181|      0|#define Z_STREAM_END    1
  ------------------
 1164|      0|            goto inf_leave;
 1165|       |
 1166|      0|        case BAD:
  ------------------
  |  Branch (1166:9): [True: 0, False: 447M]
  ------------------
 1167|      0|            ret = Z_DATA_ERROR;
  ------------------
  |  |  185|      0|#define Z_DATA_ERROR   (-3)
  ------------------
 1168|      0|            goto inf_leave;
 1169|       |
 1170|      0|        case SYNC:
  ------------------
  |  Branch (1170:9): [True: 0, False: 447M]
  ------------------
 1171|       |
 1172|      0|        default:                 /* can't happen, but makes compilers happy */
  ------------------
  |  Branch (1172:9): [True: 0, False: 447M]
  ------------------
 1173|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1174|   447M|        }
 1175|       |
 1176|       |    /*
 1177|       |       Return from inflate(), updating the total counts and the check value.
 1178|       |       If there was no progress during the inflate() call, return a buffer
 1179|       |       error.  Call updatewindow() to create and/or update the window state.
 1180|       |     */
 1181|   171M|  inf_leave:
 1182|   171M|    RESTORE();
  ------------------
  |  |   94|   171M|    do { \
  |  |   95|   171M|        strm->next_out = put; \
  |  |   96|   171M|        strm->avail_out = left; \
  |  |   97|   171M|        strm->next_in = (z_const unsigned char *)next; \
  |  |   98|   171M|        strm->avail_in = have; \
  |  |   99|   171M|        state->hold = hold; \
  |  |  100|   171M|        state->bits = bits; \
  |  |  101|   171M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (101:14): [Folded, False: 171M]
  |  |  ------------------
  ------------------
 1183|   171M|    uint32_t check_bytes = out - strm->avail_out;
 1184|   171M|    if (INFLATE_NEED_UPDATEWINDOW(strm) &&
  ------------------
  |  |   36|   342M|#  define INFLATE_NEED_UPDATEWINDOW(strm) 1
  |  |  ------------------
  |  |  |  Branch (36:43): [True: 171M, Folded]
  |  |  ------------------
  ------------------
 1185|   171M|            (state->wsize || (out != strm->avail_out && state->mode < BAD &&
  ------------------
  |  Branch (1185:14): [True: 171M, False: 115k]
  |  Branch (1185:31): [True: 3.55k, False: 111k]
  |  Branch (1185:57): [True: 3.55k, False: 0]
  ------------------
 1186|   171M|                 (state->mode < CHECK || flush != Z_FINISH)))) {
  ------------------
  |  |  175|      0|#define Z_FINISH        4
  ------------------
  |  Branch (1186:19): [True: 3.55k, False: 0]
  |  Branch (1186:42): [True: 0, False: 0]
  ------------------
 1187|       |        /* update sliding window with respective checksum if not in "raw" mode */
 1188|   171M|        updatewindow(strm, strm->next_out, check_bytes, state->wrap & 4);
 1189|   171M|    }
 1190|   171M|    in -= strm->avail_in;
 1191|   171M|    out -= strm->avail_out;
 1192|   171M|    strm->total_in += in;
 1193|   171M|    strm->total_out += out;
 1194|   171M|    state->total += out;
 1195|       |
 1196|   171M|    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
  ------------------
  |  Branch (1196:43): [True: 19.4M, False: 152M]
  ------------------
 1197|   171M|                      (state->mode == TYPE ? 128 : 0) + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
  ------------------
  |  Branch (1197:24): [True: 7.24k, False: 171M]
  |  Branch (1197:58): [True: 0, False: 171M]
  |  Branch (1197:81): [True: 0, False: 171M]
  ------------------
 1198|   171M|    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) {
  ------------------
  |  |  175|   171M|#define Z_FINISH        4
  ------------------
                  if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) {
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
  |  Branch (1198:11): [True: 45.6M, False: 125M]
  |  Branch (1198:22): [True: 0, False: 45.6M]
  |  Branch (1198:35): [True: 0, False: 171M]
  |  Branch (1198:57): [True: 0, False: 0]
  ------------------
 1199|       |        /* when no sliding window is used, hash the output bytes if no CHECK state */
 1200|      0|        if (INFLATE_NEED_CHECKSUM(strm) && !state->wsize && flush == Z_FINISH) {
  ------------------
  |  |   34|      0|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (34:39): [True: 0, Folded]
  |  |  ------------------
  ------------------
                      if (INFLATE_NEED_CHECKSUM(strm) && !state->wsize && flush == Z_FINISH) {
  ------------------
  |  |  175|      0|#define Z_FINISH        4
  ------------------
  |  Branch (1200:44): [True: 0, False: 0]
  |  Branch (1200:61): [True: 0, False: 0]
  ------------------
 1201|      0|            inf_chksum(strm, put - check_bytes, check_bytes);
 1202|      0|        }
 1203|      0|        ret = Z_BUF_ERROR;
  ------------------
  |  |  187|      0|#define Z_BUF_ERROR    (-5)
  ------------------
 1204|      0|    }
 1205|   171M|    return ret;
 1206|   171M|}
zng_inflateEnd:
 1208|  3.55k|int32_t Z_EXPORT PREFIX(inflateEnd)(PREFIX3(stream) *strm) {
 1209|  3.55k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (1209:9): [True: 0, False: 3.55k]
  ------------------
 1210|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1211|       |
 1212|       |    /* Free allocated buffers */
 1213|  3.55k|    free_inflate(strm);
 1214|       |
 1215|  3.55k|    Tracev((stderr, "inflate: end\n"));
 1216|  3.55k|    return Z_OK;
  ------------------
  |  |  180|  3.55k|#define Z_OK            0
  ------------------
 1217|  3.55k|}
inflate.c:inflateStateCheck:
   53|   171M|static int inflateStateCheck(PREFIX3(stream) *strm) {
   54|   171M|    struct inflate_state *state;
   55|   171M|    if (strm == NULL || strm->zalloc == NULL || strm->zfree == NULL)
  ------------------
  |  Branch (55:9): [True: 0, False: 171M]
  |  Branch (55:25): [True: 0, False: 171M]
  |  Branch (55:49): [True: 0, False: 171M]
  ------------------
   56|      0|        return 1;
   57|   171M|    state = (struct inflate_state *)strm->state;
   58|   171M|    if (state == NULL || state->alloc_bufs == NULL || state->strm != strm || state->mode < HEAD || state->mode > SYNC)
  ------------------
  |  Branch (58:9): [True: 0, False: 171M]
  |  Branch (58:26): [True: 0, False: 171M]
  |  Branch (58:55): [True: 0, False: 171M]
  |  Branch (58:78): [True: 0, False: 171M]
  |  Branch (58:100): [True: 0, False: 171M]
  ------------------
   59|      0|        return 1;
   60|   171M|    return 0;
   61|   171M|}
inflate.c:updatewindow:
  327|   171M|static void updatewindow(PREFIX3(stream) *strm, const uint8_t *end, uint32_t len, int32_t cksum) {
  328|   171M|    struct inflate_state *state;
  329|   171M|    uint32_t dist;
  330|       |
  331|   171M|    state = (struct inflate_state *)strm->state;
  332|       |
  333|       |    /* if window not in use yet, initialize */
  334|   171M|    if (state->wsize == 0)
  ------------------
  |  Branch (334:9): [True: 3.55k, False: 171M]
  ------------------
  335|  3.55k|        state->wsize = 1U << state->wbits;
  336|       |
  337|       |    /* len state->wsize or less output bytes into the circular window */
  338|   171M|    if (len >= state->wsize) {
  ------------------
  |  Branch (338:9): [True: 0, False: 171M]
  ------------------
  339|       |        /* Only do this if the caller specifies to checksum bytes AND the platform requires
  340|       |         * it (s/390 being the primary exception to this) */
  341|      0|        if (INFLATE_NEED_CHECKSUM(strm) && cksum) {
  ------------------
  |  |   34|      0|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (34:39): [True: 0, Folded]
  |  |  ------------------
  ------------------
  |  Branch (341:44): [True: 0, False: 0]
  ------------------
  342|       |            /* We have to split the checksum over non-copied and copied bytes */
  343|      0|            if (len > state->wsize)
  ------------------
  |  Branch (343:17): [True: 0, False: 0]
  ------------------
  344|      0|                inf_chksum(strm, end - len, len - state->wsize);
  345|      0|            inf_chksum_cpy(strm, state->window, end - state->wsize, state->wsize);
  346|      0|        } else {
  347|      0|            memcpy(state->window, end - state->wsize, state->wsize);
  348|      0|        }
  349|       |
  350|      0|        state->wnext = 0;
  351|      0|        state->whave = state->wsize;
  352|   171M|    } else {
  353|   171M|        dist = state->wsize - state->wnext;
  354|       |        /* Only do this if the caller specifies to checksum bytes AND the platform requires
  355|       |         * We need to maintain the correct order here for the checksum */
  356|   171M|        dist = MIN(dist, len);
  ------------------
  |  |  148|   171M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 171M, False: 4.61k]
  |  |  ------------------
  ------------------
  357|   171M|        if (INFLATE_NEED_CHECKSUM(strm) && cksum) {
  ------------------
  |  |   34|   342M|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (34:39): [True: 171M, Folded]
  |  |  ------------------
  ------------------
  |  Branch (357:44): [True: 171M, False: 0]
  ------------------
  358|   171M|            inf_chksum_cpy(strm, state->window + state->wnext, end - len, dist);
  359|   171M|        } else {
  360|      0|            memcpy(state->window + state->wnext, end - len, dist);
  361|      0|        }
  362|   171M|        len -= dist;
  363|   171M|        if (len) {
  ------------------
  |  Branch (363:13): [True: 0, False: 171M]
  ------------------
  364|      0|            if (INFLATE_NEED_CHECKSUM(strm) && cksum) {
  ------------------
  |  |   34|      0|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (34:39): [True: 0, Folded]
  |  |  ------------------
  ------------------
  |  Branch (364:48): [True: 0, False: 0]
  ------------------
  365|      0|                inf_chksum_cpy(strm, state->window, end - len, len);
  366|      0|            } else {
  367|      0|                memcpy(state->window, end - len, len);
  368|      0|            }
  369|       |
  370|      0|            state->wnext = len;
  371|      0|            state->whave = state->wsize;
  372|   171M|        } else {
  373|   171M|            state->wnext += dist;
  374|   171M|            if (state->wnext == state->wsize)
  ------------------
  |  Branch (374:17): [True: 4.61k, False: 171M]
  ------------------
  375|  4.61k|                state->wnext = 0;
  376|   171M|            if (state->whave < state->wsize)
  ------------------
  |  Branch (376:17): [True: 29.8M, False: 141M]
  ------------------
  377|  29.8M|                state->whave += dist;
  378|   171M|        }
  379|   171M|    }
  380|   171M|}
inflate.c:inf_chksum_cpy:
   28|   171M|                           const uint8_t *src, uint32_t copy) {
   29|   171M|    if (!copy) return;
  ------------------
  |  Branch (29:9): [True: 2.05M, False: 169M]
  ------------------
   30|   169M|    struct inflate_state *state = (struct inflate_state*)strm->state;
   31|   169M|#ifdef GUNZIP
   32|   169M|    if (state->flags) {
  ------------------
  |  Branch (32:9): [True: 0, False: 169M]
  ------------------
   33|      0|        strm->adler = state->check = FUNCTABLE_CALL(crc32_copy)(state->check, dst, src, copy);
  ------------------
  |  |   48|      0|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
   34|      0|    } else
   35|   169M|#endif
   36|   169M|    {
   37|   169M|        strm->adler = state->check = FUNCTABLE_CALL(adler32_copy)(state->check, dst, src, copy);
  ------------------
  |  |   48|   169M|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
   38|   169M|    }
   39|   169M|}

inflate.c:chunkcopy_safe:
  221|  41.2M|static Z_CHUNKCOPY_SAFE_INLINE uint8_t* chunkcopy_safe(uint8_t *out, uint8_t *from, size_t len, uint8_t *safe) {
  222|  41.2M|    size_t safelen = safe - out;
  223|  41.2M|    len = MIN(len, safelen);
  ------------------
  |  |  148|  41.2M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 0, False: 41.2M]
  |  |  ------------------
  ------------------
  224|  41.2M|    int32_t olap_src = from >= out && from < out + len;
  ------------------
  |  Branch (224:24): [True: 41.2M, False: 0]
  |  Branch (224:39): [True: 0, False: 41.2M]
  ------------------
  225|  41.2M|    int32_t olap_dst = out >= from && out < from + len;
  ------------------
  |  Branch (225:24): [True: 0, False: 41.2M]
  |  Branch (225:39): [True: 0, False: 0]
  ------------------
  226|  41.2M|    size_t tocopy;
  227|       |
  228|       |    /* For all cases without overlap, memcpy is ideal */
  229|  41.2M|    if (!(olap_src || olap_dst)) {
  ------------------
  |  Branch (229:11): [True: 0, False: 41.2M]
  |  Branch (229:23): [True: 0, False: 41.2M]
  ------------------
  230|  41.2M|        memcpy(out, from, len);
  231|  41.2M|        return out + len;
  232|  41.2M|    }
  233|       |
  234|       |    /* Complete overlap: Source == destination */
  235|      0|    if (out == from) {
  ------------------
  |  Branch (235:9): [True: 0, False: 0]
  ------------------
  236|      0|        return out + len;
  237|      0|    }
  238|       |
  239|       |    /* We are emulating a self-modifying copy loop here. To do this in a way that doesn't produce undefined behavior,
  240|       |     * we have to get a bit clever. First if the overlap is such that src falls between dst and dst+len, we can do the
  241|       |     * initial bulk memcpy of the nonoverlapping region. Then, we can leverage the size of this to determine the safest
  242|       |     * atomic memcpy size we can pick such that we have non-overlapping regions. This effectively becomes a safe look
  243|       |     * behind or lookahead distance. */
  244|      0|    size_t non_olap_size = (size_t)ABS(from - out);
  ------------------
  |  |  152|      0|#define ABS(a) ((a) < 0 ? -(a) : (a))
  |  |  ------------------
  |  |  |  Branch (152:17): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  245|       |
  246|       |    /* So this doesn't give use a worst case scenario of function calls in a loop,
  247|       |     * we want to instead break this down into copy blocks of fixed lengths
  248|       |     *
  249|       |     * TODO: The memcpy calls aren't inlined on architectures with strict memory alignment
  250|       |     */
  251|      0|    while (len) {
  ------------------
  |  Branch (251:12): [True: 0, False: 0]
  ------------------
  252|      0|        tocopy = MIN(non_olap_size, len);
  ------------------
  |  |  148|      0|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  253|      0|        len -= tocopy;
  254|       |
  255|      0|        while (tocopy >= 16) {
  ------------------
  |  Branch (255:16): [True: 0, False: 0]
  ------------------
  256|      0|            memcpy(out, from, 16);
  257|      0|            out += 16;
  258|      0|            from += 16;
  259|      0|            tocopy -= 16;
  260|      0|        }
  261|       |
  262|      0|        if (tocopy >= 8) {
  ------------------
  |  Branch (262:13): [True: 0, False: 0]
  ------------------
  263|      0|            memcpy(out, from, 8);
  264|      0|            out += 8;
  265|      0|            from += 8;
  266|      0|            tocopy -= 8;
  267|      0|        }
  268|       |
  269|      0|        if (tocopy >= 4) {
  ------------------
  |  Branch (269:13): [True: 0, False: 0]
  ------------------
  270|      0|            memcpy(out, from, 4);
  271|      0|            out += 4;
  272|      0|            from += 4;
  273|      0|            tocopy -= 4;
  274|      0|        }
  275|       |
  276|      0|        while (tocopy--) {
  ------------------
  |  Branch (276:16): [True: 0, False: 0]
  ------------------
  277|      0|            *out++ = *from++;
  278|      0|        }
  279|      0|    }
  280|       |
  281|      0|    return out;
  282|      0|}

zng_inflate_table:
  146|  23.3k|                                 code * *table, unsigned *bits, uint16_t *work) {
  147|  23.3k|    unsigned len;                 /* a code's length in bits */
  148|  23.3k|    unsigned sym;                 /* index of code symbols */
  149|  23.3k|    unsigned min, max;            /* minimum and maximum code lengths */
  150|  23.3k|    unsigned root;                /* number of index bits for root table */
  151|  23.3k|    unsigned curr;                /* number of index bits for current table */
  152|  23.3k|    unsigned drop;                /* code bits to drop for sub-table */
  153|  23.3k|    int left;                     /* number of prefix codes available */
  154|  23.3k|    unsigned used;                /* code entries in table used */
  155|  23.3k|    uint16_t rhuff;               /* Reversed huffman code */
  156|  23.3k|    unsigned huff;                /* Huffman code */
  157|  23.3k|    unsigned incr;                /* for incrementing code, index */
  158|  23.3k|    unsigned fill;                /* index for replicating entries */
  159|  23.3k|    unsigned low;                 /* low bits for current root entry */
  160|  23.3k|    unsigned mask;                /* mask for low root bits */
  161|  23.3k|    code here;                    /* table entry for duplication */
  162|  23.3k|    code *next;                   /* next available space in table */
  163|  23.3k|    const uint16_t *base = NULL;  /* base value table to use */
  164|  23.3k|    const uint16_t *extra = NULL; /* extra bits table to use */
  165|  23.3k|    unsigned match = 0;           /* use base and extra for symbol >= match */
  166|  23.3k|    uint16_t ALIGNED_(16) count[MAX_BITS+1]; /* number of codes of each length */
  167|  23.3k|    uint16_t offs[MAX_BITS+1];    /* offsets in table for each length */
  168|  23.3k|    static const uint16_t lbase[31] = { /* Length codes 257..285 base */
  169|  23.3k|        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
  170|  23.3k|        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
  171|  23.3k|    static const uint16_t lext[31] = { /* Length codes 257..285 extra */
  172|  23.3k|        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
  173|  23.3k|        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 199, 75};
  174|  23.3k|    static const uint16_t dbase[32] = { /* Distance codes 0..29 base */
  175|  23.3k|        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
  176|  23.3k|        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
  177|  23.3k|        8193, 12289, 16385, 24577, 0, 0};
  178|  23.3k|    static const uint16_t dext[32] = { /* Distance codes 0..29 extra */
  179|  23.3k|        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
  180|  23.3k|        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
  181|  23.3k|        28, 28, 29, 29, 64, 64};
  182|       |
  183|       |    /*
  184|       |       Process a set of code lengths to create a canonical Huffman code.  The
  185|       |       code lengths are lens[0..codes-1].  Each length corresponds to the
  186|       |       symbols 0..codes-1.  The Huffman code is generated by first sorting the
  187|       |       symbols by length from short to long, and retaining the symbol order
  188|       |       for codes with equal lengths.  Then the code starts with all zero bits
  189|       |       for the first code of the shortest length, and the codes are integer
  190|       |       increments for the same length, and zeros are appended as the length
  191|       |       increases.  For the deflate format, these bits are stored backwards
  192|       |       from their more natural integer increment ordering, and so when the
  193|       |       decoding tables are built in the large loop below, the integer codes
  194|       |       are incremented backwards.
  195|       |
  196|       |       This routine assumes, but does not check, that all of the entries in
  197|       |       lens[] are in the range 0..MAXBITS.  The caller must assure this.
  198|       |       1..MAXBITS is interpreted as that code length.  zero means that that
  199|       |       symbol does not occur in this code.
  200|       |
  201|       |       The codes are sorted by computing a count of codes for each length,
  202|       |       creating from that a table of starting indices for each length in the
  203|       |       sorted table, and then entering the symbols in order in the sorted
  204|       |       table.  The sorted table is work[], with that space being provided by
  205|       |       the caller.
  206|       |
  207|       |       The length counts are used for other purposes as well, i.e. finding
  208|       |       the minimum and maximum length codes, determining if there are any
  209|       |       codes at all, checking for a valid set of lengths, and looking ahead
  210|       |       at length counts to determine sub-table sizes when building the
  211|       |       decoding tables.
  212|       |     */
  213|       |
  214|       |    /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
  215|  23.3k|    count_lengths(lens, codes, count);
  216|       |
  217|       |    /* bound code lengths, force root to be within code lengths */
  218|  23.3k|    root = *bits;
  219|   195k|    for (max = MAX_BITS; max >= 1; max--)
  ------------------
  |  |   41|  23.3k|#define MAX_BITS 15
  ------------------
  |  Branch (219:26): [True: 195k, False: 0]
  ------------------
  220|   195k|        if (count[max] != 0) break;
  ------------------
  |  Branch (220:13): [True: 23.3k, False: 171k]
  ------------------
  221|  23.3k|    root = MIN(root, max);
  ------------------
  |  |  148|  23.3k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 10.8k, False: 12.5k]
  |  |  ------------------
  ------------------
  222|  23.3k|    if (UNLIKELY(max == 0)) {           /* no symbols to code at all */
  ------------------
  |  |  258|  23.3k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 0, False: 23.3k]
  |  |  ------------------
  ------------------
  223|      0|        here.op = (unsigned char)64;    /* invalid code marker */
  224|      0|        here.bits = (unsigned char)1;
  225|      0|        here.val = (uint16_t)0;
  226|      0|        *(*table)++ = here;             /* make a table to force an error */
  227|      0|        *(*table)++ = here;
  228|      0|        *bits = 1;
  229|      0|        return 0;     /* no symbols, but wait for decoding to report error */
  230|      0|    }
  231|  64.8k|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (231:19): [True: 62.4k, False: 2.41k]
  ------------------
  232|  62.4k|        if (count[min] != 0) break;
  ------------------
  |  Branch (232:13): [True: 20.9k, False: 41.4k]
  ------------------
  233|  23.3k|    root = MAX(root, min);
  ------------------
  |  |  150|  23.3k|#define MAX(a, b) ((a) < (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (150:20): [True: 0, False: 23.3k]
  |  |  ------------------
  ------------------
  234|       |
  235|       |    /* check for an over-subscribed or incomplete set of lengths */
  236|  23.3k|    left = 1;
  237|   374k|    for (len = 1; len <= MAX_BITS; len++) {
  ------------------
  |  |   41|   374k|#define MAX_BITS 15
  ------------------
  |  Branch (237:19): [True: 350k, False: 23.3k]
  ------------------
  238|   350k|        left <<= 1;
  239|   350k|        left -= count[len];
  240|   350k|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (240:13): [True: 0, False: 350k]
  ------------------
  241|   350k|    }
  242|  23.3k|    if (left > 0 && (type == CODES || max != 1))
  ------------------
  |  Branch (242:9): [True: 0, False: 23.3k]
  |  Branch (242:22): [True: 0, False: 0]
  |  Branch (242:39): [True: 0, False: 0]
  ------------------
  243|      0|        return -1;                      /* incomplete set */
  244|       |
  245|       |    /* generate offsets into symbol table for each length for sorting */
  246|  23.3k|    offs[1] = 0;
  247|   350k|    for (len = 1; len < MAX_BITS; len++)
  ------------------
  |  |   41|   350k|#define MAX_BITS 15
  ------------------
  |  Branch (247:19): [True: 327k, False: 23.3k]
  ------------------
  248|   327k|        offs[len + 1] = offs[len] + count[len];
  249|       |
  250|       |    /* sort symbols by length, by symbol order within each length */
  251|  2.47M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (251:19): [True: 2.45M, False: 23.3k]
  ------------------
  252|  2.45M|        if (lens[sym] != 0) work[offs[lens[sym]]++] = (uint16_t)sym;
  ------------------
  |  Branch (252:13): [True: 1.82M, False: 628k]
  ------------------
  253|       |
  254|       |    /*
  255|       |       Create and fill in decoding tables.  In this loop, the table being
  256|       |       filled is at next and has curr index bits.  The code being used is huff
  257|       |       with length len.  That code is converted to an index by dropping drop
  258|       |       bits off of the bottom.  For codes where len is less than drop + curr,
  259|       |       those top drop + curr - len bits are incremented through all values to
  260|       |       fill the table with replicated entries.
  261|       |
  262|       |       root is the number of index bits for the root table.  When len exceeds
  263|       |       root, sub-tables are created pointed to by the root entry with an index
  264|       |       of the low root bits of huff.  This is saved in low to check for when a
  265|       |       new sub-table should be started.  drop is zero when the root table is
  266|       |       being filled, and drop is root when sub-tables are being filled.
  267|       |
  268|       |       When a new sub-table is needed, it is necessary to look ahead in the
  269|       |       code lengths to determine what size sub-table is needed.  The length
  270|       |       counts are used for this, and so count[] is decremented as codes are
  271|       |       entered in the tables.
  272|       |
  273|       |       used keeps track of how many table entries have been allocated from the
  274|       |       provided *table space.  It is checked for LENS and DIST tables against
  275|       |       the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
  276|       |       the initial root table size constants.  See the comments in inftrees.h
  277|       |       for more information.
  278|       |
  279|       |       sym increments through all symbols, and the loop terminates when
  280|       |       all codes of length max, i.e. all codes, have been processed.  This
  281|       |       routine permits incomplete codes, so another loop after this one fills
  282|       |       in the rest of the decoding tables with invalid code markers.
  283|       |     */
  284|       |
  285|       |    /* The packed table fill below reads and writes each entry as a single uint32_t. */
  286|  23.3k|    Assert(sizeof(code) == 4, "code entry must be exactly 4 bytes");
  287|       |
  288|       |    /* set up for code type */
  289|  23.3k|    switch (type) {
  ------------------
  |  Branch (289:13): [True: 23.3k, False: 0]
  ------------------
  290|  7.79k|    case CODES:
  ------------------
  |  Branch (290:5): [True: 7.79k, False: 15.5k]
  ------------------
  291|  7.79k|        base = extra = work;    /* dummy value--not used */
  292|  7.79k|        match = 20;
  293|  7.79k|        break;
  294|  7.79k|    case LENS:
  ------------------
  |  Branch (294:5): [True: 7.79k, False: 15.5k]
  ------------------
  295|  7.79k|        base = lbase;
  296|  7.79k|        extra = lext;
  297|  7.79k|        match = 257;
  298|  7.79k|        break;
  299|  7.79k|    case DISTS:
  ------------------
  |  Branch (299:5): [True: 7.79k, False: 15.5k]
  ------------------
  300|  7.79k|        base = dbase;
  301|  7.79k|        extra = dext;
  302|  23.3k|    }
  303|       |
  304|       |    /* initialize state for loop */
  305|  23.3k|    rhuff = 0;                  /* starting code, reversed */
  306|  23.3k|    huff = 0;                   /* starting code */
  307|  23.3k|    sym = 0;                    /* starting code symbol */
  308|  23.3k|    len = min;                  /* starting code length */
  309|  23.3k|    next = *table;              /* current table to fill in */
  310|  23.3k|    curr = root;                /* current table index bits */
  311|  23.3k|    drop = 0;                   /* current bits to drop from code for index */
  312|  23.3k|    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
  313|  23.3k|    used = 1U << root;          /* use root table entries */
  314|  23.3k|    mask = used - 1;            /* mask for comparing low */
  315|       |
  316|       |    /* check available table space */
  317|  23.3k|    if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   52|  7.79k|#define ENOUGH_LENS 1332
  ------------------
  |  Branch (317:10): [True: 7.79k, False: 15.5k]
  |  Branch (317:26): [True: 0, False: 7.79k]
  ------------------
  318|  23.3k|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   53|  7.79k|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (318:10): [True: 7.79k, False: 15.5k]
  |  Branch (318:27): [True: 0, False: 7.79k]
  ------------------
  319|      0|        return 1;
  320|       |
  321|       |    /* process all codes and make table entries */
  322|  1.82M|    for (;;) {
  323|       |        /* create table entry */
  324|  1.82M|        here.bits = (unsigned char)(len - drop);
  325|  1.82M|        if (LIKELY(work[sym] >= match)) {
  ------------------
  |  |  257|  1.82M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (257:33): [True: 149k, False: 1.67M]
  |  |  ------------------
  ------------------
  326|   149k|            unsigned op = extra[work[sym] - match];
  327|   149k|            here.op = COMBINE_OP(op, here.bits);
  ------------------
  |  |  174|   149k|    ((unsigned char)((extra) & 16 ? (code_bits) | 16 : (extra)))
  |  |  ------------------
  |  |  |  Branch (174:22): [True: 149k, False: 0]
  |  |  ------------------
  ------------------
  328|   149k|            here.bits = COMBINE_BITS(here.bits, op);
  ------------------
  |  |  178|   149k|    ((unsigned char)((code_bits) + ((extra) & 15)))
  ------------------
  329|   149k|            here.val = base[work[sym] - match];
  330|  1.67M|        } else if (work[sym] + 1U < match) {
  ------------------
  |  Branch (330:20): [True: 1.66M, False: 7.79k]
  ------------------
  331|  1.66M|            here.op = (unsigned char)0;
  332|  1.66M|            here.val = work[sym];
  333|  1.66M|        } else {
  334|  7.79k|            here.op = (unsigned char)(32 + 64);         /* end of block */
  335|  7.79k|            here.val = 0;
  336|  7.79k|        }
  337|       |
  338|       |        /* replicate for those indices with low len bits equal to huff */
  339|  1.82M|        incr = 1U << (len - drop);
  340|  1.82M|        fill = 1U << curr;
  341|  1.82M|        min = fill;                 /* save offset to next table */
  342|  1.82M|        {
  343|       |            /* `here` is a 4-byte struct that the compiler writes one field at a time.
  344|       |               Read it as a packed uint32_t so each slot is filled by a single store. */
  345|  1.82M|            uint32_t here_u32 = zng_memread_4(&here);
  346|  1.82M|            code *base_ptr = next + (huff >> drop);
  347|  1.82M|            unsigned step4 = incr << 2;
  348|       |            /* Unroll by four so the slot addresses are independent. */
  349|  3.86M|            while (fill >= step4) {
  ------------------
  |  Branch (349:20): [True: 2.04M, False: 1.82M]
  ------------------
  350|  2.04M|                zng_memwrite_4(&base_ptr[fill - 1 * incr], here_u32);
  351|  2.04M|                zng_memwrite_4(&base_ptr[fill - 2 * incr], here_u32);
  352|  2.04M|                zng_memwrite_4(&base_ptr[fill - 3 * incr], here_u32);
  353|  2.04M|                zng_memwrite_4(&base_ptr[fill - 4 * incr], here_u32);
  354|  2.04M|                fill -= step4;
  355|  2.04M|            }
  356|  2.81M|            while (fill != 0) {
  ------------------
  |  Branch (356:20): [True: 988k, False: 1.82M]
  ------------------
  357|   988k|                fill -= incr;
  358|   988k|                zng_memwrite_4(&base_ptr[fill], here_u32);
  359|   988k|            }
  360|  1.82M|        }
  361|       |
  362|       |        /* backwards increment the len-bit code huff */
  363|  1.82M|        rhuff = (uint16_t)(rhuff + (0x8000u >> (len - 1)));
  364|  1.82M|        huff = zng_bitreverse16(rhuff);
  365|       |
  366|       |        /* go to next symbol, update count, len */
  367|  1.82M|        sym++;
  368|  1.82M|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (368:13): [True: 123k, False: 1.70M]
  ------------------
  369|   123k|            if (len == max)
  ------------------
  |  Branch (369:17): [True: 23.3k, False: 99.7k]
  ------------------
  370|  23.3k|                break;
  371|  99.7k|            len = lens[work[sym]];
  372|  99.7k|        }
  373|       |
  374|       |        /* create new sub-table if needed */
  375|  1.80M|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (375:13): [True: 135k, False: 1.66M]
  |  Branch (375:27): [True: 32.3k, False: 102k]
  ------------------
  376|       |            /* if first time, transition to sub-tables */
  377|  32.3k|            if (drop == 0)
  ------------------
  |  Branch (377:17): [True: 6.59k, False: 25.7k]
  ------------------
  378|  6.59k|                drop = root;
  379|       |
  380|       |            /* increment past last table */
  381|  32.3k|            next += min;            /* here min is 1 << curr */
  382|       |
  383|       |            /* determine length of next table */
  384|  32.3k|            curr = len - drop;
  385|  32.3k|            left = (int)(1 << curr);
  386|  42.4k|            while (curr + drop < max) {
  ------------------
  |  Branch (386:20): [True: 31.4k, False: 11.0k]
  ------------------
  387|  31.4k|                left -= count[curr + drop];
  388|  31.4k|                if (left <= 0)
  ------------------
  |  Branch (388:21): [True: 21.3k, False: 10.0k]
  ------------------
  389|  21.3k|                    break;
  390|  10.0k|                curr++;
  391|  10.0k|                left <<= 1;
  392|  10.0k|            }
  393|       |
  394|       |            /* check for enough space */
  395|  32.3k|            used += 1U << curr;
  396|  32.3k|            if ((type == LENS && used > ENOUGH_LENS) || (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   52|  31.3k|#define ENOUGH_LENS 1332
  ------------------
                          if ((type == LENS && used > ENOUGH_LENS) || (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   53|  1.00k|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (396:18): [True: 31.3k, False: 1.00k]
  |  Branch (396:34): [True: 0, False: 31.3k]
  |  Branch (396:58): [True: 1.00k, False: 31.3k]
  |  Branch (396:75): [True: 0, False: 1.00k]
  ------------------
  397|      0|                return 1;
  398|       |
  399|       |            /* point entry in root table to sub-table */
  400|  32.3k|            low = huff & mask;
  401|  32.3k|            (*table)[low].op = (unsigned char)curr;
  402|  32.3k|            (*table)[low].bits = (unsigned char)root;
  403|  32.3k|            (*table)[low].val = (uint16_t)(next - *table);
  404|  32.3k|        }
  405|  1.80M|    }
  406|       |
  407|       |    /* fill in remaining table entry if code is incomplete (guaranteed to have
  408|       |       at most one remaining entry, since if the code is incomplete, the
  409|       |       maximum code length that was allowed to get this far is one bit) */
  410|  23.3k|    if (UNLIKELY(huff != 0)) {
  ------------------
  |  |  258|  23.3k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 0, False: 23.3k]
  |  |  ------------------
  ------------------
  411|      0|        here.op = (unsigned char)64;            /* invalid code marker */
  412|      0|        here.bits = (unsigned char)(len - drop);
  413|      0|        here.val = (uint16_t)0;
  414|      0|        next[huff] = here;
  415|      0|    }
  416|       |
  417|       |    /* set return parameters */
  418|  23.3k|    *table += used;
  419|  23.3k|    *bits = root;
  420|  23.3k|    return 0;
  421|  23.3k|}
inftrees.c:count_lengths:
   30|  23.3k|static inline void count_lengths(uint16_t *lens, int codes, uint16_t *count) {
   31|       |    /* IBM...made some weird choices for VSX/VMX. Basically vec_ld has an inherent
   32|       |     * endianness but we don't want to force VSX to be needed */
   33|  23.3k|    static const ALIGNED_(16) uint8_t one[256] = {
   34|  23.3k|        1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   35|  23.3k|        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   36|  23.3k|        0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   37|  23.3k|        0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   38|  23.3k|        0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   39|  23.3k|        0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   40|  23.3k|        0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   41|  23.3k|        0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
   42|  23.3k|        0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
   43|  23.3k|        0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
   44|  23.3k|        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
   45|  23.3k|        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
   46|  23.3k|        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
   47|  23.3k|        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
   48|  23.3k|        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
   49|  23.3k|        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
   50|  23.3k|    };
   51|       |
   52|       |#if defined(__ALTIVEC__)
   53|       |    vector unsigned char s1 = vec_splat_u8(0);
   54|       |    vector unsigned char s2 = vec_splat_u8(0);
   55|       |
   56|       |    if (codes & 1) {
   57|       |        s1 = vec_ld(16 * lens[0], one);
   58|       |        --codes;
   59|       |        ++lens;
   60|       |    }
   61|       |
   62|       |    while (codes) {
   63|       |        s1 = vec_add(s1, vec_ld(16 * lens[0], one));
   64|       |        s2 = vec_add(s2, vec_ld(16 * lens[1], one));
   65|       |        codes -= 2;
   66|       |        lens += 2;
   67|       |    }
   68|       |
   69|       |    vector unsigned short sum_lo = vec_add(vec_unpackh(s1), vec_unpackh(s2));
   70|       |    vector unsigned short sum_hi = vec_add(vec_unpackl(s1), vec_unpackl(s2));
   71|       |
   72|       |    vec_st(sum_lo, 0, &count[0]);
   73|       |    vec_st(sum_hi, 0, &count[8]);
   74|       |
   75|       |#elif defined(__ARM_NEON) || defined(__ARM_NEON__)
   76|       |    int sym;
   77|       |    uint8x16_t s1 = vdupq_n_u8(0);
   78|       |    uint8x16_t s2 = vdupq_n_u8(0);
   79|       |
   80|       |    if (codes & 1) {
   81|       |        s1 = vld1q_u8(&one[16 * lens[0]]);
   82|       |    }
   83|       |    for (sym = codes & 1; sym < codes; sym += 2) {
   84|       |        s1 = vaddq_u8(s1, vld1q_u8(&one[16 * lens[sym]]));
   85|       |        s2 = vaddq_u8(s2, vld1q_u8(&one[16 * lens[sym+1]]));
   86|       |    }
   87|       |
   88|       |    vst1q_u16(&count[0], vaddl_u8(vget_low_u8(s1), vget_low_u8(s2)));
   89|       |    vst1q_u16(&count[8], vaddl_u8(vget_high_u8(s1), vget_high_u8(s2)));
   90|       |
   91|       |#elif defined(__SSE2__)
   92|       |    int sym;
   93|  23.3k|    __m128i s1 = _mm_setzero_si128();
   94|  23.3k|    __m128i s2 = _mm_setzero_si128();
   95|       |
   96|  23.3k|    if (codes & 1) {
  ------------------
  |  Branch (96:9): [True: 12.8k, False: 10.5k]
  ------------------
   97|  12.8k|        s1 = _mm_load_si128((const __m128i*)&one[16 * lens[0]]);
   98|  12.8k|    }
   99|  1.24M|    for (sym = codes & 1; sym < codes; sym += 2) {
  ------------------
  |  Branch (99:27): [True: 1.21M, False: 23.3k]
  ------------------
  100|  1.21M|        s1 = _mm_add_epi8(s1, _mm_load_si128((const __m128i*)&one[16 * lens[sym]]));  // vaddq_u8
  101|  1.21M|        s2 = _mm_add_epi8(s2, _mm_load_si128((const __m128i*)&one[16 * lens[sym+1]]));
  102|  1.21M|    }
  103|       |
  104|       |#  if defined(__AVX2__)
  105|       |    __m256i w1 = _mm256_cvtepu8_epi16(s1);
  106|       |    __m256i w2 = _mm256_cvtepu8_epi16(s2);
  107|       |    __m256i sum = _mm256_add_epi16(w1, w2);
  108|       |
  109|       |    _mm256_storeu_si256((__m256i*)&count[0], sum);
  110|       |#  else
  111|  23.3k|    __m128i zero = _mm_setzero_si128();
  112|       |
  113|  23.3k|    __m128i s1_lo = _mm_unpacklo_epi8(s1, zero);
  114|  23.3k|    __m128i s2_lo = _mm_unpacklo_epi8(s2, zero);
  115|  23.3k|    __m128i sum_lo = _mm_add_epi16(s1_lo, s2_lo);
  116|  23.3k|    _mm_storeu_si128((__m128i*)&count[0], sum_lo);
  117|       |
  118|  23.3k|    __m128i s1_hi = _mm_unpackhi_epi8(s1, zero);
  119|  23.3k|    __m128i s2_hi = _mm_unpackhi_epi8(s2, zero);
  120|  23.3k|    __m128i sum_hi = _mm_add_epi16(s1_hi, s2_hi);
  121|  23.3k|    _mm_storeu_si128((__m128i*)&count[8], sum_hi);
  122|  23.3k|#  endif
  123|       |#else
  124|       |    int len, sym;
  125|       |    for (len = 0; len <= MAX_BITS; len++)
  126|       |        count[len] = 0;
  127|       |    for (sym = 0; sym < codes; sym++)
  128|       |        count[lens[sym]]++;
  129|       |    Z_UNUSED(one);
  130|       |#endif
  131|  23.3k|}

insert_knuth_batch:
   12|  2.76M|Z_INTERNAL void insert_knuth_batch(deflate_state *const s, unsigned char *window, uint32_t str, uint32_t count) {
   13|  2.76M|    insert_knuth_batch_static(s, window, str, count);
   14|  2.76M|}

deflate.c:insert_knuth:
   69|   168M|Z_FORCEINLINE static uint32_t insert_knuth(deflate_state *const s, unsigned char *window, uint32_t str) {
   70|   168M|    uint8_t *strstart = window + str;
   71|   168M|    uint32_t val, h, head;
   72|       |
   73|   168M|    val = Z_U32_FROM_LE(zng_memread_4(strstart));
  ------------------
  |  |   87|   168M|#  define Z_U32_FROM_LE(x)  (x)
  ------------------
   74|   168M|    UPDATE_HASH_KNUTH(h, val);
  ------------------
  |  |   10|   168M|#define UPDATE_HASH_KNUTH(h,val) h = (((val) * 2654435761U) >> KNUTH_SHIFT)
  |  |  ------------------
  |  |  |  |    9|   168M|#define KNUTH_SHIFT (32 - HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|   168M|#  define HASH_BITS    16u         /* log2(HASH_SIZE) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   75|       |
   76|   168M|    head = s->head[h];
   77|   168M|    if (LIKELY(head != str)) {
  ------------------
  |  |  257|   168M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (257:33): [True: 68.9k, False: 168M]
  |  |  ------------------
  ------------------
   78|  68.9k|        s->prev[str & W_MASK(s)] = (Pos)head;
  ------------------
  |  |  424|  68.9k|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
   79|  68.9k|        s->head[h] = (Pos)str;
   80|  68.9k|    }
   81|   168M|    return head;
   82|   168M|}
deflate_medium.c:insert_knuth:
   69|   130M|Z_FORCEINLINE static uint32_t insert_knuth(deflate_state *const s, unsigned char *window, uint32_t str) {
   70|   130M|    uint8_t *strstart = window + str;
   71|   130M|    uint32_t val, h, head;
   72|       |
   73|   130M|    val = Z_U32_FROM_LE(zng_memread_4(strstart));
  ------------------
  |  |   87|   130M|#  define Z_U32_FROM_LE(x)  (x)
  ------------------
   74|   130M|    UPDATE_HASH_KNUTH(h, val);
  ------------------
  |  |   10|   130M|#define UPDATE_HASH_KNUTH(h,val) h = (((val) * 2654435761U) >> KNUTH_SHIFT)
  |  |  ------------------
  |  |  |  |    9|   130M|#define KNUTH_SHIFT (32 - HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|   130M|#  define HASH_BITS    16u         /* log2(HASH_SIZE) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   75|       |
   76|   130M|    head = s->head[h];
   77|   130M|    if (LIKELY(head != str)) {
  ------------------
  |  |  257|   130M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (257:33): [True: 130M, False: 3.49k]
  |  |  ------------------
  ------------------
   78|   130M|        s->prev[str & W_MASK(s)] = (Pos)head;
  ------------------
  |  |  424|   130M|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
   79|   130M|        s->head[h] = (Pos)str;
   80|   130M|    }
   81|   130M|    return head;
   82|   130M|}
insert_string.c:insert_knuth_batch_static:
  125|  2.76M|Z_FORCEINLINE static void insert_knuth_batch_static(deflate_state *const s, unsigned char *window, uint32_t str, uint32_t count) {
  126|  2.76M|    uint8_t *strstart = window + str;
  127|  2.76M|    uint8_t *strend = strstart + count;
  128|       |
  129|       |    /* Local pointers to avoid indirection */
  130|  2.76M|    Pos *headp = s->head;
  131|  2.76M|    Pos *prevp = s->prev;
  132|  2.76M|    const unsigned int w_mask = W_MASK(s);
  ------------------
  |  |  424|  2.76M|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
  133|       |
  134|  23.2M|    for (uint32_t idx = str; strstart < strend; idx++, strstart++) {
  ------------------
  |  Branch (134:30): [True: 20.4M, False: 2.76M]
  ------------------
  135|  20.4M|        uint32_t val, h, head;
  136|       |
  137|  20.4M|        val = Z_U32_FROM_LE(zng_memread_4(strstart));
  ------------------
  |  |   87|  20.4M|#  define Z_U32_FROM_LE(x)  (x)
  ------------------
  138|  20.4M|        UPDATE_HASH_KNUTH(h, val);
  ------------------
  |  |   10|  20.4M|#define UPDATE_HASH_KNUTH(h,val) h = (((val) * 2654435761U) >> KNUTH_SHIFT)
  |  |  ------------------
  |  |  |  |    9|  20.4M|#define KNUTH_SHIFT (32 - HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|  20.4M|#  define HASH_BITS    16u         /* log2(HASH_SIZE) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  139|       |
  140|  20.4M|        head = headp[h];
  141|  20.4M|        if (LIKELY(head != idx)) {
  ------------------
  |  |  257|  20.4M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (257:33): [True: 20.4M, False: 0]
  |  |  ------------------
  ------------------
  142|  20.4M|            prevp[idx & w_mask] = (Pos)head;
  143|  20.4M|            headp[h] = (Pos)idx;
  144|  20.4M|        }
  145|  20.4M|    }
  146|  2.76M|}

longest_match_avx2:
   28|  45.9M|Z_INTERNAL uint32_t LONGEST_MATCH(deflate_state *const s, uint32_t cur_match) {
   29|  45.9M|    const unsigned wmask = W_MASK(s);
  ------------------
  |  |  424|  45.9M|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
   30|  45.9M|    unsigned int strstart = s->strstart;
   31|  45.9M|    const unsigned char *window = s->window;
   32|  45.9M|    const Pos *prev = s->prev;
   33|       |#ifdef LONGEST_MATCH_SLOW
   34|       |    const Pos *head = s->head;
   35|       |#endif
   36|  45.9M|    const unsigned char *scan;
   37|  45.9M|    const unsigned char *mbase_start = window;
   38|  45.9M|    const unsigned char *mbase_end;
   39|  45.9M|    uint32_t limit;
   40|       |#ifdef LONGEST_MATCH_SLOW
   41|       |    uint32_t limit_base;
   42|       |#endif
   43|  45.9M|#ifndef LONGEST_MATCH_SLOW
   44|  45.9M|    int32_t early_exit;
   45|  45.9M|#endif
   46|  45.9M|    uint32_t chain_length = s->max_chain_length;
   47|  45.9M|    uint32_t nice_match = (uint32_t)s->nice_match;
   48|  45.9M|    uint32_t best_len, offset;
   49|  45.9M|    uint32_t lookahead = s->lookahead;
   50|  45.9M|    uint32_t match_offset = 0;
   51|  45.9M|    uint64_t scan_start;
   52|  45.9M|    uint64_t scan_end;
   53|       |
   54|       |    /* The code is optimized for STD_MAX_MATCH-2 multiple of 16. */
   55|  45.9M|    Assert(STD_MAX_MATCH == 258, "Code too clever");
   56|       |
   57|  45.9M|    best_len = s->prev_length ? s->prev_length : STD_MIN_MATCH-1;
  ------------------
  |  |   61|  45.9M|#define STD_MIN_MATCH  3
  ------------------
  |  Branch (57:16): [True: 0, False: 45.9M]
  ------------------
   58|  45.9M|    if (UNLIKELY(best_len >= lookahead))
  ------------------
  |  |  258|  45.9M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 0, False: 45.9M]
  |  |  ------------------
  ------------------
   59|      0|        return lookahead;
   60|       |#ifdef LONGEST_MATCH_SLOW
   61|       |#  ifdef LONGEST_MATCH_SLOW_ROLL
   62|       |    /* Rolling-hash variant always runs the post-match offset search; the
   63|       |     * compiler folds the constant away below.
   64|       |     */
   65|       |    const int offset_search = 1;
   66|       |#  else
   67|       |    /* The post-match offset search only pays off when we entered with a
   68|       |     * prior best_len from lazy evaluation, so gate on it at function entry.
   69|       |     */
   70|       |    const int offset_search = (best_len >= STD_MIN_MATCH);
   71|       |#  endif
   72|       |#endif
   73|       |
   74|       |    /* Calculate read offset which should only extend an extra byte to find the
   75|       |     * next best match length. When best_len is shorter than the read width, we
   76|       |     * diff the mismatched bytes instead.
   77|       |     */
   78|  45.9M|    offset = best_len >= sizeof(uint64_t) ? best_len - 7 : 0;
  ------------------
  |  Branch (78:14): [True: 0, False: 45.9M]
  ------------------
   79|       |
   80|  45.9M|    scan = window + strstart;
   81|  45.9M|    scan_start = zng_memread_8(scan);
   82|  45.9M|    scan_end = zng_memread_8(scan+offset);
   83|  45.9M|    mbase_end = (mbase_start+offset);
   84|       |
   85|       |    /* Do not waste too much time if we already have a good match */
   86|  45.9M|    if (UNLIKELY(best_len >= s->good_match))
  ------------------
  |  |  258|  45.9M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 0, False: 45.9M]
  |  |  ------------------
  ------------------
   87|      0|        chain_length >>= 2;
   88|       |
   89|       |    /* Stop when cur_match becomes <= limit. To simplify the code,
   90|       |     * we prevent matches with the string of window index 0
   91|       |     */
   92|  45.9M|    limit = strstart > MAX_DIST(s) ? (strstart - MAX_DIST(s)) : 0;
  ------------------
  |  |  419|  45.9M|#define MAX_DIST(s)  ((s)->w_size - MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  414|  45.9M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  45.9M|#define STD_MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|  45.9M|#define STD_MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  limit = strstart > MAX_DIST(s) ? (strstart - MAX_DIST(s)) : 0;
  ------------------
  |  |  419|  41.4M|#define MAX_DIST(s)  ((s)->w_size - MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  414|  41.4M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  41.4M|#define STD_MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|  41.4M|#define STD_MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (92:13): [True: 41.4M, False: 4.48M]
  ------------------
   93|  45.9M|#ifndef LONGEST_MATCH_SLOW
   94|  45.9M|    early_exit = s->level < EARLY_EXIT_TRIGGER_LEVEL;
  ------------------
  |  |   13|  45.9M|#define EARLY_EXIT_TRIGGER_LEVEL 5
  ------------------
   95|  45.9M|#endif
   96|       |#ifdef LONGEST_MATCH_SLOW
   97|       |    limit_base = limit;
   98|       |    if (best_len >= STD_MIN_MATCH) {
   99|       |        /* We're continuing search (lazy evaluation). Find a most distant
  100|       |         * chain by hashing substrings within the match area. We cannot use
  101|       |         * s->prev[strstart+1,...] immediately because those strings are not
  102|       |         * yet inserted into the hash table.
  103|       |         */
  104|       |#  ifdef LONGEST_MATCH_SLOW_ROLL
  105|       |        uint32_t hash;
  106|       |        uint32_t pos;
  107|       |
  108|       |        hash = update_hash_roll(0, scan[1]);
  109|       |        hash = update_hash_roll(hash, scan[2]);
  110|       |
  111|       |        for (uint32_t i = 3; i <= best_len; i++) {
  112|       |            hash = update_hash_roll(hash, scan[i]);
  113|       |            pos = head[hash];
  114|       |            if (UNLIKELY(pos < cur_match)) {
  115|       |                match_offset = i - 2;
  116|       |                cur_match = pos;
  117|       |            }
  118|       |        }
  119|       |#  else /* 4-byte Knuth hash, fresh lookup per offset */
  120|       |        for (uint32_t i = 1; i + (WANT_MIN_MATCH - 1) <= best_len; i++) {
  121|       |            uint32_t val = Z_U32_FROM_LE(zng_memread_4(scan + i));
  122|       |            uint32_t hash;
  123|       |            UPDATE_HASH_KNUTH(hash, val);
  124|       |            uint32_t pos = head[hash];
  125|       |            if (pos < cur_match) {
  126|       |                match_offset = i;
  127|       |                cur_match = pos;
  128|       |            }
  129|       |        }
  130|       |#  endif
  131|       |
  132|       |        /* Update offset-dependent variables */
  133|       |        limit = limit_base+match_offset;
  134|       |        if (UNLIKELY(cur_match <= limit))
  135|       |            return best_len;
  136|       |        mbase_start -= match_offset;
  137|       |        mbase_end -= match_offset;
  138|       |    }
  139|       |#endif
  140|  45.9M|    Assert((unsigned long)strstart <= s->window_size - MIN_LOOKAHEAD, "need lookahead");
  141|  48.6M|    for (;;) {
  142|  48.6M|        if (UNLIKELY(cur_match >= strstart))
  ------------------
  |  |  258|  48.6M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 0, False: 48.6M]
  |  |  ------------------
  ------------------
  143|      0|            break;
  144|       |
  145|       |        /* Skip to next match if the match length cannot increase or if the match length is
  146|       |         * less than 2. Note that the checks below for insufficient lookahead only occur
  147|       |         * occasionally for performance reasons.
  148|       |         * Therefore uninitialized memory will be accessed and conditional jumps will be made
  149|       |         * that depend on those values. However the length of the match is limited to the
  150|       |         * lookahead, so the output of deflate is not affected by the uninitialized values.
  151|       |         */
  152|  48.6M|        uint32_t len;
  153|  48.6M|        if (best_len < sizeof(uint64_t)) {
  ------------------
  |  Branch (153:13): [True: 47.6M, False: 928k]
  ------------------
  154|  47.6M|            uint64_t cand_start = zng_memread_8(mbase_start + cur_match);
  155|  47.6M|            if (scan_start != cand_start) {
  ------------------
  |  Branch (155:17): [True: 47.2M, False: 459k]
  ------------------
  156|       |                /* Peel the first candidate out of the loop. A full 8-byte match falls straight
  157|       |                 * through to compare256, and single-candidate chains (barely-compressible data)
  158|       |                 * run with no loop overhead. */
  159|  47.2M|                uint64_t first_mask = zng_first_bytes_mask64(best_len + 1);
  ------------------
  |  |  138|  47.2M|#  define zng_first_bytes_mask64(n) (UINT64_MAX >> ((8 - (n)) * 8))
  ------------------
  160|  47.2M|                uint64_t diff = scan_start ^ cand_start;
  161|       |                /* A candidate beats best_len only when its first best_len+1 bytes match, i.e.
  162|       |                 * those bytes of the XOR are zero. The masked test rejects without running ctz. */
  163|  47.2M|                if (UNLIKELY((diff & first_mask) == 0)) {
  ------------------
  |  |  258|  47.2M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 2.41M, False: 44.8M]
  |  |  ------------------
  ------------------
  164|  2.41M|                    len = zng_first_diff_byte64(diff);
  ------------------
  |  |  130|  2.41M|#  define zng_first_diff_byte64(diff) (zng_ctz64(diff) / 8)
  ------------------
  165|  2.41M|                    goto short_match_accept;
  166|  2.41M|                }
  167|  44.8M|                if (--chain_length == 0 || (cur_match = prev[cur_match & wmask]) <= limit)
  ------------------
  |  Branch (167:21): [True: 140, False: 44.8M]
  |  Branch (167:44): [True: 33.9M, False: 10.8M]
  ------------------
  168|  33.9M|                    return best_len;
  169|  10.8M|                cand_start = zng_memread_8(mbase_start + cur_match);
  170|  10.8M|                if (scan_start != cand_start) {
  ------------------
  |  Branch (170:21): [True: 10.8M, False: 24.8k]
  ------------------
  171|       |                    /* Walk the remaining candidates with the chain advance kept inline. */
  172|  24.0M|                    for (;;) {
  173|  24.0M|                        diff = scan_start ^ cand_start;
  174|  24.0M|                        if (UNLIKELY((diff & first_mask) == 0)) {
  ------------------
  |  |  258|  24.0M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 322k, False: 23.7M]
  |  |  ------------------
  ------------------
  175|   322k|                            len = zng_first_diff_byte64(diff);
  ------------------
  |  |  130|   322k|#  define zng_first_diff_byte64(diff) (zng_ctz64(diff) / 8)
  ------------------
  176|   322k|                            goto short_match_accept;
  177|   322k|                        }
  178|  23.7M|                        if (--chain_length == 0 || (cur_match = prev[cur_match & wmask]) <= limit)
  ------------------
  |  Branch (178:29): [True: 37.8k, False: 23.6M]
  |  Branch (178:52): [True: 10.3M, False: 13.2M]
  ------------------
  179|  10.4M|                            return best_len;
  180|  13.2M|                        cand_start = zng_memread_8(mbase_start + cur_match);
  181|  13.2M|                        if (scan_start == cand_start)
  ------------------
  |  Branch (181:29): [True: 55.0k, False: 13.2M]
  ------------------
  182|  55.0k|                            break;
  183|  13.2M|                    }
  184|  10.8M|                }
  185|  10.8M|            }
  186|       |            /* All 8 bytes match, fallthrough to compare256 for the tail. */
  187|  47.6M|        } else {
  188|       |            /* Pre-filter the candidate on the start and end sentinels before compare256 using
  189|       |             * simple 8-byte comparison since best_len >= 8. */
  190|  9.63M|            for (;;) {
  191|       |                /* First check the end of the candidate at best_len+1 due to the higher
  192|       |                 * likelihood of a mismatch. */
  193|  9.63M|                if (zng_memcmp_8(mbase_end+cur_match, &scan_end) == 0 &&
  ------------------
  |  Branch (193:21): [True: 619k, False: 9.01M]
  ------------------
  194|   619k|                    zng_memcmp_8(mbase_start+cur_match, &scan_start) == 0)
  ------------------
  |  Branch (194:21): [True: 584k, False: 35.7k]
  ------------------
  195|   584k|                    break;
  196|  9.05M|                GOTO_NEXT_CHAIN;
  ------------------
  |  |   16|  9.05M|    if (--chain_length && (cur_match = prev[cur_match & wmask]) > limit) \
  |  |  ------------------
  |  |  |  Branch (16:9): [True: 9.01M, False: 43.2k]
  |  |  |  Branch (16:27): [True: 8.71M, False: 301k]
  |  |  ------------------
  |  |   17|  8.71M|        continue; \
  |  |   18|   344k|    return best_len;
  ------------------
  197|  9.05M|            }
  198|   928k|        }
  199|  1.12M|        len = COMPARE256(scan+2, mbase_start+cur_match+2) + 2;
  ------------------
  |  |   51|  1.12M|#define COMPARE256          compare256_avx2_static
  ------------------
  200|  1.12M|        Assert(scan+len <= window+(unsigned)(s->window_size-1), "wild scan");
  201|       |
  202|  1.12M|        if (len > best_len)
  ------------------
  |  Branch (202:13): [True: 1.03M, False: 87.1k]
  ------------------
  203|  4.80M|short_match_accept:
  204|  4.80M|        {
  205|  4.80M|            uint32_t match_start = cur_match - match_offset;
  206|  4.80M|            s->match_start = match_start;
  207|       |
  208|       |            /* Do not look for better matches if the current match reaches
  209|       |             * or exceeds the end of the input.
  210|       |             */
  211|  4.80M|            if (UNLIKELY(len >= lookahead))
  ------------------
  |  |  258|  3.76M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 968, False: 3.76M]
  |  |  ------------------
  ------------------
  212|    968|                return lookahead;
  213|  3.76M|            if (UNLIKELY(len >= nice_match))
  ------------------
  |  |  258|  3.76M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 87.9k, False: 3.68M]
  |  |  ------------------
  ------------------
  214|  87.9k|                return len;
  215|       |
  216|  3.68M|            best_len = len;
  217|       |
  218|  3.68M|            offset = best_len >= sizeof(uint64_t) ? best_len - 7 : 0;
  ------------------
  |  Branch (218:22): [True: 947k, False: 2.73M]
  ------------------
  219|       |
  220|  3.68M|            scan_end = zng_memread_8(scan+offset);
  221|       |
  222|       |#ifdef LONGEST_MATCH_SLOW
  223|       |            /* Look for a better string offset */
  224|       |            if (UNLIKELY(offset_search && len > STD_MIN_MATCH && match_start + len < strstart)) {
  225|       |                const unsigned char *scan_endstr;
  226|       |                uint32_t hash;
  227|       |                uint32_t pos, next_pos;
  228|       |
  229|       |                /* Go back to offset 0 */
  230|       |                cur_match -= match_offset;
  231|       |                match_offset = 0;
  232|       |                next_pos = cur_match;
  233|       |
  234|       |                /* Walk prev[] for positions inside the match. The bound keeps
  235|       |                 * the hash window within the match, so we follow chains that
  236|       |                 * share bytes with the current match, not data past its end.
  237|       |                 */
  238|       |#  ifdef LONGEST_MATCH_SLOW_ROLL
  239|       |                for (uint32_t i = 0; i <= len - STD_MIN_MATCH; i++) {
  240|       |#  else /* 4-byte Knuth hash needs len - 4 bound */
  241|       |                for (uint32_t i = 0; i <= len - WANT_MIN_MATCH; i++) {
  242|       |#  endif
  243|       |                    pos = prev[(cur_match + i) & wmask];
  244|       |                    if (UNLIKELY(pos < next_pos)) {
  245|       |                        /* Hash chain is more distant, use it */
  246|       |                        if (UNLIKELY(pos <= limit_base + i))
  247|       |                            return best_len;
  248|       |                        next_pos = pos;
  249|       |                        match_offset = i;
  250|       |                    }
  251|       |                }
  252|       |                /* Switch cur_match to next_pos chain */
  253|       |                cur_match = next_pos;
  254|       |
  255|       |                /* Try hash head at a window covering the tail of the current
  256|       |                 * match to find chains that extend farther back. The window
  257|       |                 * width differs per variant: 3 bytes for rolling, 4 for Knuth.
  258|       |                 */
  259|       |#  ifdef LONGEST_MATCH_SLOW_ROLL
  260|       |                scan_endstr = scan + len - (STD_MIN_MATCH-1);
  261|       |
  262|       |                hash = update_hash_roll(0, scan_endstr[0]);
  263|       |                hash = update_hash_roll(hash, scan_endstr[1]);
  264|       |                hash = update_hash_roll(hash, scan_endstr[2]);
  265|       |
  266|       |                pos = head[hash];
  267|       |                if (UNLIKELY(pos < cur_match)) {
  268|       |                    match_offset = len - (STD_MIN_MATCH-1);
  269|       |                    if (pos <= limit_base + match_offset)
  270|       |                        return best_len;
  271|       |                    cur_match = pos;
  272|       |                }
  273|       |#  else
  274|       |                scan_endstr = scan + len - WANT_MIN_MATCH;
  275|       |                uint32_t val = Z_U32_FROM_LE(zng_memread_4(scan_endstr));
  276|       |                UPDATE_HASH_KNUTH(hash, val);
  277|       |
  278|       |                pos = head[hash];
  279|       |                if (pos < cur_match) {
  280|       |                    match_offset = len - WANT_MIN_MATCH;
  281|       |                    if (pos <= limit_base + match_offset)
  282|       |                        return best_len;
  283|       |                    cur_match = pos;
  284|       |                }
  285|       |#  endif
  286|       |
  287|       |                /* Update offset-dependent variables */
  288|       |                limit = limit_base+match_offset;
  289|       |                mbase_start = window-match_offset;
  290|       |                mbase_end = (mbase_start+offset);
  291|       |                continue;
  292|       |            }
  293|       |#endif
  294|  3.68M|            mbase_end = (mbase_start+offset);
  295|  3.68M|        }
  296|  87.1k|#ifndef LONGEST_MATCH_SLOW
  297|  87.1k|        else if (UNLIKELY(early_exit)) {
  ------------------
  |  |  258|  87.1k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 0, False: 87.1k]
  |  |  ------------------
  ------------------
  298|       |            /* The probability of finding a match later if we here is pretty low, so for
  299|       |             * performance it's best to outright stop here for the lower compression levels
  300|       |             */
  301|      0|            break;
  302|      0|        }
  303|  3.76M|#endif
  304|  3.76M|        GOTO_NEXT_CHAIN;
  ------------------
  |  |   16|  3.76M|    if (--chain_length && (cur_match = prev[cur_match & wmask]) > limit) \
  |  |  ------------------
  |  |  |  Branch (16:9): [True: 3.76M, False: 1.75k]
  |  |  |  Branch (16:27): [True: 2.68M, False: 1.07M]
  |  |  ------------------
  |  |   17|  2.68M|        continue; \
  |  |   18|  1.07M|    return best_len;
  ------------------
  305|  3.76M|    }
  306|      0|    return best_len;
  307|  45.9M|}

test_deflate:
   24|  3.55k|void test_deflate(unsigned char *compr, size_t comprLen) {
   25|  3.55k|    PREFIX3(stream) c_stream; /* compression stream */
  ------------------
  |  |  123|  3.55k|#  define PREFIX3(x) zng_ ## x
  ------------------
   26|  3.55k|    int err;
   27|  3.55k|    unsigned long len = (unsigned long)dataLen;
   28|       |
   29|  3.55k|    c_stream.zalloc = zalloc;
   30|  3.55k|    c_stream.zfree = zfree;
   31|  3.55k|    c_stream.opaque = (void *)0;
   32|       |
   33|  3.55k|    err = PREFIX(deflateInit)(&c_stream, Z_DEFAULT_COMPRESSION);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
                  err = PREFIX(deflateInit)(&c_stream, Z_DEFAULT_COMPRESSION);
  ------------------
  |  |  196|  3.55k|#define Z_DEFAULT_COMPRESSION  (-1)
  ------------------
   34|  3.55k|    CHECK_ERR(err, "deflateInit");
  ------------------
  |  |    9|  3.55k|#define CHECK_ERR(err, msg) { \
  |  |   10|  3.55k|    if (err != Z_OK) { \
  |  |  ------------------
  |  |  |  |  180|  7.10k|#define Z_OK            0
  |  |  ------------------
  |  |  |  Branch (10:9): [True: 0, False: 3.55k]
  |  |  ------------------
  |  |   11|      0|        fprintf(stderr, "%s error: %d\n", msg, err); \
  |  |   12|      0|        exit(1); \
  |  |   13|      0|    } \
  |  |   14|  3.55k|}
  ------------------
   35|       |
   36|  3.55k|    c_stream.next_in = (z_const unsigned char *)data;
   37|  3.55k|    c_stream.next_out = compr;
   38|       |
   39|   285M|    while (c_stream.total_in != len && c_stream.total_out < comprLen) {
  ------------------
  |  Branch (39:12): [True: 285M, False: 3.55k]
  |  Branch (39:40): [True: 285M, False: 0]
  ------------------
   40|   285M|        c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */
   41|   285M|        err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH);
  ------------------
  |  |  121|   285M|#  define PREFIX(x) zng_ ## x
  ------------------
                      err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH);
  ------------------
  |  |  171|   285M|#define Z_NO_FLUSH      0
  ------------------
   42|   285M|        CHECK_ERR(err, "deflate small 1");
  ------------------
  |  |    9|   285M|#define CHECK_ERR(err, msg) { \
  |  |   10|   285M|    if (err != Z_OK) { \
  |  |  ------------------
  |  |  |  |  180|   571M|#define Z_OK            0
  |  |  ------------------
  |  |  |  Branch (10:9): [True: 0, False: 285M]
  |  |  ------------------
  |  |   11|      0|        fprintf(stderr, "%s error: %d\n", msg, err); \
  |  |   12|      0|        exit(1); \
  |  |   13|      0|    } \
  |  |   14|   285M|}
  ------------------
   43|   285M|    }
   44|       |    /* Finish the stream, still forcing small buffers: */
   45|  9.29M|    for (;;) {
   46|  9.29M|        c_stream.avail_out = 1;
   47|  9.29M|        err = PREFIX(deflate)(&c_stream, Z_FINISH);
  ------------------
  |  |  121|  9.29M|#  define PREFIX(x) zng_ ## x
  ------------------
                      err = PREFIX(deflate)(&c_stream, Z_FINISH);
  ------------------
  |  |  175|  9.29M|#define Z_FINISH        4
  ------------------
   48|  9.29M|        if (err == Z_STREAM_END)
  ------------------
  |  |  181|  9.29M|#define Z_STREAM_END    1
  ------------------
  |  Branch (48:13): [True: 3.55k, False: 9.28M]
  ------------------
   49|  3.55k|            break;
   50|  9.28M|        CHECK_ERR(err, "deflate small 2");
  ------------------
  |  |    9|  9.28M|#define CHECK_ERR(err, msg) { \
  |  |   10|  9.28M|    if (err != Z_OK) { \
  |  |  ------------------
  |  |  |  |  180|  18.5M|#define Z_OK            0
  |  |  ------------------
  |  |  |  Branch (10:9): [True: 0, False: 9.28M]
  |  |  ------------------
  |  |   11|      0|        fprintf(stderr, "%s error: %d\n", msg, err); \
  |  |   12|      0|        exit(1); \
  |  |   13|      0|    } \
  |  |   14|  9.28M|}
  ------------------
   51|  9.28M|    }
   52|       |
   53|  3.55k|    err = PREFIX(deflateEnd)(&c_stream);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
   54|  3.55k|    CHECK_ERR(err, "deflateEnd");
  ------------------
  |  |    9|  3.55k|#define CHECK_ERR(err, msg) { \
  |  |   10|  3.55k|    if (err != Z_OK) { \
  |  |  ------------------
  |  |  |  |  180|  7.10k|#define Z_OK            0
  |  |  ------------------
  |  |  |  Branch (10:9): [True: 0, False: 3.55k]
  |  |  ------------------
  |  |   11|      0|        fprintf(stderr, "%s error: %d\n", msg, err); \
  |  |   12|      0|        exit(1); \
  |  |   13|      0|    } \
  |  |   14|  3.55k|}
  ------------------
   55|  3.55k|}
test_inflate:
   60|  3.55k|void test_inflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen) {
   61|  3.55k|    int err;
   62|  3.55k|    PREFIX3(stream) d_stream; /* decompression stream */
  ------------------
  |  |  123|  3.55k|#  define PREFIX3(x) zng_ ## x
  ------------------
   63|       |
   64|  3.55k|    d_stream.zalloc = zalloc;
   65|  3.55k|    d_stream.zfree = zfree;
   66|  3.55k|    d_stream.opaque = (void *)0;
   67|       |
   68|  3.55k|    d_stream.next_in = compr;
   69|  3.55k|    d_stream.avail_in = 0;
   70|  3.55k|    d_stream.next_out = uncompr;
   71|       |
   72|  3.55k|    err = PREFIX(inflateInit)(&d_stream);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
   73|  3.55k|    CHECK_ERR(err, "inflateInit");
  ------------------
  |  |    9|  3.55k|#define CHECK_ERR(err, msg) { \
  |  |   10|  3.55k|    if (err != Z_OK) { \
  |  |  ------------------
  |  |  |  |  180|  7.10k|#define Z_OK            0
  |  |  ------------------
  |  |  |  Branch (10:9): [True: 0, False: 3.55k]
  |  |  ------------------
  |  |   11|      0|        fprintf(stderr, "%s error: %d\n", msg, err); \
  |  |   12|      0|        exit(1); \
  |  |   13|      0|    } \
  |  |   14|  3.55k|}
  ------------------
   74|       |
   75|   171M|    while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) {
  ------------------
  |  Branch (75:12): [True: 171M, False: 3.55k]
  |  Branch (75:47): [True: 171M, False: 0]
  ------------------
   76|   171M|        d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */
   77|   171M|        err = PREFIX(inflate)(&d_stream, Z_NO_FLUSH);
  ------------------
  |  |  121|   171M|#  define PREFIX(x) zng_ ## x
  ------------------
                      err = PREFIX(inflate)(&d_stream, Z_NO_FLUSH);
  ------------------
  |  |  171|   171M|#define Z_NO_FLUSH      0
  ------------------
   78|   171M|        if (err == Z_STREAM_END)
  ------------------
  |  |  181|   171M|#define Z_STREAM_END    1
  ------------------
  |  Branch (78:13): [True: 0, False: 171M]
  ------------------
   79|      0|            break;
   80|   171M|        CHECK_ERR(err, "inflate");
  ------------------
  |  |    9|   171M|#define CHECK_ERR(err, msg) { \
  |  |   10|   171M|    if (err != Z_OK) { \
  |  |  ------------------
  |  |  |  |  180|   342M|#define Z_OK            0
  |  |  ------------------
  |  |  |  Branch (10:9): [True: 0, False: 171M]
  |  |  ------------------
  |  |   11|      0|        fprintf(stderr, "%s error: %d\n", msg, err); \
  |  |   12|      0|        exit(1); \
  |  |   13|      0|    } \
  |  |   14|   171M|}
  ------------------
   81|   171M|    }
   82|       |
   83|  3.55k|    err = PREFIX(inflateEnd)(&d_stream);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
   84|  3.55k|    CHECK_ERR(err, "inflateEnd");
  ------------------
  |  |    9|  3.55k|#define CHECK_ERR(err, msg) { \
  |  |   10|  3.55k|    if (err != Z_OK) { \
  |  |  ------------------
  |  |  |  |  180|  7.10k|#define Z_OK            0
  |  |  ------------------
  |  |  |  Branch (10:9): [True: 0, False: 3.55k]
  |  |  ------------------
  |  |   11|      0|        fprintf(stderr, "%s error: %d\n", msg, err); \
  |  |   12|      0|        exit(1); \
  |  |   13|      0|    } \
  |  |   14|  3.55k|}
  ------------------
   85|       |
   86|  3.55k|    if (memcmp(uncompr, data, dataLen)) {
  ------------------
  |  Branch (86:9): [True: 0, False: 3.55k]
  ------------------
   87|       |        fprintf(stderr, "bad inflate\n");
   88|      0|        exit(1);
   89|      0|    }
   90|  3.55k|}
LLVMFuzzerTestOneInput:
   92|  3.55k|int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size) {
   93|  3.55k|    size_t comprLen = PREFIX(compressBound)((z_uintmax_t)size);
  ------------------
  |  |  121|  3.55k|#  define PREFIX(x) zng_ ## x
  ------------------
   94|  3.55k|    size_t uncomprLen = size;
   95|  3.55k|    uint8_t *compr, *uncompr;
   96|       |
   97|       |    /* Discard inputs larger than 1Mb. */
   98|  3.55k|    static size_t kMaxSize = 1024 * 1024;
   99|       |
  100|  3.55k|    if (size < 1 || size > kMaxSize)
  ------------------
  |  Branch (100:9): [True: 0, False: 3.55k]
  |  Branch (100:21): [True: 0, False: 3.55k]
  ------------------
  101|      0|        return 0;
  102|       |
  103|  3.55k|    data = d;
  104|  3.55k|    dataLen = size;
  105|  3.55k|    compr = (uint8_t *)calloc(1, comprLen);
  106|  3.55k|    uncompr = (uint8_t *)calloc(1, uncomprLen);
  107|       |
  108|  3.55k|    test_deflate(compr, comprLen);
  109|  3.55k|    test_inflate(compr, comprLen, uncompr, uncomprLen);
  110|       |
  111|  3.55k|    free(compr);
  112|  3.55k|    free(uncompr);
  113|       |
  114|       |    /* This function must return 0. */
  115|  3.55k|    return 0;
  116|  3.55k|}

zng_tr_init:
   83|  3.55k|void Z_INTERNAL zng_tr_init(deflate_state *s) {
   84|  3.55k|    s->l_desc.dyn_tree = s->dyn_ltree;
   85|  3.55k|    s->l_desc.stat_desc = &static_l_desc;
   86|       |
   87|  3.55k|    s->d_desc.dyn_tree = s->dyn_dtree;
   88|  3.55k|    s->d_desc.stat_desc = &static_d_desc;
   89|       |
   90|  3.55k|    s->bl_desc.dyn_tree = s->bl_tree;
   91|  3.55k|    s->bl_desc.stat_desc = &static_bl_desc;
   92|       |
   93|  3.55k|    s->bi_buf = 0;
   94|  3.55k|    s->bi_valid = 0;
   95|  3.55k|    s->bi_used = 0;
   96|       |#ifdef ZLIB_DEBUG
   97|       |    s->compressed_len = 0L;
   98|       |    s->bits_sent = 0L;
   99|       |#endif
  100|       |
  101|       |    /* Initialize the first block of the first file: */
  102|  3.55k|    init_block(s);
  103|  3.55k|}
gen_codes:
  383|  33.6k|Z_INTERNAL void gen_codes(ct_data *tree, int max_code, uint16_t *bl_count) {
  384|       |    /* tree: the tree to decorate */
  385|       |    /* max_code: largest code with non zero frequency */
  386|       |    /* bl_count: number of codes at each bit length */
  387|  33.6k|    uint16_t next_code[MAX_BITS+1];  /* next code value for each bit length */
  388|  33.6k|    uint16_t code = 0;               /* running code value */
  389|  33.6k|    int bits;                        /* bit index */
  390|  33.6k|    int n;                           /* code index */
  391|       |
  392|       |    /* The distribution counts are first used to generate the code values
  393|       |     * without bit reversal.
  394|       |     */
  395|   537k|    for (bits = 1; bits <= MAX_BITS; bits++) {
  ------------------
  |  |   41|   537k|#define MAX_BITS 15
  ------------------
  |  Branch (395:20): [True: 504k, False: 33.6k]
  ------------------
  396|   504k|        code = (code + bl_count[bits-1]) << 1;
  397|   504k|        next_code[bits] = code;
  398|   504k|    }
  399|       |    /* Check that the bit counts in bl_count are consistent. The last code
  400|       |     * must be all ones.
  401|       |     */
  402|  33.6k|    Assert(code + bl_count[MAX_BITS]-1 == (1 << MAX_BITS)-1, "inconsistent bit counts");
  403|  33.6k|    Tracev((stderr, "\ngen_codes: max_code %d ", max_code));
  404|       |
  405|  3.46M|    for (n = 0;  n <= max_code; n++) {
  ------------------
  |  Branch (405:18): [True: 3.42M, False: 33.6k]
  ------------------
  406|  3.42M|        int len = tree[n].Len;
  ------------------
  |  |  138|  3.42M|#define Len  dl.len
  ------------------
  407|  3.42M|        if (len == 0)
  ------------------
  |  Branch (407:13): [True: 1.16M, False: 2.25M]
  ------------------
  408|  1.16M|            continue;
  409|       |        /* Now reverse the bits */
  410|  2.25M|        tree[n].Code = bi_reverse(next_code[len]++, len);
  ------------------
  |  |  136|  2.25M|#define Code fc.code
  ------------------
  411|       |
  412|  2.25M|        Tracecv(tree != static_ltree, (stderr, "\nn %3d %c l %2d c %4x (%x) ",
  413|  2.25M|             n, (isgraph(n & 0xff) ? n : ' '), len, tree[n].Code, next_code[len]-1));
  414|  2.25M|    }
  415|  33.6k|}
zng_tr_stored_block:
  602|  1.57k|void Z_INTERNAL zng_tr_stored_block(deflate_state *s, unsigned char *buf, uint32_t stored_len, int last) {
  603|       |    /* buf: input block */
  604|       |    /* stored_len: length of input block */
  605|       |    /* last: one if this is the last block for a file */
  606|  1.57k|    zng_tr_emit_tree(s, STORED_BLOCK, last); /* send block type */
  ------------------
  |  |   56|  1.57k|#define STORED_BLOCK 0
  ------------------
  607|  1.57k|    zng_tr_emit_align(s);                    /* align on byte boundary */
  608|  1.57k|    cmpr_bits_align(s);
  609|  1.57k|    put_short(s, (uint16_t)stored_len);
  610|  1.57k|    put_short(s, (uint16_t)~stored_len);
  611|  1.57k|    cmpr_bits_add(s, 32);
  ------------------
  |  |  459|  1.57k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  154|  1.57k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  612|  1.57k|    sent_bits_add(s, 32);
  ------------------
  |  |  461|  1.57k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  ------------------
  |  |  |  |  154|  1.57k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  613|  1.57k|    if (stored_len) {
  ------------------
  |  Branch (613:9): [True: 1.57k, False: 0]
  ------------------
  614|  1.57k|        memcpy(s->pending_buf + s->pending, buf, stored_len);
  615|  1.57k|        s->pending += stored_len;
  616|  1.57k|        cmpr_bits_add(s, stored_len << 3);
  ------------------
  |  |  459|  1.57k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  154|  1.57k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  617|  1.57k|        sent_bits_add(s, stored_len << 3);
  ------------------
  |  |  461|  1.57k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  ------------------
  |  |  |  |  154|  1.57k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  618|  1.57k|    }
  619|  1.57k|}
zng_tr_flush_block:
  635|  11.2k|void Z_INTERNAL zng_tr_flush_block(deflate_state *s, unsigned char *buf, uint32_t stored_len, int last) {
  636|       |    /* buf: input block, or NULL if too old */
  637|       |    /* stored_len: length of input block */
  638|       |    /* last: one if this is the last block for a file */
  639|  11.2k|    unsigned int opt_lenb, static_lenb; /* opt_len and static_len in bytes */
  640|  11.2k|    int max_blindex = 0;  /* index of last bit length code of non zero freq */
  641|       |
  642|       |    /* Build the Huffman trees unless a stored block is forced */
  643|  11.2k|    if (UNLIKELY(s->sym_next == 0)) {
  ------------------
  |  |  258|  11.2k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (258:33): [True: 38, False: 11.2k]
  |  |  ------------------
  ------------------
  644|       |        /* Emit an empty static tree block with no codes */
  645|     38|        opt_lenb = static_lenb = 0;
  646|     38|        s->static_len = 7;
  647|  11.2k|    } else if (s->level > 0) {
  ------------------
  |  Branch (647:16): [True: 11.2k, False: 0]
  ------------------
  648|       |        /* Check if the file is binary or text */
  649|  11.2k|        if (s->strm->data_type == Z_UNKNOWN)
  ------------------
  |  |  209|  11.2k|#define Z_UNKNOWN  2
  ------------------
  |  Branch (649:13): [True: 3.55k, False: 7.65k]
  ------------------
  650|  3.55k|            s->strm->data_type = detect_data_type(s);
  651|       |
  652|       |        /* Construct the literal and distance trees */
  653|  11.2k|        build_tree(s, (tree_desc *)(&(s->l_desc)));
  654|  11.2k|        Tracev((stderr, "\nlit data: dyn %u, stat %u", s->opt_len, s->static_len));
  655|       |
  656|  11.2k|        build_tree(s, (tree_desc *)(&(s->d_desc)));
  657|  11.2k|        Tracev((stderr, "\ndist data: dyn %u, stat %u", s->opt_len, s->static_len));
  658|       |        /* At this point, opt_len and static_len are the total bit lengths of
  659|       |         * the compressed block data, excluding the tree representations.
  660|       |         */
  661|       |
  662|       |        /* Build the bit length tree for the above two trees, and get the index
  663|       |         * in bl_order of the last bit length code to send.
  664|       |         */
  665|  11.2k|        max_blindex = build_bl_tree(s);
  666|       |
  667|       |        /* Determine the best encoding. Compute the block lengths in bytes. */
  668|  11.2k|        opt_lenb = (s->opt_len + 3 + 7) >> 3;
  669|  11.2k|        static_lenb = (s->static_len + 3 + 7) >> 3;
  670|       |
  671|  11.2k|        Tracev((stderr, "\nopt %u(%u) stat %u(%u) stored %u lit %u ",
  672|  11.2k|                opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
  673|  11.2k|                s->sym_next / 3));
  674|       |
  675|  11.2k|        if (static_lenb <= opt_lenb || s->strategy == Z_FIXED)
  ------------------
  |  |  202|  9.18k|#define Z_FIXED               4
  ------------------
  |  Branch (675:13): [True: 2.02k, False: 9.18k]
  |  Branch (675:40): [True: 0, False: 9.18k]
  ------------------
  676|  2.02k|            opt_lenb = static_lenb;
  677|       |
  678|  11.2k|    } else {
  679|      0|        Assert(buf != NULL, "lost buf");
  680|      0|        opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
  681|      0|    }
  682|       |
  683|  11.2k|    if (stored_len+4 <= opt_lenb && buf != NULL) {
  ------------------
  |  Branch (683:9): [True: 1.57k, False: 9.67k]
  |  Branch (683:37): [True: 1.57k, False: 0]
  ------------------
  684|       |        /* 4: two words for the lengths
  685|       |         * The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
  686|       |         * Otherwise we can't have processed more than WSIZE input bytes since
  687|       |         * the last block flush, because compression would have been
  688|       |         * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
  689|       |         * transform a block into a stored block.
  690|       |         */
  691|  1.57k|        zng_tr_stored_block(s, buf, stored_len, last);
  692|       |
  693|  9.67k|    } else if (static_lenb == opt_lenb) {
  ------------------
  |  Branch (693:16): [True: 1.87k, False: 7.79k]
  ------------------
  694|  1.87k|        zng_tr_emit_tree(s, STATIC_TREES, last);
  ------------------
  |  |   57|  1.87k|#define STATIC_TREES 1
  ------------------
  695|  1.87k|        compress_block(s, (const ct_data *)static_ltree, (const ct_data *)static_dtree);
  696|  1.87k|        cmpr_bits_add(s, s->static_len);
  ------------------
  |  |  459|  1.87k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  154|  1.87k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  697|  7.79k|    } else {
  698|  7.79k|        zng_tr_emit_tree(s, DYN_TREES, last);
  ------------------
  |  |   58|  7.79k|#define DYN_TREES    2
  ------------------
  699|  7.79k|        send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, max_blindex+1);
  700|  7.79k|        compress_block(s, (const ct_data *)s->dyn_ltree, (const ct_data *)s->dyn_dtree);
  701|  7.79k|        cmpr_bits_add(s, s->opt_len);
  ------------------
  |  |  459|  7.79k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  154|  7.79k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  702|  7.79k|    }
  703|  11.2k|    Assert(s->compressed_len == s->bits_sent, "bad compressed size");
  704|       |    /* The above check is made mod 2^32, for files larger than 512 MB
  705|       |     * and unsigned long implemented on 32 bits.
  706|       |     */
  707|  11.2k|    init_block(s);
  708|       |
  709|  11.2k|    if (last) {
  ------------------
  |  Branch (709:9): [True: 3.55k, False: 7.69k]
  ------------------
  710|  3.55k|        zng_tr_emit_align(s);
  711|  3.55k|    }
  712|  11.2k|    Tracev((stderr, "\ncomprlen %lu(%lu) ", s->compressed_len>>3, s->compressed_len-7*last));
  713|  11.2k|}
zng_tr_flush_bits:
  857|   125M|void Z_INTERNAL zng_tr_flush_bits(deflate_state *s) {
  858|   125M|    if (s->bi_valid >= 48) {
  ------------------
  |  Branch (858:9): [True: 9, False: 125M]
  ------------------
  859|      9|        put_uint32(s, (uint32_t)s->bi_buf);
  860|      9|        put_short(s, (uint16_t)(s->bi_buf >> 32));
  861|      9|        s->bi_buf >>= 48;
  862|      9|        s->bi_valid -= 48;
  863|   125M|    } else if (s->bi_valid >= 32) {
  ------------------
  |  Branch (863:16): [True: 179, False: 125M]
  ------------------
  864|    179|        put_uint32(s, (uint32_t)s->bi_buf);
  865|    179|        s->bi_buf >>= 32;
  866|    179|        s->bi_valid -= 32;
  867|    179|    }
  868|   125M|    if (s->bi_valid >= 16) {
  ------------------
  |  Branch (868:9): [True: 6.20k, False: 125M]
  ------------------
  869|  6.20k|        put_short(s, (uint16_t)s->bi_buf);
  870|  6.20k|        s->bi_buf >>= 16;
  871|  6.20k|        s->bi_valid -= 16;
  872|  6.20k|    }
  873|   125M|    if (s->bi_valid >= 8) {
  ------------------
  |  Branch (873:9): [True: 3.06k, False: 125M]
  ------------------
  874|  3.06k|        put_byte(s, s->bi_buf);
  ------------------
  |  |  360|  3.06k|#define put_byte(s, c) { \
  |  |  361|  3.06k|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  362|  3.06k|}
  ------------------
  875|  3.06k|        s->bi_buf >>= 8;
  876|  3.06k|        s->bi_valid -= 8;
  877|  3.06k|    }
  878|   125M|}
trees.c:init_block:
  108|  14.7k|static void init_block(deflate_state *s) {
  109|  14.7k|    int n; /* iterates over tree elements */
  110|       |
  111|       |    /* Initialize the trees. */
  112|  4.24M|    for (n = 0; n < L_CODES;  n++)
  ------------------
  |  |   48|  4.24M|#define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  ------------------
  |  |  |  |   45|  4.24M|#define LITERALS  256
  |  |  ------------------
  |  |               #define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  ------------------
  |  |  |  |   42|  4.24M|#define LENGTH_CODES 29
  |  |  ------------------
  ------------------
  |  Branch (112:17): [True: 4.23M, False: 14.7k]
  ------------------
  113|  4.23M|        s->dyn_ltree[n].Freq = 0;
  ------------------
  |  |  135|  4.23M|#define Freq fc.freq
  ------------------
  114|   458k|    for (n = 0; n < D_CODES;  n++)
  ------------------
  |  |   51|   458k|#define D_CODES   30
  ------------------
  |  Branch (114:17): [True: 443k, False: 14.7k]
  ------------------
  115|   443k|        s->dyn_dtree[n].Freq = 0;
  ------------------
  |  |  135|   443k|#define Freq fc.freq
  ------------------
  116|   295k|    for (n = 0; n < BL_CODES; n++)
  ------------------
  |  |   54|   295k|#define BL_CODES  19
  ------------------
  |  Branch (116:17): [True: 281k, False: 14.7k]
  ------------------
  117|   281k|        s->bl_tree[n].Freq = 0;
  ------------------
  |  |  135|   281k|#define Freq fc.freq
  ------------------
  118|       |
  119|  14.7k|    s->dyn_ltree[END_BLOCK].Freq = 1;
  ------------------
  |  |   63|  14.7k|#define END_BLOCK 256
  ------------------
                  s->dyn_ltree[END_BLOCK].Freq = 1;
  ------------------
  |  |  135|  14.7k|#define Freq fc.freq
  ------------------
  120|  14.7k|    s->opt_len = s->static_len = 0;
  121|  14.7k|    s->sym_next = 0;
  122|  14.7k|}
trees.c:build_tree:
  165|  33.6k|static void build_tree(deflate_state *s, tree_desc *desc) {
  166|       |    /* desc: the tree descriptor */
  167|  33.6k|    ct_data *tree         = desc->dyn_tree;
  168|  33.6k|    const ct_data *stree  = desc->stat_desc->static_tree;
  169|  33.6k|    int elems             = desc->stat_desc->elems;
  170|  33.6k|    int n, m;          /* iterate over heap elements */
  171|  33.6k|    int max_code = -1; /* largest code with non zero frequency */
  172|  33.6k|    int node;          /* new node being created */
  173|  33.6k|    int nleaves = 0;
  174|  33.6k|    int li = 0, ihead = 0, itail = 0;  /* queue positions for leaves and internal nodes */
  175|  33.6k|    int merges;
  176|  33.6k|    uint32_t *leaves = s->pq_leaves;   /* packed leaf entries, sorted by frequency */
  177|  33.6k|    uint32_t *scratch = s->pq_scratch; /* radix buffer, then FIFO of created internal nodes */
  178|  33.6k|    uint32_t *sorted = leaves;         /* sorted leaves, in scratch after a single pass */
  179|  33.6k|    uint32_t *internals = scratch;     /* internal node FIFO, in whichever buffer is free */
  180|  33.6k|    uint16_t count_lo[257];            /* histogram of the low frequency byte, at offset +1 */
  181|  33.6k|    uint16_t count_hi[257];            /* histogram of the high frequency byte, at offset +1 */
  182|       |
  183|  33.6k|    memset(count_lo, 0, sizeof(count_lo));
  184|  33.6k|    memset(count_hi, 0, sizeof(count_hi));
  185|  3.78M|    for (n = 0; n < elems; n++) {
  ------------------
  |  Branch (185:17): [True: 3.75M, False: 33.6k]
  ------------------
  186|  3.75M|        const uint16_t freq = tree[n].Freq;
  ------------------
  |  |  135|  3.75M|#define Freq fc.freq
  ------------------
  187|  3.75M|        if (freq != 0) {
  ------------------
  |  Branch (187:13): [True: 2.25M, False: 1.50M]
  ------------------
  188|  2.25M|            leaves[nleaves++] = pq_pack(freq, n);
  ------------------
  |  |  128|  2.25M|#define pq_pack(freq, node) (((uint32_t)(freq) << PQ_NODE_BITS) | (unsigned)(node))
  |  |  ------------------
  |  |  |  |  127|  2.25M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  189|  2.25M|            count_lo[(freq & 0xFF) + 1]++;
  190|  2.25M|            count_hi[(freq >> 8) + 1]++;
  191|  2.25M|            max_code = n;
  192|  2.25M|        } else {
  193|  1.50M|            tree[n].Len = 0;
  ------------------
  |  |  138|  1.50M|#define Len  dl.len
  ------------------
  194|  1.50M|        }
  195|  3.75M|    }
  196|       |
  197|       |    /* The pkzip format requires that at least one distance code exists,
  198|       |     * and that at least one bit should be sent even if there is only one
  199|       |     * possible code. So to avoid special checks later on we force at least
  200|       |     * two codes of non zero frequency.
  201|       |     */
  202|  40.3k|    while (nleaves < 2) {
  ------------------
  |  Branch (202:12): [True: 6.69k, False: 33.6k]
  ------------------
  203|  6.69k|        node = (max_code < 2 ? ++max_code : 0);
  ------------------
  |  Branch (203:17): [True: 6.17k, False: 527]
  ------------------
  204|  6.69k|        leaves[nleaves++] = pq_pack(1, node);
  ------------------
  |  |  128|  6.69k|#define pq_pack(freq, node) (((uint32_t)(freq) << PQ_NODE_BITS) | (unsigned)(node))
  |  |  ------------------
  |  |  |  |  127|  6.69k|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  205|  6.69k|        tree[node].Freq = 1;
  ------------------
  |  |  135|  6.69k|#define Freq fc.freq
  ------------------
  206|  6.69k|        s->opt_len--;
  207|  6.69k|        if (stree)
  ------------------
  |  Branch (207:13): [True: 6.69k, False: 0]
  ------------------
  208|  6.69k|            s->static_len -= stree[node].Len;
  ------------------
  |  |  138|  6.69k|#define Len  dl.len
  ------------------
  209|       |        /* node is 0 or 1 so it does not have extra bits */
  210|  6.69k|    }
  211|  33.6k|    desc->max_code = max_code;
  212|       |
  213|       |    /* Sort the leaves by packed entry. The scan above appended them in node order, which is
  214|       |     * ascending in the node bits, so two stable passes over the freq bytes finish the sort.
  215|       |     * A forced node can arrive out of node order, but then there are exactly two leaves,
  216|       |     * so the radix path only ever sorts entries the histograms counted. */
  217|  33.6k|    if (nleaves == 2) {
  ------------------
  |  Branch (217:9): [True: 5.18k, False: 28.4k]
  ------------------
  218|  5.18k|        if (leaves[0] > leaves[1]) {
  ------------------
  |  Branch (218:13): [True: 870, False: 4.31k]
  ------------------
  219|    870|            const uint32_t t = leaves[0];
  220|    870|            leaves[0] = leaves[1];
  221|    870|            leaves[1] = t;
  222|    870|        }
  223|  28.4k|    } else if ((int)count_hi[1] == nleaves) {
  ------------------
  |  Branch (223:16): [True: 23.9k, False: 4.51k]
  ------------------
  224|       |        /* Every frequency fits in one byte, so the first pass already produces the final
  225|       |         * order. The sorted entries then live in scratch, so the internal-node FIFO takes
  226|       |         * over the leaves buffer instead. */
  227|  23.9k|        pq_radix_pass(leaves, scratch, nleaves, PQ_NODE_BITS, count_lo);
  ------------------
  |  |  127|  23.9k|#define PQ_NODE_BITS 10
  ------------------
  228|  23.9k|        sorted = scratch;
  229|  23.9k|        internals = leaves;
  230|  23.9k|    } else {
  231|       |        /* Sort by the low then high frequency byte, ending back in leaves. */
  232|  4.51k|        pq_radix_pass(leaves, scratch, nleaves, PQ_NODE_BITS, count_lo);
  ------------------
  |  |  127|  4.51k|#define PQ_NODE_BITS 10
  ------------------
  233|  4.51k|        pq_radix_pass(scratch, leaves, nleaves, PQ_NODE_BITS + 8, count_hi);
  ------------------
  |  |  127|  4.51k|#define PQ_NODE_BITS 10
  ------------------
  234|  4.51k|    }
  235|       |
  236|       |    /* Construct the Huffman tree by repeatedly combining the least two frequent nodes.
  237|       |     * Sorted leaves and the FIFO of created nodes are each ascending, because merge sums
  238|       |     * never decrease, so the two smallest nodes are always at the queue heads.
  239|       |     */
  240|  33.6k|    node = elems;              /* next internal node of the tree */
  241|  2.25M|    for (merges = nleaves - 1; merges > 0; merges--) {
  ------------------
  |  Branch (241:32): [True: 2.22M, False: 33.6k]
  ------------------
  242|       |        /* en = entry of least frequency, em = entry of next least frequency */
  243|  2.22M|        const uint32_t en = pq_take(sorted, &li, nleaves, internals, &ihead, itail);
  244|  2.22M|        const uint32_t em = pq_take(sorted, &li, nleaves, internals, &ihead, itail);
  245|  2.22M|        n = pq_node(en);
  ------------------
  |  |  129|  2.22M|#define pq_node(e)  ((int)((e) & ((1u << PQ_NODE_BITS) - 1)))
  |  |  ------------------
  |  |  |  |  127|  2.22M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  246|  2.22M|        m = pq_node(em);
  ------------------
  |  |  129|  2.22M|#define pq_node(e)  ((int)((e) & ((1u << PQ_NODE_BITS) - 1)))
  |  |  ------------------
  |  |  |  |  127|  2.22M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  247|       |
  248|       |        /* Create a new node father of n and m. Freq wraps the same way the uint16_t
  249|       |         * state field did. */
  250|  2.22M|        const uint16_t f = (uint16_t)(pq_freq(en) + pq_freq(em));
  ------------------
  |  |  130|  2.22M|#define pq_freq(e)  ((e) >> PQ_NODE_BITS)
  |  |  ------------------
  |  |  |  |  127|  2.22M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
                      const uint16_t f = (uint16_t)(pq_freq(en) + pq_freq(em));
  ------------------
  |  |  130|  2.22M|#define pq_freq(e)  ((e) >> PQ_NODE_BITS)
  |  |  ------------------
  |  |  |  |  127|  2.22M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  251|  2.22M|        tree[node].Freq = f;
  ------------------
  |  |  135|  2.22M|#define Freq fc.freq
  ------------------
  252|  2.22M|        tree[n].Dad = tree[m].Dad = (uint16_t)node;
  ------------------
  |  |  137|  2.22M|#define Dad  dl.dad
  ------------------
                      tree[n].Dad = tree[m].Dad = (uint16_t)node;
  ------------------
  |  |  137|  2.22M|#define Dad  dl.dad
  ------------------
  253|       |#ifdef DUMP_BL_TREE
  254|       |        if (tree == s->bl_tree) {
  255|       |            fprintf(stderr, "\nnode %d(%d), sons %d(%d) %d(%d)",
  256|       |                    node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
  257|       |        }
  258|       |#endif
  259|       |        /* and append the new node to the internal queue */
  260|  2.22M|        internals[itail++] = pq_pack(f, node);
  ------------------
  |  |  128|  2.22M|#define pq_pack(freq, node) (((uint32_t)(freq) << PQ_NODE_BITS) | (unsigned)(node))
  |  |  ------------------
  |  |  |  |  127|  2.22M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  261|  2.22M|        node++;
  262|  2.22M|    }
  263|       |
  264|       |    /* At this point, the fields freq and dad are set. We can now
  265|       |     * generate the bit lengths.
  266|       |     */
  267|  33.6k|    gen_bitlen(s, (tree_desc *)desc, sorted, nleaves, node - 1);
  268|       |
  269|       |    /* The field len is now set, we can generate the bit codes */
  270|  33.6k|    gen_codes((ct_data *)tree, max_code, s->bl_count);
  271|  33.6k|}
trees.c:pq_radix_pass:
  137|  32.9k|static void pq_radix_pass(const uint32_t *src, uint32_t *dst, int n, int shift, uint16_t *count) {
  138|  32.9k|    int i;
  139|       |
  140|  8.46M|    for (i = 1; i <= 256; i++)
  ------------------
  |  Branch (140:17): [True: 8.43M, False: 32.9k]
  ------------------
  141|  8.43M|        count[i] = (uint16_t)(count[i] + count[i-1]);
  142|  3.09M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (142:17): [True: 3.06M, False: 32.9k]
  ------------------
  143|  3.06M|        dst[count[(src[i] >> shift) & 0xFF]++] = src[i];
  144|  32.9k|}
trees.c:pq_take:
  151|  4.44M|                               const uint32_t *internals, int *ihead, int itail) {
  152|  4.44M|    if (*li < nleaves && (*ihead == itail || leaves[*li] < internals[*ihead]))
  ------------------
  |  Branch (152:9): [True: 3.46M, False: 980k]
  |  Branch (152:27): [True: 81.4k, False: 3.38M]
  |  Branch (152:46): [True: 2.17M, False: 1.21M]
  ------------------
  153|  2.25M|        return leaves[(*li)++];
  154|  2.19M|    return internals[(*ihead)++];
  155|  4.44M|}
trees.c:gen_bitlen:
  283|  33.6k|static void gen_bitlen(deflate_state *s, tree_desc *desc, const uint32_t *sorted, int nleaves, int root) {
  284|       |    /* desc: the tree descriptor */
  285|  33.6k|    ct_data *tree           = desc->dyn_tree;
  286|  33.6k|    int elems               = desc->stat_desc->elems;
  287|  33.6k|    const ct_data *stree    = desc->stat_desc->static_tree;
  288|  33.6k|    const int *extra        = desc->stat_desc->extra_bits;
  289|  33.6k|    int base                = desc->stat_desc->extra_base;
  290|  33.6k|    unsigned int max_length = desc->stat_desc->max_length;
  291|  33.6k|    int i;              /* index into sorted */
  292|  33.6k|    int n, m;           /* iterate over the tree elements */
  293|  33.6k|    unsigned int bits;  /* bit length */
  294|  33.6k|    int xbits;          /* extra bits */
  295|  33.6k|    uint16_t f;         /* frequency */
  296|  33.6k|    int overflow = 0;   /* number of elements with bit length too large */
  297|       |
  298|   571k|    for (bits = 0; bits <= MAX_BITS; bits++)
  ------------------
  |  |   41|   571k|#define MAX_BITS 15
  ------------------
  |  Branch (298:20): [True: 537k, False: 33.6k]
  ------------------
  299|   537k|        s->bl_count[bits] = 0;
  300|       |
  301|       |    /* In a first pass, compute the optimal bit lengths (which may
  302|       |     * overflow in the case of the bit length tree).
  303|       |     */
  304|  33.6k|    tree[root].Len = 0; /* root of the tree */
  ------------------
  |  |  138|  33.6k|#define Len  dl.len
  ------------------
  305|       |
  306|       |    /* Dads are created after their sons, so a descending walk visits each dad first */
  307|  2.22M|    for (n = root - 1; n >= elems; n--) {
  ------------------
  |  Branch (307:24): [True: 2.19M, False: 33.6k]
  ------------------
  308|  2.19M|        bits = tree[tree[n].Dad].Len + 1u;
  ------------------
  |  |  137|  2.19M|#define Dad  dl.dad
  ------------------
                      bits = tree[tree[n].Dad].Len + 1u;
  ------------------
  |  |  138|  2.19M|#define Len  dl.len
  ------------------
  309|  2.19M|        if (bits > max_length){
  ------------------
  |  Branch (309:13): [True: 170, False: 2.19M]
  ------------------
  310|    170|            bits = max_length;
  311|    170|            overflow++;
  312|    170|        }
  313|  2.19M|        tree[n].Len = (uint16_t)bits;
  ------------------
  |  |  138|  2.19M|#define Len  dl.len
  ------------------
  314|       |        /* We overwrite tree[n].Dad which is no longer needed */
  315|  2.19M|    }
  316|       |
  317|  2.29M|    for (i = 0; i < nleaves; i++) {
  ------------------
  |  Branch (317:17): [True: 2.25M, False: 33.6k]
  ------------------
  318|  2.25M|        n = pq_node(sorted[i]);
  ------------------
  |  |  129|  2.25M|#define pq_node(e)  ((int)((e) & ((1u << PQ_NODE_BITS) - 1)))
  |  |  ------------------
  |  |  |  |  127|  2.25M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  319|  2.25M|        bits = tree[tree[n].Dad].Len + 1u;
  ------------------
  |  |  137|  2.25M|#define Dad  dl.dad
  ------------------
                      bits = tree[tree[n].Dad].Len + 1u;
  ------------------
  |  |  138|  2.25M|#define Len  dl.len
  ------------------
  320|  2.25M|        if (bits > max_length){
  ------------------
  |  Branch (320:13): [True: 5.38k, False: 2.25M]
  ------------------
  321|  5.38k|            bits = max_length;
  322|  5.38k|            overflow++;
  323|  5.38k|        }
  324|  2.25M|        tree[n].Len = (uint16_t)bits;
  ------------------
  |  |  138|  2.25M|#define Len  dl.len
  ------------------
  325|       |
  326|  2.25M|        s->bl_count[bits]++;
  327|  2.25M|        xbits = 0;
  328|  2.25M|        if (n >= base)
  ------------------
  |  Branch (328:13): [True: 276k, False: 1.98M]
  ------------------
  329|   276k|            xbits = extra[n-base];
  330|  2.25M|        f = tree[n].Freq;
  ------------------
  |  |  135|  2.25M|#define Freq fc.freq
  ------------------
  331|  2.25M|        s->opt_len += (unsigned int)f * (unsigned int)(bits + xbits);
  332|  2.25M|        if (stree)
  ------------------
  |  Branch (332:13): [True: 2.14M, False: 114k]
  ------------------
  333|  2.14M|            s->static_len += (unsigned int)f * (unsigned int)(stree[n].Len + xbits);
  ------------------
  |  |  138|  2.14M|#define Len  dl.len
  ------------------
  334|  2.25M|    }
  335|  33.6k|    if (overflow == 0)
  ------------------
  |  Branch (335:9): [True: 32.1k, False: 1.50k]
  ------------------
  336|  32.1k|        return;
  337|       |
  338|  1.50k|    Tracev((stderr, "\nbit length overflow\n"));
  339|       |    /* This happens for example on obj2 and pic of the Calgary corpus */
  340|       |
  341|       |    /* Find the first bit length which could increase: */
  342|  2.77k|    do {
  343|  2.77k|        bits = max_length - 1;
  344|  3.99k|        while (s->bl_count[bits] == 0)
  ------------------
  |  Branch (344:16): [True: 1.21k, False: 2.77k]
  ------------------
  345|  1.21k|            bits--;
  346|  2.77k|        s->bl_count[bits]--;       /* move one leaf down the tree */
  347|  2.77k|        s->bl_count[bits+1] += 2u; /* move one overflow item as its brother */
  348|  2.77k|        s->bl_count[max_length]--;
  349|       |        /* The brother of the overflow item also moves one step up,
  350|       |         * but this does not affect bl_count[max_length]
  351|       |         */
  352|  2.77k|        overflow -= 2;
  353|  2.77k|    } while (overflow > 0);
  ------------------
  |  Branch (353:14): [True: 1.27k, False: 1.50k]
  ------------------
  354|       |
  355|       |    /* Now recompute all bit lengths, scanning in increasing frequency.
  356|       |     * (It is simpler to reconstruct all lengths instead of fixing only
  357|       |     * the wrong ones. This idea is taken from 'ar' written by Haruhiko Okumura.)
  358|       |     */
  359|  1.50k|    i = 0;
  360|  12.2k|    for (bits = max_length; bits != 0; bits--) {
  ------------------
  |  Branch (360:29): [True: 10.7k, False: 1.50k]
  ------------------
  361|  10.7k|        n = s->bl_count[bits];
  362|  35.7k|        while (n != 0) {
  ------------------
  |  Branch (362:16): [True: 25.0k, False: 10.7k]
  ------------------
  363|  25.0k|            m = pq_node(sorted[i++]);
  ------------------
  |  |  129|  25.0k|#define pq_node(e)  ((int)((e) & ((1u << PQ_NODE_BITS) - 1)))
  |  |  ------------------
  |  |  |  |  127|  25.0k|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  364|  25.0k|            if (tree[m].Len != bits) {
  ------------------
  |  |  138|  25.0k|#define Len  dl.len
  ------------------
  |  Branch (364:17): [True: 2.29k, False: 22.7k]
  ------------------
  365|  2.29k|                Tracev((stderr, "code %d bits %d->%u\n", m, tree[m].Len, bits));
  366|  2.29k|                s->opt_len += (unsigned int)(bits * tree[m].Freq);
  ------------------
  |  |  135|  2.29k|#define Freq fc.freq
  ------------------
  367|  2.29k|                s->opt_len -= (unsigned int)(tree[m].Len * tree[m].Freq);
  ------------------
  |  |  138|  2.29k|#define Len  dl.len
  ------------------
                              s->opt_len -= (unsigned int)(tree[m].Len * tree[m].Freq);
  ------------------
  |  |  135|  2.29k|#define Freq fc.freq
  ------------------
  368|  2.29k|                tree[m].Len = (uint16_t)bits;
  ------------------
  |  |  138|  2.29k|#define Len  dl.len
  ------------------
  369|  2.29k|            }
  370|  25.0k|            n--;
  371|  25.0k|        }
  372|  10.7k|    }
  373|  1.50k|}
trees.c:build_bl_tree:
  535|  11.2k|static int build_bl_tree(deflate_state *s) {
  536|  11.2k|    int max_blindex;  /* index of last bit length code of non zero freq */
  537|       |
  538|       |    /* Determine the bit length frequencies for literal and distance trees */
  539|  11.2k|    scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
  540|  11.2k|    scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
  541|       |
  542|       |    /* Build the bit length tree: */
  543|  11.2k|    build_tree(s, (tree_desc *)(&(s->bl_desc)));
  544|       |    /* opt_len now includes the length of the tree representations, except
  545|       |     * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
  546|       |     */
  547|       |
  548|       |    /* Determine the number of bit length codes to send. The pkzip format
  549|       |     * requires that at least 4 bit length codes be sent. (appnote.txt says
  550|       |     * 3 but the actual value used is 4.)
  551|       |     */
  552|  29.5k|    for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
  ------------------
  |  |   54|  11.2k|#define BL_CODES  19
  ------------------
  |  Branch (552:36): [True: 29.5k, False: 0]
  ------------------
  553|  29.5k|        if (s->bl_tree[bl_order[max_blindex]].Len != 0)
  ------------------
  |  |  138|  29.5k|#define Len  dl.len
  ------------------
  |  Branch (553:13): [True: 11.2k, False: 18.3k]
  ------------------
  554|  11.2k|            break;
  555|  29.5k|    }
  556|       |    /* Update opt_len to include the bit length tree and counts */
  557|  11.2k|    s->opt_len += 3*((unsigned int)max_blindex+1) + 5+5+4;
  558|  11.2k|    Tracev((stderr, "\ndyn trees: dyn %u, stat %u", s->opt_len, s->static_len));
  559|       |
  560|  11.2k|    return max_blindex;
  561|  11.2k|}
trees.c:scan_tree:
  421|  22.4k|static void scan_tree(deflate_state *s, ct_data *tree, int max_code) {
  422|       |    /* tree: the tree to be scanned */
  423|       |    /* max_code: and its largest code of non zero frequency */
  424|  22.4k|    int n;                     /* iterates over all tree elements */
  425|  22.4k|    int prevlen = -1;          /* last emitted length */
  426|  22.4k|    int curlen;                /* length of current code */
  427|  22.4k|    int nextlen = tree[0].Len; /* length of next code */
  ------------------
  |  |  138|  22.4k|#define Len  dl.len
  ------------------
  428|  22.4k|    uint16_t count = 0;        /* repeat count of the current code */
  429|  22.4k|    uint16_t max_count = 7;    /* max repeat count */
  430|  22.4k|    uint16_t min_count = 4;    /* min repeat count */
  431|       |
  432|  22.4k|    if (nextlen == 0)
  ------------------
  |  Branch (432:9): [True: 3.55k, False: 18.8k]
  ------------------
  433|  3.55k|        max_count = 138, min_count = 3;
  434|       |
  435|  22.4k|    tree[max_code+1].Len = (uint16_t)0xffff; /* guard */
  ------------------
  |  |  138|  22.4k|#define Len  dl.len
  ------------------
  436|       |
  437|  3.24M|    for (n = 0; n <= max_code; n++) {
  ------------------
  |  Branch (437:17): [True: 3.22M, False: 22.4k]
  ------------------
  438|  3.22M|        curlen = nextlen;
  439|  3.22M|        nextlen = tree[n+1].Len;
  ------------------
  |  |  138|  3.22M|#define Len  dl.len
  ------------------
  440|  3.22M|        if (++count < max_count && curlen == nextlen) {
  ------------------
  |  Branch (440:13): [True: 3.06M, False: 157k]
  |  Branch (440:36): [True: 2.23M, False: 826k]
  ------------------
  441|  2.23M|            continue;
  442|  2.23M|        } else if (count < min_count) {
  ------------------
  |  Branch (442:20): [True: 703k, False: 280k]
  ------------------
  443|   703k|            s->bl_tree[curlen].Freq += count;
  ------------------
  |  |  135|   703k|#define Freq fc.freq
  ------------------
  444|   703k|        } else if (curlen != 0) {
  ------------------
  |  Branch (444:20): [True: 221k, False: 59.5k]
  ------------------
  445|   221k|            if (curlen != prevlen)
  ------------------
  |  Branch (445:17): [True: 92.0k, False: 129k]
  ------------------
  446|  92.0k|                s->bl_tree[curlen].Freq++;
  ------------------
  |  |  135|  92.0k|#define Freq fc.freq
  ------------------
  447|   221k|            s->bl_tree[REP_3_6].Freq++;
  ------------------
  |  |   12|   221k|#define REP_3_6      16
  ------------------
                          s->bl_tree[REP_3_6].Freq++;
  ------------------
  |  |  135|   221k|#define Freq fc.freq
  ------------------
  448|   221k|        } else if (count <= 10) {
  ------------------
  |  Branch (448:20): [True: 37.9k, False: 21.5k]
  ------------------
  449|  37.9k|            s->bl_tree[REPZ_3_10].Freq++;
  ------------------
  |  |   15|  37.9k|#define REPZ_3_10    17
  ------------------
                          s->bl_tree[REPZ_3_10].Freq++;
  ------------------
  |  |  135|  37.9k|#define Freq fc.freq
  ------------------
  450|  37.9k|        } else {
  451|  21.5k|            s->bl_tree[REPZ_11_138].Freq++;
  ------------------
  |  |   18|  21.5k|#define REPZ_11_138  18
  ------------------
                          s->bl_tree[REPZ_11_138].Freq++;
  ------------------
  |  |  135|  21.5k|#define Freq fc.freq
  ------------------
  452|  21.5k|        }
  453|   984k|        count = 0;
  454|   984k|        prevlen = curlen;
  455|   984k|        if (nextlen == 0) {
  ------------------
  |  Branch (455:13): [True: 118k, False: 865k]
  ------------------
  456|   118k|            max_count = 138, min_count = 3;
  457|   865k|        } else if (curlen == nextlen) {
  ------------------
  |  Branch (457:20): [True: 145k, False: 720k]
  ------------------
  458|   145k|            max_count = 6, min_count = 3;
  459|   720k|        } else {
  460|   720k|            max_count = 7, min_count = 4;
  461|   720k|        }
  462|   984k|    }
  463|  22.4k|}
trees.c:send_all_trees:
  568|  7.79k|static void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes) {
  569|  7.79k|    int rank;                    /* index in bl_order */
  570|       |
  571|  7.79k|    Assert(lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
  572|  7.79k|    Assert(lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, "too many codes");
  573|       |
  574|       |    // Temp local variables
  575|  7.79k|    uint32_t bi_valid = s->bi_valid;
  576|  7.79k|    uint64_t bi_buf = s->bi_buf;
  577|       |
  578|  7.79k|    Tracev((stderr, "\nbl counts: "));
  579|  7.79k|    send_bits(s, lcodes-257, 5, bi_buf, bi_valid); /* not +255 as stated in appnote.txt */
  ------------------
  |  |   43|  7.79k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|  7.79k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|  7.79k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|  7.79k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|  7.79k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|  7.79k|    trace_bits(s, val, len);\
  |  |   49|  7.79k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  461|  7.79k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  7.79k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|  7.79k|    \
  |  |   51|  7.79k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|  7.79k|    bi_buf |= val << bi_valid;\
  |  |   53|  7.79k|    \
  |  |   54|  7.79k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|  7.79k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 0, False: 7.79k]
  |  |  ------------------
  |  |   56|      0|        total_bits -= 64;\
  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |   58|      0|        \
  |  |   59|      0|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |   60|      0|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |   61|      0|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |   62|      0|    }\
  |  |   63|  7.79k|    bi_valid = total_bits;\
  |  |   64|  7.79k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 7.79k]
  |  |  ------------------
  ------------------
  580|  7.79k|    send_bits(s, dcodes-1,   5, bi_buf, bi_valid);
  ------------------
  |  |   43|  7.79k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|  7.79k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|  7.79k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|  7.79k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|  7.79k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|  7.79k|    trace_bits(s, val, len);\
  |  |   49|  7.79k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  461|  7.79k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  7.79k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|  7.79k|    \
  |  |   51|  7.79k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|  7.79k|    bi_buf |= val << bi_valid;\
  |  |   53|  7.79k|    \
  |  |   54|  7.79k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|  7.79k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 0, False: 7.79k]
  |  |  ------------------
  |  |   56|      0|        total_bits -= 64;\
  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |   58|      0|        \
  |  |   59|      0|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |   60|      0|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |   61|      0|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |   62|      0|    }\
  |  |   63|  7.79k|    bi_valid = total_bits;\
  |  |   64|  7.79k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 7.79k]
  |  |  ------------------
  ------------------
  581|  7.79k|    send_bits(s, blcodes-4,  4, bi_buf, bi_valid); /* not -3 as stated in appnote.txt */
  ------------------
  |  |   43|  7.79k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|  7.79k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|  7.79k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|  7.79k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|  7.79k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|  7.79k|    trace_bits(s, val, len);\
  |  |   49|  7.79k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  461|  7.79k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  7.79k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|  7.79k|    \
  |  |   51|  7.79k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|  7.79k|    bi_buf |= val << bi_valid;\
  |  |   53|  7.79k|    \
  |  |   54|  7.79k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|  7.79k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 0, False: 7.79k]
  |  |  ------------------
  |  |   56|      0|        total_bits -= 64;\
  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |   58|      0|        \
  |  |   59|      0|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |   60|      0|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |   61|      0|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |   62|      0|    }\
  |  |   63|  7.79k|    bi_valid = total_bits;\
  |  |   64|  7.79k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 7.79k]
  |  |  ------------------
  ------------------
  582|   141k|    for (rank = 0; rank < blcodes; rank++) {
  ------------------
  |  Branch (582:20): [True: 133k, False: 7.79k]
  ------------------
  583|   133k|        Tracev((stderr, "\nbl code %2u ", bl_order[rank]));
  584|   133k|        send_bits(s, s->bl_tree[bl_order[rank]].Len, 3, bi_buf, bi_valid);
  ------------------
  |  |   43|   133k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|   133k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|   133k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|   133k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|   133k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|   133k|    trace_bits(s, val, len);\
  |  |   49|   133k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  461|   133k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   133k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|   133k|    \
  |  |   51|   133k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|   133k|    bi_buf |= val << bi_valid;\
  |  |   53|   133k|    \
  |  |   54|   133k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|   133k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 7.40k, False: 126k]
  |  |  ------------------
  |  |   56|  7.40k|        total_bits -= 64;\
  |  |   57|  7.40k|        put_uint64(s, bi_buf);\
  |  |   58|  7.40k|        \
  |  |   59|  7.40k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |   60|  7.40k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |   61|  7.40k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |   62|  7.40k|    }\
  |  |   63|   133k|    bi_valid = total_bits;\
  |  |   64|   133k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 133k]
  |  |  ------------------
  ------------------
  585|   133k|    }
  586|  7.79k|    Tracev((stderr, "\nbl tree: sent %lu", s->bits_sent));
  587|       |
  588|       |    // Store back temp variables
  589|  7.79k|    s->bi_buf = bi_buf;
  590|  7.79k|    s->bi_valid = bi_valid;
  591|       |
  592|  7.79k|    send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
  593|  7.79k|    Tracev((stderr, "\nlit tree: sent %lu", s->bits_sent));
  594|       |
  595|  7.79k|    send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
  596|  7.79k|    Tracev((stderr, "\ndist tree: sent %lu", s->bits_sent));
  597|  7.79k|}
trees.c:send_tree:
  469|  15.5k|static void send_tree(deflate_state *s, ct_data *tree, int max_code) {
  470|       |    /* tree: the tree to be scanned */
  471|       |    /* max_code and its largest code of non zero frequency */
  472|  15.5k|    int n;                     /* iterates over all tree elements */
  473|  15.5k|    int prevlen = -1;          /* last emitted length */
  474|  15.5k|    int curlen;                /* length of current code */
  475|  15.5k|    int nextlen = tree[0].Len; /* length of next code */
  ------------------
  |  |  138|  15.5k|#define Len  dl.len
  ------------------
  476|  15.5k|    int count = 0;             /* repeat count of the current code */
  477|  15.5k|    int max_count = 7;         /* max repeat count */
  478|  15.5k|    int min_count = 4;         /* min repeat count */
  479|       |
  480|       |    /* tree[max_code+1].Len = -1; */  /* guard already set */
  481|  15.5k|    if (nextlen == 0)
  ------------------
  |  Branch (481:9): [True: 2.68k, False: 12.9k]
  ------------------
  482|  2.68k|        max_count = 138, min_count = 3;
  483|       |
  484|       |    // Temp local variables
  485|  15.5k|    uint32_t bi_valid = s->bi_valid;
  486|  15.5k|    uint64_t bi_buf = s->bi_buf;
  487|       |
  488|  2.31M|    for (n = 0; n <= max_code; n++) {
  ------------------
  |  Branch (488:17): [True: 2.30M, False: 15.5k]
  ------------------
  489|  2.30M|        curlen = nextlen;
  490|  2.30M|        nextlen = tree[n+1].Len;
  ------------------
  |  |  138|  2.30M|#define Len  dl.len
  ------------------
  491|  2.30M|        if (++count < max_count && curlen == nextlen) {
  ------------------
  |  Branch (491:13): [True: 2.20M, False: 102k]
  |  Branch (491:36): [True: 1.45M, False: 745k]
  ------------------
  492|  1.45M|            continue;
  493|  1.45M|        } else if (count < min_count) {
  ------------------
  |  Branch (493:20): [True: 641k, False: 206k]
  ------------------
  494|   869k|            do {
  495|   869k|                send_code(s, curlen, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   95|   869k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   43|   869k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |  |  |   44|   869k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |  |  |   45|   869k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   46|   869k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   47|   869k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   48|   869k|    trace_bits(s, val, len);\
  |  |  |  |   49|   869k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  461|   869k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|   869k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   50|   869k|    \
  |  |  |  |   51|   869k|    /* Unconditionally shift and merge values into the buffer */\
  |  |  |  |   52|   869k|    bi_buf |= val << bi_valid;\
  |  |  |  |   53|   869k|    \
  |  |  |  |   54|   869k|    /* Check if the 64-bit boundary was crossed */\
  |  |  |  |   55|   869k|    if (total_bits >= 64) {\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:9): [True: 36.1k, False: 833k]
  |  |  |  |  ------------------
  |  |  |  |   56|  36.1k|        total_bits -= 64;\
  |  |  |  |   57|  36.1k|        put_uint64(s, bi_buf);\
  |  |  |  |   58|  36.1k|        \
  |  |  |  |   59|  36.1k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |  |  |   60|  36.1k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |  |  |   61|  36.1k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |  |  |   62|  36.1k|    }\
  |  |  |  |   63|   869k|    bi_valid = total_bits;\
  |  |  |  |   64|   869k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (64:10): [Folded, False: 869k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  496|   869k|            } while (--count != 0);
  ------------------
  |  Branch (496:22): [True: 228k, False: 641k]
  ------------------
  497|       |
  498|   641k|        } else if (curlen != 0) {
  ------------------
  |  Branch (498:20): [True: 162k, False: 43.6k]
  ------------------
  499|   162k|            if (curlen != prevlen) {
  ------------------
  |  Branch (499:17): [True: 85.3k, False: 77.1k]
  ------------------
  500|  85.3k|                send_code(s, curlen, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   95|  85.3k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   43|  85.3k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |  |  |   44|  85.3k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |  |  |   45|  85.3k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   46|  85.3k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   47|  85.3k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   48|  85.3k|    trace_bits(s, val, len);\
  |  |  |  |   49|  85.3k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  461|  85.3k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  85.3k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   50|  85.3k|    \
  |  |  |  |   51|  85.3k|    /* Unconditionally shift and merge values into the buffer */\
  |  |  |  |   52|  85.3k|    bi_buf |= val << bi_valid;\
  |  |  |  |   53|  85.3k|    \
  |  |  |  |   54|  85.3k|    /* Check if the 64-bit boundary was crossed */\
  |  |  |  |   55|  85.3k|    if (total_bits >= 64) {\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:9): [True: 2.82k, False: 82.4k]
  |  |  |  |  ------------------
  |  |  |  |   56|  2.82k|        total_bits -= 64;\
  |  |  |  |   57|  2.82k|        put_uint64(s, bi_buf);\
  |  |  |  |   58|  2.82k|        \
  |  |  |  |   59|  2.82k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |  |  |   60|  2.82k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |  |  |   61|  2.82k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |  |  |   62|  2.82k|    }\
  |  |  |  |   63|  85.3k|    bi_valid = total_bits;\
  |  |  |  |   64|  85.3k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (64:10): [Folded, False: 85.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  501|  85.3k|                count--;
  502|  85.3k|            }
  503|   162k|            Assert(count >= 3 && count <= 6, " 3_6?");
  504|   162k|            send_code(s, REP_3_6, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   95|   162k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   43|   162k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |  |  |   44|   162k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |  |  |   45|   162k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   46|   162k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   47|   162k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   48|   162k|    trace_bits(s, val, len);\
  |  |  |  |   49|   162k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  461|   162k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|   162k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   50|   162k|    \
  |  |  |  |   51|   162k|    /* Unconditionally shift and merge values into the buffer */\
  |  |  |  |   52|   162k|    bi_buf |= val << bi_valid;\
  |  |  |  |   53|   162k|    \
  |  |  |  |   54|   162k|    /* Check if the 64-bit boundary was crossed */\
  |  |  |  |   55|   162k|    if (total_bits >= 64) {\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:9): [True: 5.60k, False: 156k]
  |  |  |  |  ------------------
  |  |  |  |   56|  5.60k|        total_bits -= 64;\
  |  |  |  |   57|  5.60k|        put_uint64(s, bi_buf);\
  |  |  |  |   58|  5.60k|        \
  |  |  |  |   59|  5.60k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |  |  |   60|  5.60k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |  |  |   61|  5.60k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |  |  |   62|  5.60k|    }\
  |  |  |  |   63|   162k|    bi_valid = total_bits;\
  |  |  |  |   64|   162k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (64:10): [Folded, False: 162k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  505|   162k|            send_bits(s, count-3, 2, bi_buf, bi_valid);
  ------------------
  |  |   43|   162k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|   162k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|   162k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|   162k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|   162k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|   162k|    trace_bits(s, val, len);\
  |  |   49|   162k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  461|   162k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   162k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|   162k|    \
  |  |   51|   162k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|   162k|    bi_buf |= val << bi_valid;\
  |  |   53|   162k|    \
  |  |   54|   162k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|   162k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 4.86k, False: 157k]
  |  |  ------------------
  |  |   56|  4.86k|        total_bits -= 64;\
  |  |   57|  4.86k|        put_uint64(s, bi_buf);\
  |  |   58|  4.86k|        \
  |  |   59|  4.86k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |   60|  4.86k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |   61|  4.86k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |   62|  4.86k|    }\
  |  |   63|   162k|    bi_valid = total_bits;\
  |  |   64|   162k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 162k]
  |  |  ------------------
  ------------------
  506|       |
  507|   162k|        } else if (count <= 10) {
  ------------------
  |  Branch (507:20): [True: 30.5k, False: 13.1k]
  ------------------
  508|  30.5k|            send_code(s, REPZ_3_10, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   95|  30.5k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   43|  30.5k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |  |  |   44|  30.5k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |  |  |   45|  30.5k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   46|  30.5k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   47|  30.5k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   48|  30.5k|    trace_bits(s, val, len);\
  |  |  |  |   49|  30.5k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  461|  30.5k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  30.5k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   50|  30.5k|    \
  |  |  |  |   51|  30.5k|    /* Unconditionally shift and merge values into the buffer */\
  |  |  |  |   52|  30.5k|    bi_buf |= val << bi_valid;\
  |  |  |  |   53|  30.5k|    \
  |  |  |  |   54|  30.5k|    /* Check if the 64-bit boundary was crossed */\
  |  |  |  |   55|  30.5k|    if (total_bits >= 64) {\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:9): [True: 1.88k, False: 28.6k]
  |  |  |  |  ------------------
  |  |  |  |   56|  1.88k|        total_bits -= 64;\
  |  |  |  |   57|  1.88k|        put_uint64(s, bi_buf);\
  |  |  |  |   58|  1.88k|        \
  |  |  |  |   59|  1.88k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |  |  |   60|  1.88k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |  |  |   61|  1.88k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |  |  |   62|  1.88k|    }\
  |  |  |  |   63|  30.5k|    bi_valid = total_bits;\
  |  |  |  |   64|  30.5k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (64:10): [Folded, False: 30.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  509|  30.5k|            send_bits(s, count-3, 3, bi_buf, bi_valid);
  ------------------
  |  |   43|  30.5k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|  30.5k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|  30.5k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|  30.5k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|  30.5k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|  30.5k|    trace_bits(s, val, len);\
  |  |   49|  30.5k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  461|  30.5k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  30.5k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|  30.5k|    \
  |  |   51|  30.5k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|  30.5k|    bi_buf |= val << bi_valid;\
  |  |   53|  30.5k|    \
  |  |   54|  30.5k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|  30.5k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 1.39k, False: 29.1k]
  |  |  ------------------
  |  |   56|  1.39k|        total_bits -= 64;\
  |  |   57|  1.39k|        put_uint64(s, bi_buf);\
  |  |   58|  1.39k|        \
  |  |   59|  1.39k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |   60|  1.39k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |   61|  1.39k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |   62|  1.39k|    }\
  |  |   63|  30.5k|    bi_valid = total_bits;\
  |  |   64|  30.5k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 30.5k]
  |  |  ------------------
  ------------------
  510|       |
  511|  30.5k|        } else {
  512|  13.1k|            send_code(s, REPZ_11_138, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   95|  13.1k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   43|  13.1k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |  |  |   44|  13.1k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |  |  |   45|  13.1k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   46|  13.1k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   47|  13.1k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   48|  13.1k|    trace_bits(s, val, len);\
  |  |  |  |   49|  13.1k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  461|  13.1k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  13.1k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   50|  13.1k|    \
  |  |  |  |   51|  13.1k|    /* Unconditionally shift and merge values into the buffer */\
  |  |  |  |   52|  13.1k|    bi_buf |= val << bi_valid;\
  |  |  |  |   53|  13.1k|    \
  |  |  |  |   54|  13.1k|    /* Check if the 64-bit boundary was crossed */\
  |  |  |  |   55|  13.1k|    if (total_bits >= 64) {\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:9): [True: 1.01k, False: 12.1k]
  |  |  |  |  ------------------
  |  |  |  |   56|  1.01k|        total_bits -= 64;\
  |  |  |  |   57|  1.01k|        put_uint64(s, bi_buf);\
  |  |  |  |   58|  1.01k|        \
  |  |  |  |   59|  1.01k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |  |  |   60|  1.01k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |  |  |   61|  1.01k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |  |  |   62|  1.01k|    }\
  |  |  |  |   63|  13.1k|    bi_valid = total_bits;\
  |  |  |  |   64|  13.1k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (64:10): [Folded, False: 13.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  513|  13.1k|            send_bits(s, count-11, 7, bi_buf, bi_valid);
  ------------------
  |  |   43|  13.1k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|  13.1k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|  13.1k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|  13.1k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|  13.1k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|  13.1k|    trace_bits(s, val, len);\
  |  |   49|  13.1k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  461|  13.1k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  13.1k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|  13.1k|    \
  |  |   51|  13.1k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|  13.1k|    bi_buf |= val << bi_valid;\
  |  |   53|  13.1k|    \
  |  |   54|  13.1k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|  13.1k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 1.50k, False: 11.6k]
  |  |  ------------------
  |  |   56|  1.50k|        total_bits -= 64;\
  |  |   57|  1.50k|        put_uint64(s, bi_buf);\
  |  |   58|  1.50k|        \
  |  |   59|  1.50k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |   60|  1.50k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |   61|  1.50k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |   62|  1.50k|    }\
  |  |   63|  13.1k|    bi_valid = total_bits;\
  |  |   64|  13.1k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 13.1k]
  |  |  ------------------
  ------------------
  514|  13.1k|        }
  515|   847k|        count = 0;
  516|   847k|        prevlen = curlen;
  517|   847k|        if (nextlen == 0) {
  ------------------
  |  Branch (517:13): [True: 93.5k, False: 754k]
  ------------------
  518|  93.5k|            max_count = 138, min_count = 3;
  519|   754k|        } else if (curlen == nextlen) {
  ------------------
  |  Branch (519:20): [True: 91.2k, False: 663k]
  ------------------
  520|  91.2k|            max_count = 6, min_count = 3;
  521|   663k|        } else {
  522|   663k|            max_count = 7, min_count = 4;
  523|   663k|        }
  524|   847k|    }
  525|       |
  526|       |    // Store back temp variables
  527|  15.5k|    s->bi_buf = bi_buf;
  528|  15.5k|    s->bi_valid = bi_valid;
  529|  15.5k|}
trees.c:compress_block:
  725|  9.67k|static void compress_block(deflate_state *s, const ct_data *ltree, const ct_data *dtree) {
  726|       |    /* ltree: literal tree */
  727|       |    /* dtree: distance tree */
  728|  9.67k|    unsigned dist;      /* distance of matched string */
  729|  9.67k|    int lc;             /* match length or unmatched char (if dist == 0) */
  730|  9.67k|    unsigned sx = 0;    /* running index in symbol buffers */
  731|       |
  732|       |    /* Local pointers to avoid indirection */
  733|  9.67k|    const unsigned int sym_next = s->sym_next;
  734|       |#ifdef LIT_MEM
  735|       |    uint16_t *d_buf = s->d_buf;
  736|       |    unsigned char *l_buf = s->l_buf;
  737|       |#else
  738|  9.67k|    unsigned char *sym_buf = s->sym_buf;
  739|  9.67k|#endif
  740|       |
  741|       |    /* Keep the bit writer state in registers across the entire loop */
  742|  9.67k|    uint64_t bi_buf = s->bi_buf;
  743|  9.67k|    uint32_t bi_valid = s->bi_valid;
  744|  9.67k|    uint32_t pending = s->pending;
  745|       |
  746|  9.67k|    if (sym_next != 0) {
  ------------------
  |  Branch (746:9): [True: 9.63k, False: 38]
  ------------------
  747|  38.9M|        do {
  748|  38.9M|            send_bits_flush(s, bi_buf, bi_valid, pending);
  ------------------
  |  |   80|  38.9M|#define send_bits_flush(s, bi_buf, bi_valid, pending) do { \
  |  |   81|  38.9M|    zng_memwrite_8((s)->pending_buf + (pending), Z_U64_TO_LE(bi_buf)); \
  |  |  ------------------
  |  |  |  |   85|  38.9M|#  define Z_U64_TO_LE(x)    (x)
  |  |  ------------------
  |  |   82|  38.9M|    pending += (bi_valid) >> 3; \
  |  |   83|  38.9M|    bi_buf >>= ((bi_valid) & ~7U); \
  |  |   84|  38.9M|    bi_valid &= 7; \
  |  |   85|  38.9M|} while (0)
  |  |  ------------------
  |  |  |  Branch (85:10): [Folded, False: 38.9M]
  |  |  ------------------
  ------------------
  749|       |#ifdef LIT_MEM
  750|       |            dist = d_buf[sx];
  751|       |            lc = l_buf[sx++];
  752|       |#else
  753|  38.9M|#  if OPTIMAL_CMP >= 32
  754|  38.9M|            uint32_t dist_lc = Z_U32_FROM_LE(zng_memread_4(&sym_buf[sx]));
  ------------------
  |  |   87|  38.9M|#  define Z_U32_FROM_LE(x)  (x)
  ------------------
  755|  38.9M|            dist = dist_lc & 0xffff;
  756|  38.9M|            lc = (dist_lc >> 16) & 0xff;
  757|       |#  else
  758|       |            dist = sym_buf[sx] + ((unsigned)sym_buf[sx + 1] << 8);
  759|       |            lc = sym_buf[sx + 2];
  760|       |#  endif
  761|  38.9M|            sx += 3;
  762|  38.9M|#endif
  763|  38.9M|            if (dist == 0) {
  ------------------
  |  Branch (763:17): [True: 36.0M, False: 2.83M]
  ------------------
  764|  36.0M|                uint64_t bits = 0;
  765|  36.0M|                uint32_t nbits = 0;
  766|       |
  767|  36.0M|                send_code_merge(s, lc, ltree, bits, nbits);
  ------------------
  |  |  106|  36.0M|    send_bits_merge(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   68|  36.0M|#define send_bits_merge(s, t_val, t_len, bi_buf, bi_valid) do { \
  |  |  |  |   69|  36.0M|    Assert((bi_valid) + (uint32_t)(t_len) <= 64, "bit buffer overflow"); \
  |  |  |  |   70|  36.0M|    trace_bits(s, (uint64_t)(t_val), (uint32_t)(t_len)); \
  |  |  |  |   71|  36.0M|    sent_bits_add(s, t_len); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  461|  36.0M|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  36.0M|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   72|  36.0M|    bi_buf |= (uint64_t)(t_val) << (bi_valid); \
  |  |  |  |   73|  36.0M|    bi_valid += (uint32_t)(t_len); \
  |  |  |  |   74|  36.0M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (74:10): [Folded, False: 36.0M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  768|  36.0M|#if !defined(LIT_MEM) && OPTIMAL_CMP >= 64
  769|       |                /* Accumulate up to 2 more consecutive literals into the same merge. Their
  770|       |                 * codes are at most 15 bits each, so all three fit alongside the at most
  771|       |                 * 7 bits the flush above leaves behind. */
  772|  36.0M|                if (sx + 8 <= sym_next) {
  ------------------
  |  Branch (772:21): [True: 36.0M, False: 18.3k]
  ------------------
  773|  36.0M|                    uint64_t next_syms = Z_U64_FROM_LE(zng_memread_8(&sym_buf[sx]));
  ------------------
  |  |   88|  36.0M|#  define Z_U64_FROM_LE(x)  (x)
  ------------------
  774|       |
  775|       |                    /* A dist field is zero exactly when that symbol is a literal */
  776|  36.0M|                    if ((uint16_t)next_syms == 0) {
  ------------------
  |  Branch (776:25): [True: 35.3M, False: 765k]
  ------------------
  777|  35.3M|                        send_code_merge(s, (unsigned)((next_syms >> 16) & 0xff), ltree, bits, nbits);
  ------------------
  |  |  106|  35.3M|    send_bits_merge(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   68|  35.3M|#define send_bits_merge(s, t_val, t_len, bi_buf, bi_valid) do { \
  |  |  |  |   69|  35.3M|    Assert((bi_valid) + (uint32_t)(t_len) <= 64, "bit buffer overflow"); \
  |  |  |  |   70|  35.3M|    trace_bits(s, (uint64_t)(t_val), (uint32_t)(t_len)); \
  |  |  |  |   71|  35.3M|    sent_bits_add(s, t_len); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  461|  35.3M|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  35.3M|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   72|  35.3M|    bi_buf |= (uint64_t)(t_val) << (bi_valid); \
  |  |  |  |   73|  35.3M|    bi_valid += (uint32_t)(t_len); \
  |  |  |  |   74|  35.3M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (74:10): [Folded, False: 35.3M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  778|  35.3M|                        sx += 3;
  779|       |
  780|  35.3M|                        if ((next_syms & LIT3_DIST1_MASK) == 0) {
  ------------------
  |  |  722|  35.3M|#define LIT3_DIST1_MASK 0x000000FFFF000000ULL
  ------------------
  |  Branch (780:29): [True: 34.8M, False: 472k]
  ------------------
  781|  34.8M|                            send_code_merge(s, (unsigned)((next_syms >> 40) & 0xff), ltree, bits, nbits);
  ------------------
  |  |  106|  34.8M|    send_bits_merge(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   68|  34.8M|#define send_bits_merge(s, t_val, t_len, bi_buf, bi_valid) do { \
  |  |  |  |   69|  34.8M|    Assert((bi_valid) + (uint32_t)(t_len) <= 64, "bit buffer overflow"); \
  |  |  |  |   70|  34.8M|    trace_bits(s, (uint64_t)(t_val), (uint32_t)(t_len)); \
  |  |  |  |   71|  34.8M|    sent_bits_add(s, t_len); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  461|  34.8M|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  34.8M|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   72|  34.8M|    bi_buf |= (uint64_t)(t_val) << (bi_valid); \
  |  |  |  |   73|  34.8M|    bi_valid += (uint32_t)(t_len); \
  |  |  |  |   74|  34.8M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (74:10): [Folded, False: 34.8M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  782|  34.8M|                            sx += 3;
  783|  34.8M|                        }
  784|  35.3M|                    }
  785|  36.0M|                }
  786|  36.0M|#endif
  787|       |                /* The codes were traced and counted as they accumulated */
  788|  36.0M|                Assert(bi_valid + nbits <= 64, "bit buffer overflow");
  789|  36.0M|                bi_buf |= bits << bi_valid;
  790|  36.0M|                bi_valid += nbits;
  791|  36.0M|            } else {
  792|  2.83M|                uint32_t match_bits_len;
  793|  2.83M|                uint64_t match_bits = zng_assemble_dist(ltree, dtree, lc, dist, &match_bits_len);
  794|       |
  795|  2.83M|                send_bits_merge(s, match_bits, match_bits_len, bi_buf, bi_valid);
  ------------------
  |  |   68|  2.83M|#define send_bits_merge(s, t_val, t_len, bi_buf, bi_valid) do { \
  |  |   69|  2.83M|    Assert((bi_valid) + (uint32_t)(t_len) <= 64, "bit buffer overflow"); \
  |  |   70|  2.83M|    trace_bits(s, (uint64_t)(t_val), (uint32_t)(t_len)); \
  |  |   71|  2.83M|    sent_bits_add(s, t_len); \
  |  |  ------------------
  |  |  |  |  461|  2.83M|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  2.83M|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   72|  2.83M|    bi_buf |= (uint64_t)(t_val) << (bi_valid); \
  |  |   73|  2.83M|    bi_valid += (uint32_t)(t_len); \
  |  |   74|  2.83M|} while (0)
  |  |  ------------------
  |  |  |  Branch (74:10): [Folded, False: 2.83M]
  |  |  ------------------
  ------------------
  796|  2.83M|            } /* literal or match pair ? */
  797|       |
  798|       |            /* Check for no overlay of pending_buf on needed symbols */
  799|       |#ifdef LIT_MEM
  800|       |            Assert(pending < 2 * (s->lit_bufsize + sx), "pending_buf overflow");
  801|       |#else
  802|  38.9M|            Assert(pending < s->lit_bufsize + sx, "pending_buf overflow");
  803|  38.9M|#endif
  804|  38.9M|        } while (sx < sym_next);
  ------------------
  |  Branch (804:18): [True: 38.9M, False: 9.63k]
  ------------------
  805|  9.63k|    }
  806|       |
  807|  9.67k|    s->pending = pending;
  808|  9.67k|    zng_emit_end_block(s, ltree, 0, &bi_buf, &bi_valid);
  809|       |
  810|       |    /* Write back to state */
  811|  9.67k|    s->bi_buf = bi_buf;
  812|  9.67k|    s->bi_valid = bi_valid;
  813|  9.67k|}
trees.c:detect_data_type:
  828|  3.55k|static int detect_data_type(deflate_state *s) {
  829|       |    /* block_mask is the bit mask of block-listed bytes
  830|       |     * set bits 0..6, 14..25, and 28..31
  831|       |     * 0xf3ffc07f = binary 11110011111111111100000001111111
  832|       |     */
  833|  3.55k|    unsigned long block_mask = 0xf3ffc07fUL;
  834|  3.55k|    int n;
  835|       |
  836|       |    /* Check for non-textual ("block-listed") bytes. */
  837|  23.2k|    for (n = 0; n <= 31; n++, block_mask >>= 1)
  ------------------
  |  Branch (837:17): [True: 22.7k, False: 537]
  ------------------
  838|  22.7k|        if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
  ------------------
  |  |  135|  17.1k|#define Freq fc.freq
  ------------------
  |  Branch (838:13): [True: 17.1k, False: 5.53k]
  |  Branch (838:33): [True: 3.01k, False: 14.1k]
  ------------------
  839|  3.01k|            return Z_BINARY;
  ------------------
  |  |  206|  3.01k|#define Z_BINARY   0
  ------------------
  840|       |
  841|       |    /* Check for textual ("allow-listed") bytes. */
  842|    537|    if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |  135|    537|#define Freq fc.freq
  ------------------
                  if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |  135|    519|#define Freq fc.freq
  ------------------
                  if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |  135|    490|#define Freq fc.freq
  ------------------
  |  Branch (842:9): [True: 18, False: 519]
  |  Branch (842:38): [True: 29, False: 490]
  |  Branch (842:68): [True: 12, False: 478]
  ------------------
  843|     59|        return Z_TEXT;
  ------------------
  |  |  207|     59|#define Z_TEXT     1
  ------------------
  844|  46.6k|    for (n = 32; n < LITERALS; n++)
  ------------------
  |  |   45|  46.6k|#define LITERALS  256
  ------------------
  |  Branch (844:18): [True: 46.6k, False: 7]
  ------------------
  845|  46.6k|        if (s->dyn_ltree[n].Freq != 0)
  ------------------
  |  |  135|  46.6k|#define Freq fc.freq
  ------------------
  |  Branch (845:13): [True: 471, False: 46.2k]
  ------------------
  846|    471|            return Z_TEXT;
  ------------------
  |  |  207|    949|#define Z_TEXT     1
  ------------------
  847|       |
  848|       |    /* There are no "block-listed" or "allow-listed" bytes:
  849|       |     * this stream either is empty or has tolerated ("gray-listed") bytes only.
  850|       |     */
  851|      7|    return Z_BINARY;
  ------------------
  |  |  206|      7|#define Z_BINARY   0
  ------------------
  852|    478|}

trees.c:zng_tr_emit_tree:
  248|  11.2k|static inline void zng_tr_emit_tree(deflate_state *s, int type, const int last) {
  249|  11.2k|    uint32_t bi_valid = s->bi_valid;
  250|  11.2k|    uint64_t bi_buf = s->bi_buf;
  251|  11.2k|    uint32_t header_bits = (type << 1) + last;
  252|  11.2k|    send_bits(s, header_bits, 3, bi_buf, bi_valid);
  ------------------
  |  |   43|  11.2k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|  11.2k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|  11.2k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|  11.2k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|  11.2k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|  11.2k|    trace_bits(s, val, len);\
  |  |   49|  11.2k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  461|  11.2k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  11.2k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|  11.2k|    \
  |  |   51|  11.2k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|  11.2k|    bi_buf |= val << bi_valid;\
  |  |   53|  11.2k|    \
  |  |   54|  11.2k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|  11.2k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 0, False: 11.2k]
  |  |  ------------------
  |  |   56|      0|        total_bits -= 64;\
  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |   58|      0|        \
  |  |   59|      0|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |   60|      0|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |   61|      0|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |   62|      0|    }\
  |  |   63|  11.2k|    bi_valid = total_bits;\
  |  |   64|  11.2k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 11.2k]
  |  |  ------------------
  ------------------
  253|  11.2k|    cmpr_bits_add(s, 3);
  ------------------
  |  |  459|  11.2k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  154|  11.2k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  254|  11.2k|    s->bi_valid = bi_valid;
  255|  11.2k|    s->bi_buf = bi_buf;
  256|  11.2k|    Tracev((stderr, "\n--- Emit Tree: Last: %u\n", last));
  257|  11.2k|}
trees.c:zng_tr_emit_align:
  262|  5.12k|static inline void zng_tr_emit_align(deflate_state *s) {
  263|  5.12k|    bi_windup(s); /* align on byte boundary */
  264|  5.12k|    sent_bits_align(s);
  265|  5.12k|}
trees.c:bi_windup:
  112|  5.12k|static inline void bi_windup(deflate_state *s) {
  113|  5.12k|    if (s->bi_valid > 56) {
  ------------------
  |  Branch (113:9): [True: 4, False: 5.11k]
  ------------------
  114|      4|        put_uint64(s, s->bi_buf);
  115|  5.11k|    } else {
  116|  5.11k|        if (s->bi_valid > 24) {
  ------------------
  |  Branch (116:13): [True: 821, False: 4.29k]
  ------------------
  117|    821|            put_uint32(s, (uint32_t)s->bi_buf);
  118|    821|            s->bi_buf >>= 32;
  119|    821|            s->bi_valid -= 32;
  120|    821|        }
  121|  5.11k|        if (s->bi_valid > 8) {
  ------------------
  |  Branch (121:13): [True: 2.37k, False: 2.74k]
  ------------------
  122|  2.37k|            put_short(s, (uint16_t)s->bi_buf);
  123|  2.37k|            s->bi_buf >>= 16;
  124|  2.37k|            s->bi_valid -= 16;
  125|  2.37k|        }
  126|  5.11k|        if (s->bi_valid > 0) {
  ------------------
  |  Branch (126:13): [True: 3.51k, False: 1.59k]
  ------------------
  127|  3.51k|            put_byte(s, s->bi_buf);
  ------------------
  |  |  360|  3.51k|#define put_byte(s, c) { \
  |  |  361|  3.51k|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  362|  3.51k|}
  ------------------
  128|  3.51k|        }
  129|  5.11k|    }
  130|  5.12k|    s->bi_used = ((s->bi_valid - 1) & 7) + 1;
  131|  5.12k|    s->bi_buf = 0;
  132|  5.12k|    s->bi_valid = 0;
  133|  5.12k|}
trees.c:zng_emit_end_block:
  213|  9.67k|                                      uint64_t *bi_buf, uint32_t *bi_valid) {
  214|  9.67k|    send_code(s, END_BLOCK, ltree, *bi_buf, *bi_valid);
  ------------------
  |  |   95|  9.67k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   43|  9.67k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |  |  |   44|  9.67k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |  |  |   45|  9.67k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   46|  9.67k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   47|  9.67k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   48|  9.67k|    trace_bits(s, val, len);\
  |  |  |  |   49|  9.67k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  461|  9.67k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  9.67k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   50|  9.67k|    \
  |  |  |  |   51|  9.67k|    /* Unconditionally shift and merge values into the buffer */\
  |  |  |  |   52|  9.67k|    bi_buf |= val << bi_valid;\
  |  |  |  |   53|  9.67k|    \
  |  |  |  |   54|  9.67k|    /* Check if the 64-bit boundary was crossed */\
  |  |  |  |   55|  9.67k|    if (total_bits >= 64) {\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:9): [True: 0, False: 9.67k]
  |  |  |  |  ------------------
  |  |  |  |   56|      0|        total_bits -= 64;\
  |  |  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |  |  |   58|      0|        \
  |  |  |  |   59|      0|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |  |  |   60|      0|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |  |  |   61|      0|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |  |  |   62|      0|    }\
  |  |  |  |   63|  9.67k|    bi_valid = total_bits;\
  |  |  |  |   64|  9.67k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (64:10): [Folded, False: 9.67k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  215|  9.67k|    Tracev((stderr, "\n+++ Emit End Block: Last: %u Pending: %u Total Out: %" PRIu64 "\n",
  216|  9.67k|        last, s->pending, (uint64_t)s->strm->total_out));
  217|  9.67k|    Z_UNUSED(last);
  ------------------
  |  |  154|  9.67k|#define Z_UNUSED(var) (void)(var)
  ------------------
  218|  9.67k|}
trees.c:zng_assemble_dist:
  148|  2.83M|Z_FORCEINLINE static uint64_t zng_assemble_dist(const ct_data *ltree, const ct_data *dtree, uint32_t lc, uint32_t dist, uint32_t *bits_len) {
  149|  2.83M|    uint64_t match_bits;
  150|  2.83M|    uint32_t match_bits_len;
  151|  2.83M|    uint32_t mask_ext;  // Contains both mask and extra, can safely be used directly as mask
  152|       |                        // due to extra bits being outside the range of lc and dist data.
  153|  2.83M|    uint32_t c, extra;
  154|  2.83M|    uint8_t code;
  155|       |
  156|       |    /* 1. Process Length Code */
  157|  2.83M|    code = zng_length_code[lc];
  158|  2.83M|    c = code + LITERALS + 1;
  ------------------
  |  |   45|  2.83M|#define LITERALS  256
  ------------------
  159|  2.83M|    Assert(c < L_CODES, "bad l_code");
  160|  2.83M|    trace_code(c);
  161|       |
  162|       |    /*    Send length code, len is the match length - STD_MIN_MATCH */
  163|  2.83M|    match_bits = ltree[c].Code;
  ------------------
  |  |  136|  2.83M|#define Code fc.code
  ------------------
  164|  2.83M|    match_bits_len = ltree[c].Len;
  ------------------
  |  |  138|  2.83M|#define Len  dl.len
  ------------------
  165|       |
  166|       |    /* 2. Get extra bits count and mask */
  167|  2.83M|    mask_ext = lmask_extra[code];
  168|  2.83M|    extra = mask_ext >> 8;
  169|       |
  170|       |    /*    Send length extra bits */
  171|  2.83M|    match_bits |= (uint64_t)(lc & mask_ext) << match_bits_len;
  172|  2.83M|    match_bits_len += extra;
  173|       |
  174|       |    /* 3. Process Distance Code */
  175|  2.83M|    dist--; /* dist is now the match distance - 1 */
  176|  2.83M|    code = d_code(dist);
  ------------------
  |  |  446|  2.83M|#define d_code(dist) ((dist) < 256 ? zng_dist_code[dist] : zng_dist_code[256+((dist)>>7)])
  |  |  ------------------
  |  |  |  Branch (446:23): [True: 562k, False: 2.27M]
  |  |  ------------------
  ------------------
  177|  2.83M|    Assert(code < D_CODES, "bad d_code");
  178|  2.83M|    trace_code(code);
  179|       |
  180|       |    /*    Send distance code */
  181|  2.83M|    match_bits |= ((uint64_t)dtree[code].Code << match_bits_len);
  ------------------
  |  |  136|  2.83M|#define Code fc.code
  ------------------
  182|  2.83M|    match_bits_len += dtree[code].Len;
  ------------------
  |  |  138|  2.83M|#define Len  dl.len
  ------------------
  183|       |
  184|       |    /* 4. Get extra bits count and mask */
  185|  2.83M|    mask_ext = dmask_extra[code];
  186|  2.83M|    extra = mask_ext >> 16;
  187|       |
  188|       |    /*    Send dist extra bits */
  189|  2.83M|    match_bits |= ((uint64_t)(dist & mask_ext) << match_bits_len);
  190|  2.83M|    match_bits_len += extra;
  191|       |
  192|  2.83M|    *bits_len = match_bits_len;
  193|  2.83M|    return match_bits;
  194|  2.83M|}

deflate.c:zng_memwrite_2:
   45|  3.55k|static inline void zng_memwrite_2(void *ptr, uint16_t val) {
   46|  3.55k|#if defined(HAVE_MAY_ALIAS)
   47|  3.55k|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   48|  3.55k|    ((unaligned_uint16_t *)ptr)->val = val;
   49|       |#else
   50|       |    memcpy(ptr, &val, sizeof(val));
   51|       |#endif
   52|  3.55k|}
deflate.c:zng_memwrite_4:
   54|  3.55k|static inline void zng_memwrite_4(void *ptr, uint32_t val) {
   55|  3.55k|#if defined(HAVE_MAY_ALIAS)
   56|  3.55k|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|  3.55k|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|  3.55k|}
deflate.c:zng_memread_4:
   23|   168M|static inline uint32_t zng_memread_4(const void *ptr) {
   24|   168M|#if defined(HAVE_MAY_ALIAS)
   25|   168M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|   168M|    return ((const unaligned_uint32_t *)ptr)->val;
   27|       |#else
   28|       |    uint32_t val;
   29|       |    memcpy(&val, ptr, sizeof(val));
   30|       |    return val;
   31|       |#endif
   32|   168M|}
deflate_medium.c:zng_memread_4:
   23|   130M|static inline uint32_t zng_memread_4(const void *ptr) {
   24|   130M|#if defined(HAVE_MAY_ALIAS)
   25|   130M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|   130M|    return ((const unaligned_uint32_t *)ptr)->val;
   27|       |#else
   28|       |    uint32_t val;
   29|       |    memcpy(&val, ptr, sizeof(val));
   30|       |    return val;
   31|       |#endif
   32|   130M|}
deflate_medium.c:zng_memwrite_4:
   54|   130M|static inline void zng_memwrite_4(void *ptr, uint32_t val) {
   55|   130M|#if defined(HAVE_MAY_ALIAS)
   56|   130M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|   130M|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|   130M|}
inftrees.c:zng_memread_4:
   23|  1.82M|static inline uint32_t zng_memread_4(const void *ptr) {
   24|  1.82M|#if defined(HAVE_MAY_ALIAS)
   25|  1.82M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  1.82M|    return ((const unaligned_uint32_t *)ptr)->val;
   27|       |#else
   28|       |    uint32_t val;
   29|       |    memcpy(&val, ptr, sizeof(val));
   30|       |    return val;
   31|       |#endif
   32|  1.82M|}
inftrees.c:zng_memwrite_4:
   54|  9.17M|static inline void zng_memwrite_4(void *ptr, uint32_t val) {
   55|  9.17M|#if defined(HAVE_MAY_ALIAS)
   56|  9.17M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|  9.17M|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|  9.17M|}
insert_string.c:zng_memread_4:
   23|  20.4M|static inline uint32_t zng_memread_4(const void *ptr) {
   24|  20.4M|#if defined(HAVE_MAY_ALIAS)
   25|  20.4M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  20.4M|    return ((const unaligned_uint32_t *)ptr)->val;
   27|       |#else
   28|       |    uint32_t val;
   29|       |    memcpy(&val, ptr, sizeof(val));
   30|       |    return val;
   31|       |#endif
   32|  20.4M|}
trees.c:zng_memwrite_8:
   63|  39.0M|static inline void zng_memwrite_8(void *ptr, uint64_t val) {
   64|  39.0M|#if defined(HAVE_MAY_ALIAS)
   65|  39.0M|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   66|  39.0M|    ((unaligned_uint64_t *)ptr)->val = val;
   67|       |#else
   68|       |    memcpy(ptr, &val, sizeof(val));
   69|       |#endif
   70|  39.0M|}
trees.c:zng_memwrite_2:
   45|  11.7k|static inline void zng_memwrite_2(void *ptr, uint16_t val) {
   46|  11.7k|#if defined(HAVE_MAY_ALIAS)
   47|  11.7k|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   48|  11.7k|    ((unaligned_uint16_t *)ptr)->val = val;
   49|       |#else
   50|       |    memcpy(ptr, &val, sizeof(val));
   51|       |#endif
   52|  11.7k|}
trees.c:zng_memread_4:
   23|  38.9M|static inline uint32_t zng_memread_4(const void *ptr) {
   24|  38.9M|#if defined(HAVE_MAY_ALIAS)
   25|  38.9M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  38.9M|    return ((const unaligned_uint32_t *)ptr)->val;
   27|       |#else
   28|       |    uint32_t val;
   29|       |    memcpy(&val, ptr, sizeof(val));
   30|       |    return val;
   31|       |#endif
   32|  38.9M|}
trees.c:zng_memread_8:
   34|  36.0M|static inline uint64_t zng_memread_8(const void *ptr) {
   35|  36.0M|#if defined(HAVE_MAY_ALIAS)
   36|  36.0M|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   37|  36.0M|    return ((const unaligned_uint64_t *)ptr)->val;
   38|       |#else
   39|       |    uint64_t val;
   40|       |    memcpy(&val, ptr, sizeof(val));
   41|       |    return val;
   42|       |#endif
   43|  36.0M|}
trees.c:zng_memwrite_4:
   54|  1.00k|static inline void zng_memwrite_4(void *ptr, uint32_t val) {
   55|  1.00k|#if defined(HAVE_MAY_ALIAS)
   56|  1.00k|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|  1.00k|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|  1.00k|}
compare256_avx2.c:zng_memread_8:
   34|   187M|static inline uint64_t zng_memread_8(const void *ptr) {
   35|   187M|#if defined(HAVE_MAY_ALIAS)
   36|   187M|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   37|   187M|    return ((const unaligned_uint64_t *)ptr)->val;
   38|       |#else
   39|       |    uint64_t val;
   40|       |    memcpy(&val, ptr, sizeof(val));
   41|       |    return val;
   42|       |#endif
   43|   187M|}
compare256_avx2.c:zng_memcmp_8:
   91|  10.2M|static inline int32_t zng_memcmp_8(const void * Z_RESTRICT src0, const void * Z_RESTRICT src1) {
   92|  10.2M|#if defined(HAVE_MAY_ALIAS) || defined(_MSC_VER)
   93|  10.2M|    return zng_memread_8(src0) != zng_memread_8(src1);
   94|       |#else
   95|       |    return memcmp(src0, src1, 8);
   96|       |#endif
   97|  10.2M|}

zng_zcalloc:
  105|  7.10k|void Z_INTERNAL *PREFIX(zcalloc)(void *opaque, unsigned items, unsigned size) {
  106|  7.10k|    Z_UNUSED(opaque);
  ------------------
  |  |  154|  7.10k|#define Z_UNUSED(var) (void)(var)
  ------------------
  107|  7.10k|    return zng_alloc((size_t)items * (size_t)size);
  108|  7.10k|}
zng_zcfree:
  110|  7.10k|void Z_INTERNAL PREFIX(zcfree)(void *opaque, void *ptr) {
  111|  7.10k|    Z_UNUSED(opaque);
  ------------------
  |  |  154|  7.10k|#define Z_UNUSED(var) (void)(var)
  ------------------
  112|  7.10k|    zng_free(ptr);
  113|  7.10k|}

zutil.c:zng_alloc:
   12|  7.10k|static inline void *zng_alloc(size_t size) {
   13|  7.10k|    return malloc(size);
   14|  7.10k|}
zutil.c:zng_free:
   16|  7.10k|static inline void zng_free(void *ptr) {
   17|  7.10k|    free(ptr);
   18|  7.10k|}

