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

adler32_copy_avx2:
  168|   351M|Z_INTERNAL uint32_t adler32_copy_avx2(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len) {
  169|   351M|    return adler32_copy_impl(adler, dst, src, len, 1);
  170|   351M|}
adler32_avx2.c:adler32_copy_impl:
   21|   351M|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|   351M|    uint32_t adler0, adler1;
   23|   351M|    adler1 = (adler >> 16) & 0xffff;
   24|   351M|    adler0 = adler & 0xffff;
   25|       |
   26|   351M|rem_peel:
   27|   351M|    if (len < 16) {
  ------------------
  |  Branch (27:9): [True: 351M, False: 0]
  ------------------
   28|   351M|        return adler32_copy_tail(adler0, dst, src, len, adler1, 1, 15, COPY);
   29|   351M|    } 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);
  ------------------
  |  |  304|      0|    ((value) & ~((align) - 1))
  |  |  ------------------
  |  |  |  Branch (304: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|   829k|Z_FORCEINLINE static uint32_t compare256_avx2_static(const uint8_t *src0, const uint8_t *src1) {
   20|   829k|    uint32_t len = 0;
   21|       |
   22|  1.12M|    do {
   23|  1.12M|        __m256i ymm_src0, ymm_src1, ymm_cmp;
   24|  1.12M|        ymm_src0 = _mm256_loadu_si256((__m256i*)src0);
   25|  1.12M|        ymm_src1 = _mm256_loadu_si256((__m256i*)src1);
   26|  1.12M|        ymm_cmp = _mm256_cmpeq_epi8(ymm_src0, ymm_src1); /* non-identical bytes = 00, identical bytes = FF */
   27|  1.12M|        unsigned mask = (unsigned)_mm256_movemask_epi8(ymm_cmp);
   28|  1.12M|        if (mask != 0xFFFFFFFF)
  ------------------
  |  Branch (28:13): [True: 625k, False: 503k]
  ------------------
   29|   625k|            return len + zng_ctz32(~mask); /* Invert bits so identical = 0 */
   30|       |
   31|   503k|        src0 += 32, src1 += 32, len += 32;
   32|       |
   33|   503k|        ymm_src0 = _mm256_loadu_si256((__m256i*)src0);
   34|   503k|        ymm_src1 = _mm256_loadu_si256((__m256i*)src1);
   35|   503k|        ymm_cmp = _mm256_cmpeq_epi8(ymm_src0, ymm_src1);
   36|   503k|        mask = (unsigned)_mm256_movemask_epi8(ymm_cmp);
   37|   503k|        if (mask != 0xFFFFFFFF)
  ------------------
  |  Branch (37:13): [True: 131k, False: 372k]
  ------------------
   38|   131k|            return len + zng_ctz32(~mask);
   39|       |
   40|   372k|        src0 += 32, src1 += 32, len += 32;
   41|   372k|    } while (len < 256);
  ------------------
  |  Branch (41:14): [True: 299k, False: 72.8k]
  ------------------
   42|       |
   43|  72.8k|    return 256;
   44|   829k|}

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

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

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

deflate.c:put_short_msb:
  375|  3.76k|static inline void put_short_msb(deflate_state *s, uint16_t w) {
  376|  3.76k|    w = Z_U16_TO_BE(w);
  ------------------
  |  |   89|  3.76k|#  define Z_U16_TO_BE(x)    ZSWAP16(x)
  |  |  ------------------
  |  |  |  |  224|  3.76k|#  define ZSWAP16(q) __builtin_bswap16(q)
  |  |  ------------------
  ------------------
  377|  3.76k|    zng_memwrite_2(&s->pending_buf[s->pending], w);
  378|  3.76k|    s->pending += 2;
  379|  3.76k|}
deflate.c:put_uint32_msb:
  395|  3.76k|static inline void put_uint32_msb(deflate_state *s, uint32_t dw) {
  396|  3.76k|    dw = Z_U32_TO_BE(dw);
  ------------------
  |  |   90|  3.76k|#  define Z_U32_TO_BE(x)    ZSWAP32(x)
  |  |  ------------------
  |  |  |  |  225|  3.76k|#  define ZSWAP32(q) __builtin_bswap32(q)
  |  |  ------------------
  ------------------
  397|  3.76k|    zng_memwrite_4(&s->pending_buf[s->pending], dw);
  398|  3.76k|    s->pending += 4;
  399|  3.76k|}
trees.c:put_uint64:
  405|  63.4k|static inline void put_uint64(deflate_state *s, uint64_t lld) {
  406|  63.4k|    lld = Z_U64_TO_LE(lld);
  ------------------
  |  |   85|  63.4k|#  define Z_U64_TO_LE(x)    (x)
  ------------------
  407|  63.4k|    zng_memwrite_8(&s->pending_buf[s->pending], lld);
  408|  63.4k|    s->pending += 8;
  409|  63.4k|}
trees.c:put_short:
  365|  12.8k|static inline void put_short(deflate_state *s, uint16_t w) {
  366|  12.8k|    w = Z_U16_TO_LE(w);
  ------------------
  |  |   83|  12.8k|#  define Z_U16_TO_LE(x)    (x)
  ------------------
  367|  12.8k|    zng_memwrite_2(&s->pending_buf[s->pending], w);
  368|  12.8k|    s->pending += 2;
  369|  12.8k|}
trees.c:put_uint32:
  385|  1.02k|static inline void put_uint32(deflate_state *s, uint32_t dw) {
  386|  1.02k|    dw = Z_U32_TO_LE(dw);
  ------------------
  |  |   84|  1.02k|#  define Z_U32_TO_LE(x)    (x)
  ------------------
  387|  1.02k|    zng_memwrite_4(&s->pending_buf[s->pending], dw);
  388|  1.02k|    s->pending += 4;
  389|  1.02k|}

deflate_medium_fizzle:
  170|   175M|Z_INTERNAL block_state SUFFIX(deflate_medium)(deflate_state *s, int flush) {
  171|   175M|    ALIGNED_(16) struct match current_match = {0};
  ------------------
  |  |  277|   175M|#  define ALIGNED_(x) __attribute__ ((aligned(x)))
  ------------------
  172|   175M|#ifdef USE_FIZZLE
  173|   175M|                 struct match next_match = {0};
  174|   175M|#endif
  175|   175M|    unsigned char *window = s->window;
  176|   175M|    uint32_t max_insert_count = MAX(2, s->max_insert_count); // stepped insert requires min 2
  ------------------
  |  |  159|   175M|#define MAX(a, b) ((a) < (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (159:20): [True: 175M, False: 0]
  |  |  ------------------
  ------------------
  177|   175M|    int32_t max_dist = MAX_DIST(s);
  ------------------
  |  |  416|   175M|#define MAX_DIST(s)  ((s)->max_dist)
  ------------------
  178|       |
  179|   315M|    for (;;) {
  180|   315M|        int bflush = 0;       /* set if current block must be flushed */
  181|   315M|        uint32_t curr_match_len;
  182|       |
  183|       |        /* Make sure that we always have enough lookahead, except
  184|       |         * at the end of the input file. We need STD_MAX_MATCH bytes
  185|       |         * for the next match, plus WANT_MIN_MATCH bytes to insert the
  186|       |         * string following the next current_match.
  187|       |         */
  188|   315M|        if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD)) {
  ------------------
  |  |  269|   315M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 315M, False: 0]
  |  |  ------------------
  ------------------
  189|   315M|            PREFIX(fill_window)(s);
  ------------------
  |  |  130|   315M|#  define PREFIX(x) zng_ ## x
  ------------------
  190|   315M|            if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH)) {
  ------------------
  |  |  269|   491M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 175M, False: 139M]
  |  |  |  Branch (269:53): [True: 176M, False: 139M]
  |  |  |  Branch (269:53): [True: 175M, False: 343k]
  |  |  ------------------
  ------------------
  191|   175M|                return need_more;
  192|   175M|            }
  193|   139M|            if (UNLIKELY(s->lookahead == 0))
  ------------------
  |  |  269|   139M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 3.76k, False: 139M]
  |  |  ------------------
  ------------------
  194|  3.76k|                break; /* flush the current block */
  195|   139M|#ifdef USE_FIZZLE
  196|   139M|            next_match.match_length = 0;
  197|   139M|#endif
  198|   139M|        }
  199|       |
  200|       |        /* Insert the string window[strstart .. strstart+2] in the
  201|       |         * dictionary, and set hash_head to the head of the hash chain:
  202|       |         */
  203|       |
  204|   139M|#ifdef USE_FIZZLE
  205|       |        /* If we already have a future match from a previous round, just use that */
  206|   139M|        if (next_match.match_length > 0) {
  ------------------
  |  Branch (206:13): [True: 0, False: 139M]
  ------------------
  207|      0|            current_match = next_match;
  208|      0|            next_match.match_length = 0;
  209|   139M|        } else {
  210|   139M|            uint32_t hash_head = 0;   /* head of the hash chain */
  211|   139M|            if (LIKELY(s->lookahead >= WANT_MIN_MATCH)) {
  ------------------
  |  |  268|   139M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (268:33): [True: 139M, False: 6.79k]
  |  |  ------------------
  ------------------
  212|   139M|                hash_head = insert_knuth(s, window, s->strstart);
  213|   139M|            }
  214|       |
  215|   139M|            current_match = SUFFIX(find_best_match)(s, hash_head, max_dist);
  ------------------
  |  |   31|   139M|#define SUFFIX(name) name ## _fizzle
  ------------------
  216|   139M|        }
  217|   139M|        curr_match_len = current_match.match_length;
  218|       |
  219|   139M|        if (curr_match_len >= WANT_MIN_MATCH && s->lookahead > (unsigned int)(curr_match_len + WANT_MIN_MATCH )) {
  ------------------
  |  |   65|   279M|#define WANT_MIN_MATCH  4
  ------------------
                      if (curr_match_len >= WANT_MIN_MATCH && s->lookahead > (unsigned int)(curr_match_len + WANT_MIN_MATCH )) {
  ------------------
  |  |   65|  2.40M|#define WANT_MIN_MATCH  4
  ------------------
  |  Branch (219:13): [True: 2.40M, False: 137M]
  |  Branch (219:49): [True: 2.33M, False: 74.7k]
  ------------------
  220|  2.33M|            SUFFIX(insert_match)(s, window, current_match, max_insert_count);
  ------------------
  |  |   31|  2.33M|#define SUFFIX(name) name ## _fizzle
  ------------------
                          SUFFIX(insert_match)(s, window, current_match, max_insert_count);
  ------------------
  |  |  250|  2.33M|#   define max_insert_count  max_lazy_match
  ------------------
  221|  2.33M|        }
  222|       |
  223|   139M|        if (UNLIKELY(curr_match_len == STD_MAX_MATCH)) {
  ------------------
  |  |  269|   139M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 72.7k, False: 139M]
  |  |  ------------------
  ------------------
  224|       |            /* A max-length match cannot be extended by fizzle without truncating it,
  225|       |             * skip fizzle and instead check for continuation after emitting current match. */
  226|  72.7k|            next_match.match_length = 0;
  227|   139M|        } else if (LIKELY((s->lookahead > MIN_LOOKAHEAD) &
  ------------------
  |  |  268|   139M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (268:33): [True: 0, False: 139M]
  |  |  ------------------
  ------------------
  228|   139M|                          ((current_match.strstart + curr_match_len) < s->fill_end))) {
  229|       |            /* now, look ahead one */
  230|       |            /* Spelled without short-circuit so both loads issue before the compare, which keeps
  231|       |             * the two tests fused into one branch. */
  232|      0|            s->strstart = current_match.strstart + curr_match_len;
  233|      0|            uint32_t hash_head = insert_knuth(s, window, s->strstart);
  234|       |
  235|      0|            next_match = SUFFIX(find_best_match)(s, hash_head, max_dist);
  ------------------
  |  |   31|      0|#define SUFFIX(name) name ## _fizzle
  ------------------
  236|       |
  237|      0|            uint32_t tmp_cmatch_len_sub = curr_match_len - 1;
  238|      0|            if (tmp_cmatch_len_sub
  ------------------
  |  Branch (238:17): [True: 0, False: 0]
  ------------------
  239|      0|                     && next_match.match_length >= WANT_MIN_MATCH
  ------------------
  |  |   65|      0|#define WANT_MIN_MATCH  4
  ------------------
  |  Branch (239:25): [True: 0, False: 0]
  ------------------
  240|      0|                     && tmp_cmatch_len_sub <= next_match.match_start) {
  ------------------
  |  Branch (240:25): [True: 0, False: 0]
  ------------------
  241|      0|                fizzle_matches(window, &current_match, &next_match, max_dist);
  242|      0|                curr_match_len = current_match.match_length;
  243|      0|            }
  244|       |
  245|      0|            s->strstart = current_match.strstart;
  246|      0|            if (curr_match_len == 0) {
  ------------------
  |  Branch (246:17): [True: 0, False: 0]
  ------------------
  247|       |                /* If current match fizzled out, jump to next loop iteration */
  248|      0|                continue;
  249|      0|            }
  250|   139M|        } else {
  251|   139M|            next_match.match_length = 0;
  252|   139M|        }
  253|       |#else
  254|       |        // WITHOUT_FIZZLE: We don't look for future matches, so code is much simplified
  255|       |        uint32_t hash_head = 0;   /* head of the hash chain */
  256|       |        if (LIKELY(s->lookahead >= WANT_MIN_MATCH)) {
  257|       |            hash_head = insert_knuth(s, window, s->strstart);
  258|       |        }
  259|       |
  260|       |        current_match = SUFFIX(find_best_match)(s, hash_head, max_dist);
  261|       |        curr_match_len = current_match.match_length;
  262|       |
  263|       |        if (curr_match_len >= WANT_MIN_MATCH && s->lookahead > (unsigned int)(curr_match_len + WANT_MIN_MATCH )) {
  264|       |            SUFFIX(insert_match)(s, window, current_match, max_insert_count);
  265|       |        }
  266|       |#endif
  267|       |
  268|       |        /* now emit the current match */
  269|   139M|        s->lookahead -= curr_match_len;
  270|   139M|        if (LIKELY(curr_match_len == 1)) {
  ------------------
  |  |  268|   139M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (268:33): [True: 137M, False: 2.40M]
  |  |  ------------------
  ------------------
  271|       |            /* matches shorter than WANT_MIN_MATCH are set to 1, we need to emit these as literals */
  272|   137M|            bflush = zng_tr_tally_lit(s, window[current_match.strstart]);
  273|   137M|        } else {
  274|  2.40M|            check_match(s, current_match.strstart, current_match.match_start, curr_match_len);
  275|  2.40M|            bflush = zng_tr_tally_dist(s, current_match.strstart - current_match.match_start, curr_match_len - STD_MIN_MATCH);
  ------------------
  |  |   61|  2.40M|#define STD_MIN_MATCH  3
  ------------------
  276|  2.40M|        }
  277|       |
  278|       |        /* move the "cursor" forward */
  279|   139M|        s->strstart += curr_match_len;
  280|       |
  281|       |        /* A max-length match might continue: keep emitting continuations at the same
  282|       |         * distance without a full search as long as possible. */
  283|   139M|        if (UNLIKELY(curr_match_len == STD_MAX_MATCH && s->lookahead >= MIN_LOOKAHEAD)) {
  ------------------
  |  |  269|   139M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 0, False: 139M]
  |  |  |  Branch (269:53): [True: 72.7k, False: 139M]
  |  |  |  Branch (269:53): [True: 0, False: 72.7k]
  |  |  ------------------
  ------------------
  284|      0|            uint32_t cont_dist = current_match.strstart - current_match.match_start;
  285|      0|            for (;;) {
  286|      0|                struct match cont_match;
  287|       |
  288|       |                // Check for continuing match
  289|      0|                uint32_t cont_len = max_match_continues(window, s->strstart, cont_dist);
  290|      0|                if (UNLIKELY(cont_len < 8))
  ------------------
  |  |  269|      0|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  291|      0|                    break;
  292|       |
  293|       |                // Set up continuation match
  294|      0|                cont_match.match_start  = s->strstart - cont_dist;
  295|      0|                cont_match.match_length = cont_len;
  296|      0|                cont_match.strstart     = s->strstart;
  297|       |
  298|      0|                check_match(s, cont_match.strstart, cont_match.match_start, cont_len);
  299|       |
  300|       |                // Skip hashing positions that overlap the match (see find_best_match).
  301|      0|                cont_match.orgstart = (cont_dist < cont_len) ? cont_match.strstart + cont_len - cont_dist : cont_match.strstart;
  ------------------
  |  Branch (301:39): [True: 0, False: 0]
  ------------------
  302|       |
  303|       |                // Insert match
  304|      0|                insert_knuth(s, window, s->strstart);
  305|      0|                SUFFIX(insert_match)(s, window, cont_match, max_insert_count);
  ------------------
  |  |   31|      0|#define SUFFIX(name) name ## _fizzle
  ------------------
                              SUFFIX(insert_match)(s, window, cont_match, max_insert_count);
  ------------------
  |  |  250|      0|#   define max_insert_count  max_lazy_match
  ------------------
  306|       |
  307|       |                // Emit match
  308|      0|                s->lookahead -= cont_len;
  309|      0|                bflush |= zng_tr_tally_dist(s, cont_dist, cont_len - STD_MIN_MATCH);
  ------------------
  |  |   61|      0|#define STD_MIN_MATCH  3
  ------------------
  310|      0|                s->strstart += cont_len;
  311|       |
  312|      0|                if (UNLIKELY(bflush)) {
  ------------------
  |  |  269|      0|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  313|      0|                    FLUSH_BLOCK(s, window, 0);
  ------------------
  |  |  203|      0|#define FLUSH_BLOCK(s, window, last) { \
  |  |  204|      0|    FLUSH_BLOCK_ONLY(s, window, last); \
  |  |  ------------------
  |  |  |  |  191|      0|#define FLUSH_BLOCK_ONLY(s, window, last) { \
  |  |  |  |  192|      0|    int block_start = s->block_start; \
  |  |  |  |  193|      0|    zng_tr_flush_block(s, (block_start >= 0 ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (193:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  194|      0|                   &window[(unsigned)block_start] : \
  |  |  |  |  195|      0|                   NULL), \
  |  |  |  |  196|      0|                   (uint32_t)((int)s->strstart - block_start), \
  |  |  |  |  197|      0|                   (last)); \
  |  |  |  |  198|      0|    s->block_start = (int)s->strstart; \
  |  |  |  |  199|      0|    PREFIX(flush_pending)(s->strm); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|      0|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  200|      0|}
  |  |  ------------------
  |  |  205|      0|    if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (205:9): [True: 0, False: 0]
  |  |  |  Branch (205:41): [Folded, False: 0]
  |  |  ------------------
  |  |  206|      0|}
  ------------------
  314|      0|                    bflush = 0;
  315|      0|                }
  316|      0|                if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD)) {
  ------------------
  |  |  269|      0|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  317|      0|                    break; /* not enough lookahead, return to the main loop */
  318|      0|                }
  319|      0|            }
  320|      0|        }
  321|       |
  322|   139M|        if (UNLIKELY(bflush))
  ------------------
  |  |  269|   139M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 8.22k, False: 139M]
  |  |  ------------------
  ------------------
  323|   139M|            FLUSH_BLOCK(s, window, 0);
  ------------------
  |  |  203|  8.22k|#define FLUSH_BLOCK(s, window, last) { \
  |  |  204|  8.22k|    FLUSH_BLOCK_ONLY(s, window, last); \
  |  |  ------------------
  |  |  |  |  191|  8.22k|#define FLUSH_BLOCK_ONLY(s, window, last) { \
  |  |  |  |  192|  8.22k|    int block_start = s->block_start; \
  |  |  |  |  193|  8.22k|    zng_tr_flush_block(s, (block_start >= 0 ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (193:28): [True: 8.09k, False: 134]
  |  |  |  |  ------------------
  |  |  |  |  194|  8.22k|                   &window[(unsigned)block_start] : \
  |  |  |  |  195|  8.22k|                   NULL), \
  |  |  |  |  196|  8.22k|                   (uint32_t)((int)s->strstart - block_start), \
  |  |  |  |  197|  8.22k|                   (last)); \
  |  |  |  |  198|  8.22k|    s->block_start = (int)s->strstart; \
  |  |  |  |  199|  8.22k|    PREFIX(flush_pending)(s->strm); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  8.22k|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  200|  8.22k|}
  |  |  ------------------
  |  |  205|  8.22k|    if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (205:9): [True: 8.22k, False: 0]
  |  |  |  Branch (205:41): [Folded, False: 8.22k]
  |  |  ------------------
  |  |  206|  8.22k|}
  ------------------
  324|   139M|    }
  325|       |
  326|  3.76k|    s->insert = s->strstart < (STD_MIN_MATCH - 1) ? s->strstart : (STD_MIN_MATCH - 1);
  ------------------
  |  |   61|  3.76k|#define STD_MIN_MATCH  3
  ------------------
                  s->insert = s->strstart < (STD_MIN_MATCH - 1) ? s->strstart : (STD_MIN_MATCH - 1);
  ------------------
  |  |   61|  3.73k|#define STD_MIN_MATCH  3
  ------------------
  |  Branch (326:17): [True: 25, False: 3.73k]
  ------------------
  327|  3.76k|    if (flush == Z_FINISH) {
  ------------------
  |  |  175|  3.76k|#define Z_FINISH        4
  ------------------
  |  Branch (327:9): [True: 3.76k, False: 0]
  ------------------
  328|  3.76k|        FLUSH_BLOCK(s, window, 1);
  ------------------
  |  |  203|  3.76k|#define FLUSH_BLOCK(s, window, last) { \
  |  |  204|  3.76k|    FLUSH_BLOCK_ONLY(s, window, last); \
  |  |  ------------------
  |  |  |  |  191|  3.76k|#define FLUSH_BLOCK_ONLY(s, window, last) { \
  |  |  |  |  192|  3.76k|    int block_start = s->block_start; \
  |  |  |  |  193|  3.76k|    zng_tr_flush_block(s, (block_start >= 0 ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (193:28): [True: 3.68k, False: 73]
  |  |  |  |  ------------------
  |  |  |  |  194|  3.76k|                   &window[(unsigned)block_start] : \
  |  |  |  |  195|  3.76k|                   NULL), \
  |  |  |  |  196|  3.76k|                   (uint32_t)((int)s->strstart - block_start), \
  |  |  |  |  197|  3.76k|                   (last)); \
  |  |  |  |  198|  3.76k|    s->block_start = (int)s->strstart; \
  |  |  |  |  199|  3.76k|    PREFIX(flush_pending)(s->strm); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  3.76k|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  200|  3.76k|}
  |  |  ------------------
  |  |  205|  3.76k|    if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (205:9): [True: 3.76k, False: 0]
  |  |  |  Branch (205:41): [True: 3.76k, Folded]
  |  |  ------------------
  |  |  206|  3.76k|}
  ------------------
  329|      0|        return finish_done;
  330|  3.76k|    }
  331|      0|    if (UNLIKELY(s->sym_next))
  ------------------
  |  |  269|      0|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  332|      0|        FLUSH_BLOCK(s, window, 0);
  ------------------
  |  |  203|      0|#define FLUSH_BLOCK(s, window, last) { \
  |  |  204|      0|    FLUSH_BLOCK_ONLY(s, window, last); \
  |  |  ------------------
  |  |  |  |  191|      0|#define FLUSH_BLOCK_ONLY(s, window, last) { \
  |  |  |  |  192|      0|    int block_start = s->block_start; \
  |  |  |  |  193|      0|    zng_tr_flush_block(s, (block_start >= 0 ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (193:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  194|      0|                   &window[(unsigned)block_start] : \
  |  |  |  |  195|      0|                   NULL), \
  |  |  |  |  196|      0|                   (uint32_t)((int)s->strstart - block_start), \
  |  |  |  |  197|      0|                   (last)); \
  |  |  |  |  198|      0|    s->block_start = (int)s->strstart; \
  |  |  |  |  199|      0|    PREFIX(flush_pending)(s->strm); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|      0|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  200|      0|}
  |  |  ------------------
  |  |  205|      0|    if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (205:9): [True: 0, False: 0]
  |  |  |  Branch (205:41): [Folded, False: 0]
  |  |  ------------------
  |  |  206|      0|}
  ------------------
  333|       |
  334|      0|    return block_done;
  335|      0|}
