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

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

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

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|      2|    }
  126|      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|      2|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|      2|    __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|      2|}

zng_compressBound:
   81|  3.46k|z_uintmax_t Z_EXPORT PREFIX(compressBound)(z_uintmax_t sourceLen) {
   82|  3.46k|    z_uintmax_t complen = DEFLATE_BOUND_COMPLEN(sourceLen);
  ------------------
  |  |  129|  3.46k|#  define z_uintmax_t size_t
  ------------------
                  z_uintmax_t complen = DEFLATE_BOUND_COMPLEN(sourceLen);
  ------------------
  |  |   17|  3.46k|#  define DEFLATE_BOUND_COMPLEN(source_len) 0
  ------------------
   83|       |
   84|  3.46k|    if (complen > 0)
  ------------------
  |  Branch (84:9): [True: 0, False: 3.46k]
  ------------------
   85|       |        /* Architecture-specific code provided an upper bound. */
   86|      0|        return complen + ZLIB_WRAPLEN;
  ------------------
  |  |   68|      0|#define ZLIB_WRAPLEN 6      /* zlib format overhead */
  ------------------
   87|       |
   88|  3.46k|#ifndef NO_QUICK_STRATEGY
   89|  3.46k|    return sourceLen                       /* The source size itself */
   90|  3.46k|      + (sourceLen == 0 ? 1 : 0)           /* Always at least one byte for any input */
  ------------------
  |  Branch (90:10): [True: 0, False: 3.46k]
  ------------------
   91|  3.46k|      + (sourceLen < 9 ? 1 : 0)            /* One extra byte for lengths less than 9 */
  ------------------
  |  Branch (91:10): [True: 202, False: 3.25k]
  ------------------
   92|  3.46k|      + DEFLATE_QUICK_OVERHEAD(sourceLen)  /* Source encoding overhead, padded to next full byte */
  ------------------
  |  |   78|  3.46k|#define DEFLATE_QUICK_OVERHEAD(x) ((x * (DEFLATE_QUICK_LIT_MAX_BITS - 8) + 7) >> 3)
  |  |  ------------------
  |  |  |  |   77|  3.46k|#define DEFLATE_QUICK_LIT_MAX_BITS 9
  |  |  ------------------
  ------------------
   93|  3.46k|      + DEFLATE_BLOCK_OVERHEAD             /* Deflate block overhead bytes */
  ------------------
  |  |   74|  3.46k|#define DEFLATE_BLOCK_OVERHEAD ((DEFLATE_HEADER_BITS + DEFLATE_EOBS_BITS + DEFLATE_PAD_BITS) >> 3)
  |  |  ------------------
  |  |  |  |   71|  3.46k|#define DEFLATE_HEADER_BITS 3
  |  |  ------------------
  |  |               #define DEFLATE_BLOCK_OVERHEAD ((DEFLATE_HEADER_BITS + DEFLATE_EOBS_BITS + DEFLATE_PAD_BITS) >> 3)
  |  |  ------------------
  |  |  |  |   72|  3.46k|#define DEFLATE_EOBS_BITS   15
  |  |  ------------------
  |  |               #define DEFLATE_BLOCK_OVERHEAD ((DEFLATE_HEADER_BITS + DEFLATE_EOBS_BITS + DEFLATE_PAD_BITS) >> 3)
  |  |  ------------------
  |  |  |  |   73|  3.46k|#define DEFLATE_PAD_BITS    6
  |  |  ------------------
  ------------------
   94|  3.46k|      + ZLIB_WRAPLEN;                      /* zlib wrapper */
  ------------------
  |  |   68|  3.46k|#define ZLIB_WRAPLEN 6      /* zlib format overhead */
  ------------------
   95|       |#else
   96|       |    return sourceLen + (sourceLen >> 4) + 7 + ZLIB_WRAPLEN;
   97|       |#endif
   98|  3.46k|}

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(PPC_FEATURES) || defined(POWER_FEATURES)
   17|       |    power_check_features(&features->power);
   18|       |#elif defined(S390_FEATURES)
   19|       |    s390_check_features(&features->s390);
   20|       |#elif defined(RISCV_FEATURES)
   21|       |    riscv_check_features(&features->riscv);
   22|       |#elif defined(LOONGARCH_FEATURES)
   23|       |    loongarch_check_features(&features->loongarch);
   24|       |#endif
   25|      2|}

alloc_deflate:
  165|  3.46k|Z_INTERNAL deflate_allocs* alloc_deflate(PREFIX3(stream) *strm, int windowBits, int lit_bufsize) {
  166|  3.46k|    int curr_size = 0;
  167|       |
  168|       |    /* Define sizes */
  169|  3.46k|    int window_size = DEFLATE_ADJUST_WINDOW_SIZE((1 << windowBits) * 2);
  ------------------
  |  |  444|  3.46k|#  define DEFLATE_ADJUST_WINDOW_SIZE(n) (n)
  ------------------
  170|  3.46k|    int prev_size = (1 << windowBits) * (int)sizeof(Pos);
  171|  3.46k|    int head_size = HASH_SIZE * sizeof(Pos);
  ------------------
  |  |   85|  3.46k|#  define HASH_SIZE 65536u         /* number of elements in hash table */
  ------------------
  172|  3.46k|    int pending_size = (lit_bufsize * LIT_BUFS) + 1;
  ------------------
  |  |  269|  3.46k|#   define LIT_BUFS 4
  ------------------
  173|  3.46k|    int state_size = sizeof(deflate_state);
  174|  3.46k|    int alloc_size = sizeof(deflate_allocs);
  175|       |
  176|       |    /* Calculate relative buffer positions and paddings */
  177|  3.46k|    LOGSZP("window", window_size, PAD_WINDOW(curr_size), PADSZ(curr_size,WINDOW_PAD_SIZE));
  178|  3.46k|    int window_pos = PAD_WINDOW(curr_size);
  ------------------
  |  |  440|  3.46k|#  define PAD_WINDOW            PAD_64
  |  |  ------------------
  |  |  |  |  297|  3.46k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  |  |  ------------------
  |  |  |  |  |  |  295|  3.46k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  179|  3.46k|    curr_size = window_pos + window_size;
  180|       |
  181|  3.46k|    LOGSZP("prev", prev_size, PAD_64(curr_size), PADSZ(curr_size,64));
  182|  3.46k|    int prev_pos = PAD_64(curr_size);
  ------------------
  |  |  297|  3.46k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  295|  3.46k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  183|  3.46k|    curr_size = prev_pos + prev_size;
  184|       |
  185|  3.46k|    LOGSZP("head", head_size, PAD_64(curr_size), PADSZ(curr_size,64));
  186|  3.46k|    int head_pos = PAD_64(curr_size);
  ------------------
  |  |  297|  3.46k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  295|  3.46k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  187|  3.46k|    curr_size = head_pos + head_size;
  188|       |
  189|  3.46k|    LOGSZP("pending", pending_size, PAD_64(curr_size), PADSZ(curr_size,64));
  190|  3.46k|    int pending_pos = PAD_64(curr_size);
  ------------------
  |  |  297|  3.46k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  295|  3.46k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  191|  3.46k|    curr_size = pending_pos + pending_size;
  192|       |
  193|  3.46k|    LOGSZP("state", state_size, PAD_64(curr_size), PADSZ(curr_size,64));
  194|  3.46k|    int state_pos = PAD_64(curr_size);
  ------------------
  |  |  297|  3.46k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  295|  3.46k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  195|  3.46k|    curr_size = state_pos + state_size;
  196|       |
  197|  3.46k|    LOGSZP("alloc", alloc_size, PAD_16(curr_size), PADSZ(curr_size,16));
  198|  3.46k|    int alloc_pos = PAD_16(curr_size);
  ------------------
  |  |  296|  3.46k|#define PAD_16(bpos) ((bpos) + PADSZ((bpos),16))
  |  |  ------------------
  |  |  |  |  295|  3.46k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  199|  3.46k|    curr_size = alloc_pos + alloc_size;
  200|       |
  201|       |    /* Add 64-1 or 4096-1 to allow window alignment, and round size of buffer up to multiple of 64 */
  202|  3.46k|    int total_size = PAD_64(curr_size + (WINDOW_PAD_SIZE - 1));
  ------------------
  |  |  297|  3.46k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  295|  3.46k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  203|       |
  204|       |    /* Allocate buffer, align to 64-byte cacheline, and zerofill the resulting buffer */
  205|  3.46k|    char *original_buf = (char *)strm->zalloc(strm->opaque, 1, total_size);
  206|  3.46k|    if (original_buf == NULL)
  ------------------
  |  Branch (206:9): [True: 0, False: 3.46k]
  ------------------
  207|      0|        return NULL;
  208|       |
  209|  3.46k|    char *buff = (char *)HINT_ALIGNED_WINDOW((char *)PAD_WINDOW(original_buf));
  ------------------
  |  |  442|  3.46k|#  define HINT_ALIGNED_WINDOW   HINT_ALIGNED_64
  |  |  ------------------
  |  |  |  |  276|  3.46k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  271|  3.46k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  210|  3.46k|    LOGSZPL("Buffer alloc", total_size, PADSZ((uintptr_t)original_buf,WINDOW_PAD_SIZE), PADSZ(curr_size,WINDOW_PAD_SIZE));
  211|       |
  212|       |    /* Initialize alloc_bufs */
  213|  3.46k|    deflate_allocs *alloc_bufs  = (struct deflate_allocs_s *)(buff + alloc_pos);
  214|  3.46k|    alloc_bufs->buf_start = original_buf;
  215|  3.46k|    alloc_bufs->zfree = strm->zfree;
  216|       |
  217|       |    /* Assign buffers */
  218|  3.46k|    alloc_bufs->window = (unsigned char *)HINT_ALIGNED_WINDOW(buff + window_pos);
  ------------------
  |  |  442|  3.46k|#  define HINT_ALIGNED_WINDOW   HINT_ALIGNED_64
  |  |  ------------------
  |  |  |  |  276|  3.46k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  271|  3.46k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  219|  3.46k|    alloc_bufs->prev = (Pos *)HINT_ALIGNED_64(buff + prev_pos);
  ------------------
  |  |  276|  3.46k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  ------------------
  |  |  |  |  271|  3.46k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  ------------------
  ------------------
  220|  3.46k|    alloc_bufs->head = (Pos *)HINT_ALIGNED_64(buff + head_pos);
  ------------------
  |  |  276|  3.46k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  ------------------
  |  |  |  |  271|  3.46k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  ------------------
  ------------------
  221|  3.46k|    alloc_bufs->pending_buf = (unsigned char *)HINT_ALIGNED_64(buff + pending_pos);
  ------------------
  |  |  276|  3.46k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  ------------------
  |  |  |  |  271|  3.46k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  ------------------
  ------------------
  222|  3.46k|    alloc_bufs->state = (deflate_state *)HINT_ALIGNED_16(buff + state_pos);
  ------------------
  |  |  275|  3.46k|#define HINT_ALIGNED_16(p) HINT_ALIGNED((p),16)
  |  |  ------------------
  |  |  |  |  271|  3.46k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  ------------------
  ------------------
  223|       |
  224|  3.46k|    memset(alloc_bufs->prev, 0, prev_size);
  225|       |
  226|  3.46k|    return alloc_bufs;
  227|  3.46k|}
zng_deflateInit2:
  247|  3.46k|                                            int32_t memLevel, int32_t strategy) {
  248|       |    /* Todo: ignore strm->next_in if we use it as window */
  249|  3.46k|    deflate_state *s;
  250|  3.46k|    int wrap = 1;
  251|       |
  252|       |    /* Initialize functable */
  253|  3.46k|    FUNCTABLE_INIT;
  ------------------
  |  |   44|  3.46k|#  define FUNCTABLE_INIT if (functable.force_init()) {return Z_VERSION_ERROR;}
  |  |  ------------------
  |  |  |  |  188|      0|#define Z_VERSION_ERROR (-6)
  |  |  ------------------
  |  |  |  Branch (44:30): [True: 0, False: 3.46k]
  |  |  ------------------
  ------------------
  254|       |
  255|  3.46k|    if (strm == NULL)
  ------------------
  |  Branch (255:9): [True: 0, False: 3.46k]
  ------------------
  256|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  257|       |
  258|  3.46k|    strm->msg = NULL;
  259|  3.46k|    if (strm->zalloc == NULL) {
  ------------------
  |  Branch (259:9): [True: 3.46k, False: 0]
  ------------------
  260|  3.46k|        strm->zalloc = PREFIX(zcalloc);
  ------------------
  |  |  117|  3.46k|#  define PREFIX(x) zng_ ## x
  ------------------
  261|  3.46k|        strm->opaque = NULL;
  262|  3.46k|    }
  263|  3.46k|    if (strm->zfree == NULL)
  ------------------
  |  Branch (263:9): [True: 3.46k, False: 0]
  ------------------
  264|  3.46k|        strm->zfree = PREFIX(zcfree);
  ------------------
  |  |  117|  3.46k|#  define PREFIX(x) zng_ ## x
  ------------------
  265|       |
  266|  3.46k|    if (level == Z_DEFAULT_COMPRESSION)
  ------------------
  |  |  196|  3.46k|#define Z_DEFAULT_COMPRESSION  (-1)
  ------------------
  |  Branch (266:9): [True: 3.46k, False: 0]
  ------------------
  267|  3.46k|        level = 6;
  268|       |
  269|  3.46k|    if (windowBits < 0) { /* suppress zlib wrapper */
  ------------------
  |  Branch (269:9): [True: 0, False: 3.46k]
  ------------------
  270|      0|        wrap = 0;
  271|      0|        if (windowBits < -MAX_WBITS)
  ------------------
  |  |   39|      0|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (271:13): [True: 0, False: 0]
  ------------------
  272|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  273|      0|        windowBits = -windowBits;
  274|      0|#ifdef GZIP
  275|  3.46k|    } else if (windowBits > MAX_WBITS) {
  ------------------
  |  |   39|  3.46k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (275:16): [True: 0, False: 3.46k]
  ------------------
  276|      0|        wrap = 2;       /* write gzip wrapper instead */
  277|      0|        windowBits -= 16;
  278|      0|#endif
  279|      0|    }
  280|  3.46k|    if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < MIN_WBITS ||
  ------------------
  |  |   27|  6.92k|#  define MAX_MEM_LEVEL 9
  ------------------
                  if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < MIN_WBITS ||
  ------------------
  |  |  212|  6.92k|#define Z_DEFLATED   8
  ------------------
                  if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < MIN_WBITS ||
  ------------------
  |  |   36|  6.92k|#  define MIN_WBITS   8  /* 256 LZ77 window */
  ------------------
  |  Branch (280:9): [True: 0, False: 3.46k]
  |  Branch (280:25): [True: 0, False: 3.46k]
  |  Branch (280:53): [True: 0, False: 3.46k]
  |  Branch (280:77): [True: 0, False: 3.46k]
  ------------------
  281|  3.46k|        windowBits > MAX_WBITS || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED ||
  ------------------
  |  |   39|  6.92k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
                      windowBits > MAX_WBITS || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED ||
  ------------------
  |  |  202|  6.92k|#define Z_FIXED               4
  ------------------
  |  Branch (281:9): [True: 0, False: 3.46k]
  |  Branch (281:35): [True: 0, False: 3.46k]
  |  Branch (281:48): [True: 0, False: 3.46k]
  |  Branch (281:61): [True: 0, False: 3.46k]
  |  Branch (281:77): [True: 0, False: 3.46k]
  ------------------
  282|  3.46k|        (windowBits == 8 && wrap != 1)) {
  ------------------
  |  Branch (282:10): [True: 0, False: 3.46k]
  |  Branch (282:29): [True: 0, False: 0]
  ------------------
  283|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  284|      0|    }
  285|  3.46k|    if (windowBits == 8)
  ------------------
  |  Branch (285:9): [True: 0, False: 3.46k]
  ------------------
  286|      0|        windowBits = 9;  /* until 256-byte window bug fixed */
  287|       |
  288|       |    /* Allocate buffers */
  289|  3.46k|    int lit_bufsize = 1 << (memLevel + 6);
  290|  3.46k|    deflate_allocs *alloc_bufs = alloc_deflate(strm, windowBits, lit_bufsize);
  291|  3.46k|    if (alloc_bufs == NULL)
  ------------------
  |  Branch (291:9): [True: 0, False: 3.46k]
  ------------------
  292|      0|        return Z_MEM_ERROR;
  ------------------
  |  |  186|      0|#define Z_MEM_ERROR    (-4)
  ------------------
  293|       |
  294|  3.46k|    s = alloc_bufs->state;
  295|  3.46k|    s->alloc_bufs = alloc_bufs;
  296|  3.46k|    s->window = alloc_bufs->window;
  297|  3.46k|    s->prev = alloc_bufs->prev;
  298|  3.46k|    s->head = alloc_bufs->head;
  299|  3.46k|    s->pending_buf = alloc_bufs->pending_buf;
  300|       |
  301|  3.46k|    strm->state = (struct internal_state *)s;
  302|  3.46k|    s->strm = strm;
  303|  3.46k|    s->status = INIT_STATE;     /* to pass state test in deflateReset() */
  ------------------
  |  |   66|  3.46k|#define INIT_STATE      1    /* zlib header -> BUSY_STATE */
  ------------------
  304|       |
  305|  3.46k|    s->wrap = wrap;
  306|  3.46k|    s->gzhead = NULL;
  307|  3.46k|    s->w_size = 1 << windowBits;
  308|       |
  309|  3.46k|    s->high_water = 0;      /* nothing written to s->window yet */
  310|       |
  311|  3.46k|    s->lit_bufsize = lit_bufsize; /* 16K elements by default */
  312|       |
  313|       |    /* We overlay pending_buf and sym_buf. This works since the average size
  314|       |     * for length/distance pairs over any compressed block is assured to be 31
  315|       |     * bits or less.
  316|       |     *
  317|       |     * Analysis: The longest fixed codes are a length code of 8 bits plus 5
  318|       |     * extra bits, for lengths 131 to 257. The longest fixed distance codes are
  319|       |     * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest
  320|       |     * possible fixed-codes length/distance pair is then 31 bits total.
  321|       |     *
  322|       |     * sym_buf starts one-fourth of the way into pending_buf. So there are
  323|       |     * three bytes in sym_buf for every four bytes in pending_buf. Each symbol
  324|       |     * in sym_buf is three bytes -- two for the distance and one for the
  325|       |     * literal/length. As each symbol is consumed, the pointer to the next
  326|       |     * sym_buf value to read moves forward three bytes. From that symbol, up to
  327|       |     * 31 bits are written to pending_buf. The closest the written pending_buf
  328|       |     * bits gets to the next sym_buf symbol to read is just before the last
  329|       |     * code is written. At that time, 31*(n-2) bits have been written, just
  330|       |     * after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at
  331|       |     * 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1
  332|       |     * symbols are written.) The closest the writing gets to what is unread is
  333|       |     * then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and
  334|       |     * can range from 128 to 32768.
  335|       |     *
  336|       |     * Therefore, at a minimum, there are 142 bits of space between what is
  337|       |     * written and what is read in the overlain buffers, so the symbols cannot
  338|       |     * be overwritten by the compressed data. That space is actually 139 bits,
  339|       |     * due to the three-bit fixed-code block header.
  340|       |     *
  341|       |     * That covers the case where either Z_FIXED is specified, forcing fixed
  342|       |     * codes, or when the use of fixed codes is chosen, because that choice
  343|       |     * results in a smaller compressed block than dynamic codes. That latter
  344|       |     * condition then assures that the above analysis also covers all dynamic
  345|       |     * blocks. A dynamic-code block will only be chosen to be emitted if it has
  346|       |     * fewer bits than a fixed-code block would for the same set of symbols.
  347|       |     * Therefore its average symbol length is assured to be less than 31. So
  348|       |     * the compressed data for a dynamic block also cannot overwrite the
  349|       |     * symbols from which it is being constructed.
  350|       |     */
  351|       |
  352|  3.46k|    s->pending_buf_size = s->lit_bufsize * 4;
  353|       |
  354|       |#ifdef LIT_MEM
  355|       |    s->d_buf = (uint16_t *)(s->pending_buf + (s->lit_bufsize << 1));
  356|       |    s->l_buf = s->pending_buf + (s->lit_bufsize << 2);
  357|       |    s->sym_end = s->lit_bufsize - 1;
  358|       |#else
  359|  3.46k|    s->sym_buf = s->pending_buf + s->lit_bufsize;
  360|  3.46k|    s->sym_end = (s->lit_bufsize - 1) * 3;
  361|  3.46k|#endif
  362|       |    /* We avoid equality with lit_bufsize*3 because of wraparound at 64K
  363|       |     * on 16 bit machines and because stored blocks are restricted to
  364|       |     * 64K-1 bytes.
  365|       |     */
  366|       |
  367|  3.46k|    s->level = level;
  368|  3.46k|    s->strategy = strategy;
  369|  3.46k|    s->block_open = 0;
  370|  3.46k|    s->reproducible = 0;
  371|       |
  372|  3.46k|    return PREFIX(deflateReset)(strm);
  ------------------
  |  |  117|  3.46k|#  define PREFIX(x) zng_ ## x
  ------------------
  373|  3.46k|}
zng_deflateInit:
  376|  3.46k|int32_t Z_EXPORT PREFIX(deflateInit)(PREFIX3(stream) *strm, int32_t level) {
  377|  3.46k|    return PREFIX(deflateInit2)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
  ------------------
  |  |  117|  3.46k|#  define PREFIX(x) zng_ ## x
  ------------------
                  return PREFIX(deflateInit2)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
  ------------------
  |  |  212|  3.46k|#define Z_DEFLATED   8
  ------------------
                  return PREFIX(deflateInit2)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
  ------------------
  |  |   39|  3.46k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
                  return PREFIX(deflateInit2)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
  ------------------
  |  |   45|  3.46k|#  define DEF_MEM_LEVEL 8
  ------------------
                  return PREFIX(deflateInit2)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
  ------------------
  |  |  203|  3.46k|#define Z_DEFAULT_STRATEGY    0
  ------------------
  378|  3.46k|}
zng_deflateResetKeep:
  494|  3.46k|int32_t Z_EXPORT PREFIX(deflateResetKeep)(PREFIX3(stream) *strm) {
  495|  3.46k|    deflate_state *s;
  496|       |
  497|  3.46k|    if (deflateStateCheck(strm))
  ------------------
  |  Branch (497:9): [True: 0, False: 3.46k]
  ------------------
  498|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  499|       |
  500|  3.46k|    strm->total_in = strm->total_out = 0;
  501|  3.46k|    strm->msg = NULL; /* use zfree if we ever allocate msg dynamically */
  502|  3.46k|    strm->data_type = Z_UNKNOWN;
  ------------------
  |  |  209|  3.46k|#define Z_UNKNOWN  2
  ------------------
  503|       |
  504|  3.46k|    s = (deflate_state *)strm->state;
  505|  3.46k|    s->pending = 0;
  506|  3.46k|    s->pending_out = s->pending_buf;
  507|       |
  508|  3.46k|    if (s->wrap < 0)
  ------------------
  |  Branch (508:9): [True: 0, False: 3.46k]
  ------------------
  509|      0|        s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
  510|       |
  511|  3.46k|    s->status =
  512|  3.46k|#ifdef GZIP
  513|  3.46k|        s->wrap == 2 ? GZIP_STATE :
  ------------------
  |  |   68|      0|#  define GZIP_STATE    4    /* gzip header -> BUSY_STATE | EXTRA_STATE */
  ------------------
  |  Branch (513:9): [True: 0, False: 3.46k]
  ------------------
  514|  3.46k|#endif
  515|  3.46k|        INIT_STATE;
  ------------------
  |  |   66|  6.92k|#define INIT_STATE      1    /* zlib header -> BUSY_STATE */
  ------------------
  516|       |
  517|  3.46k|#ifdef GZIP
  518|  3.46k|    if (s->wrap == 2) {
  ------------------
  |  Branch (518:9): [True: 0, False: 3.46k]
  ------------------
  519|      0|        strm->adler = CRC32_INITIAL_VALUE;
  ------------------
  |  |   66|      0|#define CRC32_INITIAL_VALUE   0 /* initial crc-32 hash value */
  ------------------
  520|      0|    } else
  521|  3.46k|#endif
  522|  3.46k|        strm->adler = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   65|  3.46k|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
  523|  3.46k|    s->last_flush = -2;
  524|       |
  525|  3.46k|    zng_tr_init(s);
  526|       |
  527|  3.46k|    DEFLATE_RESET_KEEP_HOOK(strm);  /* hook for IBM Z DFLTCC */
  ------------------
  |  |  450|  3.46k|#  define DEFLATE_RESET_KEEP_HOOK(strm) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (450:54): [Folded, False: 3.46k]
  |  |  ------------------
  ------------------
  528|       |
  529|  3.46k|    return Z_OK;
  ------------------
  |  |  180|  3.46k|#define Z_OK            0
  ------------------
  530|  3.46k|}
zng_deflateReset:
  533|  3.46k|int32_t Z_EXPORT PREFIX(deflateReset)(PREFIX3(stream) *strm) {
  534|  3.46k|    int ret = PREFIX(deflateResetKeep)(strm);
  ------------------
  |  |  117|  3.46k|#  define PREFIX(x) zng_ ## x
  ------------------
  535|  3.46k|    if (ret == Z_OK)
  ------------------
  |  |  180|  3.46k|#define Z_OK            0
  ------------------
  |  Branch (535:9): [True: 3.46k, False: 0]
  ------------------
  536|  3.46k|        lm_init(strm->state);
  537|  3.46k|    return ret;
  538|  3.46k|}
zng_flush_pending:
  749|  13.9k|Z_INTERNAL void PREFIX(flush_pending)(PREFIX3(stream) *strm) {
  750|  13.9k|    flush_pending_inline(strm);
  751|  13.9k|}
