adler32_avx2.c:adler32_copy_tail:
  136|   347M|                                                uint32_t sum2, const int REBASE, const int MAX_LEN, const int COPY) {
  137|   347M|    if (len) {
  ------------------
  |  Branch (137:9): [True: 347M, False: 0]
  ------------------
  138|   347M|        Z_UNUSED(MAX_LEN);
  ------------------
  |  |  154|   347M|#define Z_UNUSED(var) (void)(var)
  ------------------
  139|       |        /* Process using packed 64-bit arithmetic when source is aligned */
  140|   347M|        while (len >= 8 && ((uintptr_t)buf & 7) == 0) {
  ------------------
  |  Branch (140:16): [True: 0, False: 347M]
  |  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);
  ------------------
  |  |  148|      0|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148: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|   347M|        while (len >= 4) {
  ------------------
  |  Branch (149:16): [True: 0, False: 347M]
  ------------------
  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|   347M|        if (len & 2) {
  ------------------
  |  Branch (158:13): [True: 0, False: 347M]
  ------------------
  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|   347M|        if (len & 1) {
  ------------------
  |  Branch (166:13): [True: 347M, False: 0]
  ------------------
  167|   347M|            if (COPY)
  ------------------
  |  Branch (167:17): [True: 347M, False: 0]
  ------------------
  168|   347M|                *dst = *buf;
  169|   347M|            ADLER_DO1(adler, sum2, buf, 0);
  ------------------
  |  |   21|   347M|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  ------------------
  170|   347M|        }
  171|   347M|    }
  172|   347M|    if (REBASE) {
  ------------------
  |  Branch (172:9): [True: 347M, False: 0]
  ------------------
  173|   347M|        adler %= BASE;
  ------------------
  |  |   13|   347M|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  174|   347M|        sum2 %= BASE;
  ------------------
  |  |   13|   347M|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  175|   347M|    }
  176|       |    /* D = B * 65536 + A, see: https://en.wikipedia.org/wiki/Adler-32. */
  177|   347M|    return adler | (sum2 << 16);
  178|   347M|}

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

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

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

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

deflate.c:put_short_msb:
  372|  3.71k|static inline void put_short_msb(deflate_state *s, uint16_t w) {
  373|  3.71k|    w = Z_U16_TO_BE(w);
  ------------------
  |  |   89|  3.71k|#  define Z_U16_TO_BE(x)    ZSWAP16(x)
  |  |  ------------------
  |  |  |  |  215|  3.71k|#  define ZSWAP16(q) __builtin_bswap16(q)
  |  |  ------------------
  ------------------
  374|  3.71k|    zng_memwrite_2(&s->pending_buf[s->pending], w);
  375|  3.71k|    s->pending += 2;
  376|  3.71k|}
deflate.c:put_uint32_msb:
  392|  3.71k|static inline void put_uint32_msb(deflate_state *s, uint32_t dw) {
  393|  3.71k|    dw = Z_U32_TO_BE(dw);
  ------------------
  |  |   90|  3.71k|#  define Z_U32_TO_BE(x)    ZSWAP32(x)
  |  |  ------------------
  |  |  |  |  216|  3.71k|#  define ZSWAP32(q) __builtin_bswap32(q)
  |  |  ------------------
  ------------------
  394|  3.71k|    zng_memwrite_4(&s->pending_buf[s->pending], dw);
  395|  3.71k|    s->pending += 4;
  396|  3.71k|}
trees.c:put_uint64:
  402|  63.8k|static inline void put_uint64(deflate_state *s, uint64_t lld) {
  403|  63.8k|    lld = Z_U64_TO_LE(lld);
  ------------------
  |  |   85|  63.8k|#  define Z_U64_TO_LE(x)    (x)
  ------------------
  404|  63.8k|    zng_memwrite_8(&s->pending_buf[s->pending], lld);
  405|  63.8k|    s->pending += 8;
  406|  63.8k|}
trees.c:put_short:
  362|  12.3k|static inline void put_short(deflate_state *s, uint16_t w) {
  363|  12.3k|    w = Z_U16_TO_LE(w);
  ------------------
  |  |   83|  12.3k|#  define Z_U16_TO_LE(x)    (x)
  ------------------
  364|  12.3k|    zng_memwrite_2(&s->pending_buf[s->pending], w);
  365|  12.3k|    s->pending += 2;
  366|  12.3k|}
trees.c:put_uint32:
  382|  1.01k|static inline void put_uint32(deflate_state *s, uint32_t dw) {
  383|  1.01k|    dw = Z_U32_TO_LE(dw);
  ------------------
  |  |   84|  1.01k|#  define Z_U32_TO_LE(x)    (x)
  ------------------
  384|  1.01k|    zng_memwrite_4(&s->pending_buf[s->pending], dw);
  385|  1.01k|    s->pending += 4;
  386|  1.01k|}

deflate_medium_fizzle:
  170|   173M|Z_INTERNAL block_state SUFFIX(deflate_medium)(deflate_state *s, int flush) {
  171|   173M|    ALIGNED_(16) struct match current_match = {0};
  ------------------
  |  |  268|   173M|#  define ALIGNED_(x) __attribute__ ((aligned(x)))
  ------------------
  172|   173M|#ifdef USE_FIZZLE
  173|   173M|                 struct match next_match = {0};
  174|   173M|#endif
  175|   173M|    unsigned char *window = s->window;
  176|   173M|    uint32_t max_insert_count = MAX(2, s->max_insert_count); // stepped insert requires min 2
  ------------------
  |  |  150|   173M|#define MAX(a, b) ((a) < (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (150:20): [True: 173M, False: 0]
  |  |  ------------------
  ------------------
  177|   173M|    int32_t max_dist = MAX_DIST(s);
  ------------------
  |  |  413|   173M|#define MAX_DIST(s)  ((s)->w_size - MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  408|   173M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|   173M|#define STD_MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|   173M|#define STD_MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  178|       |
  179|   310M|    for (;;) {
  180|   310M|        int bflush = 0;       /* set if current block must be flushed */
  181|   310M|        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|   310M|        if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD)) {
  ------------------
  |  |  260|   310M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 310M, False: 0]
  |  |  ------------------
  ------------------
  189|   310M|            PREFIX(fill_window)(s);
  ------------------
  |  |  121|   310M|#  define PREFIX(x) zng_ ## x
  ------------------
  190|   310M|            if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH)) {
  ------------------
  |  |  260|   484M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 173M, False: 136M]
  |  |  |  Branch (260:53): [True: 173M, False: 136M]
  |  |  |  Branch (260:53): [True: 173M, False: 328k]
  |  |  ------------------
  ------------------
  191|   173M|                return need_more;
  192|   173M|            }
  193|   136M|            if (UNLIKELY(s->lookahead == 0))
  ------------------
  |  |  260|   136M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 3.71k, False: 136M]
  |  |  ------------------
  ------------------
  194|  3.71k|                break; /* flush the current block */
  195|   136M|#ifdef USE_FIZZLE
  196|   136M|            next_match.match_length = 0;
  197|   136M|#endif
  198|   136M|        }
  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|   136M|#ifdef USE_FIZZLE
  205|       |        /* If we already have a future match from a previous round, just use that */
  206|   136M|        if (next_match.match_length > 0) {
  ------------------
  |  Branch (206:13): [True: 0, False: 136M]
  ------------------
  207|      0|            current_match = next_match;
  208|      0|            next_match.match_length = 0;
  209|   136M|        } else {
  210|   136M|            uint32_t hash_head = 0;   /* head of the hash chain */
  211|   136M|            if (LIKELY(s->lookahead >= WANT_MIN_MATCH)) {
  ------------------
  |  |  259|   136M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (259:33): [True: 136M, False: 6.63k]
  |  |  ------------------
  ------------------
  212|   136M|                hash_head = insert_knuth(s, window, s->strstart);
  213|   136M|            }
  214|       |
  215|   136M|            current_match = SUFFIX(find_best_match)(s, hash_head, max_dist);
  ------------------
  |  |   31|   136M|#define SUFFIX(name) name ## _fizzle
  ------------------
  216|   136M|        }
  217|   136M|        curr_match_len = current_match.match_length;
  218|       |
  219|   136M|        if (curr_match_len >= WANT_MIN_MATCH && s->lookahead > (unsigned int)(curr_match_len + WANT_MIN_MATCH )) {
  ------------------
  |  |   65|   273M|#define WANT_MIN_MATCH  4
  ------------------
                      if (curr_match_len >= WANT_MIN_MATCH && s->lookahead > (unsigned int)(curr_match_len + WANT_MIN_MATCH )) {
  ------------------
  |  |   65|  2.44M|#define WANT_MIN_MATCH  4
  ------------------
  |  Branch (219:13): [True: 2.44M, False: 134M]
  |  Branch (219:49): [True: 2.37M, False: 74.3k]
  ------------------
  220|  2.37M|            SUFFIX(insert_match)(s, window, current_match, max_insert_count);
  ------------------
  |  |   31|  2.37M|#define SUFFIX(name) name ## _fizzle
  ------------------
                          SUFFIX(insert_match)(s, window, current_match, max_insert_count);
  ------------------
  |  |  250|  2.37M|#   define max_insert_count  max_lazy_match
  ------------------
  221|  2.37M|        }
  222|       |
  223|   136M|        if (UNLIKELY(curr_match_len == STD_MAX_MATCH)) {
  ------------------
  |  |  260|   136M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 72.2k, False: 136M]
  |  |  ------------------
  ------------------
  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.2k|            next_match.match_length = 0;
  227|   136M|        } else if (LIKELY((s->lookahead > MIN_LOOKAHEAD) &
  ------------------
  |  |  259|   136M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (259:33): [True: 0, False: 136M]
  |  |  ------------------
  ------------------
  228|   136M|                          ((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|   136M|        } else {
  251|   136M|            next_match.match_length = 0;
  252|   136M|        }
  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|   136M|        s->lookahead -= curr_match_len;
  270|   136M|        if (LIKELY(curr_match_len == 1)) {
  ------------------
  |  |  259|   136M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (259:33): [True: 134M, False: 2.44M]
  |  |  ------------------
  ------------------
  271|       |            /* matches shorter than WANT_MIN_MATCH are set to 1, we need to emit these as literals */
  272|   134M|            bflush = zng_tr_tally_lit(s, window[current_match.strstart]);
  273|   134M|        } else {
  274|  2.44M|            check_match(s, current_match.strstart, current_match.match_start, curr_match_len);
  275|  2.44M|            bflush = zng_tr_tally_dist(s, current_match.strstart - current_match.match_start, curr_match_len - STD_MIN_MATCH);
  ------------------
  |  |   61|  2.44M|#define STD_MIN_MATCH  3
  ------------------
  276|  2.44M|        }
  277|       |
  278|       |        /* move the "cursor" forward */
  279|   136M|        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|   136M|        if (UNLIKELY(curr_match_len == STD_MAX_MATCH && s->lookahead >= MIN_LOOKAHEAD)) {
  ------------------
  |  |  260|   136M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 0, False: 136M]
  |  |  |  Branch (260:53): [True: 72.2k, False: 136M]
  |  |  |  Branch (260:53): [True: 0, False: 72.2k]
  |  |  ------------------
  ------------------
  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))
  ------------------
  |  |  260|      0|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260: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)) {
  ------------------
  |  |  260|      0|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260: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); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  121|      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)) {
  ------------------
  |  |  260|      0|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  317|      0|                    break; /* not enough lookahead, return to the main loop */
  318|      0|                }
  319|      0|            }
  320|      0|        }
  321|       |
  322|   136M|        if (UNLIKELY(bflush))
  ------------------
  |  |  260|   136M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 8.05k, False: 136M]
  |  |  ------------------
  ------------------
  323|   136M|            FLUSH_BLOCK(s, window, 0);
  ------------------
  |  |  203|  8.05k|#define FLUSH_BLOCK(s, window, last) { \
  |  |  204|  8.05k|    FLUSH_BLOCK_ONLY(s, window, last); \
  |  |  ------------------
  |  |  |  |  191|  8.05k|#define FLUSH_BLOCK_ONLY(s, window, last) { \
  |  |  |  |  192|  8.05k|    int block_start = s->block_start; \
  |  |  |  |  193|  8.05k|    zng_tr_flush_block(s, (block_start >= 0 ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (193:28): [True: 7.93k, False: 126]
  |  |  |  |  ------------------
  |  |  |  |  194|  8.05k|                   &window[(unsigned)block_start] : \
  |  |  |  |  195|  8.05k|                   NULL), \
  |  |  |  |  196|  8.05k|                   (uint32_t)((int)s->strstart - block_start), \
  |  |  |  |  197|  8.05k|                   (last)); \
  |  |  |  |  198|  8.05k|    s->block_start = (int)s->strstart; \
  |  |  |  |  199|  8.05k|    PREFIX(flush_pending)(s->strm); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  121|  8.05k|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  200|  8.05k|}
  |  |  ------------------
  |  |  205|  8.05k|    if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (205:9): [True: 8.05k, False: 0]
  |  |  |  Branch (205:41): [Folded, False: 8.05k]
  |  |  ------------------
  |  |  206|  8.05k|}
  ------------------
  324|   136M|    }
  325|       |
  326|  3.71k|    s->insert = s->strstart < (STD_MIN_MATCH - 1) ? s->strstart : (STD_MIN_MATCH - 1);
  ------------------
  |  |   61|  3.71k|#define STD_MIN_MATCH  3
  ------------------
                  s->insert = s->strstart < (STD_MIN_MATCH - 1) ? s->strstart : (STD_MIN_MATCH - 1);
  ------------------
  |  |   61|  3.68k|#define STD_MIN_MATCH  3
  ------------------
  |  Branch (326:17): [True: 29, False: 3.68k]
  ------------------
  327|  3.71k|    if (flush == Z_FINISH) {
  ------------------
  |  |  175|  3.71k|#define Z_FINISH        4
  ------------------
  |  Branch (327:9): [True: 3.71k, False: 0]
  ------------------
  328|  3.71k|        FLUSH_BLOCK(s, window, 1);
  ------------------
  |  |  203|  3.71k|#define FLUSH_BLOCK(s, window, last) { \
  |  |  204|  3.71k|    FLUSH_BLOCK_ONLY(s, window, last); \
  |  |  ------------------
  |  |  |  |  191|  3.71k|#define FLUSH_BLOCK_ONLY(s, window, last) { \
  |  |  |  |  192|  3.71k|    int block_start = s->block_start; \
  |  |  |  |  193|  3.71k|    zng_tr_flush_block(s, (block_start >= 0 ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (193:28): [True: 3.65k, False: 63]
  |  |  |  |  ------------------
  |  |  |  |  194|  3.71k|                   &window[(unsigned)block_start] : \
  |  |  |  |  195|  3.71k|                   NULL), \
  |  |  |  |  196|  3.71k|                   (uint32_t)((int)s->strstart - block_start), \
  |  |  |  |  197|  3.71k|                   (last)); \
  |  |  |  |  198|  3.71k|    s->block_start = (int)s->strstart; \
  |  |  |  |  199|  3.71k|    PREFIX(flush_pending)(s->strm); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  121|  3.71k|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  200|  3.71k|}
  |  |  ------------------
  |  |  205|  3.71k|    if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (205:9): [True: 3.71k, False: 0]
  |  |  |  Branch (205:41): [True: 3.71k, Folded]
  |  |  ------------------
  |  |  206|  3.71k|}
  ------------------
  329|      0|        return finish_done;
  330|  3.71k|    }
  331|      0|    if (UNLIKELY(s->sym_next))
  ------------------
  |  |  260|      0|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260: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); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  121|      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|   136M|Z_FORCEINLINE static struct match SUFFIX(find_best_match)(deflate_state *s, uint32_t hash_head, int32_t max_dist) {
   44|   136M|    struct match m;
   45|   136M|    int32_t dist;
   46|       |
   47|       |    /* Initialize the match to be a 1 byte literal */
   48|   136M|    m.match_start = 0;
   49|   136M|    m.match_length = 1;
   50|   136M|    m.strstart = s->strstart;
   51|   136M|    m.orgstart = m.strstart;
   52|       |
   53|   136M|    dist = (int32_t)s->strstart - (int32_t)hash_head;
   54|   136M|    if (dist <= (int32_t)max_dist && dist > 0 && hash_head != 0) {
  ------------------
  |  Branch (54:9): [True: 66.7M, False: 70.0M]
  |  Branch (54:38): [True: 66.7M, False: 3.71k]
  |  Branch (54:50): [True: 47.9M, False: 18.7M]
  ------------------
   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|  47.9M|        uint32_t match_len = FUNCTABLE_CALL(longest_match)(s, hash_head);
  ------------------
  |  |   48|  47.9M|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
   60|  47.9M|        m.match_start = s->match_start;
   61|  47.9M|        if (UNLIKELY(match_len < WANT_MIN_MATCH))
  ------------------
  |  |  260|  47.9M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 45.5M, False: 2.44M]
  |  |  ------------------
  ------------------
   62|  45.5M|            return m;
   63|  2.44M|        if (UNLIKELY(m.match_start >= m.strstart)) {
  ------------------
  |  |  260|  2.44M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 0, False: 2.44M]
  |  |  ------------------
  ------------------
   64|       |            /* this can happen due to some restarts */
   65|      0|            return m;
   66|      0|        }
   67|  2.44M|        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.44M|        uint32_t match_dist = m.strstart - m.match_start;
   77|  2.44M|        if (match_dist < match_len) {
  ------------------
  |  Branch (77:13): [True: 75.2k, False: 2.37M]
  ------------------
   78|  75.2k|            m.orgstart += match_len - match_dist;
   79|  75.2k|        }
   80|  2.44M|    }
   81|  91.2M|    return m;
   82|   136M|}
deflate_medium.c:insert_match_fizzle:
   16|  2.37M|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.37M|    uint32_t strstart = match.strstart + 1;        // string at strstart already in table
   18|  2.37M|    uint32_t match_len = match.match_length - 1;
   19|  2.37M|    uint32_t max_len = 2 * max_insert_count;       // Normally 32, 56, 96 and 112 for levels 3-6
  ------------------
  |  |  250|  2.37M|#   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.37M|    if (UNLIKELY(strstart < match.orgstart)) {
  ------------------
  |  |  260|  2.37M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 32.3k, False: 2.34M]
  |  |  ------------------
  ------------------
   24|  32.3k|        uint32_t end = strstart + match_len;
   25|       |
   26|  32.3k|        strstart = match.orgstart;
   27|  32.3k|        match_len = end - strstart;
   28|  32.3k|        if (match_len == 0) {
  ------------------
  |  Branch (28:13): [True: 0, False: 32.3k]
  ------------------
   29|       |            /* Hash only the tail position */
   30|      0|            insert_knuth(s, window, end - 1);
   31|      0|            return;
   32|      0|        }
   33|  32.3k|    }
   34|       |
   35|       |    /* Shorter matches insert every position, which needs no step and no division. */
   36|  2.37M|    if (LIKELY(match_len <= max_len)) {
  ------------------
  |  |  259|  2.37M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (259:33): [True: 2.35M, False: 18.3k]
  |  |  ------------------
  ------------------
   37|  2.35M|        insert_knuth_batch(s, window, strstart, match_len);
   38|  2.35M|        return;
   39|  2.35M|    }
   40|  18.3k|    insert_knuth_stepped(s, window, strstart, match_len, max_insert_count);
  ------------------
  |  |  250|  18.3k|#   define max_insert_count  max_lazy_match
  ------------------
   41|  18.3k|}

deflate.c:flush_pending_inline:
  111|   131M|Z_FORCEINLINE static void flush_pending_inline(PREFIX3(stream) *strm) {
  112|   131M|    uint32_t len;
  113|   131M|    deflate_state *s = strm->state;
  114|       |
  115|   131M|    zng_tr_flush_bits(s);
  116|   131M|    len = MIN(s->pending, strm->avail_out);
  ------------------
  |  |  148|   131M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 131M, False: 22.9k]
  |  |  ------------------
  ------------------
  117|   131M|    if (len == 0)
  ------------------
  |  Branch (117:9): [True: 3.71k, False: 131M]
  ------------------
  118|  3.71k|        return;
  119|       |
  120|   131M|    Tracev((stderr, "[FLUSH]"));
  121|   131M|    memcpy(strm->next_out, s->pending_out, len);
  122|   131M|    strm->next_out  += len;
  123|   131M|    s->pending_out  += len;
  124|   131M|    strm->total_out += len;
  125|   131M|    strm->avail_out -= len;
  126|   131M|    s->pending      -= len;
  127|   131M|    if (s->pending == 0)
  ------------------
  |  Branch (127:9): [True: 19.2k, False: 131M]
  ------------------
  128|  19.2k|        s->pending_out = s->pending_buf;
  129|   131M|}
deflate.c:read_buf:
  147|   173M|Z_FORCEINLINE static unsigned read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size) {
  148|   173M|    deflate_state *s = strm->state;
  149|   173M|    uint32_t len = MIN(strm->avail_in, size);
  ------------------
  |  |  148|   173M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 0, False: 173M]
  |  |  ------------------
  ------------------
  150|       |
  151|   173M|    if (len == 0)
  ------------------
  |  Branch (151:9): [True: 0, False: 173M]
  ------------------
  152|      0|        return 0;
  153|       |
  154|   173M|    if (!DEFLATE_NEED_CHECKSUM(strm)) {
  ------------------
  |  |  504|   173M|#  define DEFLATE_NEED_CHECKSUM(strm) 1
  ------------------
  |  Branch (154:9): [Folded, False: 173M]
  ------------------
  155|      0|        memcpy(buf, strm->next_in, len);
  156|      0|#ifdef GZIP
  157|   173M|    } else if (s->wrap == 2) {
  ------------------
  |  Branch (157:16): [True: 0, False: 173M]
  ------------------
  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|   173M|    } else if (s->wrap == 1) {
  ------------------
  |  Branch (160:16): [True: 173M, False: 0]
  ------------------
  161|   173M|        strm->adler = FUNCTABLE_CALL(adler32_copy)(strm->adler, buf, strm->next_in, len);
  ------------------
  |  |   48|   173M|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
  162|   173M|    } else {
  163|      0|        memcpy(buf, strm->next_in, len);
  164|      0|    }
  165|       |
  166|   173M|    strm->avail_in -= len;
  167|   173M|    strm->next_in  += len;
  168|   173M|    strm->total_in += len;
  169|   173M|    return len;
  170|   173M|}
deflate_medium.c:zng_tr_tally_lit:
   64|   134M|static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) {
   65|       |    /* c is the unmatched char */
   66|   134M|    unsigned int sym_next = s->sym_next;
   67|   134M|#if OPTIMAL_CMP >= 32
   68|   134M|    zng_memwrite_4(&s->sym_buf[sym_next], Z_U32_TO_LE((uint32_t)c << 16));
  ------------------
  |  |   84|   134M|#  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|   134M|    s->sym_next = sym_next + 3;
   75|   134M|    s->dyn_ltree[c].Freq++;
  ------------------
  |  |  127|   134M|#define Freq fc.freq
  ------------------
   76|   134M|    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|   134M|    return (s->sym_next == s->sym_end);
   82|   134M|}
