adler32_ssse3.c:adler32_copy_tail:
  134|  1.41k|                                                uint32_t sum2, const int REBASE, const int MAX_LEN, const int COPY) {
  135|  1.41k|    if (len) {
  ------------------
  |  Branch (135:9): [True: 1.32k, False: 87]
  ------------------
  136|  1.32k|        Z_UNUSED(MAX_LEN);
  ------------------
  |  |  150|  1.32k|#define Z_UNUSED(var) (void)(var)
  ------------------
  137|       |        /* Process using packed 64-bit arithmetic when source is aligned */
  138|  1.92k|        while (len >= 8 && ((uintptr_t)buf & 7) == 0) {
  ------------------
  |  Branch (138:16): [True: 591, False: 1.32k]
  |  Branch (138:28): [True: 591, False: 0]
  ------------------
  139|    591|            size_t chunk = MIN(ALIGN_DOWN(len, (size_t)8), (size_t)ADLER32_SWAR_MAX_BYTES);
  ------------------
  |  |  144|    591|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 591]
  |  |  ------------------
  ------------------
  140|    591|            adler32_swar(&adler, dst, buf, chunk, &sum2, COPY);
  141|    591|            buf += chunk;
  142|    591|            if (COPY)
  ------------------
  |  Branch (142:17): [True: 0, False: 591]
  ------------------
  143|      0|                dst += chunk;
  144|    591|            len -= chunk;
  145|    591|        }
  146|       |        /* DO4 loop avoids GCC x86 register pressure from hoisted DO8/DO16 loads. */
  147|  1.92k|        while (len >= 4) {
  ------------------
  |  Branch (147:16): [True: 591, False: 1.32k]
  ------------------
  148|    591|            if (COPY) {
  ------------------
  |  Branch (148:17): [True: 0, False: 591]
  ------------------
  149|      0|                memcpy(dst, buf, 4);
  150|      0|                dst += 4;
  151|      0|            }
  152|    591|            len -= 4;
  153|    591|            ADLER_DO4(adler, sum2, buf, 0);
  ------------------
  |  |   21|    591|#define ADLER_DO4(sum1, sum2, buf, i)  {ADLER_DO2(sum1, sum2, buf, i); ADLER_DO2(sum1, sum2, buf, i+2);}
  |  |  ------------------
  |  |  |  |   20|    591|#define ADLER_DO2(sum1, sum2, buf, i)  {ADLER_DO1(sum1, sum2, buf, i); ADLER_DO1(sum1, sum2, buf, i+1);}
  |  |  |  |  ------------------
  |  |  |  |  |  |   19|    591|#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|    591|#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|    591|#define ADLER_DO2(sum1, sum2, buf, i)  {ADLER_DO1(sum1, sum2, buf, i); ADLER_DO1(sum1, sum2, buf, i+1);}
  |  |  |  |  ------------------
  |  |  |  |  |  |   19|    591|#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|    591|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  154|    591|            buf += 4;
  155|    591|        }
  156|  1.32k|        if (len & 2) {
  ------------------
  |  Branch (156:13): [True: 691, False: 638]
  ------------------
  157|    691|            if (COPY) {
  ------------------
  |  Branch (157:17): [True: 0, False: 691]
  ------------------
  158|      0|                memcpy(dst, buf, 2);
  159|      0|                dst += 2;
  160|      0|            }
  161|    691|            ADLER_DO2(adler, sum2, buf, 0);
  ------------------
  |  |   20|    691|#define ADLER_DO2(sum1, sum2, buf, i)  {ADLER_DO1(sum1, sum2, buf, i); ADLER_DO1(sum1, sum2, buf, i+1);}
  |  |  ------------------
  |  |  |  |   19|    691|#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|    691|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  |  |  ------------------
  ------------------
  162|    691|            buf += 2;
  163|    691|        }
  164|  1.32k|        if (len & 1) {
  ------------------
  |  Branch (164:13): [True: 689, False: 640]
  ------------------
  165|    689|            if (COPY)
  ------------------
  |  Branch (165:17): [True: 0, False: 689]
  ------------------
  166|      0|                *dst = *buf;
  167|    689|            ADLER_DO1(adler, sum2, buf, 0);
  ------------------
  |  |   19|    689|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  ------------------
  168|    689|        }
  169|  1.32k|    }
  170|  1.41k|    if (REBASE) {
  ------------------
  |  Branch (170:9): [True: 1.32k, False: 87]
  ------------------
  171|  1.32k|        adler %= BASE;
  ------------------
  |  |   13|  1.32k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  172|  1.32k|        sum2 %= BASE;
  ------------------
  |  |   13|  1.32k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  173|  1.32k|    }
  174|       |    /* D = B * 65536 + A, see: https://en.wikipedia.org/wiki/Adler-32. */
  175|  1.41k|    return adler | (sum2 << 16);
  176|  1.41k|}
adler32_ssse3.c:adler32_swar:
   66|    591|                                       uint32_t *sum2, const int COPY) {
   67|    591|    uint64_t sum_even = 0, sum_odd = 0, prefix_even = 0, prefix_odd = 0;
   68|       |
   69|    591|    *sum2 += *adler * (uint32_t)len;
   70|       |
   71|    591|    const uint64_t *src64 = (const uint64_t *)buf;
   72|       |
   73|    591|    while (len >= 16) {
  ------------------
  |  Branch (73:12): [True: 0, False: 591]
  ------------------
   74|      0|        uint64_t v0 = src64[0];
   75|      0|        uint64_t v1 = src64[1];
   76|      0|        if (COPY) {
  ------------------
  |  Branch (76:13): [True: 0, False: 0]
  ------------------
   77|      0|            memcpy(dst, &v0, sizeof(v0));
   78|      0|            memcpy(dst + 8, &v1, sizeof(v1));
   79|      0|            dst += 16;
   80|      0|        }
   81|       |
   82|      0|        prefix_even += sum_even;
   83|      0|        prefix_odd += sum_odd;
   84|      0|        sum_even +=  v0       & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|      0|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
   85|      0|        sum_odd  += (v0 >> 8) & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|      0|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
   86|       |
   87|      0|        prefix_even += sum_even;
   88|      0|        prefix_odd += sum_odd;
   89|      0|        sum_even +=  v1       & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|      0|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
   90|      0|        sum_odd  += (v1 >> 8) & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|      0|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
   91|       |
   92|      0|        src64 += 2;
   93|      0|        len -= 16;
   94|      0|    }
   95|       |
   96|       |    /* Handle remaining 8 bytes if present */
   97|    591|    if (len >= 8) {
  ------------------
  |  Branch (97:9): [True: 591, False: 0]
  ------------------
   98|    591|        uint64_t v = *src64;
   99|    591|        if (COPY)
  ------------------
  |  Branch (99:13): [True: 0, False: 591]
  ------------------
  100|      0|            memcpy(dst, &v, sizeof(v));
  101|       |
  102|    591|        prefix_even += sum_even;
  103|    591|        prefix_odd += sum_odd;
  104|    591|        sum_even +=  v       & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|    591|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
  105|    591|        sum_odd  += (v >> 8) & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|    591|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
  106|    591|    }
  107|       |
  108|       |    /* Horizontal sum of 4x16-bit lanes for s1 */
  109|    591|    *adler += (uint32_t)(((sum_even + sum_odd) * ADLER32_SWAR_HSUM) >> 48);
  ------------------
  |  |   63|    591|#define ADLER32_SWAR_HSUM        0x1000100010001ULL
  ------------------
  110|       |
  111|       |    /* Widen prefix sums to 32-bit pairs and horizontal sum for s2 */
  112|    591|    uint64_t pe_lo = prefix_even & 0xFFFF0000FFFFULL;
  113|    591|    uint64_t pe_hi = (prefix_even >> 16) & 0xFFFF0000FFFFULL;
  114|    591|    uint64_t po_lo = prefix_odd & 0xFFFF0000FFFFULL;
  115|    591|    uint64_t po_hi = (prefix_odd >> 16) & 0xFFFF0000FFFFULL;
  116|       |
  117|    591|    *sum2 += (uint32_t)(((pe_lo + po_lo + pe_hi + po_hi) * 0x800000008ULL) >> 32);
  118|       |
  119|       |    /* Positional weights [8,7,6,5,4,3,2,1] per 8-byte group for s2.
  120|       |     * On big-endian the even mask captures odd-index memory bytes (b1,b3,b5,b7)
  121|       |     * so HSUM (+1 per odd-index byte) must be applied to sum_even, not sum_odd. */
  122|    591|#if BYTE_ORDER == LITTLE_ENDIAN
  123|    591|    *sum2 += 2 * (uint32_t)((sum_even * 0x4000300020001ULL) >> 48)
  124|    591|           +     (uint32_t)((sum_odd  * ADLER32_SWAR_HSUM) >> 48)
  ------------------
  |  |   63|    591|#define ADLER32_SWAR_HSUM        0x1000100010001ULL
  ------------------
  125|    591|           + 2 * (uint32_t)((sum_odd  * 0x3000200010000ULL) >> 48);
  126|       |#else
  127|       |    *sum2 += 2 * (uint32_t)((sum_even * 0x0000100020003ULL) >> 48)
  128|       |           +     (uint32_t)((sum_even * ADLER32_SWAR_HSUM) >> 48)
  129|       |           + 2 * (uint32_t)((sum_odd  * 0x1000200030004ULL) >> 48);
  130|       |#endif
  131|    591|}
adler32_sse42.c:adler32_copy_tail:
  134|  3.37k|                                                uint32_t sum2, const int REBASE, const int MAX_LEN, const int COPY) {
  135|  3.37k|    if (len) {
  ------------------
  |  Branch (135:9): [True: 3.37k, False: 0]
  ------------------
  136|  3.37k|        Z_UNUSED(MAX_LEN);
  ------------------
  |  |  150|  3.37k|#define Z_UNUSED(var) (void)(var)
  ------------------
  137|       |        /* Process using packed 64-bit arithmetic when source is aligned */
  138|  4.95k|        while (len >= 8 && ((uintptr_t)buf & 7) == 0) {
  ------------------
  |  Branch (138:16): [True: 1.73k, False: 3.21k]
  |  Branch (138:28): [True: 1.58k, False: 153]
  ------------------
  139|  1.58k|            size_t chunk = MIN(ALIGN_DOWN(len, (size_t)8), (size_t)ADLER32_SWAR_MAX_BYTES);
  ------------------
  |  |  144|  1.58k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 1.58k]
  |  |  ------------------
  ------------------
  140|  1.58k|            adler32_swar(&adler, dst, buf, chunk, &sum2, COPY);
  141|  1.58k|            buf += chunk;
  142|  1.58k|            if (COPY)
  ------------------
  |  Branch (142:17): [True: 1.58k, False: 0]
  ------------------
  143|  1.58k|                dst += chunk;
  144|  1.58k|            len -= chunk;
  145|  1.58k|        }
  146|       |        /* DO4 loop avoids GCC x86 register pressure from hoisted DO8/DO16 loads. */
  147|  5.39k|        while (len >= 4) {
  ------------------
  |  Branch (147:16): [True: 2.02k, False: 3.37k]
  ------------------
  148|  2.02k|            if (COPY) {
  ------------------
  |  Branch (148:17): [True: 2.02k, False: 0]
  ------------------
  149|  2.02k|                memcpy(dst, buf, 4);
  150|  2.02k|                dst += 4;
  151|  2.02k|            }
  152|  2.02k|            len -= 4;
  153|  2.02k|            ADLER_DO4(adler, sum2, buf, 0);
  ------------------
  |  |   21|  2.02k|#define ADLER_DO4(sum1, sum2, buf, i)  {ADLER_DO2(sum1, sum2, buf, i); ADLER_DO2(sum1, sum2, buf, i+2);}
  |  |  ------------------
  |  |  |  |   20|  2.02k|#define ADLER_DO2(sum1, sum2, buf, i)  {ADLER_DO1(sum1, sum2, buf, i); ADLER_DO1(sum1, sum2, buf, i+1);}
  |  |  |  |  ------------------
  |  |  |  |  |  |   19|  2.02k|#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|  2.02k|#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|  2.02k|#define ADLER_DO2(sum1, sum2, buf, i)  {ADLER_DO1(sum1, sum2, buf, i); ADLER_DO1(sum1, sum2, buf, i+1);}
  |  |  |  |  ------------------
  |  |  |  |  |  |   19|  2.02k|#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|  2.02k|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  154|  2.02k|            buf += 4;
  155|  2.02k|        }
  156|  3.37k|        if (len & 2) {
  ------------------
  |  Branch (156:13): [True: 1.83k, False: 1.53k]
  ------------------
  157|  1.83k|            if (COPY) {
  ------------------
  |  Branch (157:17): [True: 1.83k, False: 0]
  ------------------
  158|  1.83k|                memcpy(dst, buf, 2);
  159|  1.83k|                dst += 2;
  160|  1.83k|            }
  161|  1.83k|            ADLER_DO2(adler, sum2, buf, 0);
  ------------------
  |  |   20|  1.83k|#define ADLER_DO2(sum1, sum2, buf, i)  {ADLER_DO1(sum1, sum2, buf, i); ADLER_DO1(sum1, sum2, buf, i+1);}
  |  |  ------------------
  |  |  |  |   19|  1.83k|#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|  1.83k|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  |  |  ------------------
  ------------------
  162|  1.83k|            buf += 2;
  163|  1.83k|        }
  164|  3.37k|        if (len & 1) {
  ------------------
  |  Branch (164:13): [True: 1.76k, False: 1.60k]
  ------------------
  165|  1.76k|            if (COPY)
  ------------------
  |  Branch (165:17): [True: 1.76k, False: 0]
  ------------------
  166|  1.76k|                *dst = *buf;
  167|  1.76k|            ADLER_DO1(adler, sum2, buf, 0);
  ------------------
  |  |   19|  1.76k|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  ------------------
  168|  1.76k|        }
  169|  3.37k|    }
  170|  3.37k|    if (REBASE) {
  ------------------
  |  Branch (170:9): [True: 3.37k, False: 0]
  ------------------
  171|  3.37k|        adler %= BASE;
  ------------------
  |  |   13|  3.37k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  172|  3.37k|        sum2 %= BASE;
  ------------------
  |  |   13|  3.37k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  173|  3.37k|    }
  174|       |    /* D = B * 65536 + A, see: https://en.wikipedia.org/wiki/Adler-32. */
  175|  3.37k|    return adler | (sum2 << 16);
  176|  3.37k|}
adler32_sse42.c:adler32_swar:
   66|  1.58k|                                       uint32_t *sum2, const int COPY) {
   67|  1.58k|    uint64_t sum_even = 0, sum_odd = 0, prefix_even = 0, prefix_odd = 0;
   68|       |
   69|  1.58k|    *sum2 += *adler * (uint32_t)len;
   70|       |
   71|  1.58k|    const uint64_t *src64 = (const uint64_t *)buf;
   72|       |
   73|  1.58k|    while (len >= 16) {
  ------------------
  |  Branch (73:12): [True: 0, False: 1.58k]
  ------------------
   74|      0|        uint64_t v0 = src64[0];
   75|      0|        uint64_t v1 = src64[1];
   76|      0|        if (COPY) {
  ------------------
  |  Branch (76:13): [True: 0, False: 0]
  ------------------
   77|      0|            memcpy(dst, &v0, sizeof(v0));
   78|      0|            memcpy(dst + 8, &v1, sizeof(v1));
   79|      0|            dst += 16;
   80|      0|        }
   81|       |
   82|      0|        prefix_even += sum_even;
   83|      0|        prefix_odd += sum_odd;
   84|      0|        sum_even +=  v0       & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|      0|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
   85|      0|        sum_odd  += (v0 >> 8) & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|      0|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
   86|       |
   87|      0|        prefix_even += sum_even;
   88|      0|        prefix_odd += sum_odd;
   89|      0|        sum_even +=  v1       & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|      0|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
   90|      0|        sum_odd  += (v1 >> 8) & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|      0|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
   91|       |
   92|      0|        src64 += 2;
   93|      0|        len -= 16;
   94|      0|    }
   95|       |
   96|       |    /* Handle remaining 8 bytes if present */
   97|  1.58k|    if (len >= 8) {
  ------------------
  |  Branch (97:9): [True: 1.58k, False: 0]
  ------------------
   98|  1.58k|        uint64_t v = *src64;
   99|  1.58k|        if (COPY)
  ------------------
  |  Branch (99:13): [True: 1.58k, False: 0]
  ------------------
  100|  1.58k|            memcpy(dst, &v, sizeof(v));
  101|       |
  102|  1.58k|        prefix_even += sum_even;
  103|  1.58k|        prefix_odd += sum_odd;
  104|  1.58k|        sum_even +=  v       & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|  1.58k|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
  105|  1.58k|        sum_odd  += (v >> 8) & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|  1.58k|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
  106|  1.58k|    }
  107|       |
  108|       |    /* Horizontal sum of 4x16-bit lanes for s1 */
  109|  1.58k|    *adler += (uint32_t)(((sum_even + sum_odd) * ADLER32_SWAR_HSUM) >> 48);
  ------------------
  |  |   63|  1.58k|#define ADLER32_SWAR_HSUM        0x1000100010001ULL
  ------------------
  110|       |
  111|       |    /* Widen prefix sums to 32-bit pairs and horizontal sum for s2 */
  112|  1.58k|    uint64_t pe_lo = prefix_even & 0xFFFF0000FFFFULL;
  113|  1.58k|    uint64_t pe_hi = (prefix_even >> 16) & 0xFFFF0000FFFFULL;
  114|  1.58k|    uint64_t po_lo = prefix_odd & 0xFFFF0000FFFFULL;
  115|  1.58k|    uint64_t po_hi = (prefix_odd >> 16) & 0xFFFF0000FFFFULL;
  116|       |
  117|  1.58k|    *sum2 += (uint32_t)(((pe_lo + po_lo + pe_hi + po_hi) * 0x800000008ULL) >> 32);
  118|       |
  119|       |    /* Positional weights [8,7,6,5,4,3,2,1] per 8-byte group for s2.
  120|       |     * On big-endian the even mask captures odd-index memory bytes (b1,b3,b5,b7)
  121|       |     * so HSUM (+1 per odd-index byte) must be applied to sum_even, not sum_odd. */
  122|  1.58k|#if BYTE_ORDER == LITTLE_ENDIAN
  123|  1.58k|    *sum2 += 2 * (uint32_t)((sum_even * 0x4000300020001ULL) >> 48)
  124|  1.58k|           +     (uint32_t)((sum_odd  * ADLER32_SWAR_HSUM) >> 48)
  ------------------
  |  |   63|  1.58k|#define ADLER32_SWAR_HSUM        0x1000100010001ULL
  ------------------
  125|  1.58k|           + 2 * (uint32_t)((sum_odd  * 0x3000200010000ULL) >> 48);
  126|       |#else
  127|       |    *sum2 += 2 * (uint32_t)((sum_even * 0x0000100020003ULL) >> 48)
  128|       |           +     (uint32_t)((sum_even * ADLER32_SWAR_HSUM) >> 48)
  129|       |           + 2 * (uint32_t)((sum_odd  * 0x1000200030004ULL) >> 48);
  130|       |#endif
  131|  1.58k|}
adler32_avx2.c:adler32_copy_tail:
  134|  4.64k|                                                uint32_t sum2, const int REBASE, const int MAX_LEN, const int COPY) {
  135|  4.64k|    if (len) {
  ------------------
  |  Branch (135:9): [True: 4.64k, False: 0]
  ------------------
  136|  4.64k|        Z_UNUSED(MAX_LEN);
  ------------------
  |  |  150|  4.64k|#define Z_UNUSED(var) (void)(var)
  ------------------
  137|       |        /* Process using packed 64-bit arithmetic when source is aligned */
  138|  6.76k|        while (len >= 8 && ((uintptr_t)buf & 7) == 0) {
  ------------------
  |  Branch (138:16): [True: 2.29k, False: 4.47k]
  |  Branch (138:28): [True: 2.12k, False: 178]
  ------------------
  139|  2.12k|            size_t chunk = MIN(ALIGN_DOWN(len, (size_t)8), (size_t)ADLER32_SWAR_MAX_BYTES);
  ------------------
  |  |  144|  2.12k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 2.12k]
  |  |  ------------------
  ------------------
  140|  2.12k|            adler32_swar(&adler, dst, buf, chunk, &sum2, COPY);
  141|  2.12k|            buf += chunk;
  142|  2.12k|            if (COPY)
  ------------------
  |  Branch (142:17): [True: 1.40k, False: 717]
  ------------------
  143|  1.40k|                dst += chunk;
  144|  2.12k|            len -= chunk;
  145|  2.12k|        }
  146|       |        /* DO4 loop avoids GCC x86 register pressure from hoisted DO8/DO16 loads. */
  147|  7.15k|        while (len >= 4) {
  ------------------
  |  Branch (147:16): [True: 2.50k, False: 4.64k]
  ------------------
  148|  2.50k|            if (COPY) {
  ------------------
  |  Branch (148:17): [True: 1.88k, False: 622]
  ------------------
  149|  1.88k|                memcpy(dst, buf, 4);
  150|  1.88k|                dst += 4;
  151|  1.88k|            }
  152|  2.50k|            len -= 4;
  153|  2.50k|            ADLER_DO4(adler, sum2, buf, 0);
  ------------------
  |  |   21|  2.50k|#define ADLER_DO4(sum1, sum2, buf, i)  {ADLER_DO2(sum1, sum2, buf, i); ADLER_DO2(sum1, sum2, buf, i+2);}
  |  |  ------------------
  |  |  |  |   20|  2.50k|#define ADLER_DO2(sum1, sum2, buf, i)  {ADLER_DO1(sum1, sum2, buf, i); ADLER_DO1(sum1, sum2, buf, i+1);}
  |  |  |  |  ------------------
  |  |  |  |  |  |   19|  2.50k|#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|  2.50k|#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|  2.50k|#define ADLER_DO2(sum1, sum2, buf, i)  {ADLER_DO1(sum1, sum2, buf, i); ADLER_DO1(sum1, sum2, buf, i+1);}
  |  |  |  |  ------------------
  |  |  |  |  |  |   19|  2.50k|#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|  2.50k|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  154|  2.50k|            buf += 4;
  155|  2.50k|        }
  156|  4.64k|        if (len & 2) {
  ------------------
  |  Branch (156:13): [True: 2.66k, False: 1.98k]
  ------------------
  157|  2.66k|            if (COPY) {
  ------------------
  |  Branch (157:17): [True: 1.83k, False: 821]
  ------------------
  158|  1.83k|                memcpy(dst, buf, 2);
  159|  1.83k|                dst += 2;
  160|  1.83k|            }
  161|  2.66k|            ADLER_DO2(adler, sum2, buf, 0);
  ------------------
  |  |   20|  2.66k|#define ADLER_DO2(sum1, sum2, buf, i)  {ADLER_DO1(sum1, sum2, buf, i); ADLER_DO1(sum1, sum2, buf, i+1);}
  |  |  ------------------
  |  |  |  |   19|  2.66k|#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|  2.66k|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  |  |  ------------------
  ------------------
  162|  2.66k|            buf += 2;
  163|  2.66k|        }
  164|  4.64k|        if (len & 1) {
  ------------------
  |  Branch (164:13): [True: 2.54k, False: 2.10k]
  ------------------
  165|  2.54k|            if (COPY)
  ------------------
  |  Branch (165:17): [True: 1.78k, False: 765]
  ------------------
  166|  1.78k|                *dst = *buf;
  167|  2.54k|            ADLER_DO1(adler, sum2, buf, 0);
  ------------------
  |  |   19|  2.54k|#define ADLER_DO1(sum1, sum2, buf, i)  {(sum1) += buf[(i)]; (sum2) += (sum1);}
  ------------------
  168|  2.54k|        }
  169|  4.64k|    }
  170|  4.64k|    if (REBASE) {
  ------------------
  |  Branch (170:9): [True: 4.64k, False: 0]
  ------------------
  171|  4.64k|        adler %= BASE;
  ------------------
  |  |   13|  4.64k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  172|  4.64k|        sum2 %= BASE;
  ------------------
  |  |   13|  4.64k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  173|  4.64k|    }
  174|       |    /* D = B * 65536 + A, see: https://en.wikipedia.org/wiki/Adler-32. */
  175|  4.64k|    return adler | (sum2 << 16);
  176|  4.64k|}
adler32_avx2.c:adler32_swar:
   66|  2.12k|                                       uint32_t *sum2, const int COPY) {
   67|  2.12k|    uint64_t sum_even = 0, sum_odd = 0, prefix_even = 0, prefix_odd = 0;
   68|       |
   69|  2.12k|    *sum2 += *adler * (uint32_t)len;
   70|       |
   71|  2.12k|    const uint64_t *src64 = (const uint64_t *)buf;
   72|       |
   73|  2.12k|    while (len >= 16) {
  ------------------
  |  Branch (73:12): [True: 0, False: 2.12k]
  ------------------
   74|      0|        uint64_t v0 = src64[0];
   75|      0|        uint64_t v1 = src64[1];
   76|      0|        if (COPY) {
  ------------------
  |  Branch (76:13): [True: 0, False: 0]
  ------------------
   77|      0|            memcpy(dst, &v0, sizeof(v0));
   78|      0|            memcpy(dst + 8, &v1, sizeof(v1));
   79|      0|            dst += 16;
   80|      0|        }
   81|       |
   82|      0|        prefix_even += sum_even;
   83|      0|        prefix_odd += sum_odd;
   84|      0|        sum_even +=  v0       & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|      0|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
   85|      0|        sum_odd  += (v0 >> 8) & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|      0|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
   86|       |
   87|      0|        prefix_even += sum_even;
   88|      0|        prefix_odd += sum_odd;
   89|      0|        sum_even +=  v1       & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|      0|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
   90|      0|        sum_odd  += (v1 >> 8) & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|      0|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
   91|       |
   92|      0|        src64 += 2;
   93|      0|        len -= 16;
   94|      0|    }
   95|       |
   96|       |    /* Handle remaining 8 bytes if present */
   97|  2.12k|    if (len >= 8) {
  ------------------
  |  Branch (97:9): [True: 2.12k, False: 0]
  ------------------
   98|  2.12k|        uint64_t v = *src64;
   99|  2.12k|        if (COPY)
  ------------------
  |  Branch (99:13): [True: 1.40k, False: 717]
  ------------------
  100|  1.40k|            memcpy(dst, &v, sizeof(v));
  101|       |
  102|  2.12k|        prefix_even += sum_even;
  103|  2.12k|        prefix_odd += sum_odd;
  104|  2.12k|        sum_even +=  v       & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|  2.12k|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
  105|  2.12k|        sum_odd  += (v >> 8) & ADLER32_SWAR_EVEN_MASK;
  ------------------
  |  |   62|  2.12k|#define ADLER32_SWAR_EVEN_MASK   0x00FF00FF00FF00FFULL
  ------------------
  106|  2.12k|    }
  107|       |
  108|       |    /* Horizontal sum of 4x16-bit lanes for s1 */
  109|  2.12k|    *adler += (uint32_t)(((sum_even + sum_odd) * ADLER32_SWAR_HSUM) >> 48);
  ------------------
  |  |   63|  2.12k|#define ADLER32_SWAR_HSUM        0x1000100010001ULL
  ------------------
  110|       |
  111|       |    /* Widen prefix sums to 32-bit pairs and horizontal sum for s2 */
  112|  2.12k|    uint64_t pe_lo = prefix_even & 0xFFFF0000FFFFULL;
  113|  2.12k|    uint64_t pe_hi = (prefix_even >> 16) & 0xFFFF0000FFFFULL;
  114|  2.12k|    uint64_t po_lo = prefix_odd & 0xFFFF0000FFFFULL;
  115|  2.12k|    uint64_t po_hi = (prefix_odd >> 16) & 0xFFFF0000FFFFULL;
  116|       |
  117|  2.12k|    *sum2 += (uint32_t)(((pe_lo + po_lo + pe_hi + po_hi) * 0x800000008ULL) >> 32);
  118|       |
  119|       |    /* Positional weights [8,7,6,5,4,3,2,1] per 8-byte group for s2.
  120|       |     * On big-endian the even mask captures odd-index memory bytes (b1,b3,b5,b7)
  121|       |     * so HSUM (+1 per odd-index byte) must be applied to sum_even, not sum_odd. */
  122|  2.12k|#if BYTE_ORDER == LITTLE_ENDIAN
  123|  2.12k|    *sum2 += 2 * (uint32_t)((sum_even * 0x4000300020001ULL) >> 48)
  124|  2.12k|           +     (uint32_t)((sum_odd  * ADLER32_SWAR_HSUM) >> 48)
  ------------------
  |  |   63|  2.12k|#define ADLER32_SWAR_HSUM        0x1000100010001ULL
  ------------------
  125|  2.12k|           + 2 * (uint32_t)((sum_odd  * 0x3000200010000ULL) >> 48);
  126|       |#else
  127|       |    *sum2 += 2 * (uint32_t)((sum_even * 0x0000100020003ULL) >> 48)
  128|       |           +     (uint32_t)((sum_even * ADLER32_SWAR_HSUM) >> 48)
  129|       |           + 2 * (uint32_t)((sum_odd  * 0x1000200030004ULL) >> 48);
  130|       |#endif
  131|  2.12k|}

adler32_avx2:
  164|  2.95k|Z_INTERNAL uint32_t adler32_avx2(uint32_t adler, const uint8_t *src, size_t len) {
  165|       |    return adler32_copy_impl(adler, NULL, src, len, 0);
  166|  2.95k|}
adler32_copy_avx2:
  168|  19.7k|Z_INTERNAL uint32_t adler32_copy_avx2(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len) {
  169|  19.7k|    return adler32_copy_impl(adler, dst, src, len, 1);
  170|  19.7k|}
adler32_avx2.c:adler32_copy_impl:
   21|  22.7k|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|  22.7k|    uint32_t adler0, adler1;
   23|  22.7k|    adler1 = (adler >> 16) & 0xffff;
   24|  22.7k|    adler0 = adler & 0xffff;
   25|       |
   26|  31.0k|rem_peel:
   27|  31.0k|    if (len < 16) {
  ------------------
  |  Branch (27:9): [True: 4.64k, False: 26.4k]
  ------------------
   28|  4.64k|        return adler32_copy_tail(adler0, dst, src, len, adler1, 1, 15, COPY);
   29|  26.4k|    } else if (len < 32) {
  ------------------
  |  Branch (29:16): [True: 4.99k, False: 21.4k]
  ------------------
   30|  4.99k|        if (COPY) {
  ------------------
  |  Branch (30:13): [True: 3.58k, False: 1.41k]
  ------------------
   31|  3.58k|            return adler32_copy_sse42(adler, dst, src, len);
   32|  3.58k|        } else {
   33|  1.41k|            return adler32_ssse3(adler, src, len);
   34|  1.41k|        }
   35|  4.99k|    }
   36|       |
   37|  21.4k|    __m256i vs1, vs2, vs2_0;
   38|       |
   39|  21.4k|    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|  21.4k|                                           46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33);
   41|  21.4k|    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|  21.4k|                                             14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
   43|  21.4k|    const __m256i dot3v = _mm256_set1_epi16(1);
   44|  21.4k|    const __m256i zero = _mm256_setzero_si256();
   45|       |
   46|   187k|    while (len >= 32) {
  ------------------
  |  Branch (46:12): [True: 165k, False: 21.4k]
  ------------------
   47|   165k|        vs1 = _mm256_zextsi128_si256(_mm_cvtsi32_si128(adler0));
   48|   165k|        vs2 = _mm256_zextsi128_si256(_mm_cvtsi32_si128(adler1));
   49|   165k|        __m256i vs1_0 = vs1;
   50|   165k|        __m256i vs3 = _mm256_setzero_si256();
   51|   165k|        vs2_0 = vs3;
   52|       |
   53|   165k|        size_t k = ALIGN_DOWN(MIN(len, NMAX), 32);
  ------------------
  |  |  289|   331k|    ((value) & ~((align) - 1))
  |  |  ------------------
  |  |  |  Branch (289:7): [True: 144k, False: 21.3k]
  |  |  ------------------
  ------------------
   54|   165k|        len -= k;
   55|       |
   56|  13.8M|        while (k >= 64) {
  ------------------
  |  Branch (56:16): [True: 13.6M, False: 165k]
  ------------------
   57|  13.6M|            __m256i vbuf = _mm256_loadu_si256((__m256i*)src);
   58|  13.6M|            __m256i vbuf_0 = _mm256_loadu_si256((__m256i*)(src + 32));
   59|  13.6M|            src += 64;
   60|  13.6M|            k -= 64;
   61|       |
   62|  13.6M|            __m256i vs1_sad = _mm256_sad_epu8(vbuf, zero);
   63|  13.6M|            __m256i vs1_sad2 = _mm256_sad_epu8(vbuf_0, zero);
   64|       |
   65|  13.6M|            if (COPY) {
  ------------------
  |  Branch (65:17): [True: 7.77M, False: 5.89M]
  ------------------
   66|  7.77M|                _mm256_storeu_si256((__m256i*)dst, vbuf);
   67|  7.77M|                _mm256_storeu_si256((__m256i*)(dst + 32), vbuf_0);
   68|  7.77M|                dst += 64;
   69|  7.77M|            }
   70|       |
   71|  13.6M|            vs1 = _mm256_add_epi32(vs1, vs1_sad);
   72|  13.6M|            vs3 = _mm256_add_epi32(vs3, vs1_0);
   73|  13.6M|            __m256i v_short_sum2 = _mm256_maddubs_epi16(vbuf, dot2v); // sum 32 uint8s to 16 shorts
   74|  13.6M|            __m256i v_short_sum2_0 = _mm256_maddubs_epi16(vbuf_0, dot2v_0); // sum 32 uint8s to 16 shorts
   75|  13.6M|            __m256i vsum2 = _mm256_madd_epi16(v_short_sum2, dot3v); // sum 16 shorts to 8 uint32s
   76|  13.6M|            __m256i vsum2_0 = _mm256_madd_epi16(v_short_sum2_0, dot3v); // sum 16 shorts to 8 uint32s
   77|  13.6M|            vs1 = _mm256_add_epi32(vs1_sad2, vs1);
   78|  13.6M|            vs2 = _mm256_add_epi32(vsum2, vs2);
   79|  13.6M|            vs2_0 = _mm256_add_epi32(vsum2_0, vs2_0);
   80|  13.6M|            vs1_0 = vs1;
   81|  13.6M|        }
   82|       |
   83|   165k|        vs2 = _mm256_add_epi32(vs2_0, vs2);
   84|   165k|        vs3 = _mm256_slli_epi32(vs3, 6);
   85|   165k|        vs2 = _mm256_add_epi32(vs3, vs2);
   86|   165k|        vs3 = _mm256_setzero_si256();
   87|       |
   88|   326k|        while (k >= 32) {
  ------------------
  |  Branch (88:16): [True: 161k, False: 165k]
  ------------------
   89|       |            /*
   90|       |               vs1 = adler + sum(c[i])
   91|       |               vs2 = sum2 + 32 vs1 + sum( (32-i+1) c[i] )
   92|       |            */
   93|   161k|            __m256i vbuf = _mm256_loadu_si256((__m256i*)src);
   94|   161k|            src += 32;
   95|   161k|            k -= 32;
   96|       |
   97|   161k|            __m256i vs1_sad = _mm256_sad_epu8(vbuf, zero); // Sum of abs diff, resulting in 2 x int32's
   98|       |
   99|   161k|            if (COPY) {
  ------------------
  |  Branch (99:17): [True: 92.1k, False: 69.1k]
  ------------------
  100|  92.1k|                _mm256_storeu_si256((__m256i*)dst, vbuf);
  101|  92.1k|                dst += 32;
  102|  92.1k|            }
  103|       |
  104|   161k|            vs1 = _mm256_add_epi32(vs1, vs1_sad);
  105|   161k|            vs3 = _mm256_add_epi32(vs3, vs1_0);
  106|   161k|            __m256i v_short_sum2 = _mm256_maddubs_epi16(vbuf, dot2v_0); // sum 32 uint8s to 16 shorts
  107|   161k|            __m256i vsum2 = _mm256_madd_epi16(v_short_sum2, dot3v); // sum 16 shorts to 8 uint32s
  108|   161k|            vs2 = _mm256_add_epi32(vsum2, vs2);
  109|   161k|            vs1_0 = vs1;
  110|   161k|        }
  111|       |
  112|       |        /* Defer the multiplication with 32 to outside of the loop */
  113|   165k|        vs3 = _mm256_slli_epi32(vs3, 5);
  114|   165k|        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|   165k|         adler0 = partial_hsum256(vs1) % BASE;
  ------------------
  |  |   13|   165k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  152|   165k|         adler1 = hsum256(vs2) % BASE;
  ------------------
  |  |   13|   165k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  153|   165k|    }
  154|       |
  155|  21.4k|    adler = adler0 | (adler1 << 16);
  156|       |
  157|  21.4k|    if (len) {
  ------------------
  |  Branch (157:9): [True: 8.35k, False: 13.0k]
  ------------------
  158|  8.35k|        goto rem_peel;
  159|  8.35k|    }
  160|       |
  161|  13.0k|    return adler;
  162|  21.4k|}

adler32_avx2.c:partial_hsum256:
   20|   165k|static inline uint32_t partial_hsum256(__m256i x) {
   21|       |    /* We need a permutation vector to extract every other integer. The
   22|       |     * rest are going to be zeros */
   23|   165k|    const __m256i perm_vec = _mm256_setr_epi32(0, 2, 4, 6, 1, 1, 1, 1);
   24|   165k|    __m256i non_zero = _mm256_permutevar8x32_epi32(x, perm_vec);
   25|   165k|    __m128i non_zero_sse = _mm256_castsi256_si128(non_zero);
   26|   165k|    __m128i sum2  = _mm_add_epi32(non_zero_sse,_mm_unpackhi_epi64(non_zero_sse, non_zero_sse));
   27|       |    __m128i sum3  = _mm_add_epi32(sum2, _mm_shuffle_epi32(sum2, 1));
   28|   165k|    return (uint32_t)_mm_cvtsi128_si32(sum3);
   29|   165k|}
adler32_avx2.c:hsum256:
   12|   165k|static inline uint32_t hsum256(__m256i x) {
   13|   165k|    __m128i sum1  = _mm_add_epi32(_mm256_extracti128_si256(x, 1),
   14|   165k|                                  _mm256_castsi256_si128(x));
   15|   165k|    __m128i sum2  = _mm_add_epi32(sum1, _mm_unpackhi_epi64(sum1, sum1));
   16|       |    __m128i sum3  = _mm_add_epi32(sum2, _mm_shuffle_epi32(sum2, 1));
   17|   165k|    return (uint32_t)_mm_cvtsi128_si32(sum3);
   18|   165k|}

adler32_copy_sse42:
   17|  3.58k|Z_INTERNAL uint32_t adler32_copy_sse42(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len) {
   18|  3.58k|    uint32_t adler0, adler1;
   19|  3.58k|    adler1 = (adler >> 16) & 0xffff;
   20|  3.58k|    adler0 = adler & 0xffff;
   21|       |
   22|  6.95k|rem_peel:
   23|  6.95k|    if (UNLIKELY(len < 16))
  ------------------
  |  |  254|  6.95k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 3.37k, False: 3.58k]
  |  |  ------------------
  ------------------
   24|  3.37k|       return adler32_copy_tail(adler0, dst, src, len, adler1, 1, 15, 1);
   25|       |
   26|  3.58k|    __m128i vbuf, vbuf_0;
   27|  3.58k|    __m128i vs1_0, vs3, vs1, vs2, vs2_0, v_sad_sum1, v_short_sum2, v_short_sum2_0,
   28|  3.58k|            v_sad_sum2, vsum2, vsum2_0;
   29|  3.58k|    __m128i zero = _mm_setzero_si128();
   30|  3.58k|    const __m128i dot2v = _mm_setr_epi8(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17);
   31|  3.58k|    const __m128i dot2v_0 = _mm_setr_epi8(16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
   32|  3.58k|    const __m128i dot3v = _mm_set1_epi16(1);
   33|       |
   34|  7.16k|    while (len >= 16) {
  ------------------
  |  Branch (34:12): [True: 3.58k, False: 3.58k]
  ------------------
   35|  3.58k|        size_t k = ALIGN_DOWN(MIN(len, NMAX), 16);
  ------------------
  |  |  289|  7.16k|    ((value) & ~((align) - 1))
  |  |  ------------------
  |  |  |  Branch (289:7): [True: 0, False: 3.58k]
  |  |  ------------------
  ------------------
   36|  3.58k|        len -= k;
   37|       |
   38|  3.58k|        vs1 = _mm_cvtsi32_si128(adler0);
   39|  3.58k|        vs2 = _mm_cvtsi32_si128(adler1);
   40|       |
   41|  3.58k|        vs3 = _mm_setzero_si128();
   42|  3.58k|        vs2_0 = _mm_setzero_si128();
   43|  3.58k|        vs1_0 = vs1;
   44|       |
   45|  3.58k|        while (k >= 32) {
  ------------------
  |  Branch (45:16): [True: 0, False: 3.58k]
  ------------------
   46|       |            /*
   47|       |               vs1 = adler + sum(c[i])
   48|       |               vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] )
   49|       |            */
   50|      0|            vbuf = _mm_loadu_si128((__m128i*)src);
   51|      0|            vbuf_0 = _mm_loadu_si128((__m128i*)(src + 16));
   52|      0|            src += 32;
   53|      0|            k -= 32;
   54|       |
   55|      0|            v_sad_sum1 = _mm_sad_epu8(vbuf, zero);
   56|      0|            v_sad_sum2 = _mm_sad_epu8(vbuf_0, zero);
   57|      0|            _mm_storeu_si128((__m128i*)dst, vbuf);
   58|      0|            _mm_storeu_si128((__m128i*)(dst + 16), vbuf_0);
   59|      0|            dst += 32;
   60|       |
   61|      0|            v_short_sum2 = _mm_maddubs_epi16(vbuf, dot2v);
   62|      0|            v_short_sum2_0 = _mm_maddubs_epi16(vbuf_0, dot2v_0);
   63|       |
   64|      0|            vs1 = _mm_add_epi32(v_sad_sum1, vs1);
   65|      0|            vs3 = _mm_add_epi32(vs1_0, vs3);
   66|       |
   67|      0|            vsum2 = _mm_madd_epi16(v_short_sum2, dot3v);
   68|      0|            vsum2_0 = _mm_madd_epi16(v_short_sum2_0, dot3v);
   69|      0|            vs1 = _mm_add_epi32(v_sad_sum2, vs1);
   70|      0|            vs2 = _mm_add_epi32(vsum2, vs2);
   71|      0|            vs2_0 = _mm_add_epi32(vsum2_0, vs2_0);
   72|      0|            vs1_0 = vs1;
   73|      0|        }
   74|       |
   75|  3.58k|        vs2 = _mm_add_epi32(vs2_0, vs2);
   76|  3.58k|        vs3 = _mm_slli_epi32(vs3, 5);
   77|  3.58k|        vs2 = _mm_add_epi32(vs3, vs2);
   78|  3.58k|        vs3 = _mm_setzero_si128();
   79|       |
   80|  7.16k|        while (k >= 16) {
  ------------------
  |  Branch (80:16): [True: 3.58k, False: 3.58k]
  ------------------
   81|       |            /*
   82|       |               vs1 = adler + sum(c[i])
   83|       |               vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] )
   84|       |            */
   85|  3.58k|            vbuf = _mm_loadu_si128((__m128i*)src);
   86|  3.58k|            src += 16;
   87|  3.58k|            k -= 16;
   88|       |
   89|  3.58k|            v_sad_sum1 = _mm_sad_epu8(vbuf, zero);
   90|  3.58k|            v_short_sum2 = _mm_maddubs_epi16(vbuf, dot2v_0);
   91|       |
   92|  3.58k|            vs1 = _mm_add_epi32(v_sad_sum1, vs1);
   93|  3.58k|            vs3 = _mm_add_epi32(vs1_0, vs3);
   94|  3.58k|            vsum2 = _mm_madd_epi16(v_short_sum2, dot3v);
   95|  3.58k|            vs2 = _mm_add_epi32(vsum2, vs2);
   96|  3.58k|            vs1_0 = vs1;
   97|       |
   98|  3.58k|            _mm_storeu_si128((__m128i*)dst, vbuf);
   99|  3.58k|            dst += 16;
  100|  3.58k|        }
  101|       |
  102|  3.58k|        vs3 = _mm_slli_epi32(vs3, 4);
  103|  3.58k|        vs2 = _mm_add_epi32(vs2, vs3);
  104|       |
  105|  3.58k|        adler0 = partial_hsum(vs1) % BASE;
  ------------------
  |  |   13|  3.58k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  106|  3.58k|        adler1 = hsum(vs2) % BASE;
  ------------------
  |  |   13|  3.58k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  107|  3.58k|    }
  108|       |
  109|       |    /* If this is true, there's fewer than 16 elements remaining */
  110|  3.58k|    if (len) {
  ------------------
  |  Branch (110:9): [True: 3.37k, False: 211]
  ------------------
  111|  3.37k|        goto rem_peel;
  112|  3.37k|    }
  113|       |
  114|    211|    return adler0 | (adler1 << 16);
  115|  3.58k|}

adler32_ssse3:
   17|  1.41k|Z_INTERNAL uint32_t adler32_ssse3(uint32_t adler, const uint8_t *buf, size_t len) {
   18|       |    /* split Adler-32 into component sums */
   19|  1.41k|    uint32_t sum2 = (adler >> 16) & 0xffff;
   20|  1.41k|    adler &= 0xffff;
   21|       |
   22|       |    /* in case user likes doing a byte at a time, keep it fast */
   23|  1.41k|    if (UNLIKELY(len == 1))
  ------------------
  |  |  254|  1.41k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 1.41k]
  |  |  ------------------
  ------------------
   24|      0|        return adler32_copy_tail(adler, NULL, buf, 1, sum2, 1, 1, 0);
   25|       |
   26|       |    /* in case short lengths are provided, keep it somewhat fast */
   27|  1.41k|    if (UNLIKELY(len < 16))
  ------------------
  |  |  254|  1.41k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 1.41k]
  |  |  ------------------
  ------------------
   28|      0|        return adler32_copy_tail(adler, NULL, buf, len, sum2, 1, 15, 0);
   29|       |
   30|  1.41k|    const __m128i dot2v = _mm_setr_epi8(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17);
   31|  1.41k|    const __m128i dot2v_0 = _mm_setr_epi8(16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
   32|  1.41k|    const __m128i dot3v = _mm_set1_epi16(1);
   33|  1.41k|    const __m128i zero = _mm_setzero_si128();
   34|       |
   35|  1.41k|    __m128i vbuf, vs1_0, vs3, vs1, vs2, vs2_0, v_sad_sum1, v_short_sum2, v_short_sum2_0,
   36|  1.41k|            vbuf_0, v_sad_sum2, vsum2, vsum2_0;
   37|       |
   38|       |    /* If our buffer is unaligned (likely), make the determination whether
   39|       |     * or not there's enough of a buffer to consume to make the scalar, aligning
   40|       |     * additions worthwhile or if it's worth it to just eat the cost of an unaligned
   41|       |     * load. This is a pretty simple test, just test if len < 32 */
   42|  1.41k|    size_t n = NMAX;
  ------------------
  |  |   14|  1.41k|#define NMAX 5552
  ------------------
   43|  1.41k|    size_t k = 0;
   44|       |
   45|  1.41k|    if (len < 32) {
  ------------------
  |  Branch (45:9): [True: 1.41k, False: 0]
  ------------------
   46|       |        /* Let's eat the cost of this one unaligned load so that
   47|       |         * we don't completely skip over the vectorization. Doing
   48|       |         * 16 bytes at a time unaligned is better than 16 + <= 15
   49|       |         * sums */
   50|  1.41k|        vbuf = _mm_loadu_si128((__m128i*)buf);
   51|  1.41k|        len -= 16;
   52|  1.41k|        buf += 16;
   53|  1.41k|        vs1 = _mm_cvtsi32_si128(adler);
   54|  1.41k|        vs2 = _mm_cvtsi32_si128(sum2);
   55|  1.41k|        vs3 = _mm_setzero_si128();
   56|  1.41k|        vs1_0 = vs1;
   57|  1.41k|        goto unaligned_jmp;
   58|  1.41k|    }
   59|       |
   60|      0|    size_t align_diff = MIN(ALIGN_DIFF(buf, 16), len);
  ------------------
  |  |  144|      0|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   61|      0|    if (align_diff) {
  ------------------
  |  Branch (61:9): [True: 0, False: 0]
  ------------------
   62|      0|        adler32_copy_align(&adler, NULL, buf, align_diff, &sum2, 15, 0);
   63|       |
   64|      0|        buf += align_diff;
   65|      0|        len -= align_diff;
   66|      0|        n -= align_diff;
   67|      0|    }
   68|       |
   69|  1.41k|    while (len >= 16) {
  ------------------
  |  Branch (69:12): [True: 0, False: 1.41k]
  ------------------
   70|      0|        vs1 = _mm_cvtsi32_si128(adler);
   71|      0|        vs2 = _mm_cvtsi32_si128(sum2);
   72|      0|        vs3 = _mm_setzero_si128();
   73|      0|        vs2_0 = _mm_setzero_si128();
   74|      0|        vs1_0 = vs1;
   75|       |
   76|      0|        k = ALIGN_DOWN(MIN(len, n), 16);
  ------------------
  |  |  289|      0|    ((value) & ~((align) - 1))
  |  |  ------------------
  |  |  |  Branch (289:7): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   77|      0|        len -= k;
   78|       |
   79|      0|        while (k >= 32) {
  ------------------
  |  Branch (79:16): [True: 0, False: 0]
  ------------------
   80|       |            /*
   81|       |               vs1 = adler + sum(c[i])
   82|       |               vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] )
   83|       |            */
   84|      0|            vbuf = _mm_load_si128((__m128i*)buf);
   85|      0|            vbuf_0 = _mm_load_si128((__m128i*)(buf + 16));
   86|      0|            buf += 32;
   87|      0|            k -= 32;
   88|       |
   89|      0|            v_sad_sum1 = _mm_sad_epu8(vbuf, zero);
   90|      0|            v_sad_sum2 = _mm_sad_epu8(vbuf_0, zero);
   91|      0|            vs1 = _mm_add_epi32(v_sad_sum1, vs1);
   92|      0|            vs3 = _mm_add_epi32(vs1_0, vs3);
   93|       |
   94|      0|            vs1 = _mm_add_epi32(v_sad_sum2, vs1);
   95|      0|            v_short_sum2 = _mm_maddubs_epi16(vbuf, dot2v);
   96|      0|            vsum2 = _mm_madd_epi16(v_short_sum2, dot3v);
   97|      0|            v_short_sum2_0 = _mm_maddubs_epi16(vbuf_0, dot2v_0);
   98|      0|            vs2 = _mm_add_epi32(vsum2, vs2);
   99|      0|            vsum2_0 = _mm_madd_epi16(v_short_sum2_0, dot3v);
  100|      0|            vs2_0 = _mm_add_epi32(vsum2_0, vs2_0);
  101|      0|            vs1_0 = vs1;
  102|      0|        }
  103|       |
  104|      0|        vs2 = _mm_add_epi32(vs2_0, vs2);
  105|      0|        vs3 = _mm_slli_epi32(vs3, 5);
  106|      0|        vs2 = _mm_add_epi32(vs3, vs2);
  107|      0|        vs3 = _mm_setzero_si128();
  108|       |
  109|  1.41k|        while (k >= 16) {
  ------------------
  |  Branch (109:16): [True: 0, False: 1.41k]
  ------------------
  110|       |            /*
  111|       |               vs1 = adler + sum(c[i])
  112|       |               vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] )
  113|       |            */
  114|      0|            vbuf = _mm_load_si128((__m128i*)buf);
  115|      0|            buf += 16;
  116|      0|            k -= 16;
  117|       |
  118|  1.41k|unaligned_jmp:
  119|  1.41k|            v_sad_sum1 = _mm_sad_epu8(vbuf, zero);
  120|  1.41k|            vs1 = _mm_add_epi32(v_sad_sum1, vs1);
  121|  1.41k|            vs3 = _mm_add_epi32(vs1_0, vs3);
  122|  1.41k|            v_short_sum2 = _mm_maddubs_epi16(vbuf, dot2v_0);
  123|  1.41k|            vsum2 = _mm_madd_epi16(v_short_sum2, dot3v);
  124|  1.41k|            vs2 = _mm_add_epi32(vsum2, vs2);
  125|  1.41k|            vs1_0 = vs1;
  126|  1.41k|        }
  127|       |
  128|  1.41k|        vs3 = _mm_slli_epi32(vs3, 4);
  129|  1.41k|        vs2 = _mm_add_epi32(vs2, vs3);
  130|       |
  131|       |        /* We don't actually need to do a full horizontal sum, since psadbw is actually doing
  132|       |         * a partial reduction sum implicitly and only summing to integers in vector positions
  133|       |         * 0 and 2. This saves us some contention on the shuffle port(s) */
  134|  1.41k|        adler = partial_hsum(vs1) % BASE;
  ------------------
  |  |   13|  1.41k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  135|  1.41k|        sum2 = hsum(vs2) % BASE;
  ------------------
  |  |   13|  1.41k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  136|  1.41k|        n = NMAX;
  ------------------
  |  |   14|  1.41k|#define NMAX 5552
  ------------------
  137|  1.41k|    }
  138|       |
  139|       |    /* Process tail (len < 16).  */
  140|  1.41k|    return adler32_copy_tail(adler, NULL, buf, len, sum2, len != 0, 15, 0);
  141|      0|}

adler32_ssse3.c:partial_hsum:
   14|  1.41k|static inline uint32_t partial_hsum(__m128i x) {
   15|       |    __m128i second_int = _mm_srli_si128(x, 8);
   16|  1.41k|    __m128i sum = _mm_add_epi32(x, second_int);
   17|  1.41k|    return _mm_cvtsi128_si32(sum);
   18|  1.41k|}
adler32_ssse3.c:hsum:
   20|  1.41k|static inline uint32_t hsum(__m128i x) {
   21|  1.41k|    __m128i sum1 = _mm_unpackhi_epi64(x, x);
   22|  1.41k|    __m128i sum2 = _mm_add_epi32(x, sum1);
   23|       |    __m128i sum3 = _mm_shuffle_epi32(sum2, 0x01);
   24|  1.41k|    __m128i sum4 = _mm_add_epi32(sum2, sum3);
   25|  1.41k|    return _mm_cvtsi128_si32(sum4);
   26|  1.41k|}
adler32_sse42.c:partial_hsum:
   14|  3.58k|static inline uint32_t partial_hsum(__m128i x) {
   15|       |    __m128i second_int = _mm_srli_si128(x, 8);
   16|  3.58k|    __m128i sum = _mm_add_epi32(x, second_int);
   17|  3.58k|    return _mm_cvtsi128_si32(sum);
   18|  3.58k|}
adler32_sse42.c:hsum:
   20|  3.58k|static inline uint32_t hsum(__m128i x) {
   21|  3.58k|    __m128i sum1 = _mm_unpackhi_epi64(x, x);
   22|  3.58k|    __m128i sum2 = _mm_add_epi32(x, sum1);
   23|       |    __m128i sum3 = _mm_shuffle_epi32(sum2, 0x01);
   24|  3.58k|    __m128i sum4 = _mm_add_epi32(sum2, sum3);
   25|  3.58k|    return _mm_cvtsi128_si32(sum4);
   26|  3.58k|}

chunkset_avx2.c:storechunk:
   51|  12.0k|static inline void storechunk(uint8_t *out, chunk_t *chunk) {
   52|  12.0k|    _mm256_storeu_si256((__m256i *)out, *chunk);
   53|  12.0k|}
chunkset_avx2.c:loadchunk:
   47|  12.0k|static inline void loadchunk(uint8_t const *s, chunk_t *chunk) {
   48|  12.0k|    *chunk = _mm256_loadu_si256((__m256i *)s);
   49|  12.0k|}

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

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

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|}

chunkmemset_safe_avx2:
  227|  3.04k|Z_INTERNAL uint8_t* CHUNKMEMSET_SAFE(uint8_t *out, uint8_t *from, size_t len, size_t left) {
  228|       |#if OPTIMAL_CMP < 32
  229|       |    static const uintptr_t align_mask = 7;
  230|       |#elif OPTIMAL_CMP == 32
  231|       |    static const uintptr_t align_mask = 3;
  232|       |#endif
  233|       |
  234|  3.04k|    len = MIN(len, left);
  ------------------
  |  |  144|  3.04k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 3.04k]
  |  |  ------------------
  ------------------
  235|       |
  236|       |#if OPTIMAL_CMP < 64
  237|       |    while (((uintptr_t)out & align_mask) && (len > 0)) {
  238|       |        *out++ = *from++;
  239|       |        --len;
  240|       |        --left;
  241|       |    }
  242|       |#endif
  243|       |
  244|  3.04k|#ifndef HAVE_MASKED_READWRITE
  245|  3.04k|    if (UNLIKELY(left < sizeof(chunk_t))) {
  ------------------
  |  |  254|  3.04k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 228, False: 2.81k]
  |  |  ------------------
  ------------------
  246|  3.54k|        while (len > 0) {
  ------------------
  |  Branch (246:16): [True: 3.31k, False: 228]
  ------------------
  247|  3.31k|            *out++ = *from++;
  248|  3.31k|            --len;
  249|  3.31k|        }
  250|       |
  251|    228|        return out;
  252|    228|    }
  253|  2.81k|#endif
  254|       |
  255|  2.81k|    if (len)
  ------------------
  |  Branch (255:9): [True: 2.81k, False: 0]
  ------------------
  256|  2.81k|        out = CHUNKMEMSET(out, from, len);
  ------------------
  |  |  120|  2.81k|#define CHUNKMEMSET      chunkmemset_avx2
  ------------------
  257|       |
  258|  2.81k|    return out;
  259|  3.04k|}
chunkset_avx2.c:chunkmemset_avx2:
  111|  1.70M|static inline uint8_t* CHUNKMEMSET(uint8_t *out, uint8_t *from, size_t len) {
  112|       |    /* Debug performance related issues when len < sizeof(uint64_t):
  113|       |       Assert(len >= sizeof(uint64_t), "chunkmemset should be called on larger chunks"); */
  114|  1.70M|    Assert(from != out, "chunkmemset cannot have a distance 0");
  115|       |
  116|  1.70M|    chunk_t chunk_load;
  117|  1.70M|    size_t chunk_mod = 0;
  118|  1.70M|    size_t adv_amount;
  119|  1.70M|    size_t dist = (size_t)ABS(out - from);
  ------------------
  |  |  148|  1.70M|#define ABS(a) ((a) < 0 ? -(a) : (a))
  |  |  ------------------
  |  |  |  Branch (148:17): [True: 1.13k, False: 1.70M]
  |  |  ------------------
  ------------------
  120|       |
  121|       |    /* We are supporting the case for when we are reading bytes from ahead in the buffer.
  122|       |     * We now have to handle this, though it wasn't _quite_ clear if this rare circumstance
  123|       |     * always needed to be handled here or if we're just now seeing it because we are
  124|       |     * dispatching to this function, more */
  125|  1.70M|    if (out < from && dist < len) {
  ------------------
  |  Branch (125:9): [True: 1.13k, False: 1.70M]
  |  Branch (125:23): [True: 0, False: 1.13k]
  ------------------
  126|       |#ifdef HAVE_MASKED_READWRITE
  127|       |        /* We can still handle this case if we can mitigate over writing _and_ we
  128|       |         * fit the entirety of the copy length with one load */
  129|       |        if (len <= sizeof(chunk_t)) {
  130|       |            /* Tempting to add a goto to the block below but hopefully most compilers
  131|       |             * collapse these identical code segments as one label to jump to */
  132|       |            return CHUNKCOPY(out, from, len);
  133|       |        }
  134|       |#endif
  135|       |        /* Here the memmove semantics match perfectly, as when this happens we are
  136|       |         * effectively sliding down the contents of memory by dist bytes */
  137|      0|        memmove(out, from, len);
  138|      0|        return out + len;
  139|      0|    }
  140|       |
  141|  1.70M|    if (dist == 1) {
  ------------------
  |  Branch (141:9): [True: 1.70M, False: 1.13k]
  ------------------
  142|  1.70M|        memset(out, *from, len);
  143|  1.70M|        return out + len;
  144|  1.70M|    } else if (dist >= sizeof(chunk_t)) {
  ------------------
  |  Branch (144:16): [True: 1.13k, False: 0]
  ------------------
  145|  1.13k|        return CHUNKCOPY(out, from, len);
  ------------------
  |  |  118|  1.13k|#define CHUNKCOPY        chunkcopy_avx2
  ------------------
  146|  1.13k|    }
  147|       |
  148|       |    /* Only AVX2+ as there's 128 bit vectors and 256 bit. We allow for shorter vector
  149|       |     * lengths because they serve to allow more cases to fall into chunkcopy, as the
  150|       |     * distance of the shorter length is still deemed a safe distance. We rewrite this
  151|       |     * here rather than calling the ssse3 variant directly now because doing so required
  152|       |     * dispatching to another function and broke inlining for this function entirely. We
  153|       |     * also can merge an assert and some remainder peeling behavior into the same code blocks,
  154|       |     * making the code a little smaller.  */
  155|      0|#ifdef HAVE_HALF_CHUNK
  156|      0|    if (len <= sizeof(halfchunk_t)) {
  ------------------
  |  Branch (156:9): [True: 0, False: 0]
  ------------------
  157|      0|        if (dist >= sizeof(halfchunk_t))
  ------------------
  |  Branch (157:13): [True: 0, False: 0]
  ------------------
  158|      0|            return HALFCHUNKCOPY(out, from, len);
  159|       |
  160|      0|        if ((dist % 2) != 0 || dist == 6) {
  ------------------
  |  Branch (160:13): [True: 0, False: 0]
  |  Branch (160:32): [True: 0, False: 0]
  ------------------
  161|      0|            halfchunk_t halfchunk_load = GET_HALFCHUNK_MAG(from, &chunk_mod, dist);
  162|       |
  163|      0|            if (len == sizeof(halfchunk_t)) {
  ------------------
  |  Branch (163:17): [True: 0, False: 0]
  ------------------
  164|      0|                storehalfchunk(out, &halfchunk_load);
  165|      0|                len -= sizeof(halfchunk_t);
  166|      0|                out += sizeof(halfchunk_t);
  167|      0|            }
  168|       |
  169|      0|            chunk_load = halfchunk2whole(&halfchunk_load);
  170|      0|            goto rem_bytes;
  171|      0|        }
  172|      0|    }
  173|      0|#endif
  174|       |
  175|      0|#ifdef HAVE_CHUNKMEMSET_2
  176|      0|    if (dist == 2) {
  ------------------
  |  Branch (176:9): [True: 0, False: 0]
  ------------------
  177|      0|        chunkmemset_2(from, &chunk_load);
  178|      0|    } else
  179|      0|#endif
  180|      0|#ifdef HAVE_CHUNKMEMSET_4
  181|      0|    if (dist == 4) {
  ------------------
  |  Branch (181:9): [True: 0, False: 0]
  ------------------
  182|      0|        chunkmemset_4(from, &chunk_load);
  183|      0|    } else
  184|      0|#endif
  185|      0|#ifdef HAVE_CHUNKMEMSET_8
  186|      0|    if (dist == 8) {
  ------------------
  |  Branch (186:9): [True: 0, False: 0]
  ------------------
  187|      0|        chunkmemset_8(from, &chunk_load);
  188|      0|    } else
  189|      0|#endif
  190|      0|#ifdef HAVE_CHUNKMEMSET_16
  191|      0|    if (dist == 16) {
  ------------------
  |  Branch (191:9): [True: 0, False: 0]
  ------------------
  192|      0|        chunkmemset_16(from, &chunk_load);
  193|      0|    } else
  194|      0|#endif
  195|      0|    chunk_load = GET_CHUNK_MAG(from, &chunk_mod, dist);
  196|       |
  197|      0|    adv_amount = sizeof(chunk_t) - chunk_mod;
  198|       |
  199|      0|    while (len >= (2 * sizeof(chunk_t))) {
  ------------------
  |  Branch (199:12): [True: 0, False: 0]
  ------------------
  200|      0|        storechunk(out, &chunk_load);
  201|      0|        storechunk(out + adv_amount, &chunk_load);
  202|      0|        out += 2 * adv_amount;
  203|      0|        len -= 2 * adv_amount;
  204|      0|    }
  205|       |
  206|       |    /* If we don't have a "dist" length that divides evenly into a vector
  207|       |     * register, we can write the whole vector register but we need only
  208|       |     * advance by the amount of the whole string that fits in our chunk_t.
  209|       |     * If we do divide evenly into the vector length, adv_amount = chunk_t size*/
  210|      0|    while (len >= sizeof(chunk_t)) {
  ------------------
  |  Branch (210:12): [True: 0, False: 0]
  ------------------
  211|      0|        storechunk(out, &chunk_load);
  212|      0|        len -= adv_amount;
  213|      0|        out += adv_amount;
  214|      0|    }
  215|       |
  216|      0|#ifdef HAVE_HALF_CHUNK
  217|      0|rem_bytes:
  218|      0|#endif
  219|      0|    if (len) {
  ------------------
  |  Branch (219:9): [True: 0, False: 0]
  ------------------
  220|      0|        memcpy(out, &chunk_load, len);
  221|      0|        out += len;
  222|      0|    }
  223|       |
  224|      0|    return out;
  225|      0|}
chunkset_avx2.c:CHUNKCOPY_SAFE:
  262|  1.13k|{
  263|  1.13k|    if (out == from)
  ------------------
  |  Branch (263:9): [True: 0, False: 1.13k]
  ------------------
  264|      0|        return out + len;
  265|       |
  266|  1.13k|    size_t safelen = (safe - out);
  267|  1.13k|    len = MIN(len, safelen);
  ------------------
  |  |  144|  1.13k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 1.13k]
  |  |  ------------------
  ------------------
  268|       |
  269|  1.13k|#ifndef HAVE_MASKED_READWRITE
  270|  1.13k|    size_t from_dist = (size_t)ABS(safe - from);
  ------------------
  |  |  148|  1.13k|#define ABS(a) ((a) < 0 ? -(a) : (a))
  |  |  ------------------
  |  |  |  Branch (148:17): [True: 1.13k, False: 0]
  |  |  ------------------
  ------------------
  271|  1.13k|    if (UNLIKELY(from_dist < sizeof(chunk_t) || safelen < sizeof(chunk_t))) {
  ------------------
  |  |  254|  2.27k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 1.13k]
  |  |  |  Branch (254:53): [True: 0, False: 1.13k]
  |  |  |  Branch (254:53): [True: 0, False: 1.13k]
  |  |  ------------------
  ------------------
  272|      0|        while (len--) {
  ------------------
  |  Branch (272:16): [True: 0, False: 0]
  ------------------
  273|      0|            *out++ = *from++;
  274|      0|        }
  275|       |
  276|      0|        return out;
  277|      0|    }
  278|  1.13k|#endif
  279|       |
  280|  1.13k|    return CHUNKMEMSET(out, from, len);
  ------------------
  |  |  120|  1.13k|#define CHUNKMEMSET      chunkmemset_avx2
  ------------------
  281|  1.13k|}
chunkset_avx2.c:chunksize_avx2:
    9|  1.70M|static inline size_t CHUNKSIZE(void) {
   10|  1.70M|    return sizeof(chunk_t);
   11|  1.70M|}
chunkset_avx2.c:chunkcopy_avx2:
   24|  1.34k|static inline uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, size_t len) {
   25|  1.34k|    Assert(len > 0, "chunkcopy should never have a length 0");
   26|  1.34k|    chunk_t chunk;
   27|  1.34k|    size_t align = ((len - 1) % sizeof(chunk_t)) + 1;
   28|  1.34k|    loadchunk(from, &chunk);
   29|  1.34k|    storechunk(out, &chunk);
   30|  1.34k|    out += align;
   31|  1.34k|    from += align;
   32|  1.34k|    len -= align;
   33|  12.0k|    while (len > 0) {
  ------------------
  |  Branch (33:12): [True: 10.7k, False: 1.34k]
  ------------------
   34|  10.7k|        loadchunk(from, &chunk);
   35|  10.7k|        storechunk(out, &chunk);
   36|  10.7k|        out += sizeof(chunk_t);
   37|  10.7k|        from += sizeof(chunk_t);
   38|  10.7k|        len -= sizeof(chunk_t);
   39|  10.7k|    }
   40|  1.34k|    return out;
   41|  1.34k|}

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|  1.53k|Z_INTERNAL deflate_allocs* alloc_deflate(PREFIX3(stream) *strm, int windowBits, int lit_bufsize) {
  166|  1.53k|    int curr_size = 0;
  167|       |
  168|       |    /* Define sizes */
  169|  1.53k|    int window_size = DEFLATE_ADJUST_WINDOW_SIZE((1 << windowBits) * 2);
  ------------------
  |  |  444|  1.53k|#  define DEFLATE_ADJUST_WINDOW_SIZE(n) (n)
  ------------------
  170|  1.53k|    int prev_size = (1 << windowBits) * (int)sizeof(Pos);
  171|  1.53k|    int head_size = HASH_SIZE * sizeof(Pos);
  ------------------
  |  |   85|  1.53k|#  define HASH_SIZE 65536u         /* number of elements in hash table */
  ------------------
  172|  1.53k|    int pending_size = (lit_bufsize * LIT_BUFS) + 1;
  ------------------
  |  |  269|  1.53k|#   define LIT_BUFS 4
  ------------------
  173|  1.53k|    int state_size = sizeof(deflate_state);
  174|  1.53k|    int alloc_size = sizeof(deflate_allocs);
  175|       |
  176|       |    /* Calculate relative buffer positions and paddings */
  177|  1.53k|    LOGSZP("window", window_size, PAD_WINDOW(curr_size), PADSZ(curr_size,WINDOW_PAD_SIZE));
  178|  1.53k|    int window_pos = PAD_WINDOW(curr_size);
  ------------------
  |  |  440|  1.53k|#  define PAD_WINDOW            PAD_64
  |  |  ------------------
  |  |  |  |  297|  1.53k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  |  |  ------------------
  |  |  |  |  |  |  295|  1.53k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  179|  1.53k|    curr_size = window_pos + window_size;
  180|       |
  181|  1.53k|    LOGSZP("prev", prev_size, PAD_64(curr_size), PADSZ(curr_size,64));
  182|  1.53k|    int prev_pos = PAD_64(curr_size);
  ------------------
  |  |  297|  1.53k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  295|  1.53k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  183|  1.53k|    curr_size = prev_pos + prev_size;
  184|       |
  185|  1.53k|    LOGSZP("head", head_size, PAD_64(curr_size), PADSZ(curr_size,64));
  186|  1.53k|    int head_pos = PAD_64(curr_size);
  ------------------
  |  |  297|  1.53k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  295|  1.53k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  187|  1.53k|    curr_size = head_pos + head_size;
  188|       |
  189|  1.53k|    LOGSZP("pending", pending_size, PAD_64(curr_size), PADSZ(curr_size,64));
  190|  1.53k|    int pending_pos = PAD_64(curr_size);
  ------------------
  |  |  297|  1.53k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  295|  1.53k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  191|  1.53k|    curr_size = pending_pos + pending_size;
  192|       |
  193|  1.53k|    LOGSZP("state", state_size, PAD_64(curr_size), PADSZ(curr_size,64));
  194|  1.53k|    int state_pos = PAD_64(curr_size);
  ------------------
  |  |  297|  1.53k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  295|  1.53k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  195|  1.53k|    curr_size = state_pos + state_size;
  196|       |
  197|  1.53k|    LOGSZP("alloc", alloc_size, PAD_16(curr_size), PADSZ(curr_size,16));
  198|  1.53k|    int alloc_pos = PAD_16(curr_size);
  ------------------
  |  |  296|  1.53k|#define PAD_16(bpos) ((bpos) + PADSZ((bpos),16))
  |  |  ------------------
  |  |  |  |  295|  1.53k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  199|  1.53k|    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|  1.53k|    int total_size = PAD_64(curr_size + (WINDOW_PAD_SIZE - 1));
  ------------------
  |  |  297|  1.53k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  295|  1.53k|#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|  1.53k|    char *original_buf = (char *)strm->zalloc(strm->opaque, 1, total_size);
  206|  1.53k|    if (original_buf == NULL)
  ------------------
  |  Branch (206:9): [True: 0, False: 1.53k]
  ------------------
  207|      0|        return NULL;
  208|       |
  209|  1.53k|    char *buff = (char *)HINT_ALIGNED_WINDOW((char *)PAD_WINDOW(original_buf));
  ------------------
  |  |  442|  1.53k|#  define HINT_ALIGNED_WINDOW   HINT_ALIGNED_64
  |  |  ------------------
  |  |  |  |  276|  1.53k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  271|  1.53k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  210|  1.53k|    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|  1.53k|    deflate_allocs *alloc_bufs  = (struct deflate_allocs_s *)(buff + alloc_pos);
  214|  1.53k|    alloc_bufs->buf_start = original_buf;
  215|  1.53k|    alloc_bufs->zfree = strm->zfree;
  216|       |
  217|       |    /* Assign buffers */
  218|  1.53k|    alloc_bufs->window = (unsigned char *)HINT_ALIGNED_WINDOW(buff + window_pos);
  ------------------
  |  |  442|  1.53k|#  define HINT_ALIGNED_WINDOW   HINT_ALIGNED_64
  |  |  ------------------
  |  |  |  |  276|  1.53k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  271|  1.53k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  219|  1.53k|    alloc_bufs->prev = (Pos *)HINT_ALIGNED_64(buff + prev_pos);
  ------------------
  |  |  276|  1.53k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  ------------------
  |  |  |  |  271|  1.53k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  ------------------
  ------------------
  220|  1.53k|    alloc_bufs->head = (Pos *)HINT_ALIGNED_64(buff + head_pos);
  ------------------
  |  |  276|  1.53k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  ------------------
  |  |  |  |  271|  1.53k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  ------------------
  ------------------
  221|  1.53k|    alloc_bufs->pending_buf = (unsigned char *)HINT_ALIGNED_64(buff + pending_pos);
  ------------------
  |  |  276|  1.53k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  ------------------
  |  |  |  |  271|  1.53k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  ------------------
  ------------------
  222|  1.53k|    alloc_bufs->state = (deflate_state *)HINT_ALIGNED_16(buff + state_pos);
  ------------------
  |  |  275|  1.53k|#define HINT_ALIGNED_16(p) HINT_ALIGNED((p),16)
  |  |  ------------------
  |  |  |  |  271|  1.53k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  ------------------
  ------------------
  223|       |
  224|  1.53k|    memset(alloc_bufs->prev, 0, prev_size);
  225|       |
  226|  1.53k|    return alloc_bufs;
  227|  1.53k|}
zng_deflateInit2:
  247|  1.53k|                                            int32_t memLevel, int32_t strategy) {
  248|       |    /* Todo: ignore strm->next_in if we use it as window */
  249|  1.53k|    deflate_state *s;
  250|  1.53k|    int wrap = 1;
  251|       |
  252|       |    /* Initialize functable */
  253|  1.53k|    FUNCTABLE_INIT;
  ------------------
  |  |   44|  1.53k|#  define FUNCTABLE_INIT if (functable.force_init()) {return Z_VERSION_ERROR;}
  |  |  ------------------
  |  |  |  |  188|      0|#define Z_VERSION_ERROR (-6)
  |  |  ------------------
  |  |  |  Branch (44:30): [True: 0, False: 1.53k]
  |  |  ------------------
  ------------------
  254|       |
  255|  1.53k|    if (strm == NULL)
  ------------------
  |  Branch (255:9): [True: 0, False: 1.53k]
  ------------------
  256|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  257|       |
  258|  1.53k|    strm->msg = NULL;
  259|  1.53k|    if (strm->zalloc == NULL) {
  ------------------
  |  Branch (259:9): [True: 1.53k, False: 0]
  ------------------
  260|  1.53k|        strm->zalloc = PREFIX(zcalloc);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
  261|  1.53k|        strm->opaque = NULL;
  262|  1.53k|    }
  263|  1.53k|    if (strm->zfree == NULL)
  ------------------
  |  Branch (263:9): [True: 1.53k, False: 0]
  ------------------
  264|  1.53k|        strm->zfree = PREFIX(zcfree);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
  265|       |
  266|  1.53k|    if (level == Z_DEFAULT_COMPRESSION)
  ------------------
  |  |  196|  1.53k|#define Z_DEFAULT_COMPRESSION  (-1)
  ------------------
  |  Branch (266:9): [True: 0, False: 1.53k]
  ------------------
  267|      0|        level = 6;
  268|       |
  269|  1.53k|    if (windowBits < 0) { /* suppress zlib wrapper */
  ------------------
  |  Branch (269:9): [True: 0, False: 1.53k]
  ------------------
  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|  1.53k|    } else if (windowBits > MAX_WBITS) {
  ------------------
  |  |   39|  1.53k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (275:16): [True: 0, False: 1.53k]
  ------------------
  276|      0|        wrap = 2;       /* write gzip wrapper instead */
  277|      0|        windowBits -= 16;
  278|      0|#endif
  279|      0|    }
  280|  1.53k|    if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < MIN_WBITS ||
  ------------------
  |  |   27|  3.07k|#  define MAX_MEM_LEVEL 9
  ------------------
                  if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < MIN_WBITS ||
  ------------------
  |  |  212|  3.07k|#define Z_DEFLATED   8
  ------------------
                  if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < MIN_WBITS ||
  ------------------
  |  |   36|  3.07k|#  define MIN_WBITS   8  /* 256 LZ77 window */
  ------------------
  |  Branch (280:9): [True: 0, False: 1.53k]
  |  Branch (280:25): [True: 0, False: 1.53k]
  |  Branch (280:53): [True: 0, False: 1.53k]
  |  Branch (280:77): [True: 0, False: 1.53k]
  ------------------
  281|  1.53k|        windowBits > MAX_WBITS || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED ||
  ------------------
  |  |   39|  3.07k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
                      windowBits > MAX_WBITS || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED ||
  ------------------
  |  |  202|  3.07k|#define Z_FIXED               4
  ------------------
  |  Branch (281:9): [True: 0, False: 1.53k]
  |  Branch (281:35): [True: 0, False: 1.53k]
  |  Branch (281:48): [True: 0, False: 1.53k]
  |  Branch (281:61): [True: 0, False: 1.53k]
  |  Branch (281:77): [True: 0, False: 1.53k]
  ------------------
  282|  1.53k|        (windowBits == 8 && wrap != 1)) {
  ------------------
  |  Branch (282:10): [True: 0, False: 1.53k]
  |  Branch (282:29): [True: 0, False: 0]
  ------------------
  283|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  284|      0|    }
  285|  1.53k|    if (windowBits == 8)
  ------------------
  |  Branch (285:9): [True: 0, False: 1.53k]
  ------------------
  286|      0|        windowBits = 9;  /* until 256-byte window bug fixed */
  287|       |
  288|       |    /* Allocate buffers */
  289|  1.53k|    int lit_bufsize = 1 << (memLevel + 6);
  290|  1.53k|    deflate_allocs *alloc_bufs = alloc_deflate(strm, windowBits, lit_bufsize);
  291|  1.53k|    if (alloc_bufs == NULL)
  ------------------
  |  Branch (291:9): [True: 0, False: 1.53k]
  ------------------
  292|      0|        return Z_MEM_ERROR;
  ------------------
  |  |  186|      0|#define Z_MEM_ERROR    (-4)
  ------------------
  293|       |
  294|  1.53k|    s = alloc_bufs->state;
  295|  1.53k|    s->alloc_bufs = alloc_bufs;
  296|  1.53k|    s->window = alloc_bufs->window;
  297|  1.53k|    s->prev = alloc_bufs->prev;
  298|  1.53k|    s->head = alloc_bufs->head;
  299|  1.53k|    s->pending_buf = alloc_bufs->pending_buf;
  300|       |
  301|  1.53k|    strm->state = (struct internal_state *)s;
  302|  1.53k|    s->strm = strm;
  303|  1.53k|    s->status = INIT_STATE;     /* to pass state test in deflateReset() */
  ------------------
  |  |   66|  1.53k|#define INIT_STATE      1    /* zlib header -> BUSY_STATE */
  ------------------
  304|       |
  305|  1.53k|    s->wrap = wrap;
  306|  1.53k|    s->gzhead = NULL;
  307|  1.53k|    s->w_size = 1 << windowBits;
  308|       |
  309|  1.53k|    s->high_water = 0;      /* nothing written to s->window yet */
  310|       |
  311|  1.53k|    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|  1.53k|    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|  1.53k|    s->sym_buf = s->pending_buf + s->lit_bufsize;
  360|  1.53k|    s->sym_end = (s->lit_bufsize - 1) * 3;
  361|  1.53k|#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|  1.53k|    s->level = level;
  368|  1.53k|    s->strategy = strategy;
  369|  1.53k|    s->block_open = 0;
  370|  1.53k|    s->reproducible = 0;
  371|       |
  372|  1.53k|    return PREFIX(deflateReset)(strm);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
  373|  1.53k|}
zng_deflateInit:
  376|  1.53k|int32_t Z_EXPORT PREFIX(deflateInit)(PREFIX3(stream) *strm, int32_t level) {
  377|  1.53k|    return PREFIX(deflateInit2)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
                  return PREFIX(deflateInit2)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
  ------------------
  |  |  212|  1.53k|#define Z_DEFLATED   8
  ------------------
                  return PREFIX(deflateInit2)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
  ------------------
  |  |   39|  1.53k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
                  return PREFIX(deflateInit2)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
  ------------------
  |  |   45|  1.53k|#  define DEF_MEM_LEVEL 8
  ------------------
                  return PREFIX(deflateInit2)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
  ------------------
  |  |  203|  1.53k|#define Z_DEFAULT_STRATEGY    0
  ------------------
  378|  1.53k|}
zng_deflateResetKeep:
  494|  1.53k|int32_t Z_EXPORT PREFIX(deflateResetKeep)(PREFIX3(stream) *strm) {
  495|  1.53k|    deflate_state *s;
  496|       |
  497|  1.53k|    if (deflateStateCheck(strm))
  ------------------
  |  Branch (497:9): [True: 0, False: 1.53k]
  ------------------
  498|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  499|       |
  500|  1.53k|    strm->total_in = strm->total_out = 0;
  501|  1.53k|    strm->msg = NULL; /* use zfree if we ever allocate msg dynamically */
  502|  1.53k|    strm->data_type = Z_UNKNOWN;
  ------------------
  |  |  209|  1.53k|#define Z_UNKNOWN  2
  ------------------
  503|       |
  504|  1.53k|    s = (deflate_state *)strm->state;
  505|  1.53k|    s->pending = 0;
  506|  1.53k|    s->pending_out = s->pending_buf;
  507|       |
  508|  1.53k|    if (s->wrap < 0)
  ------------------
  |  Branch (508:9): [True: 0, False: 1.53k]
  ------------------
  509|      0|        s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
  510|       |
  511|  1.53k|    s->status =
  512|  1.53k|#ifdef GZIP
  513|  1.53k|        s->wrap == 2 ? GZIP_STATE :
  ------------------
  |  |   68|      0|#  define GZIP_STATE    4    /* gzip header -> BUSY_STATE | EXTRA_STATE */
  ------------------
  |  Branch (513:9): [True: 0, False: 1.53k]
  ------------------
  514|  1.53k|#endif
  515|  1.53k|        INIT_STATE;
  ------------------
  |  |   66|  3.07k|#define INIT_STATE      1    /* zlib header -> BUSY_STATE */
  ------------------
  516|       |
  517|  1.53k|#ifdef GZIP
  518|  1.53k|    if (s->wrap == 2) {
  ------------------
  |  Branch (518:9): [True: 0, False: 1.53k]
  ------------------
  519|      0|        strm->adler = CRC32_INITIAL_VALUE;
  ------------------
  |  |   66|      0|#define CRC32_INITIAL_VALUE   0 /* initial crc-32 hash value */
  ------------------
  520|      0|    } else
  521|  1.53k|#endif
  522|  1.53k|        strm->adler = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   65|  1.53k|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
  523|  1.53k|    s->last_flush = -2;
  524|       |
  525|  1.53k|    zng_tr_init(s);
  526|       |
  527|  1.53k|    DEFLATE_RESET_KEEP_HOOK(strm);  /* hook for IBM Z DFLTCC */
  ------------------
  |  |  450|  1.53k|#  define DEFLATE_RESET_KEEP_HOOK(strm) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (450:54): [Folded, False: 1.53k]
  |  |  ------------------
  ------------------
  528|       |
  529|  1.53k|    return Z_OK;
  ------------------
  |  |  180|  1.53k|#define Z_OK            0
  ------------------
  530|  1.53k|}
zng_deflateReset:
  533|  1.53k|int32_t Z_EXPORT PREFIX(deflateReset)(PREFIX3(stream) *strm) {
  534|  1.53k|    int ret = PREFIX(deflateResetKeep)(strm);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
  535|  1.53k|    if (ret == Z_OK)
  ------------------
  |  |  180|  1.53k|#define Z_OK            0
  ------------------
  |  Branch (535:9): [True: 1.53k, False: 0]
  ------------------
  536|  1.53k|        lm_init(strm->state);
  537|  1.53k|    return ret;
  538|  1.53k|}
zng_deflateParams:
  596|  3.07k|int32_t Z_EXPORT PREFIX(deflateParams)(PREFIX3(stream) *strm, int32_t level, int32_t strategy) {
  597|  3.07k|    deflate_state *s;
  598|  3.07k|    compress_func func;
  599|  3.07k|    int hook_flush = Z_NO_FLUSH;
  ------------------
  |  |  171|  3.07k|#define Z_NO_FLUSH      0
  ------------------
  600|       |
  601|  3.07k|    if (deflateStateCheck(strm))
  ------------------
  |  Branch (601:9): [True: 0, False: 3.07k]
  ------------------
  602|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  603|  3.07k|    s = strm->state;
  604|       |
  605|  3.07k|    if (level == Z_DEFAULT_COMPRESSION)
  ------------------
  |  |  196|  3.07k|#define Z_DEFAULT_COMPRESSION  (-1)
  ------------------
  |  Branch (605:9): [True: 0, False: 3.07k]
  ------------------
  606|      0|        level = 6;
  607|  3.07k|    if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED)
  ------------------
  |  |  202|  3.07k|#define Z_FIXED               4
  ------------------
  |  Branch (607:9): [True: 0, False: 3.07k]
  |  Branch (607:22): [True: 0, False: 3.07k]
  |  Branch (607:35): [True: 0, False: 3.07k]
  |  Branch (607:51): [True: 0, False: 3.07k]
  ------------------
  608|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  609|  3.07k|    DEFLATE_PARAMS_HOOK(strm, level, strategy, &hook_flush);  /* hook for IBM Z DFLTCC */
  ------------------
  |  |  452|  3.07k|#  define DEFLATE_PARAMS_HOOK(strm, level, strategy, hook_flush) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (452:79): [Folded, False: 3.07k]
  |  |  ------------------
  ------------------
  610|  3.07k|    func = configuration_table[s->level].func;
  611|       |
  612|  3.07k|    if (((strategy != s->strategy || func != configuration_table[level].func) && s->last_flush != -2)
  ------------------
  |  Branch (612:11): [True: 1.53k, False: 1.53k]
  |  Branch (612:38): [True: 1.53k, False: 0]
  |  Branch (612:82): [True: 3.07k, False: 0]
  ------------------
  613|  3.07k|        || hook_flush != Z_NO_FLUSH) {
  ------------------
  |  |  171|      0|#define Z_NO_FLUSH      0
  ------------------
  |  Branch (613:12): [True: 0, False: 0]
  ------------------
  614|       |        /* Flush the last buffer. Use Z_BLOCK mode, unless the hook requests a "stronger" one. */
  615|  3.07k|        int flush = RANK(hook_flush) > RANK(Z_BLOCK) ? hook_flush : Z_BLOCK;
  ------------------
  |  |  139|  3.07k|#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
  |  |  ------------------
  |  |  |  Branch (139:31): [True: 0, False: 3.07k]
  |  |  ------------------
  ------------------
                      int flush = RANK(hook_flush) > RANK(Z_BLOCK) ? hook_flush : Z_BLOCK;
  ------------------
  |  |  139|  3.07k|#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
  |  |  ------------------
  |  |  |  Branch (139:31): [True: 3.07k, Folded]
  |  |  ------------------
  ------------------
                      int flush = RANK(hook_flush) > RANK(Z_BLOCK) ? hook_flush : Z_BLOCK;
  ------------------
  |  |  176|  3.07k|#define Z_BLOCK         5
  ------------------
  |  Branch (615:21): [True: 0, False: 3.07k]
  ------------------
  616|  3.07k|        int err = PREFIX(deflate)(strm, flush);
  ------------------
  |  |  117|  3.07k|#  define PREFIX(x) zng_ ## x
  ------------------
  617|  3.07k|        if (err == Z_STREAM_ERROR)
  ------------------
  |  |  184|  3.07k|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (617:13): [True: 0, False: 3.07k]
  ------------------
  618|      0|            return err;
  619|  3.07k|        if (strm->avail_in || ((int)s->strstart - s->block_start) + s->lookahead || !DEFLATE_DONE(strm, flush))
  ------------------
  |  |  454|      0|#  define DEFLATE_DONE(strm, flush) 1
  ------------------
  |  Branch (619:13): [True: 0, False: 3.07k]
  |  Branch (619:31): [True: 0, False: 3.07k]
  |  Branch (619:85): [Folded, False: 0]
  ------------------
  620|      0|            return Z_BUF_ERROR;
  ------------------
  |  |  187|      0|#define Z_BUF_ERROR    (-5)
  ------------------
  621|  3.07k|    }
  622|  3.07k|    if (s->level != level) {
  ------------------
  |  Branch (622:9): [True: 3.07k, False: 0]
  ------------------
  623|  3.07k|        if (s->level == 0 && s->matches != 0) {
  ------------------
  |  Branch (623:13): [True: 1.53k, False: 1.53k]
  |  Branch (623:30): [True: 35, False: 1.50k]
  ------------------
  624|     35|            if (s->matches == 1) {
  ------------------
  |  Branch (624:17): [True: 35, False: 0]
  ------------------
  625|     35|                FUNCTABLE_CALL(slide_hash)(s);
  ------------------
  |  |   45|     35|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
  626|     35|            } else {
  627|      0|                CLEAR_HASH(s);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
  628|      0|            }
  629|     35|            s->matches = 0;
  630|     35|        }
  631|       |
  632|  3.07k|        lm_set_level(s, level);
  633|  3.07k|    }
  634|  3.07k|    s->strategy = strategy;
  635|  3.07k|    return Z_OK;
  ------------------
  |  |  180|  3.07k|#define Z_OK            0
  ------------------
  636|  3.07k|}
zng_flush_pending:
  749|  9.21k|Z_INTERNAL void PREFIX(flush_pending)(PREFIX3(stream) *strm) {
  750|  9.21k|    flush_pending_inline(strm);
  751|  9.21k|}
zng_deflate:
  935|  9.21k|int32_t Z_EXPORT PREFIX(deflate)(PREFIX3(stream) *strm, int32_t flush) {
  936|  9.21k|    int32_t old_flush; /* value of flush param for previous deflate call */
  937|  9.21k|    deflate_state *s;
  938|       |
  939|  9.21k|    if (deflateStateCheck(strm) || flush > Z_BLOCK || flush < 0)
  ------------------
  |  |  176|  18.4k|#define Z_BLOCK         5
  ------------------
  |  Branch (939:9): [True: 0, False: 9.21k]
  |  Branch (939:36): [True: 0, False: 9.21k]
  |  Branch (939:55): [True: 0, False: 9.21k]
  ------------------
  940|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  941|  9.21k|    s = strm->state;
  942|       |
  943|  9.21k|    if (strm->next_out == NULL || (strm->avail_in != 0 && strm->next_in == NULL)
  ------------------
  |  Branch (943:9): [True: 0, False: 9.21k]
  |  Branch (943:36): [True: 4.60k, False: 4.60k]
  |  Branch (943:59): [True: 0, False: 4.60k]
  ------------------
  944|  9.21k|        || (s->status == FINISH_STATE && flush != Z_FINISH)) {
  ------------------
  |  |   75|  18.4k|#define FINISH_STATE    3    /* stream complete */
  ------------------
                      || (s->status == FINISH_STATE && flush != Z_FINISH)) {
  ------------------
  |  |  175|      0|#define Z_FINISH        4
  ------------------
  |  Branch (944:13): [True: 0, False: 9.21k]
  |  Branch (944:42): [True: 0, False: 0]
  ------------------
  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|  9.21k|    if (strm->avail_out == 0) {
  ------------------
  |  Branch (947:9): [True: 0, False: 9.21k]
  ------------------
  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|  9.21k|    old_flush = s->last_flush;
  952|  9.21k|    s->last_flush = flush;
  953|       |
  954|       |    /* Flush as much pending output as possible */
  955|  9.21k|    if (s->pending != 0) {
  ------------------
  |  Branch (955:9): [True: 0, False: 9.21k]
  ------------------
  956|      0|        flush_pending_inline(strm);
  957|      0|        if (strm->avail_out == 0) {
  ------------------
  |  Branch (957:13): [True: 0, 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|      0|            s->last_flush = -1;
  965|      0|            return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
  966|      0|        }
  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|  9.21k|    } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && flush != Z_FINISH) {
  ------------------
  |  |  139|  4.60k|#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
  |  |  ------------------
  |  |  |  Branch (139:31): [True: 3.07k, False: 1.53k]
  |  |  ------------------
  ------------------
                  } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && flush != Z_FINISH) {
  ------------------
  |  |  139|  13.8k|#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
  |  |  ------------------
  |  |  |  Branch (139:31): [True: 0, False: 4.60k]
  |  |  ------------------
  ------------------
                  } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && flush != Z_FINISH) {
  ------------------
  |  |  175|      0|#define Z_FINISH        4
  ------------------
  |  Branch (972:16): [True: 4.60k, False: 4.60k]
  |  Branch (972:39): [True: 0, False: 4.60k]
  |  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|  9.21k|    if (s->status == FINISH_STATE && strm->avail_in != 0)   {
  ------------------
  |  |   75|  18.4k|#define FINISH_STATE    3    /* stream complete */
  ------------------
  |  Branch (977:9): [True: 0, False: 9.21k]
  |  Branch (977:38): [True: 0, False: 0]
  ------------------
  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|  9.21k|    if (s->status == INIT_STATE && s->wrap == 0) {
  ------------------
  |  |   66|  18.4k|#define INIT_STATE      1    /* zlib header -> BUSY_STATE */
  ------------------
  |  Branch (982:9): [True: 1.53k, False: 7.68k]
  |  Branch (982:36): [True: 0, False: 1.53k]
  ------------------
  983|      0|        s->status = BUSY_STATE;
  ------------------
  |  |   74|      0|#define BUSY_STATE      2    /* deflate -> FINISH_STATE */
  ------------------
  984|      0|    }
  985|       |
  986|  9.21k|    if (s->status != BUSY_STATE && s->status != FINISH_STATE && s->wrap != 0) {
  ------------------
  |  |   74|  18.4k|#define BUSY_STATE      2    /* deflate -> FINISH_STATE */
  ------------------
                  if (s->status != BUSY_STATE && s->status != FINISH_STATE && s->wrap != 0) {
  ------------------
  |  |   75|  10.7k|#define FINISH_STATE    3    /* stream complete */
  ------------------
  |  Branch (986:9): [True: 1.53k, False: 7.68k]
  |  Branch (986:36): [True: 1.53k, False: 0]
  |  Branch (986:65): [True: 1.53k, False: 0]
  ------------------
  987|       |        /* Write the header */
  988|  1.53k|        if (deflateHeaders(s, strm) == Z_OK) {
  ------------------
  |  |  180|  1.53k|#define Z_OK            0
  ------------------
  |  Branch (988:13): [True: 0, False: 1.53k]
  ------------------
  989|      0|            return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
  990|      0|        }
  991|  1.53k|    }
  992|       |
  993|       |    /* Start a new block or continue the current one. */
  994|  9.21k|    if (strm->avail_in != 0 || s->lookahead != 0 || (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
  ------------------
  |  |  171|  3.07k|#define Z_NO_FLUSH      0
  ------------------
                  if (strm->avail_in != 0 || s->lookahead != 0 || (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
  ------------------
  |  |   75|  1.53k|#define FINISH_STATE    3    /* stream complete */
  ------------------
  |  Branch (994:9): [True: 4.60k, False: 4.60k]
  |  Branch (994:32): [True: 3.07k, False: 1.53k]
  |  Branch (994:54): [True: 1.53k, False: 0]
  |  Branch (994:77): [True: 1.53k, False: 0]
  ------------------
  995|  9.21k|        block_state bstate;
  996|       |
  997|  9.21k|        bstate = DEFLATE_HOOK(strm, flush, &bstate) ? bstate :  /* hook for IBM Z DFLTCC */
  ------------------
  |  |  462|  9.21k|#  define DEFLATE_HOOK(strm, flush, bstate) 0
  |  |  ------------------
  |  |  |  Branch (462:45): [Folded, False: 9.21k]
  |  |  ------------------
  ------------------
  998|  9.21k|                 s->level == 0 ? deflate_stored(s, flush) :
  ------------------
  |  Branch (998:18): [True: 3.07k, False: 6.14k]
  ------------------
  999|  9.21k|                 s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
  ------------------
  |  |  200|  6.14k|#define Z_HUFFMAN_ONLY        2
  ------------------
  |  Branch (999:18): [True: 0, False: 6.14k]
  ------------------
 1000|  6.14k|                 s->strategy == Z_RLE ? deflate_rle(s, flush) :
  ------------------
  |  |  201|  6.14k|#define Z_RLE                 3
  ------------------
  |  Branch (1000:18): [True: 0, False: 6.14k]
  ------------------
 1001|  6.14k|                 (*(configuration_table[s->level].func))(s, flush);
 1002|       |
 1003|  9.21k|        if (bstate == finish_started || bstate == finish_done) {
  ------------------
  |  Branch (1003:13): [True: 0, False: 9.21k]
  |  Branch (1003:41): [True: 1.53k, False: 7.68k]
  ------------------
 1004|  1.53k|            s->status = FINISH_STATE;
  ------------------
  |  |   75|  1.53k|#define FINISH_STATE    3    /* stream complete */
  ------------------
 1005|  1.53k|        }
 1006|  9.21k|        if (bstate == need_more || bstate == finish_started) {
  ------------------
  |  Branch (1006:13): [True: 4.60k, False: 4.60k]
  |  Branch (1006:36): [True: 0, False: 4.60k]
  ------------------
 1007|  4.60k|            if (strm->avail_out == 0) {
  ------------------
  |  Branch (1007:17): [True: 0, False: 4.60k]
  ------------------
 1008|      0|                s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
 1009|      0|            }
 1010|  4.60k|            return Z_OK;
  ------------------
  |  |  180|  4.60k|#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|  4.60k|        }
 1019|  4.60k|        if (bstate == block_done) {
  ------------------
  |  Branch (1019:13): [True: 3.07k, False: 1.53k]
  ------------------
 1020|  3.07k|            if (flush == Z_PARTIAL_FLUSH) {
  ------------------
  |  |  172|  3.07k|#define Z_PARTIAL_FLUSH 1
  ------------------
  |  Branch (1020:17): [True: 0, False: 3.07k]
  ------------------
 1021|      0|                zng_tr_align(s);
 1022|  3.07k|            } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
  ------------------
  |  |  176|  3.07k|#define Z_BLOCK         5
  ------------------
  |  Branch (1022:24): [True: 0, False: 3.07k]
  ------------------
 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|  3.07k|            PREFIX(flush_pending)(strm);
  ------------------
  |  |  117|  3.07k|#  define PREFIX(x) zng_ ## x
  ------------------
 1037|  3.07k|            if (strm->avail_out == 0) {
  ------------------
  |  Branch (1037:17): [True: 0, False: 3.07k]
  ------------------
 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|  3.07k|        }
 1042|  4.60k|    }
 1043|       |
 1044|  4.60k|    if (flush != Z_FINISH)
  ------------------
  |  |  175|  4.60k|#define Z_FINISH        4
  ------------------
  |  Branch (1044:9): [True: 3.07k, False: 1.53k]
  ------------------
 1045|  3.07k|        return Z_OK;
  ------------------
  |  |  180|  3.07k|#define Z_OK            0
  ------------------
 1046|       |
 1047|       |    /* Write the trailer */
 1048|  1.53k|#ifdef GZIP
 1049|  1.53k|    if (s->wrap == 2) {
  ------------------
  |  Branch (1049:9): [True: 0, False: 1.53k]
  ------------------
 1050|      0|        put_uint32(s, strm->adler);
 1051|      0|        put_uint32(s, (uint32_t)strm->total_in);
 1052|      0|    } else
 1053|  1.53k|#endif
 1054|  1.53k|    {
 1055|  1.53k|        if (s->wrap == 1)
  ------------------
  |  Branch (1055:13): [True: 1.53k, False: 0]
  ------------------
 1056|  1.53k|            put_uint32_msb(s, strm->adler);
 1057|  1.53k|    }
 1058|  1.53k|    flush_pending_inline(strm);
 1059|       |    /* If avail_out is zero, the application will call deflate again
 1060|       |     * to flush the rest.
 1061|       |     */
 1062|  1.53k|    if (s->wrap > 0)
  ------------------
  |  Branch (1062:9): [True: 1.53k, False: 0]
  ------------------
 1063|  1.53k|        s->wrap = -s->wrap; /* write the trailer only once! */
 1064|  1.53k|    if (s->pending == 0) {
  ------------------
  |  Branch (1064:9): [True: 1.53k, False: 0]
  ------------------
 1065|  1.53k|        Assert(s->bi_valid == 0, "bi_buf not flushed");
 1066|  1.53k|        return Z_STREAM_END;
  ------------------
  |  |  181|  1.53k|#define Z_STREAM_END    1
  ------------------
 1067|  1.53k|    }
 1068|      0|    return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
 1069|  1.53k|}
zng_deflateEnd:
 1072|  1.53k|int32_t Z_EXPORT PREFIX(deflateEnd)(PREFIX3(stream) *strm) {
 1073|  1.53k|    if (deflateStateCheck(strm))
  ------------------
  |  Branch (1073:9): [True: 0, False: 1.53k]
  ------------------
 1074|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1075|       |
 1076|  1.53k|    int32_t status = strm->state->status;
 1077|       |
 1078|       |    /* Free allocated buffers */
 1079|  1.53k|    free_deflate(strm);
 1080|       |
 1081|  1.53k|    return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
  ------------------
  |  |   74|  1.53k|#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|  1.53k|#define Z_OK            0
  ------------------
  |  Branch (1081:12): [True: 0, False: 1.53k]
  ------------------
 1082|  1.53k|}
zng_fill_window:
 1183|  27.8k|void Z_INTERNAL PREFIX(fill_window)(deflate_state *s) {
 1184|  27.8k|    PREFIX3(stream) *strm = s->strm;
  ------------------
  |  |  119|  27.8k|#  define PREFIX3(x) zng_ ## x
  ------------------
 1185|  27.8k|    insert_string_cb insert_string_func;
 1186|  27.8k|    unsigned char *window = s->window;
 1187|  27.8k|    unsigned n;
 1188|  27.8k|    unsigned int more;    /* Amount of free space at the end of the window. */
 1189|  27.8k|    unsigned int wsize = s->w_size;
 1190|  27.8k|    int level = s->level;
 1191|       |
 1192|  27.8k|    Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
 1193|       |
 1194|  27.8k|    if (level >= 9)
  ------------------
  |  Branch (1194:9): [True: 27.8k, False: 0]
  ------------------
 1195|  27.8k|        insert_string_func = insert_string_roll;
 1196|      0|    else
 1197|      0|        insert_string_func = insert_string;
 1198|       |
 1199|  27.8k|    do {
 1200|  27.8k|        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|  27.8k|        if (s->strstart >= wsize+MAX_DIST(s)) {
  ------------------
  |  |  385|  27.8k|#define MAX_DIST(s)  ((s)->w_size - MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  380|  27.8k|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   57|  27.8k|#define STD_MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|  27.8k|#define STD_MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1205:13): [True: 12.0k, False: 15.8k]
  ------------------
 1206|  12.0k|            memcpy(window, window + wsize, (unsigned)wsize);
 1207|  12.0k|            if (s->match_start >= wsize) {
  ------------------
  |  Branch (1207:17): [True: 12.0k, False: 0]
  ------------------
 1208|  12.0k|                s->match_start -= wsize;
 1209|  12.0k|            } else {
 1210|      0|                s->match_start = 0;
 1211|      0|                s->prev_length = 0;
 1212|      0|            }
 1213|  12.0k|            s->strstart    -= wsize; /* we now have strstart >= MAX_DIST */
 1214|  12.0k|            s->block_start -= (int)wsize;
 1215|  12.0k|            if (s->insert > s->strstart)
  ------------------
  |  Branch (1215:17): [True: 0, False: 12.0k]
  ------------------
 1216|      0|                s->insert = s->strstart;
 1217|  12.0k|            FUNCTABLE_CALL(slide_hash)(s);
  ------------------
  |  |   45|  12.0k|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
 1218|  12.0k|            more += wsize;
 1219|  12.0k|        }
 1220|  27.8k|        if (strm->avail_in == 0)
  ------------------
  |  Branch (1220:13): [True: 12.8k, False: 14.9k]
  ------------------
 1221|  12.8k|            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|  14.9k|        Assert(more >= 2, "more < 2");
 1235|       |
 1236|  14.9k|        n = read_buf(strm, window + s->strstart + s->lookahead, more);
 1237|  14.9k|        s->lookahead += n;
 1238|       |
 1239|       |        /* Initialize the hash value now that we have some input: */
 1240|  14.9k|        if (s->lookahead + s->insert >= STD_MIN_MATCH) {
  ------------------
  |  |   56|  14.9k|#define STD_MIN_MATCH  3
  ------------------
  |  Branch (1240:13): [True: 14.9k, False: 0]
  ------------------
 1241|  14.9k|            unsigned int str = s->strstart - s->insert;
 1242|  14.9k|            if (UNLIKELY(level >= 9)) {
  ------------------
  |  |  254|  14.9k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 14.9k, False: 0]
  |  |  ------------------
  ------------------
 1243|  14.9k|                s->ins_h = update_hash_roll(window[str], window[str+1]);
 1244|  14.9k|            } else if (str >= 1) {
  ------------------
  |  Branch (1244:24): [True: 0, False: 0]
  ------------------
 1245|      0|                quick_insert_string(s, window, str + 2 - STD_MIN_MATCH);
  ------------------
  |  |   56|      0|#define STD_MIN_MATCH  3
  ------------------
 1246|      0|            }
 1247|  14.9k|            unsigned int count = s->insert;
 1248|  14.9k|            if (UNLIKELY(s->lookahead == 1)) {
  ------------------
  |  |  254|  14.9k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 14.9k]
  |  |  ------------------
  ------------------
 1249|      0|                count -= 1;
 1250|      0|            }
 1251|  14.9k|            if (count > 0) {
  ------------------
  |  Branch (1251:17): [True: 1.53k, False: 13.4k]
  ------------------
 1252|  1.53k|                insert_string_func(s, window, str, count);
 1253|  1.53k|                s->insert -= count;
 1254|  1.53k|            }
 1255|  14.9k|        }
 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|  14.9k|    } while (s->lookahead < MIN_LOOKAHEAD && strm->avail_in != 0);
  ------------------
  |  |  380|  29.9k|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  ------------------
  |  |  |  |   57|  14.9k|#define STD_MAX_MATCH  258
  |  |  ------------------
  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  ------------------
  |  |  |  |   56|  14.9k|#define STD_MIN_MATCH  3
  |  |  ------------------
  ------------------
  |  Branch (1259:14): [True: 161, False: 14.8k]
  |  Branch (1259:46): [True: 0, False: 161]
  ------------------
 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|  27.8k|    if (s->high_water < s->window_size) {
  ------------------
  |  Branch (1268:9): [True: 10.4k, False: 17.4k]
  ------------------
 1269|  10.4k|        unsigned int curr = s->strstart + s->lookahead;
 1270|  10.4k|        unsigned int init;
 1271|       |
 1272|  10.4k|        if (s->high_water < curr) {
  ------------------
  |  Branch (1272:13): [True: 2.56k, False: 7.87k]
  ------------------
 1273|       |            /* Previous high water mark below current data -- zero WIN_INIT
 1274|       |             * bytes or up to end of window, whichever is less.
 1275|       |             */
 1276|  2.56k|            init = s->window_size - curr;
 1277|  2.56k|            if (init > WIN_INIT)
  ------------------
  |  |  396|  2.56k|#define WIN_INIT STD_MAX_MATCH
  |  |  ------------------
  |  |  |  |   57|  2.56k|#define STD_MAX_MATCH  258
  |  |  ------------------
  ------------------
  |  Branch (1277:17): [True: 1.82k, False: 737]
  ------------------
 1278|  1.82k|                init = WIN_INIT;
  ------------------
  |  |  396|  1.82k|#define WIN_INIT STD_MAX_MATCH
  |  |  ------------------
  |  |  |  |   57|  1.82k|#define STD_MAX_MATCH  258
  |  |  ------------------
  ------------------
 1279|  2.56k|            memset(window + curr, 0, init);
 1280|  2.56k|            s->high_water = curr + init;
 1281|  7.87k|        } else if (s->high_water < curr + WIN_INIT) {
  ------------------
  |  |  396|  7.87k|#define WIN_INIT STD_MAX_MATCH
  |  |  ------------------
  |  |  |  |   57|  7.87k|#define STD_MAX_MATCH  258
  |  |  ------------------
  ------------------
  |  Branch (1281:20): [True: 41, False: 7.83k]
  ------------------
 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|     41|            init = curr + WIN_INIT - s->high_water;
  ------------------
  |  |  396|     41|#define WIN_INIT STD_MAX_MATCH
  |  |  ------------------
  |  |  |  |   57|     41|#define STD_MAX_MATCH  258
  |  |  ------------------
  ------------------
 1287|     41|            if (init > s->window_size - s->high_water)
  ------------------
  |  Branch (1287:17): [True: 0, False: 41]
  ------------------
 1288|      0|                init = s->window_size - s->high_water;
 1289|     41|            memset(window + s->high_water, 0, init);
 1290|     41|            s->high_water += init;
 1291|     41|        }
 1292|  10.4k|    }
 1293|       |
 1294|  27.8k|    Assert((unsigned long)s->strstart <= s->window_size - MIN_LOOKAHEAD,
 1295|  27.8k|           "not enough room for search");
 1296|  27.8k|}
deflate.c:deflateStateCheck:
  399|  15.3k|static int deflateStateCheck(PREFIX3(stream) *strm) {
  400|  15.3k|    deflate_state *s;
  401|  15.3k|    if (strm == NULL || strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
  ------------------
  |  Branch (401:9): [True: 0, False: 15.3k]
  |  Branch (401:25): [True: 0, False: 15.3k]
  |  Branch (401:58): [True: 0, False: 15.3k]
  ------------------
  402|      0|        return 1;
  403|  15.3k|    s = strm->state;
  404|  15.3k|    if (s == NULL || s->alloc_bufs == NULL || s->strm != strm || (s->status < INIT_STATE || s->status > MAX_STATE))
  ------------------
  |  |   66|  30.7k|#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|  15.3k|#  define MAX_STATE     HCRC_STATE
  |  |  ------------------
  |  |  |  |   72|  15.3k|#  define HCRC_STATE    8    /* gzip header CRC -> BUSY_STATE */
  |  |  ------------------
  ------------------
  |  Branch (404:9): [True: 0, False: 15.3k]
  |  Branch (404:22): [True: 0, False: 15.3k]
  |  Branch (404:47): [True: 0, False: 15.3k]
  |  Branch (404:67): [True: 0, False: 15.3k]
  |  Branch (404:93): [True: 0, False: 15.3k]
  ------------------
  405|      0|        return 1;
  406|  15.3k|    return 0;
  407|  15.3k|}
deflate.c:deflateHeaders:
  765|  1.53k|static int deflateHeaders(deflate_state *s, PREFIX3(stream) *strm) {
  766|  1.53k|    if (s->status == INIT_STATE) {
  ------------------
  |  |   66|  1.53k|#define INIT_STATE      1    /* zlib header -> BUSY_STATE */
  ------------------
  |  Branch (766:9): [True: 1.53k, False: 0]
  ------------------
  767|       |        /* zlib header */
  768|  1.53k|        unsigned int header = (Z_DEFLATED + ((W_BITS(s)-8)<<4)) << 8;
  ------------------
  |  |  212|  1.53k|#define Z_DEFLATED   8
  ------------------
                      unsigned int header = (Z_DEFLATED + ((W_BITS(s)-8)<<4)) << 8;
  ------------------
  |  |  393|  1.53k|#define W_BITS(s)  zng_ctz32((s)->w_size)
  ------------------
  769|  1.53k|        unsigned int level_flags;
  770|       |
  771|  1.53k|        if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
  ------------------
  |  |  200|  3.07k|#define Z_HUFFMAN_ONLY        2
  ------------------
  |  Branch (771:13): [True: 0, False: 1.53k]
  |  Branch (771:46): [True: 0, False: 1.53k]
  ------------------
  772|      0|            level_flags = 0;
  773|  1.53k|        else if (s->level < 6)
  ------------------
  |  Branch (773:18): [True: 0, False: 1.53k]
  ------------------
  774|      0|            level_flags = 1;
  775|  1.53k|        else if (s->level == 6)
  ------------------
  |  Branch (775:18): [True: 0, False: 1.53k]
  ------------------
  776|      0|            level_flags = 2;
  777|  1.53k|        else
  778|  1.53k|            level_flags = 3;
  779|  1.53k|        header |= (level_flags << 6);
  780|  1.53k|        if (s->strstart != 0)
  ------------------
  |  Branch (780:13): [True: 0, False: 1.53k]
  ------------------
  781|      0|            header |= PRESET_DICT;
  ------------------
  |  |   63|      0|#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
  ------------------
  782|  1.53k|        header += 31 - (header % 31);
  783|       |
  784|  1.53k|        put_short_msb(s, (uint16_t)header);
  785|       |
  786|       |        /* Save the adler32 of the preset dictionary: */
  787|  1.53k|        if (s->strstart != 0)
  ------------------
  |  Branch (787:13): [True: 0, False: 1.53k]
  ------------------
  788|      0|            put_uint32_msb(s, strm->adler);
  789|  1.53k|        strm->adler = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   65|  1.53k|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
  790|  1.53k|        s->status = BUSY_STATE;
  ------------------
  |  |   74|  1.53k|#define BUSY_STATE      2    /* deflate -> FINISH_STATE */
  ------------------
  791|       |
  792|       |        /* Compression must start with an empty pending buffer */
  793|  1.53k|        PREFIX(flush_pending)(strm);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
  794|  1.53k|        if (s->pending != 0) {
  ------------------
  |  Branch (794:13): [True: 0, False: 1.53k]
  ------------------
  795|      0|            s->last_flush = -1;
  796|      0|            return Z_OK;
  ------------------
  |  |  180|      0|#define Z_OK            0
  ------------------
  797|      0|        }
  798|  1.53k|    }
  799|  1.53k|#ifdef GZIP
  800|  1.53k|    if (s->status == GZIP_STATE) {
  ------------------
  |  |   68|  1.53k|#  define GZIP_STATE    4    /* gzip header -> BUSY_STATE | EXTRA_STATE */
  ------------------
  |  Branch (800:9): [True: 0, False: 1.53k]
  ------------------
  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|  1.53k|    if (s->status == EXTRA_STATE) {
  ------------------
  |  |   69|  1.53k|#  define EXTRA_STATE   5    /* gzip extra block -> NAME_STATE */
  ------------------
  |  Branch (838:9): [True: 0, False: 1.53k]
  ------------------
  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|  1.53k|    if (s->status == NAME_STATE) {
  ------------------
  |  |   70|  1.53k|#  define NAME_STATE    6    /* gzip file name -> COMMENT_STATE */
  ------------------
  |  Branch (864:9): [True: 0, False: 1.53k]
  ------------------
  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|  1.53k|    if (s->status == COMMENT_STATE) {
  ------------------
  |  |   71|  1.53k|#  define COMMENT_STATE 7    /* gzip comment -> HCRC_STATE */
  ------------------
  |  Branch (887:9): [True: 0, False: 1.53k]
  ------------------
  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|  1.53k|    if (s->status == HCRC_STATE) {
  ------------------
  |  |   72|  1.53k|#  define HCRC_STATE    8    /* gzip header CRC -> BUSY_STATE */
  ------------------
  |  Branch (909:9): [True: 0, False: 1.53k]
  ------------------
  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|  1.53k|#endif
  931|  1.53k|    return -1;
  932|  1.53k|}
deflate.c:free_deflate:
  232|  1.53k|static inline void free_deflate(PREFIX3(stream) *strm) {
  233|  1.53k|    deflate_state *state = (deflate_state *)strm->state;
  234|       |
  235|  1.53k|    if (state->alloc_bufs != NULL) {
  ------------------
  |  Branch (235:9): [True: 1.53k, False: 0]
  ------------------
  236|  1.53k|        deflate_allocs *alloc_bufs = state->alloc_bufs;
  237|  1.53k|        alloc_bufs->zfree(strm->opaque, alloc_bufs->buf_start);
  238|       |        strm->state = NULL;
  239|  1.53k|    }
  240|  1.53k|}
deflate.c:lm_set_level:
 1142|  4.60k|static void lm_set_level(deflate_state *s, int level) {
 1143|  4.60k|    s->max_lazy_match   = configuration_table[level].max_lazy;
 1144|  4.60k|    s->good_match       = configuration_table[level].good_length;
 1145|  4.60k|    s->nice_match       = configuration_table[level].nice_length;
 1146|  4.60k|    s->max_chain_length = configuration_table[level].max_chain;
 1147|  4.60k|    s->level = level;
 1148|  4.60k|}
deflate.c:lm_init:
 1153|  1.53k|static void lm_init(deflate_state *s) {
 1154|  1.53k|    s->window_size = 2 * s->w_size;
 1155|       |
 1156|  1.53k|    CLEAR_HASH(s);
  ------------------
  |  |  145|  1.53k|#define CLEAR_HASH(s) do { \
  |  |  146|  1.53k|    memset((unsigned char *)s->head, 0, HASH_SIZE * sizeof(*s->head)); \
  |  |  ------------------
  |  |  |  |   85|  1.53k|#  define HASH_SIZE 65536u         /* number of elements in hash table */
  |  |  ------------------
  |  |  147|  1.53k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (147:12): [Folded, False: 1.53k]
  |  |  ------------------
  ------------------
 1157|       |
 1158|       |    /* Set the default configuration parameters:
 1159|       |     */
 1160|  1.53k|    lm_set_level(s, s->level);
 1161|       |
 1162|  1.53k|    s->strstart = 0;
 1163|  1.53k|    s->block_start = 0;
 1164|  1.53k|    s->lookahead = 0;
 1165|  1.53k|    s->insert = 0;
 1166|  1.53k|    s->prev_length = 0;
 1167|  1.53k|    s->match_available = 0;
 1168|  1.53k|    s->match_start = 0;
 1169|  1.53k|    s->ins_h = 0;
 1170|  1.53k|}

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

deflate.c:flush_pending_inline:
  123|  10.7k|Z_FORCEINLINE static void flush_pending_inline(PREFIX3(stream) *strm) {
  124|  10.7k|    uint32_t len;
  125|  10.7k|    deflate_state *s = strm->state;
  126|       |
  127|  10.7k|    zng_tr_flush_bits(s);
  128|  10.7k|    len = MIN(s->pending, strm->avail_out);
  ------------------
  |  |  144|  10.7k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 10.7k]
  |  |  ------------------
  ------------------
  129|  10.7k|    if (len == 0)
  ------------------
  |  Branch (129:9): [True: 3.07k, False: 7.68k]
  ------------------
  130|  3.07k|        return;
  131|       |
  132|  7.68k|    Tracev((stderr, "[FLUSH]"));
  133|  7.68k|    memcpy(strm->next_out, s->pending_out, len);
  134|  7.68k|    strm->next_out  += len;
  135|  7.68k|    s->pending_out  += len;
  136|  7.68k|    strm->total_out += len;
  137|  7.68k|    strm->avail_out -= len;
  138|  7.68k|    s->pending      -= len;
  139|  7.68k|    if (s->pending == 0)
  ------------------
  |  Branch (139:9): [True: 7.68k, False: 0]
  ------------------
  140|  7.68k|        s->pending_out = s->pending_buf;
  141|  7.68k|}
deflate.c:read_buf:
  159|  14.9k|Z_FORCEINLINE static unsigned read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size) {
  160|  14.9k|    deflate_state *s = strm->state;
  161|  14.9k|    uint32_t len = MIN(strm->avail_in, size);
  ------------------
  |  |  144|  14.9k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 11.9k, False: 3.07k]
  |  |  ------------------
  ------------------
  162|       |
  163|  14.9k|    if (len == 0)
  ------------------
  |  Branch (163:9): [True: 0, False: 14.9k]
  ------------------
  164|      0|        return 0;
  165|       |
  166|  14.9k|    if (!DEFLATE_NEED_CHECKSUM(strm)) {
  ------------------
  |  |  464|  14.9k|#  define DEFLATE_NEED_CHECKSUM(strm) 1
  ------------------
  |  Branch (166:9): [Folded, False: 14.9k]
  ------------------
  167|      0|        memcpy(buf, strm->next_in, len);
  168|      0|#ifdef GZIP
  169|  14.9k|    } else if (s->wrap == 2) {
  ------------------
  |  Branch (169:16): [True: 0, False: 14.9k]
  ------------------
  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|  14.9k|    } else if (s->wrap == 1) {
  ------------------
  |  Branch (172:16): [True: 14.9k, False: 0]
  ------------------
  173|  14.9k|        strm->adler = FUNCTABLE_CALL(adler32_copy)(strm->adler, buf, strm->next_in, len);
  ------------------
  |  |   45|  14.9k|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
  174|  14.9k|    } else {
  175|      0|        memcpy(buf, strm->next_in, len);
  176|      0|    }
  177|       |
  178|  14.9k|    strm->avail_in -= len;
  179|  14.9k|    strm->next_in  += len;
  180|  14.9k|    strm->total_in += len;
  181|  14.9k|    return len;
  182|  14.9k|}
deflate_slow.c:zng_tr_tally_dist:
   87|  1.70M|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|  1.70M|    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|  1.70M|#  if OPTIMAL_CMP >= 32
   99|  1.70M|    zng_memwrite_4(&s->sym_buf[sym_next], Z_U32_TO_LE(dist | ((uint32_t)len << 16)));
  ------------------
  |  |   62|  1.70M|#  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|  1.70M|    s->sym_next = sym_next + 3;
  106|  1.70M|#endif
  107|  1.70M|    s->matches++;
  108|  1.70M|    dist--;
  109|  1.70M|    Assert(dist < MAX_DIST(s) && (uint16_t)d_code(dist) < (uint16_t)D_CODES,
  110|  1.70M|        "zng_tr_tally: bad match");
  111|       |
  112|  1.70M|    s->dyn_ltree[zng_length_code[len] + LITERALS + 1].Freq++;
  ------------------
  |  |   45|  1.70M|#define LITERALS  256
  ------------------
                  s->dyn_ltree[zng_length_code[len] + LITERALS + 1].Freq++;
  ------------------
  |  |  102|  1.70M|#define Freq fc.freq
  ------------------
  113|  1.70M|    s->dyn_dtree[d_code(dist)].Freq++;
  ------------------
  |  |  411|  1.70M|#define d_code(dist) ((dist) < 256 ? zng_dist_code[dist] : zng_dist_code[256+((dist)>>7)])
  |  |  ------------------
  |  |  |  Branch (411:23): [True: 1.70M, False: 1.34k]
  |  |  ------------------
  ------------------
                  s->dyn_dtree[d_code(dist)].Freq++;
  ------------------
  |  |  102|  1.70M|#define Freq fc.freq
  ------------------
  114|  1.70M|    return (s->sym_next == s->sym_end);
  115|  1.70M|}
deflate_slow.c:zng_tr_tally_lit:
   64|  3.85k|static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) {
   65|       |    /* c is the unmatched char */
   66|  3.85k|    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|  3.85k|#  if OPTIMAL_CMP >= 32
   73|  3.85k|    zng_memwrite_4(&s->sym_buf[sym_next], Z_U32_TO_LE((uint32_t)c << 16));
  ------------------
  |  |   62|  3.85k|#  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|  3.85k|    s->sym_next = sym_next + 3;
   80|  3.85k|#endif
   81|  3.85k|    s->dyn_ltree[c].Freq++;
  ------------------
  |  |  102|  3.85k|#define Freq fc.freq
  ------------------
   82|  3.85k|    Tracevv((stderr, "%c", c));
   83|  3.85k|    Assert(c <= (STD_MAX_MATCH-STD_MIN_MATCH), "zng_tr_tally: bad literal");
   84|  3.85k|    return (s->sym_next == s->sym_end);
   85|  3.85k|}
deflate_stored.c:read_buf:
  159|  1.53k|Z_FORCEINLINE static unsigned read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size) {
  160|  1.53k|    deflate_state *s = strm->state;
  161|  1.53k|    uint32_t len = MIN(strm->avail_in, size);
  ------------------
  |  |  144|  1.53k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 1.53k]
  |  |  ------------------
  ------------------
  162|       |
  163|  1.53k|    if (len == 0)
  ------------------
  |  Branch (163:9): [True: 0, False: 1.53k]
  ------------------
  164|      0|        return 0;
  165|       |
  166|  1.53k|    if (!DEFLATE_NEED_CHECKSUM(strm)) {
  ------------------
  |  |  464|  1.53k|#  define DEFLATE_NEED_CHECKSUM(strm) 1
  ------------------
  |  Branch (166:9): [Folded, False: 1.53k]
  ------------------
  167|      0|        memcpy(buf, strm->next_in, len);
  168|      0|#ifdef GZIP
  169|  1.53k|    } else if (s->wrap == 2) {
  ------------------
  |  Branch (169:16): [True: 0, False: 1.53k]
  ------------------
  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|  1.53k|    } else if (s->wrap == 1) {
  ------------------
  |  Branch (172:16): [True: 1.53k, False: 0]
  ------------------
  173|  1.53k|        strm->adler = FUNCTABLE_CALL(adler32_copy)(strm->adler, buf, strm->next_in, len);
  ------------------
  |  |   45|  1.53k|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
  174|  1.53k|    } else {
  175|      0|        memcpy(buf, strm->next_in, len);
  176|      0|    }
  177|       |
  178|  1.53k|    strm->avail_in -= len;
  179|  1.53k|    strm->next_in  += len;
  180|  1.53k|    strm->total_in += len;
  181|  1.53k|    return len;
  182|  1.53k|}
trees.c:bi_reverse:
  146|  28.9k|Z_FORCEINLINE static uint16_t bi_reverse(uint16_t code, int len) {
  147|       |    /* code: the value to invert */
  148|       |    /* len: its bit length */
  149|  28.9k|    Assert(len >= 1 && len <= 15, "code length must be 1-15");
  150|  28.9k|    return zng_bitreverse16(code) >> (16 - len);
  151|  28.9k|}

deflate_slow:
   18|  6.14k|Z_INTERNAL block_state deflate_slow(deflate_state *s, int flush) {
   19|  6.14k|    match_func longest_match;
   20|  6.14k|    insert_string_cb insert_string_func;
   21|  6.14k|    unsigned char *window = s->window;
   22|  6.14k|    int bflush;              /* set if current block must be flushed */
   23|  6.14k|    int level = s->level;
   24|       |
   25|  6.14k|    if (level >= 9) {
  ------------------
  |  Branch (25:9): [True: 6.14k, False: 0]
  ------------------
   26|  6.14k|        longest_match = FUNCTABLE_FPTR(longest_match_roll);
  ------------------
  |  |   46|  6.14k|#  define FUNCTABLE_FPTR(name) functable.name
  ------------------
   27|  6.14k|        insert_string_func = insert_string_roll;
   28|  6.14k|    } else {
   29|      0|        longest_match = FUNCTABLE_FPTR(longest_match);
  ------------------
  |  |   46|      0|#  define FUNCTABLE_FPTR(name) functable.name
  ------------------
   30|      0|        insert_string_func = insert_string;
   31|      0|    }
   32|       |
   33|       |    /* Process the input block. */
   34|  3.42M|    for (;;) {
   35|       |        /* Make sure that we always have enough lookahead, except
   36|       |         * at the end of the input file. We need STD_MAX_MATCH bytes
   37|       |         * for the next match, plus WANT_MIN_MATCH bytes to insert the
   38|       |         * string following the next match.
   39|       |         */
   40|  3.42M|        if (s->lookahead < MIN_LOOKAHEAD) {
  ------------------
  |  |  380|  3.42M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  ------------------
  |  |  |  |   57|  3.42M|#define STD_MAX_MATCH  258
  |  |  ------------------
  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  ------------------
  |  |  |  |   56|  3.42M|#define STD_MIN_MATCH  3
  |  |  ------------------
  ------------------
  |  Branch (40:13): [True: 27.8k, False: 3.39M]
  ------------------
   41|  27.8k|            PREFIX(fill_window)(s);
  ------------------
  |  |  117|  27.8k|#  define PREFIX(x) zng_ ## x
  ------------------
   42|  27.8k|            if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH)) {
  ------------------
  |  |  254|  40.9k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 3.07k, False: 24.7k]
  |  |  |  Branch (254:53): [True: 13.0k, False: 14.8k]
  |  |  |  Branch (254:53): [True: 3.07k, False: 9.96k]
  |  |  ------------------
  ------------------
   43|  3.07k|                return need_more;
   44|  3.07k|            }
   45|  24.7k|            if (UNLIKELY(s->lookahead == 0))
  ------------------
  |  |  254|  24.7k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 3.07k, False: 21.7k]
  |  |  ------------------
  ------------------
   46|  3.07k|                break; /* flush the current block */
   47|  24.7k|        }
   48|       |
   49|       |        /* Insert the string window[strstart .. strstart+2] in the
   50|       |         * dictionary, and set hash_head to the head of the hash chain:
   51|       |         */
   52|  3.41M|        uint32_t hash_head = 0;
   53|  3.41M|        if (LIKELY(s->lookahead >= WANT_MIN_MATCH)) {
  ------------------
  |  |  253|  3.41M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 3.41M, False: 663]
  |  |  ------------------
  ------------------
   54|  3.41M|            if (level >= 9)
  ------------------
  |  Branch (54:17): [True: 3.41M, False: 0]
  ------------------
   55|  3.41M|                hash_head = quick_insert_string_roll(s, window, s->strstart);
   56|      0|            else
   57|      0|                hash_head = quick_insert_string(s, window, s->strstart);
   58|  3.41M|        }
   59|       |
   60|       |        /* Find the longest match, discarding those <= prev_length.
   61|       |         */
   62|  3.41M|        s->prev_match = s->match_start;
   63|  3.41M|        uint32_t match_len = STD_MIN_MATCH - 1;
  ------------------
  |  |   56|  3.41M|#define STD_MIN_MATCH  3
  ------------------
   64|  3.41M|        int64_t dist = (int64_t)s->strstart - hash_head;
   65|       |
   66|  3.41M|        if (dist <= MAX_DIST(s) && dist > 0 && s->prev_length < s->max_lazy_match && hash_head != 0) {
  ------------------
  |  |  385|  6.83M|#define MAX_DIST(s)  ((s)->w_size - MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  380|  3.41M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   57|  3.41M|#define STD_MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|  3.41M|#define STD_MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (66:13): [True: 3.41M, False: 416]
  |  Branch (66:36): [True: 3.41M, False: 1.53k]
  |  Branch (66:48): [True: 1.71M, False: 1.70M]
  |  Branch (66:86): [True: 1.71M, False: 1.78k]
  ------------------
   67|       |            /* To simplify the code, we prevent matches with the string
   68|       |             * of window index 0 (in particular we have to avoid a match
   69|       |             * of the string with itself at the start of the input file).
   70|       |             */
   71|  1.71M|            match_len = longest_match(s, hash_head);
   72|       |            /* longest_match() sets match_start */
   73|       |
   74|  1.71M|            if (match_len <= 5 && (s->strategy == Z_FILTERED)) {
  ------------------
  |  |  199|    305|#define Z_FILTERED            1
  ------------------
  |  Branch (74:17): [True: 305, False: 1.71M]
  |  Branch (74:35): [True: 123, False: 182]
  ------------------
   75|       |                /* If prev_match is also WANT_MIN_MATCH, match_start is garbage
   76|       |                 * but we will ignore the current match anyway.
   77|       |                 */
   78|    123|                match_len = STD_MIN_MATCH - 1;
  ------------------
  |  |   56|    123|#define STD_MIN_MATCH  3
  ------------------
   79|    123|            }
   80|  1.71M|        }
   81|       |        /* If there was a match at the previous step and the current
   82|       |         * match is not better, output the previous match:
   83|       |         */
   84|  3.41M|        if (s->prev_length >= STD_MIN_MATCH && match_len <= s->prev_length) {
  ------------------
  |  |   56|  6.83M|#define STD_MIN_MATCH  3
  ------------------
  |  Branch (84:13): [True: 1.70M, False: 1.71M]
  |  Branch (84:48): [True: 1.70M, False: 0]
  ------------------
   85|  1.70M|            unsigned int max_insert = s->strstart + s->lookahead - STD_MIN_MATCH;
  ------------------
  |  |   56|  1.70M|#define STD_MIN_MATCH  3
  ------------------
   86|       |            /* Do not insert strings in hash table beyond this. */
   87|       |
   88|  1.70M|            Assert((s->strstart-1) <= UINT16_MAX, "strstart-1 should fit in uint16_t");
   89|  1.70M|            check_match(s, s->strstart - 1, s->prev_match, s->prev_length);
   90|       |
   91|  1.70M|            bflush = zng_tr_tally_dist(s, s->strstart -1 - s->prev_match, s->prev_length - STD_MIN_MATCH);
  ------------------
  |  |   56|  1.70M|#define STD_MIN_MATCH  3
  ------------------
   92|       |
   93|       |            /* Insert in hash table all strings up to the end of the match.
   94|       |             * strstart-1 and strstart are already inserted. If there is not
   95|       |             * enough lookahead, the last two strings are not inserted in
   96|       |             * the hash table.
   97|       |             */
   98|  1.70M|            s->prev_length -= 1;
   99|  1.70M|            s->lookahead -= s->prev_length;
  100|       |
  101|  1.70M|            unsigned int mov_fwd = s->prev_length - 1;
  102|  1.70M|            if (max_insert > s->strstart) {
  ------------------
  |  Branch (102:17): [True: 1.70M, False: 0]
  ------------------
  103|  1.70M|                unsigned int insert_cnt = mov_fwd;
  104|  1.70M|                if (UNLIKELY(insert_cnt > max_insert - s->strstart))
  ------------------
  |  |  254|  1.70M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 2.82k, False: 1.70M]
  |  |  ------------------
  ------------------
  105|  2.82k|                    insert_cnt = max_insert - s->strstart;
  106|  1.70M|                insert_string_func(s, window, s->strstart + 1, insert_cnt);
  107|  1.70M|            }
  108|  1.70M|            s->prev_length = 0;
  109|  1.70M|            s->match_available = 0;
  110|  1.70M|            s->strstart += mov_fwd + 1;
  111|       |
  112|  1.70M|            if (UNLIKELY(bflush))
  ------------------
  |  |  254|  1.70M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 1.70M]
  |  |  ------------------
  ------------------
  113|  1.70M|                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|}
  ------------------
  114|       |
  115|  1.71M|        } else if (s->match_available) {
  ------------------
  |  Branch (115:20): [True: 3.56k, False: 1.70M]
  ------------------
  116|       |            /* If there was no match at the previous position, output a
  117|       |             * single literal. If there was a match but the current match
  118|       |             * is longer, truncate the previous match to a single literal.
  119|       |             */
  120|  3.56k|            bflush = zng_tr_tally_lit(s, window[s->strstart-1]);
  121|  3.56k|            if (UNLIKELY(bflush))
  ------------------
  |  |  254|  3.56k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 3.56k]
  |  |  ------------------
  ------------------
  122|      0|                FLUSH_BLOCK_ONLY(s, window, 0);
  ------------------
  |  |  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|}
  ------------------
  123|  3.56k|            s->prev_length = match_len;
  124|  3.56k|            s->strstart++;
  125|  3.56k|            s->lookahead--;
  126|  3.56k|            if (UNLIKELY(s->strm->avail_out == 0))
  ------------------
  |  |  254|  3.56k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 3.56k]
  |  |  ------------------
  ------------------
  127|      0|                return need_more;
  128|  1.70M|        } else {
  129|       |            /* There is no previous match to compare with, wait for
  130|       |             * the next step to decide.
  131|       |             */
  132|  1.70M|            s->prev_length = match_len;
  133|  1.70M|            s->match_available = 1;
  134|  1.70M|            s->strstart++;
  135|  1.70M|            s->lookahead--;
  136|  1.70M|        }
  137|  3.41M|    }
  138|  3.07k|    Assert(flush != Z_NO_FLUSH, "no flush?");
  139|  3.07k|    if (UNLIKELY(s->match_available)) {
  ------------------
  |  |  254|  3.07k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 294, False: 2.77k]
  |  |  ------------------
  ------------------
  140|    294|        Z_UNUSED(zng_tr_tally_lit(s, window[s->strstart-1]));
  ------------------
  |  |  150|    294|#define Z_UNUSED(var) (void)(var)
  ------------------
  141|    294|        s->match_available = 0;
  142|    294|    }
  143|  3.07k|    s->insert = s->strstart < (STD_MIN_MATCH - 1) ? s->strstart : (STD_MIN_MATCH - 1);
  ------------------
  |  |   56|  3.07k|#define STD_MIN_MATCH  3
  ------------------
                  s->insert = s->strstart < (STD_MIN_MATCH - 1) ? s->strstart : (STD_MIN_MATCH - 1);
  ------------------
  |  |   56|  3.07k|#define STD_MIN_MATCH  3
  ------------------
  |  Branch (143:17): [True: 0, False: 3.07k]
  ------------------
  144|  3.07k|    if (UNLIKELY(flush == Z_FINISH)) {
  ------------------
  |  |  254|  3.07k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 1.53k, False: 1.53k]
  |  |  ------------------
  ------------------
  145|  1.53k|        FLUSH_BLOCK(s, window, 1);
  ------------------
  |  |  200|  1.53k|#define FLUSH_BLOCK(s, window, last) { \
  |  |  201|  1.53k|    FLUSH_BLOCK_ONLY(s, window, last); \
  |  |  ------------------
  |  |  |  |  188|  1.53k|#define FLUSH_BLOCK_ONLY(s, window, last) { \
  |  |  |  |  189|  1.53k|    int block_start = s->block_start; \
  |  |  |  |  190|  1.53k|    zng_tr_flush_block(s, (block_start >= 0 ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (190:28): [True: 995, False: 541]
  |  |  |  |  ------------------
  |  |  |  |  191|  1.53k|                   &window[(unsigned)block_start] : \
  |  |  |  |  192|  1.53k|                   NULL), \
  |  |  |  |  193|  1.53k|                   (uint32_t)((int)s->strstart - block_start), \
  |  |  |  |  194|  1.53k|                   (last)); \
  |  |  |  |  195|  1.53k|    s->block_start = (int)s->strstart; \
  |  |  |  |  196|  1.53k|    PREFIX(flush_pending)(s->strm); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  197|  1.53k|}
  |  |  ------------------
  |  |  202|  1.53k|    if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (202:9): [True: 0, False: 1.53k]
  |  |  |  Branch (202:41): [True: 0, Folded]
  |  |  ------------------
  |  |  203|  1.53k|}
  ------------------
  146|  1.53k|        return finish_done;
  147|  1.53k|    }
  148|  1.53k|    if (UNLIKELY(s->sym_next))
  ------------------
  |  |  254|  1.53k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 1.53k, False: 0]
  |  |  ------------------
  ------------------
  149|  1.53k|        FLUSH_BLOCK(s, window, 0);
  ------------------
  |  |  200|  1.53k|#define FLUSH_BLOCK(s, window, last) { \
  |  |  201|  1.53k|    FLUSH_BLOCK_ONLY(s, window, last); \
  |  |  ------------------
  |  |  |  |  188|  1.53k|#define FLUSH_BLOCK_ONLY(s, window, last) { \
  |  |  |  |  189|  1.53k|    int block_start = s->block_start; \
  |  |  |  |  190|  1.53k|    zng_tr_flush_block(s, (block_start >= 0 ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (190:28): [True: 1.06k, False: 467]
  |  |  |  |  ------------------
  |  |  |  |  191|  1.53k|                   &window[(unsigned)block_start] : \
  |  |  |  |  192|  1.53k|                   NULL), \
  |  |  |  |  193|  1.53k|                   (uint32_t)((int)s->strstart - block_start), \
  |  |  |  |  194|  1.53k|                   (last)); \
  |  |  |  |  195|  1.53k|    s->block_start = (int)s->strstart; \
  |  |  |  |  196|  1.53k|    PREFIX(flush_pending)(s->strm); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  |  |  |  |  ------------------
  |  |  |  |  197|  1.53k|}
  |  |  ------------------
  |  |  202|  1.53k|    if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
  |  |  ------------------
  |  |  |  Branch (202:9): [True: 0, False: 1.53k]
  |  |  |  Branch (202:41): [Folded, False: 0]
  |  |  ------------------
  |  |  203|  1.53k|}
  ------------------
  150|  1.53k|    return block_done;
  151|  1.53k|}

deflate_stored:
   27|  3.07k|Z_INTERNAL block_state deflate_stored(deflate_state *s, int flush) {
   28|  3.07k|    unsigned char *window = s->window;
   29|       |    /* Smallest worthy block size when not flushing or finishing. By default
   30|       |     * this is 32K. This can be as small as 507 bytes for memLevel == 1. For
   31|       |     * large input and output buffers, the stored block size will be larger.
   32|       |     */
   33|  3.07k|    unsigned int w_size = s->w_size;
   34|  3.07k|    unsigned min_block = MIN(s->pending_buf_size - 5, w_size);
  ------------------
  |  |  144|  3.07k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 3.07k, False: 0]
  |  |  ------------------
  ------------------
   35|       |
   36|       |    /* Copy as many min_block or larger stored blocks directly to next_out as
   37|       |     * possible. If flushing, copy the remaining available input to next_out as
   38|       |     * stored blocks, if there is enough space.
   39|       |     */
   40|  3.07k|    unsigned len, left, have, last = 0;
   41|  3.07k|    unsigned used = s->strm->avail_in;
   42|  4.60k|    do {
   43|       |        /* Set len to the maximum size block that we can copy directly with the
   44|       |         * available input data and output space. Set left to how much of that
   45|       |         * would be copied from what's left in the window.
   46|       |         */
   47|  4.60k|        len = MAX_STORED;       /* maximum deflate stored block length */
  ------------------
  |  |  206|  4.60k|#define MAX_STORED 65535
  ------------------
   48|  4.60k|        have = (s->bi_valid + 42) >> 3;         /* number of header bytes */
   49|  4.60k|        if (s->strm->avail_out < have)          /* need room for header */
  ------------------
  |  Branch (49:13): [True: 0, False: 4.60k]
  ------------------
   50|      0|            break;
   51|       |            /* maximum stored block length that will fit in avail_out: */
   52|  4.60k|        have = s->strm->avail_out - have;
   53|  4.60k|        left = (int)s->strstart - s->block_start;    /* bytes left in window */
   54|  4.60k|        if (len > (unsigned long)left + s->strm->avail_in)
  ------------------
  |  Branch (54:13): [True: 4.60k, False: 0]
  ------------------
   55|  4.60k|            len = left + s->strm->avail_in;     /* limit len to the input */
   56|  4.60k|        len = MIN(len, have);                   /* limit len to the output */
  ------------------
  |  |  144|  4.60k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 4.60k]
  |  |  ------------------
  ------------------
   57|       |
   58|       |        /* If the stored block would be less than min_block in length, or if
   59|       |         * unable to copy all of the available input when flushing, then try
   60|       |         * copying to the window and the pending buffer instead. Also don't
   61|       |         * write an empty block when flushing -- deflate() does that.
   62|       |         */
   63|  4.60k|        if (len < min_block && ((len == 0 && flush != Z_FINISH) || flush == Z_NO_FLUSH || len != left + s->strm->avail_in))
  ------------------
  |  |  175|  1.53k|#define Z_FINISH        4
  ------------------
                      if (len < min_block && ((len == 0 && flush != Z_FINISH) || flush == Z_NO_FLUSH || len != left + s->strm->avail_in))
  ------------------
  |  |  171|  7.68k|#define Z_NO_FLUSH      0
  ------------------
  |  Branch (63:13): [True: 4.60k, False: 0]
  |  Branch (63:34): [True: 1.53k, False: 3.07k]
  |  Branch (63:46): [True: 1.53k, False: 0]
  |  Branch (63:68): [True: 1.53k, False: 1.53k]
  |  Branch (63:91): [True: 0, False: 1.53k]
  ------------------
   64|  3.07k|            break;
   65|       |
   66|       |        /* Make a dummy stored block in pending to get the header bytes,
   67|       |         * including any pending bits. This also updates the debugging counts.
   68|       |         */
   69|  1.53k|        last = flush == Z_FINISH && len == left + s->strm->avail_in ? 1 : 0;
  ------------------
  |  |  175|  3.07k|#define Z_FINISH        4
  ------------------
  |  Branch (69:16): [True: 0, False: 1.53k]
  |  Branch (69:37): [True: 0, False: 0]
  ------------------
   70|  1.53k|        zng_tr_stored_block(s, NULL, 0L, last);
   71|       |
   72|       |        /* Replace the lengths in the dummy stored block with len. */
   73|  1.53k|        s->pending -= 4;
   74|  1.53k|        put_short(s, (uint16_t)len);
   75|  1.53k|        put_short(s, (uint16_t)~len);
   76|       |
   77|       |        /* Write the stored block header bytes. */
   78|  1.53k|        PREFIX(flush_pending)(s->strm);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
   79|       |
   80|       |        /* Update debugging counts for the data about to be copied. */
   81|  1.53k|        cmpr_bits_add(s, len << 3);
  ------------------
  |  |  424|  1.53k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  150|  1.53k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
   82|  1.53k|        sent_bits_add(s, len << 3);
  ------------------
  |  |  426|  1.53k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  ------------------
  |  |  |  |  150|  1.53k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
   83|       |
   84|       |        /* Copy uncompressed bytes from the window to next_out. */
   85|  1.53k|        if (left) {
  ------------------
  |  Branch (85:13): [True: 1.53k, False: 0]
  ------------------
   86|  1.53k|            left = MIN(left, len);
  ------------------
  |  |  144|  1.53k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 1.53k]
  |  |  ------------------
  ------------------
   87|  1.53k|            memcpy(s->strm->next_out, window + s->block_start, left);
   88|  1.53k|            s->strm->next_out += left;
   89|  1.53k|            s->strm->avail_out -= left;
   90|  1.53k|            s->strm->total_out += left;
   91|  1.53k|            s->block_start += (int)left;
   92|  1.53k|            len -= left;
   93|  1.53k|        }
   94|       |
   95|       |        /* Copy uncompressed bytes directly from next_in to next_out, updating
   96|       |         * the check value.
   97|       |         */
   98|  1.53k|        if (len) {
  ------------------
  |  Branch (98:13): [True: 0, False: 1.53k]
  ------------------
   99|      0|            read_buf(s->strm, s->strm->next_out, len);
  100|      0|            s->strm->next_out += len;
  101|      0|            s->strm->avail_out -= len;
  102|      0|            s->strm->total_out += len;
  103|      0|        }
  104|  1.53k|    } while (last == 0);
  ------------------
  |  Branch (104:14): [True: 1.53k, False: 0]
  ------------------
  105|       |
  106|       |    /* Update the sliding window with the last s->w_size bytes of the copied
  107|       |     * data, or append all of the copied data to the existing window if less
  108|       |     * than s->w_size bytes were copied. Also update the number of bytes to
  109|       |     * insert in the hash tables, in the event that deflateParams() switches to
  110|       |     * a non-zero compression level.
  111|       |     */
  112|  3.07k|    used -= s->strm->avail_in;      /* number of input bytes directly copied */
  113|  3.07k|    if (used) {
  ------------------
  |  Branch (113:9): [True: 0, False: 3.07k]
  ------------------
  114|       |        /* If any input was used, then no unused input remains in the window,
  115|       |         * therefore s->block_start == s->strstart.
  116|       |         */
  117|      0|        if (used >= w_size) {    /* supplant the previous history */
  ------------------
  |  Branch (117:13): [True: 0, False: 0]
  ------------------
  118|      0|            s->matches = 2;         /* clear hash */
  119|      0|            memcpy(window, s->strm->next_in - w_size, w_size);
  120|      0|            s->strstart = w_size;
  121|      0|            s->insert = s->strstart;
  122|      0|        } else {
  123|      0|            if (s->window_size - s->strstart <= used) {
  ------------------
  |  Branch (123:17): [True: 0, False: 0]
  ------------------
  124|       |                /* Slide the window down. */
  125|      0|                s->strstart -= w_size;
  126|      0|                memcpy(window, window + w_size, s->strstart);
  127|      0|                if (s->matches < 2)
  ------------------
  |  Branch (127:21): [True: 0, False: 0]
  ------------------
  128|      0|                    s->matches++;   /* add a pending slide_hash() */
  129|      0|                s->insert = MIN(s->insert, s->strstart);
  ------------------
  |  |  144|      0|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  130|      0|            }
  131|      0|            memcpy(window + s->strstart, s->strm->next_in - used, used);
  132|      0|            s->strstart += used;
  133|      0|            s->insert += MIN(used, w_size - s->insert);
  ------------------
  |  |  144|      0|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  134|      0|        }
  135|      0|        s->block_start = (int)s->strstart;
  136|      0|    }
  137|  3.07k|    s->high_water = MAX(s->high_water, s->strstart);
  ------------------
  |  |  146|  3.07k|#define MAX(a, b) ((a) < (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (146:20): [True: 0, False: 3.07k]
  |  |  ------------------
  ------------------
  138|       |
  139|       |    /* If the last block was written to next_out, then done. */
  140|  3.07k|    if (last)
  ------------------
  |  Branch (140:9): [True: 0, False: 3.07k]
  ------------------
  141|      0|        return finish_done;
  142|       |
  143|       |    /* If flushing and all input has been consumed, then done. */
  144|  3.07k|    if (flush != Z_NO_FLUSH && flush != Z_FINISH && s->strm->avail_in == 0 && (int)s->strstart == s->block_start)
  ------------------
  |  |  171|  6.14k|#define Z_NO_FLUSH      0
  ------------------
                  if (flush != Z_NO_FLUSH && flush != Z_FINISH && s->strm->avail_in == 0 && (int)s->strstart == s->block_start)
  ------------------
  |  |  175|  4.60k|#define Z_FINISH        4
  ------------------
  |  Branch (144:9): [True: 1.53k, False: 1.53k]
  |  Branch (144:32): [True: 1.53k, False: 0]
  |  Branch (144:53): [True: 1.53k, False: 0]
  |  Branch (144:79): [True: 1.53k, False: 0]
  ------------------
  145|  1.53k|        return block_done;
  146|       |
  147|       |    /* Fill the window with any remaining input. */
  148|  1.53k|    have = s->window_size - s->strstart;
  149|  1.53k|    if (s->strm->avail_in > have && s->block_start >= (int)w_size) {
  ------------------
  |  Branch (149:9): [True: 35, False: 1.50k]
  |  Branch (149:37): [True: 35, False: 0]
  ------------------
  150|       |        /* Slide the window down. */
  151|     35|        s->block_start -= (int)w_size;
  152|     35|        s->strstart -= w_size;
  153|     35|        memcpy(window, window + w_size, s->strstart);
  154|     35|        if (s->matches < 2)
  ------------------
  |  Branch (154:13): [True: 35, False: 0]
  ------------------
  155|     35|            s->matches++;           /* add a pending slide_hash() */
  156|     35|        have += w_size;          /* more space now */
  157|     35|        s->insert = MIN(s->insert, s->strstart);
  ------------------
  |  |  144|     35|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 35]
  |  |  ------------------
  ------------------
  158|     35|    }
  159|       |
  160|  1.53k|    have = MIN(have, s->strm->avail_in);
  ------------------
  |  |  144|  1.53k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 1.53k, False: 1]
  |  |  ------------------
  ------------------
  161|  1.53k|    if (have) {
  ------------------
  |  Branch (161:9): [True: 1.53k, False: 0]
  ------------------
  162|  1.53k|        read_buf(s->strm, window + s->strstart, have);
  163|  1.53k|        s->strstart += have;
  164|  1.53k|        s->insert += MIN(have, w_size - s->insert);
  ------------------
  |  |  144|  1.53k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 1.53k]
  |  |  ------------------
  ------------------
  165|  1.53k|    }
  166|  1.53k|    s->high_water = MAX(s->high_water, s->strstart);
  ------------------
  |  |  146|  1.53k|#define MAX(a, b) ((a) < (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (146:20): [True: 0, False: 1.53k]
  |  |  ------------------
  ------------------
  167|       |
  168|       |    /* There was not enough avail_out to write a complete worthy or flushed
  169|       |     * stored block to next_out. Write a stored block to pending instead, if we
  170|       |     * have enough input for a worthy block, or if flushing and there is enough
  171|       |     * room for the remaining input as a stored block in the pending buffer.
  172|       |     */
  173|  1.53k|    have = (s->bi_valid + 42) >> 3;         /* number of header bytes */
  174|       |        /* maximum stored block length that will fit in pending: */
  175|  1.53k|    have = MIN(s->pending_buf_size - have, MAX_STORED);
  ------------------
  |  |  144|  1.53k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 1.53k]
  |  |  ------------------
  ------------------
  176|  1.53k|    min_block = MIN(have, w_size);
  ------------------
  |  |  144|  1.53k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 1.53k, False: 0]
  |  |  ------------------
  ------------------
  177|  1.53k|    left = (int)s->strstart - s->block_start;
  178|  1.53k|    if (left >= min_block || ((left || flush == Z_FINISH) && flush != Z_NO_FLUSH && s->strm->avail_in == 0 && left <= have)) {
  ------------------
  |  |  175|      0|#define Z_FINISH        4
  ------------------
                  if (left >= min_block || ((left || flush == Z_FINISH) && flush != Z_NO_FLUSH && s->strm->avail_in == 0 && left <= have)) {
  ------------------
  |  |  171|  3.07k|#define Z_NO_FLUSH      0
  ------------------
  |  Branch (178:9): [True: 0, False: 1.53k]
  |  Branch (178:32): [True: 1.53k, False: 0]
  |  Branch (178:40): [True: 0, False: 0]
  |  Branch (178:62): [True: 0, False: 1.53k]
  |  Branch (178:85): [True: 0, False: 0]
  |  Branch (178:111): [True: 0, False: 0]
  ------------------
  179|      0|        len = MIN(left, have);
  ------------------
  |  |  144|      0|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  180|      0|        last = flush == Z_FINISH && s->strm->avail_in == 0 && len == left ? 1 : 0;
  ------------------
  |  |  175|      0|#define Z_FINISH        4
  ------------------
  |  Branch (180:16): [True: 0, False: 0]
  |  Branch (180:37): [True: 0, False: 0]
  |  Branch (180:63): [True: 0, False: 0]
  ------------------
  181|      0|        zng_tr_stored_block(s, window + s->block_start, len, last);
  182|      0|        s->block_start += (int)len;
  183|      0|        PREFIX(flush_pending)(s->strm);
  ------------------
  |  |  117|      0|#  define PREFIX(x) zng_ ## x
  ------------------
  184|      0|    }
  185|       |
  186|       |    /* We've done all we can with the available input and output. */
  187|  1.53k|    return last ? finish_started : need_more;
  ------------------
  |  Branch (187:12): [True: 0, False: 1.53k]
  ------------------
  188|  3.07k|}

deflate.c:zng_ctz32:
   20|  1.53k|Z_FORCEINLINE static uint32_t zng_ctz32(uint32_t value) {
   21|  1.53k|    Assert(value != 0, "Invalid input value: 0");
   22|  1.53k|#if __has_builtin(__builtin_ctz)
   23|  1.53k|    return (uint32_t)__builtin_ctz(value);
   24|       |#elif defined(_MSC_VER) && !defined(__clang__)
   25|       |#  if defined(X86_FEATURES) && !(_MSC_VER < 1700)
   26|       |    /* tzcnt falls back to bsf on cpus without BMI1, and is equal or faster on all x86 cpus. */
   27|       |    return (uint32_t)_tzcnt_u32(value);
   28|       |#  else
   29|       |    unsigned long trailing_zero;
   30|       |    _BitScanForward(&trailing_zero, value);
   31|       |    return (uint32_t)trailing_zero;
   32|       |#  endif
   33|       |#else
   34|       |    /* De Bruijn CTZ for 32-bit values */
   35|       |    static const uint8_t debruijn_ctz32[32] = {
   36|       |        0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
   37|       |        31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
   38|       |    };
   39|       |    uint32_t lsb = value & (~value + 1u);
   40|       |    return debruijn_ctz32[(lsb * 0x077CB531U) >> 27];
   41|       |#endif
   42|  1.53k|}
inftrees.c:zng_bitreverse16:
  133|  23.1k|Z_FORCEINLINE static uint16_t zng_bitreverse16(uint16_t value) {
  134|  23.1k|#if __has_builtin(__builtin_bitreverse16)
  135|  23.1k|    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|  23.1k|}
trees.c:zng_bitreverse16:
  133|  28.9k|Z_FORCEINLINE static uint16_t zng_bitreverse16(uint16_t value) {
  134|  28.9k|#if __has_builtin(__builtin_bitreverse16)
  135|  28.9k|    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|  28.9k|}
compare256_avx2.c:zng_ctz32:
   20|   373k|Z_FORCEINLINE static uint32_t zng_ctz32(uint32_t value) {
   21|   373k|    Assert(value != 0, "Invalid input value: 0");
   22|   373k|#if __has_builtin(__builtin_ctz)
   23|   373k|    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|   373k|}

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

inflate_fast_avx2:
   52|  7.45k|void Z_INTERNAL INFLATE_FAST(PREFIX3(stream) *strm, uint32_t start, int safe_mode) {
   53|       |    /* start: inflate()'s starting value for strm->avail_out */
   54|  7.45k|    struct inflate_state *state;
   55|  7.45k|    z_const unsigned char *in;  /* local strm->next_in */
  ------------------
  |  |   23|  7.45k|#define z_const const
  ------------------
   56|  7.45k|    const unsigned char *last;  /* have enough input while in < last */
   57|  7.45k|    unsigned char *out;         /* local strm->next_out */
   58|  7.45k|    unsigned char *beg;         /* inflate()'s initial strm->next_out */
   59|  7.45k|    unsigned char *end;         /* while out < end, enough space available */
   60|  7.45k|    unsigned char *safe;        /* can use chunkcopy provided out < safe */
   61|  7.45k|    unsigned char *window;      /* allocated sliding window, if wsize != 0 */
   62|  7.45k|    unsigned wsize;             /* window size or zero if not using window */
   63|  7.45k|    unsigned whave;             /* valid bytes in the window */
   64|  7.45k|    unsigned wnext;             /* window write index */
   65|       |
   66|       |    /* hold is a local copy of strm->hold. By default, hold satisfies the same
   67|       |       invariants that strm->hold does, namely that (hold >> bits) == 0. This
   68|       |       invariant is kept by loading bits into hold one byte at a time, like:
   69|       |
   70|       |       hold |= next_byte_of_input << bits; in++; bits += 8;
   71|       |
   72|       |       If we need to ensure that bits >= 15 then this code snippet is simply
   73|       |       repeated. Over one iteration of the outermost do/while loop, this
   74|       |       happens up to six times (48 bits of input), as described in the NOTES
   75|       |       above.
   76|       |
   77|       |       However, on some little endian architectures, it can be significantly
   78|       |       faster to load 64 bits once instead of 8 bits six times:
   79|       |
   80|       |       if (bits <= 16) {
   81|       |         hold |= next_8_bytes_of_input << bits; in += 6; bits += 48;
   82|       |       }
   83|       |
   84|       |       Unlike the simpler one byte load, shifting the next_8_bytes_of_input
   85|       |       by bits will overflow and lose those high bits, up to 2 bytes' worth.
   86|       |       The conservative estimate is therefore that we have read only 6 bytes
   87|       |       (48 bits). Again, as per the NOTES above, 48 bits is sufficient for the
   88|       |       rest of the iteration, and we will not need to load another 8 bytes.
   89|       |
   90|       |       Inside this function, we no longer satisfy (hold >> bits) == 0, but
   91|       |       this is not problematic, even if that overflow does not land on an 8 bit
   92|       |       byte boundary. Those excess bits will eventually shift down lower as the
   93|       |       Huffman decoder consumes input, and when new input bits need to be loaded
   94|       |       into the bits variable, the same input bits will be or'ed over those
   95|       |       existing bits. A bitwise or is idempotent: (a | b | b) equals (a | b).
   96|       |       Note that we therefore write that load operation as "hold |= etc" and not
   97|       |       "hold += etc".
   98|       |
   99|       |       Outside that loop, at the end of the function, hold is bitwise and'ed
  100|       |       with (1<<bits)-1 to drop those excess bits so that, on function exit, we
  101|       |       keep the invariant that (state->hold >> state->bits) == 0.
  102|       |    */
  103|  7.45k|    bits_t bits;                /* local strm->bits */
  104|  7.45k|    uint64_t hold;              /* local strm->hold */
  105|  7.45k|    unsigned lmask;             /* mask for first level of length codes */
  106|  7.45k|    unsigned dmask;             /* mask for first level of distance codes */
  107|  7.45k|    code const *lcode;          /* local strm->lencode */
  108|  7.45k|    code const *dcode;          /* local strm->distcode */
  109|  7.45k|    code here;                  /* retrieved table entry */
  110|  7.45k|    unsigned op;                /* code bits, operation, extra bits, or */
  111|       |                                /*  window position, window bytes to copy */
  112|  7.45k|    unsigned len;               /* match length, unused bytes */
  113|  7.45k|    unsigned char *from;        /* where to copy match from */
  114|  7.45k|    unsigned dist;              /* match distance */
  115|  7.45k|    uint64_t old;               /* look-behind buffer for extra bits */
  116|       |
  117|       |    /* copy state to local variables */
  118|  7.45k|    state = (struct inflate_state *)strm->state;
  119|  7.45k|    in = strm->next_in;
  120|  7.45k|    last = in + (strm->avail_in - (INFLATE_FAST_MIN_HAVE - 1));
  ------------------
  |  |  195|  7.45k|#define INFLATE_FAST_MIN_HAVE 15   /* max input bits per length/distance pair */
  ------------------
  121|  7.45k|    out = strm->next_out;
  122|  7.45k|    beg = out - (start - strm->avail_out);
  123|  7.45k|    safe = out + strm->avail_out;
  124|  7.45k|    end = safe - (safe_mode ? INFLATE_FAST_MIN_SAFE : INFLATE_FAST_MIN_LEFT) + 1;
  ------------------
  |  |  197|  2.97k|#define INFLATE_FAST_MIN_SAFE 3    /* max unchecked literal writes per iteration */
  ------------------
                  end = safe - (safe_mode ? INFLATE_FAST_MIN_SAFE : INFLATE_FAST_MIN_LEFT) + 1;
  ------------------
  |  |  196|  4.47k|#define INFLATE_FAST_MIN_LEFT 260  /* max output per token (258) + 2 */
  ------------------
  |  Branch (124:19): [True: 2.97k, False: 4.47k]
  ------------------
  125|  7.45k|    wsize = state->wsize;
  126|  7.45k|    whave = state->whave;
  127|  7.45k|    wnext = state->wnext;
  128|  7.45k|    window = state->window;
  129|  7.45k|    hold = state->hold;
  130|  7.45k|    bits = (bits_t)state->bits;
  131|  7.45k|    lcode = state->lencode;
  132|  7.45k|    dcode = state->distcode;
  133|  7.45k|    lmask = (1U << state->lenbits) - 1;
  134|  7.45k|    dmask = (1U << state->distbits) - 1;
  135|       |
  136|       |    /* decode literals and length/distances until end-of-block or not enough
  137|       |       input data or output space */
  138|  1.70M|    do {
  139|  1.70M|        REFILL();
  ------------------
  |  |  104|  1.70M|#define REFILL() do { \
  |  |  105|  1.70M|        hold |= load_64_bits(in, bits); \
  |  |  106|  1.70M|        in += (63 ^ bits) >> 3; \
  |  |  107|  1.70M|        bits |= 56; \
  |  |  108|  1.70M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (108:14): [Folded, False: 1.70M]
  |  |  ------------------
  ------------------
  140|  1.70M|        here = lcode[hold & lmask];
  141|  1.70M|        Z_TOUCH(here);
  ------------------
  |  |  157|  1.70M|#  define Z_TOUCH(var) __asm__ ("" : "+r"(var))
  ------------------
  142|  1.70M|        old = hold;
  143|  1.70M|        DROPBITS(here.bits);
  ------------------
  |  |  132|  1.70M|    do { \
  |  |  133|  1.70M|        unsigned u = (unsigned)(n); \
  |  |  134|  1.70M|        hold >>= u; \
  |  |  135|  1.70M|        bits -= (bits_t)u; \
  |  |  136|  1.70M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 1.70M]
  |  |  ------------------
  ------------------
  144|  1.70M|        if (LIKELY(here.op == 0)) {
  ------------------
  |  |  253|  1.70M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 1.83k, False: 1.70M]
  |  |  ------------------
  ------------------
  145|  1.83k|            TRACE_LITERAL(here.val);
  146|  1.83k|            *out++ = (unsigned char)(here.val);
  147|  1.83k|            here = lcode[hold & lmask];
  148|  1.83k|            Z_TOUCH(here);
  ------------------
  |  |  157|  1.83k|#  define Z_TOUCH(var) __asm__ ("" : "+r"(var))
  ------------------
  149|  1.83k|            old = hold;
  150|  1.83k|            DROPBITS(here.bits);
  ------------------
  |  |  132|  1.83k|    do { \
  |  |  133|  1.83k|        unsigned u = (unsigned)(n); \
  |  |  134|  1.83k|        hold >>= u; \
  |  |  135|  1.83k|        bits -= (bits_t)u; \
  |  |  136|  1.83k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 1.83k]
  |  |  ------------------
  ------------------
  151|  1.83k|            if (LIKELY(here.op == 0)) {
  ------------------
  |  |  253|  1.83k|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 1.65k, False: 171]
  |  |  ------------------
  ------------------
  152|  1.65k|                TRACE_LITERAL(here.val);
  153|  1.65k|                *out++ = (unsigned char)(here.val);
  154|  1.65k|                here = lcode[hold & lmask];
  155|  1.65k|                Z_TOUCH(here);
  ------------------
  |  |  157|  1.65k|#  define Z_TOUCH(var) __asm__ ("" : "+r"(var))
  ------------------
  156|  1.65k|            dolen:
  157|  1.65k|                old = hold;
  158|  1.65k|                DROPBITS(here.bits);
  ------------------
  |  |  132|  1.65k|    do { \
  |  |  133|  1.65k|        unsigned u = (unsigned)(n); \
  |  |  134|  1.65k|        hold >>= u; \
  |  |  135|  1.65k|        bits -= (bits_t)u; \
  |  |  136|  1.65k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 1.65k]
  |  |  ------------------
  ------------------
  159|  1.65k|                if (LIKELY(here.op == 0)) {
  ------------------
  |  |  253|  1.65k|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 123, False: 1.53k]
  |  |  ------------------
  ------------------
  160|    123|                    TRACE_LITERAL(here.val);
  161|    123|                    *out++ = (unsigned char)(here.val);
  162|    123|                    continue;
  163|    123|                }
  164|  1.65k|            }
  165|  1.83k|        }
  166|  1.70M|        op = here.op;
  167|  1.70M|        if (LIKELY(op & 16)) {                  /* length base */
  ------------------
  |  |  253|  1.70M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 1.70M, False: 1.53k]
  |  |  ------------------
  ------------------
  168|  1.70M|            len = here.val + EXTRA_BITS(old, here, op);
  ------------------
  |  |  170|  1.70M|    ((old & (((uint64_t)1 << here.bits) - 1)) >> (op & MAX_BITS))
  |  |  ------------------
  |  |  |  |   39|  1.70M|#define MAX_BITS 15
  |  |  ------------------
  ------------------
  169|  1.70M|            TRACE_LENGTH(len);
  170|  1.70M|            here = dcode[hold & dmask];
  171|  1.70M|            Z_TOUCH(here);
  ------------------
  |  |  157|  1.70M|#  define Z_TOUCH(var) __asm__ ("" : "+r"(var))
  ------------------
  172|  1.70M|            if (UNLIKELY(bits < MAX_BITS + MAX_DIST_EXTRA_BITS)) {
  ------------------
  |  |  254|  1.70M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 1.70M]
  |  |  ------------------
  ------------------
  173|      0|                REFILL();
  ------------------
  |  |  104|      0|#define REFILL() do { \
  |  |  105|      0|        hold |= load_64_bits(in, bits); \
  |  |  106|      0|        in += (63 ^ bits) >> 3; \
  |  |  107|      0|        bits |= 56; \
  |  |  108|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (108:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  174|      0|            }
  175|  1.70M|          dodist:
  176|  1.70M|            old = hold;
  177|  1.70M|            DROPBITS(here.bits);
  ------------------
  |  |  132|  1.70M|    do { \
  |  |  133|  1.70M|        unsigned u = (unsigned)(n); \
  |  |  134|  1.70M|        hold >>= u; \
  |  |  135|  1.70M|        bits -= (bits_t)u; \
  |  |  136|  1.70M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 1.70M]
  |  |  ------------------
  ------------------
  178|  1.70M|            op = here.op;
  179|  1.70M|            if (LIKELY(op & 16)) {              /* distance base */
  ------------------
  |  |  253|  1.70M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 1.70M, False: 0]
  |  |  ------------------
  ------------------
  180|  1.70M|                dist = here.val + EXTRA_BITS(old, here, op);
  ------------------
  |  |  170|  1.70M|    ((old & (((uint64_t)1 << here.bits) - 1)) >> (op & MAX_BITS))
  |  |  ------------------
  |  |  |  |   39|  1.70M|#define MAX_BITS 15
  |  |  ------------------
  ------------------
  181|       |#ifdef INFLATE_STRICT
  182|       |                if (UNLIKELY(dist > state->dmax)) {
  183|       |                    SET_BAD("invalid distance too far back");
  184|       |                    break;
  185|       |                }
  186|       |#endif
  187|  1.70M|                TRACE_DISTANCE(dist);
  188|       |
  189|       |                /* In safe mode, if there isn't enough output space for the full copy,
  190|       |                   bail to the slow path's MATCH state which handles partial copies. */
  191|  1.70M|                if (UNLIKELY(safe_mode && len > (unsigned)(safe - out))) {
  ------------------
  |  |  254|  1.71M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 1.50k, False: 1.70M]
  |  |  |  Branch (254:53): [True: 2.93k, False: 1.70M]
  |  |  |  Branch (254:53): [True: 1.50k, False: 1.43k]
  |  |  ------------------
  ------------------
  192|  1.50k|                    state->mode = MATCH;
  193|  1.50k|                    state->length = len;
  194|  1.50k|                    state->offset = dist;
  195|  1.50k|                    break;
  196|  1.50k|                }
  197|       |
  198|  1.70M|                op = (unsigned)(out - beg);     /* max distance in output */
  199|  1.70M|                if (UNLIKELY(dist > op)) {      /* see if copy from window */
  ------------------
  |  |  254|  1.70M|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 1.13k, False: 1.70M]
  |  |  ------------------
  ------------------
  200|  1.13k|                    op = dist - op;             /* distance back in window */
  201|  1.13k|                    if (UNLIKELY(op > whave)) {
  ------------------
  |  |  254|  1.13k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 1.13k]
  |  |  ------------------
  ------------------
  202|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
  203|       |                        if (LIKELY(state->sane)) {
  204|       |                            SET_BAD("invalid distance too far back");
  205|       |                            break;
  206|       |                        }
  207|       |                        unsigned gap = op - whave;
  208|       |                        unsigned zeros = MIN(len, gap);
  209|       |                        memset(out, 0, zeros);  /* fill missing bytes with zeros */
  210|       |                        out += zeros;
  211|       |                        len -= zeros;
  212|       |                        if (UNLIKELY(len == 0))
  213|       |                            continue;
  214|       |                        op = whave;
  215|       |                        if (UNLIKELY(op == 0)) {/* copy from already-decoded output */
  216|       |                            out = chunkcopy_safe(out, out - dist, len, safe);
  217|       |                            continue;
  218|       |                        }
  219|       |#else
  220|      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]
  |  |  ------------------
  ------------------
  221|      0|                        break;
  222|      0|#endif
  223|      0|                    }
  224|  1.13k|                    from = window;
  225|  1.13k|                    if (LIKELY(wnext == 0)) {           /* very common case */
  ------------------
  |  |  253|  1.13k|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 489, False: 646]
  |  |  ------------------
  ------------------
  226|    489|                        from += wsize - op;
  227|    646|                    } else if (LIKELY(wnext >= op)) {   /* contiguous in window */
  ------------------
  |  |  253|    646|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 646, False: 0]
  |  |  ------------------
  ------------------
  228|    646|                        from += wnext - op;
  229|    646|                    } else {                            /* wrap around window */
  230|      0|                        op -= wnext;
  231|      0|                        from += wsize - op;
  232|      0|                        if (UNLIKELY(op < len)) {       /* some from end of window */
  ------------------
  |  |  254|      0|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  233|      0|                            len -= op;
  234|      0|                            out = CHUNKCOPY_SAFE(out, from, op, safe);
  235|      0|                            from = window;              /* more from start of window */
  236|      0|                            op = wnext;
  237|       |                            /* This (rare) case can create a situation where
  238|       |                               the first chunkcopy below must be checked.
  239|       |                             */
  240|      0|                        }
  241|      0|                    }
  242|  1.13k|                    if (UNLIKELY(op < len)) {           /* still need some from output */
  ------------------
  |  |  254|  1.13k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 1.13k]
  |  |  ------------------
  ------------------
  243|      0|                        len -= op;
  244|      0|                        if (LIKELY(!safe_mode)) {
  ------------------
  |  |  253|      0|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  245|      0|                            out = CHUNKCOPY_SAFE(out, from, op, safe);
  246|      0|                            out = CHUNKUNROLL(out, &dist, &len);
  ------------------
  |  |  119|      0|#define CHUNKUNROLL      chunkunroll_avx2
  ------------------
  247|      0|                            out = CHUNKCOPY_SAFE(out, out - dist, len, safe);
  248|      0|                        } else {
  249|       |#ifdef HAVE_MASKED_READWRITE
  250|       |                            out = CHUNKCOPY_SAFE(out, from, op, safe);
  251|       |                            out = CHUNKCOPY_SAFE(out, out - dist, len, safe);
  252|       |#else
  253|      0|                            out = chunkcopy_safe(out, from, op, safe);
  254|      0|                            out = chunkcopy_safe(out, out - dist, len, safe);
  255|      0|#endif
  256|      0|                        }
  257|  1.13k|                    } else {
  258|       |#ifdef HAVE_MASKED_READWRITE
  259|       |                        out = CHUNKCOPY_SAFE(out, from, len, safe);
  260|       |#else
  261|  1.13k|                        if (LIKELY(!safe_mode))
  ------------------
  |  |  253|  1.13k|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 1.13k, False: 0]
  |  |  ------------------
  ------------------
  262|  1.13k|                            out = CHUNKCOPY_SAFE(out, from, len, safe);
  263|      0|                        else
  264|      0|                            out = chunkcopy_safe(out, from, len, safe);
  265|  1.13k|#endif
  266|  1.13k|                    }
  267|  1.70M|                } else if (LIKELY(!safe_mode)) {
  ------------------
  |  |  253|  1.70M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 1.70M, False: 1.43k]
  |  |  ------------------
  ------------------
  268|       |                    /* Whole reference is in range of current output.  No range checks are
  269|       |                       necessary because we start with room for at least 258 bytes of output,
  270|       |                       so unroll and roundoff operations can write beyond `out+len` so long
  271|       |                       as they stay within 258 bytes of `out`.
  272|       |                    */
  273|  1.70M|                    if (LIKELY(dist >= len || dist >= CHUNKSIZE()))
  ------------------
  |  |  253|  3.40M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 207, False: 1.70M]
  |  |  |  Branch (253:53): [True: 207, False: 1.70M]
  |  |  |  Branch (253:53): [True: 0, False: 1.70M]
  |  |  ------------------
  ------------------
  274|    207|                        out = CHUNKCOPY(out, out - dist, len);
  ------------------
  |  |  118|    207|#define CHUNKCOPY        chunkcopy_avx2
  ------------------
  275|  1.70M|                    else
  276|  1.70M|                        out = CHUNKMEMSET(out, out - dist, len);
  ------------------
  |  |  120|  1.70M|#define CHUNKMEMSET      chunkmemset_avx2
  ------------------
  277|  1.70M|                } else {
  278|       |#ifdef HAVE_MASKED_READWRITE
  279|       |                    out = CHUNKCOPY_SAFE(out, out - dist, len, safe);
  280|       |#else
  281|  1.43k|                    out = chunkcopy_safe(out, out - dist, len, safe);
  282|  1.43k|#endif
  283|  1.43k|                }
  284|  1.70M|            } else if (UNLIKELY((op & 64) == 0)) {          /* 2nd level distance code */
  ------------------
  |  |  254|      0|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  285|      0|                here = dcode[here.val + BITS(op)];
  ------------------
  |  |  128|      0|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  286|      0|                Z_TOUCH(here);
  ------------------
  |  |  157|      0|#  define Z_TOUCH(var) __asm__ ("" : "+r"(var))
  ------------------
  287|      0|                goto dodist;
  288|      0|            } else {
  289|      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]
  |  |  ------------------
  ------------------
  290|      0|                break;
  291|      0|            }
  292|  1.70M|        } else if (UNLIKELY((op & 64) == 0)) {              /* 2nd level length code */
  ------------------
  |  |  254|  1.53k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 1.53k]
  |  |  ------------------
  ------------------
  293|      0|            here = lcode[here.val + BITS(op)];
  ------------------
  |  |  128|      0|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  294|      0|            Z_TOUCH(here);
  ------------------
  |  |  157|      0|#  define Z_TOUCH(var) __asm__ ("" : "+r"(var))
  ------------------
  295|      0|            goto dolen;
  296|  1.53k|        } else if (UNLIKELY(op & 32)) {                     /* end-of-block */
  ------------------
  |  |  254|  1.53k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 1.53k, False: 0]
  |  |  ------------------
  ------------------
  297|  1.53k|            TRACE_END_OF_BLOCK();
  298|  1.53k|            state->mode = TYPE;
  299|  1.53k|            break;
  300|  1.53k|        } else {
  301|      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]
  |  |  ------------------
  ------------------
  302|      0|            break;
  303|      0|        }
  304|  1.70M|    } while (in < last && out < end);
  ------------------
  |  Branch (304:14): [True: 1.70M, False: 0]
  |  Branch (304:27): [True: 1.70M, False: 4.41k]
  ------------------
  305|       |
  306|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  307|  7.45k|    len = bits >> 3;
  308|  7.45k|    in -= len;
  309|  7.45k|    bits -= (bits_t)(len << 3);
  310|  7.45k|    hold &= (UINT64_C(1) << bits) - 1;
  311|       |
  312|       |    /* update state and return */
  313|  7.45k|    strm->next_in = in;
  314|  7.45k|    strm->next_out = out;
  315|  7.45k|    strm->avail_in = (unsigned)(in < last ? (INFLATE_FAST_MIN_HAVE - 1) + (last - in)
  ------------------
  |  |  195|  7.45k|#define INFLATE_FAST_MIN_HAVE 15   /* max input bits per length/distance pair */
  ------------------
  |  Branch (315:33): [True: 7.45k, False: 0]
  ------------------
  316|  7.45k|                                          : (INFLATE_FAST_MIN_HAVE - 1) - (in - last));
  ------------------
  |  |  195|      0|#define INFLATE_FAST_MIN_HAVE 15   /* max input bits per length/distance pair */
  ------------------
  317|  7.45k|    strm->avail_out = (unsigned)(safe - out);
  318|       |
  319|  7.45k|    Assert(bits <= 32, "Remaining bits greater than 32");
  320|  7.45k|    state->hold = (uint32_t)hold;
  321|  7.45k|    state->bits = bits;
  322|  7.45k|    return;
  323|  7.45k|}

zng_inflateResetKeep:
   63|  1.53k|int32_t Z_EXPORT PREFIX(inflateResetKeep)(PREFIX3(stream) *strm) {
   64|  1.53k|    struct inflate_state *state;
   65|       |
   66|  1.53k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (66:9): [True: 0, False: 1.53k]
  ------------------
   67|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
   68|  1.53k|    state = (struct inflate_state *)strm->state;
   69|  1.53k|    strm->total_in = strm->total_out = state->total = 0;
   70|  1.53k|    strm->msg = NULL;
   71|  1.53k|    if (state->wrap)        /* to support ill-conceived Java test suite */
  ------------------
  |  Branch (71:9): [True: 1.53k, False: 0]
  ------------------
   72|  1.53k|        strm->adler = state->wrap & 1;
   73|  1.53k|    state->mode = HEAD;
   74|  1.53k|    state->check = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   65|  1.53k|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
   75|  1.53k|    state->last = 0;
   76|  1.53k|    state->havedict = 0;
   77|  1.53k|    state->flags = -1;
   78|  1.53k|    state->head = NULL;
   79|  1.53k|    state->hold = 0;
   80|  1.53k|    state->bits = 0;
   81|  1.53k|    state->lencode = state->distcode = state->next = state->codes;
   82|  1.53k|    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|  1.53k|    INFLATE_RESET_KEEP_HOOK(strm);  /* hook for IBM Z DFLTCC */
  ------------------
  |  |   28|  1.53k|#  define INFLATE_RESET_KEEP_HOOK(strm) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (28:54): [Folded, False: 1.53k]
  |  |  ------------------
  ------------------
   90|  1.53k|    Tracev((stderr, "inflate: reset\n"));
   91|  1.53k|    return Z_OK;
  ------------------
  |  |  180|  1.53k|#define Z_OK            0
  ------------------
   92|  1.53k|}
zng_inflateReset:
   94|  1.53k|int32_t Z_EXPORT PREFIX(inflateReset)(PREFIX3(stream) *strm) {
   95|  1.53k|    struct inflate_state *state;
   96|       |
   97|  1.53k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (97:9): [True: 0, False: 1.53k]
  ------------------
   98|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
   99|  1.53k|    state = (struct inflate_state *)strm->state;
  100|  1.53k|    state->wsize = 0;
  101|  1.53k|    state->whave = 0;
  102|  1.53k|    state->wnext = 0;
  103|  1.53k|    return PREFIX(inflateResetKeep)(strm);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
  104|  1.53k|}
zng_inflateReset2:
  106|  1.53k|int32_t Z_EXPORT PREFIX(inflateReset2)(PREFIX3(stream) *strm, int32_t windowBits) {
  107|  1.53k|    int wrap;
  108|  1.53k|    struct inflate_state *state;
  109|       |
  110|       |    /* get the state */
  111|  1.53k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (111:9): [True: 0, False: 1.53k]
  ------------------
  112|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  113|  1.53k|    state = (struct inflate_state *)strm->state;
  114|       |
  115|       |    /* extract wrap request from windowBits parameter */
  116|  1.53k|    if (windowBits < 0) {
  ------------------
  |  Branch (116:9): [True: 0, False: 1.53k]
  ------------------
  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|  1.53k|    } else {
  122|  1.53k|        wrap = (windowBits >> 4) + 5;
  123|  1.53k|#ifdef GUNZIP
  124|  1.53k|        if (windowBits < 48)
  ------------------
  |  Branch (124:13): [True: 1.53k, False: 0]
  ------------------
  125|  1.53k|            windowBits &= MAX_WBITS;
  ------------------
  |  |   39|  1.53k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  126|  1.53k|#endif
  127|  1.53k|    }
  128|       |
  129|       |    /* set number of window bits */
  130|  1.53k|    if (windowBits && (windowBits < MIN_WBITS || windowBits > MAX_WBITS))
  ------------------
  |  |   36|  3.07k|#  define MIN_WBITS   8  /* 256 LZ77 window */
  ------------------
                  if (windowBits && (windowBits < MIN_WBITS || windowBits > MAX_WBITS))
  ------------------
  |  |   39|  1.53k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (130:9): [True: 1.53k, False: 0]
  |  Branch (130:24): [True: 0, False: 1.53k]
  |  Branch (130:50): [True: 0, False: 1.53k]
  ------------------
  131|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  132|       |
  133|       |    /* update state and reset the rest of it */
  134|  1.53k|    state->wrap = wrap;
  135|  1.53k|    state->wbits = (unsigned)windowBits;
  136|  1.53k|    return PREFIX(inflateReset)(strm);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
  137|  1.53k|}
alloc_inflate:
  154|  1.53k|Z_INTERNAL inflate_allocs* alloc_inflate(PREFIX3(stream) *strm) {
  155|  1.53k|    int curr_size = 0;
  156|       |
  157|       |    /* Define sizes */
  158|  1.53k|    int window_size = INFLATE_ADJUST_WINDOW_SIZE((1 << MAX_WBITS) + 64); /* 64B padding for chunksize */
  ------------------
  |  |   26|  1.53k|#  define INFLATE_ADJUST_WINDOW_SIZE(n) (n)
  ------------------
  159|  1.53k|    int state_size = sizeof(inflate_state);
  160|  1.53k|    int alloc_size = sizeof(inflate_allocs);
  161|       |
  162|       |    /* Calculate relative buffer positions and paddings */
  163|  1.53k|    LOGSZP("window", window_size, PAD_WINDOW(curr_size), PADSZ(curr_size,WINDOW_PAD_SIZE));
  164|  1.53k|    int window_pos = PAD_WINDOW(curr_size);
  ------------------
  |  |  440|  1.53k|#  define PAD_WINDOW            PAD_64
  |  |  ------------------
  |  |  |  |  297|  1.53k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  |  |  ------------------
  |  |  |  |  |  |  295|  1.53k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  165|  1.53k|    curr_size = window_pos + window_size;
  166|       |
  167|  1.53k|    LOGSZP("state", state_size, PAD_64(curr_size), PADSZ(curr_size,64));
  168|  1.53k|    int state_pos = PAD_64(curr_size);
  ------------------
  |  |  297|  1.53k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  295|  1.53k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  169|  1.53k|    curr_size = state_pos + state_size;
  170|       |
  171|  1.53k|    LOGSZP("alloc", alloc_size, PAD_16(curr_size), PADSZ(curr_size,16));
  172|  1.53k|    int alloc_pos = PAD_16(curr_size);
  ------------------
  |  |  296|  1.53k|#define PAD_16(bpos) ((bpos) + PADSZ((bpos),16))
  |  |  ------------------
  |  |  |  |  295|  1.53k|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  173|  1.53k|    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|  1.53k|    int total_size = PAD_64(curr_size + (WINDOW_PAD_SIZE - 1));
  ------------------
  |  |  297|  1.53k|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  295|  1.53k|#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|  1.53k|    char *original_buf = (char *)strm->zalloc(strm->opaque, 1, total_size);
  180|  1.53k|    if (original_buf == NULL)
  ------------------
  |  Branch (180:9): [True: 0, False: 1.53k]
  ------------------
  181|      0|        return NULL;
  182|       |
  183|  1.53k|    char *buff = (char *)HINT_ALIGNED_WINDOW((char *)PAD_WINDOW(original_buf));
  ------------------
  |  |  442|  1.53k|#  define HINT_ALIGNED_WINDOW   HINT_ALIGNED_64
  |  |  ------------------
  |  |  |  |  276|  1.53k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  271|  1.53k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  184|  1.53k|    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|  1.53k|    inflate_allocs *alloc_bufs  = (struct inflate_allocs_s *)(buff + alloc_pos);
  188|  1.53k|    alloc_bufs->buf_start = original_buf;
  189|  1.53k|    alloc_bufs->zfree = strm->zfree;
  190|       |
  191|  1.53k|    alloc_bufs->window =  (unsigned char *)HINT_ALIGNED_WINDOW((buff + window_pos));
  ------------------
  |  |  442|  1.53k|#  define HINT_ALIGNED_WINDOW   HINT_ALIGNED_64
  |  |  ------------------
  |  |  |  |  276|  1.53k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  271|  1.53k|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  192|  1.53k|    alloc_bufs->state = (inflate_state *)HINT_ALIGNED_64((buff + state_pos));
  ------------------
  |  |  276|  1.53k|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  ------------------
  |  |  |  |  271|  1.53k|#  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|  1.53k|    return alloc_bufs;
  202|  1.53k|}
free_inflate:
  207|  1.53k|Z_INTERNAL void free_inflate(PREFIX3(stream) *strm) {
  208|  1.53k|    struct inflate_state *state = (struct inflate_state *)strm->state;
  209|       |
  210|  1.53k|    if (state->alloc_bufs != NULL) {
  ------------------
  |  Branch (210:9): [True: 1.53k, False: 0]
  ------------------
  211|  1.53k|        inflate_allocs *alloc_bufs = state->alloc_bufs;
  212|  1.53k|        alloc_bufs->zfree(strm->opaque, alloc_bufs->buf_start);
  213|       |        strm->state = NULL;
  214|  1.53k|    }
  215|  1.53k|}
zng_inflateInit2:
  221|  1.53k|int32_t ZNG_CONDEXPORT PREFIX(inflateInit2)(PREFIX3(stream) *strm, int32_t windowBits) {
  222|  1.53k|    struct inflate_state *state;
  223|  1.53k|    int32_t ret;
  224|       |
  225|       |    /* Initialize functable */
  226|  1.53k|    FUNCTABLE_INIT;
  ------------------
  |  |   44|  1.53k|#  define FUNCTABLE_INIT if (functable.force_init()) {return Z_VERSION_ERROR;}
  |  |  ------------------
  |  |  |  |  188|      0|#define Z_VERSION_ERROR (-6)
  |  |  ------------------
  |  |  |  Branch (44:30): [True: 0, False: 1.53k]
  |  |  ------------------
  ------------------
  227|       |
  228|  1.53k|    if (strm == NULL)
  ------------------
  |  Branch (228:9): [True: 0, False: 1.53k]
  ------------------
  229|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  230|  1.53k|    strm->msg = NULL;                   /* in case we return an error */
  231|  1.53k|    if (strm->zalloc == NULL) {
  ------------------
  |  Branch (231:9): [True: 1.53k, False: 0]
  ------------------
  232|  1.53k|        strm->zalloc = PREFIX(zcalloc);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
  233|  1.53k|        strm->opaque = NULL;
  234|  1.53k|    }
  235|  1.53k|    if (strm->zfree == NULL)
  ------------------
  |  Branch (235:9): [True: 1.53k, False: 0]
  ------------------
  236|  1.53k|        strm->zfree = PREFIX(zcfree);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
  237|       |
  238|  1.53k|    inflate_allocs *alloc_bufs = alloc_inflate(strm);
  239|  1.53k|    if (alloc_bufs == NULL)
  ------------------
  |  Branch (239:9): [True: 0, False: 1.53k]
  ------------------
  240|      0|        return Z_MEM_ERROR;
  ------------------
  |  |  186|      0|#define Z_MEM_ERROR    (-4)
  ------------------
  241|       |
  242|  1.53k|    state = alloc_bufs->state;
  243|  1.53k|    state->window = alloc_bufs->window;
  244|  1.53k|    state->alloc_bufs = alloc_bufs;
  245|  1.53k|    state->wbufsize = INFLATE_ADJUST_WINDOW_SIZE((1 << MAX_WBITS) + 64);
  ------------------
  |  |   26|  1.53k|#  define INFLATE_ADJUST_WINDOW_SIZE(n) (n)
  ------------------
  246|  1.53k|    Tracev((stderr, "inflate: allocated\n"));
  247|       |
  248|  1.53k|    strm->state = (struct internal_state *)state;
  249|  1.53k|    state->strm = strm;
  250|  1.53k|    state->mode = HEAD;     /* to pass state test in inflateReset2() */
  251|  1.53k|    ret = PREFIX(inflateReset2)(strm, windowBits);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
  252|  1.53k|    if (ret != Z_OK) {
  ------------------
  |  |  180|  1.53k|#define Z_OK            0
  ------------------
  |  Branch (252:9): [True: 0, False: 1.53k]
  ------------------
  253|      0|        free_inflate(strm);
  254|      0|    }
  255|  1.53k|    return ret;
  256|  1.53k|}
zng_inflateInit:
  259|  1.53k|int32_t Z_EXPORT PREFIX(inflateInit)(PREFIX3(stream) *strm) {
  260|  1.53k|    return PREFIX(inflateInit2)(strm, DEF_WBITS);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
                  return PREFIX(inflateInit2)(strm, DEF_WBITS);
  ------------------
  |  |   35|  1.53k|#  define DEF_WBITS MAX_WBITS
  |  |  ------------------
  |  |  |  |   39|  1.53k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  |  |  ------------------
  ------------------
  261|  1.53k|}
zng_fixedtables:
  305|    649|void Z_INTERNAL PREFIX(fixedtables)(struct inflate_state *state) {
  306|    649|    state->lencode = lenfix;
  307|    649|    state->lenbits = 9;
  308|    649|    state->distcode = distfix;
  309|    649|    state->distbits = 5;
  310|    649|}
zng_inflate:
  477|  4.60k|int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) {
  478|  4.60k|    struct inflate_state *state;
  479|  4.60k|    const unsigned char *next;  /* next input */
  480|  4.60k|    unsigned char *put;         /* next output */
  481|  4.60k|    unsigned char *from;        /* where to copy match bytes from */
  482|  4.60k|    unsigned have, left;        /* available input and output */
  483|  4.60k|    uint64_t hold;              /* bit buffer */
  484|  4.60k|    bits_t bits;                /* bits in bit buffer */
  485|  4.60k|    uint32_t in, out;           /* save starting available input and output */
  486|  4.60k|    unsigned copy;              /* number of stored or match bytes to copy */
  487|  4.60k|    code here;                  /* current decoding table entry */
  488|  4.60k|    code last;                  /* parent table entry */
  489|  4.60k|    unsigned len;               /* length to copy for repeats, bits to drop */
  490|  4.60k|    unsigned code_bits;         /* bits in current/parent code */
  491|  4.60k|    int32_t ret;                /* return code */
  492|  4.60k|    static const uint16_t order[19] = /* permutation of code lengths */
  493|  4.60k|        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
  494|       |
  495|  4.60k|    if (inflateStateCheck(strm) || strm->next_out == NULL ||
  ------------------
  |  Branch (495:9): [True: 0, False: 4.60k]
  |  Branch (495:36): [True: 0, False: 4.60k]
  ------------------
  496|  4.60k|        (strm->next_in == NULL && strm->avail_in != 0))
  ------------------
  |  Branch (496:10): [True: 0, False: 4.60k]
  |  Branch (496:35): [True: 0, False: 0]
  ------------------
  497|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  498|       |
  499|  4.60k|    state = (struct inflate_state *)strm->state;
  500|  4.60k|    if (state->mode == TYPE)      /* skip check */
  ------------------
  |  Branch (500:9): [True: 0, False: 4.60k]
  ------------------
  501|      0|        state->mode = TYPEDO;
  502|  4.60k|    LOAD();
  ------------------
  |  |   83|  4.60k|    do { \
  |  |   84|  4.60k|        put = strm->next_out; \
  |  |   85|  4.60k|        left = strm->avail_out; \
  |  |   86|  4.60k|        next = strm->next_in; \
  |  |   87|  4.60k|        have = strm->avail_in; \
  |  |   88|  4.60k|        hold = state->hold; \
  |  |   89|  4.60k|        bits = (bits_t)state->bits; \
  |  |   90|  4.60k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (90:14): [Folded, False: 4.60k]
  |  |  ------------------
  ------------------
  503|  4.60k|    in = have;
  504|  4.60k|    out = left;
  505|  4.60k|    ret = Z_OK;
  ------------------
  |  |  180|  4.60k|#define Z_OK            0
  ------------------
  506|  4.60k|    for (;;)
  507|  29.4k|        switch (state->mode) {
  508|  1.53k|        case HEAD:
  ------------------
  |  Branch (508:9): [True: 1.53k, False: 27.8k]
  ------------------
  509|  1.53k|            if (state->wrap == 0) {
  ------------------
  |  Branch (509:17): [True: 0, False: 1.53k]
  ------------------
  510|      0|                state->mode = TYPEDO;
  511|      0|                break;
  512|      0|            }
  513|  1.53k|            NEEDBITS(16);
  ------------------
  |  |  120|  1.53k|    do { \
  |  |  121|  1.53k|        unsigned u = (unsigned)(n); \
  |  |  122|  4.60k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 3.07k, False: 1.53k]
  |  |  ------------------
  |  |  123|  3.07k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  388|  3.07k|    do { \
  |  |  |  |  389|  3.07k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (389:13): [True: 0, False: 3.07k]
  |  |  |  |  ------------------
  |  |  |  |  390|  3.07k|        have--; \
  |  |  |  |  391|  3.07k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  392|  3.07k|        bits += 8; \
  |  |  |  |  393|  3.07k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:14): [Folded, False: 3.07k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  1.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 1.53k]
  |  |  ------------------
  ------------------
  514|  1.53k|#ifdef GUNZIP
  515|  1.53k|            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
  ------------------
  |  Branch (515:17): [True: 0, False: 1.53k]
  |  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|  1.53k|            if (state->head != NULL)
  ------------------
  |  Branch (524:17): [True: 0, False: 1.53k]
  ------------------
  525|      0|                state->head->done = -1;
  526|  1.53k|            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
  ------------------
  |  Branch (526:17): [True: 0, False: 1.53k]
  ------------------
  527|       |#else
  528|       |            if (
  529|       |#endif
  530|  1.53k|                ((BITS(8) << 8) + (hold >> 8)) % 31) {
  ------------------
  |  |  128|  1.53k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  |  Branch (530:17): [True: 0, False: 1.53k]
  ------------------
  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|  1.53k|            if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  128|  1.53k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
                          if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  212|  1.53k|#define Z_DEFLATED   8
  ------------------
  |  Branch (534:17): [True: 0, False: 1.53k]
  ------------------
  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|  1.53k|            DROPBITS(4);
  ------------------
  |  |  132|  1.53k|    do { \
  |  |  133|  1.53k|        unsigned u = (unsigned)(n); \
  |  |  134|  1.53k|        hold >>= u; \
  |  |  135|  1.53k|        bits -= (bits_t)u; \
  |  |  136|  1.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 1.53k]
  |  |  ------------------
  ------------------
  539|  1.53k|            len = BITS(4) + 8;
  ------------------
  |  |  128|  1.53k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  540|  1.53k|            if (state->wbits == 0)
  ------------------
  |  Branch (540:17): [True: 0, False: 1.53k]
  ------------------
  541|      0|                state->wbits = len;
  542|  1.53k|            if (len > MAX_WBITS || len > state->wbits) {
  ------------------
  |  |   39|  3.07k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (542:17): [True: 0, False: 1.53k]
  |  Branch (542:36): [True: 0, False: 1.53k]
  ------------------
  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|  1.53k|            state->flags = 0;               /* indicate zlib header */
  550|  1.53k|            Tracev((stderr, "inflate:   zlib header ok\n"));
  551|  1.53k|            strm->adler = state->check = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   65|  1.53k|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
  552|  1.53k|            state->mode = hold & 0x200 ? DICTID : TYPE;
  ------------------
  |  Branch (552:27): [True: 0, False: 1.53k]
  ------------------
  553|  1.53k|            INITBITS();
  ------------------
  |  |  112|  1.53k|    do { \
  |  |  113|  1.53k|        hold = 0; \
  |  |  114|  1.53k|        bits = 0; \
  |  |  115|  1.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (115:14): [Folded, False: 1.53k]
  |  |  ------------------
  ------------------
  554|  1.53k|            break;
  555|      0|#ifdef GUNZIP
  556|       |
  557|      0|        case FLAGS:
  ------------------
  |  Branch (557:9): [True: 0, False: 29.4k]
  ------------------
  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: 29.4k]
  ------------------
  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: 29.4k]
  ------------------
  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: 29.4k]
  ------------------
  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: 29.4k]
  ------------------
  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: 29.4k]
  ------------------
  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: 29.4k]
  ------------------
  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: 29.4k]
  ------------------
  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: 29.4k]
  ------------------
  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: 29.4k]
  ------------------
  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|  6.14k|        case TYPE:
  ------------------
  |  Branch (720:9): [True: 6.14k, False: 23.2k]
  ------------------
  721|  6.14k|            if (flush == Z_BLOCK || flush == Z_TREES)
  ------------------
  |  |  176|  12.2k|#define Z_BLOCK         5
  ------------------
                          if (flush == Z_BLOCK || flush == Z_TREES)
  ------------------
  |  |  177|  6.14k|#define Z_TREES         6
  ------------------
  |  Branch (721:17): [True: 0, False: 6.14k]
  |  Branch (721:37): [True: 0, False: 6.14k]
  ------------------
  722|      0|                goto inf_leave;
  723|  6.14k|            Z_FALLTHROUGH;
  ------------------
  |  |   50|  6.14k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  724|       |
  725|  6.14k|        case TYPEDO:
  ------------------
  |  Branch (725:9): [True: 0, False: 29.4k]
  ------------------
  726|       |            /* determine and dispatch block type */
  727|  6.14k|            INFLATE_TYPEDO_HOOK(strm, flush);  /* hook for IBM Z DFLTCC */
  ------------------
  |  |   32|  6.14k|#  define INFLATE_TYPEDO_HOOK(strm, flush) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (32:57): [Folded, False: 6.14k]
  |  |  ------------------
  ------------------
  728|  6.14k|            if (state->last) {
  ------------------
  |  Branch (728:17): [True: 1.53k, False: 4.60k]
  ------------------
  729|  1.53k|                BYTEBITS();
  ------------------
  |  |  140|  1.53k|    do { \
  |  |  141|  1.53k|        hold >>= bits & 7; \
  |  |  142|  1.53k|        bits -= bits & 7; \
  |  |  143|  1.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (143:14): [Folded, False: 1.53k]
  |  |  ------------------
  ------------------
  730|  1.53k|                state->mode = CHECK;
  731|  1.53k|                break;
  732|  1.53k|            }
  733|  4.60k|            NEEDBITS(3);
  ------------------
  |  |  120|  4.60k|    do { \
  |  |  121|  4.60k|        unsigned u = (unsigned)(n); \
  |  |  122|  8.34k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 3.73k, False: 4.60k]
  |  |  ------------------
  |  |  123|  4.60k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  388|  3.73k|    do { \
  |  |  |  |  389|  3.73k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (389:13): [True: 0, False: 3.73k]
  |  |  |  |  ------------------
  |  |  |  |  390|  3.73k|        have--; \
  |  |  |  |  391|  3.73k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  392|  3.73k|        bits += 8; \
  |  |  |  |  393|  3.73k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:14): [Folded, False: 3.73k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  4.60k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 4.60k]
  |  |  ------------------
  ------------------
  734|  4.60k|            state->last = BITS(1);
  ------------------
  |  |  128|  4.60k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  735|  4.60k|            DROPBITS(1);
  ------------------
  |  |  132|  4.60k|    do { \
  |  |  133|  4.60k|        unsigned u = (unsigned)(n); \
  |  |  134|  4.60k|        hold >>= u; \
  |  |  135|  4.60k|        bits -= (bits_t)u; \
  |  |  136|  4.60k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 4.60k]
  |  |  ------------------
  ------------------
  736|  4.60k|            switch (BITS(2)) {
  ------------------
  |  |  128|  4.60k|    (hold & ((1U << (unsigned)(n)) - 1))
  |  |  ------------------
  |  |  |  Branch (128:5): [True: 4.60k, False: 0]
  |  |  ------------------
  ------------------
  737|  1.53k|            case 0:                             /* stored block */
  ------------------
  |  Branch (737:13): [True: 1.53k, False: 3.07k]
  ------------------
  738|  1.53k|                Tracev((stderr, "inflate:     stored block%s\n", state->last ? " (last)" : ""));
  739|  1.53k|                state->mode = STORED;
  740|  1.53k|                break;
  741|    649|            case 1:                             /* fixed block */
  ------------------
  |  Branch (741:13): [True: 649, False: 3.95k]
  ------------------
  742|    649|                PREFIX(fixedtables)(state);
  ------------------
  |  |  117|    649|#  define PREFIX(x) zng_ ## x
  ------------------
  743|    649|                Tracev((stderr, "inflate:     fixed codes block%s\n", state->last ? " (last)" : ""));
  744|    649|                state->mode = LEN_;             /* decode codes */
  745|    649|                if (flush == Z_TREES) {
  ------------------
  |  |  177|    649|#define Z_TREES         6
  ------------------
  |  Branch (745:21): [True: 0, False: 649]
  ------------------
  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|    649|                break;
  750|  2.42k|            case 2:                             /* dynamic block */
  ------------------
  |  Branch (750:13): [True: 2.42k, False: 2.18k]
  ------------------
  751|  2.42k|                Tracev((stderr, "inflate:     dynamic codes block%s\n", state->last ? " (last)" : ""));
  752|  2.42k|                state->mode = TABLE;
  753|  2.42k|                break;
  754|      0|            case 3:
  ------------------
  |  Branch (754:13): [True: 0, False: 4.60k]
  ------------------
  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|  4.60k|            }
  757|  4.60k|            DROPBITS(2);
  ------------------
  |  |  132|  4.60k|    do { \
  |  |  133|  4.60k|        unsigned u = (unsigned)(n); \
  |  |  134|  4.60k|        hold >>= u; \
  |  |  135|  4.60k|        bits -= (bits_t)u; \
  |  |  136|  4.60k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 4.60k]
  |  |  ------------------
  ------------------
  758|  4.60k|            break;
  759|       |
  760|  1.53k|        case STORED:
  ------------------
  |  Branch (760:9): [True: 1.53k, False: 27.8k]
  ------------------
  761|       |            /* get and verify stored block length */
  762|  1.53k|            BYTEBITS();                         /* go to byte boundary */
  ------------------
  |  |  140|  1.53k|    do { \
  |  |  141|  1.53k|        hold >>= bits & 7; \
  |  |  142|  1.53k|        bits -= bits & 7; \
  |  |  143|  1.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (143:14): [Folded, False: 1.53k]
  |  |  ------------------
  ------------------
  763|  1.53k|            NEEDBITS(32);
  ------------------
  |  |  120|  1.53k|    do { \
  |  |  121|  1.53k|        unsigned u = (unsigned)(n); \
  |  |  122|  7.68k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 6.14k, False: 1.53k]
  |  |  ------------------
  |  |  123|  6.14k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  388|  6.14k|    do { \
  |  |  |  |  389|  6.14k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (389:13): [True: 0, False: 6.14k]
  |  |  |  |  ------------------
  |  |  |  |  390|  6.14k|        have--; \
  |  |  |  |  391|  6.14k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  392|  6.14k|        bits += 8; \
  |  |  |  |  393|  6.14k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:14): [Folded, False: 6.14k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  1.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 1.53k]
  |  |  ------------------
  ------------------
  764|  1.53k|            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
  ------------------
  |  Branch (764:17): [True: 0, False: 1.53k]
  ------------------
  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.53k|            state->length = (uint16_t)hold;
  769|  1.53k|            Tracev((stderr, "inflate:       stored length %u\n", state->length));
  770|  1.53k|            INITBITS();
  ------------------
  |  |  112|  1.53k|    do { \
  |  |  113|  1.53k|        hold = 0; \
  |  |  114|  1.53k|        bits = 0; \
  |  |  115|  1.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (115:14): [Folded, False: 1.53k]
  |  |  ------------------
  ------------------
  771|  1.53k|            state->mode = COPY_;
  772|  1.53k|            if (flush == Z_TREES)
  ------------------
  |  |  177|  1.53k|#define Z_TREES         6
  ------------------
  |  Branch (772:17): [True: 0, False: 1.53k]
  ------------------
  773|      0|                goto inf_leave;
  774|  1.53k|            Z_FALLTHROUGH;
  ------------------
  |  |   50|  1.53k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  775|       |
  776|  1.53k|        case COPY_:
  ------------------
  |  Branch (776:9): [True: 0, False: 29.4k]
  ------------------
  777|  1.53k|            state->mode = COPY;
  778|  1.53k|            Z_FALLTHROUGH;
  ------------------
  |  |   50|  1.53k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  779|       |
  780|  4.60k|        case COPY:
  ------------------
  |  Branch (780:9): [True: 3.07k, False: 26.3k]
  ------------------
  781|       |            /* copy stored block from input to output */
  782|  4.60k|            copy = state->length;
  783|  4.60k|            if (copy) {
  ------------------
  |  Branch (783:17): [True: 3.07k, False: 1.53k]
  ------------------
  784|  3.07k|                copy = MIN(copy, have);
  ------------------
  |  |  144|  3.07k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 3.07k]
  |  |  ------------------
  ------------------
  785|  3.07k|                copy = MIN(copy, left);
  ------------------
  |  |  144|  3.07k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 1.53k, False: 1.53k]
  |  |  ------------------
  ------------------
  786|  3.07k|                if (copy == 0)
  ------------------
  |  Branch (786:21): [True: 1.53k, False: 1.53k]
  ------------------
  787|  1.53k|                    goto inf_leave;
  788|  1.53k|                memcpy(put, next, copy);
  789|  1.53k|                have -= copy;
  790|  1.53k|                next += copy;
  791|  1.53k|                left -= copy;
  792|  1.53k|                put += copy;
  793|  1.53k|                state->length -= copy;
  794|  1.53k|                break;
  795|  3.07k|            }
  796|  1.53k|            Tracev((stderr, "inflate:       stored end\n"));
  797|  1.53k|            state->mode = TYPE;
  798|  1.53k|            break;
  799|       |
  800|  2.42k|        case TABLE:
  ------------------
  |  Branch (800:9): [True: 2.42k, False: 27.0k]
  ------------------
  801|       |            /* get dynamic table entries descriptor */
  802|  2.42k|            NEEDBITS(14);
  ------------------
  |  |  120|  2.42k|    do { \
  |  |  121|  2.42k|        unsigned u = (unsigned)(n); \
  |  |  122|  7.26k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 4.84k, False: 2.42k]
  |  |  ------------------
  |  |  123|  4.84k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  388|  4.84k|    do { \
  |  |  |  |  389|  4.84k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (389:13): [True: 0, False: 4.84k]
  |  |  |  |  ------------------
  |  |  |  |  390|  4.84k|        have--; \
  |  |  |  |  391|  4.84k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  392|  4.84k|        bits += 8; \
  |  |  |  |  393|  4.84k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:14): [Folded, False: 4.84k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  2.42k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 2.42k]
  |  |  ------------------
  ------------------
  803|  2.42k|            state->nlen = BITS(5) + 257;
  ------------------
  |  |  128|  2.42k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  804|  2.42k|            DROPBITS(5);
  ------------------
  |  |  132|  2.42k|    do { \
  |  |  133|  2.42k|        unsigned u = (unsigned)(n); \
  |  |  134|  2.42k|        hold >>= u; \
  |  |  135|  2.42k|        bits -= (bits_t)u; \
  |  |  136|  2.42k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 2.42k]
  |  |  ------------------
  ------------------
  805|  2.42k|            state->ndist = BITS(5) + 1;
  ------------------
  |  |  128|  2.42k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  806|  2.42k|            DROPBITS(5);
  ------------------
  |  |  132|  2.42k|    do { \
  |  |  133|  2.42k|        unsigned u = (unsigned)(n); \
  |  |  134|  2.42k|        hold >>= u; \
  |  |  135|  2.42k|        bits -= (bits_t)u; \
  |  |  136|  2.42k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 2.42k]
  |  |  ------------------
  ------------------
  807|  2.42k|            state->ncode = BITS(4) + 4;
  ------------------
  |  |  128|  2.42k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  808|  2.42k|            DROPBITS(4);
  ------------------
  |  |  132|  2.42k|    do { \
  |  |  133|  2.42k|        unsigned u = (unsigned)(n); \
  |  |  134|  2.42k|        hold >>= u; \
  |  |  135|  2.42k|        bits -= (bits_t)u; \
  |  |  136|  2.42k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 2.42k]
  |  |  ------------------
  ------------------
  809|  2.42k|#ifndef PKZIP_BUG_WORKAROUND
  810|  2.42k|            if (state->nlen > 286 || state->ndist > 30) {
  ------------------
  |  Branch (810:17): [True: 0, False: 2.42k]
  |  Branch (810:38): [True: 0, False: 2.42k]
  ------------------
  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|  2.42k|#endif
  815|  2.42k|            Tracev((stderr, "inflate:       table sizes ok\n"));
  816|  2.42k|            state->have = 0;
  817|  2.42k|            state->mode = LENLENS;
  818|  2.42k|            Z_FALLTHROUGH;
  ------------------
  |  |   50|  2.42k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  819|       |
  820|  2.42k|        case LENLENS:
  ------------------
  |  Branch (820:9): [True: 0, False: 29.4k]
  ------------------
  821|       |            /* get code length code lengths (not a typo) */
  822|  46.0k|            while (state->have < state->ncode) {
  ------------------
  |  Branch (822:20): [True: 43.6k, False: 2.42k]
  ------------------
  823|  43.6k|                NEEDBITS(3);
  ------------------
  |  |  120|  43.6k|    do { \
  |  |  121|  43.6k|        unsigned u = (unsigned)(n); \
  |  |  122|  58.1k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 14.5k, False: 43.6k]
  |  |  ------------------
  |  |  123|  43.6k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  388|  14.5k|    do { \
  |  |  |  |  389|  14.5k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (389:13): [True: 0, False: 14.5k]
  |  |  |  |  ------------------
  |  |  |  |  390|  14.5k|        have--; \
  |  |  |  |  391|  14.5k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  392|  14.5k|        bits += 8; \
  |  |  |  |  393|  14.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:14): [Folded, False: 14.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  43.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 43.6k]
  |  |  ------------------
  ------------------
  824|  43.6k|                state->lens[order[state->have++]] = (uint16_t)BITS(3);
  ------------------
  |  |  128|  43.6k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  825|  43.6k|                DROPBITS(3);
  ------------------
  |  |  132|  43.6k|    do { \
  |  |  133|  43.6k|        unsigned u = (unsigned)(n); \
  |  |  134|  43.6k|        hold >>= u; \
  |  |  135|  43.6k|        bits -= (bits_t)u; \
  |  |  136|  43.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 43.6k]
  |  |  ------------------
  ------------------
  826|  43.6k|            }
  827|  4.84k|            while (state->have < 19)
  ------------------
  |  Branch (827:20): [True: 2.42k, False: 2.42k]
  ------------------
  828|  2.42k|                state->lens[order[state->have++]] = 0;
  829|  2.42k|            state->next = state->codes;
  830|  2.42k|            state->lencode = (const code *)(state->next);
  831|  2.42k|            state->lenbits = 7;
  832|  2.42k|            ret = zng_inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work);
  833|  2.42k|            if (ret) {
  ------------------
  |  Branch (833:17): [True: 0, False: 2.42k]
  ------------------
  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|  2.42k|            Tracev((stderr, "inflate:       code lengths ok\n"));
  838|  2.42k|            state->have = 0;
  839|  2.42k|            state->mode = CODELENS;
  840|  2.42k|            Z_FALLTHROUGH;
  ------------------
  |  |   50|  2.42k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  841|       |
  842|  2.42k|        case CODELENS:
  ------------------
  |  Branch (842:9): [True: 0, False: 29.4k]
  ------------------
  843|       |            /* get length and distance code code lengths */
  844|  26.2k|            while (state->have < state->nlen + state->ndist) {
  ------------------
  |  Branch (844:20): [True: 23.8k, False: 2.42k]
  ------------------
  845|  29.9k|                for (;;) {
  846|  29.9k|                    here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  128|  29.9k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  847|  29.9k|                    if (here.bits <= bits) break;
  ------------------
  |  Branch (847:25): [True: 23.8k, False: 6.13k]
  ------------------
  848|  6.13k|                    PULLBYTE();
  ------------------
  |  |  388|  6.13k|    do { \
  |  |  389|  6.13k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (389:13): [True: 0, False: 6.13k]
  |  |  ------------------
  |  |  390|  6.13k|        have--; \
  |  |  391|  6.13k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  392|  6.13k|        bits += 8; \
  |  |  393|  6.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (393:14): [Folded, False: 6.13k]
  |  |  ------------------
  ------------------
  849|  6.13k|                }
  850|  23.8k|                if (here.val < 16) {
  ------------------
  |  Branch (850:21): [True: 14.0k, False: 9.80k]
  ------------------
  851|  14.0k|                    DROPBITS(here.bits);
  ------------------
  |  |  132|  14.0k|    do { \
  |  |  133|  14.0k|        unsigned u = (unsigned)(n); \
  |  |  134|  14.0k|        hold >>= u; \
  |  |  135|  14.0k|        bits -= (bits_t)u; \
  |  |  136|  14.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 14.0k]
  |  |  ------------------
  ------------------
  852|  14.0k|                    state->lens[state->have++] = here.val;
  853|  14.0k|                } else {
  854|  9.80k|                    if (here.val == 16) {
  ------------------
  |  Branch (854:25): [True: 0, False: 9.80k]
  ------------------
  855|      0|                        NEEDBITS(here.bits + 2);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
  856|      0|                        DROPBITS(here.bits);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
  857|      0|                        if (state->have == 0) {
  ------------------
  |  Branch (857:29): [True: 0, False: 0]
  ------------------
  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|      0|                        len = state->lens[state->have - 1];
  862|      0|                        copy = 3 + BITS(2);
  ------------------
  |  |  128|      0|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  863|      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]
  |  |  ------------------
  ------------------
  864|  9.80k|                    } else if (here.val == 17) {
  ------------------
  |  Branch (864:32): [True: 1.06k, False: 8.74k]
  ------------------
  865|  1.06k|                        NEEDBITS(here.bits + 3);
  ------------------
  |  |  120|  1.06k|    do { \
  |  |  121|  1.06k|        unsigned u = (unsigned)(n); \
  |  |  122|  1.48k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 419, False: 1.06k]
  |  |  ------------------
  |  |  123|  1.06k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  388|    419|    do { \
  |  |  |  |  389|    419|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (389:13): [True: 0, False: 419]
  |  |  |  |  ------------------
  |  |  |  |  390|    419|        have--; \
  |  |  |  |  391|    419|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  392|    419|        bits += 8; \
  |  |  |  |  393|    419|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:14): [Folded, False: 419]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  1.06k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 1.06k]
  |  |  ------------------
  ------------------
  866|  1.06k|                        DROPBITS(here.bits);
  ------------------
  |  |  132|  1.06k|    do { \
  |  |  133|  1.06k|        unsigned u = (unsigned)(n); \
  |  |  134|  1.06k|        hold >>= u; \
  |  |  135|  1.06k|        bits -= (bits_t)u; \
  |  |  136|  1.06k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 1.06k]
  |  |  ------------------
  ------------------
  867|  1.06k|                        len = 0;
  868|  1.06k|                        copy = 3 + BITS(3);
  ------------------
  |  |  128|  1.06k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  869|  1.06k|                        DROPBITS(3);
  ------------------
  |  |  132|  1.06k|    do { \
  |  |  133|  1.06k|        unsigned u = (unsigned)(n); \
  |  |  134|  1.06k|        hold >>= u; \
  |  |  135|  1.06k|        bits -= (bits_t)u; \
  |  |  136|  1.06k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 1.06k]
  |  |  ------------------
  ------------------
  870|  8.74k|                    } else {
  871|  8.74k|                        NEEDBITS(here.bits + 7);
  ------------------
  |  |  120|  8.74k|    do { \
  |  |  121|  8.74k|        unsigned u = (unsigned)(n); \
  |  |  122|  17.2k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 8.48k, False: 8.74k]
  |  |  ------------------
  |  |  123|  8.74k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  388|  8.48k|    do { \
  |  |  |  |  389|  8.48k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (389:13): [True: 0, False: 8.48k]
  |  |  |  |  ------------------
  |  |  |  |  390|  8.48k|        have--; \
  |  |  |  |  391|  8.48k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  392|  8.48k|        bits += 8; \
  |  |  |  |  393|  8.48k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:14): [Folded, False: 8.48k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  8.74k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 8.74k]
  |  |  ------------------
  ------------------
  872|  8.74k|                        DROPBITS(here.bits);
  ------------------
  |  |  132|  8.74k|    do { \
  |  |  133|  8.74k|        unsigned u = (unsigned)(n); \
  |  |  134|  8.74k|        hold >>= u; \
  |  |  135|  8.74k|        bits -= (bits_t)u; \
  |  |  136|  8.74k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 8.74k]
  |  |  ------------------
  ------------------
  873|  8.74k|                        len = 0;
  874|  8.74k|                        copy = 11 + BITS(7);
  ------------------
  |  |  128|  8.74k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  875|  8.74k|                        DROPBITS(7);
  ------------------
  |  |  132|  8.74k|    do { \
  |  |  133|  8.74k|        unsigned u = (unsigned)(n); \
  |  |  134|  8.74k|        hold >>= u; \
  |  |  135|  8.74k|        bits -= (bits_t)u; \
  |  |  136|  8.74k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 8.74k]
  |  |  ------------------
  ------------------
  876|  8.74k|                    }
  877|  9.80k|                    if (state->have + copy > state->nlen + state->ndist) {
  ------------------
  |  Branch (877:25): [True: 0, False: 9.80k]
  ------------------
  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|   711k|                    while (copy) {
  ------------------
  |  Branch (881:28): [True: 701k, False: 9.80k]
  ------------------
  882|   701k|                        --copy;
  883|   701k|                        state->lens[state->have++] = (uint16_t)len;
  884|   701k|                    }
  885|  9.80k|                }
  886|  23.8k|            }
  887|       |
  888|       |            /* handle error breaks in while */
  889|  2.42k|            if (state->mode == BAD)
  ------------------
  |  Branch (889:17): [True: 0, False: 2.42k]
  ------------------
  890|      0|                break;
  891|       |
  892|       |            /* check for end-of-block code (better have one) */
  893|  2.42k|            if (state->lens[256] == 0) {
  ------------------
  |  Branch (893:17): [True: 0, False: 2.42k]
  ------------------
  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|  2.42k|            state->next = state->codes;
  902|  2.42k|            state->lencode = (const code *)(state->next);
  903|  2.42k|            state->lenbits = 10;
  904|  2.42k|            ret = zng_inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work);
  905|  2.42k|            if (ret) {
  ------------------
  |  Branch (905:17): [True: 0, False: 2.42k]
  ------------------
  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|  2.42k|            state->distcode = (const code *)(state->next);
  910|  2.42k|            state->distbits = 9;
  911|  2.42k|            ret = zng_inflate_table(DISTS, state->lens + state->nlen, state->ndist,
  912|  2.42k|                            &(state->next), &(state->distbits), state->work);
  913|  2.42k|            if (ret) {
  ------------------
  |  Branch (913:17): [True: 0, False: 2.42k]
  ------------------
  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|  2.42k|            Tracev((stderr, "inflate:       codes ok\n"));
  918|  2.42k|            state->mode = LEN_;
  919|  2.42k|            if (flush == Z_TREES)
  ------------------
  |  |  177|  2.42k|#define Z_TREES         6
  ------------------
  |  Branch (919:17): [True: 0, False: 2.42k]
  ------------------
  920|      0|                goto inf_leave;
  921|  2.42k|            Z_FALLTHROUGH;
  ------------------
  |  |   50|  2.42k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  922|       |
  923|  3.07k|        case LEN_:
  ------------------
  |  Branch (923:9): [True: 649, False: 28.7k]
  ------------------
  924|  3.07k|            state->mode = LEN;
  925|  3.07k|            Z_FALLTHROUGH;
  ------------------
  |  |   50|  3.07k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  926|       |
  927|  9.26k|        case LEN:
  ------------------
  |  Branch (927:9): [True: 6.19k, False: 23.2k]
  ------------------
  928|       |            /* use inflate_fast() if we have enough input and output */
  929|  9.26k|            if (have >= INFLATE_FAST_MIN_HAVE && left >= INFLATE_FAST_MIN_SAFE) {
  ------------------
  |  |  195|  18.5k|#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|  9.26k|#define INFLATE_FAST_MIN_SAFE 3    /* max unchecked literal writes per iteration */
  ------------------
  |  Branch (929:17): [True: 9.26k, False: 0]
  |  Branch (929:50): [True: 7.45k, False: 1.81k]
  ------------------
  930|  7.45k|                RESTORE();
  ------------------
  |  |   94|  7.45k|    do { \
  |  |   95|  7.45k|        strm->next_out = put; \
  |  |   96|  7.45k|        strm->avail_out = left; \
  |  |   97|  7.45k|        strm->next_in = (z_const unsigned char *)next; \
  |  |   98|  7.45k|        strm->avail_in = have; \
  |  |   99|  7.45k|        state->hold = hold; \
  |  |  100|  7.45k|        state->bits = bits; \
  |  |  101|  7.45k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (101:14): [Folded, False: 7.45k]
  |  |  ------------------
  ------------------
  931|  7.45k|                FUNCTABLE_CALL(inflate_fast)(strm, out, left < INFLATE_FAST_MIN_LEFT);
  ------------------
  |  |   45|  7.45k|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
                              FUNCTABLE_CALL(inflate_fast)(strm, out, left < INFLATE_FAST_MIN_LEFT);
  ------------------
  |  |  196|  7.45k|#define INFLATE_FAST_MIN_LEFT 260  /* max output per token (258) + 2 */
  ------------------
  932|  7.45k|                LOAD();
  ------------------
  |  |   83|  7.45k|    do { \
  |  |   84|  7.45k|        put = strm->next_out; \
  |  |   85|  7.45k|        left = strm->avail_out; \
  |  |   86|  7.45k|        next = strm->next_in; \
  |  |   87|  7.45k|        have = strm->avail_in; \
  |  |   88|  7.45k|        hold = state->hold; \
  |  |   89|  7.45k|        bits = (bits_t)state->bits; \
  |  |   90|  7.45k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (90:14): [Folded, False: 7.45k]
  |  |  ------------------
  ------------------
  933|  7.45k|                if (state->mode == TYPE)
  ------------------
  |  Branch (933:21): [True: 1.53k, False: 5.91k]
  ------------------
  934|  1.53k|                    state->back = -1;
  935|  7.45k|                break;
  936|  7.45k|            }
  937|  1.81k|            state->back = 0;
  938|       |
  939|       |            /* get a literal, length, or end-of-block code */
  940|  2.59k|            for (;;) {
  941|  2.59k|                here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  128|  2.59k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  942|  2.59k|                if (CODE_BITS(here) <= bits)
  ------------------
  |  |  162|  2.59k|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 158, False: 2.43k]
  |  |  ------------------
  ------------------
  |  Branch (942:21): [True: 1.81k, False: 782]
  ------------------
  943|  1.81k|                    break;
  944|    782|                PULLBYTE();
  ------------------
  |  |  388|    782|    do { \
  |  |  389|    782|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (389:13): [True: 0, False: 782]
  |  |  ------------------
  |  |  390|    782|        have--; \
  |  |  391|    782|        hold += ((uint64_t)(*next++) << bits); \
  |  |  392|    782|        bits += 8; \
  |  |  393|    782|    } while (0)
  |  |  ------------------
  |  |  |  Branch (393:14): [Folded, False: 782]
  |  |  ------------------
  ------------------
  945|    782|            }
  946|  1.81k|            if (here.op && (here.op & 0xf0) == 0) {
  ------------------
  |  Branch (946:17): [True: 1.56k, False: 246]
  |  Branch (946:28): [True: 0, False: 1.56k]
  ------------------
  947|      0|                unsigned last_bits;
  948|      0|                last = here;
  949|      0|                last_bits = CODE_BITS(last);
  ------------------
  |  |  162|      0|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  950|      0|                for (;;) {
  951|      0|                    here = state->lencode[last.val + (BITS(last_bits + (last.op & 15)) >> last_bits)];
  ------------------
  |  |  128|      0|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  952|      0|                    if (last_bits + CODE_BITS(here) <= bits)
  ------------------
  |  |  162|      0|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (952:25): [True: 0, False: 0]
  ------------------
  953|      0|                        break;
  954|      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]
  |  |  ------------------
  ------------------
  955|      0|                }
  956|      0|                DROPBITS(last_bits);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
  957|      0|                state->back += last_bits;
  958|      0|            }
  959|  1.81k|            code_bits = CODE_BITS(here);
  ------------------
  |  |  162|  1.81k|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 33, False: 1.78k]
  |  |  ------------------
  ------------------
  960|  1.81k|            DROPBITS(code_bits);
  ------------------
  |  |  132|  1.81k|    do { \
  |  |  133|  1.81k|        unsigned u = (unsigned)(n); \
  |  |  134|  1.81k|        hold >>= u; \
  |  |  135|  1.81k|        bits -= (bits_t)u; \
  |  |  136|  1.81k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 1.81k]
  |  |  ------------------
  ------------------
  961|  1.81k|            state->back += code_bits;
  962|  1.81k|            state->length = here.val;
  963|       |
  964|       |            /* process literal */
  965|  1.81k|            if ((int)(here.op) == 0) {
  ------------------
  |  Branch (965:17): [True: 246, False: 1.56k]
  ------------------
  966|    246|                TRACE_LITERAL(here.val);
  967|    246|                state->mode = LIT;
  968|    246|                break;
  969|    246|            }
  970|       |
  971|       |            /* process end of block */
  972|  1.56k|            if (here.op & 32) {
  ------------------
  |  Branch (972:17): [True: 1.53k, False: 33]
  ------------------
  973|  1.53k|                TRACE_END_OF_BLOCK();
  974|  1.53k|                state->back = -1;
  975|  1.53k|                state->mode = TYPE;
  976|  1.53k|                break;
  977|  1.53k|            }
  978|       |
  979|       |            /* invalid code */
  980|     33|            if (here.op & 64) {
  ------------------
  |  Branch (980:17): [True: 0, False: 33]
  ------------------
  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|     33|            state->extra = CODE_EXTRA(here);
  ------------------
  |  |  166|     33|    ((unsigned)((here.op & 16) ? (here.bits - (here.op & 15)) : 0))
  |  |  ------------------
  |  |  |  Branch (166:17): [True: 33, False: 0]
  |  |  ------------------
  ------------------
  987|     33|            state->mode = LENEXT;
  988|     33|            Z_FALLTHROUGH;
  ------------------
  |  |   50|     33|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  989|       |
  990|     33|        case LENEXT:
  ------------------
  |  Branch (990:9): [True: 0, False: 29.4k]
  ------------------
  991|       |            /* get extra bits, if any */
  992|     33|            if (state->extra) {
  ------------------
  |  Branch (992:17): [True: 24, False: 9]
  ------------------
  993|     24|                NEEDBITS(state->extra);
  ------------------
  |  |  120|     24|    do { \
  |  |  121|     24|        unsigned u = (unsigned)(n); \
  |  |  122|     38|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 14, False: 24]
  |  |  ------------------
  |  |  123|     24|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  388|     14|    do { \
  |  |  |  |  389|     14|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (389:13): [True: 0, False: 14]
  |  |  |  |  ------------------
  |  |  |  |  390|     14|        have--; \
  |  |  |  |  391|     14|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  392|     14|        bits += 8; \
  |  |  |  |  393|     14|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:14): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|     24|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 24]
  |  |  ------------------
  ------------------
  994|     24|                state->length += BITS(state->extra);
  ------------------
  |  |  128|     24|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  995|     24|                DROPBITS(state->extra);
  ------------------
  |  |  132|     24|    do { \
  |  |  133|     24|        unsigned u = (unsigned)(n); \
  |  |  134|     24|        hold >>= u; \
  |  |  135|     24|        bits -= (bits_t)u; \
  |  |  136|     24|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 24]
  |  |  ------------------
  ------------------
  996|     24|                state->back += state->extra;
  997|     24|            }
  998|     33|            TRACE_LENGTH(state->length);
  999|     33|            state->was = state->length;
 1000|     33|            state->mode = DIST;
 1001|     33|            Z_FALLTHROUGH;
  ------------------
  |  |   50|     33|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1002|       |
 1003|     33|        case DIST:
  ------------------
  |  Branch (1003:9): [True: 0, False: 29.4k]
  ------------------
 1004|       |            /* get distance code */
 1005|     44|            for (;;) {
 1006|     44|                here = state->distcode[BITS(state->distbits)];
  ------------------
  |  |  128|     44|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
 1007|     44|                if (CODE_BITS(here) <= bits)
  ------------------
  |  |  162|     44|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 44, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1007:21): [True: 33, False: 11]
  ------------------
 1008|     33|                    break;
 1009|     11|                PULLBYTE();
  ------------------
  |  |  388|     11|    do { \
  |  |  389|     11|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (389:13): [True: 0, False: 11]
  |  |  ------------------
  |  |  390|     11|        have--; \
  |  |  391|     11|        hold += ((uint64_t)(*next++) << bits); \
  |  |  392|     11|        bits += 8; \
  |  |  393|     11|    } while (0)
  |  |  ------------------
  |  |  |  Branch (393:14): [Folded, False: 11]
  |  |  ------------------
  ------------------
 1010|     11|            }
 1011|     33|            if ((here.op & 0xf0) == 0) {
  ------------------
  |  Branch (1011:17): [True: 0, False: 33]
  ------------------
 1012|      0|                unsigned last_bits;
 1013|      0|                last = here;
 1014|      0|                last_bits = CODE_BITS(last);
  ------------------
  |  |  162|      0|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1015|      0|                for (;;) {
 1016|      0|                    here = state->distcode[last.val + (BITS(last_bits + (last.op & 15)) >> last_bits)];
  ------------------
  |  |  128|      0|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
 1017|      0|                    if (last_bits + CODE_BITS(here) <= bits)
  ------------------
  |  |  162|      0|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1017:25): [True: 0, False: 0]
  ------------------
 1018|      0|                        break;
 1019|      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]
  |  |  ------------------
  ------------------
 1020|      0|                }
 1021|      0|                DROPBITS(last_bits);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
 1022|      0|                state->back += last_bits;
 1023|      0|            }
 1024|     33|            code_bits = CODE_BITS(here);
  ------------------
  |  |  162|     33|    ((unsigned)((here.op & 16) ? (here.op & 15) : here.bits))
  |  |  ------------------
  |  |  |  Branch (162:17): [True: 33, False: 0]
  |  |  ------------------
  ------------------
 1025|     33|            DROPBITS(code_bits);
  ------------------
  |  |  132|     33|    do { \
  |  |  133|     33|        unsigned u = (unsigned)(n); \
  |  |  134|     33|        hold >>= u; \
  |  |  135|     33|        bits -= (bits_t)u; \
  |  |  136|     33|    } while (0)
  |  |  ------------------
  |  |  |  Branch (136:14): [Folded, False: 33]
  |  |  ------------------
  ------------------
 1026|     33|            state->back += code_bits;
 1027|     33|            if (here.op & 64) {
  ------------------
  |  Branch (1027:17): [True: 0, False: 33]
  ------------------
 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|     33|            state->offset = here.val;
 1032|     33|            state->extra = CODE_EXTRA(here);
  ------------------
  |  |  166|     33|    ((unsigned)((here.op & 16) ? (here.bits - (here.op & 15)) : 0))
  |  |  ------------------
  |  |  |  Branch (166:17): [True: 33, False: 0]
  |  |  ------------------
  ------------------
 1033|     33|            state->mode = DISTEXT;
 1034|     33|            Z_FALLTHROUGH;
  ------------------
  |  |   50|     33|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1035|       |
 1036|     33|        case DISTEXT:
  ------------------
  |  Branch (1036:9): [True: 0, False: 29.4k]
  ------------------
 1037|       |            /* get distance extra bits, if any */
 1038|     33|            if (state->extra) {
  ------------------
  |  Branch (1038:17): [True: 0, False: 33]
  ------------------
 1039|      0|                NEEDBITS(state->extra);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
 1040|      0|                state->offset += BITS(state->extra);
  ------------------
  |  |  128|      0|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
 1041|      0|                DROPBITS(state->extra);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
 1042|      0|                state->back += state->extra;
 1043|      0|            }
 1044|       |#ifdef INFLATE_STRICT
 1045|       |            if (state->offset > state->dmax) {
 1046|       |                SET_BAD("invalid distance too far back");
 1047|       |                break;
 1048|       |            }
 1049|       |#endif
 1050|     33|            TRACE_DISTANCE(state->offset);
 1051|     33|            state->mode = MATCH;
 1052|     33|            Z_FALLTHROUGH;
  ------------------
  |  |   50|     33|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1053|       |
 1054|  6.11k|        case MATCH:
  ------------------
  |  Branch (1054:9): [True: 6.08k, False: 23.3k]
  ------------------
 1055|       |            /* copy match from window to output */
 1056|  6.11k|            if (left == 0)
  ------------------
  |  Branch (1056:17): [True: 1.53k, False: 4.58k]
  ------------------
 1057|  1.53k|                goto inf_leave;
 1058|  4.58k|            copy = out - left;
 1059|  4.58k|            if (state->offset > copy) {         /* copy from window */
  ------------------
  |  Branch (1059:17): [True: 1.53k, False: 3.04k]
  ------------------
 1060|  1.53k|                copy = state->offset - copy;
 1061|  1.53k|                if (copy > state->whave) {
  ------------------
  |  Branch (1061:21): [True: 0, False: 1.53k]
  ------------------
 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|  1.53k|                if (copy > state->wnext) {
  ------------------
  |  Branch (1083:21): [True: 710, False: 827]
  ------------------
 1084|    710|                    copy -= state->wnext;
 1085|    710|                    from = state->window + (state->wsize - copy);
 1086|    827|                } else {
 1087|    827|                    from = state->window + (state->wnext - copy);
 1088|    827|                }
 1089|  1.53k|                copy = MIN(copy, state->length);
  ------------------
  |  |  144|  1.53k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 1, False: 1.53k]
  |  |  ------------------
  ------------------
 1090|  1.53k|                copy = MIN(copy, left);
  ------------------
  |  |  144|  1.53k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 1, False: 1.53k]
  |  |  ------------------
  ------------------
 1091|       |
 1092|  1.53k|                put = chunkcopy_safe(put, from, copy, put + left);
 1093|  3.04k|            } else {
 1094|  3.04k|                copy = MIN(state->length, left);
  ------------------
  |  |  144|  3.04k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 1.52k, False: 1.52k]
  |  |  ------------------
  ------------------
 1095|       |
 1096|  3.04k|                put = FUNCTABLE_CALL(chunkmemset_safe)(put, put - state->offset, copy, left);
  ------------------
  |  |   45|  3.04k|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
 1097|  3.04k|            }
 1098|  4.58k|            left -= copy;
 1099|  4.58k|            state->length -= copy;
 1100|  4.58k|            if (state->length == 0)
  ------------------
  |  Branch (1100:17): [True: 1.53k, False: 3.04k]
  ------------------
 1101|  1.53k|                state->mode = LEN;
 1102|  4.58k|            break;
 1103|       |
 1104|    246|        case LIT:
  ------------------
  |  Branch (1104:9): [True: 246, False: 29.1k]
  ------------------
 1105|    246|            if (left == 0)
  ------------------
  |  Branch (1105:17): [True: 0, False: 246]
  ------------------
 1106|      0|                goto inf_leave;
 1107|    246|            *put++ = (unsigned char)(state->length);
 1108|    246|            left--;
 1109|    246|            state->mode = LEN;
 1110|    246|            break;
 1111|       |
 1112|  1.53k|        case CHECK:
  ------------------
  |  Branch (1112:9): [True: 1.53k, False: 27.8k]
  ------------------
 1113|  1.53k|            if (state->wrap) {
  ------------------
  |  Branch (1113:17): [True: 1.53k, False: 0]
  ------------------
 1114|  1.53k|                NEEDBITS(32);
  ------------------
  |  |  120|  1.53k|    do { \
  |  |  121|  1.53k|        unsigned u = (unsigned)(n); \
  |  |  122|  7.68k|        while (bits < (bits_t)u) \
  |  |  ------------------
  |  |  |  Branch (122:16): [True: 6.14k, False: 1.53k]
  |  |  ------------------
  |  |  123|  6.14k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  388|  6.14k|    do { \
  |  |  |  |  389|  6.14k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (389:13): [True: 0, False: 6.14k]
  |  |  |  |  ------------------
  |  |  |  |  390|  6.14k|        have--; \
  |  |  |  |  391|  6.14k|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  392|  6.14k|        bits += 8; \
  |  |  |  |  393|  6.14k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:14): [Folded, False: 6.14k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  124|  1.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (124:14): [Folded, False: 1.53k]
  |  |  ------------------
  ------------------
 1115|  1.53k|                out -= left;
 1116|  1.53k|                strm->total_out += out;
 1117|  1.53k|                state->total += out;
 1118|       |
 1119|       |                /* compute crc32 checksum if not in raw mode */
 1120|  1.53k|                if (INFLATE_NEED_CHECKSUM(strm) && state->wrap & 4) {
  ------------------
  |  |   34|  3.07k|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (34:39): [True: 1.53k, Folded]
  |  |  ------------------
  ------------------
  |  Branch (1120:52): [True: 1.53k, False: 0]
  ------------------
 1121|  1.53k|                    if (out) {
  ------------------
  |  Branch (1121:25): [True: 1.53k, False: 0]
  ------------------
 1122|  1.53k|                        inf_chksum(strm, put - out, out);
 1123|  1.53k|                    }
 1124|  1.53k|                }
 1125|  1.53k|                out = left;
 1126|  1.53k|                if ((state->wrap & 4) && (
  ------------------
  |  Branch (1126:21): [True: 1.53k, False: 0]
  |  Branch (1126:42): [True: 0, False: 1.53k]
  ------------------
 1127|  1.53k|#ifdef GUNZIP
 1128|  1.53k|                     state->flags ? hold :
  ------------------
  |  Branch (1128:22): [True: 0, False: 1.53k]
  ------------------
 1129|  1.53k|#endif
 1130|  1.53k|                     ZSWAP32((unsigned)hold)) != state->check) {
  ------------------
  |  |  210|  1.53k|#  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|  1.53k|                INITBITS();
  ------------------
  |  |  112|  1.53k|    do { \
  |  |  113|  1.53k|        hold = 0; \
  |  |  114|  1.53k|        bits = 0; \
  |  |  115|  1.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (115:14): [Folded, False: 1.53k]
  |  |  ------------------
  ------------------
 1135|  1.53k|                Tracev((stderr, "inflate:   check matches trailer\n"));
 1136|  1.53k|            }
 1137|  1.53k|#ifdef GUNZIP
 1138|  1.53k|            state->mode = LENGTH;
 1139|  1.53k|            Z_FALLTHROUGH;
  ------------------
  |  |   50|  1.53k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1140|       |
 1141|  1.53k|        case LENGTH:
  ------------------
  |  Branch (1141:9): [True: 0, False: 29.4k]
  ------------------
 1142|  1.53k|            if (state->wrap && state->flags) {
  ------------------
  |  Branch (1142:17): [True: 1.53k, False: 0]
  |  Branch (1142:32): [True: 0, False: 1.53k]
  ------------------
 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|  1.53k|#endif
 1152|  1.53k|            state->mode = DONE;
 1153|  1.53k|            Z_FALLTHROUGH;
  ------------------
  |  |   50|  1.53k|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1154|       |
 1155|  1.53k|        case DONE:
  ------------------
  |  Branch (1155:9): [True: 0, False: 29.4k]
  ------------------
 1156|       |            /* inflate stream terminated properly */
 1157|  1.53k|            ret = Z_STREAM_END;
  ------------------
  |  |  181|  1.53k|#define Z_STREAM_END    1
  ------------------
 1158|  1.53k|            goto inf_leave;
 1159|       |
 1160|      0|        case BAD:
  ------------------
  |  Branch (1160:9): [True: 0, False: 29.4k]
  ------------------
 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: 29.4k]
  ------------------
 1165|       |
 1166|      0|        default:                 /* can't happen, but makes compilers happy */
  ------------------
  |  Branch (1166:9): [True: 0, False: 29.4k]
  ------------------
 1167|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1168|  29.4k|        }
 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|  4.60k|  inf_leave:
 1176|  4.60k|    RESTORE();
  ------------------
  |  |   94|  4.60k|    do { \
  |  |   95|  4.60k|        strm->next_out = put; \
  |  |   96|  4.60k|        strm->avail_out = left; \
  |  |   97|  4.60k|        strm->next_in = (z_const unsigned char *)next; \
  |  |   98|  4.60k|        strm->avail_in = have; \
  |  |   99|  4.60k|        state->hold = hold; \
  |  |  100|  4.60k|        state->bits = bits; \
  |  |  101|  4.60k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (101:14): [Folded, False: 4.60k]
  |  |  ------------------
  ------------------
 1177|  4.60k|    uint32_t check_bytes = out - strm->avail_out;
 1178|  4.60k|    if (INFLATE_NEED_UPDATEWINDOW(strm) &&
  ------------------
  |  |   36|  9.21k|#  define INFLATE_NEED_UPDATEWINDOW(strm) 1
  |  |  ------------------
  |  |  |  Branch (36:43): [True: 4.60k, Folded]
  |  |  ------------------
  ------------------
 1179|  4.60k|            (state->wsize || (out != strm->avail_out && state->mode < BAD &&
  ------------------
  |  Branch (1179:14): [True: 3.07k, False: 1.53k]
  |  Branch (1179:31): [True: 1.53k, False: 0]
  |  Branch (1179:57): [True: 1.53k, False: 0]
  ------------------
 1180|  4.60k|                 (state->mode < CHECK || flush != Z_FINISH)))) {
  ------------------
  |  |  175|      0|#define Z_FINISH        4
  ------------------
  |  Branch (1180:19): [True: 1.53k, False: 0]
  |  Branch (1180:42): [True: 0, False: 0]
  ------------------
 1181|       |        /* update sliding window with respective checksum if not in "raw" mode */
 1182|  4.60k|        updatewindow(strm, strm->next_out, check_bytes, state->wrap & 4);
 1183|  4.60k|    }
 1184|  4.60k|    in -= strm->avail_in;
 1185|  4.60k|    out -= strm->avail_out;
 1186|  4.60k|    strm->total_in += in;
 1187|  4.60k|    strm->total_out += out;
 1188|  4.60k|    state->total += out;
 1189|       |
 1190|  4.60k|    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
  ------------------
  |  Branch (1190:43): [True: 3.07k, False: 1.53k]
  ------------------
 1191|  4.60k|                      (state->mode == TYPE ? 128 : 0) + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
  ------------------
  |  Branch (1191:24): [True: 0, False: 4.60k]
  |  Branch (1191:58): [True: 0, False: 4.60k]
  |  Branch (1191:81): [True: 0, False: 4.60k]
  ------------------
 1192|  4.60k|    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) {
  ------------------
  |  |  175|  4.60k|#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: 0, False: 4.60k]
  |  Branch (1192:22): [True: 0, False: 0]
  |  Branch (1192:35): [True: 0, False: 4.60k]
  |  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|  4.60k|    return ret;
 1200|  4.60k|}
zng_inflateEnd:
 1202|  1.53k|int32_t Z_EXPORT PREFIX(inflateEnd)(PREFIX3(stream) *strm) {
 1203|  1.53k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (1203:9): [True: 0, False: 1.53k]
  ------------------
 1204|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1205|       |
 1206|       |    /* Free allocated buffers */
 1207|  1.53k|    free_inflate(strm);
 1208|       |
 1209|  1.53k|    Tracev((stderr, "inflate: end\n"));
 1210|  1.53k|    return Z_OK;
  ------------------
  |  |  180|  1.53k|#define Z_OK            0
  ------------------
 1211|  1.53k|}
inflate.c:inflateStateCheck:
   53|  10.7k|static int inflateStateCheck(PREFIX3(stream) *strm) {
   54|  10.7k|    struct inflate_state *state;
   55|  10.7k|    if (strm == NULL || strm->zalloc == NULL || strm->zfree == NULL)
  ------------------
  |  Branch (55:9): [True: 0, False: 10.7k]
  |  Branch (55:25): [True: 0, False: 10.7k]
  |  Branch (55:49): [True: 0, False: 10.7k]
  ------------------
   56|      0|        return 1;
   57|  10.7k|    state = (struct inflate_state *)strm->state;
   58|  10.7k|    if (state == NULL || state->alloc_bufs == NULL || state->strm != strm || state->mode < HEAD || state->mode > SYNC)
  ------------------
  |  Branch (58:9): [True: 0, False: 10.7k]
  |  Branch (58:26): [True: 0, False: 10.7k]
  |  Branch (58:55): [True: 0, False: 10.7k]
  |  Branch (58:78): [True: 0, False: 10.7k]
  |  Branch (58:100): [True: 0, False: 10.7k]
  ------------------
   59|      0|        return 1;
   60|  10.7k|    return 0;
   61|  10.7k|}
inflate.c:inf_chksum:
   41|  2.95k|static inline void inf_chksum(PREFIX3(stream) *strm, const uint8_t *src, uint32_t len) {
   42|  2.95k|    struct inflate_state *state = (struct inflate_state*)strm->state;
   43|  2.95k|#ifdef GUNZIP
   44|  2.95k|    if (state->flags) {
  ------------------
  |  Branch (44:9): [True: 0, False: 2.95k]
  ------------------
   45|      0|        strm->adler = state->check = FUNCTABLE_CALL(crc32)(state->check, src, len);
  ------------------
  |  |   45|      0|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
   46|      0|    } else
   47|  2.95k|#endif
   48|  2.95k|    {
   49|  2.95k|        strm->adler = state->check = FUNCTABLE_CALL(adler32)(state->check, src, len);
  ------------------
  |  |   45|  2.95k|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
   50|  2.95k|    }
   51|  2.95k|}
inflate.c:updatewindow:
  326|  4.60k|static void updatewindow(PREFIX3(stream) *strm, const uint8_t *end, uint32_t len, int32_t cksum) {
  327|  4.60k|    struct inflate_state *state;
  328|  4.60k|    uint32_t dist;
  329|       |
  330|  4.60k|    state = (struct inflate_state *)strm->state;
  331|       |
  332|       |    /* if window not in use yet, initialize */
  333|  4.60k|    if (state->wsize == 0)
  ------------------
  |  Branch (333:9): [True: 1.53k, False: 3.07k]
  ------------------
  334|  1.53k|        state->wsize = 1U << state->wbits;
  335|       |
  336|       |    /* len state->wsize or less output bytes into the circular window */
  337|  4.60k|    if (len >= state->wsize) {
  ------------------
  |  Branch (337:9): [True: 1.41k, False: 3.19k]
  ------------------
  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|  1.41k|        if (INFLATE_NEED_CHECKSUM(strm) && cksum) {
  ------------------
  |  |   34|  2.83k|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (34:39): [True: 1.41k, Folded]
  |  |  ------------------
  ------------------
  |  Branch (340:44): [True: 1.41k, False: 0]
  ------------------
  341|       |            /* We have to split the checksum over non-copied and copied bytes */
  342|  1.41k|            if (len > state->wsize)
  ------------------
  |  Branch (342:17): [True: 1.41k, False: 0]
  ------------------
  343|  1.41k|                inf_chksum(strm, end - len, len - state->wsize);
  344|  1.41k|            inf_chksum_cpy(strm, state->window, end - state->wsize, state->wsize);
  345|  1.41k|        } else {
  346|      0|            memcpy(state->window, end - state->wsize, state->wsize);
  347|      0|        }
  348|       |
  349|  1.41k|        state->wnext = 0;
  350|  1.41k|        state->whave = state->wsize;
  351|  3.19k|    } else {
  352|  3.19k|        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|  3.19k|        dist = MIN(dist, len);
  ------------------
  |  |  144|  3.19k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 3.01k, False: 173]
  |  |  ------------------
  ------------------
  356|  3.19k|        if (INFLATE_NEED_CHECKSUM(strm) && cksum) {
  ------------------
  |  |   34|  6.38k|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (34:39): [True: 3.19k, Folded]
  |  |  ------------------
  ------------------
  |  Branch (356:44): [True: 3.19k, False: 0]
  ------------------
  357|  3.19k|            inf_chksum_cpy(strm, state->window + state->wnext, end - len, dist);
  358|  3.19k|        } else {
  359|      0|            memcpy(state->window + state->wnext, end - len, dist);
  360|      0|        }
  361|  3.19k|        len -= dist;
  362|  3.19k|        if (len) {
  ------------------
  |  Branch (362:13): [True: 172, False: 3.01k]
  ------------------
  363|    172|            if (INFLATE_NEED_CHECKSUM(strm) && cksum) {
  ------------------
  |  |   34|    344|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (34:39): [True: 172, Folded]
  |  |  ------------------
  ------------------
  |  Branch (363:48): [True: 172, False: 0]
  ------------------
  364|    172|                inf_chksum_cpy(strm, state->window, end - len, len);
  365|    172|            } else {
  366|      0|                memcpy(state->window, end - len, len);
  367|      0|            }
  368|       |
  369|    172|            state->wnext = len;
  370|    172|            state->whave = state->wsize;
  371|  3.01k|        } else {
  372|  3.01k|            state->wnext += dist;
  373|  3.01k|            if (state->wnext == state->wsize)
  ------------------
  |  Branch (373:17): [True: 1, False: 3.01k]
  ------------------
  374|      1|                state->wnext = 0;
  375|  3.01k|            if (state->whave < state->wsize)
  ------------------
  |  Branch (375:17): [True: 2.13k, False: 882]
  ------------------
  376|  2.13k|                state->whave += dist;
  377|  3.01k|        }
  378|  3.19k|    }
  379|  4.60k|}
inflate.c:inf_chksum_cpy:
   28|  4.78k|                           const uint8_t *src, uint32_t copy) {
   29|  4.78k|    if (!copy) return;
  ------------------
  |  Branch (29:9): [True: 1.53k, False: 3.24k]
  ------------------
   30|  3.24k|    struct inflate_state *state = (struct inflate_state*)strm->state;
   31|  3.24k|#ifdef GUNZIP
   32|  3.24k|    if (state->flags) {
  ------------------
  |  Branch (32:9): [True: 0, False: 3.24k]
  ------------------
   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|  3.24k|#endif
   36|  3.24k|    {
   37|  3.24k|        strm->adler = state->check = FUNCTABLE_CALL(adler32_copy)(state->check, dst, src, copy);
  ------------------
  |  |   45|  3.24k|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
   38|  3.24k|    }
   39|  3.24k|}

inflate.c:chunkcopy_safe:
  206|  1.53k|static inline uint8_t* chunkcopy_safe(uint8_t *out, uint8_t *from, size_t len, uint8_t *safe) {
  207|  1.53k|    size_t safelen = safe - out;
  208|  1.53k|    len = MIN(len, safelen);
  ------------------
  |  |  144|  1.53k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 1.53k]
  |  |  ------------------
  ------------------
  209|  1.53k|    int32_t olap_src = from >= out && from < out + len;
  ------------------
  |  Branch (209:24): [True: 1.46k, False: 69]
  |  Branch (209:39): [True: 0, False: 1.46k]
  ------------------
  210|  1.53k|    int32_t olap_dst = out >= from && out < from + len;
  ------------------
  |  Branch (210:24): [True: 69, False: 1.46k]
  |  Branch (210:39): [True: 0, False: 69]
  ------------------
  211|  1.53k|    size_t tocopy;
  212|       |
  213|       |    /* For all cases without overlap, memcpy is ideal */
  214|  1.53k|    if (!(olap_src || olap_dst)) {
  ------------------
  |  Branch (214:11): [True: 0, False: 1.53k]
  |  Branch (214:23): [True: 0, False: 1.53k]
  ------------------
  215|  1.53k|        memcpy(out, from, len);
  216|  1.53k|        return out + len;
  217|  1.53k|    }
  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|}
chunkset_avx2.c:load_64_bits:
  200|  1.70M|static inline uint64_t load_64_bits(const unsigned char *in, unsigned bits) {
  201|  1.70M|    uint64_t chunk = zng_memread_8(in);
  202|  1.70M|    return Z_U64_FROM_LE(chunk) << bits;
  ------------------
  |  |   66|  1.70M|#  define Z_U64_FROM_LE(x)  (x)
  ------------------
  203|  1.70M|}
chunkset_avx2.c:chunkcopy_safe:
  206|  1.43k|static inline uint8_t* chunkcopy_safe(uint8_t *out, uint8_t *from, size_t len, uint8_t *safe) {
  207|  1.43k|    size_t safelen = safe - out;
  208|  1.43k|    len = MIN(len, safelen);
  ------------------
  |  |  144|  1.43k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 1.43k]
  |  |  ------------------
  ------------------
  209|  1.43k|    int32_t olap_src = from >= out && from < out + len;
  ------------------
  |  Branch (209:24): [True: 0, False: 1.43k]
  |  Branch (209:39): [True: 0, False: 0]
  ------------------
  210|  1.43k|    int32_t olap_dst = out >= from && out < from + len;
  ------------------
  |  Branch (210:24): [True: 1.43k, False: 0]
  |  Branch (210:39): [True: 1.43k, False: 0]
  ------------------
  211|  1.43k|    size_t tocopy;
  212|       |
  213|       |    /* For all cases without overlap, memcpy is ideal */
  214|  1.43k|    if (!(olap_src || olap_dst)) {
  ------------------
  |  Branch (214:11): [True: 0, False: 1.43k]
  |  Branch (214:23): [True: 1.43k, False: 0]
  ------------------
  215|      0|        memcpy(out, from, len);
  216|      0|        return out + len;
  217|      0|    }
  218|       |
  219|       |    /* Complete overlap: Source == destination */
  220|  1.43k|    if (out == from) {
  ------------------
  |  Branch (220:9): [True: 0, False: 1.43k]
  ------------------
  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|  1.43k|    size_t non_olap_size = (size_t)ABS(from - out);
  ------------------
  |  |  148|  1.43k|#define ABS(a) ((a) < 0 ? -(a) : (a))
  |  |  ------------------
  |  |  |  Branch (148:17): [True: 1.43k, 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|   173k|    while (len) {
  ------------------
  |  Branch (236:12): [True: 171k, False: 1.43k]
  ------------------
  237|   171k|        tocopy = MIN(non_olap_size, len);
  ------------------
  |  |  144|   171k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 0, False: 171k]
  |  |  ------------------
  ------------------
  238|   171k|        len -= tocopy;
  239|       |
  240|   171k|        while (tocopy >= 16) {
  ------------------
  |  Branch (240:16): [True: 0, False: 171k]
  ------------------
  241|      0|            memcpy(out, from, 16);
  242|      0|            out += 16;
  243|      0|            from += 16;
  244|      0|            tocopy -= 16;
  245|      0|        }
  246|       |
  247|   171k|        if (tocopy >= 8) {
  ------------------
  |  Branch (247:13): [True: 0, False: 171k]
  ------------------
  248|      0|            memcpy(out, from, 8);
  249|      0|            out += 8;
  250|      0|            from += 8;
  251|      0|            tocopy -= 8;
  252|      0|        }
  253|       |
  254|   171k|        if (tocopy >= 4) {
  ------------------
  |  Branch (254:13): [True: 0, False: 171k]
  ------------------
  255|      0|            memcpy(out, from, 4);
  256|      0|            out += 4;
  257|      0|            from += 4;
  258|      0|            tocopy -= 4;
  259|      0|        }
  260|       |
  261|   343k|        while (tocopy--) {
  ------------------
  |  Branch (261:16): [True: 171k, False: 171k]
  ------------------
  262|   171k|            *out++ = *from++;
  263|   171k|        }
  264|   171k|    }
  265|       |
  266|  1.43k|    return out;
  267|  1.43k|}

zng_inflate_table:
  145|  7.26k|                                 code * *table, unsigned *bits, uint16_t *work) {
  146|  7.26k|    unsigned len;               /* a code's length in bits */
  147|  7.26k|    unsigned sym;               /* index of code symbols */
  148|  7.26k|    unsigned min, max;          /* minimum and maximum code lengths */
  149|  7.26k|    unsigned root;              /* number of index bits for root table */
  150|  7.26k|    unsigned curr;              /* number of index bits for current table */
  151|  7.26k|    unsigned drop;              /* code bits to drop for sub-table */
  152|  7.26k|    int left;                   /* number of prefix codes available */
  153|  7.26k|    unsigned used;              /* code entries in table used */
  154|  7.26k|    uint16_t rhuff;             /* Reversed huffman code */
  155|  7.26k|    unsigned huff;              /* Huffman code */
  156|  7.26k|    unsigned incr;              /* for incrementing code, index */
  157|  7.26k|    unsigned fill;              /* index for replicating entries */
  158|  7.26k|    unsigned low;               /* low bits for current root entry */
  159|  7.26k|    unsigned mask;              /* mask for low root bits */
  160|  7.26k|    code here;                  /* table entry for duplication */
  161|  7.26k|    code *next;                 /* next available space in table */
  162|  7.26k|    const uint16_t *base;       /* base value table to use */
  163|  7.26k|    const uint16_t *extra;      /* extra bits table to use */
  164|  7.26k|    unsigned match;             /* use base and extra for symbol >= match */
  165|  7.26k|    uint16_t ALIGNED_(16) count[MAX_BITS+1]; /* number of codes of each length */
  166|  7.26k|    uint16_t offs[MAX_BITS+1];  /* offsets in table for each length */
  167|  7.26k|    static const uint16_t lbase[31] = { /* Length codes 257..285 base */
  168|  7.26k|        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
  169|  7.26k|        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
  170|  7.26k|    static const uint16_t lext[31] = { /* Length codes 257..285 extra */
  171|  7.26k|        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
  172|  7.26k|        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77};
  173|  7.26k|    static const uint16_t dbase[32] = { /* Distance codes 0..29 base */
  174|  7.26k|        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
  175|  7.26k|        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
  176|  7.26k|        8193, 12289, 16385, 24577, 0, 0};
  177|  7.26k|    static const uint16_t dext[32] = { /* Distance codes 0..29 extra */
  178|  7.26k|        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
  179|  7.26k|        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
  180|  7.26k|        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|  7.26k|    count_lengths(lens, codes, count);
  215|       |
  216|       |    /* bound code lengths, force root to be within code lengths */
  217|  7.26k|    root = *bits;
  218|   101k|    for (max = MAX_BITS; max >= 1; max--)
  ------------------
  |  |   39|  7.26k|#define MAX_BITS 15
  ------------------
  |  Branch (218:26): [True: 101k, False: 0]
  ------------------
  219|   101k|        if (count[max] != 0) break;
  ------------------
  |  Branch (219:13): [True: 7.26k, False: 94.1k]
  ------------------
  220|  7.26k|    root = MIN(root, max);
  ------------------
  |  |  144|  7.26k|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (144:20): [True: 7.26k, False: 0]
  |  |  ------------------
  ------------------
  221|  7.26k|    if (UNLIKELY(max == 0)) {           /* no symbols to code at all */
  ------------------
  |  |  254|  7.26k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 7.26k]
  |  |  ------------------
  ------------------
  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|  8.32k|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (230:19): [True: 5.64k, False: 2.68k]
  ------------------
  231|  5.64k|        if (count[min] != 0) break;
  ------------------
  |  Branch (231:13): [True: 4.58k, False: 1.05k]
  ------------------
  232|  7.26k|    root = MAX(root, min);
  ------------------
  |  |  146|  7.26k|#define MAX(a, b) ((a) < (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (146:20): [True: 0, False: 7.26k]
  |  |  ------------------
  ------------------
  233|       |
  234|       |    /* check for an over-subscribed or incomplete set of lengths */
  235|  7.26k|    left = 1;
  236|   116k|    for (len = 1; len <= MAX_BITS; len++) {
  ------------------
  |  |   39|   116k|#define MAX_BITS 15
  ------------------
  |  Branch (236:19): [True: 109k, False: 7.26k]
  ------------------
  237|   109k|        left <<= 1;
  238|   109k|        left -= count[len];
  239|   109k|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (239:13): [True: 0, False: 109k]
  ------------------
  240|   109k|    }
  241|  7.26k|    if (left > 0 && (type == CODES || max != 1))
  ------------------
  |  Branch (241:9): [True: 0, False: 7.26k]
  |  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|  7.26k|    offs[1] = 0;
  246|   109k|    for (len = 1; len < MAX_BITS; len++)
  ------------------
  |  |   39|   109k|#define MAX_BITS 15
  ------------------
  |  Branch (246:19): [True: 101k, False: 7.26k]
  ------------------
  247|   101k|        offs[len + 1] = offs[len] + count[len];
  248|       |
  249|       |    /* sort symbols by length, by symbol order within each length */
  250|   768k|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (250:19): [True: 761k, False: 7.26k]
  ------------------
  251|   761k|        if (lens[sym] != 0) work[offs[lens[sym]]++] = (uint16_t)sym;
  ------------------
  |  Branch (251:13): [True: 23.1k, False: 738k]
  ------------------
  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|  7.26k|    switch (type) {
  286|  2.42k|    case CODES:
  ------------------
  |  Branch (286:5): [True: 2.42k, False: 4.84k]
  ------------------
  287|  2.42k|        base = extra = work;    /* dummy value--not used */
  288|  2.42k|        match = 20;
  289|  2.42k|        break;
  290|  2.42k|    case LENS:
  ------------------
  |  Branch (290:5): [True: 2.42k, False: 4.84k]
  ------------------
  291|  2.42k|        base = lbase;
  292|  2.42k|        extra = lext;
  293|  2.42k|        match = 257;
  294|  2.42k|        break;
  295|  2.42k|    default:    /* DISTS */
  ------------------
  |  Branch (295:5): [True: 2.42k, False: 4.84k]
  ------------------
  296|  2.42k|        base = dbase;
  297|  2.42k|        extra = dext;
  298|  2.42k|        match = 0;
  299|  7.26k|    }
  300|       |
  301|       |    /* initialize state for loop */
  302|  7.26k|    rhuff = 0;                  /* starting code, reversed */
  303|  7.26k|    huff = 0;                   /* starting code */
  304|  7.26k|    sym = 0;                    /* starting code symbol */
  305|  7.26k|    len = min;                  /* starting code length */
  306|  7.26k|    next = *table;              /* current table to fill in */
  307|  7.26k|    curr = root;                /* current table index bits */
  308|  7.26k|    drop = 0;                   /* current bits to drop from code for index */
  309|  7.26k|    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
  310|  7.26k|    used = 1U << root;          /* use root table entries */
  311|  7.26k|    mask = used - 1;            /* mask for comparing low */
  312|       |
  313|       |    /* check available table space */
  314|  7.26k|    if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   52|  2.42k|#define ENOUGH_LENS 1332
  ------------------
  |  Branch (314:10): [True: 2.42k, False: 4.84k]
  |  Branch (314:26): [True: 0, False: 2.42k]
  ------------------
  315|  7.26k|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   53|  2.42k|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (315:10): [True: 2.42k, False: 4.84k]
  |  Branch (315:27): [True: 0, False: 2.42k]
  ------------------
  316|      0|        return 1;
  317|       |
  318|       |    /* process all codes and make table entries */
  319|  23.1k|    for (;;) {
  320|       |        /* create table entry */
  321|  23.1k|        here.bits = (unsigned char)(len - drop);
  322|  23.1k|        if (LIKELY(work[sym] >= match)) {
  ------------------
  |  |  253|  23.1k|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 9.42k, False: 13.7k]
  |  |  ------------------
  ------------------
  323|  9.42k|            unsigned op = extra[work[sym] - match];
  324|  9.42k|            here.op = COMBINE_OP(op, here.bits);
  ------------------
  |  |  174|  9.42k|    ((unsigned char)((extra) & 16 ? (code_bits) | 16 : (extra)))
  |  |  ------------------
  |  |  |  Branch (174:22): [True: 9.42k, False: 0]
  |  |  ------------------
  ------------------
  325|  9.42k|            here.bits = COMBINE_BITS(here.bits, op);
  ------------------
  |  |  178|  9.42k|    ((unsigned char)((code_bits) + ((extra) & 15)))
  ------------------
  326|  9.42k|            here.val = base[work[sym] - match];
  327|  13.7k|        } else if (work[sym] + 1U < match) {
  ------------------
  |  Branch (327:20): [True: 11.3k, False: 2.42k]
  ------------------
  328|  11.3k|            here.op = (unsigned char)0;
  329|  11.3k|            here.val = work[sym];
  330|  11.3k|        } else {
  331|  2.42k|            here.op = (unsigned char)(32 + 64);         /* end of block */
  332|  2.42k|            here.val = 0;
  333|  2.42k|        }
  334|       |
  335|       |        /* replicate for those indices with low len bits equal to huff */
  336|  23.1k|        incr = 1U << (len - drop);
  337|  23.1k|        fill = 1U << curr;
  338|  23.1k|        min = fill;                 /* save offset to next table */
  339|  35.2k|        do {
  340|  35.2k|            fill -= incr;
  341|  35.2k|            next[(huff >> drop) + fill] = here;
  342|  35.2k|        } while (fill != 0);
  ------------------
  |  Branch (342:18): [True: 12.0k, False: 23.1k]
  ------------------
  343|       |
  344|       |        /* backwards increment the len-bit code huff */
  345|  23.1k|        rhuff = (uint16_t)(rhuff + (0x8000u >> (len - 1)));
  346|  23.1k|        huff = zng_bitreverse16(rhuff);
  347|       |
  348|       |        /* go to next symbol, update count, len */
  349|  23.1k|        sym++;
  350|  23.1k|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (350:13): [True: 13.8k, False: 9.37k]
  ------------------
  351|  13.8k|            if (len == max)
  ------------------
  |  Branch (351:17): [True: 7.26k, False: 6.54k]
  ------------------
  352|  7.26k|                break;
  353|  6.54k|            len = lens[work[sym]];
  354|  6.54k|        }
  355|       |
  356|       |        /* create new sub-table if needed */
  357|  15.9k|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (357:13): [True: 0, False: 15.9k]
  |  Branch (357:27): [True: 0, False: 0]
  ------------------
  358|       |            /* if first time, transition to sub-tables */
  359|      0|            if (drop == 0)
  ------------------
  |  Branch (359:17): [True: 0, False: 0]
  ------------------
  360|      0|                drop = root;
  361|       |
  362|       |            /* increment past last table */
  363|      0|            next += min;            /* here min is 1 << curr */
  364|       |
  365|       |            /* determine length of next table */
  366|      0|            curr = len - drop;
  367|      0|            left = (int)(1 << curr);
  368|      0|            while (curr + drop < max) {
  ------------------
  |  Branch (368:20): [True: 0, False: 0]
  ------------------
  369|      0|                left -= count[curr + drop];
  370|      0|                if (left <= 0)
  ------------------
  |  Branch (370:21): [True: 0, False: 0]
  ------------------
  371|      0|                    break;
  372|      0|                curr++;
  373|      0|                left <<= 1;
  374|      0|            }
  375|       |
  376|       |            /* check for enough space */
  377|      0|            used += 1U << curr;
  378|      0|            if ((type == LENS && used > ENOUGH_LENS) || (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   52|      0|#define ENOUGH_LENS 1332
  ------------------
                          if ((type == LENS && used > ENOUGH_LENS) || (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   53|      0|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (378:18): [True: 0, False: 0]
  |  Branch (378:34): [True: 0, False: 0]
  |  Branch (378:58): [True: 0, False: 0]
  |  Branch (378:75): [True: 0, False: 0]
  ------------------
  379|      0|                return 1;
  380|       |
  381|       |            /* point entry in root table to sub-table */
  382|      0|            low = huff & mask;
  383|      0|            (*table)[low].op = (unsigned char)curr;
  384|      0|            (*table)[low].bits = (unsigned char)root;
  385|      0|            (*table)[low].val = (uint16_t)(next - *table);
  386|      0|        }
  387|  15.9k|    }
  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|  7.26k|    if (UNLIKELY(huff != 0)) {
  ------------------
  |  |  254|  7.26k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 7.26k]
  |  |  ------------------
  ------------------
  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|  7.26k|    *table += used;
  401|  7.26k|    *bits = root;
  402|  7.26k|    return 0;
  403|  7.26k|}
inftrees.c:count_lengths:
   29|  7.26k|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|  7.26k|    static const ALIGNED_(16) uint8_t one[256] = {
   33|  7.26k|        1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   34|  7.26k|        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   35|  7.26k|        0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   36|  7.26k|        0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   37|  7.26k|        0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   38|  7.26k|        0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   39|  7.26k|        0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   40|  7.26k|        0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
   41|  7.26k|        0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
   42|  7.26k|        0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
   43|  7.26k|        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
   44|  7.26k|        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
   45|  7.26k|        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
   46|  7.26k|        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
   47|  7.26k|        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
   48|  7.26k|        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
   49|  7.26k|    };
   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|  7.26k|    __m128i s1 = _mm_setzero_si128();
   93|  7.26k|    __m128i s2 = _mm_setzero_si128();
   94|       |
   95|  7.26k|    if (codes & 1) {
  ------------------
  |  Branch (95:9): [True: 3.48k, False: 3.78k]
  ------------------
   96|  3.48k|        s1 = _mm_load_si128((const __m128i*)&one[16 * lens[0]]);
   97|  3.48k|    }
   98|   386k|    for (sym = codes & 1; sym < codes; sym += 2) {
  ------------------
  |  Branch (98:27): [True: 379k, False: 7.26k]
  ------------------
   99|   379k|        s1 = _mm_add_epi8(s1, _mm_load_si128((const __m128i*)&one[16 * lens[sym]]));  // vaddq_u8
  100|   379k|        s2 = _mm_add_epi8(s2, _mm_load_si128((const __m128i*)&one[16 * lens[sym+1]]));
  101|   379k|    }
  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|  7.26k|    __m128i zero = _mm_setzero_si128();
  111|       |
  112|  7.26k|    __m128i s1_lo = _mm_unpacklo_epi8(s1, zero);
  113|  7.26k|    __m128i s2_lo = _mm_unpacklo_epi8(s2, zero);
  114|  7.26k|    __m128i sum_lo = _mm_add_epi16(s1_lo, s2_lo);
  115|  7.26k|    _mm_storeu_si128((__m128i*)&count[0], sum_lo);
  116|       |
  117|  7.26k|    __m128i s1_hi = _mm_unpackhi_epi8(s1, zero);
  118|  7.26k|    __m128i s2_hi = _mm_unpackhi_epi8(s2, zero);
  119|  7.26k|    __m128i sum_hi = _mm_add_epi16(s1_hi, s2_hi);
  120|  7.26k|    _mm_storeu_si128((__m128i*)&count[8], sum_hi);
  121|  7.26k|#  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|  7.26k|}

insert_string_roll:
   16|  1.70M|Z_INTERNAL void insert_string_roll(deflate_state *const s, unsigned char *window, uint32_t str, uint32_t count) {
   17|  1.70M|    insert_string_roll_static(s, window, str, count);
   18|  1.70M|}

deflate.c:update_hash_roll:
   32|  14.9k|Z_FORCEINLINE static uint32_t UPDATE_HASH(uint32_t h, uint32_t val) {
   33|  14.9k|    HASH_CALC(h, val);
  ------------------
  |  |   30|  14.9k|#define HASH_CALC(h, val)    h = ((h << HASH_SLIDE) ^ ((uint8_t)val))
  |  |  ------------------
  |  |  |  |   28|  14.9k|#define HASH_SLIDE           5
  |  |  ------------------
  ------------------
   34|  14.9k|    return h & HASH_CALC_MASK;
  ------------------
  |  |   34|  14.9k|#define HASH_CALC_MASK       (32768u - 1u)
  ------------------
   35|  14.9k|}
deflate_slow.c:quick_insert_string_roll:
   63|  3.41M|Z_FORCEINLINE static uint32_t QUICK_INSERT_STRING(deflate_state *const s, unsigned char *window, uint32_t str) {
   64|  3.41M|    uint8_t *strstart = window + str + HASH_CALC_OFFSET;
  ------------------
  |  |   35|  3.41M|#define HASH_CALC_OFFSET     (STD_MIN_MATCH-1)
  |  |  ------------------
  |  |  |  |   56|  3.41M|#define STD_MIN_MATCH  3
  |  |  ------------------
  ------------------
   65|  3.41M|    uint32_t val, hm, head;
   66|       |
   67|  3.41M|    HASH_CALC_VAR_INIT;
   68|  3.41M|    HASH_CALC_READ;
  ------------------
  |  |   33|  3.41M|#define HASH_CALC_READ       val = strstart[0]
  ------------------
   69|  3.41M|    HASH_CALC(HASH_CALC_VAR, val);
  ------------------
  |  |   30|  3.41M|#define HASH_CALC(h, val)    h = ((h << HASH_SLIDE) ^ ((uint8_t)val))
  |  |  ------------------
  |  |  |  |   28|  3.41M|#define HASH_SLIDE           5
  |  |  ------------------
  ------------------
   70|  3.41M|    HASH_CALC_VAR &= HASH_CALC_MASK;
  ------------------
  |  |   31|  3.41M|#define HASH_CALC_VAR        s->ins_h
  ------------------
                  HASH_CALC_VAR &= HASH_CALC_MASK;
  ------------------
  |  |   34|  3.41M|#define HASH_CALC_MASK       (32768u - 1u)
  ------------------
   71|  3.41M|    hm = HASH_CALC_VAR;
  ------------------
  |  |   31|  3.41M|#define HASH_CALC_VAR        s->ins_h
  ------------------
   72|       |
   73|  3.41M|    head = s->head[hm];
   74|  3.41M|    if (LIKELY(head != str)) {
  ------------------
  |  |  253|  3.41M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 3.41M, False: 1.53k]
  |  |  ------------------
  ------------------
   75|  3.41M|        s->prev[str & W_MASK(s)] = (Pos)head;
  ------------------
  |  |  390|  3.41M|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
   76|  3.41M|        s->head[hm] = (Pos)str;
   77|  3.41M|    }
   78|  3.41M|    return head;
   79|  3.41M|}
insert_string.c:insert_string_roll_static:
   89|  1.70M|Z_FORCEINLINE static void INSERT_STRING(deflate_state *const s, unsigned char *window, uint32_t str, uint32_t count) {
   90|  1.70M|    uint8_t *strstart = window + str + HASH_CALC_OFFSET;
  ------------------
  |  |   35|  1.70M|#define HASH_CALC_OFFSET     (STD_MIN_MATCH-1)
  |  |  ------------------
  |  |  |  |   56|  1.70M|#define STD_MIN_MATCH  3
  |  |  ------------------
  ------------------
   91|  1.70M|    uint8_t *strend = strstart + count;
   92|       |
   93|       |    /* Local pointers to avoid indirection */
   94|  1.70M|    Pos *headp = s->head;
   95|  1.70M|    Pos *prevp = s->prev;
   96|  1.70M|    const unsigned int w_mask = W_MASK(s);
  ------------------
  |  |  390|  1.70M|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
   97|       |
   98|   438M|    for (uint32_t idx = str; strstart < strend; idx++, strstart++) {
  ------------------
  |  Branch (98:30): [True: 436M, False: 1.70M]
  ------------------
   99|   436M|        uint32_t val, hm, head;
  100|       |
  101|   436M|        HASH_CALC_VAR_INIT;
  102|   436M|        HASH_CALC_READ;
  ------------------
  |  |   33|   436M|#define HASH_CALC_READ       val = strstart[0]
  ------------------
  103|   436M|        HASH_CALC(HASH_CALC_VAR, val);
  ------------------
  |  |   30|   436M|#define HASH_CALC(h, val)    h = ((h << HASH_SLIDE) ^ ((uint8_t)val))
  |  |  ------------------
  |  |  |  |   28|   436M|#define HASH_SLIDE           5
  |  |  ------------------
  ------------------
  104|   436M|        HASH_CALC_VAR &= HASH_CALC_MASK;
  ------------------
  |  |   31|   436M|#define HASH_CALC_VAR        s->ins_h
  ------------------
                      HASH_CALC_VAR &= HASH_CALC_MASK;
  ------------------
  |  |   34|   436M|#define HASH_CALC_MASK       (32768u - 1u)
  ------------------
  105|   436M|        hm = HASH_CALC_VAR;
  ------------------
  |  |   31|   436M|#define HASH_CALC_VAR        s->ins_h
  ------------------
  106|       |
  107|   436M|        head = headp[hm];
  108|   436M|        if (LIKELY(head != idx)) {
  ------------------
  |  |  253|   436M|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (253:33): [True: 436M, False: 0]
  |  |  ------------------
  ------------------
  109|   436M|            prevp[idx & w_mask] = (Pos)head;
  110|   436M|            headp[hm] = (Pos)idx;
  111|   436M|        }
  112|   436M|    }
  113|  1.70M|}
compare256_avx2.c:update_hash_roll:
   32|  1.02M|Z_FORCEINLINE static uint32_t UPDATE_HASH(uint32_t h, uint32_t val) {
   33|  1.02M|    HASH_CALC(h, val);
  ------------------
  |  |   30|  1.02M|#define HASH_CALC(h, val)    h = ((h << HASH_SLIDE) ^ ((uint8_t)val))
  |  |  ------------------
  |  |  |  |   28|  1.02M|#define HASH_SLIDE           5
  |  |  ------------------
  ------------------
   34|  1.02M|    return h & HASH_CALC_MASK;
  ------------------
  |  |   34|  1.02M|#define HASH_CALC_MASK       (32768u - 1u)
  ------------------
   35|  1.02M|}

longest_match_roll_avx2:
   28|  1.71M|Z_INTERNAL uint32_t LONGEST_MATCH(deflate_state *const s, uint32_t cur_match) {
   29|  1.71M|    const unsigned wmask = W_MASK(s);
  ------------------
  |  |  390|  1.71M|#define W_MASK(s)  ((s)->w_size - 1)
  ------------------
   30|  1.71M|    unsigned int strstart = s->strstart;
   31|  1.71M|    const unsigned char *window = s->window;
   32|  1.71M|    const Pos *prev = s->prev;
   33|  1.71M|#ifdef LONGEST_MATCH_ROLL
   34|  1.71M|    const Pos *head = s->head;
   35|  1.71M|#endif
   36|  1.71M|    const unsigned char *scan;
   37|  1.71M|    const unsigned char *mbase_start = window;
   38|  1.71M|    const unsigned char *mbase_end;
   39|  1.71M|    uint32_t limit;
   40|  1.71M|#ifdef LONGEST_MATCH_ROLL
   41|  1.71M|    uint32_t limit_base;
   42|       |#else
   43|       |    int32_t early_exit;
   44|       |#endif
   45|  1.71M|    uint32_t chain_length = s->max_chain_length;
   46|  1.71M|    uint32_t nice_match = (uint32_t)s->nice_match;
   47|  1.71M|    uint32_t best_len, offset;
   48|  1.71M|    uint32_t lookahead = s->lookahead;
   49|  1.71M|    uint32_t match_offset = 0;
   50|  1.71M|    uint64_t scan_start;
   51|  1.71M|    uint64_t scan_end;
   52|       |
   53|       |    /* The code is optimized for STD_MAX_MATCH-2 multiple of 16. */
   54|  1.71M|    Assert(STD_MAX_MATCH == 258, "Code too clever");
   55|       |
   56|  1.71M|    best_len = s->prev_length ? s->prev_length : STD_MIN_MATCH-1;
  ------------------
  |  |   56|  1.70M|#define STD_MIN_MATCH  3
  ------------------
  |  Branch (56:16): [True: 4.43k, False: 1.70M]
  ------------------
   57|  1.71M|    if (best_len >= lookahead)
  ------------------
  |  Branch (57:9): [True: 2.77k, False: 1.70M]
  ------------------
   58|  2.77k|        return lookahead;
   59|       |
   60|       |    /* Calculate read offset which should only extend an extra byte
   61|       |     * to find the next best match length.
   62|       |     */
   63|  1.70M|    offset = best_len-1;
   64|  1.70M|    if (best_len >= sizeof(uint32_t)) {
  ------------------
  |  Branch (64:9): [True: 0, False: 1.70M]
  ------------------
   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|  1.70M|    scan = window + strstart;
   71|  1.70M|    scan_start = zng_memread_8(scan);
   72|  1.70M|    scan_end = zng_memread_8(scan+offset);
   73|  1.70M|    mbase_end  = (mbase_start+offset);
   74|       |
   75|       |    /* Do not waste too much time if we already have a good match */
   76|  1.70M|    if (best_len >= s->good_match)
  ------------------
  |  Branch (76:9): [True: 0, False: 1.70M]
  ------------------
   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|  1.70M|    limit = strstart > MAX_DIST(s) ? (strstart - MAX_DIST(s)) : 0;
  ------------------
  |  |  385|  1.70M|#define MAX_DIST(s)  ((s)->w_size - MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  380|  1.70M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   57|  1.70M|#define STD_MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|  1.70M|#define STD_MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  limit = strstart > MAX_DIST(s) ? (strstart - MAX_DIST(s)) : 0;
  ------------------
  |  |  385|  1.57M|#define MAX_DIST(s)  ((s)->w_size - MIN_LOOKAHEAD)
  |  |  ------------------
  |  |  |  |  380|  1.57M|#define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   57|  1.57M|#define STD_MAX_MATCH  258
  |  |  |  |  ------------------
  |  |  |  |               #define MIN_LOOKAHEAD (STD_MAX_MATCH + STD_MIN_MATCH + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   56|  1.57M|#define STD_MIN_MATCH  3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (82:13): [True: 1.57M, False: 134k]
  ------------------
   83|  1.70M|#ifdef LONGEST_MATCH_ROLL
   84|  1.70M|    limit_base = limit;
   85|  1.70M|    if (best_len >= STD_MIN_MATCH) {
  ------------------
  |  |   56|  1.70M|#define STD_MIN_MATCH  3
  ------------------
  |  Branch (85:9): [True: 0, False: 1.70M]
  ------------------
   86|       |        /* We're continuing search (lazy evaluation). */
   87|      0|        uint32_t hash;
   88|      0|        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|      0|        hash = update_hash_roll(0, scan[1]);
   96|      0|        hash = update_hash_roll(hash, scan[2]);
   97|       |
   98|      0|        for (uint32_t i = 3; i <= best_len; i++) {
  ------------------
  |  Branch (98:30): [True: 0, False: 0]
  ------------------
   99|       |            // use update_hash_roll for deflate_slow
  100|      0|            hash = update_hash_roll(hash, scan[i]);
  101|       |            /* If we're starting with best_len >= 3, we can use offset search. */
  102|      0|            pos = head[hash];
  103|      0|            if (pos < cur_match) {
  ------------------
  |  Branch (103:17): [True: 0, False: 0]
  ------------------
  104|      0|                match_offset = i - 2;
  105|      0|                cur_match = pos;
  106|      0|            }
  107|      0|        }
  108|       |
  109|       |        /* Update offset-dependent variables */
  110|      0|        limit = limit_base+match_offset;
  111|      0|        if (cur_match <= limit)
  ------------------
  |  Branch (111:13): [True: 0, False: 0]
  ------------------
  112|      0|            return best_len;
  113|      0|        mbase_start -= match_offset;
  114|      0|        mbase_end -= match_offset;
  115|      0|    }
  116|       |#else
  117|       |    early_exit = s->level < EARLY_EXIT_TRIGGER_LEVEL;
  118|       |#endif
  119|  1.70M|    Assert((unsigned long)strstart <= s->window_size - MIN_LOOKAHEAD, "need lookahead");
  120|  2.08M|    for (;;) {
  121|  2.08M|        if (cur_match >= strstart)
  ------------------
  |  Branch (121:13): [True: 0, False: 2.08M]
  ------------------
  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|  2.08M|        if (best_len < sizeof(uint32_t)) {
  ------------------
  |  Branch (131:13): [True: 1.70M, False: 372k]
  ------------------
  132|  1.70M|            for (;;) {
  133|  1.70M|                if (zng_memcmp_2(mbase_end+cur_match, &scan_end) == 0 &&
  ------------------
  |  Branch (133:21): [True: 1.70M, False: 230]
  ------------------
  134|  1.70M|                    zng_memcmp_2(mbase_start+cur_match, &scan_start) == 0)
  ------------------
  |  Branch (134:21): [True: 1.70M, False: 183]
  ------------------
  135|  1.70M|                    break;
  136|    413|                GOTO_NEXT_CHAIN;
  ------------------
  |  |   16|    413|    if (--chain_length && (cur_match = prev[cur_match & wmask]) > limit) \
  |  |  ------------------
  |  |  |  Branch (16:9): [True: 413, False: 0]
  |  |  |  Branch (16:27): [True: 413, False: 0]
  |  |  ------------------
  |  |   17|    413|        continue; \
  |  |   18|      0|    return best_len;
  ------------------
  137|    413|            }
  138|  1.70M|        } else if (best_len >= sizeof(uint64_t)) {
  ------------------
  |  Branch (138:20): [True: 366k, False: 5.37k]
  ------------------
  139|   387k|            for (;;) {
  140|   387k|                if (zng_memcmp_8(mbase_end+cur_match, &scan_end) == 0 &&
  ------------------
  |  Branch (140:21): [True: 370k, False: 16.3k]
  ------------------
  141|   370k|                    zng_memcmp_8(mbase_start+cur_match, &scan_start) == 0)
  ------------------
  |  Branch (141:21): [True: 366k, False: 3.82k]
  ------------------
  142|   366k|                    break;
  143|  20.1k|                GOTO_NEXT_CHAIN;
  ------------------
  |  |   16|  20.1k|    if (--chain_length && (cur_match = prev[cur_match & wmask]) > limit) \
  |  |  ------------------
  |  |  |  Branch (16:9): [True: 20.1k, False: 0]
  |  |  |  Branch (16:27): [True: 20.1k, False: 0]
  |  |  ------------------
  |  |   17|  20.1k|        continue; \
  |  |   18|      0|    return best_len;
  ------------------
  144|  20.1k|            }
  145|   366k|        } else {
  146|  5.97k|            for (;;) {
  147|  5.97k|                if (zng_memcmp_4(mbase_end+cur_match, &scan_end) == 0 &&
  ------------------
  |  Branch (147:21): [True: 5.42k, False: 541]
  ------------------
  148|  5.42k|                    zng_memcmp_4(mbase_start+cur_match, &scan_start) == 0)
  ------------------
  |  Branch (148:21): [True: 5.37k, False: 57]
  ------------------
  149|  5.37k|                    break;
  150|    598|                GOTO_NEXT_CHAIN;
  ------------------
  |  |   16|    598|    if (--chain_length && (cur_match = prev[cur_match & wmask]) > limit) \
  |  |  ------------------
  |  |  |  Branch (16:9): [True: 598, False: 0]
  |  |  |  Branch (16:27): [True: 598, False: 0]
  |  |  ------------------
  |  |   17|    598|        continue; \
  |  |   18|      0|    return best_len;
  ------------------
  151|    598|            }
  152|  5.37k|        }
  153|  2.08M|        uint32_t len = COMPARE256(scan+2, mbase_start+cur_match+2) + 2;
  ------------------
  |  |   57|  2.08M|#define COMPARE256          compare256_avx2_static
  ------------------
  154|  2.08M|        Assert(scan+len <= window+(unsigned)(s->window_size-1), "wild scan");
  155|       |
  156|  2.08M|        if (len > best_len) {
  ------------------
  |  Branch (156:13): [True: 2.05M, False: 31.1k]
  ------------------
  157|  2.05M|            uint32_t match_start = cur_match - match_offset;
  158|  2.05M|            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.05M|            if (len >= lookahead)
  ------------------
  |  Branch (163:17): [True: 2.90k, False: 2.04M]
  ------------------
  164|  2.90k|                return lookahead;
  165|  2.04M|            if (len >= nice_match)
  ------------------
  |  Branch (165:17): [True: 1.70M, False: 342k]
  ------------------
  166|  1.70M|                return len;
  167|       |
  168|   342k|            best_len = len;
  169|       |
  170|   342k|            offset = best_len-1;
  171|   342k|            if (best_len >= sizeof(uint32_t)) {
  ------------------
  |  Branch (171:17): [True: 341k, False: 1.34k]
  ------------------
  172|   341k|                offset -= 2;
  173|   341k|                if (best_len >= sizeof(uint64_t))
  ------------------
  |  Branch (173:21): [True: 335k, False: 5.37k]
  ------------------
  174|   335k|                    offset -= 4;
  175|   341k|            }
  176|       |
  177|   342k|            scan_end = zng_memread_8(scan+offset);
  178|       |
  179|   342k|#ifdef LONGEST_MATCH_ROLL
  180|       |            /* Look for a better string offset */
  181|   342k|            if (UNLIKELY(len > STD_MIN_MATCH && match_start + len < strstart)) {
  ------------------
  |  |  254|   683k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 341k, False: 1.34k]
  |  |  |  Branch (254:53): [True: 341k, False: 1.34k]
  |  |  |  Branch (254:53): [True: 341k, False: 0]
  |  |  ------------------
  ------------------
  182|   341k|                const unsigned char *scan_endstr;
  183|   341k|                uint32_t hash;
  184|   341k|                uint32_t pos, next_pos;
  185|       |
  186|       |                /* Go back to offset 0 */
  187|   341k|                cur_match -= match_offset;
  188|   341k|                match_offset = 0;
  189|   341k|                next_pos = cur_match;
  190|  44.1M|                for (uint32_t i = 0; i <= len - STD_MIN_MATCH; i++) {
  ------------------
  |  |   56|  44.1M|#define STD_MIN_MATCH  3
  ------------------
  |  Branch (190:38): [True: 43.8M, False: 341k]
  ------------------
  191|  43.8M|                    pos = prev[(cur_match + i) & wmask];
  192|  43.8M|                    if (pos < next_pos) {
  ------------------
  |  Branch (192:25): [True: 341k, False: 43.4M]
  ------------------
  193|       |                        /* Hash chain is more distant, use it */
  194|   341k|                        if (pos <= limit_base + i)
  ------------------
  |  Branch (194:29): [True: 0, False: 341k]
  ------------------
  195|      0|                            return best_len;
  196|   341k|                        next_pos = pos;
  197|   341k|                        match_offset = i;
  198|   341k|                    }
  199|  43.8M|                }
  200|       |                /* Switch cur_match to next_pos chain */
  201|   341k|                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|   341k|                scan_endstr = scan + len - (STD_MIN_MATCH-1);
  ------------------
  |  |   56|   341k|#define STD_MIN_MATCH  3
  ------------------
  209|       |
  210|       |                // use update_hash_roll for deflate_slow
  211|   341k|                hash = update_hash_roll(0, scan_endstr[0]);
  212|   341k|                hash = update_hash_roll(hash, scan_endstr[1]);
  213|   341k|                hash = update_hash_roll(hash, scan_endstr[2]);
  214|       |
  215|   341k|                pos = head[hash];
  216|   341k|                if (pos < cur_match) {
  ------------------
  |  Branch (216:21): [True: 0, False: 341k]
  ------------------
  217|      0|                    match_offset = len - (STD_MIN_MATCH-1);
  ------------------
  |  |   56|      0|#define STD_MIN_MATCH  3
  ------------------
  218|      0|                    if (pos <= limit_base + match_offset)
  ------------------
  |  Branch (218:25): [True: 0, False: 0]
  ------------------
  219|      0|                        return best_len;
  220|      0|                    cur_match = pos;
  221|      0|                }
  222|       |
  223|       |                /* Update offset-dependent variables */
  224|   341k|                limit = limit_base+match_offset;
  225|   341k|                mbase_start = window-match_offset;
  226|   341k|                mbase_end = (mbase_start+offset);
  227|   341k|                continue;
  228|   341k|            }
  229|  1.34k|#endif
  230|  1.34k|            mbase_end = (mbase_start+offset);
  231|  1.34k|        }
  232|       |#ifndef LONGEST_MATCH_ROLL
  233|       |        else if (UNLIKELY(early_exit)) {
  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|       |            break;
  238|       |        }
  239|       |#endif
  240|  32.4k|        GOTO_NEXT_CHAIN;
  ------------------
  |  |   16|  32.4k|    if (--chain_length && (cur_match = prev[cur_match & wmask]) > limit) \
  |  |  ------------------
  |  |  |  Branch (16:9): [True: 32.4k, False: 0]
  |  |  |  Branch (16:27): [True: 32.4k, False: 0]
  |  |  ------------------
  |  |   17|  32.4k|        continue; \
  |  |   18|      0|    return best_len;
  ------------------
  241|  32.4k|    }
  242|      0|    return best_len;
  243|  1.70M|}

test_large_deflate:
   26|  1.53k|void test_large_deflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen) {
   27|  1.53k|    PREFIX3(stream) c_stream; /* compression stream */
  ------------------
  |  |  119|  1.53k|#  define PREFIX3(x) zng_ ## x
  ------------------
   28|  1.53k|    int err;
   29|       |
   30|  1.53k|    c_stream.zalloc = zalloc;
   31|  1.53k|    c_stream.zfree = zfree;
   32|  1.53k|    c_stream.opaque = (void *)0;
   33|       |
   34|  1.53k|    err = PREFIX(deflateInit)(&c_stream, Z_BEST_COMPRESSION);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
                  err = PREFIX(deflateInit)(&c_stream, Z_BEST_COMPRESSION);
  ------------------
  |  |  195|  1.53k|#define Z_BEST_COMPRESSION       9
  ------------------
   35|  1.53k|    CHECK_ERR(err, "deflateInit");
  ------------------
  |  |   10|  1.53k|#define CHECK_ERR(err, msg) { \
  |  |   11|  1.53k|    if (err != Z_OK) { \
  |  |  ------------------
  |  |  |  |  180|  3.07k|#define Z_OK            0
  |  |  ------------------
  |  |  |  Branch (11:9): [True: 0, False: 1.53k]
  |  |  ------------------
  |  |   12|      0|        fprintf(stderr, "%s error: %d\n", msg, err); \
  |  |   13|      0|        exit(1); \
  |  |   14|      0|    } \
  |  |   15|  1.53k|}
  ------------------
   36|       |
   37|  1.53k|    c_stream.next_out = compr;
   38|  1.53k|    c_stream.avail_out = (unsigned int)comprLen;
   39|       |
   40|       |    /* At this point, uncompr is still mostly zeroes, so it should compress
   41|       |     * very well:
   42|       |     */
   43|  1.53k|    c_stream.next_in = uncompr;
   44|  1.53k|    c_stream.avail_in = (unsigned int)uncomprLen;
   45|  1.53k|    err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
                  err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH);
  ------------------
  |  |  171|  1.53k|#define Z_NO_FLUSH      0
  ------------------
   46|  1.53k|    CHECK_ERR(err, "deflate large 1");
  ------------------
  |  |   10|  1.53k|#define CHECK_ERR(err, msg) { \
  |  |   11|  1.53k|    if (err != Z_OK) { \
  |  |  ------------------
  |  |  |  |  180|  3.07k|#define Z_OK            0
  |  |  ------------------
  |  |  |  Branch (11:9): [True: 0, False: 1.53k]
  |  |  ------------------
  |  |   12|      0|        fprintf(stderr, "%s error: %d\n", msg, err); \
  |  |   13|      0|        exit(1); \
  |  |   14|      0|    } \
  |  |   15|  1.53k|}
  ------------------
   47|  1.53k|    if (c_stream.avail_in != 0) {
  ------------------
  |  Branch (47:9): [True: 0, False: 1.53k]
  ------------------
   48|      0|        fprintf(stderr, "deflate not greedy\n");
   49|      0|        exit(1);
   50|      0|    }
   51|       |
   52|       |    /* Feed in already compressed data and switch to no compression: */
   53|  1.53k|    PREFIX(deflateParams)(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
                  PREFIX(deflateParams)(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY);
  ------------------
  |  |  193|  1.53k|#define Z_NO_COMPRESSION         0
  ------------------
                  PREFIX(deflateParams)(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY);
  ------------------
  |  |  203|  1.53k|#define Z_DEFAULT_STRATEGY    0
  ------------------
   54|  1.53k|    c_stream.next_in = compr;
   55|  1.53k|    diff = (unsigned int)(c_stream.next_out - compr);
   56|  1.53k|    c_stream.avail_in = diff;
   57|  1.53k|    err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
                  err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH);
  ------------------
  |  |  171|  1.53k|#define Z_NO_FLUSH      0
  ------------------
   58|  1.53k|    CHECK_ERR(err, "deflate large 2");
  ------------------
  |  |   10|  1.53k|#define CHECK_ERR(err, msg) { \
  |  |   11|  1.53k|    if (err != Z_OK) { \
  |  |  ------------------
  |  |  |  |  180|  3.07k|#define Z_OK            0
  |  |  ------------------
  |  |  |  Branch (11:9): [True: 0, False: 1.53k]
  |  |  ------------------
  |  |   12|      0|        fprintf(stderr, "%s error: %d\n", msg, err); \
  |  |   13|      0|        exit(1); \
  |  |   14|      0|    } \
  |  |   15|  1.53k|}
  ------------------
   59|       |
   60|       |    /* Switch back to compressing mode: */
   61|  1.53k|    PREFIX(deflateParams)(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
                  PREFIX(deflateParams)(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED);
  ------------------
  |  |  195|  1.53k|#define Z_BEST_COMPRESSION       9
  ------------------
                  PREFIX(deflateParams)(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED);
  ------------------
  |  |  199|  1.53k|#define Z_FILTERED            1
  ------------------
   62|  1.53k|    c_stream.next_in = uncompr;
   63|  1.53k|    c_stream.avail_in = (unsigned int)uncomprLen;
   64|  1.53k|    err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
                  err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH);
  ------------------
  |  |  171|  1.53k|#define Z_NO_FLUSH      0
  ------------------
   65|  1.53k|    CHECK_ERR(err, "deflate large 3");
  ------------------
  |  |   10|  1.53k|#define CHECK_ERR(err, msg) { \
  |  |   11|  1.53k|    if (err != Z_OK) { \
  |  |  ------------------
  |  |  |  |  180|  3.07k|#define Z_OK            0
  |  |  ------------------
  |  |  |  Branch (11:9): [True: 0, False: 1.53k]
  |  |  ------------------
  |  |   12|      0|        fprintf(stderr, "%s error: %d\n", msg, err); \
  |  |   13|      0|        exit(1); \
  |  |   14|      0|    } \
  |  |   15|  1.53k|}
  ------------------
   66|       |
   67|  1.53k|    err = PREFIX(deflate)(&c_stream, Z_FINISH);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
                  err = PREFIX(deflate)(&c_stream, Z_FINISH);
  ------------------
  |  |  175|  1.53k|#define Z_FINISH        4
  ------------------
   68|  1.53k|    if (err != Z_STREAM_END) {
  ------------------
  |  |  181|  1.53k|#define Z_STREAM_END    1
  ------------------
  |  Branch (68:9): [True: 0, False: 1.53k]
  ------------------
   69|      0|        fprintf(stderr, "deflate large should report Z_STREAM_END\n");
   70|      0|        exit(1);
   71|      0|    }
   72|  1.53k|    err = PREFIX(deflateEnd)(&c_stream);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
   73|  1.53k|    CHECK_ERR(err, "deflateEnd");
  ------------------
  |  |   10|  1.53k|#define CHECK_ERR(err, msg) { \
  |  |   11|  1.53k|    if (err != Z_OK) { \
  |  |  ------------------
  |  |  |  |  180|  3.07k|#define Z_OK            0
  |  |  ------------------
  |  |  |  Branch (11:9): [True: 0, False: 1.53k]
  |  |  ------------------
  |  |   12|      0|        fprintf(stderr, "%s error: %d\n", msg, err); \
  |  |   13|      0|        exit(1); \
  |  |   14|      0|    } \
  |  |   15|  1.53k|}
  ------------------
   74|  1.53k|}
test_large_inflate:
   79|  1.53k|void test_large_inflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen) {
   80|  1.53k|    int err;
   81|  1.53k|    PREFIX3(stream) d_stream; /* decompression stream */
  ------------------
  |  |  119|  1.53k|#  define PREFIX3(x) zng_ ## x
  ------------------
   82|       |
   83|  1.53k|    d_stream.zalloc = zalloc;
   84|  1.53k|    d_stream.zfree = zfree;
   85|  1.53k|    d_stream.opaque = (void *)0;
   86|       |
   87|  1.53k|    d_stream.next_in = compr;
   88|  1.53k|    d_stream.avail_in = (unsigned int)comprLen;
   89|       |
   90|  1.53k|    err = PREFIX(inflateInit)(&d_stream);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
   91|  1.53k|    CHECK_ERR(err, "inflateInit");
  ------------------
  |  |   10|  1.53k|#define CHECK_ERR(err, msg) { \
  |  |   11|  1.53k|    if (err != Z_OK) { \
  |  |  ------------------
  |  |  |  |  180|  3.07k|#define Z_OK            0
  |  |  ------------------
  |  |  |  Branch (11:9): [True: 0, False: 1.53k]
  |  |  ------------------
  |  |   12|      0|        fprintf(stderr, "%s error: %d\n", msg, err); \
  |  |   13|      0|        exit(1); \
  |  |   14|      0|    } \
  |  |   15|  1.53k|}
  ------------------
   92|       |
   93|  4.60k|    for (;;) {
   94|  4.60k|        d_stream.next_out = uncompr; /* discard the output */
   95|  4.60k|        d_stream.avail_out = (unsigned int)uncomprLen;
   96|  4.60k|        err = PREFIX(inflate)(&d_stream, Z_NO_FLUSH);
  ------------------
  |  |  117|  4.60k|#  define PREFIX(x) zng_ ## x
  ------------------
                      err = PREFIX(inflate)(&d_stream, Z_NO_FLUSH);
  ------------------
  |  |  171|  4.60k|#define Z_NO_FLUSH      0
  ------------------
   97|  4.60k|        if (err == Z_STREAM_END)
  ------------------
  |  |  181|  4.60k|#define Z_STREAM_END    1
  ------------------
  |  Branch (97:13): [True: 1.53k, False: 3.07k]
  ------------------
   98|  1.53k|            break;
   99|  3.07k|        CHECK_ERR(err, "large inflate");
  ------------------
  |  |   10|  3.07k|#define CHECK_ERR(err, msg) { \
  |  |   11|  3.07k|    if (err != Z_OK) { \
  |  |  ------------------
  |  |  |  |  180|  6.14k|#define Z_OK            0
  |  |  ------------------
  |  |  |  Branch (11:9): [True: 0, False: 3.07k]
  |  |  ------------------
  |  |   12|      0|        fprintf(stderr, "%s error: %d\n", msg, err); \
  |  |   13|      0|        exit(1); \
  |  |   14|      0|    } \
  |  |   15|  3.07k|}
  ------------------
  100|  3.07k|    }
  101|       |
  102|  1.53k|    err = PREFIX(inflateEnd)(&d_stream);
  ------------------
  |  |  117|  1.53k|#  define PREFIX(x) zng_ ## x
  ------------------
  103|  1.53k|    CHECK_ERR(err, "inflateEnd");
  ------------------
  |  |   10|  1.53k|#define CHECK_ERR(err, msg) { \
  |  |   11|  1.53k|    if (err != Z_OK) { \
  |  |  ------------------
  |  |  |  |  180|  3.07k|#define Z_OK            0
  |  |  ------------------
  |  |  |  Branch (11:9): [True: 0, False: 1.53k]
  |  |  ------------------
  |  |   12|      0|        fprintf(stderr, "%s error: %d\n", msg, err); \
  |  |   13|      0|        exit(1); \
  |  |   14|      0|    } \
  |  |   15|  1.53k|}
  ------------------
  104|       |
  105|  1.53k|    if (d_stream.total_out != 2 * uncomprLen + diff) {
  ------------------
  |  Branch (105:9): [True: 0, False: 1.53k]
  ------------------
  106|       |        fprintf(stderr, "bad large inflate: %" PRIu64 "\n", (uint64_t)d_stream.total_out);
  107|      0|        exit(1);
  108|      0|    }
  109|  1.53k|}
LLVMFuzzerTestOneInput:
  111|  1.54k|int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size) {
  112|  1.54k|    size_t comprLen = 100 + 3 * size;
  113|  1.54k|    size_t uncomprLen = comprLen;
  114|  1.54k|    uint8_t *compr, *uncompr;
  115|       |
  116|       |    /* Discard inputs larger than 512Kb. */
  117|  1.54k|    static size_t kMaxSize = 512 * 1024;
  118|       |
  119|  1.54k|    if (size < 1 || size > kMaxSize)
  ------------------
  |  Branch (119:9): [True: 0, False: 1.54k]
  |  Branch (119:21): [True: 4, False: 1.53k]
  ------------------
  120|      4|        return 0;
  121|       |
  122|  1.53k|    data = d;
  123|  1.53k|    dataLen = size;
  124|  1.53k|    compr = (uint8_t *)calloc(1, comprLen);
  125|  1.53k|    uncompr = (uint8_t *)calloc(1, uncomprLen);
  126|       |
  127|  1.53k|    test_large_deflate(compr, comprLen, uncompr, uncomprLen);
  128|  1.53k|    test_large_inflate(compr, comprLen, uncompr, uncomprLen);
  129|       |
  130|  1.53k|    free(compr);
  131|  1.53k|    free(uncompr);
  132|       |
  133|       |    /* This function must return 0. */
  134|  1.53k|    return 0;
  135|  1.54k|}

zng_tr_init:
   83|  1.53k|void Z_INTERNAL zng_tr_init(deflate_state *s) {
   84|  1.53k|    s->l_desc.dyn_tree = s->dyn_ltree;
   85|  1.53k|    s->l_desc.stat_desc = &static_l_desc;
   86|       |
   87|  1.53k|    s->d_desc.dyn_tree = s->dyn_dtree;
   88|  1.53k|    s->d_desc.stat_desc = &static_d_desc;
   89|       |
   90|  1.53k|    s->bl_desc.dyn_tree = s->bl_tree;
   91|  1.53k|    s->bl_desc.stat_desc = &static_bl_desc;
   92|       |
   93|  1.53k|    s->bi_buf = 0;
   94|  1.53k|    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|  1.53k|    init_block(s);
  102|  1.53k|}
gen_codes:
  376|  9.21k|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|  9.21k|    uint16_t next_code[MAX_BITS+1];  /* next code value for each bit length */
  381|  9.21k|    uint16_t code = 0;               /* running code value */
  382|  9.21k|    int bits;                        /* bit index */
  383|  9.21k|    int n;                           /* code index */
  384|       |
  385|       |    /* The distribution counts are first used to generate the code values
  386|       |     * without bit reversal.
  387|       |     */
  388|   147k|    for (bits = 1; bits <= MAX_BITS; bits++) {
  ------------------
  |  |   39|   147k|#define MAX_BITS 15
  ------------------
  |  Branch (388:20): [True: 138k, False: 9.21k]
  ------------------
  389|   138k|        code = (code + bl_count[bits-1]) << 1;
  390|   138k|        next_code[bits] = code;
  391|   138k|    }
  392|       |    /* Check that the bit counts in bl_count are consistent. The last code
  393|       |     * must be all ones.
  394|       |     */
  395|  9.21k|    Assert(code + bl_count[MAX_BITS]-1 == (1 << MAX_BITS)-1, "inconsistent bit counts");
  396|  9.21k|    Tracev((stderr, "\ngen_codes: max_code %d ", max_code));
  397|       |
  398|   972k|    for (n = 0;  n <= max_code; n++) {
  ------------------
  |  Branch (398:18): [True: 963k, False: 9.21k]
  ------------------
  399|   963k|        int len = tree[n].Len;
  ------------------
  |  |  105|   963k|#define Len  dl.len
  ------------------
  400|   963k|        if (len == 0)
  ------------------
  |  Branch (400:13): [True: 934k, False: 28.9k]
  ------------------
  401|   934k|            continue;
  402|       |        /* Now reverse the bits */
  403|  28.9k|        tree[n].Code = bi_reverse(next_code[len]++, len);
  ------------------
  |  |  103|  28.9k|#define Code fc.code
  ------------------
  404|       |
  405|  28.9k|        Tracecv(tree != static_ltree, (stderr, "\nn %3d %c l %2d c %4x (%x) ",
  406|  28.9k|             n, (isgraph(n & 0xff) ? n : ' '), len, tree[n].Code, next_code[len]-1));
  407|  28.9k|    }
  408|  9.21k|}
zng_tr_stored_block:
  595|  1.53k|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.53k|    zng_tr_emit_tree(s, STORED_BLOCK, last); /* send block type */
  ------------------
  |  |   51|  1.53k|#define STORED_BLOCK 0
  ------------------
  600|  1.53k|    zng_tr_emit_align(s);                    /* align on byte boundary */
  601|  1.53k|    cmpr_bits_align(s);
  602|  1.53k|    put_short(s, (uint16_t)stored_len);
  603|  1.53k|    put_short(s, (uint16_t)~stored_len);
  604|  1.53k|    cmpr_bits_add(s, 32);
  ------------------
  |  |  424|  1.53k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  150|  1.53k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  605|  1.53k|    sent_bits_add(s, 32);
  ------------------
  |  |  426|  1.53k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  ------------------
  |  |  |  |  150|  1.53k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  606|  1.53k|    if (stored_len) {
  ------------------
  |  Branch (606:9): [True: 0, False: 1.53k]
  ------------------
  607|      0|        memcpy(s->pending_buf + s->pending, buf, stored_len);
  608|      0|        s->pending += stored_len;
  609|      0|        cmpr_bits_add(s, stored_len << 3);
  ------------------
  |  |  424|      0|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  150|      0|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  610|      0|        sent_bits_add(s, stored_len << 3);
  ------------------
  |  |  426|      0|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  ------------------
  |  |  |  |  150|      0|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  611|      0|    }
  612|  1.53k|}
zng_tr_flush_block:
  628|  3.07k|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|  3.07k|    unsigned int opt_lenb, static_lenb; /* opt_len and static_len in bytes */
  633|  3.07k|    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|  3.07k|    if (UNLIKELY(s->sym_next == 0)) {
  ------------------
  |  |  254|  3.07k|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (254:33): [True: 0, False: 3.07k]
  |  |  ------------------
  ------------------
  637|       |        /* Emit an empty static tree block with no codes */
  638|      0|        opt_lenb = static_lenb = 0;
  639|      0|        s->static_len = 7;
  640|  3.07k|    } else if (s->level > 0) {
  ------------------
  |  Branch (640:16): [True: 3.07k, False: 0]
  ------------------
  641|       |        /* Check if the file is binary or text */
  642|  3.07k|        if (s->strm->data_type == Z_UNKNOWN)
  ------------------
  |  |  209|  3.07k|#define Z_UNKNOWN  2
  ------------------
  |  Branch (642:13): [True: 1.53k, False: 1.53k]
  ------------------
  643|  1.53k|            s->strm->data_type = detect_data_type(s);
  644|       |
  645|       |        /* Construct the literal and distance trees */
  646|  3.07k|        build_tree(s, (tree_desc *)(&(s->l_desc)));
  647|  3.07k|        Tracev((stderr, "\nlit data: dyn %u, stat %u", s->opt_len, s->static_len));
  648|       |
  649|  3.07k|        build_tree(s, (tree_desc *)(&(s->d_desc)));
  650|  3.07k|        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|  3.07k|        max_blindex = build_bl_tree(s);
  659|       |
  660|       |        /* Determine the best encoding. Compute the block lengths in bytes. */
  661|  3.07k|        opt_lenb = (s->opt_len + 3 + 7) >> 3;
  662|  3.07k|        static_lenb = (s->static_len + 3 + 7) >> 3;
  663|       |
  664|  3.07k|        Tracev((stderr, "\nopt %u(%u) stat %u(%u) stored %u lit %u ",
  665|  3.07k|                opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
  666|  3.07k|                s->sym_next / 3));
  667|       |
  668|  3.07k|        if (static_lenb <= opt_lenb || s->strategy == Z_FIXED)
  ------------------
  |  |  202|  2.42k|#define Z_FIXED               4
  ------------------
  |  Branch (668:13): [True: 649, False: 2.42k]
  |  Branch (668:40): [True: 0, False: 2.42k]
  ------------------
  669|    649|            opt_lenb = static_lenb;
  670|       |
  671|  3.07k|    } 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|  3.07k|    if (stored_len+4 <= opt_lenb && buf != NULL) {
  ------------------
  |  Branch (676:9): [True: 0, False: 3.07k]
  |  Branch (676:37): [True: 0, 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|      0|        zng_tr_stored_block(s, buf, stored_len, last);
  685|       |
  686|  3.07k|    } else if (static_lenb == opt_lenb) {
  ------------------
  |  Branch (686:16): [True: 649, False: 2.42k]
  ------------------
  687|    649|        zng_tr_emit_tree(s, STATIC_TREES, last);
  ------------------
  |  |   52|    649|#define STATIC_TREES 1
  ------------------
  688|    649|        compress_block(s, (const ct_data *)static_ltree, (const ct_data *)static_dtree);
  689|    649|        cmpr_bits_add(s, s->static_len);
  ------------------
  |  |  424|    649|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  150|    649|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  690|  2.42k|    } else {
  691|  2.42k|        zng_tr_emit_tree(s, DYN_TREES, last);
  ------------------
  |  |   53|  2.42k|#define DYN_TREES    2
  ------------------
  692|  2.42k|        send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, max_blindex+1);
  693|  2.42k|        compress_block(s, (const ct_data *)s->dyn_ltree, (const ct_data *)s->dyn_dtree);
  694|  2.42k|        cmpr_bits_add(s, s->opt_len);
  ------------------
  |  |  424|  2.42k|#  define cmpr_bits_add(s, len)     Z_UNUSED(len)
  |  |  ------------------
  |  |  |  |  150|  2.42k|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  ------------------
  695|  2.42k|    }
  696|  3.07k|    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|  3.07k|    init_block(s);
  701|       |
  702|  3.07k|    if (last) {
  ------------------
  |  Branch (702:9): [True: 1.53k, False: 1.53k]
  ------------------
  703|  1.53k|        zng_tr_emit_align(s);
  704|  1.53k|    }
  705|  3.07k|    Tracev((stderr, "\ncomprlen %lu(%lu) ", s->compressed_len>>3, s->compressed_len-7*last));
  706|  3.07k|}
zng_tr_flush_bits:
  811|  10.7k|void Z_INTERNAL zng_tr_flush_bits(deflate_state *s) {
  812|  10.7k|    if (s->bi_valid >= 48) {
  ------------------
  |  Branch (812:9): [True: 521, False: 10.2k]
  ------------------
  813|    521|        put_uint32(s, (uint32_t)s->bi_buf);
  814|    521|        put_short(s, (uint16_t)(s->bi_buf >> 32));
  815|    521|        s->bi_buf >>= 48;
  816|    521|        s->bi_valid -= 48;
  817|  10.2k|    } else if (s->bi_valid >= 32) {
  ------------------
  |  Branch (817:16): [True: 374, False: 9.85k]
  ------------------
  818|    374|        put_uint32(s, (uint32_t)s->bi_buf);
  819|    374|        s->bi_buf >>= 32;
  820|    374|        s->bi_valid -= 32;
  821|    374|    }
  822|  10.7k|    if (s->bi_valid >= 16) {
  ------------------
  |  Branch (822:9): [True: 271, False: 10.4k]
  ------------------
  823|    271|        put_short(s, (uint16_t)s->bi_buf);
  824|    271|        s->bi_buf >>= 16;
  825|    271|        s->bi_valid -= 16;
  826|    271|    }
  827|  10.7k|    if (s->bi_valid >= 8) {
  ------------------
  |  Branch (827:9): [True: 726, False: 10.0k]
  ------------------
  828|    726|        put_byte(s, s->bi_buf);
  ------------------
  |  |  326|    726|#define put_byte(s, c) { \
  |  |  327|    726|    s->pending_buf[s->pending++] = (unsigned char)(c); \
  |  |  328|    726|}
  ------------------
  829|    726|        s->bi_buf >>= 8;
  830|    726|        s->bi_valid -= 8;
  831|    726|    }
  832|  10.7k|}
trees.c:init_block:
  107|  4.60k|static void init_block(deflate_state *s) {
  108|  4.60k|    int n; /* iterates over tree elements */
  109|       |
  110|       |    /* Initialize the trees. */
  111|  1.32M|    for (n = 0; n < L_CODES;  n++)
  ------------------
  |  |   48|  1.32M|#define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  ------------------
  |  |  |  |   45|  1.32M|#define LITERALS  256
  |  |  ------------------
  |  |               #define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  ------------------
  |  |  |  |   42|  1.32M|#define LENGTH_CODES 29
  |  |  ------------------
  ------------------
  |  Branch (111:17): [True: 1.31M, False: 4.60k]
  ------------------
  112|  1.31M|        s->dyn_ltree[n].Freq = 0;
  ------------------
  |  |  102|  1.31M|#define Freq fc.freq
  ------------------
  113|   142k|    for (n = 0; n < D_CODES;  n++)
  ------------------
  |  |   51|   142k|#define D_CODES   30
  ------------------
  |  Branch (113:17): [True: 138k, False: 4.60k]
  ------------------
  114|   138k|        s->dyn_dtree[n].Freq = 0;
  ------------------
  |  |  102|   138k|#define Freq fc.freq
  ------------------
  115|  92.1k|    for (n = 0; n < BL_CODES; n++)
  ------------------
  |  |   54|  92.1k|#define BL_CODES  19
  ------------------
  |  Branch (115:17): [True: 87.5k, False: 4.60k]
  ------------------
  116|  87.5k|        s->bl_tree[n].Freq = 0;
  ------------------
  |  |  102|  87.5k|#define Freq fc.freq
  ------------------
  117|       |
  118|  4.60k|    s->dyn_ltree[END_BLOCK].Freq = 1;
  ------------------
  |  |   63|  4.60k|#define END_BLOCK 256
  ------------------
                  s->dyn_ltree[END_BLOCK].Freq = 1;
  ------------------
  |  |  102|  4.60k|#define Freq fc.freq
  ------------------
  119|  4.60k|    s->opt_len = s->static_len = 0;
  120|  4.60k|    s->sym_next = s->matches = 0;
  121|  4.60k|}
trees.c:build_tree:
  184|  9.21k|static void build_tree(deflate_state *s, tree_desc *desc) {
  185|       |    /* desc: the tree descriptor */
  186|  9.21k|    unsigned char *depth  = s->depth;
  187|  9.21k|    int *heap             = s->heap;
  188|  9.21k|    ct_data *tree         = desc->dyn_tree;
  189|  9.21k|    const ct_data *stree  = desc->stat_desc->static_tree;
  190|  9.21k|    int elems             = desc->stat_desc->elems;
  191|  9.21k|    int n, m;          /* iterate over heap elements */
  192|  9.21k|    int max_code = -1; /* largest code with non zero frequency */
  193|  9.21k|    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|  9.21k|    s->heap_len = 0;
  200|  9.21k|    s->heap_max = HEAP_SIZE;
  ------------------
  |  |   57|  9.21k|#define HEAP_SIZE (2*L_CODES+1)
  |  |  ------------------
  |  |  |  |   48|  9.21k|#define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  9.21k|#define LITERALS  256
  |  |  |  |  ------------------
  |  |  |  |               #define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  9.21k|#define LENGTH_CODES 29
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  201|       |
  202|  1.03M|    for (n = 0; n < elems; n++) {
  ------------------
  |  Branch (202:17): [True: 1.02M, False: 9.21k]
  ------------------
  203|  1.02M|        if (tree[n].Freq != 0) {
  ------------------
  |  |  102|  1.02M|#define Freq fc.freq
  ------------------
  |  Branch (203:13): [True: 27.2k, False: 1.00M]
  ------------------
  204|  27.2k|            heap[++(s->heap_len)] = max_code = n;
  205|  27.2k|            depth[n] = 0;
  206|  1.00M|        } else {
  207|  1.00M|            tree[n].Len = 0;
  ------------------
  |  |  105|  1.00M|#define Len  dl.len
  ------------------
  208|  1.00M|        }
  209|  1.02M|    }
  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|  10.9k|    while (s->heap_len < 2) {
  ------------------
  |  Branch (216:12): [True: 1.73k, False: 9.21k]
  ------------------
  217|  1.73k|        node = heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
  ------------------
  |  Branch (217:41): [True: 1.72k, False: 1]
  ------------------
  218|  1.73k|        tree[node].Freq = 1;
  ------------------
  |  |  102|  1.73k|#define Freq fc.freq
  ------------------
  219|  1.73k|        depth[node] = 0;
  220|  1.73k|        s->opt_len--;
  221|  1.73k|        if (stree)
  ------------------
  |  Branch (221:13): [True: 1.73k, False: 0]
  ------------------
  222|  1.73k|            s->static_len -= stree[node].Len;
  ------------------
  |  |  105|  1.73k|#define Len  dl.len
  ------------------
  223|       |        /* node is 0 or 1 so it does not have extra bits */
  224|  1.73k|    }
  225|  9.21k|    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|  22.0k|    for (n = s->heap_len/2; n >= 1; n--)
  ------------------
  |  Branch (230:29): [True: 12.8k, False: 9.21k]
  ------------------
  231|  12.8k|        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|  9.21k|    node = elems;              /* next internal node of the tree */
  237|  19.7k|    do {
  238|  19.7k|        pqremove(s, depth, heap, tree, n);  /* n = node of least frequency */
  ------------------
  |  |  139|  19.7k|#define pqremove(s, depth, heap, tree, top) { \
  |  |  140|  19.7k|    top = heap[SMALLEST]; \
  |  |  ------------------
  |  |  |  |  123|  19.7k|#define SMALLEST 1
  |  |  ------------------
  |  |  141|  19.7k|    heap[SMALLEST] = heap[s->heap_len--]; \
  |  |  ------------------
  |  |  |  |  123|  19.7k|#define SMALLEST 1
  |  |  ------------------
  |  |  142|  19.7k|    pqdownheap(depth, heap, s->heap_len, tree, SMALLEST); \
  |  |  ------------------
  |  |  |  |  123|  19.7k|#define SMALLEST 1
  |  |  ------------------
  |  |  143|  19.7k|}
  ------------------
  239|  19.7k|        m = heap[SMALLEST]; /* m = node of next least frequency */
  ------------------
  |  |  123|  19.7k|#define SMALLEST 1
  ------------------
  240|       |
  241|  19.7k|        heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
  242|  19.7k|        heap[--(s->heap_max)] = m;
  243|       |
  244|       |        /* Create a new node father of n and m */
  245|  19.7k|        tree[node].Freq = tree[n].Freq + tree[m].Freq;
  ------------------
  |  |  102|  19.7k|#define Freq fc.freq
  ------------------
                      tree[node].Freq = tree[n].Freq + tree[m].Freq;
  ------------------
  |  |  102|  19.7k|#define Freq fc.freq
  ------------------
                      tree[node].Freq = tree[n].Freq + tree[m].Freq;
  ------------------
  |  |  102|  19.7k|#define Freq fc.freq
  ------------------
  246|  19.7k|        depth[node] = (unsigned char)((depth[n] >= depth[m] ?
  ------------------
  |  Branch (246:40): [True: 14.4k, False: 5.31k]
  ------------------
  247|  14.4k|                                          depth[n] : depth[m]) + 1);
  248|  19.7k|        tree[n].Dad = tree[m].Dad = (uint16_t)node;
  ------------------
  |  |  104|  19.7k|#define Dad  dl.dad
  ------------------
                      tree[n].Dad = tree[m].Dad = (uint16_t)node;
  ------------------
  |  |  104|  19.7k|#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|  19.7k|        heap[SMALLEST] = node++;
  ------------------
  |  |  123|  19.7k|#define SMALLEST 1
  ------------------
  257|  19.7k|        pqdownheap(depth, heap, s->heap_len, tree, SMALLEST);
  ------------------
  |  |  123|  19.7k|#define SMALLEST 1
  ------------------
  258|  19.7k|    } while (s->heap_len >= 2);
  ------------------
  |  Branch (258:14): [True: 10.5k, False: 9.21k]
  ------------------
  259|       |
  260|  9.21k|    heap[--(s->heap_max)] = heap[SMALLEST];
  ------------------
  |  |  123|  9.21k|#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|  9.21k|    gen_bitlen(s, (tree_desc *)desc);
  266|       |
  267|       |    /* The field len is now set, we can generate the bit codes */
  268|  9.21k|    gen_codes((ct_data *)tree, max_code, s->bl_count);
  269|  9.21k|}
trees.c:pqdownheap:
  151|  52.3k|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|  52.3k|    int j = k << 1;  /* left son of k */
  155|  52.3k|    const int v = heap[k];
  156|       |
  157|  76.3k|    while (j <= heap_len) {
  ------------------
  |  Branch (157:12): [True: 35.7k, False: 40.6k]
  ------------------
  158|       |        /* Set j to the smallest of the two sons: */
  159|  35.7k|        if (j < heap_len && smaller(tree, heap[j+1], heap[j], depth)) {
  ------------------
  |  |  132|  16.4k|    (tree[n].Freq < tree[m].Freq || \
  |  |  ------------------
  |  |  |  |  102|  16.4k|#define Freq fc.freq
  |  |  ------------------
  |  |                   (tree[n].Freq < tree[m].Freq || \
  |  |  ------------------
  |  |  |  |  102|  32.8k|#define Freq fc.freq
  |  |  ------------------
  |  |  |  Branch (132:6): [True: 5.11k, False: 11.3k]
  |  |  ------------------
  |  |  133|  16.4k|    (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
  |  |  ------------------
  |  |  |  |  102|  11.3k|#define Freq fc.freq
  |  |  ------------------
  |  |                   (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
  |  |  ------------------
  |  |  |  |  102|  22.6k|#define Freq fc.freq
  |  |  ------------------
  |  |  |  Branch (133:6): [True: 3.11k, False: 8.21k]
  |  |  |  Branch (133:38): [True: 2.92k, False: 195]
  |  |  ------------------
  ------------------
  |  Branch (159:13): [True: 16.4k, False: 19.2k]
  ------------------
  160|  8.03k|            j++;
  161|  8.03k|        }
  162|       |        /* Exit if v is smaller than both sons */
  163|  35.7k|        if (smaller(tree, v, heap[j], depth))
  ------------------
  |  |  132|  35.7k|    (tree[n].Freq < tree[m].Freq || \
  |  |  ------------------
  |  |  |  |  102|  35.7k|#define Freq fc.freq
  |  |  ------------------
  |  |                   (tree[n].Freq < tree[m].Freq || \
  |  |  ------------------
  |  |  |  |  102|  71.4k|#define Freq fc.freq
  |  |  ------------------
  |  |  |  Branch (132:6): [True: 7.85k, False: 27.8k]
  |  |  ------------------
  |  |  133|  35.7k|    (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
  |  |  ------------------
  |  |  |  |  102|  27.8k|#define Freq fc.freq
  |  |  ------------------
  |  |                   (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
  |  |  ------------------
  |  |  |  |  102|  55.7k|#define Freq fc.freq
  |  |  ------------------
  |  |  |  Branch (133:6): [True: 8.06k, False: 19.8k]
  |  |  |  Branch (133:38): [True: 3.86k, False: 4.19k]
  |  |  ------------------
  ------------------
  164|  11.7k|            break;
  165|       |
  166|       |        /* Exchange v with the smallest son */
  167|  23.9k|        heap[k] = heap[j];
  168|  23.9k|        k = j;
  169|       |
  170|       |        /* And continue down the tree, setting j to the left son of k */
  171|  23.9k|        j <<= 1;
  172|  23.9k|    }
  173|  52.3k|    heap[k] = v;
  174|  52.3k|}
trees.c:gen_bitlen:
  281|  9.21k|static void gen_bitlen(deflate_state *s, tree_desc *desc) {
  282|       |    /* desc: the tree descriptor */
  283|  9.21k|    ct_data *tree           = desc->dyn_tree;
  284|  9.21k|    int max_code            = desc->max_code;
  285|  9.21k|    const ct_data *stree    = desc->stat_desc->static_tree;
  286|  9.21k|    const int *extra        = desc->stat_desc->extra_bits;
  287|  9.21k|    int base                = desc->stat_desc->extra_base;
  288|  9.21k|    unsigned int max_length = desc->stat_desc->max_length;
  289|  9.21k|    int h;              /* heap index */
  290|  9.21k|    int n, m;           /* iterate over the tree elements */
  291|  9.21k|    unsigned int bits;  /* bit length */
  292|  9.21k|    int xbits;          /* extra bits */
  293|  9.21k|    uint16_t f;         /* frequency */
  294|  9.21k|    int overflow = 0;   /* number of elements with bit length too large */
  295|       |
  296|   156k|    for (bits = 0; bits <= MAX_BITS; bits++)
  ------------------
  |  |   39|   156k|#define MAX_BITS 15
  ------------------
  |  Branch (296:20): [True: 147k, False: 9.21k]
  ------------------
  297|   147k|        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|  9.21k|    tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
  ------------------
  |  |  105|  9.21k|#define Len  dl.len
  ------------------
  303|       |
  304|  48.7k|    for (h = s->heap_max + 1; h < HEAP_SIZE; h++) {
  ------------------
  |  |   57|  48.7k|#define HEAP_SIZE (2*L_CODES+1)
  |  |  ------------------
  |  |  |  |   48|  48.7k|#define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  48.7k|#define LITERALS  256
  |  |  |  |  ------------------
  |  |  |  |               #define L_CODES (LITERALS+1+LENGTH_CODES)
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  48.7k|#define LENGTH_CODES 29
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (304:31): [True: 39.5k, False: 9.21k]
  ------------------
  305|  39.5k|        n = s->heap[h];
  306|  39.5k|        bits = tree[tree[n].Dad].Len + 1u;
  ------------------
  |  |  104|  39.5k|#define Dad  dl.dad
  ------------------
                      bits = tree[tree[n].Dad].Len + 1u;
  ------------------
  |  |  105|  39.5k|#define Len  dl.len
  ------------------
  307|  39.5k|        if (bits > max_length){
  ------------------
  |  Branch (307:13): [True: 0, False: 39.5k]
  ------------------
  308|      0|            bits = max_length;
  309|      0|            overflow++;
  310|      0|        }
  311|  39.5k|        tree[n].Len = (uint16_t)bits;
  ------------------
  |  |  105|  39.5k|#define Len  dl.len
  ------------------
  312|       |        /* We overwrite tree[n].Dad which is no longer needed */
  313|       |
  314|  39.5k|        if (n > max_code) /* not a leaf node */
  ------------------
  |  Branch (314:13): [True: 10.5k, False: 28.9k]
  ------------------
  315|  10.5k|            continue;
  316|       |
  317|  28.9k|        s->bl_count[bits]++;
  318|  28.9k|        xbits = 0;
  319|  28.9k|        if (n >= base)
  ------------------
  |  Branch (319:13): [True: 24.2k, False: 4.77k]
  ------------------
  320|  24.2k|            xbits = extra[n-base];
  321|  28.9k|        f = tree[n].Freq;
  ------------------
  |  |  102|  28.9k|#define Freq fc.freq
  ------------------
  322|  28.9k|        s->opt_len += (unsigned int)f * (unsigned int)(bits + xbits);
  323|  28.9k|        if (stree)
  ------------------
  |  Branch (323:13): [True: 16.6k, False: 12.2k]
  ------------------
  324|  16.6k|            s->static_len += (unsigned int)f * (unsigned int)(stree[n].Len + xbits);
  ------------------
  |  |  105|  16.6k|#define Len  dl.len
  ------------------
  325|  28.9k|    }
  326|  9.21k|    if (overflow == 0)
  ------------------
  |  Branch (326:9): [True: 9.21k, False: 0]
  ------------------
  327|  9.21k|        return;
  328|       |
  329|      0|    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|      0|    do {
  334|      0|        bits = max_length - 1;
  335|      0|        while (s->bl_count[bits] == 0)
  ------------------
  |  Branch (335:16): [True: 0, False: 0]
  ------------------
  336|      0|            bits--;
  337|      0|        s->bl_count[bits]--;       /* move one leaf down the tree */
  338|      0|        s->bl_count[bits+1] += 2u; /* move one overflow item as its brother */
  339|      0|        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|      0|        overflow -= 2;
  344|      0|    } while (overflow > 0);
  ------------------
  |  Branch (344:14): [True: 0, False: 0]
  ------------------
  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|      0|    for (bits = max_length; bits != 0; bits--) {
  ------------------
  |  Branch (351:29): [True: 0, False: 0]
  ------------------
  352|      0|        n = s->bl_count[bits];
  353|      0|        while (n != 0) {
  ------------------
  |  Branch (353:16): [True: 0, False: 0]
  ------------------
  354|      0|            m = s->heap[--h];
  355|      0|            if (m > max_code)
  ------------------
  |  Branch (355:17): [True: 0, False: 0]
  ------------------
  356|      0|                continue;
  357|      0|            if (tree[m].Len != bits) {
  ------------------
  |  |  105|      0|#define Len  dl.len
  ------------------
  |  Branch (357:17): [True: 0, False: 0]
  ------------------
  358|      0|                Tracev((stderr, "code %d bits %d->%u\n", m, tree[m].Len, bits));
  359|      0|                s->opt_len += (unsigned int)(bits * tree[m].Freq);
  ------------------
  |  |  102|      0|#define Freq fc.freq
  ------------------
  360|      0|                s->opt_len -= (unsigned int)(tree[m].Len * tree[m].Freq);
  ------------------
  |  |  105|      0|#define Len  dl.len
  ------------------
                              s->opt_len -= (unsigned int)(tree[m].Len * tree[m].Freq);
  ------------------
  |  |  102|      0|#define Freq fc.freq
  ------------------
  361|      0|                tree[m].Len = (uint16_t)bits;
  ------------------
  |  |  105|      0|#define Len  dl.len
  ------------------
  362|      0|            }
  363|      0|            n--;
  364|      0|        }
  365|      0|    }
  366|      0|}
trees.c:build_bl_tree:
  528|  3.07k|static int build_bl_tree(deflate_state *s) {
  529|  3.07k|    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|  3.07k|    scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
  533|  3.07k|    scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
  534|       |
  535|       |    /* Build the bit length tree: */
  536|  3.07k|    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|  6.14k|    for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
  ------------------
  |  |   54|  3.07k|#define BL_CODES  19
  ------------------
  |  Branch (545:36): [True: 6.14k, False: 0]
  ------------------
  546|  6.14k|        if (s->bl_tree[bl_order[max_blindex]].Len != 0)
  ------------------
  |  |  105|  6.14k|#define Len  dl.len
  ------------------
  |  Branch (546:13): [True: 3.07k, False: 3.07k]
  ------------------
  547|  3.07k|            break;
  548|  6.14k|    }
  549|       |    /* Update opt_len to include the bit length tree and counts */
  550|  3.07k|    s->opt_len += 3*((unsigned int)max_blindex+1) + 5+5+4;
  551|  3.07k|    Tracev((stderr, "\ndyn trees: dyn %u, stat %u", s->opt_len, s->static_len));
  552|       |
  553|  3.07k|    return max_blindex;
  554|  3.07k|}
trees.c:scan_tree:
  414|  6.14k|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|  6.14k|    int n;                     /* iterates over all tree elements */
  418|  6.14k|    int prevlen = -1;          /* last emitted length */
  419|  6.14k|    int curlen;                /* length of current code */
  420|  6.14k|    int nextlen = tree[0].Len; /* length of next code */
  ------------------
  |  |  105|  6.14k|#define Len  dl.len
  ------------------
  421|  6.14k|    uint16_t count = 0;        /* repeat count of the current code */
  422|  6.14k|    uint16_t max_count = 7;    /* max repeat count */
  423|  6.14k|    uint16_t min_count = 4;    /* min repeat count */
  424|       |
  425|  6.14k|    if (nextlen == 0)
  ------------------
  |  Branch (425:9): [True: 1.36k, False: 4.77k]
  ------------------
  426|  1.36k|        max_count = 138, min_count = 3;
  427|       |
  428|  6.14k|    tree[max_code+1].Len = (uint16_t)0xffff; /* guard */
  ------------------
  |  |  105|  6.14k|#define Len  dl.len
  ------------------
  429|       |
  430|   910k|    for (n = 0; n <= max_code; n++) {
  ------------------
  |  Branch (430:17): [True: 904k, False: 6.14k]
  ------------------
  431|   904k|        curlen = nextlen;
  432|   904k|        nextlen = tree[n+1].Len;
  ------------------
  |  |  105|   904k|#define Len  dl.len
  ------------------
  433|   904k|        if (++count < max_count && curlen == nextlen) {
  ------------------
  |  Branch (433:13): [True: 901k, False: 3.07k]
  |  Branch (433:36): [True: 876k, False: 24.7k]
  ------------------
  434|   876k|            continue;
  435|   876k|        } else if (count < min_count) {
  ------------------
  |  Branch (435:20): [True: 15.5k, False: 12.2k]
  ------------------
  436|  15.5k|            s->bl_tree[curlen].Freq += count;
  ------------------
  |  |  102|  15.5k|#define Freq fc.freq
  ------------------
  437|  15.5k|        } else if (curlen != 0) {
  ------------------
  |  Branch (437:20): [True: 0, False: 12.2k]
  ------------------
  438|      0|            if (curlen != prevlen)
  ------------------
  |  Branch (438:17): [True: 0, False: 0]
  ------------------
  439|      0|                s->bl_tree[curlen].Freq++;
  ------------------
  |  |  102|      0|#define Freq fc.freq
  ------------------
  440|      0|            s->bl_tree[REP_3_6].Freq++;
  ------------------
  |  |   12|      0|#define REP_3_6      16
  ------------------
                          s->bl_tree[REP_3_6].Freq++;
  ------------------
  |  |  102|      0|#define Freq fc.freq
  ------------------
  441|  12.2k|        } else if (count <= 10) {
  ------------------
  |  Branch (441:20): [True: 1.28k, False: 10.9k]
  ------------------
  442|  1.28k|            s->bl_tree[REPZ_3_10].Freq++;
  ------------------
  |  |   15|  1.28k|#define REPZ_3_10    17
  ------------------
                          s->bl_tree[REPZ_3_10].Freq++;
  ------------------
  |  |  102|  1.28k|#define Freq fc.freq
  ------------------
  443|  10.9k|        } else {
  444|  10.9k|            s->bl_tree[REPZ_11_138].Freq++;
  ------------------
  |  |   18|  10.9k|#define REPZ_11_138  18
  ------------------
                          s->bl_tree[REPZ_11_138].Freq++;
  ------------------
  |  |  102|  10.9k|#define Freq fc.freq
  ------------------
  445|  10.9k|        }
  446|  27.8k|        count = 0;
  447|  27.8k|        prevlen = curlen;
  448|  27.8k|        if (nextlen == 0) {
  ------------------
  |  Branch (448:13): [True: 11.5k, False: 16.3k]
  ------------------
  449|  11.5k|            max_count = 138, min_count = 3;
  450|  16.3k|        } else if (curlen == nextlen) {
  ------------------
  |  Branch (450:20): [True: 0, False: 16.3k]
  ------------------
  451|      0|            max_count = 6, min_count = 3;
  452|  16.3k|        } else {
  453|  16.3k|            max_count = 7, min_count = 4;
  454|  16.3k|        }
  455|  27.8k|    }
  456|  6.14k|}
trees.c:send_all_trees:
  561|  2.42k|static void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes) {
  562|  2.42k|    int rank;                    /* index in bl_order */
  563|       |
  564|  2.42k|    Assert(lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
  565|  2.42k|    Assert(lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, "too many codes");
  566|       |
  567|       |    // Temp local variables
  568|  2.42k|    uint32_t bi_valid = s->bi_valid;
  569|  2.42k|    uint64_t bi_buf = s->bi_buf;
  570|       |
  571|  2.42k|    Tracev((stderr, "\nbl counts: "));
  572|  2.42k|    send_bits(s, lcodes-257, 5, bi_buf, bi_valid); /* not +255 as stated in appnote.txt */
  ------------------
  |  |   47|  2.42k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |   48|  2.42k|    uint64_t val = (uint64_t)t_val;\
  |  |   49|  2.42k|    uint32_t len = (uint32_t)t_len;\
  |  |   50|  2.42k|    uint32_t total_bits = bi_valid + len;\
  |  |   51|  2.42k|    send_bits_trace(s, val, len);\
  |  |   52|  2.42k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  426|  2.42k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|  2.42k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   53|  2.42k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  4.84k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  2.42k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (53:9): [True: 2.42k, False: 0]
  |  |  |  Branch (53:38): [True: 2.42k, False: 0]
  |  |  ------------------
  |  |   54|  2.42k|        bi_buf |= val << bi_valid;\
  |  |   55|  2.42k|        bi_valid = total_bits;\
  |  |   56|  2.42k|    } 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|  2.42k|}
  ------------------
  573|  2.42k|    send_bits(s, dcodes-1,   5, bi_buf, bi_valid);
  ------------------
  |  |   47|  2.42k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |   48|  2.42k|    uint64_t val = (uint64_t)t_val;\
  |  |   49|  2.42k|    uint32_t len = (uint32_t)t_len;\
  |  |   50|  2.42k|    uint32_t total_bits = bi_valid + len;\
  |  |   51|  2.42k|    send_bits_trace(s, val, len);\
  |  |   52|  2.42k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  426|  2.42k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|  2.42k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   53|  2.42k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  4.84k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  2.42k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (53:9): [True: 2.42k, False: 0]
  |  |  |  Branch (53:38): [True: 2.42k, False: 0]
  |  |  ------------------
  |  |   54|  2.42k|        bi_buf |= val << bi_valid;\
  |  |   55|  2.42k|        bi_valid = total_bits;\
  |  |   56|  2.42k|    } 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|  2.42k|}
  ------------------
  574|  2.42k|    send_bits(s, blcodes-4,  4, bi_buf, bi_valid); /* not -3 as stated in appnote.txt */
  ------------------
  |  |   47|  2.42k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |   48|  2.42k|    uint64_t val = (uint64_t)t_val;\
  |  |   49|  2.42k|    uint32_t len = (uint32_t)t_len;\
  |  |   50|  2.42k|    uint32_t total_bits = bi_valid + len;\
  |  |   51|  2.42k|    send_bits_trace(s, val, len);\
  |  |   52|  2.42k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  426|  2.42k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|  2.42k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   53|  2.42k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  4.84k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  2.42k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (53:9): [True: 2.42k, False: 0]
  |  |  |  Branch (53:38): [True: 2.42k, False: 0]
  |  |  ------------------
  |  |   54|  2.42k|        bi_buf |= val << bi_valid;\
  |  |   55|  2.42k|        bi_valid = total_bits;\
  |  |   56|  2.42k|    } 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|  2.42k|}
  ------------------
  575|  46.0k|    for (rank = 0; rank < blcodes; rank++) {
  ------------------
  |  Branch (575:20): [True: 43.6k, False: 2.42k]
  ------------------
  576|  43.6k|        Tracev((stderr, "\nbl code %2u ", bl_order[rank]));
  577|  43.6k|        send_bits(s, s->bl_tree[bl_order[rank]].Len, 3, bi_buf, bi_valid);
  ------------------
  |  |   47|  43.6k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |   48|  43.6k|    uint64_t val = (uint64_t)t_val;\
  |  |   49|  43.6k|    uint32_t len = (uint32_t)t_len;\
  |  |   50|  43.6k|    uint32_t total_bits = bi_valid + len;\
  |  |   51|  43.6k|    send_bits_trace(s, val, len);\
  |  |   52|  43.6k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  426|  43.6k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|  43.6k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   53|  43.6k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  87.2k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  41.1k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (53:9): [True: 41.1k, False: 2.42k]
  |  |  |  Branch (53:38): [True: 41.1k, False: 0]
  |  |  ------------------
  |  |   54|  41.1k|        bi_buf |= val << bi_valid;\
  |  |   55|  41.1k|        bi_valid = total_bits;\
  |  |   56|  41.1k|    } else if (bi_valid >= BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  4.84k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (56:16): [True: 0, False: 2.42k]
  |  |  ------------------
  |  |   57|      0|        put_uint64(s, bi_buf);\
  |  |   58|      0|        bi_buf = val;\
  |  |   59|      0|        bi_valid = len;\
  |  |   60|  2.42k|    } else {\
  |  |   61|  2.42k|        bi_buf |= val << bi_valid;\
  |  |   62|  2.42k|        put_uint64(s, bi_buf);\
  |  |   63|  2.42k|        bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\
  |  |  ------------------
  |  |  |  |   60|  2.42k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   64|  2.42k|        bi_valid = total_bits - BIT_BUF_SIZE;\
  |  |  ------------------
  |  |  |  |   60|  2.42k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |   65|  2.42k|    }\
  |  |   66|  43.6k|}
  ------------------
  578|  43.6k|    }
  579|  2.42k|    Tracev((stderr, "\nbl tree: sent %lu", s->bits_sent));
  580|       |
  581|       |    // Store back temp variables
  582|  2.42k|    s->bi_buf = bi_buf;
  583|  2.42k|    s->bi_valid = bi_valid;
  584|       |
  585|  2.42k|    send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
  586|  2.42k|    Tracev((stderr, "\nlit tree: sent %lu", s->bits_sent));
  587|       |
  588|  2.42k|    send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
  589|  2.42k|    Tracev((stderr, "\ndist tree: sent %lu", s->bits_sent));
  590|  2.42k|}
trees.c:send_tree:
  462|  4.84k|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|  4.84k|    int n;                     /* iterates over all tree elements */
  466|  4.84k|    int prevlen = -1;          /* last emitted length */
  467|  4.84k|    int curlen;                /* length of current code */
  468|  4.84k|    int nextlen = tree[0].Len; /* length of next code */
  ------------------
  |  |  105|  4.84k|#define Len  dl.len
  ------------------
  469|  4.84k|    int count = 0;             /* repeat count of the current code */
  470|  4.84k|    int max_count = 7;         /* max repeat count */
  471|  4.84k|    int min_count = 4;         /* min repeat count */
  472|       |
  473|       |    /* tree[max_code+1].Len = -1; */  /* guard already set */
  474|  4.84k|    if (nextlen == 0)
  ------------------
  |  Branch (474:9): [True: 1.04k, False: 3.80k]
  ------------------
  475|  1.04k|        max_count = 138, min_count = 3;
  476|       |
  477|       |    // Temp local variables
  478|  4.84k|    uint32_t bi_valid = s->bi_valid;
  479|  4.84k|    uint64_t bi_buf = s->bi_buf;
  480|       |
  481|   720k|    for (n = 0; n <= max_code; n++) {
  ------------------
  |  Branch (481:17): [True: 715k, False: 4.84k]
  ------------------
  482|   715k|        curlen = nextlen;
  483|   715k|        nextlen = tree[n+1].Len;
  ------------------
  |  |  105|   715k|#define Len  dl.len
  ------------------
  484|   715k|        if (++count < max_count && curlen == nextlen) {
  ------------------
  |  Branch (484:13): [True: 713k, False: 2.42k]
  |  Branch (484:36): [True: 693k, False: 19.8k]
  ------------------
  485|   693k|            continue;
  486|   693k|        } else if (count < min_count) {
  ------------------
  |  Branch (486:20): [True: 12.4k, False: 9.80k]
  ------------------
  487|  14.0k|            do {
  488|  14.0k|                send_code(s, curlen, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   76|  14.0k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   47|  14.0k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |  |  |   48|  14.0k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   49|  14.0k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   50|  14.0k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   51|  14.0k|    send_bits_trace(s, val, len);\
  |  |  |  |   52|  14.0k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|  14.0k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|  14.0k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   53|  14.0k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  28.0k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  14.0k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (53:9): [True: 14.0k, False: 0]
  |  |  |  |  |  Branch (53:38): [True: 14.0k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   54|  14.0k|        bi_buf |= val << bi_valid;\
  |  |  |  |   55|  14.0k|        bi_valid = total_bits;\
  |  |  |  |   56|  14.0k|    } 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|  14.0k|}
  |  |  ------------------
  ------------------
  489|  14.0k|            } while (--count != 0);
  ------------------
  |  Branch (489:22): [True: 1.52k, False: 12.4k]
  ------------------
  490|       |
  491|  12.4k|        } else if (curlen != 0) {
  ------------------
  |  Branch (491:20): [True: 0, False: 9.80k]
  ------------------
  492|      0|            if (curlen != prevlen) {
  ------------------
  |  Branch (492:17): [True: 0, False: 0]
  ------------------
  493|      0|                send_code(s, curlen, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   76|      0|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   47|      0|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |  |  |   48|      0|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   49|      0|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   50|      0|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   51|      0|    send_bits_trace(s, val, len);\
  |  |  |  |   52|      0|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|      0|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|      0|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   53|      0|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (53:9): [True: 0, False: 0]
  |  |  |  |  |  Branch (53:38): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   54|      0|        bi_buf |= val << bi_valid;\
  |  |  |  |   55|      0|        bi_valid = total_bits;\
  |  |  |  |   56|      0|    } 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|      0|}
  |  |  ------------------
  ------------------
  494|      0|                count--;
  495|      0|            }
  496|      0|            Assert(count >= 3 && count <= 6, " 3_6?");
  497|      0|            send_code(s, REP_3_6, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   76|      0|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   47|      0|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |  |  |   48|      0|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   49|      0|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   50|      0|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   51|      0|    send_bits_trace(s, val, len);\
  |  |  |  |   52|      0|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|      0|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|      0|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   53|      0|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (53:9): [True: 0, False: 0]
  |  |  |  |  |  Branch (53:38): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   54|      0|        bi_buf |= val << bi_valid;\
  |  |  |  |   55|      0|        bi_valid = total_bits;\
  |  |  |  |   56|      0|    } 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|      0|}
  |  |  ------------------
  ------------------
  498|      0|            send_bits(s, count-3, 2, bi_buf, bi_valid);
  ------------------
  |  |   47|      0|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |   48|      0|    uint64_t val = (uint64_t)t_val;\
  |  |   49|      0|    uint32_t len = (uint32_t)t_len;\
  |  |   50|      0|    uint32_t total_bits = bi_valid + len;\
  |  |   51|      0|    send_bits_trace(s, val, len);\
  |  |   52|      0|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  426|      0|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|      0|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   53|      0|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|      0|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (53:9): [True: 0, False: 0]
  |  |  |  Branch (53:38): [True: 0, False: 0]
  |  |  ------------------
  |  |   54|      0|        bi_buf |= val << bi_valid;\
  |  |   55|      0|        bi_valid = total_bits;\
  |  |   56|      0|    } 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|      0|}
  ------------------
  499|       |
  500|  9.80k|        } else if (count <= 10) {
  ------------------
  |  Branch (500:20): [True: 1.06k, False: 8.74k]
  ------------------
  501|  1.06k|            send_code(s, REPZ_3_10, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   76|  1.06k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   47|  1.06k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |  |  |   48|  1.06k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   49|  1.06k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   50|  1.06k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   51|  1.06k|    send_bits_trace(s, val, len);\
  |  |  |  |   52|  1.06k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|  1.06k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|  1.06k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   53|  1.06k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  2.12k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  1.06k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (53:9): [True: 1.06k, False: 0]
  |  |  |  |  |  Branch (53:38): [True: 1.06k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   54|  1.06k|        bi_buf |= val << bi_valid;\
  |  |  |  |   55|  1.06k|        bi_valid = total_bits;\
  |  |  |  |   56|  1.06k|    } 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|  1.06k|}
  |  |  ------------------
  ------------------
  502|  1.06k|            send_bits(s, count-3, 3, bi_buf, bi_valid);
  ------------------
  |  |   47|  1.06k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |   48|  1.06k|    uint64_t val = (uint64_t)t_val;\
  |  |   49|  1.06k|    uint32_t len = (uint32_t)t_len;\
  |  |   50|  1.06k|    uint32_t total_bits = bi_valid + len;\
  |  |   51|  1.06k|    send_bits_trace(s, val, len);\
  |  |   52|  1.06k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  426|  1.06k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|  1.06k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   53|  1.06k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  2.12k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  1.06k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (53:9): [True: 1.06k, False: 0]
  |  |  |  Branch (53:38): [True: 1.06k, False: 0]
  |  |  ------------------
  |  |   54|  1.06k|        bi_buf |= val << bi_valid;\
  |  |   55|  1.06k|        bi_valid = total_bits;\
  |  |   56|  1.06k|    } 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|  1.06k|}
  ------------------
  503|       |
  504|  8.74k|        } else {
  505|  8.74k|            send_code(s, REPZ_11_138, s->bl_tree, bi_buf, bi_valid);
  ------------------
  |  |   76|  8.74k|    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
  |  |  ------------------
  |  |  |  |   47|  8.74k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |  |  |   48|  8.74k|    uint64_t val = (uint64_t)t_val;\
  |  |  |  |   49|  8.74k|    uint32_t len = (uint32_t)t_len;\
  |  |  |  |   50|  8.74k|    uint32_t total_bits = bi_valid + len;\
  |  |  |  |   51|  8.74k|    send_bits_trace(s, val, len);\
  |  |  |  |   52|  8.74k|    sent_bits_add(s, len);\
  |  |  |  |  ------------------
  |  |  |  |  |  |  426|  8.74k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|  8.74k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   53|  8.74k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  17.4k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  8.74k|#define BIT_BUF_SIZE 64
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (53:9): [True: 8.74k, False: 0]
  |  |  |  |  |  Branch (53:38): [True: 8.74k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   54|  8.74k|        bi_buf |= val << bi_valid;\
  |  |  |  |   55|  8.74k|        bi_valid = total_bits;\
  |  |  |  |   56|  8.74k|    } 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|  8.74k|}
  |  |  ------------------
  ------------------
  506|  8.74k|            send_bits(s, count-11, 7, bi_buf, bi_valid);
  ------------------
  |  |   47|  8.74k|#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\
  |  |   48|  8.74k|    uint64_t val = (uint64_t)t_val;\
  |  |   49|  8.74k|    uint32_t len = (uint32_t)t_len;\
  |  |   50|  8.74k|    uint32_t total_bits = bi_valid + len;\
  |  |   51|  8.74k|    send_bits_trace(s, val, len);\
  |  |   52|  8.74k|    sent_bits_add(s, len);\
  |  |  ------------------
  |  |  |  |  426|  8.74k|#  define sent_bits_add(s, bits)    Z_UNUSED(bits)
  |  |  |  |  ------------------
  |  |  |  |  |  |  150|  8.74k|#define Z_UNUSED(var) (void)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   53|  8.74k|    if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  17.4k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |                   if (total_bits < BIT_BUF_SIZE && bi_valid < BIT_BUF_SIZE) {\
  |  |  ------------------
  |  |  |  |   60|  8.74k|#define BIT_BUF_SIZE 64
  |  |  ------------------
  |  |  |  Branch (53:9): [True: 8.74k, False: 0]
  |  |  |  Branch (53:38): [True: 8.74k, False: 0]
  |  |  ------------------
  |  |   54|  8.74k|        bi_buf |= val << bi_valid;\
  |  |   55|  8.74k|        bi_valid = total_bits;\
  |  |   56|  8.74k|    } 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|  8.74k|}
  ------------------
  507|  8.74k|        }
  508|  22.3k|        count = 0;
  509|  22.3k|        prevlen = curlen;
  510|  22.3k|        if (nextlen == 0) {
  ------------------
  |  Branch (510:13): [True: 9.28k, False: 13.0k]
  ------------------
  511|  9.28k|            max_count = 138, min_count = 3;
  512|  13.0k|        } else if (curlen == nextlen) {
  ------------------
  |  Branch (512:20): [True: 0, False: 13.0k]
  ------------------
  513|      0|            max_count = 6, min_count = 3;
  514|  13.0k|        } else {
  515|  13.0k|            max_count = 7, min_count = 4;
  516|  13.0k|        }
  517|  22.3k|    }
  518|       |
  519|       |    // Store back temp variables
  520|  4.84k|    s->bi_buf = bi_buf;
  521|  4.84k|    s->bi_valid = bi_valid;
  522|  4.84k|}
trees.c:compress_block:
  711|  3.07k|static void compress_block(deflate_state *s, const ct_data *ltree, const ct_data *dtree) {
  712|       |    /* ltree: literal tree */
  713|       |    /* dtree: distance tree */
  714|  3.07k|    unsigned dist;      /* distance of matched string */
  715|  3.07k|    int lc;             /* match length or unmatched char (if dist == 0) */
  716|  3.07k|    unsigned sx = 0;    /* running index in symbol buffers */
  717|       |
  718|       |    /* Local pointers to avoid indirection */
  719|  3.07k|    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|  3.07k|    unsigned char *sym_buf = s->sym_buf;
  725|  3.07k|#endif
  726|       |
  727|       |    /* Keep bi_buf and bi_valid in registers across the entire loop */
  728|  3.07k|    uint64_t bi_buf = s->bi_buf;
  729|  3.07k|    uint32_t bi_valid = s->bi_valid;
  730|       |
  731|  3.07k|    if (sym_next != 0) {
  ------------------
  |  Branch (731:9): [True: 3.07k, False: 0]
  ------------------
  732|  1.71M|        do {
  733|       |#ifdef LIT_MEM
  734|       |            dist = d_buf[sx];
  735|       |            lc = l_buf[sx++];
  736|       |#else
  737|  1.71M|#  if OPTIMAL_CMP >= 32
  738|  1.71M|            uint32_t val = Z_U32_FROM_LE(zng_memread_4(&sym_buf[sx]));
  ------------------
  |  |   65|  1.71M|#  define Z_U32_FROM_LE(x)  (x)
  ------------------
  739|  1.71M|            dist = val & 0xffff;
  740|  1.71M|            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|  1.71M|            sx += 3;
  746|  1.71M|#endif
  747|  1.71M|            if (dist == 0) {
  ------------------
  |  Branch (747:17): [True: 3.85k, False: 1.70M]
  ------------------
  748|  3.85k|                zng_emit_lit(s, ltree, lc, &bi_buf, &bi_valid);
  749|  1.70M|            } else {
  750|  1.70M|                zng_emit_dist(s, ltree, dtree, lc, dist, &bi_buf, &bi_valid);
  751|  1.70M|            } /* 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|  1.71M|            Assert(s->pending < s->lit_bufsize + sx, "pending_buf overflow");
  758|  1.71M|#endif
  759|  1.71M|        } while (sx < sym_next);
  ------------------
  |  Branch (759:18): [True: 1.70M, False: 3.07k]
  ------------------
  760|  3.07k|    }
  761|       |
  762|  3.07k|    zng_emit_end_block(s, ltree, 0, &bi_buf, &bi_valid);
  763|       |
  764|       |    /* Write back to state */
  765|  3.07k|    s->bi_buf = bi_buf;
  766|  3.07k|    s->bi_valid = bi_valid;
  767|  3.07k|}
trees.c:detect_data_type:
  782|  1.53k|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|  1.53k|    unsigned long block_mask = 0xf3ffc07fUL;
  788|  1.53k|    int n;
  789|       |
  790|       |    /* Check for non-textual ("block-listed") bytes. */
  791|  1.53k|    for (n = 0; n <= 31; n++, block_mask >>= 1)
  ------------------
  |  Branch (791:17): [True: 1.53k, False: 0]
  ------------------
  792|  1.53k|        if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
  ------------------
  |  |  102|  1.53k|#define Freq fc.freq
  ------------------
  |  Branch (792:13): [True: 1.53k, False: 0]
  |  Branch (792:33): [True: 1.53k, False: 0]
  ------------------
  793|  1.53k|            return Z_BINARY;
  ------------------
  |  |  206|  1.53k|#define Z_BINARY   0
  ------------------
  794|       |
  795|       |    /* Check for textual ("allow-listed") bytes. */
  796|      0|    if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |  102|      0|#define Freq fc.freq
  ------------------
                  if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |  102|      0|#define Freq fc.freq
  ------------------
                  if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0)
  ------------------
  |  |  102|      0|#define Freq fc.freq
  ------------------
  |  Branch (796:9): [True: 0, False: 0]
  |  Branch (796:38): [True: 0, False: 0]
  |  Branch (796:68): [True: 0, False: 0]
  ------------------
  797|      0|        return Z_TEXT;
  ------------------
  |  |  207|      0|#define Z_TEXT     1
  ------------------
  798|      0|    for (n = 32; n < LITERALS; n++)
  ------------------
  |  |   45|      0|#define LITERALS  256
  ------------------
  |  Branch (798:18): [True: 0, False: 0]
  ------------------
  799|      0|        if (s->dyn_ltree[n].Freq != 0)
  ------------------
  |  |  102|      0|#define Freq fc.freq
  ------------------
  |  Branch (799:13): [True: 0, False: 0]
  ------------------
  800|      0|            return Z_TEXT;
  ------------------
  |  |  207|      0|#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|      0|    return Z_BINARY;
  ------------------
  |  |  206|      0|#define Z_BINARY   0
  ------------------
  806|      0|}

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

deflate.c:zng_memwrite_2:
   45|  1.53k|static inline void zng_memwrite_2(void *ptr, uint16_t val) {
   46|  1.53k|#if defined(HAVE_MAY_ALIAS)
   47|  1.53k|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   48|  1.53k|    ((unaligned_uint16_t *)ptr)->val = val;
   49|       |#else
   50|       |    memcpy(ptr, &val, sizeof(val));
   51|       |#endif
   52|  1.53k|}
deflate.c:zng_memwrite_4:
   54|  1.53k|static inline void zng_memwrite_4(void *ptr, uint32_t val) {
   55|  1.53k|#if defined(HAVE_MAY_ALIAS)
   56|  1.53k|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|  1.53k|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|  1.53k|}
deflate_slow.c:zng_memwrite_4:
   54|  1.71M|static inline void zng_memwrite_4(void *ptr, uint32_t val) {
   55|  1.71M|#if defined(HAVE_MAY_ALIAS)
   56|  1.71M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|  1.71M|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|  1.71M|}
deflate_stored.c:zng_memwrite_2:
   45|  3.07k|static inline void zng_memwrite_2(void *ptr, uint16_t val) {
   46|  3.07k|#if defined(HAVE_MAY_ALIAS)
   47|  3.07k|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   48|  3.07k|    ((unaligned_uint16_t *)ptr)->val = val;
   49|       |#else
   50|       |    memcpy(ptr, &val, sizeof(val));
   51|       |#endif
   52|  3.07k|}
trees.c:zng_memwrite_8:
   63|  57.6k|static inline void zng_memwrite_8(void *ptr, uint64_t val) {
   64|  57.6k|#if defined(HAVE_MAY_ALIAS)
   65|  57.6k|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   66|  57.6k|    ((unaligned_uint64_t *)ptr)->val = val;
   67|       |#else
   68|       |    memcpy(ptr, &val, sizeof(val));
   69|       |#endif
   70|  57.6k|}
trees.c:zng_memwrite_2:
   45|  4.78k|static inline void zng_memwrite_2(void *ptr, uint16_t val) {
   46|  4.78k|#if defined(HAVE_MAY_ALIAS)
   47|  4.78k|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   48|  4.78k|    ((unaligned_uint16_t *)ptr)->val = val;
   49|       |#else
   50|       |    memcpy(ptr, &val, sizeof(val));
   51|       |#endif
   52|  4.78k|}
trees.c:zng_memread_4:
   23|  1.71M|static inline uint32_t zng_memread_4(const void *ptr) {
   24|  1.71M|#if defined(HAVE_MAY_ALIAS)
   25|  1.71M|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  1.71M|    return ((const unaligned_uint32_t *)ptr)->val;
   27|       |#else
   28|       |    uint32_t val;
   29|       |    memcpy(&val, ptr, sizeof(val));
   30|       |    return val;
   31|       |#endif
   32|  1.71M|}
trees.c:zng_memwrite_4:
   54|  1.62k|static inline void zng_memwrite_4(void *ptr, uint32_t val) {
   55|  1.62k|#if defined(HAVE_MAY_ALIAS)
   56|  1.62k|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   57|  1.62k|    ((unaligned_uint32_t *)ptr)->val = val;
   58|       |#else
   59|       |    memcpy(ptr, &val, sizeof(val));
   60|       |#endif
   61|  1.62k|}
chunkset_avx2.c:zng_memread_8:
   34|  1.70M|static inline uint64_t zng_memread_8(const void *ptr) {
   35|  1.70M|#if defined(HAVE_MAY_ALIAS)
   36|  1.70M|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   37|  1.70M|    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|  1.70M|}
compare256_avx2.c:zng_memread_8:
   34|  5.27M|static inline uint64_t zng_memread_8(const void *ptr) {
   35|  5.27M|#if defined(HAVE_MAY_ALIAS)
   36|  5.27M|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   37|  5.27M|    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|  5.27M|}
compare256_avx2.c:zng_memcmp_2:
   75|  3.41M|static inline int32_t zng_memcmp_2(const void *src0, const void *src1) {
   76|  3.41M|#if defined(HAVE_MAY_ALIAS)
   77|  3.41M|    return zng_memread_2(src0) != zng_memread_2(src1);
   78|       |#else
   79|       |    return memcmp(src0, src1, 2);
   80|       |#endif
   81|  3.41M|}
compare256_avx2.c:zng_memread_2:
   12|  6.83M|static inline uint16_t zng_memread_2(const void *ptr) {
   13|  6.83M|#if defined(HAVE_MAY_ALIAS)
   14|  6.83M|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   15|  6.83M|    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|  6.83M|}
compare256_avx2.c:zng_memcmp_8:
   91|   757k|static inline int32_t zng_memcmp_8(const void *src0, const void *src1) {
   92|   757k|#if defined(HAVE_MAY_ALIAS)
   93|   757k|    return zng_memread_8(src0) != zng_memread_8(src1);
   94|       |#else
   95|       |    return memcmp(src0, src1, 8);
   96|       |#endif
   97|   757k|}
compare256_avx2.c:zng_memcmp_4:
   83|  11.3k|static inline int32_t zng_memcmp_4(const void *src0, const void *src1) {
   84|  11.3k|#if defined(HAVE_MAY_ALIAS)
   85|  11.3k|    return zng_memread_4(src0) != zng_memread_4(src1);
   86|       |#else
   87|       |    return memcmp(src0, src1, 4);
   88|       |#endif
   89|  11.3k|}
compare256_avx2.c:zng_memread_4:
   23|  22.7k|static inline uint32_t zng_memread_4(const void *ptr) {
   24|  22.7k|#if defined(HAVE_MAY_ALIAS)
   25|  22.7k|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  22.7k|    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|  22.7k|}

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

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