zng_deflate:
  935|   263M|int32_t Z_EXPORT PREFIX(deflate)(PREFIX3(stream) *strm, int32_t flush) {
  936|   263M|    int32_t old_flush; /* value of flush param for previous deflate call */
  937|   263M|    deflate_state *s;
  938|       |
  939|   263M|    if (deflateStateCheck(strm) || flush > Z_BLOCK || flush < 0)
  ------------------
  |  |  176|   527M|#define Z_BLOCK         5
  ------------------
  |  Branch (939:9): [True: 0, False: 263M]
  |  Branch (939:36): [True: 0, False: 263M]
  |  Branch (939:55): [True: 0, False: 263M]
  ------------------
  940|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  941|   263M|    s = strm->state;
  942|       |
  943|   263M|    if (strm->next_out == NULL || (strm->avail_in != 0 && strm->next_in == NULL)
  ------------------
  |  Branch (943:9): [True: 0, False: 263M]
  |  Branch (943:36): [True: 254M, False: 8.97M]
  |  Branch (943:59): [True: 0, False: 254M]
  ------------------
  944|   263M|        || (s->status == FINISH_STATE && flush != Z_FINISH)) {
  ------------------
  |  |   75|   527M|#define FINISH_STATE    3    /* stream complete */
  ------------------
                      || (s->status == FINISH_STATE && flush != Z_FINISH)) {
  ------------------
  |  |  175|  4.33M|#define Z_FINISH        4
  ------------------
  |  Branch (944:13): [True: 4.33M, False: 259M]
  |  Branch (944:42): [True: 0, False: 4.33M]
  ------------------
  945|      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)]
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|      0|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (27:39): [Folded, False: 0]
  |  |  |  |  |  Branch (27:53): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  946|      0|    }
  947|   263M|    if (strm->avail_out == 0) {
  ------------------
  |  Branch (947:9): [True: 0, False: 263M]
  ------------------
  948|      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)]
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|      0|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (27:39): [Folded, False: 0]
  |  |  |  |  |  Branch (27:53): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  949|      0|    }
  950|       |
  951|   263M|    old_flush = s->last_flush;
  952|   263M|    s->last_flush = flush;
  953|       |
  954|       |    /* Flush as much pending output as possible */
  955|   263M|    if (s->pending != 0) {
  ------------------
  |  Branch (955:9): [True: 114M, False: 148M]
  ------------------
  956|   114M|        flush_pending_inline(strm);
  957|   114M|        if (strm->avail_out == 0) {
  ------------------
  |  Branch (957:13): [True: 114M, False: 0]
  ------------------
  958|       |            /* Since avail_out is 0, deflate will be called again with
  959|       |             * more output space, but possibly with both pending and
  960|       |             * avail_in equal to zero. There won't be anything to do,
  961|       |             * but this is not an error situation so make sure we
  962|       |             * return OK instead of BUF_ERROR at next call of deflate:
  963|       |             */
  964|   114M|            s->last_flush = -1;
  965|   114M|            return Z_OK;
  ------------------
  |  |  180|   114M|#define Z_OK            0
  ------------------
  966|   114M|        }
  967|       |
  968|       |        /* Make sure there is something to do and avoid duplicate consecutive
  969|       |         * flushes. For repeated and useless calls with Z_FINISH, we keep
  970|       |         * returning Z_STREAM_END instead of Z_BUF_ERROR.
  971|       |         */
  972|   148M|    } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && flush != Z_FINISH) {
  ------------------
  |  |  139|  10.6k|#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
  |  |  ------------------
  |  |  |  Branch (139:31): [True: 0, False: 10.6k]
  |  |  ------------------
  ------------------
                  } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && flush != Z_FINISH) {
  ------------------
  |  |  139|   148M|#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
  |  |  ------------------
  |  |  |  Branch (139:31): [True: 0, False: 10.6k]
  |  |  ------------------
  ------------------
                  } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && flush != Z_FINISH) {
  ------------------
  |  |  175|      0|#define Z_FINISH        4
  ------------------
  |  Branch (972:16): [True: 10.6k, False: 148M]
  |  Branch (972:39): [True: 0, False: 10.6k]
  |  Branch (972:73): [True: 0, False: 0]
  ------------------
  973|      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)]
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|      0|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (27:39): [Folded, False: 0]
  |  |  |  |  |  Branch (27:53): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  974|      0|    }
  975|       |
  976|       |    /* User must not provide more input after the first FINISH: */
  977|   148M|    if (s->status == FINISH_STATE && strm->avail_in != 0)   {
  ------------------
  |  |   75|   297M|#define FINISH_STATE    3    /* stream complete */
  ------------------
  |  Branch (977:9): [True: 6.92k, False: 148M]
  |  Branch (977:38): [True: 0, False: 6.92k]
  ------------------
  978|      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)]
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|      0|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (27:39): [Folded, False: 0]
  |  |  |  |  |  Branch (27:53): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  979|      0|    }
  980|       |
  981|       |    /* Skip headers if raw deflate stream was requested */
  982|   148M|    if (s->status == INIT_STATE && s->wrap == 0) {
  ------------------
  |  |   66|   297M|#define INIT_STATE      1    /* zlib header -> BUSY_STATE */
  ------------------
  |  Branch (982:9): [True: 3.46k, False: 148M]
  |  Branch (982:36): [True: 0, False: 3.46k]
  ------------------
  983|      0|        s->status = BUSY_STATE;
  ------------------
  |  |   74|      0|#define BUSY_STATE      2    /* deflate -> FINISH_STATE */
  ------------------
  984|      0|    }
  985|       |
  986|   148M|    if (s->status != BUSY_STATE && s->status != FINISH_STATE && s->wrap != 0) {
  ------------------
  |  |   74|   297M|#define BUSY_STATE      2    /* deflate -> FINISH_STATE */
  ------------------
                  if (s->status != BUSY_STATE && s->status != FINISH_STATE && s->wrap != 0) {
  ------------------
  |  |   75|   148M|#define FINISH_STATE    3    /* stream complete */
  ------------------
  |  Branch (986:9): [True: 10.3k, False: 148M]
  |  Branch (986:36): [True: 3.46k, False: 6.92k]
  |  Branch (986:65): [True: 3.46k, False: 0]
  ------------------
  987|       |        /* Write the header */
  988|  3.46k|        if (deflateHeaders(s, strm) == Z_OK) {
  ------------------
  |  |  180|  3.46k|#define Z_OK            0
  ------------------
  |  Branch (988:13): [True: 3.46k, False: 0]
  ------------------
  989|  3.46k|            return Z_OK;
  ------------------
  |  |  180|  3.46k|#define Z_OK            0
  ------------------
  990|  3.46k|        }
  991|  3.46k|    }
  992|       |
  993|       |    /* Start a new block or continue the current one. */
  994|   148M|    if (strm->avail_in != 0 || s->lookahead != 0 || (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
  ------------------
  |  |  171|  13.9k|#define Z_NO_FLUSH      0
  ------------------
                  if (strm->avail_in != 0 || s->lookahead != 0 || (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
  ------------------
  |  |   75|  6.97k|#define FINISH_STATE    3    /* stream complete */
  ------------------
  |  Branch (994:9): [True: 148M, False: 10.6k]
  |  Branch (994:32): [True: 3.70k, False: 6.97k]
  |  Branch (994:54): [True: 6.97k, False: 0]
  |  Branch (994:77): [True: 53, False: 6.92k]
  ------------------
  995|   148M|        block_state bstate;
  996|       |
  997|   148M|        bstate = DEFLATE_HOOK(strm, flush, &bstate) ? bstate :  /* hook for IBM Z DFLTCC */
  ------------------
  |  |  462|   148M|#  define DEFLATE_HOOK(strm, flush, bstate) 0
  |  |  ------------------
  |  |  |  Branch (462:45): [Folded, False: 148M]
  |  |  ------------------
  ------------------
  998|   148M|                 s->level == 0 ? deflate_stored(s, flush) :
  ------------------
  |  Branch (998:18): [True: 0, False: 148M]
  ------------------
  999|   148M|                 s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
  ------------------
  |  |  200|   148M|#define Z_HUFFMAN_ONLY        2
  ------------------
  |  Branch (999:18): [True: 0, False: 148M]
  ------------------
 1000|   148M|                 s->strategy == Z_RLE ? deflate_rle(s, flush) :
  ------------------
  |  |  201|   148M|#define Z_RLE                 3
  ------------------
  |  Branch (1000:18): [True: 0, False: 148M]
  ------------------
 1001|   148M|                 (*(configuration_table[s->level].func))(s, flush);
 1002|       |
 1003|   148M|        if (bstate == finish_started || bstate == finish_done) {
  ------------------
  |  Branch (1003:13): [True: 3.46k, False: 148M]
  |  Branch (1003:41): [True: 0, False: 148M]
  ------------------
 1004|  3.46k|            s->status = FINISH_STATE;
  ------------------
  |  |   75|  3.46k|#define FINISH_STATE    3    /* stream complete */
  ------------------
 1005|  3.46k|        }
 1006|   148M|        if (bstate == need_more || bstate == finish_started) {
  ------------------
  |  Branch (1006:13): [True: 148M, False: 3.46k]
  |  Branch (1006:36): [True: 3.46k, False: 0]
  ------------------
 1007|   148M|            if (strm->avail_out == 0) {
  ------------------
  |  Branch (1007:17): [True: 10.4k, False: 148M]
  ------------------
 1008|  10.4k|                s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
 1009|  10.4k|            }
 1010|   148M|            return Z_OK;
  ------------------
  |  |  180|   148M|#define Z_OK            0
  ------------------
 1011|       |            /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
 1012|       |             * of deflate should use the same flush parameter to make sure
 1013|       |             * that the flush is complete. So we don't have to output an
 1014|       |             * empty block here, this will be done at next call. This also
 1015|       |             * ensures that for a very small output buffer, we emit at most
 1016|       |             * one empty block.
 1017|       |             */
 1018|   148M|        }
 1019|      0|        if (bstate == block_done) {
  ------------------
  |  Branch (1019:13): [True: 0, False: 0]
  ------------------
 1020|      0|            if (flush == Z_PARTIAL_FLUSH) {
  ------------------
  |  |  172|      0|#define Z_PARTIAL_FLUSH 1
  ------------------
  |  Branch (1020:17): [True: 0, False: 0]
  ------------------
 1021|      0|                zng_tr_align(s);
 1022|      0|            } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
  ------------------
  |  |  176|      0|#define Z_BLOCK         5
  ------------------
  |  Branch (1022:24): [True: 0, False: 0]
  ------------------
 1023|      0|                zng_tr_stored_block(s, NULL, 0L, 0);
 1024|       |                /* For a full flush, this empty block will be recognized
 1025|       |                 * as a special marker by inflate_sync().
 1026|       |                 */
 1027|      0|                if (flush == Z_FULL_FLUSH) {
  ------------------
  |  |  174|      0|#define Z_FULL_FLUSH    3
  ------------------
  |  Branch (1027:21): [True: 0, False: 0]
  ------------------
 1028|      0|                    CLEAR_HASH(s);             /* forget history */
  ------------------
  |  |  145|      0|#define CLEAR_HASH(s) do { \
  |  |  146|      0|    memset((unsigned char *)s->head, 0, HASH_SIZE * sizeof(*s->head)); \
  |  |  ------------------
  |  |  |  |   85|      0|#  define HASH_SIZE 65536u         /* number of elements in hash table */
  |  |  ------------------
  |  |  147|      0|  } while (0)
  |  |  ------------------
  |  |  |  Branch (147:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1029|      0|                    if (s->lookahead == 0) {
  ------------------
  |  Branch (1029:25): [True: 0, False: 0]
  ------------------
 1030|      0|                        s->strstart = 0;
 1031|      0|                        s->block_start = 0;
 1032|      0|                        s->insert = 0;
 1033|      0|                    }
 1034|      0|                }
 1035|      0|            }
 1036|      0|            PREFIX(flush_pending)(strm);
  ------------------
  |  |  117|      0|#  define PREFIX(x) zng_ ## x
  ------------------
 1037|      0|            if (strm->avail_out == 0) {
  ------------------
  |  Branch (1037:17): [True: 0, False: 0]
  ------------------
 1038|      0|                s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
 1039|      0|                return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
 1040|      0|            }
 1041|      0|        }
 1042|      0|    }
 1043|       |
 1044|  6.92k|    if (flush != Z_FINISH)
  ------------------
  |  |  175|  6.92k|#define Z_FINISH        4
  ------------------
  |  Branch (1044:9): [True: 0, False: 6.92k]
  ------------------
 1045|      0|        return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
 1046|       |
 1047|       |    /* Write the trailer */
 1048|  6.92k|#ifdef GZIP
 1049|  6.92k|    if (s->wrap == 2) {
  ------------------
  |  Branch (1049:9): [True: 0, False: 6.92k]
  ------------------
 1050|      0|        put_uint32(s, strm->adler);
 1051|      0|        put_uint32(s, (uint32_t)strm->total_in);
 1052|      0|    } else
 1053|  6.92k|#endif
 1054|  6.92k|    {
 1055|  6.92k|        if (s->wrap == 1)
  ------------------
  |  Branch (1055:13): [True: 3.46k, False: 3.46k]
  ------------------
 1056|  3.46k|            put_uint32_msb(s, strm->adler);
 1057|  6.92k|    }
 1058|  6.92k|    flush_pending_inline(strm);
 1059|       |    /* If avail_out is zero, the application will call deflate again
 1060|       |     * to flush the rest.
 1061|       |     */
 1062|  6.92k|    if (s->wrap > 0)
  ------------------
  |  Branch (1062:9): [True: 3.46k, False: 3.46k]
  ------------------
 1063|  3.46k|        s->wrap = -s->wrap; /* write the trailer only once! */
 1064|  6.92k|    if (s->pending == 0) {
  ------------------
  |  Branch (1064:9): [True: 3.46k, False: 3.46k]
  ------------------
 1065|  3.46k|        Assert(s->bi_valid == 0, "bi_buf not flushed");
 1066|  3.46k|        return Z_STREAM_END;
  ------------------
  |  |  181|  3.46k|#define Z_STREAM_END    1
  ------------------
 1067|  3.46k|    }
 1068|  3.46k|    return Z_OK;
  ------------------
  |  |  180|  3.46k|#define Z_OK            0
  ------------------
 1069|  6.92k|}
zng_deflateEnd:
 1072|  3.46k|int32_t Z_EXPORT PREFIX(deflateEnd)(PREFIX3(stream) *strm) {
 1073|  3.46k|    if (deflateStateCheck(strm))
  ------------------
  |  Branch (1073:9): [True: 0, False: 3.46k]
  ------------------
 1074|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1075|       |
 1076|  3.46k|    int32_t status = strm->state->status;
 1077|       |
 1078|       |    /* Free allocated buffers */
 1079|  3.46k|    free_deflate(strm);
 1080|       |
 1081|  3.46k|    return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
  ------------------
  |  |   74|  3.46k|#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.46k|#define Z_OK            0
  ------------------
  |  Branch (1081:12): [True: 0, False: 3.46k]
  ------------------
 1082|  3.46k|}
zng_fill_window:
 1183|   267M|void Z_INTERNAL PREFIX(fill_window)(deflate_state *s) {
 1184|   267M|    PREFIX3(stream) *strm = s->strm;
  ------------------
  |  |  119|   267M|#  define PREFIX3(x) zng_ ## x
  ------------------
 1185|   267M|    insert_string_cb insert_string_func;
 1186|   267M|    unsigned char *window = s->window;
 1187|   267M|    unsigned n;
 1188|   267M|    unsigned int more;    /* Amount of free space at the end of the window. */
 1189|   267M|    unsigned int wsize = s->w_size;
 1190|   267M|    int level = s->level;
 1191|       |
 1192|   267M|    Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
 1193|       |
 1194|   267M|    if (level >= 9)
  ------------------
  |  Branch (1194:9): [True: 0, False: 267M]
  ------------------
 1195|      0|        insert_string_func = insert_string_roll;
 1196|   267M|    else
 1197|   267M|        insert_string_func = insert_string;
 1198|       |
 1199|   267M|    do {
 1200|   267M|        more = s->window_size - s->lookahead - s->strstart;
 1201|       |
 1202|       |        /* If the window is almost full and there is insufficient lookahead,
 1203|       |         * move the upper half to the lower one to make room in the upper half.
 1204|       |         */
 1205|   267M|        if (s->strstart >= wsize+MAX_DIST(s)) {
  ------------------
  |  |  385|   267M|#define MAX_DIST(s)  ((s)->w_size - MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  380|   267M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   57|   267M|#define STD_MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|   267M|#define STD_MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1205:13): [True: 3.49k, False: 267M]
  ------------------
 1206|  3.49k|            memcpy(window, window + wsize, (unsigned)wsize);
 1207|  3.49k|            if (s->match_start >= wsize) {
  ------------------
  |  Branch (1207:17): [True: 2.67k, False: 814]
  ------------------
 1208|  2.67k|                s->match_start -= wsize;
 1209|  2.67k|            } else {
 1210|    814|                s->match_start = 0;
 1211|    814|                s->prev_length = 0;
 1212|    814|            }
 1213|  3.49k|            s->strstart    -= wsize; /* we now have strstart >= MAX_DIST */
 1214|  3.49k|            s->block_start -= (int)wsize;
 1215|  3.49k|            if (s->insert > s->strstart)
  ------------------
  |  Branch (1215:17): [True: 0, False: 3.49k]
  ------------------
 1216|      0|                s->insert = s->strstart;
 1217|  3.49k|            FUNCTABLE_CALL(slide_hash)(s);
  ------------------
  |  |   45|  3.49k|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
 1218|  3.49k|            more += wsize;
 1219|  3.49k|        }
 1220|   267M|        if (strm->avail_in == 0)
  ------------------
  |  Branch (1220:13): [True: 119M, False: 148M]
  ------------------
 1221|   119M|            break;
 1222|       |
 1223|       |        /* If there was no sliding:
 1224|       |         *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
 1225|       |         *    more == window_size - lookahead - strstart
 1226|       |         * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
 1227|       |         * => more >= window_size - 2*WSIZE + 2
 1228|       |         * In the BIG_MEM or MMAP case (not yet supported),
 1229|       |         *   window_size == input_size + MIN_LOOKAHEAD  &&
 1230|       |         *   strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
 1231|       |         * Otherwise, window_size == 2*WSIZE so more >= 2.
 1232|       |         * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
 1233|       |         */
 1234|   148M|        Assert(more >= 2, "more < 2");
 1235|       |
 1236|   148M|        n = read_buf(strm, window + s->strstart + s->lookahead, more);
 1237|   148M|        s->lookahead += n;
 1238|       |
 1239|       |        /* Initialize the hash value now that we have some input: */
 1240|   148M|        if (s->lookahead + s->insert >= STD_MIN_MATCH) {
  ------------------
  |  |   56|   148M|#define STD_MIN_MATCH  3
  ------------------
  |  Branch (1240:13): [True: 148M, False: 6.88k]
  ------------------
 1241|   148M|            unsigned int str = s->strstart - s->insert;
 1242|   148M|            if (UNLIKELY(level >= 9)) {
  ------------------
  |  |  254|   148M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 148M]
  |  |  ------------------
  ------------------
 1243|      0|                s->ins_h = update_hash_roll(window[str], window[str+1]);
 1244|   148M|            } else if (str >= 1) {
  ------------------
  |  Branch (1244:24): [True: 148M, False: 509k]
  ------------------
 1245|   148M|                quick_insert_string(s, window, str + 2 - STD_MIN_MATCH);
  ------------------
  |  |   56|   148M|#define STD_MIN_MATCH  3
  ------------------
 1246|   148M|            }
 1247|   148M|            unsigned int count = s->insert;
 1248|   148M|            if (UNLIKELY(s->lookahead == 1)) {
  ------------------
  |  |  254|   148M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 148M]
  |  |  ------------------
  ------------------
 1249|      0|                count -= 1;
 1250|      0|            }
 1251|   148M|            if (count > 0) {
  ------------------
  |  Branch (1251:17): [True: 0, False: 148M]
  ------------------
 1252|      0|                insert_string_func(s, window, str, count);
 1253|      0|                s->insert -= count;
 1254|      0|            }
 1255|   148M|        }
 1256|       |        /* If the whole input has less than STD_MIN_MATCH bytes, ins_h is garbage,
 1257|       |         * but this is not important since only literal bytes will be emitted.
 1258|       |         */
 1259|   148M|    } while (s->lookahead < MIN_LOOKAHEAD && strm->avail_in != 0);
  ------------------
  |  |  380|   297M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  ------------------
  |  |  |  |   57|   148M|#define STD_MAX_MATCH  258
  |  |  ------------------
  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  ------------------
  |  |  |  |   56|   148M|#define STD_MIN_MATCH  3
  |  |  ------------------
  ------------------
  |  Branch (1259:14): [True: 29.9M, False: 118M]
  |  Branch (1259:46): [True: 0, False: 29.9M]
  ------------------
 1260|       |
 1261|       |    /* If the WIN_INIT bytes after the end of the current data have never been
 1262|       |     * written, then zero those bytes in order to avoid memory check reports of
 1263|       |     * the use of uninitialized (or uninitialised as Julian writes) bytes by
 1264|       |     * the longest match routines.  Update the high water mark for the next
 1265|       |     * time through here.  WIN_INIT is set to STD_MAX_MATCH since the longest match
 1266|       |     * routines allow scanning to strstart + STD_MAX_MATCH, ignoring lookahead.
 1267|       |     */
 1268|   267M|    if (s->high_water < s->window_size) {
  ------------------
  |  Branch (1268:9): [True: 77.9M, False: 189M]
  ------------------
 1269|  77.9M|        unsigned int curr = s->strstart + s->lookahead;
 1270|  77.9M|        unsigned int init;
 1271|       |
 1272|  77.9M|        if (s->high_water < curr) {
  ------------------
  |  Branch (1272:13): [True: 3.46k, False: 77.9M]
  ------------------
 1273|       |            /* Previous high water mark below current data -- zero WIN_INIT
 1274|       |             * bytes or up to end of window, whichever is less.
 1275|       |             */
 1276|  3.46k|            init = s->window_size - curr;
 1277|  3.46k|            if (init > WIN_INIT)
  ------------------
  |  |  396|  3.46k|#define WIN_INIT STD_MAX_MATCH
  |  |  ------------------
  |  |  |  |   57|  3.46k|#define STD_MAX_MATCH  258
  |  |  ------------------
  ------------------
  |  Branch (1277:17): [True: 3.46k, False: 0]
  ------------------
 1278|  3.46k|                init = WIN_INIT;
  ------------------
  |  |  396|  3.46k|#define WIN_INIT STD_MAX_MATCH
  |  |  ------------------
  |  |  |  |   57|  3.46k|#define STD_MAX_MATCH  258
  |  |  ------------------
  ------------------
 1279|  3.46k|            memset(window + curr, 0, init);
 1280|  3.46k|            s->high_water = curr + init;
 1281|  77.9M|        } else if (s->high_water < curr + WIN_INIT) {
  ------------------
  |  |  396|  77.9M|#define WIN_INIT STD_MAX_MATCH
  |  |  ------------------
  |  |  |  |   57|  77.9M|#define STD_MAX_MATCH  258
  |  |  ------------------
  ------------------
  |  Branch (1281:20): [True: 44.2M, False: 33.7M]
  ------------------
 1282|       |            /* High water mark at or above current data, but below current data
 1283|       |             * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
 1284|       |             * to end of window, whichever is less.
 1285|       |             */
 1286|  44.2M|            init = curr + WIN_INIT - s->high_water;
  ------------------
  |  |  396|  44.2M|#define WIN_INIT STD_MAX_MATCH
  |  |  ------------------
  |  |  |  |   57|  44.2M|#define STD_MAX_MATCH  258
  |  |  ------------------
  ------------------
 1287|  44.2M|            if (init > s->window_size - s->high_water)
  ------------------
  |  Branch (1287:17): [True: 0, False: 44.2M]
  ------------------
 1288|      0|                init = s->window_size - s->high_water;
 1289|  44.2M|            memset(window + s->high_water, 0, init);
 1290|  44.2M|            s->high_water += init;
 1291|  44.2M|        }
 1292|  77.9M|    }
 1293|       |
 1294|   267M|    Assert((unsigned long)s->strstart <= s->window_size - MIN_LOOKAHEAD,
 1295|   267M|           "not enough room for search");
 1296|   267M|}