deflate_medium.c:zng_tr_tally_dist:
   84|  2.44M|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.44M|    unsigned int sym_next = s->sym_next;
   88|  2.44M|#if OPTIMAL_CMP >= 32
   89|  2.44M|    zng_memwrite_4(&s->sym_buf[sym_next], Z_U32_TO_LE(dist | ((uint32_t)len << 16)));
  ------------------
  |  |   84|  2.44M|#  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.44M|    s->sym_next = sym_next + 3;
   96|  2.44M|    dist--;
   97|  2.44M|    Assert(dist < MAX_DIST(s) && (uint16_t)d_code(dist) < (uint16_t)D_CODES,
   98|  2.44M|        "zng_tr_tally: bad match");
   99|       |
  100|  2.44M|    s->dyn_ltree[zng_length_code[len] + LITERALS + 1].Freq++;
  ------------------
  |  |   37|  2.44M|#define LITERALS  256
  ------------------
                  s->dyn_ltree[zng_length_code[len] + LITERALS + 1].Freq++;
  ------------------
  |  |  127|  2.44M|#define Freq fc.freq
  ------------------
  101|  2.44M|    s->dyn_dtree[d_code(dist)].Freq++;
  ------------------
  |  |  451|  2.44M|#define d_code(dist) ((dist) < 256 ? zng_dist_code[dist] : zng_dist_code[256+((dist)>>7)])
  |  |  ------------------
  |  |  |  Branch (451:23): [True: 602k, False: 1.84M]
  |  |  ------------------
  ------------------
                  s->dyn_dtree[d_code(dist)].Freq++;
  ------------------
  |  |  127|  2.44M|#define Freq fc.freq
  ------------------
  102|  2.44M|    return (s->sym_next == s->sym_end);
  103|  2.44M|}
trees.c:bi_reverse:
  134|  2.37M|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.37M|    Assert(len >= 1 && len <= 15, "code length must be 1-15");
  138|  2.37M|    return zng_bitreverse16(code) >> (16 - len);
  139|  2.37M|}

deflate.c:zng_ctz32:
   20|  3.71k|Z_FORCEINLINE static uint32_t zng_ctz32(uint32_t value) {
   21|  3.71k|    Assert(value != 0, "Invalid input value: 0");
   22|  3.71k|#if __has_builtin(__builtin_ctz)
   23|  3.71k|    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.71k|}
inftrees.c:zng_bitreverse16:
  141|  1.90M|Z_FORCEINLINE static uint16_t zng_bitreverse16(uint16_t value) {
  142|  1.90M|#if __has_builtin(__builtin_bitreverse16)
  143|  1.90M|    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.90M|}
trees.c:zng_bitreverse16:
  141|  2.37M|Z_FORCEINLINE static uint16_t zng_bitreverse16(uint16_t value) {
  142|  2.37M|#if __has_builtin(__builtin_bitreverse16)
  143|  2.37M|    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.37M|}
compare256_avx2.c:zng_ctz32:
   20|   762k|Z_FORCEINLINE static uint32_t zng_ctz32(uint32_t value) {
   21|   762k|    Assert(value != 0, "Invalid input value: 0");
   22|   762k|#if __has_builtin(__builtin_ctz)
   23|   762k|    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|   762k|}
compare256_avx2.c:zng_ctz64:
   44|  2.28M|Z_FORCEINLINE static uint32_t zng_ctz64(uint64_t value) {
   45|  2.28M|    Assert(value != 0, "Invalid input value: 0");
   46|  2.28M|#if __has_builtin(__builtin_ctzll)
   47|  2.28M|    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.28M|}

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

zng_inflateResetKeep:
   63|  3.71k|int32_t Z_EXPORT PREFIX(inflateResetKeep)(PREFIX3(stream) *strm) {
   64|  3.71k|    struct inflate_state *state;
   65|       |
   66|  3.71k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (66:9): [True: 0, False: 3.71k]
  ------------------
   67|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
   68|  3.71k|    state = (struct inflate_state *)strm->state;
   69|  3.71k|    strm->total_in = strm->total_out = state->total = 0;
   70|  3.71k|    strm->msg = NULL;
   71|  3.71k|    strm->data_type = 0;
   72|  3.71k|    if (state->wrap)        /* to support ill-conceived Java test suite */
  ------------------
  |  Branch (72:9): [True: 3.71k, False: 0]
  ------------------
   73|  3.71k|        strm->adler = state->wrap & 1;
   74|  3.71k|    state->mode = HEAD;
   75|  3.71k|    state->check = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   70|  3.71k|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
   76|  3.71k|    state->last = 0;
   77|  3.71k|    state->havedict = 0;
   78|  3.71k|    state->flags = -1;
   79|  3.71k|    state->head = NULL;
   80|  3.71k|    state->hold = 0;
   81|  3.71k|    state->bits = 0;
   82|  3.71k|    state->lencode = state->distcode = state->next = state->codes;
   83|  3.71k|    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.71k|    INFLATE_RESET_KEEP_HOOK(strm);  /* hook for IBM Z DFLTCC */
  ------------------
  |  |   28|  3.71k|#  define INFLATE_RESET_KEEP_HOOK(strm) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (28:54): [Folded, False: 3.71k]
  |  |  ------------------
  ------------------
   91|  3.71k|    Tracev((stderr, "inflate: reset\n"));
   92|  3.71k|    return Z_OK;
  ------------------
  |  |  180|  3.71k|#define Z_OK            0
  ------------------
   93|  3.71k|}
zng_inflateReset:
   95|  3.71k|int32_t Z_EXPORT PREFIX(inflateReset)(PREFIX3(stream) *strm) {
   96|  3.71k|    struct inflate_state *state;
   97|       |
   98|  3.71k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (98:9): [True: 0, False: 3.71k]
  ------------------
   99|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  100|  3.71k|    state = (struct inflate_state *)strm->state;
  101|  3.71k|    state->wbits = state->reqbits;
  102|  3.71k|    state->wsize = 0;
  103|  3.71k|    state->whave = 0;
  104|  3.71k|    state->wnext = 0;
  105|  3.71k|    return PREFIX(inflateResetKeep)(strm);
  ------------------
  |  |  121|  3.71k|#  define PREFIX(x) zng_ ## x
  ------------------
  106|  3.71k|}
zng_inflateReset2:
  108|  3.71k|int32_t Z_EXPORT PREFIX(inflateReset2)(PREFIX3(stream) *strm, int32_t windowBits) {
  109|  3.71k|    int wrap;
  110|  3.71k|    struct inflate_state *state;
  111|       |
  112|       |    /* get the state */
  113|  3.71k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (113:9): [True: 0, False: 3.71k]
  ------------------
  114|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  115|  3.71k|    state = (struct inflate_state *)strm->state;
  116|       |
  117|       |    /* extract wrap request from windowBits parameter */
  118|  3.71k|    if (windowBits < 0) {
  ------------------
  |  Branch (118:9): [True: 0, False: 3.71k]
  ------------------
  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.71k|    } else {
  124|  3.71k|        wrap = (windowBits >> 4) + 5;
  125|  3.71k|#ifdef GUNZIP
  126|  3.71k|        if (windowBits < 48)
  ------------------
  |  Branch (126:13): [True: 3.71k, False: 0]
  ------------------
  127|  3.71k|            windowBits &= MAX_WBITS;
  ------------------
  |  |   40|  3.71k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  128|  3.71k|#endif
  129|  3.71k|    }
  130|       |
  131|       |    /* set number of window bits */
  132|  3.71k|    if (windowBits && (windowBits < MIN_WBITS || windowBits > MAX_WBITS))
  ------------------
  |  |   37|  7.43k|#  define MIN_WBITS   8  /* 256 LZ77 window */
  ------------------
                  if (windowBits && (windowBits < MIN_WBITS || windowBits > MAX_WBITS))
  ------------------
  |  |   40|  3.71k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (132:9): [True: 3.71k, False: 0]
  |  Branch (132:24): [True: 0, False: 3.71k]
  |  Branch (132:50): [True: 0, False: 3.71k]
  ------------------
  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.71k|    state->wrap = wrap;
  137|  3.71k|    state->reqbits = state->wbits = (unsigned)windowBits;
  138|  3.71k|    return PREFIX(inflateReset)(strm);
  ------------------
  |  |  121|  3.71k|#  define PREFIX(x) zng_ ## x
  ------------------
  139|  3.71k|}
alloc_inflate:
  156|  3.71k|Z_INTERNAL inflate_allocs* alloc_inflate(PREFIX3(stream) *strm) {
  157|  3.71k|    int curr_size = 0;
  158|       |
  159|       |    /* Define sizes */
  160|  3.71k|    int window_size = INFLATE_ADJUST_WINDOW_SIZE((1 << MAX_WBITS) + 64); /* 64B padding for chunksize */
  ------------------
  |  |   26|  3.71k|#  define INFLATE_ADJUST_WINDOW_SIZE(n) (n)
  ------------------
  161|  3.71k|    int state_size = sizeof(inflate_state);
  162|  3.71k|    int alloc_size = sizeof(inflate_allocs);
  163|       |
  164|       |    /* Calculate relative buffer positions and paddings */
  165|  3.71k|    LOGSZP("window", window_size, PAD_WINDOW(curr_size), PADSZ(curr_size,WINDOW_PAD_SIZE));
  166|  3.71k|    int window_pos = PAD_WINDOW(curr_size);
  ------------------
  |  |  480|  3.71k|#  define PAD_WINDOW            PAD_64
  |  |  ------------------
  |  |  |  |  303|  3.71k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  |  |  ------------------
  |  |  |  |  |  |  301|  3.71k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  167|  3.71k|    curr_size = window_pos + window_size;
  168|       |
  169|  3.71k|    LOGSZP("state", state_size, PAD_64(curr_size), PADSZ(curr_size,64));
  170|  3.71k|    int state_pos = PAD_64(curr_size);
  ------------------
  |  |  303|  3.71k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  301|  3.71k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  171|  3.71k|    curr_size = state_pos + state_size;
  172|       |
  173|  3.71k|    LOGSZP("alloc", alloc_size, PAD_16(curr_size), PADSZ(curr_size,16));
  174|  3.71k|    int alloc_pos = PAD_16(curr_size);
  ------------------
  |  |  302|  3.71k|#define PAD_16(bpos) ((bpos) + PADSZ((bpos),16))
  |  |  ------------------
  |  |  |  |  301|  3.71k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  175|  3.71k|    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.71k|    int total_size = PAD_64(curr_size + (WINDOW_PAD_SIZE - 1));
  ------------------
  |  |  303|  3.71k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  301|  3.71k|#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.71k|    char *original_buf = (char *)strm->zalloc(strm->opaque, 1, total_size);
  182|  3.71k|    if (original_buf == NULL)
  ------------------
  |  Branch (182:9): [True: 0, False: 3.71k]
  ------------------
  183|      0|        return NULL;
  184|       |
  185|  3.71k|    char *buff = (char *)HINT_ALIGNED_WINDOW((char *)PAD_WINDOW(original_buf));
  ------------------
  |  |  482|  3.71k|#  define HINT_ALIGNED_WINDOW   HINT_ALIGNED_64
  |  |  ------------------
  |  |  |  |  282|  3.71k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  277|  3.71k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  186|  3.71k|    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.71k|    inflate_allocs *alloc_bufs  = (struct inflate_allocs_s *)(buff + alloc_pos);
  190|  3.71k|    alloc_bufs->buf_start = original_buf;
  191|  3.71k|    alloc_bufs->zfree = strm->zfree;
  192|       |
  193|  3.71k|    alloc_bufs->window =  (unsigned char *)HINT_ALIGNED_WINDOW((buff + window_pos));
  ------------------
  |  |  482|  3.71k|#  define HINT_ALIGNED_WINDOW   HINT_ALIGNED_64
  |  |  ------------------
  |  |  |  |  282|  3.71k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  277|  3.71k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  194|  3.71k|    alloc_bufs->state = (inflate_state *)HINT_ALIGNED_64((buff + state_pos));
  ------------------
  |  |  282|  3.71k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  ------------------
  |  |  |  |  277|  3.71k|#  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.71k|    return alloc_bufs;
  204|  3.71k|}
free_inflate:
  209|  3.71k|Z_INTERNAL void free_inflate(PREFIX3(stream) *strm) {
  210|  3.71k|    struct inflate_state *state = (struct inflate_state *)strm->state;
  211|       |
  212|  3.71k|    if (state->alloc_bufs != NULL) {
  ------------------
  |  Branch (212:9): [True: 3.71k, False: 0]
  ------------------
  213|  3.71k|        inflate_allocs *alloc_bufs = state->alloc_bufs;
  214|  3.71k|        alloc_bufs->zfree(strm->opaque, alloc_bufs->buf_start);
  215|       |        strm->state = NULL;
  216|  3.71k|    }
  217|  3.71k|}
zng_inflateInit2:
  223|  3.71k|int32_t ZNG_CONDEXPORT PREFIX(inflateInit2)(PREFIX3(stream) *strm, int32_t windowBits) {
  224|  3.71k|    struct inflate_state *state;
  225|  3.71k|    int32_t ret;
  226|       |
  227|       |    /* Initialize functable */
  228|  3.71k|    FUNCTABLE_INIT;
  ------------------
  |  |   47|  3.71k|#  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.71k]
  |  |  ------------------
  ------------------
  229|       |
  230|  3.71k|    if (strm == NULL)
  ------------------
  |  Branch (230:9): [True: 0, False: 3.71k]
  ------------------
  231|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  232|  3.71k|    strm->msg = NULL;                   /* in case we return an error */
  233|  3.71k|    if (strm->zalloc == NULL) {
  ------------------
  |  Branch (233:9): [True: 3.71k, False: 0]
  ------------------
  234|  3.71k|        strm->zalloc = PREFIX(zcalloc);
  ------------------
  |  |  121|  3.71k|#  define PREFIX(x) zng_ ## x
  ------------------
  235|  3.71k|        strm->opaque = NULL;
  236|  3.71k|    }
  237|  3.71k|    if (strm->zfree == NULL)
  ------------------
  |  Branch (237:9): [True: 3.71k, False: 0]
  ------------------
  238|  3.71k|        strm->zfree = PREFIX(zcfree);
  ------------------
  |  |  121|  3.71k|#  define PREFIX(x) zng_ ## x
  ------------------
  239|       |
  240|  3.71k|    inflate_allocs *alloc_bufs = alloc_inflate(strm);
  241|  3.71k|    if (alloc_bufs == NULL)
  ------------------
  |  Branch (241:9): [True: 0, False: 3.71k]
  ------------------
  242|      0|        return Z_MEM_ERROR;
  ------------------
  |  |  186|      0|#define Z_MEM_ERROR    (-4)
  ------------------
  243|       |
  244|  3.71k|    state = alloc_bufs->state;
  245|  3.71k|    state->window = alloc_bufs->window;
  246|  3.71k|    state->alloc_bufs = alloc_bufs;
  247|  3.71k|    state->wbufsize = INFLATE_ADJUST_WINDOW_SIZE((1 << MAX_WBITS) + 64);
  ------------------
  |  |   26|  3.71k|#  define INFLATE_ADJUST_WINDOW_SIZE(n) (n)
  ------------------
  248|  3.71k|    Tracev((stderr, "inflate: allocated\n"));
  249|       |
  250|  3.71k|    strm->state = (struct internal_state *)state;
  251|  3.71k|    state->strm = strm;
  252|  3.71k|    state->mode = HEAD;     /* to pass state test in inflateReset2() */
  253|  3.71k|    ret = PREFIX(inflateReset2)(strm, windowBits);
  ------------------
  |  |  121|  3.71k|#  define PREFIX(x) zng_ ## x
  ------------------
  254|  3.71k|    if (ret != Z_OK) {
  ------------------
  |  |  180|  3.71k|#define Z_OK            0
  ------------------
  |  Branch (254:9): [True: 0, False: 3.71k]
  ------------------
  255|      0|        free_inflate(strm);
  256|      0|    }
  257|  3.71k|    return ret;
  258|  3.71k|}
zng_inflateInit:
  261|  3.71k|int32_t Z_EXPORT PREFIX(inflateInit)(PREFIX3(stream) *strm) {
  262|  3.71k|    return PREFIX(inflateInit2)(strm, DEF_WBITS);
  ------------------
  |  |  121|  3.71k|#  define PREFIX(x) zng_ ## x
  ------------------
                  return PREFIX(inflateInit2)(strm, DEF_WBITS);
  ------------------
  |  |   37|  3.71k|#  define DEF_WBITS MAX_WBITS
  |  |  ------------------
  |  |  |  |   40|  3.71k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  |  |  ------------------
  ------------------
  263|  3.71k|}
zng_fixedtables:
  307|  1.96k|void Z_INTERNAL PREFIX(fixedtables)(struct inflate_state *state) {
  308|  1.96k|    state->wide_len = 1;
  309|  1.96k|    state->lencode = lenfix;
  310|  1.96k|    state->lenbits = 9;
  311|  1.96k|    state->distcode = distfix;
  312|  1.96k|    state->distbits = 5;
  313|  1.96k|}