deflate_medium.c:find_best_match_fizzle:
   43|   139M|Z_FORCEINLINE static struct match SUFFIX(find_best_match)(deflate_state *s, uint32_t hash_head, int32_t max_dist) {
   44|   139M|    struct match m;
   45|   139M|    int32_t dist;
   46|       |
   47|       |    /* Initialize the match to be a 1 byte literal */
   48|   139M|    m.match_start = 0;
   49|   139M|    m.match_length = 1;
   50|   139M|    m.strstart = s->strstart;
   51|   139M|    m.orgstart = m.strstart;
   52|       |
   53|   139M|    dist = (int32_t)s->strstart - (int32_t)hash_head;
   54|   139M|    if (dist <= (int32_t)max_dist && dist > 0 && hash_head != 0) {
  ------------------
  |  Branch (54:9): [True: 68.2M, False: 71.2M]
  |  Branch (54:38): [True: 68.2M, False: 3.76k]
  |  Branch (54:50): [True: 49.0M, False: 19.1M]
  ------------------
   55|       |        /* To simplify the code, we prevent matches with the string
   56|       |         * of window index 0 (in particular we have to avoid a match
   57|       |         * of the string with itself at the start of the input file).
   58|       |         */
   59|  49.0M|        uint32_t match_len = FUNCTABLE_CALL(longest_match)(s, hash_head);
  ------------------
  |  |   48|  49.0M|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
   60|  49.0M|        m.match_start = s->match_start;
   61|  49.0M|        if (UNLIKELY(match_len < WANT_MIN_MATCH))
  ------------------
  |  |  269|  49.0M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 46.6M, False: 2.40M]
  |  |  ------------------
  ------------------
   62|  46.6M|            return m;
   63|  2.40M|        if (UNLIKELY(m.match_start >= m.strstart)) {
  ------------------
  |  |  269|  2.40M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 0, False: 2.40M]
  |  |  ------------------
  ------------------
   64|       |            /* this can happen due to some restarts */
   65|      0|            return m;
   66|      0|        }
   67|  2.40M|        m.match_length = match_len;
   68|       |
   69|       |        /* We want to skip hashing overlapping positions when dist < match_length,
   70|       |         * encode this into orgstart, fizzle_matches might re-introduce some
   71|       |         * overlapping positions, but the simplification is worth it.
   72|       |         *
   73|       |         * If dist < match_length, the first (match_length - dist) positions
   74|       |         * are byte-identical to data `dist` bytes earlier (already in table).
   75|       |         */
   76|  2.40M|        uint32_t match_dist = m.strstart - m.match_start;
   77|  2.40M|        if (match_dist < match_len) {
  ------------------
  |  Branch (77:13): [True: 78.0k, False: 2.33M]
  ------------------
   78|  78.0k|            m.orgstart += match_len - match_dist;
   79|  78.0k|        }
   80|  2.40M|    }
   81|  92.8M|    return m;
   82|   139M|}
deflate_medium.c:insert_match_fizzle:
   16|  2.33M|Z_FORCEINLINE static void SUFFIX(insert_match)(deflate_state *s, unsigned char *Z_RESTRICT window, struct match match, uint32_t max_insert_count) {
   17|  2.33M|    uint32_t strstart = match.strstart + 1;        // string at strstart already in table
   18|  2.33M|    uint32_t match_len = match.match_length - 1;
   19|  2.33M|    uint32_t max_len = 2 * max_insert_count;       // Normally 32, 56, 96 and 112 for levels 3-6
  ------------------
  |  |  250|  2.33M|#   define max_insert_count  max_lazy_match
  ------------------
   20|       |
   21|       |    /* Don't re-hash positions hashed as literals (see fizzle_matches).
   22|       |     * Also don't hash overlapping positions (see find_best_match). */
   23|  2.33M|    if (UNLIKELY(strstart < match.orgstart)) {
  ------------------
  |  |  269|  2.33M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 33.1k, False: 2.30M]
  |  |  ------------------
  ------------------
   24|  33.1k|        uint32_t end = strstart + match_len;
   25|       |
   26|  33.1k|        strstart = match.orgstart;
   27|  33.1k|        match_len = end - strstart;
   28|  33.1k|        if (match_len == 0) {
  ------------------
  |  Branch (28:13): [True: 0, False: 33.1k]
  ------------------
   29|       |            /* Hash only the tail position */
   30|      0|            insert_knuth(s, window, end - 1);
   31|      0|            return;
   32|      0|        }
   33|  33.1k|    }
   34|       |
   35|       |    /* Shorter matches insert every position, which needs no step and no division. */
   36|  2.33M|    if (LIKELY(match_len <= max_len)) {
  ------------------
  |  |  268|  2.33M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (268:33): [True: 2.31M, False: 17.6k]
  |  |  ------------------
  ------------------
   37|  2.31M|        insert_knuth_batch(s, window, strstart, match_len);
   38|  2.31M|        return;
   39|  2.31M|    }
   40|  17.6k|    insert_knuth_stepped(s, window, strstart, match_len, max_insert_count);
  ------------------
  |  |  250|  17.6k|#   define max_insert_count  max_lazy_match
  ------------------
   41|  17.6k|}

deflate.c:flush_pending_inline:
  111|   134M|Z_FORCEINLINE static void flush_pending_inline(PREFIX3(stream) *strm) {
  112|   134M|    uint32_t len;
  113|   134M|    deflate_state *s = strm->state;
  114|       |
  115|   134M|    zng_tr_flush_bits(s);
  116|   134M|    len = MIN(s->pending, strm->avail_out);
  ------------------
  |  |  157|   134M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (157:20): [True: 134M, False: 23.2k]
  |  |  ------------------
  ------------------
  117|   134M|    if (len == 0)
  ------------------
  |  Branch (117:9): [True: 3.76k, False: 134M]
  ------------------
  118|  3.76k|        return;
  119|       |
  120|   134M|    Tracev((stderr, "[FLUSH]"));
  121|   134M|    memcpy(strm->next_out, s->pending_out, len);
  122|   134M|    strm->next_out  += len;
  123|   134M|    s->pending_out  += len;
  124|   134M|    strm->total_out += len;
  125|   134M|    strm->avail_out -= len;
  126|   134M|    s->pending      -= len;
  127|   134M|    if (s->pending == 0)
  ------------------
  |  Branch (127:9): [True: 19.5k, False: 134M]
  ------------------
  128|  19.5k|        s->pending_out = s->pending_buf;
  129|   134M|}
deflate.c:read_buf:
  147|   175M|Z_FORCEINLINE static unsigned read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size) {
  148|   175M|    deflate_state *s = strm->state;
  149|   175M|    uint32_t len = MIN(strm->avail_in, size);
  ------------------
  |  |  157|   175M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (157:20): [True: 0, False: 175M]
  |  |  ------------------
  ------------------
  150|       |
  151|   175M|    if (len == 0)
  ------------------
  |  Branch (151:9): [True: 0, False: 175M]
  ------------------
  152|      0|        return 0;
  153|       |
  154|   175M|    if (!DEFLATE_NEED_CHECKSUM(strm)) {
  ------------------
  |  |  507|   175M|#  define DEFLATE_NEED_CHECKSUM(strm) 1
  ------------------
  |  Branch (154:9): [Folded, False: 175M]
  ------------------
  155|      0|        memcpy(buf, strm->next_in, len);
  156|      0|#ifdef GZIP
  157|   175M|    } else if (s->wrap == 2) {
  ------------------
  |  Branch (157:16): [True: 0, False: 175M]
  ------------------
  158|      0|        strm->adler = FUNCTABLE_CALL(crc32_copy)(strm->adler, buf, strm->next_in, len);
  ------------------
  |  |   48|      0|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
  159|      0|#endif
  160|   175M|    } else if (s->wrap == 1) {
  ------------------
  |  Branch (160:16): [True: 175M, False: 0]
  ------------------
  161|   175M|        strm->adler = FUNCTABLE_CALL(adler32_copy)(strm->adler, buf, strm->next_in, len);
  ------------------
  |  |   48|   175M|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
  162|   175M|    } else {
  163|      0|        memcpy(buf, strm->next_in, len);
  164|      0|    }
  165|       |
  166|   175M|    strm->avail_in -= len;
  167|   175M|    strm->next_in  += len;
  168|   175M|    strm->total_in += len;
  169|   175M|    return len;
  170|   175M|}
deflate_medium.c:zng_tr_tally_lit:
   64|   137M|static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) {
   65|       |    /* c is the unmatched char */
   66|   137M|    unsigned int sym_next = s->sym_next;
   67|   137M|#if OPTIMAL_CMP >= 32
   68|   137M|    zng_memwrite_4(&s->sym_buf[sym_next], Z_U32_TO_LE((uint32_t)c << 16));
  ------------------
  |  |   84|   137M|#  define Z_U32_TO_LE(x)    (x)
  ------------------
   69|       |#else
   70|       |    s->sym_buf[sym_next] = 0;
   71|       |    s->sym_buf[sym_next+1] = 0;
   72|       |    s->sym_buf[sym_next+2] = c;
   73|       |#endif
   74|   137M|    s->sym_next = sym_next + 3;
   75|   137M|    s->dyn_ltree[c].Freq++;
  ------------------
  |  |  127|   137M|#define Freq fc.freq
  ------------------
   76|   137M|    Tracevv((stderr, "%c", c));
   77|       |#ifdef ZLIB_DEBUG
   78|       |    uint32_t _c = c;
   79|       |    Assert(_c <= (STD_MAX_MATCH-STD_MIN_MATCH), "zng_tr_tally: bad literal");
   80|       |#endif
   81|   137M|    return (s->sym_next == s->sym_end);
   82|   137M|}