deflate.c:deflateStateCheck:
  399|   263M|static int deflateStateCheck(PREFIX3(stream) *strm) {
  400|   263M|    deflate_state *s;
  401|   263M|    if (strm == NULL || strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
  ------------------
  |  Branch (401:9): [True: 0, False: 263M]
  |  Branch (401:25): [True: 0, False: 263M]
  |  Branch (401:58): [True: 0, False: 263M]
  ------------------
  402|      0|        return 1;
  403|   263M|    s = strm->state;
  404|   263M|    if (s == NULL || s->alloc_bufs == NULL || s->strm != strm || (s->status < INIT_STATE || s->status > MAX_STATE))
  ------------------
  |  |   66|   527M|#define INIT_STATE      1    /* zlib header -> BUSY_STATE */
  ------------------
                  if (s == NULL || s->alloc_bufs == NULL || s->strm != strm || (s->status < INIT_STATE || s->status > MAX_STATE))
  ------------------
  |  |   77|   263M|#  define MAX_STATE     HCRC_STATE
  |  |  ------------------
  |  |  |  |   72|   263M|#  define HCRC_STATE    8    /* gzip header CRC -> BUSY_STATE */
  |  |  ------------------
  ------------------
  |  Branch (404:9): [True: 0, False: 263M]
  |  Branch (404:22): [True: 0, False: 263M]
  |  Branch (404:47): [True: 0, False: 263M]
  |  Branch (404:67): [True: 0, False: 263M]
  |  Branch (404:93): [True: 0, False: 263M]
  ------------------
  405|      0|        return 1;
  406|   263M|    return 0;
  407|   263M|}
deflate.c:deflateHeaders:
  765|  3.46k|static int deflateHeaders(deflate_state *s, PREFIX3(stream) *strm) {
  766|  3.46k|    if (s->status == INIT_STATE) {
  ------------------
  |  |   66|  3.46k|#define INIT_STATE      1    /* zlib header -> BUSY_STATE */
  ------------------
  |  Branch (766:9): [True: 3.46k, False: 0]
  ------------------
  767|       |        /* zlib header */
  768|  3.46k|        unsigned int header = (Z_DEFLATED + ((W_BITS(s)-8)<<4)) << 8;
  ------------------
  |  |  212|  3.46k|#define Z_DEFLATED   8
  ------------------
                      unsigned int header = (Z_DEFLATED + ((W_BITS(s)-8)<<4)) << 8;
  ------------------
  |  |  393|  3.46k|#define W_BITS(s)  zng_ctz32((s)->w_size)
  ------------------
  769|  3.46k|        unsigned int level_flags;
  770|       |
  771|  3.46k|        if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
  ------------------
  |  |  200|  6.92k|#define Z_HUFFMAN_ONLY        2
  ------------------
  |  Branch (771:13): [True: 0, False: 3.46k]
  |  Branch (771:46): [True: 0, False: 3.46k]
  ------------------
  772|      0|            level_flags = 0;
  773|  3.46k|        else if (s->level < 6)
  ------------------
  |  Branch (773:18): [True: 0, False: 3.46k]
  ------------------
  774|      0|            level_flags = 1;
  775|  3.46k|        else if (s->level == 6)
  ------------------
  |  Branch (775:18): [True: 3.46k, False: 0]
  ------------------
  776|  3.46k|            level_flags = 2;
  777|      0|        else
  778|      0|            level_flags = 3;
  779|  3.46k|        header |= (level_flags << 6);
  780|  3.46k|        if (s->strstart != 0)
  ------------------
  |  Branch (780:13): [True: 0, False: 3.46k]
  ------------------
  781|      0|            header |= PRESET_DICT;
  ------------------
  |  |   63|      0|#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
  ------------------
  782|  3.46k|        header += 31 - (header % 31);
  783|       |
  784|  3.46k|        put_short_msb(s, (uint16_t)header);
  785|       |
  786|       |        /* Save the adler32 of the preset dictionary: */
  787|  3.46k|        if (s->strstart != 0)
  ------------------
  |  Branch (787:13): [True: 0, False: 3.46k]
  ------------------
  788|      0|            put_uint32_msb(s, strm->adler);
  789|  3.46k|        strm->adler = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   65|  3.46k|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
  790|  3.46k|        s->status = BUSY_STATE;
  ------------------
  |  |   74|  3.46k|#define BUSY_STATE      2    /* deflate -> FINISH_STATE */
  ------------------
  791|       |
  792|       |        /* Compression must start with an empty pending buffer */
  793|  3.46k|        PREFIX(flush_pending)(strm);
  ------------------
  |  |  117|  3.46k|#  define PREFIX(x) zng_ ## x
  ------------------
  794|  3.46k|        if (s->pending != 0) {
  ------------------
  |  Branch (794:13): [True: 3.46k, False: 0]
  ------------------
  795|  3.46k|            s->last_flush = -1;
  796|  3.46k|            return Z_OK;
  ------------------
  |  |  180|  3.46k|#define Z_OK            0
  ------------------
  797|  3.46k|        }
  798|  3.46k|    }
  799|      0|#ifdef GZIP
  800|      0|    if (s->status == GZIP_STATE) {
  ------------------
  |  |   68|      0|#  define GZIP_STATE    4    /* gzip header -> BUSY_STATE | EXTRA_STATE */
  ------------------
  |  Branch (800:9): [True: 0, False: 0]
  ------------------
  801|       |        /* gzip header */
  802|      0|        strm->adler = CRC32_INITIAL_VALUE;
  ------------------
  |  |   66|      0|#define CRC32_INITIAL_VALUE   0 /* initial crc-32 hash value */
  ------------------
  803|      0|        put_byte(s, 31);
  ------------------
  |  |  326|      0|#define put_byte(s, c) { \
  |  |  327|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  328|      0|}
  ------------------
  804|      0|        put_byte(s, 139);
  ------------------
  |  |  326|      0|#define put_byte(s, c) { \
  |  |  327|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  328|      0|}
  ------------------
  805|      0|        put_byte(s, 8);
  ------------------
  |  |  326|      0|#define put_byte(s, c) { \
  |  |  327|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  328|      0|}
  ------------------
  806|      0|        if (s->gzhead == NULL) {
  ------------------
  |  Branch (806:13): [True: 0, False: 0]
  ------------------
  807|      0|            put_uint32(s, 0);
  808|      0|            put_byte(s, 0);
  ------------------
  |  |  326|      0|#define put_byte(s, c) { \
  |  |  327|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  328|      0|}
  ------------------
  809|      0|            put_byte(s, s->level == 9 ? 2 :
  ------------------
  |  |  326|      0|#define put_byte(s, c) { \
  |  |  327|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  ------------------
  |  |  |  Branch (327:52): [True: 0, False: 0]
  |  |  |  Branch (327:52): [True: 0, False: 0]
  |  |  |  Branch (327:52): [True: 0, False: 0]
  |  |  ------------------
  |  |  328|      0|}
  ------------------
  810|      0|                     (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? 4 : 0));
  811|      0|            put_byte(s, OS_CODE);
  ------------------
  |  |  326|      0|#define put_byte(s, c) { \
  |  |  327|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  328|      0|}
  ------------------
  812|      0|            s->status = BUSY_STATE;
  ------------------
  |  |   74|      0|#define BUSY_STATE      2    /* deflate -> FINISH_STATE */
  ------------------
  813|       |
  814|       |            /* Compression must start with an empty pending buffer */
  815|      0|            PREFIX(flush_pending)(strm);
  ------------------
  |  |  117|      0|#  define PREFIX(x) zng_ ## x
  ------------------
  816|      0|            if (s->pending != 0) {
  ------------------
  |  Branch (816:17): [True: 0, False: 0]
  ------------------
  817|      0|                s->last_flush = -1;
  818|      0|                return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
  819|      0|            }
  820|      0|        } else {
  821|      0|            put_byte(s, (s->gzhead->text ? 1 : 0) +
  ------------------
  |  |  326|      0|#define put_byte(s, c) { \
  |  |  327|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  ------------------
  |  |  |  Branch (327:52): [True: 0, False: 0]
  |  |  |  Branch (327:52): [True: 0, False: 0]
  |  |  |  Branch (327:52): [True: 0, False: 0]
  |  |  |  Branch (327:52): [True: 0, False: 0]
  |  |  |  Branch (327:52): [True: 0, False: 0]
  |  |  ------------------
  |  |  328|      0|}
  ------------------
  822|      0|                     (s->gzhead->hcrc ? 2 : 0) +
  823|      0|                     (s->gzhead->extra == NULL ? 0 : 4) +
  824|      0|                     (s->gzhead->name == NULL ? 0 : 8) +
  825|      0|                     (s->gzhead->comment == NULL ? 0 : 16)
  826|      0|                     );
  827|      0|            put_uint32(s, s->gzhead->time);
  828|      0|            put_byte(s, s->level == 9 ? 2 : (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? 4 : 0));
  ------------------
  |  |  326|      0|#define put_byte(s, c) { \
  |  |  327|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  ------------------
  |  |  |  Branch (327:52): [True: 0, False: 0]
  |  |  |  Branch (327:52): [True: 0, False: 0]
  |  |  |  Branch (327:52): [True: 0, False: 0]
  |  |  ------------------
  |  |  328|      0|}
  ------------------
  829|      0|            put_byte(s, s->gzhead->os & 0xff);
  ------------------
  |  |  326|      0|#define put_byte(s, c) { \
  |  |  327|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  328|      0|}
  ------------------
  830|      0|            if (s->gzhead->extra != NULL)
  ------------------
  |  Branch (830:17): [True: 0, False: 0]
  ------------------
  831|      0|                put_short(s, (uint16_t)s->gzhead->extra_len);
  832|      0|            if (s->gzhead->hcrc)
  ------------------
  |  Branch (832:17): [True: 0, False: 0]
  ------------------
  833|      0|                strm->adler = crc32_small((uint32_t)strm->adler, s->pending_buf, s->pending);
  834|      0|            s->gzindex = 0;
  835|      0|            s->status = EXTRA_STATE;
  ------------------
  |  |   69|      0|#  define EXTRA_STATE   5    /* gzip extra block -> NAME_STATE */
  ------------------
  836|      0|        }
  837|      0|    }
  838|      0|    if (s->status == EXTRA_STATE) {
  ------------------
  |  |   69|      0|#  define EXTRA_STATE   5    /* gzip extra block -> NAME_STATE */
  ------------------
  |  Branch (838:9): [True: 0, False: 0]
  ------------------
  839|      0|        if (s->gzhead->extra != NULL) {
  ------------------
  |  Branch (839:13): [True: 0, False: 0]
  ------------------
  840|      0|            uint32_t beg = s->pending;   /* start of bytes to update crc */
  841|      0|            uint32_t left = (s->gzhead->extra_len & 0xffff) - s->gzindex;
  842|       |
  843|      0|            while (s->pending + left > s->pending_buf_size) {
  ------------------
  |  Branch (843:20): [True: 0, False: 0]
  ------------------
  844|      0|                uint32_t copy = s->pending_buf_size - s->pending;
  845|      0|                memcpy(s->pending_buf + s->pending, s->gzhead->extra + s->gzindex, copy);
  846|      0|                s->pending = s->pending_buf_size;
  847|      0|                HCRC_UPDATE(beg);
  ------------------
  |  |  757|      0|    do { \
  |  |  758|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (758:13): [True: 0, False: 0]
  |  |  |  Branch (758:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  759|      0|            strm->adler = crc32_small((uint32_t)strm->adler, s->pending_buf + (beg), s->pending - (beg)); \
  |  |  760|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (760:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  848|      0|                s->gzindex += copy;
  849|      0|                PREFIX(flush_pending)(strm);
  ------------------
  |  |  117|      0|#  define PREFIX(x) zng_ ## x
  ------------------
  850|      0|                if (s->pending != 0) {
  ------------------
  |  Branch (850:21): [True: 0, False: 0]
  ------------------
  851|      0|                    s->last_flush = -1;
  852|      0|                    return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
  853|      0|                }
  854|      0|                beg = 0;
  855|      0|                left -= copy;
  856|      0|            }
  857|      0|            memcpy(s->pending_buf + s->pending, s->gzhead->extra + s->gzindex, left);
  858|      0|            s->pending += left;
  859|      0|            HCRC_UPDATE(beg);
  ------------------
  |  |  757|      0|    do { \
  |  |  758|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (758:13): [True: 0, False: 0]
  |  |  |  Branch (758:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  759|      0|            strm->adler = crc32_small((uint32_t)strm->adler, s->pending_buf + (beg), s->pending - (beg)); \
  |  |  760|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (760:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  860|      0|            s->gzindex = 0;
  861|      0|        }
  862|      0|        s->status = NAME_STATE;
  ------------------
  |  |   70|      0|#  define NAME_STATE    6    /* gzip file name -> COMMENT_STATE */
  ------------------
  863|      0|    }
  864|      0|    if (s->status == NAME_STATE) {
  ------------------
  |  |   70|      0|#  define NAME_STATE    6    /* gzip file name -> COMMENT_STATE */
  ------------------
  |  Branch (864:9): [True: 0, False: 0]
  ------------------
  865|      0|        if (s->gzhead->name != NULL) {
  ------------------
  |  Branch (865:13): [True: 0, False: 0]
  ------------------
  866|      0|            uint32_t beg = s->pending;   /* start of bytes to update crc */
  867|      0|            unsigned char val;
  868|       |
  869|      0|            do {
  870|      0|                if (s->pending == s->pending_buf_size) {
  ------------------
  |  Branch (870:21): [True: 0, False: 0]
  ------------------
  871|      0|                    HCRC_UPDATE(beg);
  ------------------
  |  |  757|      0|    do { \
  |  |  758|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (758:13): [True: 0, False: 0]
  |  |  |  Branch (758:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  759|      0|            strm->adler = crc32_small((uint32_t)strm->adler, s->pending_buf + (beg), s->pending - (beg)); \
  |  |  760|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (760:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  872|      0|                    PREFIX(flush_pending)(strm);
  ------------------
  |  |  117|      0|#  define PREFIX(x) zng_ ## x
  ------------------
  873|      0|                    if (s->pending != 0) {
  ------------------
  |  Branch (873:25): [True: 0, False: 0]
  ------------------
  874|      0|                        s->last_flush = -1;
  875|      0|                        return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
  876|      0|                    }
  877|      0|                    beg = 0;
  878|      0|                }
  879|      0|                val = s->gzhead->name[s->gzindex++];
  880|      0|                put_byte(s, val);
  ------------------
  |  |  326|      0|#define put_byte(s, c) { \
  |  |  327|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  328|      0|}
  ------------------
  881|      0|            } while (val != 0);
  ------------------
  |  Branch (881:22): [True: 0, False: 0]
  ------------------
  882|      0|            HCRC_UPDATE(beg);
  ------------------
  |  |  757|      0|    do { \
  |  |  758|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (758:13): [True: 0, False: 0]
  |  |  |  Branch (758:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  759|      0|            strm->adler = crc32_small((uint32_t)strm->adler, s->pending_buf + (beg), s->pending - (beg)); \
  |  |  760|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (760:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  883|      0|            s->gzindex = 0;
  884|      0|        }
  885|      0|        s->status = COMMENT_STATE;
  ------------------
  |  |   71|      0|#  define COMMENT_STATE 7    /* gzip comment -> HCRC_STATE */
  ------------------
  886|      0|    }
  887|      0|    if (s->status == COMMENT_STATE) {
  ------------------
  |  |   71|      0|#  define COMMENT_STATE 7    /* gzip comment -> HCRC_STATE */
  ------------------
  |  Branch (887:9): [True: 0, False: 0]
  ------------------
  888|      0|        if (s->gzhead->comment != NULL) {
  ------------------
  |  Branch (888:13): [True: 0, False: 0]
  ------------------
  889|      0|            uint32_t beg = s->pending;  /* start of bytes to update crc */
  890|      0|            unsigned char val;
  891|       |
  892|      0|            do {
  893|      0|                if (s->pending == s->pending_buf_size) {
  ------------------
  |  Branch (893:21): [True: 0, False: 0]
  ------------------
  894|      0|                    HCRC_UPDATE(beg);
  ------------------
  |  |  757|      0|    do { \
  |  |  758|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (758:13): [True: 0, False: 0]
  |  |  |  Branch (758:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  759|      0|            strm->adler = crc32_small((uint32_t)strm->adler, s->pending_buf + (beg), s->pending - (beg)); \
  |  |  760|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (760:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  895|      0|                    PREFIX(flush_pending)(strm);
  ------------------
  |  |  117|      0|#  define PREFIX(x) zng_ ## x
  ------------------
  896|      0|                    if (s->pending != 0) {
  ------------------
  |  Branch (896:25): [True: 0, False: 0]
  ------------------
  897|      0|                        s->last_flush = -1;
  898|      0|                        return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
  899|      0|                    }
  900|      0|                    beg = 0;
  901|      0|                }
  902|      0|                val = s->gzhead->comment[s->gzindex++];
  903|      0|                put_byte(s, val);
  ------------------
  |  |  326|      0|#define put_byte(s, c) { \
  |  |  327|      0|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  328|      0|}
  ------------------
  904|      0|            } while (val != 0);
  ------------------
  |  Branch (904:22): [True: 0, False: 0]
  ------------------
  905|      0|            HCRC_UPDATE(beg);
  ------------------
  |  |  757|      0|    do { \
  |  |  758|      0|        if (s->gzhead->hcrc && s->pending > (beg)) \
  |  |  ------------------
  |  |  |  Branch (758:13): [True: 0, False: 0]
  |  |  |  Branch (758:32): [True: 0, False: 0]
  |  |  ------------------
  |  |  759|      0|            strm->adler = crc32_small((uint32_t)strm->adler, s->pending_buf + (beg), s->pending - (beg)); \
  |  |  760|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (760:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  906|      0|        }
  907|      0|        s->status = HCRC_STATE;
  ------------------
  |  |   72|      0|#  define HCRC_STATE    8    /* gzip header CRC -> BUSY_STATE */
  ------------------
  908|      0|    }
  909|      0|    if (s->status == HCRC_STATE) {
  ------------------
  |  |   72|      0|#  define HCRC_STATE    8    /* gzip header CRC -> BUSY_STATE */
  ------------------
  |  Branch (909:9): [True: 0, False: 0]
  ------------------
  910|      0|        if (s->gzhead->hcrc) {
  ------------------
  |  Branch (910:13): [True: 0, False: 0]
  ------------------
  911|      0|            if (s->pending + 2 > s->pending_buf_size) {
  ------------------
  |  Branch (911:17): [True: 0, False: 0]
  ------------------
  912|      0|                PREFIX(flush_pending)(strm);
  ------------------
  |  |  117|      0|#  define PREFIX(x) zng_ ## x
  ------------------
  913|      0|                if (s->pending != 0) {
  ------------------
  |  Branch (913:21): [True: 0, False: 0]
  ------------------
  914|      0|                    s->last_flush = -1;
  915|      0|                    return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
  916|      0|                }
  917|      0|            }
  918|      0|            put_short(s, (uint16_t)strm->adler);
  919|      0|            strm->adler = CRC32_INITIAL_VALUE;
  ------------------
  |  |   66|      0|#define CRC32_INITIAL_VALUE   0 /* initial crc-32 hash value */
  ------------------
  920|      0|        }
  921|      0|        s->status = BUSY_STATE;
  ------------------
  |  |   74|      0|#define BUSY_STATE      2    /* deflate -> FINISH_STATE */
  ------------------
  922|       |
  923|       |        /* Compression must start with an empty pending buffer */
  924|      0|        flush_pending_inline(strm);
  925|      0|        if (s->pending != 0) {
  ------------------
  |  Branch (925:13): [True: 0, False: 0]
  ------------------
  926|      0|            s->last_flush = -1;
  927|      0|            return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
  928|      0|        }
  929|      0|    }
  930|      0|#endif
  931|      0|    return -1;
  932|      0|}
deflate.c:free_deflate:
  232|  3.46k|static inline void free_deflate(PREFIX3(stream) *strm) {
  233|  3.46k|    deflate_state *state = (deflate_state *)strm->state;
  234|       |
  235|  3.46k|    if (state->alloc_bufs != NULL) {
  ------------------
  |  Branch (235:9): [True: 3.46k, False: 0]
  ------------------
  236|  3.46k|        deflate_allocs *alloc_bufs = state->alloc_bufs;
  237|  3.46k|        alloc_bufs->zfree(strm->opaque, alloc_bufs->buf_start);
  238|       |        strm->state = NULL;
  239|  3.46k|    }
  240|  3.46k|}
deflate.c:lm_set_level:
 1142|  3.46k|static void lm_set_level(deflate_state *s, int level) {
 1143|  3.46k|    s->max_lazy_match   = configuration_table[level].max_lazy;
 1144|  3.46k|    s->good_match       = configuration_table[level].good_length;
 1145|  3.46k|    s->nice_match       = configuration_table[level].nice_length;
 1146|  3.46k|    s->max_chain_length = configuration_table[level].max_chain;
 1147|  3.46k|    s->level = level;
 1148|  3.46k|}
deflate.c:lm_init:
 1153|  3.46k|static void lm_init(deflate_state *s) {
 1154|  3.46k|    s->window_size = 2 * s->w_size;
 1155|       |
 1156|  3.46k|    CLEAR_HASH(s);
  ------------------
  |  |  145|  3.46k|#define CLEAR_HASH(s) do { \
  |  |  146|  3.46k|    memset((unsigned char *)s->head, 0, HASH_SIZE * sizeof(*s->head)); \
  |  |  ------------------
  |  |  |  |   85|  3.46k|#  define HASH_SIZE 65536u         /* number of elements in hash table */
  |  |  ------------------
  |  |  147|  3.46k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (147:12): [Folded, False: 3.46k]
  |  |  ------------------
  ------------------
 1157|       |
 1158|       |    /* Set the default configuration parameters:
 1159|       |     */
 1160|  3.46k|    lm_set_level(s, s->level);
 1161|       |
 1162|  3.46k|    s->strstart = 0;
 1163|  3.46k|    s->block_start = 0;
 1164|  3.46k|    s->lookahead = 0;
 1165|  3.46k|    s->insert = 0;
 1166|  3.46k|    s->prev_length = 0;
 1167|  3.46k|    s->match_available = 0;
 1168|  3.46k|    s->match_start = 0;
 1169|  3.46k|    s->ins_h = 0;
 1170|  3.46k|}

deflate.c:put_short_msb:
  344|  3.46k|static inline void put_short_msb(deflate_state *s, uint16_t w) {
  345|  3.46k|    w = Z_U16_TO_BE(w);
  ------------------
  |  |   67|  3.46k|#  define Z_U16_TO_BE(x)    ZSWAP16(x)
  |  |  ------------------
  |  |  |  |  209|  3.46k|#  define ZSWAP16(q) __builtin_bswap16(q)
  |  |  ------------------
  ------------------
  346|  3.46k|    zng_memwrite_2(&s->pending_buf[s->pending], w);
  347|  3.46k|    s->pending += 2;
  348|  3.46k|}
deflate.c:put_uint32_msb:
  364|  3.46k|static inline void put_uint32_msb(deflate_state *s, uint32_t dw) {
  365|  3.46k|    dw = Z_U32_TO_BE(dw);
  ------------------
  |  |   68|  3.46k|#  define Z_U32_TO_BE(x)    ZSWAP32(x)
  |  |  ------------------
  |  |  |  |  210|  3.46k|#  define ZSWAP32(q) __builtin_bswap32(q)
  |  |  ------------------
  ------------------
  366|  3.46k|    zng_memwrite_4(&s->pending_buf[s->pending], dw);
  367|  3.46k|    s->pending += 4;
  368|  3.46k|}
trees.c:put_uint64:
  374|  11.6M|static inline void put_uint64(deflate_state *s, uint64_t lld) {
  375|  11.6M|    lld = Z_U64_TO_LE(lld);
  ------------------
  |  |   63|  11.6M|#  define Z_U64_TO_LE(x)    (x)
  ------------------
  376|  11.6M|    zng_memwrite_8(&s->pending_buf[s->pending], lld);
  377|  11.6M|    s->pending += 8;
  378|  11.6M|}
trees.c:put_short:
  334|  7.73k|static inline void put_short(deflate_state *s, uint16_t w) {
  335|  7.73k|    w = Z_U16_TO_LE(w);
  ------------------
  |  |   61|  7.73k|#  define Z_U16_TO_LE(x)    (x)
  ------------------
  336|  7.73k|    zng_memwrite_2(&s->pending_buf[s->pending], w);
  337|  7.73k|    s->pending += 2;
  338|  7.73k|}
trees.c:put_uint32:
  354|  4.32k|static inline void put_uint32(deflate_state *s, uint32_t dw) {
  355|  4.32k|    dw = Z_U32_TO_LE(dw);
  ------------------
  |  |   62|  4.32k|#  define Z_U32_TO_LE(x)    (x)
  ------------------
  356|  4.32k|    zng_memwrite_4(&s->pending_buf[s->pending], dw);
  357|  4.32k|    s->pending += 4;
  358|  4.32k|}

deflate_medium:
  178|   148M|Z_INTERNAL block_state deflate_medium(deflate_state *s, int flush) {
  179|       |    /* Align the first struct to start on a new cacheline, this allows us to fit both structs in one cacheline */
  180|   148M|    ALIGNED_(16) struct match current_match = {0};
  ------------------
  |  |  262|   148M|#  define ALIGNED_(x) __attribute__ ((aligned(x)))
  ------------------
  181|   148M|                 struct match next_match = {0};
  182|   148M|    unsigned char *window = s->window;
  183|       |
  184|       |    /* For levels below 5, don't check the next position for a better match */
  185|   148M|    int early_exit = s->level < 5;
  186|       |
  187|   267M|    for (;;) {
  188|   267M|        uint32_t hash_head = 0;    /* head of the hash chain */
  189|   267M|        int bflush = 0;       /* set if current block must be flushed */
  190|       |
  191|       |        /* Make sure that we always have enough lookahead, except
  192|       |         * at the end of the input file. We need STD_MAX_MATCH bytes
  193|       |         * for the next match, plus WANT_MIN_MATCH bytes to insert the
  194|       |         * string following the next current_match.
  195|       |         */
  196|   267M|        if (s->lookahead < MIN_LOOKAHEAD) {
  ------------------
  |  |  380|   267M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  ------------------
  |  |  |  |   57|   267M|#define STD_MAX_MATCH  258
  |  |  ------------------
  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  ------------------
  |  |  |  |   56|   267M|#define STD_MIN_MATCH  3
  |  |  ------------------
  ------------------
  |  Branch (196:13): [True: 267M, False: 0]
  ------------------
  197|   267M|            PREFIX(fill_window)(s);
  ------------------
  |  |  117|   267M|#  define PREFIX(x) zng_ ## x
  ------------------
  198|   267M|            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
  ------------------
  |  |  380|   535M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  ------------------
  |  |  |  |   57|   267M|#define STD_MAX_MATCH  258
  |  |  ------------------
  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  ------------------
  |  |  |  |   56|   267M|#define STD_MIN_MATCH  3
  |  |  ------------------
  ------------------
                          if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
  ------------------
  |  |  171|   149M|#define Z_NO_FLUSH      0
  ------------------
  |  Branch (198:17): [True: 149M, False: 118M]
  |  Branch (198:49): [True: 148M, False: 314k]
  ------------------
  199|   148M|                return need_more;
  200|   148M|            }
  201|   119M|            if (UNLIKELY(s->lookahead == 0))
  ------------------
  |  |  254|   119M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 3.46k, False: 119M]
  |  |  ------------------
  ------------------
  202|  3.46k|                break; /* flush the current block */
  203|   119M|            next_match.match_length = 0;
  204|   119M|        }
  205|       |
  206|       |        /* Insert the string window[strstart .. strstart+2] in the
  207|       |         * dictionary, and set hash_head to the head of the hash chain:
  208|       |         */
  209|       |
  210|       |        /* If we already have a future match from a previous round, just use that */
  211|   119M|        if (!early_exit && next_match.match_length > 0) {
  ------------------
  |  Branch (211:13): [True: 119M, False: 0]
  |  Branch (211:28): [True: 0, False: 119M]
  ------------------
  212|      0|            current_match = next_match;
  213|      0|            next_match.match_length = 0;
  214|   119M|        } else {
  215|   119M|            hash_head = 0;
  216|   119M|            if (s->lookahead >= WANT_MIN_MATCH) {
  ------------------
  |  |   60|   119M|#define WANT_MIN_MATCH  4
  ------------------
  |  Branch (216:17): [True: 119M, False: 6.50k]
  ------------------
  217|   119M|                hash_head = quick_insert_string(s, window, s->strstart);
  218|   119M|            }
  219|       |
  220|   119M|            current_match = find_best_match(s, hash_head);
  221|   119M|        }
  222|       |
  223|   119M|        if (LIKELY(s->lookahead > (unsigned int)(current_match.match_length + WANT_MIN_MATCH)))
  ------------------
  |  |  253|   119M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 119M, False: 69.5k]
  |  |  ------------------
  ------------------
  224|   119M|            insert_match(s, window, current_match);
  225|       |
  226|       |        /* now, look ahead one */
  227|   119M|        if (LIKELY(!early_exit && s->lookahead > MIN_LOOKAHEAD && (uint32_t)(current_match.strstart + current_match.match_length) < (s->window_size - MIN_LOOKAHEAD))) {
  ------------------
  |  |  253|   357M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 0, False: 119M]
  |  |  |  Branch (253:53): [True: 119M, False: 0]
  |  |  |  Branch (253:53): [True: 0, False: 119M]
  |  |  |  Branch (253:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  228|      0|            s->strstart = current_match.strstart + current_match.match_length;
  229|      0|            hash_head = quick_insert_string(s, window, s->strstart);
  230|       |
  231|      0|            next_match = find_best_match(s, hash_head);
  232|       |
  233|      0|            uint32_t tmp_cmatch_len_sub = current_match.match_length - 1;
  234|      0|            if (tmp_cmatch_len_sub
  ------------------
  |  Branch (234:17): [True: 0, False: 0]
  ------------------
  235|      0|                     && next_match.match_length >= WANT_MIN_MATCH
  ------------------
  |  |   60|      0|#define WANT_MIN_MATCH  4
  ------------------
  |  Branch (235:25): [True: 0, False: 0]
  ------------------
  236|      0|                     && tmp_cmatch_len_sub <= next_match.match_start
  ------------------
  |  Branch (236:25): [True: 0, False: 0]
  ------------------
  237|      0|                     && tmp_cmatch_len_sub <= next_match.strstart) {
  ------------------
  |  Branch (237:25): [True: 0, False: 0]
  ------------------
  238|      0|                fizzle_matches(s, window, &current_match, &next_match);
  239|      0|            }
  240|       |
  241|      0|            s->strstart = current_match.strstart;
  242|   119M|        } else {
  243|   119M|            next_match.match_length = 0;
  244|   119M|        }
  245|       |
  246|       |        /* now emit the current match */
  247|   119M|        bflush = emit_match(s, window, current_match);
  248|       |
  249|       |        /* move the "cursor" forward */
  250|   119M|        s->strstart += current_match.match_length;
  251|       |
  252|   119M|        if (UNLIKELY(bflush))
  ------------------
  |  |  254|   119M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 7.00k, False: 119M]
  |  |  ------------------
  ------------------
  253|   119M|            FLUSH_BLOCK(s, window, 0);
  ------------------
  |  |  200|  7.00k|#define FLUSH_BLOCK(s, window, last) { \
  |  |  201|  7.00k|    FLUSH_BLOCK_ONLY(s, window, last); \
  |  |  ------------------
  |  |  |  |  188|  7.00k|#define FLUSH_BLOCK_ONLY(s, window, last) { \
  |  |  |  |  189|  7.00k|    int block_start = s->block_start; \
  |  |  |  |  190|  7.00k|    zng_tr_flush_block(s, (block_start >= 0 ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (190:28): [True: 6.86k, False: 147]
  |  |  |  |  ------------------
  |  |  |  |  191|  7.00k|                   &window[(unsigned)block_start] : \
  |  |  |  |  192|  7.00k|                   NULL), \
  |  |  |  |  193|  7.00k|                   (uint32_t)((int)s->strstart - block_start), \
  |  |  |  |  194|  7.00k|                   (last)); \
  |  |  |  |  195|  7.00k|    s->block_start = (int)s->strstart; \
  |  |  |  |  196|  7.00k|    PREFIX(flush_pending)(s->strm); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  7.00k|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  197|  7.00k|}
  |  |  ------------------
  |  |  202|  7.00k|    if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (202:9): [True: 7.00k, False: 0]
  |  |  |  Branch (202:41): [Folded, False: 7.00k]
  |  |  ------------------
  |  |  203|  7.00k|}
  ------------------
  254|   119M|    }
  255|  3.46k|    s->insert = s->strstart < (STD_MIN_MATCH - 1) ? s->strstart : (STD_MIN_MATCH - 1);
  ------------------
  |  |   56|  3.46k|#define STD_MIN_MATCH  3
  ------------------
                  s->insert = s->strstart < (STD_MIN_MATCH - 1) ? s->strstart : (STD_MIN_MATCH - 1);
  ------------------
  |  |   56|  3.42k|#define STD_MIN_MATCH  3
  ------------------
  |  Branch (255:17): [True: 33, False: 3.42k]
  ------------------
  256|  3.46k|    if (flush == Z_FINISH) {
  ------------------
  |  |  175|  3.46k|#define Z_FINISH        4
  ------------------
  |  Branch (256:9): [True: 3.46k, False: 0]
  ------------------
  257|  3.46k|        FLUSH_BLOCK(s, window, 1);
  ------------------
  |  |  200|  3.46k|#define FLUSH_BLOCK(s, window, last) { \
  |  |  201|  3.46k|    FLUSH_BLOCK_ONLY(s, window, last); \
  |  |  ------------------
  |  |  |  |  188|  3.46k|#define FLUSH_BLOCK_ONLY(s, window, last) { \
  |  |  |  |  189|  3.46k|    int block_start = s->block_start; \
  |  |  |  |  190|  3.46k|    zng_tr_flush_block(s, (block_start >= 0 ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (190:28): [True: 3.40k, False: 55]
  |  |  |  |  ------------------
  |  |  |  |  191|  3.46k|                   &window[(unsigned)block_start] : \
  |  |  |  |  192|  3.46k|                   NULL), \
  |  |  |  |  193|  3.46k|                   (uint32_t)((int)s->strstart - block_start), \
  |  |  |  |  194|  3.46k|                   (last)); \
  |  |  |  |  195|  3.46k|    s->block_start = (int)s->strstart; \
  |  |  |  |  196|  3.46k|    PREFIX(flush_pending)(s->strm); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  3.46k|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  197|  3.46k|}
  |  |  ------------------
  |  |  202|  3.46k|    if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (202:9): [True: 3.46k, False: 0]
  |  |  |  Branch (202:41): [True: 3.46k, Folded]
  |  |  ------------------
  |  |  203|  3.46k|}
  ------------------
  258|      0|        return finish_done;
  259|  3.46k|    }
  260|      0|    if (UNLIKELY(s->sym_next))
  ------------------
  |  |  254|      0|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  261|      0|        FLUSH_BLOCK(s, window, 0);
  ------------------
  |  |  200|      0|#define FLUSH_BLOCK(s, window, last) { \
  |  |  201|      0|    FLUSH_BLOCK_ONLY(s, window, last); \
  |  |  ------------------
  |  |  |  |  188|      0|#define FLUSH_BLOCK_ONLY(s, window, last) { \
  |  |  |  |  189|      0|    int block_start = s->block_start; \
  |  |  |  |  190|      0|    zng_tr_flush_block(s, (block_start >= 0 ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (190:28): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  191|      0|                   &window[(unsigned)block_start] : \
  |  |  |  |  192|      0|                   NULL), \
  |  |  |  |  193|      0|                   (uint32_t)((int)s->strstart - block_start), \
  |  |  |  |  194|      0|                   (last)); \
  |  |  |  |  195|      0|    s->block_start = (int)s->strstart; \
  |  |  |  |  196|      0|    PREFIX(flush_pending)(s->strm); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|      0|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  197|      0|}
  |  |  ------------------
  |  |  202|      0|    if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (202:9): [True: 0, False: 0]
  |  |  |  Branch (202:41): [Folded, False: 0]
  |  |  ------------------
  |  |  203|      0|}
  ------------------
  262|       |
  263|      0|    return block_done;
  264|      0|}
deflate_medium.c:find_best_match:
   93|   119M|Z_FORCEINLINE static struct match find_best_match(deflate_state *s, uint32_t hash_head) {
   94|   119M|    struct match m;
   95|   119M|    int64_t dist;
   96|       |
   97|   119M|    m.strstart = (uint16_t)s->strstart;
   98|   119M|    m.orgstart = m.strstart;
   99|       |
  100|   119M|    dist = (int64_t)s->strstart - hash_head;
  101|   119M|    if (dist <= MAX_DIST(s) && dist > 0 && hash_head != 0) {
  ------------------
  |  |  385|   238M|#define MAX_DIST(s)  ((s)->w_size - MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  380|   119M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   57|   119M|#define STD_MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|   119M|#define STD_MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (101:9): [True: 58.7M, False: 60.3M]
  |  Branch (101:32): [True: 58.7M, False: 3.46k]
  |  Branch (101:44): [True: 41.7M, False: 16.9M]
  ------------------
  102|       |        /* To simplify the code, we prevent matches with the string
  103|       |         * of window index 0 (in particular we have to avoid a match
  104|       |         * of the string with itself at the start of the input file).
  105|       |         */
  106|  41.7M|        m.match_length = (uint16_t)FUNCTABLE_CALL(longest_match)(s, hash_head);
  ------------------
  |  |   45|  41.7M|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
  107|  41.7M|        m.match_start = (uint16_t)s->match_start;
  108|  41.7M|        if (UNLIKELY(m.match_length < WANT_MIN_MATCH))
  ------------------
  |  |  254|  41.7M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 39.6M, False: 2.10M]
  |  |  ------------------
  ------------------
  109|  39.6M|            m.match_length = 1;
  110|  41.7M|        if (UNLIKELY(m.match_start >= m.strstart)) {
  ------------------
  |  |  254|  41.7M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 41.7M]
  |  |  ------------------
  ------------------
  111|       |            /* this can happen due to some restarts */
  112|      0|            m.match_length = 1;
  113|      0|        }
  114|  77.3M|    } else {
  115|       |        /* Set up the match to be a 1 byte literal */
  116|  77.3M|        m.match_start = 0;
  117|  77.3M|        m.match_length = 1;
  118|  77.3M|    }
  119|       |
  120|   119M|    return m;
  121|   119M|}
deflate_medium.c:insert_match:
   47|   119M|static void insert_match(deflate_state *s, unsigned char *window, struct match match) {
   48|   119M|    uint32_t match_len = match.match_length;
   49|   119M|    uint32_t strstart = match.strstart;
   50|       |
   51|       |    /* matches that are not long enough we need to emit as literals */
   52|   119M|    if (LIKELY(match_len < WANT_MIN_MATCH)) {
  ------------------
  |  |  253|   119M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 116M, False: 2.04M]
  |  |  ------------------
  ------------------
   53|   116M|        strstart++;
   54|   116M|        match_len--;
   55|   116M|        if (UNLIKELY(match_len > 0)) {
  ------------------
  |  |  254|   116M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 116M]
  |  |  ------------------
  ------------------
   56|      0|            if (strstart >= match.orgstart) {
  ------------------
  |  Branch (56:17): [True: 0, False: 0]
  ------------------
   57|      0|                if (strstart + match_len - 1 >= match.orgstart) {
  ------------------
  |  Branch (57:21): [True: 0, False: 0]
  ------------------
   58|      0|                    insert_string(s, window, strstart, match_len);
   59|      0|                } else {
   60|      0|                    insert_string(s, window, strstart, match.orgstart - strstart + 1);
   61|      0|                }
   62|      0|            }
   63|      0|        }
   64|   116M|        return;
   65|   116M|    }
   66|       |
   67|       |    /* Insert new strings in the hash table only if the match length
   68|       |     * is not too large. This saves time but degrades compression.
   69|       |     */
   70|  2.04M|    if (match_len <= 16 * s->max_insert_length && s->lookahead >= WANT_MIN_MATCH) {
  ------------------
  |  |  220|  4.09M|#   define max_insert_length  max_lazy_match
  ------------------
                  if (match_len <= 16 * s->max_insert_length && s->lookahead >= WANT_MIN_MATCH) {
  ------------------
  |  |   60|  2.04M|#define WANT_MIN_MATCH  4
  ------------------
  |  Branch (70:9): [True: 2.04M, False: 471]
  |  Branch (70:51): [True: 2.04M, False: 0]
  ------------------
   71|  2.04M|        match_len--; /* string at strstart already in table */
   72|  2.04M|        strstart++;
   73|       |
   74|  2.04M|        if (LIKELY(strstart >= match.orgstart)) {
  ------------------
  |  |  253|  2.04M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 2.04M, False: 0]
  |  |  ------------------
  ------------------
   75|  2.04M|            if (LIKELY(strstart + match_len - 1 >= match.orgstart)) {
  ------------------
  |  |  253|  2.04M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 2.04M, False: 0]
  |  |  ------------------
  ------------------
   76|  2.04M|                insert_string(s, window, strstart, match_len);
   77|  2.04M|            } else {
   78|      0|                insert_string(s, window, strstart, match.orgstart - strstart + 1);
   79|      0|            }
   80|  2.04M|        } else if (match.orgstart < strstart + match_len) {
  ------------------
  |  Branch (80:20): [True: 0, False: 0]
  ------------------
   81|      0|            insert_string(s, window, match.orgstart, strstart + match_len - match.orgstart);
   82|      0|        }
   83|  2.04M|    } else {
   84|    471|        strstart += match_len;
   85|    471|        quick_insert_string(s, window, strstart + 2 - STD_MIN_MATCH);
  ------------------
  |  |   56|    471|#define STD_MIN_MATCH  3
  ------------------
   86|       |
   87|       |        /* If lookahead < WANT_MIN_MATCH, ins_h is garbage, but it does not
   88|       |         * matter since it will be recomputed at next deflate call.
   89|       |         */
   90|    471|    }
   91|  2.04M|}