zng_inflate:
  480|   175M|int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) {
  481|   175M|    struct inflate_state *state;
  482|   175M|    const unsigned char *next;  /* next input */
  483|   175M|    unsigned char *put;         /* next output */
  484|   175M|    unsigned char *from;        /* where to copy match bytes from */
  485|   175M|    unsigned have, left;        /* available input and output */
  486|   175M|    uint64_t hold;              /* bit buffer */
  487|   175M|    bits_t bits;                /* bits in bit buffer */
  488|   175M|    uint32_t in, out;           /* save starting available input and output */
  489|   175M|    unsigned copy;              /* number of stored or match bytes to copy */
  490|   175M|    code here;                  /* current decoding table entry */
  491|   175M|    code last;                  /* parent table entry */
  492|   175M|    unsigned len;               /* length to copy for repeats, bits to drop */
  493|   175M|    unsigned code_bits;         /* bits in current/parent code */
  494|   175M|    int32_t ret;                /* return code */
  495|   175M|    static const uint16_t order[19] = /* permutation of code lengths */
  496|   175M|        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
  497|       |
  498|   175M|    if (inflateStateCheck(strm) || strm->next_out == NULL ||
  ------------------
  |  Branch (498:9): [True: 0, False: 175M]
  |  Branch (498:36): [True: 0, False: 175M]
  ------------------
  499|   175M|        (strm->next_in == NULL && strm->avail_in != 0))
  ------------------
  |  Branch (499:10): [True: 0, False: 175M]
  |  Branch (499:35): [True: 0, False: 0]
  ------------------
  500|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  501|       |
  502|   175M|    state = (struct inflate_state *)strm->state;
  503|   175M|    if (state->mode == TYPE)      /* skip check */
  ------------------
  |  Branch (503:9): [True: 7.51k, False: 175M]
  ------------------
  504|  7.51k|        state->mode = TYPEDO;
  505|   175M|    LOAD();
  ------------------
  |  |   83|   175M|    do { \
  |  |   84|   175M|        put = strm->next_out; \
  |  |   85|   175M|        left = strm->avail_out; \
  |  |   86|   175M|        next = strm->next_in; \
  |  |   87|   175M|        have = strm->avail_in; \
  |  |   88|   175M|        hold = state->hold; \
  |  |   89|   175M|        bits = (bits_t)state->bits; \
  |  |   90|   175M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (90:14): [Folded, False: 175M]
  |  |  ------------------
  ------------------
  506|   175M|    in = have;
  507|   175M|    out = left;
  508|   175M|    ret = Z_OK;
  ------------------
  |  |  180|   175M|#define Z_OK            0
  ------------------
  509|   175M|    for (;;)
  510|   459M|        switch (state->mode) {
  511|  7.43k|        case HEAD:
  ------------------
  |  Branch (511:9): [True: 7.43k, False: 459M]
  ------------------
  512|  7.43k|            if (state->wrap == 0) {
  ------------------
  |  Branch (512:17): [True: 0, False: 7.43k]
  ------------------
  513|      0|                state->mode = TYPEDO;
  514|      0|                break;
  515|      0|            }
  516|  7.43k|            NEEDBITS(16);
  ------------------
  |  |  120|  7.43k|    do { \
  |  |  121|  7.43k|        unsigned u = (unsigned)(n); \
  |  |  122|  14.8k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 11.1k, False: 3.71k]
  |  |  ------------------
  |  |  123|  11.1k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  391|  11.1k|    do { \
  |  |  |  |  392|  11.1k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (392:13): [True: 3.71k, False: 7.43k]
  |  |  |  |  ------------------
  |  |  |  |  393|  11.1k|        have--; \
  |  |  |  |  394|  7.43k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  395|  7.43k|        bits += 8; \
  |  |  |  |  396|  7.43k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:14): [Folded, False: 7.43k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  7.43k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 3.71k]
  |  |  ------------------
  ------------------
  517|  3.71k|#ifdef GUNZIP
  518|  3.71k|            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
  ------------------
  |  Branch (518:17): [True: 0, False: 3.71k]
  |  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.71k|            if (state->head != NULL)
  ------------------
  |  Branch (527:17): [True: 0, False: 3.71k]
  ------------------
  528|      0|                state->head->done = -1;
  529|  3.71k|            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
  ------------------
  |  Branch (529:17): [True: 0, False: 3.71k]
  ------------------
  530|       |#else
  531|       |            if (
  532|       |#endif
  533|  3.71k|                ((BITS(8) << 8) + (hold >> 8)) % 31) {
  ------------------
  |  |  128|  3.71k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  |  Branch (533:17): [True: 0, False: 3.71k]
  ------------------
  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.71k|            if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  128|  3.71k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
                          if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  212|  3.71k|#define Z_DEFLATED   8
  ------------------
  |  Branch (537:17): [True: 0, False: 3.71k]
  ------------------
  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.71k|            DROPBITS(4);
  ------------------
  |  |  132|  3.71k|    do { \
  |  |  133|  3.71k|        unsigned u = (unsigned)(n); \
  |  |  134|  3.71k|        hold >>= u; \
  |  |  135|  3.71k|        bits -= (bits_t)u; \
  |  |  136|  3.71k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 3.71k]
  |  |  ------------------
  ------------------
  542|  3.71k|            len = BITS(4) + 8;
  ------------------
  |  |  128|  3.71k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  543|       |            /* Reject before storing, so a bad CINFO cannot stick in wbits. */
  544|  3.71k|            if (len > MAX_WBITS || (state->wbits != 0 && len > state->wbits)) {
  ------------------
  |  |   40|  7.43k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (544:17): [True: 0, False: 3.71k]
  |  Branch (544:37): [True: 3.71k, False: 0]
  |  Branch (544:58): [True: 0, False: 3.71k]
  ------------------
  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.71k|            if (state->wbits == 0)
  ------------------
  |  Branch (548:17): [True: 0, False: 3.71k]
  ------------------
  549|      0|                state->wbits = len;
  550|       |#ifdef INFLATE_STRICT
  551|       |            state->dmax = 1U << len;
  552|       |#endif
  553|  3.71k|            state->flags = 0;               /* indicate zlib header */
  554|  3.71k|            Tracev((stderr, "inflate:   zlib header ok\n"));
  555|  3.71k|            strm->adler = state->check = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   70|  3.71k|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
  556|  3.71k|            state->mode = hold & 0x200 ? DICTID : TYPE;
  ------------------
  |  Branch (556:27): [True: 0, False: 3.71k]
  ------------------
  557|  3.71k|            INITBITS();
  ------------------
  |  |  112|  3.71k|    do { \
  |  |  113|  3.71k|        hold = 0; \
  |  |  114|  3.71k|        bits = 0; \
  |  |  115|  3.71k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (115:14): [Folded, False: 3.71k]
  |  |  ------------------
  ------------------
  558|  3.71k|            break;
  559|      0|#ifdef GUNZIP
  560|       |
  561|      0|        case FLAGS:
  ------------------
  |  Branch (561:9): [True: 0, False: 459M]
  ------------------
  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: 459M]
  ------------------
  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: 459M]
  ------------------
  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: 459M]
  ------------------
  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: 459M]
  ------------------
  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: 459M]
  ------------------
  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: 459M]
  ------------------
  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: 459M]
  ------------------
  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: 459M]
  ------------------
  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);
  ------------------
  |  |  216|      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: 459M]
  ------------------
  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.6k|        case TYPE:
  ------------------
  |  Branch (724:9): [True: 14.6k, False: 459M]
  ------------------
  725|  14.6k|            if (flush == Z_BLOCK || flush == Z_TREES)
  ------------------
  |  |  176|  29.2k|#define Z_BLOCK         5
  ------------------
                          if (flush == Z_BLOCK || flush == Z_TREES)
  ------------------
  |  |  177|  14.6k|#define Z_TREES         6
  ------------------
  |  Branch (725:17): [True: 0, False: 14.6k]
  |  Branch (725:37): [True: 0, False: 14.6k]
  ------------------
  726|      0|                goto inf_leave;
  727|  14.6k|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  14.6k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  728|       |
  729|  22.1k|        case TYPEDO:
  ------------------
  |  Branch (729:9): [True: 7.51k, False: 459M]
  ------------------
  730|       |            /* determine and dispatch block type */
  731|  22.1k|            INFLATE_TYPEDO_HOOK(strm, flush);  /* hook for IBM Z DFLTCC */
  ------------------
  |  |   32|  22.1k|#  define INFLATE_TYPEDO_HOOK(strm, flush) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (32:57): [Folded, False: 22.1k]
  |  |  ------------------
  ------------------
  732|  22.1k|            if (state->last) {
  ------------------
  |  Branch (732:17): [True: 2.84k, False: 19.2k]
  ------------------
  733|  2.84k|                BYTEBITS();
  ------------------
  |  |  140|  2.84k|    do { \
  |  |  141|  2.84k|        hold >>= bits & 7; \
  |  |  142|  2.84k|        bits -= bits & 7; \
  |  |  143|  2.84k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (143:14): [Folded, False: 2.84k]
  |  |  ------------------
  ------------------
  734|  2.84k|                state->mode = CHECK;
  735|  2.84k|                break;
  736|  2.84k|            }
  737|  19.2k|            NEEDBITS(3);
  ------------------
  |  |  120|  19.2k|    do { \
  |  |  121|  19.2k|        unsigned u = (unsigned)(n); \
  |  |  122|  26.8k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 15.0k, False: 11.7k]
  |  |  ------------------
  |  |  123|  19.2k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  391|  15.0k|    do { \
  |  |  |  |  392|  15.0k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (392:13): [True: 7.54k, False: 7.51k]
  |  |  |  |  ------------------
  |  |  |  |  393|  15.0k|        have--; \
  |  |  |  |  394|  7.51k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  395|  7.51k|        bits += 8; \
  |  |  |  |  396|  7.51k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:14): [Folded, False: 7.51k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  19.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 11.7k]
  |  |  ------------------
  ------------------
  738|  11.7k|            state->last = BITS(1);
  ------------------
  |  |  128|  11.7k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  739|  11.7k|            DROPBITS(1);
  ------------------
  |  |  132|  11.7k|    do { \
  |  |  133|  11.7k|        unsigned u = (unsigned)(n); \
  |  |  134|  11.7k|        hold >>= u; \
  |  |  135|  11.7k|        bits -= (bits_t)u; \
  |  |  136|  11.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 11.7k]
  |  |  ------------------
  ------------------
  740|  11.7k|            switch (BITS(2)) {
  ------------------
  |  |  128|  11.7k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  741|  1.67k|            case 0:                             /* stored block */
  ------------------
  |  Branch (741:13): [True: 1.67k, False: 10.0k]
  ------------------
  742|  1.67k|                Tracev((stderr, "inflate:     stored block%s\n", state->last ? " (last)" : ""));
  743|  1.67k|                state->mode = STORED;
  744|  1.67k|                break;
  745|  1.96k|            case 1:                             /* fixed block */
  ------------------
  |  Branch (745:13): [True: 1.96k, False: 9.77k]
  ------------------
  746|  1.96k|                PREFIX(fixedtables)(state);
  ------------------
  |  |  121|  1.96k|#  define PREFIX(x) zng_ ## x
  ------------------
  747|  1.96k|                Tracev((stderr, "inflate:     fixed codes block%s\n", state->last ? " (last)" : ""));
  748|  1.96k|                state->mode = LEN_;             /* decode codes */
  749|  1.96k|                if (flush == Z_TREES) {
  ------------------
  |  |  177|  1.96k|#define Z_TREES         6
  ------------------
  |  Branch (749:21): [True: 0, False: 1.96k]
  ------------------
  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.96k|                break;
  754|  8.09k|            case 2:                             /* dynamic block */
  ------------------
  |  Branch (754:13): [True: 8.09k, False: 3.64k]
  ------------------
  755|  8.09k|                Tracev((stderr, "inflate:     dynamic codes block%s\n", state->last ? " (last)" : ""));
  756|  8.09k|                state->mode = TABLE;
  757|  8.09k|                break;
  758|      0|            default:
  ------------------
  |  Branch (758:13): [True: 0, False: 11.7k]
  ------------------
  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.7k|            }
  761|  11.7k|            DROPBITS(2);
  ------------------
  |  |  132|  11.7k|    do { \
  |  |  133|  11.7k|        unsigned u = (unsigned)(n); \
  |  |  134|  11.7k|        hold >>= u; \
  |  |  135|  11.7k|        bits -= (bits_t)u; \
  |  |  136|  11.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 11.7k]
  |  |  ------------------
  ------------------
  762|  11.7k|            break;
  763|       |
  764|  8.36k|        case STORED:
  ------------------
  |  Branch (764:9): [True: 8.36k, False: 459M]
  ------------------
  765|       |            /* get and verify stored block length */
  766|  8.36k|            BYTEBITS();                         /* go to byte boundary */
  ------------------
  |  |  140|  8.36k|    do { \
  |  |  141|  8.36k|        hold >>= bits & 7; \
  |  |  142|  8.36k|        bits -= bits & 7; \
  |  |  143|  8.36k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (143:14): [Folded, False: 8.36k]
  |  |  ------------------
  ------------------
  767|  8.36k|            NEEDBITS(32);
  ------------------
  |  |  120|  8.36k|    do { \
  |  |  121|  8.36k|        unsigned u = (unsigned)(n); \
  |  |  122|  15.0k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 13.3k, False: 1.67k]
  |  |  ------------------
  |  |  123|  13.3k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  391|  13.3k|    do { \
  |  |  |  |  392|  13.3k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (392:13): [True: 6.69k, False: 6.69k]
  |  |  |  |  ------------------
  |  |  |  |  393|  13.3k|        have--; \
  |  |  |  |  394|  6.69k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  395|  6.69k|        bits += 8; \
  |  |  |  |  396|  6.69k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:14): [Folded, False: 6.69k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  8.36k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 1.67k]
  |  |  ------------------
  ------------------
  768|  1.67k|            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
  ------------------
  |  Branch (768:17): [True: 0, False: 1.67k]
  ------------------
  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.67k|            state->length = (uint16_t)hold;
  773|  1.67k|            Tracev((stderr, "inflate:       stored length %u\n", state->length));
  774|  1.67k|            INITBITS();
  ------------------
  |  |  112|  1.67k|    do { \
  |  |  113|  1.67k|        hold = 0; \
  |  |  114|  1.67k|        bits = 0; \
  |  |  115|  1.67k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (115:14): [Folded, False: 1.67k]
  |  |  ------------------
  ------------------
  775|  1.67k|            state->mode = COPY_;
  776|  1.67k|            if (flush == Z_TREES)
  ------------------
  |  |  177|  1.67k|#define Z_TREES         6
  ------------------
  |  Branch (776:17): [True: 0, False: 1.67k]
  ------------------
  777|      0|                goto inf_leave;
  778|  1.67k|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  1.67k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  779|       |
  780|  1.67k|        case COPY_:
  ------------------
  |  Branch (780:9): [True: 0, False: 459M]
  ------------------
  781|  1.67k|            state->mode = COPY;
  782|  1.67k|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  1.67k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  783|       |
  784|  47.0M|        case COPY:
  ------------------
  |  Branch (784:9): [True: 47.0M, False: 412M]
  ------------------
  785|       |            /* copy stored block from input to output */
  786|  47.0M|            copy = state->length;
  787|  47.0M|            if (copy) {
  ------------------
  |  Branch (787:17): [True: 47.0M, False: 1.67k]
  ------------------
  788|  47.0M|                copy = MIN(copy, have);
  ------------------
  |  |  148|  47.0M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 47.0M, False: 1.67k]
  |  |  ------------------
  ------------------
  789|  47.0M|                copy = MIN(copy, left);
  ------------------
  |  |  148|  47.0M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 0, False: 47.0M]
  |  |  ------------------
  ------------------
  790|  47.0M|                if (copy == 0)
  ------------------
  |  Branch (790:21): [True: 23.5M, False: 23.5M]
  ------------------
  791|  23.5M|                    goto inf_leave;
  792|  23.5M|                memcpy(put, next, copy);
  793|  23.5M|                have -= copy;
  794|  23.5M|                next += copy;
  795|  23.5M|                left -= copy;
  796|  23.5M|                put += copy;
  797|  23.5M|                state->length -= copy;
  798|  23.5M|                break;
  799|  47.0M|            }
  800|  1.67k|            Tracev((stderr, "inflate:       stored end\n"));
  801|  1.67k|            state->mode = TYPE;
  802|  1.67k|            break;
  803|       |
  804|  22.7k|        case TABLE:
  ------------------
  |  Branch (804:9): [True: 22.7k, False: 459M]
  ------------------
  805|       |            /* get dynamic table entries descriptor */
  806|  22.7k|            NEEDBITS(14);
  ------------------
  |  |  120|  22.7k|    do { \
  |  |  121|  22.7k|        unsigned u = (unsigned)(n); \
  |  |  122|  37.4k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 29.3k, False: 8.09k]
  |  |  ------------------
  |  |  123|  29.3k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  391|  29.3k|    do { \
  |  |  |  |  392|  29.3k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (392:13): [True: 14.6k, False: 14.6k]
  |  |  |  |  ------------------
  |  |  |  |  393|  29.3k|        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.09k]
  |  |  ------------------
  ------------------
  807|  8.09k|            state->nlen = BITS(5) + 257;
  ------------------
  |  |  128|  8.09k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  808|  8.09k|            DROPBITS(5);
  ------------------
  |  |  132|  8.09k|    do { \
  |  |  133|  8.09k|        unsigned u = (unsigned)(n); \
  |  |  134|  8.09k|        hold >>= u; \
  |  |  135|  8.09k|        bits -= (bits_t)u; \
  |  |  136|  8.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 8.09k]
  |  |  ------------------
  ------------------
  809|  8.09k|            state->ndist = BITS(5) + 1;
  ------------------
  |  |  128|  8.09k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  810|  8.09k|            DROPBITS(5);
  ------------------
  |  |  132|  8.09k|    do { \
  |  |  133|  8.09k|        unsigned u = (unsigned)(n); \
  |  |  134|  8.09k|        hold >>= u; \
  |  |  135|  8.09k|        bits -= (bits_t)u; \
  |  |  136|  8.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 8.09k]
  |  |  ------------------
  ------------------
  811|  8.09k|            state->ncode = BITS(4) + 4;
  ------------------
  |  |  128|  8.09k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  812|  8.09k|            DROPBITS(4);
  ------------------
  |  |  132|  8.09k|    do { \
  |  |  133|  8.09k|        unsigned u = (unsigned)(n); \
  |  |  134|  8.09k|        hold >>= u; \
  |  |  135|  8.09k|        bits -= (bits_t)u; \
  |  |  136|  8.09k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 8.09k]
  |  |  ------------------
  ------------------
  813|  8.09k|#ifndef PKZIP_BUG_WORKAROUND
  814|  8.09k|            if (state->nlen > 286 || state->ndist > 30) {
  ------------------
  |  Branch (814:17): [True: 0, False: 8.09k]
  |  Branch (814:38): [True: 0, False: 8.09k]
  ------------------
  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.09k|#endif
  819|  8.09k|            Tracev((stderr, "inflate:       table sizes ok\n"));
  820|  8.09k|            state->have = 0;
  821|  8.09k|            state->mode = LENLENS;
  822|  8.09k|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  8.09k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  823|       |
  824|  59.1k|        case LENLENS:
  ------------------
  |  Branch (824:9): [True: 51.0k, False: 459M]
  ------------------
  825|       |            /* get code length code lengths (not a typo) */
  826|   197k|            while (state->have < state->ncode) {
  ------------------
  |  Branch (826:20): [True: 189k, False: 8.09k]
  ------------------
  827|   189k|                NEEDBITS(3);
  ------------------
  |  |  120|   189k|    do { \
  |  |  121|   189k|        unsigned u = (unsigned)(n); \
  |  |  122|   240k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 102k, False: 138k]
  |  |  ------------------
  |  |  123|   189k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  391|   102k|    do { \
  |  |  |  |  392|   102k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (392:13): [True: 51.0k, False: 51.0k]
  |  |  |  |  ------------------
  |  |  |  |  393|   102k|        have--; \
  |  |  |  |  394|  51.0k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  395|  51.0k|        bits += 8; \
  |  |  |  |  396|  51.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:14): [Folded, False: 51.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  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.1k|            while (state->have < 19)
  ------------------
  |  Branch (831:20): [True: 15.0k, False: 8.09k]
  ------------------
  832|  15.0k|                state->lens[order[state->have++]] = 0;
  833|  8.09k|            state->next = state->codes;
  834|  8.09k|            state->lencode = state->distcode = (const code *)(state->next);
  835|  8.09k|            state->lenbits = 7;
  836|  8.09k|            ret = zng_inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work);
  837|  8.09k|            if (ret) {
  ------------------
  |  Branch (837:17): [True: 0, False: 8.09k]
  ------------------
  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.09k|            Tracev((stderr, "inflate:       code lengths ok\n"));
  842|  8.09k|            state->have = 0;
  843|  8.09k|            state->mode = CODELENS;
  844|  8.09k|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  8.09k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  845|       |
  846|   477k|        case CODELENS:
  ------------------
  |  Branch (846:9): [True: 469k, False: 459M]
  ------------------
  847|       |            /* get length and distance code code lengths */
  848|  1.66M|            while (state->have < state->nlen + state->ndist) {
  ------------------
  |  Branch (848:20): [True: 1.65M, False: 8.09k]
  ------------------
  849|  2.05M|                for (;;) {
  850|  2.05M|                    here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  128|  2.05M|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  851|  2.05M|                    if (here.bits <= bits) break;
  ------------------
  |  Branch (851:25): [True: 1.24M, False: 807k]
  ------------------
  852|   807k|                    PULLBYTE();
  ------------------
  |  |  391|   807k|    do { \
  |  |  392|   807k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (392:13): [True: 403k, False: 403k]
  |  |  ------------------
  |  |  393|   807k|        have--; \
  |  |  394|   403k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  395|   403k|        bits += 8; \
  |  |  396|   403k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (396:14): [Folded, False: 403k]
  |  |  ------------------
  ------------------
  853|   807k|                }
  854|  1.24M|                if (here.val < 16) {
  ------------------
  |  Branch (854:21): [True: 966k, False: 282k]
  ------------------
  855|   966k|                    DROPBITS(here.bits);
  ------------------
  |  |  132|   966k|    do { \
  |  |  133|   966k|        unsigned u = (unsigned)(n); \
  |  |  134|   966k|        hold >>= u; \
  |  |  135|   966k|        bits -= (bits_t)u; \
  |  |  136|   966k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 966k]
  |  |  ------------------
  ------------------
  856|   966k|                    state->lens[state->have++] = here.val;
  857|   966k|                } else {
  858|   282k|                    if (here.val == 16) {
  ------------------
  |  Branch (858:25): [True: 218k, False: 63.9k]
  ------------------
  859|   218k|                        NEEDBITS(here.bits + 2);
  ------------------
  |  |  120|   218k|    do { \
  |  |  121|   218k|        unsigned u = (unsigned)(n); \
  |  |  122|   262k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 87.1k, False: 175k]
  |  |  ------------------
  |  |  123|   218k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  391|  87.1k|    do { \
  |  |  |  |  392|  87.1k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (392:13): [True: 43.5k, False: 43.5k]
  |  |  |  |  ------------------
  |  |  |  |  393|  87.1k|        have--; \
  |  |  |  |  394|  43.5k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  395|  43.5k|        bits += 8; \
  |  |  |  |  396|  43.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:14): [Folded, False: 43.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|   218k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 175k]
  |  |  ------------------
  ------------------
  860|   175k|                        DROPBITS(here.bits);
  ------------------
  |  |  132|   175k|    do { \
  |  |  133|   175k|        unsigned u = (unsigned)(n); \
  |  |  134|   175k|        hold >>= u; \
  |  |  135|   175k|        bits -= (bits_t)u; \
  |  |  136|   175k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 175k]
  |  |  ------------------
  ------------------
  861|   175k|                        if (state->have == 0) {
  ------------------
  |  Branch (861:29): [True: 0, False: 175k]
  ------------------
  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|   175k|                        len = state->lens[state->have - 1];
  866|   175k|                        copy = 3 + BITS(2);
  ------------------
  |  |  128|   175k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  867|   175k|                        DROPBITS(2);
  ------------------
  |  |  132|   175k|    do { \
  |  |  133|   175k|        unsigned u = (unsigned)(n); \
  |  |  134|   175k|        hold >>= u; \
  |  |  135|   175k|        bits -= (bits_t)u; \
  |  |  136|   175k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 175k]
  |  |  ------------------
  ------------------
  868|   175k|                    } else if (here.val == 17) {
  ------------------
  |  Branch (868:32): [True: 39.7k, False: 24.1k]
  ------------------
  869|  39.7k|                        NEEDBITS(here.bits + 3);
  ------------------
  |  |  120|  39.7k|    do { \
  |  |  121|  39.7k|        unsigned u = (unsigned)(n); \
  |  |  122|  50.6k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 21.6k, False: 28.9k]
  |  |  ------------------
  |  |  123|  39.7k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  391|  21.6k|    do { \
  |  |  |  |  392|  21.6k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (392:13): [True: 10.8k, False: 10.8k]
  |  |  |  |  ------------------
  |  |  |  |  393|  21.6k|        have--; \
  |  |  |  |  394|  10.8k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  395|  10.8k|        bits += 8; \
  |  |  |  |  396|  10.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:14): [Folded, False: 10.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  39.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 28.9k]
  |  |  ------------------
  ------------------
  870|  28.9k|                        DROPBITS(here.bits);
  ------------------
  |  |  132|  28.9k|    do { \
  |  |  133|  28.9k|        unsigned u = (unsigned)(n); \
  |  |  134|  28.9k|        hold >>= u; \
  |  |  135|  28.9k|        bits -= (bits_t)u; \
  |  |  136|  28.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 28.9k]
  |  |  ------------------
  ------------------
  871|  28.9k|                        len = 0;
  872|  28.9k|                        copy = 3 + BITS(3);
  ------------------
  |  |  128|  28.9k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  873|  28.9k|                        DROPBITS(3);
  ------------------
  |  |  132|  28.9k|    do { \
  |  |  133|  28.9k|        unsigned u = (unsigned)(n); \
  |  |  134|  28.9k|        hold >>= u; \
  |  |  135|  28.9k|        bits -= (bits_t)u; \
  |  |  136|  28.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 28.9k]
  |  |  ------------------
  ------------------
  874|  28.9k|                    } else {
  875|  24.1k|                        NEEDBITS(here.bits + 7);
  ------------------
  |  |  120|  24.1k|    do { \
  |  |  121|  24.1k|        unsigned u = (unsigned)(n); \
  |  |  122|  35.3k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 22.3k, False: 12.9k]
  |  |  ------------------
  |  |  123|  24.1k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  391|  22.3k|    do { \
  |  |  |  |  392|  22.3k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (392:13): [True: 11.1k, False: 11.1k]
  |  |  |  |  ------------------
  |  |  |  |  393|  22.3k|        have--; \
  |  |  |  |  394|  11.1k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  395|  11.1k|        bits += 8; \
  |  |  |  |  396|  11.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:14): [Folded, False: 11.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  24.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 12.9k]
  |  |  ------------------
  ------------------
  876|  12.9k|                        DROPBITS(here.bits);
  ------------------
  |  |  132|  12.9k|    do { \
  |  |  133|  12.9k|        unsigned u = (unsigned)(n); \
  |  |  134|  12.9k|        hold >>= u; \
  |  |  135|  12.9k|        bits -= (bits_t)u; \
  |  |  136|  12.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 12.9k]
  |  |  ------------------
  ------------------
  877|  12.9k|                        len = 0;
  878|  12.9k|                        copy = 11 + BITS(7);
  ------------------
  |  |  128|  12.9k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  879|  12.9k|                        DROPBITS(7);
  ------------------
  |  |  132|  12.9k|    do { \
  |  |  133|  12.9k|        unsigned u = (unsigned)(n); \
  |  |  134|  12.9k|        hold >>= u; \
  |  |  135|  12.9k|        bits -= (bits_t)u; \
  |  |  136|  12.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 12.9k]
  |  |  ------------------
  ------------------
  880|  12.9k|                    }
  881|   216k|                    if (state->have + copy > state->nlen + state->ndist) {
  ------------------
  |  Branch (881:25): [True: 0, False: 216k]
  ------------------
  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: 216k]
  ------------------
  886|  1.41M|                        --copy;
  887|  1.41M|                        state->lens[state->have++] = (uint16_t)len;
  888|  1.41M|                    }
  889|   216k|                }
  890|  1.24M|            }
  891|       |
  892|       |            /* handle error breaks in while */
  893|  8.09k|            if (state->mode == BAD)
  ------------------
  |  Branch (893:17): [True: 0, False: 8.09k]
  ------------------
  894|      0|                break;
  895|       |
  896|       |            /* check for end-of-block code (better have one) */
  897|  8.09k|            if (state->lens[256] == 0) {
  ------------------
  |  Branch (897:17): [True: 0, False: 8.09k]
  ------------------
  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.09k|            state->next = state->codes;
  908|  8.09k|            state->lencode = (const code *)(state->next);
  909|  8.09k|            state->lenbits = MAX_LEN_ROOT_BITS;
  ------------------
  |  |   45|  8.09k|#define MAX_LEN_ROOT_BITS 11
  ------------------
  910|  8.09k|            ret = zng_inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work);
  911|  8.09k|            if (ret) {
  ------------------
  |  Branch (911:17): [True: 0, False: 8.09k]
  ------------------
  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.09k|            state->wide_len = 0;
  918|  15.7k|            for (unsigned sym = 273; sym < state->nlen; sym++) {
  ------------------
  |  Branch (918:38): [True: 11.3k, False: 4.44k]
  ------------------
  919|  11.3k|                if (state->lens[sym] != 0) {
  ------------------
  |  Branch (919:21): [True: 3.65k, False: 7.68k]
  ------------------
  920|  3.65k|                    state->wide_len = 1;
  921|  3.65k|                    break;
  922|  3.65k|                }
  923|  11.3k|            }
  924|  8.09k|            state->distcode = (const code *)(state->next);
  925|  8.09k|            state->distbits = 9;
  926|  8.09k|            ret = zng_inflate_table(DISTS, state->lens + state->nlen, state->ndist,
  927|  8.09k|                            &(state->next), &(state->distbits), state->work);
  928|  8.09k|            if (ret) {
  ------------------
  |  Branch (928:17): [True: 0, False: 8.09k]
  ------------------
  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.09k|            Tracev((stderr, "inflate:       codes ok\n"));
  933|  8.09k|            state->mode = LEN_;
  934|  8.09k|            if (flush == Z_TREES)
  ------------------
  |  |  177|  8.09k|#define Z_TREES         6
  ------------------
  |  Branch (934:17): [True: 0, False: 8.09k]
  ------------------
  935|      0|                goto inf_leave;
  936|  8.09k|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  8.09k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  937|       |
  938|  10.0k|        case LEN_:
  ------------------
  |  Branch (938:9): [True: 1.96k, False: 459M]
  ------------------
  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: 314M]
  ------------------
  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))
  ------------------
  |  |  259|      0|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (259: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|   249M|            for (;;) {
  959|   249M|                here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  128|   249M|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  960|   249M|                if (CODE_BITS(here) <= bits)
  ------------------
  |  |  162|   249M|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 4.49M, False: 244M]
  |  |  ------------------
  ------------------
  |  Branch (960:21): [True: 113M, False: 136M]
  ------------------
  961|   113M|                    break;
  962|   136M|                PULLBYTE();
  ------------------
  |  |  391|   136M|    do { \
  |  |  392|   136M|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (392:13): [True: 32.4M, 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|   113M|            if (here.op && (here.op & 0xf0) == 0) {
  ------------------
  |  Branch (964:17): [True: 2.62M, False: 110M]
  |  Branch (964:28): [True: 255k, False: 2.37M]
  ------------------
  965|   255k|                unsigned last_bits;
  966|   255k|                last = here;
  967|   255k|                last_bits = CODE_BITS(last);
  ------------------
  |  |  162|   255k|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 0, False: 255k]
  |  |  ------------------
  ------------------
  968|   302k|                for (;;) {
  969|   302k|                    here = state->lencode[last.val + (BITS(last_bits + (last.op & 15)) >> last_bits)];
  ------------------
  |  |  128|   302k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  970|   302k|                    if (last_bits + CODE_BITS(here) <= bits)
  ------------------
  |  |  162|   302k|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 110k, False: 192k]
  |  |  ------------------
  ------------------
  |  Branch (970:25): [True: 207k, False: 95.3k]
  ------------------
  971|   207k|                        break;
  972|  95.3k|                    PULLBYTE();
  ------------------
  |  |  391|  95.3k|    do { \
  |  |  392|  95.3k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (392:13): [True: 47.7k, False: 47.6k]
  |  |  ------------------
  |  |  393|  95.3k|        have--; \
  |  |  394|  47.6k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  395|  47.6k|        bits += 8; \
  |  |  396|  47.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (396:14): [Folded, False: 47.6k]
  |  |  ------------------
  ------------------
  973|  95.3k|                }
  974|   207k|                DROPBITS(last_bits);
  ------------------
  |  |  132|   207k|    do { \
  |  |  133|   207k|        unsigned u = (unsigned)(n); \
  |  |  134|   207k|        hold >>= u; \
  |  |  135|   207k|        bits -= (bits_t)u; \
  |  |  136|   207k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 207k]
  |  |  ------------------
  ------------------
  975|   207k|                state->back += last_bits;
  976|   207k|            }
  977|   113M|            code_bits = CODE_BITS(here);
  ------------------
  |  |  162|   113M|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 2.44M, False: 110M]
  |  |  ------------------
  ------------------
  978|   113M|            DROPBITS(code_bits);
  ------------------
  |  |  132|   113M|    do { \
  |  |  133|   113M|        unsigned u = (unsigned)(n); \
  |  |  134|   113M|        hold >>= u; \
  |  |  135|   113M|        bits -= (bits_t)u; \
  |  |  136|   113M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 113M]
  |  |  ------------------
  ------------------
  979|   113M|            state->back += code_bits;
  980|   113M|            state->length = here.val;
  981|       |
  982|       |            /* process literal */
  983|   113M|            if ((int)(here.op) == 0) {
  ------------------
  |  Branch (983:17): [True: 110M, False: 2.45M]
  ------------------
  984|   110M|                TRACE_LITERAL(here.val);
  985|   110M|                state->mode = LIT;
  986|   110M|                break;
  987|   110M|            }
  988|       |
  989|       |            /* process end of block */
  990|  2.45M|            if (here.op & 32) {
  ------------------
  |  Branch (990:17): [True: 9.21k, False: 2.44M]
  ------------------
  991|  9.21k|                TRACE_END_OF_BLOCK();
  992|  9.21k|                state->back = -1;
  993|  9.21k|                state->mode = TYPE;
  994|  9.21k|                break;
  995|  9.21k|            }
  996|       |
  997|       |            /* invalid code */
  998|  2.44M|            if (here.op & 64) {
  ------------------
  |  Branch (998:17): [True: 0, False: 2.44M]
  ------------------
  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.44M|            state->extra = CODE_EXTRA(here);
  ------------------
  |  |  166|  2.44M|    ((unsigned)((here.op & 16) ? (here.bits - (here.op & 15)) : 0))
  |  |  ------------------
  |  |  |  Branch (166:17): [True: 2.44M, False: 0]
  |  |  ------------------
  ------------------
 1005|  2.44M|            state->mode = LENEXT;
 1006|  2.44M|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  2.44M|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1007|       |
 1008|  2.49M|        case LENEXT:
  ------------------
  |  Branch (1008:9): [True: 47.5k, False: 459M]
  ------------------
 1009|       |            /* get extra bits, if any */
 1010|  2.49M|            if (state->extra) {
  ------------------
  |  Branch (1010:17): [True: 335k, False: 2.15M]
  ------------------
 1011|   335k|                NEEDBITS(state->extra);
  ------------------
  |  |  120|   335k|    do { \
  |  |  121|   335k|        unsigned u = (unsigned)(n); \
  |  |  122|   408k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 120k, False: 288k]
  |  |  ------------------
  |  |  123|   335k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  391|   120k|    do { \
  |  |  |  |  392|   120k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (392:13): [True: 47.5k, False: 73.2k]
  |  |  |  |  ------------------
  |  |  |  |  393|   120k|        have--; \
  |  |  |  |  394|  73.2k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  395|  73.2k|        bits += 8; \
  |  |  |  |  396|  73.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:14): [Folded, False: 73.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|   335k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 288k]
  |  |  ------------------
  ------------------
 1012|   288k|                state->length += BITS(state->extra);
  ------------------
  |  |  128|   288k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
 1013|   288k|                DROPBITS(state->extra);
  ------------------
  |  |  132|   288k|    do { \
  |  |  133|   288k|        unsigned u = (unsigned)(n); \
  |  |  134|   288k|        hold >>= u; \
  |  |  135|   288k|        bits -= (bits_t)u; \
  |  |  136|   288k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 288k]
  |  |  ------------------
  ------------------
 1014|   288k|                state->back += state->extra;
 1015|   288k|            }
 1016|  2.44M|            TRACE_LENGTH(state->length);
 1017|  2.44M|            state->was = state->length;
 1018|  2.44M|            state->mode = DIST;
 1019|  2.44M|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  2.44M|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1020|       |
 1021|  2.97M|        case DIST:
  ------------------
  |  Branch (1021:9): [True: 524k, False: 459M]
  ------------------
 1022|       |            /* get distance code */
 1023|  4.08M|            for (;;) {
 1024|  4.08M|                here = state->distcode[BITS(state->distbits)];
  ------------------
  |  |  128|  4.08M|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
 1025|  4.08M|                if (CODE_BITS(here) <= bits)
  ------------------
  |  |  162|  4.08M|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 4.07M, False: 10.1k]
  |  |  ------------------
  ------------------
  |  Branch (1025:21): [True: 2.44M, False: 1.64M]
  ------------------
 1026|  2.44M|                    break;
 1027|  1.64M|                PULLBYTE();
  ------------------
  |  |  391|  1.64M|    do { \
  |  |  392|  1.64M|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (392:13): [True: 522k, False: 1.11M]
  |  |  ------------------
  |  |  393|  1.64M|        have--; \
  |  |  394|  1.11M|        hold += ((uint64_t)(*next++) << bits); \
  |  |  395|  1.11M|        bits += 8; \
  |  |  396|  1.11M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (396:14): [Folded, False: 1.11M]
  |  |  ------------------
  ------------------
 1028|  1.64M|            }
 1029|  2.44M|            if ((here.op & 0xf0) == 0) {
  ------------------
  |  Branch (1029:17): [True: 8.25k, False: 2.43M]
  ------------------
 1030|  8.25k|                unsigned last_bits;
 1031|  8.25k|                last = here;
 1032|  8.25k|                last_bits = CODE_BITS(last);
  ------------------
  |  |  162|  8.25k|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 0, False: 8.25k]
  |  |  ------------------
  ------------------
 1033|  9.55k|                for (;;) {
 1034|  9.55k|                    here = state->distcode[last.val + (BITS(last_bits + (last.op & 15)) >> last_bits)];
  ------------------
  |  |  128|  9.55k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
 1035|  9.55k|                    if (last_bits + CODE_BITS(here) <= bits)
  ------------------
  |  |  162|  9.55k|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 9.55k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1035:25): [True: 6.95k, False: 2.59k]
  ------------------
 1036|  6.95k|                        break;
 1037|  2.59k|                    PULLBYTE();
  ------------------
  |  |  391|  2.59k|    do { \
  |  |  392|  2.59k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (392:13): [True: 1.29k, False: 1.29k]
  |  |  ------------------
  |  |  393|  2.59k|        have--; \
  |  |  394|  1.29k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  395|  1.29k|        bits += 8; \
  |  |  396|  1.29k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (396:14): [Folded, False: 1.29k]
  |  |  ------------------
  ------------------
 1038|  2.59k|                }
 1039|  6.95k|                DROPBITS(last_bits);
  ------------------
  |  |  132|  6.95k|    do { \
  |  |  133|  6.95k|        unsigned u = (unsigned)(n); \
  |  |  134|  6.95k|        hold >>= u; \
  |  |  135|  6.95k|        bits -= (bits_t)u; \
  |  |  136|  6.95k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 6.95k]
  |  |  ------------------
  ------------------
 1040|  6.95k|                state->back += last_bits;
 1041|  6.95k|            }
 1042|  2.44M|            code_bits = CODE_BITS(here);
  ------------------
  |  |  162|  2.44M|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 2.44M, False: 0]
  |  |  ------------------
  ------------------
 1043|  2.44M|            DROPBITS(code_bits);
  ------------------
  |  |  132|  2.44M|    do { \
  |  |  133|  2.44M|        unsigned u = (unsigned)(n); \
  |  |  134|  2.44M|        hold >>= u; \
  |  |  135|  2.44M|        bits -= (bits_t)u; \
  |  |  136|  2.44M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 2.44M]
  |  |  ------------------
  ------------------
 1044|  2.44M|            state->back += code_bits;
 1045|  2.44M|            if (here.op & 64) {
  ------------------
  |  Branch (1045:17): [True: 0, False: 2.44M]
  ------------------
 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.44M|            state->offset = here.val;
 1050|  2.44M|            state->extra = CODE_EXTRA(here);
  ------------------
  |  |  166|  2.44M|    ((unsigned)((here.op & 16) ? (here.bits - (here.op & 15)) : 0))
  |  |  ------------------
  |  |  |  Branch (166:17): [True: 2.44M, False: 0]
  |  |  ------------------
  ------------------
 1051|  2.44M|            state->mode = DISTEXT;
 1052|  2.44M|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  2.44M|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1053|       |
 1054|  4.97M|        case DISTEXT:
  ------------------
  |  Branch (1054:9): [True: 2.53M, False: 457M]
  ------------------
 1055|       |            /* get distance extra bits, if any */
 1056|  4.97M|            if (state->extra) {
  ------------------
  |  Branch (1056:17): [True: 4.90M, False: 72.9k]
  ------------------
 1057|  4.90M|                NEEDBITS(state->extra);
  ------------------
  |  |  120|  4.90M|    do { \
  |  |  121|  4.90M|        unsigned u = (unsigned)(n); \
  |  |  122|  7.69M|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 5.31M, False: 2.37M]
  |  |  ------------------
  |  |  123|  5.31M|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  391|  5.31M|    do { \
  |  |  |  |  392|  5.31M|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (392:13): [True: 2.53M, False: 2.78M]
  |  |  |  |  ------------------
  |  |  |  |  393|  5.31M|        have--; \
  |  |  |  |  394|  2.78M|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  395|  2.78M|        bits += 8; \
  |  |  |  |  396|  2.78M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:14): [Folded, False: 2.78M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  4.90M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 2.37M]
  |  |  ------------------
  ------------------
 1058|  2.37M|                state->offset += BITS(state->extra);
  ------------------
  |  |  128|  2.37M|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
 1059|  2.37M|                DROPBITS(state->extra);
  ------------------
  |  |  132|  2.37M|    do { \
  |  |  133|  2.37M|        unsigned u = (unsigned)(n); \
  |  |  134|  2.37M|        hold >>= u; \
  |  |  135|  2.37M|        bits -= (bits_t)u; \
  |  |  136|  2.37M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 2.37M]
  |  |  ------------------
  ------------------
 1060|  2.37M|                state->back += state->extra;
 1061|  2.37M|            }
 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.44M|            TRACE_DISTANCE(state->offset);
 1069|  2.44M|            state->mode = MATCH;
 1070|  2.44M|            Z_FALLTHROUGH;
  ------------------
  |  |   54|  2.44M|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1071|       |
 1072|  76.2M|        case MATCH:
  ------------------
  |  Branch (1072:9): [True: 73.7M, False: 386M]
  ------------------
 1073|       |            /* copy match from window to output */
 1074|  76.2M|            if (left == 0)
  ------------------
  |  Branch (1074:17): [True: 37.0M, False: 39.1M]
  ------------------
 1075|  37.0M|                goto inf_leave;
 1076|  39.1M|            copy = out - left;
 1077|  39.1M|            if (state->offset > copy) {         /* copy from window */
  ------------------
  |  Branch (1077:17): [True: 39.1M, False: 0]
  ------------------
 1078|  39.1M|                copy = state->offset - copy;
 1079|  39.1M|                if (copy > state->whave) {
  ------------------
  |  Branch (1079:21): [True: 0, False: 39.1M]
  ------------------
 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|  39.1M|                if (copy > state->wnext) {
  ------------------
  |  Branch (1101:21): [True: 7.35M, False: 31.8M]
  ------------------
 1102|  7.35M|                    copy -= state->wnext;
 1103|  7.35M|                    from = state->window + (state->wsize - copy);
 1104|  31.8M|                } else {
 1105|  31.8M|                    from = state->window + (state->wnext - copy);
 1106|  31.8M|                }
 1107|  39.1M|                copy = MIN(copy, state->length);
  ------------------
  |  |  148|  39.1M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 27.6M, False: 11.5M]
  |  |  ------------------
  ------------------
 1108|  39.1M|                copy = MIN(copy, left);
  ------------------
  |  |  148|  39.1M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 25.6M, False: 13.5M]
  |  |  ------------------
  ------------------
 1109|       |
 1110|  39.1M|                put = chunkcopy_safe(put, from, copy, put + left);
 1111|  39.1M|            } else {
 1112|      0|                copy = MIN(state->length, left);
  ------------------
  |  |  148|      0|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148: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|  39.1M|            left -= copy;
 1117|  39.1M|            state->length -= copy;
 1118|  39.1M|            if (state->length == 0)
  ------------------
  |  Branch (1118:17): [True: 2.44M, False: 36.7M]
  ------------------
 1119|  2.44M|                state->mode = LEN;
 1120|  39.1M|            break;
 1121|       |
 1122|   189M|        case LIT:
  ------------------
  |  Branch (1122:9): [True: 189M, False: 270M]
  ------------------
 1123|   189M|            if (left == 0)
  ------------------
  |  Branch (1123:17): [True: 78.8M, False: 110M]
  ------------------
 1124|  78.8M|                goto inf_leave;
 1125|   110M|            *put++ = (unsigned char)(state->length);
 1126|   110M|            left--;
 1127|   110M|            state->mode = LEN;
 1128|   110M|            break;
 1129|       |
 1130|  2.84k|        case CHECK:
  ------------------
  |  Branch (1130:9): [True: 2.84k, False: 459M]
  ------------------
 1131|  2.84k|            if (state->wrap) {
  ------------------
  |  Branch (1131:17): [True: 2.84k, False: 0]
  ------------------
 1132|  2.84k|                NEEDBITS(32);
  ------------------
  |  |  120|  2.84k|    do { \
  |  |  121|  2.84k|        unsigned u = (unsigned)(n); \
  |  |  122|  3.32k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 3.32k, False: 0]
  |  |  ------------------
  |  |  123|  3.32k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  391|  3.32k|    do { \
  |  |  |  |  392|  3.32k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (392:13): [True: 2.84k, False: 483]
  |  |  |  |  ------------------
  |  |  |  |  393|  3.32k|        have--; \
  |  |  |  |  394|    483|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  395|    483|        bits += 8; \
  |  |  |  |  396|    483|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:14): [Folded, False: 483]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  2.84k|    } 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) {
  ------------------
  |  |  216|      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: 459M]
  ------------------
 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: 459M]
  ------------------
 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: 459M]
  ------------------
 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: 459M]
  ------------------
 1183|       |
 1184|      0|        default:                 /* can't happen, but makes compilers happy */
  ------------------
  |  Branch (1184:9): [True: 0, False: 459M]
  ------------------
 1185|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1186|   459M|        }
 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|   175M|  inf_leave:
 1194|   175M|    RESTORE();
  ------------------
  |  |   94|   175M|    do { \
  |  |   95|   175M|        strm->next_out = put; \
  |  |   96|   175M|        strm->avail_out = left; \
  |  |   97|   175M|        strm->next_in = (z_const unsigned char *)next; \
  |  |   98|   175M|        strm->avail_in = have; \
  |  |   99|   175M|        state->hold = hold; \
  |  |  100|   175M|        state->bits = bits; \
  |  |  101|   175M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (101:14): [Folded, False: 175M]
  |  |  ------------------
  ------------------
 1195|   175M|    uint32_t check_bytes = out - strm->avail_out;
 1196|   175M|    if (INFLATE_NEED_UPDATEWINDOW(strm) &&
  ------------------
  |  |   36|   351M|#  define INFLATE_NEED_UPDATEWINDOW(strm) 1
  |  |  ------------------
  |  |  |  Branch (36:43): [True: 175M, Folded]
  |  |  ------------------
  ------------------
 1197|   175M|            (state->wsize || (out != strm->avail_out && state->mode < BAD &&
  ------------------
  |  Branch (1197:14): [True: 175M, False: 117k]
  |  Branch (1197:31): [True: 3.71k, False: 114k]
  |  Branch (1197:57): [True: 3.71k, False: 0]
  ------------------
 1198|   175M|                 (state->mode < CHECK || flush != Z_FINISH)))) {
  ------------------
  |  |  175|      0|#define Z_FINISH        4
  ------------------
  |  Branch (1198:19): [True: 3.71k, False: 0]
  |  Branch (1198:42): [True: 0, False: 0]
  ------------------
 1199|       |        /* update sliding window with respective checksum if not in "raw" mode */
 1200|   175M|        updatewindow(strm, strm->next_out, check_bytes, state->wrap & 4);
 1201|   175M|    }
 1202|   175M|    in -= strm->avail_in;
 1203|   175M|    out -= strm->avail_out;
 1204|   175M|    strm->total_in += in;
 1205|   175M|    strm->total_out += out;
 1206|   175M|    state->total += out;
 1207|       |
 1208|   175M|    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
  ------------------
  |  Branch (1208:43): [True: 20.9M, False: 154M]
  ------------------
 1209|   175M|                      (state->mode == TYPE ? 128 : 0) + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
  ------------------
  |  Branch (1209:24): [True: 7.54k, False: 175M]
  |  Branch (1209:58): [True: 0, False: 175M]
  |  Branch (1209:81): [True: 0, False: 175M]
  ------------------
 1210|   175M|    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) {
  ------------------
  |  |  175|   175M|#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.8M, False: 131M]
  |  Branch (1210:22): [True: 0, False: 43.8M]
  |  Branch (1210:35): [True: 0, False: 175M]
  |  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|   175M|    return ret;
 1218|   175M|}
zng_inflateEnd:
 1220|  3.71k|int32_t Z_EXPORT PREFIX(inflateEnd)(PREFIX3(stream) *strm) {
 1221|  3.71k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (1221:9): [True: 0, False: 3.71k]
  ------------------
 1222|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1223|       |
 1224|       |    /* Free allocated buffers */
 1225|  3.71k|    free_inflate(strm);
 1226|       |
 1227|  3.71k|    Tracev((stderr, "inflate: end\n"));
 1228|  3.71k|    return Z_OK;
  ------------------
  |  |  180|  3.71k|#define Z_OK            0
  ------------------
 1229|  3.71k|}
inflate.c:inflateStateCheck:
   53|   175M|static int inflateStateCheck(PREFIX3(stream) *strm) {
   54|   175M|    struct inflate_state *state;
   55|   175M|    if (strm == NULL || strm->zalloc == NULL || strm->zfree == NULL)
  ------------------
  |  Branch (55:9): [True: 0, False: 175M]
  |  Branch (55:25): [True: 0, False: 175M]
  |  Branch (55:49): [True: 0, False: 175M]
  ------------------
   56|      0|        return 1;
   57|   175M|    state = (struct inflate_state *)strm->state;
   58|   175M|    if (state == NULL || state->alloc_bufs == NULL || state->strm != strm || state->mode < HEAD || state->mode > SYNC)
  ------------------
  |  Branch (58:9): [True: 0, False: 175M]
  |  Branch (58:26): [True: 0, False: 175M]
  |  Branch (58:55): [True: 0, False: 175M]
  |  Branch (58:78): [True: 0, False: 175M]
  |  Branch (58:100): [True: 0, False: 175M]
  ------------------
   59|      0|        return 1;
   60|   175M|    return 0;
   61|   175M|}
inflate.c:updatewindow:
  329|   175M|static void updatewindow(PREFIX3(stream) *strm, const uint8_t *end, uint32_t len, int32_t cksum) {
  330|   175M|    struct inflate_state *state;
  331|   175M|    uint32_t dist;
  332|       |
  333|   175M|    state = (struct inflate_state *)strm->state;
  334|       |
  335|       |    /* if window not in use yet, initialize */
  336|   175M|    if (state->wsize == 0)
  ------------------
  |  Branch (336:9): [True: 3.71k, False: 175M]
  ------------------
  337|  3.71k|        state->wsize = 1U << state->wbits;
  338|       |
  339|       |    /* len state->wsize or less output bytes into the circular window */
  340|   175M|    if (len >= state->wsize) {
  ------------------
  |  Branch (340:9): [True: 0, False: 175M]
  ------------------
  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|   175M|    } else {
  355|   175M|        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|   175M|        dist = MIN(dist, len);
  ------------------
  |  |  148|   175M|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 175M, False: 4.74k]
  |  |  ------------------
  ------------------
  359|   175M|        if (INFLATE_NEED_CHECKSUM(strm) && cksum) {
  ------------------
  |  |   34|   350M|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (34:39): [True: 175M, Folded]
  |  |  ------------------
  ------------------
  |  Branch (359:44): [True: 175M, False: 0]
  ------------------
  360|   175M|            inf_chksum_cpy(strm, state->window + state->wnext, end - len, dist);
  361|   175M|        } else {
  362|      0|            memcpy(state->window + state->wnext, end - len, dist);
  363|      0|        }
  364|   175M|        len -= dist;
  365|   175M|        if (len) {
  ------------------
  |  Branch (365:13): [True: 0, False: 175M]
  ------------------
  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|   175M|        } else {
  375|   175M|            state->wnext += dist;
  376|   175M|            if (state->wnext == state->wsize)
  ------------------
  |  Branch (376:17): [True: 4.74k, False: 175M]
  ------------------
  377|  4.74k|                state->wnext = 0;
  378|   175M|            if (state->whave < state->wsize)
  ------------------
  |  Branch (378:17): [True: 30.5M, False: 144M]
  ------------------
  379|  30.5M|                state->whave += dist;
  380|   175M|        }
  381|   175M|    }
  382|   175M|}