deflate_medium.c:zng_tr_tally_dist:
   84|  2.40M|static inline int zng_tr_tally_dist(deflate_state* s, uint32_t dist, uint32_t len) {
   85|       |    /* dist: distance of matched string */
   86|       |    /* len: match length-STD_MIN_MATCH */
   87|  2.40M|    unsigned int sym_next = s->sym_next;
   88|  2.40M|#if OPTIMAL_CMP >= 32
   89|  2.40M|    zng_memwrite_4(&s->sym_buf[sym_next], Z_U32_TO_LE(dist | ((uint32_t)len << 16)));
  ------------------
  |  |   84|  2.40M|#  define Z_U32_TO_LE(x)    (x)
  ------------------
   90|       |#else
   91|       |    s->sym_buf[sym_next] = (uint8_t)(dist);
   92|       |    s->sym_buf[sym_next+1] = (uint8_t)(dist >> 8);
   93|       |    s->sym_buf[sym_next+2] = (uint8_t)len;
   94|       |#endif
   95|  2.40M|    s->sym_next = sym_next + 3;
   96|  2.40M|    dist--;
   97|  2.40M|    Assert(dist < MAX_DIST(s) && (uint16_t)d_code(dist) < (uint16_t)D_CODES,
   98|  2.40M|        "zng_tr_tally: bad match");
   99|       |
  100|  2.40M|    s->dyn_ltree[zng_length_code[len] + LITERALS + 1].Freq++;
  ------------------
  |  |   37|  2.40M|#define LITERALS  256
  ------------------
                  s->dyn_ltree[zng_length_code[len] + LITERALS + 1].Freq++;
  ------------------
  |  |  127|  2.40M|#define Freq fc.freq
  ------------------
  101|  2.40M|    s->dyn_dtree[d_code(dist)].Freq++;
  ------------------
  |  |  454|  2.40M|#define d_code(dist) zng_dist_code[(dist) < 256 ? (dist) : (256 + ((dist) >> 7))]
  |  |  ------------------
  |  |  |  Branch (454:36): [True: 602k, False: 1.80M]
  |  |  ------------------
  ------------------
                  s->dyn_dtree[d_code(dist)].Freq++;
  ------------------
  |  |  127|  2.40M|#define Freq fc.freq
  ------------------
  102|  2.40M|    return (s->sym_next == s->sym_end);
  103|  2.40M|}
trees.c:bi_reverse:
  134|  2.44M|Z_FORCEINLINE static uint16_t bi_reverse(uint16_t code, int len) {
  135|       |    /* code: the value to invert */
  136|       |    /* len: its bit length */
  137|  2.44M|    Assert(len >= 1 && len <= 15, "code length must be 1-15");
  138|  2.44M|    return zng_bitreverse16(code) >> (16 - len);
  139|  2.44M|}

deflate.c:zng_ctz32:
   20|  3.76k|Z_FORCEINLINE static uint32_t zng_ctz32(uint32_t value) {
   21|  3.76k|    Assert(value != 0, "Invalid input value: 0");
   22|  3.76k|#if __has_builtin(__builtin_ctz)
   23|  3.76k|    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.76k|}
inftrees.c:zng_bitreverse16:
  141|  1.91M|Z_FORCEINLINE static uint16_t zng_bitreverse16(uint16_t value) {
  142|  1.91M|#if __has_builtin(__builtin_bitreverse16)
  143|  1.91M|    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.91M|}
trees.c:zng_bitreverse16:
  141|  2.44M|Z_FORCEINLINE static uint16_t zng_bitreverse16(uint16_t value) {
  142|  2.44M|#if __has_builtin(__builtin_bitreverse16)
  143|  2.44M|    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.44M|}
compare256_avx2.c:zng_ctz32:
   20|   756k|Z_FORCEINLINE static uint32_t zng_ctz32(uint32_t value) {
   21|   756k|    Assert(value != 0, "Invalid input value: 0");
   22|   756k|#if __has_builtin(__builtin_ctz)
   23|   756k|    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|   756k|}
compare256_avx2.c:zng_ctz64:
   44|  2.24M|Z_FORCEINLINE static uint32_t zng_ctz64(uint64_t value) {
   45|  2.24M|    Assert(value != 0, "Invalid input value: 0");
   46|  2.24M|#if __has_builtin(__builtin_ctzll)
   47|  2.24M|    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.24M|}

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.52k|static int force_init_empty(void) {
   64|  7.52k|    return 0;
   65|  7.52k|}

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

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

insert_knuth_batch:
   12|  2.31M|Z_INTERNAL void insert_knuth_batch(deflate_state *const s, unsigned char *window, uint32_t str, uint32_t count) {
   13|  2.31M|    insert_knuth_batch_static(s, window, str, count);
   14|  2.31M|}
insert_knuth_stepped:
   16|  17.6k|Z_INTERNAL void insert_knuth_stepped(deflate_state *const s, unsigned char *window, uint32_t str, uint32_t count, uint32_t step) {
   17|  17.6k|    insert_knuth_stepped_static(s, window, str, count, step);
   18|  17.6k|}

deflate.c:insert_knuth:
   69|   175M|Z_FORCEINLINE static uint32_t insert_knuth(deflate_state *const s, unsigned char *window, uint32_t str) {
   70|   175M|    uint8_t *strstart = window + str;
   71|   175M|    uint32_t val, h, head;
   72|       |
   73|   175M|    val = Z_U32_FROM_LE(zng_memread_4(strstart));
  ------------------
  |  |   87|   175M|#  define Z_U32_FROM_LE(x)  (x)
  ------------------
   74|   175M|    UPDATE_HASH_KNUTH(h, val);
  ------------------
  |  |   10|   175M|#define UPDATE_HASH_KNUTH(h,val) h = (((val) * 2654435761U) >> KNUTH_SHIFT)
  |  |  ------------------
  |  |  |  |    9|   175M|#define KNUTH_SHIFT (32 - HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|   175M|#  define HASH_BITS    16u         /* log2(HASH_SIZE) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   75|       |
   76|   175M|    head = s->head[h];
   77|   175M|    if (LIKELY(head != str)) {
  ------------------
  |  |  268|   175M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (268:33): [True: 72.7k, False: 175M]
  |  |  ------------------
  ------------------
   78|  72.7k|        s->prev[str & W_MASK(s)] = (Pos)head;
  ------------------
  |  |  421|  72.7k|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
   79|  72.7k|        s->head[h] = (Pos)str;
   80|  72.7k|    }
   81|   175M|    return head;
   82|   175M|}
deflate_medium.c:insert_knuth:
   69|   139M|Z_FORCEINLINE static uint32_t insert_knuth(deflate_state *const s, unsigned char *window, uint32_t str) {
   70|   139M|    uint8_t *strstart = window + str;
   71|   139M|    uint32_t val, h, head;
   72|       |
   73|   139M|    val = Z_U32_FROM_LE(zng_memread_4(strstart));
  ------------------
  |  |   87|   139M|#  define Z_U32_FROM_LE(x)  (x)
  ------------------
   74|   139M|    UPDATE_HASH_KNUTH(h, val);
  ------------------
  |  |   10|   139M|#define UPDATE_HASH_KNUTH(h,val) h = (((val) * 2654435761U) >> KNUTH_SHIFT)
  |  |  ------------------
  |  |  |  |    9|   139M|#define KNUTH_SHIFT (32 - HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|   139M|#  define HASH_BITS    16u         /* log2(HASH_SIZE) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   75|       |
   76|   139M|    head = s->head[h];
   77|   139M|    if (LIKELY(head != str)) {
  ------------------
  |  |  268|   139M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (268:33): [True: 139M, False: 3.70k]
  |  |  ------------------
  ------------------
   78|   139M|        s->prev[str & W_MASK(s)] = (Pos)head;
  ------------------
  |  |  421|   139M|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
   79|   139M|        s->head[h] = (Pos)str;
   80|   139M|    }
   81|   139M|    return head;
   82|   139M|}
insert_string.c:insert_knuth_batch_static:
  141|  2.31M|Z_FORCEINLINE static void insert_knuth_batch_static(deflate_state *const s, unsigned char *window, uint32_t str, uint32_t count) {
  142|  2.31M|    uint8_t *strstart = window + str;
  143|  2.31M|    uint8_t *strend = strstart + count;
  144|       |
  145|       |    /* Local pointers to avoid indirection */
  146|  2.31M|    Pos *headp = s->head;
  147|  2.31M|    Pos *prevp = s->prev;
  148|  2.31M|    const unsigned int w_mask = W_MASK(s);
  ------------------
  |  |  421|  2.31M|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
  149|       |
  150|  15.9M|    for (uint32_t idx = str; strstart < strend; idx++, strstart++) {
  ------------------
  |  Branch (150:30): [True: 13.6M, False: 2.31M]
  ------------------
  151|  13.6M|        uint32_t val, h, head;
  152|       |
  153|  13.6M|        val = Z_U32_FROM_LE(zng_memread_4(strstart));
  ------------------
  |  |   87|  13.6M|#  define Z_U32_FROM_LE(x)  (x)
  ------------------
  154|  13.6M|        UPDATE_HASH_KNUTH(h, val);
  ------------------
  |  |   10|  13.6M|#define UPDATE_HASH_KNUTH(h,val) h = (((val) * 2654435761U) >> KNUTH_SHIFT)
  |  |  ------------------
  |  |  |  |    9|  13.6M|#define KNUTH_SHIFT (32 - HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|  13.6M|#  define HASH_BITS    16u         /* log2(HASH_SIZE) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  155|       |
  156|  13.6M|        head = headp[h];
  157|  13.6M|        if (LIKELY(head != idx)) {
  ------------------
  |  |  268|  13.6M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (268:33): [True: 13.6M, False: 0]
  |  |  ------------------
  ------------------
  158|  13.6M|            prevp[idx & w_mask] = (Pos)head;
  159|  13.6M|            headp[h] = (Pos)idx;
  160|  13.6M|        }
  161|  13.6M|    }
  162|  2.31M|}
insert_string.c:insert_knuth_stepped_static:
  169|  17.6k|Z_FORCEINLINE static void insert_knuth_stepped_static(deflate_state *const s, unsigned char *window, uint32_t str, uint32_t count, uint32_t max_inserts) {
  170|  17.6k|    Assert(count >= 3, "Insert count too low");
  171|  17.6k|    Assert(max_inserts >= 2, "max_inserts too low");
  172|       |
  173|       |    /* Local pointers to avoid indirection */
  174|  17.6k|    Pos *headp = s->head;
  175|  17.6k|    Pos *prevp = s->prev;
  176|  17.6k|    const unsigned int w_mask = W_MASK(s);
  ------------------
  |  |  421|  17.6k|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
  177|       |
  178|  17.6k|    uint32_t inserts = (count < max_inserts) ? count : max_inserts;
  ------------------
  |  Branch (178:24): [True: 0, False: 17.6k]
  ------------------
  179|  17.6k|    uint32_t intervals = inserts - 1;
  180|       |
  181|       |    /*
  182|       |     * Calculate a 32-bit Fixed-Point Scale with a 16-bit fraction.
  183|       |     * Safe from overflow since (count - 1) <= 257, meaning ((257 << 16) + 256) fits easily in 32 bits.
  184|       |     * The rounding bias guarantees hitting the exact tail end ('str + count - 1') smoothly.
  185|       |     */
  186|  17.6k|    uint32_t inc_fp = (((count - 1) << 16) + (intervals - 1)) / intervals;
  187|       |
  188|       |    /* Initialize the fixed-point index tracking register */
  189|  17.6k|    uint32_t idx_fp = str << 16;
  190|       |
  191|  1.00M|    for (uint32_t i = 0; i < inserts; i++) {
  ------------------
  |  Branch (191:26): [True: 986k, False: 17.6k]
  ------------------
  192|   986k|        uint32_t val, h, head, idx;
  193|       |
  194|       |        /* Extract the real window index by shifting out the fractional bits */
  195|   986k|        idx = idx_fp >> 16;
  196|       |
  197|       |        /* Increment offset for next iteration */
  198|   986k|        idx_fp += inc_fp;
  199|       |
  200|   986k|        val = Z_U32_FROM_LE(zng_memread_4(window + idx));
  ------------------
  |  |   87|   986k|#  define Z_U32_FROM_LE(x)  (x)
  ------------------
  201|   986k|        UPDATE_HASH_KNUTH(h, val);
  ------------------
  |  |   10|   986k|#define UPDATE_HASH_KNUTH(h,val) h = (((val) * 2654435761U) >> KNUTH_SHIFT)
  |  |  ------------------
  |  |  |  |    9|   986k|#define KNUTH_SHIFT (32 - HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|   986k|#  define HASH_BITS    16u         /* log2(HASH_SIZE) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  202|       |
  203|   986k|        head = headp[h];
  204|   986k|        if (LIKELY(head != idx)) {
  ------------------
  |  |  268|   986k|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (268:33): [True: 986k, False: 0]
  |  |  ------------------
  ------------------
  205|   986k|            prevp[idx & w_mask] = (Pos)head;
  206|   986k|            headp[h] = (Pos)idx;
  207|   986k|        }
  208|   986k|    }
  209|  17.6k|}