deflate_medium.c:emit_match:
   23|   119M|static int emit_match(deflate_state *s, unsigned char *window, struct match match) {
   24|   119M|    int bflush = 0;
   25|   119M|    uint32_t match_len = match.match_length;
   26|       |
   27|       |    /* None of the below functions care about s->lookahead, so decrement it early */
   28|   119M|    s->lookahead -= match_len;
   29|       |
   30|       |    /* matches that are not long enough we need to emit as literals */
   31|   119M|    if (match_len < WANT_MIN_MATCH) {
  ------------------
  |  |   60|   119M|#define WANT_MIN_MATCH  4
  ------------------
  |  Branch (31:9): [True: 116M, False: 2.10M]
  ------------------
   32|   233M|        while (match_len) {
  ------------------
  |  Branch (32:16): [True: 116M, False: 116M]
  ------------------
   33|   116M|            bflush += zng_tr_tally_lit(s, window[match.strstart]);
   34|   116M|            match_len--;
   35|   116M|            match.strstart++;
   36|   116M|        }
   37|   116M|        return bflush;
   38|   116M|    }
   39|       |
   40|  2.10M|    check_match(s, match.strstart, match.match_start, match_len);
   41|       |
   42|  2.10M|    bflush += zng_tr_tally_dist(s, match.strstart - match.match_start, match_len - STD_MIN_MATCH);
  ------------------
  |  |   56|  2.10M|#define STD_MIN_MATCH  3
  ------------------
   43|  2.10M|    return bflush;
   44|   119M|}

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

deflate.c:zng_ctz32:
   20|  3.46k|Z_FORCEINLINE static uint32_t zng_ctz32(uint32_t value) {
   21|  3.46k|    Assert(value != 0, "Invalid input value: 0");
   22|  3.46k|#if __has_builtin(__builtin_ctz)
   23|  3.46k|    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.46k|}
inftrees.c:zng_bitreverse16:
  133|  1.64M|Z_FORCEINLINE static uint16_t zng_bitreverse16(uint16_t value) {
  134|  1.64M|#if __has_builtin(__builtin_bitreverse16)
  135|  1.64M|    return (uint16_t)__builtin_bitreverse16(value);
  136|       |#elif defined(ARCH_ARM) && defined(ARCH_64BIT) && !defined(_MSC_VER)
  137|       |    /* ARM bit reversal for 16-bit values using rbit instruction */
  138|       |    uint32_t res;
  139|       |#    if __has_builtin(__builtin_rbit)
  140|       |    res = __builtin_rbit((uint32_t)value);
  141|       |#    else
  142|       |    __asm__ volatile("rbit %w0, %w1" : "=r"(res) : "r"((uint32_t)value));
  143|       |#    endif
  144|       |    return (uint16_t)(res >> 16);
  145|       |#elif defined(ARCH_LOONGARCH)
  146|       |    /* LoongArch bit reversal for 16-bit values */
  147|       |    uint32_t res;
  148|       |    __asm__ volatile("bitrev.w %0, %1" : "=r"(res) : "r"(value));
  149|       |    return (uint16_t)(res >> 16);
  150|       |#else
  151|       |    /* Bit reversal for 8-bit values using multiplication method */
  152|       |#  define bitrev8(value) \
  153|       |    (uint8_t)((((uint8_t)(value) * 0x80200802ULL) & 0x0884422110ULL) * 0x0101010101ULL >> 32)
  154|       |    /* General purpose bit reversal for 16-bit values */
  155|       |    return ((bitrev8(value >> 8) | (uint16_t)bitrev8(value) << 8));
  156|       |#  undef bitrev8
  157|       |#endif
  158|  1.64M|}
trees.c:zng_bitreverse16:
  133|  2.08M|Z_FORCEINLINE static uint16_t zng_bitreverse16(uint16_t value) {
  134|  2.08M|#if __has_builtin(__builtin_bitreverse16)
  135|  2.08M|    return (uint16_t)__builtin_bitreverse16(value);
  136|       |#elif defined(ARCH_ARM) && defined(ARCH_64BIT) && !defined(_MSC_VER)
  137|       |    /* ARM bit reversal for 16-bit values using rbit instruction */
  138|       |    uint32_t res;
  139|       |#    if __has_builtin(__builtin_rbit)
  140|       |    res = __builtin_rbit((uint32_t)value);
  141|       |#    else
  142|       |    __asm__ volatile("rbit %w0, %w1" : "=r"(res) : "r"((uint32_t)value));
  143|       |#    endif
  144|       |    return (uint16_t)(res >> 16);
  145|       |#elif defined(ARCH_LOONGARCH)
  146|       |    /* LoongArch bit reversal for 16-bit values */
  147|       |    uint32_t res;
  148|       |    __asm__ volatile("bitrev.w %0, %1" : "=r"(res) : "r"(value));
  149|       |    return (uint16_t)(res >> 16);
  150|       |#else
  151|       |    /* Bit reversal for 8-bit values using multiplication method */
  152|       |#  define bitrev8(value) \
  153|       |    (uint8_t)((((uint8_t)(value) * 0x80200802ULL) & 0x0884422110ULL) * 0x0101010101ULL >> 32)
  154|       |    /* General purpose bit reversal for 16-bit values */
  155|       |    return ((bitrev8(value >> 8) | (uint16_t)bitrev8(value) << 8));
  156|       |#  undef bitrev8
  157|       |#endif
  158|  2.08M|}
compare256_avx2.c:zng_ctz32:
   20|  2.93M|Z_FORCEINLINE static uint32_t zng_ctz32(uint32_t value) {
   21|  2.93M|    Assert(value != 0, "Invalid input value: 0");
   22|  2.93M|#if __has_builtin(__builtin_ctz)
   23|  2.93M|    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|  2.93M|}

functable.c:functable_constructor:
  441|      2|static void __attribute__((constructor)) functable_constructor(void) {
  442|      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|    };
  ------------------
  443|      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|       |#endif
   87|       |#ifdef COMPARE256_FALLBACK
   88|       |    ft.compare256 = &compare256_c;
   89|       |    ft.longest_match = &longest_match_c;
   90|       |    ft.longest_match_roll = &longest_match_roll_c;
   91|       |#endif
   92|      2|#ifdef CRC32_BRAID_FALLBACK
   93|      2|    ft.crc32 = &crc32_braid;
   94|      2|    ft.crc32_copy = &crc32_copy_braid;
   95|      2|#endif
   96|       |#ifdef SLIDE_HASH_FALLBACK
   97|       |    ft.slide_hash = &slide_hash_c;
   98|       |#endif
   99|       |
  100|       |    // Select arch-optimized functions
  101|      2|#ifdef WITH_OPTIM
  102|       |
  103|       |    // Chorba generic C fallback
  104|      2|#ifdef CRC32_CHORBA_FALLBACK
  105|      2|    ft.crc32 = &crc32_chorba;
  106|      2|    ft.crc32_copy = &crc32_copy_chorba;
  107|      2|#endif
  108|       |
  109|       |    // X86 - SSE2
  110|      2|#ifdef X86_SSE2
  111|       |#  ifndef X86_SSE2_NATIVE
  112|       |    if (cf.x86.has_sse2)
  113|       |#  endif
  114|      2|    {
  115|      2|#  ifndef X86_AVX2_NATIVE
  116|      2|        ft.chunkmemset_safe = &chunkmemset_safe_sse2;
  117|      2|        ft.compare256 = &compare256_sse2;
  118|      2|        ft.inflate_fast = &inflate_fast_sse2;
  119|      2|        ft.longest_match = &longest_match_sse2;
  120|      2|        ft.longest_match_roll = &longest_match_roll_sse2;
  121|      2|        ft.slide_hash = &slide_hash_sse2;
  122|      2|#  endif
  123|      2|#  if defined(CRC32_CHORBA_SSE_FALLBACK) && !defined(X86_SSE41_NATIVE) && !defined(X86_PCLMULQDQ_NATIVE)
  124|      2|        ft.crc32 = &crc32_chorba_sse2;
  125|      2|        ft.crc32_copy = &crc32_copy_chorba_sse2;
  126|      2|#  endif
  127|      2|    }
  128|      2|#endif
  129|       |    // X86 - SSSE3
  130|      2|#ifdef X86_SSSE3
  131|      2|#  ifndef X86_SSSE3_NATIVE
  132|      2|    if (cf.x86.has_ssse3)
  ------------------
  |  Branch (132:9): [True: 2, False: 0]
  ------------------
  133|      2|#  endif
  134|      2|    {
  135|      2|        ft.adler32 = &adler32_ssse3;
  136|      2|        ft.adler32_copy = &adler32_copy_ssse3;
  137|      2|#  ifndef X86_AVX2_NATIVE
  138|      2|        ft.chunkmemset_safe = &chunkmemset_safe_ssse3;
  139|      2|        ft.inflate_fast = &inflate_fast_ssse3;
  140|      2|#  endif
  141|      2|    }
  142|      2|#endif
  143|       |
  144|       |    // X86 - SSE4.1
  145|      2|#if defined(X86_SSE41) && !defined(X86_PCLMULQDQ_NATIVE)
  146|      2|#  ifndef X86_SSE41_NATIVE
  147|      2|    if (cf.x86.has_sse41)
  ------------------
  |  Branch (147:9): [True: 2, False: 0]
  ------------------
  148|      2|#  endif
  149|      2|    {
  150|      2|#  ifdef CRC32_CHORBA_SSE_FALLBACK
  151|      2|        ft.crc32 = &crc32_chorba_sse41;
  152|      2|        ft.crc32_copy = &crc32_copy_chorba_sse41;
  153|      2|#  endif
  154|      2|    }
  155|      2|#endif
  156|       |
  157|       |    // X86 - SSE4.2
  158|      2|#if defined(X86_SSE42) && !defined(X86_AVX512_NATIVE)
  159|      2|#  ifndef X86_SSE42_NATIVE
  160|      2|    if (cf.x86.has_sse42)
  ------------------
  |  Branch (160:9): [True: 2, False: 0]
  ------------------
  161|      2|#  endif
  162|      2|    {
  163|      2|        ft.adler32_copy = &adler32_copy_sse42;
  164|      2|    }
  165|      2|#endif
  166|       |    // X86 - PCLMUL
  167|      2|#if defined(X86_PCLMULQDQ_CRC) && !defined(X86_VPCLMULQDQ_NATIVE)
  168|      2|#  ifndef X86_PCLMULQDQ_NATIVE
  169|      2|    if (cf.x86.has_pclmulqdq)
  ------------------
  |  Branch (169:9): [True: 2, False: 0]
  ------------------
  170|      2|#  endif
  171|      2|    {
  172|      2|        ft.crc32 = &crc32_pclmulqdq;
  173|      2|        ft.crc32_copy = &crc32_copy_pclmulqdq;
  174|      2|    }
  175|      2|#endif
  176|       |    // X86 - AVX2
  177|      2|#ifdef X86_AVX2
  178|       |    /* BMI2 support is all but implicit with AVX2 but let's sanity check this just in case. Enabling BMI2 allows for
  179|       |     * flagless shifts, resulting in fewer flag stalls for the pipeline, and allows us to set destination registers
  180|       |     * for the shift results as an operand, eliminating several register-register moves when the original value needs
  181|       |     * to remain intact. They also allow for a count operand that isn't the CL register, avoiding contention there */
  182|      2|#  ifndef X86_AVX2_NATIVE
  183|      2|    if (cf.x86.has_avx2 && cf.x86.has_bmi2)
  ------------------
  |  Branch (183:9): [True: 2, False: 0]
  |  Branch (183:28): [True: 2, False: 0]
  ------------------
  184|      2|#  endif
  185|      2|    {
  186|      2|#  ifndef X86_AVX512_NATIVE
  187|      2|        ft.adler32 = &adler32_avx2;
  188|      2|        ft.adler32_copy = &adler32_copy_avx2;
  189|      2|        ft.chunkmemset_safe = &chunkmemset_safe_avx2;
  190|      2|        ft.compare256 = &compare256_avx2;
  191|      2|        ft.inflate_fast = &inflate_fast_avx2;
  192|      2|        ft.longest_match = &longest_match_avx2;
  193|      2|        ft.longest_match_roll = &longest_match_roll_avx2;
  194|      2|#  endif
  195|      2|        ft.slide_hash = &slide_hash_avx2;
  196|      2|    }
  197|      2|#endif
  198|       |    // X86 - AVX512 (F,DQ,BW,Vl)
  199|      2|#ifdef X86_AVX512
  200|      2|#  ifndef X86_AVX512_NATIVE
  201|      2|    if (cf.x86.has_avx512_common)
  ------------------
  |  Branch (201:9): [True: 0, False: 2]
  ------------------
  202|      0|#  endif
  203|      0|    {
  204|      0|#  ifndef X86_AVX512VNNI_NATIVE
  205|      0|        ft.adler32 = &adler32_avx512;
  206|      0|        ft.adler32_copy = &adler32_copy_avx512;
  207|      0|#  endif
  208|      0|        ft.chunkmemset_safe = &chunkmemset_safe_avx512;
  209|      0|        ft.compare256 = &compare256_avx512;
  210|      0|        ft.inflate_fast = &inflate_fast_avx512;
  211|      0|        ft.longest_match = &longest_match_avx512;
  212|      0|        ft.longest_match_roll = &longest_match_roll_avx512;
  213|      0|    }
  214|      2|#endif
  215|      2|#ifdef X86_AVX512VNNI
  216|      2|#  ifndef X86_AVX512VNNI_NATIVE
  217|      2|    if (cf.x86.has_avx512vnni)
  ------------------
  |  Branch (217:9): [True: 0, False: 2]
  ------------------
  218|      0|#  endif
  219|      0|    {
  220|      0|        ft.adler32 = &adler32_avx512_vnni;
  221|      0|        ft.adler32_copy = &adler32_copy_avx512_vnni;
  222|      0|    }
  223|      2|#endif
  224|       |    // X86 - VPCLMULQDQ (AVX2)
  225|      2|#ifdef X86_VPCLMULQDQ_AVX2
  226|      2|#  ifndef X86_VPCLMULQDQ_AVX2_NATIVE
  227|      2|    if (cf.x86.has_pclmulqdq && cf.x86.has_avx2 && cf.x86.has_vpclmulqdq)
  ------------------
  |  Branch (227:9): [True: 2, False: 0]
  |  Branch (227:33): [True: 2, False: 0]
  |  Branch (227:52): [True: 0, False: 2]
  ------------------
  228|      0|#  endif
  229|      0|    {
  230|      0|        ft.crc32 = &crc32_vpclmulqdq_avx2;
  231|      0|        ft.crc32_copy = &crc32_copy_vpclmulqdq_avx2;
  232|      0|    }
  233|      2|#endif
  234|       |    // X86 - VPCLMULQDQ (AVX-512)
  235|      2|#ifdef X86_VPCLMULQDQ_AVX512
  236|      2|#  ifndef X86_VPCLMULQDQ_AVX512_NATIVE
  237|      2|    if (cf.x86.has_pclmulqdq && cf.x86.has_avx512_common && cf.x86.has_vpclmulqdq)
  ------------------
  |  Branch (237:9): [True: 2, False: 0]
  |  Branch (237:33): [True: 0, False: 2]
  |  Branch (237:61): [True: 0, False: 0]
  ------------------
  238|      0|#  endif
  239|      0|    {
  240|      0|        ft.crc32 = &crc32_vpclmulqdq_avx512;
  241|      0|        ft.crc32_copy = &crc32_copy_vpclmulqdq_avx512;
  242|      0|    }
  243|      2|#endif
  244|       |
  245|       |
  246|       |    // ARM - SIMD
  247|       |#if defined(ARM_SIMD) && !defined(ARM_NEON_NATIVE)
  248|       |#  ifndef ARM_SIMD_NATIVE
  249|       |    if (cf.arm.has_simd)
  250|       |#  endif
  251|       |    {
  252|       |        ft.slide_hash = &slide_hash_armv6;
  253|       |    }
  254|       |#endif
  255|       |    // ARM - NEON
  256|       |#ifdef ARM_NEON
  257|       |#  ifndef ARM_NEON_NATIVE
  258|       |    if (cf.arm.has_neon)
  259|       |#  endif
  260|       |    {
  261|       |        ft.adler32 = &adler32_neon;
  262|       |        ft.adler32_copy = &adler32_copy_neon;
  263|       |        ft.chunkmemset_safe = &chunkmemset_safe_neon;
  264|       |        ft.compare256 = &compare256_neon;
  265|       |        ft.inflate_fast = &inflate_fast_neon;
  266|       |        ft.longest_match = &longest_match_neon;
  267|       |        ft.longest_match_roll = &longest_match_roll_neon;
  268|       |        ft.slide_hash = &slide_hash_neon;
  269|       |    }
  270|       |#endif
  271|       |    // ARM - CRC32
  272|       |#if defined(ARM_CRC32) && !defined(ARM_PMULL_EOR3_NATIVE)
  273|       |#  ifndef ARM_CRC32_NATIVE
  274|       |    if (cf.arm.has_crc32)
  275|       |#  endif
  276|       |    {
  277|       |        ft.crc32 = &crc32_armv8;
  278|       |        ft.crc32_copy = &crc32_copy_armv8;
  279|       |    }
  280|       |#endif
  281|       |    // ARM - PMULL EOR3
  282|       |#ifdef ARM_PMULL_EOR3
  283|       |#  ifndef ARM_PMULL_EOR3_NATIVE
  284|       |    if (cf.arm.has_crc32 && cf.arm.has_pmull && cf.arm.has_eor3 && cf.arm.has_fast_pmull)
  285|       |#  endif
  286|       |    {
  287|       |        ft.crc32 = &crc32_armv8_pmull_eor3;
  288|       |        ft.crc32_copy = &crc32_copy_armv8_pmull_eor3;
  289|       |    }
  290|       |#endif
  291|       |
  292|       |    // Power - VMX
  293|       |#ifdef PPC_VMX
  294|       |#  ifndef PPC_VMX_NATIVE
  295|       |    if (cf.power.has_altivec)
  296|       |#  endif
  297|       |    {
  298|       |        ft.adler32 = &adler32_vmx;
  299|       |        ft.adler32_copy = &adler32_copy_vmx;
  300|       |        ft.slide_hash = &slide_hash_vmx;
  301|       |    }
  302|       |#endif
  303|       |    // Power8 - VSX
  304|       |#ifdef POWER8_VSX
  305|       |#  ifndef POWER8_VSX_NATIVE
  306|       |    if (cf.power.has_arch_2_07)
  307|       |#  endif
  308|       |    {
  309|       |        ft.adler32 = &adler32_power8;
  310|       |        ft.adler32_copy = &adler32_copy_power8;
  311|       |        ft.chunkmemset_safe = &chunkmemset_safe_power8;
  312|       |        ft.inflate_fast = &inflate_fast_power8;
  313|       |        ft.slide_hash = &slide_hash_power8;
  314|       |    }
  315|       |#endif
  316|       |#ifdef POWER8_VSX_CRC32
  317|       |#  ifndef POWER8_VSX_CRC32_NATIVE
  318|       |    if (cf.power.has_arch_2_07)
  319|       |#  endif
  320|       |    {
  321|       |        ft.crc32 = &crc32_power8;
  322|       |        ft.crc32_copy = &crc32_copy_power8;
  323|       |    }
  324|       |#endif
  325|       |    // Power9
  326|       |#ifdef POWER9
  327|       |#  ifndef POWER9_NATIVE
  328|       |    if (cf.power.has_arch_3_00)
  329|       |#  endif
  330|       |    {
  331|       |        ft.compare256 = &compare256_power9;
  332|       |        ft.longest_match = &longest_match_power9;
  333|       |        ft.longest_match_roll = &longest_match_roll_power9;
  334|       |    }
  335|       |#endif
  336|       |
  337|       |
  338|       |    // RISCV - RVV
  339|       |#ifdef RISCV_RVV
  340|       |#  ifndef RISCV_RVV_NATIVE
  341|       |    if (cf.riscv.has_rvv)
  342|       |#  endif
  343|       |    {
  344|       |        ft.adler32 = &adler32_rvv;
  345|       |        ft.adler32_copy = &adler32_copy_rvv;
  346|       |        ft.chunkmemset_safe = &chunkmemset_safe_rvv;
  347|       |        ft.compare256 = &compare256_rvv;
  348|       |        ft.inflate_fast = &inflate_fast_rvv;
  349|       |        ft.longest_match = &longest_match_rvv;
  350|       |        ft.longest_match_roll = &longest_match_roll_rvv;
  351|       |        ft.slide_hash = &slide_hash_rvv;
  352|       |    }
  353|       |#endif
  354|       |
  355|       |    // RISCV - ZBC
  356|       |#ifdef RISCV_CRC32_ZBC
  357|       |#  ifndef RISCV_ZBC_NATIVE
  358|       |    if (cf.riscv.has_zbc)
  359|       |#  endif
  360|       |    {
  361|       |        ft.crc32 = &crc32_riscv64_zbc;
  362|       |        ft.crc32_copy = &crc32_copy_riscv64_zbc;
  363|       |    }
  364|       |#endif
  365|       |
  366|       |    // S390
  367|       |#ifdef S390_VX
  368|       |#  ifndef S390_VX_NATIVE
  369|       |    if (cf.s390.has_vx)
  370|       |#  endif
  371|       |    {
  372|       |        ft.crc32 = &crc32_s390_vx;
  373|       |        ft.crc32_copy = &crc32_copy_s390_vx;
  374|       |        ft.slide_hash = &slide_hash_vx;
  375|       |    }
  376|       |#endif
  377|       |
  378|       |    // LOONGARCH
  379|       |#ifdef LOONGARCH_CRC
  380|       |#  ifndef LOONGARCH_CRC_NATIVE
  381|       |    if (cf.loongarch.has_crc)
  382|       |#  endif
  383|       |    {
  384|       |        ft.crc32 = &crc32_loongarch64;
  385|       |        ft.crc32_copy = &crc32_copy_loongarch64;
  386|       |    }
  387|       |#endif
  388|       |#if defined(LOONGARCH_LSX) && !defined(LOONGARCH_LASX_NATIVE)
  389|       |#  ifndef LOONGARCH_LSX_NATIVE
  390|       |    if (cf.loongarch.has_lsx)
  391|       |#  endif
  392|       |    {
  393|       |        ft.adler32 = &adler32_lsx;
  394|       |        ft.adler32_copy = &adler32_copy_lsx;
  395|       |        ft.chunkmemset_safe = &chunkmemset_safe_lsx;
  396|       |        ft.compare256 = &compare256_lsx;
  397|       |        ft.inflate_fast = &inflate_fast_lsx;
  398|       |        ft.longest_match = &longest_match_lsx;
  399|       |        ft.longest_match_roll = &longest_match_roll_lsx;
  400|       |        ft.slide_hash = &slide_hash_lsx;
  401|       |    }
  402|       |#endif
  403|       |#ifdef LOONGARCH_LASX
  404|       |#  ifndef LOONGARCH_LASX_NATIVE
  405|       |    if (cf.loongarch.has_lasx)
  406|       |#  endif
  407|       |    {
  408|       |        ft.adler32 = &adler32_lasx;
  409|       |        ft.adler32_copy = &adler32_copy_lasx;
  410|       |        ft.chunkmemset_safe = &chunkmemset_safe_lasx;
  411|       |        ft.compare256 = &compare256_lasx;
  412|       |        ft.inflate_fast = &inflate_fast_lasx;
  413|       |        ft.longest_match = &longest_match_lasx;
  414|       |        ft.longest_match_roll = &longest_match_roll_lasx;
  415|       |        ft.slide_hash = &slide_hash_lasx;
  416|       |    }
  417|       |#endif
  418|       |
  419|      2|#endif // WITH_OPTIM
  420|       |
  421|       |    // Assign function pointers individually for atomic operation
  422|      2|    FUNCTABLE_ASSIGN(ft, force_init);
  ------------------
  |  |   20|      2|    __atomic_store(&(functable.FUNC_NAME), &(VAR.FUNC_NAME), __ATOMIC_SEQ_CST)
  ------------------
  423|      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)
  |  |  ------------------
  ------------------
  424|      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)
  |  |  ------------------
  ------------------
  425|      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)
  |  |  ------------------
  ------------------
  426|      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)
  |  |  ------------------
  ------------------
  427|      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)
  |  |  ------------------
  ------------------
  428|      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)
  |  |  ------------------
  ------------------
  429|      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)
  |  |  ------------------
  ------------------
  430|      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)
  |  |  ------------------
  ------------------
  431|      2|    FUNCTABLE_VERIFY_ASSIGN(ft, longest_match_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)
  |  |  ------------------
  ------------------
  432|      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)
  |  |  ------------------
  ------------------
  433|       |
  434|       |    // Memory barrier for weak memory order CPUs
  435|      2|    FUNCTABLE_BARRIER();
  ------------------
  |  |   21|      2|#  define FUNCTABLE_BARRIER() __atomic_thread_fence(__ATOMIC_SEQ_CST)
  ------------------
  436|       |
  437|      2|    return Z_OK;
  ------------------
  |  |  180|      2|#define Z_OK            0
  ------------------
  438|      2|}