inflate.c:inf_chksum_cpy:
   28|   175M|                           const uint8_t *src, uint32_t copy) {
   29|   175M|    if (!copy) return;
  ------------------
  |  Branch (29:9): [True: 1.91M, False: 173M]
  ------------------
   30|   173M|    struct inflate_state *state = (struct inflate_state*)strm->state;
   31|   173M|#ifdef GUNZIP
   32|   173M|    if (state->flags) {
  ------------------
  |  Branch (32:9): [True: 0, False: 173M]
  ------------------
   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|   173M|#endif
   36|   173M|    {
   37|   173M|        strm->adler = state->check = FUNCTABLE_CALL(adler32_copy)(state->check, dst, src, copy);
  ------------------
  |  |   48|   173M|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
   38|   173M|    }
   39|   173M|}

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

zng_inflate_table:
  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|   205k|    for (max = MAX_BITS; max >= 1; max--)
  ------------------
  |  |   41|  24.2k|#define MAX_BITS 15
  ------------------
  |  Branch (223:26): [True: 205k, False: 0]
  ------------------
  224|   205k|        if (count[max] != 0) break;
  ------------------
  |  Branch (224:13): [True: 24.2k, False: 181k]
  ------------------
  225|  24.2k|    root = MIN(root, max);
  ------------------
  |  |  148|  24.2k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (148:20): [True: 12.8k, False: 11.4k]
  |  |  ------------------
  ------------------
  226|  24.2k|    if (UNLIKELY(max == 0)) {           /* no symbols to code at all */
  ------------------
  |  |  260|  24.2k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260: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.8k|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (235:19): [True: 65.1k, False: 2.67k]
  ------------------
  236|  65.1k|        if (count[min] != 0) break;
  ------------------
  |  Branch (236:13): [True: 21.6k, False: 43.5k]
  ------------------
  237|  24.2k|    root = MAX(root, min);
  ------------------
  |  |  150|  24.2k|#define MAX(a, b) ((a) < (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (150: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.09k|#define MAX_LEN_ROOT_BITS 11
  ------------------
  |  Branch (242:9): [True: 8.09k, False: 16.1k]
  |  Branch (242:25): [True: 6.18k, False: 1.91k]
  ------------------
  243|  6.18k|        unsigned space = 0;
  244|  37.0k|        for (len = root; len <= MAX_BITS; len++)
  ------------------
  |  |   41|  37.0k|#define MAX_BITS 15
  ------------------
  |  Branch (244:26): [True: 30.9k, False: 6.18k]
  ------------------
  245|  30.9k|            space += (unsigned)count[len] << (MAX_BITS - len);
  ------------------
  |  |   41|  30.9k|#define MAX_BITS 15
  ------------------
  246|  6.18k|        if (space < ROOT_GROW_MIN_SPACE)
  ------------------
  |  |   31|  6.18k|#define ROOT_GROW_MIN_SPACE ((1U << MAX_BITS) / 256)
  |  |  ------------------
  |  |  |  |   41|  6.18k|#define MAX_BITS 15
  |  |  ------------------
  ------------------
  |  Branch (246:13): [True: 3.99k, False: 2.18k]
  ------------------
  247|  3.99k|            root--;
  248|  6.18k|    }
  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: 364k, False: 24.2k]
  ------------------
  253|   364k|        left <<= 1;
  254|   364k|        left -= count[len];
  255|   364k|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (255:13): [True: 0, False: 364k]
  ------------------
  256|   364k|    }
  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|   364k|    for (len = 1; len < MAX_BITS; len++)
  ------------------
  |  |   41|   364k|#define MAX_BITS 15
  ------------------
  |  Branch (262:19): [True: 340k, False: 24.2k]
  ------------------
  263|   340k|        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.90M, False: 627k]
  ------------------
  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.09k|    case CODES:
  ------------------
  |  Branch (305:5): [True: 8.09k, False: 16.1k]
  ------------------
  306|  8.09k|        base = extra = work;    /* dummy value--not used */
  307|  8.09k|        match = 20;
  308|  8.09k|        break;
  309|  8.09k|    case LENS:
  ------------------
  |  Branch (309:5): [True: 8.09k, False: 16.1k]
  ------------------
  310|  8.09k|        base = lbase;
  311|  8.09k|        extra = lext;
  312|  8.09k|        match = 257;
  313|  8.09k|        break;
  314|  8.09k|    case DISTS:
  ------------------
  |  Branch (314:5): [True: 8.09k, False: 16.1k]
  ------------------
  315|  8.09k|        base = dbase;
  316|  8.09k|        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.09k|#define ENOUGH_LENS 2340
  ------------------
  |  Branch (332:10): [True: 8.09k, False: 16.1k]
  |  Branch (332:26): [True: 0, False: 8.09k]
  ------------------
  333|  24.2k|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   53|  8.09k|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (333:10): [True: 8.09k, False: 16.1k]
  |  Branch (333:27): [True: 0, False: 8.09k]
  ------------------
  334|      0|        return 1;
  335|       |
  336|       |    /* process all codes and make table entries */
  337|  1.90M|    for (;;) {
  338|       |        /* create table entry */
  339|  1.90M|        here.bits = (unsigned char)(len - drop);
  340|  1.90M|        if (LIKELY(work[sym] >= match)) {
  ------------------
  |  |  259|  1.90M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (259:33): [True: 146k, False: 1.76M]
  |  |  ------------------
  ------------------
  341|   146k|            unsigned op = extra[work[sym] - match];
  342|   146k|            here.op = COMBINE_OP(op, here.bits);
  ------------------
  |  |  174|   146k|    ((unsigned char)((extra) & 16 ? (code_bits) | 16 : (extra)))
  |  |  ------------------
  |  |  |  Branch (174:22): [True: 146k, False: 0]
  |  |  ------------------
  ------------------
  343|   146k|            here.bits = COMBINE_BITS(here.bits, op);
  ------------------
  |  |  178|   146k|    ((unsigned char)((code_bits) + ((extra) & 15)))
  ------------------
  344|   146k|            here.val = base[work[sym] - match];
  345|  1.76M|        } else if (work[sym] + 1U < match) {
  ------------------
  |  Branch (345:20): [True: 1.75M, False: 8.09k]
  ------------------
  346|  1.75M|            here.op = (unsigned char)0;
  347|  1.75M|            here.val = work[sym];
  348|  1.75M|        } else {
  349|  8.09k|            here.op = (unsigned char)(32 + 64);         /* end of block */
  350|  8.09k|            here.val = 0;
  351|  8.09k|        }
  352|       |
  353|       |        /* replicate for those indices with low len bits equal to huff */
  354|  1.90M|        incr = 1U << (len - drop);
  355|  1.90M|        fill = 1U << curr;
  356|  1.90M|        min = fill;                 /* save offset to next table */
  357|  1.90M|        {
  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.90M|            uint32_t here_u32 = zng_memread_4(&here);
  361|  1.90M|            code *base_ptr = next + (huff >> drop);
  362|  1.90M|            unsigned step4 = incr << 2;
  363|       |            /* Unroll by four so the slot addresses are independent. */
  364|  4.58M|            while (fill >= step4) {
  ------------------
  |  Branch (364:20): [True: 2.67M, False: 1.90M]
  ------------------
  365|  2.67M|                zng_memwrite_4(&base_ptr[fill - 1 * incr], here_u32);
  366|  2.67M|                zng_memwrite_4(&base_ptr[fill - 2 * incr], here_u32);
  367|  2.67M|                zng_memwrite_4(&base_ptr[fill - 3 * incr], here_u32);
  368|  2.67M|                zng_memwrite_4(&base_ptr[fill - 4 * incr], here_u32);
  369|  2.67M|                fill -= step4;
  370|  2.67M|            }
  371|  2.80M|            while (fill != 0) {
  ------------------
  |  Branch (371:20): [True: 897k, False: 1.90M]
  ------------------
  372|   897k|                fill -= incr;
  373|   897k|                zng_memwrite_4(&base_ptr[fill], here_u32);
  374|   897k|            }
  375|  1.90M|        }
  376|       |
  377|       |        /* backwards increment the len-bit code huff */
  378|  1.90M|        rhuff = (uint16_t)(rhuff + (0x8000u >> (len - 1)));
  379|  1.90M|        huff = zng_bitreverse16(rhuff);
  380|       |
  381|       |        /* go to next symbol, update count, len */
  382|  1.90M|        sym++;
  383|  1.90M|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (383:13): [True: 125k, False: 1.78M]
  ------------------
  384|   125k|            if (len == max)
  ------------------
  |  Branch (384:17): [True: 24.2k, False: 100k]
  ------------------
  385|  24.2k|                break;
  386|   100k|            len = lens[work[sym]];
  387|   100k|        }
  388|       |
  389|       |        /* create new sub-table if needed */
  390|  1.88M|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (390:13): [True: 100k, False: 1.78M]
  |  Branch (390:27): [True: 25.3k, False: 75.3k]
  ------------------
  391|       |            /* if first time, transition to sub-tables */
  392|  25.3k|            if (drop == 0)
  ------------------
  |  Branch (392:17): [True: 6.58k, False: 18.7k]
  ------------------
  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.91k]
  ------------------
  404|  14.0k|                    break;
  405|  7.91k|                curr++;
  406|  7.91k|                left <<= 1;
  407|  7.91k|            }
  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|    983|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (411:18): [True: 24.3k, False: 983]
  |  Branch (411:34): [True: 0, False: 24.3k]
  |  Branch (411:58): [True: 983, False: 24.3k]
  |  Branch (411:75): [True: 0, False: 983]
  ------------------
  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.88M|    }
  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)) {
  ------------------
  |  |  260|  24.2k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260: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: 11.0k]
  ------------------
  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.26M, False: 24.2k]
  ------------------
  104|  1.26M|        s1 = _mm_add_epi8(s1, _mm_load_si128((const __m128i*)&one[16 * lens[sym]]));  // vaddq_u8
  105|  1.26M|        s2 = _mm_add_epi8(s2, _mm_load_si128((const __m128i*)&one[16 * lens[sym+1]]));
  106|  1.26M|    }
  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.35M|Z_INTERNAL void insert_knuth_batch(deflate_state *const s, unsigned char *window, uint32_t str, uint32_t count) {
   13|  2.35M|    insert_knuth_batch_static(s, window, str, count);
   14|  2.35M|}