longest_match_avx2:
   26|  49.0M|Z_INTERNAL uint32_t LONGEST_MATCH(deflate_state *const s, uint32_t cur_match) {
   27|  49.0M|    const unsigned wmask = W_MASK(s);
  ------------------
  |  |  421|  49.0M|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
   28|  49.0M|    unsigned int strstart = s->strstart;
   29|  49.0M|    const unsigned char *window = s->window;
   30|  49.0M|    const Pos *prev = s->prev;
   31|       |#ifdef LONGEST_MATCH_SLOW
   32|       |    const Pos *head = s->head;
   33|       |#endif
   34|  49.0M|    const unsigned char *scan;
   35|  49.0M|    const unsigned char *mbase_start = window;
   36|  49.0M|    const unsigned char *mbase_end;
   37|  49.0M|    uint32_t limit;
   38|       |#ifdef LONGEST_MATCH_SLOW
   39|       |    uint32_t limit_base;
   40|       |#endif
   41|  49.0M|    uint32_t chain_length = s->max_chain_length;
   42|  49.0M|    uint32_t nice_match = (uint32_t)s->nice_match;
   43|  49.0M|    uint32_t best_len, offset;
   44|  49.0M|    uint32_t lookahead = s->lookahead;
   45|  49.0M|    uint32_t match_offset = 0;
   46|  49.0M|    uint64_t scan_start;
   47|  49.0M|    uint64_t scan_end;
   48|       |
   49|       |    /* The code is optimized for STD_MAX_MATCH-2 multiple of 16. */
   50|  49.0M|    Assert(STD_MAX_MATCH == 258, "Code too clever");
   51|       |
   52|       |#ifdef LONGEST_MATCH_SLOW
   53|       |    best_len = s->prev_length ? s->prev_length : STD_MIN_MATCH-1;
   54|       |    if (UNLIKELY(best_len >= lookahead))
   55|       |        return lookahead;
   56|       |#else
   57|  49.0M|    best_len = STD_MIN_MATCH-1;
  ------------------
  |  |   61|  49.0M|#define STD_MIN_MATCH  3
  ------------------
   58|  49.0M|#endif
   59|       |
   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|  49.0M|    offset = best_len >= sizeof(uint64_t) ? best_len - 7 : 0;
  ------------------
  |  Branch (78:14): [True: 0, False: 49.0M]
  ------------------
   79|       |
   80|  49.0M|    scan = window + strstart;
   81|  49.0M|    scan_start = zng_memread_8(scan);
   82|  49.0M|    scan_end = zng_memread_8(scan+offset);
   83|  49.0M|    mbase_end = (mbase_start+offset);
   84|       |
   85|       |    /* Do not waste too much time if we already have a good match */
   86|  49.0M|    if (UNLIKELY(best_len >= s->good_match))
  ------------------
  |  |  269|  49.0M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 0, False: 49.0M]
  |  |  ------------------
  ------------------
   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|  49.0M|    limit = strstart > MAX_DIST(s) ? (strstart - MAX_DIST(s)) : 0;
  ------------------
  |  |  416|  49.0M|#define MAX_DIST(s)  ((s)->max_dist)
  ------------------
                  limit = strstart > MAX_DIST(s) ? (strstart - MAX_DIST(s)) : 0;
  ------------------
  |  |  416|  44.3M|#define MAX_DIST(s)  ((s)->max_dist)
  ------------------
  |  Branch (92:13): [True: 44.3M, False: 4.73M]
  ------------------
   93|       |#ifdef LONGEST_MATCH_SLOW
   94|       |    limit_base = limit;
   95|       |    if (best_len >= STD_MIN_MATCH) {
   96|       |        /* We're continuing search (lazy evaluation). Find a most distant
   97|       |         * chain by hashing substrings within the match area. We cannot use
   98|       |         * s->prev[strstart+1,...] immediately because those strings are not
   99|       |         * yet inserted into the hash table.
  100|       |         */
  101|       |#  ifdef LONGEST_MATCH_SLOW_ROLL
  102|       |        uint32_t hash;
  103|       |        uint32_t pos;
  104|       |
  105|       |        hash = update_hash_roll(0, scan[1]);
  106|       |        hash = update_hash_roll(hash, scan[2]);
  107|       |
  108|       |        for (uint32_t i = 3; i <= best_len; i++) {
  109|       |            hash = update_hash_roll(hash, scan[i]);
  110|       |            pos = head[hash];
  111|       |            if (UNLIKELY(pos < cur_match)) {
  112|       |                match_offset = i - 2;
  113|       |                cur_match = pos;
  114|       |            }
  115|       |        }
  116|       |#  else /* 4-byte Knuth hash, fresh lookup per offset */
  117|       |        for (uint32_t i = 1; i + (WANT_MIN_MATCH - 1) <= best_len; i++) {
  118|       |            uint32_t val = Z_U32_FROM_LE(zng_memread_4(scan + i));
  119|       |            uint32_t hash;
  120|       |            UPDATE_HASH_KNUTH(hash, val);
  121|       |            uint32_t pos = head[hash];
  122|       |            if (pos < cur_match) {
  123|       |                match_offset = i;
  124|       |                cur_match = pos;
  125|       |            }
  126|       |        }
  127|       |#  endif
  128|       |
  129|       |        /* Update offset-dependent variables */
  130|       |        limit = limit_base+match_offset;
  131|       |        if (UNLIKELY(cur_match <= limit))
  132|       |            return best_len;
  133|       |        mbase_start -= match_offset;
  134|       |        mbase_end -= match_offset;
  135|       |    }
  136|       |#endif
  137|  49.0M|    Assert(strstart <= s->fill_end, "need lookahead");
  138|  51.1M|    for (;;) {
  139|  51.1M|        if (UNLIKELY(cur_match >= strstart))
  ------------------
  |  |  269|  51.1M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 0, False: 51.1M]
  |  |  ------------------
  ------------------
  140|      0|            break;
  141|       |
  142|       |        /* Skip to next match if the match length cannot increase or if the match length is
  143|       |         * less than 2. Note that the checks below for insufficient lookahead only occur
  144|       |         * occasionally for performance reasons.
  145|       |         * Therefore uninitialized memory will be accessed and conditional jumps will be made
  146|       |         * that depend on those values. However the length of the match is limited to the
  147|       |         * lookahead, so the output of deflate is not affected by the uninitialized values.
  148|       |         */
  149|  51.1M|        uint32_t len;
  150|  51.1M|        if (best_len < sizeof(uint64_t)) {
  ------------------
  |  Branch (150:13): [True: 50.4M, False: 615k]
  ------------------
  151|  50.4M|            uint64_t cand_start = zng_memread_8(mbase_start + cur_match);
  152|  50.4M|            if (scan_start != cand_start) {
  ------------------
  |  Branch (152:17): [True: 50.0M, False: 439k]
  ------------------
  153|       |                /* Peel the first candidate out of the loop. A full 8-byte match falls straight
  154|       |                 * through to compare256, and single-candidate chains (barely-compressible data)
  155|       |                 * run with no loop overhead. */
  156|  50.0M|                uint64_t first_mask = zng_first_bytes_mask64(best_len + 1);
  ------------------
  |  |  138|  50.0M|#  define zng_first_bytes_mask64(n) (UINT64_MAX >> ((8 - (n)) * 8))
  ------------------
  157|  50.0M|                uint64_t diff = scan_start ^ cand_start;
  158|       |                /* A candidate beats best_len only when its first best_len+1 bytes match, i.e.
  159|       |                 * those bytes of the XOR are zero. The masked test rejects without running ctz. */
  160|  50.0M|                if (UNLIKELY((diff & first_mask) == 0)) {
  ------------------
  |  |  269|  50.0M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 1.98M, False: 48.0M]
  |  |  ------------------
  ------------------
  161|  1.98M|                    len = zng_first_diff_byte64(diff);
  ------------------
  |  |  130|  1.98M|#  define zng_first_diff_byte64(diff) (zng_ctz64(diff) / 8)
  ------------------
  162|  1.98M|                    goto short_match_accept;
  163|  1.98M|                }
  164|  48.0M|                if (--chain_length == 0 || (cur_match = prev[cur_match & wmask]) <= limit)
  ------------------
  |  Branch (164:21): [True: 122, False: 48.0M]
  |  Branch (164:44): [True: 36.7M, False: 11.3M]
  ------------------
  165|  36.7M|                    return best_len;
  166|  11.3M|                cand_start = zng_memread_8(mbase_start + cur_match);
  167|  11.3M|                if (scan_start != cand_start) {
  ------------------
  |  Branch (167:21): [True: 11.3M, False: 25.7k]
  ------------------
  168|       |                    /* Walk the remaining candidates with the chain advance kept inline. */
  169|  24.8M|                    for (;;) {
  170|  24.8M|                        diff = scan_start ^ cand_start;
  171|  24.8M|                        if (UNLIKELY((diff & first_mask) == 0)) {
  ------------------
  |  |  269|  24.8M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 263k, False: 24.5M]
  |  |  ------------------
  ------------------
  172|   263k|                            len = zng_first_diff_byte64(diff);
  ------------------
  |  |  130|   263k|#  define zng_first_diff_byte64(diff) (zng_ctz64(diff) / 8)
  ------------------
  173|   263k|                            goto short_match_accept;
  174|   263k|                        }
  175|  24.5M|                        if (--chain_length == 0 || (cur_match = prev[cur_match & wmask]) <= limit)
  ------------------
  |  Branch (175:29): [True: 40.9k, False: 24.5M]
  |  Branch (175:52): [True: 10.9M, False: 13.5M]
  ------------------
  176|  10.9M|                            return best_len;
  177|  13.5M|                        cand_start = zng_memread_8(mbase_start + cur_match);
  178|  13.5M|                        if (scan_start == cand_start)
  ------------------
  |  Branch (178:29): [True: 59.2k, False: 13.5M]
  ------------------
  179|  59.2k|                            break;
  180|  13.5M|                    }
  181|  11.3M|                }
  182|  11.3M|            }
  183|       |            /* All 8 bytes match, fallthrough to compare256 for the tail. */
  184|  50.4M|        } else {
  185|       |            /* Pre-filter the candidate on the start and end sentinels before compare256 using
  186|       |             * simple 8-byte comparison since best_len >= 8. */
  187|  8.60M|            for (;;) {
  188|       |                /* First check the end of the candidate at best_len+1 due to the higher
  189|       |                 * likelihood of a mismatch. */
  190|  8.60M|                if (zng_memcmp_8(mbase_end+cur_match, &scan_end) == 0 &&
  ------------------
  |  Branch (190:21): [True: 330k, False: 8.27M]
  ------------------
  191|   330k|                    zng_memcmp_8(mbase_start+cur_match, &scan_start) == 0)
  ------------------
  |  Branch (191:21): [True: 304k, False: 25.9k]
  ------------------
  192|   304k|                    break;
  193|  8.30M|                GOTO_NEXT_CHAIN;
  ------------------
  |  |   14|  8.30M|    if (--chain_length && (cur_match = prev[cur_match & wmask]) > limit) \
  |  |  ------------------
  |  |  |  Branch (14:9): [True: 8.26M, False: 39.1k]
  |  |  |  Branch (14:27): [True: 7.99M, False: 271k]
  |  |  ------------------
  |  |   15|  7.99M|        continue; \
  |  |   16|   310k|    return best_len;
  ------------------
  194|  8.30M|            }
  195|   615k|        }
  196|       |
  197|   829k|        len = COMPARE256(scan+2, mbase_start+cur_match+2) + 2;
  ------------------
  |  |   51|   829k|#define COMPARE256          compare256_avx2_static
  ------------------
  198|   829k|        Assert(scan+len <= window+(unsigned)(s->window_size-1), "wild scan");
  199|       |
  200|   829k|        if (len > best_len)
  ------------------
  |  Branch (200:13): [True: 773k, False: 55.5k]
  ------------------
  201|  3.79M|short_match_accept:
  202|  3.79M|        {
  203|  3.79M|            uint32_t match_start = cur_match - match_offset;
  204|  3.79M|            s->match_start = match_start;
  205|       |
  206|       |            /* Do not look for better matches if the current match reaches
  207|       |             * or exceeds the end of the input.
  208|       |             */
  209|  3.79M|            if (UNLIKELY(len >= lookahead))
  ------------------
  |  |  269|  3.02M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 1.00k, False: 3.02M]
  |  |  ------------------
  ------------------
  210|  1.00k|                return lookahead;
  211|  3.02M|            if (UNLIKELY(len >= nice_match))
  ------------------
  |  |  269|  3.02M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 90.5k, False: 2.93M]
  |  |  ------------------
  ------------------
  212|  90.5k|                return len;
  213|       |
  214|  2.93M|            best_len = len;
  215|       |
  216|  2.93M|            offset = best_len >= sizeof(uint64_t) ? best_len - 7 : 0;
  ------------------
  |  Branch (216:22): [True: 682k, False: 2.24M]
  ------------------
  217|       |
  218|  2.93M|            scan_end = zng_memread_8(scan+offset);
  219|       |
  220|       |#ifdef LONGEST_MATCH_SLOW
  221|       |            /* Look for a better string offset */
  222|       |            if (UNLIKELY(offset_search && len > STD_MIN_MATCH && match_start + len < strstart)) {
  223|       |                const unsigned char *scan_endstr;
  224|       |                uint32_t hash;
  225|       |                uint32_t pos, next_pos;
  226|       |
  227|       |                /* Go back to offset 0 */
  228|       |                cur_match -= match_offset;
  229|       |                match_offset = 0;
  230|       |                next_pos = cur_match;
  231|       |
  232|       |                /* Walk prev[] for positions inside the match. The bound keeps
  233|       |                 * the hash window within the match, so we follow chains that
  234|       |                 * share bytes with the current match, not data past its end.
  235|       |                 */
  236|       |#  ifdef LONGEST_MATCH_SLOW_ROLL
  237|       |                for (uint32_t i = 0; i <= len - STD_MIN_MATCH; i++) {
  238|       |#  else /* 4-byte Knuth hash needs len - 4 bound */
  239|       |                for (uint32_t i = 0; i <= len - WANT_MIN_MATCH; i++) {
  240|       |#  endif
  241|       |                    pos = prev[(cur_match + i) & wmask];
  242|       |                    if (UNLIKELY(pos < next_pos)) {
  243|       |                        /* Hash chain is more distant, use it */
  244|       |                        if (UNLIKELY(pos <= limit_base + i))
  245|       |                            return best_len;
  246|       |                        next_pos = pos;
  247|       |                        match_offset = i;
  248|       |                    }
  249|       |                }
  250|       |                /* Switch cur_match to next_pos chain */
  251|       |                cur_match = next_pos;
  252|       |
  253|       |                /* Try hash head at a window covering the tail of the current
  254|       |                 * match to find chains that extend farther back. The window
  255|       |                 * width differs per variant: 3 bytes for rolling, 4 for Knuth.
  256|       |                 */
  257|       |#  ifdef LONGEST_MATCH_SLOW_ROLL
  258|       |                scan_endstr = scan + len - (STD_MIN_MATCH-1);
  259|       |
  260|       |                hash = update_hash_roll(0, scan_endstr[0]);
  261|       |                hash = update_hash_roll(hash, scan_endstr[1]);
  262|       |                hash = update_hash_roll(hash, scan_endstr[2]);
  263|       |
  264|       |                pos = head[hash];
  265|       |                if (UNLIKELY(pos < cur_match)) {
  266|       |                    match_offset = len - (STD_MIN_MATCH-1);
  267|       |                    if (pos <= limit_base + match_offset)
  268|       |                        return best_len;
  269|       |                    cur_match = pos;
  270|       |                }
  271|       |#  else
  272|       |                scan_endstr = scan + len - WANT_MIN_MATCH;
  273|       |                uint32_t val = Z_U32_FROM_LE(zng_memread_4(scan_endstr));
  274|       |                UPDATE_HASH_KNUTH(hash, val);
  275|       |
  276|       |                pos = head[hash];
  277|       |                if (pos < cur_match) {
  278|       |                    match_offset = len - WANT_MIN_MATCH;
  279|       |                    if (pos <= limit_base + match_offset)
  280|       |                        return best_len;
  281|       |                    cur_match = pos;
  282|       |                }
  283|       |#  endif
  284|       |
  285|       |                /* Update offset-dependent variables */
  286|       |                limit = limit_base+match_offset;
  287|       |                mbase_start = window-match_offset;
  288|       |                mbase_end = (mbase_start+offset);
  289|       |                continue;
  290|       |            }
  291|       |#endif
  292|  2.93M|            mbase_end = (mbase_start+offset);
  293|  2.93M|        }
  294|  2.98M|        GOTO_NEXT_CHAIN;
  ------------------
  |  |   14|  2.98M|    if (--chain_length && (cur_match = prev[cur_match & wmask]) > limit) \
  |  |  ------------------
  |  |  |  Branch (14:9): [True: 2.98M, False: 907]
  |  |  |  Branch (14:27): [True: 2.02M, False: 962k]
  |  |  ------------------
  |  |   15|  2.02M|        continue; \
  |  |   16|   963k|    return best_len;
  ------------------
  295|  2.98M|    }
  296|      0|    return best_len;
  297|  49.0M|}

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

zng_tr_init:
   83|  3.76k|void Z_INTERNAL zng_tr_init(deflate_state *s) {
   84|  3.76k|    s->l_desc.dyn_tree = s->dyn_ltree;
   85|  3.76k|    s->l_desc.stat_desc = &static_l_desc;
   86|       |
   87|  3.76k|    s->d_desc.dyn_tree = s->dyn_dtree;
   88|  3.76k|    s->d_desc.stat_desc = &static_d_desc;
   89|       |
   90|  3.76k|    s->bl_desc.dyn_tree = s->bl_tree;
   91|  3.76k|    s->bl_desc.stat_desc = &static_bl_desc;
   92|       |
   93|  3.76k|    s->bi_buf = 0;
   94|  3.76k|    s->bi_valid = 0;
   95|  3.76k|    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.76k|    init_block(s);
  103|  3.76k|}
gen_codes:
  383|  35.8k|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|  35.8k|    uint16_t next_code[MAX_BITS+1];  /* next code value for each bit length */
  388|  35.8k|    uint16_t code = 0;               /* running code value */
  389|  35.8k|    int bits;                        /* bit index */
  390|  35.8k|    int n;                           /* code index */
  391|       |
  392|       |    /* The distribution counts are first used to generate the code values
  393|       |     * without bit reversal.
  394|       |     */
  395|   573k|    for (bits = 1; bits <= MAX_BITS; bits++) {
  ------------------
  |  |   41|   573k|#define MAX_BITS 15
  ------------------
  |  Branch (395:20): [True: 537k, False: 35.8k]
  ------------------
  396|   537k|        code = (code + bl_count[bits-1]) << 1;
  397|   537k|        next_code[bits] = code;
  398|   537k|    }
  399|       |    /* Check that the bit counts in bl_count are consistent. The last code
  400|       |     * must be all ones.
  401|       |     */
  402|  35.8k|    Assert(code + bl_count[MAX_BITS]-1 == (1 << MAX_BITS)-1, "inconsistent bit counts");
  403|  35.8k|    Tracev((stderr, "\ngen_codes: max_code %d ", max_code));
  404|       |
  405|  3.67M|    for (n = 0;  n <= max_code; n++) {
  ------------------
  |  Branch (405:18): [True: 3.63M, False: 35.8k]
  ------------------
  406|  3.63M|        int len = tree[n].Len;
  ------------------
  |  |  130|  3.63M|#define Len  dl.len
  ------------------
  407|  3.63M|        if (len == 0)
  ------------------
  |  Branch (407:13): [True: 1.19M, False: 2.44M]
  ------------------
  408|  1.19M|            continue;
  409|       |        /* Now reverse the bits */
  410|  2.44M|        tree[n].Code = bi_reverse(next_code[len]++, len);
  ------------------
  |  |  128|  2.44M|#define Code fc.code
  ------------------
  411|       |
  412|  2.44M|        Tracecv(tree != static_ltree, (stderr, "\nn %3d %c l %2d c %4x (%x) ",
  413|  2.44M|             n, (isgraph(n & 0xff) ? n : ' '), len, tree[n].Code, next_code[len]-1));
  414|  2.44M|    }
  415|  35.8k|}