functable.c:force_init_empty:
   63|  6.92k|static int force_init_empty(void) {
   64|  6.92k|    return 0;
   65|  6.92k|}

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

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

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

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

deflate.c:quick_insert_string:
   63|   148M|Z_FORCEINLINE static uint32_t QUICK_INSERT_STRING(deflate_state *const s, unsigned char *window, uint32_t str) {
   64|   148M|    uint8_t *strstart = window + str + HASH_CALC_OFFSET;
  ------------------
  |  |   18|   148M|#define HASH_CALC_OFFSET     0
  ------------------
   65|   148M|    uint32_t val, hm, head;
   66|       |
   67|   148M|    HASH_CALC_VAR_INIT;
  ------------------
  |  |   17|   148M|#define HASH_CALC_VAR_INIT   uint32_t h
  ------------------
   68|   148M|    HASH_CALC_READ;
  ------------------
  |  |   23|   148M|#  define HASH_CALC_READ val = Z_U32_FROM_LE(zng_memread_4(strstart));
  |  |  ------------------
  |  |  |  |   65|   148M|#  define Z_U32_FROM_LE(x)  (x)
  |  |  ------------------
  ------------------
   69|   148M|    HASH_CALC(HASH_CALC_VAR, val);
  ------------------
  |  |   14|   148M|#define HASH_CALC(h, val)    h = ((val * 2654435761U) >> HASH_SLIDE);
  |  |  ------------------
  |  |  |  |   12|   148M|#define HASH_SLIDE           16
  |  |  ------------------
  ------------------
   70|   148M|    HASH_CALC_VAR &= HASH_CALC_MASK;
  ------------------
  |  |   16|   148M|#define HASH_CALC_VAR        h
  ------------------
                  HASH_CALC_VAR &= HASH_CALC_MASK;
  ------------------
  |  |   15|   148M|#define HASH_CALC_MASK       HASH_MASK
  |  |  ------------------
  |  |  |  |   87|   148M|#define HASH_MASK (HASH_SIZE - 1u) /* HASH_SIZE-1 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|   148M|#  define HASH_SIZE 65536u         /* number of elements in hash table */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   71|   148M|    hm = HASH_CALC_VAR;
  ------------------
  |  |   16|   148M|#define HASH_CALC_VAR        h
  ------------------
   72|       |
   73|   148M|    head = s->head[hm];
   74|   148M|    if (LIKELY(head != str)) {
  ------------------
  |  |  253|   148M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 57.3k, False: 148M]
  |  |  ------------------
  ------------------
   75|  57.3k|        s->prev[str & W_MASK(s)] = (Pos)head;
  ------------------
  |  |  390|  57.3k|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
   76|  57.3k|        s->head[hm] = (Pos)str;
   77|  57.3k|    }
   78|   148M|    return head;
   79|   148M|}
deflate_medium.c:quick_insert_string:
   63|   119M|Z_FORCEINLINE static uint32_t QUICK_INSERT_STRING(deflate_state *const s, unsigned char *window, uint32_t str) {
   64|   119M|    uint8_t *strstart = window + str + HASH_CALC_OFFSET;
  ------------------
  |  |   18|   119M|#define HASH_CALC_OFFSET     0
  ------------------
   65|   119M|    uint32_t val, hm, head;
   66|       |
   67|   119M|    HASH_CALC_VAR_INIT;
  ------------------
  |  |   17|   119M|#define HASH_CALC_VAR_INIT   uint32_t h
  ------------------
   68|   119M|    HASH_CALC_READ;
  ------------------
  |  |   23|   119M|#  define HASH_CALC_READ val = Z_U32_FROM_LE(zng_memread_4(strstart));
  |  |  ------------------
  |  |  |  |   65|   119M|#  define Z_U32_FROM_LE(x)  (x)
  |  |  ------------------
  ------------------
   69|   119M|    HASH_CALC(HASH_CALC_VAR, val);
  ------------------
  |  |   14|   119M|#define HASH_CALC(h, val)    h = ((val * 2654435761U) >> HASH_SLIDE);
  |  |  ------------------
  |  |  |  |   12|   119M|#define HASH_SLIDE           16
  |  |  ------------------
  ------------------
   70|   119M|    HASH_CALC_VAR &= HASH_CALC_MASK;
  ------------------
  |  |   16|   119M|#define HASH_CALC_VAR        h
  ------------------
                  HASH_CALC_VAR &= HASH_CALC_MASK;
  ------------------
  |  |   15|   119M|#define HASH_CALC_MASK       HASH_MASK
  |  |  ------------------
  |  |  |  |   87|   119M|#define HASH_MASK (HASH_SIZE - 1u) /* HASH_SIZE-1 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|   119M|#  define HASH_SIZE 65536u         /* number of elements in hash table */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   71|   119M|    hm = HASH_CALC_VAR;
  ------------------
  |  |   16|   119M|#define HASH_CALC_VAR        h
  ------------------
   72|       |
   73|   119M|    head = s->head[hm];
   74|   119M|    if (LIKELY(head != str)) {
  ------------------
  |  |  253|   119M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 119M, False: 3.38k]
  |  |  ------------------
  ------------------
   75|   119M|        s->prev[str & W_MASK(s)] = (Pos)head;
  ------------------
  |  |  390|   119M|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
   76|   119M|        s->head[hm] = (Pos)str;
   77|   119M|    }
   78|   119M|    return head;
   79|   119M|}
insert_string.c:insert_string_static:
   89|  2.04M|Z_FORCEINLINE static void INSERT_STRING(deflate_state *const s, unsigned char *window, uint32_t str, uint32_t count) {
   90|  2.04M|    uint8_t *strstart = window + str + HASH_CALC_OFFSET;
  ------------------
  |  |   18|  2.04M|#define HASH_CALC_OFFSET     0
  ------------------
   91|  2.04M|    uint8_t *strend = strstart + count;
   92|       |
   93|       |    /* Local pointers to avoid indirection */
   94|  2.04M|    Pos *headp = s->head;
   95|  2.04M|    Pos *prevp = s->prev;
   96|  2.04M|    const unsigned int w_mask = W_MASK(s);
  ------------------
  |  |  390|  2.04M|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
   97|       |
   98|  16.8M|    for (uint32_t idx = str; strstart < strend; idx++, strstart++) {
  ------------------
  |  Branch (98:30): [True: 14.7M, False: 2.04M]
  ------------------
   99|  14.7M|        uint32_t val, hm, head;
  100|       |
  101|  14.7M|        HASH_CALC_VAR_INIT;
  ------------------
  |  |   17|  14.7M|#define HASH_CALC_VAR_INIT   uint32_t h
  ------------------
  102|  14.7M|        HASH_CALC_READ;
  ------------------
  |  |   23|  14.7M|#  define HASH_CALC_READ val = Z_U32_FROM_LE(zng_memread_4(strstart));
  |  |  ------------------
  |  |  |  |   65|  14.7M|#  define Z_U32_FROM_LE(x)  (x)
  |  |  ------------------
  ------------------
  103|  14.7M|        HASH_CALC(HASH_CALC_VAR, val);
  ------------------
  |  |   14|  14.7M|#define HASH_CALC(h, val)    h = ((val * 2654435761U) >> HASH_SLIDE);
  |  |  ------------------
  |  |  |  |   12|  14.7M|#define HASH_SLIDE           16
  |  |  ------------------
  ------------------
  104|  14.7M|        HASH_CALC_VAR &= HASH_CALC_MASK;
  ------------------
  |  |   16|  14.7M|#define HASH_CALC_VAR        h
  ------------------
                      HASH_CALC_VAR &= HASH_CALC_MASK;
  ------------------
  |  |   15|  14.7M|#define HASH_CALC_MASK       HASH_MASK
  |  |  ------------------
  |  |  |  |   87|  14.7M|#define HASH_MASK (HASH_SIZE - 1u) /* HASH_SIZE-1 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   85|  14.7M|#  define HASH_SIZE 65536u         /* number of elements in hash table */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  105|  14.7M|        hm = HASH_CALC_VAR;
  ------------------
  |  |   16|  14.7M|#define HASH_CALC_VAR        h
  ------------------
  106|       |
  107|  14.7M|        head = headp[hm];
  108|  14.7M|        if (LIKELY(head != idx)) {
  ------------------
  |  |  253|  14.7M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 14.7M, False: 0]
  |  |  ------------------
  ------------------
  109|  14.7M|            prevp[idx & w_mask] = (Pos)head;
  110|  14.7M|            headp[hm] = (Pos)idx;
  111|  14.7M|        }
  112|  14.7M|    }
  113|  2.04M|}

longest_match_avx2:
   28|  41.7M|Z_INTERNAL uint32_t LONGEST_MATCH(deflate_state *const s, uint32_t cur_match) {
   29|  41.7M|    const unsigned wmask = W_MASK(s);
  ------------------
  |  |  390|  41.7M|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
   30|  41.7M|    unsigned int strstart = s->strstart;
   31|  41.7M|    const unsigned char *window = s->window;
   32|  41.7M|    const Pos *prev = s->prev;
   33|       |#ifdef LONGEST_MATCH_ROLL
   34|       |    const Pos *head = s->head;
   35|       |#endif
   36|  41.7M|    const unsigned char *scan;
   37|  41.7M|    const unsigned char *mbase_start = window;
   38|  41.7M|    const unsigned char *mbase_end;
   39|  41.7M|    uint32_t limit;
   40|       |#ifdef LONGEST_MATCH_ROLL
   41|       |    uint32_t limit_base;
   42|       |#else
   43|  41.7M|    int32_t early_exit;
   44|  41.7M|#endif
   45|  41.7M|    uint32_t chain_length = s->max_chain_length;
   46|  41.7M|    uint32_t nice_match = (uint32_t)s->nice_match;
   47|  41.7M|    uint32_t best_len, offset;
   48|  41.7M|    uint32_t lookahead = s->lookahead;
   49|  41.7M|    uint32_t match_offset = 0;
   50|  41.7M|    uint64_t scan_start;
   51|  41.7M|    uint64_t scan_end;
   52|       |
   53|       |    /* The code is optimized for STD_MAX_MATCH-2 multiple of 16. */
   54|  41.7M|    Assert(STD_MAX_MATCH == 258, "Code too clever");
   55|       |
   56|  41.7M|    best_len = s->prev_length ? s->prev_length : STD_MIN_MATCH-1;
  ------------------
  |  |   56|  41.7M|#define STD_MIN_MATCH  3
  ------------------
  |  Branch (56:16): [True: 0, False: 41.7M]
  ------------------
   57|  41.7M|    if (best_len >= lookahead)
  ------------------
  |  Branch (57:9): [True: 0, False: 41.7M]
  ------------------
   58|      0|        return lookahead;
   59|       |
   60|       |    /* Calculate read offset which should only extend an extra byte
   61|       |     * to find the next best match length.
   62|       |     */
   63|  41.7M|    offset = best_len-1;
   64|  41.7M|    if (best_len >= sizeof(uint32_t)) {
  ------------------
  |  Branch (64:9): [True: 0, False: 41.7M]
  ------------------
   65|      0|        offset -= 2;
   66|      0|        if (best_len >= sizeof(uint64_t))
  ------------------
  |  Branch (66:13): [True: 0, False: 0]
  ------------------
   67|      0|            offset -= 4;
   68|      0|    }
   69|       |
   70|  41.7M|    scan = window + strstart;
   71|  41.7M|    scan_start = zng_memread_8(scan);
   72|  41.7M|    scan_end = zng_memread_8(scan+offset);
   73|  41.7M|    mbase_end  = (mbase_start+offset);
   74|       |
   75|       |    /* Do not waste too much time if we already have a good match */
   76|  41.7M|    if (best_len >= s->good_match)
  ------------------
  |  Branch (76:9): [True: 0, False: 41.7M]
  ------------------
   77|      0|        chain_length >>= 2;
   78|       |
   79|       |    /* Stop when cur_match becomes <= limit. To simplify the code,
   80|       |     * we prevent matches with the string of window index 0
   81|       |     */
   82|  41.7M|    limit = strstart > MAX_DIST(s) ? (strstart - MAX_DIST(s)) : 0;
  ------------------
  |  |  385|  41.7M|#define MAX_DIST(s)  ((s)->w_size - MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  380|  41.7M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   57|  41.7M|#define STD_MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|  41.7M|#define STD_MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  limit = strstart > MAX_DIST(s) ? (strstart - MAX_DIST(s)) : 0;
  ------------------
  |  |  385|  37.5M|#define MAX_DIST(s)  ((s)->w_size - MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  380|  37.5M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   57|  37.5M|#define STD_MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|  37.5M|#define STD_MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (82:13): [True: 37.5M, False: 4.20M]
  ------------------
   83|       |#ifdef LONGEST_MATCH_ROLL
   84|       |    limit_base = limit;
   85|       |    if (best_len >= STD_MIN_MATCH) {
   86|       |        /* We're continuing search (lazy evaluation). */
   87|       |        uint32_t hash;
   88|       |        uint32_t pos;
   89|       |
   90|       |        /* Find a most distant chain starting from scan with index=1 (index=0 corresponds
   91|       |         * to cur_match). We cannot use s->prev[strstart+1,...] immediately, because
   92|       |         * these strings are not yet inserted into the hash table.
   93|       |         */
   94|       |        // use update_hash_roll for deflate_slow
   95|       |        hash = update_hash_roll(0, scan[1]);
   96|       |        hash = update_hash_roll(hash, scan[2]);
   97|       |
   98|       |        for (uint32_t i = 3; i <= best_len; i++) {
   99|       |            // use update_hash_roll for deflate_slow
  100|       |            hash = update_hash_roll(hash, scan[i]);
  101|       |            /* If we're starting with best_len >= 3, we can use offset search. */
  102|       |            pos = head[hash];
  103|       |            if (pos < cur_match) {
  104|       |                match_offset = i - 2;
  105|       |                cur_match = pos;
  106|       |            }
  107|       |        }
  108|       |
  109|       |        /* Update offset-dependent variables */
  110|       |        limit = limit_base+match_offset;
  111|       |        if (cur_match <= limit)
  112|       |            return best_len;
  113|       |        mbase_start -= match_offset;
  114|       |        mbase_end -= match_offset;
  115|       |    }
  116|       |#else
  117|  41.7M|    early_exit = s->level < EARLY_EXIT_TRIGGER_LEVEL;
  ------------------
  |  |   13|  41.7M|#define EARLY_EXIT_TRIGGER_LEVEL 5
  ------------------
  118|  41.7M|#endif
  119|  41.7M|    Assert((unsigned long)strstart <= s->window_size - MIN_LOOKAHEAD, "need lookahead");
  120|  43.9M|    for (;;) {
  121|  43.9M|        if (cur_match >= strstart)
  ------------------
  |  Branch (121:13): [True: 0, False: 43.9M]
  ------------------
  122|      0|            break;
  123|       |
  124|       |        /* Skip to next match if the match length cannot increase or if the match length is
  125|       |         * less than 2. Note that the checks below for insufficient lookahead only occur
  126|       |         * occasionally for performance reasons.
  127|       |         * Therefore uninitialized memory will be accessed and conditional jumps will be made
  128|       |         * that depend on those values. However the length of the match is limited to the
  129|       |         * lookahead, so the output of deflate is not affected by the uninitialized values.
  130|       |         */
  131|  43.9M|        if (best_len < sizeof(uint32_t)) {
  ------------------
  |  Branch (131:13): [True: 41.7M, False: 2.19M]
  ------------------
  132|  53.2M|            for (;;) {
  133|  53.2M|                if (zng_memcmp_2(mbase_end+cur_match, &scan_end) == 0 &&
  ------------------
  |  Branch (133:21): [True: 2.11M, False: 51.1M]
  ------------------
  134|  2.11M|                    zng_memcmp_2(mbase_start+cur_match, &scan_start) == 0)
  ------------------
  |  Branch (134:21): [True: 2.10M, False: 6.27k]
  ------------------
  135|  2.10M|                    break;
  136|  51.1M|                GOTO_NEXT_CHAIN;
  ------------------
  |  |   16|  51.1M|    if (--chain_length && (cur_match = prev[cur_match & wmask]) > limit) \
  |  |  ------------------
  |  |  |  Branch (16:9): [True: 51.1M, False: 1.88k]
  |  |  |  Branch (16:27): [True: 11.5M, False: 39.6M]
  |  |  ------------------
  |  |   17|  39.6M|        continue; \
  |  |   18|  39.6M|    return best_len;
  ------------------
  137|  51.1M|            }
  138|  41.7M|        } else if (best_len >= sizeof(uint64_t)) {
  ------------------
  |  Branch (138:20): [True: 762k, False: 1.43M]
  ------------------
  139|  8.20M|            for (;;) {
  140|  8.20M|                if (zng_memcmp_8(mbase_end+cur_match, &scan_end) == 0 &&
  ------------------
  |  Branch (140:21): [True: 552k, False: 7.64M]
  ------------------
  141|   552k|                    zng_memcmp_8(mbase_start+cur_match, &scan_start) == 0)
  ------------------
  |  Branch (141:21): [True: 513k, False: 38.9k]
  ------------------
  142|   513k|                    break;
  143|  7.68M|                GOTO_NEXT_CHAIN;
  ------------------
  |  |   16|  7.68M|    if (--chain_length && (cur_match = prev[cur_match & wmask]) > limit) \
  |  |  ------------------
  |  |  |  Branch (16:9): [True: 7.64M, False: 38.5k]
  |  |  |  Branch (16:27): [True: 7.43M, False: 209k]
  |  |  ------------------
  |  |   17|  7.43M|        continue; \
  |  |   18|   248k|    return best_len;
  ------------------
  144|  7.68M|            }
  145|  1.43M|        } else {
  146|  11.2M|            for (;;) {
  147|  11.2M|                if (zng_memcmp_4(mbase_end+cur_match, &scan_end) == 0 &&
  ------------------
  |  Branch (147:21): [True: 376k, False: 10.8M]
  ------------------
  148|   376k|                    zng_memcmp_4(mbase_start+cur_match, &scan_start) == 0)
  ------------------
  |  Branch (148:21): [True: 375k, False: 938]
  ------------------
  149|   375k|                    break;
  150|  10.8M|                GOTO_NEXT_CHAIN;
  ------------------
  |  |   16|  10.8M|    if (--chain_length && (cur_match = prev[cur_match & wmask]) > limit) \
  |  |  ------------------
  |  |  |  Branch (16:9): [True: 10.8M, False: 28.7k]
  |  |  |  Branch (16:27): [True: 9.77M, False: 1.02M]
  |  |  ------------------
  |  |   17|  9.77M|        continue; \
  |  |   18|  1.05M|    return best_len;
  ------------------
  151|  10.8M|            }
  152|  1.43M|        }
  153|  2.99M|        uint32_t len = COMPARE256(scan+2, mbase_start+cur_match+2) + 2;
  ------------------
  |  |   51|  2.99M|#define COMPARE256          compare256_avx2_static
  ------------------
  154|  2.99M|        Assert(scan+len <= window+(unsigned)(s->window_size-1), "wild scan");
  155|       |
  156|  2.99M|        if (len > best_len) {
  ------------------
  |  Branch (156:13): [True: 2.90M, False: 92.7k]
  ------------------
  157|  2.90M|            uint32_t match_start = cur_match - match_offset;
  158|  2.90M|            s->match_start = match_start;
  159|       |
  160|       |            /* Do not look for better matches if the current match reaches
  161|       |             * or exceeds the end of the input.
  162|       |             */
  163|  2.90M|            if (len >= lookahead)
  ------------------
  |  Branch (163:17): [True: 874, False: 2.90M]
  ------------------
  164|    874|                return lookahead;
  165|  2.90M|            if (len >= nice_match)
  ------------------
  |  Branch (165:17): [True: 73.6k, False: 2.82M]
  ------------------
  166|  73.6k|                return len;
  167|       |
  168|  2.82M|            best_len = len;
  169|       |
  170|  2.82M|            offset = best_len-1;
  171|  2.82M|            if (best_len >= sizeof(uint32_t)) {
  ------------------
  |  Branch (171:17): [True: 2.82M, False: 0]
  ------------------
  172|  2.82M|                offset -= 2;
  173|  2.82M|                if (best_len >= sizeof(uint64_t))
  ------------------
  |  Branch (173:21): [True: 752k, False: 2.07M]
  ------------------
  174|   752k|                    offset -= 4;
  175|  2.82M|            }
  176|       |
  177|  2.82M|            scan_end = zng_memread_8(scan+offset);
  178|       |
  179|       |#ifdef LONGEST_MATCH_ROLL
  180|       |            /* Look for a better string offset */
  181|       |            if (UNLIKELY(len > STD_MIN_MATCH && match_start + len < strstart)) {
  182|       |                const unsigned char *scan_endstr;
  183|       |                uint32_t hash;
  184|       |                uint32_t pos, next_pos;
  185|       |
  186|       |                /* Go back to offset 0 */
  187|       |                cur_match -= match_offset;
  188|       |                match_offset = 0;
  189|       |                next_pos = cur_match;
  190|       |                for (uint32_t i = 0; i <= len - STD_MIN_MATCH; i++) {
  191|       |                    pos = prev[(cur_match + i) & wmask];
  192|       |                    if (pos < next_pos) {
  193|       |                        /* Hash chain is more distant, use it */
  194|       |                        if (pos <= limit_base + i)
  195|       |                            return best_len;
  196|       |                        next_pos = pos;
  197|       |                        match_offset = i;
  198|       |                    }
  199|       |                }
  200|       |                /* Switch cur_match to next_pos chain */
  201|       |                cur_match = next_pos;
  202|       |
  203|       |                /* Try hash head at len-(STD_MIN_MATCH-1) position to see if we could get
  204|       |                 * a better cur_match at the end of string. Using (STD_MIN_MATCH-1) lets
  205|       |                 * us include one more byte into hash - the byte which will be checked
  206|       |                 * in main loop now, and which allows to grow match by 1.
  207|       |                 */
  208|       |                scan_endstr = scan + len - (STD_MIN_MATCH-1);
  209|       |
  210|       |                // use update_hash_roll for deflate_slow
  211|       |                hash = update_hash_roll(0, scan_endstr[0]);
  212|       |                hash = update_hash_roll(hash, scan_endstr[1]);
  213|       |                hash = update_hash_roll(hash, scan_endstr[2]);
  214|       |
  215|       |                pos = head[hash];
  216|       |                if (pos < cur_match) {
  217|       |                    match_offset = len - (STD_MIN_MATCH-1);
  218|       |                    if (pos <= limit_base + match_offset)
  219|       |                        return best_len;
  220|       |                    cur_match = pos;
  221|       |                }
  222|       |
  223|       |                /* Update offset-dependent variables */
  224|       |                limit = limit_base+match_offset;
  225|       |                mbase_start = window-match_offset;
  226|       |                mbase_end = (mbase_start+offset);
  227|       |                continue;
  228|       |            }
  229|       |#endif
  230|  2.82M|            mbase_end = (mbase_start+offset);
  231|  2.82M|        }
  232|  92.7k|#ifndef LONGEST_MATCH_ROLL
  233|  92.7k|        else if (UNLIKELY(early_exit)) {
  ------------------
  |  |  254|  92.7k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 92.7k]
  |  |  ------------------
  ------------------
  234|       |            /* The probability of finding a match later if we here is pretty low, so for
  235|       |             * performance it's best to outright stop here for the lower compression levels
  236|       |             */
  237|      0|            break;
  238|      0|        }
  239|  2.92M|#endif
  240|  2.92M|        GOTO_NEXT_CHAIN;
  ------------------
  |  |   16|  2.92M|    if (--chain_length && (cur_match = prev[cur_match & wmask]) > limit) \
  |  |  ------------------
  |  |  |  Branch (16:9): [True: 2.91M, False: 1.75k]
  |  |  |  Branch (16:27): [True: 2.19M, False: 726k]
  |  |  ------------------
  |  |   17|  2.19M|        continue; \
  |  |   18|   728k|    return best_len;
  ------------------
  241|  2.92M|    }
  242|      0|    return best_len;
  243|  41.7M|}

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