insert_knuth_stepped:
   16|  18.3k|Z_INTERNAL void insert_knuth_stepped(deflate_state *const s, unsigned char *window, uint32_t str, uint32_t count, uint32_t step) {
   17|  18.3k|    insert_knuth_stepped_static(s, window, str, count, step);
   18|  18.3k|}

deflate.c:insert_knuth:
   69|   172M|Z_FORCEINLINE static uint32_t insert_knuth(deflate_state *const s, unsigned char *window, uint32_t str) {
   70|   172M|    uint8_t *strstart = window + str;
   71|   172M|    uint32_t val, h, head;
   72|       |
   73|   172M|    val = Z_U32_FROM_LE(zng_memread_4(strstart));
  ------------------
  |  |   87|   172M|#  define Z_U32_FROM_LE(x)  (x)
  ------------------
   74|   172M|    UPDATE_HASH_KNUTH(h, val);
  ------------------
  |  |   10|   172M|#define UPDATE_HASH_KNUTH(h,val) h = (((val) * 2654435761U) >> KNUTH_SHIFT)
  |  |  ------------------
  |  |  |  |    9|   172M|#define KNUTH_SHIFT (32 - HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|   172M|#  define HASH_BITS    16u         /* log2(HASH_SIZE) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   75|       |
   76|   172M|    head = s->head[h];
   77|   172M|    if (LIKELY(head != str)) {
  ------------------
  |  |  259|   172M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (259:33): [True: 72.2k, False: 172M]
  |  |  ------------------
  ------------------
   78|  72.2k|        s->prev[str & W_MASK(s)] = (Pos)head;
  ------------------
  |  |  418|  72.2k|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
   79|  72.2k|        s->head[h] = (Pos)str;
   80|  72.2k|    }
   81|   172M|    return head;
   82|   172M|}
deflate_medium.c:insert_knuth:
   69|   136M|Z_FORCEINLINE static uint32_t insert_knuth(deflate_state *const s, unsigned char *window, uint32_t str) {
   70|   136M|    uint8_t *strstart = window + str;
   71|   136M|    uint32_t val, h, head;
   72|       |
   73|   136M|    val = Z_U32_FROM_LE(zng_memread_4(strstart));
  ------------------
  |  |   87|   136M|#  define Z_U32_FROM_LE(x)  (x)
  ------------------
   74|   136M|    UPDATE_HASH_KNUTH(h, val);
  ------------------
  |  |   10|   136M|#define UPDATE_HASH_KNUTH(h,val) h = (((val) * 2654435761U) >> KNUTH_SHIFT)
  |  |  ------------------
  |  |  |  |    9|   136M|#define KNUTH_SHIFT (32 - HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|   136M|#  define HASH_BITS    16u         /* log2(HASH_SIZE) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   75|       |
   76|   136M|    head = s->head[h];
   77|   136M|    if (LIKELY(head != str)) {
  ------------------
  |  |  259|   136M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (259:33): [True: 136M, False: 3.65k]
  |  |  ------------------
  ------------------
   78|   136M|        s->prev[str & W_MASK(s)] = (Pos)head;
  ------------------
  |  |  418|   136M|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
   79|   136M|        s->head[h] = (Pos)str;
   80|   136M|    }
   81|   136M|    return head;
   82|   136M|}
insert_string.c:insert_knuth_batch_static:
  141|  2.35M|Z_FORCEINLINE static void insert_knuth_batch_static(deflate_state *const s, unsigned char *window, uint32_t str, uint32_t count) {
  142|  2.35M|    uint8_t *strstart = window + str;
  143|  2.35M|    uint8_t *strend = strstart + count;
  144|       |
  145|       |    /* Local pointers to avoid indirection */
  146|  2.35M|    Pos *headp = s->head;
  147|  2.35M|    Pos *prevp = s->prev;
  148|  2.35M|    const unsigned int w_mask = W_MASK(s);
  ------------------
  |  |  418|  2.35M|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
  149|       |
  150|  16.3M|    for (uint32_t idx = str; strstart < strend; idx++, strstart++) {
  ------------------
  |  Branch (150:30): [True: 13.9M, False: 2.35M]
  ------------------
  151|  13.9M|        uint32_t val, h, head;
  152|       |
  153|  13.9M|        val = Z_U32_FROM_LE(zng_memread_4(strstart));
  ------------------
  |  |   87|  13.9M|#  define Z_U32_FROM_LE(x)  (x)
  ------------------
  154|  13.9M|        UPDATE_HASH_KNUTH(h, val);
  ------------------
  |  |   10|  13.9M|#define UPDATE_HASH_KNUTH(h,val) h = (((val) * 2654435761U) >> KNUTH_SHIFT)
  |  |  ------------------
  |  |  |  |    9|  13.9M|#define KNUTH_SHIFT (32 - HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|  13.9M|#  define HASH_BITS    16u         /* log2(HASH_SIZE) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  155|       |
  156|  13.9M|        head = headp[h];
  157|  13.9M|        if (LIKELY(head != idx)) {
  ------------------
  |  |  259|  13.9M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (259:33): [True: 13.9M, False: 0]
  |  |  ------------------
  ------------------
  158|  13.9M|            prevp[idx & w_mask] = (Pos)head;
  159|  13.9M|            headp[h] = (Pos)idx;
  160|  13.9M|        }
  161|  13.9M|    }
  162|  2.35M|}
insert_string.c:insert_knuth_stepped_static:
  169|  18.3k|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|  18.3k|    Assert(count >= 3, "Insert count too low");
  171|  18.3k|    Assert(max_inserts >= 2, "max_inserts too low");
  172|       |
  173|       |    /* Local pointers to avoid indirection */
  174|  18.3k|    Pos *headp = s->head;
  175|  18.3k|    Pos *prevp = s->prev;
  176|  18.3k|    const unsigned int w_mask = W_MASK(s);
  ------------------
  |  |  418|  18.3k|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
  177|       |
  178|  18.3k|    uint32_t inserts = (count < max_inserts) ? count : max_inserts;
  ------------------
  |  Branch (178:24): [True: 0, False: 18.3k]
  ------------------
  179|  18.3k|    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|  18.3k|    uint32_t inc_fp = (((count - 1) << 16) + (intervals - 1)) / intervals;
  187|       |
  188|       |    /* Initialize the fixed-point index tracking register */
  189|  18.3k|    uint32_t idx_fp = str << 16;
  190|       |
  191|  1.04M|    for (uint32_t i = 0; i < inserts; i++) {
  ------------------
  |  Branch (191:26): [True: 1.02M, False: 18.3k]
  ------------------
  192|  1.02M|        uint32_t val, h, head, idx;
  193|       |
  194|       |        /* Extract the real window index by shifting out the fractional bits */
  195|  1.02M|        idx = idx_fp >> 16;
  196|       |
  197|       |        /* Increment offset for next iteration */
  198|  1.02M|        idx_fp += inc_fp;
  199|       |
  200|  1.02M|        val = Z_U32_FROM_LE(zng_memread_4(window + idx));
  ------------------
  |  |   87|  1.02M|#  define Z_U32_FROM_LE(x)  (x)
  ------------------
  201|  1.02M|        UPDATE_HASH_KNUTH(h, val);
  ------------------
  |  |   10|  1.02M|#define UPDATE_HASH_KNUTH(h,val) h = (((val) * 2654435761U) >> KNUTH_SHIFT)
  |  |  ------------------
  |  |  |  |    9|  1.02M|#define KNUTH_SHIFT (32 - HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|  1.02M|#  define HASH_BITS    16u         /* log2(HASH_SIZE) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  202|       |
  203|  1.02M|        head = headp[h];
  204|  1.02M|        if (LIKELY(head != idx)) {
  ------------------
  |  |  259|  1.02M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (259:33): [True: 1.02M, False: 0]
  |  |  ------------------
  ------------------
  205|  1.02M|            prevp[idx & w_mask] = (Pos)head;
  206|  1.02M|            headp[h] = (Pos)idx;
  207|  1.02M|        }
  208|  1.02M|    }
  209|  18.3k|}

longest_match_avx2:
   26|  47.9M|Z_INTERNAL uint32_t LONGEST_MATCH(deflate_state *const s, uint32_t cur_match) {
   27|  47.9M|    const unsigned wmask = W_MASK(s);
  ------------------
  |  |  418|  47.9M|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
   28|  47.9M|    unsigned int strstart = s->strstart;
   29|  47.9M|    const unsigned char *window = s->window;
   30|  47.9M|    const Pos *prev = s->prev;
   31|       |#ifdef LONGEST_MATCH_SLOW
   32|       |    const Pos *head = s->head;
   33|       |#endif
   34|  47.9M|    const unsigned char *scan;
   35|  47.9M|    const unsigned char *mbase_start = window;
   36|  47.9M|    const unsigned char *mbase_end;
   37|  47.9M|    uint32_t limit;
   38|       |#ifdef LONGEST_MATCH_SLOW
   39|       |    uint32_t limit_base;
   40|       |#endif
   41|  47.9M|    uint32_t chain_length = s->max_chain_length;
   42|  47.9M|    uint32_t nice_match = (uint32_t)s->nice_match;
   43|  47.9M|    uint32_t best_len, offset;
   44|  47.9M|    uint32_t lookahead = s->lookahead;
   45|  47.9M|    uint32_t match_offset = 0;
   46|  47.9M|    uint64_t scan_start;
   47|  47.9M|    uint64_t scan_end;
   48|       |
   49|       |    /* The code is optimized for STD_MAX_MATCH-2 multiple of 16. */
   50|  47.9M|    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|  47.9M|    best_len = STD_MIN_MATCH-1;
  ------------------
  |  |   61|  47.9M|#define STD_MIN_MATCH  3
  ------------------
   58|  47.9M|#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|  47.9M|    offset = best_len >= sizeof(uint64_t) ? best_len - 7 : 0;
  ------------------
  |  Branch (78:14): [True: 0, False: 47.9M]
  ------------------
   79|       |
   80|  47.9M|    scan = window + strstart;
   81|  47.9M|    scan_start = zng_memread_8(scan);
   82|  47.9M|    scan_end = zng_memread_8(scan+offset);
   83|  47.9M|    mbase_end = (mbase_start+offset);
   84|       |
   85|       |    /* Do not waste too much time if we already have a good match */
   86|  47.9M|    if (UNLIKELY(best_len >= s->good_match))
  ------------------
  |  |  260|  47.9M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 0, False: 47.9M]
  |  |  ------------------
  ------------------
   87|      0|        chain_length >>= 2;
   88|       |
   89|       |    /* Stop when cur_match becomes <= limit. To simplify the code,
   90|       |     * we prevent matches with the string of window index 0
   91|       |     */
   92|  47.9M|    limit = strstart > MAX_DIST(s) ? (strstart - MAX_DIST(s)) : 0;
  ------------------
  |  |  413|  47.9M|#define MAX_DIST(s)  ((s)->w_size - MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  408|  47.9M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  47.9M|#define STD_MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|  47.9M|#define STD_MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  limit = strstart > MAX_DIST(s) ? (strstart - MAX_DIST(s)) : 0;
  ------------------
  |  |  413|  43.3M|#define MAX_DIST(s)  ((s)->w_size - MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  408|  43.3M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   62|  43.3M|#define STD_MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|  43.3M|#define STD_MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (92:13): [True: 43.3M, False: 4.63M]
  ------------------
   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|  47.9M|    Assert(strstart <= s->fill_end, "need lookahead");
  138|  50.0M|    for (;;) {
  139|  50.0M|        if (UNLIKELY(cur_match >= strstart))
  ------------------
  |  |  260|  50.0M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 0, False: 50.0M]
  |  |  ------------------
  ------------------
  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|  50.0M|        uint32_t len;
  150|  50.0M|        if (best_len < sizeof(uint64_t)) {
  ------------------
  |  Branch (150:13): [True: 49.4M, False: 624k]
  ------------------
  151|  49.4M|            uint64_t cand_start = zng_memread_8(mbase_start + cur_match);
  152|  49.4M|            if (scan_start != cand_start) {
  ------------------
  |  Branch (152:17): [True: 48.9M, False: 440k]
  ------------------
  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|  48.9M|                uint64_t first_mask = zng_first_bytes_mask64(best_len + 1);
  ------------------
  |  |  138|  48.9M|#  define zng_first_bytes_mask64(n) (UINT64_MAX >> ((8 - (n)) * 8))
  ------------------
  157|  48.9M|                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|  48.9M|                if (UNLIKELY((diff & first_mask) == 0)) {
  ------------------
  |  |  260|  48.9M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 2.01M, False: 46.9M]
  |  |  ------------------
  ------------------
  161|  2.01M|                    len = zng_first_diff_byte64(diff);
  ------------------
  |  |  130|  2.01M|#  define zng_first_diff_byte64(diff) (zng_ctz64(diff) / 8)
  ------------------
  162|  2.01M|                    goto short_match_accept;
  163|  2.01M|                }
  164|  46.9M|                if (--chain_length == 0 || (cur_match = prev[cur_match & wmask]) <= limit)
  ------------------
  |  Branch (164:21): [True: 130, False: 46.9M]
  |  Branch (164:44): [True: 35.8M, False: 11.0M]
  ------------------
  165|  35.8M|                    return best_len;
  166|  11.0M|                cand_start = zng_memread_8(mbase_start + cur_match);
  167|  11.0M|                if (scan_start != cand_start) {
  ------------------
  |  Branch (167:21): [True: 11.0M, False: 26.0k]
  ------------------
  168|       |                    /* Walk the remaining candidates with the chain advance kept inline. */
  169|  24.5M|                    for (;;) {
  170|  24.5M|                        diff = scan_start ^ cand_start;
  171|  24.5M|                        if (UNLIKELY((diff & first_mask) == 0)) {
  ------------------
  |  |  260|  24.5M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 267k, False: 24.2M]
  |  |  ------------------
  ------------------
  172|   267k|                            len = zng_first_diff_byte64(diff);
  ------------------
  |  |  130|   267k|#  define zng_first_diff_byte64(diff) (zng_ctz64(diff) / 8)
  ------------------
  173|   267k|                            goto short_match_accept;
  174|   267k|                        }
  175|  24.2M|                        if (--chain_length == 0 || (cur_match = prev[cur_match & wmask]) <= limit)
  ------------------
  |  Branch (175:29): [True: 40.0k, False: 24.2M]
  |  Branch (175:52): [True: 10.6M, False: 13.5M]
  ------------------
  176|  10.7M|                            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: 58.0k, False: 13.4M]
  ------------------
  179|  58.0k|                            break;
  180|  13.5M|                    }
  181|  11.0M|                }
  182|  11.0M|            }
  183|       |            /* All 8 bytes match, fallthrough to compare256 for the tail. */
  184|  49.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.62M|            for (;;) {
  188|       |                /* First check the end of the candidate at best_len+1 due to the higher
  189|       |                 * likelihood of a mismatch. */
  190|  8.62M|                if (zng_memcmp_8(mbase_end+cur_match, &scan_end) == 0 &&
  ------------------
  |  Branch (190:21): [True: 336k, False: 8.28M]
  ------------------
  191|   336k|                    zng_memcmp_8(mbase_start+cur_match, &scan_start) == 0)
  ------------------
  |  Branch (191:21): [True: 310k, False: 26.1k]
  ------------------
  192|   310k|                    break;
  193|  8.31M|                GOTO_NEXT_CHAIN;
  ------------------
  |  |   14|  8.31M|    if (--chain_length && (cur_match = prev[cur_match & wmask]) > limit) \
  |  |  ------------------
  |  |  |  Branch (14:9): [True: 8.27M, False: 38.2k]
  |  |  |  Branch (14:27): [True: 7.99M, False: 276k]
  |  |  ------------------
  |  |   15|  7.99M|        continue; \
  |  |   16|   314k|    return best_len;
  ------------------
  194|  8.31M|            }
  195|   624k|        }
  196|       |
  197|   835k|        len = COMPARE256(scan+2, mbase_start+cur_match+2) + 2;
  ------------------
  |  |   51|   835k|#define COMPARE256          compare256_avx2_static
  ------------------
  198|   835k|        Assert(scan+len <= window+(unsigned)(s->window_size-1), "wild scan");
  199|       |
  200|   835k|        if (len > best_len)
  ------------------
  |  Branch (200:13): [True: 778k, False: 56.2k]
  ------------------
  201|  3.83M|short_match_accept:
  202|  3.83M|        {
  203|  3.83M|            uint32_t match_start = cur_match - match_offset;
  204|  3.83M|            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.83M|            if (UNLIKELY(len >= lookahead))
  ------------------
  |  |  260|  3.06M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 1.00k, False: 3.05M]
  |  |  ------------------
  ------------------
  210|  1.00k|                return lookahead;
  211|  3.05M|            if (UNLIKELY(len >= nice_match))
  ------------------
  |  |  260|  3.05M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 90.8k, False: 2.96M]
  |  |  ------------------
  ------------------
  212|  90.8k|                return len;
  213|       |
  214|  2.96M|            best_len = len;
  215|       |
  216|  2.96M|            offset = best_len >= sizeof(uint64_t) ? best_len - 7 : 0;
  ------------------
  |  Branch (216:22): [True: 687k, False: 2.28M]
  ------------------
  217|       |
  218|  2.96M|            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.96M|            mbase_end = (mbase_start+offset);
  293|  2.96M|        }
  294|  3.02M|        GOTO_NEXT_CHAIN;
  ------------------
  |  |   14|  3.02M|    if (--chain_length && (cur_match = prev[cur_match & wmask]) > limit) \
  |  |  ------------------
  |  |  |  Branch (14:9): [True: 3.02M, False: 916]
  |  |  |  Branch (14:27): [True: 2.04M, False: 976k]
  |  |  ------------------
  |  |   15|  2.04M|        continue; \
  |  |   16|   977k|    return best_len;
  ------------------
  295|  3.02M|    }
  296|      0|    return best_len;
  297|  47.9M|}

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