zng_tr_stored_block:
  602|  1.92k|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.92k|    zng_tr_emit_tree(s, STORED_BLOCK, last); /* send block type */
  ------------------
  |  |   56|  1.92k|#define STORED_BLOCK 0
  ------------------
  607|  1.92k|    zng_tr_emit_align(s);                    /* align on byte boundary */
  608|  1.92k|    cmpr_bits_align(s);
  609|  1.92k|    put_short(s, (uint16_t)stored_len);
  610|  1.92k|    put_short(s, (uint16_t)~stored_len);
  611|  1.92k|    cmpr_bits_add(s, 32);
  ------------------
  |  |  467|  1.92k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  163|  1.92k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  612|  1.92k|    sent_bits_add(s, 32);
  ------------------
  |  |  469|  1.92k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  ------------------
  |  |  |  |  163|  1.92k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  613|  1.92k|    if (stored_len) {
  ------------------
  |  Branch (613:9): [True: 1.92k, False: 0]
  ------------------
  614|  1.92k|        memcpy(s->pending_buf + s->pending, buf, stored_len);
  615|  1.92k|        s->pending += stored_len;
  616|  1.92k|        cmpr_bits_add(s, stored_len << 3);
  ------------------
  |  |  467|  1.92k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  163|  1.92k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  617|  1.92k|        sent_bits_add(s, stored_len << 3);
  ------------------
  |  |  469|  1.92k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  ------------------
  |  |  |  |  163|  1.92k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  618|  1.92k|    }
  619|  1.92k|}
zng_tr_flush_block:
  635|  11.9k|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.9k|    unsigned int opt_lenb, static_lenb; /* opt_len and static_len in bytes */
  640|  11.9k|    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.9k|    if (UNLIKELY(s->sym_next == 0)) {
  ------------------
  |  |  269|  11.9k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (269:33): [True: 40, False: 11.9k]
  |  |  ------------------
  ------------------
  644|       |        /* Emit an empty static tree block with no codes */
  645|     40|        opt_lenb = static_lenb = 0;
  646|     40|        s->static_len = 7;
  647|  11.9k|    } else if (s->level > 0) {
  ------------------
  |  Branch (647:16): [True: 11.9k, False: 0]
  ------------------
  648|       |        /* Check if the file is binary or text */
  649|  11.9k|        if (s->strm->data_type == Z_UNKNOWN)
  ------------------
  |  |  209|  11.9k|#define Z_UNKNOWN  2
  ------------------
  |  Branch (649:13): [True: 3.76k, False: 8.18k]
  ------------------
  650|  3.76k|            s->strm->data_type = detect_data_type(s);
  651|       |
  652|       |        /* Construct the literal and distance trees */
  653|  11.9k|        build_tree(s, (tree_desc *)(&(s->l_desc)));
  654|  11.9k|        Tracev((stderr, "\nlit data: dyn %u, stat %u", s->opt_len, s->static_len));
  655|       |
  656|  11.9k|        build_tree(s, (tree_desc *)(&(s->d_desc)));
  657|  11.9k|        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.9k|        max_blindex = build_bl_tree(s);
  666|       |
  667|       |        /* Determine the best encoding. Compute the block lengths in bytes. */
  668|  11.9k|        opt_lenb = (s->opt_len + 3 + 7) >> 3;
  669|  11.9k|        static_lenb = (s->static_len + 3 + 7) >> 3;
  670|       |
  671|  11.9k|        Tracev((stderr, "\nopt %u(%u) stat %u(%u) stored %u lit %u ",
  672|  11.9k|                opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
  673|  11.9k|                s->sym_next / 3));
  674|       |
  675|  11.9k|        if (static_lenb <= opt_lenb || s->strategy == Z_FIXED)
  ------------------
  |  |  202|  9.80k|#define Z_FIXED               4
  ------------------
  |  Branch (675:13): [True: 2.13k, False: 9.80k]
  |  Branch (675:40): [True: 0, False: 9.80k]
  ------------------
  676|  2.13k|            opt_lenb = static_lenb;
  677|       |
  678|  11.9k|    } 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.9k|    if (stored_len+4 <= opt_lenb && buf != NULL) {
  ------------------
  |  Branch (683:9): [True: 1.92k, False: 10.0k]
  |  Branch (683:37): [True: 1.92k, 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.92k|        zng_tr_stored_block(s, buf, stored_len, last);
  692|       |
  693|  10.0k|    } else if (static_lenb == opt_lenb) {
  ------------------
  |  Branch (693:16): [True: 1.97k, False: 8.08k]
  ------------------
  694|  1.97k|        zng_tr_emit_tree(s, STATIC_TREES, last);
  ------------------
  |  |   57|  1.97k|#define STATIC_TREES 1
  ------------------
  695|  1.97k|        compress_block(s, (const ct_data *)static_ltree, (const ct_data *)static_dtree);
  696|  1.97k|        cmpr_bits_add(s, s->static_len);
  ------------------
  |  |  467|  1.97k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  163|  1.97k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  697|  8.08k|    } else {
  698|  8.08k|        zng_tr_emit_tree(s, DYN_TREES, last);
  ------------------
  |  |   58|  8.08k|#define DYN_TREES    2
  ------------------
  699|  8.08k|        send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, max_blindex+1);
  700|  8.08k|        compress_block(s, (const ct_data *)s->dyn_ltree, (const ct_data *)s->dyn_dtree);
  701|  8.08k|        cmpr_bits_add(s, s->opt_len);
  ------------------
  |  |  467|  8.08k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  163|  8.08k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  702|  8.08k|    }
  703|  11.9k|    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.9k|    init_block(s);
  708|       |
  709|  11.9k|    if (last) {
  ------------------
  |  Branch (709:9): [True: 3.76k, False: 8.22k]
  ------------------
  710|  3.76k|        zng_tr_emit_align(s);
  711|  3.76k|    }
  712|  11.9k|    Tracev((stderr, "\ncomprlen %lu(%lu) ", s->compressed_len>>3, s->compressed_len-7*last));
  713|  11.9k|}
zng_tr_flush_bits:
  841|   134M|void Z_INTERNAL zng_tr_flush_bits(deflate_state *s) {
  842|   134M|    if (s->bi_valid >= 48) {
  ------------------
  |  Branch (842:9): [True: 12, False: 134M]
  ------------------
  843|     12|        put_uint32(s, (uint32_t)s->bi_buf);
  844|     12|        put_short(s, (uint16_t)(s->bi_buf >> 32));
  845|     12|        s->bi_buf >>= 48;
  846|     12|        s->bi_valid -= 48;
  847|   134M|    } else if (s->bi_valid >= 32) {
  ------------------
  |  Branch (847:16): [True: 151, False: 134M]
  ------------------
  848|    151|        put_uint32(s, (uint32_t)s->bi_buf);
  849|    151|        s->bi_buf >>= 32;
  850|    151|        s->bi_valid -= 32;
  851|    151|    }
  852|   134M|    if (s->bi_valid >= 16) {
  ------------------
  |  Branch (852:9): [True: 6.43k, False: 134M]
  ------------------
  853|  6.43k|        put_short(s, (uint16_t)s->bi_buf);
  854|  6.43k|        s->bi_buf >>= 16;
  855|  6.43k|        s->bi_valid -= 16;
  856|  6.43k|    }
  857|   134M|    if (s->bi_valid >= 8) {
  ------------------
  |  Branch (857:9): [True: 3.20k, False: 134M]
  ------------------
  858|  3.20k|        put_byte(s, s->bi_buf);
  ------------------
  |  |  357|  3.20k|#define put_byte(s, c) { \
  |  |  358|  3.20k|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  359|  3.20k|}
  ------------------
  859|  3.20k|        s->bi_buf >>= 8;
  860|  3.20k|        s->bi_valid -= 8;
  861|  3.20k|    }
  862|   134M|}
trees.c:init_block:
  108|  15.7k|static void init_block(deflate_state *s) {
  109|  15.7k|    int n; /* iterates over tree elements */
  110|       |
  111|       |    /* Initialize the trees. */
  112|  4.51M|    for (n = 0; n < L_CODES;  n++)
  ------------------
  |  |   40|  4.51M|#define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  ------------------
  |  |  |  |   37|  4.51M|#define LITERALS  256
  |  |  ------------------
  |  |               #define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  ------------------
  |  |  |  |   34|  4.51M|#define LENGTH_CODES 29
  |  |  ------------------
  ------------------
  |  Branch (112:17): [True: 4.50M, False: 15.7k]
  ------------------
  113|  4.50M|        s->dyn_ltree[n].Freq = 0;
  ------------------
  |  |  127|  4.50M|#define Freq fc.freq
  ------------------
  114|   488k|    for (n = 0; n < D_CODES;  n++)
  ------------------
  |  |   43|   488k|#define D_CODES   30
  ------------------
  |  Branch (114:17): [True: 472k, False: 15.7k]
  ------------------
  115|   472k|        s->dyn_dtree[n].Freq = 0;
  ------------------
  |  |  127|   472k|#define Freq fc.freq
  ------------------
  116|   314k|    for (n = 0; n < BL_CODES; n++)
  ------------------
  |  |   46|   314k|#define BL_CODES  19
  ------------------
  |  Branch (116:17): [True: 299k, False: 15.7k]
  ------------------
  117|   299k|        s->bl_tree[n].Freq = 0;
  ------------------
  |  |  127|   299k|#define Freq fc.freq
  ------------------
  118|       |
  119|  15.7k|    s->dyn_ltree[END_BLOCK].Freq = 1;
  ------------------
  |  |   55|  15.7k|#define END_BLOCK 256
  ------------------
                  s->dyn_ltree[END_BLOCK].Freq = 1;
  ------------------
  |  |  127|  15.7k|#define Freq fc.freq
  ------------------
  120|  15.7k|    s->opt_len = s->static_len = 0;
  121|  15.7k|    s->sym_next = 0;
  122|  15.7k|}
trees.c:build_tree:
  165|  35.8k|static void build_tree(deflate_state *s, tree_desc *desc) {
  166|       |    /* desc: the tree descriptor */
  167|  35.8k|    ct_data *tree         = desc->dyn_tree;
  168|  35.8k|    const ct_data *stree  = desc->stat_desc->static_tree;
  169|  35.8k|    int elems             = desc->stat_desc->elems;
  170|  35.8k|    int n, m;          /* iterate over heap elements */
  171|  35.8k|    int max_code = -1; /* largest code with non zero frequency */
  172|  35.8k|    int node;          /* new node being created */
  173|  35.8k|    int nleaves = 0;
  174|  35.8k|    int li = 0, ihead = 0, itail = 0;  /* queue positions for leaves and internal nodes */
  175|  35.8k|    int merges;
  176|  35.8k|    uint32_t *leaves = s->pq_leaves;   /* packed leaf entries, sorted by frequency */
  177|  35.8k|    uint32_t *scratch = s->pq_scratch; /* radix buffer, then FIFO of created internal nodes */
  178|  35.8k|    uint32_t *sorted = leaves;         /* sorted leaves, in scratch after a single pass */
  179|  35.8k|    uint32_t *internals = scratch;     /* internal node FIFO, in whichever buffer is free */
  180|  35.8k|    uint16_t count_lo[257];            /* histogram of the low frequency byte, at offset +1 */
  181|  35.8k|    uint16_t count_hi[257];            /* histogram of the high frequency byte, at offset +1 */
  182|       |
  183|  35.8k|    memset(count_lo, 0, sizeof(count_lo));
  184|  35.8k|    memset(count_hi, 0, sizeof(count_hi));
  185|  4.03M|    for (n = 0; n < elems; n++) {
  ------------------
  |  Branch (185:17): [True: 4.00M, False: 35.8k]
  ------------------
  186|  4.00M|        const uint16_t freq = tree[n].Freq;
  ------------------
  |  |  127|  4.00M|#define Freq fc.freq
  ------------------
  187|  4.00M|        if (freq != 0) {
  ------------------
  |  Branch (187:13): [True: 2.43M, False: 1.56M]
  ------------------
  188|  2.43M|            leaves[nleaves++] = pq_pack(freq, n);
  ------------------
  |  |  128|  2.43M|#define pq_pack(freq, node) (((uint32_t)(freq) << PQ_NODE_BITS) | (unsigned)(node))
  |  |  ------------------
  |  |  |  |  127|  2.43M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  189|  2.43M|            count_lo[(freq & 0xFF) + 1]++;
  190|  2.43M|            count_hi[(freq >> 8) + 1]++;
  191|  2.43M|            max_code = n;
  192|  2.43M|        } else {
  193|  1.56M|            tree[n].Len = 0;
  ------------------
  |  |  130|  1.56M|#define Len  dl.len
  ------------------
  194|  1.56M|        }
  195|  4.00M|    }
  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|  43.6k|    while (nleaves < 2) {
  ------------------
  |  Branch (202:12): [True: 7.85k, False: 35.8k]
  ------------------
  203|  7.85k|        node = (max_code < 2 ? ++max_code : 0);
  ------------------
  |  Branch (203:17): [True: 7.27k, False: 577]
  ------------------
  204|  7.85k|        leaves[nleaves++] = pq_pack(1, node);
  ------------------
  |  |  128|  7.85k|#define pq_pack(freq, node) (((uint32_t)(freq) << PQ_NODE_BITS) | (unsigned)(node))
  |  |  ------------------
  |  |  |  |  127|  7.85k|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  205|  7.85k|        tree[node].Freq = 1;
  ------------------
  |  |  127|  7.85k|#define Freq fc.freq
  ------------------
  206|  7.85k|        s->opt_len--;
  207|  7.85k|        if (stree)
  ------------------
  |  Branch (207:13): [True: 7.85k, False: 0]
  ------------------
  208|  7.85k|            s->static_len -= stree[node].Len;
  ------------------
  |  |  130|  7.85k|#define Len  dl.len
  ------------------
  209|       |        /* node is 0 or 1 so it does not have extra bits */
  210|  7.85k|    }
  211|  35.8k|    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|  35.8k|    if (nleaves == 2) {
  ------------------
  |  Branch (217:9): [True: 5.80k, False: 30.0k]
  ------------------
  218|  5.80k|        if (leaves[0] > leaves[1]) {
  ------------------
  |  Branch (218:13): [True: 963, False: 4.83k]
  ------------------
  219|    963|            const uint32_t t = leaves[0];
  220|    963|            leaves[0] = leaves[1];
  221|    963|            leaves[1] = t;
  222|    963|        }
  223|  30.0k|    } else if ((int)count_hi[1] == nleaves) {
  ------------------
  |  Branch (223:16): [True: 25.7k, False: 4.24k]
  ------------------
  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|  25.7k|        pq_radix_pass(leaves, scratch, nleaves, PQ_NODE_BITS, count_lo);
  ------------------
  |  |  127|  25.7k|#define PQ_NODE_BITS 10
  ------------------
  228|  25.7k|        sorted = scratch;
  229|  25.7k|        internals = leaves;
  230|  25.7k|    } else {
  231|       |        /* Sort by the low then high frequency byte, ending back in leaves. */
  232|  4.24k|        pq_radix_pass(leaves, scratch, nleaves, PQ_NODE_BITS, count_lo);
  ------------------
  |  |  127|  4.24k|#define PQ_NODE_BITS 10
  ------------------
  233|  4.24k|        pq_radix_pass(scratch, leaves, nleaves, PQ_NODE_BITS + 8, count_hi);
  ------------------
  |  |  127|  4.24k|#define PQ_NODE_BITS 10
  ------------------
  234|  4.24k|    }
  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|  35.8k|    node = elems;              /* next internal node of the tree */
  241|  2.44M|    for (merges = nleaves - 1; merges > 0; merges--) {
  ------------------
  |  Branch (241:32): [True: 2.40M, False: 35.8k]
  ------------------
  242|       |        /* en = entry of least frequency, em = entry of next least frequency */
  243|  2.40M|        const uint32_t en = pq_take(sorted, &li, nleaves, internals, &ihead, itail);
  244|  2.40M|        const uint32_t em = pq_take(sorted, &li, nleaves, internals, &ihead, itail);
  245|  2.40M|        n = pq_node(en);
  ------------------
  |  |  129|  2.40M|#define pq_node(e)  ((int)((e) & ((1u << PQ_NODE_BITS) - 1)))
  |  |  ------------------
  |  |  |  |  127|  2.40M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  246|  2.40M|        m = pq_node(em);
  ------------------
  |  |  129|  2.40M|#define pq_node(e)  ((int)((e) & ((1u << PQ_NODE_BITS) - 1)))
  |  |  ------------------
  |  |  |  |  127|  2.40M|#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.40M|        const uint16_t f = (uint16_t)(pq_freq(en) + pq_freq(em));
  ------------------
  |  |  130|  2.40M|#define pq_freq(e)  ((e) >> PQ_NODE_BITS)
  |  |  ------------------
  |  |  |  |  127|  2.40M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
                      const uint16_t f = (uint16_t)(pq_freq(en) + pq_freq(em));
  ------------------
  |  |  130|  2.40M|#define pq_freq(e)  ((e) >> PQ_NODE_BITS)
  |  |  ------------------
  |  |  |  |  127|  2.40M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  251|  2.40M|        tree[node].Freq = f;
  ------------------
  |  |  127|  2.40M|#define Freq fc.freq
  ------------------
  252|  2.40M|        tree[n].Dad = tree[m].Dad = (uint16_t)node;
  ------------------
  |  |  129|  2.40M|#define Dad  dl.dad
  ------------------
                      tree[n].Dad = tree[m].Dad = (uint16_t)node;
  ------------------
  |  |  129|  2.40M|#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.40M|        internals[itail++] = pq_pack(f, node);
  ------------------
  |  |  128|  2.40M|#define pq_pack(freq, node) (((uint32_t)(freq) << PQ_NODE_BITS) | (unsigned)(node))
  |  |  ------------------
  |  |  |  |  127|  2.40M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  261|  2.40M|        node++;
  262|  2.40M|    }
  263|       |
  264|       |    /* At this point, the fields freq and dad are set. We can now
  265|       |     * generate the bit lengths.
  266|       |     */
  267|  35.8k|    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|  35.8k|    gen_codes((ct_data *)tree, max_code, s->bl_count);
  271|  35.8k|}