zng_tr_init:
   83|  3.46k|void Z_INTERNAL zng_tr_init(deflate_state *s) {
   84|  3.46k|    s->l_desc.dyn_tree = s->dyn_ltree;
   85|  3.46k|    s->l_desc.stat_desc = &static_l_desc;
   86|       |
   87|  3.46k|    s->d_desc.dyn_tree = s->dyn_dtree;
   88|  3.46k|    s->d_desc.stat_desc = &static_d_desc;
   89|       |
   90|  3.46k|    s->bl_desc.dyn_tree = s->bl_tree;
   91|  3.46k|    s->bl_desc.stat_desc = &static_bl_desc;
   92|       |
   93|  3.46k|    s->bi_buf = 0;
   94|  3.46k|    s->bi_valid = 0;
   95|       |#ifdef ZLIB_DEBUG
   96|       |    s->compressed_len = 0L;
   97|       |    s->bits_sent = 0L;
   98|       |#endif
   99|       |
  100|       |    /* Initialize the first block of the first file: */
  101|  3.46k|    init_block(s);
  102|  3.46k|}
gen_codes:
  376|  31.2k|Z_INTERNAL void gen_codes(ct_data *tree, int max_code, uint16_t *bl_count) {
  377|       |    /* tree: the tree to decorate */
  378|       |    /* max_code: largest code with non zero frequency */
  379|       |    /* bl_count: number of codes at each bit length */
  380|  31.2k|    uint16_t next_code[MAX_BITS+1];  /* next code value for each bit length */
  381|  31.2k|    uint16_t code = 0;               /* running code value */
  382|  31.2k|    int bits;                        /* bit index */
  383|  31.2k|    int n;                           /* code index */
  384|       |
  385|       |    /* The distribution counts are first used to generate the code values
  386|       |     * without bit reversal.
  387|       |     */
  388|   500k|    for (bits = 1; bits <= MAX_BITS; bits++) {
  ------------------
  |  |   39|   500k|#define MAX_BITS 15
  ------------------
  |  Branch (388:20): [True: 468k, False: 31.2k]
  ------------------
  389|   468k|        code = (code + bl_count[bits-1]) << 1;
  390|   468k|        next_code[bits] = code;
  391|   468k|    }
  392|       |    /* Check that the bit counts in bl_count are consistent. The last code
  393|       |     * must be all ones.
  394|       |     */
  395|  31.2k|    Assert(code + bl_count[MAX_BITS]-1 == (1 << MAX_BITS)-1, "inconsistent bit counts");
  396|  31.2k|    Tracev((stderr, "\ngen_codes: max_code %d ", max_code));
  397|       |
  398|  3.20M|    for (n = 0;  n <= max_code; n++) {
  ------------------
  |  Branch (398:18): [True: 3.17M, False: 31.2k]
  ------------------
  399|  3.17M|        int len = tree[n].Len;
  ------------------
  |  |  105|  3.17M|#define Len  dl.len
  ------------------
  400|  3.17M|        if (len == 0)
  ------------------
  |  Branch (400:13): [True: 1.09M, False: 2.08M]
  ------------------
  401|  1.09M|            continue;
  402|       |        /* Now reverse the bits */
  403|  2.08M|        tree[n].Code = bi_reverse(next_code[len]++, len);
  ------------------
  |  |  103|  2.08M|#define Code fc.code
  ------------------
  404|       |
  405|  2.08M|        Tracecv(tree != static_ltree, (stderr, "\nn %3d %c l %2d c %4x (%x) ",
  406|  2.08M|             n, (isgraph(n & 0xff) ? n : ' '), len, tree[n].Code, next_code[len]-1));
  407|  2.08M|    }
  408|  31.2k|}
zng_tr_stored_block:
  595|  1.60k|void Z_INTERNAL zng_tr_stored_block(deflate_state *s, unsigned char *buf, uint32_t stored_len, int last) {
  596|       |    /* buf: input block */
  597|       |    /* stored_len: length of input block */
  598|       |    /* last: one if this is the last block for a file */
  599|  1.60k|    zng_tr_emit_tree(s, STORED_BLOCK, last); /* send block type */
  ------------------
  |  |   51|  1.60k|#define STORED_BLOCK 0
  ------------------
  600|  1.60k|    zng_tr_emit_align(s);                    /* align on byte boundary */
  601|  1.60k|    cmpr_bits_align(s);
  602|  1.60k|    put_short(s, (uint16_t)stored_len);
  603|  1.60k|    put_short(s, (uint16_t)~stored_len);
  604|  1.60k|    cmpr_bits_add(s, 32);
  ------------------
  |  |  424|  1.60k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  150|  1.60k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  605|  1.60k|    sent_bits_add(s, 32);
  ------------------
  |  |  426|  1.60k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  ------------------
  |  |  |  |  150|  1.60k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  606|  1.60k|    if (stored_len) {
  ------------------
  |  Branch (606:9): [True: 1.60k, False: 0]
  ------------------
  607|  1.60k|        memcpy(s->pending_buf + s->pending, buf, stored_len);
  608|  1.60k|        s->pending += stored_len;
  609|  1.60k|        cmpr_bits_add(s, stored_len << 3);
  ------------------
  |  |  424|  1.60k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  150|  1.60k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  610|  1.60k|        sent_bits_add(s, stored_len << 3);
  ------------------
  |  |  426|  1.60k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  ------------------
  |  |  |  |  150|  1.60k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  611|  1.60k|    }
  612|  1.60k|}
zng_tr_flush_block:
  628|  10.4k|void Z_INTERNAL zng_tr_flush_block(deflate_state *s, unsigned char *buf, uint32_t stored_len, int last) {
  629|       |    /* buf: input block, or NULL if too old */
  630|       |    /* stored_len: length of input block */
  631|       |    /* last: one if this is the last block for a file */
  632|  10.4k|    unsigned int opt_lenb, static_lenb; /* opt_len and static_len in bytes */
  633|  10.4k|    int max_blindex = 0;  /* index of last bit length code of non zero freq */
  634|       |
  635|       |    /* Build the Huffman trees unless a stored block is forced */
  636|  10.4k|    if (UNLIKELY(s->sym_next == 0)) {
  ------------------
  |  |  254|  10.4k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 53, False: 10.4k]
  |  |  ------------------
  ------------------
  637|       |        /* Emit an empty static tree block with no codes */
  638|     53|        opt_lenb = static_lenb = 0;
  639|     53|        s->static_len = 7;
  640|  10.4k|    } else if (s->level > 0) {
  ------------------
  |  Branch (640:16): [True: 10.4k, False: 0]
  ------------------
  641|       |        /* Check if the file is binary or text */
  642|  10.4k|        if (s->strm->data_type == Z_UNKNOWN)
  ------------------
  |  |  209|  10.4k|#define Z_UNKNOWN  2
  ------------------
  |  Branch (642:13): [True: 3.46k, False: 6.95k]
  ------------------
  643|  3.46k|            s->strm->data_type = detect_data_type(s);
  644|       |
  645|       |        /* Construct the literal and distance trees */
  646|  10.4k|        build_tree(s, (tree_desc *)(&(s->l_desc)));
  647|  10.4k|        Tracev((stderr, "\nlit data: dyn %u, stat %u", s->opt_len, s->static_len));
  648|       |
  649|  10.4k|        build_tree(s, (tree_desc *)(&(s->d_desc)));
  650|  10.4k|        Tracev((stderr, "\ndist data: dyn %u, stat %u", s->opt_len, s->static_len));
  651|       |        /* At this point, opt_len and static_len are the total bit lengths of
  652|       |         * the compressed block data, excluding the tree representations.
  653|       |         */
  654|       |
  655|       |        /* Build the bit length tree for the above two trees, and get the index
  656|       |         * in bl_order of the last bit length code to send.
  657|       |         */
  658|  10.4k|        max_blindex = build_bl_tree(s);
  659|       |
  660|       |        /* Determine the best encoding. Compute the block lengths in bytes. */
  661|  10.4k|        opt_lenb = (s->opt_len + 3 + 7) >> 3;
  662|  10.4k|        static_lenb = (s->static_len + 3 + 7) >> 3;
  663|       |
  664|  10.4k|        Tracev((stderr, "\nopt %u(%u) stat %u(%u) stored %u lit %u ",
  665|  10.4k|                opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
  666|  10.4k|                s->sym_next / 3));
  667|       |
  668|  10.4k|        if (static_lenb <= opt_lenb || s->strategy == Z_FIXED)
  ------------------
  |  |  202|  8.39k|#define Z_FIXED               4
  ------------------
  |  Branch (668:13): [True: 2.02k, False: 8.39k]
  |  Branch (668:40): [True: 0, False: 8.39k]
  ------------------
  669|  2.02k|            opt_lenb = static_lenb;
  670|       |
  671|  10.4k|    } else {
  672|      0|        Assert(buf != NULL, "lost buf");
  673|      0|        opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
  674|      0|    }
  675|       |
  676|  10.4k|    if (stored_len+4 <= opt_lenb && buf != NULL) {
  ------------------
  |  Branch (676:9): [True: 1.60k, False: 8.86k]
  |  Branch (676:37): [True: 1.60k, False: 0]
  ------------------
  677|       |        /* 4: two words for the lengths
  678|       |         * The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
  679|       |         * Otherwise we can't have processed more than WSIZE input bytes since
  680|       |         * the last block flush, because compression would have been
  681|       |         * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
  682|       |         * transform a block into a stored block.
  683|       |         */
  684|  1.60k|        zng_tr_stored_block(s, buf, stored_len, last);
  685|       |
  686|  8.86k|    } else if (static_lenb == opt_lenb) {
  ------------------
  |  Branch (686:16): [True: 1.84k, False: 7.02k]
  ------------------
  687|  1.84k|        zng_tr_emit_tree(s, STATIC_TREES, last);
  ------------------
  |  |   52|  1.84k|#define STATIC_TREES 1
  ------------------
  688|  1.84k|        compress_block(s, (const ct_data *)static_ltree, (const ct_data *)static_dtree);
  689|  1.84k|        cmpr_bits_add(s, s->static_len);
  ------------------
  |  |  424|  1.84k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  150|  1.84k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  690|  7.02k|    } else {
  691|  7.02k|        zng_tr_emit_tree(s, DYN_TREES, last);
  ------------------
  |  |   53|  7.02k|#define DYN_TREES    2
  ------------------
  692|  7.02k|        send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, max_blindex+1);
  693|  7.02k|        compress_block(s, (const ct_data *)s->dyn_ltree, (const ct_data *)s->dyn_dtree);
  694|  7.02k|        cmpr_bits_add(s, s->opt_len);
  ------------------
  |  |  424|  7.02k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  150|  7.02k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  695|  7.02k|    }
  696|  10.4k|    Assert(s->compressed_len == s->bits_sent, "bad compressed size");
  697|       |    /* The above check is made mod 2^32, for files larger than 512 MB
  698|       |     * and unsigned long implemented on 32 bits.
  699|       |     */
  700|  10.4k|    init_block(s);
  701|       |
  702|  10.4k|    if (last) {
  ------------------
  |  Branch (702:9): [True: 3.46k, False: 7.00k]
  ------------------
  703|  3.46k|        zng_tr_emit_align(s);
  704|  3.46k|    }
  705|  10.4k|    Tracev((stderr, "\ncomprlen %lu(%lu) ", s->compressed_len>>3, s->compressed_len-7*last));
  706|  10.4k|}
zng_tr_flush_bits:
  811|   114M|void Z_INTERNAL zng_tr_flush_bits(deflate_state *s) {
  812|   114M|    if (s->bi_valid >= 48) {
  ------------------
  |  Branch (812:9): [True: 1.44k, False: 114M]
  ------------------
  813|  1.44k|        put_uint32(s, (uint32_t)s->bi_buf);
  814|  1.44k|        put_short(s, (uint16_t)(s->bi_buf >> 32));
  815|  1.44k|        s->bi_buf >>= 48;
  816|  1.44k|        s->bi_valid -= 48;
  817|   114M|    } else if (s->bi_valid >= 32) {
  ------------------
  |  Branch (817:16): [True: 1.46k, False: 114M]
  ------------------
  818|  1.46k|        put_uint32(s, (uint32_t)s->bi_buf);
  819|  1.46k|        s->bi_buf >>= 32;
  820|  1.46k|        s->bi_valid -= 32;
  821|  1.46k|    }
  822|   114M|    if (s->bi_valid >= 16) {
  ------------------
  |  Branch (822:9): [True: 1.43k, False: 114M]
  ------------------
  823|  1.43k|        put_short(s, (uint16_t)s->bi_buf);
  824|  1.43k|        s->bi_buf >>= 16;
  825|  1.43k|        s->bi_valid -= 16;
  826|  1.43k|    }
  827|   114M|    if (s->bi_valid >= 8) {
  ------------------
  |  Branch (827:9): [True: 2.81k, False: 114M]
  ------------------
  828|  2.81k|        put_byte(s, s->bi_buf);
  ------------------
  |  |  326|  2.81k|#define put_byte(s, c) { \
  |  |  327|  2.81k|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  328|  2.81k|}
  ------------------
  829|  2.81k|        s->bi_buf >>= 8;
  830|  2.81k|        s->bi_valid -= 8;
  831|  2.81k|    }
  832|   114M|}
trees.c:init_block:
  107|  13.9k|static void init_block(deflate_state *s) {
  108|  13.9k|    int n; /* iterates over tree elements */
  109|       |
  110|       |    /* Initialize the trees. */
  111|  3.99M|    for (n = 0; n < L_CODES;  n++)
  ------------------
  |  |   48|  3.99M|#define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  ------------------
  |  |  |  |   45|  3.99M|#define LITERALS  256
  |  |  ------------------
  |  |               #define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  ------------------
  |  |  |  |   42|  3.99M|#define LENGTH_CODES 29
  |  |  ------------------
  ------------------
  |  Branch (111:17): [True: 3.98M, False: 13.9k]
  ------------------
  112|  3.98M|        s->dyn_ltree[n].Freq = 0;
  ------------------
  |  |  102|  3.98M|#define Freq fc.freq
  ------------------
  113|   431k|    for (n = 0; n < D_CODES;  n++)
  ------------------
  |  |   51|   431k|#define D_CODES   30
  ------------------
  |  Branch (113:17): [True: 417k, False: 13.9k]
  ------------------
  114|   417k|        s->dyn_dtree[n].Freq = 0;
  ------------------
  |  |  102|   417k|#define Freq fc.freq
  ------------------
  115|   278k|    for (n = 0; n < BL_CODES; n++)
  ------------------
  |  |   54|   278k|#define BL_CODES  19
  ------------------
  |  Branch (115:17): [True: 264k, False: 13.9k]
  ------------------
  116|   264k|        s->bl_tree[n].Freq = 0;
  ------------------
  |  |  102|   264k|#define Freq fc.freq
  ------------------
  117|       |
  118|  13.9k|    s->dyn_ltree[END_BLOCK].Freq = 1;
  ------------------
  |  |   63|  13.9k|#define END_BLOCK 256
  ------------------
                  s->dyn_ltree[END_BLOCK].Freq = 1;
  ------------------
  |  |  102|  13.9k|#define Freq fc.freq
  ------------------
  119|  13.9k|    s->opt_len = s->static_len = 0;
  120|  13.9k|    s->sym_next = s->matches = 0;
  121|  13.9k|}
trees.c:build_tree:
  184|  31.2k|static void build_tree(deflate_state *s, tree_desc *desc) {
  185|       |    /* desc: the tree descriptor */
  186|  31.2k|    unsigned char *depth  = s->depth;
  187|  31.2k|    int *heap             = s->heap;
  188|  31.2k|    ct_data *tree         = desc->dyn_tree;
  189|  31.2k|    const ct_data *stree  = desc->stat_desc->static_tree;
  190|  31.2k|    int elems             = desc->stat_desc->elems;
  191|  31.2k|    int n, m;          /* iterate over heap elements */
  192|  31.2k|    int max_code = -1; /* largest code with non zero frequency */
  193|  31.2k|    int node;          /* new node being created */
  194|       |
  195|       |    /* Construct the initial heap, with least frequent element in
  196|       |     * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
  197|       |     * heap[0] is not used.
  198|       |     */
  199|  31.2k|    s->heap_len = 0;
  200|  31.2k|    s->heap_max = HEAP_SIZE;
  ------------------
  |  |   57|  31.2k|#define HEAP_SIZE (2*L_CODES+1)
  |  |  ------------------
  |  |  |  |   48|  31.2k|#define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  31.2k|#define LITERALS  256
  |  |  |  |  ------------------
  |  |  |  |               #define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  31.2k|#define LENGTH_CODES 29
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  201|       |
  202|  3.52M|    for (n = 0; n < elems; n++) {
  ------------------
  |  Branch (202:17): [True: 3.48M, False: 31.2k]
  ------------------
  203|  3.48M|        if (tree[n].Freq != 0) {
  ------------------
  |  |  102|  3.48M|#define Freq fc.freq
  ------------------
  |  Branch (203:13): [True: 2.07M, False: 1.41M]
  ------------------
  204|  2.07M|            heap[++(s->heap_len)] = max_code = n;
  205|  2.07M|            depth[n] = 0;
  206|  2.07M|        } else {
  207|  1.41M|            tree[n].Len = 0;
  ------------------
  |  |  105|  1.41M|#define Len  dl.len
  ------------------
  208|  1.41M|        }
  209|  3.48M|    }
  210|       |
  211|       |    /* The pkzip format requires that at least one distance code exists,
  212|       |     * and that at least one bit should be sent even if there is only one
  213|       |     * possible code. So to avoid special checks later on we force at least
  214|       |     * two codes of non zero frequency.
  215|       |     */
  216|  37.9k|    while (s->heap_len < 2) {
  ------------------
  |  Branch (216:12): [True: 6.66k, False: 31.2k]
  ------------------
  217|  6.66k|        node = heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
  ------------------
  |  Branch (217:41): [True: 6.21k, False: 450]
  ------------------
  218|  6.66k|        tree[node].Freq = 1;
  ------------------
  |  |  102|  6.66k|#define Freq fc.freq
  ------------------
  219|  6.66k|        depth[node] = 0;
  220|  6.66k|        s->opt_len--;
  221|  6.66k|        if (stree)
  ------------------
  |  Branch (221:13): [True: 6.66k, False: 0]
  ------------------
  222|  6.66k|            s->static_len -= stree[node].Len;
  ------------------
  |  |  105|  6.66k|#define Len  dl.len
  ------------------
  223|       |        /* node is 0 or 1 so it does not have extra bits */
  224|  6.66k|    }
  225|  31.2k|    desc->max_code = max_code;
  226|       |
  227|       |    /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
  228|       |     * establish sub-heaps of increasing lengths:
  229|       |     */
  230|  1.06M|    for (n = s->heap_len/2; n >= 1; n--)
  ------------------
  |  Branch (230:29): [True: 1.03M, False: 31.2k]
  ------------------
  231|  1.03M|        pqdownheap(depth, heap, s->heap_len, tree, n);
  232|       |
  233|       |    /* Construct the Huffman tree by repeatedly combining the least two
  234|       |     * frequent nodes.
  235|       |     */
  236|  31.2k|    node = elems;              /* next internal node of the tree */
  237|  2.04M|    do {
  238|  2.04M|        pqremove(s, depth, heap, tree, n);  /* n = node of least frequency */
  ------------------
  |  |  139|  2.04M|#define pqremove(s, depth, heap, tree, top) { \
  |  |  140|  2.04M|    top = heap[SMALLEST]; \
  |  |  ------------------
  |  |  |  |  123|  2.04M|#define SMALLEST 1
  |  |  ------------------
  |  |  141|  2.04M|    heap[SMALLEST] = heap[s->heap_len--]; \
  |  |  ------------------
  |  |  |  |  123|  2.04M|#define SMALLEST 1
  |  |  ------------------
  |  |  142|  2.04M|    pqdownheap(depth, heap, s->heap_len, tree, SMALLEST); \
  |  |  ------------------
  |  |  |  |  123|  2.04M|#define SMALLEST 1
  |  |  ------------------
  |  |  143|  2.04M|}
  ------------------
  239|  2.04M|        m = heap[SMALLEST]; /* m = node of next least frequency */
  ------------------
  |  |  123|  2.04M|#define SMALLEST 1
  ------------------
  240|       |
  241|  2.04M|        heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
  242|  2.04M|        heap[--(s->heap_max)] = m;
  243|       |
  244|       |        /* Create a new node father of n and m */
  245|  2.04M|        tree[node].Freq = tree[n].Freq + tree[m].Freq;
  ------------------
  |  |  102|  2.04M|#define Freq fc.freq
  ------------------
                      tree[node].Freq = tree[n].Freq + tree[m].Freq;
  ------------------
  |  |  102|  2.04M|#define Freq fc.freq
  ------------------
                      tree[node].Freq = tree[n].Freq + tree[m].Freq;
  ------------------
  |  |  102|  2.04M|#define Freq fc.freq
  ------------------
  246|  2.04M|        depth[node] = (unsigned char)((depth[n] >= depth[m] ?
  ------------------
  |  Branch (246:40): [True: 1.77M, False: 271k]
  ------------------
  247|  1.77M|                                          depth[n] : depth[m]) + 1);
  248|  2.04M|        tree[n].Dad = tree[m].Dad = (uint16_t)node;
  ------------------
  |  |  104|  2.04M|#define Dad  dl.dad
  ------------------
                      tree[n].Dad = tree[m].Dad = (uint16_t)node;
  ------------------
  |  |  104|  2.04M|#define Dad  dl.dad
  ------------------
  249|       |#ifdef DUMP_BL_TREE
  250|       |        if (tree == s->bl_tree) {
  251|       |            fprintf(stderr, "\nnode %d(%d), sons %d(%d) %d(%d)",
  252|       |                    node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
  253|       |        }
  254|       |#endif
  255|       |        /* and insert the new node in the heap */
  256|  2.04M|        heap[SMALLEST] = node++;
  ------------------
  |  |  123|  2.04M|#define SMALLEST 1
  ------------------
  257|  2.04M|        pqdownheap(depth, heap, s->heap_len, tree, SMALLEST);
  ------------------
  |  |  123|  2.04M|#define SMALLEST 1
  ------------------
  258|  2.04M|    } while (s->heap_len >= 2);
  ------------------
  |  Branch (258:14): [True: 2.01M, False: 31.2k]
  ------------------
  259|       |
  260|  31.2k|    heap[--(s->heap_max)] = heap[SMALLEST];
  ------------------
  |  |  123|  31.2k|#define SMALLEST 1
  ------------------
  261|       |
  262|       |    /* At this point, the fields freq and dad are set. We can now
  263|       |     * generate the bit lengths.
  264|       |     */
  265|  31.2k|    gen_bitlen(s, (tree_desc *)desc);
  266|       |
  267|       |    /* The field len is now set, we can generate the bit codes */
  268|  31.2k|    gen_codes((ct_data *)tree, max_code, s->bl_count);
  269|  31.2k|}