zng_tr_init:
   83|  3.71k|void Z_INTERNAL zng_tr_init(deflate_state *s) {
   84|  3.71k|    s->l_desc.dyn_tree = s->dyn_ltree;
   85|  3.71k|    s->l_desc.stat_desc = &static_l_desc;
   86|       |
   87|  3.71k|    s->d_desc.dyn_tree = s->dyn_dtree;
   88|  3.71k|    s->d_desc.stat_desc = &static_d_desc;
   89|       |
   90|  3.71k|    s->bl_desc.dyn_tree = s->bl_tree;
   91|  3.71k|    s->bl_desc.stat_desc = &static_bl_desc;
   92|       |
   93|  3.71k|    s->bi_buf = 0;
   94|  3.71k|    s->bi_valid = 0;
   95|  3.71k|    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.71k|    init_block(s);
  103|  3.71k|}
gen_codes:
  383|  35.2k|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.2k|    uint16_t next_code[MAX_BITS+1];  /* next code value for each bit length */
  388|  35.2k|    uint16_t code = 0;               /* running code value */
  389|  35.2k|    int bits;                        /* bit index */
  390|  35.2k|    int n;                           /* code index */
  391|       |
  392|       |    /* The distribution counts are first used to generate the code values
  393|       |     * without bit reversal.
  394|       |     */
  395|   563k|    for (bits = 1; bits <= MAX_BITS; bits++) {
  ------------------
  |  |   41|   563k|#define MAX_BITS 15
  ------------------
  |  Branch (395:20): [True: 528k, False: 35.2k]
  ------------------
  396|   528k|        code = (code + bl_count[bits-1]) << 1;
  397|   528k|        next_code[bits] = code;
  398|   528k|    }
  399|       |    /* Check that the bit counts in bl_count are consistent. The last code
  400|       |     * must be all ones.
  401|       |     */
  402|  35.2k|    Assert(code + bl_count[MAX_BITS]-1 == (1 << MAX_BITS)-1, "inconsistent bit counts");
  403|  35.2k|    Tracev((stderr, "\ngen_codes: max_code %d ", max_code));
  404|       |
  405|  3.61M|    for (n = 0;  n <= max_code; n++) {
  ------------------
  |  Branch (405:18): [True: 3.57M, False: 35.2k]
  ------------------
  406|  3.57M|        int len = tree[n].Len;
  ------------------
  |  |  130|  3.57M|#define Len  dl.len
  ------------------
  407|  3.57M|        if (len == 0)
  ------------------
  |  Branch (407:13): [True: 1.20M, False: 2.37M]
  ------------------
  408|  1.20M|            continue;
  409|       |        /* Now reverse the bits */
  410|  2.37M|        tree[n].Code = bi_reverse(next_code[len]++, len);
  ------------------
  |  |  128|  2.37M|#define Code fc.code
  ------------------
  411|       |
  412|  2.37M|        Tracecv(tree != static_ltree, (stderr, "\nn %3d %c l %2d c %4x (%x) ",
  413|  2.37M|             n, (isgraph(n & 0xff) ? n : ' '), len, tree[n].Code, next_code[len]-1));
  414|  2.37M|    }
  415|  35.2k|}
zng_tr_stored_block:
  602|  1.67k|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.67k|    zng_tr_emit_tree(s, STORED_BLOCK, last); /* send block type */
  ------------------
  |  |   56|  1.67k|#define STORED_BLOCK 0
  ------------------
  607|  1.67k|    zng_tr_emit_align(s);                    /* align on byte boundary */
  608|  1.67k|    cmpr_bits_align(s);
  609|  1.67k|    put_short(s, (uint16_t)stored_len);
  610|  1.67k|    put_short(s, (uint16_t)~stored_len);
  611|  1.67k|    cmpr_bits_add(s, 32);
  ------------------
  |  |  464|  1.67k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  154|  1.67k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  612|  1.67k|    sent_bits_add(s, 32);
  ------------------
  |  |  466|  1.67k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  ------------------
  |  |  |  |  154|  1.67k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  613|  1.67k|    if (stored_len) {
  ------------------
  |  Branch (613:9): [True: 1.67k, False: 0]
  ------------------
  614|  1.67k|        memcpy(s->pending_buf + s->pending, buf, stored_len);
  615|  1.67k|        s->pending += stored_len;
  616|  1.67k|        cmpr_bits_add(s, stored_len << 3);
  ------------------
  |  |  464|  1.67k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  154|  1.67k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  617|  1.67k|        sent_bits_add(s, stored_len << 3);
  ------------------
  |  |  466|  1.67k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  ------------------
  |  |  |  |  154|  1.67k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  618|  1.67k|    }
  619|  1.67k|}
zng_tr_flush_block:
  635|  11.7k|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.7k|    unsigned int opt_lenb, static_lenb; /* opt_len and static_len in bytes */
  640|  11.7k|    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.7k|    if (UNLIKELY(s->sym_next == 0)) {
  ------------------
  |  |  260|  11.7k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (260:33): [True: 42, False: 11.7k]
  |  |  ------------------
  ------------------
  644|       |        /* Emit an empty static tree block with no codes */
  645|     42|        opt_lenb = static_lenb = 0;
  646|     42|        s->static_len = 7;
  647|  11.7k|    } else if (s->level > 0) {
  ------------------
  |  Branch (647:16): [True: 11.7k, False: 0]
  ------------------
  648|       |        /* Check if the file is binary or text */
  649|  11.7k|        if (s->strm->data_type == Z_UNKNOWN)
  ------------------
  |  |  209|  11.7k|#define Z_UNKNOWN  2
  ------------------
  |  Branch (649:13): [True: 3.71k, False: 8.01k]
  ------------------
  650|  3.71k|            s->strm->data_type = detect_data_type(s);
  651|       |
  652|       |        /* Construct the literal and distance trees */
  653|  11.7k|        build_tree(s, (tree_desc *)(&(s->l_desc)));
  654|  11.7k|        Tracev((stderr, "\nlit data: dyn %u, stat %u", s->opt_len, s->static_len));
  655|       |
  656|  11.7k|        build_tree(s, (tree_desc *)(&(s->d_desc)));
  657|  11.7k|        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.7k|        max_blindex = build_bl_tree(s);
  666|       |
  667|       |        /* Determine the best encoding. Compute the block lengths in bytes. */
  668|  11.7k|        opt_lenb = (s->opt_len + 3 + 7) >> 3;
  669|  11.7k|        static_lenb = (s->static_len + 3 + 7) >> 3;
  670|       |
  671|  11.7k|        Tracev((stderr, "\nopt %u(%u) stat %u(%u) stored %u lit %u ",
  672|  11.7k|                opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
  673|  11.7k|                s->sym_next / 3));
  674|       |
  675|  11.7k|        if (static_lenb <= opt_lenb || s->strategy == Z_FIXED)
  ------------------
  |  |  202|  9.58k|#define Z_FIXED               4
  ------------------
  |  Branch (675:13): [True: 2.14k, False: 9.58k]
  |  Branch (675:40): [True: 0, False: 9.58k]
  ------------------
  676|  2.14k|            opt_lenb = static_lenb;
  677|       |
  678|  11.7k|    } 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.7k|    if (stored_len+4 <= opt_lenb && buf != NULL) {
  ------------------
  |  Branch (683:9): [True: 1.67k, False: 10.1k]
  |  Branch (683:37): [True: 1.67k, 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.67k|        zng_tr_stored_block(s, buf, stored_len, last);
  692|       |
  693|  10.1k|    } else if (static_lenb == opt_lenb) {
  ------------------
  |  Branch (693:16): [True: 2.00k, False: 8.09k]
  ------------------
  694|  2.00k|        zng_tr_emit_tree(s, STATIC_TREES, last);
  ------------------
  |  |   57|  2.00k|#define STATIC_TREES 1
  ------------------
  695|  2.00k|        compress_block(s, (const ct_data *)static_ltree, (const ct_data *)static_dtree);
  696|  2.00k|        cmpr_bits_add(s, s->static_len);
  ------------------
  |  |  464|  2.00k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  154|  2.00k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  697|  8.09k|    } else {
  698|  8.09k|        zng_tr_emit_tree(s, DYN_TREES, last);
  ------------------
  |  |   58|  8.09k|#define DYN_TREES    2
  ------------------
  699|  8.09k|        send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, max_blindex+1);
  700|  8.09k|        compress_block(s, (const ct_data *)s->dyn_ltree, (const ct_data *)s->dyn_dtree);
  701|  8.09k|        cmpr_bits_add(s, s->opt_len);
  ------------------
  |  |  464|  8.09k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  154|  8.09k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  702|  8.09k|    }
  703|  11.7k|    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.7k|    init_block(s);
  708|       |
  709|  11.7k|    if (last) {
  ------------------
  |  Branch (709:9): [True: 3.71k, False: 8.05k]
  ------------------
  710|  3.71k|        zng_tr_emit_align(s);
  711|  3.71k|    }
  712|  11.7k|    Tracev((stderr, "\ncomprlen %lu(%lu) ", s->compressed_len>>3, s->compressed_len-7*last));
  713|  11.7k|}
zng_tr_flush_bits:
  841|   131M|void Z_INTERNAL zng_tr_flush_bits(deflate_state *s) {
  842|   131M|    if (s->bi_valid >= 48) {
  ------------------
  |  Branch (842:9): [True: 12, False: 131M]
  ------------------
  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|   131M|    } else if (s->bi_valid >= 32) {
  ------------------
  |  Branch (847:16): [True: 146, False: 131M]
  ------------------
  848|    146|        put_uint32(s, (uint32_t)s->bi_buf);
  849|    146|        s->bi_buf >>= 32;
  850|    146|        s->bi_valid -= 32;
  851|    146|    }
  852|   131M|    if (s->bi_valid >= 16) {
  ------------------
  |  Branch (852:9): [True: 6.49k, False: 131M]
  ------------------
  853|  6.49k|        put_short(s, (uint16_t)s->bi_buf);
  854|  6.49k|        s->bi_buf >>= 16;
  855|  6.49k|        s->bi_valid -= 16;
  856|  6.49k|    }
  857|   131M|    if (s->bi_valid >= 8) {
  ------------------
  |  Branch (857:9): [True: 3.22k, False: 131M]
  ------------------
  858|  3.22k|        put_byte(s, s->bi_buf);
  ------------------
  |  |  354|  3.22k|#define put_byte(s, c) { \
  |  |  355|  3.22k|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  356|  3.22k|}
  ------------------
  859|  3.22k|        s->bi_buf >>= 8;
  860|  3.22k|        s->bi_valid -= 8;
  861|  3.22k|    }
  862|   131M|}
trees.c:init_block:
  108|  15.4k|static void init_block(deflate_state *s) {
  109|  15.4k|    int n; /* iterates over tree elements */
  110|       |
  111|       |    /* Initialize the trees. */
  112|  4.44M|    for (n = 0; n < L_CODES;  n++)
  ------------------
  |  |   40|  4.44M|#define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  ------------------
  |  |  |  |   37|  4.44M|#define LITERALS  256
  |  |  ------------------
  |  |               #define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  ------------------
  |  |  |  |   34|  4.44M|#define LENGTH_CODES 29
  |  |  ------------------
  ------------------
  |  Branch (112:17): [True: 4.43M, False: 15.4k]
  ------------------
  113|  4.43M|        s->dyn_ltree[n].Freq = 0;
  ------------------
  |  |  127|  4.43M|#define Freq fc.freq
  ------------------
  114|   480k|    for (n = 0; n < D_CODES;  n++)
  ------------------
  |  |   43|   480k|#define D_CODES   30
  ------------------
  |  Branch (114:17): [True: 464k, False: 15.4k]
  ------------------
  115|   464k|        s->dyn_dtree[n].Freq = 0;
  ------------------
  |  |  127|   464k|#define Freq fc.freq
  ------------------
  116|   309k|    for (n = 0; n < BL_CODES; n++)
  ------------------
  |  |   46|   309k|#define BL_CODES  19
  ------------------
  |  Branch (116:17): [True: 294k, False: 15.4k]
  ------------------
  117|   294k|        s->bl_tree[n].Freq = 0;
  ------------------
  |  |  127|   294k|#define Freq fc.freq
  ------------------
  118|       |
  119|  15.4k|    s->dyn_ltree[END_BLOCK].Freq = 1;
  ------------------
  |  |   55|  15.4k|#define END_BLOCK 256
  ------------------
                  s->dyn_ltree[END_BLOCK].Freq = 1;
  ------------------
  |  |  127|  15.4k|#define Freq fc.freq
  ------------------
  120|  15.4k|    s->opt_len = s->static_len = 0;
  121|  15.4k|    s->sym_next = 0;
  122|  15.4k|}
trees.c:build_tree:
  165|  35.2k|static void build_tree(deflate_state *s, tree_desc *desc) {
  166|       |    /* desc: the tree descriptor */
  167|  35.2k|    ct_data *tree         = desc->dyn_tree;
  168|  35.2k|    const ct_data *stree  = desc->stat_desc->static_tree;
  169|  35.2k|    int elems             = desc->stat_desc->elems;
  170|  35.2k|    int n, m;          /* iterate over heap elements */
  171|  35.2k|    int max_code = -1; /* largest code with non zero frequency */
  172|  35.2k|    int node;          /* new node being created */
  173|  35.2k|    int nleaves = 0;
  174|  35.2k|    int li = 0, ihead = 0, itail = 0;  /* queue positions for leaves and internal nodes */
  175|  35.2k|    int merges;
  176|  35.2k|    uint32_t *leaves = s->pq_leaves;   /* packed leaf entries, sorted by frequency */
  177|  35.2k|    uint32_t *scratch = s->pq_scratch; /* radix buffer, then FIFO of created internal nodes */
  178|  35.2k|    uint32_t *sorted = leaves;         /* sorted leaves, in scratch after a single pass */
  179|  35.2k|    uint32_t *internals = scratch;     /* internal node FIFO, in whichever buffer is free */
  180|  35.2k|    uint16_t count_lo[257];            /* histogram of the low frequency byte, at offset +1 */
  181|  35.2k|    uint16_t count_hi[257];            /* histogram of the high frequency byte, at offset +1 */
  182|       |
  183|  35.2k|    memset(count_lo, 0, sizeof(count_lo));
  184|  35.2k|    memset(count_hi, 0, sizeof(count_hi));
  185|  3.96M|    for (n = 0; n < elems; n++) {
  ------------------
  |  Branch (185:17): [True: 3.93M, False: 35.2k]
  ------------------
  186|  3.93M|        const uint16_t freq = tree[n].Freq;
  ------------------
  |  |  127|  3.93M|#define Freq fc.freq
  ------------------
  187|  3.93M|        if (freq != 0) {
  ------------------
  |  Branch (187:13): [True: 2.36M, False: 1.56M]
  ------------------
  188|  2.36M|            leaves[nleaves++] = pq_pack(freq, n);
  ------------------
  |  |  128|  2.36M|#define pq_pack(freq, node) (((uint32_t)(freq) << PQ_NODE_BITS) | (unsigned)(node))
  |  |  ------------------
  |  |  |  |  127|  2.36M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  189|  2.36M|            count_lo[(freq & 0xFF) + 1]++;
  190|  2.36M|            count_hi[(freq >> 8) + 1]++;
  191|  2.36M|            max_code = n;
  192|  2.36M|        } else {
  193|  1.56M|            tree[n].Len = 0;
  ------------------
  |  |  130|  1.56M|#define Len  dl.len
  ------------------
  194|  1.56M|        }
  195|  3.93M|    }
  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|  42.6k|    while (nleaves < 2) {
  ------------------
  |  Branch (202:12): [True: 7.42k, False: 35.2k]
  ------------------
  203|  7.42k|        node = (max_code < 2 ? ++max_code : 0);
  ------------------
  |  Branch (203:17): [True: 6.81k, False: 616]
  ------------------
  204|  7.42k|        leaves[nleaves++] = pq_pack(1, node);
  ------------------
  |  |  128|  7.42k|#define pq_pack(freq, node) (((uint32_t)(freq) << PQ_NODE_BITS) | (unsigned)(node))
  |  |  ------------------
  |  |  |  |  127|  7.42k|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  205|  7.42k|        tree[node].Freq = 1;
  ------------------
  |  |  127|  7.42k|#define Freq fc.freq
  ------------------
  206|  7.42k|        s->opt_len--;
  207|  7.42k|        if (stree)
  ------------------
  |  Branch (207:13): [True: 7.42k, False: 0]
  ------------------
  208|  7.42k|            s->static_len -= stree[node].Len;
  ------------------
  |  |  130|  7.42k|#define Len  dl.len
  ------------------
  209|       |        /* node is 0 or 1 so it does not have extra bits */
  210|  7.42k|    }
  211|  35.2k|    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.2k|    if (nleaves == 2) {
  ------------------
  |  Branch (217:9): [True: 5.58k, False: 29.6k]
  ------------------
  218|  5.58k|        if (leaves[0] > leaves[1]) {
  ------------------
  |  Branch (218:13): [True: 981, False: 4.60k]
  ------------------
  219|    981|            const uint32_t t = leaves[0];
  220|    981|            leaves[0] = leaves[1];
  221|    981|            leaves[1] = t;
  222|    981|        }
  223|  29.6k|    } else if ((int)count_hi[1] == nleaves) {
  ------------------
  |  Branch (223:16): [True: 25.2k, False: 4.32k]
  ------------------
  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.2k|        pq_radix_pass(leaves, scratch, nleaves, PQ_NODE_BITS, count_lo);
  ------------------
  |  |  127|  25.2k|#define PQ_NODE_BITS 10
  ------------------
  228|  25.2k|        sorted = scratch;
  229|  25.2k|        internals = leaves;
  230|  25.2k|    } else {
  231|       |        /* Sort by the low then high frequency byte, ending back in leaves. */
  232|  4.32k|        pq_radix_pass(leaves, scratch, nleaves, PQ_NODE_BITS, count_lo);
  ------------------
  |  |  127|  4.32k|#define PQ_NODE_BITS 10
  ------------------
  233|  4.32k|        pq_radix_pass(scratch, leaves, nleaves, PQ_NODE_BITS + 8, count_hi);
  ------------------
  |  |  127|  4.32k|#define PQ_NODE_BITS 10
  ------------------
  234|  4.32k|    }
  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.2k|    node = elems;              /* next internal node of the tree */
  241|  2.37M|    for (merges = nleaves - 1; merges > 0; merges--) {
  ------------------
  |  Branch (241:32): [True: 2.33M, False: 35.2k]
  ------------------
  242|       |        /* en = entry of least frequency, em = entry of next least frequency */
  243|  2.33M|        const uint32_t en = pq_take(sorted, &li, nleaves, internals, &ihead, itail);
  244|  2.33M|        const uint32_t em = pq_take(sorted, &li, nleaves, internals, &ihead, itail);
  245|  2.33M|        n = pq_node(en);
  ------------------
  |  |  129|  2.33M|#define pq_node(e)  ((int)((e) & ((1u << PQ_NODE_BITS) - 1)))
  |  |  ------------------
  |  |  |  |  127|  2.33M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  246|  2.33M|        m = pq_node(em);
  ------------------
  |  |  129|  2.33M|#define pq_node(e)  ((int)((e) & ((1u << PQ_NODE_BITS) - 1)))
  |  |  ------------------
  |  |  |  |  127|  2.33M|#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.33M|        const uint16_t f = (uint16_t)(pq_freq(en) + pq_freq(em));
  ------------------
  |  |  130|  2.33M|#define pq_freq(e)  ((e) >> PQ_NODE_BITS)
  |  |  ------------------
  |  |  |  |  127|  2.33M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
                      const uint16_t f = (uint16_t)(pq_freq(en) + pq_freq(em));
  ------------------
  |  |  130|  2.33M|#define pq_freq(e)  ((e) >> PQ_NODE_BITS)
  |  |  ------------------
  |  |  |  |  127|  2.33M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  251|  2.33M|        tree[node].Freq = f;
  ------------------
  |  |  127|  2.33M|#define Freq fc.freq
  ------------------
  252|  2.33M|        tree[n].Dad = tree[m].Dad = (uint16_t)node;
  ------------------
  |  |  129|  2.33M|#define Dad  dl.dad
  ------------------
                      tree[n].Dad = tree[m].Dad = (uint16_t)node;
  ------------------
  |  |  129|  2.33M|#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.33M|        internals[itail++] = pq_pack(f, node);
  ------------------
  |  |  128|  2.33M|#define pq_pack(freq, node) (((uint32_t)(freq) << PQ_NODE_BITS) | (unsigned)(node))
  |  |  ------------------
  |  |  |  |  127|  2.33M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  261|  2.33M|        node++;
  262|  2.33M|    }
  263|       |
  264|       |    /* At this point, the fields freq and dad are set. We can now
  265|       |     * generate the bit lengths.
  266|       |     */
  267|  35.2k|    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.2k|    gen_codes((ct_data *)tree, max_code, s->bl_count);
  271|  35.2k|}