trees.c:pq_radix_pass:
  137|  34.2k|static void pq_radix_pass(const uint32_t *src, uint32_t *dst, int n, int shift, uint16_t *count) {
  138|  34.2k|    int i;
  139|       |
  140|  8.81M|    for (i = 1; i <= 256; i++)
  ------------------
  |  Branch (140:17): [True: 8.77M, False: 34.2k]
  ------------------
  141|  8.77M|        count[i] = (uint16_t)(count[i] + count[i-1]);
  142|  3.24M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (142:17): [True: 3.21M, False: 34.2k]
  ------------------
  143|  3.21M|        dst[count[(src[i] >> shift) & 0xFF]++] = src[i];
  144|  34.2k|}
trees.c:pq_take:
  151|  4.81M|                               const uint32_t *internals, int *ihead, int itail) {
  152|  4.81M|    if (*li < nleaves && (*ihead == itail || leaves[*li] < internals[*ihead]))
  ------------------
  |  Branch (152:9): [True: 3.67M, False: 1.13M]
  |  Branch (152:27): [True: 87.0k, False: 3.59M]
  |  Branch (152:46): [True: 2.35M, False: 1.23M]
  ------------------
  153|  2.44M|        return leaves[(*li)++];
  154|  2.37M|    return internals[(*ihead)++];
  155|  4.81M|}
trees.c:gen_bitlen:
  283|  35.8k|static void gen_bitlen(deflate_state *s, tree_desc *desc, const uint32_t *sorted, int nleaves, int root) {
  284|       |    /* desc: the tree descriptor */
  285|  35.8k|    ct_data *tree           = desc->dyn_tree;
  286|  35.8k|    int elems               = desc->stat_desc->elems;
  287|  35.8k|    const ct_data *stree    = desc->stat_desc->static_tree;
  288|  35.8k|    const int *extra        = desc->stat_desc->extra_bits;
  289|  35.8k|    int base                = desc->stat_desc->extra_base;
  290|  35.8k|    unsigned int max_length = desc->stat_desc->max_length;
  291|  35.8k|    int i;              /* index into sorted */
  292|  35.8k|    int n, m;           /* iterate over the tree elements */
  293|  35.8k|    unsigned int bits;  /* bit length */
  294|  35.8k|    int xbits;          /* extra bits */
  295|  35.8k|    uint16_t f;         /* frequency */
  296|  35.8k|    int overflow = 0;   /* number of elements with bit length too large */
  297|       |
  298|   609k|    for (bits = 0; bits <= MAX_BITS; bits++)
  ------------------
  |  |   41|   609k|#define MAX_BITS 15
  ------------------
  |  Branch (298:20): [True: 573k, False: 35.8k]
  ------------------
  299|   573k|        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|  35.8k|    tree[root].Len = 0; /* root of the tree */
  ------------------
  |  |  130|  35.8k|#define Len  dl.len
  ------------------
  305|       |
  306|       |    /* Dads are created after their sons, so a descending walk visits each dad first */
  307|  2.40M|    for (n = root - 1; n >= elems; n--) {
  ------------------
  |  Branch (307:24): [True: 2.37M, False: 35.8k]
  ------------------
  308|  2.37M|        bits = tree[tree[n].Dad].Len + 1u;
  ------------------
  |  |  129|  2.37M|#define Dad  dl.dad
  ------------------
                      bits = tree[tree[n].Dad].Len + 1u;
  ------------------
  |  |  130|  2.37M|#define Len  dl.len
  ------------------
  309|  2.37M|        if (bits > max_length){
  ------------------
  |  Branch (309:13): [True: 198, False: 2.37M]
  ------------------
  310|    198|            bits = max_length;
  311|    198|            overflow++;
  312|    198|        }
  313|  2.37M|        tree[n].Len = (uint16_t)bits;
  ------------------
  |  |  130|  2.37M|#define Len  dl.len
  ------------------
  314|       |        /* We overwrite tree[n].Dad which is no longer needed */
  315|  2.37M|    }
  316|       |
  317|  2.47M|    for (i = 0; i < nleaves; i++) {
  ------------------
  |  Branch (317:17): [True: 2.44M, False: 35.8k]
  ------------------
  318|  2.44M|        n = pq_node(sorted[i]);
  ------------------
  |  |  129|  2.44M|#define pq_node(e)  ((int)((e) & ((1u << PQ_NODE_BITS) - 1)))
  |  |  ------------------
  |  |  |  |  127|  2.44M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  319|  2.44M|        bits = tree[tree[n].Dad].Len + 1u;
  ------------------
  |  |  129|  2.44M|#define Dad  dl.dad
  ------------------
                      bits = tree[tree[n].Dad].Len + 1u;
  ------------------
  |  |  130|  2.44M|#define Len  dl.len
  ------------------
  320|  2.44M|        if (bits > max_length){
  ------------------
  |  Branch (320:13): [True: 5.71k, False: 2.43M]
  ------------------
  321|  5.71k|            bits = max_length;
  322|  5.71k|            overflow++;
  323|  5.71k|        }
  324|  2.44M|        tree[n].Len = (uint16_t)bits;
  ------------------
  |  |  130|  2.44M|#define Len  dl.len
  ------------------
  325|       |
  326|  2.44M|        s->bl_count[bits]++;
  327|  2.44M|        xbits = 0;
  328|  2.44M|        if (n >= base)
  ------------------
  |  Branch (328:13): [True: 274k, False: 2.16M]
  ------------------
  329|   274k|            xbits = extra[n-base];
  330|  2.44M|        f = tree[n].Freq;
  ------------------
  |  |  127|  2.44M|#define Freq fc.freq
  ------------------
  331|  2.44M|        s->opt_len += (unsigned int)f * (unsigned int)(bits + xbits);
  332|  2.44M|        if (stree)
  ------------------
  |  Branch (332:13): [True: 2.32M, False: 118k]
  ------------------
  333|  2.32M|            s->static_len += (unsigned int)f * (unsigned int)(stree[n].Len + xbits);
  ------------------
  |  |  130|  2.32M|#define Len  dl.len
  ------------------
  334|  2.44M|    }
  335|  35.8k|    if (overflow == 0)
  ------------------
  |  Branch (335:9): [True: 34.2k, False: 1.60k]
  ------------------
  336|  34.2k|        return;
  337|       |
  338|  1.60k|    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.95k|    do {
  343|  2.95k|        bits = max_length - 1;
  344|  4.26k|        while (s->bl_count[bits] == 0)
  ------------------
  |  Branch (344:16): [True: 1.30k, False: 2.95k]
  ------------------
  345|  1.30k|            bits--;
  346|  2.95k|        s->bl_count[bits]--;       /* move one leaf down the tree */
  347|  2.95k|        s->bl_count[bits+1] += 2u; /* move one overflow item as its brother */
  348|  2.95k|        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.95k|        overflow -= 2;
  353|  2.95k|    } while (overflow > 0);
  ------------------
  |  Branch (353:14): [True: 1.35k, False: 1.60k]
  ------------------
  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.60k|    i = 0;
  360|  12.9k|    for (bits = max_length; bits != 0; bits--) {
  ------------------
  |  Branch (360:29): [True: 11.3k, False: 1.60k]
  ------------------
  361|  11.3k|        n = s->bl_count[bits];
  362|  37.1k|        while (n != 0) {
  ------------------
  |  Branch (362:16): [True: 25.8k, False: 11.3k]
  ------------------
  363|  25.8k|            m = pq_node(sorted[i++]);
  ------------------
  |  |  129|  25.8k|#define pq_node(e)  ((int)((e) & ((1u << PQ_NODE_BITS) - 1)))
  |  |  ------------------
  |  |  |  |  127|  25.8k|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  364|  25.8k|            if (tree[m].Len != bits) {
  ------------------
  |  |  130|  25.8k|#define Len  dl.len
  ------------------
  |  Branch (364:17): [True: 2.46k, False: 23.3k]
  ------------------
  365|  2.46k|                Tracev((stderr, "code %d bits %d->%u\n", m, tree[m].Len, bits));
  366|  2.46k|                s->opt_len += (unsigned int)(bits * tree[m].Freq);
  ------------------
  |  |  127|  2.46k|#define Freq fc.freq
  ------------------
  367|  2.46k|                s->opt_len -= (unsigned int)(tree[m].Len * tree[m].Freq);
  ------------------
  |  |  130|  2.46k|#define Len  dl.len
  ------------------
                              s->opt_len -= (unsigned int)(tree[m].Len * tree[m].Freq);
  ------------------
  |  |  127|  2.46k|#define Freq fc.freq
  ------------------
  368|  2.46k|                tree[m].Len = (uint16_t)bits;
  ------------------
  |  |  130|  2.46k|#define Len  dl.len
  ------------------
  369|  2.46k|            }
  370|  25.8k|            n--;
  371|  25.8k|        }
  372|  11.3k|    }
  373|  1.60k|}
trees.c:build_bl_tree:
  535|  11.9k|static int build_bl_tree(deflate_state *s) {
  536|  11.9k|    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.9k|    scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
  540|  11.9k|    scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
  541|       |
  542|       |    /* Build the bit length tree: */
  543|  11.9k|    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|  31.3k|    for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
  ------------------
  |  |   46|  11.9k|#define BL_CODES  19
  ------------------
  |  Branch (552:36): [True: 31.3k, False: 0]
  ------------------
  553|  31.3k|        if (s->bl_tree[bl_order[max_blindex]].Len != 0)
  ------------------
  |  |  130|  31.3k|#define Len  dl.len
  ------------------
  |  Branch (553:13): [True: 11.9k, False: 19.4k]
  ------------------
  554|  11.9k|            break;
  555|  31.3k|    }
  556|       |    /* Update opt_len to include the bit length tree and counts */
  557|  11.9k|    s->opt_len += 3*((unsigned int)max_blindex+1) + 5+5+4;
  558|  11.9k|    Tracev((stderr, "\ndyn trees: dyn %u, stat %u", s->opt_len, s->static_len));
  559|       |
  560|  11.9k|    return max_blindex;
  561|  11.9k|}
trees.c:scan_tree:
  421|  23.8k|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|  23.8k|    int n;                     /* iterates over all tree elements */
  425|  23.8k|    int prevlen = -1;          /* last emitted length */
  426|  23.8k|    int curlen;                /* length of current code */
  427|  23.8k|    int nextlen = tree[0].Len; /* length of next code */
  ------------------
  |  |  130|  23.8k|#define Len  dl.len
  ------------------
  428|  23.8k|    uint16_t count = 0;        /* repeat count of the current code */
  429|  23.8k|    uint16_t max_count = 7;    /* max repeat count */
  430|  23.8k|    uint16_t min_count = 4;    /* min repeat count */
  431|       |
  432|  23.8k|    if (nextlen == 0)
  ------------------
  |  Branch (432:9): [True: 3.68k, False: 20.2k]
  ------------------
  433|  3.68k|        max_count = 138, min_count = 3;
  434|       |
  435|  23.8k|    tree[max_code+1].Len = (uint16_t)0xffff; /* guard */
  ------------------
  |  |  130|  23.8k|#define Len  dl.len
  ------------------
  436|       |
  437|  3.43M|    for (n = 0; n <= max_code; n++) {
  ------------------
  |  Branch (437:17): [True: 3.41M, False: 23.8k]
  ------------------
  438|  3.41M|        curlen = nextlen;
  439|  3.41M|        nextlen = tree[n+1].Len;
  ------------------
  |  |  130|  3.41M|#define Len  dl.len
  ------------------
  440|  3.41M|        if (++count < max_count && curlen == nextlen) {
  ------------------
  |  Branch (440:13): [True: 3.23M, False: 183k]
  |  Branch (440:36): [True: 2.39M, False: 834k]
  ------------------
  441|  2.39M|            continue;
  442|  2.39M|        } else if (count < min_count) {
  ------------------
  |  Branch (442:20): [True: 710k, False: 307k]
  ------------------
  443|   710k|            s->bl_tree[curlen].Freq += count;
  ------------------
  |  |  127|   710k|#define Freq fc.freq
  ------------------
  444|   710k|        } else if (curlen != 0) {
  ------------------
  |  Branch (444:20): [True: 250k, False: 57.2k]
  ------------------
  445|   250k|            if (curlen != prevlen)
  ------------------
  |  Branch (445:17): [True: 97.8k, False: 152k]
  ------------------
  446|  97.8k|                s->bl_tree[curlen].Freq++;
  ------------------
  |  |  127|  97.8k|#define Freq fc.freq
  ------------------
  447|   250k|            s->bl_tree[REP_3_6].Freq++;
  ------------------
  |  |   12|   250k|#define REP_3_6      16
  ------------------
                          s->bl_tree[REP_3_6].Freq++;
  ------------------
  |  |  127|   250k|#define Freq fc.freq
  ------------------
  448|   250k|        } else if (count <= 10) {
  ------------------
  |  Branch (448:20): [True: 35.4k, False: 21.7k]
  ------------------
  449|  35.4k|            s->bl_tree[REPZ_3_10].Freq++;
  ------------------
  |  |   15|  35.4k|#define REPZ_3_10    17
  ------------------
                          s->bl_tree[REPZ_3_10].Freq++;
  ------------------
  |  |  127|  35.4k|#define Freq fc.freq
  ------------------
  450|  35.4k|        } else {
  451|  21.7k|            s->bl_tree[REPZ_11_138].Freq++;
  ------------------
  |  |   18|  21.7k|#define REPZ_11_138  18
  ------------------
                          s->bl_tree[REPZ_11_138].Freq++;
  ------------------
  |  |  127|  21.7k|#define Freq fc.freq
  ------------------
  452|  21.7k|        }
  453|  1.01M|        count = 0;
  454|  1.01M|        prevlen = curlen;
  455|  1.01M|        if (nextlen == 0) {
  ------------------
  |  Branch (455:13): [True: 115k, False: 902k]
  ------------------
  456|   115k|            max_count = 138, min_count = 3;
  457|   902k|        } else if (curlen == nextlen) {
  ------------------
  |  Branch (457:20): [True: 169k, False: 732k]
  ------------------
  458|   169k|            max_count = 6, min_count = 3;
  459|   732k|        } else {
  460|   732k|            max_count = 7, min_count = 4;
  461|   732k|        }
  462|  1.01M|    }
  463|  23.8k|}