trees.c:pqdownheap:
  151|  5.13M|static inline void pqdownheap(unsigned char *depth, int *heap, const int heap_len, ct_data *tree, int k) {
  152|       |    /* tree: the tree to restore */
  153|       |    /* k: node to move down */
  154|  5.13M|    int j = k << 1;  /* left son of k */
  155|  5.13M|    const int v = heap[k];
  156|       |
  157|  26.6M|    while (j <= heap_len) {
  ------------------
  |  Branch (157:12): [True: 22.6M, False: 4.05M]
  ------------------
  158|       |        /* Set j to the smallest of the two sons: */
  159|  22.6M|        if (j < heap_len && smaller(tree, heap[j+1], heap[j], depth)) {
  ------------------
  |  |  132|  22.3M|    (tree[n].Freq < tree[m].Freq || \
  |  |  ------------------
  |  |  |  |  102|  22.3M|#define Freq fc.freq
  |  |  ------------------
  |  |                   (tree[n].Freq < tree[m].Freq || \
  |  |  ------------------
  |  |  |  |  102|  44.7M|#define Freq fc.freq
  |  |  ------------------
  |  |  |  Branch (132:6): [True: 7.00M, False: 15.3M]
  |  |  ------------------
  |  |  133|  22.3M|    (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
  |  |  ------------------
  |  |  |  |  102|  15.3M|#define Freq fc.freq
  |  |  ------------------
  |  |                   (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
  |  |  ------------------
  |  |  |  |  102|  30.6M|#define Freq fc.freq
  |  |  ------------------
  |  |  |  Branch (133:6): [True: 4.22M, False: 11.1M]
  |  |  |  Branch (133:38): [True: 3.70M, False: 520k]
  |  |  ------------------
  ------------------
  |  Branch (159:13): [True: 22.3M, False: 287k]
  ------------------
  160|  10.7M|            j++;
  161|  10.7M|        }
  162|       |        /* Exit if v is smaller than both sons */
  163|  22.6M|        if (smaller(tree, v, heap[j], depth))
  ------------------
  |  |  132|  22.6M|    (tree[n].Freq < tree[m].Freq || \
  |  |  ------------------
  |  |  |  |  102|  22.6M|#define Freq fc.freq
  |  |  ------------------
  |  |                   (tree[n].Freq < tree[m].Freq || \
  |  |  ------------------
  |  |  |  |  102|  45.2M|#define Freq fc.freq
  |  |  ------------------
  |  |  |  Branch (132:6): [True: 850k, False: 21.7M]
  |  |  ------------------
  |  |  133|  22.6M|    (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
  |  |  ------------------
  |  |  |  |  102|  21.7M|#define Freq fc.freq
  |  |  ------------------
  |  |                   (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
  |  |  ------------------
  |  |  |  |  102|  43.5M|#define Freq fc.freq
  |  |  ------------------
  |  |  |  Branch (133:6): [True: 356k, False: 21.4M]
  |  |  |  Branch (133:38): [True: 228k, False: 127k]
  |  |  ------------------
  ------------------
  164|  1.07M|            break;
  165|       |
  166|       |        /* Exchange v with the smallest son */
  167|  21.5M|        heap[k] = heap[j];
  168|  21.5M|        k = j;
  169|       |
  170|       |        /* And continue down the tree, setting j to the left son of k */
  171|  21.5M|        j <<= 1;
  172|  21.5M|    }
  173|  5.13M|    heap[k] = v;
  174|  5.13M|}
trees.c:gen_bitlen:
  281|  31.2k|static void gen_bitlen(deflate_state *s, tree_desc *desc) {
  282|       |    /* desc: the tree descriptor */
  283|  31.2k|    ct_data *tree           = desc->dyn_tree;
  284|  31.2k|    int max_code            = desc->max_code;
  285|  31.2k|    const ct_data *stree    = desc->stat_desc->static_tree;
  286|  31.2k|    const int *extra        = desc->stat_desc->extra_bits;
  287|  31.2k|    int base                = desc->stat_desc->extra_base;
  288|  31.2k|    unsigned int max_length = desc->stat_desc->max_length;
  289|  31.2k|    int h;              /* heap index */
  290|  31.2k|    int n, m;           /* iterate over the tree elements */
  291|  31.2k|    unsigned int bits;  /* bit length */
  292|  31.2k|    int xbits;          /* extra bits */
  293|  31.2k|    uint16_t f;         /* frequency */
  294|  31.2k|    int overflow = 0;   /* number of elements with bit length too large */
  295|       |
  296|   531k|    for (bits = 0; bits <= MAX_BITS; bits++)
  ------------------
  |  |   39|   531k|#define MAX_BITS 15
  ------------------
  |  Branch (296:20): [True: 500k, False: 31.2k]
  ------------------
  297|   500k|        s->bl_count[bits] = 0;
  298|       |
  299|       |    /* In a first pass, compute the optimal bit lengths (which may
  300|       |     * overflow in the case of the bit length tree).
  301|       |     */
  302|  31.2k|    tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
  ------------------
  |  |  105|  31.2k|#define Len  dl.len
  ------------------
  303|       |
  304|  4.13M|    for (h = s->heap_max + 1; h < HEAP_SIZE; h++) {
  ------------------
  |  |   57|  4.13M|#define HEAP_SIZE (2*L_CODES+1)
  |  |  ------------------
  |  |  |  |   48|  4.13M|#define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  4.13M|#define LITERALS  256
  |  |  |  |  ------------------
  |  |  |  |               #define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  4.13M|#define LENGTH_CODES 29
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (304:31): [True: 4.09M, False: 31.2k]
  ------------------
  305|  4.09M|        n = s->heap[h];
  306|  4.09M|        bits = tree[tree[n].Dad].Len + 1u;
  ------------------
  |  |  104|  4.09M|#define Dad  dl.dad
  ------------------
                      bits = tree[tree[n].Dad].Len + 1u;
  ------------------
  |  |  105|  4.09M|#define Len  dl.len
  ------------------
  307|  4.09M|        if (bits > max_length){
  ------------------
  |  Branch (307:13): [True: 5.72k, False: 4.09M]
  ------------------
  308|  5.72k|            bits = max_length;
  309|  5.72k|            overflow++;
  310|  5.72k|        }
  311|  4.09M|        tree[n].Len = (uint16_t)bits;
  ------------------
  |  |  105|  4.09M|#define Len  dl.len
  ------------------
  312|       |        /* We overwrite tree[n].Dad which is no longer needed */
  313|       |
  314|  4.09M|        if (n > max_code) /* not a leaf node */
  ------------------
  |  Branch (314:13): [True: 2.01M, False: 2.08M]
  ------------------
  315|  2.01M|            continue;
  316|       |
  317|  2.08M|        s->bl_count[bits]++;
  318|  2.08M|        xbits = 0;
  319|  2.08M|        if (n >= base)
  ------------------
  |  Branch (319:13): [True: 237k, False: 1.84M]
  ------------------
  320|   237k|            xbits = extra[n-base];
  321|  2.08M|        f = tree[n].Freq;
  ------------------
  |  |  102|  2.08M|#define Freq fc.freq
  ------------------
  322|  2.08M|        s->opt_len += (unsigned int)f * (unsigned int)(bits + xbits);
  323|  2.08M|        if (stree)
  ------------------
  |  Branch (323:13): [True: 1.97M, False: 103k]
  ------------------
  324|  1.97M|            s->static_len += (unsigned int)f * (unsigned int)(stree[n].Len + xbits);
  ------------------
  |  |  105|  1.97M|#define Len  dl.len
  ------------------
  325|  2.08M|    }
  326|  31.2k|    if (overflow == 0)
  ------------------
  |  Branch (326:9): [True: 29.6k, False: 1.57k]
  ------------------
  327|  29.6k|        return;
  328|       |
  329|  1.57k|    Tracev((stderr, "\nbit length overflow\n"));
  330|       |    /* This happens for example on obj2 and pic of the Calgary corpus */
  331|       |
  332|       |    /* Find the first bit length which could increase: */
  333|  2.86k|    do {
  334|  2.86k|        bits = max_length - 1;
  335|  4.10k|        while (s->bl_count[bits] == 0)
  ------------------
  |  Branch (335:16): [True: 1.24k, False: 2.86k]
  ------------------
  336|  1.24k|            bits--;
  337|  2.86k|        s->bl_count[bits]--;       /* move one leaf down the tree */
  338|  2.86k|        s->bl_count[bits+1] += 2u; /* move one overflow item as its brother */
  339|  2.86k|        s->bl_count[max_length]--;
  340|       |        /* The brother of the overflow item also moves one step up,
  341|       |         * but this does not affect bl_count[max_length]
  342|       |         */
  343|  2.86k|        overflow -= 2;
  344|  2.86k|    } while (overflow > 0);
  ------------------
  |  Branch (344:14): [True: 1.29k, False: 1.57k]
  ------------------
  345|       |
  346|       |    /* Now recompute all bit lengths, scanning in increasing frequency.
  347|       |     * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
  348|       |     * lengths instead of fixing only the wrong ones. This idea is taken
  349|       |     * from 'ar' written by Haruhiko Okumura.)
  350|       |     */
  351|  12.7k|    for (bits = max_length; bits != 0; bits--) {
  ------------------
  |  Branch (351:29): [True: 11.1k, False: 1.57k]
  ------------------
  352|  11.1k|        n = s->bl_count[bits];
  353|  57.8k|        while (n != 0) {
  ------------------
  |  Branch (353:16): [True: 46.6k, False: 11.1k]
  ------------------
  354|  46.6k|            m = s->heap[--h];
  355|  46.6k|            if (m > max_code)
  ------------------
  |  Branch (355:17): [True: 20.0k, False: 26.6k]
  ------------------
  356|  20.0k|                continue;
  357|  26.6k|            if (tree[m].Len != bits) {
  ------------------
  |  |  105|  26.6k|#define Len  dl.len
  ------------------
  |  Branch (357:17): [True: 2.48k, False: 24.1k]
  ------------------
  358|  2.48k|                Tracev((stderr, "code %d bits %d->%u\n", m, tree[m].Len, bits));
  359|  2.48k|                s->opt_len += (unsigned int)(bits * tree[m].Freq);
  ------------------
  |  |  102|  2.48k|#define Freq fc.freq
  ------------------
  360|  2.48k|                s->opt_len -= (unsigned int)(tree[m].Len * tree[m].Freq);
  ------------------
  |  |  105|  2.48k|#define Len  dl.len
  ------------------
                              s->opt_len -= (unsigned int)(tree[m].Len * tree[m].Freq);
  ------------------
  |  |  102|  2.48k|#define Freq fc.freq
  ------------------
  361|  2.48k|                tree[m].Len = (uint16_t)bits;
  ------------------
  |  |  105|  2.48k|#define Len  dl.len
  ------------------
  362|  2.48k|            }
  363|  26.6k|            n--;
  364|  26.6k|        }
  365|  11.1k|    }
  366|  1.57k|}
trees.c:build_bl_tree:
  528|  10.4k|static int build_bl_tree(deflate_state *s) {
  529|  10.4k|    int max_blindex;  /* index of last bit length code of non zero freq */
  530|       |
  531|       |    /* Determine the bit length frequencies for literal and distance trees */
  532|  10.4k|    scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
  533|  10.4k|    scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
  534|       |
  535|       |    /* Build the bit length tree: */
  536|  10.4k|    build_tree(s, (tree_desc *)(&(s->bl_desc)));
  537|       |    /* opt_len now includes the length of the tree representations, except
  538|       |     * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
  539|       |     */
  540|       |
  541|       |    /* Determine the number of bit length codes to send. The pkzip format
  542|       |     * requires that at least 4 bit length codes be sent. (appnote.txt says
  543|       |     * 3 but the actual value used is 4.)
  544|       |     */
  545|  27.1k|    for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
  ------------------
  |  |   54|  10.4k|#define BL_CODES  19
  ------------------
  |  Branch (545:36): [True: 27.1k, False: 0]
  ------------------
  546|  27.1k|        if (s->bl_tree[bl_order[max_blindex]].Len != 0)
  ------------------
  |  |  105|  27.1k|#define Len  dl.len
  ------------------
  |  Branch (546:13): [True: 10.4k, False: 16.6k]
  ------------------
  547|  10.4k|            break;
  548|  27.1k|    }
  549|       |    /* Update opt_len to include the bit length tree and counts */
  550|  10.4k|    s->opt_len += 3*((unsigned int)max_blindex+1) + 5+5+4;
  551|  10.4k|    Tracev((stderr, "\ndyn trees: dyn %u, stat %u", s->opt_len, s->static_len));
  552|       |
  553|  10.4k|    return max_blindex;
  554|  10.4k|}
trees.c:scan_tree:
  414|  20.8k|static void scan_tree(deflate_state *s, ct_data *tree, int max_code) {
  415|       |    /* tree: the tree to be scanned */
  416|       |    /* max_code: and its largest code of non zero frequency */
  417|  20.8k|    int n;                     /* iterates over all tree elements */
  418|  20.8k|    int prevlen = -1;          /* last emitted length */
  419|  20.8k|    int curlen;                /* length of current code */
  420|  20.8k|    int nextlen = tree[0].Len; /* length of next code */
  ------------------
  |  |  105|  20.8k|#define Len  dl.len
  ------------------
  421|  20.8k|    uint16_t count = 0;        /* repeat count of the current code */
  422|  20.8k|    uint16_t max_count = 7;    /* max repeat count */
  423|  20.8k|    uint16_t min_count = 4;    /* min repeat count */
  424|       |
  425|  20.8k|    if (nextlen == 0)
  ------------------
  |  Branch (425:9): [True: 3.44k, False: 17.3k]
  ------------------
  426|  3.44k|        max_count = 138, min_count = 3;
  427|       |
  428|  20.8k|    tree[max_code+1].Len = (uint16_t)0xffff; /* guard */
  ------------------
  |  |  105|  20.8k|#define Len  dl.len
  ------------------
  429|       |
  430|  3.00M|    for (n = 0; n <= max_code; n++) {
  ------------------
  |  Branch (430:17): [True: 2.98M, False: 20.8k]
  ------------------
  431|  2.98M|        curlen = nextlen;
  432|  2.98M|        nextlen = tree[n+1].Len;
  ------------------
  |  |  105|  2.98M|#define Len  dl.len
  ------------------
  433|  2.98M|        if (++count < max_count && curlen == nextlen) {
  ------------------
  |  Branch (433:13): [True: 2.83M, False: 150k]
  |  Branch (433:36): [True: 2.07M, False: 752k]
  ------------------
  434|  2.07M|            continue;
  435|  2.07M|        } else if (count < min_count) {
  ------------------
  |  Branch (435:20): [True: 643k, False: 259k]
  ------------------
  436|   643k|            s->bl_tree[curlen].Freq += count;
  ------------------
  |  |  102|   643k|#define Freq fc.freq
  ------------------
  437|   643k|        } else if (curlen != 0) {
  ------------------
  |  Branch (437:20): [True: 206k, False: 53.2k]
  ------------------
  438|   206k|            if (curlen != prevlen)
  ------------------
  |  Branch (438:17): [True: 81.0k, False: 125k]
  ------------------
  439|  81.0k|                s->bl_tree[curlen].Freq++;
  ------------------
  |  |  102|  81.0k|#define Freq fc.freq
  ------------------
  440|   206k|            s->bl_tree[REP_3_6].Freq++;
  ------------------
  |  |   12|   206k|#define REP_3_6      16
  ------------------
                          s->bl_tree[REP_3_6].Freq++;
  ------------------
  |  |  102|   206k|#define Freq fc.freq
  ------------------
  441|   206k|        } else if (count <= 10) {
  ------------------
  |  Branch (441:20): [True: 33.8k, False: 19.3k]
  ------------------
  442|  33.8k|            s->bl_tree[REPZ_3_10].Freq++;
  ------------------
  |  |   15|  33.8k|#define REPZ_3_10    17
  ------------------
                          s->bl_tree[REPZ_3_10].Freq++;
  ------------------
  |  |  102|  33.8k|#define Freq fc.freq
  ------------------
  443|  33.8k|        } else {
  444|  19.3k|            s->bl_tree[REPZ_11_138].Freq++;
  ------------------
  |  |   18|  19.3k|#define REPZ_11_138  18
  ------------------
                          s->bl_tree[REPZ_11_138].Freq++;
  ------------------
  |  |  102|  19.3k|#define Freq fc.freq
  ------------------
  445|  19.3k|        }
  446|   903k|        count = 0;
  447|   903k|        prevlen = curlen;
  448|   903k|        if (nextlen == 0) {
  ------------------
  |  Branch (448:13): [True: 111k, False: 792k]
  ------------------
  449|   111k|            max_count = 138, min_count = 3;
  450|   792k|        } else if (curlen == nextlen) {
  ------------------
  |  Branch (450:20): [True: 139k, False: 652k]
  ------------------
  451|   139k|            max_count = 6, min_count = 3;
  452|   652k|        } else {
  453|   652k|            max_count = 7, min_count = 4;
  454|   652k|        }
  455|   903k|    }
  456|  20.8k|}
trees.c:send_all_trees:
  561|  7.02k|static void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes) {
  562|  7.02k|    int rank;                    /* index in bl_order */
  563|       |
  564|  7.02k|    Assert(lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
  565|  7.02k|    Assert(lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, "too many codes");
  566|       |
  567|       |    // Temp local variables
  568|  7.02k|    uint32_t bi_valid = s->bi_valid;
  569|  7.02k|    uint64_t bi_buf = s->bi_buf;
  570|       |
  571|  7.02k|    Tracev((stderr, "\nbl counts: "));
  572|  7.02k|    send_bits(s, lcodes-257, 5, bi_buf, bi_valid); /* not +255 as stated in appnote.txt */
  ------------------
  |  |   47|  7.02k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |   48|  7.02k|    uint64_t val = (uint64_t)t_val;\
  |  |   49|  7.02k|    uint32_t len = (uint32_t)t_len;\
  |  |   50|  7.02k|    uint32_t total_bits = bi_valid + len;\
  |  |   51|  7.02k|    send_bits_trace(s, val, len);\
  |  |   52|  7.02k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  426|  7.02k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|  7.02k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   53|  7.02k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  14.0k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  7.02k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (53:9): [True: 7.02k, False: 0]
  |  |  |  Branch (53:38): [True: 7.02k, False: 0]
  |  |  ------------------
  |  |   54|  7.02k|        bi_buf |= val << bi_valid;\
  |  |   55|  7.02k|        bi_valid = total_bits;\
  |  |   56|  7.02k|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (56:16): [True: 0, False: 0]
  |  |  ------------------
  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |   58|      0|        bi_buf = val;\
  |  |   59|      0|        bi_valid = len;\
  |  |   60|      0|    } else {\
  |  |   61|      0|        bi_buf |= val << bi_valid;\
  |  |   62|      0|        put_uint64(s, bi_buf);\
  |  |   63|      0|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  ------------------
  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   64|      0|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  ------------------
  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   65|      0|    }\
  |  |   66|  7.02k|}
  ------------------
  573|  7.02k|    send_bits(s, dcodes-1,   5, bi_buf, bi_valid);
  ------------------
  |  |   47|  7.02k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |   48|  7.02k|    uint64_t val = (uint64_t)t_val;\
  |  |   49|  7.02k|    uint32_t len = (uint32_t)t_len;\
  |  |   50|  7.02k|    uint32_t total_bits = bi_valid + len;\
  |  |   51|  7.02k|    send_bits_trace(s, val, len);\
  |  |   52|  7.02k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  426|  7.02k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|  7.02k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   53|  7.02k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  14.0k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  7.02k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (53:9): [True: 7.02k, False: 0]
  |  |  |  Branch (53:38): [True: 7.02k, False: 0]
  |  |  ------------------
  |  |   54|  7.02k|        bi_buf |= val << bi_valid;\
  |  |   55|  7.02k|        bi_valid = total_bits;\
  |  |   56|  7.02k|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (56:16): [True: 0, False: 0]
  |  |  ------------------
  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |   58|      0|        bi_buf = val;\
  |  |   59|      0|        bi_valid = len;\
  |  |   60|      0|    } else {\
  |  |   61|      0|        bi_buf |= val << bi_valid;\
  |  |   62|      0|        put_uint64(s, bi_buf);\
  |  |   63|      0|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  ------------------
  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   64|      0|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  ------------------
  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   65|      0|    }\
  |  |   66|  7.02k|}
  ------------------
  574|  7.02k|    send_bits(s, blcodes-4,  4, bi_buf, bi_valid); /* not -3 as stated in appnote.txt */
  ------------------
  |  |   47|  7.02k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |   48|  7.02k|    uint64_t val = (uint64_t)t_val;\
  |  |   49|  7.02k|    uint32_t len = (uint32_t)t_len;\
  |  |   50|  7.02k|    uint32_t total_bits = bi_valid + len;\
  |  |   51|  7.02k|    send_bits_trace(s, val, len);\
  |  |   52|  7.02k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  426|  7.02k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|  7.02k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   53|  7.02k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  14.0k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  7.02k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (53:9): [True: 7.02k, False: 0]
  |  |  |  Branch (53:38): [True: 7.02k, False: 0]
  |  |  ------------------
  |  |   54|  7.02k|        bi_buf |= val << bi_valid;\
  |  |   55|  7.02k|        bi_valid = total_bits;\
  |  |   56|  7.02k|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (56:16): [True: 0, False: 0]
  |  |  ------------------
  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |   58|      0|        bi_buf = val;\
  |  |   59|      0|        bi_valid = len;\
  |  |   60|      0|    } else {\
  |  |   61|      0|        bi_buf |= val << bi_valid;\
  |  |   62|      0|        put_uint64(s, bi_buf);\
  |  |   63|      0|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  ------------------
  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   64|      0|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  ------------------
  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   65|      0|    }\
  |  |   66|  7.02k|}
  ------------------
  575|   127k|    for (rank = 0; rank < blcodes; rank++) {
  ------------------
  |  Branch (575:20): [True: 120k, False: 7.02k]
  ------------------
  576|   120k|        Tracev((stderr, "\nbl code %2u ", bl_order[rank]));
  577|   120k|        send_bits(s, s->bl_tree[bl_order[rank]].Len, 3, bi_buf, bi_valid);
  ------------------
  |  |   47|   120k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |   48|   120k|    uint64_t val = (uint64_t)t_val;\
  |  |   49|   120k|    uint32_t len = (uint32_t)t_len;\
  |  |   50|   120k|    uint32_t total_bits = bi_valid + len;\
  |  |   51|   120k|    send_bits_trace(s, val, len);\
  |  |   52|   120k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  426|   120k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|   120k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   53|   120k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|   240k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|   113k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (53:9): [True: 113k, False: 6.66k]
  |  |  |  Branch (53:38): [True: 113k, False: 0]
  |  |  ------------------
  |  |   54|   113k|        bi_buf |= val << bi_valid;\
  |  |   55|   113k|        bi_valid = total_bits;\
  |  |   56|   113k|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  13.3k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (56:16): [True: 0, False: 6.66k]
  |  |  ------------------
  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |   58|      0|        bi_buf = val;\
  |  |   59|      0|        bi_valid = len;\
  |  |   60|  6.66k|    } else {\
  |  |   61|  6.66k|        bi_buf |= val << bi_valid;\
  |  |   62|  6.66k|        put_uint64(s, bi_buf);\
  |  |   63|  6.66k|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  ------------------
  |  |  |  |   60|  6.66k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   64|  6.66k|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  ------------------
  |  |  |  |   60|  6.66k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   65|  6.66k|    }\
  |  |   66|   120k|}
  ------------------
  578|   120k|    }
  579|  7.02k|    Tracev((stderr, "\nbl tree: sent %lu", s->bits_sent));
  580|       |
  581|       |    // Store back temp variables
  582|  7.02k|    s->bi_buf = bi_buf;
  583|  7.02k|    s->bi_valid = bi_valid;
  584|       |
  585|  7.02k|    send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
  586|  7.02k|    Tracev((stderr, "\nlit tree: sent %lu", s->bits_sent));
  587|       |
  588|  7.02k|    send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
  589|  7.02k|    Tracev((stderr, "\ndist tree: sent %lu", s->bits_sent));
  590|  7.02k|}
trees.c:send_tree:
  462|  14.0k|static void send_tree(deflate_state *s, ct_data *tree, int max_code) {
  463|       |    /* tree: the tree to be scanned */
  464|       |    /* max_code and its largest code of non zero frequency */
  465|  14.0k|    int n;                     /* iterates over all tree elements */
  466|  14.0k|    int prevlen = -1;          /* last emitted length */
  467|  14.0k|    int curlen;                /* length of current code */
  468|  14.0k|    int nextlen = tree[0].Len; /* length of next code */
  ------------------
  |  |  105|  14.0k|#define Len  dl.len
  ------------------
  469|  14.0k|    int count = 0;             /* repeat count of the current code */
  470|  14.0k|    int max_count = 7;         /* max repeat count */
  471|  14.0k|    int min_count = 4;         /* min repeat count */
  472|       |
  473|       |    /* tree[max_code+1].Len = -1; */  /* guard already set */
  474|  14.0k|    if (nextlen == 0)
  ------------------
  |  Branch (474:9): [True: 2.51k, False: 11.5k]
  ------------------
  475|  2.51k|        max_count = 138, min_count = 3;
  476|       |
  477|       |    // Temp local variables
  478|  14.0k|    uint32_t bi_valid = s->bi_valid;
  479|  14.0k|    uint64_t bi_buf = s->bi_buf;
  480|       |
  481|  2.08M|    for (n = 0; n <= max_code; n++) {
  ------------------
  |  Branch (481:17): [True: 2.06M, False: 14.0k]
  ------------------
  482|  2.06M|        curlen = nextlen;
  483|  2.06M|        nextlen = tree[n+1].Len;
  ------------------
  |  |  105|  2.06M|#define Len  dl.len
  ------------------
  484|  2.06M|        if (++count < max_count && curlen == nextlen) {
  ------------------
  |  Branch (484:13): [True: 1.97M, False: 94.6k]
  |  Branch (484:36): [True: 1.30M, False: 666k]
  ------------------
  485|  1.30M|            continue;
  486|  1.30M|        } else if (count < min_count) {
  ------------------
  |  Branch (486:20): [True: 575k, False: 185k]
  ------------------
  487|   777k|            do {
  488|   777k|                send_code(s, curlen, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   76|   777k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   47|   777k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |  |  |   48|   777k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   49|   777k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   50|   777k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   51|   777k|    send_bits_trace(s, val, len);\
  |  |  |  |   52|   777k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|   777k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|   777k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   53|   777k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  1.55M|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|   745k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (53:9): [True: 745k, False: 31.8k]
  |  |  |  |  |  Branch (53:38): [True: 745k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   54|   745k|        bi_buf |= val << bi_valid;\
  |  |  |  |   55|   745k|        bi_valid = total_bits;\
  |  |  |  |   56|   745k|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  63.6k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (56:16): [True: 0, False: 31.8k]
  |  |  |  |  ------------------
  |  |  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |  |  |   58|      0|        bi_buf = val;\
  |  |  |  |   59|      0|        bi_valid = len;\
  |  |  |  |   60|  31.8k|    } else {\
  |  |  |  |   61|  31.8k|        bi_buf |= val << bi_valid;\
  |  |  |  |   62|  31.8k|        put_uint64(s, bi_buf);\
  |  |  |  |   63|  31.8k|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  31.8k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |   64|  31.8k|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  31.8k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |   65|  31.8k|    }\
  |  |  |  |   66|   777k|}
  |  |  ------------------
  ------------------
  489|   777k|            } while (--count != 0);
  ------------------
  |  Branch (489:22): [True: 201k, False: 575k]
  ------------------
  490|       |
  491|   575k|        } else if (curlen != 0) {
  ------------------
  |  Branch (491:20): [True: 147k, False: 37.4k]
  ------------------
  492|   147k|            if (curlen != prevlen) {
  ------------------
  |  Branch (492:17): [True: 74.5k, False: 73.2k]
  ------------------
  493|  74.5k|                send_code(s, curlen, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   76|  74.5k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   47|  74.5k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |  |  |   48|  74.5k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   49|  74.5k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   50|  74.5k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   51|  74.5k|    send_bits_trace(s, val, len);\
  |  |  |  |   52|  74.5k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|  74.5k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|  74.5k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   53|  74.5k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|   149k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  72.0k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (53:9): [True: 72.0k, False: 2.46k]
  |  |  |  |  |  Branch (53:38): [True: 72.0k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   54|  72.0k|        bi_buf |= val << bi_valid;\
  |  |  |  |   55|  72.0k|        bi_valid = total_bits;\
  |  |  |  |   56|  72.0k|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  4.92k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (56:16): [True: 0, False: 2.46k]
  |  |  |  |  ------------------
  |  |  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |  |  |   58|      0|        bi_buf = val;\
  |  |  |  |   59|      0|        bi_valid = len;\
  |  |  |  |   60|  2.46k|    } else {\
  |  |  |  |   61|  2.46k|        bi_buf |= val << bi_valid;\
  |  |  |  |   62|  2.46k|        put_uint64(s, bi_buf);\
  |  |  |  |   63|  2.46k|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  2.46k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |   64|  2.46k|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  2.46k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |   65|  2.46k|    }\
  |  |  |  |   66|  74.5k|}
  |  |  ------------------
  ------------------
  494|  74.5k|                count--;
  495|  74.5k|            }
  496|   147k|            Assert(count >= 3 && count <= 6, " 3_6?");
  497|   147k|            send_code(s, REP_3_6, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   76|   147k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   47|   147k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |  |  |   48|   147k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   49|   147k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   50|   147k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   51|   147k|    send_bits_trace(s, val, len);\
  |  |  |  |   52|   147k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|   147k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|   147k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   53|   147k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|   295k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|   142k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (53:9): [True: 142k, False: 4.89k]
  |  |  |  |  |  Branch (53:38): [True: 142k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   54|   142k|        bi_buf |= val << bi_valid;\
  |  |  |  |   55|   142k|        bi_valid = total_bits;\
  |  |  |  |   56|   142k|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  9.78k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (56:16): [True: 0, False: 4.89k]
  |  |  |  |  ------------------
  |  |  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |  |  |   58|      0|        bi_buf = val;\
  |  |  |  |   59|      0|        bi_valid = len;\
  |  |  |  |   60|  4.89k|    } else {\
  |  |  |  |   61|  4.89k|        bi_buf |= val << bi_valid;\
  |  |  |  |   62|  4.89k|        put_uint64(s, bi_buf);\
  |  |  |  |   63|  4.89k|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  4.89k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |   64|  4.89k|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  4.89k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |   65|  4.89k|    }\
  |  |  |  |   66|   147k|}
  |  |  ------------------
  ------------------
  498|   147k|            send_bits(s, count-3, 2, bi_buf, bi_valid);
  ------------------
  |  |   47|   147k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |   48|   147k|    uint64_t val = (uint64_t)t_val;\
  |  |   49|   147k|    uint32_t len = (uint32_t)t_len;\
  |  |   50|   147k|    uint32_t total_bits = bi_valid + len;\
  |  |   51|   147k|    send_bits_trace(s, val, len);\
  |  |   52|   147k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  426|   147k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|   147k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   53|   147k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|   295k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|   143k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (53:9): [True: 143k, False: 4.49k]
  |  |  |  Branch (53:38): [True: 143k, False: 0]
  |  |  ------------------
  |  |   54|   143k|        bi_buf |= val << bi_valid;\
  |  |   55|   143k|        bi_valid = total_bits;\
  |  |   56|   143k|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  8.99k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (56:16): [True: 0, False: 4.49k]
  |  |  ------------------
  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |   58|      0|        bi_buf = val;\
  |  |   59|      0|        bi_valid = len;\
  |  |   60|  4.49k|    } else {\
  |  |   61|  4.49k|        bi_buf |= val << bi_valid;\
  |  |   62|  4.49k|        put_uint64(s, bi_buf);\
  |  |   63|  4.49k|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  ------------------
  |  |  |  |   60|  4.49k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   64|  4.49k|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  ------------------
  |  |  |  |   60|  4.49k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   65|  4.49k|    }\
  |  |   66|   147k|}
  ------------------
  499|       |
  500|   147k|        } else if (count <= 10) {
  ------------------
  |  Branch (500:20): [True: 26.3k, False: 11.1k]
  ------------------
  501|  26.3k|            send_code(s, REPZ_3_10, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   76|  26.3k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   47|  26.3k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |  |  |   48|  26.3k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   49|  26.3k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   50|  26.3k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   51|  26.3k|    send_bits_trace(s, val, len);\
  |  |  |  |   52|  26.3k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|  26.3k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|  26.3k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   53|  26.3k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  52.6k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  24.6k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (53:9): [True: 24.6k, False: 1.66k]
  |  |  |  |  |  Branch (53:38): [True: 24.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   54|  24.6k|        bi_buf |= val << bi_valid;\
  |  |  |  |   55|  24.6k|        bi_valid = total_bits;\
  |  |  |  |   56|  24.6k|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  3.32k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (56:16): [True: 0, False: 1.66k]
  |  |  |  |  ------------------
  |  |  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |  |  |   58|      0|        bi_buf = val;\
  |  |  |  |   59|      0|        bi_valid = len;\
  |  |  |  |   60|  1.66k|    } else {\
  |  |  |  |   61|  1.66k|        bi_buf |= val << bi_valid;\
  |  |  |  |   62|  1.66k|        put_uint64(s, bi_buf);\
  |  |  |  |   63|  1.66k|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  1.66k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |   64|  1.66k|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  1.66k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |   65|  1.66k|    }\
  |  |  |  |   66|  26.3k|}
  |  |  ------------------
  ------------------
  502|  26.3k|            send_bits(s, count-3, 3, bi_buf, bi_valid);
  ------------------
  |  |   47|  26.3k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |   48|  26.3k|    uint64_t val = (uint64_t)t_val;\
  |  |   49|  26.3k|    uint32_t len = (uint32_t)t_len;\
  |  |   50|  26.3k|    uint32_t total_bits = bi_valid + len;\
  |  |   51|  26.3k|    send_bits_trace(s, val, len);\
  |  |   52|  26.3k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  426|  26.3k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|  26.3k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   53|  26.3k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  52.6k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  25.0k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (53:9): [True: 25.0k, False: 1.26k]
  |  |  |  Branch (53:38): [True: 25.0k, False: 0]
  |  |  ------------------
  |  |   54|  25.0k|        bi_buf |= val << bi_valid;\
  |  |   55|  25.0k|        bi_valid = total_bits;\
  |  |   56|  25.0k|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  2.52k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (56:16): [True: 0, False: 1.26k]
  |  |  ------------------
  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |   58|      0|        bi_buf = val;\
  |  |   59|      0|        bi_valid = len;\
  |  |   60|  1.26k|    } else {\
  |  |   61|  1.26k|        bi_buf |= val << bi_valid;\
  |  |   62|  1.26k|        put_uint64(s, bi_buf);\
  |  |   63|  1.26k|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  ------------------
  |  |  |  |   60|  1.26k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   64|  1.26k|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  ------------------
  |  |  |  |   60|  1.26k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   65|  1.26k|    }\
  |  |   66|  26.3k|}
  ------------------
  503|       |
  504|  26.3k|        } else {
  505|  11.1k|            send_code(s, REPZ_11_138, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   76|  11.1k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   47|  11.1k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |  |  |   48|  11.1k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   49|  11.1k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   50|  11.1k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   51|  11.1k|    send_bits_trace(s, val, len);\
  |  |  |  |   52|  11.1k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|  11.1k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|  11.1k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   53|  11.1k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  22.2k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  10.2k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (53:9): [True: 10.2k, False: 895]
  |  |  |  |  |  Branch (53:38): [True: 10.2k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   54|  10.2k|        bi_buf |= val << bi_valid;\
  |  |  |  |   55|  10.2k|        bi_valid = total_bits;\
  |  |  |  |   56|  10.2k|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  1.79k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (56:16): [True: 0, False: 895]
  |  |  |  |  ------------------
  |  |  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |  |  |   58|      0|        bi_buf = val;\
  |  |  |  |   59|      0|        bi_valid = len;\
  |  |  |  |   60|    895|    } else {\
  |  |  |  |   61|    895|        bi_buf |= val << bi_valid;\
  |  |  |  |   62|    895|        put_uint64(s, bi_buf);\
  |  |  |  |   63|    895|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|    895|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |   64|    895|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|    895|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |   65|    895|    }\
  |  |  |  |   66|  11.1k|}
  |  |  ------------------
  ------------------
  506|  11.1k|            send_bits(s, count-11, 7, bi_buf, bi_valid);
  ------------------
  |  |   47|  11.1k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |   48|  11.1k|    uint64_t val = (uint64_t)t_val;\
  |  |   49|  11.1k|    uint32_t len = (uint32_t)t_len;\
  |  |   50|  11.1k|    uint32_t total_bits = bi_valid + len;\
  |  |   51|  11.1k|    send_bits_trace(s, val, len);\
  |  |   52|  11.1k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  426|  11.1k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|  11.1k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   53|  11.1k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  22.2k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  9.99k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (53:9): [True: 9.99k, False: 1.12k]
  |  |  |  Branch (53:38): [True: 9.99k, False: 0]
  |  |  ------------------
  |  |   54|  9.99k|        bi_buf |= val << bi_valid;\
  |  |   55|  9.99k|        bi_valid = total_bits;\
  |  |   56|  9.99k|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  2.25k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (56:16): [True: 0, False: 1.12k]
  |  |  ------------------
  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |   58|      0|        bi_buf = val;\
  |  |   59|      0|        bi_valid = len;\
  |  |   60|  1.12k|    } else {\
  |  |   61|  1.12k|        bi_buf |= val << bi_valid;\
  |  |   62|  1.12k|        put_uint64(s, bi_buf);\
  |  |   63|  1.12k|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  ------------------
  |  |  |  |   60|  1.12k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   64|  1.12k|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  ------------------
  |  |  |  |   60|  1.12k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   65|  1.12k|    }\
  |  |   66|  11.1k|}
  ------------------
  507|  11.1k|        }
  508|   760k|        count = 0;
  509|   760k|        prevlen = curlen;
  510|   760k|        if (nextlen == 0) {
  ------------------
  |  Branch (510:13): [True: 83.1k, False: 677k]
  ------------------
  511|  83.1k|            max_count = 138, min_count = 3;
  512|   677k|        } else if (curlen == nextlen) {
  ------------------
  |  Branch (512:20): [True: 85.1k, False: 592k]
  ------------------
  513|  85.1k|            max_count = 6, min_count = 3;
  514|   592k|        } else {
  515|   592k|            max_count = 7, min_count = 4;
  516|   592k|        }
  517|   760k|    }
  518|       |
  519|       |    // Store back temp variables
  520|  14.0k|    s->bi_buf = bi_buf;
  521|  14.0k|    s->bi_valid = bi_valid;
  522|  14.0k|}