trees.c:pq_radix_pass:
  137|  33.9k|static void pq_radix_pass(const uint32_t *src, uint32_t *dst, int n, int shift, uint16_t *count) {
  138|  33.9k|    int i;
  139|       |
  140|  8.72M|    for (i = 1; i <= 256; i++)
  ------------------
  |  Branch (140:17): [True: 8.68M, False: 33.9k]
  ------------------
  141|  8.68M|        count[i] = (uint16_t)(count[i] + count[i-1]);
  142|  3.17M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (142:17): [True: 3.14M, False: 33.9k]
  ------------------
  143|  3.14M|        dst[count[(src[i] >> shift) & 0xFF]++] = src[i];
  144|  33.9k|}
trees.c:pq_take:
  151|  4.67M|                               const uint32_t *internals, int *ihead, int itail) {
  152|  4.67M|    if (*li < nleaves && (*ihead == itail || leaves[*li] < internals[*ihead]))
  ------------------
  |  Branch (152:9): [True: 3.60M, False: 1.06M]
  |  Branch (152:27): [True: 85.3k, False: 3.52M]
  |  Branch (152:46): [True: 2.28M, False: 1.23M]
  ------------------
  153|  2.37M|        return leaves[(*li)++];
  154|  2.30M|    return internals[(*ihead)++];
  155|  4.67M|}
trees.c:gen_bitlen:
  283|  35.2k|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.2k|    ct_data *tree           = desc->dyn_tree;
  286|  35.2k|    int elems               = desc->stat_desc->elems;
  287|  35.2k|    const ct_data *stree    = desc->stat_desc->static_tree;
  288|  35.2k|    const int *extra        = desc->stat_desc->extra_bits;
  289|  35.2k|    int base                = desc->stat_desc->extra_base;
  290|  35.2k|    unsigned int max_length = desc->stat_desc->max_length;
  291|  35.2k|    int i;              /* index into sorted */
  292|  35.2k|    int n, m;           /* iterate over the tree elements */
  293|  35.2k|    unsigned int bits;  /* bit length */
  294|  35.2k|    int xbits;          /* extra bits */
  295|  35.2k|    uint16_t f;         /* frequency */
  296|  35.2k|    int overflow = 0;   /* number of elements with bit length too large */
  297|       |
  298|   598k|    for (bits = 0; bits <= MAX_BITS; bits++)
  ------------------
  |  |   41|   598k|#define MAX_BITS 15
  ------------------
  |  Branch (298:20): [True: 563k, False: 35.2k]
  ------------------
  299|   563k|        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.2k|    tree[root].Len = 0; /* root of the tree */
  ------------------
  |  |  130|  35.2k|#define Len  dl.len
  ------------------
  305|       |
  306|       |    /* Dads are created after their sons, so a descending walk visits each dad first */
  307|  2.33M|    for (n = root - 1; n >= elems; n--) {
  ------------------
  |  Branch (307:24): [True: 2.30M, False: 35.2k]
  ------------------
  308|  2.30M|        bits = tree[tree[n].Dad].Len + 1u;
  ------------------
  |  |  129|  2.30M|#define Dad  dl.dad
  ------------------
                      bits = tree[tree[n].Dad].Len + 1u;
  ------------------
  |  |  130|  2.30M|#define Len  dl.len
  ------------------
  309|  2.30M|        if (bits > max_length){
  ------------------
  |  Branch (309:13): [True: 196, False: 2.30M]
  ------------------
  310|    196|            bits = max_length;
  311|    196|            overflow++;
  312|    196|        }
  313|  2.30M|        tree[n].Len = (uint16_t)bits;
  ------------------
  |  |  130|  2.30M|#define Len  dl.len
  ------------------
  314|       |        /* We overwrite tree[n].Dad which is no longer needed */
  315|  2.30M|    }
  316|       |
  317|  2.40M|    for (i = 0; i < nleaves; i++) {
  ------------------
  |  Branch (317:17): [True: 2.37M, False: 35.2k]
  ------------------
  318|  2.37M|        n = pq_node(sorted[i]);
  ------------------
  |  |  129|  2.37M|#define pq_node(e)  ((int)((e) & ((1u << PQ_NODE_BITS) - 1)))
  |  |  ------------------
  |  |  |  |  127|  2.37M|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  319|  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
  ------------------
  320|  2.37M|        if (bits > max_length){
  ------------------
  |  Branch (320:13): [True: 5.55k, False: 2.36M]
  ------------------
  321|  5.55k|            bits = max_length;
  322|  5.55k|            overflow++;
  323|  5.55k|        }
  324|  2.37M|        tree[n].Len = (uint16_t)bits;
  ------------------
  |  |  130|  2.37M|#define Len  dl.len
  ------------------
  325|       |
  326|  2.37M|        s->bl_count[bits]++;
  327|  2.37M|        xbits = 0;
  328|  2.37M|        if (n >= base)
  ------------------
  |  Branch (328:13): [True: 278k, False: 2.09M]
  ------------------
  329|   278k|            xbits = extra[n-base];
  330|  2.37M|        f = tree[n].Freq;
  ------------------
  |  |  127|  2.37M|#define Freq fc.freq
  ------------------
  331|  2.37M|        s->opt_len += (unsigned int)f * (unsigned int)(bits + xbits);
  332|  2.37M|        if (stree)
  ------------------
  |  Branch (332:13): [True: 2.25M, False: 118k]
  ------------------
  333|  2.25M|            s->static_len += (unsigned int)f * (unsigned int)(stree[n].Len + xbits);
  ------------------
  |  |  130|  2.25M|#define Len  dl.len
  ------------------
  334|  2.37M|    }
  335|  35.2k|    if (overflow == 0)
  ------------------
  |  Branch (335:9): [True: 33.6k, False: 1.55k]
  ------------------
  336|  33.6k|        return;
  337|       |
  338|  1.55k|    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.87k|    do {
  343|  2.87k|        bits = max_length - 1;
  344|  4.16k|        while (s->bl_count[bits] == 0)
  ------------------
  |  Branch (344:16): [True: 1.29k, False: 2.87k]
  ------------------
  345|  1.29k|            bits--;
  346|  2.87k|        s->bl_count[bits]--;       /* move one leaf down the tree */
  347|  2.87k|        s->bl_count[bits+1] += 2u; /* move one overflow item as its brother */
  348|  2.87k|        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.87k|        overflow -= 2;
  353|  2.87k|    } while (overflow > 0);
  ------------------
  |  Branch (353:14): [True: 1.31k, False: 1.55k]
  ------------------
  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.55k|    i = 0;
  360|  12.6k|    for (bits = max_length; bits != 0; bits--) {
  ------------------
  |  Branch (360:29): [True: 11.0k, False: 1.55k]
  ------------------
  361|  11.0k|        n = s->bl_count[bits];
  362|  36.1k|        while (n != 0) {
  ------------------
  |  Branch (362:16): [True: 25.1k, False: 11.0k]
  ------------------
  363|  25.1k|            m = pq_node(sorted[i++]);
  ------------------
  |  |  129|  25.1k|#define pq_node(e)  ((int)((e) & ((1u << PQ_NODE_BITS) - 1)))
  |  |  ------------------
  |  |  |  |  127|  25.1k|#define PQ_NODE_BITS 10
  |  |  ------------------
  ------------------
  364|  25.1k|            if (tree[m].Len != bits) {
  ------------------
  |  |  130|  25.1k|#define Len  dl.len
  ------------------
  |  Branch (364:17): [True: 2.41k, False: 22.7k]
  ------------------
  365|  2.41k|                Tracev((stderr, "code %d bits %d->%u\n", m, tree[m].Len, bits));
  366|  2.41k|                s->opt_len += (unsigned int)(bits * tree[m].Freq);
  ------------------
  |  |  127|  2.41k|#define Freq fc.freq
  ------------------
  367|  2.41k|                s->opt_len -= (unsigned int)(tree[m].Len * tree[m].Freq);
  ------------------
  |  |  130|  2.41k|#define Len  dl.len
  ------------------
                              s->opt_len -= (unsigned int)(tree[m].Len * tree[m].Freq);
  ------------------
  |  |  127|  2.41k|#define Freq fc.freq
  ------------------
  368|  2.41k|                tree[m].Len = (uint16_t)bits;
  ------------------
  |  |  130|  2.41k|#define Len  dl.len
  ------------------
  369|  2.41k|            }
  370|  25.1k|            n--;
  371|  25.1k|        }
  372|  11.0k|    }
  373|  1.55k|}
trees.c:build_bl_tree:
  535|  11.7k|static int build_bl_tree(deflate_state *s) {
  536|  11.7k|    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.7k|    scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
  540|  11.7k|    scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
  541|       |
  542|       |    /* Build the bit length tree: */
  543|  11.7k|    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|  30.8k|    for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
  ------------------
  |  |   46|  11.7k|#define BL_CODES  19
  ------------------
  |  Branch (552:36): [True: 30.8k, False: 0]
  ------------------
  553|  30.8k|        if (s->bl_tree[bl_order[max_blindex]].Len != 0)
  ------------------
  |  |  130|  30.8k|#define Len  dl.len
  ------------------
  |  Branch (553:13): [True: 11.7k, False: 19.1k]
  ------------------
  554|  11.7k|            break;
  555|  30.8k|    }
  556|       |    /* Update opt_len to include the bit length tree and counts */
  557|  11.7k|    s->opt_len += 3*((unsigned int)max_blindex+1) + 5+5+4;
  558|  11.7k|    Tracev((stderr, "\ndyn trees: dyn %u, stat %u", s->opt_len, s->static_len));
  559|       |
  560|  11.7k|    return max_blindex;
  561|  11.7k|}
trees.c:scan_tree:
  421|  23.4k|static void scan_tree(deflate_state *s, ct_data *tree, int max_code) {
  422|       |    /* tree: the tree to be scanned */
  423|       |    /* max_code: and its largest code of non zero frequency */
  424|  23.4k|    int n;                     /* iterates over all tree elements */
  425|  23.4k|    int prevlen = -1;          /* last emitted length */
  426|  23.4k|    int curlen;                /* length of current code */
  427|  23.4k|    int nextlen = tree[0].Len; /* length of next code */
  ------------------
  |  |  130|  23.4k|#define Len  dl.len
  ------------------
  428|  23.4k|    uint16_t count = 0;        /* repeat count of the current code */
  429|  23.4k|    uint16_t max_count = 7;    /* max repeat count */
  430|  23.4k|    uint16_t min_count = 4;    /* min repeat count */
  431|       |
  432|  23.4k|    if (nextlen == 0)
  ------------------
  |  Branch (432:9): [True: 3.64k, False: 19.8k]
  ------------------
  433|  3.64k|        max_count = 138, min_count = 3;
  434|       |
  435|  23.4k|    tree[max_code+1].Len = (uint16_t)0xffff; /* guard */
  ------------------
  |  |  130|  23.4k|#define Len  dl.len
  ------------------
  436|       |
  437|  3.38M|    for (n = 0; n <= max_code; n++) {
  ------------------
  |  Branch (437:17): [True: 3.36M, False: 23.4k]
  ------------------
  438|  3.36M|        curlen = nextlen;
  439|  3.36M|        nextlen = tree[n+1].Len;
  ------------------
  |  |  130|  3.36M|#define Len  dl.len
  ------------------
  440|  3.36M|        if (++count < max_count && curlen == nextlen) {
  ------------------
  |  Branch (440:13): [True: 3.18M, False: 171k]
  |  Branch (440:36): [True: 2.35M, False: 839k]
  ------------------
  441|  2.35M|            continue;
  442|  2.35M|        } else if (count < min_count) {
  ------------------
  |  Branch (442:20): [True: 713k, False: 296k]
  ------------------
  443|   713k|            s->bl_tree[curlen].Freq += count;
  ------------------
  |  |  127|   713k|#define Freq fc.freq
  ------------------
  444|   713k|        } else if (curlen != 0) {
  ------------------
  |  Branch (444:20): [True: 238k, False: 58.7k]
  ------------------
  445|   238k|            if (curlen != prevlen)
  ------------------
  |  Branch (445:17): [True: 97.4k, False: 140k]
  ------------------
  446|  97.4k|                s->bl_tree[curlen].Freq++;
  ------------------
  |  |  127|  97.4k|#define Freq fc.freq
  ------------------
  447|   238k|            s->bl_tree[REP_3_6].Freq++;
  ------------------
  |  |   12|   238k|#define REP_3_6      16
  ------------------
                          s->bl_tree[REP_3_6].Freq++;
  ------------------
  |  |  127|   238k|#define Freq fc.freq
  ------------------
  448|   238k|        } else if (count <= 10) {
  ------------------
  |  Branch (448:20): [True: 36.6k, False: 22.0k]
  ------------------
  449|  36.6k|            s->bl_tree[REPZ_3_10].Freq++;
  ------------------
  |  |   15|  36.6k|#define REPZ_3_10    17
  ------------------
                          s->bl_tree[REPZ_3_10].Freq++;
  ------------------
  |  |  127|  36.6k|#define Freq fc.freq
  ------------------
  450|  36.6k|        } else {
  451|  22.0k|            s->bl_tree[REPZ_11_138].Freq++;
  ------------------
  |  |   18|  22.0k|#define REPZ_11_138  18
  ------------------
                          s->bl_tree[REPZ_11_138].Freq++;
  ------------------
  |  |  127|  22.0k|#define Freq fc.freq
  ------------------
  452|  22.0k|        }
  453|  1.01M|        count = 0;
  454|  1.01M|        prevlen = curlen;
  455|  1.01M|        if (nextlen == 0) {
  ------------------
  |  Branch (455:13): [True: 117k, False: 892k]
  ------------------
  456|   117k|            max_count = 138, min_count = 3;
  457|   892k|        } else if (curlen == nextlen) {
  ------------------
  |  Branch (457:20): [True: 157k, False: 734k]
  ------------------
  458|   157k|            max_count = 6, min_count = 3;
  459|   734k|        } else {
  460|   734k|            max_count = 7, min_count = 4;
  461|   734k|        }
  462|  1.01M|    }
  463|  23.4k|}