trees.c:send_all_trees:
  568|  8.08k|static void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes) {
  569|  8.08k|    int rank;                    /* index in bl_order */
  570|       |
  571|  8.08k|    Assert(lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
  572|  8.08k|    Assert(lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, "too many codes");
  573|       |
  574|       |    // Temp local variables
  575|  8.08k|    uint32_t bi_valid = s->bi_valid;
  576|  8.08k|    uint64_t bi_buf = s->bi_buf;
  577|       |
  578|  8.08k|    Tracev((stderr, "\nbl counts: "));
  579|  8.08k|    send_bits(s, lcodes-257, 5, bi_buf, bi_valid); /* not +255 as stated in appnote.txt */
  ------------------
  |  |   43|  8.08k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|  8.08k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|  8.08k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|  8.08k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|  8.08k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|  8.08k|    trace_bits(s, val, len);\
  |  |   49|  8.08k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  469|  8.08k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  8.08k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|  8.08k|    \
  |  |   51|  8.08k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|  8.08k|    bi_buf |= val << bi_valid;\
  |  |   53|  8.08k|    \
  |  |   54|  8.08k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|  8.08k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 0, False: 8.08k]
  |  |  ------------------
  |  |   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|  8.08k|    bi_valid = total_bits;\
  |  |   64|  8.08k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 8.08k]
  |  |  ------------------
  ------------------
  580|  8.08k|    send_bits(s, dcodes-1,   5, bi_buf, bi_valid);
  ------------------
  |  |   43|  8.08k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|  8.08k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|  8.08k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|  8.08k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|  8.08k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|  8.08k|    trace_bits(s, val, len);\
  |  |   49|  8.08k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  469|  8.08k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  8.08k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|  8.08k|    \
  |  |   51|  8.08k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|  8.08k|    bi_buf |= val << bi_valid;\
  |  |   53|  8.08k|    \
  |  |   54|  8.08k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|  8.08k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 0, False: 8.08k]
  |  |  ------------------
  |  |   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|  8.08k|    bi_valid = total_bits;\
  |  |   64|  8.08k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 8.08k]
  |  |  ------------------
  ------------------
  581|  8.08k|    send_bits(s, blcodes-4,  4, bi_buf, bi_valid); /* not -3 as stated in appnote.txt */
  ------------------
  |  |   43|  8.08k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|  8.08k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|  8.08k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|  8.08k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|  8.08k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|  8.08k|    trace_bits(s, val, len);\
  |  |   49|  8.08k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  469|  8.08k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  8.08k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|  8.08k|    \
  |  |   51|  8.08k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|  8.08k|    bi_buf |= val << bi_valid;\
  |  |   53|  8.08k|    \
  |  |   54|  8.08k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|  8.08k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 0, False: 8.08k]
  |  |  ------------------
  |  |   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|  8.08k|    bi_valid = total_bits;\
  |  |   64|  8.08k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 8.08k]
  |  |  ------------------
  ------------------
  582|   146k|    for (rank = 0; rank < blcodes; rank++) {
  ------------------
  |  Branch (582:20): [True: 138k, False: 8.08k]
  ------------------
  583|   138k|        Tracev((stderr, "\nbl code %2u ", bl_order[rank]));
  584|   138k|        send_bits(s, s->bl_tree[bl_order[rank]].Len, 3, bi_buf, bi_valid);
  ------------------
  |  |   43|   138k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|   138k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|   138k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|   138k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|   138k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|   138k|    trace_bits(s, val, len);\
  |  |   49|   138k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  469|   138k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   138k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|   138k|    \
  |  |   51|   138k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|   138k|    bi_buf |= val << bi_valid;\
  |  |   53|   138k|    \
  |  |   54|   138k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|   138k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 7.71k, False: 130k]
  |  |  ------------------
  |  |   56|  7.71k|        total_bits -= 64;\
  |  |   57|  7.71k|        put_uint64(s, bi_buf);\
  |  |   58|  7.71k|        \
  |  |   59|  7.71k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |   60|  7.71k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |   61|  7.71k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |   62|  7.71k|    }\
  |  |   63|   138k|    bi_valid = total_bits;\
  |  |   64|   138k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 138k]
  |  |  ------------------
  ------------------
  585|   138k|    }
  586|  8.08k|    Tracev((stderr, "\nbl tree: sent %lu", s->bits_sent));
  587|       |
  588|       |    // Store back temp variables
  589|  8.08k|    s->bi_buf = bi_buf;
  590|  8.08k|    s->bi_valid = bi_valid;
  591|       |
  592|  8.08k|    send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
  593|  8.08k|    Tracev((stderr, "\nlit tree: sent %lu", s->bits_sent));
  594|       |
  595|  8.08k|    send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
  596|  8.08k|    Tracev((stderr, "\ndist tree: sent %lu", s->bits_sent));
  597|  8.08k|}
trees.c:send_tree:
  469|  16.1k|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|  16.1k|    int n;                     /* iterates over all tree elements */
  473|  16.1k|    int prevlen = -1;          /* last emitted length */
  474|  16.1k|    int curlen;                /* length of current code */
  475|  16.1k|    int nextlen = tree[0].Len; /* length of next code */
  ------------------
  |  |  130|  16.1k|#define Len  dl.len
  ------------------
  476|  16.1k|    int count = 0;             /* repeat count of the current code */
  477|  16.1k|    int max_count = 7;         /* max repeat count */
  478|  16.1k|    int min_count = 4;         /* min repeat count */
  479|       |
  480|       |    /* tree[max_code+1].Len = -1; */  /* guard already set */
  481|  16.1k|    if (nextlen == 0)
  ------------------
  |  Branch (481:9): [True: 2.70k, False: 13.4k]
  ------------------
  482|  2.70k|        max_count = 138, min_count = 3;
  483|       |
  484|       |    // Temp local variables
  485|  16.1k|    uint32_t bi_valid = s->bi_valid;
  486|  16.1k|    uint64_t bi_buf = s->bi_buf;
  487|       |
  488|  2.39M|    for (n = 0; n <= max_code; n++) {
  ------------------
  |  Branch (488:17): [True: 2.37M, False: 16.1k]
  ------------------
  489|  2.37M|        curlen = nextlen;
  490|  2.37M|        nextlen = tree[n+1].Len;
  ------------------
  |  |  130|  2.37M|#define Len  dl.len
  ------------------
  491|  2.37M|        if (++count < max_count && curlen == nextlen) {
  ------------------
  |  Branch (491:13): [True: 2.26M, False: 114k]
  |  Branch (491:36): [True: 1.51M, False: 746k]
  ------------------
  492|  1.51M|            continue;
  493|  1.51M|        } else if (count < min_count) {
  ------------------
  |  Branch (493:20): [True: 642k, False: 218k]
  ------------------
  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);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  469|   869k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  163|   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: 226k, False: 642k]
  ------------------
  497|       |
  498|   642k|        } else if (curlen != 0) {
  ------------------
  |  Branch (498:20): [True: 177k, False: 40.7k]
  ------------------
  499|   177k|            if (curlen != prevlen) {
  ------------------
  |  Branch (499:17): [True: 89.4k, False: 88.2k]
  ------------------
  500|  89.4k|                send_code(s, curlen, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   95|  89.4k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   43|  89.4k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |  |  |   44|  89.4k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |  |  |   45|  89.4k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   46|  89.4k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   47|  89.4k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   48|  89.4k|    trace_bits(s, val, len);\
  |  |  |  |   49|  89.4k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  469|  89.4k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  163|  89.4k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   50|  89.4k|    \
  |  |  |  |   51|  89.4k|    /* Unconditionally shift and merge values into the buffer */\
  |  |  |  |   52|  89.4k|    bi_buf |= val << bi_valid;\
  |  |  |  |   53|  89.4k|    \
  |  |  |  |   54|  89.4k|    /* Check if the 64-bit boundary was crossed */\
  |  |  |  |   55|  89.4k|    if (total_bits >= 64) {\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:9): [True: 2.93k, False: 86.5k]
  |  |  |  |  ------------------
  |  |  |  |   56|  2.93k|        total_bits -= 64;\
  |  |  |  |   57|  2.93k|        put_uint64(s, bi_buf);\
  |  |  |  |   58|  2.93k|        \
  |  |  |  |   59|  2.93k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |  |  |   60|  2.93k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |  |  |   61|  2.93k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |  |  |   62|  2.93k|    }\
  |  |  |  |   63|  89.4k|    bi_valid = total_bits;\
  |  |  |  |   64|  89.4k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (64:10): [Folded, False: 89.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  501|  89.4k|                count--;
  502|  89.4k|            }
  503|   177k|            Assert(count >= 3 && count <= 6, " 3_6?");
  504|   177k|            send_code(s, REP_3_6, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   95|   177k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   43|   177k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |  |  |   44|   177k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |  |  |   45|   177k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   46|   177k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   47|   177k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   48|   177k|    trace_bits(s, val, len);\
  |  |  |  |   49|   177k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  469|   177k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  163|   177k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   50|   177k|    \
  |  |  |  |   51|   177k|    /* Unconditionally shift and merge values into the buffer */\
  |  |  |  |   52|   177k|    bi_buf |= val << bi_valid;\
  |  |  |  |   53|   177k|    \
  |  |  |  |   54|   177k|    /* Check if the 64-bit boundary was crossed */\
  |  |  |  |   55|   177k|    if (total_bits >= 64) {\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:9): [True: 5.88k, False: 171k]
  |  |  |  |  ------------------
  |  |  |  |   56|  5.88k|        total_bits -= 64;\
  |  |  |  |   57|  5.88k|        put_uint64(s, bi_buf);\
  |  |  |  |   58|  5.88k|        \
  |  |  |  |   59|  5.88k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |  |  |   60|  5.88k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |  |  |   61|  5.88k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |  |  |   62|  5.88k|    }\
  |  |  |  |   63|   177k|    bi_valid = total_bits;\
  |  |  |  |   64|   177k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (64:10): [Folded, False: 177k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  505|   177k|            send_bits(s, count-3, 2, bi_buf, bi_valid);
  ------------------
  |  |   43|   177k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|   177k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|   177k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|   177k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|   177k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|   177k|    trace_bits(s, val, len);\
  |  |   49|   177k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  469|   177k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|   177k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|   177k|    \
  |  |   51|   177k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|   177k|    bi_buf |= val << bi_valid;\
  |  |   53|   177k|    \
  |  |   54|   177k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|   177k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 5.20k, False: 172k]
  |  |  ------------------
  |  |   56|  5.20k|        total_bits -= 64;\
  |  |   57|  5.20k|        put_uint64(s, bi_buf);\
  |  |   58|  5.20k|        \
  |  |   59|  5.20k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |   60|  5.20k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |   61|  5.20k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |   62|  5.20k|    }\
  |  |   63|   177k|    bi_valid = total_bits;\
  |  |   64|   177k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 177k]
  |  |  ------------------
  ------------------
  506|       |
  507|   177k|        } else if (count <= 10) {
  ------------------
  |  Branch (507:20): [True: 27.9k, False: 12.7k]
  ------------------
  508|  27.9k|            send_code(s, REPZ_3_10, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   95|  27.9k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   43|  27.9k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |  |  |   44|  27.9k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |  |  |   45|  27.9k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   46|  27.9k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   47|  27.9k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   48|  27.9k|    trace_bits(s, val, len);\
  |  |  |  |   49|  27.9k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  469|  27.9k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  163|  27.9k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   50|  27.9k|    \
  |  |  |  |   51|  27.9k|    /* Unconditionally shift and merge values into the buffer */\
  |  |  |  |   52|  27.9k|    bi_buf |= val << bi_valid;\
  |  |  |  |   53|  27.9k|    \
  |  |  |  |   54|  27.9k|    /* Check if the 64-bit boundary was crossed */\
  |  |  |  |   55|  27.9k|    if (total_bits >= 64) {\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:9): [True: 1.80k, False: 26.1k]
  |  |  |  |  ------------------
  |  |  |  |   56|  1.80k|        total_bits -= 64;\
  |  |  |  |   57|  1.80k|        put_uint64(s, bi_buf);\
  |  |  |  |   58|  1.80k|        \
  |  |  |  |   59|  1.80k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |  |  |   60|  1.80k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |  |  |   61|  1.80k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |  |  |   62|  1.80k|    }\
  |  |  |  |   63|  27.9k|    bi_valid = total_bits;\
  |  |  |  |   64|  27.9k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (64:10): [Folded, False: 27.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  509|  27.9k|            send_bits(s, count-3, 3, bi_buf, bi_valid);
  ------------------
  |  |   43|  27.9k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|  27.9k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|  27.9k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|  27.9k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|  27.9k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|  27.9k|    trace_bits(s, val, len);\
  |  |   49|  27.9k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  469|  27.9k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  27.9k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|  27.9k|    \
  |  |   51|  27.9k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|  27.9k|    bi_buf |= val << bi_valid;\
  |  |   53|  27.9k|    \
  |  |   54|  27.9k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|  27.9k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 1.36k, False: 26.5k]
  |  |  ------------------
  |  |   56|  1.36k|        total_bits -= 64;\
  |  |   57|  1.36k|        put_uint64(s, bi_buf);\
  |  |   58|  1.36k|        \
  |  |   59|  1.36k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |   60|  1.36k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |   61|  1.36k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |   62|  1.36k|    }\
  |  |   63|  27.9k|    bi_valid = total_bits;\
  |  |   64|  27.9k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 27.9k]
  |  |  ------------------
  ------------------
  510|       |
  511|  27.9k|        } else {
  512|  12.7k|            send_code(s, REPZ_11_138, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   95|  12.7k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   43|  12.7k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |  |  |   44|  12.7k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |  |  |   45|  12.7k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   46|  12.7k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   47|  12.7k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   48|  12.7k|    trace_bits(s, val, len);\
  |  |  |  |   49|  12.7k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  469|  12.7k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  163|  12.7k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   50|  12.7k|    \
  |  |  |  |   51|  12.7k|    /* Unconditionally shift and merge values into the buffer */\
  |  |  |  |   52|  12.7k|    bi_buf |= val << bi_valid;\
  |  |  |  |   53|  12.7k|    \
  |  |  |  |   54|  12.7k|    /* Check if the 64-bit boundary was crossed */\
  |  |  |  |   55|  12.7k|    if (total_bits >= 64) {\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:9): [True: 961, False: 11.8k]
  |  |  |  |  ------------------
  |  |  |  |   56|    961|        total_bits -= 64;\
  |  |  |  |   57|    961|        put_uint64(s, bi_buf);\
  |  |  |  |   58|    961|        \
  |  |  |  |   59|    961|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |  |  |   60|    961|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |  |  |   61|    961|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |  |  |   62|    961|    }\
  |  |  |  |   63|  12.7k|    bi_valid = total_bits;\
  |  |  |  |   64|  12.7k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (64:10): [Folded, False: 12.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  513|  12.7k|            send_bits(s, count-11, 7, bi_buf, bi_valid);
  ------------------
  |  |   43|  12.7k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|  12.7k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|  12.7k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|  12.7k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|  12.7k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|  12.7k|    trace_bits(s, val, len);\
  |  |   49|  12.7k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  469|  12.7k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  12.7k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|  12.7k|    \
  |  |   51|  12.7k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|  12.7k|    bi_buf |= val << bi_valid;\
  |  |   53|  12.7k|    \
  |  |   54|  12.7k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|  12.7k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 1.42k, False: 11.3k]
  |  |  ------------------
  |  |   56|  1.42k|        total_bits -= 64;\
  |  |   57|  1.42k|        put_uint64(s, bi_buf);\
  |  |   58|  1.42k|        \
  |  |   59|  1.42k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |   60|  1.42k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |   61|  1.42k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |   62|  1.42k|    }\
  |  |   63|  12.7k|    bi_valid = total_bits;\
  |  |   64|  12.7k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 12.7k]
  |  |  ------------------
  ------------------
  514|  12.7k|        }
  515|   861k|        count = 0;
  516|   861k|        prevlen = curlen;
  517|   861k|        if (nextlen == 0) {
  ------------------
  |  Branch (517:13): [True: 88.4k, False: 772k]
  ------------------
  518|  88.4k|            max_count = 138, min_count = 3;
  519|   772k|        } else if (curlen == nextlen) {
  ------------------
  |  Branch (519:20): [True: 103k, False: 669k]
  ------------------
  520|   103k|            max_count = 6, min_count = 3;
  521|   669k|        } else {
  522|   669k|            max_count = 7, min_count = 4;
  523|   669k|        }
  524|   861k|    }
  525|       |
  526|       |    // Store back temp variables
  527|  16.1k|    s->bi_buf = bi_buf;
  528|  16.1k|    s->bi_valid = bi_valid;
  529|  16.1k|}