trees.c:compress_block:
  711|  8.86k|static void compress_block(deflate_state *s, const ct_data *ltree, const ct_data *dtree) {
  712|       |    /* ltree: literal tree */
  713|       |    /* dtree: distance tree */
  714|  8.86k|    unsigned dist;      /* distance of matched string */
  715|  8.86k|    int lc;             /* match length or unmatched char (if dist == 0) */
  716|  8.86k|    unsigned sx = 0;    /* running index in symbol buffers */
  717|       |
  718|       |    /* Local pointers to avoid indirection */
  719|  8.86k|    const unsigned int sym_next = s->sym_next;
  720|       |#ifdef LIT_MEM
  721|       |    uint16_t *d_buf = s->d_buf;
  722|       |    unsigned char *l_buf = s->l_buf;
  723|       |#else
  724|  8.86k|    unsigned char *sym_buf = s->sym_buf;
  725|  8.86k|#endif
  726|       |
  727|       |    /* Keep bi_buf and bi_valid in registers across the entire loop */
  728|  8.86k|    uint64_t bi_buf = s->bi_buf;
  729|  8.86k|    uint32_t bi_valid = s->bi_valid;
  730|       |
  731|  8.86k|    if (sym_next != 0) {
  ------------------
  |  Branch (731:9): [True: 8.81k, False: 53]
  ------------------
  732|  97.2M|        do {
  733|       |#ifdef LIT_MEM
  734|       |            dist = d_buf[sx];
  735|       |            lc = l_buf[sx++];
  736|       |#else
  737|  97.2M|#  if OPTIMAL_CMP >= 32
  738|  97.2M|            uint32_t val = Z_U32_FROM_LE(zng_memread_4(&sym_buf[sx]));
  ------------------
  |  |   65|  97.2M|#  define Z_U32_FROM_LE(x)  (x)
  ------------------
  739|  97.2M|            dist = val & 0xffff;
  740|  97.2M|            lc = (val >> 16) & 0xff;
  741|       |#  else
  742|       |            dist = sym_buf[sx] + ((unsigned)sym_buf[sx + 1] << 8);
  743|       |            lc = sym_buf[sx + 2];
  744|       |#  endif
  745|  97.2M|            sx += 3;
  746|  97.2M|#endif
  747|  97.2M|            if (dist == 0) {
  ------------------
  |  Branch (747:17): [True: 95.1M, False: 2.10M]
  ------------------
  748|  95.1M|                zng_emit_lit(s, ltree, lc, &bi_buf, &bi_valid);
  749|  95.1M|            } else {
  750|  2.10M|                zng_emit_dist(s, ltree, dtree, lc, dist, &bi_buf, &bi_valid);
  751|  2.10M|            } /* literal or match pair ? */
  752|       |
  753|       |            /* Check for no overlay of pending_buf on needed symbols */
  754|       |#ifdef LIT_MEM
  755|       |            Assert(s->pending < 2 * (s->lit_bufsize + sx), "pending_buf overflow");
  756|       |#else
  757|  97.2M|            Assert(s->pending < s->lit_bufsize + sx, "pending_buf overflow");
  758|  97.2M|#endif
  759|  97.2M|        } while (sx < sym_next);
  ------------------
  |  Branch (759:18): [True: 97.2M, False: 8.81k]
  ------------------
  760|  8.81k|    }
  761|       |
  762|  8.86k|    zng_emit_end_block(s, ltree, 0, &bi_buf, &bi_valid);
  763|       |
  764|       |    /* Write back to state */
  765|  8.86k|    s->bi_buf = bi_buf;
  766|  8.86k|    s->bi_valid = bi_valid;
  767|  8.86k|}
trees.c:detect_data_type:
  782|  3.46k|static int detect_data_type(deflate_state *s) {
  783|       |    /* block_mask is the bit mask of block-listed bytes
  784|       |     * set bits 0..6, 14..25, and 28..31
  785|       |     * 0xf3ffc07f = binary 11110011111111111100000001111111
  786|       |     */
  787|  3.46k|    unsigned long block_mask = 0xf3ffc07fUL;
  788|  3.46k|    int n;
  789|       |
  790|       |    /* Check for non-textual ("block-listed") bytes. */
  791|  24.0k|    for (n = 0; n <= 31; n++, block_mask >>= 1)
  ------------------
  |  Branch (791:17): [True: 23.5k, False: 558]
  ------------------
  792|  23.5k|        if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
  ------------------
  |  |  102|  17.7k|#define Freq fc.freq
  ------------------
  |  Branch (792:13): [True: 17.7k, False: 5.79k]
  |  Branch (792:33): [True: 2.90k, False: 14.8k]
  ------------------
  793|  2.90k|            return Z_BINARY;
  ------------------
  |  |  206|  2.90k|#define Z_BINARY   0
  ------------------
  794|       |
  795|       |    /* Check for textual ("allow-listed") bytes. */
  796|    558|    if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |  102|    558|#define Freq fc.freq
  ------------------
                  if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |  102|    529|#define Freq fc.freq
  ------------------
                  if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |  102|    503|#define Freq fc.freq
  ------------------
  |  Branch (796:9): [True: 29, False: 529]
  |  Branch (796:38): [True: 26, False: 503]
  |  Branch (796:68): [True: 14, False: 489]
  ------------------
  797|     69|        return Z_TEXT;
  ------------------
  |  |  207|     69|#define Z_TEXT     1
  ------------------
  798|  48.1k|    for (n = 32; n < LITERALS; n++)
  ------------------
  |  |   45|  48.1k|#define LITERALS  256
  ------------------
  |  Branch (798:18): [True: 48.1k, False: 5]
  ------------------
  799|  48.1k|        if (s->dyn_ltree[n].Freq != 0)
  ------------------
  |  |  102|  48.1k|#define Freq fc.freq
  ------------------
  |  Branch (799:13): [True: 484, False: 47.6k]
  ------------------
  800|    484|            return Z_TEXT;
  ------------------
  |  |  207|    973|#define Z_TEXT     1
  ------------------
  801|       |
  802|       |    /* There are no "block-listed" or "allow-listed" bytes:
  803|       |     * this stream either is empty or has tolerated ("gray-listed") bytes only.
  804|       |     */
  805|      5|    return Z_BINARY;
  ------------------
  |  |  206|      5|#define Z_BINARY   0
  ------------------
  806|    489|}

trees.c:zng_tr_emit_tree:
  197|  10.4k|static inline void zng_tr_emit_tree(deflate_state *s, int type, const int last) {
  198|  10.4k|    uint32_t bi_valid = s->bi_valid;
  199|  10.4k|    uint64_t bi_buf = s->bi_buf;
  200|  10.4k|    uint32_t header_bits = (type << 1) + last;
  201|  10.4k|    send_bits(s, header_bits, 3, bi_buf, bi_valid);
  ------------------
  |  |   47|  10.4k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |   48|  10.4k|    uint64_t val = (uint64_t)t_val;\
  |  |   49|  10.4k|    uint32_t len = (uint32_t)t_len;\
  |  |   50|  10.4k|    uint32_t total_bits = bi_valid + len;\
  |  |   51|  10.4k|    send_bits_trace(s, val, len);\
  |  |   52|  10.4k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  426|  10.4k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|  10.4k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   53|  10.4k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  20.9k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  10.4k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (53:9): [True: 10.4k, False: 0]
  |  |  |  Branch (53:38): [True: 10.4k, False: 0]
  |  |  ------------------
  |  |   54|  10.4k|        bi_buf |= val << bi_valid;\
  |  |   55|  10.4k|        bi_valid = total_bits;\
  |  |   56|  10.4k|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (56:16): [True: 0, False: 0]
  |  |  ------------------
  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |   58|      0|        bi_buf = val;\
  |  |   59|      0|        bi_valid = len;\
  |  |   60|      0|    } else {\
  |  |   61|      0|        bi_buf |= val << bi_valid;\
  |  |   62|      0|        put_uint64(s, bi_buf);\
  |  |   63|      0|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  ------------------
  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   64|      0|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  ------------------
  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   65|      0|    }\
  |  |   66|  10.4k|}
  ------------------
  202|  10.4k|    cmpr_bits_add(s, 3);
  ------------------
  |  |  424|  10.4k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  150|  10.4k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  203|  10.4k|    s->bi_valid = bi_valid;
  204|  10.4k|    s->bi_buf = bi_buf;
  205|  10.4k|    Tracev((stderr, "\n--- Emit Tree: Last: %u\n", last));
  206|  10.4k|}
trees.c:zng_tr_emit_align:
  211|  5.06k|static inline void zng_tr_emit_align(deflate_state *s) {
  212|  5.06k|    bi_windup(s); /* align on byte boundary */
  213|  5.06k|    sent_bits_align(s);
  214|  5.06k|}
trees.c:bi_windup:
   82|  5.06k|static inline void bi_windup(deflate_state *s) {
   83|  5.06k|    if (s->bi_valid > 56) {
  ------------------
  |  Branch (83:9): [True: 320, False: 4.74k]
  ------------------
   84|    320|        put_uint64(s, s->bi_buf);
   85|  4.74k|    } else {
   86|  4.74k|        if (s->bi_valid > 24) {
  ------------------
  |  Branch (86:13): [True: 1.41k, False: 3.32k]
  ------------------
   87|  1.41k|            put_uint32(s, (uint32_t)s->bi_buf);
   88|  1.41k|            s->bi_buf >>= 32;
   89|  1.41k|            s->bi_valid -= 32;
   90|  1.41k|        }
   91|  4.74k|        if (s->bi_valid > 8) {
  ------------------
  |  Branch (91:13): [True: 1.65k, False: 3.09k]
  ------------------
   92|  1.65k|            put_short(s, (uint16_t)s->bi_buf);
   93|  1.65k|            s->bi_buf >>= 16;
   94|  1.65k|            s->bi_valid -= 16;
   95|  1.65k|        }
   96|  4.74k|        if (s->bi_valid > 0) {
  ------------------
  |  Branch (96:13): [True: 3.14k, False: 1.59k]
  ------------------
   97|  3.14k|            put_byte(s, s->bi_buf);
  ------------------
  |  |  326|  3.14k|#define put_byte(s, c) { \
  |  |  327|  3.14k|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  328|  3.14k|}
  ------------------
   98|  3.14k|        }
   99|  4.74k|    }
  100|  5.06k|    s->bi_buf = 0;
  101|  5.06k|    s->bi_valid = 0;
  102|  5.06k|}
trees.c:zng_emit_end_block:
  162|  8.86k|                                      uint64_t *bi_buf, uint32_t *bi_valid) {
  163|  8.86k|    send_code(s, END_BLOCK, ltree, *bi_buf, *bi_valid);
  ------------------
  |  |   76|  8.86k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   47|  8.86k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |  |  |   48|  8.86k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   49|  8.86k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   50|  8.86k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   51|  8.86k|    send_bits_trace(s, val, len);\
  |  |  |  |   52|  8.86k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|  8.86k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|  8.86k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   53|  8.86k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  17.7k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  7.36k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (53:9): [True: 7.36k, False: 1.50k]
  |  |  |  |  |  Branch (53:38): [True: 7.36k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   54|  7.36k|        bi_buf |= val << bi_valid;\
  |  |  |  |   55|  7.36k|        bi_valid = total_bits;\
  |  |  |  |   56|  7.36k|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  3.00k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (56:16): [True: 0, False: 1.50k]
  |  |  |  |  ------------------
  |  |  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |  |  |   58|      0|        bi_buf = val;\
  |  |  |  |   59|      0|        bi_valid = len;\
  |  |  |  |   60|  1.50k|    } else {\
  |  |  |  |   61|  1.50k|        bi_buf |= val << bi_valid;\
  |  |  |  |   62|  1.50k|        put_uint64(s, bi_buf);\
  |  |  |  |   63|  1.50k|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  1.50k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |   64|  1.50k|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  1.50k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |   65|  1.50k|    }\
  |  |  |  |   66|  8.86k|}
  |  |  ------------------
  ------------------
  164|  8.86k|    Tracev((stderr, "\n+++ Emit End Block: Last: %u Pending: %u Total Out: %" PRIu64 "\n",
  165|  8.86k|        last, s->pending, (uint64_t)s->strm->total_out));
  166|  8.86k|    Z_UNUSED(last);
  ------------------
  |  |  150|  8.86k|#define Z_UNUSED(var) (void)(var)
  ------------------
  167|  8.86k|}
trees.c:zng_emit_lit:
  108|  95.1M|                                uint64_t *bi_buf, uint32_t *bi_valid) {
  109|  95.1M|    send_code(s, c, ltree, *bi_buf, *bi_valid);
  ------------------
  |  |   76|  95.1M|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   47|  95.1M|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |  |  |   48|  95.1M|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   49|  95.1M|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   50|  95.1M|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   51|  95.1M|    send_bits_trace(s, val, len);\
  |  |  |  |   52|  95.1M|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|  95.1M|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|  95.1M|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   53|  95.1M|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|   190M|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  84.1M|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (53:9): [True: 84.1M, False: 10.9M]
  |  |  |  |  |  Branch (53:38): [True: 84.1M, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   54|  84.1M|        bi_buf |= val << bi_valid;\
  |  |  |  |   55|  84.1M|        bi_valid = total_bits;\
  |  |  |  |   56|  84.1M|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  21.9M|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (56:16): [True: 0, False: 10.9M]
  |  |  |  |  ------------------
  |  |  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |  |  |   58|      0|        bi_buf = val;\
  |  |  |  |   59|      0|        bi_valid = len;\
  |  |  |  |   60|  10.9M|    } else {\
  |  |  |  |   61|  10.9M|        bi_buf |= val << bi_valid;\
  |  |  |  |   62|  10.9M|        put_uint64(s, bi_buf);\
  |  |  |  |   63|  10.9M|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  10.9M|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |   64|  10.9M|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  10.9M|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |   65|  10.9M|    }\
  |  |  |  |   66|  95.1M|}
  |  |  ------------------
  ------------------
  110|  95.1M|    Tracecv(isgraph(c & 0xff), (stderr, " '%c' ", c));
  111|  95.1M|}
trees.c:zng_emit_dist:
  117|  2.10M|                                     uint32_t lc, uint32_t dist, uint64_t *bi_buf, uint32_t *bi_valid) {
  118|  2.10M|    uint32_t c, extra, lext;
  119|  2.10M|    uint8_t code;
  120|  2.10M|    uint64_t match_bits;
  121|  2.10M|    uint32_t match_bits_len;
  122|       |
  123|       |    /* Send the length code, len is the match length - STD_MIN_MATCH */
  124|  2.10M|    code = zng_length_code[lc];
  125|  2.10M|    c = code+LITERALS+1;
  ------------------
  |  |   45|  2.10M|#define LITERALS  256
  ------------------
  126|  2.10M|    Assert(c < L_CODES, "bad l_code");
  127|  2.10M|    send_code_trace(s, c);
  128|       |
  129|  2.10M|    match_bits = ltree[c].Code;
  ------------------
  |  |  103|  2.10M|#define Code fc.code
  ------------------
  130|  2.10M|    match_bits_len = ltree[c].Len;
  ------------------
  |  |  105|  2.10M|#define Len  dl.len
  ------------------
  131|       |    /* Get extra bits count and subtract base length from match length */
  132|  2.10M|    lext = lbase_extra[code];
  133|  2.10M|    extra = lext >> 8;
  134|  2.10M|    lc -= lext & 0xff;
  135|  2.10M|    match_bits |= ((uint64_t)(lc & ((1U << extra) - 1)) << match_bits_len);
  136|  2.10M|    match_bits_len += extra;
  137|       |
  138|  2.10M|    dist--; /* dist is now the match distance - 1 */
  139|  2.10M|    code = d_code(dist);
  ------------------
  |  |  411|  2.10M|#define d_code(dist) ((dist) < 256 ? zng_dist_code[dist] : zng_dist_code[256+((dist)>>7)])
  |  |  ------------------
  |  |  |  Branch (411:23): [True: 501k, False: 1.60M]
  |  |  ------------------
  ------------------
  140|  2.10M|    Assert(code < D_CODES, "bad d_code");
  141|  2.10M|    send_code_trace(s, code);
  142|       |
  143|       |    /* Send the distance code */
  144|  2.10M|    match_bits |= ((uint64_t)dtree[code].Code << match_bits_len);
  ------------------
  |  |  103|  2.10M|#define Code fc.code
  ------------------
  145|  2.10M|    match_bits_len += dtree[code].Len;
  ------------------
  |  |  105|  2.10M|#define Len  dl.len
  ------------------
  146|       |    /* Get extra bits count and subtract base distance */
  147|  2.10M|    lext = dbase_extra[code];
  148|  2.10M|    extra = lext >> 16;
  149|  2.10M|    dist -= lext & 0xffff;
  150|  2.10M|    match_bits |= ((uint64_t)(dist & ((1U << extra) - 1)) << match_bits_len);
  151|  2.10M|    match_bits_len += extra;
  152|       |
  153|  2.10M|    send_bits(s, match_bits, match_bits_len, *bi_buf, *bi_valid);
  ------------------
  |  |   47|  2.10M|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |   48|  2.10M|    uint64_t val = (uint64_t)t_val;\
  |  |   49|  2.10M|    uint32_t len = (uint32_t)t_len;\
  |  |   50|  2.10M|    uint32_t total_bits = bi_valid + len;\
  |  |   51|  2.10M|    send_bits_trace(s, val, len);\
  |  |   52|  2.10M|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  426|  2.10M|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|  2.10M|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   53|  2.10M|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  4.21M|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  1.52M|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (53:9): [True: 1.52M, False: 582k]
  |  |  |  Branch (53:38): [True: 1.52M, False: 0]
  |  |  ------------------
  |  |   54|  1.52M|        bi_buf |= val << bi_valid;\
  |  |   55|  1.52M|        bi_valid = total_bits;\
  |  |   56|  1.52M|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  1.16M|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (56:16): [True: 0, False: 582k]
  |  |  ------------------
  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |   58|      0|        bi_buf = val;\
  |  |   59|      0|        bi_valid = len;\
  |  |   60|   582k|    } else {\
  |  |   61|   582k|        bi_buf |= val << bi_valid;\
  |  |   62|   582k|        put_uint64(s, bi_buf);\
  |  |   63|   582k|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  ------------------
  |  |  |  |   60|   582k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   64|   582k|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  ------------------
  |  |  |  |   60|   582k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   65|   582k|    }\
  |  |   66|  2.10M|}
  ------------------
  154|       |
  155|  2.10M|    return match_bits_len;
  156|  2.10M|}

deflate.c:zng_memwrite_2:
   45|  3.46k|static inline void zng_memwrite_2(void *ptr, uint16_t val) {
   46|  3.46k|#if defined(HAVE_MAY_ALIAS)
   47|  3.46k|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   48|  3.46k|    ((unaligned_uint16_t *)ptr)->val = val;
   49|       |#else
   50|       |    memcpy(ptr, &val, sizeof(val));
   51|       |#endif
   52|  3.46k|}
deflate.c:zng_memwrite_4:
   54|  3.46k|static inline void zng_memwrite_4(void *ptr, uint32_t val) {
   55|  3.46k|#if defined(HAVE_MAY_ALIAS)
   56|  3.46k|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|  3.46k|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|  3.46k|}
deflate.c:zng_memread_4:
   23|   148M|static inline uint32_t zng_memread_4(const void *ptr) {
   24|   148M|#if defined(HAVE_MAY_ALIAS)
   25|   148M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|   148M|    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|   148M|}
deflate_medium.c:zng_memread_4:
   23|   119M|static inline uint32_t zng_memread_4(const void *ptr) {
   24|   119M|#if defined(HAVE_MAY_ALIAS)
   25|   119M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|   119M|    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|   119M|}
deflate_medium.c:zng_memwrite_4:
   54|   119M|static inline void zng_memwrite_4(void *ptr, uint32_t val) {
   55|   119M|#if defined(HAVE_MAY_ALIAS)
   56|   119M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|   119M|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|   119M|}
insert_string.c:zng_memread_4:
   23|  14.7M|static inline uint32_t zng_memread_4(const void *ptr) {
   24|  14.7M|#if defined(HAVE_MAY_ALIAS)
   25|  14.7M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  14.7M|    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.7M|}
trees.c:zng_memwrite_8:
   63|  11.6M|static inline void zng_memwrite_8(void *ptr, uint64_t val) {
   64|  11.6M|#if defined(HAVE_MAY_ALIAS)
   65|  11.6M|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   66|  11.6M|    ((unaligned_uint64_t *)ptr)->val = val;
   67|       |#else
   68|       |    memcpy(ptr, &val, sizeof(val));
   69|       |#endif
   70|  11.6M|}
trees.c:zng_memwrite_2:
   45|  7.73k|static inline void zng_memwrite_2(void *ptr, uint16_t val) {
   46|  7.73k|#if defined(HAVE_MAY_ALIAS)
   47|  7.73k|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   48|  7.73k|    ((unaligned_uint16_t *)ptr)->val = val;
   49|       |#else
   50|       |    memcpy(ptr, &val, sizeof(val));
   51|       |#endif
   52|  7.73k|}
trees.c:zng_memread_4:
   23|  97.2M|static inline uint32_t zng_memread_4(const void *ptr) {
   24|  97.2M|#if defined(HAVE_MAY_ALIAS)
   25|  97.2M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  97.2M|    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|  97.2M|}
trees.c:zng_memwrite_4:
   54|  4.32k|static inline void zng_memwrite_4(void *ptr, uint32_t val) {
   55|  4.32k|#if defined(HAVE_MAY_ALIAS)
   56|  4.32k|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|  4.32k|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|  4.32k|}
compare256_avx2.c:zng_memread_8:
   34|   103M|static inline uint64_t zng_memread_8(const void *ptr) {
   35|   103M|#if defined(HAVE_MAY_ALIAS)
   36|   103M|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   37|   103M|    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|   103M|}
compare256_avx2.c:zng_memcmp_2:
   75|  55.3M|static inline int32_t zng_memcmp_2(const void *src0, const void *src1) {
   76|  55.3M|#if defined(HAVE_MAY_ALIAS)
   77|  55.3M|    return zng_memread_2(src0) != zng_memread_2(src1);
   78|       |#else
   79|       |    return memcmp(src0, src1, 2);
   80|       |#endif
   81|  55.3M|}
compare256_avx2.c:zng_memread_2:
   12|   110M|static inline uint16_t zng_memread_2(const void *ptr) {
   13|   110M|#if defined(HAVE_MAY_ALIAS)
   14|   110M|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   15|   110M|    return ((const unaligned_uint16_t *)ptr)->val;
   16|       |#else
   17|       |    uint16_t val;
   18|       |    memcpy(&val, ptr, sizeof(val));
   19|       |    return val;
   20|       |#endif
   21|   110M|}
compare256_avx2.c:zng_memcmp_8:
   91|  8.75M|static inline int32_t zng_memcmp_8(const void *src0, const void *src1) {
   92|  8.75M|#if defined(HAVE_MAY_ALIAS)
   93|  8.75M|    return zng_memread_8(src0) != zng_memread_8(src1);
   94|       |#else
   95|       |    return memcmp(src0, src1, 8);
   96|       |#endif
   97|  8.75M|}
compare256_avx2.c:zng_memcmp_4:
   83|  11.5M|static inline int32_t zng_memcmp_4(const void *src0, const void *src1) {
   84|  11.5M|#if defined(HAVE_MAY_ALIAS)
   85|  11.5M|    return zng_memread_4(src0) != zng_memread_4(src1);
   86|       |#else
   87|       |    return memcmp(src0, src1, 4);
   88|       |#endif
   89|  11.5M|}
compare256_avx2.c:zng_memread_4:
   23|  23.1M|static inline uint32_t zng_memread_4(const void *ptr) {
   24|  23.1M|#if defined(HAVE_MAY_ALIAS)
   25|  23.1M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  23.1M|    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|  23.1M|}

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

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