trees.c:send_all_trees:
  568|  8.09k|static void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes) {
  569|  8.09k|    int rank;                    /* index in bl_order */
  570|       |
  571|  8.09k|    Assert(lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
  572|  8.09k|    Assert(lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, "too many codes");
  573|       |
  574|       |    // Temp local variables
  575|  8.09k|    uint32_t bi_valid = s->bi_valid;
  576|  8.09k|    uint64_t bi_buf = s->bi_buf;
  577|       |
  578|  8.09k|    Tracev((stderr, "\nbl counts: "));
  579|  8.09k|    send_bits(s, lcodes-257, 5, bi_buf, bi_valid); /* not +255 as stated in appnote.txt */
  ------------------
  |  |   43|  8.09k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|  8.09k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|  8.09k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|  8.09k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|  8.09k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|  8.09k|    trace_bits(s, val, len);\
  |  |   49|  8.09k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  466|  8.09k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  8.09k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|  8.09k|    \
  |  |   51|  8.09k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|  8.09k|    bi_buf |= val << bi_valid;\
  |  |   53|  8.09k|    \
  |  |   54|  8.09k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|  8.09k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 0, False: 8.09k]
  |  |  ------------------
  |  |   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.09k|    bi_valid = total_bits;\
  |  |   64|  8.09k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 8.09k]
  |  |  ------------------
  ------------------
  580|  8.09k|    send_bits(s, dcodes-1,   5, bi_buf, bi_valid);
  ------------------
  |  |   43|  8.09k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|  8.09k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|  8.09k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|  8.09k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|  8.09k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|  8.09k|    trace_bits(s, val, len);\
  |  |   49|  8.09k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  466|  8.09k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  8.09k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|  8.09k|    \
  |  |   51|  8.09k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|  8.09k|    bi_buf |= val << bi_valid;\
  |  |   53|  8.09k|    \
  |  |   54|  8.09k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|  8.09k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 0, False: 8.09k]
  |  |  ------------------
  |  |   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.09k|    bi_valid = total_bits;\
  |  |   64|  8.09k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 8.09k]
  |  |  ------------------
  ------------------
  581|  8.09k|    send_bits(s, blcodes-4,  4, bi_buf, bi_valid); /* not -3 as stated in appnote.txt */
  ------------------
  |  |   43|  8.09k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|  8.09k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|  8.09k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|  8.09k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|  8.09k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|  8.09k|    trace_bits(s, val, len);\
  |  |   49|  8.09k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  466|  8.09k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  8.09k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|  8.09k|    \
  |  |   51|  8.09k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|  8.09k|    bi_buf |= val << bi_valid;\
  |  |   53|  8.09k|    \
  |  |   54|  8.09k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|  8.09k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 0, False: 8.09k]
  |  |  ------------------
  |  |   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.09k|    bi_valid = total_bits;\
  |  |   64|  8.09k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 8.09k]
  |  |  ------------------
  ------------------
  582|   146k|    for (rank = 0; rank < blcodes; rank++) {
  ------------------
  |  Branch (582:20): [True: 138k, False: 8.09k]
  ------------------
  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);\
  |  |  ------------------
  |  |  |  |  466|   138k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   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.72k, False: 131k]
  |  |  ------------------
  |  |   56|  7.72k|        total_bits -= 64;\
  |  |   57|  7.72k|        put_uint64(s, bi_buf);\
  |  |   58|  7.72k|        \
  |  |   59|  7.72k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |   60|  7.72k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |   61|  7.72k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |   62|  7.72k|    }\
  |  |   63|   138k|    bi_valid = total_bits;\
  |  |   64|   138k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 138k]
  |  |  ------------------
  ------------------
  585|   138k|    }
  586|  8.09k|    Tracev((stderr, "\nbl tree: sent %lu", s->bits_sent));
  587|       |
  588|       |    // Store back temp variables
  589|  8.09k|    s->bi_buf = bi_buf;
  590|  8.09k|    s->bi_valid = bi_valid;
  591|       |
  592|  8.09k|    send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
  593|  8.09k|    Tracev((stderr, "\nlit tree: sent %lu", s->bits_sent));
  594|       |
  595|  8.09k|    send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
  596|  8.09k|    Tracev((stderr, "\ndist tree: sent %lu", s->bits_sent));
  597|  8.09k|}
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.68k, False: 13.5k]
  ------------------
  482|  2.68k|        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.38M, False: 16.1k]
  ------------------
  489|  2.38M|        curlen = nextlen;
  490|  2.38M|        nextlen = tree[n+1].Len;
  ------------------
  |  |  130|  2.38M|#define Len  dl.len
  ------------------
  491|  2.38M|        if (++count < max_count && curlen == nextlen) {
  ------------------
  |  Branch (491:13): [True: 2.26M, False: 111k]
  |  Branch (491:36): [True: 1.51M, False: 753k]
  ------------------
  492|  1.51M|            continue;
  493|  1.51M|        } else if (count < min_count) {
  ------------------
  |  Branch (493:20): [True: 648k, False: 216k]
  ------------------
  494|   876k|            do {
  495|   876k|                send_code(s, curlen, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   95|   876k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   43|   876k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |  |  |   44|   876k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |  |  |   45|   876k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   46|   876k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   47|   876k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   48|   876k|    trace_bits(s, val, len);\
  |  |  |  |   49|   876k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  466|   876k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|   876k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   50|   876k|    \
  |  |  |  |   51|   876k|    /* Unconditionally shift and merge values into the buffer */\
  |  |  |  |   52|   876k|    bi_buf |= val << bi_valid;\
  |  |  |  |   53|   876k|    \
  |  |  |  |   54|   876k|    /* Check if the 64-bit boundary was crossed */\
  |  |  |  |   55|   876k|    if (total_bits >= 64) {\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:9): [True: 36.3k, False: 839k]
  |  |  |  |  ------------------
  |  |  |  |   56|  36.3k|        total_bits -= 64;\
  |  |  |  |   57|  36.3k|        put_uint64(s, bi_buf);\
  |  |  |  |   58|  36.3k|        \
  |  |  |  |   59|  36.3k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |  |  |   60|  36.3k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |  |  |   61|  36.3k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |  |  |   62|  36.3k|    }\
  |  |  |  |   63|   876k|    bi_valid = total_bits;\
  |  |  |  |   64|   876k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (64:10): [Folded, False: 876k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  496|   876k|            } while (--count != 0);
  ------------------
  |  Branch (496:22): [True: 228k, False: 648k]
  ------------------
  497|       |
  498|   648k|        } else if (curlen != 0) {
  ------------------
  |  Branch (498:20): [True: 175k, False: 41.9k]
  ------------------
  499|   175k|            if (curlen != prevlen) {
  ------------------
  |  Branch (499:17): [True: 90.0k, False: 85.0k]
  ------------------
  500|  90.0k|                send_code(s, curlen, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   95|  90.0k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   43|  90.0k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |  |  |   44|  90.0k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |  |  |   45|  90.0k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   46|  90.0k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   47|  90.0k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   48|  90.0k|    trace_bits(s, val, len);\
  |  |  |  |   49|  90.0k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  466|  90.0k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  90.0k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   50|  90.0k|    \
  |  |  |  |   51|  90.0k|    /* Unconditionally shift and merge values into the buffer */\
  |  |  |  |   52|  90.0k|    bi_buf |= val << bi_valid;\
  |  |  |  |   53|  90.0k|    \
  |  |  |  |   54|  90.0k|    /* Check if the 64-bit boundary was crossed */\
  |  |  |  |   55|  90.0k|    if (total_bits >= 64) {\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:9): [True: 3.02k, False: 87.0k]
  |  |  |  |  ------------------
  |  |  |  |   56|  3.02k|        total_bits -= 64;\
  |  |  |  |   57|  3.02k|        put_uint64(s, bi_buf);\
  |  |  |  |   58|  3.02k|        \
  |  |  |  |   59|  3.02k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |  |  |   60|  3.02k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |  |  |   61|  3.02k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |  |  |   62|  3.02k|    }\
  |  |  |  |   63|  90.0k|    bi_valid = total_bits;\
  |  |  |  |   64|  90.0k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (64:10): [Folded, False: 90.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  501|  90.0k|                count--;
  502|  90.0k|            }
  503|   175k|            Assert(count >= 3 && count <= 6, " 3_6?");
  504|   175k|            send_code(s, REP_3_6, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   95|   175k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   43|   175k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |  |  |   44|   175k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |  |  |   45|   175k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   46|   175k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   47|   175k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   48|   175k|    trace_bits(s, val, len);\
  |  |  |  |   49|   175k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  466|   175k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|   175k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   50|   175k|    \
  |  |  |  |   51|   175k|    /* Unconditionally shift and merge values into the buffer */\
  |  |  |  |   52|   175k|    bi_buf |= val << bi_valid;\
  |  |  |  |   53|   175k|    \
  |  |  |  |   54|   175k|    /* Check if the 64-bit boundary was crossed */\
  |  |  |  |   55|   175k|    if (total_bits >= 64) {\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:9): [True: 5.73k, False: 169k]
  |  |  |  |  ------------------
  |  |  |  |   56|  5.73k|        total_bits -= 64;\
  |  |  |  |   57|  5.73k|        put_uint64(s, bi_buf);\
  |  |  |  |   58|  5.73k|        \
  |  |  |  |   59|  5.73k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |  |  |   60|  5.73k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |  |  |   61|  5.73k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |  |  |   62|  5.73k|    }\
  |  |  |  |   63|   175k|    bi_valid = total_bits;\
  |  |  |  |   64|   175k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (64:10): [Folded, False: 175k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  505|   175k|            send_bits(s, count-3, 2, bi_buf, bi_valid);
  ------------------
  |  |   43|   175k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|   175k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|   175k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|   175k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|   175k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|   175k|    trace_bits(s, val, len);\
  |  |   49|   175k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  466|   175k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   175k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|   175k|    \
  |  |   51|   175k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|   175k|    bi_buf |= val << bi_valid;\
  |  |   53|   175k|    \
  |  |   54|   175k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|   175k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 5.17k, False: 169k]
  |  |  ------------------
  |  |   56|  5.17k|        total_bits -= 64;\
  |  |   57|  5.17k|        put_uint64(s, bi_buf);\
  |  |   58|  5.17k|        \
  |  |   59|  5.17k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |   60|  5.17k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |   61|  5.17k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |   62|  5.17k|    }\
  |  |   63|   175k|    bi_valid = total_bits;\
  |  |   64|   175k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 175k]
  |  |  ------------------
  ------------------
  506|       |
  507|   175k|        } else if (count <= 10) {
  ------------------
  |  Branch (507:20): [True: 28.9k, False: 12.9k]
  ------------------
  508|  28.9k|            send_code(s, REPZ_3_10, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   95|  28.9k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   43|  28.9k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |  |  |   44|  28.9k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |  |  |   45|  28.9k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   46|  28.9k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   47|  28.9k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   48|  28.9k|    trace_bits(s, val, len);\
  |  |  |  |   49|  28.9k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  466|  28.9k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  28.9k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   50|  28.9k|    \
  |  |  |  |   51|  28.9k|    /* Unconditionally shift and merge values into the buffer */\
  |  |  |  |   52|  28.9k|    bi_buf |= val << bi_valid;\
  |  |  |  |   53|  28.9k|    \
  |  |  |  |   54|  28.9k|    /* Check if the 64-bit boundary was crossed */\
  |  |  |  |   55|  28.9k|    if (total_bits >= 64) {\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:9): [True: 1.90k, False: 27.0k]
  |  |  |  |  ------------------
  |  |  |  |   56|  1.90k|        total_bits -= 64;\
  |  |  |  |   57|  1.90k|        put_uint64(s, bi_buf);\
  |  |  |  |   58|  1.90k|        \
  |  |  |  |   59|  1.90k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |  |  |   60|  1.90k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |  |  |   61|  1.90k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |  |  |   62|  1.90k|    }\
  |  |  |  |   63|  28.9k|    bi_valid = total_bits;\
  |  |  |  |   64|  28.9k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (64:10): [Folded, False: 28.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  509|  28.9k|            send_bits(s, count-3, 3, bi_buf, bi_valid);
  ------------------
  |  |   43|  28.9k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|  28.9k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|  28.9k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|  28.9k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|  28.9k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|  28.9k|    trace_bits(s, val, len);\
  |  |   49|  28.9k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  466|  28.9k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  28.9k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|  28.9k|    \
  |  |   51|  28.9k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|  28.9k|    bi_buf |= val << bi_valid;\
  |  |   53|  28.9k|    \
  |  |   54|  28.9k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|  28.9k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 1.37k, False: 27.5k]
  |  |  ------------------
  |  |   56|  1.37k|        total_bits -= 64;\
  |  |   57|  1.37k|        put_uint64(s, bi_buf);\
  |  |   58|  1.37k|        \
  |  |   59|  1.37k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |   60|  1.37k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |   61|  1.37k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |   62|  1.37k|    }\
  |  |   63|  28.9k|    bi_valid = total_bits;\
  |  |   64|  28.9k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 28.9k]
  |  |  ------------------
  ------------------
  510|       |
  511|  28.9k|        } else {
  512|  12.9k|            send_code(s, REPZ_11_138, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   95|  12.9k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   43|  12.9k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |  |  |   44|  12.9k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |  |  |   45|  12.9k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   46|  12.9k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   47|  12.9k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   48|  12.9k|    trace_bits(s, val, len);\
  |  |  |  |   49|  12.9k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  466|  12.9k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  12.9k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   50|  12.9k|    \
  |  |  |  |   51|  12.9k|    /* Unconditionally shift and merge values into the buffer */\
  |  |  |  |   52|  12.9k|    bi_buf |= val << bi_valid;\
  |  |  |  |   53|  12.9k|    \
  |  |  |  |   54|  12.9k|    /* Check if the 64-bit boundary was crossed */\
  |  |  |  |   55|  12.9k|    if (total_bits >= 64) {\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:9): [True: 1.01k, False: 11.9k]
  |  |  |  |  ------------------
  |  |  |  |   56|  1.01k|        total_bits -= 64;\
  |  |  |  |   57|  1.01k|        put_uint64(s, bi_buf);\
  |  |  |  |   58|  1.01k|        \
  |  |  |  |   59|  1.01k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |  |  |   60|  1.01k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |  |  |   61|  1.01k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |  |  |   62|  1.01k|    }\
  |  |  |  |   63|  12.9k|    bi_valid = total_bits;\
  |  |  |  |   64|  12.9k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (64:10): [Folded, False: 12.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  513|  12.9k|            send_bits(s, count-11, 7, bi_buf, bi_valid);
  ------------------
  |  |   43|  12.9k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
  |  |   44|  12.9k|    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
  |  |   45|  12.9k|    uint64_t val = (uint64_t)t_val;\
  |  |   46|  12.9k|    uint32_t len = (uint32_t)t_len;\
  |  |   47|  12.9k|    uint32_t total_bits = bi_valid + len;\
  |  |   48|  12.9k|    trace_bits(s, val, len);\
  |  |   49|  12.9k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  466|  12.9k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  12.9k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   50|  12.9k|    \
  |  |   51|  12.9k|    /* Unconditionally shift and merge values into the buffer */\
  |  |   52|  12.9k|    bi_buf |= val << bi_valid;\
  |  |   53|  12.9k|    \
  |  |   54|  12.9k|    /* Check if the 64-bit boundary was crossed */\
  |  |   55|  12.9k|    if (total_bits >= 64) {\
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 1.44k, False: 11.5k]
  |  |  ------------------
  |  |   56|  1.44k|        total_bits -= 64;\
  |  |   57|  1.44k|        put_uint64(s, bi_buf);\
  |  |   58|  1.44k|        \
  |  |   59|  1.44k|        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
  |  |   60|  1.44k|        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
  |  |   61|  1.44k|        bi_buf = (val >> 1) >> (~bi_valid & 63);\
  |  |   62|  1.44k|    }\
  |  |   63|  12.9k|    bi_valid = total_bits;\
  |  |   64|  12.9k|} while (0)
  |  |  ------------------
  |  |  |  Branch (64:10): [Folded, False: 12.9k]
  |  |  ------------------
  ------------------
  514|  12.9k|        }
  515|   865k|        count = 0;
  516|   865k|        prevlen = curlen;
  517|   865k|        if (nextlen == 0) {
  ------------------
  |  Branch (517:13): [True: 90.3k, False: 774k]
  ------------------
  518|  90.3k|            max_count = 138, min_count = 3;
  519|   774k|        } else if (curlen == nextlen) {
  ------------------
  |  Branch (519:20): [True: 100k, False: 674k]
  ------------------
  520|   100k|            max_count = 6, min_count = 3;
  521|   674k|        } else {
  522|   674k|            max_count = 7, min_count = 4;
  523|   674k|        }
  524|   865k|    }
  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.1k|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.1k|    unsigned dist;      /* distance of matched string */
  727|  10.1k|    int lc;             /* match length or unmatched char (if dist == 0) */
  728|  10.1k|    unsigned sx = 0;    /* running index in symbol buffers */
  729|       |
  730|       |    /* Local pointers to avoid indirection */
  731|  10.1k|    const unsigned int sym_next = s->sym_next;
  732|  10.1k|    unsigned char *sym_buf = s->sym_buf;
  733|       |
  734|       |    /* Keep the bit writer state in registers across the entire loop */
  735|  10.1k|    uint64_t bi_buf = s->bi_buf;
  736|  10.1k|    uint32_t bi_valid = s->bi_valid;
  737|  10.1k|    uint32_t pending = s->pending;
  738|       |
  739|  10.1k|    if (sym_next != 0) {
  ------------------
  |  Branch (739:9): [True: 10.0k, False: 42]
  ------------------
  740|  39.9M|        do {
  741|  39.9M|            send_bits_flush(s, bi_buf, bi_valid, pending);
  ------------------
  |  |   80|  39.9M|#define send_bits_flush(s, bi_buf, bi_valid, pending) do { \
  |  |   81|  39.9M|    zng_memwrite_8((s)->pending_buf + (pending), Z_U64_TO_LE(bi_buf)); \
  |  |  ------------------
  |  |  |  |   85|  39.9M|#  define Z_U64_TO_LE(x)    (x)
  |  |  ------------------
  |  |   82|  39.9M|    pending += (bi_valid) >> 3; \
  |  |   83|  39.9M|    bi_buf >>= ((bi_valid) & ~7U); \
  |  |   84|  39.9M|    bi_valid &= 7; \
  |  |   85|  39.9M|} while (0)
  |  |  ------------------
  |  |  |  Branch (85:10): [Folded, False: 39.9M]
  |  |  ------------------
  ------------------
  742|  39.9M|#if OPTIMAL_CMP >= 32
  743|  39.9M|            uint32_t dist_lc = Z_U32_FROM_LE(zng_memread_4(&sym_buf[sx]));
  ------------------
  |  |   87|  39.9M|#  define Z_U32_FROM_LE(x)  (x)
  ------------------
  744|  39.9M|            dist = dist_lc & 0xffff;
  745|  39.9M|            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.9M|            sx += 3;
  751|  39.9M|            if (dist == 0) {
  ------------------
  |  Branch (751:17): [True: 37.5M, False: 2.44M]
  ------------------
  752|  37.5M|                uint64_t bits = 0;
  753|  37.5M|                uint32_t nbits = 0;
  754|       |
  755|  37.5M|                send_code_merge(s, lc, ltree, bits, nbits);
  ------------------
  |  |  106|  37.5M|    send_bits_merge(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   68|  37.5M|#define send_bits_merge(s, t_val, t_len, bi_buf, bi_valid) do { \
  |  |  |  |   69|  37.5M|    Assert((bi_valid) + (uint32_t)(t_len) <= 64, "bit buffer overflow"); \
  |  |  |  |   70|  37.5M|    trace_bits(s, (uint64_t)(t_val), (uint32_t)(t_len)); \
  |  |  |  |   71|  37.5M|    sent_bits_add(s, t_len); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  466|  37.5M|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  37.5M|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   72|  37.5M|    bi_buf |= (uint64_t)(t_val) << (bi_valid); \
  |  |  |  |   73|  37.5M|    bi_valid += (uint32_t)(t_len); \
  |  |  |  |   74|  37.5M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (74:10): [Folded, False: 37.5M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  756|  37.5M|#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.5M|                if (sx + 8 <= sym_next) {
  ------------------
  |  Branch (760:21): [True: 37.5M, False: 19.2k]
  ------------------
  761|  37.5M|                    uint64_t next_syms = Z_U64_FROM_LE(zng_memread_8(&sym_buf[sx]));
  ------------------
  |  |   88|  37.5M|#  define Z_U64_FROM_LE(x)  (x)
  ------------------
  762|       |
  763|       |                    /* A dist field is zero exactly when that symbol is a literal */
  764|  37.5M|                    if ((uint16_t)next_syms == 0) {
  ------------------
  |  Branch (764:25): [True: 36.8M, False: 665k]
  ------------------
  765|  36.8M|                        send_code_merge(s, (unsigned)((next_syms >> 16) & 0xff), ltree, bits, nbits);
  ------------------
  |  |  106|  36.8M|    send_bits_merge(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   68|  36.8M|#define send_bits_merge(s, t_val, t_len, bi_buf, bi_valid) do { \
  |  |  |  |   69|  36.8M|    Assert((bi_valid) + (uint32_t)(t_len) <= 64, "bit buffer overflow"); \
  |  |  |  |   70|  36.8M|    trace_bits(s, (uint64_t)(t_val), (uint32_t)(t_len)); \
  |  |  |  |   71|  36.8M|    sent_bits_add(s, t_len); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  466|  36.8M|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  36.8M|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   72|  36.8M|    bi_buf |= (uint64_t)(t_val) << (bi_valid); \
  |  |  |  |   73|  36.8M|    bi_valid += (uint32_t)(t_len); \
  |  |  |  |   74|  36.8M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (74:10): [Folded, False: 36.8M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  766|  36.8M|                        sx += 3;
  767|       |
  768|  36.8M|                        if ((next_syms & LIT3_DIST1_MASK) == 0) {
  ------------------
  |  |  718|  36.8M|#define LIT3_DIST1_MASK 0x000000FFFF000000ULL
  ------------------
  |  Branch (768:29): [True: 36.4M, False: 411k]
  ------------------
  769|  36.4M|                            send_code_merge(s, (unsigned)((next_syms >> 40) & 0xff), ltree, bits, nbits);
  ------------------
  |  |  106|  36.4M|    send_bits_merge(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   68|  36.4M|#define send_bits_merge(s, t_val, t_len, bi_buf, bi_valid) do { \
  |  |  |  |   69|  36.4M|    Assert((bi_valid) + (uint32_t)(t_len) <= 64, "bit buffer overflow"); \
  |  |  |  |   70|  36.4M|    trace_bits(s, (uint64_t)(t_val), (uint32_t)(t_len)); \
  |  |  |  |   71|  36.4M|    sent_bits_add(s, t_len); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  466|  36.4M|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|  36.4M|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   72|  36.4M|    bi_buf |= (uint64_t)(t_val) << (bi_valid); \
  |  |  |  |   73|  36.4M|    bi_valid += (uint32_t)(t_len); \
  |  |  |  |   74|  36.4M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (74:10): [Folded, False: 36.4M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  770|  36.4M|                            sx += 3;
  771|  36.4M|                        }
  772|  36.8M|                    }
  773|  37.5M|                }
  774|  37.5M|#endif
  775|       |                /* The codes were traced and counted as they accumulated */
  776|  37.5M|                Assert(bi_valid + nbits <= 64, "bit buffer overflow");
  777|  37.5M|                bi_buf |= bits << bi_valid;
  778|  37.5M|                bi_valid += nbits;
  779|  37.5M|            } else {
  780|  2.44M|                uint32_t match_bits_len;
  781|  2.44M|                uint64_t match_bits = zng_assemble_dist(ltree, dtree, lc, dist, &match_bits_len);
  782|       |
  783|  2.44M|                send_bits_merge(s, match_bits, match_bits_len, bi_buf, bi_valid);
  ------------------
  |  |   68|  2.44M|#define send_bits_merge(s, t_val, t_len, bi_buf, bi_valid) do { \
  |  |   69|  2.44M|    Assert((bi_valid) + (uint32_t)(t_len) <= 64, "bit buffer overflow"); \
  |  |   70|  2.44M|    trace_bits(s, (uint64_t)(t_val), (uint32_t)(t_len)); \
  |  |   71|  2.44M|    sent_bits_add(s, t_len); \
  |  |  ------------------
  |  |  |  |  466|  2.44M|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  2.44M|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   72|  2.44M|    bi_buf |= (uint64_t)(t_val) << (bi_valid); \
  |  |   73|  2.44M|    bi_valid += (uint32_t)(t_len); \
  |  |   74|  2.44M|} while (0)
  |  |  ------------------
  |  |  |  Branch (74:10): [Folded, False: 2.44M]
  |  |  ------------------
  ------------------
  784|  2.44M|            } /* literal or match pair ? */
  785|       |
  786|       |            /* Check for no overlay of pending_buf on needed symbols */
  787|  39.9M|            Assert(pending < s->lit_bufsize + sx, "pending_buf overflow");
  788|  39.9M|        } while (sx < sym_next);
  ------------------
  |  Branch (788:18): [True: 39.9M, False: 10.0k]
  ------------------
  789|  10.0k|    }
  790|       |
  791|  10.1k|    s->pending = pending;
  792|  10.1k|    zng_emit_end_block(s, ltree, 0, &bi_buf, &bi_valid);
  793|       |
  794|       |    /* Write back to state */
  795|  10.1k|    s->bi_buf = bi_buf;
  796|  10.1k|    s->bi_valid = bi_valid;
  797|  10.1k|}
trees.c:detect_data_type:
  812|  3.71k|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.71k|    unsigned long block_mask = 0xf3ffc07fUL;
  818|  3.71k|    int n;
  819|       |
  820|       |    /* Check for non-textual ("block-listed") bytes. */
  821|  25.3k|    for (n = 0; n <= 31; n++, block_mask >>= 1)
  ------------------
  |  Branch (821:17): [True: 24.7k, False: 592]
  ------------------
  822|  24.7k|        if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
  ------------------
  |  |  127|  18.6k|#define Freq fc.freq
  ------------------
  |  Branch (822:13): [True: 18.6k, False: 6.08k]
  |  Branch (822:33): [True: 3.12k, False: 15.5k]
  ------------------
  823|  3.12k|            return Z_BINARY;
  ------------------
  |  |  206|  3.12k|#define Z_BINARY   0
  ------------------
  824|       |
  825|       |    /* Check for textual ("allow-listed") bytes. */
  826|    592|    if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |  127|    592|#define Freq fc.freq
  ------------------
                  if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |  127|    571|#define Freq fc.freq
  ------------------
                  if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |  127|    558|#define Freq fc.freq
  ------------------
  |  Branch (826:9): [True: 21, False: 571]
  |  Branch (826:38): [True: 13, False: 558]
  |  Branch (826:68): [True: 16, False: 542]
  ------------------
  827|     50|        return Z_TEXT;
  ------------------
  |  |  207|     50|#define Z_TEXT     1
  ------------------
  828|  50.3k|    for (n = 32; n < LITERALS; n++)
  ------------------
  |  |   37|  50.3k|#define LITERALS  256
  ------------------
  |  Branch (828:18): [True: 50.3k, False: 18]
  ------------------
  829|  50.3k|        if (s->dyn_ltree[n].Freq != 0)
  ------------------
  |  |  127|  50.3k|#define Freq fc.freq
  ------------------
  |  Branch (829:13): [True: 524, False: 49.7k]
  ------------------
  830|    524|            return Z_TEXT;
  ------------------
  |  |  207|  1.06k|#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|     18|    return Z_BINARY;
  ------------------
  |  |  206|     18|#define Z_BINARY   0
  ------------------
  836|    542|}

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

deflate.c:zng_memwrite_2:
   45|  3.71k|Z_FORCEINLINE static void zng_memwrite_2(void *ptr, uint16_t val) {
   46|  3.71k|#if defined(HAVE_MAY_ALIAS)
   47|  3.71k|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   48|  3.71k|    ((unaligned_uint16_t *)ptr)->val = val;
   49|       |#else
   50|       |    memcpy(ptr, &val, sizeof(val));
   51|       |#endif
   52|  3.71k|}
deflate.c:zng_memwrite_4:
   54|  3.71k|Z_FORCEINLINE static void zng_memwrite_4(void *ptr, uint32_t val) {
   55|  3.71k|#if defined(HAVE_MAY_ALIAS)
   56|  3.71k|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|  3.71k|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|  3.71k|}
deflate.c:zng_memread_4:
   23|   172M|Z_FORCEINLINE static uint32_t zng_memread_4(const void *ptr) {
   24|   172M|#if defined(HAVE_MAY_ALIAS)
   25|   172M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|   172M|    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|   172M|}
deflate_medium.c:zng_memread_4:
   23|   136M|Z_FORCEINLINE static uint32_t zng_memread_4(const void *ptr) {
   24|   136M|#if defined(HAVE_MAY_ALIAS)
   25|   136M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|   136M|    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|   136M|}
deflate_medium.c:zng_memwrite_4:
   54|   136M|Z_FORCEINLINE static void zng_memwrite_4(void *ptr, uint32_t val) {
   55|   136M|#if defined(HAVE_MAY_ALIAS)
   56|   136M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|   136M|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|   136M|}
inftrees.c:zng_memread_4:
   23|  1.90M|Z_FORCEINLINE static uint32_t zng_memread_4(const void *ptr) {
   24|  1.90M|#if defined(HAVE_MAY_ALIAS)
   25|  1.90M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  1.90M|    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.90M|}
inftrees.c:zng_memwrite_4:
   54|  11.5M|Z_FORCEINLINE static void zng_memwrite_4(void *ptr, uint32_t val) {
   55|  11.5M|#if defined(HAVE_MAY_ALIAS)
   56|  11.5M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|  11.5M|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|  11.5M|}
insert_string.c:zng_memread_4:
   23|  14.9M|Z_FORCEINLINE static uint32_t zng_memread_4(const void *ptr) {
   24|  14.9M|#if defined(HAVE_MAY_ALIAS)
   25|  14.9M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  14.9M|    return ((const unaligned_uint32_t *)ptr)->val;
   27|       |#else
   28|       |    uint32_t val;
   29|       |    memcpy(&val, ptr, sizeof(val));
   30|       |    return val;
   31|       |#endif
   32|  14.9M|}
trees.c:zng_memwrite_8:
   63|  40.0M|Z_FORCEINLINE static void zng_memwrite_8(void *ptr, uint64_t val) {
   64|  40.0M|#if defined(HAVE_MAY_ALIAS)
   65|  40.0M|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   66|  40.0M|    ((unaligned_uint64_t *)ptr)->val = val;
   67|       |#else
   68|       |    memcpy(ptr, &val, sizeof(val));
   69|       |#endif
   70|  40.0M|}
trees.c:zng_memwrite_2:
   45|  12.3k|Z_FORCEINLINE static void zng_memwrite_2(void *ptr, uint16_t val) {
   46|  12.3k|#if defined(HAVE_MAY_ALIAS)
   47|  12.3k|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   48|  12.3k|    ((unaligned_uint16_t *)ptr)->val = val;
   49|       |#else
   50|       |    memcpy(ptr, &val, sizeof(val));
   51|       |#endif
   52|  12.3k|}
trees.c:zng_memread_4:
   23|  39.9M|Z_FORCEINLINE static uint32_t zng_memread_4(const void *ptr) {
   24|  39.9M|#if defined(HAVE_MAY_ALIAS)
   25|  39.9M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  39.9M|    return ((const unaligned_uint32_t *)ptr)->val;
   27|       |#else
   28|       |    uint32_t val;
   29|       |    memcpy(&val, ptr, sizeof(val));
   30|       |    return val;
   31|       |#endif
   32|  39.9M|}
trees.c:zng_memread_8:
   34|  37.5M|Z_FORCEINLINE static uint64_t zng_memread_8(const void *ptr) {
   35|  37.5M|#if defined(HAVE_MAY_ALIAS)
   36|  37.5M|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   37|  37.5M|    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.5M|}
trees.c:zng_memwrite_4:
   54|  1.01k|Z_FORCEINLINE static void zng_memwrite_4(void *ptr, uint32_t val) {
   55|  1.01k|#if defined(HAVE_MAY_ALIAS)
   56|  1.01k|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|  1.01k|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|  1.01k|}
compare256_avx2.c:zng_memread_8:
   34|   190M|Z_FORCEINLINE static uint64_t zng_memread_8(const void *ptr) {
   35|   190M|#if defined(HAVE_MAY_ALIAS)
   36|   190M|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   37|   190M|    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|   190M|}
compare256_avx2.c:zng_memcmp_8:
   91|  8.95M|Z_FORCEINLINE static int32_t zng_memcmp_8(const void * Z_RESTRICT src0, const void * Z_RESTRICT src1) {
   92|  8.95M|#if defined(HAVE_MAY_ALIAS) || defined(_MSC_VER)
   93|  8.95M|    return zng_memread_8(src0) != zng_memread_8(src1);
   94|       |#else
   95|       |    return memcmp(src0, src1, 8);
   96|       |#endif
   97|  8.95M|}

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

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