trees.c:compress_block:
  723|  10.0k|static void compress_block(deflate_state *s, const ct_data *ltree, const ct_data *dtree) {
  724|       |    /* ltree: literal tree */
  725|       |    /* dtree: distance tree */
  726|  10.0k|    unsigned dist;      /* distance of matched string */
  727|  10.0k|    int lc;             /* match length or unmatched char (if dist == 0) */
  728|  10.0k|    unsigned sx = 0;    /* running index in symbol buffers */
  729|       |
  730|       |    /* Local pointers to avoid indirection */
  731|  10.0k|    const unsigned int sym_next = s->sym_next;
  732|  10.0k|    unsigned char *sym_buf = s->sym_buf;
  733|       |
  734|       |    /* Keep the bit writer state in registers across the entire loop */
  735|  10.0k|    uint64_t bi_buf = s->bi_buf;
  736|  10.0k|    uint32_t bi_valid = s->bi_valid;
  737|  10.0k|    uint32_t pending = s->pending;
  738|       |
  739|  10.0k|    if (sym_next != 0) {
  ------------------
  |  Branch (739:9): [True: 10.0k, False: 40]
  ------------------
  740|  39.6M|        do {
  741|  39.6M|            send_bits_flush(s, bi_buf, bi_valid, pending);
  ------------------
  |  |   80|  39.6M|#define send_bits_flush(s, bi_buf, bi_valid, pending) do { \
  |  |   81|  39.6M|    zng_memwrite_8((s)->pending_buf + (pending), Z_U64_TO_LE(bi_buf)); \
  |  |  ------------------
  |  |  |  |   85|  39.6M|#  define Z_U64_TO_LE(x)    (x)
  |  |  ------------------
  |  |   82|  39.6M|    pending += (bi_valid) >> 3; \
  |  |   83|  39.6M|    bi_buf >>= ((bi_valid) & ~7U); \
  |  |   84|  39.6M|    bi_valid &= 7; \
  |  |   85|  39.6M|} while (0)
  |  |  ------------------
  |  |  |  Branch (85:10): [Folded, False: 39.6M]
  |  |  ------------------
  ------------------
  742|  39.6M|#if OPTIMAL_CMP >= 32
  743|  39.6M|            uint32_t dist_lc = Z_U32_FROM_LE(zng_memread_4(&sym_buf[sx]));
  ------------------
  |  |   87|  39.6M|#  define Z_U32_FROM_LE(x)  (x)
  ------------------
  744|  39.6M|            dist = dist_lc & 0xffff;
  745|  39.6M|            lc = (dist_lc >> 16) & 0xff;
  746|       |#else
  747|       |            dist = sym_buf[sx] + ((unsigned)sym_buf[sx + 1] << 8);
  748|       |            lc = sym_buf[sx + 2];
  749|       |#endif
  750|  39.6M|            sx += 3;
  751|  39.6M|            if (dist == 0) {
  ------------------
  |  Branch (751:17): [True: 37.2M, False: 2.40M]
  ------------------
  752|  37.2M|                uint64_t bits = 0;
  753|  37.2M|                uint32_t nbits = 0;
  754|       |
  755|  37.2M|                send_code_merge(s, lc, ltree, bits, nbits);
  ------------------
  |  |  106|  37.2M|    send_bits_merge(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   68|  37.2M|#define send_bits_merge(s, t_val, t_len, bi_buf, bi_valid) do { \
  |  |  |  |   69|  37.2M|    Assert((bi_valid) + (uint32_t)(t_len) <= 64, "bit buffer overflow"); \
  |  |  |  |   70|  37.2M|    trace_bits(s, (uint64_t)(t_val), (uint32_t)(t_len)); \
  |  |  |  |   71|  37.2M|    sent_bits_add(s, t_len); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  469|  37.2M|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  163|  37.2M|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   72|  37.2M|    bi_buf |= (uint64_t)(t_val) << (bi_valid); \
  |  |  |  |   73|  37.2M|    bi_valid += (uint32_t)(t_len); \
  |  |  |  |   74|  37.2M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (74:10): [Folded, False: 37.2M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  756|  37.2M|#if OPTIMAL_CMP >= 64
  757|       |                /* Accumulate up to 2 more consecutive literals into the same merge. Their
  758|       |                 * codes are at most 15 bits each, so all three fit alongside the at most
  759|       |                 * 7 bits the flush above leaves behind. */
  760|  37.2M|                if (sx + 8 <= sym_next) {
  ------------------
  |  Branch (760:21): [True: 37.2M, False: 19.2k]
  ------------------
  761|  37.2M|                    uint64_t next_syms = Z_U64_FROM_LE(zng_memread_8(&sym_buf[sx]));
  ------------------
  |  |   88|  37.2M|#  define Z_U64_FROM_LE(x)  (x)
  ------------------
  762|       |
  763|       |                    /* A dist field is zero exactly when that symbol is a literal */
  764|  37.2M|                    if ((uint16_t)next_syms == 0) {
  ------------------
  |  Branch (764:25): [True: 36.5M, False: 662k]
  ------------------
  765|  36.5M|                        send_code_merge(s, (unsigned)((next_syms >> 16) & 0xff), ltree, bits, nbits);
  ------------------
  |  |  106|  36.5M|    send_bits_merge(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   68|  36.5M|#define send_bits_merge(s, t_val, t_len, bi_buf, bi_valid) do { \
  |  |  |  |   69|  36.5M|    Assert((bi_valid) + (uint32_t)(t_len) <= 64, "bit buffer overflow"); \
  |  |  |  |   70|  36.5M|    trace_bits(s, (uint64_t)(t_val), (uint32_t)(t_len)); \
  |  |  |  |   71|  36.5M|    sent_bits_add(s, t_len); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  469|  36.5M|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  163|  36.5M|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   72|  36.5M|    bi_buf |= (uint64_t)(t_val) << (bi_valid); \
  |  |  |  |   73|  36.5M|    bi_valid += (uint32_t)(t_len); \
  |  |  |  |   74|  36.5M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (74:10): [Folded, False: 36.5M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  766|  36.5M|                        sx += 3;
  767|       |
  768|  36.5M|                        if ((next_syms & LIT3_DIST1_MASK) == 0) {
  ------------------
  |  |  718|  36.5M|#define LIT3_DIST1_MASK 0x000000FFFF000000ULL
  ------------------
  |  Branch (768:29): [True: 36.1M, False: 412k]
  ------------------
  769|  36.1M|                            send_code_merge(s, (unsigned)((next_syms >> 40) & 0xff), ltree, bits, nbits);
  ------------------
  |  |  106|  36.1M|    send_bits_merge(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   68|  36.1M|#define send_bits_merge(s, t_val, t_len, bi_buf, bi_valid) do { \
  |  |  |  |   69|  36.1M|    Assert((bi_valid) + (uint32_t)(t_len) <= 64, "bit buffer overflow"); \
  |  |  |  |   70|  36.1M|    trace_bits(s, (uint64_t)(t_val), (uint32_t)(t_len)); \
  |  |  |  |   71|  36.1M|    sent_bits_add(s, t_len); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  469|  36.1M|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  163|  36.1M|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   72|  36.1M|    bi_buf |= (uint64_t)(t_val) << (bi_valid); \
  |  |  |  |   73|  36.1M|    bi_valid += (uint32_t)(t_len); \
  |  |  |  |   74|  36.1M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (74:10): [Folded, False: 36.1M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  770|  36.1M|                            sx += 3;
  771|  36.1M|                        }
  772|  36.5M|                    }
  773|  37.2M|                }
  774|  37.2M|#endif
  775|       |                /* The codes were traced and counted as they accumulated */
  776|  37.2M|                Assert(bi_valid + nbits <= 64, "bit buffer overflow");
  777|  37.2M|                bi_buf |= bits << bi_valid;
  778|  37.2M|                bi_valid += nbits;
  779|  37.2M|            } else {
  780|  2.40M|                uint32_t match_bits_len;
  781|  2.40M|                uint64_t match_bits = zng_assemble_dist(ltree, dtree, lc, dist, &match_bits_len);
  782|       |
  783|  2.40M|                send_bits_merge(s, match_bits, match_bits_len, bi_buf, bi_valid);
  ------------------
  |  |   68|  2.40M|#define send_bits_merge(s, t_val, t_len, bi_buf, bi_valid) do { \
  |  |   69|  2.40M|    Assert((bi_valid) + (uint32_t)(t_len) <= 64, "bit buffer overflow"); \
  |  |   70|  2.40M|    trace_bits(s, (uint64_t)(t_val), (uint32_t)(t_len)); \
  |  |   71|  2.40M|    sent_bits_add(s, t_len); \
  |  |  ------------------
  |  |  |  |  469|  2.40M|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  163|  2.40M|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   72|  2.40M|    bi_buf |= (uint64_t)(t_val) << (bi_valid); \
  |  |   73|  2.40M|    bi_valid += (uint32_t)(t_len); \
  |  |   74|  2.40M|} while (0)
  |  |  ------------------
  |  |  |  Branch (74:10): [Folded, False: 2.40M]
  |  |  ------------------
  ------------------
  784|  2.40M|            } /* literal or match pair ? */
  785|       |
  786|       |            /* Check for no overlay of pending_buf on needed symbols */
  787|  39.6M|            Assert(pending < s->lit_bufsize + sx, "pending_buf overflow");
  788|  39.6M|        } while (sx < sym_next);
  ------------------
  |  Branch (788:18): [True: 39.6M, False: 10.0k]
  ------------------
  789|  10.0k|    }
  790|       |
  791|  10.0k|    s->pending = pending;
  792|  10.0k|    zng_emit_end_block(s, ltree, 0, &bi_buf, &bi_valid);
  793|       |
  794|       |    /* Write back to state */
  795|  10.0k|    s->bi_buf = bi_buf;
  796|  10.0k|    s->bi_valid = bi_valid;
  797|  10.0k|}
trees.c:detect_data_type:
  812|  3.76k|static int detect_data_type(deflate_state *s) {
  813|       |    /* block_mask is the bit mask of block-listed bytes
  814|       |     * set bits 0..6, 14..25, and 28..31
  815|       |     * 0xf3ffc07f = binary 11110011111111111100000001111111
  816|       |     */
  817|  3.76k|    unsigned long block_mask = 0xf3ffc07fUL;
  818|  3.76k|    int n;
  819|       |
  820|       |    /* Check for non-textual ("block-listed") bytes. */
  821|  25.6k|    for (n = 0; n <= 31; n++, block_mask >>= 1)
  ------------------
  |  Branch (821:17): [True: 25.0k, False: 605]
  ------------------
  822|  25.0k|        if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
  ------------------
  |  |  127|  18.9k|#define Freq fc.freq
  ------------------
  |  Branch (822:13): [True: 18.9k, False: 6.16k]
  |  Branch (822:33): [True: 3.15k, False: 15.7k]
  ------------------
  823|  3.15k|            return Z_BINARY;
  ------------------
  |  |  206|  3.15k|#define Z_BINARY   0
  ------------------
  824|       |
  825|       |    /* Check for textual ("allow-listed") bytes. */
  826|    605|    if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |  127|    605|#define Freq fc.freq
  ------------------
                  if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |  127|    584|#define Freq fc.freq
  ------------------
                  if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |  127|    567|#define Freq fc.freq
  ------------------
  |  Branch (826:9): [True: 21, False: 584]
  |  Branch (826:38): [True: 17, False: 567]
  |  Branch (826:68): [True: 19, False: 548]
  ------------------
  827|     57|        return Z_TEXT;
  ------------------
  |  |  207|     57|#define Z_TEXT     1
  ------------------
  828|  53.1k|    for (n = 32; n < LITERALS; n++)
  ------------------
  |  |   37|  53.1k|#define LITERALS  256
  ------------------
  |  Branch (828:18): [True: 53.1k, False: 26]
  ------------------
  829|  53.1k|        if (s->dyn_ltree[n].Freq != 0)
  ------------------
  |  |  127|  53.1k|#define Freq fc.freq
  ------------------
  |  Branch (829:13): [True: 522, False: 52.6k]
  ------------------
  830|    522|            return Z_TEXT;
  ------------------
  |  |  207|  1.07k|#define Z_TEXT     1
  ------------------
  831|       |
  832|       |    /* There are no "block-listed" or "allow-listed" bytes:
  833|       |     * this stream either is empty or has tolerated ("gray-listed") bytes only.
  834|       |     */
  835|     26|    return Z_BINARY;
  ------------------
  |  |  206|     26|#define Z_BINARY   0
  ------------------
  836|    548|}

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

deflate.c:zng_memwrite_2:
   45|  3.76k|Z_FORCEINLINE static void zng_memwrite_2(void *ptr, uint16_t val) {
   46|  3.76k|#if defined(HAVE_MAY_ALIAS)
   47|  3.76k|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   48|  3.76k|    ((unaligned_uint16_t *)ptr)->val = val;
   49|       |#else
   50|       |    memcpy(ptr, &val, sizeof(val));
   51|       |#endif
   52|  3.76k|}
deflate.c:zng_memwrite_4:
   54|  3.76k|Z_FORCEINLINE static void zng_memwrite_4(void *ptr, uint32_t val) {
   55|  3.76k|#if defined(HAVE_MAY_ALIAS)
   56|  3.76k|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|  3.76k|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|  3.76k|}
deflate.c:zng_memread_4:
   23|   175M|Z_FORCEINLINE static uint32_t zng_memread_4(const void *ptr) {
   24|   175M|#if defined(HAVE_MAY_ALIAS)
   25|   175M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|   175M|    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|   175M|}
deflate_medium.c:zng_memread_4:
   23|   139M|Z_FORCEINLINE static uint32_t zng_memread_4(const void *ptr) {
   24|   139M|#if defined(HAVE_MAY_ALIAS)
   25|   139M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|   139M|    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|   139M|}
deflate_medium.c:zng_memwrite_4:
   54|   139M|Z_FORCEINLINE static void zng_memwrite_4(void *ptr, uint32_t val) {
   55|   139M|#if defined(HAVE_MAY_ALIAS)
   56|   139M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|   139M|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|   139M|}
inftrees.c:zng_memread_4:
   23|  1.91M|Z_FORCEINLINE static uint32_t zng_memread_4(const void *ptr) {
   24|  1.91M|#if defined(HAVE_MAY_ALIAS)
   25|  1.91M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  1.91M|    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.91M|}
inftrees.c:zng_memwrite_4:
   54|  11.4M|Z_FORCEINLINE static void zng_memwrite_4(void *ptr, uint32_t val) {
   55|  11.4M|#if defined(HAVE_MAY_ALIAS)
   56|  11.4M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|  11.4M|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|  11.4M|}
insert_string.c:zng_memread_4:
   23|  14.6M|Z_FORCEINLINE static uint32_t zng_memread_4(const void *ptr) {
   24|  14.6M|#if defined(HAVE_MAY_ALIAS)
   25|  14.6M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  14.6M|    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|  14.6M|}
trees.c:zng_memwrite_8:
   63|  39.7M|Z_FORCEINLINE static void zng_memwrite_8(void *ptr, uint64_t val) {
   64|  39.7M|#if defined(HAVE_MAY_ALIAS)
   65|  39.7M|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   66|  39.7M|    ((unaligned_uint64_t *)ptr)->val = val;
   67|       |#else
   68|       |    memcpy(ptr, &val, sizeof(val));
   69|       |#endif
   70|  39.7M|}
trees.c:zng_memwrite_2:
   45|  12.8k|Z_FORCEINLINE static void zng_memwrite_2(void *ptr, uint16_t val) {
   46|  12.8k|#if defined(HAVE_MAY_ALIAS)
   47|  12.8k|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   48|  12.8k|    ((unaligned_uint16_t *)ptr)->val = val;
   49|       |#else
   50|       |    memcpy(ptr, &val, sizeof(val));
   51|       |#endif
   52|  12.8k|}
trees.c:zng_memread_4:
   23|  39.6M|Z_FORCEINLINE static uint32_t zng_memread_4(const void *ptr) {
   24|  39.6M|#if defined(HAVE_MAY_ALIAS)
   25|  39.6M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  39.6M|    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|  39.6M|}
trees.c:zng_memread_8:
   34|  37.2M|Z_FORCEINLINE static uint64_t zng_memread_8(const void *ptr) {
   35|  37.2M|#if defined(HAVE_MAY_ALIAS)
   36|  37.2M|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   37|  37.2M|    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|  37.2M|}
trees.c:zng_memwrite_4:
   54|  1.02k|Z_FORCEINLINE static void zng_memwrite_4(void *ptr, uint32_t val) {
   55|  1.02k|#if defined(HAVE_MAY_ALIAS)
   56|  1.02k|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|  1.02k|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|  1.02k|}
compare256_avx2.c:zng_memread_8:
   34|   194M|Z_FORCEINLINE static uint64_t zng_memread_8(const void *ptr) {
   35|   194M|#if defined(HAVE_MAY_ALIAS)
   36|   194M|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   37|   194M|    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|   194M|}
compare256_avx2.c:zng_memcmp_8:
   91|  8.94M|Z_FORCEINLINE static int32_t zng_memcmp_8(const void * Z_RESTRICT src0, const void * Z_RESTRICT src1) {
   92|  8.94M|#if defined(HAVE_MAY_ALIAS) || defined(_MSC_VER)
   93|  8.94M|    return zng_memread_8(src0) != zng_memread_8(src1);
   94|       |#else
   95|       |    return memcmp(src0, src1, 8);
   96|       |#endif
   97|  8.94M|}

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

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

