zxc_compress.c:rapidhash_withSeed:
  487|   101k|RAPIDHASH_INLINE_CONSTEXPR uint64_t rapidhash_withSeed(const void *key, size_t len, uint64_t seed) RAPIDHASH_NOEXCEPT {
  488|   101k|  return rapidhash_internal(key, len, seed, rapid_secret);
  489|   101k|}
zxc_compress.c:rapidhash_internal:
  244|   101k|RAPIDHASH_INLINE_CONSTEXPR uint64_t rapidhash_internal(const void *key, size_t len, uint64_t seed, const uint64_t* secret) RAPIDHASH_NOEXCEPT {
  245|   101k|  const uint8_t *p=(const uint8_t *)key;
  246|   101k|  seed ^= rapid_mix(seed ^ secret[2], secret[1]);
  247|   101k|  uint64_t a=0, b=0;
  248|   101k|  size_t i = len;
  249|   101k|  if (_likely_(len <= 16)) {
  ------------------
  |  |  107|   101k| # define _likely_(x)  __builtin_expect(x,1)
  |  |  ------------------
  |  |  |  Branch (107:24): [True: 330, False: 101k]
  |  |  ------------------
  ------------------
  250|    330|    if (len >= 4) {
  ------------------
  |  Branch (250:9): [True: 317, False: 13]
  ------------------
  251|    317|      seed ^= len;
  252|    317|      if (len >= 8) {
  ------------------
  |  Branch (252:11): [True: 295, False: 22]
  ------------------
  253|    295|        const uint8_t* plast = p + len - 8;
  254|    295|        a = rapid_read64(p);
  255|    295|        b = rapid_read64(plast);
  256|    295|      } else {
  257|     22|        const uint8_t* plast = p + len - 4;
  258|     22|        a = rapid_read32(p);
  259|     22|        b = rapid_read32(plast);
  260|     22|      }
  261|    317|    } else if (len > 0) {
  ------------------
  |  Branch (261:16): [True: 13, False: 0]
  ------------------
  262|     13|      a = (((uint64_t)p[0])<<45)|p[len-1];
  263|     13|      b = p[len>>1];
  264|     13|    } else
  265|      0|      a = b = 0;
  266|   101k|  } else {
  267|   101k|    if (len > 112) {
  ------------------
  |  Branch (267:9): [True: 99.9k, False: 1.54k]
  ------------------
  268|  99.9k|      uint64_t see1 = seed, see2 = seed;
  269|  99.9k|      uint64_t see3 = seed, see4 = seed;
  270|  99.9k|      uint64_t see5 = seed, see6 = seed;
  271|  99.9k|#ifdef RAPIDHASH_COMPACT
  272|  9.02M|      do {
  273|  9.02M|        seed = rapid_mix(rapid_read64(p) ^ secret[0], rapid_read64(p + 8) ^ seed);
  274|  9.02M|        see1 = rapid_mix(rapid_read64(p + 16) ^ secret[1], rapid_read64(p + 24) ^ see1);
  275|  9.02M|        see2 = rapid_mix(rapid_read64(p + 32) ^ secret[2], rapid_read64(p + 40) ^ see2);
  276|  9.02M|        see3 = rapid_mix(rapid_read64(p + 48) ^ secret[3], rapid_read64(p + 56) ^ see3);
  277|  9.02M|        see4 = rapid_mix(rapid_read64(p + 64) ^ secret[4], rapid_read64(p + 72) ^ see4);
  278|  9.02M|        see5 = rapid_mix(rapid_read64(p + 80) ^ secret[5], rapid_read64(p + 88) ^ see5);
  279|  9.02M|        see6 = rapid_mix(rapid_read64(p + 96) ^ secret[6], rapid_read64(p + 104) ^ see6);
  280|  9.02M|        p += 112;
  281|  9.02M|        i -= 112;
  282|  9.02M|      } while(i > 112);
  ------------------
  |  Branch (282:15): [True: 8.92M, False: 99.9k]
  ------------------
  283|       |#else
  284|       |      while (i > 224) {
  285|       |        seed = rapid_mix(rapid_read64(p) ^ secret[0], rapid_read64(p + 8) ^ seed);
  286|       |        see1 = rapid_mix(rapid_read64(p + 16) ^ secret[1], rapid_read64(p + 24) ^ see1);
  287|       |        see2 = rapid_mix(rapid_read64(p + 32) ^ secret[2], rapid_read64(p + 40) ^ see2);
  288|       |        see3 = rapid_mix(rapid_read64(p + 48) ^ secret[3], rapid_read64(p + 56) ^ see3);
  289|       |        see4 = rapid_mix(rapid_read64(p + 64) ^ secret[4], rapid_read64(p + 72) ^ see4);
  290|       |        see5 = rapid_mix(rapid_read64(p + 80) ^ secret[5], rapid_read64(p + 88) ^ see5);
  291|       |        see6 = rapid_mix(rapid_read64(p + 96) ^ secret[6], rapid_read64(p + 104) ^ see6);
  292|       |        seed = rapid_mix(rapid_read64(p + 112) ^ secret[0], rapid_read64(p + 120) ^ seed);
  293|       |        see1 = rapid_mix(rapid_read64(p + 128) ^ secret[1], rapid_read64(p + 136) ^ see1);
  294|       |        see2 = rapid_mix(rapid_read64(p + 144) ^ secret[2], rapid_read64(p + 152) ^ see2);
  295|       |        see3 = rapid_mix(rapid_read64(p + 160) ^ secret[3], rapid_read64(p + 168) ^ see3);
  296|       |        see4 = rapid_mix(rapid_read64(p + 176) ^ secret[4], rapid_read64(p + 184) ^ see4);
  297|       |        see5 = rapid_mix(rapid_read64(p + 192) ^ secret[5], rapid_read64(p + 200) ^ see5);
  298|       |        see6 = rapid_mix(rapid_read64(p + 208) ^ secret[6], rapid_read64(p + 216) ^ see6);
  299|       |        p += 224;
  300|       |        i -= 224;
  301|       |      }
  302|       |      if (i > 112) {
  303|       |        seed = rapid_mix(rapid_read64(p) ^ secret[0], rapid_read64(p + 8) ^ seed);
  304|       |        see1 = rapid_mix(rapid_read64(p + 16) ^ secret[1], rapid_read64(p + 24) ^ see1);
  305|       |        see2 = rapid_mix(rapid_read64(p + 32) ^ secret[2], rapid_read64(p + 40) ^ see2);
  306|       |        see3 = rapid_mix(rapid_read64(p + 48) ^ secret[3], rapid_read64(p + 56) ^ see3);
  307|       |        see4 = rapid_mix(rapid_read64(p + 64) ^ secret[4], rapid_read64(p + 72) ^ see4);
  308|       |        see5 = rapid_mix(rapid_read64(p + 80) ^ secret[5], rapid_read64(p + 88) ^ see5);
  309|       |        see6 = rapid_mix(rapid_read64(p + 96) ^ secret[6], rapid_read64(p + 104) ^ see6);
  310|       |        p += 112;
  311|       |        i -= 112;
  312|       |      }
  313|       |#endif
  314|  99.9k|      seed ^= see1;
  315|  99.9k|      see2 ^= see3;
  316|  99.9k|      see4 ^= see5;
  317|  99.9k|      seed ^= see6;
  318|  99.9k|      see2 ^= see4;
  319|  99.9k|      seed ^= see2;
  320|  99.9k|    }
  321|   101k|    if (i > 16) {
  ------------------
  |  Branch (321:9): [True: 88.8k, False: 12.6k]
  ------------------
  322|  88.8k|      seed = rapid_mix(rapid_read64(p) ^ secret[2], rapid_read64(p + 8) ^ seed);
  323|  88.8k|      if (i > 32) {
  ------------------
  |  Branch (323:11): [True: 86.0k, False: 2.79k]
  ------------------
  324|  86.0k|          seed = rapid_mix(rapid_read64(p + 16) ^ secret[2], rapid_read64(p + 24) ^ seed);
  325|  86.0k|          if (i > 48) {
  ------------------
  |  Branch (325:15): [True: 84.3k, False: 1.75k]
  ------------------
  326|  84.3k|              seed = rapid_mix(rapid_read64(p + 32) ^ secret[1], rapid_read64(p + 40) ^ seed);
  327|  84.3k|              if (i > 64) {
  ------------------
  |  Branch (327:19): [True: 4.76k, False: 79.5k]
  ------------------
  328|  4.76k|                  seed = rapid_mix(rapid_read64(p + 48) ^ secret[1], rapid_read64(p + 56) ^ seed);
  329|  4.76k|                  if (i > 80) {
  ------------------
  |  Branch (329:23): [True: 3.07k, False: 1.69k]
  ------------------
  330|  3.07k|                      seed = rapid_mix(rapid_read64(p + 64) ^ secret[2], rapid_read64(p + 72) ^ seed);
  331|  3.07k|                      if (i > 96) {
  ------------------
  |  Branch (331:27): [True: 1.49k, False: 1.57k]
  ------------------
  332|  1.49k|                          seed = rapid_mix(rapid_read64(p + 80) ^ secret[1], rapid_read64(p + 88) ^ seed);
  333|  1.49k|                      }
  334|  3.07k|                  }
  335|  4.76k|              }
  336|  84.3k|          }
  337|  86.0k|      }
  338|  88.8k|    }
  339|   101k|    a=rapid_read64(p+i-16) ^ i;  b=rapid_read64(p+i-8);
  340|   101k|  }
  341|   101k|  a ^= secret[1];
  342|   101k|  b ^= seed;
  343|   101k|  rapid_mum(&a, &b);
  344|   101k|  return rapid_mix(a ^ secret[7], b ^ secret[1] ^ i);
  345|   101k|}
zxc_compress.c:rapid_mix:
  209|  63.1M|  RAPIDHASH_INLINE_CONSTEXPR uint64_t rapid_mix(uint64_t A, uint64_t B) RAPIDHASH_NOEXCEPT { rapid_mum(&A,&B); return A^B; }
zxc_compress.c:rapid_read64:
  215|   126M| RAPIDHASH_INLINE uint64_t rapid_read64(const uint8_t *p) RAPIDHASH_NOEXCEPT { uint64_t v; memcpy(&v, p, sizeof(uint64_t)); return v;}
zxc_compress.c:rapid_read32:
  216|     44| RAPIDHASH_INLINE uint64_t rapid_read32(const uint8_t *p) RAPIDHASH_NOEXCEPT { uint32_t v; memcpy(&v, p, sizeof(uint32_t)); return v;}
zxc_compress.c:rapid_mum:
  157|  63.2M| RAPIDHASH_INLINE_CONSTEXPR void rapid_mum(uint64_t *A, uint64_t *B) RAPIDHASH_NOEXCEPT {
  158|  63.2M| #if defined(__SIZEOF_INT128__)
  159|  63.2M|   __uint128_t r=*A; r*=*B;
  160|       |   #ifdef RAPIDHASH_PROTECTED
  161|       |   *A^=(uint64_t)r; *B^=(uint64_t)(r>>64);
  162|       |   #else
  163|  63.2M|   *A=(uint64_t)r; *B=(uint64_t)(r>>64);
  164|  63.2M|   #endif
  165|       | #elif defined(_MSC_VER) && (defined(_WIN64) || defined(_M_HYBRID_CHPE_ARM64))
  166|       |   #if defined(_M_X64)
  167|       |     #ifdef RAPIDHASH_PROTECTED
  168|       |     uint64_t a, b;
  169|       |     a=_umul128(*A,*B,&b);
  170|       |     *A^=a;  *B^=b;
  171|       |     #else
  172|       |     *A=_umul128(*A,*B,B);
  173|       |     #endif
  174|       |   #else
  175|       |     #ifdef RAPIDHASH_PROTECTED
  176|       |     uint64_t a, b;
  177|       |     b = __umulh(*A, *B);
  178|       |     a = *A * *B;
  179|       |     *A^=a;  *B^=b;
  180|       |     #else
  181|       |     uint64_t c = __umulh(*A, *B);
  182|       |     *A = *A * *B;
  183|       |     *B = c;
  184|       |     #endif
  185|       |   #endif
  186|       | #else
  187|       |   uint64_t ha=*A>>32, hb=*B>>32, la=(uint32_t)*A, lb=(uint32_t)*B;
  188|       |   uint64_t rh=ha*hb, rm0=ha*lb, rm1=hb*la, rl=la*lb, t=rl+(rm0<<32), c=t<rl;
  189|       |   uint64_t lo=t+(rm1<<32); 
  190|       |   c+=lo<t; 
  191|       |   uint64_t hi=rh+(rm0>>32)+(rm1>>32)+c;
  192|       |   #ifdef RAPIDHASH_PROTECTED
  193|       |   *A^=lo;  *B^=hi;
  194|       |   #else
  195|       |   *A=lo;  *B=hi;
  196|       |   #endif
  197|       | #endif
  198|  63.2M| }
zxc_decompress.c:rapidhash_withSeed:
  487|   101k|RAPIDHASH_INLINE_CONSTEXPR uint64_t rapidhash_withSeed(const void *key, size_t len, uint64_t seed) RAPIDHASH_NOEXCEPT {
  488|   101k|  return rapidhash_internal(key, len, seed, rapid_secret);
  489|   101k|}
zxc_decompress.c:rapidhash_internal:
  244|   101k|RAPIDHASH_INLINE_CONSTEXPR uint64_t rapidhash_internal(const void *key, size_t len, uint64_t seed, const uint64_t* secret) RAPIDHASH_NOEXCEPT {
  245|   101k|  const uint8_t *p=(const uint8_t *)key;
  246|   101k|  seed ^= rapid_mix(seed ^ secret[2], secret[1]);
  247|   101k|  uint64_t a=0, b=0;
  248|   101k|  size_t i = len;
  249|   101k|  if (_likely_(len <= 16)) {
  ------------------
  |  |  107|   101k| # define _likely_(x)  __builtin_expect(x,1)
  |  |  ------------------
  |  |  |  Branch (107:24): [True: 330, False: 101k]
  |  |  ------------------
  ------------------
  250|    330|    if (len >= 4) {
  ------------------
  |  Branch (250:9): [True: 317, False: 13]
  ------------------
  251|    317|      seed ^= len;
  252|    317|      if (len >= 8) {
  ------------------
  |  Branch (252:11): [True: 295, False: 22]
  ------------------
  253|    295|        const uint8_t* plast = p + len - 8;
  254|    295|        a = rapid_read64(p);
  255|    295|        b = rapid_read64(plast);
  256|    295|      } else {
  257|     22|        const uint8_t* plast = p + len - 4;
  258|     22|        a = rapid_read32(p);
  259|     22|        b = rapid_read32(plast);
  260|     22|      }
  261|    317|    } else if (len > 0) {
  ------------------
  |  Branch (261:16): [True: 13, False: 0]
  ------------------
  262|     13|      a = (((uint64_t)p[0])<<45)|p[len-1];
  263|     13|      b = p[len>>1];
  264|     13|    } else
  265|      0|      a = b = 0;
  266|   101k|  } else {
  267|   101k|    if (len > 112) {
  ------------------
  |  Branch (267:9): [True: 99.8k, False: 1.54k]
  ------------------
  268|  99.8k|      uint64_t see1 = seed, see2 = seed;
  269|  99.8k|      uint64_t see3 = seed, see4 = seed;
  270|  99.8k|      uint64_t see5 = seed, see6 = seed;
  271|  99.8k|#ifdef RAPIDHASH_COMPACT
  272|  8.81M|      do {
  273|  8.81M|        seed = rapid_mix(rapid_read64(p) ^ secret[0], rapid_read64(p + 8) ^ seed);
  274|  8.81M|        see1 = rapid_mix(rapid_read64(p + 16) ^ secret[1], rapid_read64(p + 24) ^ see1);
  275|  8.81M|        see2 = rapid_mix(rapid_read64(p + 32) ^ secret[2], rapid_read64(p + 40) ^ see2);
  276|  8.81M|        see3 = rapid_mix(rapid_read64(p + 48) ^ secret[3], rapid_read64(p + 56) ^ see3);
  277|  8.81M|        see4 = rapid_mix(rapid_read64(p + 64) ^ secret[4], rapid_read64(p + 72) ^ see4);
  278|  8.81M|        see5 = rapid_mix(rapid_read64(p + 80) ^ secret[5], rapid_read64(p + 88) ^ see5);
  279|  8.81M|        see6 = rapid_mix(rapid_read64(p + 96) ^ secret[6], rapid_read64(p + 104) ^ see6);
  280|  8.81M|        p += 112;
  281|  8.81M|        i -= 112;
  282|  8.81M|      } while(i > 112);
  ------------------
  |  Branch (282:15): [True: 8.71M, False: 99.8k]
  ------------------
  283|       |#else
  284|       |      while (i > 224) {
  285|       |        seed = rapid_mix(rapid_read64(p) ^ secret[0], rapid_read64(p + 8) ^ seed);
  286|       |        see1 = rapid_mix(rapid_read64(p + 16) ^ secret[1], rapid_read64(p + 24) ^ see1);
  287|       |        see2 = rapid_mix(rapid_read64(p + 32) ^ secret[2], rapid_read64(p + 40) ^ see2);
  288|       |        see3 = rapid_mix(rapid_read64(p + 48) ^ secret[3], rapid_read64(p + 56) ^ see3);
  289|       |        see4 = rapid_mix(rapid_read64(p + 64) ^ secret[4], rapid_read64(p + 72) ^ see4);
  290|       |        see5 = rapid_mix(rapid_read64(p + 80) ^ secret[5], rapid_read64(p + 88) ^ see5);
  291|       |        see6 = rapid_mix(rapid_read64(p + 96) ^ secret[6], rapid_read64(p + 104) ^ see6);
  292|       |        seed = rapid_mix(rapid_read64(p + 112) ^ secret[0], rapid_read64(p + 120) ^ seed);
  293|       |        see1 = rapid_mix(rapid_read64(p + 128) ^ secret[1], rapid_read64(p + 136) ^ see1);
  294|       |        see2 = rapid_mix(rapid_read64(p + 144) ^ secret[2], rapid_read64(p + 152) ^ see2);
  295|       |        see3 = rapid_mix(rapid_read64(p + 160) ^ secret[3], rapid_read64(p + 168) ^ see3);
  296|       |        see4 = rapid_mix(rapid_read64(p + 176) ^ secret[4], rapid_read64(p + 184) ^ see4);
  297|       |        see5 = rapid_mix(rapid_read64(p + 192) ^ secret[5], rapid_read64(p + 200) ^ see5);
  298|       |        see6 = rapid_mix(rapid_read64(p + 208) ^ secret[6], rapid_read64(p + 216) ^ see6);
  299|       |        p += 224;
  300|       |        i -= 224;
  301|       |      }
  302|       |      if (i > 112) {
  303|       |        seed = rapid_mix(rapid_read64(p) ^ secret[0], rapid_read64(p + 8) ^ seed);
  304|       |        see1 = rapid_mix(rapid_read64(p + 16) ^ secret[1], rapid_read64(p + 24) ^ see1);
  305|       |        see2 = rapid_mix(rapid_read64(p + 32) ^ secret[2], rapid_read64(p + 40) ^ see2);
  306|       |        see3 = rapid_mix(rapid_read64(p + 48) ^ secret[3], rapid_read64(p + 56) ^ see3);
  307|       |        see4 = rapid_mix(rapid_read64(p + 64) ^ secret[4], rapid_read64(p + 72) ^ see4);
  308|       |        see5 = rapid_mix(rapid_read64(p + 80) ^ secret[5], rapid_read64(p + 88) ^ see5);
  309|       |        see6 = rapid_mix(rapid_read64(p + 96) ^ secret[6], rapid_read64(p + 104) ^ see6);
  310|       |        p += 112;
  311|       |        i -= 112;
  312|       |      }
  313|       |#endif
  314|  99.8k|      seed ^= see1;
  315|  99.8k|      see2 ^= see3;
  316|  99.8k|      see4 ^= see5;
  317|  99.8k|      seed ^= see6;
  318|  99.8k|      see2 ^= see4;
  319|  99.8k|      seed ^= see2;
  320|  99.8k|    }
  321|   101k|    if (i > 16) {
  ------------------
  |  Branch (321:9): [True: 88.7k, False: 12.6k]
  ------------------
  322|  88.7k|      seed = rapid_mix(rapid_read64(p) ^ secret[2], rapid_read64(p + 8) ^ seed);
  323|  88.7k|      if (i > 32) {
  ------------------
  |  Branch (323:11): [True: 85.9k, False: 2.84k]
  ------------------
  324|  85.9k|          seed = rapid_mix(rapid_read64(p + 16) ^ secret[2], rapid_read64(p + 24) ^ seed);
  325|  85.9k|          if (i > 48) {
  ------------------
  |  Branch (325:15): [True: 84.1k, False: 1.78k]
  ------------------
  326|  84.1k|              seed = rapid_mix(rapid_read64(p + 32) ^ secret[1], rapid_read64(p + 40) ^ seed);
  327|  84.1k|              if (i > 64) {
  ------------------
  |  Branch (327:19): [True: 4.76k, False: 79.3k]
  ------------------
  328|  4.76k|                  seed = rapid_mix(rapid_read64(p + 48) ^ secret[1], rapid_read64(p + 56) ^ seed);
  329|  4.76k|                  if (i > 80) {
  ------------------
  |  Branch (329:23): [True: 3.07k, False: 1.69k]
  ------------------
  330|  3.07k|                      seed = rapid_mix(rapid_read64(p + 64) ^ secret[2], rapid_read64(p + 72) ^ seed);
  331|  3.07k|                      if (i > 96) {
  ------------------
  |  Branch (331:27): [True: 1.49k, False: 1.57k]
  ------------------
  332|  1.49k|                          seed = rapid_mix(rapid_read64(p + 80) ^ secret[1], rapid_read64(p + 88) ^ seed);
  333|  1.49k|                      }
  334|  3.07k|                  }
  335|  4.76k|              }
  336|  84.1k|          }
  337|  85.9k|      }
  338|  88.7k|    }
  339|   101k|    a=rapid_read64(p+i-16) ^ i;  b=rapid_read64(p+i-8);
  340|   101k|  }
  341|   101k|  a ^= secret[1];
  342|   101k|  b ^= seed;
  343|   101k|  rapid_mum(&a, &b);
  344|   101k|  return rapid_mix(a ^ secret[7], b ^ secret[1] ^ i);
  345|   101k|}
zxc_decompress.c:rapid_mix:
  209|  60.2M|  RAPIDHASH_INLINE_CONSTEXPR uint64_t rapid_mix(uint64_t A, uint64_t B) RAPIDHASH_NOEXCEPT { rapid_mum(&A,&B); return A^B; }
zxc_decompress.c:rapid_read64:
  215|   120M| RAPIDHASH_INLINE uint64_t rapid_read64(const uint8_t *p) RAPIDHASH_NOEXCEPT { uint64_t v; memcpy(&v, p, sizeof(uint64_t)); return v;}
zxc_decompress.c:rapid_read32:
  216|     44| RAPIDHASH_INLINE uint64_t rapid_read32(const uint8_t *p) RAPIDHASH_NOEXCEPT { uint32_t v; memcpy(&v, p, sizeof(uint32_t)); return v;}
zxc_decompress.c:rapid_mum:
  157|  60.3M| RAPIDHASH_INLINE_CONSTEXPR void rapid_mum(uint64_t *A, uint64_t *B) RAPIDHASH_NOEXCEPT {
  158|  60.3M| #if defined(__SIZEOF_INT128__)
  159|  60.3M|   __uint128_t r=*A; r*=*B;
  160|       |   #ifdef RAPIDHASH_PROTECTED
  161|       |   *A^=(uint64_t)r; *B^=(uint64_t)(r>>64);
  162|       |   #else
  163|  60.3M|   *A=(uint64_t)r; *B=(uint64_t)(r>>64);
  164|  60.3M|   #endif
  165|       | #elif defined(_MSC_VER) && (defined(_WIN64) || defined(_M_HYBRID_CHPE_ARM64))
  166|       |   #if defined(_M_X64)
  167|       |     #ifdef RAPIDHASH_PROTECTED
  168|       |     uint64_t a, b;
  169|       |     a=_umul128(*A,*B,&b);
  170|       |     *A^=a;  *B^=b;
  171|       |     #else
  172|       |     *A=_umul128(*A,*B,B);
  173|       |     #endif
  174|       |   #else
  175|       |     #ifdef RAPIDHASH_PROTECTED
  176|       |     uint64_t a, b;
  177|       |     b = __umulh(*A, *B);
  178|       |     a = *A * *B;
  179|       |     *A^=a;  *B^=b;
  180|       |     #else
  181|       |     uint64_t c = __umulh(*A, *B);
  182|       |     *A = *A * *B;
  183|       |     *B = c;
  184|       |     #endif
  185|       |   #endif
  186|       | #else
  187|       |   uint64_t ha=*A>>32, hb=*B>>32, la=(uint32_t)*A, lb=(uint32_t)*B;
  188|       |   uint64_t rh=ha*hb, rm0=ha*lb, rm1=hb*la, rl=la*lb, t=rl+(rm0<<32), c=t<rl;
  189|       |   uint64_t lo=t+(rm1<<32); 
  190|       |   c+=lo<t; 
  191|       |   uint64_t hi=rh+(rm0>>32)+(rm1>>32)+c;
  192|       |   #ifdef RAPIDHASH_PROTECTED
  193|       |   *A^=lo;  *B^=hi;
  194|       |   #else
  195|       |   *A=lo;  *B=hi;
  196|       |   #endif
  197|       | #endif
  198|  60.3M| }
zxc_dict.c:rapidhash_withSeed:
  487|  19.4k|RAPIDHASH_INLINE_CONSTEXPR uint64_t rapidhash_withSeed(const void *key, size_t len, uint64_t seed) RAPIDHASH_NOEXCEPT {
  488|  19.4k|  return rapidhash_internal(key, len, seed, rapid_secret);
  489|  19.4k|}
zxc_dict.c:rapidhash_internal:
  244|  19.4k|RAPIDHASH_INLINE_CONSTEXPR uint64_t rapidhash_internal(const void *key, size_t len, uint64_t seed, const uint64_t* secret) RAPIDHASH_NOEXCEPT {
  245|  19.4k|  const uint8_t *p=(const uint8_t *)key;
  246|  19.4k|  seed ^= rapid_mix(seed ^ secret[2], secret[1]);
  247|  19.4k|  uint64_t a=0, b=0;
  248|  19.4k|  size_t i = len;
  249|  19.4k|  if (_likely_(len <= 16)) {
  ------------------
  |  |  107|  19.4k| # define _likely_(x)  __builtin_expect(x,1)
  |  |  ------------------
  |  |  |  Branch (107:24): [True: 2.52k, False: 16.9k]
  |  |  ------------------
  ------------------
  250|  2.52k|    if (len >= 4) {
  ------------------
  |  Branch (250:9): [True: 2.36k, False: 164]
  ------------------
  251|  2.36k|      seed ^= len;
  252|  2.36k|      if (len >= 8) {
  ------------------
  |  Branch (252:11): [True: 1.75k, False: 606]
  ------------------
  253|  1.75k|        const uint8_t* plast = p + len - 8;
  254|  1.75k|        a = rapid_read64(p);
  255|  1.75k|        b = rapid_read64(plast);
  256|  1.75k|      } else {
  257|    606|        const uint8_t* plast = p + len - 4;
  258|    606|        a = rapid_read32(p);
  259|    606|        b = rapid_read32(plast);
  260|    606|      }
  261|  2.36k|    } else if (len > 0) {
  ------------------
  |  Branch (261:16): [True: 164, False: 0]
  ------------------
  262|    164|      a = (((uint64_t)p[0])<<45)|p[len-1];
  263|    164|      b = p[len>>1];
  264|    164|    } else
  265|      0|      a = b = 0;
  266|  16.9k|  } else {
  267|  16.9k|    if (len > 112) {
  ------------------
  |  Branch (267:9): [True: 14.2k, False: 2.70k]
  ------------------
  268|  14.2k|      uint64_t see1 = seed, see2 = seed;
  269|  14.2k|      uint64_t see3 = seed, see4 = seed;
  270|  14.2k|      uint64_t see5 = seed, see6 = seed;
  271|  14.2k|#ifdef RAPIDHASH_COMPACT
  272|   990k|      do {
  273|   990k|        seed = rapid_mix(rapid_read64(p) ^ secret[0], rapid_read64(p + 8) ^ seed);
  274|   990k|        see1 = rapid_mix(rapid_read64(p + 16) ^ secret[1], rapid_read64(p + 24) ^ see1);
  275|   990k|        see2 = rapid_mix(rapid_read64(p + 32) ^ secret[2], rapid_read64(p + 40) ^ see2);
  276|   990k|        see3 = rapid_mix(rapid_read64(p + 48) ^ secret[3], rapid_read64(p + 56) ^ see3);
  277|   990k|        see4 = rapid_mix(rapid_read64(p + 64) ^ secret[4], rapid_read64(p + 72) ^ see4);
  278|   990k|        see5 = rapid_mix(rapid_read64(p + 80) ^ secret[5], rapid_read64(p + 88) ^ see5);
  279|   990k|        see6 = rapid_mix(rapid_read64(p + 96) ^ secret[6], rapid_read64(p + 104) ^ see6);
  280|   990k|        p += 112;
  281|   990k|        i -= 112;
  282|   990k|      } while(i > 112);
  ------------------
  |  Branch (282:15): [True: 976k, False: 14.2k]
  ------------------
  283|       |#else
  284|       |      while (i > 224) {
  285|       |        seed = rapid_mix(rapid_read64(p) ^ secret[0], rapid_read64(p + 8) ^ seed);
  286|       |        see1 = rapid_mix(rapid_read64(p + 16) ^ secret[1], rapid_read64(p + 24) ^ see1);
  287|       |        see2 = rapid_mix(rapid_read64(p + 32) ^ secret[2], rapid_read64(p + 40) ^ see2);
  288|       |        see3 = rapid_mix(rapid_read64(p + 48) ^ secret[3], rapid_read64(p + 56) ^ see3);
  289|       |        see4 = rapid_mix(rapid_read64(p + 64) ^ secret[4], rapid_read64(p + 72) ^ see4);
  290|       |        see5 = rapid_mix(rapid_read64(p + 80) ^ secret[5], rapid_read64(p + 88) ^ see5);
  291|       |        see6 = rapid_mix(rapid_read64(p + 96) ^ secret[6], rapid_read64(p + 104) ^ see6);
  292|       |        seed = rapid_mix(rapid_read64(p + 112) ^ secret[0], rapid_read64(p + 120) ^ seed);
  293|       |        see1 = rapid_mix(rapid_read64(p + 128) ^ secret[1], rapid_read64(p + 136) ^ see1);
  294|       |        see2 = rapid_mix(rapid_read64(p + 144) ^ secret[2], rapid_read64(p + 152) ^ see2);
  295|       |        see3 = rapid_mix(rapid_read64(p + 160) ^ secret[3], rapid_read64(p + 168) ^ see3);
  296|       |        see4 = rapid_mix(rapid_read64(p + 176) ^ secret[4], rapid_read64(p + 184) ^ see4);
  297|       |        see5 = rapid_mix(rapid_read64(p + 192) ^ secret[5], rapid_read64(p + 200) ^ see5);
  298|       |        see6 = rapid_mix(rapid_read64(p + 208) ^ secret[6], rapid_read64(p + 216) ^ see6);
  299|       |        p += 224;
  300|       |        i -= 224;
  301|       |      }
  302|       |      if (i > 112) {
  303|       |        seed = rapid_mix(rapid_read64(p) ^ secret[0], rapid_read64(p + 8) ^ seed);
  304|       |        see1 = rapid_mix(rapid_read64(p + 16) ^ secret[1], rapid_read64(p + 24) ^ see1);
  305|       |        see2 = rapid_mix(rapid_read64(p + 32) ^ secret[2], rapid_read64(p + 40) ^ see2);
  306|       |        see3 = rapid_mix(rapid_read64(p + 48) ^ secret[3], rapid_read64(p + 56) ^ see3);
  307|       |        see4 = rapid_mix(rapid_read64(p + 64) ^ secret[4], rapid_read64(p + 72) ^ see4);
  308|       |        see5 = rapid_mix(rapid_read64(p + 80) ^ secret[5], rapid_read64(p + 88) ^ see5);
  309|       |        see6 = rapid_mix(rapid_read64(p + 96) ^ secret[6], rapid_read64(p + 104) ^ see6);
  310|       |        p += 112;
  311|       |        i -= 112;
  312|       |      }
  313|       |#endif
  314|  14.2k|      seed ^= see1;
  315|  14.2k|      see2 ^= see3;
  316|  14.2k|      see4 ^= see5;
  317|  14.2k|      seed ^= see6;
  318|  14.2k|      see2 ^= see4;
  319|  14.2k|      seed ^= see2;
  320|  14.2k|    }
  321|  16.9k|    if (i > 16) {
  ------------------
  |  Branch (321:9): [True: 15.3k, False: 1.54k]
  ------------------
  322|  15.3k|      seed = rapid_mix(rapid_read64(p) ^ secret[2], rapid_read64(p + 8) ^ seed);
  323|  15.3k|      if (i > 32) {
  ------------------
  |  Branch (323:11): [True: 6.43k, False: 8.93k]
  ------------------
  324|  6.43k|          seed = rapid_mix(rapid_read64(p + 16) ^ secret[2], rapid_read64(p + 24) ^ seed);
  325|  6.43k|          if (i > 48) {
  ------------------
  |  Branch (325:15): [True: 5.21k, False: 1.22k]
  ------------------
  326|  5.21k|              seed = rapid_mix(rapid_read64(p + 32) ^ secret[1], rapid_read64(p + 40) ^ seed);
  327|  5.21k|              if (i > 64) {
  ------------------
  |  Branch (327:19): [True: 3.80k, False: 1.40k]
  ------------------
  328|  3.80k|                  seed = rapid_mix(rapid_read64(p + 48) ^ secret[1], rapid_read64(p + 56) ^ seed);
  329|  3.80k|                  if (i > 80) {
  ------------------
  |  Branch (329:23): [True: 2.61k, False: 1.19k]
  ------------------
  330|  2.61k|                      seed = rapid_mix(rapid_read64(p + 64) ^ secret[2], rapid_read64(p + 72) ^ seed);
  331|  2.61k|                      if (i > 96) {
  ------------------
  |  Branch (331:27): [True: 1.01k, False: 1.60k]
  ------------------
  332|  1.01k|                          seed = rapid_mix(rapid_read64(p + 80) ^ secret[1], rapid_read64(p + 88) ^ seed);
  333|  1.01k|                      }
  334|  2.61k|                  }
  335|  3.80k|              }
  336|  5.21k|          }
  337|  6.43k|      }
  338|  15.3k|    }
  339|  16.9k|    a=rapid_read64(p+i-16) ^ i;  b=rapid_read64(p+i-8);
  340|  16.9k|  }
  341|  19.4k|  a ^= secret[1];
  342|  19.4k|  b ^= seed;
  343|  19.4k|  rapid_mum(&a, &b);
  344|  19.4k|  return rapid_mix(a ^ secret[7], b ^ secret[1] ^ i);
  345|  19.4k|}
zxc_dict.c:rapid_mix:
  209|  7.00M|  RAPIDHASH_INLINE_CONSTEXPR uint64_t rapid_mix(uint64_t A, uint64_t B) RAPIDHASH_NOEXCEPT { rapid_mum(&A,&B); return A^B; }
zxc_dict.c:rapid_read64:
  215|  13.9M| RAPIDHASH_INLINE uint64_t rapid_read64(const uint8_t *p) RAPIDHASH_NOEXCEPT { uint64_t v; memcpy(&v, p, sizeof(uint64_t)); return v;}
zxc_dict.c:rapid_read32:
  216|  1.21k| RAPIDHASH_INLINE uint64_t rapid_read32(const uint8_t *p) RAPIDHASH_NOEXCEPT { uint32_t v; memcpy(&v, p, sizeof(uint32_t)); return v;}
zxc_dict.c:rapid_mum:
  157|  7.02M| RAPIDHASH_INLINE_CONSTEXPR void rapid_mum(uint64_t *A, uint64_t *B) RAPIDHASH_NOEXCEPT {
  158|  7.02M| #if defined(__SIZEOF_INT128__)
  159|  7.02M|   __uint128_t r=*A; r*=*B;
  160|       |   #ifdef RAPIDHASH_PROTECTED
  161|       |   *A^=(uint64_t)r; *B^=(uint64_t)(r>>64);
  162|       |   #else
  163|  7.02M|   *A=(uint64_t)r; *B=(uint64_t)(r>>64);
  164|  7.02M|   #endif
  165|       | #elif defined(_MSC_VER) && (defined(_WIN64) || defined(_M_HYBRID_CHPE_ARM64))
  166|       |   #if defined(_M_X64)
  167|       |     #ifdef RAPIDHASH_PROTECTED
  168|       |     uint64_t a, b;
  169|       |     a=_umul128(*A,*B,&b);
  170|       |     *A^=a;  *B^=b;
  171|       |     #else
  172|       |     *A=_umul128(*A,*B,B);
  173|       |     #endif
  174|       |   #else
  175|       |     #ifdef RAPIDHASH_PROTECTED
  176|       |     uint64_t a, b;
  177|       |     b = __umulh(*A, *B);
  178|       |     a = *A * *B;
  179|       |     *A^=a;  *B^=b;
  180|       |     #else
  181|       |     uint64_t c = __umulh(*A, *B);
  182|       |     *A = *A * *B;
  183|       |     *B = c;
  184|       |     #endif
  185|       |   #endif
  186|       | #else
  187|       |   uint64_t ha=*A>>32, hb=*B>>32, la=(uint32_t)*A, lb=(uint32_t)*B;
  188|       |   uint64_t rh=ha*hb, rm0=ha*lb, rm1=hb*la, rl=la*lb, t=rl+(rm0<<32), c=t<rl;
  189|       |   uint64_t lo=t+(rm1<<32); 
  190|       |   c+=lo<t; 
  191|       |   uint64_t hi=rh+(rm0>>32)+(rm1>>32)+c;
  192|       |   #ifdef RAPIDHASH_PROTECTED
  193|       |   *A^=lo;  *B^=hi;
  194|       |   #else
  195|       |   *A=lo;  *B=hi;
  196|       |   #endif
  197|       | #endif
  198|  7.02M| }

zxc_cctx_init_in_workspace:
  243|  60.0k|                               const int defer_entropy_scratch) {
  244|  60.0k|    if (UNLIKELY(!ctx || !workspace || chunk_size == 0)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  152|   240k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 60.0k]
  |  |  |  Branch (152:42): [True: 0, False: 60.0k]
  |  |  |  Branch (152:42): [True: 0, False: 60.0k]
  |  |  |  Branch (152:42): [True: 0, False: 60.0k]
  |  |  ------------------
  ------------------
  245|       |
  246|  60.0k|    const zxc_cctx_layout_t layout =
  247|  60.0k|        compute_cctx_layout(chunk_size, mode, level, dict_size, defer_entropy_scratch);
  248|  60.0k|    if (UNLIKELY(workspace_size < layout.total)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  60.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 60.0k]
  |  |  ------------------
  ------------------
  249|       |
  250|  60.0k|    ZXC_MEMSET(ctx, 0, sizeof(zxc_cctx_t));
  ------------------
  |  |  173|  60.0k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  251|  60.0k|    ctx->checksum_enabled = checksum_enabled;
  252|  60.0k|    ctx->chunk_size = chunk_size;
  253|  60.0k|    const uint32_t offset_bits = zxc_log2_u32((uint32_t)chunk_size);
  254|  60.0k|    ctx->offset_bits = offset_bits;
  255|  60.0k|    ctx->offset_mask = (uint32_t)((1ULL << offset_bits) - 1);
  256|  60.0k|    ctx->max_epoch = (uint32_t)(1ULL << (32 - offset_bits));
  257|       |
  258|       |    // memory_block stays NULL on the static-init path so zxc_cctx_free does
  259|       |    // not try to free the caller's workspace.  Sub-buffer pointers carry the
  260|       |    // partition; ownership is implicit (the caller owns @p workspace).
  261|  60.0k|    uint8_t* const mem = (uint8_t*)workspace;
  262|       |
  263|       |    // Dictionary concat scratch (both modes); init owns dict_size now so callers
  264|       |    // no longer assign ctx->dict_size after init.
  265|  60.0k|    ctx->dict_size = dict_size;
  266|  60.0k|    if (dict_size > 0) {
  ------------------
  |  Branch (266:9): [True: 34.3k, False: 25.6k]
  ------------------
  267|  34.3k|        ctx->dict_buffer = mem + layout.off_dict;
  268|  34.3k|        ctx->dict_buffer_cap = layout.sz_dict;
  269|  34.3k|        ctx->dict_huf = (zxc_dict_huf_state_t*)(void*)(mem + layout.off_dict_huf);
  270|  34.3k|    }
  271|       |
  272|  60.0k|    if (mode == 0) {
  ------------------
  |  Branch (272:9): [True: 29.9k, False: 30.0k]
  ------------------
  273|  29.9k|        ctx->work_buf = mem + layout.off_work;
  274|  29.9k|        ctx->work_buf_cap = chunk_size + ZXC_DECOMPRESS_TAIL_PAD;
  ------------------
  |  |  372|  29.9k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|  29.9k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|  29.9k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|  29.9k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  29.9k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  29.9k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  29.9k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  342|  29.9k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  275|  29.9k|        ctx->lit_buffer = mem + layout.off_lit_dctx;
  276|  29.9k|        ctx->lit_buffer_cap = chunk_size + ZXC_PAD_SIZE;
  ------------------
  |  |  342|  29.9k|#define ZXC_PAD_SIZE 32
  ------------------
  277|  29.9k|        if (layout.sz_pivco_dctx) {
  ------------------
  |  Branch (277:13): [True: 0, False: 29.9k]
  ------------------
  278|      0|            ctx->tok_buffer = mem + layout.off_tok_dctx;
  279|      0|            ctx->tok_buffer_cap = layout.sz_tok_dctx;
  280|      0|            ctx->pivco_scratch = mem + layout.off_pivco_dctx;
  281|      0|            ctx->pivco_scratch_cap = layout.sz_pivco_dctx;
  282|      0|        }
  283|  29.9k|        return ZXC_OK;
  284|  29.9k|    }
  285|       |
  286|  30.0k|    ctx->hash_table = (uint32_t*)(mem + layout.off_hash_pos);
  287|  30.0k|    ctx->hash_tags = mem + layout.off_hash_tags;
  288|  30.0k|    ctx->chain_table = (uint16_t*)(mem + layout.off_chain);
  289|  30.0k|    ctx->buf_sequences = (uint32_t*)(mem + layout.off_seq_union);
  290|  30.0k|    ctx->buf_offsets = (uint16_t*)(mem + layout.off_seq_union);
  291|  30.0k|    ctx->buf_tokens = mem + layout.off_seq_union + layout.max_seq * sizeof(uint16_t);
  292|  30.0k|    ctx->buf_split = ctx->buf_tokens + layout.max_seq;
  293|  30.0k|    ctx->buf_split_hist = (zxc_spl_match_split_hist_t*)(void*)(mem + layout.off_split_hist);
  294|  30.0k|    ctx->buf_extras = mem + layout.off_extras;
  295|  30.0k|    ctx->literals = mem + layout.off_lit_cctx;
  296|  30.0k|    if (layout.sz_opt) {
  ------------------
  |  Branch (296:9): [True: 12.1k, False: 17.8k]
  ------------------
  297|  12.1k|        ctx->opt_scratch = mem + layout.off_opt;
  298|  12.1k|        ctx->opt_scratch_cap = layout.sz_opt;
  299|  12.1k|    }
  300|       |
  301|  30.0k|    ctx->compression_level = level;
  302|  30.0k|    ctx->epoch = 1;
  303|       |
  304|  30.0k|    ZXC_MEMSET(ctx->hash_table, 0, layout.sz_hash_pos);
  ------------------
  |  |  173|  30.0k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  305|  30.0k|    ZXC_MEMSET(ctx->hash_tags, 0, layout.sz_hash_tags);
  ------------------
  |  |  173|  30.0k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  306|  30.0k|    return ZXC_OK;
  307|  60.0k|}
zxc_dict_snap_size:
  311|  29.9k|size_t zxc_dict_snap_size(const size_t dict_size) {
  312|       |    // List positions are 16-bit.
  313|  29.9k|    if (dict_size < ZXC_LZ_MIN_MATCH_LEN || dict_size > ZXC_DICT_SIZE_MAX) return 0;
  ------------------
  |  |  586|  59.9k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
                  if (dict_size < ZXC_LZ_MIN_MATCH_LEN || dict_size > ZXC_DICT_SIZE_MAX) return 0;
  ------------------
  |  |   94|  16.9k|#define ZXC_DICT_SIZE_MAX ((1U << 16) - 1U)
  ------------------
  |  Branch (313:9): [True: 12.9k, False: 16.9k]
  |  Branch (313:45): [True: 0, False: 16.9k]
  ------------------
  314|  16.9k|    return ZXC_DICT_SNAP_HDR_SIZE + ZXC_DICT_SNAP_TABLES_SIZE + dict_size * sizeof(uint16_t) +
  ------------------
  |  |  309|  16.9k|#define ZXC_DICT_SNAP_HDR_SIZE ((sizeof(zxc_dict_snap_t) + 7) & ~(size_t)7)
  ------------------
                  return ZXC_DICT_SNAP_HDR_SIZE + ZXC_DICT_SNAP_TABLES_SIZE + dict_size * sizeof(uint16_t) +
  ------------------
  |  | 2094|  16.9k|#define ZXC_DICT_SNAP_TABLES_SIZE (ZXC_LZ_HASH_SIZE * (sizeof(uint32_t) + sizeof(uint8_t)))
  |  |  ------------------
  |  |  |  |  580|  16.9k|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  578|  16.9k|#define ZXC_LZ_HASH_BITS 15
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  315|  16.9k|           dict_size;
  316|  29.9k|}
zxc_cctx_init:
  344|  59.9k|                  const int level, const int checksum_enabled, const size_t dict_size) {
  345|       |    // Cleared first, so that zxc_cctx_free is safe after a failure.
  346|  59.9k|    ZXC_MEMSET(ctx, 0, sizeof(*ctx));
  ------------------
  |  |  173|  59.9k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  347|  59.9k|    if (UNLIKELY(chunk_size == 0)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  152|  59.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 59.9k]
  |  |  ------------------
  ------------------
  348|       |    // Heap contexts defer the decode-side entropy scratch to the first entropy
  349|       |    // section; static workspaces must have it already, they may never allocate.
  350|  59.9k|    const int defer_entropy = (mode == 0);
  351|  59.9k|    const size_t total =
  352|  59.9k|        compute_cctx_layout(chunk_size, mode, level, dict_size, defer_entropy).total;
  353|  59.9k|    if (UNLIKELY(total == 0)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  152|  59.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 59.9k]
  |  |  ------------------
  ------------------
  354|       |
  355|  59.9k|    uint8_t* const mem = (uint8_t*)ZXC_ALIGNED_MALLOC(total, ZXC_CACHE_LINE_SIZE);
  ------------------
  |  |  134|  59.9k|#define ZXC_ALIGNED_MALLOC(size, alignment) zxc_aligned_malloc(size, alignment)
  ------------------
  356|  59.9k|    if (UNLIKELY(!mem)) return ZXC_ERROR_MEMORY;
  ------------------
  |  |  152|  59.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 59.9k]
  |  |  ------------------
  ------------------
  357|       |
  358|  59.9k|    const int rc = zxc_cctx_init_in_workspace(ctx, mem, total, chunk_size, mode, level,
  359|  59.9k|                                              checksum_enabled, dict_size, defer_entropy);
  360|  59.9k|    if (UNLIKELY(rc != ZXC_OK)) {
  ------------------
  |  |  152|  59.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 59.9k]
  |  |  ------------------
  ------------------
  361|       |        // LCOV_EXCL_START
  362|      0|        ZXC_ALIGNED_FREE(mem);
  ------------------
  |  |  137|      0|#define ZXC_ALIGNED_FREE(ptr) zxc_aligned_free(ptr)
  ------------------
  363|      0|        return rc;
  364|       |        // LCOV_EXCL_STOP
  365|      0|    }
  366|       |    // Library-owned buffer: record the allocation so zxc_cctx_free frees it.
  367|  59.9k|    ctx->memory_block = mem;
  368|       |    // Allocated with the workspace, so that blocks never allocate.
  369|  59.9k|    if (mode == 1) ctx->dict_snap = zxc_dict_snap_create(dict_size);
  ------------------
  |  Branch (369:9): [True: 29.9k, False: 30.0k]
  ------------------
  370|  59.9k|    return ZXC_OK;
  371|  59.9k|}
zxc_cctx_alloc_entropy_scratch:
  381|  7.42k|int zxc_cctx_alloc_entropy_scratch(zxc_cctx_t* ctx) {
  382|  7.42k|    if (LIKELY(ctx->pivco_scratch)) return ZXC_OK;
  ------------------
  |  |  146|  7.42k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 0, False: 7.42k]
  |  |  ------------------
  ------------------
  383|       |
  384|       |    // Sized for the block the context was carved for, not chunk_size: a reader
  385|       |    // over frames of several block sizes lowers chunk_size per block.
  386|  7.42k|    size_t sz_tok = 0;
  387|  7.42k|    size_t sz_pivco = 0;
  388|  7.42k|    zxc_dctx_entropy_sizes(ctx->work_buf_cap - ZXC_DECOMPRESS_TAIL_PAD, &sz_tok, &sz_pivco);
  ------------------
  |  |  372|  7.42k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|  7.42k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|  7.42k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|  7.42k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  7.42k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  7.42k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  7.42k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  342|  7.42k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  389|  7.42k|    const size_t total = ZXC_ALIGN_CL(sz_tok) + ZXC_ALIGN_CL(sz_pivco);
  ------------------
  |  |  384|  7.42k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  7.42k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  7.42k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  7.42k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  7.42k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  const size_t total = ZXC_ALIGN_CL(sz_tok) + ZXC_ALIGN_CL(sz_pivco);
  ------------------
  |  |  384|  7.42k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  7.42k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  7.42k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  7.42k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  7.42k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  390|       |
  391|  7.42k|    uint8_t* const mem = (uint8_t*)ZXC_ALIGNED_MALLOC(total, ZXC_CACHE_LINE_SIZE);
  ------------------
  |  |  134|  7.42k|#define ZXC_ALIGNED_MALLOC(size, alignment) zxc_aligned_malloc(size, alignment)
  ------------------
  392|  7.42k|    if (UNLIKELY(!mem)) return ZXC_ERROR_MEMORY;  // LCOV_EXCL_LINE
  ------------------
  |  |  152|  7.42k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 7.42k]
  |  |  ------------------
  ------------------
  393|       |
  394|  7.42k|    ctx->entropy_block = mem;
  395|  7.42k|    ctx->tok_buffer = mem;
  396|  7.42k|    ctx->tok_buffer_cap = sz_tok;
  397|  7.42k|    ctx->pivco_scratch = mem + ZXC_ALIGN_CL(sz_tok);
  ------------------
  |  |  384|  7.42k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  7.42k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  7.42k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  7.42k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  7.42k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  398|  7.42k|    ctx->pivco_scratch_cap = sz_pivco;
  399|  7.42k|    return ZXC_OK;
  400|  7.42k|}
zxc_cctx_free:
  408|  59.9k|void zxc_cctx_free(zxc_cctx_t* ctx) {
  409|  59.9k|    if (ctx->memory_block) {
  ------------------
  |  Branch (409:9): [True: 59.9k, False: 1]
  ------------------
  410|  59.9k|        ZXC_ALIGNED_FREE(ctx->memory_block);
  ------------------
  |  |  137|  59.9k|#define ZXC_ALIGNED_FREE(ptr) zxc_aligned_free(ptr)
  ------------------
  411|  59.9k|        ctx->memory_block = NULL;
  412|  59.9k|    }
  413|  59.9k|    if (ctx->entropy_block) {
  ------------------
  |  Branch (413:9): [True: 7.45k, False: 52.5k]
  ------------------
  414|  7.45k|        ZXC_ALIGNED_FREE(ctx->entropy_block);
  ------------------
  |  |  137|  7.45k|#define ZXC_ALIGNED_FREE(ptr) zxc_aligned_free(ptr)
  ------------------
  415|  7.45k|        ctx->entropy_block = NULL;
  416|  7.45k|    }
  417|  59.9k|    ZXC_FREE(ctx->dict_snap);
  ------------------
  |  |   86|  59.9k|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  418|  59.9k|    ctx->dict_snap = NULL;
  419|  59.9k|    ctx->dict_buffer_gen = 0;
  420|       |
  421|  59.9k|    ctx->lit_buffer = NULL;
  422|  59.9k|    ctx->hash_table = NULL;
  423|  59.9k|    ctx->hash_tags = NULL;
  424|  59.9k|    ctx->chain_table = NULL;
  425|  59.9k|    ctx->buf_sequences = NULL;
  426|  59.9k|    ctx->buf_tokens = NULL;
  427|  59.9k|    ctx->buf_offsets = NULL;
  428|  59.9k|    ctx->buf_extras = NULL;
  429|  59.9k|    ctx->buf_split = NULL;
  430|  59.9k|    ctx->buf_split_hist = NULL;
  431|  59.9k|    ctx->literals = NULL;
  432|  59.9k|    ctx->work_buf = NULL;
  433|  59.9k|    ctx->tok_buffer = NULL;
  434|  59.9k|    ctx->pivco_scratch = NULL;
  435|  59.9k|    ctx->opt_scratch = NULL;
  436|  59.9k|    ctx->dict_buffer = NULL;
  437|  59.9k|    ctx->dict_huf = NULL;
  438|       |
  439|  59.9k|    ctx->epoch = 0;
  440|  59.9k|    ctx->lit_buffer_cap = 0;
  441|  59.9k|    ctx->work_buf_cap = 0;
  442|  59.9k|    ctx->tok_buffer_cap = 0;
  443|  59.9k|    ctx->pivco_scratch_cap = 0;
  444|  59.9k|    ctx->opt_scratch_cap = 0;
  445|  59.9k|    ctx->dict_buffer_cap = 0;
  446|  59.9k|    ctx->dict_size = 0;
  447|  59.9k|    ctx->dict_huf_tree_ok = 0;
  448|       |    ctx->lit_freq_acc = NULL;
  449|  59.9k|}
zxc_cctx_attach_dict_huf:
  464|  59.9k|int zxc_cctx_attach_dict_huf(zxc_cctx_t* RESTRICT ctx, const uint8_t* RESTRICT lengths) {
  465|  59.9k|    if (UNLIKELY(!ctx)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  152|  59.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 59.9k]
  |  |  ------------------
  ------------------
  466|  59.9k|    ctx->dict_huf_tree_ok = 0;
  467|  59.9k|    if (!lengths) return ZXC_OK;
  ------------------
  |  Branch (467:9): [True: 59.9k, False: 0]
  ------------------
  468|       |
  469|       |    // Empty (all-zero) table from a low-entropy corpus: treat it as "no shared table".
  470|      0|    int empty = 1;
  471|      0|    for (size_t i = 0; i < ZXC_HUF_TABLE_SIZE; i++) {
  ------------------
  |  |  102|      0|#define ZXC_HUF_TABLE_SIZE 128
  ------------------
  |  Branch (471:24): [True: 0, False: 0]
  ------------------
  472|      0|        if (lengths[i]) {
  ------------------
  |  Branch (472:13): [True: 0, False: 0]
  ------------------
  473|      0|            empty = 0;
  474|      0|            break;
  475|      0|        }
  476|      0|    }
  477|      0|    if (UNLIKELY(empty || !ctx->dict_huf)) return ZXC_OK;
  ------------------
  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  478|       |
  479|       |    // Tree-at-attach: built once, reused by every block.
  480|      0|    const int rc = zxc_huf_dict_tree_build(lengths, &ctx->dict_huf->tree, ctx->dict_huf->codes,
  481|      0|                                           ctx->dict_huf->code_len);
  482|      0|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  483|      0|    ctx->dict_huf_tree_ok = 1;
  484|      0|    return ZXC_OK;
  485|      0|}
zxc_write_file_header:
  499|  18.3k|                          const int has_seek) {
  500|  18.3k|    if (UNLIKELY(dst_capacity < ZXC_FILE_HEADER_SIZE)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  501|       |
  502|  18.3k|    zxc_store_le32(dst, ZXC_MAGIC_WORD);
  ------------------
  |  |  123|  18.3k|#define ZXC_MAGIC_WORD 0x9CB02EF5U
  ------------------
  503|  18.3k|    dst[4] = ZXC_FILE_FORMAT_VERSION;
  ------------------
  |  |  339|  18.3k|#define ZXC_FILE_FORMAT_VERSION 9
  ------------------
  504|       |
  505|       |    // Block size stored as log2 exponent (e.g. 18 = 256 KB)
  506|  18.3k|    dst[5] = (uint8_t)zxc_log2_u32((uint32_t)chunk_size);
  507|       |
  508|  18.3k|    uint8_t flags = has_checksum ? (ZXC_FILE_FLAG_HAS_CHECKSUM | ZXC_CHECKSUM_RAPIDHASH) : 0;
  ------------------
  |  |  396|  12.1k|#define ZXC_FILE_FLAG_HAS_CHECKSUM 0x80U
  ------------------
                  uint8_t flags = has_checksum ? (ZXC_FILE_FLAG_HAS_CHECKSUM | ZXC_CHECKSUM_RAPIDHASH) : 0;
  ------------------
  |  |  463|  12.1k|#define ZXC_CHECKSUM_RAPIDHASH 0
  ------------------
  |  Branch (508:21): [True: 12.1k, False: 6.23k]
  ------------------
  509|  18.3k|    if (has_dict) flags |= ZXC_FILE_FLAG_HAS_DICTIONARY;
  ------------------
  |  |  398|  9.72k|#define ZXC_FILE_FLAG_HAS_DICTIONARY 0x40U
  ------------------
  |  Branch (509:9): [True: 9.72k, False: 8.67k]
  ------------------
  510|  18.3k|    if (has_seek) flags |= ZXC_FILE_FLAG_HAS_SEEK_TABLE;
  ------------------
  |  |  401|  12.2k|#define ZXC_FILE_FLAG_HAS_SEEK_TABLE 0x20U
  ------------------
  |  Branch (510:9): [True: 12.2k, False: 6.17k]
  ------------------
  511|  18.3k|    dst[6] = flags;
  512|       |
  513|       |    // Bytes 7-13: Reserved / Dictionary ID
  514|  18.3k|    ZXC_MEMSET(dst + 7, 0, 7);
  ------------------
  |  |  173|  18.3k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  515|  18.3k|    if (has_dict) zxc_store_le32(dst + 7, dict_id);
  ------------------
  |  Branch (515:9): [True: 9.72k, False: 8.67k]
  ------------------
  516|       |
  517|       |    // Bytes 14-15: Header Checksum (16-bit)
  518|  18.3k|    zxc_file_header_sign(dst);
  519|       |
  520|  18.3k|    return ZXC_FILE_HEADER_SIZE;
  ------------------
  |  |  126|  18.3k|#define ZXC_FILE_HEADER_SIZE 16
  ------------------
  521|  18.3k|}
zxc_read_file_header:
  531|  73.6k|                         int* RESTRICT out_has_seek) {
  532|  73.6k|    if (UNLIKELY(src_size < ZXC_FILE_HEADER_SIZE)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  152|  73.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 1.28k, False: 72.3k]
  |  |  ------------------
  ------------------
  533|  72.3k|    if (UNLIKELY(zxc_le32(src) != ZXC_MAGIC_WORD)) return ZXC_ERROR_BAD_MAGIC;
  ------------------
  |  |  152|  72.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 17.1k, False: 55.2k]
  |  |  ------------------
  ------------------
  534|  55.2k|    if (UNLIKELY(src[4] != ZXC_FILE_FORMAT_VERSION)) return ZXC_ERROR_BAD_VERSION;
  ------------------
  |  |  152|  55.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 22, False: 55.2k]
  |  |  ------------------
  ------------------
  535|       |
  536|  55.2k|    uint8_t temp[ZXC_FILE_HEADER_SIZE];
  537|  55.2k|    ZXC_MEMCPY(temp, src, ZXC_FILE_HEADER_SIZE);
  ------------------
  |  |  168|  55.2k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  538|       |    // Zero out checksum bytes (14-15) before hash check
  539|  55.2k|    temp[14] = 0;
  540|  55.2k|    temp[15] = 0;
  541|       |    // Header checksum (integrity), then the checksum-algorithm id in flags bits 0-3
  542|       |    // (only 0 = RapidHash is defined). It is checked first via short-circuit.
  543|  55.2k|    if (UNLIKELY(zxc_le16(src + 14) != zxc_hash16(temp) ||
  ------------------
  |  |  152|   110k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 36, False: 55.1k]
  |  |  |  Branch (152:42): [True: 34, False: 55.1k]
  |  |  |  Branch (152:42): [True: 2, False: 55.1k]
  |  |  ------------------
  ------------------
  544|  55.2k|                 (src[6] & ZXC_FILE_CHECKSUM_ALGO_MASK) != ZXC_CHECKSUM_RAPIDHASH))
  545|     36|        return ZXC_ERROR_BAD_HEADER;
  546|       |    // Reserved: flag bit 4, bytes 7-13 minus the dict_id (7-10).
  547|  55.1k|    if (UNLIKELY(src[6] & ZXC_FILE_FLAG_RESERVED)) return ZXC_ERROR_BAD_HEADER;
  ------------------
  |  |  152|  55.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 55.1k]
  |  |  ------------------
  ------------------
  548|  55.1k|    uint8_t rsv = 0;
  549|  55.1k|    const int has_dict = (src[6] & ZXC_FILE_FLAG_HAS_DICTIONARY) ? 1 : 0;
  ------------------
  |  |  398|  55.1k|#define ZXC_FILE_FLAG_HAS_DICTIONARY 0x40U
  ------------------
  |  Branch (549:26): [True: 29.1k, False: 26.0k]
  ------------------
  550|   324k|    for (size_t i = has_dict ? 11 : 7; i < 14; i++) rsv |= src[i];
  ------------------
  |  Branch (550:21): [True: 29.1k, False: 26.0k]
  |  Branch (550:40): [True: 269k, False: 55.1k]
  ------------------
  551|  55.1k|    if (UNLIKELY(rsv != 0)) return ZXC_ERROR_BAD_HEADER;
  ------------------
  |  |  152|  55.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 2, False: 55.1k]
  |  |  ------------------
  ------------------
  552|       |
  553|  55.1k|    if (out_block_size) {
  ------------------
  |  Branch (553:9): [True: 55.1k, False: 0]
  ------------------
  554|  55.1k|        const uint8_t code = src[5];
  555|  55.1k|        if (UNLIKELY(code < ZXC_BLOCK_SIZE_MIN_LOG2 || code > ZXC_BLOCK_SIZE_MAX_LOG2))
  ------------------
  |  |  152|   110k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 55.1k]
  |  |  |  Branch (152:42): [True: 0, False: 55.1k]
  |  |  |  Branch (152:42): [True: 0, False: 55.1k]
  |  |  ------------------
  ------------------
  556|      0|            return ZXC_ERROR_BAD_BLOCK_SIZE;
  557|       |        // Exponent encoding: block_size = 2^code  (4 KB - 2 MB)
  558|  55.1k|        *out_block_size = (size_t)1U << code;
  559|  55.1k|    }
  560|  55.1k|    if (out_has_checksum) *out_has_checksum = (src[6] & ZXC_FILE_FLAG_HAS_CHECKSUM) ? 1 : 0;
  ------------------
  |  |  396|  36.7k|#define ZXC_FILE_FLAG_HAS_CHECKSUM 0x80U
  ------------------
  |  Branch (560:9): [True: 36.7k, False: 18.3k]
  |  Branch (560:47): [True: 24.3k, False: 12.4k]
  ------------------
  561|       |    // The flag alone tells whether a dictionary is needed: its id may be 0.
  562|  55.1k|    if (out_has_dict) *out_has_dict = has_dict;
  ------------------
  |  Branch (562:9): [True: 36.7k, False: 18.3k]
  ------------------
  563|  55.1k|    if (out_dict_id) *out_dict_id = has_dict ? zxc_le32(src + 7) : 0;
  ------------------
  |  Branch (563:9): [True: 36.7k, False: 18.3k]
  |  Branch (563:37): [True: 19.4k, False: 17.3k]
  ------------------
  564|  55.1k|    if (out_has_seek) *out_has_seek = (src[6] & ZXC_FILE_FLAG_HAS_SEEK_TABLE) ? 1 : 0;
  ------------------
  |  |  401|  36.7k|#define ZXC_FILE_FLAG_HAS_SEEK_TABLE 0x20U
  ------------------
  |  Branch (564:9): [True: 36.7k, False: 18.3k]
  |  Branch (564:39): [True: 24.4k, False: 12.3k]
  ------------------
  565|       |
  566|  55.1k|    return ZXC_OK;
  567|  55.1k|}
zxc_scan_frame:
  591|  18.3k|                   zxc_frame_info_t* info, size_t* footer_len, int* has_dict) {
  592|  18.3k|    uint8_t h[ZXC_FILE_HEADER_SIZE];
  593|  18.3k|    int rc;
  594|       |    // Too short for a frame: what is left starts the input, its header speaks first.
  595|  18.3k|    if (UNLIKELY(end < ZXC_FRAME_MIN_SIZE)) {
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  596|      0|        const size_t n = end < sizeof(h) ? (size_t)end : sizeof(h);
  ------------------
  |  Branch (596:26): [True: 0, False: 0]
  ------------------
  597|      0|        rc = zxc_scan_read(src, 0, h, n);
  598|      0|        return rc != ZXC_OK ? rc : zxc_short_input_verdict(h, n);
  ------------------
  |  Branch (598:16): [True: 0, False: 0]
  ------------------
  599|      0|    }
  600|  18.3k|    uint8_t tail[ZXC_FOOTER_MAX_SIZE_WITH_DIGEST];  // end > sizeof(tail)
  601|  18.3k|    rc = zxc_scan_read(src, end - sizeof(tail), tail, sizeof(tail));
  602|  18.3k|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  603|  18.3k|    uint64_t dsize = 0;
  604|  18.3k|    uint64_t frame = 0;
  605|  18.3k|    size_t sizes = 0;
  606|  18.3k|    rc = zxc_parse_file_footer(tail + sizeof(tail), sizeof(tail), &dsize, &frame, &sizes);
  607|  18.3k|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  608|  18.3k|    if (UNLIKELY(frame < ZXC_FRAME_MIN_SIZE || frame > end)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  36.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  609|       |
  610|  18.3k|    const uint64_t at = end - frame;
  611|  18.3k|    rc = zxc_scan_read(src, at, h, sizeof(h));
  612|  18.3k|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  613|  18.3k|    const size_t tl = zxc_frame_tail_len(frame);
  614|  18.3k|    rc = zxc_read_frame_info(h, tail + sizeof(tail) - tl, tl, frame, info, footer_len, has_dict);
  615|       |    // Past the first frame, a wrong magic word is a broken container.
  616|  18.3k|    if (UNLIKELY(rc == ZXC_ERROR_BAD_MAGIC && at != 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  617|  18.3k|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  618|  18.3k|    *start = at;
  619|  18.3k|    return ZXC_OK;
  620|  18.3k|}
zxc_scan_container:
  635|  36.8k|                       zxc_container_info_t* info) {
  636|  36.8k|    ZXC_MEMSET(info, 0, sizeof(*info));
  ------------------
  |  |  173|  36.8k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  637|       |    // The first header speaks first, as for a single frame: junk is a bad magic word.
  638|  36.8k|    uint8_t h[ZXC_FILE_HEADER_SIZE];
  639|  36.8k|    const size_t n = src->size < sizeof(h) ? (size_t)src->size : sizeof(h);
  ------------------
  |  Branch (639:22): [True: 1.28k, False: 35.5k]
  ------------------
  640|  36.8k|    size_t chunk = 0;
  641|  36.8k|    int hrc = zxc_scan_read(src, 0, h, n);
  642|  36.8k|    if (hrc == ZXC_OK) hrc = zxc_read_file_header(h, n, &chunk, NULL, NULL, NULL, NULL);
  ------------------
  |  Branch (642:9): [True: 36.8k, False: 0]
  ------------------
  643|  36.8k|    if (UNLIKELY(hrc != ZXC_OK)) return hrc;
  ------------------
  |  |  152|  36.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 18.4k, False: 18.3k]
  |  |  ------------------
  ------------------
  644|       |
  645|  18.3k|    uint64_t end = src->size;
  646|  18.3k|    do {
  647|  18.3k|        zxc_frame_info_t fi;
  648|  18.3k|        uint64_t start = 0;
  649|  18.3k|        int has_dict = 0;
  650|  18.3k|        const int rc = zxc_scan_frame(src, end, &start, &fi, NULL, &has_dict);
  651|  18.3k|        if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  652|  18.3k|        if (UNLIKELY(req_chunk && fi.block_size != req_chunk)) return ZXC_ERROR_BAD_BLOCK_SIZE;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  653|  18.3k|        if (UNLIKELY(fi.decompressed_size > UINT64_MAX - info->dsize))
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  654|      0|            return ZXC_ERROR_CORRUPT_DATA;
  655|  18.3k|        info->dsize += fi.decompressed_size;
  656|  18.3k|        info->frames++;
  657|  18.3k|        info->uses_dict |= has_dict;
  658|  18.3k|        end = start;
  659|  18.3k|    } while (end > 0);
  ------------------
  |  Branch (659:14): [True: 0, False: 18.3k]
  ------------------
  660|  18.3k|    return ZXC_OK;
  661|  18.3k|}
zxc_read_frame_info:
  671|  18.3k|                        int* has_dict) {
  672|  18.3k|    size_t chunk = 0;
  673|  18.3k|    int cs = 0;
  674|  18.3k|    int seek = 0;
  675|  18.3k|    int hd = 0;
  676|  18.3k|    uint32_t did = 0;
  677|  18.3k|    const int hrc =
  678|  18.3k|        zxc_read_file_header(header, ZXC_FILE_HEADER_SIZE, &chunk, &cs, &hd, &did, &seek);
  ------------------
  |  |  126|  18.3k|#define ZXC_FILE_HEADER_SIZE 16
  ------------------
  679|  18.3k|    if (UNLIKELY(hrc != ZXC_OK)) return hrc;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  680|       |
  681|  18.3k|    uint64_t stored = 0;
  682|  18.3k|    uint64_t frame = 0;
  683|  18.3k|    size_t sizes = 0;
  684|  18.3k|    const int frc = zxc_parse_file_footer(tail + tail_len, tail_len, &stored, &frame, &sizes);
  685|  18.3k|    if (UNLIKELY(frc != ZXC_OK)) return frc;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  686|  18.3k|    const size_t flen = sizes + (cs ? (size_t)ZXC_FILE_DIGEST_SIZE : 0U);
  ------------------
  |  |  133|  12.1k|#define ZXC_FILE_DIGEST_SIZE 8
  ------------------
  |  Branch (686:34): [True: 12.1k, False: 6.23k]
  ------------------
  687|       |    // All the frame's bytes are there: a footer longer than they allow is forged.
  688|  18.3k|    if (UNLIKELY(flen > tail_len)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  689|  18.3k|    if (UNLIKELY(frame != total || !zxc_footer_dsize_plausible(stored, chunk, total)))
  ------------------
  |  |  152|  36.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  690|      0|        return ZXC_ERROR_CORRUPT_DATA;
  691|       |
  692|  18.3k|    ZXC_MEMSET(info, 0, sizeof(*info));  // padding too: zxc_frame_info_copy() hands it out
  ------------------
  |  |  173|  18.3k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  693|  18.3k|    info->decompressed_size = stored;
  694|  18.3k|    info->compressed_size = frame;
  695|  18.3k|    info->digest = cs ? zxc_le64(tail + tail_len - flen) : 0;
  ------------------
  |  Branch (695:20): [True: 12.1k, False: 6.23k]
  ------------------
  696|  18.3k|    info->block_size = chunk;
  697|  18.3k|    info->dict_id = did;
  698|  18.3k|    info->format_version = header[4];
  699|  18.3k|    info->has_checksum = (uint8_t)cs;
  700|  18.3k|    info->has_seek_table = (uint8_t)seek;
  701|  18.3k|    if (footer_len) *footer_len = flen;
  ------------------
  |  Branch (701:9): [True: 0, False: 18.3k]
  ------------------
  702|  18.3k|    if (has_dict) *has_dict = hd;
  ------------------
  |  Branch (702:9): [True: 18.3k, False: 0]
  ------------------
  703|  18.3k|    return ZXC_OK;
  704|  18.3k|}
zxc_write_block_header:
  710|   213k|                           const zxc_block_header_t* RESTRICT bh) {
  711|   213k|    if (UNLIKELY(dst_capacity < ZXC_BLOCK_HEADER_SIZE)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|   213k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 213k]
  |  |  ------------------
  ------------------
  712|       |
  713|   213k|    dst[0] = bh->block_type;
  714|   213k|    dst[1] = 0;  // Flags not used currently
  715|   213k|    dst[2] = 0;  // Reserved
  716|   213k|    zxc_store_le32(dst + 3, bh->comp_size);
  717|   213k|    dst[7] = 0;               // Zero before hashing
  718|   213k|    dst[7] = zxc_hash8(dst);  // Checksum at the end
  719|       |
  720|   213k|    return ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  439|   213k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
  721|   213k|}
zxc_read_block_header:
  729|   311k|                          zxc_block_header_t* RESTRICT bh) {
  730|   311k|    if (UNLIKELY(src_size < ZXC_BLOCK_HEADER_SIZE)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  152|   311k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 311k]
  |  |  ------------------
  ------------------
  731|       |
  732|   311k|    if (UNLIKELY(!zxc_block_header_ok(src))) return ZXC_ERROR_BAD_HEADER;
  ------------------
  |  |  152|   311k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 311k]
  |  |  ------------------
  ------------------
  733|       |
  734|   311k|    bh->block_type = src[0];
  735|   311k|    bh->block_flags = src[1];
  736|   311k|    bh->reserved = src[2];
  737|   311k|    bh->comp_size = zxc_le32(src + 3);
  738|   311k|    bh->header_checksum = src[7];
  739|       |
  740|   311k|    return ZXC_OK;
  741|   311k|}
zxc_seek_table_header:
  760|  24.4k|int zxc_seek_table_header(uint8_t* dst, const size_t dst_capacity, const uint64_t num_blocks) {
  761|       |    // The field keeps the table size modulo 2^32; readers derive the count from the footer.
  762|  24.4k|    const zxc_block_header_t bh = {
  763|  24.4k|        .block_type = ZXC_BLOCK_SEK,
  764|  24.4k|        .block_flags = 0,
  765|  24.4k|        .reserved = 0,
  766|  24.4k|        .comp_size = zxc_seek_size_field(zxc_seek_table_bytes(num_blocks))};
  767|  24.4k|    return zxc_write_block_header(dst, dst_capacity, &bh);
  768|  24.4k|}
zxc_check_eof_header:
  770|  18.3k|int zxc_check_eof_header(const uint8_t* hdr) {
  771|  18.3k|    const zxc_block_header_t eof = {
  772|  18.3k|        .block_type = ZXC_BLOCK_EOF, .block_flags = 0, .reserved = 0, .comp_size = 0};
  773|  18.3k|    uint8_t want[ZXC_BLOCK_HEADER_SIZE];
  774|  18.3k|    if (UNLIKELY(zxc_write_block_header(want, sizeof(want), &eof) < 0))
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  775|      0|        return ZXC_ERROR_BAD_HEADER;  // LCOV_EXCL_LINE
  776|  18.3k|    return memcmp(hdr, want, sizeof(want)) == 0 ? ZXC_OK : ZXC_ERROR_BAD_HEADER;
  ------------------
  |  Branch (776:12): [True: 18.3k, False: 0]
  ------------------
  777|  18.3k|}
zxc_check_seek_header:
  780|  12.2k|                          const size_t block_size, uint64_t* sek_bytes) {
  781|  12.2k|    const uint64_t n = zxc_seek_block_count(total_out, block_size);
  782|  12.2k|    uint8_t want[ZXC_BLOCK_HEADER_SIZE];
  783|  12.2k|    if (UNLIKELY(zxc_seek_table_header(want, sizeof(want), n) < 0))
  ------------------
  |  |  152|  12.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 12.2k]
  |  |  ------------------
  ------------------
  784|      0|        return ZXC_ERROR_CORRUPT_DATA;  // LCOV_EXCL_LINE
  785|  12.2k|    const size_t m = avail < sizeof(want) ? avail : sizeof(want);
  ------------------
  |  Branch (785:22): [True: 0, False: 12.2k]
  ------------------
  786|  12.2k|    if (memcmp(hdr, want, m) != 0) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  Branch (786:9): [True: 0, False: 12.2k]
  ------------------
  787|  12.2k|    if (avail < sizeof(want)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  Branch (787:9): [True: 0, False: 12.2k]
  ------------------
  788|  12.2k|    if (sek_bytes) *sek_bytes = zxc_seek_table_bytes(n);
  ------------------
  |  Branch (788:9): [True: 12.2k, False: 0]
  ------------------
  789|  12.2k|    return ZXC_OK;
  790|  12.2k|}
zxc_seek_write_group:
  793|  12.9k|                            const uint32_t* RESTRICT sizes, const uint32_t cnt) {
  794|  12.9k|    zxc_store_le64(dst, *anchor);
  795|  12.9k|    uint8_t* p = dst + ZXC_SEEK_ANCHOR_SIZE;
  ------------------
  |  |  476|  12.9k|#define ZXC_SEEK_ANCHOR_SIZE 8U
  ------------------
  796|   120k|    for (uint32_t k = 0; k < cnt; k++, p += ZXC_SEEK_SIZE_ENTRY) {
  ------------------
  |  |  478|   107k|#define ZXC_SEEK_SIZE_ENTRY 4U
  ------------------
  |  Branch (796:26): [True: 107k, False: 12.9k]
  ------------------
  797|   107k|        zxc_store_le32(p, sizes[k]);
  798|   107k|        *anchor += sizes[k];
  799|   107k|    }
  800|  12.9k|    return (size_t)(p - dst);
  801|  12.9k|}
zxc_write_file_footer:
  856|  18.3k|                          const int checksum_enabled) {
  857|  18.3k|    const zxc_footer_layout_t l = zxc_footer_layout(prefix, src_size, checksum_enabled);
  858|  18.3k|    if (UNLIKELY(dst_capacity < l.len)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  859|  18.3k|    zxc_encode_footer(dst, &l, src_size, digest);
  860|  18.3k|    return (int)l.len;
  861|  18.3k|}
zxc_check_file_footer:
  870|  18.3k|                          const uint64_t src_size, uint64_t* digest) {
  871|  18.3k|    uint8_t want[ZXC_FOOTER_MAX_SIZE_WITH_DIGEST];
  872|  18.3k|    zxc_encode_footer(want, l, src_size, 0);
  873|  18.3k|    const size_t n = avail < l->len ? avail : l->len;
  ------------------
  |  Branch (873:22): [True: 0, False: 18.3k]
  ------------------
  874|  18.3k|    if (n > l->skip && memcmp(footer + l->skip, want + l->skip, n - l->skip) != 0)
  ------------------
  |  Branch (874:9): [True: 18.3k, False: 0]
  |  Branch (874:24): [True: 0, False: 18.3k]
  ------------------
  875|      0|        return ZXC_ERROR_CORRUPT_DATA;
  876|  18.3k|    if (avail < l->len) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  Branch (876:9): [True: 0, False: 18.3k]
  ------------------
  877|  18.3k|    if (digest) *digest = l->skip ? zxc_le64(footer) : 0;
  ------------------
  |  Branch (877:9): [True: 18.3k, False: 0]
  |  Branch (877:27): [True: 12.1k, False: 6.23k]
  ------------------
  878|  18.3k|    return ZXC_OK;
  879|  18.3k|}
zxc_parse_file_footer:
  888|  36.7k|                          uint64_t* compressed_size, size_t* sizes_len) {
  889|  36.7k|    if (UNLIKELY(avail < ZXC_FILE_FOOTER_MIN_SIZE)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  152|  36.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 36.7k]
  |  |  ------------------
  ------------------
  890|  36.7k|    const uint8_t L = end[-1];
  891|  36.7k|    if (UNLIKELY(L & 0x88U)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  36.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 36.7k]
  |  |  ------------------
  ------------------
  892|  36.7k|    const size_t nd = (size_t)(L & 0x07U) + 1;
  893|  36.7k|    const size_t nf = (size_t)(L >> 4) + 1;
  894|  36.7k|    const size_t need = nd + nf + 1;
  895|  36.7k|    if (UNLIKELY(avail < need)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  152|  36.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 36.7k]
  |  |  ------------------
  ------------------
  896|  36.7k|    const uint64_t d = zxc_load_le_n(end - need, nd);
  897|  36.7k|    const uint64_t f = zxc_load_le_n(end - 1 - nf, nf);
  898|       |    // Minimal lengths: d on exactly nd bytes; f too, and nf the fewest that hold
  899|       |    // the total, which one byte less would not (f counts its own bytes).
  900|  36.7k|    if (UNLIKELY(zxc_uint_bytes(d) != nd || zxc_uint_bytes(f) != nf ||
  ------------------
  |  |  152|   209k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 36.7k]
  |  |  |  Branch (152:42): [True: 0, False: 36.7k]
  |  |  |  Branch (152:42): [True: 0, False: 36.7k]
  |  |  |  Branch (152:42): [True: 25.1k, False: 11.6k]
  |  |  |  Branch (152:42): [True: 0, False: 25.1k]
  |  |  ------------------
  ------------------
  901|  36.7k|                 (nf > 1 && zxc_uint_bytes(f - 1) < nf)))
  902|      0|        return ZXC_ERROR_CORRUPT_DATA;
  903|  36.7k|    *src_size = d;
  904|  36.7k|    *compressed_size = f;
  905|  36.7k|    *sizes_len = need;
  906|  36.7k|    return ZXC_OK;
  907|  36.7k|}
zxc_write_spl_header_and_desc:
  964|   111k|                                  const uint32_t tok_comp) {
  965|   111k|    const size_t desc_sz = zxc_spl_desc_size(gh->enc_lit, gh->enc_tok);
  966|   111k|    const size_t needed = ZXC_SPL_HEADER_BINARY_SIZE + desc_sz;
  ------------------
  |  |  443|   111k|#define ZXC_SPL_HEADER_BINARY_SIZE 12
  ------------------
  967|       |
  968|   111k|    if (UNLIKELY(rem < needed)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|   111k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 111k]
  |  |  ------------------
  ------------------
  969|       |
  970|   111k|    zxc_write_gnr_header(dst, gh);
  971|   111k|    uint8_t* p = dst + ZXC_SPL_HEADER_BINARY_SIZE;
  ------------------
  |  |  443|   111k|#define ZXC_SPL_HEADER_BINARY_SIZE 12
  ------------------
  972|       |
  973|   111k|    if (gh->enc_lit != ZXC_SECTION_ENCODING_RAW) {
  ------------------
  |  Branch (973:9): [True: 69.7k, False: 41.9k]
  ------------------
  974|  69.7k|        zxc_store_le32(p, lit_comp);
  975|  69.7k|        p += sizeof(uint32_t);
  976|  69.7k|    }
  977|   111k|    if (gh->enc_tok == ZXC_SECTION_ENCODING_HUFFMAN) {
  ------------------
  |  Branch (977:9): [True: 41.3k, False: 70.3k]
  ------------------
  978|  41.3k|        zxc_store_le32(p, tok_comp);
  979|  41.3k|    }
  980|       |
  981|   111k|    return (int)needed;
  982|   111k|}
zxc_read_spl_header_and_desc:
  989|   149k|                                 uint32_t* RESTRICT tok_comp) {
  990|   149k|    if (UNLIKELY(len < ZXC_SPL_HEADER_BINARY_SIZE)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  152|   149k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 149k]
  |  |  ------------------
  ------------------
  991|       |
  992|   149k|    zxc_read_gnr_header(src, gh);
  993|       |
  994|   149k|    const size_t desc_sz = zxc_spl_desc_size(gh->enc_lit, gh->enc_tok);
  995|   149k|    const size_t needed = ZXC_SPL_HEADER_BINARY_SIZE + desc_sz;
  ------------------
  |  |  443|   149k|#define ZXC_SPL_HEADER_BINARY_SIZE 12
  ------------------
  996|   149k|    if (UNLIKELY(len < needed)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  152|   149k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 149k]
  |  |  ------------------
  ------------------
  997|       |
  998|   149k|    const uint8_t* p = src + ZXC_SPL_HEADER_BINARY_SIZE;
  ------------------
  |  |  443|   149k|#define ZXC_SPL_HEADER_BINARY_SIZE 12
  ------------------
  999|       |
 1000|   149k|    if (gh->enc_lit != ZXC_SECTION_ENCODING_RAW) {
  ------------------
  |  Branch (1000:9): [True: 106k, False: 42.6k]
  ------------------
 1001|   106k|        *lit_comp = zxc_le32(p);
 1002|   106k|        p += sizeof(uint32_t);
 1003|   106k|    } else {
 1004|  42.6k|        *lit_comp = gh->n_literals;
 1005|  42.6k|    }
 1006|   149k|    *tok_comp = (gh->enc_tok == ZXC_SECTION_ENCODING_HUFFMAN) ? zxc_le32(p) : gh->n_sequences;
  ------------------
  |  Branch (1006:17): [True: 82.3k, False: 66.8k]
  ------------------
 1007|       |
 1008|   149k|    return (int)needed;
 1009|   149k|}
zxc_write_pak_header:
 1020|  34.9k|                         const zxc_gnr_header_t* RESTRICT gh) {
 1021|  34.9k|    if (UNLIKELY(rem < ZXC_PAK_HEADER_BINARY_SIZE)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  34.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 34.9k]
  |  |  ------------------
  ------------------
 1022|       |
 1023|  34.9k|    zxc_write_gnr_header(dst, gh);
 1024|  34.9k|    return ZXC_PAK_HEADER_BINARY_SIZE;
  ------------------
  |  |  445|  34.9k|#define ZXC_PAK_HEADER_BINARY_SIZE 12
  ------------------
 1025|  34.9k|}
zxc_read_pak_header:
 1031|  32.6k|                        zxc_gnr_header_t* RESTRICT gh) {
 1032|  32.6k|    if (UNLIKELY(len < ZXC_PAK_HEADER_BINARY_SIZE)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  152|  32.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 32.6k]
  |  |  ------------------
  ------------------
 1033|       |
 1034|  32.6k|    zxc_read_gnr_header(src, gh);
 1035|  32.6k|    return ZXC_OK;
 1036|  32.6k|}
zxc_compress_bound:
 1051|  36.7k|size_t zxc_compress_bound(const size_t input_size) {
 1052|       |    // n <= 2^52 even for a 64-bit size_t, so the overhead sum fits a uint64.
 1053|  36.7k|    uint64_t n = (uint64_t)input_size / ZXC_BLOCK_SIZE_MIN + (input_size % ZXC_BLOCK_SIZE_MIN != 0);
  ------------------
  |  |   73|  36.7k|#define ZXC_BLOCK_SIZE_MIN (1U << ZXC_BLOCK_SIZE_MIN_LOG2)
  |  |  ------------------
  |  |  |  |   67|  36.7k|#define ZXC_BLOCK_SIZE_MIN_LOG2 12
  |  |  ------------------
  ------------------
                  uint64_t n = (uint64_t)input_size / ZXC_BLOCK_SIZE_MIN + (input_size % ZXC_BLOCK_SIZE_MIN != 0);
  ------------------
  |  |   73|  36.7k|#define ZXC_BLOCK_SIZE_MIN (1U << ZXC_BLOCK_SIZE_MIN_LOG2)
  |  |  ------------------
  |  |  |  |   67|  36.7k|#define ZXC_BLOCK_SIZE_MIN_LOG2 12
  |  |  ------------------
  ------------------
 1054|  36.7k|    if (n == 0) n = 1;
  ------------------
  |  Branch (1054:9): [True: 0, False: 36.7k]
  ------------------
 1055|  36.7k|    const uint64_t overhead =
 1056|  36.7k|        ZXC_FILE_HEADER_SIZE +
  ------------------
  |  |  126|  36.7k|#define ZXC_FILE_HEADER_SIZE 16
  ------------------
 1057|  36.7k|        (n * (ZXC_BLOCK_HEADER_SIZE + ZXC_BLOCK_CHECKSUM_SIZE + ZXC_BLOCK_FORMAT_OVERHEAD)) +
  ------------------
  |  |  439|  36.7k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
                      (n * (ZXC_BLOCK_HEADER_SIZE + ZXC_BLOCK_CHECKSUM_SIZE + ZXC_BLOCK_FORMAT_OVERHEAD)) +
  ------------------
  |  |  441|  36.7k|#define ZXC_BLOCK_CHECKSUM_SIZE 4
  ------------------
                      (n * (ZXC_BLOCK_HEADER_SIZE + ZXC_BLOCK_CHECKSUM_SIZE + ZXC_BLOCK_FORMAT_OVERHEAD)) +
  ------------------
  |  |  457|  36.7k|#define ZXC_BLOCK_FORMAT_OVERHEAD 68
  ------------------
 1058|  36.7k|        ZXC_BLOCK_HEADER_SIZE +          /* EOF block */
  ------------------
  |  |  439|  36.7k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 1059|  36.7k|        ZXC_BLOCK_HEADER_SIZE +          /* SEK block header (seekable) */
  ------------------
  |  |  439|  36.7k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 1060|  36.7k|        zxc_seek_table_bytes(n) +        /* SEK groups (seekable) */
 1061|  36.7k|        ZXC_FOOTER_MAX_SIZE_WITH_DIGEST; /* optional digest + footer */
  ------------------
  |  | 2565|  36.7k|#define ZXC_FOOTER_MAX_SIZE_WITH_DIGEST (ZXC_FILE_DIGEST_SIZE + ZXC_FILE_FOOTER_MAX_SIZE)
  |  |  ------------------
  |  |  |  |  133|  36.7k|#define ZXC_FILE_DIGEST_SIZE 8
  |  |  ------------------
  |  |               #define ZXC_FOOTER_MAX_SIZE_WITH_DIGEST (ZXC_FILE_DIGEST_SIZE + ZXC_FILE_FOOTER_MAX_SIZE)
  |  |  ------------------
  |  |  |  |  131|  36.7k|#define ZXC_FILE_FOOTER_MAX_SIZE 17
  |  |  ------------------
  ------------------
 1062|       |    // The bound is a buffer size: input + overhead must fit a size_t.
 1063|  36.7k|    if (UNLIKELY(overhead > (uint64_t)(SIZE_MAX - input_size))) return 0;
  ------------------
  |  |  152|  36.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 36.7k]
  |  |  ------------------
  ------------------
 1064|  36.7k|    return input_size + (size_t)overhead;
 1065|  36.7k|}
zxc_max_level:
 1198|  18.4k|int zxc_max_level(void) { return ZXC_LEVEL_ULTRA; }
zxc_common.c:compute_cctx_layout:
  122|   119k|                                             const int defer_entropy_scratch) {
  123|   119k|    zxc_cctx_layout_t layout = {0};
  124|       |
  125|   119k|    const size_t max_seq = zxc_cctx_max_seq(chunk_size);
  126|       |
  127|   119k|    if (mode == 0) {
  ------------------
  |  Branch (127:9): [True: 59.9k, False: 60.0k]
  ------------------
  128|       |        // Decompress: work_buf + lit_buffer, padded for wild-copy overshoot and
  129|       |        // sized worst-case. lit_buffer is provisioned at every level - the decoder
  130|       |        // cannot predict a block's literal encoding (RAW / RLE / HUFFMAN).
  131|  59.9k|        const size_t sz_work = chunk_size + ZXC_DECOMPRESS_TAIL_PAD;
  ------------------
  |  |  372|  59.9k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|  59.9k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|  59.9k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|  59.9k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  59.9k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  59.9k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  59.9k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  342|  59.9k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  132|  59.9k|        const size_t sz_lit = chunk_size + ZXC_PAD_SIZE;
  ------------------
  |  |  342|  59.9k|#define ZXC_PAD_SIZE 32
  ------------------
  133|       |
  134|  59.9k|        layout.off_work = layout.total;
  135|  59.9k|        layout.total += ZXC_ALIGN_CL(sz_work);
  ------------------
  |  |  384|  59.9k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  59.9k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  59.9k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  59.9k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  59.9k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  136|  59.9k|        layout.off_lit_dctx = layout.total;
  137|  59.9k|        layout.total += ZXC_ALIGN_CL(sz_lit);
  ------------------
  |  |  384|  59.9k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  59.9k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  59.9k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  59.9k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  59.9k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  138|       |        // Token-section decode scratch (level-7 SPL Huffman-codes the tokens) +
  139|       |        // PivCo ping-pong scratch. enc_lit/enc_tok are unpredictable, so static
  140|       |        // workspaces provision both up front (no-alloc contract); heap contexts
  141|       |        // defer them to the first entropy section, sparing L1-5 archives ~1.2x
  142|       |        // chunk_size. See zxc_cctx_alloc_entropy_scratch.
  143|  59.9k|        if (!defer_entropy_scratch) {
  ------------------
  |  Branch (143:13): [True: 0, False: 59.9k]
  ------------------
  144|      0|            size_t sz_tok = 0;
  145|      0|            size_t sz_pivco = 0;
  146|      0|            zxc_dctx_entropy_sizes(chunk_size, &sz_tok, &sz_pivco);
  147|      0|            layout.sz_tok_dctx = sz_tok;
  148|      0|            layout.off_tok_dctx = layout.total;
  149|      0|            layout.total += ZXC_ALIGN_CL(layout.sz_tok_dctx);
  ------------------
  |  |  384|      0|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|      0|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|      0|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|      0|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|      0|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  150|      0|            layout.sz_pivco_dctx = sz_pivco;
  151|      0|            layout.off_pivco_dctx = layout.total;
  152|      0|            layout.total += ZXC_ALIGN_CL(layout.sz_pivco_dctx);
  ------------------
  |  |  384|      0|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|      0|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|      0|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|      0|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|      0|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  153|      0|        }
  154|  60.0k|    } else {
  155|       |        // Compress: 7 partitions + optional opt_scratch at level >= ZXC_LEVEL_DENSITY.
  156|  60.0k|        const uint32_t offset_bits = zxc_log2_u32((uint32_t)chunk_size);
  157|  60.0k|        layout.max_seq = max_seq;
  158|  60.0k|        layout.sz_hash_pos = ZXC_LZ_HASH_SIZE * sizeof(uint32_t);
  ------------------
  |  |  580|  60.0k|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  ------------------
  |  |  |  |  578|  60.0k|#define ZXC_LZ_HASH_BITS 15
  |  |  ------------------
  ------------------
  159|  60.0k|        layout.sz_hash_tags = ZXC_LZ_HASH_SIZE * sizeof(uint8_t);
  ------------------
  |  |  580|  60.0k|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  ------------------
  |  |  |  |  578|  60.0k|#define ZXC_LZ_HASH_BITS 15
  |  |  ------------------
  ------------------
  160|  60.0k|        const size_t sz_chain = ZXC_LZ_WINDOW_SIZE * sizeof(uint16_t);
  ------------------
  |  |  582|  60.0k|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  ------------------
  161|       |        // buf_sequences (PAK, level <= ZXC_LEVEL_FAST) aliases buf_offsets, buf_tokens and
  162|       |        // buf_split (SPL, level >= ZXC_LEVEL_DEFAULT): 4 bytes per sequence either way.
  163|  60.0k|        const size_t sz_seq_union = layout.max_seq * sizeof(uint32_t);
  164|  60.0k|        const size_t vbyte_len = (offset_bits + 6) / 7;
  165|  60.0k|        const size_t sz_extras = layout.max_seq * 2 * vbyte_len;
  166|  60.0k|        const size_t sz_lit = chunk_size + ZXC_PAD_SIZE;
  ------------------
  |  |  342|  60.0k|#define ZXC_PAD_SIZE 32
  ------------------
  167|       |
  168|       |        // opt_scratch (level >= ZXC_LEVEL_DENSITY): the optimal parser's DP arrays,
  169|       |        // reused transiently by the code-length builder and its nudge, so sized to
  170|       |        // the larger demand. Keep in sync with zxc_estimate_cctx_memory() and its
  171|       |        // consumer in zxc_compress.c.
  172|  60.0k|        if (level >= ZXC_LEVEL_DENSITY) {
  ------------------
  |  Branch (172:13): [True: 24.3k, False: 35.6k]
  ------------------
  173|  24.3k|            size_t sz_dp;
  174|  24.3k|            size_t sz_pl;
  175|  24.3k|            size_t sz_po;
  176|  24.3k|            size_t sz_bm;
  177|  24.3k|            zxc_opt_dp_sizes(chunk_size, &sz_dp, &sz_pl, &sz_po, &sz_bm);
  178|  24.3k|            const size_t dp_needed = sz_dp + sz_pl + sz_po + sz_bm;
  179|  24.3k|            layout.sz_opt =
  180|  24.3k|                (dp_needed > ZXC_HUF_NUDGE_SCRATCH_SIZE) ? dp_needed : ZXC_HUF_NUDGE_SCRATCH_SIZE;
  ------------------
  |  | 1119|  24.3k|#define ZXC_HUF_NUDGE_SCRATCH_SIZE (ZXC_HUF_NUDGE_SCRATCH_OFF + sizeof(zxc_huf_nudge_ws_t))
  |  |  ------------------
  |  |  |  | 1117|  24.3k|#define ZXC_HUF_NUDGE_SCRATCH_OFF ZXC_ALIGN_CL(ZXC_HUF_BUILD_SCRATCH_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  384|  24.3k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  382|  24.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  380|  24.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  382|  24.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  380|  24.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                              (dp_needed > ZXC_HUF_NUDGE_SCRATCH_SIZE) ? dp_needed : ZXC_HUF_NUDGE_SCRATCH_SIZE;
  ------------------
  |  | 1119|  41.7k|#define ZXC_HUF_NUDGE_SCRATCH_SIZE (ZXC_HUF_NUDGE_SCRATCH_OFF + sizeof(zxc_huf_nudge_ws_t))
  |  |  ------------------
  |  |  |  | 1117|  17.3k|#define ZXC_HUF_NUDGE_SCRATCH_OFF ZXC_ALIGN_CL(ZXC_HUF_BUILD_SCRATCH_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  384|  17.3k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  382|  17.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  380|  17.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  382|  17.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  380|  17.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (180:17): [True: 6.97k, False: 17.3k]
  ------------------
  181|  24.3k|        }
  182|       |
  183|  60.0k|        layout.off_hash_pos = layout.total;
  184|  60.0k|        layout.total += ZXC_ALIGN_CL(layout.sz_hash_pos);
  ------------------
  |  |  384|  60.0k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  60.0k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  60.0k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  60.0k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  60.0k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  185|  60.0k|        layout.off_hash_tags = layout.total;
  186|  60.0k|        layout.total += ZXC_ALIGN_CL(layout.sz_hash_tags);
  ------------------
  |  |  384|  60.0k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  60.0k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  60.0k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  60.0k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  60.0k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  187|  60.0k|        layout.off_chain = layout.total;
  188|  60.0k|        layout.total += ZXC_ALIGN_CL(sz_chain);
  ------------------
  |  |  384|  60.0k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  60.0k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  60.0k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  60.0k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  60.0k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  189|  60.0k|        layout.off_seq_union = layout.total;
  190|  60.0k|        layout.total += ZXC_ALIGN_CL(sz_seq_union);
  ------------------
  |  |  384|  60.0k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  60.0k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  60.0k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  60.0k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  60.0k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  191|  60.0k|        layout.off_split_hist = layout.total;
  192|  60.0k|        layout.total += ZXC_ALIGN_CL(sizeof(zxc_spl_match_split_hist_t));
  ------------------
  |  |  384|  60.0k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  60.0k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  60.0k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  60.0k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  60.0k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  193|  60.0k|        layout.off_extras = layout.total;
  194|  60.0k|        layout.total += ZXC_ALIGN_CL(sz_extras);
  ------------------
  |  |  384|  60.0k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  60.0k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  60.0k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  60.0k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  60.0k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  195|  60.0k|        layout.off_lit_cctx = layout.total;
  196|  60.0k|        layout.total += ZXC_ALIGN_CL(sz_lit);
  ------------------
  |  |  384|  60.0k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  60.0k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  60.0k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  60.0k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  60.0k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  197|       |        // opt_scratch is appended last so it is absent for levels 1..5 (zero
  198|       |        // waste on the common path) and only inflates the workspace at level 6.
  199|  60.0k|        if (layout.sz_opt) {
  ------------------
  |  Branch (199:13): [True: 24.3k, False: 35.6k]
  ------------------
  200|  24.3k|            layout.off_opt = layout.total;
  201|  24.3k|            layout.total += ZXC_ALIGN_CL(layout.sz_opt);
  ------------------
  |  |  384|  24.3k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  24.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  24.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  24.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  24.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  202|  24.3k|        }
  203|  60.0k|    }
  204|       |
  205|       |    // [dict | data] concat scratch (dict only). Compress chunk_size already
  206|       |    // spans [dict | block]; decompress prepends dict to a (chunk + PAD) region.
  207|   119k|    if (dict_size > 0) {
  ------------------
  |  Branch (207:9): [True: 68.7k, False: 51.2k]
  ------------------
  208|  68.7k|        layout.sz_dict = (mode == 1) ? (chunk_size + ZXC_DECOMPRESS_TAIL_PAD)
  ------------------
  |  |  372|  34.3k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|  34.3k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|  34.3k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|  34.3k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  34.3k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  34.3k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  34.3k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  342|  34.3k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  |  Branch (208:26): [True: 34.3k, False: 34.3k]
  ------------------
  209|  68.7k|                                     : (dict_size + chunk_size + ZXC_DECOMPRESS_TAIL_PAD);
  ------------------
  |  |  372|  34.3k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|  34.3k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|  34.3k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|  34.3k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  34.3k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  34.3k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  34.3k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  342|  34.3k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  210|  68.7k|        layout.off_dict = layout.total;
  211|  68.7k|        layout.total += ZXC_ALIGN_CL(layout.sz_dict);
  ------------------
  |  |  384|  68.7k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  68.7k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  68.7k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  68.7k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  68.7k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  212|  68.7k|        layout.off_dict_huf = layout.total;
  213|  68.7k|        layout.total += ZXC_ALIGN_CL(sizeof(zxc_dict_huf_state_t));
  ------------------
  |  |  384|  68.7k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  68.7k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  68.7k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  68.7k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  68.7k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  214|  68.7k|    }
  215|   119k|    return layout;
  216|   119k|}
zxc_common.c:zxc_cctx_max_seq:
   74|   127k|static ZXC_ALWAYS_INLINE size_t zxc_cctx_max_seq(const size_t chunk_size) {
   75|   127k|    return chunk_size / ZXC_LZ_MIN_MATCH_LEN + 16;
  ------------------
  |  |  586|   127k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
   76|   127k|}
zxc_common.c:zxc_dict_snap_create:
  319|  29.9k|static zxc_dict_snap_t* zxc_dict_snap_create(const size_t dict_size) {
  320|  29.9k|    const size_t total = zxc_dict_snap_size(dict_size);
  321|  29.9k|    if (total == 0) return NULL;
  ------------------
  |  Branch (321:9): [True: 12.9k, False: 16.9k]
  ------------------
  322|  16.9k|    uint8_t* const mem = (uint8_t*)ZXC_MALLOC(total);
  ------------------
  |  |   68|  16.9k|#define ZXC_MALLOC(size) malloc(size)
  ------------------
  323|  16.9k|    if (UNLIKELY(!mem)) return NULL;  // LCOV_EXCL_LINE
  ------------------
  |  |  152|  16.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 16.9k]
  |  |  ------------------
  ------------------
  324|  16.9k|    zxc_dict_snap_t* const snap = (zxc_dict_snap_t*)mem;
  325|  16.9k|    ZXC_MEMSET(snap, 0, sizeof(*snap));
  ------------------
  |  |  173|  16.9k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  326|  16.9k|    snap->capacity = dict_size;
  327|  16.9k|    snap->tables = mem + ZXC_DICT_SNAP_HDR_SIZE;
  ------------------
  |  |  309|  16.9k|#define ZXC_DICT_SNAP_HDR_SIZE ((sizeof(zxc_dict_snap_t) + 7) & ~(size_t)7)
  ------------------
  328|  16.9k|    snap->chain = (uint16_t*)(snap->tables + ZXC_DICT_SNAP_TABLES_SIZE);
  ------------------
  |  | 2094|  16.9k|#define ZXC_DICT_SNAP_TABLES_SIZE (ZXC_LZ_HASH_SIZE * (sizeof(uint32_t) + sizeof(uint8_t)))
  |  |  ------------------
  |  |  |  |  580|  16.9k|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  578|  16.9k|#define ZXC_LZ_HASH_BITS 15
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  329|  16.9k|    snap->dict = (uint8_t*)(snap->chain + dict_size);
  330|  16.9k|    return snap;
  331|  16.9k|}
zxc_common.c:zxc_dctx_entropy_sizes:
   86|  7.42k|                                   size_t* RESTRICT sz_pivco) {
   87|  7.42k|    *sz_tok = zxc_cctx_max_seq(chunk_size) + ZXC_PAD_SIZE;
  ------------------
  |  |  342|  7.42k|#define ZXC_PAD_SIZE 32
  ------------------
   88|  7.42k|    *sz_pivco = chunk_size + ZXC_PIVCO_SCRATCH_PAD;
  ------------------
  |  | 1939|  7.42k|#define ZXC_PIVCO_SCRATCH_PAD 32
  ------------------
   89|  7.42k|}
zxc_common.c:zxc_scan_read:
  571|  73.6k|                         const size_t len) {
  572|  73.6k|    if (UNLIKELY(off > src->size || (uint64_t)len > src->size - off))
  ------------------
  |  |  152|   147k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 73.6k]
  |  |  |  Branch (152:42): [True: 0, False: 73.6k]
  |  |  |  Branch (152:42): [True: 0, False: 73.6k]
  |  |  ------------------
  ------------------
  573|      0|        return ZXC_ERROR_SRC_TOO_SMALL;
  574|  73.6k|    if (src->read_at) return src->read_at(src, off, dst, len);
  ------------------
  |  Branch (574:9): [True: 73.6k, False: 0]
  ------------------
  575|      0|    ZXC_MEMCPY(dst, src->data + off, len);
  ------------------
  |  |  168|      0|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  576|      0|    return ZXC_OK;
  577|  73.6k|}
zxc_common.c:zxc_encode_footer:
  841|  36.7k|                              const uint64_t digest) {
  842|  36.7k|    if (l->skip) zxc_store_le64(dst, digest);
  ------------------
  |  Branch (842:9): [True: 24.3k, False: 12.4k]
  ------------------
  843|  36.7k|    uint8_t* p = dst + l->skip;
  844|  36.7k|    zxc_store_le_n(p, src_size, l->nd);
  845|  36.7k|    p += l->nd;
  846|  36.7k|    zxc_store_le_n(p, l->compressed_size, l->nf);
  847|  36.7k|    p[l->nf] = (uint8_t)((l->nd - 1) | (l->nf - 1) << 4);
  848|  36.7k|}
zxc_common.c:zxc_store_le_n:
  828|  73.5k|static void zxc_store_le_n(uint8_t* dst, uint64_t v, const size_t n) {
  829|   213k|    for (size_t i = 0; i < n; i++, v >>= 8) dst[i] = (uint8_t)v;
  ------------------
  |  Branch (829:24): [True: 139k, False: 73.5k]
  ------------------
  830|  73.5k|}
zxc_common.c:zxc_load_le_n:
  833|  73.5k|static uint64_t zxc_load_le_n(const uint8_t* src, const size_t n) {
  834|  73.5k|    uint64_t v = 0;
  835|   213k|    for (size_t i = n; i > 0; i--) v = (v << 8) | src[i - 1];
  ------------------
  |  Branch (835:24): [True: 139k, False: 73.5k]
  ------------------
  836|  73.5k|    return v;
  837|  73.5k|}
zxc_common.c:zxc_spl_desc_size:
  948|   260k|static ZXC_ALWAYS_INLINE size_t zxc_spl_desc_size(const uint8_t enc_lit, const uint8_t enc_tok) {
  949|   260k|    return ((enc_lit != ZXC_SECTION_ENCODING_RAW) ? sizeof(uint32_t) : 0) +
  ------------------
  |  Branch (949:13): [True: 176k, False: 84.4k]
  ------------------
  950|   260k|           ((enc_tok == ZXC_SECTION_ENCODING_HUFFMAN) ? sizeof(uint32_t) : 0);
  ------------------
  |  Branch (950:13): [True: 123k, False: 136k]
  ------------------
  951|   260k|}
zxc_common.c:zxc_write_gnr_header:
  916|   146k|                                                   const zxc_gnr_header_t* RESTRICT gh) {
  917|   146k|    zxc_store_le32(dst, gh->n_sequences);
  918|   146k|    zxc_store_le32(dst + 4, gh->n_literals);
  919|       |
  920|   146k|    dst[8] = gh->enc_lit;
  921|   146k|    dst[9] = gh->enc_tok;
  922|   146k|    dst[10] = gh->enc_mlen;
  923|   146k|    dst[11] = gh->enc_off;
  924|   146k|}
zxc_common.c:zxc_read_gnr_header:
  933|   181k|                                                  zxc_gnr_header_t* RESTRICT gh) {
  934|   181k|    gh->n_sequences = zxc_le32(src);
  935|   181k|    gh->n_literals = zxc_le32(src + 4);
  936|   181k|    gh->enc_lit = src[8];
  937|   181k|    gh->enc_tok = src[9];
  938|   181k|    gh->enc_mlen = src[10];
  939|   181k|    gh->enc_off = src[11];
  940|   181k|}

zxc_compress_chunk_wrapper_default:
 2659|   146k|                               const uint64_t block_index) {
 2660|   146k|    if (UNLIKELY(dst_cap < ZXC_BLOCK_HEADER_SIZE)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|   146k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 146k]
  |  |  ------------------
  ------------------
 2661|       |
 2662|   146k|    const size_t dict_sz = ctx->dict_size;
 2663|   146k|    const size_t block_sz = src_sz - dict_sz;
 2664|   146k|    const uint8_t* block_data = chunk + dict_sz;
 2665|   146k|    size_t w = 0;
 2666|   146k|    int res = ZXC_OK;
 2667|       |
 2668|   146k|    if (ctx->compression_level <= 2)
  ------------------
  |  Branch (2668:9): [True: 34.9k, False: 111k]
  ------------------
 2669|  34.9k|        res = zxc_encode_block_pak(ctx, chunk, src_sz, dst, dst_cap, &w);
 2670|   111k|    else
 2671|   111k|        res = zxc_encode_block_spl(ctx, chunk, src_sz, dst, dst_cap, &w);
 2672|       |
 2673|       |    // Check expansion against block data size (excluding dict prefix).
 2674|   146k|    if (UNLIKELY(res != ZXC_OK || w >= block_sz)) {
  ------------------
  |  |  152|   293k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 5.61k, False: 140k]
  |  |  |  Branch (152:42): [True: 8, False: 146k]
  |  |  |  Branch (152:42): [True: 5.61k, False: 140k]
  |  |  ------------------
  ------------------
 2675|  5.61k|        res = zxc_encode_block_raw(block_data, block_sz, dst, dst_cap, &w);
 2676|  5.61k|        if (UNLIKELY(res != ZXC_OK)) return res;
  ------------------
  |  |  152|  5.61k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 5.61k]
  |  |  ------------------
  ------------------
 2677|  5.61k|    }
 2678|       |
 2679|   146k|    if (ctx->checksum_enabled) {
  ------------------
  |  Branch (2679:9): [True: 101k, False: 44.7k]
  ------------------
 2680|   101k|        if (UNLIKELY(w + ZXC_BLOCK_CHECKSUM_SIZE > dst_cap)) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  152|   101k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 101k]
  |  |  ------------------
  ------------------
 2681|       |
 2682|   101k|        zxc_store_le32(dst + w,
 2683|   101k|                       zxc_checksum(block_data, block_sz, block_index, ZXC_CHECKSUM_RAPIDHASH));
  ------------------
  |  |  463|   101k|#define ZXC_CHECKSUM_RAPIDHASH 0
  ------------------
 2684|   101k|        w += ZXC_BLOCK_CHECKSUM_SIZE;
  ------------------
  |  |  441|   101k|#define ZXC_BLOCK_CHECKSUM_SIZE 4
  ------------------
 2685|   101k|    }
 2686|       |
 2687|   146k|    return (int)w;
 2688|   146k|}
zxc_compress.c:zxc_encode_block_pak:
 2601|  34.9k|                                size_t* RESTRICT const out_sz) {
 2602|  34.9k|    if (UNLIKELY(dst_cap < ZXC_BLOCK_HEADER_SIZE)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  34.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 34.9k]
  |  |  ------------------
  ------------------
 2603|       |
 2604|  34.9k|    uint32_t seq_c = 0;
 2605|  34.9k|    size_t lit_c = 0, extras_c = 0;
 2606|  34.9k|    const int rc = zxc_pak_parse(ctx, src, src_sz, &seq_c, &lit_c, &extras_c);
 2607|  34.9k|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|  34.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 34.9k]
  |  |  ------------------
  ------------------
 2608|  34.9k|    return zxc_pak_emit(ctx, seq_c, lit_c, extras_c, dst, dst_cap, out_sz);
 2609|  34.9k|}
zxc_compress.c:zxc_encode_block_spl:
 2352|   111k|                                size_t* RESTRICT out_sz) {
 2353|   111k|    if (UNLIKELY(dst_cap < ZXC_BLOCK_HEADER_SIZE)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|   111k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 111k]
  |  |  ------------------
  ------------------
 2354|       |
 2355|   111k|    uint32_t seq_c;
 2356|   111k|    size_t lit_c, extras_sz;
 2357|   111k|    uint16_t max_offset;
 2358|   111k|    const int rc = zxc_spl_parse(ctx, src, src_sz, &seq_c, &lit_c, &extras_sz, &max_offset);
 2359|   111k|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|   111k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 111k]
  |  |  ------------------
  ------------------
 2360|   111k|    return zxc_spl_emit(ctx, seq_c, lit_c, extras_sz, max_offset, dst, dst_cap, out_sz);
 2361|   111k|}
zxc_compress.c:zxc_encode_block_raw:
 2628|  5.61k|                                size_t* RESTRICT const out_sz) {
 2629|  5.61k|    if (UNLIKELY(dst_cap < ZXC_BLOCK_HEADER_SIZE + src_sz)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  5.61k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 5.61k]
  |  |  ------------------
  ------------------
 2630|       |
 2631|  5.61k|    zxc_block_header_t bh;
 2632|  5.61k|    bh.block_type = ZXC_BLOCK_RAW;
 2633|  5.61k|    bh.block_flags = 0;  // Checksum flag moved to file header
 2634|  5.61k|    bh.reserved = 0;
 2635|  5.61k|    bh.comp_size = (uint32_t)src_sz;
 2636|       |
 2637|  5.61k|    const int hw = zxc_write_block_header(dst, dst_cap, &bh);
 2638|  5.61k|    if (UNLIKELY(hw < 0)) return hw;
  ------------------
  |  |  152|  5.61k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 5.61k]
  |  |  ------------------
  ------------------
 2639|       |
 2640|  5.61k|    ZXC_MEMCPY(dst + ZXC_BLOCK_HEADER_SIZE, src, src_sz);
  ------------------
  |  |  168|  5.61k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2641|       |
 2642|       |    // Checksum will be appended by the wrapper
 2643|  5.61k|    *out_sz = ZXC_BLOCK_HEADER_SIZE + src_sz;
  ------------------
  |  |  439|  5.61k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 2644|  5.61k|    return ZXC_OK;
 2645|  5.61k|}
zxc_compress.c:zxc_pak_parse:
 2508|  34.9k|                         size_t* RESTRICT extras_c) {
 2509|  34.9k|    const int level = ctx->compression_level;
 2510|  34.9k|    const size_t dict_sz = ctx->dict_size;
 2511|       |
 2512|  34.9k|    zxc_lz77_params_t lzp = zxc_get_lz77_params(level);
 2513|       |    // The floor is a candidate until the block itself clears it.
 2514|  34.9k|    if (lzp.min_offset > 1 && zxc_block_is_short_dist_bound(src + dict_sz, src_sz - dict_sz))
  ------------------
  |  Branch (2514:9): [True: 34.9k, False: 1]
  |  Branch (2514:31): [True: 20.5k, False: 14.3k]
  ------------------
 2515|  20.5k|        lzp.min_offset = 1;
 2516|       |
 2517|  34.9k|    const uint32_t epoch_mark = zxc_lz_begin_block(ctx, src, dict_sz, level);
 2518|       |
 2519|  34.9k|    return (level == ZXC_LEVEL_FAST)
  ------------------
  |  Branch (2519:12): [True: 10.1k, False: 24.7k]
  ------------------
 2520|  34.9k|               ? zxc_lz77_lazy_parse_pak_l2(ctx, src, src_sz, epoch_mark, lzp.min_offset, seq_c,
 2521|  10.1k|                                            lit_c, extras_c)
 2522|  34.9k|               : zxc_lz77_lazy_parse_pak_l1(ctx, src, src_sz, epoch_mark, lzp.min_offset, seq_c,
 2523|  24.7k|                                            lit_c, extras_c);
 2524|  34.9k|}
zxc_compress.c:zxc_lz_begin_block:
 1551|   146k|                                   const size_t dict_sz, const int level) {
 1552|   146k|    const int use_hash5 = zxc_lz77_use_hash5(level);
 1553|   146k|    const int seed = dict_sz >= ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  586|   146k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1554|   146k|    const size_t limit = seed ? dict_sz - (ZXC_LZ_MIN_MATCH_LEN - 1) : 0;
  ------------------
  |  |  586|  78.3k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
  |  Branch (1554:26): [True: 78.3k, False: 68.2k]
  ------------------
 1555|       |    // Positions from `stable` on also hash the block's first bytes.
 1556|   146k|    const size_t stable = seed ? dict_sz + 1 - zxc_hash_span(use_hash5) : 0;
  ------------------
  |  Branch (1556:27): [True: 78.3k, False: 68.2k]
  ------------------
 1557|   146k|    zxc_dict_snap_t* snap = seed ? ctx->dict_snap : NULL;
  ------------------
  |  Branch (1557:29): [True: 78.3k, False: 68.2k]
  ------------------
 1558|   146k|    int restore = 0;
 1559|   146k|    int save = 0;
 1560|   146k|    if (snap) {
  ------------------
  |  Branch (1560:9): [True: 78.3k, False: 68.2k]
  ------------------
 1561|       |        // A known identity spares comparing the bytes.
 1562|  78.3k|        if (snap->dict_size == dict_sz && snap->offset_bits == ctx->offset_bits &&
  ------------------
  |  Branch (1562:13): [True: 65.8k, False: 12.4k]
  |  Branch (1562:43): [True: 65.8k, False: 0]
  ------------------
 1563|  65.8k|            snap->use_hash5 == use_hash5 &&
  ------------------
  |  Branch (1563:13): [True: 65.8k, False: 18.4E]
  ------------------
 1564|  65.8k|            ((snap->input_gen != 0 && snap->dict_gen == snap->input_gen) ||
  ------------------
  |  Branch (1564:15): [True: 0, False: 65.8k]
  |  Branch (1564:39): [True: 0, False: 0]
  ------------------
 1565|  65.8k|             memcmp(snap->dict, src, dict_sz) == 0)) {
  ------------------
  |  Branch (1565:14): [True: 65.8k, False: 0]
  ------------------
 1566|  65.8k|            snap->dict_gen = snap->input_gen;
 1567|  65.8k|            restore = snap->valid;
 1568|       |            // Second block in a row with this dictionary: worth a snapshot.
 1569|  65.8k|            save = !snap->valid;
 1570|  65.8k|        } else if (dict_sz <= snap->capacity) {
  ------------------
  |  Branch (1570:20): [True: 12.4k, False: 18.4E]
  ------------------
 1571|       |            // New dictionary: remember it, snapshot only if it comes back.
 1572|  12.4k|            snap->valid = 0;
 1573|  12.4k|            snap->dict_size = dict_sz;
 1574|  12.4k|            snap->dict_gen = snap->input_gen;
 1575|  12.4k|            snap->offset_bits = ctx->offset_bits;
 1576|  12.4k|            snap->use_hash5 = use_hash5;
 1577|  12.4k|            ZXC_MEMCPY(snap->dict, src, dict_sz);
  ------------------
  |  |  168|  12.4k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1578|  18.4E|        } else {
 1579|       |            // Larger than the snapshot: seed every block.
 1580|  18.4E|            snap->valid = 0;
 1581|  18.4E|            snap->dict_size = 0;
 1582|  18.4E|            snap = NULL;
 1583|  18.4E|        }
 1584|  78.3k|    }
 1585|       |
 1586|   146k|    uint32_t epoch_mark;
 1587|   146k|    if (restore && snap->copy) {
  ------------------
  |  Branch (1587:9): [True: 59.8k, False: 86.7k]
  |  Branch (1587:20): [True: 8.56k, False: 51.2k]
  ------------------
 1588|       |        // The whole table is overwritten: the state seeding [0, stable) left.
 1589|  8.56k|        ZXC_MEMCPY(ctx->hash_table, snap->tables, ZXC_LZ_HASH_SIZE * sizeof(uint32_t));
  ------------------
  |  |  168|  8.56k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1590|  8.56k|        ZXC_MEMCPY(ctx->hash_tags, snap->tables + ZXC_LZ_HASH_SIZE * sizeof(uint32_t),
  ------------------
  |  |  168|  8.56k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1591|  8.56k|                   ZXC_LZ_HASH_SIZE * sizeof(uint8_t));
 1592|  8.56k|        ZXC_MEMCPY(ctx->chain_table, snap->chain, stable * sizeof(uint16_t));
  ------------------
  |  |  168|  8.56k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1593|  8.56k|        ctx->epoch = snap->epoch;
 1594|  8.56k|        epoch_mark = ctx->epoch << ctx->offset_bits;
 1595|   137k|    } else {
 1596|   137k|        ctx->epoch++;
 1597|   137k|        if (UNLIKELY(ctx->epoch >= ctx->max_epoch)) {
  ------------------
  |  |  152|   137k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 137k]
  |  |  ------------------
  ------------------
 1598|      0|            ZXC_MEMSET(ctx->hash_table, 0, ZXC_LZ_HASH_SIZE * sizeof(uint32_t));
  ------------------
  |  |  173|      0|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 1599|      0|            ZXC_MEMSET(ctx->hash_tags, 0, ZXC_LZ_HASH_SIZE * sizeof(uint8_t));
  ------------------
  |  |  173|      0|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 1600|      0|            ctx->epoch = 1;
 1601|      0|        }
 1602|   137k|        epoch_mark = ctx->epoch << ctx->offset_bits;
 1603|   137k|        if (restore) {
  ------------------
  |  Branch (1603:13): [True: 51.2k, False: 86.7k]
  ------------------
 1604|  51.2k|            const uint16_t* const slot = (const uint16_t*)snap->tables;
 1605|  51.2k|            const uint16_t* const pos = slot + ZXC_DICT_SNAP_LIST_MAX;
  ------------------
  |  | 2091|  51.2k|#define ZXC_DICT_SNAP_LIST_MAX (ZXC_LZ_HASH_SIZE / 8)
  |  |  ------------------
  |  |  |  |  580|  51.2k|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  578|  51.2k|#define ZXC_LZ_HASH_BITS 15
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1606|  51.2k|            const uint8_t* const tag = (const uint8_t*)(pos + ZXC_DICT_SNAP_LIST_MAX);
  ------------------
  |  | 2091|  51.2k|#define ZXC_DICT_SNAP_LIST_MAX (ZXC_LZ_HASH_SIZE / 8)
  |  |  ------------------
  |  |  |  |  580|  51.2k|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  578|  51.2k|#define ZXC_LZ_HASH_BITS 15
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1607|  41.4M|            for (size_t i = 0; i < snap->n; i++) {
  ------------------
  |  Branch (1607:32): [True: 41.3M, False: 51.2k]
  ------------------
 1608|  41.3M|                ctx->hash_table[slot[i]] = epoch_mark | pos[i];
 1609|  41.3M|                ctx->hash_tags[slot[i]] = tag[i];
 1610|  41.3M|            }
 1611|  51.2k|            ZXC_MEMCPY(ctx->chain_table, snap->chain, stable * sizeof(uint16_t));
  ------------------
  |  |  168|  51.2k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1612|  86.7k|        } else if (seed) {
  ------------------
  |  Branch (1612:20): [True: 18.4k, False: 68.2k]
  ------------------
 1613|  18.4k|            zxc_lz_seed_dict(src, dict_sz, ctx->hash_table, ctx->hash_tags, ctx->chain_table,
 1614|  18.4k|                             epoch_mark, ctx->offset_mask, use_hash5, stable);
 1615|  18.4k|            if (save) zxc_dict_snap_save(snap, ctx, stable);
  ------------------
  |  Branch (1615:17): [True: 5.99k, False: 12.4k]
  ------------------
 1616|  18.4k|        }
 1617|   137k|    }
 1618|   146k|    if (seed)
  ------------------
  |  Branch (1618:9): [True: 78.2k, False: 68.2k]
  ------------------
 1619|  78.2k|        zxc_lz_seed_dense(src, stable, limit, ctx->hash_table, ctx->hash_tags, ctx->chain_table,
 1620|  78.2k|                          epoch_mark, ctx->offset_mask, use_hash5);
 1621|   146k|    return epoch_mark;
 1622|   146k|}
zxc_compress.c:zxc_lz77_use_hash5:
   66|   771M|static ZXC_ALWAYS_INLINE int zxc_lz77_use_hash5(const int level) {
   67|   771M|    return level >= ZXC_LEVEL_DEFAULT;
   68|   771M|}
zxc_compress.c:zxc_hash_span:
   60|  78.3k|static ZXC_ALWAYS_INLINE size_t zxc_hash_span(const int use_hash5) { return use_hash5 ? 5 : 6; }
  ------------------
  |  Branch (60:77): [True: 56.7k, False: 21.5k]
  ------------------
zxc_compress.c:zxc_lz_seed_dict:
 1482|  18.4k|                             const uint32_t offset_mask, const int use_hash5, const size_t end) {
 1483|  18.4k|    const size_t limit = dict_size - (ZXC_LZ_MIN_MATCH_LEN - 1);
  ------------------
  |  |  586|  18.4k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1484|       |
 1485|       |    // Sparse seeding for the first half, dense for the second half.
 1486|       |    // Positions near the end of the dict produce shorter offsets and are
 1487|       |    // more likely to yield matches, so they deserve full coverage.
 1488|  18.4k|    const size_t half = limit / 2;
 1489|  18.9M|    for (size_t i = 0; i < half; i += 4) {
  ------------------
  |  Branch (1489:24): [True: 18.9M, False: 18.4k]
  ------------------
 1490|  18.9M|        const uint64_t val8 = zxc_le64(src + i);
 1491|  18.9M|        const uint32_t h = zxc_hash_func(val8, use_hash5);
 1492|  18.9M|        const uint32_t cur_pos = (uint32_t)i;
 1493|       |
 1494|  18.9M|        hash_table[h] = epoch_mark | cur_pos;
 1495|  18.9M|        hash_tags[h] = zxc_hash_tag((uint32_t)val8);
 1496|  18.9M|        chain_table[cur_pos & ZXC_LZ_WINDOW_MASK] = 0;
  ------------------
  |  |  584|  18.9M|#define ZXC_LZ_WINDOW_MASK (ZXC_LZ_WINDOW_SIZE - 1U)
  |  |  ------------------
  |  |  |  |  582|  18.9M|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  |  |  ------------------
  ------------------
 1497|  18.9M|    }
 1498|  18.4k|    zxc_lz_seed_dense(src, half, end, hash_table, hash_tags, chain_table, epoch_mark, offset_mask,
 1499|  18.4k|                      use_hash5);
 1500|  18.4k|}
zxc_compress.c:zxc_hash_func:
   49|   497M|static ZXC_ALWAYS_INLINE uint32_t zxc_hash_func(const uint64_t val, const int use_hash5) {
   50|   497M|    if (use_hash5) {
  ------------------
  |  Branch (50:9): [True: 461M, False: 36.7M]
  ------------------
   51|   461M|        const uint64_t v5 = val & 0xFFFFFFFFFFULL;
   52|   461M|        return (uint32_t)((v5 * ZXC_HASH_XORSHIFT64) >> (64 - ZXC_LZ_HASH_BITS));
  ------------------
  |  |  799|   461M|#define ZXC_HASH_XORSHIFT64 0x2545F4914F6CDD1DULL
  ------------------
                      return (uint32_t)((v5 * ZXC_HASH_XORSHIFT64) >> (64 - ZXC_LZ_HASH_BITS));
  ------------------
  |  |  578|   461M|#define ZXC_LZ_HASH_BITS 15
  ------------------
   53|   461M|    } else {
   54|  36.7M|        const uint64_t v4 = val ^ (val >> 15);
   55|  36.7M|        return ((uint32_t)v4 * ZXC_HASH_MULT32) >> (32 - ZXC_LZ_HASH_BITS);
  ------------------
  |  |  801|  36.7M|#define ZXC_HASH_MULT32 0x2D35182DU
  ------------------
                      return ((uint32_t)v4 * ZXC_HASH_MULT32) >> (32 - ZXC_LZ_HASH_BITS);
  ------------------
  |  |  578|  36.7M|#define ZXC_LZ_HASH_BITS 15
  ------------------
   56|  36.7M|    }
   57|   497M|}
zxc_compress.c:zxc_hash_tag:
   80|   481M|static ZXC_ALWAYS_INLINE uint8_t zxc_hash_tag(const uint32_t val4) {
   81|   481M|    return (uint8_t)(val4 ^ (val4 >> 16));
   82|   481M|}
zxc_compress.c:zxc_dict_snap_save:
 1507|  5.99k|                               const size_t stable) {
 1508|  5.99k|    uint16_t* const slot = (uint16_t*)snap->tables;
 1509|  5.99k|    uint16_t* const pos = slot + ZXC_DICT_SNAP_LIST_MAX;
  ------------------
  |  | 2091|  5.99k|#define ZXC_DICT_SNAP_LIST_MAX (ZXC_LZ_HASH_SIZE / 8)
  |  |  ------------------
  |  |  |  |  580|  5.99k|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  578|  5.99k|#define ZXC_LZ_HASH_BITS 15
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1510|  5.99k|    uint8_t* const tag = (uint8_t*)(pos + ZXC_DICT_SNAP_LIST_MAX);
  ------------------
  |  | 2091|  5.99k|#define ZXC_DICT_SNAP_LIST_MAX (ZXC_LZ_HASH_SIZE / 8)
  |  |  ------------------
  |  |  |  |  580|  5.99k|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  578|  5.99k|#define ZXC_LZ_HASH_BITS 15
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1511|  5.99k|    size_t n = 0;
 1512|  5.99k|    uint32_t s;
 1513|   161M|    for (s = 0; s < ZXC_LZ_HASH_SIZE; s++) {
  ------------------
  |  |  580|   161M|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  ------------------
  |  |  |  |  578|   161M|#define ZXC_LZ_HASH_BITS 15
  |  |  ------------------
  ------------------
  |  Branch (1513:17): [True: 161M, False: 4.30k]
  ------------------
 1514|   161M|        const uint32_t e = ctx->hash_table[s];
 1515|   161M|        if ((e >> ctx->offset_bits) != ctx->epoch) continue;
  ------------------
  |  Branch (1515:13): [True: 153M, False: 8.51M]
  ------------------
 1516|  8.51M|        if (n == ZXC_DICT_SNAP_LIST_MAX) break;
  ------------------
  |  | 2091|  8.51M|#define ZXC_DICT_SNAP_LIST_MAX (ZXC_LZ_HASH_SIZE / 8)
  |  |  ------------------
  |  |  |  |  580|  8.51M|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  578|  8.51M|#define ZXC_LZ_HASH_BITS 15
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1516:13): [True: 1.69k, False: 8.51M]
  ------------------
 1517|  8.51M|        slot[n] = (uint16_t)s;
 1518|  8.51M|        pos[n] = (uint16_t)(e & ctx->offset_mask);
 1519|  8.51M|        tag[n] = ctx->hash_tags[s];
 1520|  8.51M|        n++;
 1521|  8.51M|    }
 1522|  5.99k|    snap->copy = (s < ZXC_LZ_HASH_SIZE);
  ------------------
  |  |  580|  5.99k|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  ------------------
  |  |  |  |  578|  5.99k|#define ZXC_LZ_HASH_BITS 15
  |  |  ------------------
  ------------------
 1523|  5.99k|    if (snap->copy) {
  ------------------
  |  Branch (1523:9): [True: 1.69k, False: 4.30k]
  ------------------
 1524|  1.69k|        ZXC_MEMCPY(snap->tables, ctx->hash_table, ZXC_LZ_HASH_SIZE * sizeof(uint32_t));
  ------------------
  |  |  168|  1.69k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1525|  1.69k|        ZXC_MEMCPY(snap->tables + ZXC_LZ_HASH_SIZE * sizeof(uint32_t), ctx->hash_tags,
  ------------------
  |  |  168|  1.69k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1526|  1.69k|                   ZXC_LZ_HASH_SIZE * sizeof(uint8_t));
 1527|  1.69k|        snap->epoch = ctx->epoch;
 1528|  1.69k|    }
 1529|  5.99k|    snap->n = n;
 1530|  5.99k|    ZXC_MEMCPY(snap->chain, ctx->chain_table, stable * sizeof(uint16_t));
  ------------------
  |  |  168|  5.99k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1531|  5.99k|    snap->valid = 1;
 1532|  5.99k|}
zxc_compress.c:zxc_lz_seed_dense:
 1449|  96.7k|                                                const uint32_t offset_mask, const int use_hash5) {
 1450|  62.5M|    for (size_t i = begin; i < end; i++) {
  ------------------
  |  Branch (1450:28): [True: 62.4M, False: 96.7k]
  ------------------
 1451|  62.4M|        const uint64_t val8 = zxc_le64(src + i);
 1452|  62.4M|        const uint32_t h = zxc_hash_func(val8, use_hash5);
 1453|  62.4M|        const uint32_t cur_pos = (uint32_t)i;
 1454|  62.4M|        const uint32_t prev_idx = zxc_epoch_pos(hash_table[h], offset_mask, epoch_mark);
 1455|       |
 1456|  62.4M|        hash_table[h] = epoch_mark | cur_pos;
 1457|  62.4M|        hash_tags[h] = zxc_hash_tag((uint32_t)val8);
 1458|  62.4M|        chain_table[cur_pos & ZXC_LZ_WINDOW_MASK] = zxc_chain_delta(cur_pos, prev_idx);
  ------------------
  |  |  584|  62.4M|#define ZXC_LZ_WINDOW_MASK (ZXC_LZ_WINDOW_SIZE - 1U)
  |  |  ------------------
  |  |  |  |  582|  62.4M|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  |  |  ------------------
  ------------------
 1459|  62.4M|    }
 1460|  96.7k|}
zxc_compress.c:zxc_epoch_pos:
   91|   461M|                                                const uint32_t epoch_mark) {
   92|       |    // epoch_mark has no position bits: the XOR is the position when the epochs
   93|       |    // agree, above offset_mask otherwise. No ~offset_mask to keep live.
   94|   461M|    const uint32_t pos = head ^ epoch_mark;
   95|   461M|    return (pos <= offset_mask) ? pos : 0;
  ------------------
  |  Branch (95:12): [True: 269M, False: 192M]
  ------------------
   96|   461M|}
zxc_compress.c:zxc_chain_delta:
  104|   458M|static ZXC_ALWAYS_INLINE uint16_t zxc_chain_delta(const uint32_t cur_pos, const uint32_t prev_idx) {
  105|   458M|    const uint32_t dist = cur_pos - prev_idx;
  106|       |    // cppcheck-suppress bitwiseOnBoolean
  107|   458M|    const uint32_t valid = 0U - (uint32_t)((prev_idx != 0) & (dist < ZXC_LZ_WINDOW_SIZE));
  ------------------
  |  |  582|   458M|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  ------------------
  108|   458M|    return (uint16_t)(dist & valid);
  109|   458M|}
zxc_compress.c:zxc_lz77_lazy_parse_pak_l2:
 2482|  10.1k|                                                   size_t* lit_c_out, size_t* extras_c_out) {
 2483|  10.1k|    return zxc_lz77_lazy_parse_pak_impl(ctx, src, src_sz, epoch_mark, min_offset, seq_c_out,
 2484|  10.1k|                                        lit_c_out, extras_c_out, ZXC_LEVEL_FAST);
 2485|  10.1k|}
zxc_compress.c:zxc_lz77_lazy_parse_pak_impl:
 2381|  34.8k|    size_t* RESTRICT lit_c_out, size_t* RESTRICT extras_c_out, const int level) {
 2382|  34.8k|    zxc_lz77_params_t lzp = zxc_get_lz77_params(level);
 2383|  34.8k|    lzp.min_offset = min_offset;
 2384|  34.8k|    const uint32_t offset_mask = ctx->offset_mask;
 2385|       |
 2386|  34.8k|    const uint8_t* ip = src + ctx->dict_size;
 2387|  34.8k|    const uint8_t* iend = src + src_sz;
 2388|  34.8k|    const uint8_t* anchor = ip;
 2389|  34.8k|    const uint8_t* search_limit = iend - ZXC_LZ_SEARCH_MARGIN;
  ------------------
  |  |  765|  34.8k|#define ZXC_LZ_SEARCH_MARGIN (sizeof(uint64_t))
  ------------------
 2390|       |
 2391|  34.8k|    uint32_t* const hash_table = ctx->hash_table;
 2392|  34.8k|    uint8_t* const hash_tags = ctx->hash_tags;
 2393|  34.8k|    uint8_t* const buf_extras = ctx->buf_extras;
 2394|  34.8k|    uint16_t* const chain_table = ctx->chain_table;
 2395|  34.8k|    uint8_t* const literals = ctx->literals;
 2396|  34.8k|    uint32_t* const buf_sequences = ctx->buf_sequences;
 2397|       |
 2398|  34.8k|    uint32_t seq_c = 0;
 2399|  34.8k|    size_t extras_c = 0;
 2400|  34.8k|    size_t lit_c = 0;
 2401|       |
 2402|  34.8k|    const int use_hash5 = zxc_lz77_use_hash5(level);
 2403|       |
 2404|  2.68M|    while (LIKELY(ip < search_limit)) {
  ------------------
  |  |  146|  2.68M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 2.64M, False: 34.8k]
  |  |  ------------------
  ------------------
 2405|  2.64M|        uint32_t h = zxc_hash_func(zxc_le64(ip), use_hash5);
 2406|       |
 2407|       |        // One pass per unmatched position: the hash taken to prefetch the next
 2408|       |        // position's slots is the one the finder needs there. PAK skips far more
 2409|       |        // positions than SPL, whose lazy loop gains nothing from carrying it.
 2410|  12.8M|        for (;;) {
 2411|  12.8M|            const size_t dist = (size_t)(ip - anchor);
 2412|  12.8M|            size_t step = lzp.step_base + (dist >> lzp.step_shift);
 2413|  12.8M|            if (UNLIKELY(ip + step >= search_limit)) step = 1;
  ------------------
  |  |  152|  12.8M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 479k, False: 12.3M]
  |  |  ------------------
  ------------------
 2414|       |
 2415|  12.8M|            ZXC_PREFETCH_READ(ip + step * 4 + ZXC_CACHE_LINE_SIZE);
  ------------------
  |  |  163|  12.8M|#define ZXC_PREFETCH_READ(ptr) __builtin_prefetch((const void*)(ptr), 0, 3)
  ------------------
 2416|       |
 2417|       |            // ip + step <= search_limit either way, so this read stays in the block.
 2418|  12.8M|            const uint32_t h_next = zxc_hash_func(zxc_le64(ip + step), use_hash5);
 2419|  12.8M|            ZXC_PREFETCH_READ(&hash_tags[h_next]);
  ------------------
  |  |  163|  12.8M|#define ZXC_PREFETCH_READ(ptr) __builtin_prefetch((const void*)(ptr), 0, 3)
  ------------------
 2420|  12.8M|            ZXC_PREFETCH_READ(&hash_table[h_next]);
  ------------------
  |  |  163|  12.8M|#define ZXC_PREFETCH_READ(ptr) __builtin_prefetch((const void*)(ptr), 0, 3)
  ------------------
 2421|       |
 2422|  12.8M|            const zxc_match_t m = zxc_lz77_find_best_match(
 2423|  12.8M|                src, ip, h, iend, search_limit, anchor, hash_table, hash_tags, chain_table,
 2424|  12.8M|                epoch_mark, offset_mask, level, lzp, /*last_off=*/0U);
 2425|       |
 2426|  12.8M|            if (m.ref) {
  ------------------
  |  Branch (2426:17): [True: 2.65M, False: 10.1M]
  ------------------
 2427|  2.65M|                ip -= m.backtrack;
 2428|  2.65M|                const uint32_t ll = (uint32_t)(ip - anchor);
 2429|  2.65M|                const uint32_t ml = m.len - ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  586|  2.65M|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 2430|  2.65M|                const uint32_t off = (uint32_t)(ip - m.ref);
 2431|       |
 2432|  2.65M|                if (ll > 0) zxc_flush_literals(literals, &lit_c, anchor, ll, iend);
  ------------------
  |  Branch (2432:21): [True: 1.50M, False: 1.14M]
  ------------------
 2433|       |
 2434|  2.65M|                const uint32_t ll_write = (ll >= ZXC_SEQ_LL_MASK) ? ZXC_SEQ_LL_MASK : ll;
  ------------------
  |  |  539|  2.65M|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  ------------------
  |  |  |  |  533|  2.65M|#define ZXC_SEQ_LL_BITS 8
  |  |  ------------------
  ------------------
                              const uint32_t ll_write = (ll >= ZXC_SEQ_LL_MASK) ? ZXC_SEQ_LL_MASK : ll;
  ------------------
  |  |  539|  58.6k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  ------------------
  |  |  |  |  533|  58.6k|#define ZXC_SEQ_LL_BITS 8
  |  |  ------------------
  ------------------
  |  Branch (2434:43): [True: 58.6k, False: 2.59M]
  ------------------
 2435|  2.65M|                const uint32_t ml_write = (ml >= ZXC_SEQ_ML_MASK) ? ZXC_SEQ_ML_MASK : ml;
  ------------------
  |  |  541|  2.65M|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  535|  2.65M|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  ------------------
                              const uint32_t ml_write = (ml >= ZXC_SEQ_ML_MASK) ? ZXC_SEQ_ML_MASK : ml;
  ------------------
  |  |  541|   103k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  535|   103k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  ------------------
  |  Branch (2435:43): [True: 103k, False: 2.54M]
  ------------------
 2436|  2.65M|                const uint32_t seq_val = (ll_write << ZXC_SEQ_LL_SHIFT) |
  ------------------
  |  |  545|  2.65M|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  535|  2.65M|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  537|  2.65M|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
 2437|  2.65M|                                         (ml_write << ZXC_SEQ_ML_SHIFT) |
  ------------------
  |  |  547|  2.65M|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  ------------------
  |  |  |  |  537|  2.65M|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
 2438|  2.65M|                                         ((off - ZXC_LZ_OFFSET_BIAS) & ZXC_SEQ_OFF_MASK);
  ------------------
  |  |  724|  2.65M|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
                                                       ((off - ZXC_LZ_OFFSET_BIAS) & ZXC_SEQ_OFF_MASK);
  ------------------
  |  |  543|  2.65M|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  ------------------
  |  |  |  |  537|  2.65M|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
 2439|  2.65M|                buf_sequences[seq_c] = seq_val;
 2440|  2.65M|                seq_c++;
 2441|       |
 2442|  2.65M|                if (UNLIKELY(!zxc_emit_extra(buf_extras, &extras_c, ll, ZXC_SEQ_LL_MASK) ||
  ------------------
  |  |  152|  5.30M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 2.65M]
  |  |  |  Branch (152:42): [True: 576, False: 2.65M]
  |  |  |  Branch (152:42): [True: 15.0k, False: 2.63M]
  |  |  ------------------
  ------------------
 2443|  2.65M|                             !zxc_emit_extra(buf_extras, &extras_c, ml, ZXC_SEQ_ML_MASK)))
 2444|      0|                    return ZXC_ERROR_OVERFLOW;
 2445|       |
 2446|  2.65M|                ip += m.len;
 2447|  2.65M|                anchor = ip;
 2448|  2.65M|                break;
 2449|  2.65M|            }
 2450|       |
 2451|  10.1M|            ip += step;
 2452|  10.1M|            if (UNLIKELY(ip >= search_limit)) break;
  ------------------
  |  |  152|  10.1M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 10.4k, False: 10.1M]
  |  |  ------------------
  ------------------
 2453|  10.1M|            h = h_next;
 2454|  10.1M|        }
 2455|  2.64M|    }
 2456|       |
 2457|  34.8k|    const size_t last_lits = (size_t)(iend - anchor);
 2458|  34.8k|    if (last_lits > 0) {
  ------------------
  |  Branch (2458:9): [True: 14.5k, False: 20.3k]
  ------------------
 2459|  14.5k|        ZXC_MEMCPY(literals + lit_c, anchor, last_lits);
  ------------------
  |  |  168|  14.5k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2460|  14.5k|        lit_c += last_lits;
 2461|  14.5k|    }
 2462|       |
 2463|  34.8k|    *seq_c_out = seq_c;
 2464|  34.8k|    *lit_c_out = lit_c;
 2465|  34.8k|    *extras_c_out = extras_c;
 2466|  34.8k|    return ZXC_OK;
 2467|  34.8k|}
zxc_compress.c:zxc_lz77_find_best_match:
  669|   398M|    const uint32_t last_off) {
  670|   398M|    const int use_hash5 = zxc_lz77_use_hash5(level);
  671|       |    // Sentinel length just below the minimum, so any valid match replaces it.
  672|   398M|    zxc_match_t best = (zxc_match_t){NULL, ZXC_LZ_MIN_MATCH_LEN - 1, 0};
  ------------------
  |  |  586|   398M|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
  673|       |
  674|   398M|    const uint32_t cur_val = zxc_le32(ip);
  675|       |
  676|       |    // 8-bit tag: XOR fold of first 4 bytes for fast rejection
  677|   398M|    const uint8_t cur_tag = zxc_hash_tag(cur_val);
  678|       |
  679|   398M|    const uint32_t cur_pos = (uint32_t)(ip - src);
  680|       |
  681|       |    // Tag-first filter on fast levels.
  682|   398M|    const uint8_t stored_tag = hash_tags[h];
  683|   398M|    uint32_t match_idx;
  684|   398M|    if (level <= ZXC_LEVEL_FAST && stored_tag != cur_tag) {
  ------------------
  |  Branch (684:9): [True: 12.8M, False: 386M]
  |  Branch (684:36): [True: 3.92M, False: 8.90M]
  ------------------
  685|  3.92M|        match_idx = 0;
  686|   395M|    } else {
  687|   395M|        match_idx = zxc_epoch_pos(hash_table[h], offset_mask, epoch_mark);
  688|   395M|    }
  689|       |
  690|       |    // skip_head drives the chain walk on level >= 3 (advances past the
  691|       |    // mismatched head without comparing). On level <= 2 it is always 0, which
  692|       |    // the compiler cannot see: saying so frees registers in the PAK loop.
  693|       |    // cppcheck-suppress bitwiseOnBoolean
  694|   398M|    const int skip_head = (level > ZXC_LEVEL_FAST) & (match_idx != 0) & (stored_tag != cur_tag);
  695|       |
  696|       |    // Split table writes
  697|   398M|    hash_table[h] = epoch_mark | cur_pos;
  698|   398M|    hash_tags[h] = cur_tag;
  699|       |
  700|   398M|    chain_table[cur_pos & ZXC_LZ_WINDOW_MASK] = zxc_chain_delta(cur_pos, match_idx);
  ------------------
  |  |  584|   398M|#define ZXC_LZ_WINDOW_MASK (ZXC_LZ_WINDOW_SIZE - 1U)
  |  |  ------------------
  |  |  |  |  582|   398M|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  |  |  ------------------
  ------------------
  701|       |
  702|   398M|    int attempts = p.search_depth;
  703|       |
  704|       |    // Repeat-offset seed (level-6 parser passes last_off; others pass 0).
  705|       |    // Probing the previous offset first often finds the longest match right
  706|       |    // away, speeding up the chain walk. It only raises best.len, never lowers
  707|       |    // it, so the result is unchanged - this is purely a speed optimization.
  708|   398M|    if (last_off != 0U && last_off >= p.min_offset && last_off <= (uint32_t)ZXC_LZ_MAX_DIST &&
  ------------------
  |  |  726|   756M|#define ZXC_LZ_MAX_DIST (ZXC_LZ_WINDOW_SIZE - 1)
  |  |  ------------------
  |  |  |  |  582|   357M|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  |  |  ------------------
  ------------------
  |  Branch (708:9): [True: 357M, False: 41.9M]
  |  Branch (708:27): [True: 357M, False: 18.4E]
  |  Branch (708:55): [True: 357M, False: 18.4E]
  ------------------
  709|   357M|        last_off <= cur_pos) {
  ------------------
  |  Branch (709:9): [True: 357M, False: 18.4E]
  ------------------
  710|   357M|        const uint8_t* const rep_ref = src + (cur_pos - last_off);
  711|   357M|        if (zxc_le32(rep_ref) == cur_val) {
  ------------------
  |  Branch (711:13): [True: 150M, False: 206M]
  ------------------
  712|   150M|            uint32_t mlen = sizeof(uint32_t);
  713|   150M|            const uint8_t* const limit_8 = iend - sizeof(uint64_t);
  714|   532M|            while (ip + mlen < limit_8) {
  ------------------
  |  Branch (714:20): [True: 526M, False: 5.95M]
  ------------------
  715|   526M|                const uint64_t diff = zxc_le64(ip + mlen) ^ zxc_le64(rep_ref + mlen);
  716|   526M|                if (diff == 0) {
  ------------------
  |  Branch (716:21): [True: 382M, False: 144M]
  ------------------
  717|   382M|                    mlen += sizeof(uint64_t);
  718|   382M|                } else {
  719|   144M|                    mlen += (uint32_t)(zxc_ctz64(diff) >> 3);
  720|   144M|                    goto _rep_done;
  721|   144M|                }
  722|   526M|            }
  723|  12.1M|            while (ip + mlen < iend && rep_ref[mlen] == ip[mlen]) mlen++;
  ------------------
  |  Branch (723:20): [True: 6.28M, False: 5.87M]
  |  Branch (723:40): [True: 6.20M, False: 81.1k]
  ------------------
  724|   150M|        _rep_done:;
  725|   150M|            best.len = mlen;
  726|   150M|            best.ref = rep_ref;
  727|   150M|            if (UNLIKELY(best.len >= (uint32_t)p.sufficient_len || ip + best.len >= iend))
  ------------------
  |  |  152|   300M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 1.34M, False: 149M]
  |  |  |  Branch (152:42): [True: 9.75k, False: 150M]
  |  |  |  Branch (152:42): [True: 1.26M, False: 149M]
  |  |  ------------------
  ------------------
  728|  1.34M|                goto _finalize_match;
  729|   150M|        }
  730|   357M|    }
  731|       |
  732|   397M|    if (match_idx == 0) goto _finalize_match;
  ------------------
  |  Branch (732:9): [True: 188M, False: 209M]
  ------------------
  733|       |
  734|       |    // Optimization: If head tag doesn't match, advance immediately without loading the first
  735|       |    // mismatch.
  736|   209M|    if (skip_head) {
  ------------------
  |  Branch (736:9): [True: 58.7M, False: 150M]
  ------------------
  737|  58.7M|        const uint16_t delta = chain_table[match_idx & ZXC_LZ_WINDOW_MASK];
  ------------------
  |  |  584|  58.7M|#define ZXC_LZ_WINDOW_MASK (ZXC_LZ_WINDOW_SIZE - 1U)
  |  |  ------------------
  |  |  |  |  582|  58.7M|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  |  |  ------------------
  ------------------
  738|  58.7M|        const uint32_t next_idx = match_idx - delta;
  739|  58.7M|        match_idx = (delta != 0) ? next_idx : 0;
  ------------------
  |  Branch (739:21): [True: 24.2M, False: 34.4M]
  ------------------
  740|  58.7M|        attempts--;
  741|  58.7M|    }
  742|       |
  743|  4.29G|    while (match_idx > 0) {
  ------------------
  |  Branch (743:12): [True: 4.13G, False: 166M]
  ------------------
  744|  4.13G|        if (UNLIKELY(attempts-- < 0 || cur_pos - match_idx > ZXC_LZ_MAX_DIST)) break;
  ------------------
  |  |  152|  8.22G|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 38.9M, False: 4.09G]
  |  |  |  Branch (152:42): [True: 39.2M, False: 4.09G]
  |  |  |  Branch (152:42): [True: 7.12M, False: 4.08G]
  |  |  ------------------
  ------------------
  745|  4.09G|        const uint8_t* ref = src + match_idx;
  746|       |
  747|       |        // Load the next chain link early (before the compare) so its address
  748|       |        // resolves while we prefetch. The prefetch aims at the next gate for
  749|       |        // the current best.len; a longer match found here moves that gate.
  750|  4.09G|        const uint16_t delta = chain_table[match_idx & ZXC_LZ_WINDOW_MASK];
  ------------------
  |  |  584|  4.09G|#define ZXC_LZ_WINDOW_MASK (ZXC_LZ_WINDOW_SIZE - 1U)
  |  |  ------------------
  |  |  |  |  582|  4.09G|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  |  |  ------------------
  ------------------
  751|  4.09G|        const uint32_t next_idx = match_idx - delta;
  752|  4.09G|        ZXC_PREFETCH_READ(src + next_idx + best.len - 3);
  ------------------
  |  |  163|  4.09G|#define ZXC_PREFETCH_READ(ptr) __builtin_prefetch((const void*)(ptr), 0, 3)
  ------------------
  753|       |
  754|       |        // Gate first: most candidates share the head and fail on bytes
  755|       |        // [best.len-3, best.len], which a longer match must also cover.
  756|  4.09G|        const int should_compare = (cur_pos - match_idx) >= p.min_offset &&
  ------------------
  |  Branch (756:36): [True: 4.08G, False: 12.4M]
  ------------------
  757|  4.08G|                                   zxc_le32(ref + best.len - 3) == zxc_le32(ip + best.len - 3) &&
  ------------------
  |  Branch (757:36): [True: 225M, False: 3.85G]
  ------------------
  758|   225M|                                   zxc_le32(ref) == cur_val;
  ------------------
  |  Branch (758:36): [True: 225M, False: 87.7k]
  ------------------
  759|       |
  760|  4.09G|        if (should_compare) {
  ------------------
  |  Branch (760:13): [True: 225M, False: 3.86G]
  ------------------
  761|   225M|            uint32_t mlen = sizeof(uint32_t);  // We already know the first 4 bytes match
  762|       |
  763|       |            // Fast path: Scalar 64-bit comparison for short matches (=< 64 bytes)
  764|       |            // Most matches are short, so this avoids SIMD overhead for common cases
  765|   225M|            const uint8_t* limit_8 = iend - sizeof(uint64_t);
  766|   225M|            const uint8_t* scalar_limit = ip + mlen + 64;
  767|   225M|            if (scalar_limit > limit_8) scalar_limit = limit_8;
  ------------------
  |  Branch (767:17): [True: 882k, False: 224M]
  ------------------
  768|       |
  769|   412M|            while (ip + mlen < scalar_limit) {
  ------------------
  |  Branch (769:20): [True: 405M, False: 7.05M]
  ------------------
  770|   405M|                uint64_t diff = zxc_le64(ip + mlen) ^ zxc_le64(ref + mlen);
  771|   405M|                if (diff == 0)
  ------------------
  |  Branch (771:21): [True: 186M, False: 218M]
  ------------------
  772|   186M|                    mlen += sizeof(uint64_t);
  773|   218M|                else {
  774|   218M|                    mlen += (uint32_t)zxc_ctz64(diff) >> 3;
  775|   218M|                    goto _match_len_done;
  776|   218M|                }
  777|   405M|            }
  778|       |
  779|       |            // Long match path: Use SIMD for matches exceeding 64 bytes
  780|       |#if defined(ZXC_USE_AVX512)
  781|       |            const uint8_t* limit_64 = iend - 64;
  782|       |            while (ip + mlen < limit_64) {
  783|       |                const __m512i v_src = _mm512_loadu_si512((const void*)(ip + mlen));
  784|       |                const __m512i v_ref = _mm512_loadu_si512((const void*)(ref + mlen));
  785|       |                const __mmask64 mask = _mm512_cmpeq_epi8_mask(v_src, v_ref);
  786|       |                if (mask == 0xFFFFFFFFFFFFFFFF)
  787|       |                    mlen += 64;
  788|       |                else {
  789|       |                    mlen += (uint32_t)zxc_ctz64(~mask);
  790|       |                    goto _match_len_done;
  791|       |                }
  792|       |            }
  793|       |#elif defined(ZXC_USE_AVX2)
  794|       |            const uint8_t* limit_32 = iend - 32;
  795|       |            while (ip + mlen < limit_32) {
  796|       |                const __m256i v_src = _mm256_loadu_si256((const __m256i*)(ip + mlen));
  797|       |                const __m256i v_ref = _mm256_loadu_si256((const __m256i*)(ref + mlen));
  798|       |                const __m256i v_cmp = _mm256_cmpeq_epi8(v_src, v_ref);
  799|       |                const uint32_t mask = (uint32_t)_mm256_movemask_epi8(v_cmp);
  800|       |                if (mask == 0xFFFFFFFF)
  801|       |                    mlen += 32;
  802|       |                else {
  803|       |                    mlen += (uint32_t)zxc_ctz32(~mask);
  804|       |                    goto _match_len_done;
  805|       |                }
  806|       |            }
  807|       |#elif defined(ZXC_USE_SSE2)
  808|  7.05M|            const uint8_t* limit_16 = iend - 16;
  809|  49.0M|            while (ip + mlen < limit_16) {
  ------------------
  |  Branch (809:20): [True: 44.9M, False: 4.14M]
  ------------------
  810|  44.9M|                const __m128i v_src = _mm_loadu_si128((const __m128i*)(ip + mlen));
  811|  44.9M|                const __m128i v_ref = _mm_loadu_si128((const __m128i*)(ref + mlen));
  812|  44.9M|                const __m128i v_cmp = _mm_cmpeq_epi8(v_src, v_ref);
  813|  44.9M|                const uint32_t mask = (uint32_t)_mm_movemask_epi8(v_cmp);
  814|  44.9M|                if (mask == 0xFFFFU)
  ------------------
  |  Branch (814:21): [True: 42.0M, False: 2.91M]
  ------------------
  815|  42.0M|                    mlen += 16;
  816|  2.91M|                else {
  817|       |                    // mask != 0xFFFF => a differing byte exists in bits 0..15,
  818|       |                    // so the lowest set bit of ~mask lies in that range.
  819|  2.91M|                    mlen += (uint32_t)zxc_ctz32(~mask);
  820|  2.91M|                    goto _match_len_done;
  821|  2.91M|                }
  822|  44.9M|            }
  823|       |#elif defined(ZXC_USE_NEON64)
  824|       |            {
  825|       |                const uint8_t* limit_32 = iend - 32;
  826|       |                while (ip + mlen < limit_32) {
  827|       |                    const uint8x16_t s0 = vld1q_u8(ip + mlen);
  828|       |                    const uint8x16_t r0 = vld1q_u8(ref + mlen);
  829|       |                    const uint8x16_t c0 = vceqq_u8(s0, r0);
  830|       |                    const uint64_t m0 = vget_lane_u64(
  831|       |                        vreinterpret_u64_u8(vshrn_n_u16(vreinterpretq_u16_u8(c0), 4)), 0);
  832|       |                    if (UNLIKELY(m0 != ~(uint64_t)0)) {
  833|       |                        mlen += (uint32_t)(zxc_ctz64(~m0) >> 2);
  834|       |                        goto _match_len_done;
  835|       |                    }
  836|       |                    const uint8x16_t s1 = vld1q_u8(ip + mlen + 16);
  837|       |                    const uint8x16_t r1 = vld1q_u8(ref + mlen + 16);
  838|       |                    const uint8x16_t c1 = vceqq_u8(s1, r1);
  839|       |                    const uint64_t m1 = vget_lane_u64(
  840|       |                        vreinterpret_u64_u8(vshrn_n_u16(vreinterpretq_u16_u8(c1), 4)), 0);
  841|       |                    if (UNLIKELY(m1 != ~(uint64_t)0)) {
  842|       |                        mlen += 16 + (uint32_t)(zxc_ctz64(~m1) >> 2);
  843|       |                        goto _match_len_done;
  844|       |                    }
  845|       |                    mlen += 32;
  846|       |                }
  847|       |                if (ip + mlen < iend - 16) {
  848|       |                    const uint8x16_t v_src = vld1q_u8(ip + mlen);
  849|       |                    const uint8x16_t v_ref = vld1q_u8(ref + mlen);
  850|       |                    const uint8x16_t v_cmp = vceqq_u8(v_src, v_ref);
  851|       |                    const uint64_t mask = vget_lane_u64(
  852|       |                        vreinterpret_u64_u8(vshrn_n_u16(vreinterpretq_u16_u8(v_cmp), 4)), 0);
  853|       |                    if (LIKELY(mask == ~(uint64_t)0))
  854|       |                        mlen += 16;
  855|       |                    else {
  856|       |                        mlen += (uint32_t)(zxc_ctz64(~mask) >> 2);
  857|       |                        goto _match_len_done;
  858|       |                    }
  859|       |                }
  860|       |            }
  861|       |#elif defined(ZXC_USE_NEON32)
  862|       |            {
  863|       |                const uint8_t* limit_16 = iend - 16;
  864|       |                while (ip + mlen < limit_16) {
  865|       |                    const uint8x16_t v_src = vld1q_u8(ip + mlen);
  866|       |                    const uint8x16_t v_ref = vld1q_u8(ref + mlen);
  867|       |                    const uint8x16_t v_cmp = vceqq_u8(v_src, v_ref);
  868|       |                    uint8x8_t p1 = vpmin_u8(vget_low_u8(v_cmp), vget_high_u8(v_cmp));
  869|       |                    uint8x8_t p2 = vpmin_u8(p1, p1);
  870|       |                    uint8x8_t p3 = vpmin_u8(p2, p2);
  871|       |                    uint8x8_t p4 = vpmin_u8(p3, p3);
  872|       |                    uint8_t min_val = vget_lane_u8(p4, 0);
  873|       |                    if (min_val == 0xFF)
  874|       |                        mlen += 16;
  875|       |                    else {
  876|       |                        uint8x16_t v_diff = vmvnq_u8(v_cmp);
  877|       |                        uint64_t lo =
  878|       |                            (uint64_t)vgetq_lane_u32(vreinterpretq_u32_u8(v_diff), 0) |
  879|       |                            ((uint64_t)vgetq_lane_u32(vreinterpretq_u32_u8(v_diff), 1) << 32);
  880|       |                        if (lo != 0)
  881|       |                            mlen += (zxc_ctz64(lo) >> 3);
  882|       |                        else
  883|       |                            mlen +=
  884|       |                                8 + (zxc_ctz64(
  885|       |                                         (uint64_t)vgetq_lane_u32(vreinterpretq_u32_u8(v_diff), 2) |
  886|       |                                         ((uint64_t)vgetq_lane_u32(vreinterpretq_u32_u8(v_diff), 3)
  887|       |                                          << 32)) >>
  888|       |                                     3);
  889|       |                        goto _match_len_done;
  890|       |                    }
  891|       |                }
  892|       |            }
  893|       |#endif
  894|  4.17M|            while (ip + mlen < limit_8) {
  ------------------
  |  Branch (894:20): [True: 35.7k, False: 4.13M]
  ------------------
  895|  35.7k|                const uint64_t diff = zxc_le64(ip + mlen) ^ zxc_le64(ref + mlen);
  896|  35.7k|                if (diff == 0)
  ------------------
  |  Branch (896:21): [True: 32.7k, False: 2.95k]
  ------------------
  897|  32.7k|                    mlen += sizeof(uint64_t);
  898|  2.95k|                else {
  899|  2.95k|                    mlen += (uint32_t)zxc_ctz64(diff) >> 3;
  900|  2.95k|                    goto _match_len_done;
  901|  2.95k|                }
  902|  35.7k|            }
  903|  4.58M|            while (ip + mlen < iend && ref[mlen] == ip[mlen]) mlen++;
  ------------------
  |  Branch (903:20): [True: 475k, False: 4.11M]
  |  Branch (903:40): [True: 446k, False: 28.2k]
  ------------------
  904|       |
  905|   225M|        _match_len_done:;
  906|   225M|            const int better = (mlen > best.len);
  907|   225M|            best.len = better ? mlen : best.len;
  ------------------
  |  Branch (907:24): [True: 48.6M, False: 176M]
  ------------------
  908|   225M|            best.ref = better ? ref : best.ref;
  ------------------
  |  Branch (908:24): [True: 48.6M, False: 176M]
  ------------------
  909|       |
  910|   225M|            if (UNLIKELY(best.len >= (uint32_t)p.sufficient_len || ip + best.len >= iend)) break;
  ------------------
  |  |  152|   447M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 3.29M, False: 221M]
  |  |  |  Branch (152:42): [True: 3.12M, False: 222M]
  |  |  |  Branch (152:42): [True: 22.0k, False: 222M]
  |  |  ------------------
  ------------------
  911|   225M|        }
  912|       |
  913|  4.09G|        match_idx = (delta != 0) ? next_idx : 0;
  ------------------
  |  Branch (913:21): [True: 3.95G, False: 134M]
  ------------------
  914|  4.09G|    }
  915|       |
  916|   398M|_finalize_match:
  917|   398M|    if (best.ref) {
  ------------------
  |  Branch (917:9): [True: 167M, False: 230M]
  ------------------
  918|       |        // Backtrack to extend match backwards
  919|   167M|        const uint8_t* b_ip = ip;
  920|   167M|        const uint8_t* b_ref = best.ref;
  921|   177M|        while (b_ip > anchor && b_ref > src && b_ip[-1] == b_ref[-1]) {
  ------------------
  |  Branch (921:16): [True: 13.5M, False: 163M]
  |  Branch (921:33): [True: 13.5M, False: 18.4E]
  |  Branch (921:48): [True: 9.93M, False: 3.64M]
  ------------------
  922|  9.93M|            b_ip--;
  923|  9.93M|            b_ref--;
  924|  9.93M|            best.len++;
  925|  9.93M|            best.backtrack++;
  926|  9.93M|        }
  927|   167M|        best.ref = b_ref;
  928|   167M|    }
  929|       |
  930|       |    // Lazy: a match two bytes longer at ip+1, or from level 4 three bytes longer
  931|       |    // at ip+2, cancels this one.
  932|   398M|    if (p.use_lazy && best.ref && best.len < (uint32_t)p.lazy_len_threshold &&
  ------------------
  |  Branch (932:9): [True: 14.0M, False: 384M]
  |  Branch (932:23): [True: 4.63M, False: 9.41M]
  |  Branch (932:35): [True: 4.50M, False: 125k]
  ------------------
  933|  4.50M|        ip + 1 < search_limit) {
  ------------------
  |  Branch (933:9): [True: 4.50M, False: 18.4E]
  ------------------
  934|  4.50M|        if (zxc_lazy_probe(src, ip + 1, iend, best.len + 2, hash_table, hash_tags, chain_table,
  ------------------
  |  Branch (934:13): [True: 1.40M, False: 3.10M]
  ------------------
  935|  4.50M|                           epoch_mark, offset_mask, use_hash5, p) ||
  936|  3.10M|            (level >= ZXC_LEVEL_BALANCED && ip + 2 < search_limit &&
  ------------------
  |  Branch (936:14): [True: 1.98M, False: 1.12M]
  |  Branch (936:45): [True: 1.98M, False: 513]
  ------------------
  937|  1.98M|             zxc_lazy_probe(src, ip + 2, iend, best.len + 3, hash_table, hash_tags, chain_table,
  ------------------
  |  Branch (937:14): [True: 138k, False: 1.84M]
  ------------------
  938|  1.98M|                            epoch_mark, offset_mask, use_hash5, p)))
  939|  1.60M|            best.ref = NULL;
  940|  4.50M|    }
  941|       |
  942|   398M|    return best;
  943|   209M|}
zxc_compress.c:zxc_lazy_probe:
  608|  6.42M|                                            const int use_hash5, const zxc_lz77_params_t p) {
  609|  6.42M|    if (need > (size_t)(iend - lp)) return 0;  // too close to the end to win
  ------------------
  |  Branch (609:9): [True: 16.2k, False: 6.40M]
  ------------------
  610|       |
  611|  6.40M|    const uint64_t val8 = zxc_le64(lp);
  612|  6.40M|    const uint32_t val = (uint32_t)val8;
  613|  6.40M|    const uint32_t h = zxc_hash_func(val8, use_hash5);
  614|  6.40M|    const uint32_t pos = (uint32_t)(lp - src);
  615|  6.40M|    const uint32_t gate = zxc_le32(lp + need - 4);
  616|  6.40M|    uint32_t idx = zxc_epoch_pos(hash_table[h], offset_mask, epoch_mark);
  617|       |    // A head with another tag is another string: walk past it.
  618|  6.40M|    int skip = (hash_tags[h] != zxc_hash_tag(val));
  619|       |
  620|  22.9M|    for (int att = p.lazy_attempts; idx > 0 && att > 0; att--) {
  ------------------
  |  Branch (620:37): [True: 22.3M, False: 608k]
  |  Branch (620:48): [True: 20.0M, False: 2.24M]
  ------------------
  621|  20.0M|        if (UNLIKELY(pos - idx > ZXC_LZ_MAX_DIST)) break;
  ------------------
  |  |  152|  20.0M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 42.6k, False: 20.0M]
  |  |  ------------------
  ------------------
  622|  20.0M|        const uint8_t* const ref = src + idx;
  623|       |
  624|       |        // Filtered here too: a lazy hit only cancels best.ref, so a match
  625|       |        // we could never emit would drop a legal one for nothing.
  626|  20.0M|        if (pos - idx >= p.min_offset && !skip && zxc_le32(ref + need - 4) == gate &&
  ------------------
  |  Branch (626:13): [True: 20.0M, False: 18.4E]
  |  Branch (626:42): [True: 19.9M, False: 53.0k]
  |  Branch (626:51): [True: 4.08M, False: 15.8M]
  ------------------
  627|  4.08M|            zxc_le32(ref) == val && zxc_match_reaches(lp, ref, sizeof(uint32_t), need, iend))
  ------------------
  |  Branch (627:13): [True: 4.07M, False: 15.5k]
  |  Branch (627:37): [True: 1.59M, False: 2.47M]
  ------------------
  628|  1.59M|            return 1;
  629|       |
  630|  18.4M|        const uint16_t delta = chain_table[idx & ZXC_LZ_WINDOW_MASK];
  ------------------
  |  |  584|  18.4M|#define ZXC_LZ_WINDOW_MASK (ZXC_LZ_WINDOW_SIZE - 1U)
  |  |  ------------------
  |  |  |  |  582|  18.4M|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  |  |  ------------------
  ------------------
  631|  18.4M|        if (UNLIKELY(delta == 0)) break;
  ------------------
  |  |  152|  18.4M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 1.90M, False: 16.5M]
  |  |  ------------------
  ------------------
  632|  16.5M|        idx -= delta;
  633|  16.5M|        skip = 0;
  634|  16.5M|    }
  635|  4.81M|    return 0;
  636|  6.40M|}
zxc_compress.c:zxc_match_reaches:
  582|  4.06M|                                               const uint8_t* iend) {
  583|  11.4M|    while (from < need) {
  ------------------
  |  Branch (583:12): [True: 10.3M, False: 1.03M]
  ------------------
  584|  10.3M|        if (UNLIKELY((size_t)(iend - cur) - from < sizeof(uint64_t))) {
  ------------------
  |  |  152|  10.3M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 2.52k, False: 10.3M]
  |  |  ------------------
  ------------------
  585|  9.35k|            while (from < need && cur[from] == ref[from]) from++;
  ------------------
  |  Branch (585:20): [True: 7.66k, False: 1.68k]
  |  Branch (585:35): [True: 6.83k, False: 835]
  ------------------
  586|  2.52k|            return from >= need;
  587|  2.52k|        }
  588|  10.3M|        const uint64_t d = zxc_le64(cur + from) ^ zxc_le64(ref + from);
  589|  10.3M|        if (d != 0) return from + (uint32_t)(zxc_ctz64(d) >> 3) >= need;
  ------------------
  |  Branch (589:13): [True: 3.02M, False: 7.36M]
  ------------------
  590|  7.36M|        from += sizeof(uint64_t);
  591|  7.36M|    }
  592|  1.03M|    return 1;
  593|  4.06M|}
zxc_compress.c:zxc_flush_literals:
  540|  3.25M|                                                 const uint8_t* iend) {
  541|  3.25M|    if (LIKELY(anchor + ZXC_PAD_SIZE <= iend)) {
  ------------------
  |  |  146|  3.25M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 3.24M, False: 12.4k]
  |  |  ------------------
  ------------------
  542|  3.24M|        zxc_copy32(literals + *lit_c, anchor);
  543|  3.24M|        if (UNLIKELY(ll > ZXC_PAD_SIZE))
  ------------------
  |  |  152|  3.24M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 272k, False: 2.97M]
  |  |  ------------------
  ------------------
  544|   272k|            ZXC_MEMCPY(literals + *lit_c + ZXC_PAD_SIZE, anchor + ZXC_PAD_SIZE, ll - ZXC_PAD_SIZE);
  ------------------
  |  |  168|   272k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  545|  3.24M|    } else {
  546|  12.4k|        ZXC_MEMCPY(literals + *lit_c, anchor, ll);
  ------------------
  |  |  168|  12.4k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  547|  12.4k|    }
  548|  3.25M|    *lit_c += ll;
  549|  3.25M|}
zxc_compress.c:zxc_emit_extra:
  256|  41.6M|                                            const uint32_t val, const uint32_t mask) {
  257|  41.6M|    if (LIKELY(val < mask)) return 1;
  ------------------
  |  |  146|  41.6M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 38.0M, False: 3.59M]
  |  |  ------------------
  ------------------
  258|  3.59M|    const size_t n = zxc_write_varint(extras + *used, val - mask);
  259|  3.59M|    if (UNLIKELY(n == 0)) return 0;
  ------------------
  |  |  152|  3.59M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 3.59M]
  |  |  ------------------
  ------------------
  260|  3.59M|    *used += n;
  261|  3.59M|    return 1;
  262|  3.59M|}
zxc_compress.c:zxc_write_varint:
  220|  3.62M|static ZXC_ALWAYS_INLINE size_t zxc_write_varint(uint8_t* RESTRICT dst, const uint32_t val) {
  221|       |    // Values above ZXC_MAX_VARINT_VALUE are out-of-spec and the decoder would
  222|       |    // reject them. Unreachable from the Block API, so this is defence in depth;
  223|       |    // callers must treat a return of 0 as an encoding error.
  224|  3.62M|    if (UNLIKELY(val > ZXC_MAX_VARINT_VALUE)) {
  ------------------
  |  |  152|  3.62M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 3.62M]
  |  |  ------------------
  ------------------
  225|      0|        return 0;
  226|      0|    }
  227|       |
  228|       |    // 1 byte: 0xxxxxxx (7 bits)
  229|  3.62M|    if (LIKELY(val < ZXC_VARINT_1B_LIMIT)) {
  ------------------
  |  |  146|  3.62M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 3.01M, False: 610k]
  |  |  ------------------
  ------------------
  230|  3.01M|        dst[0] = (uint8_t)val;
  231|  3.01M|        return 1;
  232|  3.01M|    }
  233|       |
  234|       |    // 2 bytes: 10xxxxxx xxxxxxxx (14 bits)
  235|   610k|    if (LIKELY(val < ZXC_VARINT_2B_LIMIT)) {
  ------------------
  |  |  146|   610k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 597k, False: 12.4k]
  |  |  ------------------
  ------------------
  236|   597k|        dst[0] = (uint8_t)(0x80 | (val & 0x3F));
  237|   597k|        dst[1] = (uint8_t)(val >> 6);
  238|   597k|        return 2;
  239|   597k|    }
  240|       |
  241|       |    // 3 bytes: 110xxxxx xxxxxxxx xxxxxxxx (21 bits) -> max emittable value,
  242|       |    // matching ZXC_MAX_VARINT_VALUE = ZXC_BLOCK_SIZE_MAX - 1.
  243|  12.4k|    dst[0] = (uint8_t)(0xC0 | (val & 0x1F));
  244|  12.4k|    dst[1] = (uint8_t)(val >> 5);
  245|  12.4k|    dst[2] = (uint8_t)(val >> 13);
  246|  12.4k|    return 3;
  247|   610k|}
zxc_compress.c:zxc_lz77_lazy_parse_pak_l1:
 2473|  24.7k|                                                   size_t* lit_c_out, size_t* extras_c_out) {
 2474|  24.7k|    return zxc_lz77_lazy_parse_pak_impl(ctx, src, src_sz, epoch_mark, min_offset, seq_c_out,
 2475|  24.7k|                                        lit_c_out, extras_c_out, ZXC_LEVEL_FASTEST);
 2476|  24.7k|}
zxc_compress.c:zxc_spl_parse:
 1792|   111k|                         size_t* RESTRICT extras_sz_out, uint16_t* RESTRICT max_offset_out) {
 1793|   111k|    const int level = ctx->compression_level;
 1794|   111k|    const size_t dict_sz = ctx->dict_size;
 1795|       |
 1796|   111k|    zxc_lz77_params_t lzp = zxc_get_lz77_params(level);
 1797|       |    // The floor is a candidate until the block itself clears it.
 1798|   111k|    if (lzp.min_offset > 1 && zxc_block_is_short_dist_bound(src + dict_sz, src_sz - dict_sz))
  ------------------
  |  Branch (1798:9): [True: 38.1k, False: 73.4k]
  |  Branch (1798:31): [True: 29.6k, False: 8.52k]
  ------------------
 1799|  29.6k|        lzp.min_offset = 1;
 1800|       |
 1801|   111k|    const uint32_t offset_mask = ctx->offset_mask;
 1802|   111k|    const uint32_t epoch_mark = zxc_lz_begin_block(ctx, src, dict_sz, level);
 1803|       |
 1804|   111k|    uint8_t* const literals = ctx->literals;
 1805|   111k|    uint8_t* const buf_tokens = ctx->buf_tokens;
 1806|   111k|    uint16_t* const buf_offsets = ctx->buf_offsets;
 1807|   111k|    uint8_t* const buf_extras = ctx->buf_extras;
 1808|       |
 1809|   111k|    uint32_t seq_c = 0;
 1810|   111k|    size_t lit_c = 0;
 1811|   111k|    size_t extras_sz = 0;
 1812|   111k|    uint16_t max_offset = 0;  // Track max offset for 1-byte/2-byte mode decision
 1813|       |
 1814|       |    // Level 6+: price-based optimal parser; below it, the lazy loop built for
 1815|       |    // the level at hand.
 1816|   111k|    int parse_rc;
 1817|   111k|    if (level >= ZXC_LEVEL_DENSITY) {
  ------------------
  |  Branch (1817:9): [True: 73.4k, False: 38.1k]
  ------------------
 1818|  73.4k|        parse_rc = zxc_lz77_optimal_parse_spl(ctx, src, src_sz, ctx->hash_table, ctx->hash_tags,
 1819|  73.4k|                                              ctx->chain_table, epoch_mark, offset_mask, level,
 1820|  73.4k|                                              literals, buf_tokens, buf_offsets, buf_extras, &seq_c,
 1821|  73.4k|                                              &lit_c, &extras_sz, &max_offset);
 1822|  73.4k|    } else if (level == ZXC_LEVEL_DEFAULT) {
  ------------------
  |  Branch (1822:16): [True: 11.3k, False: 26.8k]
  ------------------
 1823|  11.3k|        parse_rc = zxc_lz77_lazy_parse_spl_l3(ctx, src, src_sz, epoch_mark, lzp.min_offset, &seq_c,
 1824|  11.3k|                                              &lit_c, &extras_sz, &max_offset);
 1825|  26.8k|    } else if (level == ZXC_LEVEL_BALANCED) {
  ------------------
  |  Branch (1825:16): [True: 15.8k, False: 10.9k]
  ------------------
 1826|  15.8k|        parse_rc = zxc_lz77_lazy_parse_spl_l4(ctx, src, src_sz, epoch_mark, lzp.min_offset, &seq_c,
 1827|  15.8k|                                              &lit_c, &extras_sz, &max_offset);
 1828|  15.8k|    } else {
 1829|  10.9k|        parse_rc = zxc_lz77_lazy_parse_spl_l5(ctx, src, src_sz, epoch_mark, lzp.min_offset, &seq_c,
 1830|  10.9k|                                              &lit_c, &extras_sz, &max_offset);
 1831|  10.9k|    }
 1832|   111k|    if (UNLIKELY(parse_rc != ZXC_OK)) return parse_rc;
  ------------------
  |  |  152|   111k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 111k]
  |  |  ------------------
  ------------------
 1833|       |
 1834|       |    // Per-block match splitting on the parsed block (see zxc_spl_match_split_block).
 1835|   111k|    seq_c = zxc_spl_match_split_block(
 1836|   111k|        buf_tokens, buf_offsets, buf_extras, &extras_sz, ctx->buf_split, ctx->buf_split_hist, seq_c,
 1837|   111k|        lit_c, (max_offset <= UINT8_MAX) ? 1U : 2U, lzp.split_max, ctx->split_budget_pct);
  ------------------
  |  Branch (1837:16): [True: 29.4k, False: 82.1k]
  ------------------
 1838|       |    // Dictionary-table trainer hook: accumulate the REAL post-LZ literal
 1839|       |    // frequencies (see zxc_dict_train_huf). Cold path, NULL outside training.
 1840|   111k|    if (UNLIKELY(ctx->lit_freq_acc)) {
  ------------------
  |  |  152|   111k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 111k]
  |  |  ------------------
  ------------------
 1841|      0|        for (size_t i = 0; i < lit_c; i++) ctx->lit_freq_acc[literals[i]]++;
  ------------------
  |  Branch (1841:28): [True: 0, False: 0]
  ------------------
 1842|      0|    }
 1843|       |
 1844|   111k|    *seq_c_out = seq_c;
 1845|   111k|    *lit_c_out = lit_c;
 1846|   111k|    *extras_sz_out = extras_sz;
 1847|   111k|    *max_offset_out = max_offset;
 1848|   111k|    return ZXC_OK;
 1849|   111k|}
zxc_compress.c:zxc_lz77_optimal_parse_spl:
 1212|  73.4k|                                      uint16_t* RESTRICT max_offset_out) {
 1213|  73.4k|    zxc_lz77_params_t lzp_opt = zxc_get_lz77_params(level);
 1214|  73.4k|    lzp_opt.use_lazy = 0;  // guard
 1215|       |
 1216|       |    // With a dictionary, src = [dict | block]. The DP arrays index from the block
 1217|       |    // start, so src_base points at the first block byte for literal copies while
 1218|       |    // src stays the match finder's base.
 1219|  73.4k|    const size_t dict_sz = ctx->dict_size;
 1220|  73.4k|    const size_t block_sz = src_sz - dict_sz;
 1221|  73.4k|    const uint8_t* const src_base = src + dict_sz;
 1222|  73.4k|    const uint8_t* const iend = src + src_sz;
 1223|       |
 1224|       |    // Block too small for any match: emit all as literals.
 1225|  73.4k|    if (UNLIKELY(block_sz < ZXC_LZ_SEARCH_MARGIN + 1)) {
  ------------------
  |  |  152|  73.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 76, False: 73.3k]
  |  |  ------------------
  ------------------
 1226|     76|        if (block_sz > 0) ZXC_MEMCPY(literals, src_base, block_sz);
  ------------------
  |  |  168|     76|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  |  Branch (1226:13): [True: 76, False: 0]
  ------------------
 1227|     76|        *lit_c_out = block_sz;
 1228|     76|        *seq_c_out = 0;
 1229|     76|        *extras_sz_out = 0;
 1230|     76|        *max_offset_out = 0;
 1231|     76|        return 0;
 1232|     76|    }
 1233|       |
 1234|  73.3k|    const size_t search_limit_pos = block_sz - ZXC_LZ_SEARCH_MARGIN;
  ------------------
  |  |  765|  73.3k|#define ZXC_LZ_SEARCH_MARGIN (sizeof(uint64_t))
  ------------------
 1235|  73.3k|    const uint8_t* const search_limit = src + search_limit_pos;
 1236|       |
 1237|       |    // DP arrays carved from ctx->opt_scratch, one allocation reused across
 1238|       |    // blocks, each sub-buffer cache-line padded.
 1239|       |    //
 1240|       |    //   dp             : (chunk+1) x u32: min cost to reach position p.
 1241|       |    //   parent_len     : (chunk+1) x u16: 0 = literal, >= MIN_MATCH = match.
 1242|       |    //   parent_off     : (chunk+1) x u16: biased match offset (distance-1).
 1243|       |    //   match_end_bits : one bit per position, set when a match on the chosen
 1244|       |    //                    path ends there - a forward actions[] stack at 1/64
 1245|       |    //                    the cost.
 1246|       |    //
 1247|       |    // The same buffer doubles as package-merge scratch for the code-length
 1248|       |    // builder: that scratch is live before the DP and after the parse is read
 1249|       |    // out, never during, so capacity is just the larger of the two.
 1250|  73.3k|    size_t sz_dp;
 1251|  73.3k|    size_t sz_pl;
 1252|  73.3k|    size_t sz_po;
 1253|  73.3k|    size_t sz_bm;
 1254|  73.3k|    zxc_opt_dp_sizes(ctx->chunk_size, &sz_dp, &sz_pl, &sz_po, &sz_bm);
 1255|  73.3k|    const size_t n_bm_words = ZXC_BITMAP_WORDS(block_sz + 1);
  ------------------
  |  |  393|  73.3k|#define ZXC_BITMAP_WORDS(n_bits) (((n_bits) + 63) / 64)
  ------------------
 1256|       |
 1257|       |    // Per-block literal cost (sample only block data, not dict prefix):
 1258|  73.3k|    const uint32_t lit_cost = zxc_opt_estimate_lit_bits(src_base, block_sz, ctx->opt_scratch);
 1259|       |
 1260|  73.3k|    uint32_t* const dp = (uint32_t*)ctx->opt_scratch;
 1261|  73.3k|    uint16_t* const parent_len = (uint16_t*)(ctx->opt_scratch + sz_dp);
 1262|  73.3k|    uint16_t* const parent_off = (uint16_t*)(ctx->opt_scratch + sz_dp + sz_pl);
 1263|  73.3k|    uint64_t* const match_end_bits = (uint64_t*)(ctx->opt_scratch + sz_dp + sz_pl + sz_po);
 1264|       |
 1265|  73.3k|    dp[0] = 0;
 1266|  73.3k|    ZXC_MEMSET(dp + 1, 0xFF, block_sz * sizeof(uint32_t));
  ------------------
  |  |  173|  73.3k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 1267|  73.3k|    ZXC_MEMSET(match_end_bits, 0, n_bm_words * sizeof(uint64_t));
  ------------------
  |  |  173|  73.3k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 1268|       |
 1269|       |    // Forward DP: visit every position, update reachable successors.
 1270|       |    // `skip_until` suppresses find_best_match strictly inside the last long
 1271|       |    // match - the transition from its start already covers dp[p+1..p+L], and
 1272|       |    // re-searching there is what makes the parser quadratic on repetitive data.
 1273|  73.3k|    size_t skip_until = 0;
 1274|       |    // Rolling repeat-offset seed for find_best_match
 1275|  73.3k|    uint32_t last_off = 0;
 1276|       |    // Previous matched position and the length relaxed from it.
 1277|  73.3k|    size_t prev_p = 0;
 1278|  73.3k|    size_t prev_len = 0;
 1279|   692M|    for (size_t p = 0; p < search_limit_pos; p++) {
  ------------------
  |  Branch (1279:24): [True: 692M, False: 73.3k]
  ------------------
 1280|   692M|        if (UNLIKELY(dp[p] == UINT32_MAX)) continue;
  ------------------
  |  |  152|   692M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 692M]
  |  |  ------------------
  ------------------
 1281|       |
 1282|       |        // Literal transition.
 1283|   692M|        const uint32_t lit_next = dp[p] + lit_cost;
 1284|   692M|        if (lit_next < dp[p + 1]) {
  ------------------
  |  Branch (1284:13): [True: 242M, False: 450M]
  ------------------
 1285|   242M|            dp[p + 1] = lit_next;
 1286|   242M|            parent_len[p + 1] = 0;
 1287|   242M|        }
 1288|       |
 1289|   692M|        if (p < skip_until) continue;
  ------------------
  |  Branch (1289:13): [True: 322M, False: 370M]
  ------------------
 1290|       |
 1291|       |        // Match transition: no lazy, no backtrack (anchor=ip). Sub-lengths are
 1292|       |        // iterated because any L <= max_L matches at the same offset and may end
 1293|       |        // at a more useful DP position. ip is absolute so dict references
 1294|       |        // resolve against src.
 1295|   370M|        const uint8_t* ip = src_base + p;
 1296|   370M|        const zxc_match_t m = zxc_lz77_find_best_match(
 1297|   370M|            src, ip, zxc_hash_func(zxc_le64(ip), zxc_lz77_use_hash5(level)), iend, search_limit,
 1298|   370M|            /*anchor=*/ip, hash_table, hash_tags, chain_table, epoch_mark, offset_mask, level,
 1299|   370M|            lzp_opt, last_off);
 1300|       |
 1301|   370M|        if (m.ref) {
  ------------------
  |  Branch (1301:13): [True: 160M, False: 209M]
  ------------------
 1302|   160M|            const uint32_t off = (uint32_t)(ip - m.ref);
 1303|   160M|            if (off > 0 && off <= ZXC_LZ_WINDOW_SIZE) {
  ------------------
  |  |  582|   160M|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  ------------------
  |  Branch (1303:17): [True: 160M, False: 18.4E]
  |  Branch (1303:28): [True: 160M, False: 18.4E]
  ------------------
 1304|   160M|                last_off = off;
 1305|   160M|                const size_t L_max_raw = (m.len > block_sz - p) ? (block_sz - p) : (size_t)m.len;
  ------------------
  |  Branch (1305:42): [True: 0, False: 160M]
  ------------------
 1306|   160M|                const size_t L_max = (L_max_raw > UINT16_MAX) ? UINT16_MAX : L_max_raw;
  ------------------
  |  Branch (1306:38): [True: 34, False: 160M]
  ------------------
 1307|       |
 1308|       |                // Cost is piecewise constant in varint segments, so split
 1309|       |                // [MIN_MATCH, L_max] into:
 1310|       |                //   1. cheap   : v < ML_MASK                   -> base
 1311|       |                //   2. varint1 : v in [ML_MASK, ML_MASK + VARINT_1B_LIMIT) -> base + 8
 1312|       |                //   3. varint2+: v >= ML_MASK + VARINT_1B_LIMIT            -> base + 16, ...
 1313|       |                // The first two have a constant nxt and vectorize; the third is
 1314|       |                // rare enough to stay scalar.
 1315|   160M|                const uint16_t off_biased = (uint16_t)(off - ZXC_LZ_OFFSET_BIAS);
  ------------------
  |  |  724|   160M|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1316|   160M|                const size_t L_max_plus = L_max + 1;
 1317|   160M|                const size_t L_cheap_end = ZXC_LZ_MIN_MATCH_LEN + ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  586|   160M|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
                              const size_t L_cheap_end = ZXC_LZ_MIN_MATCH_LEN + ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  524|   160M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|   160M|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
 1318|   160M|                const size_t L_v1_end = L_cheap_end + ZXC_VARINT_1B_LIMIT;
  ------------------
  |  |  600|   160M|#define ZXC_VARINT_1B_LIMIT (1U << 7)
  ------------------
 1319|   160M|                const uint32_t nxt_cheap = dp[p] + ZXC_OPT_MATCH_COST_BASE;
  ------------------
  |  |  774|   160M|#define ZXC_OPT_MATCH_COST_BASE ((uint32_t)(3U * CHAR_BIT))
  ------------------
 1320|   160M|                const uint32_t nxt_v1 = nxt_cheap + CHAR_BIT;
 1321|       |
 1322|       |                // Covered: each processed position q bounds dp[q+l] by
 1323|       |                // dp[q] + cost(l), by relaxing or through its own predecessor.
 1324|       |                // With dp[p] >= dp[p-1], length l only wins where cost(l) <
 1325|       |                // cost(l+1): the last length of the two classes below
 1326|       |                // ZXC_OPT_LONG_MATCH_SKIP. Costs ignore the offset.
 1327|   160M|                const int covered = prev_len > L_max && prev_p + 1 == p && dp[p] >= dp[p - 1];
  ------------------
  |  Branch (1327:37): [True: 136M, False: 24.0M]
  |  Branch (1327:57): [True: 136M, False: 59.5k]
  |  Branch (1327:76): [True: 133M, False: 2.71M]
  ------------------
 1328|   160M|                prev_p = p;
 1329|   160M|                prev_len = L_max;
 1330|       |
 1331|   160M|                if (covered) {
  ------------------
  |  Branch (1331:21): [True: 133M, False: 26.7M]
  ------------------
 1332|   133M|                    if (L_max_plus >= L_cheap_end)
  ------------------
  |  Branch (1332:25): [True: 45.6M, False: 87.9M]
  ------------------
 1333|  45.6M|                        zxc_opt_relax(dp, parent_len, parent_off, p, L_cheap_end - 1, nxt_cheap,
 1334|  45.6M|                                      off_biased);
 1335|   133M|                    if (L_max_plus >= L_v1_end)
  ------------------
  |  Branch (1335:25): [True: 4.95M, False: 128M]
  ------------------
 1336|  4.95M|                        zxc_opt_relax(dp, parent_len, parent_off, p, L_v1_end - 1, nxt_v1,
 1337|  4.95M|                                      off_biased);
 1338|   133M|                } else {
 1339|       |                    // 1. Cheap range.
 1340|  26.7M|                    size_t L = zxc_opt_dp_update_const_cost(
 1341|  26.7M|                        dp, parent_len, parent_off, p, ZXC_LZ_MIN_MATCH_LEN,
  ------------------
  |  |  586|  26.7M|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1342|  26.7M|                        (L_max_plus < L_cheap_end) ? L_max_plus : L_cheap_end, nxt_cheap,
  ------------------
  |  Branch (1342:25): [True: 26.1M, False: 545k]
  ------------------
 1343|  26.7M|                        off_biased);
 1344|       |
 1345|       |                    // 2. First varint level (1-byte extension).
 1346|  26.7M|                    if (L < L_max_plus)
  ------------------
  |  Branch (1346:25): [True: 2.06M, False: 24.6M]
  ------------------
 1347|  2.06M|                        L = zxc_opt_dp_update_const_cost(
 1348|  2.06M|                            dp, parent_len, parent_off, p, L,
 1349|  2.06M|                            (L_max_plus < L_v1_end) ? L_max_plus : L_v1_end, nxt_v1, off_biased);
  ------------------
  |  Branch (1349:29): [True: 1.78M, False: 283k]
  ------------------
 1350|       |
 1351|       |                    // 3. Higher varint levels: variable cost, kept scalar.
 1352|       |                    // Reached only by L >= ML_MASK + 128 + MIN_MATCH, so the
 1353|       |                    // v >= ML_MASK guard from the original loop is implied.
 1354|   329M|                    for (; L < L_max_plus; L++) {
  ------------------
  |  Branch (1354:28): [True: 302M, False: 26.7M]
  ------------------
 1355|   302M|                        uint32_t cost = ZXC_OPT_MATCH_COST_BASE;
  ------------------
  |  |  774|   302M|#define ZXC_OPT_MATCH_COST_BASE ((uint32_t)(3U * CHAR_BIT))
  ------------------
 1356|   302M|                        uint32_t v = (uint32_t)(L - ZXC_LZ_MIN_MATCH_LEN) - ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  586|   302M|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
                                      uint32_t v = (uint32_t)(L - ZXC_LZ_MIN_MATCH_LEN) - ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  524|   302M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|   302M|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
 1357|   302M|                        cost += CHAR_BIT;
 1358|   663M|                        while (v >= 128) {
  ------------------
  |  Branch (1358:32): [True: 360M, False: 302M]
  ------------------
 1359|   360M|                            v >>= 7;
 1360|   360M|                            cost += CHAR_BIT;
 1361|   360M|                        }
 1362|   302M|                        zxc_opt_relax(dp, parent_len, parent_off, p, L, dp[p] + cost, off_biased);
 1363|   302M|                    }
 1364|  26.7M|                }
 1365|   160M|                if (UNLIKELY(L_max >= ZXC_OPT_LONG_MATCH_SKIP)) skip_until = p + L_max - 1;
  ------------------
  |  |  152|   160M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 151k, False: 160M]
  |  |  ------------------
  ------------------
 1366|   160M|            }
 1367|   160M|        }
 1368|   370M|    }
 1369|       |
 1370|       |    // Tail (last ZXC_LZ_SEARCH_MARGIN bytes) can only be literals: the match finder
 1371|       |    // stops at search_limit so its 8-byte probe reads stay in bounds.
 1372|   660k|    for (size_t p = search_limit_pos; p < block_sz; p++) {
  ------------------
  |  Branch (1372:39): [True: 587k, False: 73.3k]
  ------------------
 1373|   587k|        if (UNLIKELY(dp[p] == UINT32_MAX)) continue;
  ------------------
  |  |  152|   587k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 587k]
  |  |  ------------------
  ------------------
 1374|   587k|        const uint32_t lit_next = dp[p] + lit_cost;
 1375|   587k|        if (lit_next < dp[p + 1]) {
  ------------------
  |  Branch (1375:13): [True: 211k, False: 375k]
  ------------------
 1376|   211k|            dp[p + 1] = lit_next;
 1377|   211k|            parent_len[p + 1] = 0;
 1378|   211k|        }
 1379|   587k|    }
 1380|       |
 1381|       |    // Backtrack from src_sz to 0. Only match endpoints are recorded; literals
 1382|       |    // are the unmarked runs between them, rebuilt at emission from lit_start,
 1383|       |    // so they need no backtrack storage.
 1384|  73.3k|    {
 1385|  73.3k|        size_t pos = block_sz;
 1386|   215M|        while (pos > 0) {
  ------------------
  |  Branch (1386:16): [True: 215M, False: 73.3k]
  ------------------
 1387|   215M|            const uint32_t L = parent_len[pos];
 1388|   215M|            if (L == 0) {
  ------------------
  |  Branch (1388:17): [True: 200M, False: 15.0M]
  ------------------
 1389|   200M|                pos -= 1;
 1390|   200M|            } else {
 1391|  15.0M|                match_end_bits[pos >> 6] |= (uint64_t)1 << (pos & 63);
 1392|  15.0M|                pos -= L;
 1393|  15.0M|            }
 1394|   215M|        }
 1395|  73.3k|    }
 1396|       |
 1397|       |    // Forward emission: walk match_end_bits word-by-word, peeling set bits
 1398|       |    // with ctzll. Each set bit gives a match endpoint; parent_len/parent_off
 1399|       |    // at that position recover (length, offset).
 1400|  73.3k|    uint32_t seq_c = 0;
 1401|  73.3k|    size_t lit_c = 0;
 1402|  73.3k|    size_t extras_sz = 0;
 1403|  73.3k|    uint16_t max_offset = 0;
 1404|  73.3k|    size_t lit_start = 0;
 1405|       |
 1406|  11.3M|    for (size_t word_idx = 0; word_idx < n_bm_words; word_idx++) {
  ------------------
  |  Branch (1406:31): [True: 11.2M, False: 73.3k]
  ------------------
 1407|  11.2M|        uint64_t w = match_end_bits[word_idx];
 1408|  26.3M|        while (w) {
  ------------------
  |  Branch (1408:16): [True: 15.0M, False: 11.2M]
  ------------------
 1409|  15.0M|            const size_t pos = (word_idx << 6) + (size_t)zxc_ctz64(w);
 1410|  15.0M|            w &= w - 1;
 1411|  15.0M|            const uint32_t L = parent_len[pos];
 1412|  15.0M|            const uint16_t off_biased = parent_off[pos];
 1413|  15.0M|            const size_t match_start = pos - L;
 1414|       |
 1415|  15.0M|            const size_t LL = match_start - lit_start;
 1416|  15.0M|            if (LL > 0) {
  ------------------
  |  Branch (1416:17): [True: 13.1M, False: 1.95M]
  ------------------
 1417|  13.1M|                ZXC_MEMCPY(literals + lit_c, src_base + lit_start, LL);
  ------------------
  |  |  168|  13.1M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1418|  13.1M|                lit_c += LL;
 1419|  13.1M|            }
 1420|  15.0M|            const uint32_t ll = (uint32_t)LL;
 1421|  15.0M|            const uint32_t ml = L - ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  586|  15.0M|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1422|  15.0M|            if (UNLIKELY(!zxc_spl_put_seq(buf_tokens, buf_offsets, buf_extras, &seq_c, &extras_sz,
  ------------------
  |  |  152|  15.0M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 15.0M]
  |  |  ------------------
  ------------------
 1423|  15.0M|                                          &max_offset, ll, ml, off_biased)))
 1424|      0|                return ZXC_ERROR_OVERFLOW;
 1425|  15.0M|            lit_start = pos;
 1426|  15.0M|        }
 1427|  11.2M|    }
 1428|       |
 1429|       |    // Tail literals after the last match (or all literals if no match).
 1430|  73.3k|    if (lit_start < block_sz) {
  ------------------
  |  Branch (1430:9): [True: 31.1k, False: 42.2k]
  ------------------
 1431|  31.1k|        const size_t tail = block_sz - lit_start;
 1432|  31.1k|        ZXC_MEMCPY(literals + lit_c, src_base + lit_start, tail);
  ------------------
  |  |  168|  31.1k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1433|  31.1k|        lit_c += tail;
 1434|  31.1k|    }
 1435|       |
 1436|  73.3k|    *seq_c_out = seq_c;
 1437|  73.3k|    *lit_c_out = lit_c;
 1438|  73.3k|    *extras_sz_out = extras_sz;
 1439|  73.3k|    *max_offset_out = max_offset;
 1440|  73.3k|    return 0;
 1441|  73.3k|}
zxc_compress.c:zxc_opt_estimate_lit_bits:
 1127|  73.3k|                                          void* RESTRICT scratch) {
 1128|  73.3k|    if (UNLIKELY(src_sz < ZXC_OPT_LIT_SAMPLE_MIN)) return CHAR_BIT;
  ------------------
  |  |  152|  73.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 2.12k, False: 71.2k]
  |  |  ------------------
  ------------------
 1129|       |
 1130|  71.2k|    uint32_t hist[ZXC_HUF_NUM_SYMBOLS] = {0};
 1131|  71.2k|    const size_t step =
 1132|  71.2k|        (src_sz > ZXC_OPT_LIT_SAMPLE_TARGET) ? src_sz / ZXC_OPT_LIT_SAMPLE_TARGET : 1U;
  ------------------
  |  |  787|  71.2k|#define ZXC_OPT_LIT_SAMPLE_TARGET 4096
  ------------------
                      (src_sz > ZXC_OPT_LIT_SAMPLE_TARGET) ? src_sz / ZXC_OPT_LIT_SAMPLE_TARGET : 1U;
  ------------------
  |  |  787|  10.7k|#define ZXC_OPT_LIT_SAMPLE_TARGET 4096
  ------------------
  |  Branch (1132:9): [True: 10.7k, False: 60.4k]
  ------------------
 1133|  71.2k|    size_t sampled = 0;
 1134|   284M|    for (size_t i = 0; i < src_sz; i += step) {
  ------------------
  |  Branch (1134:24): [True: 284M, False: 71.2k]
  ------------------
 1135|   284M|        hist[src[i]]++;
 1136|   284M|        sampled++;
 1137|   284M|    }
 1138|       |
 1139|  71.2k|    uint8_t code_len[ZXC_HUF_NUM_SYMBOLS];
 1140|  71.2k|    if (UNLIKELY(zxc_huf_build_code_lengths(hist, code_len, scratch,
  ------------------
  |  |  152|  71.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 71.2k]
  |  |  ------------------
  ------------------
 1141|  71.2k|                                            ZXC_HUF_MAX_CODE_LEN_DENSITY) != ZXC_OK))
 1142|      0|        return CHAR_BIT;
 1143|       |
 1144|       |    // Sample-weighted sum of code lengths = predicted Huffman bits; divide by
 1145|       |    // the sample count for bits/byte, rounded up. The DP is integer, and
 1146|       |    // rounding up favours matches over fractional-cost literals.
 1147|  71.2k|    uint32_t total_bits = 0;
 1148|  18.3M|    for (int k = 0; k < ZXC_HUF_NUM_SYMBOLS; k++) {
  ------------------
  |  |  833|  18.3M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (1148:21): [True: 18.2M, False: 71.2k]
  ------------------
 1149|  18.2M|        total_bits += hist[k] * (uint32_t)code_len[k];
 1150|  18.2M|    }
 1151|  71.2k|    const uint32_t n = (uint32_t)sampled;
 1152|  71.2k|    const uint32_t avg = (total_bits + n - 1) / n;
 1153|       |
 1154|       |    // Cap at RAW cost: if Huffman can't beat 8 bits/byte on the sample,
 1155|       |    // the encoder will pick RAW anyway and 8 is the actual literal cost.
 1156|  71.2k|    return (avg < CHAR_BIT) ? avg : CHAR_BIT;
  ------------------
  |  Branch (1156:12): [True: 53.1k, False: 18.1k]
  ------------------
 1157|  71.2k|}
zxc_compress.c:zxc_opt_relax:
  953|   404M|                                            const uint16_t off_biased) {
  954|   404M|    if (nxt < dp[p + L]) {
  ------------------
  |  Branch (954:9): [True: 348M, False: 55.7M]
  ------------------
  955|   348M|        dp[p + L] = nxt;
  956|   348M|        parent_len[p + L] = (uint16_t)L;
  957|   348M|        parent_off[p + L] = off_biased;
  958|   348M|    }
  959|   404M|}
zxc_compress.c:zxc_opt_dp_update_const_cost:
 1003|  30.3M|    const size_t p, size_t L, const size_t L_end, const uint32_t nxt, const uint16_t off_biased) {
 1004|       |#if defined(ZXC_USE_AVX512) && defined(__AVX512VL__)
 1005|       |    if (L + 16 <= L_end) {
 1006|       |        const __m512i v_inc =
 1007|       |            _mm512_setr_epi32(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
 1008|       |        const __m512i v_nxt = _mm512_set1_epi32((int)nxt);
 1009|       |        const __m256i v_off = _mm256_set1_epi16((int16_t)off_biased);
 1010|       |        for (; L + 16 <= L_end; L += 16) {
 1011|       |            const __m512i v_L_lanes = _mm512_add_epi32(v_inc, _mm512_set1_epi32((int)L));
 1012|       |            const __m512i v_dp = _mm512_loadu_si512((const void*)&dp[p + L]);
 1013|       |            const __mmask16 m = _mm512_cmplt_epu32_mask(v_nxt, v_dp);
 1014|       |            _mm512_mask_storeu_epi32(&dp[p + L], m, v_nxt);
 1015|       |            const __m256i v_L_u16 = _mm512_cvtusepi32_epi16(v_L_lanes);
 1016|       |            _mm256_mask_storeu_epi16((void*)&parent_len[p + L], m, v_L_u16);
 1017|       |            _mm256_mask_storeu_epi16((void*)&parent_off[p + L], m, v_off);
 1018|       |        }
 1019|       |    }
 1020|       |#elif defined(ZXC_USE_AVX2)
 1021|       |    if (L + 8 <= L_end) {
 1022|       |        const __m256i v_inc = _mm256_setr_epi32(0, 1, 2, 3, 4, 5, 6, 7);
 1023|       |        const __m256i v_nxt = _mm256_set1_epi32((int)nxt);
 1024|       |        const __m256i v_bias = _mm256_set1_epi32((int)0x80000000);
 1025|       |        const __m256i v_nxt_b = _mm256_xor_si256(v_nxt, v_bias);
 1026|       |        const __m128i v_off = _mm_set1_epi16((int16_t)off_biased);
 1027|       |        for (; L + 8 <= L_end; L += 8) {
 1028|       |            const __m256i v_L_lanes = _mm256_add_epi32(v_inc, _mm256_set1_epi32((int)L));
 1029|       |            const __m256i v_dp = _mm256_loadu_si256((const __m256i*)&dp[p + L]);
 1030|       |            // Unsigned-compare-via-bias trick:
 1031|       |            //   (dp ^ 0x80000000) > (nxt ^ 0x80000000)  iff  dp > nxt
 1032|       |            // because XOR with the sign bit maps unsigned ordering to
 1033|       |            // signed ordering. AVX2 only has signed cmpgt for 32-bit.
 1034|       |            const __m256i v_dp_b = _mm256_xor_si256(v_dp, v_bias);
 1035|       |            const __m256i v_mask = _mm256_cmpgt_epi32(v_dp_b, v_nxt_b);
 1036|       |            const __m256i v_dp_new = _mm256_blendv_epi8(v_dp, v_nxt, v_mask);
 1037|       |            _mm256_storeu_si256((__m256i*)&dp[p + L], v_dp_new);
 1038|       |            // Pack 8x int32 mask -> 8x int16 mask with signed saturation:
 1039|       |            // 0xFFFFFFFF -> 0xFFFF, 0x00000000 -> 0x0000.
 1040|       |            const __m128i v_mask16 = _mm_packs_epi32(_mm256_castsi256_si128(v_mask),
 1041|       |                                                     _mm256_extracti128_si256(v_mask, 1));
 1042|       |            const __m128i v_L_u16 = _mm_packus_epi32(_mm256_castsi256_si128(v_L_lanes),
 1043|       |                                                     _mm256_extracti128_si256(v_L_lanes, 1));
 1044|       |            const __m128i v_pl = _mm_loadu_si128((const __m128i*)&parent_len[p + L]);
 1045|       |            const __m128i v_pl_new = _mm_blendv_epi8(v_pl, v_L_u16, v_mask16);
 1046|       |            _mm_storeu_si128((__m128i*)&parent_len[p + L], v_pl_new);
 1047|       |            const __m128i v_po = _mm_loadu_si128((const __m128i*)&parent_off[p + L]);
 1048|       |            const __m128i v_po_new = _mm_blendv_epi8(v_po, v_off, v_mask16);
 1049|       |            _mm_storeu_si128((__m128i*)&parent_off[p + L], v_po_new);
 1050|       |        }
 1051|       |    }
 1052|       |#elif defined(ZXC_USE_NEON64) || defined(ZXC_USE_NEON32)
 1053|       |    if (L + 4 <= L_end) {
 1054|       |        static const uint32_t k_inc_array[4] = {0, 1, 2, 3};
 1055|       |        const uint32x4_t v_inc = vld1q_u32(k_inc_array);
 1056|       |        const uint32x4_t v_nxt = vdupq_n_u32(nxt);
 1057|       |        const uint16x4_t v_off = vdup_n_u16(off_biased);
 1058|       |        for (; L + 4 <= L_end; L += 4) {
 1059|       |            const uint32x4_t v_L_lanes = vaddq_u32(v_inc, vdupq_n_u32((uint32_t)L));
 1060|       |            const uint32x4_t v_dp = vld1q_u32(&dp[p + L]);
 1061|       |            const uint32x4_t v_mask = vcgtq_u32(v_dp, v_nxt);
 1062|       |            vst1q_u32(&dp[p + L], vbslq_u32(v_mask, v_nxt, v_dp));
 1063|       |            const uint16x4_t v_mask16 = vmovn_u32(v_mask);
 1064|       |            const uint16x4_t v_L_u16 = vqmovn_u32(v_L_lanes);
 1065|       |            const uint16x4_t v_pl = vld1_u16(&parent_len[p + L]);
 1066|       |            vst1_u16(&parent_len[p + L], vbsl_u16(v_mask16, v_L_u16, v_pl));
 1067|       |            const uint16x4_t v_po = vld1_u16(&parent_off[p + L]);
 1068|       |            vst1_u16(&parent_off[p + L], vbsl_u16(v_mask16, v_off, v_po));
 1069|       |        }
 1070|       |    }
 1071|       |#elif defined(ZXC_OPT_SSE2)
 1072|  30.3M|    if (L + 4 <= L_end) {
  ------------------
  |  Branch (1072:9): [True: 20.9M, False: 9.40M]
  ------------------
 1073|  20.9M|        const __m128i v_inc = _mm_setr_epi32(0, 1, 2, 3);
 1074|  20.9M|        const __m128i v_nxt = _mm_set1_epi32((int)nxt);
 1075|  20.9M|        const __m128i v_bias = _mm_set1_epi32((int)0x80000000);
 1076|  20.9M|        const __m128i v_nxt_b = _mm_xor_si128(v_nxt, v_bias);
 1077|  20.9M|        const __m128i v_off = _mm_set1_epi16((short)off_biased);
 1078|  67.2M|        for (; L + 4 <= L_end; L += 4) {
  ------------------
  |  Branch (1078:16): [True: 46.2M, False: 20.9M]
  ------------------
 1079|  46.2M|            const __m128i v_L_lanes = _mm_add_epi32(v_inc, _mm_set1_epi32((int)L));
 1080|  46.2M|            const __m128i v_dp = _mm_loadu_si128((const __m128i*)&dp[p + L]);
 1081|       |            // Unsigned compare via sign-bit bias (SSE2 cmpgt is signed only):
 1082|       |            //   (dp ^ 0x80000000) > (nxt ^ 0x80000000)  iff  dp > nxt.
 1083|  46.2M|            const __m128i v_dp_b = _mm_xor_si128(v_dp, v_bias);
 1084|  46.2M|            const __m128i v_mask = _mm_cmpgt_epi32(v_dp_b, v_nxt_b);
 1085|  46.2M|            const __m128i v_dp_new = zxc_mm_blendv_epi8_sse2(v_dp, v_nxt, v_mask);
 1086|  46.2M|            _mm_storeu_si128((__m128i*)&dp[p + L], v_dp_new);
 1087|       |            // Narrow the 4x int32 mask / length lanes to 4x int16 (low 64 bits).
 1088|       |            // packs: 0xFFFFFFFF -> 0xFFFF, 0 -> 0; packus (SSE2-emulated): u32->u16.
 1089|  46.2M|            const __m128i v_mask16 = _mm_packs_epi32(v_mask, v_mask);
 1090|  46.2M|            const __m128i v_L_u16 = zxc_mm_packus_epi32_sse2(v_L_lanes, v_L_lanes);
 1091|  46.2M|            __m128i v_pl = _mm_loadl_epi64((const __m128i*)&parent_len[p + L]);
 1092|  46.2M|            v_pl = zxc_mm_blendv_epi8_sse2(v_pl, v_L_u16, v_mask16);
 1093|  46.2M|            _mm_storel_epi64((__m128i*)&parent_len[p + L], v_pl);
 1094|  46.2M|            __m128i v_po = _mm_loadl_epi64((const __m128i*)&parent_off[p + L]);
 1095|  46.2M|            v_po = zxc_mm_blendv_epi8_sse2(v_po, v_off, v_mask16);
 1096|  46.2M|            _mm_storel_epi64((__m128i*)&parent_off[p + L], v_po);
 1097|  46.2M|        }
 1098|  20.9M|    }
 1099|  30.3M|#endif
 1100|       |    // Scalar tail (and full path on archs without SIMD).
 1101|       |    // L < L_end <= UINT16_MAX (caller precondition), so the cast is lossless.
 1102|  83.1M|    for (; L < L_end; L++) zxc_opt_relax(dp, parent_len, parent_off, p, L, nxt, off_biased);
  ------------------
  |  Branch (1102:12): [True: 52.7M, False: 30.3M]
  ------------------
 1103|  30.3M|    return L;
 1104|  30.3M|}
zxc_compress.c:zxc_mm_blendv_epi8_sse2:
  179|   138M|static ZXC_ALWAYS_INLINE __m128i zxc_mm_blendv_epi8_sse2(__m128i a, __m128i b, __m128i mask) {
  180|   138M|    return _mm_or_si128(_mm_and_si128(mask, b), _mm_andnot_si128(mask, a));
  181|   138M|}
zxc_compress.c:zxc_mm_packus_epi32_sse2:
  195|  46.2M|static ZXC_ALWAYS_INLINE __m128i zxc_mm_packus_epi32_sse2(__m128i a, __m128i b) {
  196|  46.2M|    const __m128i bias32 = _mm_set1_epi32(0x8000);
  197|  46.2M|    const __m128i bias16 = _mm_set1_epi16((short)0x8000);
  198|  46.2M|    const __m128i pa = _mm_sub_epi32(a, bias32);
  199|  46.2M|    const __m128i pb = _mm_sub_epi32(b, bias32);
  200|  46.2M|    return _mm_add_epi16(_mm_packs_epi32(pa, pb), bias16);
  201|  46.2M|}
zxc_compress.c:zxc_spl_put_seq:
  285|  18.1M|                                             const uint32_t ml, const uint16_t off_biased) {
  286|  18.1M|    const uint8_t ll_code = (ll >= ZXC_TOKEN_LL_MASK) ? ZXC_TOKEN_LL_MASK : (uint8_t)ll;
  ------------------
  |  |  522|  18.1M|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  ------------------
  |  |  |  |  518|  18.1M|#define ZXC_TOKEN_LIT_BITS 4
  |  |  ------------------
  ------------------
                  const uint8_t ll_code = (ll >= ZXC_TOKEN_LL_MASK) ? ZXC_TOKEN_LL_MASK : (uint8_t)ll;
  ------------------
  |  |  522|  1.19M|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  ------------------
  |  |  |  |  518|  1.19M|#define ZXC_TOKEN_LIT_BITS 4
  |  |  ------------------
  ------------------
  |  Branch (286:29): [True: 1.19M, False: 16.9M]
  ------------------
  287|  18.1M|    const uint8_t ml_code = (ml >= ZXC_TOKEN_ML_MASK) ? ZXC_TOKEN_ML_MASK : (uint8_t)ml;
  ------------------
  |  |  524|  18.1M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|  18.1M|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
                  const uint8_t ml_code = (ml >= ZXC_TOKEN_ML_MASK) ? ZXC_TOKEN_ML_MASK : (uint8_t)ml;
  ------------------
  |  |  524|  2.26M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|  2.26M|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
  |  Branch (287:29): [True: 2.26M, False: 15.9M]
  ------------------
  288|  18.1M|    buf_tokens[*seq_c] = (uint8_t)((ll_code << ZXC_TOKEN_LIT_BITS) | ml_code);
  ------------------
  |  |  518|  18.1M|#define ZXC_TOKEN_LIT_BITS 4
  ------------------
  289|  18.1M|    buf_offsets[*seq_c] = off_biased;
  290|  18.1M|    if (off_biased > *max_offset) *max_offset = off_biased;
  ------------------
  |  Branch (290:9): [True: 765k, False: 17.4M]
  ------------------
  291|  18.1M|    if (UNLIKELY(!zxc_emit_extra(buf_extras, extras_sz, ll, ZXC_TOKEN_LL_MASK) ||
  ------------------
  |  |  152|  36.3M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.1M]
  |  |  |  Branch (152:42): [True: 1.73k, False: 18.1M]
  |  |  |  Branch (152:42): [True: 6.24k, False: 18.1M]
  |  |  ------------------
  ------------------
  292|  18.1M|                 !zxc_emit_extra(buf_extras, extras_sz, ml, ZXC_TOKEN_ML_MASK)))
  293|      0|        return 0;
  294|  18.1M|    (*seq_c)++;
  295|  18.1M|    return 1;
  296|  18.1M|}
zxc_compress.c:zxc_lz77_lazy_parse_spl_l3:
 1743|  11.3k|                                                   uint16_t* max_offset_out) {
 1744|  11.3k|    return zxc_lz77_lazy_parse_spl_impl(ctx, src, src_sz, epoch_mark, min_offset, seq_c_out,
 1745|  11.3k|                                        lit_c_out, extras_sz_out, max_offset_out,
 1746|  11.3k|                                        ZXC_LEVEL_DEFAULT);
 1747|  11.3k|}
zxc_compress.c:zxc_lz77_lazy_parse_spl_impl:
 1648|  38.1k|    const int level) {
 1649|  38.1k|    zxc_lz77_params_t lzp = zxc_get_lz77_params(level);
 1650|  38.1k|    lzp.min_offset = min_offset;
 1651|  38.1k|    const uint32_t offset_mask = ctx->offset_mask;
 1652|       |
 1653|  38.1k|    const uint8_t* ip = src + ctx->dict_size;
 1654|  38.1k|    const uint8_t* iend = src + src_sz;
 1655|  38.1k|    const uint8_t* anchor = ip;
 1656|  38.1k|    const uint8_t* search_limit = iend - ZXC_LZ_SEARCH_MARGIN;
  ------------------
  |  |  765|  38.1k|#define ZXC_LZ_SEARCH_MARGIN (sizeof(uint64_t))
  ------------------
 1657|       |
 1658|  38.1k|    uint32_t* const hash_table = ctx->hash_table;
 1659|  38.1k|    uint8_t* const hash_tags = ctx->hash_tags;
 1660|  38.1k|    uint16_t* const chain_table = ctx->chain_table;
 1661|  38.1k|    uint8_t* const literals = ctx->literals;
 1662|  38.1k|    uint8_t* const buf_tokens = ctx->buf_tokens;
 1663|  38.1k|    uint16_t* const buf_offsets = ctx->buf_offsets;
 1664|  38.1k|    uint8_t* const buf_extras = ctx->buf_extras;
 1665|       |
 1666|  38.1k|    uint32_t seq_c = 0;
 1667|  38.1k|    size_t lit_c = 0;
 1668|  38.1k|    size_t extras_sz = 0;
 1669|  38.1k|    uint16_t max_offset = 0;
 1670|       |
 1671|  38.1k|    const int use_hash5 = zxc_lz77_use_hash5(level);
 1672|       |
 1673|  14.1M|    while (LIKELY(ip < search_limit)) {
  ------------------
  |  |  146|  14.1M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 14.1M, False: 38.1k]
  |  |  ------------------
  ------------------
 1674|  14.1M|        const size_t dist = (size_t)(ip - anchor);
 1675|  14.1M|        size_t step = lzp.step_base + (dist >> lzp.step_shift);
 1676|  14.1M|        if (UNLIKELY(ip + step >= search_limit)) step = 1;
  ------------------
  |  |  152|  14.1M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 210k, False: 13.8M]
  |  |  ------------------
  ------------------
 1677|       |
 1678|       |        // ip + step <= search_limit either way, so this read stays in the block.
 1679|       |        // cppcheck-suppress unreadVariable
 1680|  14.1M|        const uint32_t h_next = zxc_hash_func(zxc_le64(ip + step), use_hash5);
 1681|  14.1M|        ZXC_PREFETCH_READ(&hash_tags[h_next]);
  ------------------
  |  |  163|  14.1M|#define ZXC_PREFETCH_READ(ptr) __builtin_prefetch((const void*)(ptr), 0, 3)
  ------------------
 1682|  14.1M|        ZXC_PREFETCH_READ(&hash_table[h_next]);
  ------------------
  |  |  163|  14.1M|#define ZXC_PREFETCH_READ(ptr) __builtin_prefetch((const void*)(ptr), 0, 3)
  ------------------
 1683|       |
 1684|  14.1M|        const zxc_match_t m = zxc_lz77_find_best_match(
 1685|  14.1M|            src, ip, zxc_hash_func(zxc_le64(ip), use_hash5), iend, search_limit, anchor, hash_table,
 1686|  14.1M|            hash_tags, chain_table, epoch_mark, offset_mask, level, lzp,
 1687|  14.1M|            /*last_off=*/0U);
 1688|       |
 1689|  14.1M|        if (m.ref) {
  ------------------
  |  Branch (1689:13): [True: 3.09M, False: 11.0M]
  ------------------
 1690|  3.09M|            ip -= m.backtrack;
 1691|  3.09M|            const uint32_t ll = (uint32_t)(ip - anchor);
 1692|  3.09M|            const uint32_t ml = m.len - ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  586|  3.09M|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1693|  3.09M|            const uint32_t off = (uint32_t)(ip - m.ref);
 1694|  3.09M|            const uint16_t off_biased = (uint16_t)(off - ZXC_LZ_OFFSET_BIAS);
  ------------------
  |  |  724|  3.09M|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1695|       |
 1696|  3.09M|            if (ll > 0) zxc_flush_literals(literals, &lit_c, anchor, ll, iend);
  ------------------
  |  Branch (1696:17): [True: 1.75M, False: 1.34M]
  ------------------
 1697|       |
 1698|  3.09M|            if (UNLIKELY(!zxc_spl_put_seq(buf_tokens, buf_offsets, buf_extras, &seq_c, &extras_sz,
  ------------------
  |  |  152|  3.09M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 3.09M]
  |  |  ------------------
  ------------------
 1699|  3.09M|                                          &max_offset, ll, ml, off_biased)))
 1700|      0|                return ZXC_ERROR_OVERFLOW;
 1701|       |
 1702|  3.09M|            if (m.len > 2 && level > ZXC_LEVEL_BALANCED) {
  ------------------
  |  Branch (1702:17): [True: 3.09M, False: 8.19k]
  |  Branch (1702:30): [True: 875k, False: 2.21M]
  ------------------
 1703|   875k|                const uint8_t* match_end = ip + m.len;
 1704|   875k|                if (match_end < iend - 7) {
  ------------------
  |  Branch (1704:21): [True: 865k, False: 9.43k]
  ------------------
 1705|   865k|                    const uint32_t pos_u = (uint32_t)((match_end - 2) - src);
 1706|   865k|                    const uint64_t val_u8 = zxc_le64(match_end - 2);
 1707|   865k|                    const uint32_t val_u = (uint32_t)val_u8;
 1708|   865k|                    const uint32_t h_u = zxc_hash_func(val_u8, use_hash5);
 1709|   865k|                    const uint32_t prev_idx =
 1710|   865k|                        zxc_epoch_pos(hash_table[h_u], offset_mask, epoch_mark);
 1711|   865k|                    hash_table[h_u] = epoch_mark | pos_u;
 1712|   865k|                    hash_tags[h_u] = zxc_hash_tag(val_u);
 1713|   865k|                    chain_table[pos_u & ZXC_LZ_WINDOW_MASK] = zxc_chain_delta(pos_u, prev_idx);
  ------------------
  |  |  584|   865k|#define ZXC_LZ_WINDOW_MASK (ZXC_LZ_WINDOW_SIZE - 1U)
  |  |  ------------------
  |  |  |  |  582|   865k|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  |  |  ------------------
  ------------------
 1714|   865k|                }
 1715|   875k|            }
 1716|       |
 1717|  3.09M|            ip += m.len;
 1718|  3.09M|            anchor = ip;
 1719|  11.0M|        } else {
 1720|  11.0M|            ip += step;
 1721|  11.0M|        }
 1722|  14.1M|    }
 1723|       |
 1724|  38.1k|    const size_t last_lits = (size_t)(iend - anchor);
 1725|  38.1k|    if (last_lits > 0) {
  ------------------
  |  Branch (1725:9): [True: 10.7k, False: 27.4k]
  ------------------
 1726|  10.7k|        ZXC_MEMCPY(literals + lit_c, anchor, last_lits);
  ------------------
  |  |  168|  10.7k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1727|  10.7k|        lit_c += last_lits;
 1728|  10.7k|    }
 1729|       |
 1730|  38.1k|    *seq_c_out = seq_c;
 1731|  38.1k|    *lit_c_out = lit_c;
 1732|  38.1k|    *extras_sz_out = extras_sz;
 1733|  38.1k|    *max_offset_out = max_offset;
 1734|  38.1k|    return ZXC_OK;
 1735|  38.1k|}
zxc_compress.c:zxc_lz77_lazy_parse_spl_l4:
 1754|  15.8k|                                                   uint16_t* max_offset_out) {
 1755|  15.8k|    return zxc_lz77_lazy_parse_spl_impl(ctx, src, src_sz, epoch_mark, min_offset, seq_c_out,
 1756|  15.8k|                                        lit_c_out, extras_sz_out, max_offset_out,
 1757|  15.8k|                                        ZXC_LEVEL_BALANCED);
 1758|  15.8k|}
zxc_compress.c:zxc_lz77_lazy_parse_spl_l5:
 1765|  10.9k|                                                   uint16_t* max_offset_out) {
 1766|  10.9k|    return zxc_lz77_lazy_parse_spl_impl(ctx, src, src_sz, epoch_mark, min_offset, seq_c_out,
 1767|  10.9k|                                        lit_c_out, extras_sz_out, max_offset_out,
 1768|  10.9k|                                        ZXC_LEVEL_COMPACT);
 1769|  10.9k|}
zxc_compress.c:zxc_spl_match_split_block:
  464|   111k|                                          const uint8_t budget_pct) {
  465|   111k|    if (n_seq == 0) return n_seq;
  ------------------
  |  Branch (465:9): [True: 2.08k, False: 109k]
  ------------------
  466|   109k|    const uint8_t* const extras_end = extras + *extras_sz;
  467|   109k|    uint8_t ctx_bad[1U << ZXC_SPL_MATCH_SPLIT_CTX_BITS];
  468|       |
  469|       |    // 0. The caps: the budget's, then the gate's (same scratch, in turn).
  470|   109k|    uint32_t all_cap = ZXC_SPL_INLINE_ML_CODE, gate_cap = ZXC_SPL_INLINE_ML_CODE;
  ------------------
  |  |  677|   109k|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  ------------------
  |  |  |  |  524|   109k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  520|   109k|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  uint32_t all_cap = ZXC_SPL_INLINE_ML_CODE, gate_cap = ZXC_SPL_INLINE_ML_CODE;
  ------------------
  |  |  677|   109k|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  ------------------
  |  |  |  |  524|   109k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  520|   109k|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  471|   109k|    if (budget_pct)
  ------------------
  |  Branch (471:9): [True: 94.0k, False: 15.4k]
  ------------------
  472|  94.0k|        all_cap = zxc_spl_match_split_budget_cap(tokens, offsets, extras, *extras_sz, n_seq, lit_c,
  473|  94.0k|                                                 off_bytes, (*hist_buf)[0][0], budget_pct);
  474|   109k|    if (gate_max > ZXC_SPL_INLINE_ML_CODE &&
  ------------------
  |  |  677|   219k|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  ------------------
  |  |  |  |  524|   109k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  520|   109k|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (474:9): [True: 36.9k, False: 72.6k]
  ------------------
  475|  36.9k|        zxc_spl_match_split_analyze(tokens, n_seq, hist_buf, ctx_bad, side))
  ------------------
  |  Branch (475:9): [True: 6.07k, False: 30.8k]
  ------------------
  476|  6.07k|        gate_cap = gate_max;
  477|   109k|    if (all_cap == ZXC_SPL_INLINE_ML_CODE && gate_cap == ZXC_SPL_INLINE_ML_CODE) return n_seq;
  ------------------
  |  |  677|   219k|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  ------------------
  |  |  |  |  524|   109k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  520|   109k|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  if (all_cap == ZXC_SPL_INLINE_ML_CODE && gate_cap == ZXC_SPL_INLINE_ML_CODE) return n_seq;
  ------------------
  |  |  677|  47.7k|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  ------------------
  |  |  |  |  524|  47.7k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  520|  47.7k|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (477:9): [True: 47.7k, False: 61.8k]
  |  Branch (477:46): [True: 44.9k, False: 2.75k]
  ------------------
  478|       |
  479|       |    // 1. Mark the matches to split and drop their varints; the other extras
  480|       |    // move forward.
  481|  64.5k|    size_t r = 0, w = 0;
  482|  64.5k|    uint32_t extra = 0;
  483|  13.0M|    for (uint32_t i = 0; i < n_seq; i++) {
  ------------------
  |  Branch (483:26): [True: 13.0M, False: 64.5k]
  ------------------
  484|  13.0M|        const uint8_t tok = tokens[i];
  485|  13.0M|        const int bad = gate_cap != ZXC_SPL_INLINE_ML_CODE && ctx_bad[side[i]];
  ------------------
  |  |  677|  26.0M|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  ------------------
  |  |  |  |  524|  13.0M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  520|  13.0M|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (485:25): [True: 1.00M, False: 12.0M]
  |  Branch (485:63): [True: 971k, False: 37.3k]
  ------------------
  486|  13.0M|        side[i] = 0;
  487|  13.0M|        if ((tok >> ZXC_TOKEN_LIT_BITS) == ZXC_TOKEN_LL_MASK)
  ------------------
  |  |  518|  13.0M|#define ZXC_TOKEN_LIT_BITS 4
  ------------------
                      if ((tok >> ZXC_TOKEN_LIT_BITS) == ZXC_TOKEN_LL_MASK)
  ------------------
  |  |  522|  13.0M|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  ------------------
  |  |  |  |  518|  13.0M|#define ZXC_TOKEN_LIT_BITS 4
  |  |  ------------------
  ------------------
  |  Branch (487:13): [True: 705k, False: 12.3M]
  ------------------
  488|   705k|            zxc_varint_keep(extras, &w, &r, extras_end);
  489|  13.0M|        if ((tok & ZXC_TOKEN_ML_MASK) != ZXC_TOKEN_ML_MASK) continue;
  ------------------
  |  |  524|  13.0M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|  13.0M|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
                      if ((tok & ZXC_TOKEN_ML_MASK) != ZXC_TOKEN_ML_MASK) continue;
  ------------------
  |  |  524|  13.0M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|  13.0M|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
  |  Branch (489:13): [True: 11.1M, False: 1.90M]
  ------------------
  490|  1.90M|        const uint8_t* p = extras + r;
  491|  1.90M|        const uint32_t code = zxc_read_varint(&p, extras_end) + ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  524|  1.90M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|  1.90M|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
  492|  1.90M|        if ((code <= all_cap && zxc_spl_match_split_far(offsets[i])) || (bad && code <= gate_cap)) {
  ------------------
  |  Branch (492:14): [True: 1.41M, False: 496k]
  |  Branch (492:33): [True: 787k, False: 622k]
  |  Branch (492:74): [True: 43.5k, False: 1.09M]
  |  Branch (492:81): [True: 20.7k, False: 22.7k]
  ------------------
  493|   808k|            side[i] = (uint8_t)code;
  494|   808k|            extra += zxc_spl_match_split_pieces(code) - 1;
  495|   808k|            r = (size_t)(p - extras);
  496|  1.09M|        } else {
  497|  1.09M|            zxc_extras_move(extras, &w, &r, p);
  498|  1.09M|        }
  499|  1.90M|    }
  500|  64.5k|    *extras_sz = w;
  501|  64.5k|    if (extra == 0) return n_seq;
  ------------------
  |  Branch (501:9): [True: 1.34k, False: 63.2k]
  ------------------
  502|       |
  503|       |    // 2. Expand backward. A marked sequence spans its pieces, written forward: the
  504|       |    // first keeps the literal nibble and its escape, the last takes the remainder.
  505|  63.2k|    uint32_t out = n_seq + extra;
  506|  12.9M|    for (uint32_t i = n_seq; i-- > 0;) {
  ------------------
  |  Branch (506:30): [True: 12.9M, False: 63.2k]
  ------------------
  507|  12.9M|        const uint8_t tok = tokens[i];
  508|  12.9M|        const uint16_t off = offsets[i];
  509|  12.9M|        if (side[i] == 0) {
  ------------------
  |  Branch (509:13): [True: 12.1M, False: 802k]
  ------------------
  510|  12.1M|            out--;
  511|  12.1M|            tokens[out] = tok;
  512|  12.1M|            offsets[out] = off;
  513|  12.1M|            continue;
  514|  12.1M|        }
  515|   802k|        uint32_t code = side[i];
  516|   802k|        uint8_t ll_bits = tok & (uint8_t)(ZXC_TOKEN_LL_MASK << ZXC_TOKEN_LIT_BITS);
  ------------------
  |  |  522|   802k|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  ------------------
  |  |  |  |  518|   802k|#define ZXC_TOKEN_LIT_BITS 4
  |  |  ------------------
  ------------------
                      uint8_t ll_bits = tok & (uint8_t)(ZXC_TOKEN_LL_MASK << ZXC_TOKEN_LIT_BITS);
  ------------------
  |  |  518|   802k|#define ZXC_TOKEN_LIT_BITS 4
  ------------------
  517|   802k|        out -= zxc_spl_match_split_pieces(code);
  518|   802k|        uint32_t k = out;
  519|  2.25M|        while (code > ZXC_SPL_INLINE_ML_CODE) {
  ------------------
  |  |  677|  2.25M|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  ------------------
  |  |  |  |  524|  2.25M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  520|  2.25M|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (519:16): [True: 1.44M, False: 802k]
  ------------------
  520|  1.44M|            const uint32_t p = zxc_spl_match_split_piece(code);
  521|  1.44M|            tokens[k] = (uint8_t)(ll_bits | p);
  522|  1.44M|            offsets[k++] = off;
  523|  1.44M|            ll_bits = 0;
  524|  1.44M|            code -= p + ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  586|  1.44M|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
  525|  1.44M|        }
  526|   802k|        tokens[k] = (uint8_t)(ll_bits | code);
  527|   802k|        offsets[k] = off;
  528|   802k|    }
  529|  63.2k|    return n_seq + extra;
  530|  64.5k|}
zxc_compress.c:zxc_spl_match_split_budget_cap:
  400|  94.0k|                                               uint32_t* RESTRICT hist, const uint32_t budget_pct) {
  401|  94.0k|    const uint8_t* const extras_end = extras + extras_sz;
  402|  94.0k|    ZXC_MEMSET(hist, 0, (ZXC_SPL_MATCH_SPLIT_MAX + 1) * sizeof(uint32_t));
  ------------------
  |  |  173|  94.0k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  403|  94.0k|    const uint8_t* p = extras;
  404|  15.7M|    for (uint32_t i = 0; i < n_seq; i++) {
  ------------------
  |  Branch (404:26): [True: 15.6M, False: 94.0k]
  ------------------
  405|  15.6M|        const uint8_t tok = tokens[i];
  406|  15.6M|        if ((tok >> ZXC_TOKEN_LIT_BITS) == ZXC_TOKEN_LL_MASK) (void)zxc_read_varint(&p, extras_end);
  ------------------
  |  |  518|  15.6M|#define ZXC_TOKEN_LIT_BITS 4
  ------------------
                      if ((tok >> ZXC_TOKEN_LIT_BITS) == ZXC_TOKEN_LL_MASK) (void)zxc_read_varint(&p, extras_end);
  ------------------
  |  |  522|  15.6M|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  ------------------
  |  |  |  |  518|  15.6M|#define ZXC_TOKEN_LIT_BITS 4
  |  |  ------------------
  ------------------
  |  Branch (406:13): [True: 852k, False: 14.7M]
  ------------------
  407|  15.6M|        if ((tok & ZXC_TOKEN_ML_MASK) != ZXC_TOKEN_ML_MASK) continue;
  ------------------
  |  |  524|  15.6M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|  15.6M|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
                      if ((tok & ZXC_TOKEN_ML_MASK) != ZXC_TOKEN_ML_MASK) continue;
  ------------------
  |  |  524|  15.6M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|  15.6M|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
  |  Branch (407:13): [True: 13.6M, False: 2.00M]
  ------------------
  408|  2.00M|        const uint32_t code = zxc_read_varint(&p, extras_end) + ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  524|  2.00M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|  2.00M|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
  409|  2.00M|        if (code <= ZXC_SPL_MATCH_SPLIT_MAX && zxc_spl_match_split_far(offsets[i])) hist[code]++;
  ------------------
  |  |  707|  4.00M|#define ZXC_SPL_MATCH_SPLIT_MAX (128U - ZXC_LZ_MIN_MATCH_LEN) /* 123 */
  |  |  ------------------
  |  |  |  |  586|  2.00M|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  ------------------
  ------------------
  |  Branch (409:13): [True: 1.66M, False: 340k]
  |  Branch (409:48): [True: 876k, False: 786k]
  ------------------
  410|  2.00M|    }
  411|  94.0k|    const size_t seq_bytes = 1 + off_bytes;
  412|  94.0k|    size_t budget = (n_seq * seq_bytes + extras_sz + lit_c) * budget_pct / 100;
  413|  94.0k|    uint32_t cap = ZXC_SPL_INLINE_ML_CODE;
  ------------------
  |  |  677|  94.0k|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  ------------------
  |  |  |  |  524|  94.0k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  520|  94.0k|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  414|  10.1M|    for (uint32_t c = ZXC_TOKEN_ML_MASK; c <= ZXC_SPL_MATCH_SPLIT_MAX; c++) {
  ------------------
  |  |  524|  94.0k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|  94.0k|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
                  for (uint32_t c = ZXC_TOKEN_ML_MASK; c <= ZXC_SPL_MATCH_SPLIT_MAX; c++) {
  ------------------
  |  |  707|  10.1M|#define ZXC_SPL_MATCH_SPLIT_MAX (128U - ZXC_LZ_MIN_MATCH_LEN) /* 123 */
  |  |  ------------------
  |  |  |  |  586|  10.1M|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  ------------------
  ------------------
  |  Branch (414:42): [True: 10.0M, False: 91.0k]
  ------------------
  415|  10.0M|        if (hist[c] == 0) continue;
  ------------------
  |  Branch (415:13): [True: 9.61M, False: 426k]
  ------------------
  416|   426k|        const size_t cost = hist[c] * ((zxc_spl_match_split_pieces(c) - 1) * seq_bytes - 1);
  417|   426k|        if (cost > budget) break;
  ------------------
  |  Branch (417:13): [True: 3.04k, False: 423k]
  ------------------
  418|   423k|        budget -= cost;
  419|   423k|        cap = c;
  420|   423k|    }
  421|  94.0k|    return cap;
  422|  94.0k|}
zxc_compress.c:zxc_spl_match_split_analyze:
  342|  36.9k|                                       uint8_t* RESTRICT ctx_bad, uint8_t* RESTRICT side) {
  343|  36.9k|    uint32_t order = ZXC_SPL_MATCH_SPLIT_CTX_BITS;
  ------------------
  |  |  693|  36.9k|#define ZXC_SPL_MATCH_SPLIT_CTX_BITS 8
  ------------------
  344|   245k|    while (order > 2 && (n_seq >> order) < 16) order--;
  ------------------
  |  Branch (344:12): [True: 217k, False: 28.3k]
  |  Branch (344:25): [True: 208k, False: 8.59k]
  ------------------
  345|  36.9k|    const uint32_t hmask = (1U << order) - 1U;
  346|  36.9k|    uint32_t (*const ctx_hist)[2][1U << ZXC_SPL_MATCH_SPLIT_CTX_BITS] = *hist_buf;
  347|   184k|    for (uint32_t l = 0; l < 4; l++) {
  ------------------
  |  Branch (347:26): [True: 147k, False: 36.9k]
  ------------------
  348|   147k|        ZXC_MEMSET(ctx_hist[l][0], 0, (hmask + 1) * sizeof(uint32_t));
  ------------------
  |  |  173|   147k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  349|   147k|        ZXC_MEMSET(ctx_hist[l][1], 0, (hmask + 1) * sizeof(uint32_t));
  ------------------
  |  |  173|   147k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  350|   147k|    }
  351|  36.9k|    uint32_t hist = 0, n_esc = 0;
  352|  3.20M|    for (uint32_t i = 0; i < n_seq; i++) {
  ------------------
  |  Branch (352:26): [True: 3.17M, False: 36.9k]
  ------------------
  353|  3.17M|        const uint32_t esc = (tokens[i] & ZXC_TOKEN_ML_MASK) == ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  524|  3.17M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|  3.17M|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
                      const uint32_t esc = (tokens[i] & ZXC_TOKEN_ML_MASK) == ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  524|  3.17M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|  3.17M|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
  354|  3.17M|        side[i] = (uint8_t)hist;
  355|  3.17M|        ctx_hist[i & 3][esc][hist]++;
  356|  3.17M|        hist = ((hist << 1) | esc) & hmask;
  357|  3.17M|        n_esc += esc;
  358|  3.17M|    }
  359|       |    // No conditional sum here: GCC 14.2 miscompiles it for AVX-512
  360|  36.9k|    uint32_t errors = 0;
  361|   262k|    for (uint32_t c = 0; c <= hmask; c++) {
  ------------------
  |  Branch (361:26): [True: 225k, False: 36.9k]
  ------------------
  362|   225k|        uint32_t n0 = 0, n1 = 0;
  363|  1.12M|        for (uint32_t l = 0; l < 4; l++) {
  ------------------
  |  Branch (363:30): [True: 902k, False: 225k]
  ------------------
  364|   902k|            n0 += ctx_hist[l][0][c];
  365|   902k|            n1 += ctx_hist[l][1][c];
  366|   902k|        }
  367|   225k|        ctx_bad[c] = (n1 < n0);  // escape a strict minority in its context
  368|   225k|        errors += (n0 < n1) ? n0 : n1;
  ------------------
  |  Branch (368:19): [True: 90.6k, False: 134k]
  ------------------
  369|   225k|    }
  370|  36.9k|    return n_esc != 0 &&
  ------------------
  |  Branch (370:12): [True: 34.3k, False: 2.65k]
  ------------------
  371|  34.3k|           (uint64_t)errors * 100 >= (uint64_t)ZXC_SPL_MATCH_SPLIT_MIN_MISPREDICT_PCT * n_esc;
  ------------------
  |  |  696|  34.3k|#define ZXC_SPL_MATCH_SPLIT_MIN_MISPREDICT_PCT 80
  ------------------
  |  Branch (371:12): [True: 6.07k, False: 28.2k]
  ------------------
  372|  36.9k|}
zxc_compress.c:zxc_varint_keep:
  306|   705k|                                              size_t* RESTRICT r, const uint8_t* end) {
  307|   705k|    const uint8_t* p = extras + *r;
  308|   705k|    (void)zxc_read_varint(&p, end);
  309|   705k|    zxc_extras_move(extras, w, r, p);
  310|   705k|}
zxc_compress.c:zxc_spl_match_split_far:
  325|  3.06M|static ZXC_ALWAYS_INLINE int zxc_spl_match_split_far(const uint16_t off) {
  326|  3.06M|    return (uint32_t)off + ZXC_LZ_OFFSET_BIAS >= ZXC_SPL_MATCH_SPLIT_MIN_OFFSET;
  ------------------
  |  |  724|  3.06M|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
                  return (uint32_t)off + ZXC_LZ_OFFSET_BIAS >= ZXC_SPL_MATCH_SPLIT_MIN_OFFSET;
  ------------------
  |  |  713|  3.06M|#define ZXC_SPL_MATCH_SPLIT_MIN_OFFSET ZXC_PAD_SIZE
  |  |  ------------------
  |  |  |  |  342|  3.06M|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  327|  3.06M|}
zxc_compress.c:zxc_spl_match_split_pieces:
  313|  2.03M|static ZXC_ALWAYS_INLINE uint32_t zxc_spl_match_split_pieces(const uint32_t code) {
  314|  2.03M|    return (code + ZXC_LZ_MIN_MATCH_LEN + ZXC_SPL_MAX_INLINE_ML - 1) / ZXC_SPL_MAX_INLINE_ML;
  ------------------
  |  |  586|  2.03M|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
                  return (code + ZXC_LZ_MIN_MATCH_LEN + ZXC_SPL_MAX_INLINE_ML - 1) / ZXC_SPL_MAX_INLINE_ML;
  ------------------
  |  |  683|  2.03M|#define ZXC_SPL_MAX_INLINE_ML (ZXC_SPL_INLINE_ML_CODE + ZXC_LZ_MIN_MATCH_LEN) /* 19 */
  |  |  ------------------
  |  |  |  |  677|  2.03M|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  2.03M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  520|  2.03M|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_SPL_MAX_INLINE_ML (ZXC_SPL_INLINE_ML_CODE + ZXC_LZ_MIN_MATCH_LEN) /* 19 */
  |  |  ------------------
  |  |  |  |  586|  2.03M|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  ------------------
  ------------------
                  return (code + ZXC_LZ_MIN_MATCH_LEN + ZXC_SPL_MAX_INLINE_ML - 1) / ZXC_SPL_MAX_INLINE_ML;
  ------------------
  |  |  683|  2.03M|#define ZXC_SPL_MAX_INLINE_ML (ZXC_SPL_INLINE_ML_CODE + ZXC_LZ_MIN_MATCH_LEN) /* 19 */
  |  |  ------------------
  |  |  |  |  677|  2.03M|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  2.03M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  520|  2.03M|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_SPL_MAX_INLINE_ML (ZXC_SPL_INLINE_ML_CODE + ZXC_LZ_MIN_MATCH_LEN) /* 19 */
  |  |  ------------------
  |  |  |  |  586|  2.03M|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  ------------------
  ------------------
  315|  2.03M|}
zxc_compress.c:zxc_extras_move:
  300|  1.81M|                                              size_t* RESTRICT r, const uint8_t* to) {
  301|  4.02M|    while (extras + *r < to) extras[(*w)++] = extras[(*r)++];
  ------------------
  |  Branch (301:12): [True: 2.20M, False: 1.81M]
  ------------------
  302|  1.81M|}
zxc_compress.c:zxc_spl_match_split_piece:
  319|  1.44M|static ZXC_ALWAYS_INLINE uint32_t zxc_spl_match_split_piece(const uint32_t code) {
  320|  1.44M|    const uint32_t rest = code - ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  586|  1.44M|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
  321|  1.44M|    return (rest < ZXC_SPL_INLINE_ML_CODE) ? rest : ZXC_SPL_INLINE_ML_CODE;
  ------------------
  |  |  677|  1.44M|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  ------------------
  |  |  |  |  524|  1.44M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  520|  1.44M|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  return (rest < ZXC_SPL_INLINE_ML_CODE) ? rest : ZXC_SPL_INLINE_ML_CODE;
  ------------------
  |  |  677|  1.13M|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  ------------------
  |  |  |  |  524|  1.13M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  520|  1.13M|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (321:12): [True: 308k, False: 1.13M]
  ------------------
  322|  1.44M|}
zxc_compress.c:zxc_pak_emit:
 2529|  34.9k|                        size_t* RESTRICT const out_sz) {
 2530|  34.9k|    const size_t sz_lit = lit_c;
 2531|  34.9k|    const size_t sz_seq = seq_c * sizeof(uint32_t);
 2532|  34.9k|    const size_t sz_ext = extras_c;
 2533|       |
 2534|       |    // See the SPL twin. PAK literals are always RAW, so the slack always
 2535|       |    // matters here.
 2536|  34.9k|    const size_t behind_lit = sz_seq + sz_ext;
 2537|  34.9k|    const size_t pad = (behind_lit < ZXC_BLOCK_LIT_SLACK) ? ZXC_BLOCK_LIT_SLACK - behind_lit : 0;
  ------------------
  |  |  356|  34.9k|#define ZXC_BLOCK_LIT_SLACK 32
  ------------------
                  const size_t pad = (behind_lit < ZXC_BLOCK_LIT_SLACK) ? ZXC_BLOCK_LIT_SLACK - behind_lit : 0;
  ------------------
  |  |  356|  9.23k|#define ZXC_BLOCK_LIT_SLACK 32
  ------------------
  |  Branch (2537:24): [True: 9.23k, False: 25.6k]
  ------------------
 2538|       |
 2539|  34.9k|    if (!dst) {
  ------------------
  |  Branch (2539:9): [True: 0, False: 34.9k]
  ------------------
 2540|      0|        *out_sz = ZXC_BLOCK_HEADER_SIZE + ZXC_PAK_HEADER_BINARY_SIZE + sz_lit + behind_lit + pad;
  ------------------
  |  |  439|      0|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
                      *out_sz = ZXC_BLOCK_HEADER_SIZE + ZXC_PAK_HEADER_BINARY_SIZE + sz_lit + behind_lit + pad;
  ------------------
  |  |  445|      0|#define ZXC_PAK_HEADER_BINARY_SIZE 12
  ------------------
 2541|      0|        return ZXC_OK;
 2542|      0|    }
 2543|  34.9k|    if (UNLIKELY(dst_cap < ZXC_BLOCK_HEADER_SIZE)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  34.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 34.9k]
  |  |  ------------------
  ------------------
 2544|       |
 2545|  34.9k|    const uint8_t* const literals = ctx->literals;
 2546|  34.9k|    const uint8_t* const buf_extras = ctx->buf_extras;
 2547|  34.9k|    const uint32_t* const buf_sequences = ctx->buf_sequences;
 2548|       |
 2549|  34.9k|    zxc_block_header_t bh = {.block_type = ZXC_BLOCK_PAK};
 2550|  34.9k|    uint8_t* const p = dst + ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  439|  34.9k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 2551|  34.9k|    size_t rem = dst_cap - ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  439|  34.9k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 2552|       |
 2553|  34.9k|    const zxc_gnr_header_t gh = {.n_sequences = seq_c,
 2554|  34.9k|                                 .n_literals = (uint32_t)lit_c,
 2555|  34.9k|                                 .enc_lit = ZXC_SECTION_ENCODING_RAW,
 2556|  34.9k|                                 .enc_tok = 0,
 2557|  34.9k|                                 .enc_mlen = 0,
 2558|  34.9k|                                 .enc_off = 0};
 2559|       |
 2560|  34.9k|    const int ghs = zxc_write_pak_header(p, rem, &gh);
 2561|  34.9k|    if (UNLIKELY(ghs < 0)) return ghs;
  ------------------
  |  |  152|  34.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 34.9k]
  |  |  ------------------
  ------------------
 2562|       |
 2563|  34.9k|    uint8_t* p_curr = p + ghs;
 2564|  34.9k|    rem -= (size_t)ghs;
 2565|       |
 2566|  34.9k|    if (UNLIKELY(rem < sz_lit + sz_seq + sz_ext + pad)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  34.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 34.9k]
  |  |  ------------------
  ------------------
 2567|       |
 2568|  34.9k|    ZXC_MEMCPY(p_curr, literals, lit_c);
  ------------------
  |  |  168|  34.9k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2569|  34.9k|    p_curr += lit_c;
 2570|       |
 2571|       |    // Write sequences in little-endian order
 2572|       |#ifdef ZXC_BIG_ENDIAN
 2573|       |    for (uint32_t i = 0; i < seq_c; i++) {
 2574|       |        zxc_store_le32(p_curr, buf_sequences[i]);
 2575|       |        p_curr += sizeof(uint32_t);
 2576|       |    }
 2577|       |#else
 2578|  34.9k|    ZXC_MEMCPY(p_curr, buf_sequences, sz_seq);
  ------------------
  |  |  168|  34.9k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2579|  34.9k|    p_curr += sz_seq;
 2580|  34.9k|#endif
 2581|       |
 2582|       |    // --- WRITE EXTRAS ---
 2583|  34.9k|    ZXC_MEMCPY(p_curr, buf_extras, sz_ext);
  ------------------
  |  |  168|  34.9k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2584|  34.9k|    p_curr += sz_ext;
 2585|       |
 2586|  34.9k|    ZXC_MEMSET(p_curr, 0, pad);
  ------------------
  |  |  173|  34.9k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 2587|  34.9k|    p_curr += pad;
 2588|       |
 2589|  34.9k|    bh.comp_size = (uint32_t)(p_curr - (dst + ZXC_BLOCK_HEADER_SIZE));
  ------------------
  |  |  439|  34.9k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 2590|  34.9k|    const int hw = zxc_write_block_header(dst, dst_cap, &bh);
 2591|  34.9k|    if (UNLIKELY(hw < 0)) return hw;
  ------------------
  |  |  152|  34.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 34.9k]
  |  |  ------------------
  ------------------
 2592|       |
 2593|       |    // Checksum will be appended by the wrapper
 2594|  34.9k|    *out_sz = ZXC_BLOCK_HEADER_SIZE + bh.comp_size;
  ------------------
  |  |  439|  34.9k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 2595|  34.9k|    return ZXC_OK;
 2596|  34.9k|}
zxc_compress.c:zxc_spl_emit:
 1869|   111k|                        const size_t dst_cap, size_t* RESTRICT out_sz) {
 1870|   111k|    if (UNLIKELY(dst && dst_cap < ZXC_BLOCK_HEADER_SIZE)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|   223k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 111k]
  |  |  |  Branch (152:42): [True: 111k, False: 0]
  |  |  |  Branch (152:42): [True: 0, False: 111k]
  |  |  ------------------
  ------------------
 1871|       |
 1872|   111k|    const int level = ctx->compression_level;
 1873|   111k|    const uint8_t* const literals = ctx->literals;
 1874|   111k|    const uint8_t* const buf_tokens = ctx->buf_tokens;
 1875|   111k|    const uint16_t* const buf_offsets = ctx->buf_offsets;
 1876|   111k|    const uint8_t* const buf_extras = ctx->buf_extras;
 1877|       |
 1878|       |    // --- RLE ANALYSIS ---
 1879|   111k|    size_t rle_size = 0;
 1880|   111k|    int enc_lit = ZXC_SECTION_ENCODING_RAW;
 1881|   111k|    size_t best_j = lit_c;
 1882|       |
 1883|   111k|    if (lit_c > 0) {
  ------------------
  |  Branch (1883:9): [True: 105k, False: 6.39k]
  ------------------
 1884|   105k|        const uint8_t* p = literals;
 1885|   105k|        const uint8_t* const p_end = literals + lit_c;
 1886|   105k|        const uint8_t* const p_end_4 = p_end - 3;  // Safe limit for 4-byte lookahead
 1887|       |
 1888|   935k|        while (LIKELY(p < p_end)) {
  ------------------
  |  |  146|   935k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 830k, False: 105k]
  |  |  ------------------
  ------------------
 1889|   830k|            const uint8_t b = *p;
 1890|   830k|            const uint8_t* run_start = p++;
 1891|       |
 1892|       |            // Fast run counting with early SIMD exit
 1893|       |#if defined(ZXC_USE_AVX512)
 1894|       |            const __m512i vb = _mm512_set1_epi8((char)b);
 1895|       |            while (p <= p_end - 64) {
 1896|       |                const __m512i v = _mm512_loadu_si512((const void*)p);
 1897|       |                const __mmask64 mask = _mm512_cmpeq_epi8_mask(v, vb);
 1898|       |                if (mask != 0xFFFFFFFFFFFFFFFFULL) {
 1899|       |                    p += (size_t)zxc_ctz64(~mask);
 1900|       |                    goto _run_done;
 1901|       |                }
 1902|       |                p += 64;
 1903|       |            }
 1904|       |#elif defined(ZXC_USE_AVX2)
 1905|       |            const __m256i vb = _mm256_set1_epi8((char)b);
 1906|       |            while (p <= p_end - 32) {
 1907|       |                const __m256i v = _mm256_loadu_si256((const __m256i*)p);
 1908|       |                const uint32_t mask = (uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, vb));
 1909|       |                if (mask != 0xFFFFFFFF) {
 1910|       |                    p += zxc_ctz32(~mask);
 1911|       |                    goto _run_done;
 1912|       |                }
 1913|       |                p += 32;
 1914|       |            }
 1915|       |#elif defined(ZXC_USE_SSE2)
 1916|       |            const __m128i vb = _mm_set1_epi8((char)b);
 1917|   951k|            while (p <= p_end - 16) {
  ------------------
  |  Branch (1917:20): [True: 858k, False: 93.0k]
  ------------------
 1918|   858k|                const __m128i v = _mm_loadu_si128((const __m128i*)p);
 1919|   858k|                const uint32_t mask = (uint32_t)_mm_movemask_epi8(_mm_cmpeq_epi8(v, vb));
 1920|   858k|                if (mask != 0xFFFFU) {
  ------------------
  |  Branch (1920:21): [True: 737k, False: 121k]
  ------------------
 1921|   737k|                    p += zxc_ctz32(~mask);
 1922|   737k|                    goto _run_done;
 1923|   737k|                }
 1924|   121k|                p += 16;
 1925|   121k|            }
 1926|       |#elif defined(ZXC_USE_NEON64)
 1927|       |            const uint8x16_t vb = vdupq_n_u8(b);
 1928|       |            while (p <= p_end - 16) {
 1929|       |                const uint8x16_t v = vld1q_u8(p);
 1930|       |                const uint8x16_t eq = vceqq_u8(v, vb);
 1931|       |                // SHRN nibble-mask: see find_best_match above for rationale.
 1932|       |                const uint64_t mask =
 1933|       |                    vget_lane_u64(vreinterpret_u64_u8(vshrn_n_u16(vreinterpretq_u16_u8(eq), 4)), 0);
 1934|       |                if (LIKELY(mask == ~(uint64_t)0)) {
 1935|       |                    p += 16;
 1936|       |                } else {
 1937|       |                    p += (size_t)(zxc_ctz64(~mask) >> 2);
 1938|       |                    goto _run_done;
 1939|       |                }
 1940|       |            }
 1941|       |#elif defined(ZXC_USE_NEON32)
 1942|       |            uint8x16_t vb = vdupq_n_u8(b);
 1943|       |            while (p <= p_end - 16) {
 1944|       |                uint8x16_t v = vld1q_u8(p);
 1945|       |                uint8x16_t eq = vceqq_u8(v, vb);
 1946|       |                uint8x16_t not_eq = vmvnq_u8(eq);
 1947|       |
 1948|       |                // 32-bit ARM NEON doesn't always support vgetq_lane_u64 / vreinterpretq_u64_u8 so
 1949|       |                // we treat the 128-bit vector as 4 x 32-bit lanes */
 1950|       |                const uint32x4_t neq32 = vreinterpretq_u32_u8(not_eq);
 1951|       |                const uint32_t l0 = vgetq_lane_u32(neq32, 0);
 1952|       |                const uint32_t l1 = vgetq_lane_u32(neq32, 1);
 1953|       |
 1954|       |                const uint64_t lo = ((uint64_t)l1 << 32) | l0;
 1955|       |                if (lo != 0) {
 1956|       |                    p += (size_t)(zxc_ctz64(lo) >> 3);
 1957|       |                    goto _run_done;
 1958|       |                }
 1959|       |
 1960|       |                const uint32_t h0 = vgetq_lane_u32(neq32, 2);
 1961|       |                const uint32_t h1 = vgetq_lane_u32(neq32, 3);
 1962|       |                const uint64_t hi = ((uint64_t)h1 << 32) | h0;
 1963|       |
 1964|       |                if (hi != 0) {
 1965|       |                    p += 8 + (zxc_ctz64(hi) >> 3);
 1966|       |                    goto _run_done;
 1967|       |                }
 1968|       |                p += 16;
 1969|       |            }
 1970|       |#endif
 1971|   319k|            while (p < p_end && *p == b) p++;
  ------------------
  |  Branch (1971:20): [True: 296k, False: 23.2k]
  |  Branch (1971:33): [True: 226k, False: 69.8k]
  ------------------
 1972|       |
 1973|  93.0k|#if defined(ZXC_USE_AVX512) || defined(ZXC_USE_AVX2) || defined(ZXC_USE_NEON64) || \
 1974|  93.0k|    defined(ZXC_USE_NEON32) || defined(ZXC_USE_SSE2)
 1975|   830k|        _run_done:;
 1976|   830k|#endif
 1977|   830k|            const size_t run = (size_t)(p - run_start);
 1978|       |
 1979|   830k|            if (run >= ZXC_LIT_RLE_RUN_MIN) {
  ------------------
  |  |  561|   830k|#define ZXC_LIT_RLE_RUN_MIN 4U
  ------------------
  |  Branch (1979:17): [True: 395k, False: 434k]
  ------------------
 1980|       |                // RLE run: 2 bytes per ZXC_LIT_RLE_RUN_MAX values, then remainder
 1981|       |                // Branchless: full_chunks * 2 + remainder handling
 1982|   395k|                const size_t full_chunks = run / ZXC_LIT_RLE_RUN_MAX;
  ------------------
  |  |  563|   395k|#define ZXC_LIT_RLE_RUN_MAX (ZXC_LIT_LEN_MASK + ZXC_LIT_RLE_RUN_MIN) /* 131 */
  |  |  ------------------
  |  |  |  |  557|   395k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  555|   395k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_LIT_RLE_RUN_MAX (ZXC_LIT_LEN_MASK + ZXC_LIT_RLE_RUN_MIN) /* 131 */
  |  |  ------------------
  |  |  |  |  561|   395k|#define ZXC_LIT_RLE_RUN_MIN 4U
  |  |  ------------------
  ------------------
 1983|   395k|                const size_t rem = run - full_chunks * ZXC_LIT_RLE_RUN_MAX;  // Avoid modulo
  ------------------
  |  |  563|   395k|#define ZXC_LIT_RLE_RUN_MAX (ZXC_LIT_LEN_MASK + ZXC_LIT_RLE_RUN_MIN) /* 131 */
  |  |  ------------------
  |  |  |  |  557|   395k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  555|   395k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_LIT_RLE_RUN_MAX (ZXC_LIT_LEN_MASK + ZXC_LIT_RLE_RUN_MIN) /* 131 */
  |  |  ------------------
  |  |  |  |  561|   395k|#define ZXC_LIT_RLE_RUN_MIN 4U
  |  |  ------------------
  ------------------
 1984|   395k|                rle_size += full_chunks * 2;
 1985|       |                // Remainder: if >= 4 -> 2 bytes (RLE), else 1 + rem (literal)
 1986|   395k|                if (rem >= ZXC_LIT_RLE_RUN_MIN)
  ------------------
  |  |  561|   395k|#define ZXC_LIT_RLE_RUN_MIN 4U
  ------------------
  |  Branch (1986:21): [True: 395k, False: 268]
  ------------------
 1987|   395k|                    rle_size += 2;
 1988|    268|                else if (rem > 0)
  ------------------
  |  Branch (1988:26): [True: 124, False: 144]
  ------------------
 1989|    124|                    rle_size += 1 + rem;
 1990|   434k|            } else {
 1991|       |                // Literal run: scan ahead with fast SIMD lookahead
 1992|   434k|                const uint8_t* lit_start = run_start;
 1993|       |
 1994|   434k|#if defined(ZXC_RLE_WIN)
 1995|  18.9M|                while (p <= p_end_4 - ZXC_RLE_WIN) {
  ------------------
  |  |  140|  18.9M|#define ZXC_RLE_WIN 16
  ------------------
  |  Branch (1995:24): [True: 18.8M, False: 132k]
  ------------------
 1996|  18.8M|                    const zxc_rle_mask_t m = zxc_rle_pair_mask(p);
 1997|  18.8M|                    const zxc_rle_mask_t mask = m & (m >> ZXC_RLE_BPB) & (m >> (2 * ZXC_RLE_BPB));
  ------------------
  |  |  141|  18.8M|#define ZXC_RLE_BPB 1
  ------------------
                                  const zxc_rle_mask_t mask = m & (m >> ZXC_RLE_BPB) & (m >> (2 * ZXC_RLE_BPB));
  ------------------
  |  |  141|  18.8M|#define ZXC_RLE_BPB 1
  ------------------
 1998|  18.8M|                    if (LIKELY(mask == 0)) {
  ------------------
  |  |  146|  18.8M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 16.3M, False: 2.52M]
  |  |  ------------------
  ------------------
 1999|  16.3M|                        p += ZXC_RLE_WIN - 2;
  ------------------
  |  |  140|  16.3M|#define ZXC_RLE_WIN 16
  ------------------
 2000|  16.3M|                        continue;
 2001|  16.3M|                    }
 2002|  2.52M|                    const unsigned rpos = (unsigned)(ZXC_RLE_CTZ(mask) / ZXC_RLE_BPB);
  ------------------
  |  |  142|  2.52M|#define ZXC_RLE_CTZ(x) zxc_ctz32(x)
  ------------------
                                  const unsigned rpos = (unsigned)(ZXC_RLE_CTZ(mask) / ZXC_RLE_BPB);
  ------------------
  |  |  141|  2.52M|#define ZXC_RLE_BPB 1
  ------------------
 2003|  2.52M|                    const unsigned rpairs =
 2004|  2.52M|                        (unsigned)(ZXC_RLE_CTZ(~(m >> (rpos * ZXC_RLE_BPB))) / ZXC_RLE_BPB);
  ------------------
  |  |  142|  2.52M|#define ZXC_RLE_CTZ(x) zxc_ctz32(x)
  ------------------
                                      (unsigned)(ZXC_RLE_CTZ(~(m >> (rpos * ZXC_RLE_BPB))) / ZXC_RLE_BPB);
  ------------------
  |  |  141|  2.52M|#define ZXC_RLE_BPB 1
  ------------------
 2005|  2.52M|                    if (UNLIKELY(rpos + rpairs >= ZXC_RLE_WIN)) {
  ------------------
  |  |  152|  2.52M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 302k, False: 2.21M]
  |  |  ------------------
  ------------------
 2006|   302k|                        p += rpos;
 2007|   302k|                        goto _lit_done; /* run may extend past the window */
 2008|   302k|                    }
 2009|  2.21M|                    const size_t seg = (size_t)(p + rpos - lit_start);
 2010|  2.21M|                    rle_size += seg + (seg + ZXC_LIT_LEN_MASK) / ZXC_LIT_RUN_MAX;
  ------------------
  |  |  557|  2.21M|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  ------------------
  |  |  |  |  555|  2.21M|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  ------------------
  ------------------
                                  rle_size += seg + (seg + ZXC_LIT_LEN_MASK) / ZXC_LIT_RUN_MAX;
  ------------------
  |  |  559|  2.21M|#define ZXC_LIT_RUN_MAX (ZXC_LIT_LEN_MASK + 1U) /* 128 */
  |  |  ------------------
  |  |  |  |  557|  2.21M|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  555|  2.21M|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2011|  2.21M|                    rle_size += 2; /* run fits one chunk: full_chunks=0, rem>=4 */
 2012|  2.21M|                    p += rpos + rpairs + 1;
 2013|  2.21M|                    lit_start = p;
 2014|  2.21M|                }
 2015|       |#elif defined(ZXC_USE_NEON32)
 2016|       |                while (p <= p_end_4 - 16) {
 2017|       |                    uint8x16_t v0 = vld1q_u8(p);
 2018|       |                    uint8x16_t v1 = vld1q_u8(p + 1);
 2019|       |                    const uint8x16_t pe = vceqq_u8(v0, v1);
 2020|       |                    const uint8x16_t zv = vdupq_n_u8(0);
 2021|       |                    const uint8x16_t eq =
 2022|       |                        vandq_u8(pe, vandq_u8(vextq_u8(pe, zv, 1), vextq_u8(pe, zv, 2)));
 2023|       |
 2024|       |                    uint32x4_t eq32 = vreinterpretq_u32_u8(eq);
 2025|       |                    uint32_t l0 = vgetq_lane_u32(eq32, 0);
 2026|       |                    uint32_t l1 = vgetq_lane_u32(eq32, 1);
 2027|       |                    uint64_t lo = ((uint64_t)l1 << 32) | l0;
 2028|       |
 2029|       |                    if (lo != 0) {
 2030|       |                        p += (zxc_ctz64(lo) >> 3);
 2031|       |                        goto _lit_done;
 2032|       |                    }
 2033|       |
 2034|       |                    uint32_t h0 = vgetq_lane_u32(eq32, 2);
 2035|       |                    uint32_t h1 = vgetq_lane_u32(eq32, 3);
 2036|       |                    uint64_t hi = ((uint64_t)h1 << 32) | h0;
 2037|       |
 2038|       |                    if (hi != 0) {
 2039|       |                        p += 8 + (zxc_ctz64(hi) >> 3);
 2040|       |                        goto _lit_done;
 2041|       |                    }
 2042|       |                    p += 14;
 2043|       |                }
 2044|       |#endif
 2045|   751k|                while (p < p_end_4) {
  ------------------
  |  Branch (2045:24): [True: 658k, False: 92.9k]
  ------------------
 2046|   658k|                    if (UNLIKELY(p[0] == p[1] && p[1] == p[2] && p[2] == p[3])) break;
  ------------------
  |  |  152|  1.49M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 39.0k, False: 619k]
  |  |  |  Branch (152:42): [True: 119k, False: 539k]
  |  |  |  Branch (152:42): [True: 56.4k, False: 62.6k]
  |  |  |  Branch (152:42): [True: 39.0k, False: 17.3k]
  |  |  ------------------
  ------------------
 2047|   619k|                    p++;
 2048|   619k|                }
 2049|   132k|                if (p >= p_end_4) p = p_end;
  ------------------
  |  Branch (2049:21): [True: 92.8k, False: 39.1k]
  ------------------
 2050|       |
 2051|   132k|#if defined(ZXC_USE_AVX512) || defined(ZXC_USE_AVX2) || defined(ZXC_USE_NEON64) || \
 2052|   132k|    defined(ZXC_USE_NEON32) || defined(ZXC_USE_SSE2)
 2053|   434k|            _lit_done:;
 2054|   434k|#endif
 2055|   434k|                const size_t lit_run = (size_t)(p - lit_start);
 2056|       |                // 1 header per ZXC_LIT_RUN_MAX bytes + all data bytes
 2057|   434k|                rle_size += lit_run + (lit_run + ZXC_LIT_LEN_MASK) / ZXC_LIT_RUN_MAX;
  ------------------
  |  |  557|   434k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  ------------------
  |  |  |  |  555|   434k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  ------------------
  ------------------
                              rle_size += lit_run + (lit_run + ZXC_LIT_LEN_MASK) / ZXC_LIT_RUN_MAX;
  ------------------
  |  |  559|   434k|#define ZXC_LIT_RUN_MAX (ZXC_LIT_LEN_MASK + 1U) /* 128 */
  |  |  ------------------
  |  |  |  |  557|   434k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  555|   434k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2058|   434k|            }
 2059|   830k|        }
 2060|       |
 2061|       |        // RLE over RAW: space-speed J comparison. The per-level premium
 2062|       |        // reproduces the historical margin exactly below ULTRA.
 2063|   105k|        const size_t rle_j = rle_size + ZXC_SS_TAX(lit_c, zxc_ss_prem_rle_q8(level));
  ------------------
  |  |  950|   105k|#define ZXC_SS_TAX(n, prem_q8) (((size_t)(n) * (size_t)(prem_q8)) >> 8)
  ------------------
 2064|   105k|        if (rle_j < best_j) {
  ------------------
  |  Branch (2064:13): [True: 67.3k, False: 37.7k]
  ------------------
 2065|  67.3k|            enc_lit = ZXC_SECTION_ENCODING_RLE;
 2066|  67.3k|            best_j = rle_j;
 2067|  67.3k|        }
 2068|   105k|    }
 2069|       |
 2070|       |    // Level >= 6: Huffman as a third literal-encoding candidate. Histogram,
 2071|       |    // length-limited code lengths, exact PivCo section size, and switch if its
 2072|       |    // J (size + decode tax) beats the current winner's.
 2073|   111k|    uint8_t huf_code_len[ZXC_HUF_NUM_SYMBOLS];
 2074|   111k|    size_t huf_total_size = SIZE_MAX;
 2075|   111k|    uint32_t lit_freq[ZXC_HUF_NUM_SYMBOLS]; /* valid iff huf_total_size != SIZE_MAX */
 2076|   111k|    if (level >= ZXC_LEVEL_DENSITY && lit_c >= ZXC_HUF_MIN_LITERALS) {
  ------------------
  |  |  999|  73.4k|#define ZXC_HUF_MIN_LITERALS 139
  ------------------
  |  Branch (2076:9): [True: 73.4k, False: 38.0k]
  |  Branch (2076:39): [True: 67.4k, False: 6.01k]
  ------------------
 2077|  67.4k|        uint32_t freq0[ZXC_HUF_NUM_SYMBOLS] = {0};
 2078|  67.4k|        uint32_t freq1[ZXC_HUF_NUM_SYMBOLS] = {0};
 2079|  67.4k|        uint32_t freq2[ZXC_HUF_NUM_SYMBOLS] = {0};
 2080|  67.4k|        uint32_t freq3[ZXC_HUF_NUM_SYMBOLS] = {0};
 2081|  67.4k|        {
 2082|  67.4k|            size_t i = 0;
 2083|  50.3M|            for (; i + 4 <= lit_c; i += 4) {
  ------------------
  |  Branch (2083:20): [True: 50.2M, False: 67.4k]
  ------------------
 2084|  50.2M|                freq0[literals[i + 0]]++;
 2085|  50.2M|                freq1[literals[i + 1]]++;
 2086|  50.2M|                freq2[literals[i + 2]]++;
 2087|  50.2M|                freq3[literals[i + 3]]++;
 2088|  50.2M|            }
 2089|   167k|            for (; i < lit_c; i++) freq0[literals[i]]++;
  ------------------
  |  Branch (2089:20): [True: 100k, False: 67.4k]
  ------------------
 2090|  67.4k|        }
 2091|  67.4k|        uint32_t* const freq = lit_freq;
 2092|  17.3M|        for (int k = 0; k < ZXC_HUF_NUM_SYMBOLS; k++) {
  ------------------
  |  |  833|  17.3M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (2092:25): [True: 17.2M, False: 67.4k]
  ------------------
 2093|  17.2M|            freq[k] = freq0[k] + freq1[k] + freq2[k] + freq3[k];
 2094|  17.2M|        }
 2095|       |
 2096|  67.4k|        if (zxc_huf_build_code_lengths(freq, huf_code_len, ctx->opt_scratch,
  ------------------
  |  |   27|  67.4k|#define zxc_huf_build_code_lengths ZXC_CAT(zxc_huf_build_code_lengths, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   24|  67.4k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   23|  67.4k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2096:13): [True: 67.4k, False: 3]
  ------------------
 2097|  67.4k|                                       zxc_huf_enc_max_code_len(level)) == ZXC_OK) {
 2098|  67.4k|            (void)zxc_huf_nudge_code_lengths(freq, huf_code_len, ctx->opt_scratch,
 2099|  67.4k|                                             ctx->opt_scratch_cap, zxc_huf_enc_max_code_len(level));
 2100|  67.4k|            huf_total_size = zxc_huf_calc_size(freq, huf_code_len, 1);
  ------------------
  |  |   29|  67.4k|#define zxc_huf_calc_size ZXC_CAT(zxc_huf_calc_size, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   24|  67.4k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   23|  67.4k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2101|       |            // Space-speed: the entropy candidate must beat the current winner's
 2102|       |            // J, paying its own decode tax over the copy path.
 2103|  67.4k|            if (huf_total_size != SIZE_MAX) {
  ------------------
  |  Branch (2103:17): [True: 67.4k, False: 18.4E]
  ------------------
 2104|  67.4k|                const size_t huf_j = huf_total_size + ZXC_SS_TAX(lit_c, zxc_ss_prem_huf_q8(level));
  ------------------
  |  |  950|  67.4k|#define ZXC_SS_TAX(n, prem_q8) (((size_t)(n) * (size_t)(prem_q8)) >> 8)
  ------------------
 2105|  67.4k|                if (huf_j < best_j) {
  ------------------
  |  Branch (2105:21): [True: 20.6k, False: 46.7k]
  ------------------
 2106|  20.6k|                    enc_lit = ZXC_SECTION_ENCODING_HUFFMAN;
 2107|  20.6k|                    best_j = huf_j;
 2108|  20.6k|                }
 2109|  67.4k|            }
 2110|  67.4k|        }
 2111|  67.4k|    }
 2112|       |
 2113|       |    // Shared dictionary table (level >= 6, dict with a table): the HUFFMAN
 2114|       |    // bitstream minus the 128-byte header, so it stays viable far below
 2115|       |    // ZXC_HUF_MIN_LITERALS. A literal without a code drops the candidate.
 2116|   111k|    size_t huf_dict_total_size = SIZE_MAX;
 2117|   111k|#ifndef ZXC_NO_DICT
 2118|   111k|    if (level >= ZXC_LEVEL_DENSITY && ctx->dict_huf_tree_ok && lit_c > 0) {
  ------------------
  |  Branch (2118:9): [True: 73.4k, False: 38.0k]
  |  Branch (2118:39): [True: 0, False: 73.4k]
  |  Branch (2118:64): [True: 0, False: 0]
  ------------------
 2119|       |        // The dict candidate runs on sections too small for the per-block
 2120|       |        // table, so the histogram may not have been built above.
 2121|      0|        if (huf_total_size == SIZE_MAX) {
  ------------------
  |  Branch (2121:13): [True: 0, False: 0]
  ------------------
 2122|      0|            ZXC_MEMSET(lit_freq, 0, sizeof(uint32_t) * ZXC_HUF_NUM_SYMBOLS);
  ------------------
  |  |  173|      0|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 2123|      0|            for (size_t i = 0; i < lit_c; i++) lit_freq[literals[i]]++;
  ------------------
  |  Branch (2123:32): [True: 0, False: 0]
  ------------------
 2124|      0|        }
 2125|       |        // zxc_huf_calc_size returns SIZE_MAX for unencodable candidates
 2126|       |        // (a literal byte without a code in the shared table).
 2127|      0|        huf_dict_total_size =
 2128|      0|            zxc_huf_calc_size_dict(lit_freq, ctx->dict_huf->code_len, &ctx->dict_huf->tree);
  ------------------
  |  |   30|      0|#define zxc_huf_calc_size_dict ZXC_CAT(zxc_huf_calc_size_dict, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   24|      0|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   23|      0|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2129|      0|        if (huf_dict_total_size != SIZE_MAX) {
  ------------------
  |  Branch (2129:13): [True: 0, False: 0]
  ------------------
 2130|       |            // Same J rule against the running winner: vs the per-block Huffman
 2131|       |            // candidate the equal entropy taxes cancel (pure size comparison),
 2132|       |            // while RAW/RLE baselines keep their decode-tax edge.
 2133|      0|            const size_t huf_dict_j =
 2134|      0|                huf_dict_total_size + ZXC_SS_TAX(lit_c, zxc_ss_prem_huf_q8(level));
  ------------------
  |  |  950|      0|#define ZXC_SS_TAX(n, prem_q8) (((size_t)(n) * (size_t)(prem_q8)) >> 8)
  ------------------
 2135|       |            // Last candidate: no need to keep best_j updated past this point.
 2136|      0|            if (huf_dict_j < best_j) enc_lit = ZXC_SECTION_ENCODING_HUFFMAN_DICT;
  ------------------
  |  Branch (2136:17): [True: 0, False: 0]
  ------------------
 2137|      0|        }
 2138|      0|    }
 2139|   111k|#endif
 2140|       |
 2141|       |    // Level-7 (ULTRA): Huffman-code the token stream with the literal codec -
 2142|       |    // tokens are a <= 256-symbol alphabet. Same J rule; the decoder picks the
 2143|       |    // path from gh.enc_tok. opt_scratch is free by now.
 2144|   111k|    uint8_t tok_code_len[ZXC_HUF_NUM_SYMBOLS];
 2145|   111k|    uint8_t enc_tok = ZXC_SECTION_ENCODING_RAW;
 2146|   111k|    size_t tok_huf_size = 0;
 2147|   111k|    uint32_t tfreq[ZXC_HUF_NUM_SYMBOLS];
 2148|   111k|    if (level >= ZXC_LEVEL_ULTRA && seq_c >= ZXC_HUF_MIN_LITERALS) {
  ------------------
  |  |  999|  68.1k|#define ZXC_HUF_MIN_LITERALS 139
  ------------------
  |  Branch (2148:9): [True: 68.1k, False: 43.3k]
  |  Branch (2148:37): [True: 50.7k, False: 17.3k]
  ------------------
 2149|  50.7k|        ZXC_MEMSET(tfreq, 0, sizeof(tfreq)); /* only the ULTRA path reads tfreq */
  ------------------
  |  |  173|  50.7k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 2150|  15.0M|        for (uint32_t i = 0; i < seq_c; i++) tfreq[buf_tokens[i]]++;
  ------------------
  |  Branch (2150:30): [True: 15.0M, False: 50.7k]
  ------------------
 2151|  50.7k|        if (zxc_huf_build_code_lengths(tfreq, tok_code_len, ctx->opt_scratch,
  ------------------
  |  |   27|  50.7k|#define zxc_huf_build_code_lengths ZXC_CAT(zxc_huf_build_code_lengths, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   24|  50.7k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   23|  50.7k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2151:13): [True: 50.7k, False: 0]
  ------------------
 2152|  50.7k|                                       zxc_huf_enc_max_code_len(level)) == ZXC_OK) {
 2153|  50.7k|            (void)zxc_huf_nudge_code_lengths(tfreq, tok_code_len, ctx->opt_scratch,
 2154|  50.7k|                                             ctx->opt_scratch_cap, zxc_huf_enc_max_code_len(level));
 2155|  50.7k|            tok_huf_size = zxc_huf_calc_size(tfreq, tok_code_len, 1);
  ------------------
  |  |   29|  50.7k|#define zxc_huf_calc_size ZXC_CAT(zxc_huf_calc_size, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   24|  50.7k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   23|  50.7k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2156|       |            // Space-speed J comparison (this path is ULTRA-only): the PivCo
 2157|       |            // token section pays the same decode tax as PivCo literals.
 2158|  50.7k|            if (tok_huf_size != SIZE_MAX &&
  ------------------
  |  Branch (2158:17): [True: 50.7k, False: 1]
  ------------------
 2159|  50.7k|                tok_huf_size + ZXC_SS_TAX((size_t)seq_c, zxc_ss_prem_huf_q8(level)) < (size_t)seq_c)
  ------------------
  |  |  950|  50.7k|#define ZXC_SS_TAX(n, prem_q8) (((size_t)(n) * (size_t)(prem_q8)) >> 8)
  ------------------
  |  Branch (2159:17): [True: 41.3k, False: 9.41k]
  ------------------
 2160|  41.3k|                enc_tok = ZXC_SECTION_ENCODING_HUFFMAN;
 2161|  50.7k|        }
 2162|  50.7k|    }
 2163|       |
 2164|   111k|    const int use_8bit_off = (max_offset <= UINT8_MAX) ? 1 : 0;
  ------------------
  |  Branch (2164:30): [True: 29.4k, False: 82.0k]
  ------------------
 2165|   111k|    const size_t off_stream_size = use_8bit_off ? seq_c : (seq_c * 2);
  ------------------
  |  Branch (2165:36): [True: 29.4k, False: 82.0k]
  ------------------
 2166|       |
 2167|   111k|    const zxc_gnr_header_t gh = {.n_sequences = seq_c,
 2168|   111k|                                 .n_literals = (uint32_t)lit_c,
 2169|   111k|                                 .enc_lit = (uint8_t)enc_lit,
 2170|   111k|                                 .enc_tok = enc_tok,
 2171|   111k|                                 .enc_mlen = 0,
 2172|   111k|                                 .enc_off = (uint8_t)use_8bit_off};
 2173|       |
 2174|   111k|    const size_t sz_lit = (enc_lit == ZXC_SECTION_ENCODING_RLE)            ? rle_size
  ------------------
  |  Branch (2174:27): [True: 49.0k, False: 62.4k]
  ------------------
 2175|   111k|                          : (enc_lit == ZXC_SECTION_ENCODING_HUFFMAN)      ? huf_total_size
  ------------------
  |  Branch (2175:29): [True: 20.6k, False: 41.7k]
  ------------------
 2176|  62.4k|                          : (enc_lit == ZXC_SECTION_ENCODING_HUFFMAN_DICT) ? huf_dict_total_size
  ------------------
  |  Branch (2176:29): [True: 0, False: 41.7k]
  ------------------
 2177|  41.7k|                                                                           : lit_c;
 2178|   111k|    const size_t sz_tok = (enc_tok == ZXC_SECTION_ENCODING_HUFFMAN) ? tok_huf_size : seq_c;
  ------------------
  |  Branch (2178:27): [True: 41.3k, False: 70.1k]
  ------------------
 2179|   111k|    const size_t sz_off = off_stream_size;
 2180|   111k|    const size_t sz_ext = extras_sz;
 2181|       |
 2182|   111k|    if (!dst) {
  ------------------
  |  Branch (2182:9): [True: 0, False: 111k]
  ------------------
 2183|      0|        const size_t desc = ((enc_lit != ZXC_SECTION_ENCODING_RAW) ? sizeof(uint32_t) : 0) +
  ------------------
  |  Branch (2183:30): [True: 0, False: 0]
  ------------------
 2184|      0|                            ((enc_tok == ZXC_SECTION_ENCODING_HUFFMAN) ? sizeof(uint32_t) : 0);
  ------------------
  |  Branch (2184:30): [True: 0, False: 0]
  ------------------
 2185|      0|        const size_t behind = sz_tok + sz_off + sz_ext;
 2186|      0|        const size_t slack = (behind < ZXC_BLOCK_LIT_SLACK) ? ZXC_BLOCK_LIT_SLACK - behind : 0;
  ------------------
  |  |  356|      0|#define ZXC_BLOCK_LIT_SLACK 32
  ------------------
                      const size_t slack = (behind < ZXC_BLOCK_LIT_SLACK) ? ZXC_BLOCK_LIT_SLACK - behind : 0;
  ------------------
  |  |  356|      0|#define ZXC_BLOCK_LIT_SLACK 32
  ------------------
  |  Branch (2186:30): [True: 0, False: 0]
  ------------------
 2187|      0|        *out_sz =
 2188|      0|            ZXC_BLOCK_HEADER_SIZE + ZXC_SPL_HEADER_BINARY_SIZE + desc + sz_lit + behind + slack;
  ------------------
  |  |  439|      0|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
                          ZXC_BLOCK_HEADER_SIZE + ZXC_SPL_HEADER_BINARY_SIZE + desc + sz_lit + behind + slack;
  ------------------
  |  |  443|      0|#define ZXC_SPL_HEADER_BINARY_SIZE 12
  ------------------
 2189|      0|        return ZXC_OK;
 2190|      0|    }
 2191|       |
 2192|   111k|    zxc_block_header_t bh = {.block_type = ZXC_BLOCK_SPL};
 2193|   111k|    uint8_t* const p = dst + ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  439|   111k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 2194|   111k|    size_t rem = dst_cap - ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  439|   111k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 2195|       |
 2196|   111k|    const int ghs = zxc_write_spl_header_and_desc(p, rem, &gh, (uint32_t)sz_lit, (uint32_t)sz_tok);
 2197|   111k|    if (UNLIKELY(ghs < 0)) return ghs;
  ------------------
  |  |  152|   111k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 111k]
  |  |  ------------------
  ------------------
 2198|       |
 2199|   111k|    uint8_t* p_curr = p + ghs;
 2200|   111k|    rem -= (size_t)ghs;
 2201|       |
 2202|   111k|    if (UNLIKELY(rem < sz_lit)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|   111k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 111k]
  |  |  ------------------
  ------------------
 2203|       |
 2204|   111k|    if (enc_lit == ZXC_SECTION_ENCODING_HUFFMAN) {
  ------------------
  |  Branch (2204:9): [True: 20.6k, False: 90.7k]
  ------------------
 2205|  20.6k|        const int written =
 2206|  20.6k|            zxc_huf_encode_section(literals, lit_c, lit_freq, huf_code_len, p_curr, rem);
  ------------------
  |  |   31|  20.6k|#define zxc_huf_encode_section ZXC_CAT(zxc_huf_encode_section, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   24|  20.6k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   23|  20.6k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2207|  20.6k|        if (UNLIKELY(written < 0)) return written;
  ------------------
  |  |  152|  20.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 20.6k]
  |  |  ------------------
  ------------------
 2208|  20.6k|        if (UNLIKELY((size_t)written != huf_total_size)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  20.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 20.6k]
  |  |  ------------------
  ------------------
 2209|  20.6k|        p_curr += written;
 2210|  20.6k|#ifndef ZXC_NO_DICT
 2211|  90.7k|    } else if (enc_lit == ZXC_SECTION_ENCODING_HUFFMAN_DICT) {
  ------------------
  |  Branch (2211:16): [True: 0, False: 90.7k]
  ------------------
 2212|      0|        const int written =
 2213|      0|            zxc_huf_encode_section_dict(literals, lit_c, lit_freq, ctx->dict_huf->code_len,
  ------------------
  |  |   32|      0|#define zxc_huf_encode_section_dict ZXC_CAT(zxc_huf_encode_section_dict, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   24|      0|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   23|      0|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2214|      0|                                        &ctx->dict_huf->tree, ctx->dict_huf->codes, p_curr, rem);
 2215|      0|        if (UNLIKELY(written < 0)) return written;
  ------------------
  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2216|      0|        if (UNLIKELY((size_t)written != huf_dict_total_size)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2217|      0|        p_curr += written;
 2218|      0|#endif
 2219|  90.7k|    } else if (enc_lit == ZXC_SECTION_ENCODING_RLE) {
  ------------------
  |  Branch (2219:16): [True: 49.0k, False: 41.7k]
  ------------------
 2220|       |        // Write RLE - optimized single-pass encoding
 2221|  49.0k|        const uint8_t* lit_ptr = literals;
 2222|  49.0k|        const uint8_t* const lit_end = literals + lit_c;
 2223|       |
 2224|  3.14M|        while (lit_ptr < lit_end) {
  ------------------
  |  Branch (2224:16): [True: 3.09M, False: 49.0k]
  ------------------
 2225|  3.09M|            uint8_t b = *lit_ptr;
 2226|  3.09M|            const uint8_t* run_start = lit_ptr++;
 2227|       |
 2228|  13.0M|            while (lit_ptr < lit_end && *lit_ptr == b) lit_ptr++;
  ------------------
  |  Branch (2228:20): [True: 13.0M, False: 18.0k]
  |  Branch (2228:41): [True: 9.93M, False: 3.07M]
  ------------------
 2229|  3.09M|            size_t run = (size_t)(lit_ptr - run_start);
 2230|       |
 2231|  3.09M|            if (run >= ZXC_LIT_RLE_RUN_MIN) {
  ------------------
  |  |  561|  3.09M|#define ZXC_LIT_RLE_RUN_MIN 4U
  ------------------
  |  Branch (2231:17): [True: 1.58M, False: 1.50M]
  ------------------
 2232|       |                // RLE runs: emit 2-byte tokens (header + value)
 2233|  3.17M|                while (run >= ZXC_LIT_RLE_RUN_MIN) {
  ------------------
  |  |  561|  3.17M|#define ZXC_LIT_RLE_RUN_MIN 4U
  ------------------
  |  Branch (2233:24): [True: 1.59M, False: 1.58M]
  ------------------
 2234|  1.59M|                    size_t chunk = (run > ZXC_LIT_RLE_RUN_MAX) ? ZXC_LIT_RLE_RUN_MAX : run;
  ------------------
  |  |  563|  1.59M|#define ZXC_LIT_RLE_RUN_MAX (ZXC_LIT_LEN_MASK + ZXC_LIT_RLE_RUN_MIN) /* 131 */
  |  |  ------------------
  |  |  |  |  557|  1.59M|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  555|  1.59M|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_LIT_RLE_RUN_MAX (ZXC_LIT_LEN_MASK + ZXC_LIT_RLE_RUN_MIN) /* 131 */
  |  |  ------------------
  |  |  |  |  561|  1.59M|#define ZXC_LIT_RLE_RUN_MIN 4U
  |  |  ------------------
  ------------------
                                  size_t chunk = (run > ZXC_LIT_RLE_RUN_MAX) ? ZXC_LIT_RLE_RUN_MAX : run;
  ------------------
  |  |  563|  1.05k|#define ZXC_LIT_RLE_RUN_MAX (ZXC_LIT_LEN_MASK + ZXC_LIT_RLE_RUN_MIN) /* 131 */
  |  |  ------------------
  |  |  |  |  557|  1.05k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  555|  1.05k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_LIT_RLE_RUN_MAX (ZXC_LIT_LEN_MASK + ZXC_LIT_RLE_RUN_MIN) /* 131 */
  |  |  ------------------
  |  |  |  |  561|  1.05k|#define ZXC_LIT_RLE_RUN_MIN 4U
  |  |  ------------------
  ------------------
  |  Branch (2234:36): [True: 1.05k, False: 1.58M]
  ------------------
 2235|  1.59M|                    *p_curr++ = (uint8_t)(ZXC_LIT_RLE_FLAG | (chunk - ZXC_LIT_RLE_RUN_MIN));
  ------------------
  |  |  555|  1.59M|#define ZXC_LIT_RLE_FLAG 0x80U
  ------------------
                                  *p_curr++ = (uint8_t)(ZXC_LIT_RLE_FLAG | (chunk - ZXC_LIT_RLE_RUN_MIN));
  ------------------
  |  |  561|  1.59M|#define ZXC_LIT_RLE_RUN_MIN 4U
  ------------------
 2236|  1.59M|                    *p_curr++ = b;
 2237|  1.59M|                    run -= chunk;
 2238|  1.59M|                }
 2239|       |                // Leftover < 4 bytes: emit as literal
 2240|  1.58M|                if (run > 0) {
  ------------------
  |  Branch (2240:21): [True: 123, False: 1.58M]
  ------------------
 2241|    123|                    *p_curr++ = (uint8_t)(run - 1);
 2242|    123|                    ZXC_MEMCPY(p_curr, lit_ptr - run, run);
  ------------------
  |  |  168|    123|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2243|    123|                    p_curr += run;
 2244|    123|                }
 2245|  1.58M|            } else {
 2246|       |                // Literal run: scan ahead to find next RLE opportunity
 2247|  1.50M|                const uint8_t* lit_run_start = run_start;
 2248|       |
 2249|  46.0M|                while (lit_ptr < lit_end) {
  ------------------
  |  Branch (2249:24): [True: 46.0M, False: 37.9k]
  ------------------
 2250|  46.0M|                    if (UNLIKELY(lit_ptr + 3 < lit_end && lit_ptr[0] == lit_ptr[1] &&
  ------------------
  |  |  152|   190M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 1.47M, False: 44.5M]
  |  |  |  Branch (152:42): [True: 45.9M, False: 101k]
  |  |  |  Branch (152:42): [True: 4.25M, False: 41.6M]
  |  |  |  Branch (152:42): [True: 2.07M, False: 2.17M]
  |  |  |  Branch (152:42): [True: 1.47M, False: 606k]
  |  |  ------------------
  ------------------
 2251|  46.0M|                                 lit_ptr[1] == lit_ptr[2] && lit_ptr[2] == lit_ptr[3])) {
 2252|  1.47M|                        break;
 2253|  1.47M|                    }
 2254|  44.5M|                    lit_ptr++;
 2255|  44.5M|                }
 2256|       |
 2257|  1.50M|                size_t lit_run = (size_t)(lit_ptr - lit_run_start);
 2258|  1.50M|                const uint8_t* src_ptr = lit_run_start;
 2259|       |
 2260|       |                // Emit literal chunks (ZXC_LIT_RUN_MAX bytes each at most)
 2261|  3.22M|                while (lit_run > 0) {
  ------------------
  |  Branch (2261:24): [True: 1.71M, False: 1.50M]
  ------------------
 2262|  1.71M|                    size_t chunk = (lit_run > ZXC_LIT_RUN_MAX) ? ZXC_LIT_RUN_MAX : lit_run;
  ------------------
  |  |  559|  1.71M|#define ZXC_LIT_RUN_MAX (ZXC_LIT_LEN_MASK + 1U) /* 128 */
  |  |  ------------------
  |  |  |  |  557|  1.71M|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  555|  1.71M|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                  size_t chunk = (lit_run > ZXC_LIT_RUN_MAX) ? ZXC_LIT_RUN_MAX : lit_run;
  ------------------
  |  |  559|   208k|#define ZXC_LIT_RUN_MAX (ZXC_LIT_LEN_MASK + 1U) /* 128 */
  |  |  ------------------
  |  |  |  |  557|   208k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  555|   208k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2262:36): [True: 208k, False: 1.50M]
  ------------------
 2263|  1.71M|                    *p_curr++ = (uint8_t)(chunk - 1);
 2264|  1.71M|                    ZXC_MEMCPY(p_curr, src_ptr, chunk);
  ------------------
  |  |  168|  1.71M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2265|  1.71M|                    p_curr += chunk;
 2266|  1.71M|                    src_ptr += chunk;
 2267|  1.71M|                    lit_run -= chunk;
 2268|  1.71M|                }
 2269|  1.50M|            }
 2270|  3.09M|        }
 2271|  49.0k|    } else {
 2272|  41.7k|        ZXC_MEMCPY(p_curr, literals, lit_c);
  ------------------
  |  |  168|  41.7k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2273|  41.7k|        p_curr += lit_c;
 2274|  41.7k|    }
 2275|   111k|    rem -= sz_lit;
 2276|       |
 2277|   111k|    if (UNLIKELY(rem < sz_tok)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|   111k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 111k]
  |  |  ------------------
  ------------------
 2278|       |
 2279|   111k|    if (enc_tok == ZXC_SECTION_ENCODING_HUFFMAN) {
  ------------------
  |  Branch (2279:9): [True: 41.3k, False: 70.1k]
  ------------------
 2280|  41.3k|        const int written =
 2281|  41.3k|            zxc_huf_encode_section(buf_tokens, seq_c, tfreq, tok_code_len, p_curr, rem);
  ------------------
  |  |   31|  41.3k|#define zxc_huf_encode_section ZXC_CAT(zxc_huf_encode_section, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   24|  41.3k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   23|  41.3k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2282|  41.3k|        if (UNLIKELY(written < 0)) return written;
  ------------------
  |  |  152|  41.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 41.3k]
  |  |  ------------------
  ------------------
 2283|  41.3k|        if (UNLIKELY((size_t)written != tok_huf_size)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  41.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 41.3k]
  |  |  ------------------
  ------------------
 2284|  41.3k|        p_curr += written;
 2285|  70.1k|    } else {
 2286|  70.1k|        ZXC_MEMCPY(p_curr, buf_tokens, seq_c);
  ------------------
  |  |  168|  70.1k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2287|  70.1k|        p_curr += seq_c;
 2288|  70.1k|    }
 2289|   111k|    rem -= sz_tok;
 2290|       |
 2291|   111k|    if (UNLIKELY(rem < sz_off)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|   111k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 111k]
  |  |  ------------------
  ------------------
 2292|       |
 2293|   111k|    if (use_8bit_off) {
  ------------------
  |  Branch (2293:9): [True: 29.4k, False: 82.0k]
  ------------------
 2294|       |        // Write 1-byte offsets - unroll for better throughput
 2295|  29.4k|        uint32_t i = 0;
 2296|   489k|        for (; i + 8 <= seq_c; i += 8) {
  ------------------
  |  Branch (2296:16): [True: 459k, False: 29.4k]
  ------------------
 2297|   459k|            p_curr[0] = (uint8_t)buf_offsets[i + 0];
 2298|   459k|            p_curr[1] = (uint8_t)buf_offsets[i + 1];
 2299|   459k|            p_curr[2] = (uint8_t)buf_offsets[i + 2];
 2300|   459k|            p_curr[3] = (uint8_t)buf_offsets[i + 3];
 2301|   459k|            p_curr[4] = (uint8_t)buf_offsets[i + 4];
 2302|   459k|            p_curr[5] = (uint8_t)buf_offsets[i + 5];
 2303|   459k|            p_curr[6] = (uint8_t)buf_offsets[i + 6];
 2304|   459k|            p_curr[7] = (uint8_t)buf_offsets[i + 7];
 2305|   459k|            p_curr += 8;
 2306|   459k|        }
 2307|   113k|        for (; i < seq_c; i++) {
  ------------------
  |  Branch (2307:16): [True: 83.9k, False: 29.4k]
  ------------------
 2308|  83.9k|            *p_curr++ = (uint8_t)buf_offsets[i];
 2309|  83.9k|        }
 2310|  82.0k|    } else {
 2311|       |        // Write 2-byte offsets in little-endian order
 2312|       |#ifdef ZXC_BIG_ENDIAN
 2313|       |        for (uint32_t i = 0; i < seq_c; i++) {
 2314|       |            zxc_store_le16(p_curr, buf_offsets[i]);
 2315|       |            p_curr += sizeof(uint16_t);
 2316|       |        }
 2317|       |#else
 2318|  82.0k|        ZXC_MEMCPY(p_curr, buf_offsets, seq_c * sizeof(uint16_t));
  ------------------
  |  |  168|  82.0k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2319|  82.0k|        p_curr += seq_c * sizeof(uint16_t);
 2320|  82.0k|#endif
 2321|  82.0k|    }
 2322|   111k|    rem -= sz_off;
 2323|       |
 2324|       |    // The sections behind the literals must total ZXC_BLOCK_LIT_SLACK bytes so
 2325|       |    // the decoder's literal wild-copy can overshoot. Tokens and offsets alone
 2326|       |    // clear it from 16 sequences on, so pad is 0 on any real block. It rides
 2327|       |    // inside the extras section, which the decoder sizes from the payload
 2328|       |    // residue - hence no wire field.
 2329|   111k|    const size_t behind_lit = sz_tok + sz_off + sz_ext;
 2330|   111k|    const size_t pad = (behind_lit < ZXC_BLOCK_LIT_SLACK) ? ZXC_BLOCK_LIT_SLACK - behind_lit : 0;
  ------------------
  |  |  356|   111k|#define ZXC_BLOCK_LIT_SLACK 32
  ------------------
                  const size_t pad = (behind_lit < ZXC_BLOCK_LIT_SLACK) ? ZXC_BLOCK_LIT_SLACK - behind_lit : 0;
  ------------------
  |  |  356|  20.6k|#define ZXC_BLOCK_LIT_SLACK 32
  ------------------
  |  Branch (2330:24): [True: 20.6k, False: 90.7k]
  ------------------
 2331|       |
 2332|   111k|    if (UNLIKELY(rem < sz_ext + pad)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|   111k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 111k]
  |  |  ------------------
  ------------------
 2333|       |
 2334|   111k|    ZXC_MEMCPY(p_curr, buf_extras, extras_sz);
  ------------------
  |  |  168|   111k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2335|   111k|    p_curr += extras_sz;
 2336|       |
 2337|   111k|    ZXC_MEMSET(p_curr, 0, pad);
  ------------------
  |  |  173|   111k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 2338|   111k|    p_curr += pad;
 2339|       |
 2340|   111k|    bh.comp_size = (uint32_t)(p_curr - (dst + ZXC_BLOCK_HEADER_SIZE));
  ------------------
  |  |  439|   111k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 2341|   111k|    const int hw = zxc_write_block_header(dst, dst_cap, &bh);
 2342|   111k|    if (UNLIKELY(hw < 0)) return hw;
  ------------------
  |  |  152|   111k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 111k]
  |  |  ------------------
  ------------------
 2343|       |
 2344|       |    // Checksum will be appended by the wrapper
 2345|   111k|    *out_sz = ZXC_BLOCK_HEADER_SIZE + bh.comp_size;
  ------------------
  |  |  439|   111k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 2346|   111k|    return ZXC_OK;
 2347|   111k|}
zxc_compress.c:zxc_rle_pair_mask:
  144|  18.8M|static ZXC_ALWAYS_INLINE zxc_rle_mask_t zxc_rle_pair_mask(const uint8_t* p) {
  145|  18.8M|    const __m128i v0 = _mm_loadu_si128((const __m128i*)p);
  146|  18.8M|    const __m128i v1 = _mm_loadu_si128((const __m128i*)(p + 1));
  147|  18.8M|    return (uint32_t)_mm_movemask_epi8(_mm_cmpeq_epi8(v0, v1));
  148|  18.8M|}

zxc_decompress_chunk_wrapper_default:
 1700|  68.0k|                                 const uint64_t block_index) {
 1701|  68.0k|    return zxc_decompress_chunk_wrapper_body(ctx, src, src_sz, dst, dst_cap, block_index, 0, 0);
 1702|  68.0k|}
zxc_decompress_chunk_wrapper_dict_default:
 1723|  78.3k|                                      const size_t dst_cap, const uint64_t block_index) {
 1724|  78.3k|    return zxc_decompress_chunk_wrapper_body(ctx, src, src_sz, dst, dst_cap, block_index, 1, 0);
 1725|  78.3k|}
zxc_decompress.c:zxc_decompress_chunk_wrapper_body:
 1633|   146k|    const int safe) {
 1634|   146k|    if (UNLIKELY(src_sz < ZXC_BLOCK_HEADER_SIZE)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  152|   146k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 146k]
  |  |  ------------------
  ------------------
 1635|   146k|    if (UNLIKELY(!zxc_block_header_ok(src))) return ZXC_ERROR_BAD_HEADER;
  ------------------
  |  |  152|   146k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 146k]
  |  |  ------------------
  ------------------
 1636|       |
 1637|   146k|    const uint8_t type = src[0];
 1638|   146k|    const uint32_t comp_sz = zxc_le32(src + 3);
 1639|   146k|    const int has_checksum = ctx->checksum_enabled;
 1640|       |
 1641|       |    // A block never compresses past its own content size
 1642|   146k|    if (UNLIKELY((uint64_t)comp_sz > (uint64_t)ctx->chunk_size)) return ZXC_ERROR_BAD_BLOCK_SIZE;
  ------------------
  |  |  152|   146k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 146k]
  |  |  ------------------
  ------------------
 1643|       |
 1644|       |    // Check bounds: Header + Body + Checksum(if any)
 1645|   146k|    const size_t expected_sz =
 1646|   146k|        (size_t)ZXC_BLOCK_HEADER_SIZE + comp_sz + (has_checksum ? ZXC_BLOCK_CHECKSUM_SIZE : 0);
  ------------------
  |  |  439|   146k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
                      (size_t)ZXC_BLOCK_HEADER_SIZE + comp_sz + (has_checksum ? ZXC_BLOCK_CHECKSUM_SIZE : 0);
  ------------------
  |  |  441|   101k|#define ZXC_BLOCK_CHECKSUM_SIZE 4
  ------------------
  |  Branch (1646:52): [True: 101k, False: 44.7k]
  ------------------
 1647|   146k|    if (UNLIKELY(src_sz < expected_sz)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  152|   146k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 146k]
  |  |  ------------------
  ------------------
 1648|       |
 1649|   146k|    const uint8_t* data = src + ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  439|   146k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 1650|       |
 1651|   146k|    int decoded_sz = ZXC_ERROR_BAD_BLOCK_TYPE;
 1652|       |
 1653|   146k|    switch (type) {
 1654|   108k|        case ZXC_BLOCK_SPL:
  ------------------
  |  Branch (1654:9): [True: 108k, False: 38.3k]
  ------------------
 1655|   108k|            decoded_sz = safe       ? zxc_decode_block_spl_safe(ctx, data, comp_sz, dst, dst_cap)
  ------------------
  |  Branch (1655:26): [True: 0, False: 108k]
  ------------------
 1656|   108k|                         : has_dict ? zxc_decode_block_spl_dict(ctx, data, comp_sz, dst, dst_cap)
  ------------------
  |  Branch (1656:28): [True: 55.5k, False: 52.5k]
  ------------------
 1657|   108k|                                    : zxc_decode_block_spl(ctx, data, comp_sz, dst, dst_cap);
 1658|   108k|            break;
 1659|  32.6k|        case ZXC_BLOCK_PAK:
  ------------------
  |  Branch (1659:9): [True: 32.6k, False: 113k]
  ------------------
 1660|  32.6k|            decoded_sz = safe       ? zxc_decode_block_pak_safe(ctx, data, comp_sz, dst, dst_cap)
  ------------------
  |  Branch (1660:26): [True: 0, False: 32.6k]
  ------------------
 1661|  32.6k|                         : has_dict ? zxc_decode_block_pak_dict(ctx, data, comp_sz, dst, dst_cap)
  ------------------
  |  Branch (1661:28): [True: 20.6k, False: 12.0k]
  ------------------
 1662|  32.6k|                                    : zxc_decode_block_pak(ctx, data, comp_sz, dst, dst_cap);
 1663|  32.6k|            break;
 1664|  5.61k|        case ZXC_BLOCK_RAW:
  ------------------
  |  Branch (1664:9): [True: 5.61k, False: 140k]
  ------------------
 1665|       |            // For RAW blocks, comp_sz == raw_sz (uncompressed data stored as-is)
 1666|  5.61k|            if (UNLIKELY(comp_sz > dst_cap)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  5.61k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 5.61k]
  |  |  ------------------
  ------------------
 1667|  5.61k|            ZXC_MEMCPY(dst, data, comp_sz);
  ------------------
  |  |  168|  5.61k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1668|  5.61k|            decoded_sz = (int)comp_sz;
 1669|  5.61k|            break;
 1670|      0|        case ZXC_BLOCK_EOF:
  ------------------
  |  Branch (1670:9): [True: 0, False: 146k]
  ------------------
 1671|       |            // EOF should be handled by the dispatcher, not here
 1672|      0|            return ZXC_ERROR_CORRUPT_DATA;
 1673|      0|        default:
  ------------------
  |  Branch (1673:9): [True: 0, False: 146k]
  ------------------
 1674|      0|            return ZXC_ERROR_BAD_BLOCK_TYPE;
 1675|   146k|    }
 1676|       |
 1677|       |    // dst_cap includes the wild-copy margin: bound the block itself
 1678|   146k|    if (UNLIKELY(decoded_sz > 0 && (size_t)decoded_sz > ctx->chunk_size))
  ------------------
  |  |  152|   292k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 146k]
  |  |  |  Branch (152:42): [True: 146k, False: 9]
  |  |  |  Branch (152:42): [True: 0, False: 146k]
  |  |  ------------------
  ------------------
 1679|      0|        return ZXC_ERROR_BAD_BLOCK_SIZE;
 1680|       |
 1681|   146k|    if (has_checksum && LIKELY(decoded_sz >= 0)) {
  ------------------
  |  |  146|   101k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 101k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1681:9): [True: 101k, False: 44.7k]
  ------------------
 1682|   101k|        const uint32_t stored = zxc_le32(data + comp_sz);
 1683|   101k|        if (UNLIKELY(stored !=
  ------------------
  |  |  152|   101k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 101k]
  |  |  ------------------
  ------------------
 1684|   101k|                     zxc_checksum(dst, (size_t)decoded_sz, block_index, ZXC_CHECKSUM_RAPIDHASH)))
 1685|      0|            return ZXC_ERROR_BAD_CHECKSUM;
 1686|   101k|    }
 1687|       |
 1688|   146k|    return decoded_sz;
 1689|   146k|}
zxc_decompress.c:zxc_decode_block_spl_impl:
  835|   149k|                                                       const int has_dict, const int tok_entropy) {
  836|   149k|    zxc_gnr_header_t gh;
  837|       |
  838|       |    // Constant 0 when !has_dict, so `d_floor` folds to `dst`.
  839|   149k|    const size_t dict_size = has_dict ? ctx->dict_size : 0;
  ------------------
  |  Branch (839:30): [True: 74.1k, False: 75.0k]
  ------------------
  840|   149k|    uint32_t lit_comp;
  841|   149k|    uint32_t tok_comp;
  842|       |
  843|   149k|    const int hdr_sz = zxc_read_spl_header_and_desc(src, src_size, &gh, &lit_comp, &tok_comp);
  844|   149k|    if (UNLIKELY(hdr_sz < 0)) return ZXC_ERROR_BAD_HEADER;
  ------------------
  |  |  152|   149k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 149k]
  |  |  ------------------
  ------------------
  845|       |
  846|       |    // Only 0 and 1 are defined widths.
  847|   149k|    if (UNLIKELY(gh.enc_off > 1)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|   149k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 149k]
  |  |  ------------------
  ------------------
  848|       |
  849|       |    // Entropy-coded tokens (level 7): tail-call the dedicated instantiation
  850|       |    // before any section work - it restarts from the header, so only the parse
  851|       |    // above is duplicated. Flags are constant per instantiation, so exactly one
  852|       |    // call survives and t_ptr keeps a single provenance below.
  853|   149k|    if (!tok_entropy && UNLIKELY(gh.enc_tok == ZXC_SECTION_ENCODING_HUFFMAN)) {
  ------------------
  |  |  152|   107k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 41.2k, False: 66.5k]
  |  |  ------------------
  ------------------
  |  Branch (853:9): [True: 107k, False: 41.3k]
  ------------------
  854|  41.2k|        if (safe) return zxc_decode_block_spl_entropy_safe(ctx, src, src_size, dst, dst_capacity);
  ------------------
  |  Branch (854:13): [True: 0, False: 41.2k]
  ------------------
  855|  41.2k|        if (has_dict)
  ------------------
  |  Branch (855:13): [True: 18.6k, False: 22.5k]
  ------------------
  856|  18.6k|            return zxc_decode_block_spl_entropy_dict(ctx, src, src_size, dst, dst_capacity);
  857|  22.5k|        return zxc_decode_block_spl_entropy(ctx, src, src_size, dst, dst_capacity);
  858|  41.2k|    }
  859|       |
  860|   107k|    const uint8_t* p_data = src + (size_t)hdr_sz;
  861|   107k|    const uint8_t* p_curr = p_data;
  862|       |
  863|       |    // --- Literal Stream Setup ---
  864|   107k|    const uint8_t* l_ptr;
  865|   107k|    const uint8_t* l_end;
  866|   107k|    uint8_t* rle_buf = NULL;
  867|       |
  868|   107k|    size_t lit_stream_size = lit_comp;
  869|       |    // Decoded size of an encoded literal section (RAW ignores it).
  870|   107k|    const size_t required_size = gh.n_literals;
  871|       |
  872|   107k|    if (gh.enc_lit == ZXC_SECTION_ENCODING_HUFFMAN ||
  ------------------
  |  Branch (872:9): [True: 20.7k, False: 87.1k]
  ------------------
  873|  87.1k|        gh.enc_lit == ZXC_SECTION_ENCODING_HUFFMAN_DICT) {
  ------------------
  |  Branch (873:9): [True: 18.4E, False: 87.1k]
  ------------------
  874|  20.5k|        if (UNLIKELY(lit_stream_size > (size_t)(src + src_size - p_curr)))
  ------------------
  |  |  152|  20.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 20.5k]
  |  |  ------------------
  ------------------
  875|      0|            return ZXC_ERROR_CORRUPT_DATA;
  876|  20.5k|        if (required_size == 0) {
  ------------------
  |  Branch (876:13): [True: 0, False: 20.5k]
  ------------------
  877|      0|            l_ptr = p_curr;
  878|      0|            l_end = p_curr;
  879|  20.5k|        } else {
  880|  20.5k|            if (UNLIKELY(required_size > dst_capacity || required_size > SIZE_MAX - ZXC_PAD_SIZE))
  ------------------
  |  |  152|  41.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 20.5k]
  |  |  |  Branch (152:42): [True: 18.4E, False: 20.5k]
  |  |  |  Branch (152:42): [True: 0, False: 20.5k]
  |  |  ------------------
  ------------------
  881|      0|                return ZXC_ERROR_DST_TOO_SMALL;
  882|  20.5k|            const int rc =
  883|  20.5k|                (gh.enc_lit == ZXC_SECTION_ENCODING_HUFFMAN)
  ------------------
  |  Branch (883:17): [True: 20.5k, False: 18.4E]
  ------------------
  884|  20.5k|                    ? zxc_decode_lit_pivco(ctx, p_curr, lit_stream_size, required_size)
  885|  18.4E|                    : zxc_decode_lit_pivco_dict(ctx, p_curr, lit_stream_size, required_size);
  886|  20.5k|            if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|  20.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 20.5k]
  |  |  ------------------
  ------------------
  887|  20.5k|            l_ptr = ctx->lit_buffer;
  888|  20.5k|            l_end = ctx->lit_buffer + required_size;
  889|  20.5k|        }
  890|  87.3k|    } else if (gh.enc_lit == ZXC_SECTION_ENCODING_RLE) {
  ------------------
  |  Branch (890:16): [True: 48.1k, False: 39.2k]
  ------------------
  891|  48.1k|        if (required_size > 0) {
  ------------------
  |  Branch (891:13): [True: 48.1k, False: 0]
  ------------------
  892|  48.1k|            if (UNLIKELY(required_size > dst_capacity || required_size > SIZE_MAX - ZXC_PAD_SIZE))
  ------------------
  |  |  152|  96.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 48.1k]
  |  |  |  Branch (152:42): [True: 0, False: 48.1k]
  |  |  |  Branch (152:42): [True: 18.4E, False: 48.1k]
  |  |  ------------------
  ------------------
  893|      0|                return ZXC_ERROR_DST_TOO_SMALL;
  894|  48.1k|            const size_t alloc_size = required_size + ZXC_PAD_SIZE;
  ------------------
  |  |  342|  48.1k|#define ZXC_PAD_SIZE 32
  ------------------
  895|       |
  896|       |            // lit_buffer is pre-allocated to chunk_size + ZXC_PAD_SIZE by
  897|       |            // zxc_cctx_init (mode == 0).
  898|  48.1k|            if (UNLIKELY(ctx->lit_buffer_cap < alloc_size)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  48.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 48.1k]
  |  |  ------------------
  ------------------
  899|       |
  900|  48.1k|            rle_buf = ctx->lit_buffer;
  901|  48.1k|            if (UNLIKELY(!rle_buf || lit_stream_size > (size_t)(src + src_size - p_curr)))
  ------------------
  |  |  152|  96.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 48.1k]
  |  |  |  Branch (152:42): [True: 1, False: 48.1k]
  |  |  |  Branch (152:42): [True: 18.4E, False: 48.1k]
  |  |  ------------------
  ------------------
  902|      0|                return ZXC_ERROR_CORRUPT_DATA;
  903|       |
  904|  48.1k|            const uint8_t* r_ptr = p_curr;
  905|  48.1k|            const uint8_t* r_end = r_ptr + lit_stream_size;
  906|  48.1k|            uint8_t* w_ptr = rle_buf;
  907|  48.1k|            const uint8_t* const w_end = rle_buf + required_size;
  908|       |
  909|  3.31M|            while (r_ptr < r_end && w_ptr < w_end) {
  ------------------
  |  Branch (909:20): [True: 3.26M, False: 48.1k]
  |  Branch (909:37): [True: 3.26M, False: 18.4E]
  ------------------
  910|  3.26M|                uint8_t token = *r_ptr++;
  911|  3.26M|                if (LIKELY(!(token & ZXC_LIT_RLE_FLAG))) {
  ------------------
  |  |  146|  3.26M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 1.69M, False: 1.57M]
  |  |  ------------------
  ------------------
  912|       |                    // Raw copy (most common path): 32-byte wild copies (zxc_copy32 width)
  913|       |                    // token is 7-bit (0-127), so len is 1-128 bytes
  914|  1.69M|                    const uint32_t len = (uint32_t)token + 1;
  915|  1.69M|                    if (UNLIKELY(w_ptr + len > w_end || r_ptr + len > r_end))
  ------------------
  |  |  152|  3.39M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 1.69M]
  |  |  |  Branch (152:42): [True: 171, False: 1.69M]
  |  |  |  Branch (152:42): [True: 18.4E, False: 1.69M]
  |  |  ------------------
  ------------------
  916|      0|                        return ZXC_ERROR_CORRUPT_DATA;
  917|       |
  918|       |                    // Destination has ZXC_PAD_SIZE bytes of safe overrun space.
  919|       |                    // Source may not - check before wild copy.
  920|       |                    // Fast path: source holds a full zxc_copy32 read (most common)
  921|  1.69M|                    if (LIKELY(r_ptr + 32 <= r_end)) {
  ------------------
  |  |  146|  1.69M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 1.57M, False: 119k]
  |  |  ------------------
  ------------------
  922|       |                        // Single copy covers len <= 32 (most tokens)
  923|  1.57M|                        zxc_copy32(w_ptr, r_ptr);
  924|       |
  925|  1.57M|                        if (UNLIKELY(len > 32)) {
  ------------------
  |  |  152|  1.57M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 384k, False: 1.19M]
  |  |  ------------------
  ------------------
  926|       |                            // Unroll: max len=128, so max 4 copies total. The last
  927|       |                            // copy is placed to end exactly on len, overlapping the
  928|       |                            // previous one - unconditional stores beat branches here.
  929|   384k|                            if (len <= 64) {
  ------------------
  |  Branch (929:33): [True: 112k, False: 271k]
  ------------------
  930|   112k|                                zxc_copy32(w_ptr + len - 32, r_ptr + len - 32);
  931|   271k|                            } else if (len <= 96) {
  ------------------
  |  Branch (931:40): [True: 42.5k, False: 228k]
  ------------------
  932|  42.5k|                                zxc_copy32(w_ptr + 32, r_ptr + 32);
  933|  42.5k|                                zxc_copy32(w_ptr + len - 32, r_ptr + len - 32);
  934|   228k|                            } else {
  935|   228k|                                zxc_copy32(w_ptr + 32, r_ptr + 32);
  936|   228k|                                zxc_copy32(w_ptr + 64, r_ptr + 64);
  937|   228k|                                zxc_copy32(w_ptr + len - 32, r_ptr + len - 32);
  938|   228k|                            }
  939|   384k|                        }
  940|  1.57M|                    } else {
  941|       |                        // Near end of source: safe copy (rare cold path)
  942|   119k|                        ZXC_MEMCPY(w_ptr, r_ptr, len);
  ------------------
  |  |  168|   119k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  943|   119k|                    }
  944|       |
  945|  1.69M|                    w_ptr += len;
  946|  1.69M|                    r_ptr += len;
  947|  1.69M|                } else {
  948|       |                    // RLE run: fill with single byte
  949|  1.57M|                    const uint32_t len = (token & ZXC_LIT_LEN_MASK) + ZXC_LIT_RLE_RUN_MIN;
  ------------------
  |  |  557|  1.57M|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  ------------------
  |  |  |  |  555|  1.57M|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  ------------------
  ------------------
                                  const uint32_t len = (token & ZXC_LIT_LEN_MASK) + ZXC_LIT_RLE_RUN_MIN;
  ------------------
  |  |  561|  1.57M|#define ZXC_LIT_RLE_RUN_MIN 4U
  ------------------
  950|  1.57M|                    if (UNLIKELY(w_ptr + len > w_end || r_ptr >= r_end))
  ------------------
  |  |  152|  3.14M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 1.57M]
  |  |  |  Branch (152:42): [True: 18.4E, False: 1.57M]
  |  |  |  Branch (152:42): [True: 20, False: 1.57M]
  |  |  ------------------
  ------------------
  951|      0|                        return ZXC_ERROR_CORRUPT_DATA;
  952|  1.57M|                    ZXC_MEMSET(w_ptr, *r_ptr++, len);
  ------------------
  |  |  173|  1.57M|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  953|  1.57M|                    w_ptr += len;
  954|  1.57M|                }
  955|  3.26M|            }
  956|  48.1k|            if (UNLIKELY(w_ptr != w_end || r_ptr != r_end)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  96.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 48.1k]
  |  |  |  Branch (152:42): [True: 18.4E, False: 48.2k]
  |  |  |  Branch (152:42): [True: 18.4E, False: 48.2k]
  |  |  ------------------
  ------------------
  957|  48.1k|            l_ptr = rle_buf;
  958|  48.1k|            l_end = rle_buf + required_size;
  959|  48.1k|        } else {
  960|      0|            if (UNLIKELY(lit_stream_size != 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  961|      0|            l_ptr = p_curr;
  962|      0|            l_end = p_curr;
  963|      0|        }
  964|  48.1k|    } else if (gh.enc_lit == ZXC_SECTION_ENCODING_RAW) {
  ------------------
  |  Branch (964:16): [True: 39.0k, False: 151]
  ------------------
  965|  39.0k|        if (UNLIKELY(lit_stream_size > (size_t)(src + src_size - p_curr)))
  ------------------
  |  |  152|  39.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 39.0k]
  |  |  ------------------
  ------------------
  966|      0|            return ZXC_ERROR_CORRUPT_DATA;
  967|  39.0k|        l_ptr = p_curr;
  968|  39.0k|        l_end = p_curr + lit_stream_size;
  969|  39.0k|    } else {
  970|    151|        return ZXC_ERROR_CORRUPT_DATA;
  971|    151|    }
  972|       |
  973|   107k|    p_curr += lit_stream_size;
  974|       |
  975|       |    // --- Stream Pointers & Validation ---
  976|       |    // Only the literal and token sizes are on the wire; offsets follow from the
  977|       |    // sequence count and width, and extras take the payload residue.
  978|   107k|    const size_t sz_tokens = tok_comp;
  979|   107k|    const uint64_t sz_offsets = SPL_OFF8 ? (uint64_t)gh.n_sequences : (uint64_t)gh.n_sequences * 2;
  ------------------
  |  |  577|   107k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  ------------------
  |  |  |  Branch (577:18): [True: 26.0k, False: 81.6k]
  |  |  ------------------
  ------------------
  980|       |
  981|   107k|    const size_t payload_avail = (size_t)(src + src_size - p_data);
  982|   107k|    const uint64_t consumed = (uint64_t)lit_stream_size + (uint64_t)sz_tokens + sz_offsets;
  983|   107k|    if (UNLIKELY(consumed > (uint64_t)payload_avail)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|   107k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 107k]
  |  |  ------------------
  ------------------
  984|   107k|    const size_t sz_extras = payload_avail - (size_t)consumed; /* slack padding included */
  985|       |
  986|       |    // RAW literals point into the caller's buffer and the wild copy overshoots,
  987|       |    // so it needs ZXC_BLOCK_LIT_SLACK readable bytes behind it. v7 staged short
  988|       |    // streams into a padded scratch here; v8 rejects instead. No underflow:
  989|       |    // lit_stream_size <= consumed <= payload_avail.
  990|   107k|    if (UNLIKELY(payload_avail - lit_stream_size < ZXC_BLOCK_LIT_SLACK))
  ------------------
  |  |  152|   107k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 107k]
  |  |  ------------------
  ------------------
  991|      0|        return ZXC_ERROR_CORRUPT_DATA;
  992|       |
  993|       |    // Offsets/extras follow the on-disk token SECTION; sz_tokens is its size
  994|       |    // (== n_sequences when RAW, the Huffman payload size when enc_tok set).
  995|   107k|    const uint8_t* o_ptr = p_curr + sz_tokens;
  996|   107k|    const uint8_t* e_ptr = o_ptr + (size_t)sz_offsets;
  997|   107k|    const uint8_t* const e_end = e_ptr + sz_extras;
  998|       |
  999|   107k|    const uint8_t* RESTRICT t_ptr;
 1000|   107k|    if (!tok_entropy) {
  ------------------
  |  Branch (1000:9): [True: 66.7k, False: 41.0k]
  ------------------
 1001|       |        // enc_tok == 2 was re-routed right after the header parse; any other
 1002|       |        // value would have mis-sized the section descriptors above.
 1003|  66.7k|        if (UNLIKELY(gh.enc_tok != 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  66.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 66.7k]
  |  |  ------------------
  ------------------
 1004|  66.7k|        t_ptr = p_curr;
 1005|  66.7k|    } else {
 1006|  41.0k|        if (UNLIKELY(gh.enc_tok != ZXC_SECTION_ENCODING_HUFFMAN)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  41.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 41.0k]
  |  |  ------------------
  ------------------
 1007|  41.0k|        const int rc = zxc_decode_tok_pivco(ctx, p_curr, sz_tokens, gh.n_sequences);
 1008|  41.0k|        if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|  41.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 41.0k]
  |  |  ------------------
  ------------------
 1009|  41.0k|        t_ptr = ctx->tok_buffer;
 1010|  41.0k|    }
 1011|       |
 1012|   107k|    uint8_t* d_ptr = dst;
 1013|   107k|    const uint8_t* const d_end = dst + dst_capacity;
 1014|       |    // Lowest address a match may reach: the dictionary prefix if any, else dst.
 1015|   107k|    const uint8_t* const d_floor = dst - dict_size;
 1016|       |    // 4x loop margin: four sequences without a varint, the wild-copy overshoot, 4 of safety.
 1017|   107k|    const size_t d_margin_4x = 4 * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE + 4;
  ------------------
  |  |  674|   107k|#define ZXC_SPL_MAX_INLINE_OUT_PER_SEQ ((ZXC_TOKEN_LL_MASK - 1U) + ZXC_SPL_MAX_INLINE_ML) /* 33 */
  |  |  ------------------
  |  |  |  |  522|   107k|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  518|   107k|#define ZXC_TOKEN_LIT_BITS 4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_SPL_MAX_INLINE_OUT_PER_SEQ ((ZXC_TOKEN_LL_MASK - 1U) + ZXC_SPL_MAX_INLINE_ML) /* 33 */
  |  |  ------------------
  |  |  |  |  683|   107k|#define ZXC_SPL_MAX_INLINE_ML (ZXC_SPL_INLINE_ML_CODE + ZXC_LZ_MIN_MATCH_LEN) /* 19 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  677|   107k|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   107k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  520|   107k|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define ZXC_SPL_MAX_INLINE_ML (ZXC_SPL_INLINE_ML_CODE + ZXC_LZ_MIN_MATCH_LEN) /* 19 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   107k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  const size_t d_margin_4x = 4 * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE + 4;
  ------------------
  |  |  342|   107k|#define ZXC_PAD_SIZE 32
  ------------------
 1018|  18.4E|    const uint8_t* const d_end_safe = (dst_capacity > d_margin_4x) ? d_end - d_margin_4x : dst;
  ------------------
  |  Branch (1018:39): [True: 107k, False: 18.4E]
  ------------------
 1019|       |
 1020|       |    // Literal margin for the 4x loops: without a varint, ll <= 14 per sequence,
 1021|       |    // so 4 * 14 = 56. Past that margin only the cold varint path checks l_ptr.
 1022|   107k|    const size_t spl_sz_lit = (size_t)(l_end - l_ptr);
 1023|   107k|    const size_t spl_margin_4x = 4 * (ZXC_TOKEN_LL_MASK - 1);  // 56
  ------------------
  |  |  522|   107k|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  ------------------
  |  |  |  |  518|   107k|#define ZXC_TOKEN_LIT_BITS 4
  |  |  ------------------
  ------------------
 1024|   107k|    const size_t spl_margin_1x = ZXC_TOKEN_LL_MASK - 1;        // 14
  ------------------
  |  |  522|   107k|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  ------------------
  |  |  |  |  518|   107k|#define ZXC_TOKEN_LIT_BITS 4
  |  |  ------------------
  ------------------
 1025|   107k|    const uint8_t* const l_end_safe_4x =
 1026|   107k|        (spl_sz_lit > spl_margin_4x) ? l_end - spl_margin_4x : l_ptr;
  ------------------
  |  Branch (1026:9): [True: 87.3k, False: 20.4k]
  ------------------
 1027|   107k|    const uint8_t* const l_end_safe_1x =
 1028|   107k|        (spl_sz_lit > spl_margin_1x) ? l_end - spl_margin_1x : l_ptr;
  ------------------
  |  Branch (1028:9): [True: 91.5k, False: 16.2k]
  ------------------
 1029|       |
 1030|   107k|    uint32_t n_seq = gh.n_sequences;
 1031|       |
 1032|       |    // Offsets only need checking until the output is wider than the widest offset
 1033|       |    // the format can encode (256 for 1-byte offsets, 65536 for 2-byte); past that
 1034|       |    // none can reach below d_floor. A dictionary counts as already written, so a
 1035|       |    // large one puts d_bounds at dst and skips the SAFE loop.
 1036|   107k|    const size_t off_span = SPL_OFF8 ? (1U << 8) : (1U << 16);
  ------------------
  |  |  577|   107k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  ------------------
  |  |  |  Branch (577:18): [True: 26.0k, False: 81.7k]
  |  |  ------------------
  ------------------
 1037|   107k|    const size_t span = (dict_size >= off_span) ? 0 : off_span - dict_size;
  ------------------
  |  Branch (1037:25): [True: 8.11k, False: 99.6k]
  ------------------
 1038|   107k|    const uint8_t* const d_bounds = (span >= dst_capacity) ? d_end : dst + span;
  ------------------
  |  Branch (1038:37): [True: 63.0k, False: 44.7k]
  ------------------
 1039|       |
 1040|       |    // --- SAFE Loop: offset validation until d_bounds (4x unroll) ---
 1041|   107k|    if (safe) {
  ------------------
  |  Branch (1041:9): [True: 0, False: 107k]
  ------------------
 1042|       |        // SAFE variant: save per-batch state so overflow can rollback.
 1043|      0|        while (n_seq >= 4 && d_ptr < d_end_safe && l_ptr < l_end_safe_4x && d_ptr < d_bounds) {
  ------------------
  |  Branch (1043:16): [True: 0, False: 0]
  |  Branch (1043:30): [True: 0, False: 0]
  |  Branch (1043:52): [True: 0, False: 0]
  |  Branch (1043:77): [True: 0, False: 0]
  ------------------
 1044|      0|            const uint8_t* const t_save = t_ptr;
 1045|      0|            const uint8_t* const o_save = o_ptr;
 1046|      0|            const uint8_t* const e_save = e_ptr;
 1047|      0|            uint8_t* const d_save = d_ptr;
 1048|      0|            const uint8_t* const l_save = l_ptr;
 1049|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  ------------------
  |  |  639|      0|    do {                                                                                           \
  |  |  640|      0|        uint32_t tokens = zxc_le32(t_ptr);                                                         \
  |  |  641|      0|        t_ptr += sizeof(uint32_t);                                                                 \
  |  |  642|      0|        uint64_t offs;                                                                             \
  |  |  643|      0|        if (SPL_OFF8) {                                                                            \
  |  |  ------------------
  |  |  |  |  577|      0|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (577:18): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  644|      0|            uint64_t x = zxc_le32(o_ptr);                                                          \
  |  |  645|      0|            o_ptr += sizeof(uint32_t);                                                             \
  |  |  646|      0|            x = (x | (x << 16)) & 0x0000FFFF0000FFFFULL;                                           \
  |  |  647|      0|            offs = (x | (x << 8)) & 0x00FF00FF00FF00FFULL;                                         \
  |  |  648|      0|        } else {                                                                                   \
  |  |  649|      0|            offs = zxc_le64(o_ptr);                                                                \
  |  |  650|      0|            o_ptr += sizeof(uint64_t);                                                             \
  |  |  651|      0|        }                                                                                          \
  |  |  652|      0|        DECODE_SPL_SEQ((tokens & 0x0F0) >> 4, (tokens & 0x00F),                                    \
  |  |  ------------------
  |  |  |  |  593|      0|    do {                                                                                        \
  |  |  |  |  594|      0|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|      0|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|      0|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|      0|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|      0|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|      0|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|      0|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|      0|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|      0|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|      0|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|      0|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|      0|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|      0|                ON_FAIL;                                                                        \
  |  |  |  |  607|      0|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|      0|        } else {                                                                                \
  |  |  |  |  609|      0|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|      0|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|      0|        }                                                                                       \
  |  |  |  |  612|      0|        l_ptr += ll;                                                                            \
  |  |  |  |  613|      0|        d_ptr += ll;                                                                            \
  |  |  |  |  614|      0|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|      0|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|      0|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|      0|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|      0|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|      0|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|      0|                ON_FAIL;                                                                        \
  |  |  |  |  621|      0|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|      0|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1049|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|      0|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|      0|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|      0|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|      0|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|      0|        } else {                                                                                \
  |  |  |  |  624|      0|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|      0|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|      0|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1049|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|      0|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|      0|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|      0|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|      0|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|      0|        }                                                                                       \
  |  |  |  |  628|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  653|      0|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs & 0xFFFF),                             \
  |  |  654|      0|                       ((tokens >> 12) & 0xF) + ((tokens >> 20) & 0xF) + (tokens >> 28), 3U,       \
  |  |  655|      0|                       DECODE, ON_FAIL);                                                           \
  |  |  656|      0|        DECODE_SPL_SEQ((tokens & 0x0F000) >> 12, (tokens & 0x00F00) >> 8,                          \
  |  |  ------------------
  |  |  |  |  593|      0|    do {                                                                                        \
  |  |  |  |  594|      0|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|      0|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|      0|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|      0|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|      0|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|      0|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|      0|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|      0|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|      0|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|      0|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|      0|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|      0|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|      0|                ON_FAIL;                                                                        \
  |  |  |  |  607|      0|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|      0|        } else {                                                                                \
  |  |  |  |  609|      0|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|      0|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|      0|        }                                                                                       \
  |  |  |  |  612|      0|        l_ptr += ll;                                                                            \
  |  |  |  |  613|      0|        d_ptr += ll;                                                                            \
  |  |  |  |  614|      0|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|      0|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|      0|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|      0|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|      0|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|      0|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|      0|                ON_FAIL;                                                                        \
  |  |  |  |  621|      0|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|      0|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1049|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|      0|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|      0|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|      0|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|      0|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|      0|        } else {                                                                                \
  |  |  |  |  624|      0|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|      0|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|      0|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1049|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|      0|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|      0|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|      0|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|      0|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|      0|        }                                                                                       \
  |  |  |  |  628|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  657|      0|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 16) & 0xFFFF),                     \
  |  |  658|      0|                       ((tokens >> 20) & 0xF) + (tokens >> 28), 2U, DECODE, ON_FAIL);              \
  |  |  659|      0|        DECODE_SPL_SEQ((tokens & 0x0F00000) >> 20, (tokens & 0x00F0000) >> 16,                     \
  |  |  ------------------
  |  |  |  |  593|      0|    do {                                                                                        \
  |  |  |  |  594|      0|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|      0|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|      0|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|      0|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|      0|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|      0|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|      0|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|      0|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|      0|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|      0|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|      0|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|      0|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|      0|                ON_FAIL;                                                                        \
  |  |  |  |  607|      0|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|      0|        } else {                                                                                \
  |  |  |  |  609|      0|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|      0|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|      0|        }                                                                                       \
  |  |  |  |  612|      0|        l_ptr += ll;                                                                            \
  |  |  |  |  613|      0|        d_ptr += ll;                                                                            \
  |  |  |  |  614|      0|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|      0|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|      0|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|      0|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|      0|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|      0|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|      0|                ON_FAIL;                                                                        \
  |  |  |  |  621|      0|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|      0|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1049|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|      0|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|      0|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|      0|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|      0|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|      0|        } else {                                                                                \
  |  |  |  |  624|      0|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|      0|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|      0|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1049|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|      0|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|      0|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|      0|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|      0|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|      0|        }                                                                                       \
  |  |  |  |  628|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  660|      0|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 32) & 0xFFFF), (tokens >> 28), 1U, \
  |  |  661|      0|                       DECODE, ON_FAIL);                                                           \
  |  |  662|      0|        DECODE_SPL_SEQ((tokens >> 28), (tokens >> 24) & 0x0F,                                      \
  |  |  ------------------
  |  |  |  |  593|      0|    do {                                                                                        \
  |  |  |  |  594|      0|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|      0|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|      0|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|      0|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|      0|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|      0|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|      0|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|      0|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|      0|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|      0|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|      0|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|      0|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|      0|                ON_FAIL;                                                                        \
  |  |  |  |  607|      0|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|      0|        } else {                                                                                \
  |  |  |  |  609|      0|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|      0|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|      0|        }                                                                                       \
  |  |  |  |  612|      0|        l_ptr += ll;                                                                            \
  |  |  |  |  613|      0|        d_ptr += ll;                                                                            \
  |  |  |  |  614|      0|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|      0|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|      0|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|      0|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|      0|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|      0|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|      0|                ON_FAIL;                                                                        \
  |  |  |  |  621|      0|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|      0|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1049|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|      0|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|      0|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|      0|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|      0|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|      0|        } else {                                                                                \
  |  |  |  |  624|      0|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|      0|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|      0|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1049|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|      0|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|      0|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|      0|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|      0|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|      0|        }                                                                                       \
  |  |  |  |  628|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  663|      0|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs >> 48), 0, 0U, DECODE, ON_FAIL);       \
  |  |  664|      0|        n_seq -= 4;                                                                                \
  |  |  665|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (665:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1050|      0|            continue;
 1051|       |
 1052|      0|        rollback_safe_4x:
 1053|      0|            t_ptr = t_save;
 1054|      0|            o_ptr = o_save;
 1055|      0|            e_ptr = e_save;
 1056|      0|            d_ptr = d_save;
 1057|      0|            l_ptr = l_save;
 1058|      0|            break;
 1059|      0|        }
 1060|   107k|    } else {
 1061|  3.21M|        while (n_seq >= 4 && d_ptr < d_end_safe && l_ptr < l_end_safe_4x && d_ptr < d_bounds) {
  ------------------
  |  Branch (1061:16): [True: 3.18M, False: 31.5k]
  |  Branch (1061:30): [True: 3.18M, False: 18.4E]
  |  Branch (1061:52): [True: 3.13M, False: 55.0k]
  |  Branch (1061:77): [True: 3.10M, False: 21.7k]
  ------------------
 1062|  3.10M|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  ------------------
  |  |  639|  3.10M|    do {                                                                                           \
  |  |  640|  3.10M|        uint32_t tokens = zxc_le32(t_ptr);                                                         \
  |  |  641|  3.10M|        t_ptr += sizeof(uint32_t);                                                                 \
  |  |  642|  3.10M|        uint64_t offs;                                                                             \
  |  |  643|  3.10M|        if (SPL_OFF8) {                                                                            \
  |  |  ------------------
  |  |  |  |  577|  3.10M|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (577:18): [True: 47.9k, False: 3.06M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  644|  47.9k|            uint64_t x = zxc_le32(o_ptr);                                                          \
  |  |  645|  47.9k|            o_ptr += sizeof(uint32_t);                                                             \
  |  |  646|  47.9k|            x = (x | (x << 16)) & 0x0000FFFF0000FFFFULL;                                           \
  |  |  647|  47.9k|            offs = (x | (x << 8)) & 0x00FF00FF00FF00FFULL;                                         \
  |  |  648|  3.06M|        } else {                                                                                   \
  |  |  649|  3.06M|            offs = zxc_le64(o_ptr);                                                                \
  |  |  650|  3.06M|            o_ptr += sizeof(uint64_t);                                                             \
  |  |  651|  3.06M|        }                                                                                          \
  |  |  652|  3.10M|        DECODE_SPL_SEQ((tokens & 0x0F0) >> 4, (tokens & 0x00F),                                    \
  |  |  ------------------
  |  |  |  |  593|  3.10M|    do {                                                                                        \
  |  |  |  |  594|  3.10M|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|  3.10M|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|  3.10M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  3.10M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 229k, False: 2.88M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|   229k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|   229k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|   229k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|   229k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|   229k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|   229k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   458k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 229k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 52, False: 229k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 18.4E, False: 229k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|   229k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|   229k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|   229k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|   229k|                ON_FAIL;                                                                        \
  |  |  |  |  607|   229k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|  2.88M|        } else {                                                                                \
  |  |  |  |  609|  2.88M|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|  2.88M|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|  2.88M|        }                                                                                       \
  |  |  |  |  612|  3.10M|        l_ptr += ll;                                                                            \
  |  |  |  |  613|  3.10M|        d_ptr += ll;                                                                            \
  |  |  |  |  614|  3.10M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  3.10M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 188k, False: 2.92M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|   188k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|   188k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|   188k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   188k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 188k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|   188k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|   188k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|   188k|                ON_FAIL;                                                                        \
  |  |  |  |  621|   188k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   188k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|   188k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1062|   188k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   188k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   188k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   188k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 188k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   188k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   188k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   188k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 188k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|  2.92M|        } else {                                                                                \
  |  |  |  |  624|  2.92M|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|  2.92M|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  2.92M|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|  2.92M|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1062|  2.92M|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|  2.92M|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|  2.92M|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|  2.92M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 2.92M]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|  2.92M|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|  2.92M|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|  2.92M|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 2.92M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|  2.92M|        }                                                                                       \
  |  |  |  |  628|  3.10M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 3.10M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  653|  3.10M|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs & 0xFFFF),                             \
  |  |  654|  3.10M|                       ((tokens >> 12) & 0xF) + ((tokens >> 20) & 0xF) + (tokens >> 28), 3U,       \
  |  |  655|  3.10M|                       DECODE, ON_FAIL);                                                           \
  |  |  656|  3.10M|        DECODE_SPL_SEQ((tokens & 0x0F000) >> 12, (tokens & 0x00F00) >> 8,                          \
  |  |  ------------------
  |  |  |  |  593|  3.10M|    do {                                                                                        \
  |  |  |  |  594|  3.10M|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|  3.10M|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|  3.10M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  3.10M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 220k, False: 2.88M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|   220k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|   220k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|   220k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|   220k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|   220k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|   220k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   440k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 220k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 74, False: 220k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 18.4E, False: 220k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|   220k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|   220k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|   220k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|   220k|                ON_FAIL;                                                                        \
  |  |  |  |  607|   220k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|  2.88M|        } else {                                                                                \
  |  |  |  |  609|  2.88M|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|  2.88M|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|  2.88M|        }                                                                                       \
  |  |  |  |  612|  3.10M|        l_ptr += ll;                                                                            \
  |  |  |  |  613|  3.10M|        d_ptr += ll;                                                                            \
  |  |  |  |  614|  3.10M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  3.10M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 183k, False: 2.92M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|   183k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|   183k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|   183k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   183k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 183k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|   183k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|   183k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|   183k|                ON_FAIL;                                                                        \
  |  |  |  |  621|   183k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   183k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|   183k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1062|   183k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   183k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   183k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   183k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 183k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   183k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   183k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   183k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 183k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|  2.92M|        } else {                                                                                \
  |  |  |  |  624|  2.92M|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|  2.92M|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  2.92M|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|  2.92M|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1062|  2.92M|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|  2.92M|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|  2.92M|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|  2.92M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 2.92M]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|  2.92M|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|  2.92M|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|  2.92M|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 2.92M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|  2.92M|        }                                                                                       \
  |  |  |  |  628|  3.10M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 3.10M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  657|  3.10M|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 16) & 0xFFFF),                     \
  |  |  658|  3.10M|                       ((tokens >> 20) & 0xF) + (tokens >> 28), 2U, DECODE, ON_FAIL);              \
  |  |  659|  3.10M|        DECODE_SPL_SEQ((tokens & 0x0F00000) >> 20, (tokens & 0x00F0000) >> 16,                     \
  |  |  ------------------
  |  |  |  |  593|  3.10M|    do {                                                                                        \
  |  |  |  |  594|  3.10M|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|  3.10M|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|  3.10M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  3.10M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 215k, False: 2.89M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|   215k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|   215k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|   215k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|   215k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|   215k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|   215k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   431k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 215k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 56, False: 215k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 18.4E, False: 215k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|   215k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|   215k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|   215k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|   215k|                ON_FAIL;                                                                        \
  |  |  |  |  607|   215k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|  2.89M|        } else {                                                                                \
  |  |  |  |  609|  2.89M|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|  2.89M|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|  2.89M|        }                                                                                       \
  |  |  |  |  612|  3.10M|        l_ptr += ll;                                                                            \
  |  |  |  |  613|  3.10M|        d_ptr += ll;                                                                            \
  |  |  |  |  614|  3.10M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  3.10M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 179k, False: 2.92M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|   179k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|   179k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|   179k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   179k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 179k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|   179k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|   179k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|   179k|                ON_FAIL;                                                                        \
  |  |  |  |  621|   179k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   179k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|   179k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1062|   179k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   179k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   179k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   179k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 179k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   179k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   179k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   179k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 179k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|  2.92M|        } else {                                                                                \
  |  |  |  |  624|  2.92M|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|  2.92M|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  2.92M|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|  2.92M|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1062|  2.92M|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|  2.92M|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|  2.92M|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|  2.92M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 2.92M]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|  2.92M|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|  2.92M|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|  2.92M|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 2.92M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|  2.92M|        }                                                                                       \
  |  |  |  |  628|  3.10M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 3.10M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  660|  3.10M|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 32) & 0xFFFF), (tokens >> 28), 1U, \
  |  |  661|  3.10M|                       DECODE, ON_FAIL);                                                           \
  |  |  662|  3.10M|        DECODE_SPL_SEQ((tokens >> 28), (tokens >> 24) & 0x0F,                                      \
  |  |  ------------------
  |  |  |  |  593|  3.10M|    do {                                                                                        \
  |  |  |  |  594|  3.10M|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|  3.10M|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|  3.10M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  3.10M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 213k, False: 2.89M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|   213k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|   213k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|   213k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|   213k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|   213k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|   213k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   427k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 213k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 79, False: 213k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 18.4E, False: 213k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|   213k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|   213k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|   213k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|   213k|                ON_FAIL;                                                                        \
  |  |  |  |  607|   213k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|  2.89M|        } else {                                                                                \
  |  |  |  |  609|  2.89M|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|  2.89M|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|  2.89M|        }                                                                                       \
  |  |  |  |  612|  3.10M|        l_ptr += ll;                                                                            \
  |  |  |  |  613|  3.10M|        d_ptr += ll;                                                                            \
  |  |  |  |  614|  3.10M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  3.10M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 181k, False: 2.92M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|   181k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|   181k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|   181k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   181k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 181k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|   181k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|   181k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|   181k|                ON_FAIL;                                                                        \
  |  |  |  |  621|   181k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   181k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|   181k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1062|   181k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   181k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   181k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   181k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 181k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   181k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   181k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   181k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 181k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|  2.92M|        } else {                                                                                \
  |  |  |  |  624|  2.92M|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|  2.92M|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  2.92M|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|  2.92M|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1062|  2.92M|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|  2.92M|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|  2.92M|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|  2.92M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 2.92M]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|  2.92M|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|  2.92M|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|  2.92M|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 2.92M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|  2.92M|        }                                                                                       \
  |  |  |  |  628|  3.10M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 3.10M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  663|  3.10M|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs >> 48), 0, 0U, DECODE, ON_FAIL);       \
  |  |  664|  3.10M|        n_seq -= 4;                                                                                \
  |  |  665|  3.10M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (665:14): [Folded, False: 3.10M]
  |  |  ------------------
  ------------------
 1063|  3.10M|        }
 1064|   107k|    }
 1065|       |
 1066|       |    // --- FAST Loop: After threshold, no offset validation needed (4x unroll) ---
 1067|   107k|    if (safe) {
  ------------------
  |  Branch (1067:9): [True: 0, False: 107k]
  ------------------
 1068|      0|        while (n_seq >= 4 && d_ptr < d_end_safe && l_ptr < l_end_safe_4x) {
  ------------------
  |  Branch (1068:16): [True: 0, False: 0]
  |  Branch (1068:30): [True: 0, False: 0]
  |  Branch (1068:52): [True: 0, False: 0]
  ------------------
 1069|      0|            const uint8_t* const t_save = t_ptr;
 1070|      0|            const uint8_t* const o_save = o_ptr;
 1071|      0|            const uint8_t* const e_save = e_ptr;
 1072|      0|            uint8_t* const d_save = d_ptr;
 1073|      0|            const uint8_t* const l_save = l_ptr;
 1074|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  ------------------
  |  |  639|      0|    do {                                                                                           \
  |  |  640|      0|        uint32_t tokens = zxc_le32(t_ptr);                                                         \
  |  |  641|      0|        t_ptr += sizeof(uint32_t);                                                                 \
  |  |  642|      0|        uint64_t offs;                                                                             \
  |  |  643|      0|        if (SPL_OFF8) {                                                                            \
  |  |  ------------------
  |  |  |  |  577|      0|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (577:18): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  644|      0|            uint64_t x = zxc_le32(o_ptr);                                                          \
  |  |  645|      0|            o_ptr += sizeof(uint32_t);                                                             \
  |  |  646|      0|            x = (x | (x << 16)) & 0x0000FFFF0000FFFFULL;                                           \
  |  |  647|      0|            offs = (x | (x << 8)) & 0x00FF00FF00FF00FFULL;                                         \
  |  |  648|      0|        } else {                                                                                   \
  |  |  649|      0|            offs = zxc_le64(o_ptr);                                                                \
  |  |  650|      0|            o_ptr += sizeof(uint64_t);                                                             \
  |  |  651|      0|        }                                                                                          \
  |  |  652|      0|        DECODE_SPL_SEQ((tokens & 0x0F0) >> 4, (tokens & 0x00F),                                    \
  |  |  ------------------
  |  |  |  |  593|      0|    do {                                                                                        \
  |  |  |  |  594|      0|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|      0|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|      0|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|      0|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|      0|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|      0|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|      0|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|      0|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|      0|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|      0|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|      0|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|      0|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|      0|                ON_FAIL;                                                                        \
  |  |  |  |  607|      0|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|      0|        } else {                                                                                \
  |  |  |  |  609|      0|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|      0|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|      0|        }                                                                                       \
  |  |  |  |  612|      0|        l_ptr += ll;                                                                            \
  |  |  |  |  613|      0|        d_ptr += ll;                                                                            \
  |  |  |  |  614|      0|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|      0|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|      0|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|      0|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|      0|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|      0|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|      0|                ON_FAIL;                                                                        \
  |  |  |  |  621|      0|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|      0|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1074|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|      0|    do {                                 \
  |  |  |  |  |  |  |  |  562|      0|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|      0|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|      0|        } else {                                                                                \
  |  |  |  |  624|      0|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|      0|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|      0|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1074|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|      0|    do {                                 \
  |  |  |  |  |  |  |  |  562|      0|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|      0|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|      0|        }                                                                                       \
  |  |  |  |  628|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  653|      0|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs & 0xFFFF),                             \
  |  |  654|      0|                       ((tokens >> 12) & 0xF) + ((tokens >> 20) & 0xF) + (tokens >> 28), 3U,       \
  |  |  655|      0|                       DECODE, ON_FAIL);                                                           \
  |  |  656|      0|        DECODE_SPL_SEQ((tokens & 0x0F000) >> 12, (tokens & 0x00F00) >> 8,                          \
  |  |  ------------------
  |  |  |  |  593|      0|    do {                                                                                        \
  |  |  |  |  594|      0|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|      0|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|      0|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|      0|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|      0|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|      0|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|      0|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|      0|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|      0|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|      0|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|      0|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|      0|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|      0|                ON_FAIL;                                                                        \
  |  |  |  |  607|      0|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|      0|        } else {                                                                                \
  |  |  |  |  609|      0|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|      0|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|      0|        }                                                                                       \
  |  |  |  |  612|      0|        l_ptr += ll;                                                                            \
  |  |  |  |  613|      0|        d_ptr += ll;                                                                            \
  |  |  |  |  614|      0|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|      0|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|      0|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|      0|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|      0|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|      0|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|      0|                ON_FAIL;                                                                        \
  |  |  |  |  621|      0|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|      0|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1074|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|      0|    do {                                 \
  |  |  |  |  |  |  |  |  562|      0|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|      0|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|      0|        } else {                                                                                \
  |  |  |  |  624|      0|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|      0|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|      0|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1074|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|      0|    do {                                 \
  |  |  |  |  |  |  |  |  562|      0|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|      0|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|      0|        }                                                                                       \
  |  |  |  |  628|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  657|      0|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 16) & 0xFFFF),                     \
  |  |  658|      0|                       ((tokens >> 20) & 0xF) + (tokens >> 28), 2U, DECODE, ON_FAIL);              \
  |  |  659|      0|        DECODE_SPL_SEQ((tokens & 0x0F00000) >> 20, (tokens & 0x00F0000) >> 16,                     \
  |  |  ------------------
  |  |  |  |  593|      0|    do {                                                                                        \
  |  |  |  |  594|      0|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|      0|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|      0|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|      0|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|      0|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|      0|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|      0|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|      0|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|      0|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|      0|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|      0|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|      0|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|      0|                ON_FAIL;                                                                        \
  |  |  |  |  607|      0|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|      0|        } else {                                                                                \
  |  |  |  |  609|      0|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|      0|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|      0|        }                                                                                       \
  |  |  |  |  612|      0|        l_ptr += ll;                                                                            \
  |  |  |  |  613|      0|        d_ptr += ll;                                                                            \
  |  |  |  |  614|      0|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|      0|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|      0|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|      0|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|      0|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|      0|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|      0|                ON_FAIL;                                                                        \
  |  |  |  |  621|      0|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|      0|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1074|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|      0|    do {                                 \
  |  |  |  |  |  |  |  |  562|      0|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|      0|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|      0|        } else {                                                                                \
  |  |  |  |  624|      0|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|      0|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|      0|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1074|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|      0|    do {                                 \
  |  |  |  |  |  |  |  |  562|      0|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|      0|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|      0|        }                                                                                       \
  |  |  |  |  628|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  660|      0|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 32) & 0xFFFF), (tokens >> 28), 1U, \
  |  |  661|      0|                       DECODE, ON_FAIL);                                                           \
  |  |  662|      0|        DECODE_SPL_SEQ((tokens >> 28), (tokens >> 24) & 0x0F,                                      \
  |  |  ------------------
  |  |  |  |  593|      0|    do {                                                                                        \
  |  |  |  |  594|      0|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|      0|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|      0|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|      0|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|      0|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|      0|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|      0|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|      0|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|      0|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|      0|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|      0|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|      0|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|      0|                ON_FAIL;                                                                        \
  |  |  |  |  607|      0|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|      0|        } else {                                                                                \
  |  |  |  |  609|      0|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|      0|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|      0|        }                                                                                       \
  |  |  |  |  612|      0|        l_ptr += ll;                                                                            \
  |  |  |  |  613|      0|        d_ptr += ll;                                                                            \
  |  |  |  |  614|      0|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|      0|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|      0|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|      0|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|      0|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|      0|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|      0|                ON_FAIL;                                                                        \
  |  |  |  |  621|      0|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|      0|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1074|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|      0|    do {                                 \
  |  |  |  |  |  |  |  |  562|      0|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|      0|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|      0|        } else {                                                                                \
  |  |  |  |  624|      0|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|      0|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|      0|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1074|      0|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|      0|    do {                                 \
  |  |  |  |  |  |  |  |  562|      0|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|      0|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|      0|        }                                                                                       \
  |  |  |  |  628|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  663|      0|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs >> 48), 0, 0U, DECODE, ON_FAIL);       \
  |  |  664|      0|        n_seq -= 4;                                                                                \
  |  |  665|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (665:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1075|      0|            continue;
 1076|       |
 1077|      0|        rollback_fast_4x:
 1078|      0|            t_ptr = t_save;
 1079|      0|            o_ptr = o_save;
 1080|      0|            e_ptr = e_save;
 1081|      0|            d_ptr = d_save;
 1082|      0|            l_ptr = l_save;
 1083|      0|            break;
 1084|      0|        }
 1085|   107k|    } else {
 1086|  1.11M|        while (n_seq >= 4 && d_ptr < d_end_safe && l_ptr < l_end_safe_4x) {
  ------------------
  |  Branch (1086:16): [True: 1.08M, False: 36.0k]
  |  Branch (1086:30): [True: 1.08M, False: 18.4E]
  |  Branch (1086:52): [True: 1.01M, False: 71.8k]
  ------------------
 1087|  1.01M|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  ------------------
  |  |  639|  1.01M|    do {                                                                                           \
  |  |  640|  1.01M|        uint32_t tokens = zxc_le32(t_ptr);                                                         \
  |  |  641|  1.01M|        t_ptr += sizeof(uint32_t);                                                                 \
  |  |  642|  1.01M|        uint64_t offs;                                                                             \
  |  |  643|  1.01M|        if (SPL_OFF8) {                                                                            \
  |  |  ------------------
  |  |  |  |  577|  1.01M|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (577:18): [True: 714k, False: 297k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  644|   714k|            uint64_t x = zxc_le32(o_ptr);                                                          \
  |  |  645|   714k|            o_ptr += sizeof(uint32_t);                                                             \
  |  |  646|   714k|            x = (x | (x << 16)) & 0x0000FFFF0000FFFFULL;                                           \
  |  |  647|   714k|            offs = (x | (x << 8)) & 0x00FF00FF00FF00FFULL;                                         \
  |  |  648|   714k|        } else {                                                                                   \
  |  |  649|   297k|            offs = zxc_le64(o_ptr);                                                                \
  |  |  650|   297k|            o_ptr += sizeof(uint64_t);                                                             \
  |  |  651|   297k|        }                                                                                          \
  |  |  652|  1.01M|        DECODE_SPL_SEQ((tokens & 0x0F0) >> 4, (tokens & 0x00F),                                    \
  |  |  ------------------
  |  |  |  |  593|  1.01M|    do {                                                                                        \
  |  |  |  |  594|  1.01M|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|  1.01M|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|  1.01M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.01M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 71.2k, False: 939k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|  71.2k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|  71.2k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|  71.2k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|  71.2k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|  71.2k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|  71.2k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   142k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 71.2k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 28, False: 71.2k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 18.4E, False: 71.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|  71.2k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|  71.2k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|  71.2k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|  71.2k|                ON_FAIL;                                                                        \
  |  |  |  |  607|  71.2k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|   939k|        } else {                                                                                \
  |  |  |  |  609|   939k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|   939k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|   939k|        }                                                                                       \
  |  |  |  |  612|  1.01M|        l_ptr += ll;                                                                            \
  |  |  |  |  613|  1.01M|        d_ptr += ll;                                                                            \
  |  |  |  |  614|  1.01M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.01M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 72.0k, False: 939k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|  72.0k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|  72.0k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|  72.0k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  72.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 72.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|  72.0k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|  72.0k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|  72.0k|                ON_FAIL;                                                                        \
  |  |  |  |  621|  72.0k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  72.0k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|  72.0k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|  72.0k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  72.0k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  72.0k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  72.0k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  72.0k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 72.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|   939k|        } else {                                                                                \
  |  |  |  |  624|   939k|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|   939k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   939k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|   939k|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|   939k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|   939k|    do {                                 \
  |  |  |  |  |  |  |  |  562|   939k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|   939k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|   939k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 939k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|   939k|        }                                                                                       \
  |  |  |  |  628|  1.01M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 1.01M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  653|  1.01M|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs & 0xFFFF),                             \
  |  |  654|  1.01M|                       ((tokens >> 12) & 0xF) + ((tokens >> 20) & 0xF) + (tokens >> 28), 3U,       \
  |  |  655|  1.01M|                       DECODE, ON_FAIL);                                                           \
  |  |  656|  1.01M|        DECODE_SPL_SEQ((tokens & 0x0F000) >> 12, (tokens & 0x00F00) >> 8,                          \
  |  |  ------------------
  |  |  |  |  593|  1.01M|    do {                                                                                        \
  |  |  |  |  594|  1.01M|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|  1.01M|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|  1.01M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.01M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 70.2k, False: 941k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|  70.2k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|  70.2k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|  70.2k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|  70.2k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|  70.2k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|  70.2k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   140k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 70.2k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 33, False: 70.1k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 18.4E, False: 70.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|  70.2k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|  70.2k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|  70.2k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|  70.2k|                ON_FAIL;                                                                        \
  |  |  |  |  607|  70.2k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|   941k|        } else {                                                                                \
  |  |  |  |  609|   941k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|   941k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|   941k|        }                                                                                       \
  |  |  |  |  612|  1.01M|        l_ptr += ll;                                                                            \
  |  |  |  |  613|  1.01M|        d_ptr += ll;                                                                            \
  |  |  |  |  614|  1.01M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.01M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 70.1k, False: 941k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|  70.1k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|  70.1k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|  70.1k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  70.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 70.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|  70.1k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|  70.1k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|  70.1k|                ON_FAIL;                                                                        \
  |  |  |  |  621|  70.1k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  70.1k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|  70.1k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|  70.1k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  70.1k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  70.1k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  70.1k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  70.1k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 70.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|   941k|        } else {                                                                                \
  |  |  |  |  624|   941k|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|   941k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   941k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|   941k|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|   941k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|   941k|    do {                                 \
  |  |  |  |  |  |  |  |  562|   941k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|   941k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|   941k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 941k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|   941k|        }                                                                                       \
  |  |  |  |  628|  1.01M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 1.01M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  657|  1.01M|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 16) & 0xFFFF),                     \
  |  |  658|  1.01M|                       ((tokens >> 20) & 0xF) + (tokens >> 28), 2U, DECODE, ON_FAIL);              \
  |  |  659|  1.01M|        DECODE_SPL_SEQ((tokens & 0x0F00000) >> 20, (tokens & 0x00F0000) >> 16,                     \
  |  |  ------------------
  |  |  |  |  593|  1.01M|    do {                                                                                        \
  |  |  |  |  594|  1.01M|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|  1.01M|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|  1.01M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.01M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 69.9k, False: 941k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|  69.9k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|  69.9k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|  69.9k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|  69.9k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|  69.9k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|  69.9k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   139k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 69.9k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 43, False: 69.9k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 18.4E, False: 69.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|  69.9k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|  69.9k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|  69.9k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|  69.9k|                ON_FAIL;                                                                        \
  |  |  |  |  607|  69.9k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|   941k|        } else {                                                                                \
  |  |  |  |  609|   941k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|   941k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|   941k|        }                                                                                       \
  |  |  |  |  612|  1.01M|        l_ptr += ll;                                                                            \
  |  |  |  |  613|  1.01M|        d_ptr += ll;                                                                            \
  |  |  |  |  614|  1.01M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.01M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 69.5k, False: 941k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|  69.5k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|  69.5k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|  69.5k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  69.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 69.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|  69.5k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|  69.5k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|  69.5k|                ON_FAIL;                                                                        \
  |  |  |  |  621|  69.5k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  69.5k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|  69.5k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|  69.5k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  69.5k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  69.5k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  69.5k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  69.5k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 69.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|   941k|        } else {                                                                                \
  |  |  |  |  624|   941k|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|   941k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   941k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|   941k|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|   941k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|   941k|    do {                                 \
  |  |  |  |  |  |  |  |  562|   941k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|   941k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|   941k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 941k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|   941k|        }                                                                                       \
  |  |  |  |  628|  1.01M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 1.01M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  660|  1.01M|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 32) & 0xFFFF), (tokens >> 28), 1U, \
  |  |  661|  1.01M|                       DECODE, ON_FAIL);                                                           \
  |  |  662|  1.01M|        DECODE_SPL_SEQ((tokens >> 28), (tokens >> 24) & 0x0F,                                      \
  |  |  ------------------
  |  |  |  |  593|  1.01M|    do {                                                                                        \
  |  |  |  |  594|  1.01M|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|  1.01M|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|  1.01M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.01M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 70.1k, False: 941k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|  70.1k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|  70.1k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|  70.1k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|  70.1k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|  70.1k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|  70.1k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   140k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 70.1k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 38, False: 70.0k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 18.4E, False: 70.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|  70.1k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|  70.1k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|  70.1k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|  70.1k|                ON_FAIL;                                                                        \
  |  |  |  |  607|  70.1k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|   941k|        } else {                                                                                \
  |  |  |  |  609|   941k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|   941k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|   941k|        }                                                                                       \
  |  |  |  |  612|  1.01M|        l_ptr += ll;                                                                            \
  |  |  |  |  613|  1.01M|        d_ptr += ll;                                                                            \
  |  |  |  |  614|  1.01M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.01M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 70.3k, False: 940k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|  70.3k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|  70.3k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|  70.3k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  70.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 70.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|  70.3k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|  70.3k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|  70.3k|                ON_FAIL;                                                                        \
  |  |  |  |  621|  70.3k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  70.3k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|  70.3k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|  70.3k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  70.3k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  70.3k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  70.3k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  70.3k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 70.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|   940k|        } else {                                                                                \
  |  |  |  |  624|   940k|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|   940k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   940k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|   940k|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|   940k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|   940k|    do {                                 \
  |  |  |  |  |  |  |  |  562|   940k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|   940k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|   940k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 940k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|   940k|        }                                                                                       \
  |  |  |  |  628|  1.01M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 1.01M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  663|  1.01M|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs >> 48), 0, 0U, DECODE, ON_FAIL);       \
  |  |  664|  1.01M|        n_seq -= 4;                                                                                \
  |  |  665|  1.01M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (665:14): [Folded, False: 1.01M]
  |  |  ------------------
  ------------------
 1088|  1.01M|        }
 1089|   107k|    }
 1090|       |
 1091|       |    // --- Remaining 1 sequence (Fast Path) ---
 1092|  1.75M|    while (n_seq > 0 && d_ptr < d_end_safe && l_ptr < l_end_safe_1x) {
  ------------------
  |  Branch (1092:12): [True: 1.72M, False: 23.8k]
  |  Branch (1092:25): [True: 1.72M, False: 18.4E]
  |  Branch (1092:47): [True: 1.64M, False: 83.9k]
  ------------------
 1093|       |        // Save pointers before reading (in case we need to fall back to Safe Path)
 1094|  1.64M|        const uint8_t* t_save = t_ptr;
 1095|  1.64M|        const uint8_t* o_save = o_ptr;
 1096|  1.64M|        const uint8_t* e_save = e_ptr;
 1097|       |
 1098|  1.64M|        uint8_t token = *t_ptr++;
 1099|  1.64M|        uint64_t ll = token >> ZXC_TOKEN_LIT_BITS;
  ------------------
  |  |  518|  1.64M|#define ZXC_TOKEN_LIT_BITS 4
  ------------------
 1100|  1.64M|        uint64_t ml = token & ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  524|  1.64M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|  1.64M|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
 1101|  1.64M|        uint32_t offset = ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  724|  1.64M|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1102|  1.64M|        if (SPL_OFF8) {
  ------------------
  |  |  577|  1.64M|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  ------------------
  |  |  |  Branch (577:18): [True: 454k, False: 1.19M]
  |  |  ------------------
  ------------------
 1103|   454k|            offset += *o_ptr++;  // 1-byte offset (biased)
 1104|  1.19M|        } else {
 1105|  1.19M|            offset += zxc_le16(o_ptr);  // 2-byte offset (biased)
 1106|  1.19M|            o_ptr += sizeof(uint16_t);
 1107|  1.19M|        }
 1108|       |
 1109|  1.64M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {
  ------------------
  |  |  152|  1.64M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 31.1k, False: 1.61M]
  |  |  ------------------
  ------------------
 1110|  31.1k|            ll += zxc_read_varint(&e_ptr, e_end);
 1111|  31.1k|            if (UNLIKELY(ll > (size_t)(l_end - l_ptr))) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  152|  31.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 31.1k]
  |  |  ------------------
  ------------------
 1112|  31.1k|        }
 1113|  1.64M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) ml += zxc_read_varint(&e_ptr, e_end);
  ------------------
  |  |  152|  1.64M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 232k, False: 1.41M]
  |  |  ------------------
  ------------------
 1114|  1.64M|        ml += ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  586|  1.64M|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1115|       |
 1116|       |        // Check bounds before wild copies - if too close to end, fall back to Safe Path
 1117|  1.64M|        if (UNLIKELY(ll + ml + ZXC_PAD_SIZE > (size_t)(d_end - d_ptr))) {
  ------------------
  |  |  152|  1.64M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 1.64M]
  |  |  ------------------
  ------------------
 1118|      0|            t_ptr = t_save;
 1119|      0|            o_ptr = o_save;
 1120|      0|            e_ptr = e_save;
 1121|      0|            break;
 1122|      0|        }
 1123|       |
 1124|       |        // Unlike the 4x batch the copy cannot sit in the varint branch's else -
 1125|       |        // the rollback above must run first - so re-test ll instead. Exact:
 1126|       |        // the escape leaves ll >= ZXC_TOKEN_LL_MASK.
 1127|  1.64M|        if (LIKELY(ll < ZXC_TOKEN_LL_MASK)) {
  ------------------
  |  |  146|  1.64M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 1.61M, False: 31.2k]
  |  |  ------------------
  ------------------
 1128|  1.61M|            zxc_copy16(d_ptr, l_ptr);
 1129|  1.61M|        } else {
 1130|  31.2k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);
 1131|  31.2k|        }
 1132|  1.64M|        l_ptr += ll;
 1133|  1.64M|        d_ptr += ll;
 1134|       |
 1135|  1.64M|        if (UNLIKELY(d_ptr < d_bounds && (size_t)(d_ptr - d_floor) < offset))
  ------------------
  |  |  152|  2.75M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 1.64M]
  |  |  |  Branch (152:42): [True: 1.11M, False: 532k]
  |  |  |  Branch (152:42): [True: 0, False: 1.11M]
  |  |  ------------------
  ------------------
 1136|      0|            return ZXC_ERROR_BAD_OFFSET;
 1137|       |
 1138|       |        // The loop entry check guarantees ll + ml + ZXC_PAD_SIZE bytes of
 1139|       |        // headroom, so the wild-copy ladder (incl. overlap/fill runs) is safe.
 1140|  1.64M|        zxc_decode_copy_match_spl(d_ptr, offset, ml);
 1141|  1.64M|        d_ptr += ml;
 1142|  1.64M|        n_seq--;
 1143|  1.64M|    }
 1144|       |
 1145|       |    // --- Safe Path for Remaining Sequences ---
 1146|  1.08M|    while (n_seq > 0) {
  ------------------
  |  Branch (1146:12): [True: 974k, False: 107k]
  ------------------
 1147|   974k|        uint8_t token = *t_ptr++;
 1148|   974k|        uint64_t ll = token >> ZXC_TOKEN_LIT_BITS;
  ------------------
  |  |  518|   974k|#define ZXC_TOKEN_LIT_BITS 4
  ------------------
 1149|   974k|        uint64_t ml = token & ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  524|   974k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|   974k|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
 1150|   974k|        uint32_t offset = ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  724|   974k|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1151|   974k|        if (SPL_OFF8) {
  ------------------
  |  |  577|   974k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  ------------------
  |  |  |  Branch (577:18): [True: 176k, False: 797k]
  |  |  ------------------
  ------------------
 1152|   176k|            offset += *o_ptr++;  // 1-byte offset (biased)
 1153|   797k|        } else {
 1154|   797k|            offset += zxc_le16(o_ptr);  // 2-byte offset (biased)
 1155|   797k|            o_ptr += sizeof(uint16_t);
 1156|   797k|        }
 1157|       |
 1158|   974k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) ll += zxc_read_varint(&e_ptr, e_end);
  ------------------
  |  |  152|   974k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 974k]
  |  |  ------------------
  ------------------
 1159|   974k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) ml += zxc_read_varint(&e_ptr, e_end);
  ------------------
  |  |  152|   974k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 217k, False: 756k]
  |  |  ------------------
  ------------------
 1160|   974k|        ml += ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  586|   974k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1161|       |
 1162|   974k|        if (UNLIKELY(ll + ml > (size_t)(d_end - d_ptr) || ll > (size_t)(l_end - l_ptr)))
  ------------------
  |  |  152|  1.94M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 974k]
  |  |  |  Branch (152:42): [True: 167, False: 973k]
  |  |  |  Branch (152:42): [True: 18.4E, False: 973k]
  |  |  ------------------
  ------------------
 1163|      0|            return ZXC_ERROR_OVERFLOW;
 1164|   974k|        ZXC_MEMCPY(d_ptr, l_ptr, ll);
  ------------------
  |  |  168|   974k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1165|   974k|        l_ptr += ll;
 1166|   974k|        d_ptr += ll;
 1167|       |
 1168|   974k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < offset)) return ZXC_ERROR_BAD_OFFSET;
  ------------------
  |  |  152|   974k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 974k]
  |  |  ------------------
  ------------------
 1169|   974k|        const uint8_t* match_src = d_ptr - offset;
 1170|       |
 1171|   974k|        zxc_decode_copy_match_exact(d_ptr, match_src, offset, ml);
 1172|   974k|        d_ptr += ml;
 1173|   974k|        n_seq--;
 1174|   974k|    }
 1175|       |
 1176|       |    // --- Trailing Literals ---
 1177|       |    // Copy remaining literals from source stream (literal exhaustion)
 1178|   107k|    if (UNLIKELY(l_ptr > l_end)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|   107k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 107k]
  |  |  ------------------
  ------------------
 1179|   107k|    if (UNLIKELY(d_ptr > d_end)) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  152|   107k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 107k]
  |  |  ------------------
  ------------------
 1180|       |
 1181|   107k|    const size_t remaining_literals = (size_t)(l_end - l_ptr);
 1182|   107k|    if (UNLIKELY(remaining_literals > (size_t)(d_end - d_ptr))) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  152|   107k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 107k]
  |  |  ------------------
  ------------------
 1183|   107k|    ZXC_MEMCPY(d_ptr, l_ptr, remaining_literals);
  ------------------
  |  |  168|   107k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1184|   107k|    d_ptr += remaining_literals;
 1185|       |
 1186|   107k|    return (int)(d_ptr - dst);
 1187|   107k|}
zxc_decompress.c:zxc_decode_block_spl_entropy_dict:
 1465|  18.6k|                                                          const size_t dst_capacity) {
 1466|  18.6k|    return zxc_decode_block_spl_impl(ctx, src, src_size, dst, dst_capacity, 0, 1, 1);
 1467|  18.6k|}
zxc_decompress.c:zxc_decode_block_spl_entropy:
 1456|  22.6k|                                                     const size_t dst_capacity) {
 1457|  22.6k|    return zxc_decode_block_spl_impl(ctx, src, src_size, dst, dst_capacity, 0, 0, 1);
 1458|  22.6k|}
zxc_decompress.c:zxc_decode_lit_pivco:
  745|  20.5k|                                                      const size_t required_size) {
  746|  20.5k|    const int arc = zxc_ensure_entropy_scratch(ctx);
  747|  20.5k|    if (UNLIKELY(arc != ZXC_OK)) return arc;
  ------------------
  |  |  152|  20.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 20.5k]
  |  |  ------------------
  ------------------
  748|  20.5k|    if (UNLIKELY(ctx->lit_buffer_cap < required_size + ZXC_PAD_SIZE ||
  ------------------
  |  |  152|  41.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 20.5k]
  |  |  |  Branch (152:42): [True: 18.4E, False: 20.6k]
  |  |  |  Branch (152:42): [True: 0, False: 20.6k]
  |  |  ------------------
  ------------------
  749|  20.5k|                 ctx->pivco_scratch_cap < required_size + ZXC_PIVCO_SCRATCH_PAD))
  750|      0|        return ZXC_ERROR_DST_TOO_SMALL;
  751|  20.5k|    return zxc_huf_decode_section(payload, psize, ctx->lit_buffer, required_size,
  ------------------
  |  |   33|  20.5k|#define zxc_huf_decode_section ZXC_CAT(zxc_huf_decode_section, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   25|  20.5k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   24|  20.5k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  752|  20.5k|                                  ctx->pivco_scratch);
  753|  20.5k|}
zxc_decompress.c:zxc_ensure_entropy_scratch:
  737|  61.8k|static ZXC_NOINLINE ZXC_COLD int zxc_ensure_entropy_scratch(const zxc_cctx_t* RESTRICT ctx) {
  738|  61.8k|    if (LIKELY(ctx->pivco_scratch)) return ZXC_OK;
  ------------------
  |  |  146|  61.8k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 54.4k, False: 7.40k]
  |  |  ------------------
  ------------------
  739|  7.40k|    return zxc_cctx_alloc_entropy_scratch((zxc_cctx_t*)(uintptr_t)ctx);
  740|  61.8k|}
zxc_decompress.c:zxc_decode_tok_pivco:
  780|  41.2k|                                                      const size_t psize, const size_t n_tok) {
  781|  41.2k|    const int arc = zxc_ensure_entropy_scratch(ctx);
  782|  41.2k|    if (UNLIKELY(arc != ZXC_OK)) return arc;
  ------------------
  |  |  152|  41.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 41.2k]
  |  |  ------------------
  ------------------
  783|  41.2k|    if (UNLIKELY(n_tok + ZXC_PAD_SIZE > ctx->tok_buffer_cap ||
  ------------------
  |  |  152|  82.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 41.2k]
  |  |  |  Branch (152:42): [True: 18.4E, False: 41.2k]
  |  |  |  Branch (152:42): [True: 0, False: 41.2k]
  |  |  ------------------
  ------------------
  784|  41.2k|                 n_tok + ZXC_PIVCO_SCRATCH_PAD > ctx->pivco_scratch_cap))
  785|      0|        return ZXC_ERROR_DST_TOO_SMALL;
  786|  41.2k|    return zxc_huf_decode_section(payload, psize, ctx->tok_buffer, n_tok, ctx->pivco_scratch);
  ------------------
  |  |   33|  41.2k|#define zxc_huf_decode_section ZXC_CAT(zxc_huf_decode_section, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   25|  41.2k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   24|  41.2k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  787|  41.2k|}
zxc_decompress.c:zxc_decode_copy_literals:
  426|  3.52M|                                                       const uint64_t ll) {
  427|  3.52M|    zxc_wild_copy32(dst, src, ll);
  428|  3.52M|}
zxc_decompress.c:zxc_wild_copy32:
  393|  5.22M|static ZXC_ALWAYS_INLINE void zxc_wild_copy32(uint8_t* dst, const uint8_t* src, const size_t len) {
  394|  5.22M|    zxc_copy32(dst, src);
  395|  5.22M|    if (UNLIKELY(len > 32)) {
  ------------------
  |  |  152|  5.22M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 1.41M, False: 3.80M]
  |  |  ------------------
  ------------------
  396|  1.41M|        size_t rem = len - 32;
  397|  1.41M|        dst += 32;
  398|  1.41M|        src += 32;
  399|  19.8M|        while (rem > 32) {
  ------------------
  |  Branch (399:16): [True: 18.4M, False: 1.41M]
  ------------------
  400|  18.4M|            zxc_copy32(dst, src);
  401|  18.4M|            dst += 32;
  402|  18.4M|            src += 32;
  403|  18.4M|            rem -= 32;
  404|  18.4M|        }
  405|  1.41M|        zxc_copy32(dst, src);
  406|  1.41M|    }
  407|  5.22M|}
zxc_decompress.c:zxc_decode_copy_match:
  454|  3.55M|                                                    const uint64_t ml) {
  455|  3.55M|    const uint8_t* match_src = d_ptr - off;
  456|  3.55M|    if (LIKELY(off >= 32)) {
  ------------------
  |  |  146|  3.55M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 1.77M, False: 1.77M]
  |  |  ------------------
  ------------------
  457|  1.77M|        zxc_wild_copy32(d_ptr, match_src, ml);
  458|  1.77M|    } else if (off == 1) {
  ------------------
  |  Branch (458:16): [True: 575k, False: 1.20M]
  ------------------
  459|   575k|        zxc_decode_fill_run(d_ptr, match_src[0], ml);
  460|  1.20M|    } else {
  461|  1.20M|        zxc_decode_copy_overlap_run32(d_ptr, off, ml);
  462|  1.20M|    }
  463|  3.55M|}
zxc_decompress.c:zxc_decode_fill_run:
  331|  1.53M|                                                  const uint64_t ml) {
  332|       |#if defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512)
  333|       |    const __m256i v = _mm256_set1_epi8((char)byte);
  334|       |    _mm256_storeu_si256((__m256i*)dst, v);
  335|       |    if (UNLIKELY(ml > 32)) {
  336|       |        uint8_t* p = dst;
  337|       |        const uint8_t* const last = dst + ml - 32;
  338|       |        do {
  339|       |            p += 32;
  340|       |            _mm256_storeu_si256((__m256i*)p, v);
  341|       |        } while (p < last);
  342|       |    }
  343|       |#elif defined(ZXC_USE_SSE2)
  344|       |    const __m128i v = _mm_set1_epi8((char)byte);
  345|  1.53M|    _mm_storeu_si128((__m128i*)dst, v);
  346|  1.53M|    _mm_storeu_si128((__m128i*)(dst + 16), v);
  347|  1.53M|    if (UNLIKELY(ml > 32)) {
  ------------------
  |  |  152|  1.53M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 302k, False: 1.23M]
  |  |  ------------------
  ------------------
  348|   302k|        uint8_t* p = dst;
  349|   302k|        const uint8_t* const last = dst + ml - 32;
  350|  1.07M|        do {
  351|  1.07M|            p += 32;
  352|  1.07M|            _mm_storeu_si128((__m128i*)p, v);
  353|  1.07M|            _mm_storeu_si128((__m128i*)(p + 16), v);
  354|  1.07M|        } while (p < last);
  ------------------
  |  Branch (354:18): [True: 767k, False: 302k]
  ------------------
  355|   302k|    }
  356|       |#elif defined(ZXC_USE_NEON64) || defined(ZXC_USE_NEON32)
  357|       |    const uint8x16_t v = vdupq_n_u8(byte);
  358|       |    vst1q_u8(dst, v);
  359|       |    vst1q_u8(dst + 16, v);
  360|       |    if (UNLIKELY(ml > 32)) {
  361|       |        uint8_t* p = dst;
  362|       |        const uint8_t* const last = dst + ml - 32;
  363|       |        do {
  364|       |            p += 32;
  365|       |            vst1q_u8(p, v);
  366|       |            vst1q_u8(p + 16, v);
  367|       |        } while (p < last);
  368|       |    }
  369|       |#else
  370|       |    ZXC_MEMSET(dst, byte, ml);
  371|       |#endif
  372|  1.53M|}
zxc_decompress.c:zxc_decode_copy_overlap_run32:
  152|  1.25M|                                                            const uint64_t ml) {
  153|  1.25M|    const size_t stride = zxc_overlap_strides32[off];
  154|  1.25M|    size_t copied = 0;
  155|       |    // MSan keeps the shadow of the bytes a shuffle loads but never selects.
  156|  1.25M|    ZXC_MSAN_UNPOISON(dst, 32 - off);
  ------------------
  |  |  268|  1.25M|#define ZXC_MSAN_UNPOISON(p, n) ((void)0)
  ------------------
  157|       |#if defined(ZXC_USE_NEON64)
  158|       |    uint8x16x2_t tbl;
  159|       |    tbl.val[0] = vld1q_u8(dst - off);
  160|       |    tbl.val[1] = vld1q_u8(dst - off + 16);
  161|       |    const uint8x16_t pat_lo = vqtbl2q_u8(tbl, vld1q_u8(zxc_overlap_masks32[off]));
  162|       |    const uint8x16_t pat_hi = vqtbl2q_u8(tbl, vld1q_u8(zxc_overlap_masks32[off] + 16));
  163|       |    do {
  164|       |        vst1q_u8(dst + copied, pat_lo);
  165|       |        vst1q_u8(dst + copied + 16, pat_hi);
  166|       |        copied += stride;
  167|       |    } while (copied < ml);
  168|       |
  169|       |#elif defined(ZXC_USE_NEON32)
  170|       |    // VTBL reaches 8 bytes per lookup from a 4-register (32-byte) table, so the
  171|       |    // pattern takes four lookups instead of NEON64's two.
  172|       |    uint8x8x4_t tbl;
  173|       |    tbl.val[0] = vld1_u8(dst - off);
  174|       |    tbl.val[1] = vld1_u8(dst - off + 8);
  175|       |    tbl.val[2] = vld1_u8(dst - off + 16);
  176|       |    tbl.val[3] = vld1_u8(dst - off + 24);
  177|       |    const uint8_t* const m = zxc_overlap_masks32[off];
  178|       |    const uint8x8_t p0 = vtbl4_u8(tbl, vld1_u8(m));
  179|       |    const uint8x8_t p1 = vtbl4_u8(tbl, vld1_u8(m + 8));
  180|       |    const uint8x8_t p2 = vtbl4_u8(tbl, vld1_u8(m + 16));
  181|       |    const uint8x8_t p3 = vtbl4_u8(tbl, vld1_u8(m + 24));
  182|       |    do {
  183|       |        vst1_u8(dst + copied, p0);
  184|       |        vst1_u8(dst + copied + 8, p1);
  185|       |        vst1_u8(dst + copied + 16, p2);
  186|       |        vst1_u8(dst + copied + 24, p3);
  187|       |        copied += stride;
  188|       |    } while (copied < ml);
  189|       |
  190|       |#elif defined(ZXC_USE_AVX512) && defined(__AVX512VBMI__) && defined(__AVX512VL__)
  191|       |    // vpermb indexes all 32 bytes, so the table needs no emulation.
  192|       |    const __m256i pat =
  193|       |        _mm256_permutexvar_epi8(_mm256_load_si256((const __m256i*)zxc_overlap_masks32[off]),
  194|       |                                _mm256_loadu_si256((const __m256i*)(dst - off)));
  195|       |    do {
  196|       |        _mm256_storeu_si256((__m256i*)(dst + copied), pat);
  197|       |        copied += stride;
  198|       |    } while (copied < ml);
  199|       |
  200|       |#elif defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512)
  201|       |    // pshufb only reaches 16 bytes per lane, so the 32-byte table is emulated:
  202|       |    // shuffle both halves, then pick per byte on bit 4 of the index.
  203|       |    const __m128i t0 = _mm_loadu_si128((const __m128i*)(dst - off));
  204|       |    const __m128i t1 = _mm_loadu_si128((const __m128i*)(dst - off + 16));
  205|       |    const __m128i sixteen = _mm_set1_epi8(16);
  206|       |    const __m128i m_lo = _mm_load_si128((const __m128i*)zxc_overlap_masks32[off]);
  207|       |    const __m128i m_hi = _mm_load_si128((const __m128i*)(zxc_overlap_masks32[off] + 16));
  208|       |    const __m128i pat_lo =
  209|       |        _mm_blendv_epi8(_mm_shuffle_epi8(t0, m_lo),
  210|       |                        _mm_shuffle_epi8(t1, _mm_sub_epi8(m_lo, sixteen)), _mm_slli_epi16(m_lo, 3));
  211|       |    const __m128i pat_hi =
  212|       |        _mm_blendv_epi8(_mm_shuffle_epi8(t0, m_hi),
  213|       |                        _mm_shuffle_epi8(t1, _mm_sub_epi8(m_hi, sixteen)), _mm_slli_epi16(m_hi, 3));
  214|       |    do {
  215|       |        _mm_storeu_si128((__m128i*)(dst + copied), pat_lo);
  216|       |        _mm_storeu_si128((__m128i*)(dst + copied + 16), pat_hi);
  217|       |        copied += stride;
  218|       |    } while (copied < ml);
  219|       |
  220|       |#else
  221|       |    // SSE2 (no PSHUFB) and non-SIMD tiers: build the 32-byte pattern with a
  222|       |    // wrap counter (no per-byte modulo), then store it as two 16-byte halves.
  223|  1.25M|    const uint8_t* src = dst - off;
  224|  1.25M|    uint8_t pat[32];
  225|  1.25M|    uint32_t k = 0;
  226|  41.0M|    for (size_t i = 0; i < 32; i++) {
  ------------------
  |  Branch (226:24): [True: 39.8M, False: 1.25M]
  ------------------
  227|  39.8M|        pat[i] = src[k];
  228|  39.8M|        if (++k == off) k = 0;
  ------------------
  |  Branch (228:13): [True: 3.75M, False: 36.0M]
  ------------------
  229|  39.8M|    }
  230|  1.71M|    do {
  231|  1.71M|        zxc_copy16(dst + copied, pat);
  232|  1.71M|        zxc_copy16(dst + copied + 16, pat + 16);
  233|  1.71M|        copied += stride;
  234|  1.71M|    } while (copied < ml);
  ------------------
  |  Branch (234:14): [True: 462k, False: 1.25M]
  ------------------
  235|  1.25M|#endif
  236|  1.25M|}
zxc_decompress.c:zxc_decode_copy_match_short:
  481|  16.1M|                                                          const uint32_t off, const uint64_t ml) {
  482|  16.1M|    const uint8_t* match_src = d_ptr - off;
  483|  16.1M|    if (LIKELY(off >= 32)) {
  ------------------
  |  |  146|  16.1M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 7.74M, False: 8.45M]
  |  |  ------------------
  ------------------
  484|  7.74M|        zxc_copy32(d_ptr, match_src);
  485|  8.45M|    } else if (off == 1) {
  ------------------
  |  Branch (485:16): [True: 967k, False: 7.48M]
  ------------------
  486|   967k|        zxc_decode_fill_run(d_ptr, match_src[0], ml);
  487|  7.48M|    } else {
  488|  7.48M|        zxc_decode_copy_overlap_short(d_ptr, off, ml);
  489|  7.48M|    }
  490|  16.1M|}
zxc_decompress.c:zxc_decode_copy_overlap_short:
  259|  7.73M|                                                            const uint64_t ml) {
  260|  7.73M|    ZXC_MSAN_UNPOISON(dst, ml > 16 ? 32 - off : (off < 16 ? 16 - off : 0));
  ------------------
  |  |  268|  7.73M|#define ZXC_MSAN_UNPOISON(p, n) ((void)0)
  ------------------
  261|       |#if defined(ZXC_USE_NEON64)
  262|       |    const uint8x16_t s0 = vld1q_u8(dst - off);
  263|       |    vst1q_u8(dst, vqtbl1q_u8(s0, vld1q_u8(zxc_overlap_masks32[off])));
  264|       |    if (UNLIKELY(ml > 16)) {
  265|       |        uint8x16x2_t tbl;
  266|       |        tbl.val[0] = s0;
  267|       |        tbl.val[1] = vld1q_u8(dst - off + 16);
  268|       |        vst1q_u8(dst + 16, vqtbl2q_u8(tbl, vld1q_u8(zxc_overlap_masks32[off] + 16)));
  269|       |    }
  270|       |
  271|       |#elif defined(ZXC_USE_NEON32)
  272|       |    uint8x8x2_t lo_tbl;
  273|       |    lo_tbl.val[0] = vld1_u8(dst - off);
  274|       |    lo_tbl.val[1] = vld1_u8(dst - off + 8);
  275|       |    const uint8_t* const m = zxc_overlap_masks32[off];
  276|       |    vst1_u8(dst, vtbl2_u8(lo_tbl, vld1_u8(m)));
  277|       |    vst1_u8(dst + 8, vtbl2_u8(lo_tbl, vld1_u8(m + 8)));
  278|       |    if (UNLIKELY(ml > 16)) {
  279|       |        uint8x8x4_t tbl;
  280|       |        tbl.val[0] = lo_tbl.val[0];
  281|       |        tbl.val[1] = lo_tbl.val[1];
  282|       |        tbl.val[2] = vld1_u8(dst - off + 16);
  283|       |        tbl.val[3] = vld1_u8(dst - off + 24);
  284|       |        vst1_u8(dst + 16, vtbl4_u8(tbl, vld1_u8(m + 16)));
  285|       |        vst1_u8(dst + 24, vtbl4_u8(tbl, vld1_u8(m + 24)));
  286|       |    }
  287|       |
  288|       |#elif defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512)
  289|       |    // pshufb reaches 16 bytes, so only the upper half needs two tables: shuffle
  290|       |    // both and pick per byte on bit 4 of the index.
  291|       |    const __m128i t0 = _mm_loadu_si128((const __m128i*)(dst - off));
  292|       |    _mm_storeu_si128(
  293|       |        (__m128i*)dst,
  294|       |        _mm_shuffle_epi8(t0, _mm_load_si128((const __m128i*)zxc_overlap_masks32[off])));
  295|       |    if (UNLIKELY(ml > 16)) {
  296|       |        const __m128i t1 = _mm_loadu_si128((const __m128i*)(dst - off + 16));
  297|       |        const __m128i m_hi = _mm_load_si128((const __m128i*)(zxc_overlap_masks32[off] + 16));
  298|       |        _mm_storeu_si128(
  299|       |            (__m128i*)(dst + 16),
  300|       |            _mm_blendv_epi8(_mm_shuffle_epi8(t0, m_hi),
  301|       |                            _mm_shuffle_epi8(t1, _mm_sub_epi8(m_hi, _mm_set1_epi8(16))),
  302|       |                            _mm_slli_epi16(m_hi, 3)));
  303|       |    }
  304|       |
  305|       |#else
  306|  7.73M|    const uint8_t* src = dst - off;
  307|  7.73M|    const size_t n = (ml > 16) ? 32 : 16;
  ------------------
  |  Branch (307:22): [True: 92.6k, False: 7.63M]
  ------------------
  308|  7.73M|    uint32_t k = 0;
  309|   132M|    for (size_t i = 0; i < n; i++) {
  ------------------
  |  Branch (309:24): [True: 125M, False: 7.73M]
  ------------------
  310|   125M|        dst[i] = src[k];
  311|   125M|        if (++k == off) k = 0;
  ------------------
  |  Branch (311:13): [True: 7.48M, False: 117M]
  ------------------
  312|   125M|    }
  313|  7.73M|#endif
  314|  7.73M|}
zxc_decompress.c:zxc_decode_copy_match_spl:
  503|  1.64M|                                                        const uint64_t ml) {
  504|  1.64M|    if (LIKELY(ml <= ZXC_SPL_MAX_INLINE_ML)) {
  ------------------
  |  |  146|  1.64M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 1.41M, False: 229k]
  |  |  ------------------
  ------------------
  505|  1.41M|        zxc_decode_copy_match_short(d_ptr, off, ml);
  506|  1.41M|    } else {
  507|   229k|        zxc_decode_copy_match(d_ptr, off, ml);
  508|   229k|    }
  509|  1.64M|}
zxc_decompress.c:zxc_decode_copy_match_exact:
  528|  1.23M|                                                     const size_t off, const size_t ml) {
  529|  1.23M|    if (off >= ml) {
  ------------------
  |  Branch (529:9): [True: 1.10M, False: 133k]
  ------------------
  530|  1.10M|        ZXC_MEMCPY(d_ptr, match_src, ml);
  ------------------
  |  |  168|  1.10M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  531|  1.10M|    } else if (ml < 16) {
  ------------------
  |  Branch (531:16): [True: 31.9k, False: 101k]
  ------------------
  532|   336k|        for (size_t i = 0; i < ml; i++) d_ptr[i] = match_src[i];
  ------------------
  |  Branch (532:28): [True: 304k, False: 31.9k]
  ------------------
  533|   101k|    } else {
  534|   101k|        size_t n = off;
  535|   101k|        ZXC_MEMCPY(d_ptr, match_src, n);
  ------------------
  |  |  168|   101k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  536|   511k|        while (n <= ml - n) {
  ------------------
  |  Branch (536:16): [True: 410k, False: 101k]
  ------------------
  537|   410k|            ZXC_MEMCPY(d_ptr + n, d_ptr, n);
  ------------------
  |  |  168|   410k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  538|   410k|            n <<= 1;
  539|   410k|        }
  540|   101k|        ZXC_MEMCPY(d_ptr + n, d_ptr, ml - n);
  ------------------
  |  |  168|   101k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  541|   101k|    }
  542|  1.23M|}
zxc_decompress.c:zxc_decode_block_spl_dict:
 1533|  55.5k|                                                  const size_t dst_capacity) {
 1534|  55.5k|    return zxc_decode_block_spl_impl(ctx, src, src_size, dst, dst_capacity, 0, 1, 0);
 1535|  55.5k|}
zxc_decompress.c:zxc_decode_block_spl:
 1493|  52.5k|                                const size_t dst_capacity) {
 1494|  52.5k|    return zxc_decode_block_spl_impl(ctx, src, src_size, dst, dst_capacity, 0, 0, 0);
 1495|  52.5k|}
zxc_decompress.c:zxc_decode_block_pak_impl:
 1213|  32.6k|                                                       const int has_dict) {
 1214|  32.6k|    zxc_gnr_header_t gh;
 1215|       |
 1216|       |    // 0 when !has_dict (safe path) -> folds `d_floor` to `dst`.
 1217|  32.6k|    const size_t dict_size = has_dict ? ctx->dict_size : 0;
  ------------------
  |  Branch (1217:30): [True: 20.6k, False: 11.9k]
  ------------------
 1218|       |
 1219|  32.6k|    if (UNLIKELY(zxc_read_pak_header(src, src_size, &gh) != ZXC_OK)) return ZXC_ERROR_BAD_HEADER;
  ------------------
  |  |  152|  32.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 32.6k]
  |  |  ------------------
  ------------------
 1220|  32.6k|    if (UNLIKELY(gh.enc_lit != ZXC_SECTION_ENCODING_RAW || gh.enc_tok != 0))
  ------------------
  |  |  152|  65.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 32.6k]
  |  |  |  Branch (152:42): [True: 16, False: 32.6k]
  |  |  |  Branch (152:42): [True: 18.4E, False: 32.6k]
  |  |  ------------------
  ------------------
 1221|      0|        return ZXC_ERROR_CORRUPT_DATA;
 1222|       |
 1223|  32.6k|    const uint8_t* const p_data = src + ZXC_PAK_HEADER_BINARY_SIZE;
  ------------------
  |  |  445|  32.6k|#define ZXC_PAK_HEADER_BINARY_SIZE 12
  ------------------
 1224|  32.6k|    const uint8_t* p_curr = p_data;
 1225|       |
 1226|       |    // --- Stream Pointers & Validation ---
 1227|       |    // PAK carries no section descriptors: literals are always RAW, the sequence
 1228|       |    // stream is four bytes per sequence, and extras run to the payload end.
 1229|  32.6k|    const size_t sz_lit = gh.n_literals;
 1230|  32.6k|    const uint64_t sz_seqs = (uint64_t)gh.n_sequences * sizeof(uint32_t);
 1231|       |
 1232|  32.6k|    const size_t payload_avail = (size_t)(src + src_size - p_data);
 1233|  32.6k|    const uint64_t consumed = (uint64_t)sz_lit + sz_seqs;
 1234|  32.6k|    if (UNLIKELY(consumed > (uint64_t)payload_avail)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  32.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 32.6k]
  |  |  ------------------
  ------------------
 1235|  32.6k|    const size_t sz_exts = payload_avail - (size_t)consumed; /* slack padding included */
 1236|       |
 1237|       |    // PAK literals are always RAW, so the slack is always load-bearing here.
 1238|       |    // No underflow: sz_lit <= consumed <= payload_avail.
 1239|  32.6k|    if (UNLIKELY(payload_avail - sz_lit < ZXC_BLOCK_LIT_SLACK)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  32.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 32.6k]
  |  |  ------------------
  ------------------
 1240|       |
 1241|  32.6k|    const uint8_t* l_ptr = p_curr;
 1242|  32.6k|    const uint8_t* l_end = l_ptr + sz_lit;
 1243|  32.6k|    p_curr += sz_lit;
 1244|       |
 1245|  32.6k|    const uint8_t* seq_ptr = p_curr;
 1246|  32.6k|    const uint8_t* extras_ptr = p_curr + (size_t)sz_seqs;
 1247|  32.6k|    const uint8_t* const extras_end = extras_ptr + sz_exts;
 1248|       |
 1249|  32.6k|    uint8_t* d_ptr = dst;
 1250|  32.6k|    const uint8_t* const d_end = dst + dst_capacity;
 1251|       |    // Lowest address a match may reach: the dictionary prefix if any, else dst.
 1252|  32.6k|    const uint8_t* const d_floor = dst - dict_size;
 1253|  32.6k|    const uint8_t* const d_end_safe =
 1254|  32.6k|        (dst_capacity > ZXC_PAD_SIZE * 4) ? d_end - (ZXC_PAD_SIZE * 4) : dst;  // 128
  ------------------
  |  |  342|  32.6k|#define ZXC_PAD_SIZE 32
  ------------------
                      (dst_capacity > ZXC_PAD_SIZE * 4) ? d_end - (ZXC_PAD_SIZE * 4) : dst;  // 128
  ------------------
  |  |  342|  32.6k|#define ZXC_PAD_SIZE 32
  ------------------
  |  Branch (1254:9): [True: 32.6k, False: 10]
  ------------------
 1255|       |    // 4x loop margin: four sequences of inline output (ll <= 254, ml <= 254 + 5,
 1256|       |    // longer ones escape and check themselves) plus the wild-copy overshoot:
 1257|       |    // 4 x 513 + 32 = 2084, all of ZXC_DECOMPRESS_TAIL_PAD.
 1258|  32.6k|    const uint8_t* const d_end_fast =
 1259|  32.6k|        (dst_capacity > ZXC_DECOMPRESS_TAIL_PAD) ? d_end - ZXC_DECOMPRESS_TAIL_PAD : dst;
  ------------------
  |  |  372|  32.6k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|  32.6k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|  32.6k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|  32.6k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  32.6k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  32.6k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  32.6k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  342|  32.6k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
                      (dst_capacity > ZXC_DECOMPRESS_TAIL_PAD) ? d_end - ZXC_DECOMPRESS_TAIL_PAD : dst;
  ------------------
  |  |  372|  32.6k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|  32.6k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|  32.6k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|  32.6k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  32.6k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  32.6k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  32.6k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  342|  32.6k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  |  Branch (1259:9): [True: 32.6k, False: 10]
  ------------------
 1260|       |
 1261|       |    // Literal margin for the PAK loops: without a varint, ll <= 254 per sequence,
 1262|       |    // so 4 * 254 = 1016. Past that only the cold varint path checks l_ptr.
 1263|  32.6k|    const size_t pak_margin_4x = 4 * (ZXC_SEQ_LL_MASK - 1);  // 1016
  ------------------
  |  |  539|  32.6k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  ------------------
  |  |  |  |  533|  32.6k|#define ZXC_SEQ_LL_BITS 8
  |  |  ------------------
  ------------------
 1264|  32.6k|    const size_t pak_margin_1x = ZXC_SEQ_LL_MASK - 1;        // 254
  ------------------
  |  |  539|  32.6k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  ------------------
  |  |  |  |  533|  32.6k|#define ZXC_SEQ_LL_BITS 8
  |  |  ------------------
  ------------------
 1265|  32.6k|    const uint8_t* const l_end_safe_4x = (sz_lit > pak_margin_4x) ? l_end - pak_margin_4x : l_ptr;
  ------------------
  |  Branch (1265:42): [True: 20.3k, False: 12.3k]
  ------------------
 1266|  32.6k|    const uint8_t* const l_end_safe_1x = (sz_lit > pak_margin_1x) ? l_end - pak_margin_1x : l_ptr;
  ------------------
  |  Branch (1266:42): [True: 24.0k, False: 8.57k]
  ------------------
 1267|       |
 1268|  32.6k|    uint32_t n_seq = gh.n_sequences;
 1269|       |
 1270|       |    // Same handover as SPL, but the PAK offset is inline in the sequence word and
 1271|       |    // always 16 bits -- enc_off is not a width here, so the span is fixed.
 1272|  32.6k|    const size_t off_span = 1U << 16;
 1273|  32.6k|    const size_t span = (dict_size >= off_span) ? 0 : off_span - dict_size;
  ------------------
  |  Branch (1273:25): [True: 0, False: 32.6k]
  ------------------
 1274|  32.6k|    const uint8_t* const d_bounds = (span >= dst_capacity) ? d_end : dst + span;
  ------------------
  |  Branch (1274:37): [True: 20.4k, False: 12.1k]
  ------------------
 1275|       |
 1276|       |    // --- SAFE loop: validate offsets until d_bounds (4x unroll) ---
 1277|  32.6k|    if (safe) {
  ------------------
  |  Branch (1277:9): [True: 0, False: 32.6k]
  ------------------
 1278|       |        // SAFE variant: save per-batch state so an OVERFLOW can rollback and
 1279|       |        // hand over to the 1x loop / Safe Path. Wild writes already committed
 1280|       |        // are deterministically overwritten when the 1x loop replays.
 1281|      0|        while (n_seq >= 4 && d_ptr < d_end_fast && l_ptr < l_end_safe_4x && d_ptr < d_bounds) {
  ------------------
  |  Branch (1281:16): [True: 0, False: 0]
  |  Branch (1281:30): [True: 0, False: 0]
  |  Branch (1281:52): [True: 0, False: 0]
  |  Branch (1281:77): [True: 0, False: 0]
  ------------------
 1282|      0|            const uint8_t* const t_save = seq_ptr;
 1283|      0|            const uint8_t* const e_save = extras_ptr;
 1284|      0|            uint8_t* const d_save = d_ptr;
 1285|      0|            const uint8_t* const l_save = l_ptr;
 1286|      0|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x, (void)0);
  ------------------
  |  |  706|      0|    do {                                                                                        \
  |  |  707|      0|        uint32_t s1 = zxc_le32(seq_ptr);                                                        \
  |  |  708|      0|        uint32_t s2 = zxc_le32(seq_ptr + sizeof(uint32_t));                                     \
  |  |  709|      0|        uint32_t s3 = zxc_le32(seq_ptr + 2 * sizeof(uint32_t));                                 \
  |  |  710|      0|        uint32_t s4 = zxc_le32(seq_ptr + 3 * sizeof(uint32_t));                                 \
  |  |  711|      0|        seq_ptr += 4 * sizeof(uint32_t);                                                        \
  |  |  712|      0|        PREFETCH;                                                                               \
  |  |  713|      0|        DECODE_PAK_SEQ(                                                                         \
  |  |  ------------------
  |  |  |  |  673|      0|    do {                                                                                     \
  |  |  |  |  674|      0|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|      0|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|      0|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|      0|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|      0|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|      0|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|      0|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|      0|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|      0|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|      0|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|      0|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|      0|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|      0|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|      0|                ON_FAIL;                                                                     \
  |  |  |  |  685|      0|        }                                                                                    \
  |  |  |  |  686|      0|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|      0|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|      0|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|      0|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|      0|                ON_FAIL;                                                                     \
  |  |  |  |  691|      0|        }                                                                                    \
  |  |  |  |  692|      0|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|      0|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|      0|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|      0|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|      0|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|      0|        l_ptr += ll;                                                                         \
  |  |  |  |  696|      0|        d_ptr += ll;                                                                         \
  |  |  |  |  697|      0|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1286|      0|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|      0|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|      0|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|      0|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|      0|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  714|      0|            s1, (s2 >> ZXC_SEQ_LL_SHIFT) + (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), \
  |  |  715|      0|            3U, DECODE, ON_FAIL);                                                               \
  |  |  716|      0|        DECODE_PAK_SEQ(s2, (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), 2U, DECODE,     \
  |  |  ------------------
  |  |  |  |  673|      0|    do {                                                                                     \
  |  |  |  |  674|      0|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|      0|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|      0|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|      0|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|      0|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|      0|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|      0|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|      0|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|      0|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|      0|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|      0|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|      0|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|      0|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|      0|                ON_FAIL;                                                                     \
  |  |  |  |  685|      0|        }                                                                                    \
  |  |  |  |  686|      0|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|      0|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|      0|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|      0|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|      0|                ON_FAIL;                                                                     \
  |  |  |  |  691|      0|        }                                                                                    \
  |  |  |  |  692|      0|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|      0|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|      0|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|      0|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|      0|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|      0|        l_ptr += ll;                                                                         \
  |  |  |  |  696|      0|        d_ptr += ll;                                                                         \
  |  |  |  |  697|      0|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1286|      0|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|      0|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|      0|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|      0|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|      0|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  717|      0|                       ON_FAIL);                                                                \
  |  |  718|      0|        DECODE_PAK_SEQ(s3, (s4 >> ZXC_SEQ_LL_SHIFT), 1U, DECODE, ON_FAIL);                      \
  |  |  ------------------
  |  |  |  |  673|      0|    do {                                                                                     \
  |  |  |  |  674|      0|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|      0|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|      0|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|      0|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|      0|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|      0|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|      0|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|      0|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|      0|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|      0|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|      0|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|      0|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|      0|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|      0|                ON_FAIL;                                                                     \
  |  |  |  |  685|      0|        }                                                                                    \
  |  |  |  |  686|      0|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|      0|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|      0|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|      0|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|      0|                ON_FAIL;                                                                     \
  |  |  |  |  691|      0|        }                                                                                    \
  |  |  |  |  692|      0|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|      0|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|      0|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|      0|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|      0|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|      0|        l_ptr += ll;                                                                         \
  |  |  |  |  696|      0|        d_ptr += ll;                                                                         \
  |  |  |  |  697|      0|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1286|      0|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|      0|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|      0|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|      0|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|      0|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  719|      0|        DECODE_PAK_SEQ(s4, 0, 0U, DECODE, ON_FAIL);                                             \
  |  |  ------------------
  |  |  |  |  673|      0|    do {                                                                                     \
  |  |  |  |  674|      0|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|      0|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|      0|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|      0|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|      0|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|      0|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|      0|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|      0|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|      0|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|      0|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|      0|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|      0|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|      0|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|      0|                ON_FAIL;                                                                     \
  |  |  |  |  685|      0|        }                                                                                    \
  |  |  |  |  686|      0|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|      0|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|      0|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|      0|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|      0|                ON_FAIL;                                                                     \
  |  |  |  |  691|      0|        }                                                                                    \
  |  |  |  |  692|      0|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|      0|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|      0|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|      0|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|      0|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|      0|        l_ptr += ll;                                                                         \
  |  |  |  |  696|      0|        d_ptr += ll;                                                                         \
  |  |  |  |  697|      0|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1286|      0|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|      0|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|      0|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|      0|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|      0|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  720|      0|        n_seq -= 4;                                                                             \
  |  |  721|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (721:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1287|      0|            continue;
 1288|       |
 1289|      0|        rollback_safe_4x:
 1290|      0|            seq_ptr = t_save;
 1291|      0|            extras_ptr = e_save;
 1292|      0|            d_ptr = d_save;
 1293|      0|            l_ptr = l_save;
 1294|      0|            break;
 1295|      0|        }
 1296|  32.6k|    } else {
 1297|   329k|        while (n_seq >= 4 && d_ptr < d_end_fast && l_ptr < l_end_safe_4x && d_ptr < d_bounds) {
  ------------------
  |  Branch (1297:16): [True: 319k, False: 9.78k]
  |  Branch (1297:30): [True: 319k, False: 18.4E]
  |  Branch (1297:52): [True: 298k, False: 20.8k]
  |  Branch (1297:77): [True: 296k, False: 2.05k]
  ------------------
 1298|   296k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW, (void)0);
  ------------------
  |  |  706|   296k|    do {                                                                                        \
  |  |  707|   296k|        uint32_t s1 = zxc_le32(seq_ptr);                                                        \
  |  |  708|   296k|        uint32_t s2 = zxc_le32(seq_ptr + sizeof(uint32_t));                                     \
  |  |  709|   296k|        uint32_t s3 = zxc_le32(seq_ptr + 2 * sizeof(uint32_t));                                 \
  |  |  710|   296k|        uint32_t s4 = zxc_le32(seq_ptr + 3 * sizeof(uint32_t));                                 \
  |  |  711|   296k|        seq_ptr += 4 * sizeof(uint32_t);                                                        \
  |  |  712|   296k|        PREFETCH;                                                                               \
  |  |  713|   296k|        DECODE_PAK_SEQ(                                                                         \
  |  |  ------------------
  |  |  |  |  673|   296k|    do {                                                                                     \
  |  |  |  |  674|   296k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|   296k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   296k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   296k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|   296k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|   296k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   296k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   296k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   296k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|   296k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   296k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|   296k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   296k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 10.4k, False: 286k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  10.4k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  10.4k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  10.4k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  10.4k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  20.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 10.4k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 10.4k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 10.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  10.4k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  10.4k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  10.4k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  10.4k|        }                                                                                    \
  |  |  |  |  686|   296k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   296k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 9.29k, False: 287k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  9.29k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  9.29k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  9.29k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 9.29k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  9.29k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  9.29k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  9.29k|        }                                                                                    \
  |  |  |  |  692|   296k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|   296k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   296k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|   296k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|   296k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|   296k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|   296k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|   296k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|   296k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1298|   296k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   296k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   296k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   296k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 296k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   296k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   296k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   296k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 296k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|   296k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 296k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  714|   296k|            s1, (s2 >> ZXC_SEQ_LL_SHIFT) + (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), \
  |  |  715|   296k|            3U, DECODE, ON_FAIL);                                                               \
  |  |  716|   296k|        DECODE_PAK_SEQ(s2, (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), 2U, DECODE,     \
  |  |  ------------------
  |  |  |  |  673|   296k|    do {                                                                                     \
  |  |  |  |  674|   296k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|   296k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   296k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   296k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|   296k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|   296k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   296k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   296k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   296k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|   296k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   296k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|   296k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   296k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 7.66k, False: 288k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  7.66k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  7.66k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  7.66k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  7.66k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  15.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 7.66k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 2, False: 7.66k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 7.66k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  7.66k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  7.66k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  7.66k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  7.66k|        }                                                                                    \
  |  |  |  |  686|   296k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   296k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 8.37k, False: 288k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  8.37k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  8.37k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  8.37k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 8.37k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  8.37k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  8.37k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  8.37k|        }                                                                                    \
  |  |  |  |  692|   296k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|   296k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   296k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|   296k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|   296k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|   296k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|   296k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|   296k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|   296k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1298|   296k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   296k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   296k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   296k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 296k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   296k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   296k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   296k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 296k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|   296k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 296k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  717|   296k|                       ON_FAIL);                                                                \
  |  |  718|   296k|        DECODE_PAK_SEQ(s3, (s4 >> ZXC_SEQ_LL_SHIFT), 1U, DECODE, ON_FAIL);                      \
  |  |  ------------------
  |  |  |  |  673|   296k|    do {                                                                                     \
  |  |  |  |  674|   296k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|   296k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   296k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   296k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|   296k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|   296k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   296k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   296k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   296k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|   296k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   296k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|   296k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   296k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 7.03k, False: 289k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  7.03k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  7.03k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  7.03k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  7.03k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  14.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 7.03k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 1, False: 7.03k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 7.03k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  7.03k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  7.03k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  7.03k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  7.03k|        }                                                                                    \
  |  |  |  |  686|   296k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   296k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 8.57k, False: 287k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  8.57k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  8.57k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  8.57k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 8.57k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  8.57k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  8.57k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  8.57k|        }                                                                                    \
  |  |  |  |  692|   296k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|   296k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   296k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|   296k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|   296k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|   296k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|   296k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|   296k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|   296k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1298|   296k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   296k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   296k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   296k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 296k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   296k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   296k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   296k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 296k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|   296k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 296k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  719|   296k|        DECODE_PAK_SEQ(s4, 0, 0U, DECODE, ON_FAIL);                                             \
  |  |  ------------------
  |  |  |  |  673|   296k|    do {                                                                                     \
  |  |  |  |  674|   296k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|   296k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   296k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   296k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|   296k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|   296k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   296k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   296k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   296k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|   296k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   296k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|   296k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   296k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 7.20k, False: 289k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  7.20k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  7.20k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  7.20k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  7.20k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  14.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 7.20k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 2, False: 7.20k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 7.20k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  7.20k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  7.20k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  7.20k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  7.20k|        }                                                                                    \
  |  |  |  |  686|   296k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   296k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 8.63k, False: 287k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  8.63k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  8.63k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  8.63k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 8.63k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  8.63k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  8.63k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  8.63k|        }                                                                                    \
  |  |  |  |  692|   296k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|   296k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   296k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|   296k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|   296k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|   296k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|   296k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|   296k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|   296k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1298|   296k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   296k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   296k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   296k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 296k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   296k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   296k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   296k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 296k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|   296k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 296k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  720|   296k|        n_seq -= 4;                                                                             \
  |  |  721|   296k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (721:14): [Folded, False: 296k]
  |  |  ------------------
  ------------------
 1299|   296k|        }
 1300|  32.6k|    }
 1301|       |
 1302|       |    // --- SAFE Loop tail: remaining sequences with offset validation (1x) ---
 1303|   810k|    while (n_seq > 0 && d_ptr < d_end_safe && d_ptr < d_bounds) {
  ------------------
  |  Branch (1303:12): [True: 786k, False: 24.3k]
  |  Branch (1303:25): [True: 786k, False: 3]
  |  Branch (1303:47): [True: 778k, False: 8.26k]
  ------------------
 1304|   778k|        uint32_t seq = zxc_le32(seq_ptr);
 1305|   778k|        seq_ptr += sizeof(uint32_t);
 1306|       |
 1307|   778k|        uint64_t ll = seq >> ZXC_SEQ_LL_SHIFT;
  ------------------
  |  |  545|   778k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  535|   778k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  537|   778k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
 1308|   778k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) ll += zxc_read_varint(&extras_ptr, extras_end);
  ------------------
  |  |  152|   778k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 9.65k, False: 768k]
  |  |  ------------------
  ------------------
 1309|       |
 1310|   778k|        uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  547|   778k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  ------------------
  |  |  |  |  537|   778k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  541|   778k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  535|   778k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  ------------------
 1311|   778k|        uint64_t ml = m_bits + ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  586|   778k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1312|   778k|        if (UNLIKELY(m_bits == ZXC_SEQ_ML_MASK)) ml += zxc_read_varint(&extras_ptr, extras_end);
  ------------------
  |  |  152|   778k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 28.6k, False: 749k]
  |  |  ------------------
  ------------------
 1313|       |
 1314|   778k|        uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  543|   778k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  ------------------
  |  |  |  |  537|   778k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  724|   778k|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1315|       |
 1316|       |        // Strict bounds check: sequence must fit, AND wild copies must not overshoot
 1317|       |        // Check both destination (d_ptr) and source literal stream (l_ptr)
 1318|   778k|        if (UNLIKELY(ll + ml + ZXC_PAD_SIZE > (size_t)(d_end - d_ptr) ||
  ------------------
  |  |  152|  1.55M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 147k, False: 631k]
  |  |  |  Branch (152:42): [True: 1.06k, False: 777k]
  |  |  |  Branch (152:42): [True: 142k, False: 635k]
  |  |  ------------------
  ------------------
 1319|   778k|                     ll + ZXC_PAD_SIZE > (size_t)(l_end - l_ptr))) {
 1320|       |            // Fallback to exact copy (slow but safe)
 1321|   147k|            if (UNLIKELY(ll + ml > (size_t)(d_end - d_ptr) || ll > (size_t)(l_end - l_ptr)))
  ------------------
  |  |  152|   294k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 147k]
  |  |  |  Branch (152:42): [True: 1, False: 147k]
  |  |  |  Branch (152:42): [True: 18.4E, False: 147k]
  |  |  ------------------
  ------------------
 1322|      0|                return ZXC_ERROR_OVERFLOW;
 1323|   147k|            ZXC_MEMCPY(d_ptr, l_ptr, ll);
  ------------------
  |  |  168|   147k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1324|   147k|            l_ptr += ll;
 1325|   147k|            d_ptr += ll;
 1326|       |
 1327|   147k|            if (UNLIKELY((size_t)(d_ptr - d_floor) < offset)) return ZXC_ERROR_BAD_OFFSET;
  ------------------
  |  |  152|   147k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 147k]
  |  |  ------------------
  ------------------
 1328|   147k|            const uint8_t* match_src = d_ptr - offset;
 1329|       |
 1330|   147k|            zxc_decode_copy_match_exact(d_ptr, match_src, offset, ml);
 1331|   147k|            d_ptr += ml;
 1332|   631k|        } else {
 1333|   631k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);
 1334|   631k|            l_ptr += ll;
 1335|   631k|            d_ptr += ll;
 1336|   631k|            DECODE_MATCH_SAFE(ml, offset, zxc_decode_copy_match);
  ------------------
  |  |  552|   631k|    do {                                                                              \
  |  |  553|   631k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  ------------------
  |  |  |  |  152|   631k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (152:21): [True: 0, False: 631k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  554|   631k|        COPY(d_ptr, off, ml);                                                         \
  |  |  555|   631k|        d_ptr += ml;                                                                  \
  |  |  556|   631k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (556:14): [Folded, False: 631k]
  |  |  ------------------
  ------------------
 1337|   631k|        }
 1338|   778k|        n_seq--;
 1339|   778k|    }
 1340|       |
 1341|       |    // --- FAST Loop: After threshold, check large margin to avoid individual bounds checks ---
 1342|  32.6k|    if (safe) {
  ------------------
  |  Branch (1342:9): [True: 0, False: 32.6k]
  ------------------
 1343|      0|        while (n_seq >= 4 && d_ptr < d_end_fast && l_ptr < l_end_safe_4x) {
  ------------------
  |  Branch (1343:16): [True: 0, False: 0]
  |  Branch (1343:30): [True: 0, False: 0]
  |  Branch (1343:52): [True: 0, False: 0]
  ------------------
 1344|      0|            const uint8_t* const t_save = seq_ptr;
 1345|      0|            const uint8_t* const e_save = extras_ptr;
 1346|      0|            uint8_t* const d_save = d_ptr;
 1347|      0|            const uint8_t* const l_save = l_ptr;
 1348|      0|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x,
  ------------------
  |  |  706|      0|    do {                                                                                        \
  |  |  707|      0|        uint32_t s1 = zxc_le32(seq_ptr);                                                        \
  |  |  708|      0|        uint32_t s2 = zxc_le32(seq_ptr + sizeof(uint32_t));                                     \
  |  |  709|      0|        uint32_t s3 = zxc_le32(seq_ptr + 2 * sizeof(uint32_t));                                 \
  |  |  710|      0|        uint32_t s4 = zxc_le32(seq_ptr + 3 * sizeof(uint32_t));                                 \
  |  |  711|      0|        seq_ptr += 4 * sizeof(uint32_t);                                                        \
  |  |  712|      0|        PREFETCH;                                                                               \
  |  |  713|      0|        DECODE_PAK_SEQ(                                                                         \
  |  |  ------------------
  |  |  |  |  673|      0|    do {                                                                                     \
  |  |  |  |  674|      0|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|      0|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|      0|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|      0|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|      0|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|      0|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|      0|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|      0|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|      0|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|      0|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|      0|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|      0|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|      0|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|      0|                ON_FAIL;                                                                     \
  |  |  |  |  685|      0|        }                                                                                    \
  |  |  |  |  686|      0|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|      0|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|      0|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|      0|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|      0|                ON_FAIL;                                                                     \
  |  |  |  |  691|      0|        }                                                                                    \
  |  |  |  |  692|      0|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|      0|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|      0|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|      0|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|      0|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|      0|        l_ptr += ll;                                                                         \
  |  |  |  |  696|      0|        d_ptr += ll;                                                                         \
  |  |  |  |  697|      0|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1348|      0|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|      0|    do {                                 \
  |  |  |  |  |  |  |  |  562|      0|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|      0|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  714|      0|            s1, (s2 >> ZXC_SEQ_LL_SHIFT) + (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), \
  |  |  715|      0|            3U, DECODE, ON_FAIL);                                                               \
  |  |  716|      0|        DECODE_PAK_SEQ(s2, (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), 2U, DECODE,     \
  |  |  ------------------
  |  |  |  |  673|      0|    do {                                                                                     \
  |  |  |  |  674|      0|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|      0|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|      0|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|      0|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|      0|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|      0|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|      0|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|      0|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|      0|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|      0|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|      0|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|      0|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|      0|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|      0|                ON_FAIL;                                                                     \
  |  |  |  |  685|      0|        }                                                                                    \
  |  |  |  |  686|      0|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|      0|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|      0|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|      0|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|      0|                ON_FAIL;                                                                     \
  |  |  |  |  691|      0|        }                                                                                    \
  |  |  |  |  692|      0|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|      0|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|      0|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|      0|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|      0|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|      0|        l_ptr += ll;                                                                         \
  |  |  |  |  696|      0|        d_ptr += ll;                                                                         \
  |  |  |  |  697|      0|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1348|      0|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|      0|    do {                                 \
  |  |  |  |  |  |  |  |  562|      0|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|      0|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  717|      0|                       ON_FAIL);                                                                \
  |  |  718|      0|        DECODE_PAK_SEQ(s3, (s4 >> ZXC_SEQ_LL_SHIFT), 1U, DECODE, ON_FAIL);                      \
  |  |  ------------------
  |  |  |  |  673|      0|    do {                                                                                     \
  |  |  |  |  674|      0|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|      0|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|      0|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|      0|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|      0|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|      0|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|      0|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|      0|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|      0|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|      0|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|      0|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|      0|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|      0|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|      0|                ON_FAIL;                                                                     \
  |  |  |  |  685|      0|        }                                                                                    \
  |  |  |  |  686|      0|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|      0|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|      0|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|      0|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|      0|                ON_FAIL;                                                                     \
  |  |  |  |  691|      0|        }                                                                                    \
  |  |  |  |  692|      0|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|      0|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|      0|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|      0|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|      0|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|      0|        l_ptr += ll;                                                                         \
  |  |  |  |  696|      0|        d_ptr += ll;                                                                         \
  |  |  |  |  697|      0|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1348|      0|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|      0|    do {                                 \
  |  |  |  |  |  |  |  |  562|      0|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|      0|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  719|      0|        DECODE_PAK_SEQ(s4, 0, 0U, DECODE, ON_FAIL);                                             \
  |  |  ------------------
  |  |  |  |  673|      0|    do {                                                                                     \
  |  |  |  |  674|      0|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|      0|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|      0|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|      0|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|      0|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|      0|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|      0|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|      0|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|      0|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|      0|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|      0|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|      0|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|      0|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|      0|                ON_FAIL;                                                                     \
  |  |  |  |  685|      0|        }                                                                                    \
  |  |  |  |  686|      0|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|      0|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|      0|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|      0|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|      0|                ON_FAIL;                                                                     \
  |  |  |  |  691|      0|        }                                                                                    \
  |  |  |  |  692|      0|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|      0|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|      0|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|      0|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|      0|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|      0|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|      0|        l_ptr += ll;                                                                         \
  |  |  |  |  696|      0|        d_ptr += ll;                                                                         \
  |  |  |  |  697|      0|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1348|      0|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|      0|    do {                                 \
  |  |  |  |  |  |  |  |  562|      0|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|      0|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|      0|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  720|      0|        n_seq -= 4;                                                                             \
  |  |  721|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (721:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1349|      0|                                ZXC_PREFETCH_READ(l_ptr + ZXC_CACHE_LINE_SIZE));
 1350|      0|            continue;
 1351|       |
 1352|      0|        rollback_fast_4x:
 1353|      0|            seq_ptr = t_save;
 1354|      0|            extras_ptr = e_save;
 1355|      0|            d_ptr = d_save;
 1356|      0|            l_ptr = l_save;
 1357|      0|            break;
 1358|      0|        }
 1359|  32.6k|    } else {
 1360|   170k|        while (n_seq >= 4 && d_ptr < d_end_fast && l_ptr < l_end_safe_4x) {
  ------------------
  |  Branch (1360:16): [True: 143k, False: 26.7k]
  |  Branch (1360:30): [True: 143k, False: 18.4E]
  |  Branch (1360:52): [True: 137k, False: 5.93k]
  ------------------
 1361|   137k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW,
  ------------------
  |  |  706|   137k|    do {                                                                                        \
  |  |  707|   137k|        uint32_t s1 = zxc_le32(seq_ptr);                                                        \
  |  |  708|   137k|        uint32_t s2 = zxc_le32(seq_ptr + sizeof(uint32_t));                                     \
  |  |  709|   137k|        uint32_t s3 = zxc_le32(seq_ptr + 2 * sizeof(uint32_t));                                 \
  |  |  710|   137k|        uint32_t s4 = zxc_le32(seq_ptr + 3 * sizeof(uint32_t));                                 \
  |  |  711|   137k|        seq_ptr += 4 * sizeof(uint32_t);                                                        \
  |  |  712|   137k|        PREFETCH;                                                                               \
  |  |  713|   137k|        DECODE_PAK_SEQ(                                                                         \
  |  |  ------------------
  |  |  |  |  673|   137k|    do {                                                                                     \
  |  |  |  |  674|   137k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|   137k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   137k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   137k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|   137k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|   137k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   137k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   137k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   137k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|   137k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   137k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|   137k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   137k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 3.35k, False: 134k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  3.35k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  3.35k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  3.35k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  3.35k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  6.70k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 3.35k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 2, False: 3.35k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 3.35k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  3.35k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  3.35k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  3.35k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  3.35k|        }                                                                                    \
  |  |  |  |  686|   137k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   137k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 4.20k, False: 133k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  4.20k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  4.20k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  4.20k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 4.20k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  4.20k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  4.20k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  4.20k|        }                                                                                    \
  |  |  |  |  692|   137k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|   137k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   137k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|   137k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|   137k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|   137k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|   137k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|   137k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|   137k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1361|   137k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|   137k|    do {                                 \
  |  |  |  |  |  |  |  |  562|   137k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|   137k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|   137k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 137k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|   137k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 137k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  714|   137k|            s1, (s2 >> ZXC_SEQ_LL_SHIFT) + (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), \
  |  |  715|   137k|            3U, DECODE, ON_FAIL);                                                               \
  |  |  716|   137k|        DECODE_PAK_SEQ(s2, (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), 2U, DECODE,     \
  |  |  ------------------
  |  |  |  |  673|   137k|    do {                                                                                     \
  |  |  |  |  674|   137k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|   137k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   137k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   137k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|   137k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|   137k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   137k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   137k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   137k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|   137k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   137k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|   137k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   137k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 3.13k, False: 134k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  3.13k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  3.13k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  3.13k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  3.13k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  6.26k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 3.13k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 1, False: 3.13k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 3.13k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  3.13k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  3.13k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  3.13k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  3.13k|        }                                                                                    \
  |  |  |  |  686|   137k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   137k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 4.25k, False: 133k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  4.25k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  4.25k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  4.25k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 4.25k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  4.25k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  4.25k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  4.25k|        }                                                                                    \
  |  |  |  |  692|   137k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|   137k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   137k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|   137k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|   137k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|   137k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|   137k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|   137k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|   137k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1361|   137k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|   137k|    do {                                 \
  |  |  |  |  |  |  |  |  562|   137k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|   137k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|   137k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 137k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|   137k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 137k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  717|   137k|                       ON_FAIL);                                                                \
  |  |  718|   137k|        DECODE_PAK_SEQ(s3, (s4 >> ZXC_SEQ_LL_SHIFT), 1U, DECODE, ON_FAIL);                      \
  |  |  ------------------
  |  |  |  |  673|   137k|    do {                                                                                     \
  |  |  |  |  674|   137k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|   137k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   137k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   137k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|   137k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|   137k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   137k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   137k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   137k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|   137k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   137k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|   137k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   137k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 3.22k, False: 134k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  3.22k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  3.22k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  3.22k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  3.22k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  6.44k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 3.22k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 1, False: 3.22k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 3.22k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  3.22k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  3.22k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  3.22k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  3.22k|        }                                                                                    \
  |  |  |  |  686|   137k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   137k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 4.28k, False: 133k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  4.28k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  4.28k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  4.28k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 4.28k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  4.28k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  4.28k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  4.28k|        }                                                                                    \
  |  |  |  |  692|   137k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|   137k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   137k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|   137k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|   137k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|   137k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|   137k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|   137k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|   137k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1361|   137k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|   137k|    do {                                 \
  |  |  |  |  |  |  |  |  562|   137k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|   137k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|   137k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 137k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|   137k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 137k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  719|   137k|        DECODE_PAK_SEQ(s4, 0, 0U, DECODE, ON_FAIL);                                             \
  |  |  ------------------
  |  |  |  |  673|   137k|    do {                                                                                     \
  |  |  |  |  674|   137k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|   137k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   137k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   137k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|   137k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|   137k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   137k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   137k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   137k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|   137k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   137k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|   137k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   137k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 3.24k, False: 134k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  3.24k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  3.24k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  3.24k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  3.24k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  6.48k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 3.24k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 2, False: 3.23k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 3.23k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  3.24k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  3.24k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  3.24k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  3.24k|        }                                                                                    \
  |  |  |  |  686|   137k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   137k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 4.22k, False: 133k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  4.22k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  4.22k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  4.22k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 0, False: 4.22k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  4.22k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  4.22k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  4.22k|        }                                                                                    \
  |  |  |  |  692|   137k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|   137k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   137k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|   137k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|   137k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|   137k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|   137k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|   137k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|   137k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1361|   137k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|   137k|    do {                                 \
  |  |  |  |  |  |  |  |  562|   137k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|   137k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|   137k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 137k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|   137k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 137k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  720|   137k|        n_seq -= 4;                                                                             \
  |  |  721|   137k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (721:14): [Folded, False: 137k]
  |  |  ------------------
  ------------------
 1362|   137k|                                ZXC_PREFETCH_READ(l_ptr + ZXC_CACHE_LINE_SIZE));
 1363|   137k|        }
 1364|  32.6k|    }
 1365|       |
 1366|       |    // --- Remaining 1 sequence (Fast Path) ---
 1367|   129k|    while (n_seq > 0 && d_ptr < d_end_safe && l_ptr < l_end_safe_1x) {
  ------------------
  |  Branch (1367:12): [True: 103k, False: 25.1k]
  |  Branch (1367:25): [True: 103k, False: 0]
  |  Branch (1367:47): [True: 98.0k, False: 5.84k]
  ------------------
 1368|       |        // Save state for fallback
 1369|  98.0k|        const uint8_t* seq_save = seq_ptr;
 1370|  98.0k|        const uint8_t* ext_save = extras_ptr;
 1371|       |
 1372|  98.0k|        const uint32_t seq = zxc_le32(seq_ptr);
 1373|  98.0k|        seq_ptr += sizeof(uint32_t);
 1374|       |
 1375|  98.0k|        uint64_t ll = seq >> ZXC_SEQ_LL_SHIFT;
  ------------------
  |  |  545|  98.0k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  535|  98.0k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  537|  98.0k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
 1376|  98.0k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {
  ------------------
  |  |  152|  98.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 3.23k, False: 94.7k]
  |  |  ------------------
  ------------------
 1377|  3.23k|            ll += zxc_read_varint(&extras_ptr, extras_end);
 1378|  3.23k|            if (UNLIKELY(ll > (size_t)(l_end - l_ptr))) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  152|  3.23k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 3.23k]
  |  |  ------------------
  ------------------
 1379|  3.23k|        }
 1380|       |
 1381|  98.0k|        uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  547|  98.0k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  ------------------
  |  |  |  |  537|  98.0k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  541|  98.0k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  535|  98.0k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  ------------------
 1382|  98.0k|        uint64_t ml = m_bits + ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  586|  98.0k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1383|  98.0k|        if (UNLIKELY(m_bits == ZXC_SEQ_ML_MASK)) ml += zxc_read_varint(&extras_ptr, extras_end);
  ------------------
  |  |  152|  98.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 6.08k, False: 91.9k]
  |  |  ------------------
  ------------------
 1384|       |
 1385|       |        // Strict bounds checks (including wild copy overrun safety)
 1386|  98.0k|        if (UNLIKELY(ll + ml + ZXC_PAD_SIZE > (size_t)(d_end - d_ptr) ||
  ------------------
  |  |  152|   196k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 1.65k, False: 96.3k]
  |  |  |  Branch (152:42): [True: 18.4E, False: 98.0k]
  |  |  |  Branch (152:42): [True: 1.64k, False: 96.3k]
  |  |  ------------------
  ------------------
 1387|  98.0k|                     ll + ZXC_PAD_SIZE > (size_t)(l_end - l_ptr))) {
 1388|  1.65k|            seq_ptr = seq_save;
 1389|  1.65k|            extras_ptr = ext_save;
 1390|  1.65k|            break;
 1391|  1.65k|        }
 1392|  96.3k|        uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  543|  96.3k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  ------------------
  |  |  |  |  537|  96.3k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  724|  96.3k|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1393|       |
 1394|  96.3k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);
 1395|  96.3k|        l_ptr += ll;
 1396|  96.3k|        d_ptr += ll;
 1397|       |
 1398|  96.3k|        if (UNLIKELY(d_ptr < d_bounds && (size_t)(d_ptr - d_floor) < offset))
  ------------------
  |  |  152|  96.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 96.3k]
  |  |  |  Branch (152:42): [True: 0, False: 96.3k]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1399|      0|            return ZXC_ERROR_BAD_OFFSET;
 1400|       |
 1401|       |        // The loop entry check guarantees ll + ml + ZXC_PAD_SIZE bytes of
 1402|       |        // headroom, so the wild-copy ladder (incl. overlap/fill runs) is safe.
 1403|  96.3k|        zxc_decode_copy_match(d_ptr, offset, ml);
 1404|  96.3k|        d_ptr += ml;
 1405|  96.3k|        n_seq--;
 1406|  96.3k|    }
 1407|       |
 1408|       |    // --- Safe Path for Remaining Sequences ---
 1409|   148k|    while (n_seq > 0) {
  ------------------
  |  Branch (1409:12): [True: 115k, False: 32.6k]
  ------------------
 1410|   115k|        uint32_t seq = zxc_le32(seq_ptr);
 1411|   115k|        seq_ptr += sizeof(uint32_t);
 1412|       |
 1413|   115k|        uint64_t ll = seq >> ZXC_SEQ_LL_SHIFT;
  ------------------
  |  |  545|   115k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  535|   115k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  537|   115k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
 1414|   115k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) ll += zxc_read_varint(&extras_ptr, extras_end);
  ------------------
  |  |  152|   115k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 1.67k, False: 114k]
  |  |  ------------------
  ------------------
 1415|       |
 1416|   115k|        uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  547|   115k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  ------------------
  |  |  |  |  537|   115k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  541|   115k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  535|   115k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  ------------------
 1417|   115k|        uint64_t ml = m_bits + ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  586|   115k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1418|   115k|        if (UNLIKELY(m_bits == ZXC_SEQ_ML_MASK)) ml += zxc_read_varint(&extras_ptr, extras_end);
  ------------------
  |  |  152|   115k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 17.3k, False: 98.3k]
  |  |  ------------------
  ------------------
 1419|   115k|        uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  543|   115k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  ------------------
  |  |  |  |  537|   115k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  724|   115k|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1420|       |
 1421|   115k|        if (UNLIKELY(ll + ml > (size_t)(d_end - d_ptr) || ll > (size_t)(l_end - l_ptr)))
  ------------------
  |  |  152|   231k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 115k]
  |  |  |  Branch (152:42): [True: 71, False: 115k]
  |  |  |  Branch (152:42): [True: 18.4E, False: 115k]
  |  |  ------------------
  ------------------
 1422|      0|            return ZXC_ERROR_OVERFLOW;
 1423|   115k|        ZXC_MEMCPY(d_ptr, l_ptr, ll);
  ------------------
  |  |  168|   115k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1424|   115k|        l_ptr += ll;
 1425|   115k|        d_ptr += ll;
 1426|       |
 1427|   115k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < offset)) return ZXC_ERROR_BAD_OFFSET;
  ------------------
  |  |  152|   115k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 115k]
  |  |  ------------------
  ------------------
 1428|   115k|        const uint8_t* match_src = d_ptr - offset;
 1429|       |
 1430|   115k|        zxc_decode_copy_match_exact(d_ptr, match_src, offset, ml);
 1431|   115k|        d_ptr += ml;
 1432|   115k|        n_seq--;
 1433|   115k|    }
 1434|       |
 1435|       |    // --- Trailing Literals ---
 1436|       |    // Copy remaining literals from source stream (literal exhaustion)
 1437|  32.6k|    if (UNLIKELY(l_ptr > l_end)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  32.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 32.6k]
  |  |  ------------------
  ------------------
 1438|  32.6k|    if (UNLIKELY(d_ptr > d_end)) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  152|  32.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 32.6k]
  |  |  ------------------
  ------------------
 1439|       |
 1440|  32.6k|    const size_t remaining_literals = (size_t)(l_end - l_ptr);
 1441|  32.6k|    if (UNLIKELY(remaining_literals > (size_t)(d_end - d_ptr))) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  152|  32.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 32.6k]
  |  |  ------------------
  ------------------
 1442|  32.6k|    ZXC_MEMCPY(d_ptr, l_ptr, remaining_literals);
  ------------------
  |  |  168|  32.6k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1443|  32.6k|    d_ptr += remaining_literals;
 1444|       |
 1445|  32.6k|    return (int)(d_ptr - dst);
 1446|  32.6k|}
zxc_decompress.c:zxc_decode_block_pak_dict:
 1555|  20.6k|                                                  const size_t dst_capacity) {
 1556|  20.6k|    return zxc_decode_block_pak_impl(ctx, src, src_size, dst, dst_capacity, 0, 1);
 1557|  20.6k|}
zxc_decompress.c:zxc_decode_block_pak:
 1511|  11.9k|                                const size_t dst_capacity) {
 1512|  11.9k|    return zxc_decode_block_pak_impl(ctx, src, src_size, dst, dst_capacity, 0, 0);
 1513|  11.9k|}

zxc_common.c:zxc_aligned_malloc:
  113|  67.3k|static inline void* zxc_aligned_malloc(const size_t size, const size_t alignment) {
  114|       |#if defined(_WIN32)
  115|       |    return _aligned_malloc(size, alignment);
  116|       |#else
  117|  67.3k|    void* ptr = NULL;
  118|  67.3k|    if (posix_memalign(&ptr, alignment, size) != 0) return NULL;
  ------------------
  |  Branch (118:9): [True: 0, False: 67.3k]
  ------------------
  119|  67.3k|    return ptr;
  120|  67.3k|#endif
  121|  67.3k|}
zxc_common.c:zxc_aligned_free:
  124|  67.4k|static inline void zxc_aligned_free(void* ptr) {
  125|       |#if defined(_WIN32)
  126|       |    _aligned_free(ptr);
  127|       |#else
  128|  67.4k|    free(ptr);
  129|  67.4k|#endif
  130|  67.4k|}
zxc_driver.c:zxc_aligned_malloc:
  113|  36.7k|static inline void* zxc_aligned_malloc(const size_t size, const size_t alignment) {
  114|       |#if defined(_WIN32)
  115|       |    return _aligned_malloc(size, alignment);
  116|       |#else
  117|  36.7k|    void* ptr = NULL;
  118|  36.7k|    if (posix_memalign(&ptr, alignment, size) != 0) return NULL;
  ------------------
  |  Branch (118:9): [True: 0, False: 36.7k]
  ------------------
  119|  36.7k|    return ptr;
  120|  36.7k|#endif
  121|  36.7k|}
zxc_driver.c:zxc_aligned_free:
  124|  36.7k|static inline void zxc_aligned_free(void* ptr) {
  125|       |#if defined(_WIN32)
  126|       |    _aligned_free(ptr);
  127|       |#else
  128|  36.7k|    free(ptr);
  129|  36.7k|#endif
  130|  36.7k|}

zxc_dict_compute_id:
   30|  55.2k|                             const void* RESTRICT huf_lengths) {
   31|  55.2k|    if (UNLIKELY(!dict || dict_size == 0)) return 0;
  ------------------
  |  |  152|  74.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 35.7k, False: 19.4k]
  |  |  |  Branch (152:42): [True: 35.7k, False: 19.4k]
  |  |  |  Branch (152:42): [True: 0, False: 19.4k]
  |  |  ------------------
  ------------------
   32|  19.4k|    const uint32_t base = zxc_checksum(dict, dict_size, 0, ZXC_CHECKSUM_RAPIDHASH);
  ------------------
  |  |  463|  19.4k|#define ZXC_CHECKSUM_RAPIDHASH 0
  ------------------
   33|  19.4k|    if (!huf_lengths) return base;
  ------------------
  |  Branch (33:9): [True: 19.4k, False: 0]
  ------------------
   34|      0|    return zxc_checksum(huf_lengths, ZXC_HUF_TABLE_SIZE, base, ZXC_CHECKSUM_RAPIDHASH);
  ------------------
  |  |  102|      0|#define ZXC_HUF_TABLE_SIZE 128
  ------------------
                  return zxc_checksum(huf_lengths, ZXC_HUF_TABLE_SIZE, base, ZXC_CHECKSUM_RAPIDHASH);
  ------------------
  |  |  463|      0|#define ZXC_CHECKSUM_RAPIDHASH 0
  ------------------
   35|  19.4k|}

zxc_decompress_chunk_wrapper:
  520|   146k|                                 const uint64_t block_index) {
  521|       |    // dict_size is constant for a stream; this per-block branch (outside the decode
  522|       |    // loop) routes to the dict variant only when a dictionary is active, so the
  523|       |    // no-dict path runs the dict-free chunk wrapper (identical codegen to main).
  524|   146k|    const zxc_variant_set_t* v = zxc_variants();
  525|       |#ifdef ZXC_NO_DICT
  526|       |    // dict_size is always 0.
  527|       |    return v->decompress(ctx, src, src_sz, dst, dst_cap, block_index);
  528|       |#else
  529|   146k|    return (ctx->dict_size ? v->decompress_dict : v->decompress)(ctx, src, src_sz, dst, dst_cap,
  ------------------
  |  Branch (529:13): [True: 78.3k, False: 68.0k]
  ------------------
  530|   146k|                                                                 block_index);
  531|   146k|#endif
  532|   146k|}
zxc_compress_chunk_wrapper:
  556|   146k|                               const uint64_t block_index) {
  557|   146k|    return zxc_variants()->compress(ctx, src, src_sz, dst, dst_cap, block_index);
  558|   146k|}
zxc_create_cctx:
 1176|  18.3k|zxc_cctx* zxc_create_cctx(void) {
 1177|  18.3k|    zxc_cctx* const cctx = (zxc_cctx*)ZXC_CALLOC(1, sizeof(zxc_cctx));
  ------------------
  |  |   74|  18.3k|#define ZXC_CALLOC(nmemb, size) calloc(nmemb, size)
  ------------------
 1178|  18.3k|    if (UNLIKELY(!cctx)) return NULL;  // LCOV_EXCL_LINE
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1179|  18.3k|    cctx->params = zxc_cparams_defaults();
 1180|  18.3k|    cctx->init_level = ZXC_LEVEL_DEFAULT;
 1181|  18.3k|    return cctx;
 1182|  18.3k|}
zxc_cctx_params:
 1184|  18.3k|const zxc_cparams_t* zxc_cctx_params(const zxc_cctx* cctx) { return &cctx->params; }
zxc_cparam_bounds:
 1186|   110k|int zxc_cparam_bounds(const zxc_cparam_t param, int64_t* min, int64_t* max) {
 1187|   110k|    int64_t lo, hi;
 1188|   110k|    switch (param) {
 1189|  18.3k|        case ZXC_C_LEVEL:
  ------------------
  |  Branch (1189:9): [True: 18.3k, False: 91.9k]
  ------------------
 1190|  18.3k|            lo = ZXC_LEVEL_FASTEST;
 1191|  18.3k|            hi = ZXC_LEVEL_ULTRA;
 1192|  18.3k|            break;
 1193|  18.3k|        case ZXC_C_BLOCK_SIZE:
  ------------------
  |  Branch (1193:9): [True: 18.3k, False: 91.9k]
  ------------------
 1194|  18.3k|            lo = ZXC_BLOCK_SIZE_MIN;
  ------------------
  |  |   73|  18.3k|#define ZXC_BLOCK_SIZE_MIN (1U << ZXC_BLOCK_SIZE_MIN_LOG2)
  |  |  ------------------
  |  |  |  |   67|  18.3k|#define ZXC_BLOCK_SIZE_MIN_LOG2 12
  |  |  ------------------
  ------------------
 1195|  18.3k|            hi = ZXC_BLOCK_SIZE_MAX;
  ------------------
  |  |   75|  18.3k|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  ------------------
  |  |  |  |   69|  18.3k|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  ------------------
  ------------------
 1196|  18.3k|            break;
 1197|  18.3k|        case ZXC_C_THREADS:
  ------------------
  |  Branch (1197:9): [True: 18.3k, False: 91.9k]
  ------------------
 1198|  18.3k|            lo = 0;
 1199|  18.3k|            hi = ZXC_MAX_THREADS;
  ------------------
  |  |  113|  18.3k|#define ZXC_MAX_THREADS 512
  ------------------
 1200|  18.3k|            break;
 1201|  18.3k|        case ZXC_C_CHECKSUM:
  ------------------
  |  Branch (1201:9): [True: 18.3k, False: 91.9k]
  ------------------
 1202|  36.7k|        case ZXC_C_SEEKABLE:
  ------------------
  |  Branch (1202:9): [True: 18.3k, False: 91.9k]
  ------------------
 1203|  36.7k|            lo = 0;
 1204|  36.7k|            hi = 1;
 1205|  36.7k|            break;
 1206|  18.3k|        case ZXC_C_FAVOR_DECODE_SPEED:
  ------------------
  |  Branch (1206:9): [True: 18.3k, False: 91.9k]
  ------------------
 1207|  18.3k|            lo = 1;
 1208|  18.3k|            hi = ZXC_FAVOR_DECODE_SPEED_MAX;
  ------------------
  |  |   82|  18.3k|#define ZXC_FAVOR_DECODE_SPEED_MAX 100
  ------------------
 1209|  18.3k|            break;
 1210|      0|        default:
  ------------------
  |  Branch (1210:9): [True: 0, False: 110k]
  ------------------
 1211|      0|            return ZXC_ERROR_BAD_PARAM;
 1212|   110k|    }
 1213|   110k|    if (min) *min = lo;
  ------------------
  |  Branch (1213:9): [True: 110k, False: 0]
  ------------------
 1214|   110k|    if (max) *max = hi;
  ------------------
  |  Branch (1214:9): [True: 110k, False: 0]
  ------------------
 1215|   110k|    return ZXC_OK;
 1216|   110k|}
zxc_cctx_set_param:
 1225|   110k|int zxc_cctx_set_param(zxc_cctx* cctx, const zxc_cparam_t param, const int64_t value) {
 1226|   110k|    if (UNLIKELY(!cctx)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  152|   110k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 1227|   110k|    int64_t lo, hi;
 1228|   110k|    const int rc = zxc_cparam_bounds(param, &lo, &hi);
 1229|   110k|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|   110k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 1230|   110k|    if (value != 0 && (value < lo || value > hi)) {
  ------------------
  |  Branch (1230:9): [True: 93.8k, False: 16.5k]
  |  Branch (1230:24): [True: 0, False: 93.8k]
  |  Branch (1230:38): [True: 0, False: 93.8k]
  ------------------
 1231|      0|        if (param == ZXC_C_LEVEL) return ZXC_ERROR_BAD_LEVEL;
  ------------------
  |  Branch (1231:13): [True: 0, False: 0]
  ------------------
 1232|      0|        return param == ZXC_C_BLOCK_SIZE ? ZXC_ERROR_BAD_BLOCK_SIZE : ZXC_ERROR_BAD_PARAM;
  ------------------
  |  Branch (1232:16): [True: 0, False: 0]
  ------------------
 1233|      0|    }
 1234|       |
 1235|   110k|    zxc_cparams_t* const p = &cctx->params;
 1236|   110k|    switch (param) {
 1237|  18.3k|        case ZXC_C_LEVEL: {
  ------------------
  |  Branch (1237:9): [True: 18.3k, False: 91.9k]
  ------------------
 1238|       |            // 0 restores the default: on a static workspace, the pinned level.
 1239|  18.3k|            const int level = value != 0             ? (int)value
  ------------------
  |  Branch (1239:31): [True: 18.3k, False: 0]
  ------------------
 1240|  18.3k|                              : cctx->owns_workspace ? cctx->init_level
  ------------------
  |  Branch (1240:33): [True: 0, False: 0]
  ------------------
 1241|      0|                                                     : ZXC_LEVEL_DEFAULT;
 1242|       |            // A static workspace carved below the optimal-parser tier cannot grow into it.
 1243|  18.3k|            if (UNLIKELY(cctx->owns_workspace && level >= ZXC_LEVEL_DENSITY &&
  ------------------
  |  |  152|  36.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1244|  18.3k|                         !cctx->inner.opt_scratch))
 1245|      0|                return ZXC_ERROR_BAD_LEVEL;
 1246|  18.3k|            p->level = level;
 1247|  18.3k|            break;
 1248|  18.3k|        }
 1249|  18.3k|        case ZXC_C_BLOCK_SIZE: {
  ------------------
  |  Branch (1249:9): [True: 18.3k, False: 91.9k]
  ------------------
 1250|  18.3k|            const size_t block_size = value != 0             ? (size_t)value
  ------------------
  |  Branch (1250:39): [True: 18.3k, False: 0]
  ------------------
 1251|  18.3k|                                      : cctx->owns_workspace ? cctx->last_block_size
  ------------------
  |  Branch (1251:41): [True: 0, False: 0]
  ------------------
 1252|      0|                                                             : ZXC_BLOCK_SIZE_DEFAULT;
  ------------------
  |  |   71|      0|#define ZXC_BLOCK_SIZE_DEFAULT (512 * 1024)
  ------------------
 1253|  18.3k|            if (UNLIKELY(!zxc_validate_block_size(block_size))) return ZXC_ERROR_BAD_BLOCK_SIZE;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1254|  18.3k|            if (UNLIKELY(cctx->owns_workspace && block_size != cctx->last_block_size))
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1255|      0|                return ZXC_ERROR_BAD_BLOCK_SIZE;
 1256|  18.3k|            p->block_size = block_size;
 1257|  18.3k|            break;
 1258|  18.3k|        }
 1259|  18.3k|        case ZXC_C_THREADS:
  ------------------
  |  Branch (1259:9): [True: 18.3k, False: 91.9k]
  ------------------
 1260|  18.3k|            p->n_threads = (int)value;
 1261|  18.3k|            break;
 1262|  18.3k|        case ZXC_C_CHECKSUM:
  ------------------
  |  Branch (1262:9): [True: 18.3k, False: 91.9k]
  ------------------
 1263|  18.3k|            p->checksum_enabled = (int)value;
 1264|  18.3k|            break;
 1265|  18.3k|        case ZXC_C_SEEKABLE:
  ------------------
  |  Branch (1265:9): [True: 18.3k, False: 91.9k]
  ------------------
 1266|  18.3k|            p->seekable = (int)value;
 1267|  18.3k|            break;
 1268|  18.3k|        case ZXC_C_FAVOR_DECODE_SPEED:
  ------------------
  |  Branch (1268:9): [True: 18.3k, False: 91.9k]
  ------------------
 1269|  18.3k|            p->favor_decode_speed = (int)value;
 1270|  18.3k|            break;
 1271|      0|        default:
  ------------------
  |  Branch (1271:9): [True: 0, False: 110k]
  ------------------
 1272|      0|            return ZXC_ERROR_BAD_PARAM;  // LCOV_EXCL_LINE: bounds already refused it
 1273|   110k|    }
 1274|   110k|    return ZXC_OK;
 1275|   110k|}
zxc_cctx_set_dict:
 1306|  18.3k|                      const void* dict_huf) {
 1307|  18.3k|    if (UNLIKELY(!cctx)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1308|       |#ifdef ZXC_NO_DICT
 1309|       |    // No dictionary support: clearing is a no-op.
 1310|       |    if (UNLIKELY(dict && dict_size > 0)) return ZXC_ERROR_DICT_UNSUPPORTED;
 1311|       |#endif
 1312|       |    // No room for the dictionary prefix in a workspace carved without it.
 1313|  18.3k|    if (UNLIKELY(cctx->owns_workspace && dict && dict_size > 0)) return ZXC_ERROR_DICT_UNSUPPORTED;
  ------------------
  |  |  152|  36.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1314|  18.3k|    const int rc = zxc_dict_copy_set(&cctx->dict_copy, dict, dict_size, dict_huf);
 1315|  18.3k|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1316|  18.3k|    cctx->params.dict = cctx->dict_copy.data;
 1317|  18.3k|    cctx->params.dict_size = cctx->dict_copy.size;
 1318|  18.3k|    cctx->params.dict_huf = cctx->dict_copy.has_huf ? cctx->dict_copy.huf : NULL;
  ------------------
  |  Branch (1318:29): [True: 0, False: 18.3k]
  ------------------
 1319|  18.3k|    return ZXC_OK;
 1320|  18.3k|}
zxc_cctx_set_progress:
 1322|  18.3k|int zxc_cctx_set_progress(zxc_cctx* cctx, const zxc_progress_callback_t cb, void* user_data) {
 1323|  18.3k|    if (UNLIKELY(!cctx)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1324|  18.3k|    cctx->params.progress_cb = cb;
 1325|  18.3k|    cctx->params.user_data = cb ? user_data : NULL;
  ------------------
  |  Branch (1325:30): [True: 9.52k, False: 8.87k]
  ------------------
 1326|  18.3k|    return ZXC_OK;
 1327|  18.3k|}
zxc_free_cctx:
 1348|  18.3k|void zxc_free_cctx(zxc_cctx* cctx) {
 1349|  18.3k|    if (UNLIKELY(!cctx)) return;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1350|       |    // Static cctx: handle + inner buffers live inside the caller's workspace,
 1351|       |    // which we do not own. Free is a no-op; the caller owns the workspace.
 1352|  18.3k|    if (cctx->owns_workspace) return;
  ------------------
  |  Branch (1352:9): [True: 0, False: 18.3k]
  ------------------
 1353|  18.3k|    if (cctx->initialized) zxc_cctx_free(&cctx->inner);
  ------------------
  |  Branch (1353:9): [True: 0, False: 18.3k]
  ------------------
 1354|  18.3k|    ZXC_FREE(cctx->dict_copy.data);
  ------------------
  |  |   86|  18.3k|#define ZXC_FREE(ptr) free(ptr)
  ------------------
 1355|  18.3k|    ZXC_FREE(cctx);
  ------------------
  |  |   86|  18.3k|#define ZXC_FREE(ptr) free(ptr)
  ------------------
 1356|  18.3k|}
zxc_create_dctx:
 1517|  36.8k|zxc_dctx* zxc_create_dctx(void) {
 1518|  36.8k|    zxc_dctx* const dctx = (zxc_dctx*)ZXC_CALLOC(1, sizeof(zxc_dctx));
  ------------------
  |  |   74|  36.8k|#define ZXC_CALLOC(nmemb, size) calloc(nmemb, size)
  ------------------
 1519|  36.8k|    return dctx;
 1520|  36.8k|}
zxc_dctx_params:
 1522|  36.8k|const zxc_dparams_t* zxc_dctx_params(const zxc_dctx* dctx) { return &dctx->params; }
zxc_dparam_bounds:
 1524|  73.6k|int zxc_dparam_bounds(const zxc_dparam_t param, int64_t* min, int64_t* max) {
 1525|  73.6k|    int64_t lo, hi;
 1526|  73.6k|    switch (param) {
 1527|  36.8k|        case ZXC_D_THREADS:
  ------------------
  |  Branch (1527:9): [True: 36.8k, False: 36.8k]
  ------------------
 1528|  36.8k|            lo = 0;
 1529|  36.8k|            hi = ZXC_MAX_THREADS;
  ------------------
  |  |  113|  36.8k|#define ZXC_MAX_THREADS 512
  ------------------
 1530|  36.8k|            break;
 1531|  36.8k|        case ZXC_D_CHECKSUM:
  ------------------
  |  Branch (1531:9): [True: 36.8k, False: 36.8k]
  ------------------
 1532|  36.8k|            lo = 0;
 1533|  36.8k|            hi = 1;
 1534|  36.8k|            break;
 1535|      0|        default:
  ------------------
  |  Branch (1535:9): [True: 0, False: 73.6k]
  ------------------
 1536|      0|            return ZXC_ERROR_BAD_PARAM;
 1537|  73.6k|    }
 1538|  73.6k|    if (min) *min = lo;
  ------------------
  |  Branch (1538:9): [True: 73.6k, False: 0]
  ------------------
 1539|  73.6k|    if (max) *max = hi;
  ------------------
  |  Branch (1539:9): [True: 73.6k, False: 0]
  ------------------
 1540|  73.6k|    return ZXC_OK;
 1541|  73.6k|}
zxc_dctx_set_param:
 1543|  73.6k|int zxc_dctx_set_param(zxc_dctx* dctx, const zxc_dparam_t param, const int64_t value) {
 1544|  73.6k|    if (UNLIKELY(!dctx)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  152|  73.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 73.6k]
  |  |  ------------------
  ------------------
 1545|  73.6k|    int64_t lo, hi;
 1546|  73.6k|    const int rc = zxc_dparam_bounds(param, &lo, &hi);
 1547|  73.6k|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|  73.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 73.6k]
  |  |  ------------------
  ------------------
 1548|  73.6k|    if (value != 0 && (value < lo || value > hi)) return ZXC_ERROR_BAD_PARAM;
  ------------------
  |  Branch (1548:9): [True: 61.2k, False: 12.4k]
  |  Branch (1548:24): [True: 0, False: 61.2k]
  |  Branch (1548:38): [True: 0, False: 61.2k]
  ------------------
 1549|  73.6k|    switch (param) {
 1550|  36.8k|        case ZXC_D_THREADS:
  ------------------
  |  Branch (1550:9): [True: 36.8k, False: 36.8k]
  ------------------
 1551|  36.8k|            dctx->params.n_threads = (int)value;
 1552|  36.8k|            break;
 1553|  36.8k|        case ZXC_D_CHECKSUM:
  ------------------
  |  Branch (1553:9): [True: 36.8k, False: 36.8k]
  ------------------
 1554|  36.8k|            dctx->params.checksum_enabled = (int)value;
 1555|  36.8k|            break;
 1556|      0|        default:
  ------------------
  |  Branch (1556:9): [True: 0, False: 73.6k]
  ------------------
 1557|      0|            return ZXC_ERROR_BAD_PARAM;  // LCOV_EXCL_LINE: bounds already refused it
 1558|  73.6k|    }
 1559|  73.6k|    return ZXC_OK;
 1560|  73.6k|}
zxc_dctx_set_dict:
 1578|  18.3k|                      const void* dict_huf) {
 1579|  18.3k|    if (UNLIKELY(!dctx)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1580|       |#ifdef ZXC_NO_DICT
 1581|       |    // No dictionary support: clearing is a no-op.
 1582|       |    if (UNLIKELY(dict && dict_size > 0)) return ZXC_ERROR_DICT_UNSUPPORTED;
 1583|       |#endif
 1584|  18.3k|    if (UNLIKELY(dctx->owns_workspace && dict && dict_size > 0)) return ZXC_ERROR_DICT_UNSUPPORTED;
  ------------------
  |  |  152|  36.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1585|  18.3k|    const int rc = zxc_dict_copy_set(&dctx->dict_copy, dict, dict_size, dict_huf);
 1586|  18.3k|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1587|  18.3k|    dctx->params.dict = dctx->dict_copy.data;
 1588|  18.3k|    dctx->params.dict_size = dctx->dict_copy.size;
 1589|  18.3k|    dctx->params.dict_huf = dctx->dict_copy.has_huf ? dctx->dict_copy.huf : NULL;
  ------------------
  |  Branch (1589:29): [True: 0, False: 18.3k]
  ------------------
 1590|  18.3k|    return ZXC_OK;
 1591|  18.3k|}
zxc_dctx_set_progress:
 1593|  18.3k|int zxc_dctx_set_progress(zxc_dctx* dctx, const zxc_progress_callback_t cb, void* user_data) {
 1594|  18.3k|    if (UNLIKELY(!dctx)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1595|  18.3k|    dctx->params.progress_cb = cb;
 1596|  18.3k|    dctx->params.user_data = cb ? user_data : NULL;
  ------------------
  |  Branch (1596:30): [True: 9.52k, False: 8.87k]
  ------------------
 1597|  18.3k|    return ZXC_OK;
 1598|  18.3k|}
zxc_free_dctx:
 1613|  36.8k|void zxc_free_dctx(zxc_dctx* dctx) {
 1614|  36.8k|    if (UNLIKELY(!dctx)) return;
  ------------------
  |  |  152|  36.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 36.8k]
  |  |  ------------------
  ------------------
 1615|       |    // Static dctx: handle + inner buffers live inside the caller's workspace,
 1616|       |    // which we do not own. Free is a no-op; the caller owns the workspace.
 1617|  36.8k|    if (dctx->owns_workspace) return;
  ------------------
  |  Branch (1617:9): [True: 0, False: 36.8k]
  ------------------
 1618|  36.8k|    if (dctx->initialized) zxc_cctx_free(&dctx->inner);
  ------------------
  |  Branch (1618:9): [True: 0, False: 36.8k]
  ------------------
 1619|  36.8k|    ZXC_FREE(dctx->dict_copy.data);
  ------------------
  |  |   86|  36.8k|#define ZXC_FREE(ptr) free(ptr)
  ------------------
 1620|  36.8k|    ZXC_FREE(dctx);
  ------------------
  |  |   86|  36.8k|#define ZXC_FREE(ptr) free(ptr)
  ------------------
 1621|  36.8k|}
zxc_dispatch.c:zxc_variants:
  417|   293k|static ZXC_ALWAYS_INLINE const zxc_variant_set_t* zxc_variants(void) {
  418|   293k|    return &zxc_variants_default;
  419|   293k|}
zxc_dispatch.c:zxc_cparams_defaults:
 1172|  18.3k|static zxc_cparams_t zxc_cparams_defaults(void) {
 1173|  18.3k|    return (zxc_cparams_t){.level = ZXC_LEVEL_DEFAULT, .block_size = ZXC_BLOCK_SIZE_DEFAULT};
  ------------------
  |  |   71|  18.3k|#define ZXC_BLOCK_SIZE_DEFAULT (512 * 1024)
  ------------------
 1174|  18.3k|}
zxc_dispatch.c:zxc_dict_copy_set:
 1084|  36.7k|                             const void* dict_huf) {
 1085|  36.7k|    uint8_t* copy = NULL;
 1086|  36.7k|    if (dict && dict_size > 0) {
  ------------------
  |  Branch (1086:9): [True: 19.4k, False: 17.3k]
  |  Branch (1086:17): [True: 19.4k, False: 0]
  ------------------
 1087|  19.4k|        if (UNLIKELY(dict_size > ZXC_DICT_SIZE_MAX)) return ZXC_ERROR_DICT_TOO_LARGE;
  ------------------
  |  |  152|  19.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 19.4k]
  |  |  ------------------
  ------------------
 1088|  19.4k|        copy = (uint8_t*)ZXC_MALLOC(dict_size);
  ------------------
  |  |   68|  19.4k|#define ZXC_MALLOC(size) malloc(size)
  ------------------
 1089|  19.4k|        if (UNLIKELY(!copy)) return ZXC_ERROR_MEMORY;  // LCOV_EXCL_LINE
  ------------------
  |  |  152|  19.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 19.4k]
  |  |  ------------------
  ------------------
 1090|  19.4k|        ZXC_MEMCPY(copy, dict, dict_size);
  ------------------
  |  |  168|  19.4k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1091|  19.4k|        if (dict_huf) ZXC_MEMCPY(c->huf, dict_huf, ZXC_HUF_TABLE_SIZE);
  ------------------
  |  |  168|      0|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  |  Branch (1091:13): [True: 0, False: 19.4k]
  ------------------
 1092|  19.4k|    }
 1093|  36.7k|    ZXC_FREE(c->data);
  ------------------
  |  |   86|  36.7k|#define ZXC_FREE(ptr) free(ptr)
  ------------------
 1094|  36.7k|    c->data = copy;
 1095|  36.7k|    c->size = copy ? dict_size : 0;
  ------------------
  |  Branch (1095:15): [True: 19.4k, False: 17.3k]
  ------------------
 1096|  36.7k|    c->has_huf = copy && dict_huf;
  ------------------
  |  Branch (1096:18): [True: 19.4k, False: 17.3k]
  |  Branch (1096:26): [True: 0, False: 19.4k]
  ------------------
 1097|  36.7k|    c->gen++;
 1098|  36.7k|    return ZXC_OK;
 1099|  36.7k|}

zxc_stream_compress:
 1285|  18.3k|int64_t zxc_stream_compress(FILE* f_in, FILE* f_out, const zxc_cctx* cfg) {
 1286|  18.3k|    if (UNLIKELY(!f_in)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1287|  18.3k|    const zxc_cparams_t* const opts = cfg ? zxc_cctx_params(cfg) : NULL;
  ------------------
  |  Branch (1287:39): [True: 18.3k, False: 0]
  ------------------
 1288|       |
 1289|  18.3k|    const int n_threads = opts ? opts->n_threads : 0;
  ------------------
  |  Branch (1289:27): [True: 18.3k, False: 0]
  ------------------
 1290|  18.3k|    const int checksum_enabled = opts ? opts->checksum_enabled : 0;
  ------------------
  |  Branch (1290:34): [True: 18.3k, False: 0]
  ------------------
 1291|  18.3k|    const int seekable = opts ? opts->seekable : 0;
  ------------------
  |  Branch (1291:26): [True: 18.3k, False: 0]
  ------------------
 1292|  18.3k|    const uint8_t split_budget_pct = opts ? (uint8_t)opts->favor_decode_speed : 0;
  ------------------
  |  Branch (1292:38): [True: 18.3k, False: 0]
  ------------------
 1293|  18.3k|    const int level = ZXC_OPTS_LEVEL(opts, ZXC_LEVEL_DEFAULT);
  ------------------
  |  | 1042|  18.3k|#define ZXC_OPTS_LEVEL(o, dflt) (((o) && (o)->level != 0) ? (o)->level : (dflt))
  |  |  ------------------
  |  |  |  Branch (1042:35): [True: 18.3k, False: 0]
  |  |  |  Branch (1042:42): [True: 18.3k, False: 0]
  |  |  ------------------
  ------------------
 1294|  18.3k|    const size_t block_size = ZXC_OPTS_BLOCK_SIZE(opts, ZXC_BLOCK_SIZE_DEFAULT);
  ------------------
  |  | 1044|  18.3k|#define ZXC_OPTS_BLOCK_SIZE(o, dflt) (((o) && (o)->block_size > 0) ? (o)->block_size : (dflt))
  |  |  ------------------
  |  |  |  Branch (1044:40): [True: 18.3k, False: 0]
  |  |  |  Branch (1044:47): [True: 18.3k, False: 0]
  |  |  ------------------
  ------------------
 1295|  18.3k|    const uint8_t* dict = opts ? (const uint8_t*)opts->dict : NULL;
  ------------------
  |  Branch (1295:27): [True: 18.3k, False: 0]
  ------------------
 1296|  18.3k|    const size_t dict_size = ZXC_OPTS_DICT_SIZE(opts);
  ------------------
  |  | 1037|  18.3k|#define ZXC_OPTS_DICT_SIZE(o) (((o) && (o)->dict) ? (o)->dict_size : (size_t)0)
  |  |  ------------------
  |  |  |  Branch (1037:33): [True: 18.3k, False: 0]
  |  |  |  Branch (1037:40): [True: 9.72k, False: 8.67k]
  |  |  ------------------
  ------------------
 1297|  18.3k|    zxc_progress_callback_t cb = opts ? opts->progress_cb : NULL;
  ------------------
  |  Branch (1297:34): [True: 18.3k, False: 0]
  ------------------
 1298|  18.3k|    void* ud = opts ? opts->user_data : NULL;
  ------------------
  |  Branch (1298:16): [True: 18.3k, False: 0]
  ------------------
 1299|       |
 1300|  18.3k|    const uint8_t* dict_huf = ZXC_OPTS_DICT_HUF(opts);
  ------------------
  |  | 1040|  18.3k|    (((o) && (o)->dict && (o)->dict_size > 0) ? (const uint8_t*)(o)->dict_huf : NULL)
  |  |  ------------------
  |  |  |  Branch (1040:7): [True: 18.3k, False: 0]
  |  |  |  Branch (1040:14): [True: 9.72k, False: 8.67k]
  |  |  |  Branch (1040:27): [True: 9.72k, False: 0]
  |  |  ------------------
  ------------------
 1301|  18.3k|    zxc_stream_engine_t e;
 1302|  18.3k|    ZXC_MEMSET(&e, 0, sizeof(e));
  ------------------
  |  |  173|  18.3k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 1303|  18.3k|    zxc_stream_ctx_t* const ctx = &e.ctx;
 1304|  18.3k|    ctx->compression_mode = 1;
 1305|  18.3k|    ctx->compression_level = level;
 1306|  18.3k|    ctx->split_budget_pct = split_budget_pct;
 1307|  18.3k|    ctx->chunk_size = block_size;
 1308|  18.3k|    ctx->checksum_enabled = checksum_enabled;
 1309|  18.3k|    ctx->file_has_checksum = checksum_enabled;
 1310|  18.3k|    ctx->progress_cb = cb;
 1311|  18.3k|    ctx->progress_user_data = ud;
 1312|  18.3k|    ctx->dict = dict;
 1313|  18.3k|    ctx->dict_size = dict_size;
 1314|  18.3k|    ctx->dict_huf = dict_huf;
 1315|       |
 1316|       |    // Input size for progress tracking; for decompression the CLI passes it.
 1317|  18.3k|    long long saved_pos = 0;
 1318|  18.3k|    uint64_t in_size = 0;
 1319|  18.3k|    if (cb && zxc_file_span(f_in, &saved_pos, &in_size) == ZXC_OK) {
  ------------------
  |  Branch (1319:9): [True: 9.52k, False: 8.87k]
  |  Branch (1319:15): [True: 9.52k, False: 0]
  ------------------
 1320|  9.52k|        ctx->total_input_bytes = in_size;   // LCOV_EXCL_LINE
 1321|  9.52k|        fseeko(f_in, saved_pos, SEEK_SET);  // LCOV_EXCL_LINE
 1322|  9.52k|    }
 1323|       |
 1324|       |    // Seekable: initial block-size tracking array
 1325|  18.3k|    if (seekable) {
  ------------------
  |  Branch (1325:9): [True: 12.2k, False: 6.17k]
  ------------------
 1326|  12.2k|        e.w.seek_cap = 64;  // doubled as blocks come
 1327|  12.2k|        e.w.seek_comp = (uint32_t*)ZXC_MALLOC(e.w.seek_cap * sizeof(uint32_t));
  ------------------
  |  |   68|  12.2k|#define ZXC_MALLOC(size) malloc(size)
  ------------------
 1328|  12.2k|        if (UNLIKELY(!e.w.seek_comp)) return ZXC_ERROR_MEMORY;  // LCOV_EXCL_LINE
  ------------------
  |  |  152|  12.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 12.2k]
  |  |  ------------------
  ------------------
 1329|  12.2k|    }
 1330|  18.3k|    e.w.f = f_out;
 1331|  18.3k|    const int src = zxc_stream_engine_start(&e, f_in, n_threads);
 1332|  18.3k|    if (UNLIKELY(src != ZXC_OK)) {
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1333|      0|        ZXC_FREE(e.w.seek_comp);  // LCOV_EXCL_LINE
  ------------------
  |  |   86|      0|#define ZXC_FREE(ptr) free(ptr)
  ------------------
 1334|      0|        return src;               // LCOV_EXCL_LINE
 1335|      0|    }
 1336|       |
 1337|       |    // The writer waits for a job: the header goes first.
 1338|  18.3k|    if (f_out) {
  ------------------
  |  Branch (1338:9): [True: 18.3k, False: 0]
  ------------------
 1339|  18.3k|        uint8_t h[ZXC_FILE_HEADER_SIZE];
 1340|  18.3k|        zxc_write_file_header(h, ZXC_FILE_HEADER_SIZE, block_size, checksum_enabled,
  ------------------
  |  |  126|  18.3k|#define ZXC_FILE_HEADER_SIZE 16
  ------------------
 1341|  18.3k|                              dict && dict_size > 0, zxc_dict_compute_id(dict, dict_size, dict_huf),
  ------------------
  |  Branch (1341:31): [True: 9.72k, False: 8.67k]
  |  Branch (1341:39): [True: 9.72k, False: 0]
  ------------------
 1342|  18.3k|                              seekable);
 1343|  18.3k|        if (UNLIKELY(fwrite(h, 1, ZXC_FILE_HEADER_SIZE, f_out) != ZXC_FILE_HEADER_SIZE))
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1344|      0|            zxc_stream_reader_fail(ctx, 0);
 1345|  18.3k|    }
 1346|  18.3k|    e.w.total_bytes = ZXC_FILE_HEADER_SIZE;
  ------------------
  |  |  126|  18.3k|#define ZXC_FILE_HEADER_SIZE 16
  ------------------
 1347|       |
 1348|  18.3k|    e.read_idx = zxc_stream_read_loop(ctx, f_in, 0, dict_size > 0);
 1349|  18.3k|    zxc_stream_engine_stop(&e, 1);
 1350|       |
 1351|  18.3k|    if (!ctx->io_error && e.w.total_bytes >= 0) zxc_stream_finish_compress(ctx, &e.w, f_out);
  ------------------
  |  Branch (1351:9): [True: 18.3k, False: 0]
  |  Branch (1351:27): [True: 18.3k, False: 0]
  ------------------
 1352|       |    // stdio defers write errors to flush time: push the last buffer to the OS
 1353|       |    // so a failure (ENOSPC, EFBIG, EPIPE) is reported here instead of being
 1354|       |    // left to the caller's fclose, after a success count was returned.
 1355|  18.3k|    if (UNLIKELY(!ctx->io_error && f_out && fflush(f_out) != 0)) ctx->io_error = 1;
  ------------------
  |  |  152|  73.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 18.3k, False: 0]
  |  |  |  Branch (152:42): [True: 18.3k, False: 0]
  |  |  |  Branch (152:42): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1356|  18.3k|    ZXC_FREE(e.w.seek_comp);
  ------------------
  |  |   86|  18.3k|#define ZXC_FREE(ptr) free(ptr)
  ------------------
 1357|       |
 1358|  18.3k|    if (UNLIKELY(ctx->io_error)) return ctx->fail_code ? ctx->fail_code : ZXC_ERROR_IO;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  |  Branch (1358:41): [True: 0, False: 0]
  ------------------
 1359|  18.3k|    return e.w.total_bytes;
 1360|  18.3k|}
zxc_stream_decompress:
 1371|  36.8k|int64_t zxc_stream_decompress(FILE* f_in, FILE* f_out, const zxc_dctx* cfg) {
 1372|  36.8k|    if (UNLIKELY(!f_in)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  152|  36.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 36.8k]
  |  |  ------------------
  ------------------
 1373|  36.8k|    const zxc_dparams_t* const opts = cfg ? zxc_dctx_params(cfg) : NULL;
  ------------------
  |  Branch (1373:39): [True: 36.8k, False: 0]
  ------------------
 1374|       |
 1375|  36.8k|    const int n_threads = opts ? opts->n_threads : 0;
  ------------------
  |  Branch (1375:27): [True: 36.8k, False: 0]
  ------------------
 1376|  36.8k|    const int checksum_enabled = opts ? opts->checksum_enabled : 0;
  ------------------
  |  Branch (1376:34): [True: 36.8k, False: 0]
  ------------------
 1377|  36.8k|    const uint8_t* dict = opts ? (const uint8_t*)opts->dict : NULL;
  ------------------
  |  Branch (1377:27): [True: 36.8k, False: 0]
  ------------------
 1378|  36.8k|    const size_t dict_size = ZXC_OPTS_DICT_SIZE(opts);
  ------------------
  |  | 1037|  36.8k|#define ZXC_OPTS_DICT_SIZE(o) (((o) && (o)->dict) ? (o)->dict_size : (size_t)0)
  |  |  ------------------
  |  |  |  Branch (1037:33): [True: 36.8k, False: 0]
  |  |  |  Branch (1037:40): [True: 9.72k, False: 27.1k]
  |  |  ------------------
  ------------------
 1379|  36.8k|    const uint8_t* dict_huf = ZXC_OPTS_DICT_HUF(opts);
  ------------------
  |  | 1040|  36.8k|    (((o) && (o)->dict && (o)->dict_size > 0) ? (const uint8_t*)(o)->dict_huf : NULL)
  |  |  ------------------
  |  |  |  Branch (1040:7): [True: 36.8k, False: 0]
  |  |  |  Branch (1040:14): [True: 9.72k, False: 27.1k]
  |  |  |  Branch (1040:27): [True: 9.72k, False: 0]
  |  |  ------------------
  ------------------
 1380|  36.8k|    const uint32_t dict_id = zxc_dict_compute_id(dict, dict_size, dict_huf);
 1381|       |
 1382|  36.8k|    zxc_stream_engine_t e;
 1383|  36.8k|    int running = 0;
 1384|  36.8k|    uint8_t magic[sizeof(uint32_t)];
 1385|  36.8k|    int rc = zxc_stream_read_exact(NULL, f_in, magic, sizeof(magic), ZXC_ERROR_SRC_TOO_SMALL);
 1386|       |
 1387|  36.8k|    int64_t total = 0;
 1388|  55.2k|    for (int frames = 0;; frames++) {
 1389|  55.2k|        if (rc == 1) {
  ------------------
  |  Branch (1389:13): [True: 18.3k, False: 36.8k]
  ------------------
 1390|       |            // A clean end of input, after at least one frame.
 1391|  18.3k|            rc = frames ? ZXC_OK : ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  Branch (1391:18): [True: 18.3k, False: 0]
  ------------------
 1392|  18.3k|            break;
 1393|  18.3k|        }
 1394|  36.8k|        if (UNLIKELY(rc != ZXC_OK)) break;
  ------------------
  |  |  152|  36.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 36.8k]
  |  |  ------------------
  ------------------
 1395|  36.8k|        if (UNLIKELY(zxc_le32(magic) != ZXC_MAGIC_WORD)) {
  ------------------
  |  |  152|  36.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 18.4k, False: 18.4k]
  |  |  ------------------
  ------------------
 1396|  18.4k|            rc = frames ? ZXC_ERROR_CORRUPT_DATA : ZXC_ERROR_BAD_MAGIC;
  ------------------
  |  Branch (1396:18): [True: 0, False: 18.4k]
  ------------------
 1397|  18.4k|            break;
 1398|  18.4k|        }
 1399|  18.4k|        size_t chunk = 0;
 1400|  18.4k|        int has_checksum = 0;
 1401|  18.4k|        int has_seek = 0;
 1402|  18.4k|        int frame_dict = 0;
 1403|  18.4k|        rc = zxc_stream_read_frame_header(running ? &e.ctx : NULL, f_in, magic, dict_size > 0,
  ------------------
  |  Branch (1403:43): [True: 0, False: 18.4k]
  ------------------
 1404|  18.4k|                                          dict_id, &chunk, &has_checksum, &has_seek, &frame_dict);
 1405|  18.4k|        if (UNLIKELY(rc != ZXC_OK)) break;
  ------------------
  |  |  152|  18.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 37, False: 18.3k]
  |  |  ------------------
  ------------------
 1406|       |
 1407|       |        // The workers are set up for one block size and checksum flag.
 1408|  18.3k|        if (running && (e.ctx.chunk_size != chunk || e.ctx.file_has_checksum != has_checksum)) {
  ------------------
  |  Branch (1408:13): [True: 0, False: 18.3k]
  |  Branch (1408:25): [True: 0, False: 0]
  |  Branch (1408:54): [True: 0, False: 0]
  ------------------
 1409|      0|            running = 0;
 1410|      0|            rc = zxc_stream_engine_close(&e, f_in);
 1411|      0|            if (UNLIKELY(rc != ZXC_OK)) break;  // LCOV_EXCL_LINE
  ------------------
  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1412|      0|        }
 1413|  18.3k|        if (!running) {
  ------------------
  |  Branch (1413:13): [True: 18.3k, False: 0]
  ------------------
 1414|  18.3k|            ZXC_MEMSET(&e, 0, sizeof(e));
  ------------------
  |  |  173|  18.3k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 1415|  18.3k|            e.ctx.chunk_size = chunk;
 1416|  18.3k|            e.ctx.checksum_enabled = checksum_enabled;
 1417|  18.3k|            e.ctx.file_has_checksum = has_checksum;
 1418|  18.3k|            e.ctx.progress_cb = opts ? opts->progress_cb : NULL;
  ------------------
  |  Branch (1418:33): [True: 18.3k, False: 0]
  ------------------
 1419|  18.3k|            e.ctx.progress_user_data = opts ? opts->user_data : NULL;
  ------------------
  |  Branch (1419:40): [True: 18.3k, False: 0]
  ------------------
 1420|  18.3k|            e.ctx.dict = dict;
 1421|  18.3k|            e.ctx.dict_size = dict_size;
 1422|  18.3k|            e.ctx.dict_huf = dict_huf;
 1423|  18.3k|            e.w.f = f_out;
 1424|  18.3k|            e.w.bytes_processed = (uint64_t)total;  // Progress counts across frames
 1425|  18.3k|            rc = zxc_stream_engine_start(&e, f_in, n_threads);
 1426|  18.3k|            if (UNLIKELY(rc != ZXC_OK)) break;  // LCOV_EXCL_LINE
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1427|  18.3k|            running = 1;
 1428|  18.3k|        }
 1429|       |
 1430|       |        // A frame without the flag never sees the dictionary nor its literal table.
 1431|  18.3k|        const int64_t r = zxc_stream_decode_frame(&e, f_in, has_seek, frame_dict);
 1432|  18.3k|        if (UNLIKELY(r < 0)) {
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1433|      0|            rc = (int)r;
 1434|      0|            break;
 1435|      0|        }
 1436|  18.3k|        total += r;
 1437|  18.3k|        rc = zxc_stream_read_exact(&e.ctx, f_in, magic, sizeof(magic), ZXC_ERROR_CORRUPT_DATA);
 1438|  18.3k|    }
 1439|  36.8k|    if (running) {
  ------------------
  |  Branch (1439:9): [True: 18.3k, False: 18.4k]
  ------------------
 1440|  18.3k|        const int crc = zxc_stream_engine_close(&e, f_in);
 1441|  18.3k|        if (rc == ZXC_OK) rc = crc;
  ------------------
  |  Branch (1441:13): [True: 18.3k, False: 0]
  ------------------
 1442|       |        // Settled by the writer, now stopped.
 1443|      0|        else if (e.ctx.fail_code)
  ------------------
  |  Branch (1443:18): [True: 0, False: 0]
  ------------------
 1444|      0|            rc = e.ctx.fail_code;
 1445|  18.3k|    }
 1446|       |    // stdio defers write errors to flush time (see zxc_stream_compress).
 1447|  36.8k|    if (rc == ZXC_OK && f_out && UNLIKELY(fflush(f_out) != 0)) rc = ZXC_ERROR_IO;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  |  Branch (1447:9): [True: 18.3k, False: 18.4k]
  |  Branch (1447:25): [True: 18.3k, False: 0]
  ------------------
 1448|  36.8k|    return rc != ZXC_OK ? rc : total;
  ------------------
  |  Branch (1448:12): [True: 18.4k, False: 18.3k]
  ------------------
 1449|  36.8k|}
zxc_stream_get_decompressed_size:
 1481|  36.8k|int64_t zxc_stream_get_decompressed_size(FILE* f_in) {
 1482|  36.8k|    if (UNLIKELY(!f_in)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  152|  36.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 36.8k]
  |  |  ------------------
  ------------------
 1483|  36.8k|    long long saved = 0;
 1484|  36.8k|    uint64_t size = 0;
 1485|  36.8k|    int rc = zxc_file_span(f_in, &saved, &size);
 1486|  36.8k|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|  36.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 36.8k]
  |  |  ------------------
  ------------------
 1487|  36.8k|    zxc_container_info_t info;
 1488|  36.8k|    const zxc_scan_src_t src = {zxc_file_scan_read, NULL, f_in, size};
 1489|  36.8k|    rc = zxc_scan_container(&src, 0, &info);
 1490|  36.8k|    fseeko(f_in, saved, SEEK_SET);
 1491|  36.8k|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|  36.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 18.4k, False: 18.3k]
  |  |  ------------------
  ------------------
 1492|  18.3k|    if (UNLIKELY(info.dsize > (uint64_t)INT64_MAX)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1493|  18.3k|    return (int64_t)info.dsize;
 1494|  18.3k|}
zxc_driver.c:zxc_file_span:
 1264|  46.3k|static int zxc_file_span(FILE* f, long long* saved, uint64_t* size) {
 1265|  46.3k|    *saved = ftello(f);
 1266|  46.3k|    if (UNLIKELY(*saved < 0 || fseeko(f, 0, SEEK_END) != 0)) return ZXC_ERROR_IO;
  ------------------
  |  |  152|  92.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 46.3k]
  |  |  |  Branch (152:42): [True: 0, False: 46.3k]
  |  |  |  Branch (152:42): [True: 0, False: 46.3k]
  |  |  ------------------
  ------------------
 1267|  46.3k|    const long long n = ftello(f);
 1268|  46.3k|    if (UNLIKELY(n < 0)) {
  ------------------
  |  |  152|  46.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 46.3k]
  |  |  ------------------
  ------------------
 1269|       |        // LCOV_EXCL_START
 1270|      0|        fseeko(f, *saved, SEEK_SET);
 1271|      0|        return ZXC_ERROR_IO;
 1272|       |        // LCOV_EXCL_STOP
 1273|      0|    }
 1274|  46.3k|    *size = (uint64_t)n;
 1275|  46.3k|    return ZXC_OK;
 1276|  46.3k|}
zxc_driver.c:zxc_stream_engine_start:
  794|  36.7k|static int zxc_stream_engine_start(zxc_stream_engine_t* e, FILE* f_in, const int n_threads) {
  795|  36.7k|    zxc_stream_ctx_t* const ctx = &e->ctx;
  796|  36.7k|    const int mode = ctx->compression_mode;
  797|  36.7k|    const size_t chunk = ctx->chunk_size;
  798|       |
  799|  36.7k|    const int explicit_threads = n_threads > 0;
  800|  36.7k|    int num_threads = explicit_threads ? n_threads : zxc_num_procs();
  ------------------
  |  Branch (800:23): [True: 36.7k, False: 0]
  ------------------
  801|  36.7k|    if (num_threads > ZXC_MAX_THREADS) num_threads = ZXC_MAX_THREADS;
  ------------------
  |  |  113|  36.7k|#define ZXC_MAX_THREADS 512
  ------------------
                  if (num_threads > ZXC_MAX_THREADS) num_threads = ZXC_MAX_THREADS;
  ------------------
  |  |  113|      0|#define ZXC_MAX_THREADS 512
  ------------------
  |  Branch (801:9): [True: 0, False: 36.7k]
  ------------------
  802|       |    // Positioned reads need two threads: a lone worker is faster fed by the reader.
  803|  36.7k|    ctx->in_fd = -1;
  804|  36.7k|    const int in_fd = (mode == 0) ? zxc_stream_regular_fd(f_in) : -1;
  ------------------
  |  Branch (804:23): [True: 18.3k, False: 18.3k]
  ------------------
  805|  36.7k|    ctx->batch = (in_fd >= 0 && chunk < ZXC_MT_BATCH_BYTES) ? (int)(ZXC_MT_BATCH_BYTES / chunk) : 1;
  ------------------
  |  |  378|      0|#define ZXC_MT_BATCH_BYTES ((size_t)256 * 1024)
  ------------------
                  ctx->batch = (in_fd >= 0 && chunk < ZXC_MT_BATCH_BYTES) ? (int)(ZXC_MT_BATCH_BYTES / chunk) : 1;
  ------------------
  |  |  378|      0|#define ZXC_MT_BATCH_BYTES ((size_t)256 * 1024)
  ------------------
  |  Branch (805:19): [True: 0, False: 36.7k]
  |  Branch (805:33): [True: 0, False: 0]
  ------------------
  806|  36.7k|    if (in_fd >= 0 && num_threads > 1 && chunk >= ZXC_STREAM_PREAD_MIN_BLOCK)
  ------------------
  |  |   61|      0|#define ZXC_STREAM_PREAD_MIN_BLOCK ((size_t)64 * 1024)
  ------------------
  |  Branch (806:9): [True: 0, False: 36.7k]
  |  Branch (806:23): [True: 0, False: 0]
  |  Branch (806:42): [True: 0, False: 0]
  ------------------
  807|      0|        zxc_stream_open_positioned(ctx, f_in, in_fd);
  808|       |    // -T N is N workers; auto-detection leaves one processor to the reader and
  809|       |    // writer unless the workers read themselves.
  810|  36.7k|    const int num_workers = (explicit_threads || ctx->in_fd >= 0) ? num_threads
  ------------------
  |  Branch (810:30): [True: 36.7k, False: 0]
  |  Branch (810:50): [True: 0, False: 0]
  ------------------
  811|  36.7k|                            : (num_threads > 1)                   ? num_threads - 1
  ------------------
  |  Branch (811:31): [True: 0, False: 0]
  ------------------
  812|      0|                                                                  : 1;
  813|       |    // Batched jobs hold several blocks: fewer keep the workers fed.
  814|  36.7k|    ctx->ring_size = (size_t)num_workers *
  815|  36.7k|                     (ctx->batch > 1 ? ZXC_STREAM_RING_BATCHED : ZXC_STREAM_RING_UNBATCHED);
  ------------------
  |  |   64|      0|#define ZXC_STREAM_RING_BATCHED 2U
  ------------------
                                   (ctx->batch > 1 ? ZXC_STREAM_RING_BATCHED : ZXC_STREAM_RING_UNBATCHED);
  ------------------
  |  |   66|  36.7k|#define ZXC_STREAM_RING_UNBATCHED 4U
  ------------------
  |  Branch (815:23): [True: 0, False: 36.7k]
  ------------------
  816|       |
  817|  36.7k|    const uint64_t max_out = zxc_compress_bound(chunk);
  818|  36.7k|    const size_t raw_alloc_in =
  819|  36.7k|        (size_t)((mode ? chunk : max_out * (uint64_t)ctx->batch) + ZXC_PAD_SIZE);
  ------------------
  |  |  342|  36.7k|#define ZXC_PAD_SIZE 32
  ------------------
  |  Branch (819:19): [True: 18.3k, False: 18.3k]
  ------------------
  820|  36.7k|    const size_t alloc_in = (raw_alloc_in + ZXC_ALIGNMENT_MASK) & ~ZXC_ALIGNMENT_MASK;
  ------------------
  |  |  382|  36.7k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  ------------------
  |  |  |  |  380|  36.7k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  ------------------
  ------------------
                  const size_t alloc_in = (raw_alloc_in + ZXC_ALIGNMENT_MASK) & ~ZXC_ALIGNMENT_MASK;
  ------------------
  |  |  382|  36.7k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  ------------------
  |  |  |  |  380|  36.7k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  ------------------
  ------------------
  821|  36.7k|    ctx->in_alloc = alloc_in;
  822|       |
  823|  36.7k|    const size_t raw_alloc_out =
  824|  36.7k|        (size_t)((mode ? max_out : chunk * (size_t)ctx->batch + ZXC_DECOMPRESS_TAIL_PAD) +
  ------------------
  |  |  372|  18.3k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|  18.3k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|  18.3k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|  18.3k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  18.3k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  18.3k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  18.3k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  342|  18.3k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  |  Branch (824:19): [True: 18.3k, False: 18.3k]
  ------------------
  825|  36.7k|                 ZXC_PAD_SIZE);
  ------------------
  |  |  342|  36.7k|#define ZXC_PAD_SIZE 32
  ------------------
  826|  36.7k|    const size_t alloc_out = (raw_alloc_out + ZXC_ALIGNMENT_MASK) & ~ZXC_ALIGNMENT_MASK;
  ------------------
  |  |  382|  36.7k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  ------------------
  |  |  |  |  380|  36.7k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  ------------------
  ------------------
                  const size_t alloc_out = (raw_alloc_out + ZXC_ALIGNMENT_MASK) & ~ZXC_ALIGNMENT_MASK;
  ------------------
  |  |  382|  36.7k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  ------------------
  |  |  |  |  380|  36.7k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  ------------------
  ------------------
  827|       |
  828|       |    // Positioned reads use per-worker input buffers.
  829|  36.7k|    const size_t ring_in = ctx->in_fd >= 0 ? 0 : alloc_in;
  ------------------
  |  Branch (829:28): [True: 0, False: 36.7k]
  ------------------
  830|  36.7k|    const size_t per_job_sz = sizeof(zxc_stream_job_t) + sizeof(int) + ring_in + alloc_out;
  831|  36.7k|    if (UNLIKELY(per_job_sz > SIZE_MAX / ctx->ring_size))
  ------------------
  |  |  152|  36.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 36.7k]
  |  |  ------------------
  ------------------
  832|      0|        return ZXC_ERROR_MEMORY;  // LCOV_EXCL_LINE
  833|       |
  834|  36.7k|    uint8_t* const mem_block = ZXC_ALIGNED_MALLOC(ctx->ring_size * per_job_sz, ZXC_CACHE_LINE_SIZE);
  ------------------
  |  |  134|  36.7k|#define ZXC_ALIGNED_MALLOC(size, alignment) zxc_aligned_malloc(size, alignment)
  ------------------
  835|  36.7k|    if (UNLIKELY(!mem_block)) return ZXC_ERROR_MEMORY;  // LCOV_EXCL_LINE
  ------------------
  |  |  152|  36.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 36.7k]
  |  |  ------------------
  ------------------
  836|  36.7k|    e->mem_block = mem_block;
  837|       |
  838|  36.7k|    uint8_t* ptr = mem_block;
  839|  36.7k|    ctx->jobs = (zxc_stream_job_t*)ptr;
  840|  36.7k|    ptr += ctx->ring_size * sizeof(zxc_stream_job_t);
  841|  36.7k|    ctx->worker_queue = (int*)ptr;
  842|  36.7k|    ptr += ctx->ring_size * sizeof(int);
  843|  36.7k|    uint8_t* buf_in = ptr;
  844|  36.7k|    ptr += ctx->ring_size * ring_in;
  845|  36.7k|    uint8_t* buf_out = ptr;
  846|       |
  847|  36.7k|    ZXC_MEMSET(mem_block, 0, ctx->ring_size * (sizeof(zxc_stream_job_t) + sizeof(int)));
  ------------------
  |  |  173|  36.7k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  848|       |
  849|   276k|    for (size_t i = 0; i < ctx->ring_size; i++) {
  ------------------
  |  Branch (849:24): [True: 240k, False: 36.7k]
  ------------------
  850|   240k|        ctx->jobs[i].job_id = (int)i;
  851|   240k|        ctx->jobs[i].status = JOB_STATUS_FREE;
  852|   240k|        ctx->jobs[i].in_buf = ring_in ? buf_in + (i * ring_in) : NULL;
  ------------------
  |  Branch (852:31): [True: 240k, False: 0]
  ------------------
  853|   240k|        ctx->jobs[i].in_cap = alloc_in - ZXC_PAD_SIZE;
  ------------------
  |  |  342|   240k|#define ZXC_PAD_SIZE 32
  ------------------
  854|   240k|        ctx->jobs[i].in_sz = 0;
  855|   240k|        ctx->jobs[i].out_buf = buf_out + (i * alloc_out);
  856|   240k|        ctx->jobs[i].out_cap = alloc_out - ZXC_PAD_SIZE;
  ------------------
  |  |  342|   240k|#define ZXC_PAD_SIZE 32
  ------------------
  857|   240k|        ctx->jobs[i].result_sz = 0;
  858|   240k|    }
  859|       |
  860|  36.7k|    pthread_mutex_init(&ctx->lock, NULL);
  861|  36.7k|    pthread_cond_init(&ctx->cond_reader, NULL);
  862|  36.7k|    pthread_cond_init(&ctx->cond_worker, NULL);
  863|  36.7k|    pthread_cond_init(&ctx->cond_writer, NULL);
  864|       |
  865|  36.7k|    e->workers = ZXC_MALLOC((size_t)num_workers * sizeof(pthread_t));
  ------------------
  |  |   68|  36.7k|#define ZXC_MALLOC(size) malloc(size)
  ------------------
  866|  36.7k|    if (LIKELY(e->workers)) {
  ------------------
  |  |  146|  36.7k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 36.7k, False: 0]
  |  |  ------------------
  ------------------
  867|  96.7k|        while (e->n_workers < num_workers &&
  ------------------
  |  Branch (867:16): [True: 60.0k, False: 36.7k]
  ------------------
  868|  60.0k|               pthread_create(&e->workers[e->n_workers], NULL, zxc_stream_worker, ctx) == 0)
  ------------------
  |  Branch (868:16): [True: 60.0k, False: 0]
  ------------------
  869|  60.0k|            e->n_workers++;
  870|  36.7k|    }
  871|  36.7k|    e->w.ctx = ctx;
  872|  36.7k|    if (UNLIKELY(e->n_workers == 0 ||
  ------------------
  |  |  152|  73.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 36.7k]
  |  |  |  Branch (152:42): [True: 0, False: 36.7k]
  |  |  |  Branch (152:42): [True: 0, False: 36.7k]
  |  |  ------------------
  ------------------
  873|  36.7k|                 pthread_create(&e->writer, NULL, zxc_async_writer, &e->w) != 0)) {
  874|      0|        zxc_stream_engine_stop(e, 0);  // LCOV_EXCL_LINE
  875|      0|        return ZXC_ERROR_MEMORY;       // LCOV_EXCL_LINE
  876|      0|    }
  877|  36.7k|    return ZXC_OK;
  878|  36.7k|}
zxc_driver.c:zxc_stream_regular_fd:
  364|  18.3k|static int zxc_stream_regular_fd(FILE* f) {
  365|       |#if defined(_WIN32)
  366|       |    // LCOV_EXCL_START - Windows path, not reachable on POSIX CI
  367|       |    const int fd = _fileno(f);
  368|       |    if (fd < 0) return -1;
  369|       |    const intptr_t handle = _get_osfhandle(fd);
  370|       |    return (handle != -1 && GetFileType((HANDLE)handle) == FILE_TYPE_DISK) ? fd : -1;
  371|       |    // LCOV_EXCL_STOP
  372|       |#else
  373|  18.3k|    struct stat st;
  374|  18.3k|    const int fd = fileno(f);
  375|  18.3k|    return (fd >= 0 && fstat(fd, &st) == 0 && S_ISREG(st.st_mode)) ? fd : -1;
  ------------------
  |  Branch (375:13): [True: 0, False: 18.3k]
  |  Branch (375:24): [True: 0, False: 0]
  |  Branch (375:47): [True: 0, False: 0]
  ------------------
  376|  18.3k|#endif
  377|  18.3k|}
zxc_driver.c:zxc_stream_worker:
  514|  59.9k|static void* zxc_stream_worker(void* arg) {
  515|  59.9k|    zxc_stream_ctx_t* const ctx = (zxc_stream_ctx_t*)arg;
  516|  59.9k|    zxc_cctx_t cctx;
  517|       |
  518|  59.9k|    const int unified_chk = (ctx->compression_mode == 1)
  ------------------
  |  Branch (518:29): [True: 29.9k, False: 30.0k]
  ------------------
  519|  59.9k|                                ? ctx->checksum_enabled
  520|  59.9k|                                : (ctx->file_has_checksum && ctx->checksum_enabled);
  ------------------
  |  Branch (520:36): [True: 21.3k, False: 8.65k]
  |  Branch (520:62): [True: 21.3k, False: 18.4E]
  ------------------
  521|       |
  522|  59.9k|    const size_t eff_chunk = (ctx->dict_size > 0 && ctx->compression_mode == 1)
  ------------------
  |  Branch (522:31): [True: 34.3k, False: 25.6k]
  |  Branch (522:53): [True: 17.1k, False: 17.1k]
  ------------------
  523|  59.9k|                                 ? zxc_block_size_ceil(ctx->dict_size + ctx->chunk_size)
  524|  59.9k|                                 : ctx->chunk_size;
  525|       |    // Per-worker input buffer for positioned reads: stays in this core's cache.
  526|  59.9k|    uint8_t* const in_work = ctx->in_fd >= 0 ? (uint8_t*)ZXC_MALLOC(ctx->in_alloc) : NULL;
  ------------------
  |  |   68|      0|#define ZXC_MALLOC(size) malloc(size)
  ------------------
  |  Branch (526:30): [True: 0, False: 59.9k]
  ------------------
  527|  59.9k|    if (UNLIKELY(zxc_cctx_init(&cctx, eff_chunk, ctx->compression_mode, ctx->compression_level,
  ------------------
  |  |  152|   299k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 59.9k]
  |  |  |  Branch (152:42): [True: 7, False: 59.9k]
  |  |  |  Branch (152:42): [True: 7, False: 59.9k]
  |  |  |  Branch (152:42): [True: 0, False: 59.9k]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  528|  59.9k|                               unified_chk, ctx->dict_size) != ZXC_OK ||
  529|  59.9k|                 zxc_cctx_attach_dict_huf(&cctx, ctx->dict_huf) != ZXC_OK ||
  530|  59.9k|                 (ctx->in_fd >= 0 && !in_work))) {
  531|       |        // LCOV_EXCL_START
  532|      0|        ZXC_FREE(in_work);
  ------------------
  |  |   86|      0|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  533|      0|        zxc_cctx_free(&cctx);
  534|      0|        pthread_mutex_lock(&ctx->lock);
  535|      0|        ctx->io_error = 1;
  536|      0|        ctx->workers_lost = 1;
  537|      0|        pthread_cond_broadcast(&ctx->cond_writer);
  538|      0|        pthread_cond_broadcast(&ctx->cond_reader);
  539|      0|        pthread_mutex_unlock(&ctx->lock);
  540|      0|        return NULL;
  541|       |        // LCOV_EXCL_STOP
  542|      0|    }
  543|       |
  544|  59.9k|    cctx.compression_level = ctx->compression_level;
  545|  59.9k|    cctx.split_budget_pct = ctx->split_budget_pct;
  546|       |
  547|       |    // Per-worker dict buffer for assembling [dict | block_data]
  548|  59.9k|    const size_t dsz = ctx->dict_size;
  549|  59.9k|    const int dict_huf_tree_ok = cctx.dict_huf_tree_ok;
  550|  59.9k|    uint8_t* const dict_work = cctx.dict_buffer;
  551|  59.9k|    if (dict_work) ZXC_MEMCPY(dict_work, ctx->dict, dsz);
  ------------------
  |  |  168|  34.3k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  |  Branch (551:9): [True: 34.3k, False: 25.6k]
  ------------------
  552|       |
  553|   353k|    while (1) {
  ------------------
  |  Branch (553:12): [True: 353k, Folded]
  ------------------
  554|   353k|        zxc_stream_job_t* job = NULL;
  555|   353k|        pthread_mutex_lock(&ctx->lock);
  556|   448k|        while (ctx->wq_count == 0 && !ctx->shutdown_workers) {
  ------------------
  |  Branch (556:16): [True: 155k, False: 293k]
  |  Branch (556:38): [True: 95.8k, False: 60.0k]
  ------------------
  557|  95.8k|            pthread_cond_wait(&ctx->cond_worker, &ctx->lock);
  558|  95.8k|        }
  559|   353k|        if (ctx->shutdown_workers && ctx->wq_count == 0) {
  ------------------
  |  Branch (559:13): [True: 60.0k, False: 293k]
  |  Branch (559:38): [True: 60.0k, False: 0]
  ------------------
  560|  60.0k|            pthread_mutex_unlock(&ctx->lock);
  561|  60.0k|            break;
  562|  60.0k|        }
  563|   293k|        const int jid = ctx->worker_queue[ctx->wq_tail];
  564|   293k|        ctx->wq_tail = zxc_ring_next(ctx, ctx->wq_tail);
  565|   293k|        ctx->wq_count--;
  566|   293k|        job = &ctx->jobs[jid];
  567|   293k|        pthread_mutex_unlock(&ctx->lock);
  568|       |
  569|       |        // A short read (the file shrank) is an I/O error.
  570|   293k|        const uint8_t* const in = in_work ? in_work : job->in_buf;
  ------------------
  |  Branch (570:35): [True: 0, False: 293k]
  ------------------
  571|   293k|        int res;
  572|   293k|        if (in_work && UNLIKELY(zxc_stream_read_at(ctx, in_work, job->in_sz, job->in_off) !=
  ------------------
  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (572:13): [True: 0, False: 293k]
  ------------------
  573|   293k|                                (int64_t)job->in_sz)) {
  574|      0|            res = ZXC_ERROR_IO;
  575|   293k|        } else if (ctx->compression_mode == 0) {
  ------------------
  |  Branch (575:20): [True: 146k, False: 146k]
  ------------------
  576|       |            // The prefix and table stay set up; only bound frames see them.
  577|   146k|            cctx.dict_size = job->has_dict ? dsz : 0;
  ------------------
  |  Branch (577:30): [True: 78.4k, False: 68.1k]
  ------------------
  578|   146k|            cctx.dict_huf_tree_ok = job->has_dict ? dict_huf_tree_ok : 0;
  ------------------
  |  Branch (578:37): [True: 78.4k, False: 68.1k]
  ------------------
  579|   146k|            res = zxc_stream_decode_job(ctx, &cctx, job, in, dict_work);
  580|   146k|        } else if (dict_work) {
  ------------------
  |  Branch (580:20): [True: 78.4k, False: 68.0k]
  ------------------
  581|  78.4k|            ZXC_MEMCPY(dict_work + dsz, in, job->in_sz);
  ------------------
  |  |  168|  78.4k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  582|  78.4k|            res = zxc_stream_process(ctx, &cctx, dict_work, dsz + job->in_sz, job->out_buf,
  583|  78.4k|                                     job->out_cap, job->block_index);
  584|  78.4k|        } else {
  585|  68.0k|            res = zxc_stream_process(ctx, &cctx, in, job->in_sz, job->out_buf, job->out_cap,
  586|  68.0k|                                     job->block_index);
  587|  68.0k|        }
  588|       |
  589|   293k|        pthread_mutex_lock(&ctx->lock);
  590|   293k|        job->result_sz = UNLIKELY(res < 0) ? 0 : (size_t)res;
  ------------------
  |  |  152|   293k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 293k]
  |  |  ------------------
  ------------------
  591|   293k|        job->fail_code = UNLIKELY(res < 0) ? res : 0;
  ------------------
  |  |  152|   293k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 293k]
  |  |  ------------------
  ------------------
  592|   293k|        job->status = JOB_STATUS_PROCESSED;
  593|   293k|        if (UNLIKELY(res < 0)) {
  ------------------
  |  |  152|   293k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 293k]
  |  |  ------------------
  ------------------
  594|       |            // Keep the codec's own diagnosis; io_error only stops the others.
  595|      0|            if (!ctx->fail_code) ctx->fail_code = res;
  ------------------
  |  Branch (595:17): [True: 0, False: 0]
  ------------------
  596|      0|            ctx->io_error = 1;
  597|      0|            pthread_cond_broadcast(&ctx->cond_writer);
  598|      0|            pthread_cond_broadcast(&ctx->cond_reader);
  599|   293k|        } else if (jid == ctx->write_idx) {
  ------------------
  |  Branch (599:20): [True: 192k, False: 100k]
  ------------------
  600|   192k|            pthread_cond_signal(&ctx->cond_writer);
  601|   192k|        }
  602|   293k|        pthread_mutex_unlock(&ctx->lock);
  603|   293k|    }
  604|  59.9k|    ZXC_FREE(in_work);
  ------------------
  |  |   86|  59.9k|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  605|  59.9k|    zxc_cctx_free(&cctx);
  606|       |    return NULL;
  607|  59.9k|}
zxc_driver.c:zxc_ring_next:
  280|  1.17M|static ZXC_ALWAYS_INLINE int zxc_ring_next(const zxc_stream_ctx_t* ctx, const int idx) {
  281|  1.17M|    return (int)(((size_t)idx + 1) % ctx->ring_size);
  282|  1.17M|}
zxc_driver.c:zxc_stream_decode_job:
  469|   146k|                                 uint8_t* dict_work) {
  470|   146k|    const size_t checksum_sz = ctx->file_has_checksum ? ZXC_BLOCK_CHECKSUM_SIZE : 0;
  ------------------
  |  |  441|   101k|#define ZXC_BLOCK_CHECKSUM_SIZE 4
  ------------------
  |  Branch (470:32): [True: 101k, False: 44.7k]
  ------------------
  471|       |    // One block of output plus the fast decoder's margin.
  472|   146k|    const size_t room = ctx->chunk_size + ZXC_DECOMPRESS_TAIL_PAD;
  ------------------
  |  |  372|   146k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|   146k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|   146k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|   146k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   146k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   146k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   146k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  342|   146k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  473|       |    // Dictionary: decode behind the prefix so back-references resolve.
  474|   146k|    uint8_t* const scratch = cctx->dict_size ? dict_work + cctx->dict_size : NULL;
  ------------------
  |  Branch (474:30): [True: 78.4k, False: 68.1k]
  ------------------
  475|   146k|    uint64_t block_index = job->block_index;
  476|   146k|    size_t ip = 0;
  477|   146k|    size_t op = 0;
  478|       |
  479|   293k|    while (ip < job->in_sz) {
  ------------------
  |  Branch (479:12): [True: 146k, False: 146k]
  ------------------
  480|   146k|        const size_t rem = job->in_sz - ip;
  481|   146k|        zxc_block_header_t bh;
  482|   146k|        if (UNLIKELY(rem < ZXC_BLOCK_HEADER_SIZE ||
  ------------------
  |  |  152|   293k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 146k]
  |  |  |  Branch (152:42): [True: 18.4E, False: 146k]
  |  |  |  Branch (152:42): [True: 99, False: 146k]
  |  |  ------------------
  ------------------
  483|   146k|                     zxc_read_block_header(in + ip, ZXC_BLOCK_HEADER_SIZE, &bh) != ZXC_OK))
  484|      0|            return ZXC_ERROR_CORRUPT_DATA;
  485|   146k|        const uint64_t block_sz = (uint64_t)ZXC_BLOCK_HEADER_SIZE + bh.comp_size + checksum_sz;
  ------------------
  |  |  439|   146k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
  486|   146k|        if (UNLIKELY(block_sz > rem || job->out_cap - op < room)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|   292k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 146k]
  |  |  |  Branch (152:42): [True: 100, False: 146k]
  |  |  |  Branch (152:42): [True: 18.4E, False: 146k]
  |  |  ------------------
  ------------------
  487|       |
  488|   146k|        const int res =
  489|   146k|            zxc_stream_process(ctx, cctx, in + ip, (size_t)block_sz,
  490|   146k|                               scratch ? scratch : job->out_buf + op, room, block_index++);
  ------------------
  |  Branch (490:32): [True: 78.3k, False: 68.1k]
  ------------------
  491|   146k|        if (UNLIKELY(res < 0)) return res;
  ------------------
  |  |  152|   146k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 146k]
  |  |  ------------------
  ------------------
  492|   146k|        if (scratch) ZXC_MEMCPY(job->out_buf + op, scratch, (size_t)res);
  ------------------
  |  |  168|  78.3k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  |  Branch (492:13): [True: 78.3k, False: 68.2k]
  ------------------
  493|   146k|        ip += (size_t)block_sz;
  494|   146k|        op += (size_t)res;
  495|   146k|    }
  496|   146k|    return (int)op;
  497|   146k|}
zxc_driver.c:zxc_stream_process:
  453|   293k|                                                const size_t out_cap, const uint64_t block_index) {
  454|   293k|    return ctx->compression_mode
  ------------------
  |  Branch (454:12): [True: 146k, False: 146k]
  ------------------
  455|   293k|               ? zxc_compress_chunk_wrapper(cctx, in, in_sz, out, out_cap, block_index)
  456|   293k|               : zxc_decompress_chunk_wrapper(cctx, in, in_sz, out, out_cap, block_index);
  457|   293k|}
zxc_driver.c:zxc_async_writer:
  638|  36.7k|static void* zxc_async_writer(void* arg) {
  639|  36.7k|    writer_args_t* const args = (writer_args_t*)arg;
  640|  36.7k|    zxc_stream_ctx_t* const ctx = args->ctx;
  641|   329k|    while (1) {
  ------------------
  |  Branch (641:12): [True: 329k, Folded]
  ------------------
  642|   329k|        zxc_stream_job_t* const job = &ctx->jobs[ctx->write_idx];
  643|   329k|        pthread_mutex_lock(&ctx->lock);
  644|   532k|        while (job->status != JOB_STATUS_PROCESSED && !ctx->workers_lost &&
  ------------------
  |  Branch (644:16): [True: 202k, False: 329k]
  |  Branch (644:55): [True: 202k, False: 0]
  ------------------
  645|   202k|               !(ctx->io_error && job->status == JOB_STATUS_FREE))
  ------------------
  |  Branch (645:18): [True: 0, False: 202k]
  |  Branch (645:35): [True: 0, False: 0]
  ------------------
  646|   202k|            pthread_cond_wait(&ctx->cond_writer, &ctx->lock);
  647|   329k|        if (UNLIKELY(job->status != JOB_STATUS_PROCESSED)) {
  ------------------
  |  |  152|   329k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 329k]
  |  |  ------------------
  ------------------
  648|      0|            pthread_mutex_unlock(&ctx->lock);
  649|      0|            break;
  650|      0|        }
  651|   329k|        if (UNLIKELY(job->fail_code)) {
  ------------------
  |  |  152|   329k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 329k]
  |  |  ------------------
  ------------------
  652|       |            // First in stream order, not the first to finish.
  653|      0|            ctx->fail_code = job->fail_code;
  654|      0|            job->status = JOB_STATUS_FREE;
  655|      0|            pthread_cond_signal(&ctx->cond_reader);
  656|      0|            pthread_mutex_unlock(&ctx->lock);
  657|      0|            break;
  658|      0|        }
  659|       |
  660|   329k|        const size_t result_sz = job->result_sz;
  661|   329k|        const size_t in_sz = job->in_sz;
  662|   329k|        pthread_mutex_unlock(&ctx->lock);
  663|       |
  664|   329k|        if (result_sz == (size_t)-1) break;
  ------------------
  |  Branch (664:13): [True: 36.7k, False: 293k]
  ------------------
  665|       |
  666|   293k|        if (args->f && result_sz > 0) {
  ------------------
  |  Branch (666:13): [True: 293k, False: 0]
  |  Branch (666:24): [True: 293k, False: 0]
  ------------------
  667|   293k|            if (fwrite(job->out_buf, 1, result_sz, args->f) != result_sz) {
  ------------------
  |  Branch (667:17): [True: 0, False: 293k]
  ------------------
  668|      0|                pthread_mutex_lock(&ctx->lock);
  669|      0|                ctx->fail_code = ZXC_ERROR_IO;  // Before any job still to be written
  670|      0|                ctx->io_error = 1;
  671|      0|                job->status = JOB_STATUS_FREE;
  672|      0|                pthread_cond_signal(&ctx->cond_reader);
  673|      0|                pthread_mutex_unlock(&ctx->lock);
  674|      0|                break;
  675|      0|            }
  676|   293k|        }
  677|   293k|        args->total_bytes += (int64_t)result_sz;
  678|   293k|        if (ctx->checksum_enabled && ctx->compression_mode == 1 &&
  ------------------
  |  Branch (678:13): [True: 203k, False: 89.4k]
  |  Branch (678:38): [True: 101k, False: 101k]
  ------------------
  679|   101k|            LIKELY(result_sz >= ZXC_BLOCK_CHECKSUM_SIZE))
  ------------------
  |  |  146|   101k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 101k, False: 0]
  |  |  ------------------
  ------------------
  680|   101k|            args->digest = zxc_digest_combine(
  681|   101k|                args->digest, zxc_le32(job->out_buf + result_sz - ZXC_BLOCK_CHECKSUM_SIZE));
  ------------------
  |  |  441|   101k|#define ZXC_BLOCK_CHECKSUM_SIZE 4
  ------------------
  682|       |
  683|       |        // Seekable: record compressed block size
  684|   293k|        if (args->seek_comp && ctx->compression_mode == 1) {
  ------------------
  |  Branch (684:13): [True: 107k, False: 185k]
  |  Branch (684:32): [True: 107k, False: 0]
  ------------------
  685|   107k|            if (UNLIKELY(args->seek_count >= args->seek_cap)) {
  ------------------
  |  |  152|   107k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 608, False: 107k]
  |  |  ------------------
  ------------------
  686|    608|                const uint64_t max_cap = SIZE_MAX / sizeof(uint32_t);
  687|    608|                uint32_t* nc = NULL;
  688|    608|                if (LIKELY(args->seek_cap < max_cap)) {
  ------------------
  |  |  146|    608|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 608, False: 0]
  |  |  ------------------
  ------------------
  689|    608|                    args->seek_cap = args->seek_cap < max_cap / 2 ? args->seek_cap * 2 : max_cap;
  ------------------
  |  Branch (689:38): [True: 608, False: 0]
  ------------------
  690|    608|                    nc = (uint32_t*)ZXC_REALLOC(args->seek_comp,
  ------------------
  |  |   80|    608|#define ZXC_REALLOC(ptr, size) realloc(ptr, size)
  ------------------
  691|    608|                                                (size_t)args->seek_cap * sizeof(uint32_t));
  692|    608|                }
  693|       |                // LCOV_EXCL_START
  694|    608|                if (UNLIKELY(!nc)) {
  ------------------
  |  |  152|    608|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 608]
  |  |  ------------------
  ------------------
  695|      0|                    pthread_mutex_lock(&ctx->lock);
  696|      0|                    if (!ctx->fail_code) ctx->fail_code = ZXC_ERROR_MEMORY;
  ------------------
  |  Branch (696:25): [True: 0, False: 0]
  ------------------
  697|      0|                    ctx->io_error = 1;
  698|      0|                    job->status = JOB_STATUS_FREE;
  699|      0|                    pthread_cond_signal(&ctx->cond_reader);
  700|      0|                    pthread_mutex_unlock(&ctx->lock);
  701|      0|                    break;
  702|      0|                }
  703|       |                // LCOV_EXCL_STOP
  704|    608|                args->seek_comp = nc;
  705|    608|            }
  706|   107k|            args->seek_comp[args->seek_count++] = (uint32_t)result_sz;
  707|   107k|        }
  708|       |
  709|   293k|        if (ctx->progress_cb) {
  ------------------
  |  Branch (709:13): [True: 111k, False: 181k]
  ------------------
  710|       |            // LCOV_EXCL_START
  711|   111k|            args->bytes_processed += ctx->compression_mode == 1 ? in_sz : result_sz;
  ------------------
  |  Branch (711:38): [True: 55.7k, False: 55.7k]
  ------------------
  712|   111k|            ctx->progress_cb(args->bytes_processed, ctx->total_input_bytes,
  713|   111k|                             ctx->progress_user_data);
  714|       |            // LCOV_EXCL_STOP
  715|   111k|        }
  716|       |
  717|   293k|        pthread_mutex_lock(&ctx->lock);
  718|   293k|        job->status = JOB_STATUS_FREE;
  719|   293k|        ctx->write_idx = zxc_ring_next(ctx, ctx->write_idx);
  720|   293k|        pthread_cond_signal(&ctx->cond_reader);
  721|   293k|        pthread_mutex_unlock(&ctx->lock);
  722|   293k|    }
  723|       |    return NULL;
  724|  36.7k|}
zxc_driver.c:zxc_stream_read_loop:
 1030|  36.7k|                                const int has_dict) {
 1031|  36.7k|    int read_eof = 0;
 1032|  36.7k|    uint64_t block_index = 0;
 1033|       |
 1034|   329k|    while (!read_eof) {
  ------------------
  |  Branch (1034:12): [True: 311k, False: 18.0k]
  ------------------
 1035|   311k|        zxc_stream_job_t* const job = &ctx->jobs[read_idx];
 1036|   311k|        pthread_mutex_lock(&ctx->lock);
 1037|   435k|        while (job->status != JOB_STATUS_FREE && !ctx->io_error)
  ------------------
  |  Branch (1037:16): [True: 123k, False: 311k]
  |  Branch (1037:50): [True: 123k, False: 0]
  ------------------
 1038|   123k|            pthread_cond_wait(&ctx->cond_reader, &ctx->lock);
 1039|   311k|        const int failed = ctx->io_error;
 1040|   311k|        pthread_mutex_unlock(&ctx->lock);
 1041|       |
 1042|   311k|        if (UNLIKELY(failed)) break;
  ------------------
  |  |  152|   311k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 311k]
  |  |  ------------------
  ------------------
 1043|       |
 1044|   311k|        int n_blocks = 1;
 1045|   311k|        const size_t read_sz = ctx->compression_mode
  ------------------
  |  Branch (1045:32): [True: 146k, False: 164k]
  ------------------
 1046|   311k|                                   ? zxc_stream_read_chunk(ctx, f_in, job, &read_eof)
 1047|   311k|                                   : zxc_stream_read_blocks(ctx, f_in, job, &n_blocks, &read_eof);
 1048|   311k|        if (UNLIKELY(read_eof && read_sz == 0)) break;
  ------------------
  |  |  152|   348k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 18.7k, False: 293k]
  |  |  |  Branch (152:42): [True: 36.7k, False: 275k]
  |  |  |  Branch (152:42): [True: 18.7k, False: 18.0k]
  |  |  ------------------
  ------------------
 1049|       |
 1050|   293k|        job->in_sz = read_sz;
 1051|   293k|        job->has_dict = has_dict;
 1052|   293k|        job->block_index = block_index;
 1053|   293k|        block_index += (uint64_t)n_blocks;
 1054|   293k|        pthread_mutex_lock(&ctx->lock);
 1055|   293k|        job->status = JOB_STATUS_FILLED;
 1056|   293k|        ctx->worker_queue[ctx->wq_head] = read_idx;
 1057|   293k|        ctx->wq_head = zxc_ring_next(ctx, ctx->wq_head);
 1058|   293k|        ctx->wq_count++;
 1059|   293k|        read_idx = zxc_ring_next(ctx, read_idx);
 1060|   293k|        pthread_cond_signal(&ctx->cond_worker);
 1061|   293k|        pthread_mutex_unlock(&ctx->lock);
 1062|   293k|    }
 1063|  36.7k|    return read_idx;
 1064|  36.7k|}
zxc_driver.c:zxc_stream_read_chunk:
 1010|   146k|                                    int* eof) {
 1011|   146k|    const size_t got = fread(job->in_buf, 1, ctx->chunk_size, f_in);
 1012|   146k|    ctx->src_total += got;
 1013|   146k|    if (got < ctx->chunk_size) {
  ------------------
  |  Branch (1013:9): [True: 18.3k, False: 128k]
  ------------------
 1014|  18.3k|        *eof = 1;
 1015|  18.3k|        if (UNLIKELY(!feof(f_in))) {
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1016|      0|            zxc_stream_reader_fail(ctx, ZXC_ERROR_IO);
 1017|      0|            return 0;
 1018|      0|        }
 1019|  18.3k|    }
 1020|   146k|    return got;
 1021|   146k|}
zxc_driver.c:zxc_stream_read_blocks:
  910|   164k|                                     int* n_blocks, int* eof) {
  911|   164k|    const int positioned = ctx->in_fd >= 0;
  912|   164k|    const size_t checksum_sz = ctx->file_has_checksum ? ZXC_BLOCK_CHECKSUM_SIZE : 0;
  ------------------
  |  |  441|   114k|#define ZXC_BLOCK_CHECKSUM_SIZE 4
  ------------------
  |  Branch (912:32): [True: 114k, False: 50.9k]
  ------------------
  913|       |    // Folded only when finish_decompress will compare it: like the block
  914|       |    // checksums, the file flag and the caller's switch both.
  915|   164k|    const int fold = ctx->file_has_checksum && ctx->checksum_enabled;
  ------------------
  |  Branch (915:22): [True: 114k, False: 50.9k]
  |  Branch (915:48): [True: 114k, False: 0]
  ------------------
  916|   164k|    size_t fill = 0;
  917|   164k|    int code = 0;  // 0: a read error
  918|       |
  919|   311k|    for (*n_blocks = 0; *n_blocks < ctx->batch; (*n_blocks)++) {
  ------------------
  |  Branch (919:25): [True: 164k, False: 146k]
  ------------------
  920|   164k|        uint8_t bh_buf[ZXC_BLOCK_HEADER_SIZE];
  921|   164k|        const uint64_t block_off = ctx->in_pos;
  922|   164k|        int64_t h_read;
  923|   164k|        if (positioned && ctx->ahead_len >= 0) {
  ------------------
  |  Branch (923:13): [True: 0, False: 164k]
  |  Branch (923:27): [True: 0, False: 0]
  ------------------
  924|      0|            h_read = ctx->ahead_len;
  925|      0|            ZXC_MEMCPY(bh_buf, ctx->ahead, (size_t)h_read);
  ------------------
  |  |  168|      0|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  926|      0|            ctx->ahead_len = -1;
  927|   164k|        } else if (positioned) {
  ------------------
  |  Branch (927:20): [True: 0, False: 164k]
  ------------------
  928|      0|            h_read = zxc_stream_read_at(ctx, bh_buf, sizeof(bh_buf), ctx->in_pos);
  929|   164k|        } else {
  930|   164k|            h_read = zxc_stream_in_read(NULL, f_in, bh_buf, sizeof(bh_buf));
  931|   164k|        }
  932|   164k|        if (UNLIKELY(h_read < 0)) goto _failed;  // LCOV_EXCL_LINE
  ------------------
  |  |  152|   164k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 164k]
  |  |  ------------------
  ------------------
  933|   164k|        if (positioned) ctx->in_pos += (uint64_t)h_read;
  ------------------
  |  Branch (933:13): [True: 0, False: 164k]
  ------------------
  934|   164k|        if (UNLIKELY(h_read < ZXC_BLOCK_HEADER_SIZE)) {
  ------------------
  |  |  152|   164k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 164k]
  |  |  ------------------
  ------------------
  935|      0|            *eof = 1;
  936|      0|            return fill;
  937|      0|        }
  938|       |
  939|   164k|        zxc_block_header_t bh;
  940|   164k|        if (UNLIKELY(zxc_read_block_header(bh_buf, ZXC_BLOCK_HEADER_SIZE, &bh) != ZXC_OK)) {
  ------------------
  |  |  152|   164k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 164k]
  |  |  ------------------
  ------------------
  941|       |            // Bad checksum: corrupt data. Good checksum, Flags/Reserved set: bad header.
  942|      0|            uint8_t sum[ZXC_BLOCK_HEADER_SIZE];
  943|      0|            ZXC_MEMCPY(sum, bh_buf, ZXC_BLOCK_HEADER_SIZE);
  ------------------
  |  |  168|      0|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  944|      0|            sum[7] = 0;
  945|      0|            code = bh_buf[7] == zxc_hash8(sum) ? ZXC_ERROR_BAD_HEADER : ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  Branch (945:20): [True: 0, False: 0]
  ------------------
  946|      0|            goto _failed;
  947|      0|        }
  948|       |
  949|   164k|        if (bh.block_type == ZXC_BLOCK_EOF) {
  ------------------
  |  Branch (949:13): [True: 18.3k, False: 146k]
  ------------------
  950|  18.3k|            if (UNLIKELY(zxc_check_eof_header(bh_buf) != ZXC_OK)) {
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  951|      0|                code = ZXC_ERROR_BAD_HEADER;
  952|      0|                goto _failed;
  953|      0|            }
  954|  18.3k|            ctx->frame_in += ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  439|  18.3k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
  955|  18.3k|            *eof = 1;
  956|  18.3k|            return fill;
  957|  18.3k|        }
  958|       |
  959|   146k|        if (UNLIKELY((uint64_t)bh.comp_size > (uint64_t)ctx->chunk_size)) {
  ------------------
  |  |  152|   146k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 146k]
  |  |  ------------------
  ------------------
  960|      0|            code = ZXC_ERROR_BAD_BLOCK_SIZE;  // LCOV_EXCL_LINE
  961|      0|            goto _failed;                     // LCOV_EXCL_LINE
  962|      0|        }
  963|       |
  964|   146k|        const size_t body_total = (size_t)bh.comp_size + checksum_sz;
  965|   146k|        const uint64_t total_len = (uint64_t)body_total + ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  439|   146k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
  966|   146k|        if (UNLIKELY(total_len > (uint64_t)(job->in_cap - fill))) goto _failed;
  ------------------
  |  |  152|   146k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 146k]
  |  |  ------------------
  ------------------
  967|       |
  968|   146k|        uint8_t tail[ZXC_BLOCK_CHECKSUM_SIZE + ZXC_BLOCK_HEADER_SIZE];
  969|   146k|        const uint8_t* stored = tail;
  970|   146k|        int got = 1;
  971|       |
  972|   146k|        if (positioned) {
  ------------------
  |  Branch (972:13): [True: 0, False: 146k]
  ------------------
  973|       |            // The worker reads the bodies; the digest needs only the checksum,
  974|       |            // read with the next header.
  975|      0|            if (fill == 0) job->in_off = block_off;
  ------------------
  |  Branch (975:17): [True: 0, False: 0]
  ------------------
  976|      0|            ctx->in_pos += body_total;
  977|      0|            if (fold) {
  ------------------
  |  Branch (977:17): [True: 0, False: 0]
  ------------------
  978|      0|                const int64_t r = zxc_stream_read_at(ctx, tail, sizeof(tail),
  979|      0|                                                     ctx->in_pos - ZXC_BLOCK_CHECKSUM_SIZE);
  ------------------
  |  |  441|      0|#define ZXC_BLOCK_CHECKSUM_SIZE 4
  ------------------
  980|      0|                got = r >= ZXC_BLOCK_CHECKSUM_SIZE;
  ------------------
  |  |  441|      0|#define ZXC_BLOCK_CHECKSUM_SIZE 4
  ------------------
  981|      0|                if (LIKELY(got)) {
  ------------------
  |  |  146|      0|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  982|      0|                    ctx->ahead_len = (int)(r - ZXC_BLOCK_CHECKSUM_SIZE);
  ------------------
  |  |  441|      0|#define ZXC_BLOCK_CHECKSUM_SIZE 4
  ------------------
  983|      0|                    ZXC_MEMCPY(ctx->ahead, tail + ZXC_BLOCK_CHECKSUM_SIZE, (size_t)ctx->ahead_len);
  ------------------
  |  |  168|      0|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  984|      0|                }
  985|      0|            }
  986|   146k|        } else {
  987|   146k|            uint8_t* const block = job->in_buf + fill;
  988|   146k|            ZXC_MEMCPY(block, bh_buf, ZXC_BLOCK_HEADER_SIZE);
  ------------------
  |  |  168|   146k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  989|   146k|            stored = block + ZXC_BLOCK_HEADER_SIZE + bh.comp_size;
  ------------------
  |  |  439|   146k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
  990|       |
  991|       |            // Single fread for body + checksum (reduces syscalls)
  992|   146k|            got = fread(block + ZXC_BLOCK_HEADER_SIZE, 1, body_total, f_in) == body_total;
  ------------------
  |  |  439|   146k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
  993|   146k|        }
  994|       |
  995|   146k|        if (UNLIKELY(!got)) goto _failed;
  ------------------
  |  |  152|   146k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 146k]
  |  |  ------------------
  ------------------
  996|   146k|        if (fold) ctx->digest = zxc_digest_combine(ctx->digest, zxc_le32(stored));
  ------------------
  |  Branch (996:13): [True: 101k, False: 44.7k]
  ------------------
  997|   146k|        fill += (size_t)total_len;
  998|   146k|        ctx->frame_in += total_len;
  999|   146k|    }
 1000|   146k|    return fill;
 1001|       |
 1002|      0|_failed:
 1003|      0|    zxc_stream_reader_fail(ctx, code);
 1004|      0|    *eof = 1;
 1005|      0|    return 0;
 1006|   164k|}
zxc_driver.c:zxc_stream_in_read:
  424|   269k|static int64_t zxc_stream_in_read(zxc_stream_ctx_t* ctx, FILE* f, void* dst, const size_t len) {
  425|   269k|    if (ctx && ctx->in_fd >= 0) {
  ------------------
  |  Branch (425:9): [True: 49.0k, False: 220k]
  |  Branch (425:16): [True: 0, False: 49.0k]
  ------------------
  426|      0|        const int64_t r = zxc_stream_read_at(ctx, dst, len, ctx->in_pos);
  427|      0|        if (LIKELY(r > 0)) ctx->in_pos += (uint64_t)r;
  ------------------
  |  |  146|      0|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  428|      0|        return r;
  429|      0|    }
  430|   269k|    const size_t got = fread(dst, 1, len, f);
  431|       |    // A short read without EOF is a read error. Not ferror(): the caller may have
  432|       |    // left a stale error indicator on the stream.
  433|   269k|    if (UNLIKELY(got < len && !feof(f))) return ZXC_ERROR_IO;  // LCOV_EXCL_LINE
  ------------------
  |  |  152|   287k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 269k]
  |  |  |  Branch (152:42): [True: 18.4k, False: 250k]
  |  |  |  Branch (152:42): [True: 0, False: 18.4k]
  |  |  ------------------
  ------------------
  434|   269k|    return (int64_t)got;
  435|   269k|}
zxc_driver.c:zxc_stream_engine_stop:
  733|  36.7k|static void zxc_stream_engine_stop(zxc_stream_engine_t* e, const int writer_started) {
  734|  36.7k|    zxc_stream_ctx_t* const ctx = &e->ctx;
  735|  36.7k|    if (writer_started) {
  ------------------
  |  Branch (735:9): [True: 36.7k, False: 0]
  ------------------
  736|  36.7k|        zxc_stream_job_t* const end_job = &ctx->jobs[e->read_idx];
  737|  36.7k|        pthread_mutex_lock(&ctx->lock);
  738|  40.1k|        while (end_job->status != JOB_STATUS_FREE && !ctx->io_error)
  ------------------
  |  Branch (738:16): [True: 3.35k, False: 36.7k]
  |  Branch (738:54): [True: 3.35k, False: 0]
  ------------------
  739|  3.35k|            pthread_cond_wait(&ctx->cond_reader, &ctx->lock);
  740|  36.7k|        if (end_job->status == JOB_STATUS_FREE) {
  ------------------
  |  Branch (740:13): [True: 36.7k, False: 0]
  ------------------
  741|  36.7k|            end_job->result_sz = (size_t)-1;
  742|  36.7k|            end_job->fail_code = 0;
  743|  36.7k|            end_job->status = JOB_STATUS_PROCESSED;
  744|  36.7k|        }
  745|  36.7k|        pthread_cond_broadcast(&ctx->cond_writer);
  746|  36.7k|        pthread_mutex_unlock(&ctx->lock);
  747|  36.7k|        pthread_join(e->writer, NULL);
  748|  36.7k|    }
  749|  36.7k|    pthread_mutex_lock(&ctx->lock);
  750|  36.7k|    ctx->shutdown_workers = 1;
  751|  36.7k|    pthread_cond_broadcast(&ctx->cond_worker);
  752|  36.7k|    pthread_mutex_unlock(&ctx->lock);
  753|  96.7k|    for (int i = 0; i < e->n_workers; i++) pthread_join(e->workers[i], NULL);
  ------------------
  |  Branch (753:21): [True: 60.0k, False: 36.7k]
  ------------------
  754|       |
  755|  36.7k|    pthread_cond_destroy(&ctx->cond_writer);
  756|  36.7k|    pthread_cond_destroy(&ctx->cond_worker);
  757|  36.7k|    pthread_cond_destroy(&ctx->cond_reader);
  758|  36.7k|    pthread_mutex_destroy(&ctx->lock);
  759|  36.7k|    ZXC_FREE(e->workers);
  ------------------
  |  |   86|  36.7k|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  760|  36.7k|    ZXC_ALIGNED_FREE(e->mem_block);
  ------------------
  |  |  137|  36.7k|#define ZXC_ALIGNED_FREE(ptr) zxc_aligned_free(ptr)
  ------------------
  761|  36.7k|}
zxc_driver.c:zxc_stream_finish_compress:
 1071|  18.3k|static void zxc_stream_finish_compress(zxc_stream_ctx_t* ctx, writer_args_t* w, FILE* f_out) {
 1072|       |    // EOF block
 1073|  18.3k|    uint8_t eof_buf[ZXC_BLOCK_HEADER_SIZE];
 1074|  18.3k|    const zxc_block_header_t eof_bh = {
 1075|  18.3k|        .block_type = ZXC_BLOCK_EOF, .block_flags = 0, .reserved = 0, .comp_size = 0};
 1076|  18.3k|    zxc_write_block_header(eof_buf, ZXC_BLOCK_HEADER_SIZE, &eof_bh);
  ------------------
  |  |  439|  18.3k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 1077|  18.3k|    if (UNLIKELY(f_out &&
  ------------------
  |  |  152|  36.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 18.3k, False: 0]
  |  |  |  Branch (152:42): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1078|  18.3k|                 fwrite(eof_buf, 1, ZXC_BLOCK_HEADER_SIZE, f_out) != ZXC_BLOCK_HEADER_SIZE))
 1079|      0|        ctx->io_error = 1;  // LCOV_EXCL_LINE
 1080|  18.3k|    else
 1081|  18.3k|        w->total_bytes += ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  439|  18.3k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 1082|       |
 1083|       |    // Seekable: write SEK block between EOF and footer, empty when no block was read
 1084|  18.3k|    if (!ctx->io_error && w->seek_comp) {
  ------------------
  |  Branch (1084:9): [True: 18.3k, False: 0]
  |  Branch (1084:27): [True: 12.2k, False: 6.17k]
  ------------------
 1085|       |        // Header, then one group at a time (seek_comp itself stays resident).
 1086|  12.2k|        uint8_t st_buf[ZXC_SEEK_GROUP_BYTES];
 1087|  12.2k|        const int h = zxc_seek_table_header(st_buf, sizeof(st_buf), w->seek_count);
 1088|  12.2k|        if (UNLIKELY(h < 0 || (f_out && fwrite(st_buf, 1, (size_t)h, f_out) != (size_t)h)))
  ------------------
  |  |  152|  48.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 12.2k]
  |  |  |  Branch (152:42): [True: 12.2k, False: 0]
  |  |  |  Branch (152:42): [True: 0, False: 12.2k]
  |  |  |  Branch (152:42): [True: 0, False: 12.2k]
  |  |  ------------------
  ------------------
 1089|      0|            ctx->io_error = 1;  // LCOV_EXCL_LINE
 1090|  12.2k|        else
 1091|  12.2k|            w->total_bytes += h;
 1092|       |
 1093|  12.2k|        uint64_t anchor = ZXC_FILE_HEADER_SIZE;
  ------------------
  |  |  126|  12.2k|#define ZXC_FILE_HEADER_SIZE 16
  ------------------
 1094|  25.1k|        for (uint64_t i = 0; i < w->seek_count && !ctx->io_error; i += ZXC_SEEK_GROUP) {
  ------------------
  |  |  474|  12.9k|#define ZXC_SEEK_GROUP 64U
  ------------------
  |  Branch (1094:30): [True: 12.9k, False: 12.2k]
  |  Branch (1094:51): [True: 12.9k, False: 0]
  ------------------
 1095|  12.9k|            const size_t bytes =
 1096|  12.9k|                zxc_seek_write_group(st_buf, &anchor, w->seek_comp + i,
 1097|  12.9k|                                     zxc_seek_group_len(w->seek_count, i / ZXC_SEEK_GROUP));
  ------------------
  |  |  474|  12.9k|#define ZXC_SEEK_GROUP 64U
  ------------------
 1098|  12.9k|            if (UNLIKELY(f_out && fwrite(st_buf, 1, bytes, f_out) != bytes))
  ------------------
  |  |  152|  25.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 12.9k]
  |  |  |  Branch (152:42): [True: 12.9k, False: 0]
  |  |  |  Branch (152:42): [True: 0, False: 12.9k]
  |  |  ------------------
  ------------------
 1099|      0|                ctx->io_error = 1;  // LCOV_EXCL_LINE
 1100|  12.9k|            else
 1101|  12.9k|                w->total_bytes += (int64_t)bytes;
 1102|  12.9k|        }
 1103|  12.2k|    }
 1104|       |
 1105|       |    // Footer (FORMAT.md 8)
 1106|  18.3k|    uint8_t footer_buf[ZXC_FOOTER_MAX_SIZE_WITH_DIGEST];
 1107|  18.3k|    const size_t footer_len =
 1108|  18.3k|        (size_t)zxc_write_file_footer(footer_buf, sizeof(footer_buf), (uint64_t)w->total_bytes,
 1109|  18.3k|                                      ctx->src_total, w->digest, ctx->checksum_enabled);
 1110|  18.3k|    if (UNLIKELY(f_out && fwrite(footer_buf, 1, footer_len, f_out) != footer_len))
  ------------------
  |  |  152|  36.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  |  Branch (152:42): [True: 18.3k, False: 0]
  |  |  |  Branch (152:42): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1111|      0|        ctx->io_error = 1;
 1112|  18.3k|    else
 1113|  18.3k|        w->total_bytes += (int64_t)footer_len;
 1114|  18.3k|}
zxc_driver.c:zxc_stream_read_exact:
 1189|  73.6k|                                 const int short_code) {
 1190|  73.6k|    const int64_t got = zxc_stream_in_read(ctx, f, dst, len);
 1191|  73.6k|    if (LIKELY(got == (int64_t)len)) return ZXC_OK;
  ------------------
  |  |  146|  73.6k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 55.2k, False: 18.4k]
  |  |  ------------------
  ------------------
 1192|  18.4k|    if (UNLIKELY(got < 0)) return ZXC_ERROR_IO;  // LCOV_EXCL_LINE
  ------------------
  |  |  152|  18.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.4k]
  |  |  ------------------
  ------------------
 1193|  18.4k|    return got == 0 ? 1 : short_code;
  ------------------
  |  Branch (1193:12): [True: 18.3k, False: 6]
  ------------------
 1194|  18.4k|}
zxc_driver.c:zxc_stream_read_frame_header:
 1212|  18.4k|                                        int* has_checksum, int* has_seek, int* frame_dict) {
 1213|  18.4k|    uint8_t h[ZXC_FILE_HEADER_SIZE];
 1214|  18.4k|    int header_has_dict = 0;
 1215|  18.4k|    uint32_t header_dict_id = 0;
 1216|  18.4k|    ZXC_MEMCPY(h, magic, sizeof(uint32_t));
  ------------------
  |  |  168|  18.4k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1217|  18.4k|    const int rrc =
 1218|  18.4k|        zxc_stream_read_exact(ctx, f_in, h + sizeof(uint32_t),
 1219|  18.4k|                              ZXC_FILE_HEADER_SIZE - sizeof(uint32_t), ZXC_ERROR_SRC_TOO_SMALL);
  ------------------
  |  |  126|  18.4k|#define ZXC_FILE_HEADER_SIZE 16
  ------------------
 1220|  18.4k|    if (UNLIKELY(rrc != ZXC_OK)) return rrc == 1 ? ZXC_ERROR_SRC_TOO_SMALL : rrc;
  ------------------
  |  |  152|  18.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 7, False: 18.4k]
  |  |  ------------------
  ------------------
  |  Branch (1220:41): [True: 1, False: 6]
  ------------------
 1221|       |
 1222|  18.4k|    const int hrc = zxc_read_file_header(h, ZXC_FILE_HEADER_SIZE, chunk, has_checksum,
  ------------------
  |  |  126|  18.4k|#define ZXC_FILE_HEADER_SIZE 16
  ------------------
 1223|  18.4k|                                         &header_has_dict, &header_dict_id, has_seek);
 1224|  18.4k|    if (UNLIKELY(hrc != ZXC_OK)) return hrc;
  ------------------
  |  |  152|  18.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 30, False: 18.3k]
  |  |  ------------------
  ------------------
 1225|  18.3k|    *frame_dict = header_has_dict;
 1226|  18.3k|    if (header_has_dict) {
  ------------------
  |  Branch (1226:9): [True: 9.72k, False: 8.67k]
  ------------------
 1227|       |#ifdef ZXC_NO_DICT
 1228|       |        return ZXC_ERROR_DICT_UNSUPPORTED;
 1229|       |#endif
 1230|  9.72k|        if (UNLIKELY(!has_dict)) return ZXC_ERROR_DICT_REQUIRED;
  ------------------
  |  |  152|  9.72k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 9.72k]
  |  |  ------------------
  ------------------
 1231|  9.72k|        if (UNLIKELY(dict_id != header_dict_id)) return ZXC_ERROR_DICT_MISMATCH;
  ------------------
  |  |  152|  9.72k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 9.72k]
  |  |  ------------------
  ------------------
 1232|  9.72k|    }
 1233|  18.3k|    return ZXC_OK;
 1234|  18.3k|}
zxc_driver.c:zxc_stream_engine_close:
  881|  18.3k|static int zxc_stream_engine_close(zxc_stream_engine_t* e, FILE* f_in) {
  882|  18.3k|    zxc_stream_engine_stop(e, 1);
  883|  18.3k|    if (e->ctx.in_fd < 0) return ZXC_OK;
  ------------------
  |  Branch (883:9): [True: 18.3k, False: 0]
  ------------------
  884|      0|    e->ctx.in_fd = -1;
  885|      0|    return fseeko(f_in, (long long)e->ctx.in_pos, SEEK_SET) == 0 ? ZXC_OK : ZXC_ERROR_IO;
  ------------------
  |  Branch (885:12): [True: 0, False: 0]
  ------------------
  886|  18.3k|}
zxc_driver.c:zxc_stream_decode_frame:
 1242|  18.3k|                                       const int has_dict) {
 1243|  18.3k|    zxc_stream_ctx_t* const ctx = &e->ctx;
 1244|  18.3k|    const int64_t base = e->w.total_bytes;
 1245|  18.3k|    ctx->file_has_seek = has_seek;
 1246|  18.3k|    ctx->frame_in = ZXC_FILE_HEADER_SIZE;
  ------------------
  |  |  126|  18.3k|#define ZXC_FILE_HEADER_SIZE 16
  ------------------
 1247|  18.3k|    ctx->digest = 0;
 1248|  18.3k|    ctx->ahead_len = -1;
 1249|       |
 1250|  18.3k|    e->read_idx = zxc_stream_read_loop(ctx, f_in, e->read_idx, has_dict);
 1251|  18.3k|    if (!zxc_stream_engine_drain(e))
  ------------------
  |  Branch (1251:9): [True: 18.3k, False: 0]
  ------------------
 1252|  18.3k|        zxc_stream_finish_decompress(ctx, (uint64_t)(e->w.total_bytes - base), f_in);
 1253|       |
 1254|       |    // fail_code holds the cause, else a read/write failed; a worker may still set it.
 1255|  18.3k|    pthread_mutex_lock(&ctx->lock);
 1256|  18.3k|    const int failed = ctx->io_error;
 1257|  18.3k|    const int code = ctx->fail_code;
 1258|  18.3k|    pthread_mutex_unlock(&ctx->lock);
 1259|  18.3k|    if (UNLIKELY(failed)) return code ? code : ZXC_ERROR_IO;
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
  |  Branch (1259:34): [True: 0, False: 0]
  ------------------
 1260|  18.3k|    return e->w.total_bytes - base;
 1261|  18.3k|}
zxc_driver.c:zxc_stream_engine_drain:
  889|  18.3k|static int zxc_stream_engine_drain(zxc_stream_engine_t* e) {
  890|  18.3k|    zxc_stream_ctx_t* const ctx = &e->ctx;
  891|       |    // The writer frees jobs in order: the last one queued is free last.
  892|  18.3k|    const zxc_stream_job_t* const last =
  893|  18.3k|        &ctx->jobs[((size_t)e->read_idx + ctx->ring_size - 1) % ctx->ring_size];
  894|  18.3k|    pthread_mutex_lock(&ctx->lock);
  895|  47.2k|    while (last->status != JOB_STATUS_FREE && !ctx->io_error)
  ------------------
  |  Branch (895:12): [True: 28.8k, False: 18.3k]
  |  Branch (895:47): [True: 28.8k, False: 0]
  ------------------
  896|  28.8k|        pthread_cond_wait(&ctx->cond_reader, &ctx->lock);
  897|  18.3k|    const int failed = ctx->io_error;
  898|  18.3k|    pthread_mutex_unlock(&ctx->lock);
  899|  18.3k|    return failed;
  900|  18.3k|}
zxc_driver.c:zxc_stream_finish_decompress:
 1120|  18.3k|                                         FILE* f_in) {
 1121|       |    // After the EOF block: the SEK block when the header announced one, then the
 1122|       |    // footer, whose length follows from the bytes read and the bytes produced.
 1123|  18.3k|    int failed = 0;
 1124|  18.3k|    int code = 0;  // 0: an I/O error
 1125|       |
 1126|  18.3k|    if (ctx->file_has_seek) {
  ------------------
  |  Branch (1126:9): [True: 12.2k, False: 6.17k]
  ------------------
 1127|  12.2k|        uint8_t sek[ZXC_BLOCK_HEADER_SIZE];
 1128|  12.2k|        uint64_t remaining = 0;
 1129|  12.2k|        uint64_t sek_bytes = 0;
 1130|       |        // A short read is a truncation, unless the bytes read already disagree.
 1131|  12.2k|        const int64_t got = zxc_stream_in_read(ctx, f_in, sek, sizeof(sek));
 1132|  12.2k|        const int src_rc = got < 0 ? ZXC_ERROR_IO
  ------------------
  |  Branch (1132:28): [True: 0, False: 12.2k]
  ------------------
 1133|  12.2k|                                   : zxc_check_seek_header(sek, (size_t)got, frame_out,
 1134|  12.2k|                                                           ctx->chunk_size, &remaining);
 1135|  12.2k|        if (UNLIKELY(src_rc != ZXC_OK)) {
  ------------------
  |  |  152|  12.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 12.2k]
  |  |  ------------------
  ------------------
 1136|      0|            failed = 1;
 1137|      0|            if (src_rc == ZXC_ERROR_CORRUPT_DATA) code = src_rc;
  ------------------
  |  Branch (1137:17): [True: 0, False: 0]
  ------------------
 1138|      0|        }
 1139|  12.2k|        sek_bytes = remaining;
 1140|       |        // Skip the SEK payload; positioned, a cut table shows at the footer read.
 1141|  12.2k|        if (ctx->in_fd >= 0) {
  ------------------
  |  Branch (1141:13): [True: 0, False: 12.2k]
  ------------------
 1142|      0|            ctx->in_pos += remaining;
 1143|      0|            remaining = 0;
 1144|      0|        }
 1145|  12.2k|        uint8_t discard[512];  // scratch, any size
 1146|  24.7k|        while (remaining > 0 && !failed) {
  ------------------
  |  Branch (1146:16): [True: 12.5k, False: 12.2k]
  |  Branch (1146:33): [True: 12.5k, False: 0]
  ------------------
 1147|  12.5k|            const size_t chunk = remaining < sizeof(discard) ? (size_t)remaining : sizeof(discard);
  ------------------
  |  Branch (1147:34): [True: 12.2k, False: 370]
  ------------------
 1148|  12.5k|            if (UNLIKELY(fread(discard, 1, chunk, f_in) != chunk)) failed = 1;
  ------------------
  |  |  152|  12.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 12.5k]
  |  |  ------------------
  ------------------
 1149|  12.5k|            remaining -= chunk;
 1150|  12.5k|        }
 1151|  12.2k|        ctx->frame_in += ZXC_BLOCK_HEADER_SIZE + sek_bytes;
  ------------------
  |  |  439|  12.2k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 1152|  12.2k|    }
 1153|  18.3k|    const zxc_footer_layout_t fl =
 1154|  18.3k|        zxc_footer_layout(ctx->frame_in, frame_out, ctx->file_has_checksum);
 1155|  18.3k|    uint64_t stored_digest = 0;
 1156|  18.3k|    if (!failed) {
  ------------------
  |  Branch (1156:9): [True: 18.3k, False: 0]
  ------------------
 1157|  18.3k|        uint8_t footer[ZXC_FOOTER_MAX_SIZE_WITH_DIGEST];
 1158|  18.3k|        const int64_t got = zxc_stream_in_read(ctx, f_in, footer, fl.len);
 1159|  18.3k|        const int frc =
 1160|  18.3k|            got < 0 ? ZXC_ERROR_IO
  ------------------
  |  Branch (1160:13): [True: 0, False: 18.3k]
  ------------------
 1161|  18.3k|                    : zxc_check_file_footer(footer, (size_t)got, &fl, frame_out, &stored_digest);
 1162|  18.3k|        if (UNLIKELY(frc != ZXC_OK)) {
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1163|      0|            failed = 1;
 1164|      0|            if (frc == ZXC_ERROR_CORRUPT_DATA) code = frc;
  ------------------
  |  Branch (1164:17): [True: 0, False: 0]
  ------------------
 1165|      0|        }
 1166|  18.3k|    }
 1167|  18.3k|    if (!failed && ctx->file_has_checksum && ctx->checksum_enabled &&
  ------------------
  |  Branch (1167:9): [True: 18.3k, False: 0]
  |  Branch (1167:20): [True: 12.1k, False: 6.23k]
  |  Branch (1167:46): [True: 12.1k, False: 0]
  ------------------
 1168|  12.1k|        UNLIKELY(stored_digest != ctx->digest)) {
  ------------------
  |  |  152|  12.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 12.1k]
  |  |  ------------------
  ------------------
 1169|      0|        failed = 1;
 1170|      0|        code = ZXC_ERROR_BAD_CHECKSUM;
 1171|      0|    }
 1172|  18.3k|    if (UNLIKELY(failed)) zxc_stream_reader_fail(ctx, code);
  ------------------
  |  |  152|  18.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
 1173|       |    // Whatever follows is the next frame's, or an error: see zxc_stream_decompress().
 1174|  18.3k|}
zxc_driver.c:zxc_file_scan_read:
 1453|  73.6k|                              const size_t len) {
 1454|  73.6k|    FILE* const f = (FILE*)src->ctx;
 1455|  73.6k|    if (UNLIKELY(fseeko(f, (long long)off, SEEK_SET) != 0 || fread(dst, 1, len, f) != len))
  ------------------
  |  |  152|   147k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 73.6k]
  |  |  |  Branch (152:42): [True: 0, False: 73.6k]
  |  |  |  Branch (152:42): [True: 0, False: 73.6k]
  |  |  ------------------
  ------------------
 1456|      0|        return ZXC_ERROR_IO;  // LCOV_EXCL_LINE
 1457|  73.6k|    return ZXC_OK;
 1458|  73.6k|}

zxc_huf_build_code_lengths_default:
  159|   392k|                               void* RESTRICT scratch, const int max_code_len) {
  160|   392k|    ZXC_MEMSET(code_len, 0, ZXC_HUF_NUM_SYMBOLS);
  ------------------
  |  |  173|   392k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  161|       |
  162|   392k|    pm_leaf_t leaves[ZXC_HUF_NUM_SYMBOLS];
  163|   392k|    int n = 0;
  164|   100M|    for (int i = 0; i < ZXC_HUF_NUM_SYMBOLS; i++) {
  ------------------
  |  |  833|   100M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (164:21): [True: 100M, False: 392k]
  ------------------
  165|   100M|        if (freq[i] > 0) {
  ------------------
  |  Branch (165:13): [True: 44.5M, False: 55.7M]
  ------------------
  166|  44.5M|            leaves[n].w = freq[i];
  167|  44.5M|            leaves[n].sym = (int16_t)i;
  168|  44.5M|            n++;
  169|  44.5M|        }
  170|   100M|    }
  171|   392k|    if (UNLIKELY(n == 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|   392k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 392k]
  |  |  ------------------
  ------------------
  172|   392k|    if (n == 1) {
  ------------------
  |  Branch (172:9): [True: 637, False: 392k]
  ------------------
  173|    637|        code_len[leaves[0].sym] = 1;
  174|    637|        return ZXC_OK;
  175|    637|    }
  176|       |
  177|   392k|    pm_leaves_sort(leaves, n);
  178|       |
  179|       |    // Callers pass max_code_len >= 8, and n <= 256 <= 2^max_code_len, so the
  180|       |    // length limit is always feasible (a full 8-bit code covers all 256 symbols).
  181|   392k|    const int max_per_level = 2 * n;
  182|       |
  183|       |    // Working buffers: either carve from caller-provided scratch (sized for
  184|       |    // the worst-case alphabet) or fall back to per-call malloc/free.
  185|   392k|    pm_item_t* items;
  186|   392k|    int* counts;
  187|   392k|    frame_t* stack;
  188|   392k|    pm_item_t* owned_items = NULL;
  189|   392k|    int* owned_counts = NULL;
  190|   392k|    frame_t* owned_stack = NULL;
  191|   392k|    if (scratch) {
  ------------------
  |  Branch (191:9): [True: 392k, False: 18.4E]
  ------------------
  192|   392k|        uint8_t* p = (uint8_t*)scratch;
  193|   392k|        items = (pm_item_t*)p;
  194|   392k|        p +=
  195|   392k|            (size_t)ZXC_HUF_MAX_CODE_LEN_ULTRA * (size_t)ZXC_HUF_PM_LEVEL_BOUND * sizeof(pm_item_t);
  ------------------
  |  |  826|   392k|#define ZXC_HUF_MAX_CODE_LEN_ULTRA 11
  ------------------
                          (size_t)ZXC_HUF_MAX_CODE_LEN_ULTRA * (size_t)ZXC_HUF_PM_LEVEL_BOUND * sizeof(pm_item_t);
  ------------------
  |  | 1082|   392k|#define ZXC_HUF_PM_LEVEL_BOUND (2 * ZXC_HUF_NUM_SYMBOLS)
  |  |  ------------------
  |  |  |  |  833|   392k|#define ZXC_HUF_NUM_SYMBOLS 256
  |  |  ------------------
  ------------------
  196|   392k|        p = (uint8_t*)(((uintptr_t)p + 7U) & ~(uintptr_t)7U);
  197|   392k|        counts = (int*)p;
  198|   392k|        ZXC_MEMSET(counts, 0, (size_t)ZXC_HUF_MAX_CODE_LEN_ULTRA * sizeof(int));
  ------------------
  |  |  173|   392k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  199|   392k|        p += (size_t)ZXC_HUF_MAX_CODE_LEN_ULTRA * sizeof(int);
  ------------------
  |  |  826|   392k|#define ZXC_HUF_MAX_CODE_LEN_ULTRA 11
  ------------------
  200|   392k|        p = (uint8_t*)(((uintptr_t)p + 7U) & ~(uintptr_t)7U);
  201|   392k|        stack = (frame_t*)p;
  202|  18.4E|    } else {
  203|  18.4E|        owned_items = (pm_item_t*)ZXC_MALLOC((size_t)ZXC_HUF_MAX_CODE_LEN_ULTRA *
  ------------------
  |  |   68|  18.4E|#define ZXC_MALLOC(size) malloc(size)
  ------------------
  204|  18.4E|                                             (size_t)max_per_level * sizeof(pm_item_t));
  205|  18.4E|        owned_counts = (int*)ZXC_CALLOC((size_t)ZXC_HUF_MAX_CODE_LEN_ULTRA, sizeof(int));
  ------------------
  |  |   74|  18.4E|#define ZXC_CALLOC(nmemb, size) calloc(nmemb, size)
  ------------------
  206|  18.4E|        owned_stack = (frame_t*)ZXC_MALLOC((size_t)ZXC_HUF_MAX_CODE_LEN_ULTRA *
  ------------------
  |  |   68|  18.4E|#define ZXC_MALLOC(size) malloc(size)
  ------------------
  207|  18.4E|                                           (size_t)max_per_level * sizeof(frame_t));
  208|  18.4E|        if (UNLIKELY(!owned_items || !owned_counts || !owned_stack)) {
  ------------------
  |  |  152|  18.4E|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.4E]
  |  |  |  Branch (152:42): [True: 18.4E, False: 0]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  209|      0|            ZXC_FREE(owned_items);
  ------------------
  |  |   86|      0|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  210|      0|            ZXC_FREE(owned_counts);
  ------------------
  |  |   86|      0|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  211|      0|            ZXC_FREE(owned_stack);
  ------------------
  |  |   86|      0|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  212|      0|            return ZXC_ERROR_MEMORY;
  213|      0|        }
  214|  18.4E|        items = owned_items;
  215|  18.4E|        counts = owned_counts;
  216|  18.4E|        stack = owned_stack;
  217|  18.4E|    }
  218|   392k|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  219|       |
  220|       |    // Level 0 (logical level 1): the leaves themselves, already sorted.
  221|  45.0M|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (221:21): [True: 44.6M, False: 392k]
  ------------------
  222|  44.6M|        ITEM(0, i).weight = leaves[i].w;
  ------------------
  |  |  218|  44.6M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  223|  44.6M|        ITEM(0, i).left = -1;
  ------------------
  |  |  218|  44.6M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  224|  44.6M|        ITEM(0, i).right = -1;
  ------------------
  |  |  218|  44.6M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  225|  44.6M|        ITEM(0, i).sym = leaves[i].sym;
  ------------------
  |  |  218|  44.6M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  226|  44.6M|    }
  227|   392k|    counts[0] = n;
  228|       |
  229|       |    // Levels 1..max_code_len-1: merge sorted leaves with sorted packages from the previous
  230|       |    // level.
  231|  3.35M|    for (int k = 1; k < max_code_len; k++) {
  ------------------
  |  Branch (231:21): [True: 2.96M, False: 392k]
  ------------------
  232|  2.96M|        const int prev = counts[k - 1];
  233|  2.96M|        const int packs = prev / 2;
  234|  2.96M|        int li = 0;
  235|  2.96M|        int pi = 0;
  236|  2.96M|        int n_lvl = 0;
  237|   643M|        while (li < n || pi < packs) {
  ------------------
  |  Branch (237:16): [True: 591M, False: 52.1M]
  |  Branch (237:26): [True: 49.2M, False: 2.96M]
  ------------------
  238|   640M|            const uint32_t wl = (li < n) ? leaves[li].w : UINT32_MAX;
  ------------------
  |  Branch (238:33): [True: 591M, False: 49.8M]
  ------------------
  239|   640M|            const uint32_t wp =
  240|   640M|                (pi < packs)
  ------------------
  |  Branch (240:17): [True: 640M, False: 132k]
  ------------------
  241|   640M|                    ? (uint32_t)(ITEM(k - 1, 2 * pi).weight + ITEM(k - 1, 2 * pi + 1).weight)
  ------------------
  |  |  218|   640M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
                                  ? (uint32_t)(ITEM(k - 1, 2 * pi).weight + ITEM(k - 1, 2 * pi + 1).weight)
  ------------------
  |  |  218|   640M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  242|   640M|                    : UINT32_MAX;
  243|   640M|            if (wl <= wp && li < n) {
  ------------------
  |  Branch (243:17): [True: 343M, False: 297M]
  |  Branch (243:29): [True: 343M, False: 11.8k]
  ------------------
  244|   343M|                ITEM(k, n_lvl).weight = wl;
  ------------------
  |  |  218|   343M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  245|   343M|                ITEM(k, n_lvl).left = -1;
  ------------------
  |  |  218|   343M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  246|   343M|                ITEM(k, n_lvl).right = -1;
  ------------------
  |  |  218|   343M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  247|   343M|                ITEM(k, n_lvl).sym = leaves[li].sym;
  ------------------
  |  |  218|   343M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  248|   343M|                li++;
  249|   343M|            } else {
  250|   297M|                ITEM(k, n_lvl).weight = wp;
  ------------------
  |  |  218|   297M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  251|   297M|                ITEM(k, n_lvl).left = (int16_t)(2 * pi);
  ------------------
  |  |  218|   297M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  252|   297M|                ITEM(k, n_lvl).right = (int16_t)(2 * pi + 1);
  ------------------
  |  |  218|   297M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  253|   297M|                ITEM(k, n_lvl).sym = -1;
  ------------------
  |  |  218|   297M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  254|   297M|                pi++;
  255|   297M|            }
  256|   640M|            n_lvl++;
  257|   640M|        }
  258|  2.96M|        counts[k] = n_lvl;
  259|  2.96M|    }
  260|       |
  261|       |    // Step 3: take first 2n-2 items at level max_code_len-1; trace back, counting leaf
  262|       |    // appearances.
  263|   392k|    int n_take = 2 * n - 2;
  264|   392k|    if (n_take > counts[max_code_len - 1]) n_take = counts[max_code_len - 1];
  ------------------
  |  Branch (264:9): [True: 0, False: 392k]
  ------------------
  265|       |
  266|       |    // Worst case stack depth: (max_code_len * n_take) frames; bounded by
  267|       |    // max_code_len * 2n <= ZXC_HUF_MAX_CODE_LEN_ULTRA * 2n. `stack` was set up earlier from
  268|       |    // scratch (or the local malloc fallback), sized for the ceiling.
  269|   392k|    int sp = 0;
  270|  88.8M|    for (int i = 0; i < n_take; i++) {
  ------------------
  |  Branch (270:21): [True: 88.4M, False: 392k]
  ------------------
  271|  88.4M|        stack[sp].lvl = (int8_t)(max_code_len - 1);
  272|  88.4M|        stack[sp].idx = (int16_t)i;
  273|  88.4M|        sp++;
  274|  88.4M|    }
  275|   588M|    while (sp > 0) {
  ------------------
  |  Branch (275:12): [True: 588M, False: 392k]
  ------------------
  276|   588M|        frame_t f = stack[--sp];
  277|   588M|        const pm_item_t* it = &ITEM(f.lvl, f.idx);
  ------------------
  |  |  218|   588M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  278|   588M|        if (it->sym >= 0) {
  ------------------
  |  Branch (278:13): [True: 337M, False: 250M]
  ------------------
  279|   337M|            code_len[it->sym]++;
  280|   337M|        } else {
  281|   250M|            stack[sp].lvl = (int8_t)(f.lvl - 1);
  282|   250M|            stack[sp].idx = it->left;
  283|   250M|            sp++;
  284|   250M|            stack[sp].lvl = (int8_t)(f.lvl - 1);
  285|   250M|            stack[sp].idx = it->right;
  286|   250M|            sp++;
  287|   250M|        }
  288|   588M|    }
  289|       |
  290|   392k|    if (owned_items) {
  ------------------
  |  Branch (290:9): [True: 0, False: 392k]
  ------------------
  291|      0|        ZXC_FREE(owned_items);
  ------------------
  |  |   86|      0|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  292|      0|        ZXC_FREE(owned_counts);
  ------------------
  |  |   86|      0|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  293|      0|        ZXC_FREE(owned_stack);
  ------------------
  |  |   86|      0|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  294|      0|    }
  295|   392k|#undef ITEM
  296|   392k|    return ZXC_OK;
  297|   392k|}
zxc_huf_nudge_code_lengths:
  787|   118k|                               const int max_code_len) {
  788|   118k|    enum { LU = ZXC_HUF_MAX_CODE_LEN_ULTRA };
  789|   118k|    uint32_t blc0[LU + 1];
  790|   118k|    const int n = zxc_huf_nudge_classes(code_len, blc0);
  791|       |    // Degenerate alphabets have no shape freedom (and n == 1 is format-pinned
  792|       |    // to code length exactly 1): leave them untouched.
  793|   118k|    if (n < 4) return 0;
  ------------------
  |  Branch (793:9): [True: 224, False: 117k]
  ------------------
  794|       |
  795|       |    // Tables and DP planes live past the rebuilds' region of the scratch when it
  796|       |    // has the room (opt_scratch does), else in one allocation: no 10 KiB frame.
  797|   117k|    const int owned = !scratch || scratch_cap < ZXC_HUF_NUDGE_SCRATCH_SIZE;
  ------------------
  |  | 1119|   117k|#define ZXC_HUF_NUDGE_SCRATCH_SIZE (ZXC_HUF_NUDGE_SCRATCH_OFF + sizeof(zxc_huf_nudge_ws_t))
  |  |  ------------------
  |  |  |  | 1117|   117k|#define ZXC_HUF_NUDGE_SCRATCH_OFF ZXC_ALIGN_CL(ZXC_HUF_BUILD_SCRATCH_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  384|   117k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  382|   117k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  380|   117k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  382|   117k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  380|   117k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (797:23): [True: 0, False: 117k]
  |  Branch (797:35): [True: 0, False: 117k]
  ------------------
  798|   117k|    zxc_huf_nudge_ws_t* const ws =
  799|   117k|        owned ? (zxc_huf_nudge_ws_t*)ZXC_MALLOC(sizeof(*ws))
  ------------------
  |  |   68|      0|#define ZXC_MALLOC(size) malloc(size)
  ------------------
  |  Branch (799:9): [True: 0, False: 117k]
  ------------------
  800|   117k|              : (zxc_huf_nudge_ws_t*)((uint8_t*)scratch + ZXC_HUF_NUDGE_SCRATCH_OFF);
  ------------------
  |  | 1117|   117k|#define ZXC_HUF_NUDGE_SCRATCH_OFF ZXC_ALIGN_CL(ZXC_HUF_BUILD_SCRATCH_SIZE)
  |  |  ------------------
  |  |  |  |  384|   117k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  382|   117k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  380|   117k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  382|   117k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  380|   117k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  801|   117k|    if (UNLIKELY(!ws)) return 0;
  ------------------
  |  |  152|   117k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 117k]
  |  |  ------------------
  ------------------
  802|       |
  803|       |    // Baseline cost, exact (canonical-order frequency weighting).
  804|   117k|    uint64_t* const pf = ws->pf;
  805|   117k|    zxc_huf_nudge_pf_canonical(code_len, freq, blc0, pf);
  806|   117k|    zxc_huf_nudge_cost_t c0;
  807|   117k|    zxc_huf_nudge_eval(blc0, pf, &c0);
  808|       |
  809|       |    // Frequency-rank order shared by every candidate (rank 0 = most frequent;
  810|       |    // pm_leaves_sort is ascending, ties on symbol, so read it backwards).
  811|   117k|    pm_leaf_t* const leaves = ws->leaves;
  812|   117k|    int k = 0;
  813|  30.2M|    for (int s = 0; s < ZXC_HUF_NUM_SYMBOLS; s++) {
  ------------------
  |  |  833|  30.2M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (813:21): [True: 30.1M, False: 117k]
  ------------------
  814|  30.1M|        if (!freq[s]) continue;
  ------------------
  |  Branch (814:13): [True: 17.5M, False: 12.6M]
  ------------------
  815|  12.6M|        leaves[k].w = freq[s];
  816|  12.6M|        leaves[k].sym = (int16_t)s;
  817|  12.6M|        k++;
  818|  12.6M|    }
  819|   117k|    pm_leaves_sort(leaves, n);
  820|   117k|    int16_t* const sym_order = ws->sym_order;
  821|   117k|    uint64_t* const pf_rank = ws->pf_rank;
  822|   117k|    pf_rank[0] = 0;
  823|  12.8M|    for (int r = 0; r < n; r++) {
  ------------------
  |  Branch (823:21): [True: 12.6M, False: 117k]
  ------------------
  824|  12.6M|        sym_order[r] = leaves[n - 1 - r].sym;
  825|  12.6M|        pf_rank[r + 1] = pf_rank[r] + leaves[n - 1 - r].w;
  826|  12.6M|    }
  827|       |
  828|       |    // Candidates: the greedy ledger walk, package-merge rebuilt at reduced caps
  829|       |    // (the pass loop runs max_depth + 1 times, so depth cuts attack the decoder's
  830|       |    // biggest fixed cost), and the slot-ledger DP below. All Kraft-exact.
  831|   117k|    uint8_t (*const cand)[ZXC_HUF_NUM_SYMBOLS] = ws->cand;
  832|   117k|    int n_cand = 0;
  833|   117k|    {
  834|   117k|        uint32_t blc_w[LU + 1];
  835|   117k|        zxc_huf_nudge_walk(blc0, pf_rank, n, max_code_len, blc_w);
  836|   117k|        zxc_huf_nudge_assign(blc_w, sym_order, cand[n_cand]);
  837|   117k|        n_cand++;
  838|   117k|    }
  839|   117k|    int max_len0 = 0;
  840|   395k|    for (int l = LU; l >= 1; l--) {
  ------------------
  |  Branch (840:22): [True: 395k, False: 18.4E]
  ------------------
  841|   395k|        if (blc0[l]) {
  ------------------
  |  Branch (841:13): [True: 117k, False: 277k]
  ------------------
  842|   117k|            max_len0 = l;
  843|   117k|            break;
  844|   117k|        }
  845|   395k|    }
  846|   117k|    if (max_len0 >= 2) {
  ------------------
  |  Branch (846:9): [True: 117k, False: 18.4E]
  ------------------
  847|   321k|        for (int cut = 1; cut <= 2; cut++) {
  ------------------
  |  Branch (847:27): [True: 232k, False: 89.3k]
  ------------------
  848|   232k|            const int cap2 = max_len0 - cut;
  849|   232k|            if (cap2 < 2 || ((uint32_t)1 << cap2) < (uint32_t)n) break;
  ------------------
  |  Branch (849:17): [True: 338, False: 231k]
  |  Branch (849:29): [True: 28.3k, False: 203k]
  ------------------
  850|   203k|            if (zxc_huf_build_code_lengths(freq, cand[n_cand], scratch, cap2) != ZXC_OK) break;
  ------------------
  |  |   42|   203k|#define zxc_huf_build_code_lengths ZXC_CAT(zxc_huf_build_code_lengths, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   41|   203k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|   203k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (850:17): [True: 0, False: 203k]
  ------------------
  851|   203k|            n_cand++;
  852|   203k|        }
  853|   117k|    }
  854|       |
  855|       |    // Slot-ledger DP: optimal class counts under the rank-weighted model, over
  856|       |    // groups of 2^G frequency-adjacent symbols (G = 0 is exact; coarser tiers
  857|       |    // keep the plane cache-resident, bounding the call to a few hundred us).
  858|       |    // When G does not divide n the lightest group is padded with zero-freq
  859|       |    // ghost leaves on unused byte values - wire-legal, empty runs, and the
  860|       |    // evaluator prices the burnt code space like anything else.
  861|   117k|    {
  862|   117k|        int g_log2 = 0; /* coarsen until the groups fit the DP plane */
  863|   225k|        while (((n + (1 << g_log2) - 1) >> g_log2) > ZXC_HUF_NUDGE_DP_M) g_log2++;
  ------------------
  |  | 1097|   225k|#define ZXC_HUF_NUDGE_DP_M 64
  ------------------
  |  Branch (863:16): [True: 107k, False: 117k]
  ------------------
  864|   117k|        const int g = 1 << g_log2;
  865|   117k|        const int m = (n + g - 1) / g;
  866|   117k|        const int cap_c = max_code_len - g_log2;
  867|   117k|        if (m >= 2 && cap_c >= 1 && m <= (1 << cap_c)) {
  ------------------
  |  Branch (867:13): [True: 117k, False: 18.4E]
  |  Branch (867:23): [True: 117k, False: 0]
  |  Branch (867:37): [True: 117k, False: 0]
  ------------------
  868|   117k|            uint64_t* const pfg = ws->pfg;
  869|  5.62M|            for (int j2 = 0; j2 <= m; j2++) {
  ------------------
  |  Branch (869:30): [True: 5.50M, False: 117k]
  ------------------
  870|  5.50M|                int r = j2 * g;
  871|  5.50M|                if (r > n) r = n;
  ------------------
  |  Branch (871:21): [True: 36.6k, False: 5.46M]
  ------------------
  872|  5.50M|                pfg[j2] = pf_rank[r];
  873|  5.50M|            }
  874|   117k|            uint32_t cblc[LU + 1];
  875|   117k|            if (zxc_huf_nudge_dp_solve(ws, pfg, m, cap_c, LU - g_log2, g_log2, cblc)) {
  ------------------
  |  Branch (875:17): [True: 117k, False: 8]
  ------------------
  876|   117k|                uint8_t* const cl = cand[n_cand];
  877|   117k|                ZXC_MEMSET(cl, 0, ZXC_HUF_NUM_SYMBOLS);
  ------------------
  |  |  173|   117k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  878|   117k|                int r = 0;
  879|   117k|                int ghosts = 0;
  880|   117k|                uint8_t ghost_len = 0;
  881|  1.29M|                for (int lc = 1; lc <= cap_c; lc++) {
  ------------------
  |  Branch (881:34): [True: 1.18M, False: 117k]
  ------------------
  882|  6.56M|                    for (uint32_t q = 0; q < cblc[lc]; q++) {
  ------------------
  |  Branch (882:42): [True: 5.38M, False: 1.18M]
  ------------------
  883|  18.1M|                        for (int e = 0; e < g; e++, r++) {
  ------------------
  |  Branch (883:41): [True: 12.7M, False: 5.38M]
  ------------------
  884|  12.7M|                            if (r < n) {
  ------------------
  |  Branch (884:33): [True: 12.6M, False: 57.9k]
  ------------------
  885|  12.6M|                                cl[sym_order[r]] = (uint8_t)(lc + g_log2);
  886|  12.6M|                            } else {
  887|  57.9k|                                ghost_len = (uint8_t)(lc + g_log2);
  888|  57.9k|                                ghosts++;
  889|  57.9k|                            }
  890|  12.7M|                        }
  891|  5.38M|                    }
  892|  1.18M|                }
  893|   930k|                for (int s = 0; s < ZXC_HUF_NUM_SYMBOLS && ghosts; s++) {
  ------------------
  |  |  833|  1.86M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (893:33): [True: 929k, False: 392]
  |  Branch (893:60): [True: 812k, False: 117k]
  ------------------
  894|   812k|                    if (freq[s] == 0 && cl[s] == 0) {
  ------------------
  |  Branch (894:25): [True: 58.0k, False: 754k]
  |  Branch (894:41): [True: 58.0k, False: 0]
  ------------------
  895|  58.0k|                        cl[s] = ghost_len;
  896|  58.0k|                        ghosts--;
  897|  58.0k|                    }
  898|   812k|                }
  899|   117k|                n_cand++;
  900|   117k|            }
  901|   117k|        }
  902|   117k|    }
  903|       |
  904|       |    // Adopt the cheapest candidate clearing both guard rails and strictly
  905|       |    // beating the baseline J; otherwise leave code_len byte-for-byte alone, so a
  906|       |    // rejection never depends on package-merge tie assignment.
  907|   117k|    const uint64_t j0 = zxc_huf_nudge_j(&c0);
  908|   117k|    uint64_t best_j = j0;
  909|   117k|    int best = -1;
  910|   557k|    for (int ci = 0; ci < n_cand; ci++) {
  ------------------
  |  Branch (910:22): [True: 439k, False: 117k]
  ------------------
  911|       |        // Every live symbol must keep a code; ghost-padded candidates carry
  912|       |        // MORE nonzero lengths than n, which is fine.
  913|   439k|        int valid = 1;
  914|   112M|        for (int s = 0; s < ZXC_HUF_NUM_SYMBOLS; s++) {
  ------------------
  |  |  833|   112M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (914:25): [True: 112M, False: 439k]
  ------------------
  915|   112M|            if (freq[s] != 0 && cand[ci][s] == 0) {
  ------------------
  |  Branch (915:17): [True: 46.3M, False: 65.8M]
  |  Branch (915:33): [True: 0, False: 46.3M]
  ------------------
  916|      0|                valid = 0;
  917|      0|                break;
  918|      0|            }
  919|   112M|        }
  920|   439k|        if (!valid) continue;
  ------------------
  |  Branch (920:13): [True: 0, False: 439k]
  ------------------
  921|   439k|        uint32_t blc[LU + 1];
  922|   439k|        (void)zxc_huf_nudge_classes(cand[ci], blc);
  923|   439k|        zxc_huf_nudge_pf_canonical(cand[ci], freq, blc, pf);
  924|   439k|        zxc_huf_nudge_cost_t c1;
  925|   439k|        zxc_huf_nudge_eval(blc, pf, &c1);
  926|   439k|        if (c1.bits * 1000 > c0.bits * ZXC_HUF_NUDGE_BITS_PERMIL) continue;
  ------------------
  |  |  916|   439k|#define ZXC_HUF_NUDGE_BITS_PERMIL 1015
  ------------------
  |  Branch (926:13): [True: 122k, False: 316k]
  ------------------
  927|   316k|        if (c1.touches * 256 > c0.touches * ZXC_HUF_NUDGE_MERGE_Q8) continue;
  ------------------
  |  |  919|   316k|#define ZXC_HUF_NUDGE_MERGE_Q8 230
  ------------------
  |  Branch (927:13): [True: 189k, False: 126k]
  ------------------
  928|   126k|        const uint64_t j = zxc_huf_nudge_j(&c1);
  929|   126k|        if (j < best_j) {
  ------------------
  |  Branch (929:13): [True: 106k, False: 20.5k]
  ------------------
  930|   106k|            best_j = j;
  931|   106k|            best = ci;
  932|   106k|        }
  933|   126k|    }
  934|   117k|    if (best >= 0) ZXC_MEMCPY(code_len, cand[best], ZXC_HUF_NUM_SYMBOLS);
  ------------------
  |  |  168|  75.6k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  |  Branch (934:9): [True: 75.6k, False: 42.2k]
  ------------------
  935|   117k|    if (owned) ZXC_FREE(ws);
  ------------------
  |  |   86|      0|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  |  Branch (935:9): [True: 0, False: 117k]
  ------------------
  936|   117k|    return best >= 0;
  937|   117k|}
zxc_huf_pack_lengths_default:
  946|  62.0k|void zxc_huf_pack_lengths(const uint8_t* RESTRICT code_len, uint8_t* RESTRICT out) {
  947|  8.00M|    for (int i = 0; i < ZXC_HUF_NUM_SYMBOLS; i += 2) {
  ------------------
  |  |  833|  8.00M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (947:21): [True: 7.93M, False: 62.0k]
  ------------------
  948|  7.93M|        const uint8_t lo = code_len[i] & 0x0F;
  949|  7.93M|        const uint8_t hi = code_len[i + 1] & 0x0F;
  950|  7.93M|        out[i >> 1] = (uint8_t)(lo | (hi << 4));
  951|  7.93M|    }
  952|  62.0k|}
zxc_huf_unpack_lengths_default:
  956|  61.8k|int zxc_huf_unpack_lengths(const uint8_t* RESTRICT in, uint8_t* RESTRICT code_len) {
  957|  61.8k|    int max_len = 0;
  958|  61.8k|    int n_present = 0;
  959|  7.78M|    for (int i = 0; i < ZXC_HUF_NUM_SYMBOLS; i += 2) {
  ------------------
  |  |  833|  7.78M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (959:21): [True: 7.72M, False: 61.8k]
  ------------------
  960|  7.72M|        const uint8_t b = in[i >> 1];
  961|  7.72M|        const uint8_t lo = b & 0x0F;
  962|  7.72M|        const uint8_t hi = (uint8_t)(b >> 4);
  963|  7.72M|        code_len[i] = lo;
  964|  7.72M|        code_len[i + 1] = hi;
  965|  7.72M|        if (lo > max_len) max_len = lo;
  ------------------
  |  Branch (965:13): [True: 93.5k, False: 7.63M]
  ------------------
  966|  7.72M|        if (hi > max_len) max_len = hi;
  ------------------
  |  Branch (966:13): [True: 49.1k, False: 7.67M]
  ------------------
  967|  7.72M|        if (lo) n_present++;
  ------------------
  |  Branch (967:13): [True: 2.58M, False: 5.14M]
  ------------------
  968|  7.72M|        if (hi) n_present++;
  ------------------
  |  Branch (968:13): [True: 2.38M, False: 5.33M]
  ------------------
  969|  7.72M|    }
  970|  61.8k|    if (UNLIKELY(max_len > ZXC_HUF_MAX_CODE_LEN_ULTRA || n_present == 0))
  ------------------
  |  |  152|   123k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 61.8k]
  |  |  |  Branch (152:42): [True: 18.4E, False: 61.9k]
  |  |  |  Branch (152:42): [True: 3, False: 61.9k]
  |  |  ------------------
  ------------------
  971|      0|        return ZXC_ERROR_CORRUPT_DATA;
  972|  61.8k|    return ZXC_OK;
  973|  61.8k|}
zxc_huf_calc_size_default:
 1208|   118k|                         const int with_header) {
 1209|   118k|    zxc_pivco_tree_t t;
 1210|   118k|    if (UNLIKELY(zxc_pivco_tree_build(code_len, &t) != 0)) return SIZE_MAX;
  ------------------
  |  |  152|   118k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 118k]
  |  |  ------------------
  ------------------
 1211|   118k|    const size_t body = zxc_huf_calc_size_dict(freq, code_len, &t);
  ------------------
  |  |   46|   118k|#define zxc_huf_calc_size_dict ZXC_CAT(zxc_huf_calc_size_dict, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   41|   118k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|   118k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1212|   118k|    if (UNLIKELY(body == SIZE_MAX)) return SIZE_MAX;
  ------------------
  |  |  152|   118k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 118k]
  |  |  ------------------
  ------------------
 1213|  18.4E|    return body + (with_header ? (size_t)ZXC_HUF_TABLE_SIZE : 0);
  ------------------
  |  |  102|   118k|#define ZXC_HUF_TABLE_SIZE 128
  ------------------
  |  Branch (1213:20): [True: 118k, False: 18.4E]
  ------------------
 1214|   118k|}
zxc_huf_calc_size_dict_default:
 1222|   118k|                              const zxc_pivco_tree_t* RESTRICT tree) {
 1223|       |    // Encodability is part of the estimate: a histogram symbol the table has no
 1224|       |    // code for would be silently ignored below and undercount. Report the
 1225|       |    // candidate unencodable instead.
 1226|  30.3M|    for (int k = 0; k < ZXC_HUF_NUM_SYMBOLS; k++)
  ------------------
  |  |  833|  30.3M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (1226:21): [True: 30.2M, False: 118k]
  ------------------
 1227|  30.2M|        if (UNLIKELY(freq[k] != 0 && code_len[k] == 0)) return SIZE_MAX;
  ------------------
  |  |  152|  42.9M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 30.2M]
  |  |  |  Branch (152:42): [True: 12.6M, False: 17.5M]
  |  |  |  Branch (152:42): [True: 0, False: 12.6M]
  |  |  ------------------
  ------------------
 1228|   118k|    uint32_t count[ZXC_PIVCO_NODE_SLOTS];
 1229|   118k|    zxc_pivco_counts(tree, freq, count);
 1230|       |    return zxc_pivco_layout(tree, count, NULL);
 1231|   118k|}
zxc_huf_encode_section_default:
 1315|  62.0k|                           uint8_t* RESTRICT dst, const size_t dst_cap) {
 1316|  62.0k|    zxc_pivco_tree_t t;
 1317|  62.0k|    uint32_t codes[ZXC_HUF_NUM_SYMBOLS];
 1318|  62.0k|    if (UNLIKELY(zxc_pivco_tree_build(code_len, &t) != 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  62.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 62.0k]
  |  |  ------------------
  ------------------
 1319|  62.0k|    zxc_pivco_codes(&t, codes);
 1320|  62.0k|    return zxc_pivco_encode_core(literals, n_literals, freq, code_len, &t, codes, dst, dst_cap, 1);
 1321|  62.0k|}
zxc_huf_decode_section_default:
 2310|  61.8k|                           uint8_t* RESTRICT dst, const size_t n, uint8_t* RESTRICT scratch) {
 2311|  61.8k|    if (UNLIKELY(payload_size < (size_t)ZXC_HUF_TABLE_SIZE)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  61.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 61.8k]
  |  |  ------------------
  ------------------
 2312|  61.8k|    uint8_t code_len[ZXC_HUF_NUM_SYMBOLS];
 2313|  61.8k|    const int rc = zxc_huf_unpack_lengths(payload, code_len);
  ------------------
  |  |   44|  61.8k|#define zxc_huf_unpack_lengths ZXC_CAT(zxc_huf_unpack_lengths, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   41|  61.8k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|  61.8k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2314|  61.8k|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|  61.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 61.8k]
  |  |  ------------------
  ------------------
 2315|  61.8k|    zxc_pivco_tree_t t;
 2316|  61.8k|    if (UNLIKELY(zxc_pivco_tree_build(code_len, &t) != 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  61.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 61.8k]
  |  |  ------------------
  ------------------
 2317|  61.8k|    return zxc_pivco_decode_core(payload + ZXC_HUF_TABLE_SIZE, payload_size - ZXC_HUF_TABLE_SIZE,
  ------------------
  |  |  102|  61.8k|#define ZXC_HUF_TABLE_SIZE 128
  ------------------
                  return zxc_pivco_decode_core(payload + ZXC_HUF_TABLE_SIZE, payload_size - ZXC_HUF_TABLE_SIZE,
  ------------------
  |  |  102|  61.8k|#define ZXC_HUF_TABLE_SIZE 128
  ------------------
 2318|  61.8k|                                 dst, n, &t, scratch);
 2319|  61.8k|}
zxc_huffman.c:pm_leaves_sort:
  103|   510k|static void pm_leaves_sort(pm_leaf_t* RESTRICT leaves, const int n) {
  104|       |    // One bucket per possible value of floor(log2(weight)) for a 32-bit
  105|       |    // weight, i.e. 32 buckets.
  106|   510k|    enum { NUM_BUCKETS = 32 };
  107|   510k|    int count[NUM_BUCKETS];
  108|   510k|    int offset[NUM_BUCKETS + 1]; /* +1 sentinel = n, avoids end-of-bucket branch. */
  109|   510k|    uint8_t bucket_of[ZXC_HUF_NUM_SYMBOLS];
  110|   510k|    pm_leaf_t tmp[ZXC_HUF_NUM_SYMBOLS];
  111|       |
  112|   510k|    ZXC_MEMSET(count, 0, sizeof(count));
  ------------------
  |  |  173|   510k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  113|  57.7M|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (113:21): [True: 57.2M, False: 510k]
  ------------------
  114|  57.2M|        const unsigned b = zxc_log2_u32(leaves[i].w);
  115|  57.2M|        bucket_of[i] = (uint8_t)b;
  116|  57.2M|        count[b]++;
  117|  57.2M|    }
  118|       |
  119|   510k|    int acc = 0;
  120|  16.8M|    for (int b = 0; b < NUM_BUCKETS; b++) {
  ------------------
  |  Branch (120:21): [True: 16.3M, False: 510k]
  ------------------
  121|  16.3M|        offset[b] = acc;
  122|  16.3M|        acc += count[b];
  123|  16.3M|    }
  124|   510k|    offset[NUM_BUCKETS] = n;
  125|       |
  126|   510k|    int pos[NUM_BUCKETS];
  127|   510k|    ZXC_MEMCPY(pos, offset, sizeof(pos));
  ------------------
  |  |  168|   510k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  128|  57.7M|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (128:21): [True: 57.2M, False: 510k]
  ------------------
  129|  57.2M|        tmp[pos[bucket_of[i]]++] = leaves[i];
  130|  57.2M|    }
  131|       |
  132|  16.6M|    for (int b = 0; b < NUM_BUCKETS; b++) {
  ------------------
  |  Branch (132:21): [True: 16.1M, False: 510k]
  ------------------
  133|  16.1M|        if (count[b] < 2) continue;
  ------------------
  |  Branch (133:13): [True: 13.7M, False: 2.44M]
  ------------------
  134|  2.44M|        const int s = offset[b];
  135|  2.44M|        const int e = offset[b + 1];
  136|  56.2M|        for (int i = s + 1; i < e; i++) {
  ------------------
  |  Branch (136:29): [True: 53.8M, False: 2.44M]
  ------------------
  137|  53.8M|            const pm_leaf_t key = tmp[i];
  138|  53.8M|            int j = i - 1;
  139|   608M|            while (j >= s && (tmp[j].w > key.w || (tmp[j].w == key.w && tmp[j].sym > key.sym))) {
  ------------------
  |  Branch (139:20): [True: 607M, False: 1.80M]
  |  Branch (139:31): [True: 555M, False: 52.0M]
  |  Branch (139:52): [True: 46.8M, False: 5.22M]
  |  Branch (139:73): [True: 0, False: 46.8M]
  ------------------
  140|   555M|                tmp[j + 1] = tmp[j];
  141|   555M|                j--;
  142|   555M|            }
  143|  53.8M|            tmp[j + 1] = key;
  144|  53.8M|        }
  145|  2.44M|    }
  146|       |
  147|   510k|    ZXC_MEMCPY(leaves, tmp, (size_t)n * sizeof(pm_leaf_t));
  ------------------
  |  |  168|   510k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  148|   510k|}
zxc_huffman.c:zxc_huf_nudge_classes:
  339|   557k|static int zxc_huf_nudge_classes(const uint8_t* RESTRICT code_len, uint32_t* RESTRICT blc) {
  340|   557k|    ZXC_MEMSET(blc, 0, (ZXC_HUF_MAX_CODE_LEN_ULTRA + 1) * sizeof(uint32_t));
  ------------------
  |  |  173|   557k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  341|   557k|    int n = 0;
  342|   142M|    for (int s = 0; s < ZXC_HUF_NUM_SYMBOLS; s++) {
  ------------------
  |  |  833|   142M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (342:21): [True: 142M, False: 557k]
  ------------------
  343|   142M|        const int l = code_len[s];
  344|   142M|        if (!l) continue;
  ------------------
  |  Branch (344:13): [True: 83.4M, False: 58.9M]
  ------------------
  345|  58.9M|        blc[l]++;
  346|  58.9M|        n++;
  347|  58.9M|    }
  348|   557k|    return n;
  349|   557k|}
zxc_huffman.c:zxc_huf_nudge_pf_canonical:
  362|   557k|                                       uint64_t* RESTRICT pf) {
  363|   557k|    uint32_t pos[ZXC_HUF_MAX_CODE_LEN_ULTRA + 1];
  364|   557k|    uint32_t acc = 0;
  365|  6.68M|    for (int l = 1; l <= ZXC_HUF_MAX_CODE_LEN_ULTRA; l++) {
  ------------------
  |  |  826|  6.68M|#define ZXC_HUF_MAX_CODE_LEN_ULTRA 11
  ------------------
  |  Branch (365:21): [True: 6.12M, False: 557k]
  ------------------
  366|  6.12M|        pos[l] = acc;
  367|  6.12M|        acc += blc[l];
  368|  6.12M|    }
  369|   557k|    uint32_t val[ZXC_HUF_NUM_SYMBOLS];
  370|   142M|    for (int s = 0; s < ZXC_HUF_NUM_SYMBOLS; s++) {
  ------------------
  |  |  833|   142M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (370:21): [True: 142M, False: 557k]
  ------------------
  371|   142M|        const int l = code_len[s];
  372|   142M|        if (l) val[pos[l]++] = freq[s];
  ------------------
  |  Branch (372:13): [True: 59.0M, False: 83.1M]
  ------------------
  373|   142M|    }
  374|   557k|    pf[0] = 0;
  375|  59.6M|    for (uint32_t i = 0; i < acc; i++) pf[i + 1] = pf[i] + val[i];
  ------------------
  |  Branch (375:26): [True: 59.1M, False: 557k]
  ------------------
  376|   557k|}
zxc_huffman.c:zxc_huf_nudge_eval:
  397|  2.99M|                               zxc_huf_nudge_cost_t* RESTRICT out) {
  398|  2.99M|    enum { LU = ZXC_HUF_MAX_CODE_LEN_ULTRA };
  399|  2.99M|    uint64_t bits = 0;
  400|  2.99M|    uint64_t touches = 0;
  401|  2.99M|    int max_len = 0;
  402|  2.99M|    uint32_t S = 0;    /* code-space cursor, in 2^-LU slots */
  403|  2.99M|    uint32_t base = 0; /* leaf index where the current run starts */
  404|  35.8M|    for (int l = 1; l <= LU; l++) {
  ------------------
  |  Branch (404:21): [True: 32.8M, False: 2.99M]
  ------------------
  405|  32.8M|        if (!blc[l]) continue;
  ------------------
  |  Branch (405:13): [True: 16.7M, False: 16.0M]
  ------------------
  406|  16.0M|        max_len = l;
  407|  16.0M|        bits += (uint64_t)l * (pf[base + blc[l]] - pf[base]);
  408|  16.0M|        const uint32_t w = 1U << (LU - l);
  409|  16.0M|        const uint32_t end = S + blc[l] * w;
  410|  16.0M|        uint32_t x = S;
  411|  53.2M|        while (x < end) {
  ------------------
  |  Branch (411:16): [True: 37.1M, False: 16.0M]
  ------------------
  412|  37.1M|            const uint32_t wx = x ? (x & (0U - x)) : (1U << LU);
  ------------------
  |  Branch (412:33): [True: 34.1M, False: 2.98M]
  ------------------
  413|  37.1M|            const uint32_t wr = 1U << zxc_log2_u32(end - x);
  414|  37.1M|            const uint32_t W = wx < wr ? wx : wr;
  ------------------
  |  Branch (414:32): [True: 10.4M, False: 26.7M]
  ------------------
  415|  37.1M|            const int D = (int)zxc_log2_u32(W) - (LU - l);
  416|  37.1M|            const uint32_t i0 = base + ((x - S) >> (LU - l));
  417|  37.1M|            const uint64_t mass = pf[i0 + (W >> (LU - l))] - pf[i0];
  418|  37.1M|            int t;
  419|  37.1M|            if (D == 0) {
  ------------------
  |  Branch (419:17): [True: 6.54M, False: 30.6M]
  ------------------
  420|  6.54M|                t = l + 1; /* lone leaf: one memset + merges above */
  421|  30.6M|            } else if (D == 1) {
  ------------------
  |  Branch (421:24): [True: 8.95M, False: 21.6M]
  ------------------
  422|  8.95M|                t = l; /* leaf pair: parent XOR-blend at depth l-1 */
  423|  21.6M|            } else {
  424|  21.6M|                t = (l - D) + 1; /* flat root: one unpack + merges above */
  425|  21.6M|                if (D > ZXC_PIVCO_UNPACK_FLAT_SIMD_MAX) t += ZXC_HUF_NUDGE_DEEP_FLAT_PENALTY;
  ------------------
  |  |  847|  21.6M|#define ZXC_PIVCO_UNPACK_FLAT_SIMD_MAX 6
  ------------------
                              if (D > ZXC_PIVCO_UNPACK_FLAT_SIMD_MAX) t += ZXC_HUF_NUDGE_DEEP_FLAT_PENALTY;
  ------------------
  |  |  924|   208k|#define ZXC_HUF_NUDGE_DEEP_FLAT_PENALTY 24
  ------------------
  |  Branch (425:21): [True: 208k, False: 21.4M]
  ------------------
  426|  21.6M|            }
  427|  37.1M|            touches += mass * (uint64_t)t;
  428|  37.1M|            x += W;
  429|  37.1M|        }
  430|  16.0M|        S = end;
  431|  16.0M|        base += blc[l];
  432|  16.0M|    }
  433|  2.99M|    touches += (uint64_t)ZXC_HUF_NUDGE_LEVEL_COST * (uint64_t)(max_len + 1);
  ------------------
  |  |  928|  2.99M|#define ZXC_HUF_NUDGE_LEVEL_COST 64
  ------------------
  434|  2.99M|    out->bits = bits;
  435|  2.99M|    out->touches = touches;
  436|  2.99M|}
zxc_huffman.c:zxc_huf_nudge_walk:
  521|   117k|                               const int n, const int cap, uint32_t* RESTRICT out_blc) {
  522|   117k|    enum { LU = ZXC_HUF_MAX_CODE_LEN_ULTRA };
  523|   117k|    ZXC_MEMSET(out_blc, 0, (LU + 1) * sizeof(uint32_t));
  ------------------
  |  |  173|   117k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  524|   117k|    uint32_t s = 2; /* the root's two slots at level 1 (n >= 4 => root is internal) */
  525|   117k|    uint32_t n_rem = (uint32_t)n;
  526|  1.09M|    for (int l = 1; l <= cap && n_rem; l++) {
  ------------------
  |  Branch (526:21): [True: 1.08M, False: 9.96k]
  |  Branch (526:33): [True: 978k, False: 108k]
  ------------------
  527|   978k|        struct {
  528|   978k|            uint32_t c;
  529|   978k|            int flat_d; /* > 0: complete as one uniform run at depth l + flat_d */
  530|   978k|        } cand[6];
  531|   978k|        int n_cand = 0;
  532|   978k|        const uint32_t c_base = zxc_huf_nudge_clamp(blc0[l], s, n_rem, l, cap);
  533|   978k|        cand[n_cand].c = c_base;
  534|   978k|        cand[n_cand++].flat_d = 0;
  535|   978k|        if (c_base < n_rem) {
  ------------------
  |  Branch (535:13): [True: 860k, False: 117k]
  ------------------
  536|       |            // Shape the internal-node count i = s - c toward few set bits.
  537|   860k|            const uint32_t i_base = s - c_base;
  538|   860k|            const uint32_t i_dn = 1U << zxc_log2_u32(i_base);
  539|   860k|            const uint32_t rest = i_base - i_dn;
  540|   860k|            const uint32_t shapes[3] = {i_dn, i_dn << 1,
  541|   860k|                                        i_dn | (rest ? 1U << zxc_log2_u32(rest) : 0U)};
  ------------------
  |  Branch (541:49): [True: 454k, False: 405k]
  ------------------
  542|  3.44M|            for (int k = 0; k < 3; k++) {
  ------------------
  |  Branch (542:29): [True: 2.58M, False: 860k]
  ------------------
  543|  2.58M|                const uint32_t want = s > shapes[k] ? s - shapes[k] : 0;
  ------------------
  |  Branch (543:39): [True: 1.27M, False: 1.31M]
  ------------------
  544|  2.58M|                const uint32_t c = zxc_huf_nudge_clamp(want, s, n_rem, l, cap);
  545|  2.58M|                int dup = 0;
  546|  6.48M|                for (int p = 0; p < n_cand; p++) dup |= (cand[p].c == c);
  ------------------
  |  Branch (546:33): [True: 3.90M, False: 2.58M]
  ------------------
  547|  2.58M|                if (!dup) {
  ------------------
  |  Branch (547:21): [True: 1.11M, False: 1.46M]
  ------------------
  548|  1.11M|                    cand[n_cand].c = c;
  549|  1.11M|                    cand[n_cand++].flat_d = 0;
  550|  1.11M|                }
  551|  2.58M|            }
  552|       |            // Uniform finish: c leaves here, the rest as i complete depth-D
  553|       |            // subtrees (c*(2^D - 1) == s*2^D - n_rem must divide exactly).
  554|  5.25M|            for (int d = 1; d <= cap - l && n_cand < 6; d++) {
  ------------------
  |  Branch (554:29): [True: 4.74M, False: 514k]
  |  Branch (554:45): [True: 4.74M, False: 18.4E]
  ------------------
  555|  4.74M|                const uint32_t den = (1U << d) - 1;
  556|  4.74M|                const int32_t num = (int32_t)(s << d) - (int32_t)n_rem;
  557|  4.74M|                if (num < 0 || (uint32_t)num % den) continue;
  ------------------
  |  Branch (557:21): [True: 2.01M, False: 2.73M]
  |  Branch (557:32): [True: 2.38M, False: 347k]
  ------------------
  558|   346k|                const uint32_t c = (uint32_t)num / den;
  559|   347k|                if (c >= s || c >= n_rem) continue; /* need i >= 1 and a remainder */
  ------------------
  |  Branch (559:21): [True: 18.4E, False: 347k]
  |  Branch (559:31): [True: 0, False: 347k]
  ------------------
  560|   346k|                cand[n_cand].c = c;
  561|   346k|                cand[n_cand++].flat_d = d;
  562|   346k|                break; /* the shallowest exact finish is the aggressive one */
  563|   346k|            }
  564|   860k|        }
  565|   978k|        uint64_t best_j = UINT64_MAX;
  566|   978k|        uint32_t best_c = c_base;
  567|  3.41M|        for (int k = 0; k < n_cand; k++) {
  ------------------
  |  Branch (567:25): [True: 2.43M, False: 978k]
  ------------------
  568|  2.43M|            uint32_t tmp[LU + 1];
  569|  2.43M|            ZXC_MEMCPY(tmp, out_blc, sizeof(tmp));
  ------------------
  |  |  168|  2.43M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  570|  2.43M|            tmp[l] = cand[k].c;
  571|  2.43M|            const uint32_t rem = n_rem - cand[k].c;
  572|  2.43M|            if (rem) {
  ------------------
  |  Branch (572:17): [True: 2.31M, False: 117k]
  ------------------
  573|  2.31M|                if (cand[k].flat_d)
  ------------------
  |  Branch (573:21): [True: 347k, False: 1.97M]
  ------------------
  574|   347k|                    tmp[l + cand[k].flat_d] = rem;
  575|  1.97M|                else
  576|  1.97M|                    zxc_huf_nudge_complete(tmp, l, 2 * (s - cand[k].c), rem, blc0, cap);
  577|  2.31M|            }
  578|  2.43M|            zxc_huf_nudge_cost_t cc;
  579|  2.43M|            zxc_huf_nudge_eval(tmp, pf_rank, &cc);
  580|  2.43M|            const uint64_t j = zxc_huf_nudge_j(&cc);
  581|  2.43M|            if (j < best_j) {
  ------------------
  |  Branch (581:17): [True: 1.17M, False: 1.25M]
  ------------------
  582|  1.17M|                best_j = j;
  583|  1.17M|                best_c = cand[k].c;
  584|  1.17M|            }
  585|  2.43M|        }
  586|   978k|        out_blc[l] = best_c;
  587|   978k|        n_rem -= best_c;
  588|   978k|        s = 2 * (s - best_c);
  589|   978k|    }
  590|   117k|}
zxc_huffman.c:zxc_huf_nudge_clamp:
  468|  12.2M|                                    const int l, const int cap) {
  469|  12.2M|    if (n_rem <= s || l >= cap) return n_rem; /* forced finish */
  ------------------
  |  Branch (469:9): [True: 2.07M, False: 10.1M]
  |  Branch (469:23): [True: 107, False: 10.1M]
  ------------------
  470|  10.1M|    const uint32_t m = 1U << (cap - l);
  471|  10.1M|    const uint32_t lo = (2 * s > n_rem) ? 2 * s - n_rem : 0;
  ------------------
  |  Branch (471:25): [True: 2.81M, False: 7.30M]
  ------------------
  472|  10.1M|    uint32_t hi = s - 1;
  473|  10.1M|    const uint32_t cap_hi = (s * m - n_rem) / (m - 1);
  474|  10.1M|    if (cap_hi < hi) hi = cap_hi;
  ------------------
  |  Branch (474:9): [True: 5.78M, False: 4.33M]
  ------------------
  475|  10.1M|    const uint32_t c = want < lo ? lo : want;
  ------------------
  |  Branch (475:24): [True: 891k, False: 9.23M]
  ------------------
  476|  10.1M|    return c > hi ? hi : c;
  ------------------
  |  Branch (476:12): [True: 1.28M, False: 8.83M]
  ------------------
  477|  12.2M|}
zxc_huffman.c:zxc_huf_nudge_complete:
  491|  1.97M|                                   const uint32_t* RESTRICT blc0, const int cap) {
  492|  10.6M|    for (int j = l + 1; j <= cap && n_rem; j++) {
  ------------------
  |  Branch (492:25): [True: 9.89M, False: 737k]
  |  Branch (492:37): [True: 8.66M, False: 1.23M]
  ------------------
  493|  8.66M|        const uint32_t c = zxc_huf_nudge_clamp(blc0[j], s, n_rem, j, cap);
  494|  8.66M|        blc[j] = c;
  495|  8.66M|        n_rem -= c;
  496|  8.66M|        s = 2 * (s - c);
  497|  8.66M|    }
  498|  1.97M|}
zxc_huffman.c:zxc_huf_nudge_assign:
  766|   117k|                                 uint8_t* RESTRICT cand_len) {
  767|   117k|    ZXC_MEMSET(cand_len, 0, ZXC_HUF_NUM_SYMBOLS);
  ------------------
  |  |  173|   117k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  768|   117k|    int r = 0;
  769|  1.41M|    for (int l = 1; l <= ZXC_HUF_MAX_CODE_LEN_ULTRA; l++)
  ------------------
  |  |  826|  1.41M|#define ZXC_HUF_MAX_CODE_LEN_ULTRA 11
  ------------------
  |  Branch (769:21): [True: 1.29M, False: 117k]
  ------------------
  770|  13.9M|        for (uint32_t k = 0; k < blc[l]; k++) cand_len[sym_order[r++]] = (uint8_t)l;
  ------------------
  |  Branch (770:30): [True: 12.6M, False: 1.29M]
  ------------------
  771|   117k|}
zxc_huffman.c:zxc_huf_nudge_dp_solve:
  671|   117k|                                  uint32_t* RESTRICT out_cblc) {
  672|   117k|    if (UNLIKELY(m < 2 || m > ZXC_HUF_NUDGE_DP_M || cap_c < 1 ||
  ------------------
  |  |  152|   707k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 117k]
  |  |  |  Branch (152:42): [True: 0, False: 117k]
  |  |  |  Branch (152:42): [True: 0, False: 117k]
  |  |  |  Branch (152:42): [True: 0, False: 117k]
  |  |  |  Branch (152:42): [True: 18.4E, False: 117k]
  |  |  ------------------
  ------------------
  673|   117k|                 cap_c > ZXC_HUF_MAX_CODE_LEN_ULTRA))
  674|      0|        return 0;
  675|       |
  676|   117k|    const size_t plane = (size_t)(m + 1) * (size_t)(m + 1);
  677|   117k|    const size_t arrive_cnt = (size_t)(cap_c + 1) * plane;
  678|   117k|    uint64_t* jcur = ws->jcur;
  679|   117k|    uint64_t* jnxt = ws->jnxt;
  680|   117k|    uint8_t* const arrive = ws->arrive;
  681|   117k|    int ok = 0;
  682|       |
  683|   117k|#define ZXC_NUDGE_DP_IDX(k, s) ((size_t)(k) * (size_t)(m + 1) + (size_t)(s))
  684|   278M|    for (size_t i = 0; i < plane; i++) jcur[i] = UINT64_MAX;
  ------------------
  |  Branch (684:24): [True: 278M, False: 117k]
  ------------------
  685|   117k|    jcur[ZXC_NUDGE_DP_IDX(0, 2)] = 0;
  ------------------
  |  |  683|   117k|#define ZXC_NUDGE_DP_IDX(k, s) ((size_t)(k) * (size_t)(m + 1) + (size_t)(s))
  ------------------
  686|   117k|    uint64_t best_j = UINT64_MAX;
  687|   117k|    int best_l = 0;
  688|   117k|    int best_k = 0;
  689|   117k|    int best_s = 0;
  690|  1.29M|    for (int lc = 1; lc <= cap_c; lc++) {
  ------------------
  |  Branch (690:22): [True: 1.17M, False: 117k]
  ------------------
  691|  2.68G|        for (size_t i = 0; i < plane; i++) jnxt[i] = UINT64_MAX;
  ------------------
  |  Branch (691:28): [True: 2.68G, False: 1.17M]
  ------------------
  692|  53.9M|        for (int k = 0; k < m; k++) {
  ------------------
  |  Branch (692:25): [True: 52.7M, False: 1.17M]
  ------------------
  693|  52.7M|            const uint32_t n_rem = (uint32_t)(m - k);
  694|  1.34G|            for (uint32_t s = 1; s <= n_rem; s++) {
  ------------------
  |  Branch (694:34): [True: 1.29G, False: 52.7M]
  ------------------
  695|  1.29G|                const size_t from = ZXC_NUDGE_DP_IDX(k, s);
  ------------------
  |  |  683|  1.29G|#define ZXC_NUDGE_DP_IDX(k, s) ((size_t)(k) * (size_t)(m + 1) + (size_t)(s))
  ------------------
  696|  1.29G|                if (UNLIKELY(from >= plane)) continue;
  ------------------
  |  |  152|  1.29G|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 1.29G]
  |  |  ------------------
  ------------------
  697|  1.29G|                const uint64_t j0 = jcur[from];
  698|  1.29G|                if (j0 == UINT64_MAX) continue;
  ------------------
  |  Branch (698:21): [True: 1.12G, False: 160M]
  ------------------
  699|   160M|                if (s == n_rem) {
  ------------------
  |  Branch (699:21): [True: 10.0M, False: 150M]
  ------------------
  700|       |                    // Forced finish: fill every slot, close the tree here.
  701|  10.0M|                    const uint64_t j =
  702|  10.0M|                        j0 + zxc_huf_nudge_dp_run_j(lu, lc, g_log2, s, s, pfg, (uint32_t)k) +
  703|  10.0M|                        (uint64_t)ZXC_HUF_NUDGE_LAMBDA_Q8 * (uint64_t)ZXC_HUF_NUDGE_LEVEL_COST *
  ------------------
  |  |  913|  10.0M|#define ZXC_HUF_NUDGE_LAMBDA_Q8 26
  ------------------
                                      (uint64_t)ZXC_HUF_NUDGE_LAMBDA_Q8 * (uint64_t)ZXC_HUF_NUDGE_LEVEL_COST *
  ------------------
  |  |  928|  10.0M|#define ZXC_HUF_NUDGE_LEVEL_COST 64
  ------------------
  704|  10.0M|                            (uint64_t)(lc + g_log2 + 1);
  705|  10.0M|                    if (j < best_j) {
  ------------------
  |  Branch (705:25): [True: 1.09M, False: 9.00M]
  ------------------
  706|  1.09M|                        best_j = j;
  707|  1.09M|                        best_l = lc;
  708|  1.09M|                        best_k = k;
  709|  1.09M|                        best_s = (int)s;
  710|  1.09M|                    }
  711|  10.0M|                    continue;
  712|  10.0M|                }
  713|   150M|                if (lc == cap_c) continue; /* must finish at the cap */
  ------------------
  |  Branch (713:21): [True: 0, False: 150M]
  ------------------
  714|   150M|                const uint32_t mm = 1U << (cap_c - lc);
  715|   150M|                const uint32_t lo = (2 * s > n_rem) ? 2 * s - n_rem : 0;
  ------------------
  |  Branch (715:37): [True: 90.4M, False: 60.3M]
  ------------------
  716|   150M|                uint32_t hi = s - 1;
  717|   150M|                const uint32_t cap_hi = (s * mm - n_rem) / (mm - 1);
  718|   150M|                if (cap_hi < hi) hi = cap_hi;
  ------------------
  |  Branch (718:21): [True: 102M, False: 48.6M]
  ------------------
  719|  1.03G|                for (uint32_t c = lo; c <= hi; c++) {
  ------------------
  |  Branch (719:39): [True: 884M, False: 150M]
  ------------------
  720|   884M|                    const uint64_t j =
  721|   884M|                        j0 + zxc_huf_nudge_dp_run_j(lu, lc, g_log2, s, c, pfg, (uint32_t)k);
  722|   884M|                    const size_t to = ZXC_NUDGE_DP_IDX(k + (int)c, 2 * (s - c));
  ------------------
  |  |  683|   884M|#define ZXC_NUDGE_DP_IDX(k, s) ((size_t)(k) * (size_t)(m + 1) + (size_t)(s))
  ------------------
  723|   884M|                    const size_t arr = (size_t)(lc + 1) * plane + to;
  724|       |
  725|   884M|                    if (UNLIKELY(to >= plane || arr >= arrive_cnt)) continue;
  ------------------
  |  |  152|  1.76G|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 884M]
  |  |  |  Branch (152:42): [True: 3.12M, False: 881M]
  |  |  |  Branch (152:42): [True: 18.4E, False: 881M]
  |  |  ------------------
  ------------------
  726|   884M|                    if (j < jnxt[to]) {
  ------------------
  |  Branch (726:25): [True: 633M, False: 251M]
  ------------------
  727|   633M|                        jnxt[to] = j;
  728|   633M|                        arrive[arr] = (uint8_t)c;
  729|   633M|                    }
  730|   884M|                }
  731|   150M|            }
  732|  52.7M|        }
  733|  1.17M|        uint64_t* tmp = jcur;
  734|  1.17M|        jcur = jnxt;
  735|  1.17M|        jnxt = tmp;
  736|  1.17M|    }
  737|   117k|    if (best_j == UINT64_MAX) goto done;
  ------------------
  |  Branch (737:9): [True: 0, False: 117k]
  ------------------
  738|   117k|    ZXC_MEMSET(out_cblc, 0, (ZXC_HUF_MAX_CODE_LEN_ULTRA + 1) * sizeof(uint32_t));
  ------------------
  |  |  173|   117k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  739|   117k|    out_cblc[best_l] = (uint32_t)best_s;
  740|   117k|    {
  741|   117k|        int k = best_k;
  742|   117k|        int s = best_s;
  743|   864k|        for (int lc = best_l; lc > 1; lc--) {
  ------------------
  |  Branch (743:31): [True: 746k, False: 117k]
  ------------------
  744|   746k|            const uint32_t c = arrive[(size_t)lc * plane + ZXC_NUDGE_DP_IDX(k, s)];
  ------------------
  |  |  683|   746k|#define ZXC_NUDGE_DP_IDX(k, s) ((size_t)(k) * (size_t)(m + 1) + (size_t)(s))
  ------------------
  745|   746k|            out_cblc[lc - 1] = c;
  746|   746k|            s = s / 2 + (int)c;
  747|   746k|            k -= (int)c;
  748|   746k|        }
  749|   117k|        if (UNLIKELY(k != 0 || s != 2)) goto done; /* backtrack corruption: drop candidate */
  ------------------
  |  |  152|   235k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 117k]
  |  |  |  Branch (152:42): [True: 7, False: 117k]
  |  |  |  Branch (152:42): [True: 0, False: 117k]
  |  |  ------------------
  ------------------
  750|   117k|    }
  751|   117k|    ok = 1;
  752|   117k|done:
  753|   117k|#undef ZXC_NUDGE_DP_IDX
  754|   117k|    return ok;
  755|   117k|}
zxc_huffman.c:zxc_huf_nudge_dp_run_j:
  615|   888M|                                       const uint64_t* RESTRICT pfg, const uint32_t k) {
  616|   888M|    if (!c) return 0;
  ------------------
  |  Branch (616:9): [True: 66.6M, False: 822M]
  ------------------
  617|   822M|    const int lr = lc + g_log2; /* real code length of these leaves */
  618|   822M|    const uint32_t w = 1U << (lu - lc);
  619|   822M|    const uint32_t S = (1U << lu) - s * w;
  620|   822M|    const uint32_t end = S + c * w;
  621|   822M|    const uint64_t bits = (uint64_t)lr * (pfg[k + c] - pfg[k]);
  622|   822M|    uint64_t touches = 0;
  623|   822M|    uint32_t x = S;
  624|  3.28G|    while (x < end) {
  ------------------
  |  Branch (624:12): [True: 2.45G, False: 822M]
  ------------------
  625|  18.4E|        const uint32_t wx = x ? (x & (0U - x)) : (1U << lu);
  ------------------
  |  Branch (625:29): [True: 2.46G, False: 18.4E]
  ------------------
  626|  2.45G|        const uint32_t wr = 1U << zxc_log2_u32(end - x);
  627|  2.45G|        const uint32_t W = wx < wr ? wx : wr;
  ------------------
  |  Branch (627:28): [True: 749M, False: 1.70G]
  ------------------
  628|  2.45G|        const int d = (int)zxc_log2_u32(W >> (lu - lc)) + g_log2;
  629|  2.45G|        const uint32_t i0 = k + ((x - S) >> (lu - lc));
  630|  2.45G|        const uint64_t mass = pfg[i0 + (W >> (lu - lc))] - pfg[i0];
  631|  2.45G|        int t;
  632|  2.45G|        if (d == 0) {
  ------------------
  |  Branch (632:13): [True: 205M, False: 2.25G]
  ------------------
  633|   205M|            t = lr + 1;
  634|  2.25G|        } else if (d == 1) {
  ------------------
  |  Branch (634:20): [True: 495M, False: 1.75G]
  ------------------
  635|   495M|            t = lr;
  636|  1.75G|        } else {
  637|  1.75G|            t = (lr - d) + 1;
  638|  1.75G|            if (d > ZXC_PIVCO_UNPACK_FLAT_SIMD_MAX) t += ZXC_HUF_NUDGE_DEEP_FLAT_PENALTY;
  ------------------
  |  |  847|  1.75G|#define ZXC_PIVCO_UNPACK_FLAT_SIMD_MAX 6
  ------------------
                          if (d > ZXC_PIVCO_UNPACK_FLAT_SIMD_MAX) t += ZXC_HUF_NUDGE_DEEP_FLAT_PENALTY;
  ------------------
  |  |  924|   962k|#define ZXC_HUF_NUDGE_DEEP_FLAT_PENALTY 24
  ------------------
  |  Branch (638:17): [True: 962k, False: 1.75G]
  ------------------
  639|  1.75G|        }
  640|  2.45G|        touches += mass * (uint64_t)t;
  641|  2.45G|        x += W;
  642|  2.45G|    }
  643|   822M|    return 256U * bits + (uint64_t)ZXC_HUF_NUDGE_LAMBDA_Q8 * touches;
  ------------------
  |  |  913|   822M|#define ZXC_HUF_NUDGE_LAMBDA_Q8 26
  ------------------
  644|   888M|}
zxc_huffman.c:zxc_huf_nudge_j:
  444|  2.67M|static ZXC_ALWAYS_INLINE uint64_t zxc_huf_nudge_j(const zxc_huf_nudge_cost_t* c) {
  445|  2.67M|    return 256U * c->bits + (uint64_t)ZXC_HUF_NUDGE_LAMBDA_Q8 * c->touches;
  ------------------
  |  |  913|  2.67M|#define ZXC_HUF_NUDGE_LAMBDA_Q8 26
  ------------------
  446|  2.67M|}
zxc_huffman.c:zxc_pivco_tree_build:
 1048|   242k|static int zxc_pivco_tree_build(const uint8_t* RESTRICT code_len, zxc_pivco_tree_t* RESTRICT t) {
 1049|   242k|    uint16_t bl_count[ZXC_HUF_MAX_CODE_LEN_ULTRA + 1] = {0};
 1050|   242k|    int n_present = 0;
 1051|   242k|    int max_depth = 0;
 1052|  61.7M|    for (int s = 0; s < ZXC_HUF_NUM_SYMBOLS; s++) {
  ------------------
  |  |  833|  61.7M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (1052:21): [True: 61.5M, False: 242k]
  ------------------
 1053|  61.5M|        const int l = code_len[s];
 1054|  61.5M|        if (l == 0) continue;
  ------------------
  |  Branch (1054:13): [True: 39.0M, False: 22.5M]
  ------------------
 1055|  22.5M|        if (UNLIKELY(l > ZXC_HUF_MAX_CODE_LEN_ULTRA)) return -1;
  ------------------
  |  |  152|  22.5M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 22.5M]
  |  |  ------------------
  ------------------
 1056|  22.5M|        bl_count[l]++;
 1057|  22.5M|        n_present++;
 1058|  22.5M|        if (l > max_depth) max_depth = l;
  ------------------
  |  Branch (1058:13): [True: 563k, False: 21.9M]
  ------------------
 1059|  22.5M|    }
 1060|   242k|    if (UNLIKELY(n_present == 0)) return -1;
  ------------------
  |  |  152|   242k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 242k]
  |  |  ------------------
  ------------------
 1061|   242k|    if (n_present >= 2) {
  ------------------
  |  Branch (1061:9): [True: 242k, False: 18.4E]
  ------------------
 1062|   242k|        uint32_t kraft = 0;
 1063|  2.90M|        for (int l = 1; l <= ZXC_HUF_MAX_CODE_LEN_ULTRA; l++)
  ------------------
  |  |  826|  2.90M|#define ZXC_HUF_MAX_CODE_LEN_ULTRA 11
  ------------------
  |  Branch (1063:25): [True: 2.66M, False: 242k]
  ------------------
 1064|  2.66M|            kraft += (uint32_t)bl_count[l] << (ZXC_HUF_MAX_CODE_LEN_ULTRA - l);
  ------------------
  |  |  826|  2.66M|#define ZXC_HUF_MAX_CODE_LEN_ULTRA 11
  ------------------
 1065|   242k|        if (UNLIKELY(kraft != (1U << ZXC_HUF_MAX_CODE_LEN_ULTRA))) return -1;
  ------------------
  |  |  152|   242k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 242k]
  |  |  ------------------
  ------------------
 1066|  18.4E|    } else if (UNLIKELY(bl_count[1] != 1)) {
  ------------------
  |  |  152|  18.4E|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 18.4E]
  |  |  ------------------
  ------------------
 1067|      0|        return -1; /* the lone symbol is pinned at length 1 */
 1068|      0|    }
 1069|   242k|    t->max_depth = max_depth;
 1070|       |
 1071|       |    // Two children per internal node above, one under the lone symbol's root.
 1072|       |    // The d-bit prefixes start at `first`.
 1073|   242k|    unsigned width = 1;
 1074|   242k|    unsigned first = 0;
 1075|   242k|    t->node_base[0] = 0;
 1076|   242k|    t->leaf_base[0] = 0;
 1077|  2.47M|    for (int d = 0; d <= max_depth; d++) {
  ------------------
  |  Branch (1077:21): [True: 2.22M, False: 242k]
  ------------------
 1078|  2.22M|        t->base[d] = (int16_t)(t->node_base[d] - (int)first);
 1079|  2.22M|        t->node_base[d + 1] = (uint16_t)(t->node_base[d] + width);
 1080|  2.22M|        t->leaf_base[d + 1] = (uint16_t)(t->leaf_base[d] + bl_count[d]);
 1081|  2.22M|        first = 2 * (first + bl_count[d]);
 1082|  2.22M|        width = (d == 0 && n_present == 1) ? 1U : 2 * (width - bl_count[d]);
  ------------------
  |  Branch (1082:18): [True: 242k, False: 1.98M]
  |  Branch (1082:28): [True: 0, False: 242k]
  ------------------
 1083|  2.22M|    }
 1084|       |
 1085|   242k|    uint16_t pos[ZXC_HUF_MAX_CODE_LEN_ULTRA + 1];
 1086|  2.47M|    for (int d = 0; d <= max_depth; d++) pos[d] = t->leaf_base[d];
  ------------------
  |  Branch (1086:21): [True: 2.22M, False: 242k]
  ------------------
 1087|  61.9M|    for (int s = 0; s < ZXC_HUF_NUM_SYMBOLS; s++)
  ------------------
  |  |  833|  61.9M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (1087:21): [True: 61.7M, False: 242k]
  ------------------
 1088|  61.7M|        if (code_len[s]) t->syms[pos[code_len[s]]++] = (uint8_t)s;
  ------------------
  |  Branch (1088:13): [True: 22.7M, False: 38.9M]
  ------------------
 1089|       |
 1090|       |    // FORMAT RULE: a flat root is a MAXIMAL complete subtree of depth D >= 2
 1091|       |    // (D = 1 is a leaf pair). Bottom-up, flat_d holds complete heights: 0 at
 1092|       |    // leaves and the slot, INCOMPLETE across depths.
 1093|   242k|    enum { INCOMPLETE = 0xFE };
 1094|   242k|    t->flat_d[t->node_base[max_depth + 1]] = 0;
 1095|  2.46M|    for (int d = max_depth; d >= 0; d--) {
  ------------------
  |  Branch (1095:29): [True: 2.21M, False: 242k]
  ------------------
 1096|  2.21M|        uint8_t* const h = t->flat_d + t->node_base[d];
 1097|  2.21M|        const uint8_t* const hc = t->flat_d + t->node_base[d + 1];
 1098|  2.21M|        const int L = zxc_pivco_leaves(t, d);
 1099|  2.21M|        const int N = t->node_base[d + 1] - t->node_base[d];
 1100|  25.0M|        for (int i = 0; i < L; i++) h[i] = 0;
  ------------------
  |  Branch (1100:25): [True: 22.7M, False: 2.21M]
  ------------------
 1101|  24.7M|        for (int i = L; i < N; i++) {
  ------------------
  |  Branch (1101:25): [True: 22.5M, False: 2.21M]
  ------------------
 1102|  22.5M|            const uint8_t a = hc[2 * (i - L)];
 1103|  22.5M|            const uint8_t b = hc[2 * (i - L) + 1];
 1104|  22.5M|            h[i] = (a == b && a != INCOMPLETE) ? (uint8_t)(a + 1) : (uint8_t)INCOMPLETE;
  ------------------
  |  Branch (1104:21): [True: 21.0M, False: 1.50M]
  |  Branch (1104:31): [True: 20.7M, False: 241k]
  ------------------
 1105|  22.5M|        }
 1106|  2.21M|    }
 1107|       |    // Top-down: the first height >= 2 on a path is a flat root, the internal
 1108|       |    // nodes below are covered. The wire packs a path LSB first, so leaf r has
 1109|       |    // packed code r bit-reversed: store the leaves in that order.
 1110|  2.20M|    for (int d = 0; d < max_depth; d++) {
  ------------------
  |  Branch (1110:21): [True: 1.96M, False: 242k]
  ------------------
 1111|  1.96M|        uint8_t* const fd = t->flat_d + t->node_base[d];
 1112|  1.96M|        const uint8_t* const up =
 1113|  1.96M|            d ? t->flat_d + t->node_base[d - 1] + zxc_pivco_leaves(t, d - 1) : NULL;
  ------------------
  |  Branch (1113:13): [True: 1.73M, False: 230k]
  ------------------
 1114|  1.96M|        const int N = t->node_base[d + 1] - t->node_base[d];
 1115|  24.3M|        for (int i = zxc_pivco_leaves(t, d); i < N; i++) {
  ------------------
  |  Branch (1115:46): [True: 22.3M, False: 1.96M]
  ------------------
 1116|  22.3M|            if (up && up[i >> 1]) {
  ------------------
  |  Branch (1116:17): [True: 22.1M, False: 226k]
  |  Branch (1116:23): [True: 19.0M, False: 3.11M]
  ------------------
 1117|  19.0M|                fd[i] = ZXC_PIVCO_COVERED;
  ------------------
  |  |  850|  19.0M|#define ZXC_PIVCO_COVERED 0xFFU
  ------------------
 1118|  19.0M|            } else if (fd[i] < 2 || fd[i] == INCOMPLETE) {
  ------------------
  |  Branch (1118:24): [True: 372k, False: 2.97M]
  |  Branch (1118:37): [True: 1.75M, False: 1.22M]
  ------------------
 1119|  2.13M|                fd[i] = 0;
 1120|  2.13M|            } else {
 1121|  1.20M|                const int g = t->node_base[d] + i;
 1122|  1.20M|                zxc_pivco_bitrev_permute(t->syms + zxc_pivco_flat_leaves(t, g, d, fd[i]), fd[i]);
 1123|  1.20M|            }
 1124|  22.3M|        }
 1125|  1.96M|    }
 1126|   242k|    return 0;
 1127|   242k|}
zxc_huffman.c:zxc_pivco_leaves:
 1012|  16.3M|static ZXC_ALWAYS_INLINE int zxc_pivco_leaves(const zxc_pivco_tree_t* RESTRICT t, const int d) {
 1013|  16.3M|    return t->leaf_base[d + 1] - t->leaf_base[d];
 1014|  16.3M|}
zxc_huffman.c:zxc_pivco_bitrev_permute:
 1024|  1.22M|static void zxc_pivco_bitrev_permute(uint8_t* RESTRICT s, const int D) {
 1025|  1.22M|    const unsigned m = 1U << D;
 1026|  1.22M|    unsigned c = 0; /* r bit-reversed */
 1027|  22.7M|    for (unsigned r = 0; r < m; r++) {
  ------------------
  |  Branch (1027:26): [True: 21.5M, False: 1.22M]
  ------------------
 1028|  21.5M|        if (r < c) {
  ------------------
  |  Branch (1028:13): [True: 8.04M, False: 13.5M]
  ------------------
 1029|  8.04M|            const uint8_t x = s[r];
 1030|  8.04M|            s[r] = s[c];
 1031|  8.04M|            s[c] = x;
 1032|  8.04M|        }
 1033|  21.5M|        unsigned bit = m >> 1; /* reversed increment */
 1034|  41.8M|        for (; c & bit; bit >>= 1) c ^= bit;
  ------------------
  |  Branch (1034:16): [True: 20.3M, False: 21.5M]
  ------------------
 1035|  21.5M|        c |= bit;
 1036|  21.5M|    }
 1037|  1.22M|}
zxc_huffman.c:zxc_pivco_flat_leaves:
 1018|  1.48M|                                                   const int d, const int D) {
 1019|  1.48M|    const int e = d + D;
 1020|  1.48M|    return t->leaf_base[e] + t->base[e] - t->node_base[e] + ((g - t->base[d]) << D);
 1021|  1.48M|}
zxc_huffman.c:zxc_pivco_counts:
 1138|   180k|                             uint32_t* RESTRICT count) {
 1139|   180k|    count[t->node_base[t->max_depth + 1]] = 0;
 1140|  1.84M|    for (int d = t->max_depth; d >= 0; d--) {
  ------------------
  |  Branch (1140:32): [True: 1.66M, False: 180k]
  ------------------
 1141|  1.66M|        const int L = zxc_pivco_leaves(t, d);
 1142|  1.66M|        const int N = t->node_base[d + 1] - t->node_base[d];
 1143|  1.66M|        uint32_t* const cnt = count + t->node_base[d];
 1144|  1.66M|        const uint32_t* const ccnt = count + t->node_base[d + 1];
 1145|  1.66M|        const uint8_t* const sym = t->syms + t->leaf_base[d];
 1146|  19.4M|        for (int i = 0; i < L; i++) cnt[i] = freq[sym[i]];
  ------------------
  |  Branch (1146:25): [True: 17.7M, False: 1.66M]
  ------------------
 1147|  19.2M|        for (int i = L; i < N; i++) cnt[i] = ccnt[2 * (i - L)] + ccnt[2 * (i - L) + 1];
  ------------------
  |  Branch (1147:25): [True: 17.5M, False: 1.66M]
  ------------------
 1148|  1.66M|    }
 1149|   180k|}
zxc_huffman.c:zxc_pivco_layout:
 1195|   180k|                               uint32_t* RESTRICT cur) {
 1196|   180k|    size_t total = 0;
 1197|  1.66M|    for (int d = 0; d < t->max_depth; d++) {
  ------------------
  |  Branch (1197:21): [True: 1.48M, False: 180k]
  ------------------
 1198|  19.0M|        for (int g = t->node_base[d] + zxc_pivco_leaves(t, d); g < t->node_base[d + 1]; g++) {
  ------------------
  |  Branch (1198:64): [True: 17.5M, False: 1.48M]
  ------------------
 1199|  17.5M|            if (t->flat_d[g] == ZXC_PIVCO_COVERED) continue;
  ------------------
  |  |  850|  17.5M|#define ZXC_PIVCO_COVERED 0xFFU
  ------------------
  |  Branch (1199:17): [True: 15.0M, False: 2.49M]
  ------------------
 1200|  2.49M|            if (cur) cur[g] = (uint32_t)(total << 3);
  ------------------
  |  Branch (1200:17): [True: 880k, False: 1.61M]
  ------------------
 1201|  2.49M|            total += zxc_pivco_run_bytes(count[g], t->flat_d[g]);
 1202|  2.49M|        }
 1203|  1.48M|    }
 1204|   180k|    return total;
 1205|   180k|}
zxc_huffman.c:zxc_pivco_run_bytes:
 1182|  11.8M|static ZXC_ALWAYS_INLINE size_t zxc_pivco_run_bytes(const uint32_t count, const uint8_t flat_d) {
 1183|  11.8M|    return flat_d ? ((size_t)count * flat_d + 7) / 8 : ((size_t)count + 7) / 8;
  ------------------
  |  Branch (1183:12): [True: 9.26M, False: 2.57M]
  ------------------
 1184|  11.8M|}
zxc_huffman.c:zxc_pivco_codes:
 1152|  62.0k|static void zxc_pivco_codes(const zxc_pivco_tree_t* RESTRICT t, uint32_t* RESTRICT codes) {
 1153|   566k|    for (int d = 1; d <= t->max_depth; d++)
  ------------------
  |  Branch (1153:21): [True: 504k, False: 62.0k]
  ------------------
 1154|  5.54M|        for (int i = 0; i < zxc_pivco_leaves(t, d); i++)
  ------------------
  |  Branch (1154:25): [True: 5.03M, False: 504k]
  ------------------
 1155|  5.03M|            codes[t->syms[t->leaf_base[d] + i]] = (uint32_t)(t->node_base[d] + i - t->base[d]);
 1156|  62.0k|}
zxc_huffman.c:zxc_pivco_encode_core:
 1244|  62.0k|                                 const int with_header) {
 1245|  62.0k|    if (UNLIKELY(n_literals == 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  62.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 62.0k]
  |  |  ------------------
  ------------------
 1246|       |    // Every literal present in the histogram must have a code (a dict table
 1247|       |    // may lack codes for symbols unseen in training: the caller then falls
 1248|       |    // back to a per-block table, but a direct call must fail loudly).
 1249|  15.9M|    for (int k = 0; k < ZXC_HUF_NUM_SYMBOLS; k++)
  ------------------
  |  |  833|  15.9M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (1249:21): [True: 15.8M, False: 62.0k]
  ------------------
 1250|  15.8M|        if (UNLIKELY(freq[k] != 0 && code_len[k] == 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  20.8M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 15.8M]
  |  |  |  Branch (152:42): [True: 5.01M, False: 10.8M]
  |  |  |  Branch (152:42): [True: 0, False: 5.01M]
  |  |  ------------------
  ------------------
 1251|       |
 1252|  62.0k|    uint32_t count[ZXC_PIVCO_NODE_SLOTS];
 1253|  62.0k|    zxc_pivco_counts(t, freq, count);
 1254|  62.0k|    uint32_t cur[ZXC_PIVCO_MAX_NODES]; /* per-node write cursor, in payload bits */
 1255|  62.0k|    const size_t payload = zxc_pivco_layout(t, count, cur);
 1256|  62.0k|    const size_t hdr = with_header ? (size_t)ZXC_HUF_TABLE_SIZE : 0;
  ------------------
  |  |  102|  62.0k|#define ZXC_HUF_TABLE_SIZE 128
  ------------------
  |  Branch (1256:24): [True: 62.0k, False: 4]
  ------------------
 1257|       |    // +2: the packed-code emitter uses a 3-byte read-modify-write that may
 1258|       |    // touch up to 2 bytes past the payload end.
 1259|  62.0k|    if (UNLIKELY(hdr + payload + 2 > dst_cap)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  62.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 62.0k]
  |  |  ------------------
  ------------------
 1260|       |
 1261|  62.0k|    if (with_header) zxc_huf_pack_lengths(code_len, dst);
  ------------------
  |  |   43|  62.0k|#define zxc_huf_pack_lengths ZXC_CAT(zxc_huf_pack_lengths, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   41|  62.0k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|  62.0k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1261:9): [True: 62.0k, False: 4]
  ------------------
 1262|  62.0k|    uint8_t* const out = dst + hdr;
 1263|  62.0k|    ZXC_MEMSET(out, 0, payload + 2);
  ------------------
  |  |  173|  62.0k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 1264|       |
 1265|       |    // Emit MSB-first while descending. At a flat root, emit the code's last D
 1266|       |    // bits, its packed code, in one shot and stop. Batching the per-bit
 1267|       |    // read-modify-write buys nothing: accumulators would still touch memory
 1268|       |    // once per bit, and flat roots absorb the dense levels.
 1269|  60.8M|    for (size_t i = 0; i < n_literals; i++) {
  ------------------
  |  Branch (1269:24): [True: 60.8M, False: 62.0k]
  ------------------
 1270|  60.8M|        const uint8_t s = literals[i];
 1271|  60.8M|        const uint32_t c = codes[s];
 1272|  60.8M|        const int l = code_len[s];
 1273|   213M|        for (int d = 0; d < l; d++) {
  ------------------
  |  Branch (1273:25): [True: 202M, False: 10.8M]
  ------------------
 1274|   202M|            const int g = t->base[d] + (int)(c >> (l - d));
 1275|   202M|            const int fd = t->flat_d[g];
 1276|   202M|            if (fd) {
  ------------------
  |  Branch (1276:17): [True: 49.9M, False: 152M]
  ------------------
 1277|  49.9M|                const uint32_t p = cur[g];
 1278|  49.9M|                cur[g] += (uint32_t)fd;
 1279|  49.9M|                uint8_t* q = out + (p >> 3);
 1280|  49.9M|                const uint32_t sh = p & 7U;
 1281|  49.9M|                uint32_t w = (uint32_t)q[0] | ((uint32_t)q[1] << 8) | ((uint32_t)q[2] << 16);
 1282|  49.9M|                w |= (c & ((1U << fd) - 1U)) << sh; /* fd <= 8, sh <= 7: fits 24 bits */
 1283|  49.9M|                q[0] = (uint8_t)w;
 1284|  49.9M|                q[1] = (uint8_t)(w >> 8);
 1285|  49.9M|                q[2] = (uint8_t)(w >> 16);
 1286|  49.9M|                break;
 1287|  49.9M|            }
 1288|   152M|            const uint32_t bit = (c >> (l - 1 - d)) & 1U;
 1289|   152M|            const uint32_t p = cur[g]++;
 1290|   152M|            out[p >> 3] |= (uint8_t)(bit << (p & 7));
 1291|   152M|        }
 1292|  60.8M|    }
 1293|  62.0k|    return (int)(hdr + payload);
 1294|  62.0k|}
zxc_huffman.c:zxc_pivco_decode_core:
 2188|  61.8k|                                 const zxc_pivco_tree_t* RESTRICT t, uint8_t* RESTRICT scratch) {
 2189|  61.8k|    if (UNLIKELY(n == 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  61.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 61.8k]
  |  |  ------------------
  ------------------
 2190|       |
 2191|       |    // Pass 1, in wire order: node counts from the partition bits, and where
 2192|       |    // each depth's runs start. Leaf-pair children (emitted by their parent) and
 2193|       |    // a flat root's inside get count 0: empty runs, nothing to flag.
 2194|  61.8k|    uint32_t count[ZXC_PIVCO_NODE_SLOTS];
 2195|  61.8k|    const uint8_t* lvl_run[ZXC_HUF_MAX_CODE_LEN_ULTRA];
 2196|  61.8k|    const int slot = t->node_base[t->max_depth + 1];
 2197|  61.8k|    count[0] = (uint32_t)n;
 2198|  61.8k|    count[slot] = 0;
 2199|  61.8k|    const uint8_t* p = payload;
 2200|  61.8k|    const uint8_t* const pend = payload + payload_size;
 2201|   555k|    for (int d = 0; d < t->max_depth; d++) {
  ------------------
  |  Branch (2201:21): [True: 493k, False: 61.8k]
  ------------------
 2202|   493k|        lvl_run[d] = p;
 2203|   493k|        const int L = zxc_pivco_leaves(t, d);
 2204|   493k|        const int N = t->node_base[d + 1] - t->node_base[d];
 2205|   493k|        const int Lc = zxc_pivco_leaves(t, d + 1);
 2206|   493k|        const uint32_t* const cnt = count + t->node_base[d];
 2207|   493k|        uint32_t* const ccnt = count + t->node_base[d + 1];
 2208|   493k|        const uint8_t* const fd = t->flat_d + t->node_base[d];
 2209|  5.31M|        for (int i = L; i < N; i++) {
  ------------------
  |  Branch (2209:25): [True: 4.82M, False: 493k]
  ------------------
 2210|  4.82M|            const uint32_t c = cnt[i];
 2211|  4.82M|            const int k2 = 2 * (i - L); /* first child */
 2212|  4.82M|            if (fd[i]) {
  ------------------
  |  Branch (2212:17): [True: 4.25M, False: 567k]
  ------------------
 2213|       |                // Packed-code run: no partition below, nothing to popcount.
 2214|  4.25M|                const size_t fbytes = zxc_pivco_run_bytes(c, fd[i]);
 2215|  4.25M|                if (UNLIKELY((size_t)(pend - p) < fbytes)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  4.25M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 4.25M]
  |  |  ------------------
  ------------------
 2216|  4.25M|                p += fbytes;
 2217|  4.25M|                ccnt[k2] = 0;
 2218|  4.25M|                ccnt[k2 + 1] = 0;
 2219|  4.25M|                continue;
 2220|  4.25M|            }
 2221|   567k|            const size_t nbytes = zxc_pivco_run_bytes(c, 0); /* merge node: c partition bits */
 2222|   567k|            if (UNLIKELY((size_t)(pend - p) < nbytes)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|   567k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 567k]
  |  |  ------------------
  ------------------
 2223|       |            // popcount of the c valid bits = the right child's count. All but the
 2224|       |            // last byte counted fast, the last one with its padding masked - if the
 2225|       |            // 8-byte loop swallowed it unmasked, padding bits would inflate `ones`.
 2226|   567k|            uint32_t ones = 0;
 2227|   568k|            if (nbytes) {
  ------------------
  |  Branch (2227:17): [True: 568k, False: 18.4E]
  ------------------
 2228|   568k|                const size_t full = nbytes - 1;
 2229|   568k|                size_t k = 0;
 2230|  2.76M|                for (; k + 8 <= full; k += 8) {
  ------------------
  |  Branch (2230:24): [True: 2.19M, False: 568k]
  ------------------
 2231|  2.19M|                    uint64_t w;
 2232|  2.19M|                    ZXC_MEMCPY(&w, p + k, 8);
  ------------------
  |  |  168|  2.19M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2233|  2.19M|                    ones += (uint32_t)zxc_pivco_popcnt64(w);
 2234|  2.19M|                }
 2235|  2.05M|                for (; k < full; k++) ones += (uint32_t)zxc_pivco_popcnt32(p[k]);
  ------------------
  |  Branch (2235:24): [True: 1.48M, False: 568k]
  ------------------
 2236|   568k|                uint8_t last = p[full];
 2237|   568k|                if (c & 7U) last &= (uint8_t)((1U << (c & 7U)) - 1U);
  ------------------
  |  Branch (2237:21): [True: 489k, False: 79.0k]
  ------------------
 2238|   568k|                ones += (uint32_t)zxc_pivco_popcnt32(last);
 2239|   568k|            }
 2240|   567k|            p += nbytes;
 2241|   567k|            if (UNLIKELY(ones > c)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|   567k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 567k]
  |  |  ------------------
  ------------------
 2242|   567k|            const int leaf_pair = k2 + 1 < Lc;
 2243|   567k|            ccnt[k2] = leaf_pair ? 0 : c - ones;
  ------------------
  |  Branch (2243:24): [True: 109k, False: 457k]
  ------------------
 2244|   567k|            ccnt[k2 + 1] = leaf_pair ? 0 : ones;
  ------------------
  |  Branch (2244:28): [True: 109k, False: 457k]
  ------------------
 2245|   567k|        }
 2246|   493k|    }
 2247|       |    // The slot stands for the lone-symbol root's missing child: no 1 bits.
 2248|  61.8k|    if (UNLIKELY(count[slot] != 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  61.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 61.8k]
  |  |  ------------------
  ------------------
 2249|       |
 2250|       |    // Pass 2, bottom-up. Runs and children follow position order, so two
 2251|       |    // running offsets replace per-node tables.
 2252|   596k|    for (int d = t->max_depth; d >= 0; d--) {
  ------------------
  |  Branch (2252:32): [True: 534k, False: 61.8k]
  ------------------
 2253|   534k|        uint8_t* const buf_d = (d & 1) ? scratch : dst;
  ------------------
  |  Branch (2253:32): [True: 254k, False: 279k]
  ------------------
 2254|   534k|        const uint8_t* const buf_c = (d & 1) ? dst : scratch; /* children at d+1 (read-only) */
  ------------------
  |  Branch (2254:38): [True: 254k, False: 279k]
  ------------------
 2255|   534k|        const int L = zxc_pivco_leaves(t, d);
 2256|   534k|        const int N = t->node_base[d + 1] - t->node_base[d];
 2257|   534k|        const uint32_t* const cnt = count + t->node_base[d];
 2258|   534k|        const uint8_t* const sym = t->syms + t->leaf_base[d];
 2259|   534k|        size_t off = 0;
 2260|  5.51M|        for (int i = 0; i < L; i++) {
  ------------------
  |  Branch (2260:25): [True: 4.97M, False: 534k]
  ------------------
 2261|  4.97M|            if (cnt[i]) ZXC_MEMSET(buf_d + off, sym[i], cnt[i]);
  ------------------
  |  |  173|   112k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  |  Branch (2261:17): [True: 112k, False: 4.86M]
  ------------------
 2262|  4.97M|            off += cnt[i];
 2263|  4.97M|        }
 2264|   534k|        if (d == t->max_depth) continue; /* leaves only, as in pass 1 */
  ------------------
  |  Branch (2264:13): [True: 61.8k, False: 472k]
  ------------------
 2265|   472k|        const uint8_t* run = lvl_run[d];
 2266|   472k|        const uint32_t* const ccnt = count + t->node_base[d + 1];
 2267|   472k|        const uint8_t* const csym = t->syms + t->leaf_base[d + 1];
 2268|   472k|        const int Lc = zxc_pivco_leaves(t, d + 1);
 2269|   472k|        const uint8_t* const fd = t->flat_d + t->node_base[d];
 2270|   472k|        size_t coff = 0;
 2271|  5.25M|        for (int i = L; i < N; i++) {
  ------------------
  |  Branch (2271:25): [True: 4.78M, False: 472k]
  ------------------
 2272|  4.78M|            const uint32_t c = cnt[i];
 2273|  4.78M|            const int k2 = 2 * (i - L);
 2274|  4.78M|            if (c) {
  ------------------
  |  Branch (2274:17): [True: 824k, False: 3.95M]
  ------------------
 2275|   824k|                if (fd[i]) {
  ------------------
  |  Branch (2275:21): [True: 288k, False: 536k]
  ------------------
 2276|   288k|                    const int D = fd[i];
 2277|   288k|                    const int leaves = zxc_pivco_flat_leaves(t, t->node_base[d] + i, d, D);
 2278|   288k|                    zxc_pivco_unpack_flat(buf_d + off, c, D, run, t->syms + leaves);
 2279|   536k|                } else if (k2 + 1 < Lc) {
  ------------------
  |  Branch (2279:28): [True: 109k, False: 427k]
  ------------------
 2280|   109k|                    zxc_pivco_emit_leaf_pair(buf_d + off, c, csym[k2], csym[k2 + 1], run);
 2281|   427k|                } else {
 2282|   427k|                    const uint32_t nl = ccnt[k2];
 2283|   427k|                    zxc_pivco_merge(buf_d + off, buf_c + coff, nl, c - nl, run);
 2284|   427k|                }
 2285|   824k|            }
 2286|  4.78M|            run += zxc_pivco_run_bytes(c, fd[i]);
 2287|  4.78M|            off += c;
 2288|  4.78M|            coff += ccnt[k2] + ccnt[k2 + 1];
 2289|  4.78M|        }
 2290|   472k|    }
 2291|  61.8k|    return ZXC_OK;
 2292|  61.8k|}
zxc_huffman.c:zxc_pivco_popcnt64:
 1009|  2.19M|static ZXC_ALWAYS_INLINE int zxc_pivco_popcnt64(const uint64_t v) { return (int)ZXC_POPCOUNT64(v); }
  ------------------
  |  |  157|  2.19M|#define ZXC_POPCOUNT64(v) __builtin_popcountll(v)
  ------------------
zxc_huffman.c:zxc_pivco_popcnt32:
 1007|  17.0M|static ZXC_ALWAYS_INLINE int zxc_pivco_popcnt32(const uint32_t v) { return (int)ZXC_POPCOUNT32(v); }
  ------------------
  |  |  156|  17.0M|#define ZXC_POPCOUNT32(v) __builtin_popcount(v)
  ------------------
zxc_huffman.c:zxc_pivco_unpack_flat:
 1584|   287k|                                  const uint8_t* RESTRICT bits, const uint8_t* RESTRICT c2s) {
 1585|   287k|    size_t i = 0;
 1586|       |#if defined(ZXC_USE_NEON64)
 1587|       |    if (D == 2) {
 1588|       |        uint8_t c2s16[16];
 1589|       |        for (int k = 0; k < 16; k++) c2s16[k] = c2s[k & 3];
 1590|       |        const uint8x16_t vc2s = vld1q_u8(c2s16);
 1591|       |        static const uint8_t rep4[16] = {0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3};
 1592|       |        static const int8_t sh2[16] = {0, -2, -4, -6, 0, -2, -4, -6, 0, -2, -4, -6, 0, -2, -4, -6};
 1593|       |        const uint8x16_t vrep = vld1q_u8(rep4);
 1594|       |        const int8x16_t vsh = vld1q_s8(sh2);
 1595|       |        const uint8x16_t vmask = vdupq_n_u8(0x03);
 1596|       |        while (i + 16 <= n) {
 1597|       |            uint8x16_t raw = vdupq_n_u8(0);
 1598|       |            raw = vreinterpretq_u8_u32(
 1599|       |                vsetq_lane_u32(zxc_le32(bits + ((i * 2) >> 3)), vreinterpretq_u32_u8(raw), 0));
 1600|       |            const uint8x16_t rep = vqtbl1q_u8(raw, vrep);
 1601|       |            const uint8x16_t codes = vandq_u8(vshlq_u8(rep, vsh), vmask);
 1602|       |            vst1q_u8(out + i, vqtbl1q_u8(vc2s, codes));
 1603|       |            i += 16;
 1604|       |        }
 1605|       |    } else if (D == 3) {
 1606|       |        // Odd D straddle bytes: build a 16-bit window {byte_j,byte_j+1} per lane
 1607|       |        // (byte_j = Di>>3), right-shift by Di&7, mask D bits. 16/step, two u16x8
 1608|       |        // halves sharing the shift vector. D=3: 6 source bytes.
 1609|       |        uint8_t c2s16[16];
 1610|       |        for (int k = 0; k < 16; k++) c2s16[k] = c2s[k & 7];
 1611|       |        const uint8x16_t vc2s = vld1q_u8(c2s16); /* 8 entries, padded to 16 */
 1612|       |        static const uint8_t idxA[16] = {0, 1, 0, 1, 0, 1, 1, 2, 1, 2, 1, 2, 2, 3, 2, 3};
 1613|       |        static const uint8_t idxB[16] = {3, 4, 3, 4, 3, 4, 4, 5, 4, 5, 4, 5, 5, 6, 5, 6};
 1614|       |        static const int16_t sh8[8] = {0, -3, -6, -1, -4, -7, -2, -5};
 1615|       |        const uint8x16_t vidxA = vld1q_u8(idxA);
 1616|       |        const uint8x16_t vidxB = vld1q_u8(idxB);
 1617|       |        const int16x8_t vsh = vld1q_s16(sh8);
 1618|       |        const uint16x8_t vmask = vdupq_n_u16(0x07);
 1619|       |        while (i + 16 <= n) {
 1620|       |            const size_t off = (i * 3) >> 3;
 1621|       |            uint32_t w0;
 1622|       |            uint16_t w1;
 1623|       |            ZXC_MEMCPY(&w0, bits + off, 4);
 1624|       |            ZXC_MEMCPY(&w1, bits + off + 4, 2); /* exactly 6 bytes read */
 1625|       |            uint8x16_t raw = vdupq_n_u8(0);
 1626|       |            raw = vreinterpretq_u8_u32(vsetq_lane_u32(w0, vreinterpretq_u32_u8(raw), 0));
 1627|       |            raw = vreinterpretq_u8_u16(vsetq_lane_u16(w1, vreinterpretq_u16_u8(raw), 2));
 1628|       |            const uint16x8_t winA = vreinterpretq_u16_u8(vqtbl1q_u8(raw, vidxA));
 1629|       |            const uint16x8_t winB = vreinterpretq_u16_u8(vqtbl1q_u8(raw, vidxB));
 1630|       |            const uint8x8_t cA = vmovn_u16(vandq_u16(vshlq_u16(winA, vsh), vmask));
 1631|       |            const uint8x8_t cB = vmovn_u16(vandq_u16(vshlq_u16(winB, vsh), vmask));
 1632|       |            vst1q_u8(out + i, vqtbl1q_u8(vc2s, vcombine_u8(cA, cB)));
 1633|       |            i += 16;
 1634|       |        }
 1635|       |    } else if (D == 4) {
 1636|       |        const uint8x16_t vc2s = vld1q_u8(c2s); /* 16 entries */
 1637|       |        static const uint8_t rep2[16] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7};
 1638|       |        static const int8_t sh4[16] = {0, -4, 0, -4, 0, -4, 0, -4, 0, -4, 0, -4, 0, -4, 0, -4};
 1639|       |        const uint8x16_t vrep = vld1q_u8(rep2);
 1640|       |        const int8x16_t vsh = vld1q_s8(sh4);
 1641|       |        const uint8x16_t vmask = vdupq_n_u8(0x0F);
 1642|       |        while (i + 16 <= n) {
 1643|       |            uint8x16_t raw = vdupq_n_u8(0);
 1644|       |            raw = vreinterpretq_u8_u64(
 1645|       |                vsetq_lane_u64(zxc_le64(bits + ((i * 4) >> 3)), vreinterpretq_u64_u8(raw), 0));
 1646|       |            const uint8x16_t rep = vqtbl1q_u8(raw, vrep);
 1647|       |            const uint8x16_t codes = vandq_u8(vshlq_u8(rep, vsh), vmask);
 1648|       |            vst1q_u8(out + i, vqtbl1q_u8(vc2s, codes));
 1649|       |            i += 16;
 1650|       |        }
 1651|       |    } else if (D == 5) {
 1652|       |        // Same window scheme as D=3; c2s has 32 entries (vqtbl2q). 10 bytes.
 1653|       |        const uint8x16x2_t vc2s = vld1q_u8_x2(c2s);
 1654|       |        static const uint8_t idxA[16] = {0, 1, 0, 1, 1, 2, 1, 2, 2, 3, 3, 4, 3, 4, 4, 5};
 1655|       |        static const uint8_t idxB[16] = {5, 6, 5, 6, 6, 7, 6, 7, 7, 8, 8, 9, 8, 9, 9, 10};
 1656|       |        static const int16_t sh8[8] = {0, -5, -2, -7, -4, -1, -6, -3};
 1657|       |        const uint8x16_t vidxA = vld1q_u8(idxA);
 1658|       |        const uint8x16_t vidxB = vld1q_u8(idxB);
 1659|       |        const int16x8_t vsh = vld1q_s16(sh8);
 1660|       |        const uint16x8_t vmask = vdupq_n_u16(0x1F);
 1661|       |        while (i + 16 <= n) {
 1662|       |            const size_t off = (i * 5) >> 3;
 1663|       |            uint64_t w0;
 1664|       |            uint16_t w1;
 1665|       |            ZXC_MEMCPY(&w0, bits + off, 8);
 1666|       |            ZXC_MEMCPY(&w1, bits + off + 8, 2);
 1667|       |            uint8x16_t raw = vdupq_n_u8(0);
 1668|       |            raw = vreinterpretq_u8_u64(vsetq_lane_u64(w0, vreinterpretq_u64_u8(raw), 0));
 1669|       |            raw = vreinterpretq_u8_u16(vsetq_lane_u16(w1, vreinterpretq_u16_u8(raw), 4));
 1670|       |            const uint16x8_t winA = vreinterpretq_u16_u8(vqtbl1q_u8(raw, vidxA));
 1671|       |            const uint16x8_t winB = vreinterpretq_u16_u8(vqtbl1q_u8(raw, vidxB));
 1672|       |            const uint8x8_t cA = vmovn_u16(vandq_u16(vshlq_u16(winA, vsh), vmask));
 1673|       |            const uint8x8_t cB = vmovn_u16(vandq_u16(vshlq_u16(winB, vsh), vmask));
 1674|       |            vst1q_u8(out + i, vqtbl2q_u8(vc2s, vcombine_u8(cA, cB)));
 1675|       |            i += 16;
 1676|       |        }
 1677|       |    } else if (D == 6) {
 1678|       |        // Same window scheme as D=3; c2s has 64 entries (vqtbl4q). 12 bytes.
 1679|       |        const uint8x16x4_t vc2s = vld1q_u8_x4(c2s);
 1680|       |        static const uint8_t idxA[16] = {0, 1, 0, 1, 1, 2, 2, 3, 3, 4, 3, 4, 4, 5, 5, 6};
 1681|       |        static const uint8_t idxB[16] = {6, 7, 6, 7, 7, 8, 8, 9, 9, 10, 9, 10, 10, 11, 11, 12};
 1682|       |        static const int16_t sh8[8] = {0, -6, -4, -2, 0, -6, -4, -2};
 1683|       |        const uint8x16_t vidxA = vld1q_u8(idxA);
 1684|       |        const uint8x16_t vidxB = vld1q_u8(idxB);
 1685|       |        const int16x8_t vsh = vld1q_s16(sh8);
 1686|       |        const uint16x8_t vmask = vdupq_n_u16(0x3F);
 1687|       |        while (i + 16 <= n) {
 1688|       |            const size_t off = (i * 6) >> 3;
 1689|       |            uint64_t w0;
 1690|       |            uint32_t w1;
 1691|       |            ZXC_MEMCPY(&w0, bits + off, 8);
 1692|       |            ZXC_MEMCPY(&w1, bits + off + 8, 4);
 1693|       |            uint8x16_t raw = vdupq_n_u8(0);
 1694|       |            raw = vreinterpretq_u8_u64(vsetq_lane_u64(w0, vreinterpretq_u64_u8(raw), 0));
 1695|       |            raw = vreinterpretq_u8_u32(vsetq_lane_u32(w1, vreinterpretq_u32_u8(raw), 2));
 1696|       |            const uint16x8_t winA = vreinterpretq_u16_u8(vqtbl1q_u8(raw, vidxA));
 1697|       |            const uint16x8_t winB = vreinterpretq_u16_u8(vqtbl1q_u8(raw, vidxB));
 1698|       |            const uint8x8_t cA = vmovn_u16(vandq_u16(vshlq_u16(winA, vsh), vmask));
 1699|       |            const uint8x8_t cB = vmovn_u16(vandq_u16(vshlq_u16(winB, vsh), vmask));
 1700|       |            vst1q_u8(out + i, vqtbl4q_u8(vc2s, vcombine_u8(cA, cB)));
 1701|       |            i += 16;
 1702|       |        }
 1703|       |    }
 1704|       |#elif defined(ZXC_USE_NEON32)
 1705|       |    // d-register mirrors of the AArch64 kernels: 8 codes per step, c2s lookup
 1706|       |    // via VTBL (16-entry table = two d-registers).
 1707|       |    if (D == 2) {
 1708|       |        uint8_t c2s8[8];
 1709|       |        for (int k = 0; k < 8; k++) c2s8[k] = c2s[k & 3];
 1710|       |        const uint8x8_t vc2s = vld1_u8(c2s8);
 1711|       |        static const uint8_t rep4[8] = {0, 0, 0, 0, 1, 1, 1, 1};
 1712|       |        static const int8_t sh2[8] = {0, -2, -4, -6, 0, -2, -4, -6};
 1713|       |        const uint8x8_t vrep = vld1_u8(rep4);
 1714|       |        const int8x8_t vsh = vld1_s8(sh2);
 1715|       |        const uint8x8_t vmask = vdup_n_u8(0x03);
 1716|       |        while (i + 8 <= n) {
 1717|       |            const uint16_t w = (uint16_t)((uint16_t)bits[(i * 2) >> 3] |
 1718|       |                                          ((uint16_t)bits[((i * 2) >> 3) + 1] << 8));
 1719|       |            const uint8x8_t raw = vreinterpret_u8_u16(vdup_n_u16(w));
 1720|       |            const uint8x8_t rep = vtbl1_u8(raw, vrep);
 1721|       |            const uint8x8_t codes = vand_u8(vshl_u8(rep, vsh), vmask);
 1722|       |            vst1_u8(out + i, vtbl1_u8(vc2s, codes));
 1723|       |            i += 8;
 1724|       |        }
 1725|       |    } else if (D == 3) {
 1726|       |        // 8 codes/step. 3-bit codes straddle bytes, so build a 16-bit window
 1727|       |        // {byte_j, byte_j+1} per lane via two VTBLs, then extract bits [s,s+3)
 1728|       |        // by multiply-by-2^(13-s) then >>13 - ARMv7 has no per-lane u16 variable
 1729|       |        // shift. 8 codes fit in 3 source bytes.
 1730|       |        const uint8x8_t vc2s = vld1_u8(c2s); /* 8 entries (2^3) */
 1731|       |        static const uint8_t idxlo[8] = {0, 1, 0, 1, 0, 1, 1, 2};
 1732|       |        static const uint8_t idxhi[8] = {1, 2, 1, 2, 2, 3, 2, 3};
 1733|       |        static const uint16_t mul8[8] = {8192, 1024, 128, 4096, 512, 64, 2048, 256};
 1734|       |        const uint8x8_t vidxlo = vld1_u8(idxlo);
 1735|       |        const uint8x8_t vidxhi = vld1_u8(idxhi);
 1736|       |        const uint16x8_t vmul = vld1q_u16(mul8);
 1737|       |        const uint16x8_t vmask = vdupq_n_u16(0x07);
 1738|       |        while (i + 8 <= n) {
 1739|       |            const size_t off = (i * 3) >> 3;
 1740|       |            const uint32_t w = (uint32_t)bits[off] | ((uint32_t)bits[off + 1] << 8) |
 1741|       |                               ((uint32_t)bits[off + 2] << 16); /* exactly 3 bytes */
 1742|       |            const uint8x8_t raw = vreinterpret_u8_u32(vdup_n_u32(w));
 1743|       |            const uint8x8_t wlo = vtbl1_u8(raw, vidxlo);
 1744|       |            const uint8x8_t whi = vtbl1_u8(raw, vidxhi);
 1745|       |            const uint16x8_t win = vreinterpretq_u16_u8(vcombine_u8(wlo, whi));
 1746|       |            const uint16x8_t codes16 = vandq_u16(vshrq_n_u16(vmulq_u16(win, vmul), 13), vmask);
 1747|       |            vst1_u8(out + i, vtbl1_u8(vc2s, vmovn_u16(codes16)));
 1748|       |            i += 8;
 1749|       |        }
 1750|       |    } else if (D == 4) {
 1751|       |        /* Register by register: GCC has no AArch32 vld1_u8_x2/_x4 before 14.
 1752|       |         * Loaded once per call, so the tuple form bought nothing anyway. */
 1753|       |        uint8x8x2_t vc2s;
 1754|       |        vc2s.val[0] = vld1_u8(c2s);
 1755|       |        vc2s.val[1] = vld1_u8(c2s + 8);
 1756|       |        static const uint8_t rep2[8] = {0, 0, 1, 1, 2, 2, 3, 3};
 1757|       |        static const int8_t sh4[8] = {0, -4, 0, -4, 0, -4, 0, -4};
 1758|       |        const uint8x8_t vrep = vld1_u8(rep2);
 1759|       |        const int8x8_t vsh = vld1_s8(sh4);
 1760|       |        const uint8x8_t vmask = vdup_n_u8(0x0F);
 1761|       |        while (i + 8 <= n) {
 1762|       |            uint32_t w;
 1763|       |            ZXC_MEMCPY(&w, bits + ((i * 4) >> 3), 4);
 1764|       |            const uint8x8_t raw = vreinterpret_u8_u32(vdup_n_u32(w));
 1765|       |            const uint8x8_t rep = vtbl1_u8(raw, vrep);
 1766|       |            const uint8x8_t codes = vand_u8(vshl_u8(rep, vsh), vmask);
 1767|       |            vst1_u8(out + i, vtbl2_u8(vc2s, codes));
 1768|       |            i += 8;
 1769|       |        }
 1770|       |    } else if (D == 5) {
 1771|       |        // Same window scheme as D=3; c2s has 32 entries (VTBL4). 5 source bytes.
 1772|       |        // Register by register: see D == 4.
 1773|       |        uint8x8x4_t vc2s;
 1774|       |        vc2s.val[0] = vld1_u8(c2s);
 1775|       |        vc2s.val[1] = vld1_u8(c2s + 8);
 1776|       |        vc2s.val[2] = vld1_u8(c2s + 16);
 1777|       |        vc2s.val[3] = vld1_u8(c2s + 24);
 1778|       |        static const uint8_t idxlo[8] = {0, 1, 0, 1, 1, 2, 1, 2};
 1779|       |        static const uint8_t idxhi[8] = {2, 3, 3, 4, 3, 4, 4, 5};
 1780|       |        static const uint16_t mul8[8] = {2048, 64, 512, 16, 128, 1024, 32, 256};
 1781|       |        const uint8x8_t vidxlo = vld1_u8(idxlo);
 1782|       |        const uint8x8_t vidxhi = vld1_u8(idxhi);
 1783|       |        const uint16x8_t vmul = vld1q_u16(mul8);
 1784|       |        const uint16x8_t vmask = vdupq_n_u16(0x1F);
 1785|       |        while (i + 8 <= n) {
 1786|       |            uint64_t w = 0;
 1787|       |            ZXC_MEMCPY(&w, bits + ((i * 5) >> 3), 5);
 1788|       |            const uint8x8_t raw = vcreate_u8(w);
 1789|       |            const uint16x8_t win =
 1790|       |                vreinterpretq_u16_u8(vcombine_u8(vtbl1_u8(raw, vidxlo), vtbl1_u8(raw, vidxhi)));
 1791|       |            const uint8x8_t codes =
 1792|       |                vmovn_u16(vandq_u16(vshrq_n_u16(vmulq_u16(win, vmul), 11), vmask));
 1793|       |            vst1_u8(out + i, vtbl4_u8(vc2s, codes));
 1794|       |            i += 8;
 1795|       |        }
 1796|       |    } else if (D == 6) {
 1797|       |        // Same window scheme; c2s has 64 entries: two VTBL4 halves, select by
 1798|       |        // code bit 5. 6 source bytes.
 1799|       |        uint8x8x4_t lo, hi;  // register by register: see D == 4
 1800|       |        lo.val[0] = vld1_u8(c2s);
 1801|       |        lo.val[1] = vld1_u8(c2s + 8);
 1802|       |        lo.val[2] = vld1_u8(c2s + 16);
 1803|       |        lo.val[3] = vld1_u8(c2s + 24);
 1804|       |        hi.val[0] = vld1_u8(c2s + 32);
 1805|       |        hi.val[1] = vld1_u8(c2s + 40);
 1806|       |        hi.val[2] = vld1_u8(c2s + 48);
 1807|       |        hi.val[3] = vld1_u8(c2s + 56);
 1808|       |        static const uint8_t idxlo[8] = {0, 1, 0, 1, 1, 2, 2, 3};
 1809|       |        static const uint8_t idxhi[8] = {3, 4, 3, 4, 4, 5, 5, 6};
 1810|       |        static const uint16_t mul8[8] = {1024, 16, 64, 256, 1024, 16, 64, 256};
 1811|       |        const uint8x8_t vidxlo = vld1_u8(idxlo);
 1812|       |        const uint8x8_t vidxhi = vld1_u8(idxhi);
 1813|       |        const uint16x8_t vmul = vld1q_u16(mul8);
 1814|       |        const uint16x8_t vmask = vdupq_n_u16(0x3F);
 1815|       |        while (i + 8 <= n) {
 1816|       |            uint64_t w = 0;
 1817|       |            ZXC_MEMCPY(&w, bits + ((i * 6) >> 3), 6);
 1818|       |            const uint8x8_t raw = vcreate_u8(w);
 1819|       |            const uint16x8_t win =
 1820|       |                vreinterpretq_u16_u8(vcombine_u8(vtbl1_u8(raw, vidxlo), vtbl1_u8(raw, vidxhi)));
 1821|       |            const uint8x8_t codes =
 1822|       |                vmovn_u16(vandq_u16(vshrq_n_u16(vmulq_u16(win, vmul), 10), vmask));
 1823|       |            const uint8x8_t sel =
 1824|       |                vbsl_u8(vcge_u8(codes, vdup_n_u8(32)), vtbl4_u8(hi, vsub_u8(codes, vdup_n_u8(32))),
 1825|       |                        vtbl4_u8(lo, codes));
 1826|       |            vst1_u8(out + i, sel);
 1827|       |            i += 8;
 1828|       |        }
 1829|       |    }
 1830|       |#elif defined(ZXC_USE_AVX512) || defined(ZXC_USE_AVX2) || \
 1831|       |    (defined(ZXC_USE_SSE2) && defined(__SSE4_1__))
 1832|       |#if defined(ZXC_USE_AVX512) && defined(__AVX512VBMI__)
 1833|       |    /* vpmultishiftqb reads an 8-bit field at an arbitrary bit offset: the
 1834|       |     * unaligned D-bit read, in one instruction. Two facts carry the rest -
 1835|       |     * 64 codes are exactly 8*D bytes and byte-aligned, so the tables are the
 1836|       |     * same every step; and only the low D bits of a field survive, so bytes
 1837|       |     * past 8*D are irrelevant and both accesses can be clamped to the run.
 1838|       |     * Clamping the store also ends the run, hence nothing narrower below. */
 1839|       |    if (D >= 2 && D <= 6) {
 1840|       |        uint8_t arr[64];
 1841|       |        uint8_t shf[64];
 1842|       |        for (int k = 0; k < 8; k++) {
 1843|       |            for (int j = 0; j < 8; j++) {
 1844|       |                arr[k * 8 + j] = (uint8_t)(k * D + j);
 1845|       |                shf[k * 8 + j] = (uint8_t)(j * D);
 1846|       |            }
 1847|       |        }
 1848|       |        const __m512i varr = _mm512_loadu_si512((const void*)arr);
 1849|       |        const __m512i vshf = _mm512_loadu_si512((const void*)shf);
 1850|       |        const __m512i vand = _mm512_set1_epi8((char)((1 << D) - 1));
 1851|       |        /* c2s holds 2^D entries and nothing is guaranteed past them. */
 1852|       |        const __mmask64 tm = (D == 6) ? ~(__mmask64)0 : (((__mmask64)1 << (1 << D)) - 1);
 1853|       |        const __m512i vc2s = _mm512_maskz_loadu_epi8(tm, (const void*)c2s);
 1854|       |        const size_t nbytes = zxc_pivco_run_bytes((uint32_t)n, (uint8_t)D);
 1855|       |        while (i < n) {
 1856|       |            const size_t off = ((size_t)i * (size_t)D) >> 3;
 1857|       |            const size_t avail = nbytes - off;
 1858|       |            const size_t left = n - i;
 1859|       |            const __mmask64 lm = (avail >= 64) ? ~(__mmask64)0 : (((__mmask64)1 << avail) - 1);
 1860|       |            const __mmask64 sm = (left >= 64) ? ~(__mmask64)0 : (((__mmask64)1 << left) - 1);
 1861|       |            const __m512i raw = _mm512_maskz_loadu_epi8(lm, (const void*)(bits + off));
 1862|       |            const __m512i q = _mm512_permutexvar_epi8(varr, raw);
 1863|       |            const __m512i codes = _mm512_and_si512(_mm512_multishift_epi64_epi8(vshf, q), vand);
 1864|       |            _mm512_mask_storeu_epi8((void*)(out + i), sm, _mm512_permutexvar_epi8(codes, vc2s));
 1865|       |            i += 64;
 1866|       |        }
 1867|       |        if (i > n) i = n;
 1868|       |    }
 1869|       |#else
 1870|       |#if defined(ZXC_USE_AVX2)
 1871|       |    /* Codes 16..31 start exactly 2*D bytes in, so the upper half runs the same
 1872|       |     * pattern over a shifted source: one shuffle vector serves both, and packus
 1873|       |     * leaves each half's codes in order in its own lane - no cross-lane fixup.
 1874|       |     * The bound keeps both 16-byte reads inside the run; the exact-length
 1875|       |     * 16-wide loops below take the tail. */
 1876|       |    if (D >= 2 && D <= 6) {
 1877|       |        uint8_t sa[16];
 1878|       |        uint8_t sb[16];
 1879|       |        uint16_t mu[8];
 1880|       |        for (int q = 0; q < 8; q++) {
 1881|       |            const int ba = (q * D) >> 3;
 1882|       |            sa[2 * q] = (uint8_t)ba;
 1883|       |            sa[2 * q + 1] = (uint8_t)(ba + 1);
 1884|       |            sb[2 * q] = (uint8_t)(ba + D); /* code q+8 sits D bytes further */
 1885|       |            sb[2 * q + 1] = (uint8_t)(ba + D + 1);
 1886|       |            mu[q] = (uint16_t)(1U << (16 - D - ((q * D) & 7)));
 1887|       |        }
 1888|       |        const __m256i vsa = _mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(void*)sa));
 1889|       |        const __m256i vsb = _mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(void*)sb));
 1890|       |        const __m256i vmu = _mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(void*)mu));
 1891|       |        const __m256i vand = _mm256_set1_epi8((char)((1 << D) - 1));
 1892|       |        uint8_t tab[64];
 1893|       |        for (int e = 0; e < 64; e++) tab[e] = c2s[e & ((1 << D) - 1)];
 1894|       |        const __m256i t0 = _mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(void*)tab));
 1895|       |        const __m256i t1 =
 1896|       |            _mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(void*)(tab + 16)));
 1897|       |        const __m256i t2 =
 1898|       |            _mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(void*)(tab + 32)));
 1899|       |        const __m256i t3 =
 1900|       |            _mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(void*)(tab + 48)));
 1901|       |        const size_t nbytes = zxc_pivco_run_bytes((uint32_t)n, (uint8_t)D);
 1902|       |        while (i + 32 <= n && ((size_t)i * (size_t)D >> 3) + (size_t)(2 * D) + 16 <= nbytes) {
 1903|       |            const uint8_t* src = bits + ((size_t)i * (size_t)D >> 3);
 1904|       |            const __m256i raw = _mm256_inserti128_si256(
 1905|       |                _mm256_castsi128_si256(_mm_loadu_si128((const __m128i*)(const void*)src)),
 1906|       |                _mm_loadu_si128((const __m128i*)(const void*)(src + 2 * D)), 1);
 1907|       |            const __m256i ca =
 1908|       |                _mm256_srli_epi16(_mm256_mullo_epi16(_mm256_shuffle_epi8(raw, vsa), vmu), 16 - D);
 1909|       |            const __m256i cb =
 1910|       |                _mm256_srli_epi16(_mm256_mullo_epi16(_mm256_shuffle_epi8(raw, vsb), vmu), 16 - D);
 1911|       |            const __m256i codes = _mm256_and_si256(_mm256_packus_epi16(ca, cb), vand);
 1912|       |            __m256i sym;
 1913|       |            if (D <= 4) {
 1914|       |                sym = _mm256_shuffle_epi8(t0, codes);
 1915|       |            } else {
 1916|       |                const __m256i b4 = _mm256_slli_epi16(codes, 3); /* code bit 4 -> sign */
 1917|       |                const __m256i lo = _mm256_blendv_epi8(_mm256_shuffle_epi8(t0, codes),
 1918|       |                                                      _mm256_shuffle_epi8(t1, codes), b4);
 1919|       |                if (D == 5) {
 1920|       |                    sym = lo;
 1921|       |                } else {
 1922|       |                    const __m256i hi = _mm256_blendv_epi8(_mm256_shuffle_epi8(t2, codes),
 1923|       |                                                          _mm256_shuffle_epi8(t3, codes), b4);
 1924|       |                    sym = _mm256_blendv_epi8(lo, hi, _mm256_slli_epi16(codes, 2));
 1925|       |                }
 1926|       |            }
 1927|       |            _mm256_storeu_si256((__m256i*)(void*)(out + i), sym);
 1928|       |            i += 32;
 1929|       |        }
 1930|       |    }
 1931|       |#endif
 1932|       |    if (D == 4) {
 1933|       |        const __m128i vc2s = _mm_loadu_si128((const __m128i*)(const void*)c2s);
 1934|       |        const __m128i vrep = _mm_setr_epi8(0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7);
 1935|       |        const __m128i vmask = _mm_set1_epi8(0x0F);
 1936|       |        // even lanes keep low nibble, odd lanes take the high nibble: shift the
 1937|       |        // replicated bytes right by 4 via a 16-bit shift + odd-lane select.
 1938|       |        const __m128i vodd = _mm_set1_epi16(0x0F00 - 0x0F00 + (short)0xFF00);
 1939|       |        while (i + 16 <= n) {
 1940|       |            const __m128i raw =
 1941|       |                _mm_loadl_epi64((const __m128i*)(const void*)(bits + ((i * 4) >> 3)));
 1942|       |            const __m128i rep = _mm_shuffle_epi8(raw, vrep);
 1943|       |            const __m128i hi = _mm_and_si128(_mm_srli_epi16(rep, 4), _mm_set1_epi8(0x0F));
 1944|       |            const __m128i lo = _mm_and_si128(rep, vmask);
 1945|       |            const __m128i codes = _mm_blendv_epi8(lo, hi, vodd);
 1946|       |            _mm_storeu_si128((__m128i*)(void*)(out + i), _mm_shuffle_epi8(vc2s, codes));
 1947|       |            i += 16;
 1948|       |        }
 1949|       |    } else if (D == 2) {
 1950|       |        // 16 codes from 4 bytes. SSE has no per-lane byte shift, so shift by
 1951|       |        // multiply: (b << (6 - 2j)) >> 6 keeps bits [2j+1:2j]. Bytes spread to
 1952|       |        // u16 lanes, times {64,16,4,1}, shifted, then packed back.
 1953|       |        uint8_t c2s16[16];
 1954|       |        for (int k = 0; k < 16; k++) c2s16[k] = c2s[k & 3];
 1955|       |        const __m128i vc2s = _mm_loadu_si128((const __m128i*)(const void*)c2s16);
 1956|       |        const __m128i vspreadA =
 1957|       |            _mm_setr_epi8(0, (char)0x80, 0, (char)0x80, 0, (char)0x80, 0, (char)0x80, 1, (char)0x80,
 1958|       |                          1, (char)0x80, 1, (char)0x80, 1, (char)0x80);
 1959|       |        const __m128i vspreadB =
 1960|       |            _mm_setr_epi8(2, (char)0x80, 2, (char)0x80, 2, (char)0x80, 2, (char)0x80, 3, (char)0x80,
 1961|       |                          3, (char)0x80, 3, (char)0x80, 3, (char)0x80);
 1962|       |        const __m128i vmul = _mm_setr_epi16(64, 16, 4, 1, 64, 16, 4, 1);
 1963|       |        while (i + 16 <= n) {
 1964|       |            const __m128i raw = _mm_cvtsi32_si128(
 1965|       |                (int)((uint32_t)bits[(i * 2) >> 3] | ((uint32_t)bits[((i * 2) >> 3) + 1] << 8) |
 1966|       |                      ((uint32_t)bits[((i * 2) >> 3) + 2] << 16) |
 1967|       |                      ((uint32_t)bits[((i * 2) >> 3) + 3] << 24)));
 1968|       |            const __m128i a16 =
 1969|       |                _mm_srli_epi16(_mm_mullo_epi16(_mm_shuffle_epi8(raw, vspreadA), vmul), 6);
 1970|       |            const __m128i b16 =
 1971|       |                _mm_srli_epi16(_mm_mullo_epi16(_mm_shuffle_epi8(raw, vspreadB), vmul), 6);
 1972|       |            const __m128i codes = _mm_and_si128(_mm_packus_epi16(a16, b16), _mm_set1_epi8(3));
 1973|       |            _mm_storeu_si128((__m128i*)(void*)(out + i), _mm_shuffle_epi8(vc2s, codes));
 1974|       |            i += 16;
 1975|       |        }
 1976|       |    } else if (D == 3) {
 1977|       |        // 16-bit window {byte_j,byte_j+1} per lane (byte_j = Di>>3); SSE has no
 1978|       |        // per-lane u16 shift, so extract bits [s,s+D) of window w by w*2^(16-D-s)
 1979|       |        // (field lands in the top D bits) then >>(16-D); s_j = Dj&7. D=3: 6 bytes.
 1980|       |        uint8_t c2s16[16];
 1981|       |        for (int k = 0; k < 16; k++) c2s16[k] = c2s[k & 7];
 1982|       |        const __m128i vc2s = _mm_loadu_si128((const __m128i*)(const void*)c2s16);
 1983|       |        const __m128i shufA = _mm_setr_epi8(0, 1, 0, 1, 0, 1, 1, 2, 1, 2, 1, 2, 2, 3, 2, 3);
 1984|       |        const __m128i shufB = _mm_setr_epi8(3, 4, 3, 4, 3, 4, 4, 5, 4, 5, 4, 5, 5, 6, 5, 6);
 1985|       |        const __m128i vmul = _mm_setr_epi16(8192, 1024, 128, 4096, 512, 64, 2048, 256);
 1986|       |        while (i + 16 <= n) {
 1987|       |            const size_t off = (i * 3) >> 3;
 1988|       |            uint32_t w0;
 1989|       |            uint16_t w1;
 1990|       |            ZXC_MEMCPY(&w0, bits + off, 4);
 1991|       |            ZXC_MEMCPY(&w1, bits + off + 4, 2); /* exactly 6 bytes read */
 1992|       |            const __m128i raw = _mm_insert_epi16(_mm_cvtsi32_si128((int)w0), (int16_t)w1, 2);
 1993|       |            const __m128i cA =
 1994|       |                _mm_srli_epi16(_mm_mullo_epi16(_mm_shuffle_epi8(raw, shufA), vmul), 13);
 1995|       |            const __m128i cB =
 1996|       |                _mm_srli_epi16(_mm_mullo_epi16(_mm_shuffle_epi8(raw, shufB), vmul), 13);
 1997|       |            const __m128i codes = _mm_and_si128(_mm_packus_epi16(cA, cB), _mm_set1_epi8(7));
 1998|       |            _mm_storeu_si128((__m128i*)(void*)(out + i), _mm_shuffle_epi8(vc2s, codes));
 1999|       |            i += 16;
 2000|       |        }
 2001|       |    } else if (D == 5) {
 2002|       |        // c2s has 32 entries: pshufb does 16, so select lo/hi by code bit 4.
 2003|       |        const __m128i vlo = _mm_loadu_si128((const __m128i*)(const void*)c2s);
 2004|       |        const __m128i vhi = _mm_loadu_si128((const __m128i*)(const void*)(c2s + 16));
 2005|       |        const __m128i shufA = _mm_setr_epi8(0, 1, 0, 1, 1, 2, 1, 2, 2, 3, 3, 4, 3, 4, 4, 5);
 2006|       |        const __m128i shufB = _mm_setr_epi8(5, 6, 5, 6, 6, 7, 6, 7, 7, 8, 8, 9, 8, 9, 9, 10);
 2007|       |        const __m128i vmul = _mm_setr_epi16(2048, 64, 512, 16, 128, 1024, 32, 256);
 2008|       |        while (i + 16 <= n) {
 2009|       |            const size_t off = (i * 5) >> 3;
 2010|       |            uint16_t w1;
 2011|       |            ZXC_MEMCPY(&w1, bits + off + 8, 2); /* 10 source bytes */
 2012|       |            const __m128i raw = _mm_insert_epi16(
 2013|       |                _mm_loadl_epi64((const __m128i*)(const void*)(bits + off)), (int16_t)w1, 4);
 2014|       |            const __m128i cA =
 2015|       |                _mm_srli_epi16(_mm_mullo_epi16(_mm_shuffle_epi8(raw, shufA), vmul), 11);
 2016|       |            const __m128i cB =
 2017|       |                _mm_srli_epi16(_mm_mullo_epi16(_mm_shuffle_epi8(raw, shufB), vmul), 11);
 2018|       |            const __m128i codes = _mm_and_si128(_mm_packus_epi16(cA, cB), _mm_set1_epi8(0x1F));
 2019|       |            const __m128i sel =
 2020|       |                _mm_blendv_epi8(_mm_shuffle_epi8(vlo, codes), _mm_shuffle_epi8(vhi, codes),
 2021|       |                                _mm_slli_epi16(codes, 3));
 2022|       |            _mm_storeu_si128((__m128i*)(void*)(out + i), sel);
 2023|       |            i += 16;
 2024|       |        }
 2025|       |    } else if (D == 6) {
 2026|       |        // c2s has 64 entries: 4 pshufb sub-tables, select by code bits 4-5.
 2027|       |        const __m128i t0 = _mm_loadu_si128((const __m128i*)(const void*)c2s);
 2028|       |        const __m128i t1 = _mm_loadu_si128((const __m128i*)(const void*)(c2s + 16));
 2029|       |        const __m128i t2 = _mm_loadu_si128((const __m128i*)(const void*)(c2s + 32));
 2030|       |        const __m128i t3 = _mm_loadu_si128((const __m128i*)(const void*)(c2s + 48));
 2031|       |        const __m128i shufA = _mm_setr_epi8(0, 1, 0, 1, 1, 2, 2, 3, 3, 4, 3, 4, 4, 5, 5, 6);
 2032|       |        const __m128i shufB = _mm_setr_epi8(6, 7, 6, 7, 7, 8, 8, 9, 9, 10, 9, 10, 10, 11, 11, 12);
 2033|       |        const __m128i vmul = _mm_setr_epi16(1024, 16, 64, 256, 1024, 16, 64, 256);
 2034|       |        while (i + 16 <= n) {
 2035|       |            const size_t off = (i * 6) >> 3;
 2036|       |            uint32_t w1;
 2037|       |            ZXC_MEMCPY(&w1, bits + off + 8, 4); /* 12 source bytes */
 2038|       |            const __m128i raw = _mm_insert_epi32(
 2039|       |                _mm_loadl_epi64((const __m128i*)(const void*)(bits + off)), (int)w1, 2);
 2040|       |            const __m128i cA =
 2041|       |                _mm_srli_epi16(_mm_mullo_epi16(_mm_shuffle_epi8(raw, shufA), vmul), 10);
 2042|       |            const __m128i cB =
 2043|       |                _mm_srli_epi16(_mm_mullo_epi16(_mm_shuffle_epi8(raw, shufB), vmul), 10);
 2044|       |            const __m128i codes = _mm_and_si128(_mm_packus_epi16(cA, cB), _mm_set1_epi8(0x3F));
 2045|       |            const __m128i m4 = _mm_slli_epi16(codes, 3);
 2046|       |            const __m128i lo =
 2047|       |                _mm_blendv_epi8(_mm_shuffle_epi8(t0, codes), _mm_shuffle_epi8(t1, codes), m4);
 2048|       |            const __m128i hi =
 2049|       |                _mm_blendv_epi8(_mm_shuffle_epi8(t2, codes), _mm_shuffle_epi8(t3, codes), m4);
 2050|       |            _mm_storeu_si128((__m128i*)(void*)(out + i),
 2051|       |                             _mm_blendv_epi8(lo, hi, _mm_slli_epi16(codes, 2)));
 2052|       |            i += 16;
 2053|       |        }
 2054|       |    }
 2055|       |#endif /* AVX-512 VBMI, else AVX2 + SSE */
 2056|       |#endif
 2057|       |    // Generic scalar bit-reader (any D).
 2058|   287k|    {
 2059|   287k|        uint64_t bitpos = i * (uint64_t)D;
 2060|   287k|        const uint32_t m = (1U << D) - 1U;
 2061|   287k|        const size_t fbytes = (size_t)(((uint64_t)n * (uint64_t)D + 7U) >> 3);
 2062|  45.4M|        while (i < n) {
  ------------------
  |  Branch (2062:16): [True: 45.1M, False: 287k]
  ------------------
 2063|  45.1M|            const size_t byte = (size_t)(bitpos >> 3);
 2064|  45.1M|            uint32_t w = bits[byte];
 2065|  45.3M|            if (byte + 1 < fbytes) w |= (uint32_t)bits[byte + 1] << 8;
  ------------------
  |  Branch (2065:17): [True: 45.3M, False: 18.4E]
  ------------------
 2066|  45.1M|            if (D > 8 && byte + 2 < fbytes) w |= (uint32_t)bits[byte + 2] << 16;
  ------------------
  |  Branch (2066:17): [True: 0, False: 45.1M]
  |  Branch (2066:26): [True: 0, False: 0]
  ------------------
 2067|  45.1M|            out[i++] = c2s[(w >> (bitpos & 7U)) & m];
 2068|  45.1M|            bitpos += (uint64_t)D;
 2069|  45.1M|        }
 2070|   287k|    }
 2071|   287k|}
zxc_huffman.c:zxc_pivco_emit_leaf_pair:
 2083|   109k|                                                       const uint8_t* RESTRICT bits) {
 2084|   109k|    size_t i = 0;
 2085|       |#if defined(ZXC_USE_NEON64)
 2086|       |    const uint8x16_t vsym0 = vdupq_n_u8(sym0);
 2087|       |    const uint8x16_t vdelta = vdupq_n_u8((uint8_t)(sym0 ^ sym1));
 2088|       |    static const uint8_t rep_idx[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
 2089|       |    static const uint8_t bit_sel[16] = {1, 2, 4, 8, 16, 32, 64, 128, 1, 2, 4, 8, 16, 32, 64, 128};
 2090|       |    const uint8x16_t vrep = vld1q_u8(rep_idx);
 2091|       |    const uint8x16_t vsel = vld1q_u8(bit_sel);
 2092|       |    while (i + 16 <= n) {
 2093|       |        uint8x16_t ctrl = vdupq_n_u8(0);
 2094|       |        ctrl = vsetq_lane_u8(bits[i >> 3], ctrl, 0);
 2095|       |        ctrl = vsetq_lane_u8(bits[(i >> 3) + 1], ctrl, 1);
 2096|       |        const uint8x16_t rep = vqtbl1q_u8(ctrl, vrep);
 2097|       |        const uint8x16_t mask = vtstq_u8(rep, vsel);
 2098|       |        vst1q_u8(out + i, veorq_u8(vsym0, vandq_u8(vdelta, mask)));
 2099|       |        i += 16;
 2100|       |    }
 2101|       |#elif defined(ZXC_USE_NEON32)
 2102|       |    const uint8x8_t vsym0 = vdup_n_u8(sym0);
 2103|       |    const uint8x8_t vdelta = vdup_n_u8((uint8_t)(sym0 ^ sym1));
 2104|       |    static const uint8_t bit_sel8[8] = {1, 2, 4, 8, 16, 32, 64, 128};
 2105|       |    const uint8x8_t vsel = vld1_u8(bit_sel8);
 2106|       |    while (i + 8 <= n) {
 2107|       |        const uint8x8_t mask = vtst_u8(vdup_n_u8(bits[i >> 3]), vsel);
 2108|       |        vst1_u8(out + i, veor_u8(vsym0, vand_u8(vdelta, mask)));
 2109|       |        i += 8;
 2110|       |    }
 2111|       |#elif defined(ZXC_USE_AVX512) || defined(ZXC_USE_AVX2) || \
 2112|       |    (defined(ZXC_USE_SSE2) && defined(__SSSE3__))
 2113|       |#if defined(ZXC_USE_AVX512)
 2114|       |    /* The control word is already the blend mask; the masked store takes the
 2115|       |     * tail, hence nothing narrower below. */
 2116|       |    {
 2117|       |        const __m512i z0 = _mm512_set1_epi8((char)sym0);
 2118|       |        const __m512i z1 = _mm512_set1_epi8((char)sym1);
 2119|       |        while (i < n) {
 2120|       |            const size_t left = n - i;
 2121|       |            const size_t cb = (left + 7) >> 3;
 2122|       |            uint64_t ctrl = 0;
 2123|       |            ZXC_MEMCPY(&ctrl, bits + (i >> 3), cb < 8 ? cb : 8); /* not past the run */
 2124|       |            const __mmask64 sm = (left >= 64) ? ~(__mmask64)0 : (((__mmask64)1 << left) - 1);
 2125|       |            _mm512_mask_storeu_epi8((void*)(out + i), sm,
 2126|       |                                    _mm512_mask_blend_epi8((__mmask64)ctrl, z0, z1));
 2127|       |            i += 64;
 2128|       |        }
 2129|       |        if (i > n) i = n;
 2130|       |    }
 2131|       |#else
 2132|       |#if defined(ZXC_USE_AVX2)
 2133|       |    /* Broadcasting the control dword lets each 128-bit half pick its own two
 2134|       |     * bytes out of it. */
 2135|       |    {
 2136|       |        const __m256i y0 = _mm256_set1_epi8((char)sym0);
 2137|       |        const __m256i ydelta = _mm256_set1_epi8((char)(uint8_t)(sym0 ^ sym1));
 2138|       |        const __m256i yrep = _mm256_setr_epi8(0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
 2139|       |                                              2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3);
 2140|       |        const __m256i ysel =
 2141|       |            _mm256_setr_epi8(1, 2, 4, 8, 16, 32, 64, (char)128, 1, 2, 4, 8, 16, 32, 64, (char)128,
 2142|       |                             1, 2, 4, 8, 16, 32, 64, (char)128, 1, 2, 4, 8, 16, 32, 64, (char)128);
 2143|       |        while (i + 32 <= n) {
 2144|       |            uint32_t c4;
 2145|       |            ZXC_MEMCPY(&c4, bits + (i >> 3), 4);
 2146|       |            const __m256i rep = _mm256_shuffle_epi8(_mm256_set1_epi32((int)c4), yrep);
 2147|       |            const __m256i mask = _mm256_cmpeq_epi8(_mm256_and_si256(rep, ysel), ysel);
 2148|       |            _mm256_storeu_si256((__m256i*)(void*)(out + i),
 2149|       |                                _mm256_xor_si256(y0, _mm256_and_si256(ydelta, mask)));
 2150|       |            i += 32;
 2151|       |        }
 2152|       |    }
 2153|       |#endif
 2154|       |    const __m128i vsym0 = _mm_set1_epi8((char)sym0);
 2155|       |    const __m128i vdelta = _mm_set1_epi8((char)(uint8_t)(sym0 ^ sym1));
 2156|       |    const __m128i vrep = _mm_setr_epi8(0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1);
 2157|       |    const __m128i vsel =
 2158|       |        _mm_setr_epi8(1, 2, 4, 8, 16, 32, 64, (char)128, 1, 2, 4, 8, 16, 32, 64, (char)128);
 2159|       |    while (i + 16 <= n) {
 2160|       |        const __m128i ctrl = _mm_cvtsi32_si128(bits[i >> 3] | ((int)bits[(i >> 3) + 1] << 8));
 2161|       |        const __m128i rep = _mm_shuffle_epi8(ctrl, vrep);
 2162|       |        // lanes where the selected bit is set -> 0xFF
 2163|       |        const __m128i mask = _mm_cmpeq_epi8(_mm_and_si128(rep, vsel), vsel);
 2164|       |        _mm_storeu_si128((__m128i*)(void*)(out + i),
 2165|       |                         _mm_xor_si128(vsym0, _mm_and_si128(vdelta, mask)));
 2166|       |        i += 16;
 2167|       |    }
 2168|       |#endif /* AVX-512, else AVX2 + SSE */
 2169|       |#endif
 2170|  4.11M|    while (i < n) {
  ------------------
  |  Branch (2170:12): [True: 4.00M, False: 109k]
  ------------------
 2171|  4.00M|        const int bit = (bits[i >> 3] >> (i & 7)) & 1;
 2172|  4.00M|        out[i++] = bit ? sym1 : sym0;
  ------------------
  |  Branch (2172:20): [True: 2.02M, False: 1.97M]
  ------------------
 2173|  4.00M|    }
 2174|   109k|}
zxc_huffman.c:zxc_pivco_merge:
 1403|   431k|                                              const uint8_t* RESTRICT bits) {
 1404|   431k|    const uint8_t* L = src;
 1405|   431k|    const uint8_t* R = src + nl;
 1406|   431k|    const size_t n = nl + nr;
 1407|   431k|    size_t i = 0;
 1408|   431k|    size_t lp = 0;
 1409|   431k|    size_t rp = 0;
 1410|       |    // MSan keeps the shadow of the bytes a shuffle loads but never selects.
 1411|   431k|    ZXC_MSAN_UNPOISON(src + n, 16);
  ------------------
  |  |  268|   431k|#define ZXC_MSAN_UNPOISON(p, n) ((void)0)
  ------------------
 1412|       |#if defined(ZXC_USE_NEON64)
 1413|       |    // 16 outputs per step: two-register TBL over {L[0..15], R[0..15]} with the
 1414|       |    // signed-index tables (see zxc_pivco_tables.h).
 1415|       |    while (i + 16 <= n) {
 1416|       |        const uint8_t b0 = bits[i >> 3];
 1417|       |        const uint8_t b1 = bits[(i >> 3) + 1];
 1418|       |        uint8x16x2_t tb;
 1419|       |        tb.val[0] = vld1q_u8(L + lp);
 1420|       |        tb.val[1] = vld1q_u8(R + rp);
 1421|       |        const size_t pc0 = (size_t)ZXC_PIVCO_POPCNT8(b0);
 1422|       |        const uint8x8_t ia = vld1_u8(zxc_pivco_idxa_u8[b0]);
 1423|       |        const uint8x8_t ib = vld1_u8(zxc_pivco_idxb_pre[pc0][b1]);
 1424|       |        vst1q_u8(out + i, vqtbl2q_u8(tb, vcombine_u8(ia, ib)));
 1425|       |        const size_t pc = pc0 + (size_t)ZXC_PIVCO_POPCNT8(b1);
 1426|       |        ZXC_PIVCO_MERGE_STEP(16, pc);
 1427|       |    }
 1428|       |#else /* x86 tiers */
 1429|       |#if defined(ZXC_USE_AVX512) && defined(__AVX512VBMI2__)
 1430|       |    // 64 outputs per step: the merge IS a pair of byte expands - L's bytes fill
 1431|       |    // the control word's 0-bit lanes, R's the 1-bit lanes. The masked expand
 1432|       |    // loads only touch the bytes they consume, so the speculative reads stay
 1433|       |    // fault-safe without extra buffer slack.
 1434|       |    const __m512i zero = _mm512_setzero_si512();
 1435|       |    while (i + 64 <= n) {
 1436|       |        uint64_t ctrl;
 1437|       |        ZXC_MEMCPY(&ctrl, bits + (i >> 3), 8);
 1438|       |        const __m512i vl =
 1439|       |            _mm512_mask_expandloadu_epi8(zero, (__mmask64)~ctrl, (const void*)(L + lp));
 1440|       |        const __m512i outv =
 1441|       |            _mm512_mask_expandloadu_epi8(vl, (__mmask64)ctrl, (const void*)(R + rp));
 1442|       |        _mm512_storeu_si512((void*)(out + i), outv);
 1443|       |        const int pc = zxc_pivco_popcnt64(ctrl);
 1444|       |        ZXC_PIVCO_MERGE_STEP(64, pc);
 1445|       |    }
 1446|       |#endif
 1447|       |#if defined(ZXC_USE_AVX512) || defined(ZXC_USE_AVX2) || \
 1448|       |    (defined(ZXC_USE_SSE2) && defined(__SSSE3__))
 1449|       |    // 16 outputs/step: pshufb(L, ix+0x70) | pshufb(R, ix-16) selects L[ix] or
 1450|       |    // R[ix-16] (out-of-range lanes zero out); 32/step unrolls it twice.
 1451|       |#if defined(ZXC_USE_AVX2)
 1452|       |    // Same thing at 256 bits, 32 outputs/step. Both selects take the index
 1453|       |    // unbiased: table lanes all sit in [0, 31], so pshufb masks to 4 bits and
 1454|       |    // bit 4 is the L/R selector - shifted into the sign it drives the blend,
 1455|       |    // and both bias vectors go away. L and R stay two 128-bit loads: the
 1456|       |    // second cursor is lp + (16 - pcA), never lp + 16.
 1457|       |    while (i + 32 <= n) {
 1458|       |        const uint8_t* cb = bits + (i >> 3);
 1459|       |        const size_t pcA0 = (size_t)zxc_pivco_popcnt32(cb[0]);
 1460|       |        const size_t pcA = pcA0 + (size_t)zxc_pivco_popcnt32(cb[1]);
 1461|       |        const size_t pcB0 = (size_t)zxc_pivco_popcnt32(cb[2]);
 1462|       |        const size_t pcB = pcB0 + (size_t)zxc_pivco_popcnt32(cb[3]);
 1463|       |        const size_t lpB = lp + (16 - pcA);
 1464|       |        const size_t rpB = rp + pcA;
 1465|       |        const __m256i vl = _mm256_inserti128_si256(
 1466|       |            _mm256_castsi128_si256(_mm_loadu_si128((const __m128i*)(const void*)(L + lp))),
 1467|       |            _mm_loadu_si128((const __m128i*)(const void*)(L + lpB)), 1);
 1468|       |        const __m256i vr = _mm256_inserti128_si256(
 1469|       |            _mm256_castsi128_si256(_mm_loadu_si128((const __m128i*)(const void*)(R + rp))),
 1470|       |            _mm_loadu_si128((const __m128i*)(const void*)(R + rpB)), 1);
 1471|       |        const __m128i ixA = _mm_unpacklo_epi64(
 1472|       |            _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxa_u8[cb[0]]),
 1473|       |            _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxb_pre[pcA0][cb[1]]));
 1474|       |        const __m128i ixB = _mm_unpacklo_epi64(
 1475|       |            _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxa_u8[cb[2]]),
 1476|       |            _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxb_pre[pcB0][cb[3]]));
 1477|       |        const __m256i ix = _mm256_inserti128_si256(_mm256_castsi128_si256(ixA), ixB, 1);
 1478|       |        _mm256_storeu_si256(
 1479|       |            (__m256i*)(void*)(out + i),
 1480|       |            _mm256_blendv_epi8(_mm256_shuffle_epi8(vl, ix), _mm256_shuffle_epi8(vr, ix),
 1481|       |                               _mm256_slli_epi16(ix, 3)));
 1482|       |        lp = lpB + (16 - pcB);
 1483|       |        rp = rpB + pcB;
 1484|       |        i += 32;
 1485|       |    }
 1486|       |#else
 1487|       |    while (i + 32 <= n) {
 1488|       |        const uint8_t* cb = bits + (i >> 3);
 1489|       |        const size_t pcA0 = (size_t)zxc_pivco_popcnt32(cb[0]);
 1490|       |        const size_t pcA = pcA0 + (size_t)zxc_pivco_popcnt32(cb[1]);
 1491|       |        const size_t pcB0 = (size_t)zxc_pivco_popcnt32(cb[2]);
 1492|       |        const size_t pcB = pcB0 + (size_t)zxc_pivco_popcnt32(cb[3]);
 1493|       |        const size_t lpB = lp + (16 - pcA);
 1494|       |        const size_t rpB = rp + pcA;
 1495|       |        const __m128i vlA = _mm_loadu_si128((const __m128i*)(const void*)(L + lp));
 1496|       |        const __m128i vrA = _mm_loadu_si128((const __m128i*)(const void*)(R + rp));
 1497|       |        const __m128i vlB = _mm_loadu_si128((const __m128i*)(const void*)(L + lpB));
 1498|       |        const __m128i vrB = _mm_loadu_si128((const __m128i*)(const void*)(R + rpB));
 1499|       |        const __m128i iaA = _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxa_u8[cb[0]]);
 1500|       |        const __m128i ibA =
 1501|       |            _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxb_pre[pcA0][cb[1]]);
 1502|       |        const __m128i iaB = _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxa_u8[cb[2]]);
 1503|       |        const __m128i ibB =
 1504|       |            _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxb_pre[pcB0][cb[3]]);
 1505|       |        const __m128i ixA = _mm_unpacklo_epi64(iaA, ibA);
 1506|       |        const __m128i ixB = _mm_unpacklo_epi64(iaB, ibB);
 1507|       |        const __m128i selA =
 1508|       |            _mm_or_si128(_mm_shuffle_epi8(vlA, _mm_add_epi8(ixA, _mm_set1_epi8(0x70))),
 1509|       |                         _mm_shuffle_epi8(vrA, _mm_sub_epi8(ixA, _mm_set1_epi8(16))));
 1510|       |        const __m128i selB =
 1511|       |            _mm_or_si128(_mm_shuffle_epi8(vlB, _mm_add_epi8(ixB, _mm_set1_epi8(0x70))),
 1512|       |                         _mm_shuffle_epi8(vrB, _mm_sub_epi8(ixB, _mm_set1_epi8(16))));
 1513|       |        _mm_storeu_si128((__m128i*)(void*)(out + i), selA);
 1514|       |        _mm_storeu_si128((__m128i*)(void*)(out + i + 16), selB);
 1515|       |        lp = lpB + (16 - pcB);
 1516|       |        rp = rpB + pcB;
 1517|       |        i += 32;
 1518|       |    }
 1519|       |#endif
 1520|       |    while (i + 16 <= n) {
 1521|       |        const uint8_t b0 = bits[i >> 3];
 1522|       |        const uint8_t b1 = bits[(i >> 3) + 1];
 1523|       |        const __m128i vl = _mm_loadu_si128((const __m128i*)(const void*)(L + lp));
 1524|       |        const __m128i vr = _mm_loadu_si128((const __m128i*)(const void*)(R + rp));
 1525|       |        const int pc0 = zxc_pivco_popcnt32(b0);
 1526|       |        const __m128i ia = _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxa_u8[b0]);
 1527|       |        const __m128i ib =
 1528|       |            _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxb_pre[pc0][b1]);
 1529|       |        const __m128i ix = _mm_unpacklo_epi64(ia, ib);
 1530|       |        const __m128i sell = _mm_shuffle_epi8(vl, _mm_add_epi8(ix, _mm_set1_epi8(0x70)));
 1531|       |        const __m128i selr = _mm_shuffle_epi8(vr, _mm_sub_epi8(ix, _mm_set1_epi8(16)));
 1532|       |        _mm_storeu_si128((__m128i*)(void*)(out + i), _mm_or_si128(sell, selr));
 1533|       |        const int pc = pc0 + zxc_pivco_popcnt32(b1);
 1534|       |        ZXC_PIVCO_MERGE_STEP(16, pc);
 1535|       |    }
 1536|       |#elif defined(ZXC_USE_NEON32)
 1537|       |    // 8 outputs per step: four-register VTBL over {L[0..7], -, R[0..7], -}. The
 1538|       |    // shared index tables address a 32-lane view, and an 8-output step only
 1539|       |    // touches lanes 0..7 and 16..23, so the two spare d-registers stay zero.
 1540|       |    while (i + 8 <= n) {
 1541|       |        const uint8_t b = bits[i >> 3];
 1542|       |        uint8x8x4_t tb;
 1543|       |        tb.val[0] = vld1_u8(L + lp);
 1544|       |        tb.val[1] = vdup_n_u8(0);
 1545|       |        tb.val[2] = vld1_u8(R + rp);
 1546|       |        tb.val[3] = vdup_n_u8(0);
 1547|       |        vst1_u8(out + i, vtbl4_u8(tb, vld1_u8(zxc_pivco_idxa_u8[b])));
 1548|       |        const int pc = zxc_pivco_popcnt32(b);
 1549|       |        ZXC_PIVCO_MERGE_STEP(8, pc);
 1550|       |    }
 1551|       |#endif
 1552|   431k|#endif /* x86 tiers */
 1553|       |    // Portable 8-output path: byte selects from a 24-byte scratch laid out
 1554|       |    // as the low half of the 32-lane view the shared index tables assume
 1555|       |    // (L at offset 0, R at offset 16).
 1556|  15.9M|    while (i + 8 <= n) {
  ------------------
  |  Branch (1556:12): [True: 15.4M, False: 431k]
  ------------------
 1557|  15.4M|        const uint8_t b = bits[i >> 3];
 1558|  15.4M|        uint8_t comb[24];
 1559|  15.4M|        ZXC_MEMCPY(comb, L + lp, 8);
  ------------------
  |  |  168|  15.4M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1560|  15.4M|        ZXC_MEMCPY(comb + 16, R + rp, 8);
  ------------------
  |  |  168|  15.4M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1561|  15.4M|        const uint8_t* ix = zxc_pivco_idxa_u8[b];
 1562|   139M|        for (int j = 0; j < 8; j++) out[i + (size_t)j] = comb[ix[j]];
  ------------------
  |  Branch (1562:25): [True: 123M, False: 15.4M]
  ------------------
 1563|  15.4M|        const int pc = zxc_pivco_popcnt32(b);
 1564|  15.4M|        ZXC_PIVCO_MERGE_STEP(8, pc);
  ------------------
  |  | 1371|  15.4M|    do {                            \
  |  | 1372|  15.4M|        rp += (size_t)(pc);         \
  |  | 1373|  15.4M|        lp += (size_t)((w) - (pc)); \
  |  | 1374|  15.4M|        i += (w);                   \
  |  | 1375|  15.4M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1375:14): [Folded, False: 15.4M]
  |  |  ------------------
  ------------------
 1565|  15.4M|    }
 1566|  1.94M|    while (i < n) {
  ------------------
  |  Branch (1566:12): [True: 1.51M, False: 431k]
  ------------------
 1567|  1.51M|        const int bit = (bits[i >> 3] >> (i & 7)) & 1;
 1568|  1.51M|        out[i++] = bit ? R[rp++] : L[lp++];
  ------------------
  |  Branch (1568:20): [True: 808k, False: 703k]
  ------------------
 1569|  1.51M|    }
 1570|   431k|}

zxc_common.c:zxc_opt_dp_sizes:
 1129|  24.3k|                                               size_t* RESTRICT sz_bm) {
 1130|  24.3k|    *sz_dp = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint32_t));
  ------------------
  |  |  384|  24.3k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  24.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  24.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  24.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  24.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1131|  24.3k|    *sz_pl = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint16_t));
  ------------------
  |  |  384|  24.3k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  24.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  24.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  24.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  24.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1132|  24.3k|    *sz_po = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint16_t));
  ------------------
  |  |  384|  24.3k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  24.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  24.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  24.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  24.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1133|  24.3k|    *sz_bm = ZXC_ALIGN_CL(ZXC_BITMAP_WORDS(chunk_size + 1) * sizeof(uint64_t));
  ------------------
  |  |  384|  24.3k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  24.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  24.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  24.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  24.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1134|  24.3k|}
zxc_common.c:zxc_log2_u32:
 1145|   138k|static ZXC_ALWAYS_INLINE uint32_t zxc_log2_u32(const uint32_t v) {
 1146|       |#ifdef _MSC_VER
 1147|       |    unsigned long index;
 1148|       |    return (v == 0) ? 0 : (_BitScanReverse(&index, v) ? index : 0);
 1149|       |#else
 1150|   138k|    return (v == 0) ? 0 : (uint32_t)(31 - __builtin_clz(v));
  ------------------
  |  Branch (1150:12): [True: 0, False: 138k]
  ------------------
 1151|   138k|#endif
 1152|   138k|}
zxc_common.c:zxc_store_le32:
 1485|   753k|static ZXC_ALWAYS_INLINE void zxc_store_le32(void* p, const uint32_t v) {
 1486|       |#ifdef ZXC_BIG_ENDIAN
 1487|       |    const uint32_t s = ZXC_BSWAP32(v);
 1488|       |    ZXC_MEMCPY(p, &s, sizeof(s));
 1489|       |#else
 1490|   753k|    ZXC_MEMCPY(p, &v, sizeof(v));
  ------------------
  |  |  168|   753k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1491|   753k|#endif
 1492|   753k|}
zxc_common.c:zxc_file_header_sign:
 1568|  18.3k|static ZXC_ALWAYS_INLINE void zxc_file_header_sign(uint8_t* h) {
 1569|  18.3k|    zxc_store_le16(h + 14, 0);
 1570|  18.3k|    zxc_store_le16(h + 14, zxc_hash16(h));
 1571|  18.3k|}
zxc_common.c:zxc_store_le16:
 1467|  36.7k|static ZXC_ALWAYS_INLINE void zxc_store_le16(void* p, const uint16_t v) {
 1468|       |#ifdef ZXC_BIG_ENDIAN
 1469|       |    const uint16_t s = ZXC_BSWAP16(v);
 1470|       |    ZXC_MEMCPY(p, &s, sizeof(s));
 1471|       |#else
 1472|  36.7k|    ZXC_MEMCPY(p, &v, sizeof(v));
  ------------------
  |  |  168|  36.7k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1473|  36.7k|#endif
 1474|  36.7k|}
zxc_common.c:zxc_le32:
 1385|   951k|static ZXC_ALWAYS_INLINE uint32_t zxc_le32(const void* p) {
 1386|   951k|    uint32_t v;
 1387|   951k|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  168|   951k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1388|       |#ifdef ZXC_BIG_ENDIAN
 1389|       |    return ZXC_BSWAP32(v);
 1390|       |#else
 1391|   951k|    return v;
 1392|   951k|#endif
 1393|   951k|}
zxc_common.c:zxc_le16:
 1366|  55.2k|static ZXC_ALWAYS_INLINE uint16_t zxc_le16(const void* p) {
 1367|  55.2k|    uint16_t v;
 1368|  55.2k|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  168|  55.2k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1369|       |#ifdef ZXC_BIG_ENDIAN
 1370|       |    return ZXC_BSWAP16(v);
 1371|       |#else
 1372|  55.2k|    return v;
 1373|  55.2k|#endif
 1374|  55.2k|}
zxc_common.c:zxc_hash16:
 1557|  73.6k|static ZXC_ALWAYS_INLINE uint16_t zxc_hash16(const uint8_t* p) {
 1558|  73.6k|    const uint64_t h1 = (zxc_le64(p) ^ ZXC_HASH_MULT64) * ZXC_HASH_MULT64;
  ------------------
  |  |  803|  73.6k|#define ZXC_HASH_MULT64 0xD2D84A61D2D84A61ULL
  ------------------
                  const uint64_t h1 = (zxc_le64(p) ^ ZXC_HASH_MULT64) * ZXC_HASH_MULT64;
  ------------------
  |  |  803|  73.6k|#define ZXC_HASH_MULT64 0xD2D84A61D2D84A61ULL
  ------------------
 1559|       |
 1560|  73.6k|    return (uint16_t)(((h1 + zxc_le64(p + 8) + ZXC_HASH_GOLDEN64) * ZXC_HASH_GOLDEN64) >> 48);
  ------------------
  |  |  797|  73.6k|#define ZXC_HASH_GOLDEN64 0x9E3779B97F4A7C15ULL
  ------------------
                  return (uint16_t)(((h1 + zxc_le64(p + 8) + ZXC_HASH_GOLDEN64) * ZXC_HASH_GOLDEN64) >> 48);
  ------------------
  |  |  797|  73.6k|#define ZXC_HASH_GOLDEN64 0x9E3779B97F4A7C15ULL
  ------------------
 1561|  73.6k|}
zxc_common.c:zxc_frame_tail_len:
 2573|  18.3k|static inline size_t zxc_frame_tail_len(const uint64_t total) {
 2574|  18.3k|    const uint64_t body = total - (ZXC_FILE_HEADER_SIZE + ZXC_BLOCK_HEADER_SIZE);
  ------------------
  |  |  126|  18.3k|#define ZXC_FILE_HEADER_SIZE 16
  ------------------
                  const uint64_t body = total - (ZXC_FILE_HEADER_SIZE + ZXC_BLOCK_HEADER_SIZE);
  ------------------
  |  |  439|  18.3k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 2575|  18.3k|    return body < ZXC_FOOTER_MAX_SIZE_WITH_DIGEST ? (size_t)body : ZXC_FOOTER_MAX_SIZE_WITH_DIGEST;
  ------------------
  |  | 2565|  18.3k|#define ZXC_FOOTER_MAX_SIZE_WITH_DIGEST (ZXC_FILE_DIGEST_SIZE + ZXC_FILE_FOOTER_MAX_SIZE)
  |  |  ------------------
  |  |  |  |  133|  18.3k|#define ZXC_FILE_DIGEST_SIZE 8
  |  |  ------------------
  |  |               #define ZXC_FOOTER_MAX_SIZE_WITH_DIGEST (ZXC_FILE_DIGEST_SIZE + ZXC_FILE_FOOTER_MAX_SIZE)
  |  |  ------------------
  |  |  |  |  131|  18.3k|#define ZXC_FILE_FOOTER_MAX_SIZE 17
  |  |  ------------------
  ------------------
                  return body < ZXC_FOOTER_MAX_SIZE_WITH_DIGEST ? (size_t)body : ZXC_FOOTER_MAX_SIZE_WITH_DIGEST;
  ------------------
  |  | 2565|  18.3k|#define ZXC_FOOTER_MAX_SIZE_WITH_DIGEST (ZXC_FILE_DIGEST_SIZE + ZXC_FILE_FOOTER_MAX_SIZE)
  |  |  ------------------
  |  |  |  |  133|  18.3k|#define ZXC_FILE_DIGEST_SIZE 8
  |  |  ------------------
  |  |               #define ZXC_FOOTER_MAX_SIZE_WITH_DIGEST (ZXC_FILE_DIGEST_SIZE + ZXC_FILE_FOOTER_MAX_SIZE)
  |  |  ------------------
  |  |  |  |  131|  18.3k|#define ZXC_FILE_FOOTER_MAX_SIZE 17
  |  |  ------------------
  ------------------
  |  Branch (2575:12): [True: 31, False: 18.3k]
  ------------------
 2576|  18.3k|}
zxc_common.c:zxc_footer_dsize_plausible:
 2618|  18.3k|                                                        const uint64_t comp_size) {
 2619|  18.3k|    return zxc_seek_block_count(dsize, chunk_size) <= comp_size / ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  439|  18.3k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 2620|  18.3k|}
zxc_common.c:zxc_le64:
 1448|   695k|static ZXC_ALWAYS_INLINE uint64_t zxc_le64(const void* p) {
 1449|   695k|    uint64_t v;
 1450|   695k|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  168|   695k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1451|       |#ifdef ZXC_BIG_ENDIAN
 1452|       |    return ZXC_BSWAP64(v);
 1453|       |#else
 1454|   695k|    return v;
 1455|   695k|#endif
 1456|   695k|}
zxc_common.c:zxc_hash8:
 1524|   524k|static ZXC_ALWAYS_INLINE uint8_t zxc_hash8(const uint8_t* p) {
 1525|   524k|    const uint64_t h = (zxc_le64(p) ^ ZXC_HASH_GOLDEN64) * ZXC_HASH_GOLDEN64;
  ------------------
  |  |  797|   524k|#define ZXC_HASH_GOLDEN64 0x9E3779B97F4A7C15ULL
  ------------------
                  const uint64_t h = (zxc_le64(p) ^ ZXC_HASH_GOLDEN64) * ZXC_HASH_GOLDEN64;
  ------------------
  |  |  797|   524k|#define ZXC_HASH_GOLDEN64 0x9E3779B97F4A7C15ULL
  ------------------
 1526|       |
 1527|   524k|    return (uint8_t)(h >> 56);
 1528|   524k|}
zxc_common.c:zxc_block_header_ok:
 1537|   311k|static ZXC_ALWAYS_INLINE int zxc_block_header_ok(const uint8_t* p) {
 1538|   311k|    uint8_t temp[ZXC_BLOCK_HEADER_SIZE];
 1539|   311k|    ZXC_MEMCPY(temp, p, ZXC_BLOCK_HEADER_SIZE);
  ------------------
  |  |  168|   311k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1540|   311k|    temp[7] = 0;  // The checksum covers the header with its own byte zeroed
 1541|   311k|    return p[7] == zxc_hash8(temp) && (p[1] | p[2]) == 0;
  ------------------
  |  Branch (1541:12): [True: 311k, False: 18.4E]
  |  Branch (1541:39): [True: 311k, False: 18.4E]
  ------------------
 1542|   311k|}
zxc_common.c:zxc_seek_table_bytes:
  494|  73.4k|static ZXC_ALWAYS_INLINE uint64_t zxc_seek_table_bytes(const uint64_t nblocks) {
  495|  73.4k|    return zxc_seek_group_count(nblocks) * ZXC_SEEK_ANCHOR_SIZE + nblocks * ZXC_SEEK_SIZE_ENTRY;
  ------------------
  |  |  476|  73.4k|#define ZXC_SEEK_ANCHOR_SIZE 8U
  ------------------
                  return zxc_seek_group_count(nblocks) * ZXC_SEEK_ANCHOR_SIZE + nblocks * ZXC_SEEK_SIZE_ENTRY;
  ------------------
  |  |  478|  73.4k|#define ZXC_SEEK_SIZE_ENTRY 4U
  ------------------
  496|  73.4k|}
zxc_common.c:zxc_seek_group_count:
  483|  73.4k|static ZXC_ALWAYS_INLINE uint64_t zxc_seek_group_count(const uint64_t nblocks) {
  484|  73.4k|    return (nblocks + ZXC_SEEK_GROUP - 1) / ZXC_SEEK_GROUP;
  ------------------
  |  |  474|  73.4k|#define ZXC_SEEK_GROUP 64U
  ------------------
                  return (nblocks + ZXC_SEEK_GROUP - 1) / ZXC_SEEK_GROUP;
  ------------------
  |  |  474|  73.4k|#define ZXC_SEEK_GROUP 64U
  ------------------
  485|  73.4k|}
zxc_common.c:zxc_seek_size_field:
  500|  24.4k|static ZXC_ALWAYS_INLINE uint32_t zxc_seek_size_field(const uint64_t table_bytes) {
  501|       |#if defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM64) || defined(_M_ARM64EC))
  502|       |    // MSVC 19.51 ARM64 /O2 sees the table size as 4U and compiles this fold into
  503|       |    // `ror w, #30` on the low half of u, dropping the high word: tables of 4 GiB
  504|       |    // and more get a wrong field. A volatile copy hides that shape. Once per table.
  505|       |    const volatile uint64_t t = table_bytes;
  506|       |    return (uint32_t)(t ^ (t >> 32));
  507|       |#else
  508|  24.4k|    return (uint32_t)(table_bytes ^ (table_bytes >> 32));
  509|  24.4k|#endif
  510|  24.4k|}
zxc_common.c:zxc_seek_block_count:
 1700|  30.6k|                                                       const size_t block_size) {
 1701|       |    // A shift, block_size being a header power of two: no 64-bit division on 32-bit
 1702|       |    // hosts. Not (total + bs - 1) >> s, which wraps near 2^64 on a forged footer.
 1703|  30.6k|    if (UNLIKELY(!block_size)) return 0;
  ------------------
  |  |  152|  30.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 30.6k]
  |  |  ------------------
  ------------------
 1704|  30.6k|    const int s = zxc_ctz32((uint32_t)block_size);
 1705|  30.6k|    return (total_decomp >> s) + ((total_decomp & (block_size - 1)) != 0);
 1706|  30.6k|}
zxc_common.c:zxc_ctz32:
 1655|  30.6k|static ZXC_ALWAYS_INLINE int zxc_ctz32(const uint32_t x) {
 1656|  30.6k|    if (x == 0) return 32;
  ------------------
  |  Branch (1656:9): [True: 0, False: 30.6k]
  ------------------
 1657|  30.6k|#if defined(__GNUC__) || defined(__clang__)
 1658|  30.6k|    return __builtin_ctz(x);
 1659|       |#elif defined(_MSC_VER)
 1660|       |    unsigned long r;
 1661|       |    _BitScanForward(&r, x);
 1662|       |    return (int)r;
 1663|       |#else
 1664|       |    return zxc_ctz32_debruijn(x);
 1665|       |#endif
 1666|  30.6k|}
zxc_common.c:zxc_store_le64:
 1503|  37.2k|static ZXC_ALWAYS_INLINE void zxc_store_le64(void* p, const uint64_t v) {
 1504|       |#ifdef ZXC_BIG_ENDIAN
 1505|       |    const uint64_t s = ZXC_BSWAP64(v);
 1506|       |    ZXC_MEMCPY(p, &s, sizeof(s));
 1507|       |#else
 1508|  37.2k|    ZXC_MEMCPY(p, &v, sizeof(v));
  ------------------
  |  |  168|  37.2k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1509|  37.2k|#endif
 1510|  37.2k|}
zxc_common.c:zxc_footer_layout:
 2508|  18.3k|                                                               const int checksum_enabled) {
 2509|  18.3k|    zxc_footer_layout_t l;
 2510|  18.3k|    l.skip = checksum_enabled ? (size_t)ZXC_FILE_DIGEST_SIZE : 0U;
  ------------------
  |  |  133|  12.1k|#define ZXC_FILE_DIGEST_SIZE 8
  ------------------
  |  Branch (2510:14): [True: 12.1k, False: 6.23k]
  ------------------
 2511|  18.3k|    l.nd = zxc_uint_bytes(src_size);
 2512|  18.3k|    const uint64_t base = prefix + l.skip + l.nd + 1;
 2513|  18.3k|    l.nf = 1;
 2514|  32.4k|    while (zxc_uint_bytes(base + l.nf) > l.nf) l.nf++;
  ------------------
  |  Branch (2514:12): [True: 14.0k, False: 18.3k]
  ------------------
 2515|  18.3k|    l.compressed_size = base + l.nf;
 2516|  18.3k|    l.len = l.skip + l.nd + l.nf + 1;
 2517|  18.3k|    return l;
 2518|  18.3k|}
zxc_common.c:zxc_uint_bytes:
 2485|   149k|static ZXC_ALWAYS_INLINE size_t zxc_uint_bytes(const uint64_t v) {
 2486|   149k|    size_t n = 1;
 2487|   293k|    while (n < sizeof(uint64_t) && (v >> (8 * n)) != 0) n++;
  ------------------
  |  Branch (2487:12): [True: 293k, False: 0]
  |  Branch (2487:36): [True: 144k, False: 149k]
  ------------------
 2488|   149k|    return n;
 2489|   149k|}
zxc_compress.c:zxc_store_le32:
 1485|   101k|static ZXC_ALWAYS_INLINE void zxc_store_le32(void* p, const uint32_t v) {
 1486|       |#ifdef ZXC_BIG_ENDIAN
 1487|       |    const uint32_t s = ZXC_BSWAP32(v);
 1488|       |    ZXC_MEMCPY(p, &s, sizeof(s));
 1489|       |#else
 1490|   101k|    ZXC_MEMCPY(p, &v, sizeof(v));
  ------------------
  |  |  168|   101k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1491|   101k|#endif
 1492|   101k|}
zxc_compress.c:zxc_checksum:
 1732|   101k|                                               const uint64_t seed, const uint8_t hash_method) {
 1733|   101k|    (void)hash_method; /* single algorithm for now; extend when adding more */
 1734|   101k|    const uint64_t hash = rapidhash_withSeed(input, len, seed);
 1735|       |
 1736|       |    return (uint32_t)(hash ^ (hash >> (sizeof(uint32_t) * CHAR_BIT)));
 1737|   101k|}
zxc_compress.c:zxc_get_lz77_params:
 1249|   292k|static ZXC_ALWAYS_INLINE zxc_lz77_params_t zxc_get_lz77_params(const int level) {
 1250|       |    // The distance floor stops at level 5: the slow levels keep every distance.
 1251|       |    // Default match splitting at levels 3-5 only: 1-2 are PAK; favor_decode_speed
 1252|       |    // also reaches 6-7.
 1253|       |    // search_depth, sufficient_len, use_lazy, lazy_attempts, lazy_len_threshold, step_base,
 1254|       |    // step_shift, min_offset, split_max
 1255|   292k|    static const zxc_lz77_params_t table[7] = {
 1256|   292k|        {3, 16, 0, 0, 0, 4, 4, ZXC_LZ_MINDIST, 0},        // fallback
  ------------------
  |  |  745|   292k|#define ZXC_LZ_MINDIST 32
  ------------------
 1257|   292k|        {3, 16, 0, 0, 0, 4, 4, ZXC_LZ_MINDIST, 0},        // level 1
  ------------------
  |  |  745|   292k|#define ZXC_LZ_MINDIST 32
  ------------------
 1258|   292k|        {3, 18, 0, 0, 0, 3, 6, ZXC_LZ_MINDIST, 0},        // level 2
  ------------------
  |  |  745|   292k|#define ZXC_LZ_MINDIST 32
  ------------------
 1259|   292k|        {3, 16, 1, 4, 128, 1, 4, ZXC_LZ_MINDIST, 33},     // level 3
  ------------------
  |  |  745|   292k|#define ZXC_LZ_MINDIST 32
  ------------------
 1260|   292k|        {3, 18, 1, 4, 128, 1, 5, ZXC_LZ_MINDIST, 24},     // level 4
  ------------------
  |  |  745|   292k|#define ZXC_LZ_MINDIST 32
  ------------------
 1261|   292k|        {64, 256, 1, 16, 128, 1, 8, ZXC_LZ_MINDIST, 23},  // level 5
  ------------------
  |  |  745|   292k|#define ZXC_LZ_MINDIST 32
  ------------------
 1262|   292k|        {64, 256, 0, 0, 0, 1, 8, 1, 0}                    // level 6
 1263|   292k|    };
 1264|   292k|    return (level >= ZXC_LEVEL_ULTRA)
  ------------------
  |  Branch (1264:12): [True: 136k, False: 156k]
  ------------------
 1265|   292k|               ? (zxc_lz77_params_t){128, 256, 0, 0, 0, 1, 8, 1, 0}
 1266|   292k|               : table[level < ZXC_LEVEL_FASTEST ? ZXC_LEVEL_FASTEST : level];
  ------------------
  |  Branch (1266:24): [True: 0, False: 156k]
  ------------------
 1267|   292k|}
zxc_compress.c:zxc_block_is_short_dist_bound:
 1408|  73.1k|                                                           const size_t size) {
 1409|  73.1k|    const size_t d_max = ZXC_LZ_MINDIST;
  ------------------
  |  |  745|  73.1k|#define ZXC_LZ_MINDIST 32
  ------------------
 1410|       |    // Too small to sample, and too small to gain: keep every distance.
 1411|  73.1k|    if (size < d_max + sizeof(uint32_t)) return 1;
  ------------------
  |  Branch (1411:9): [True: 753, False: 72.3k]
  ------------------
 1412|       |
 1413|  72.3k|    size_t want = size / ZXC_LZ_MINDIST_PROBE_PER_KB;
  ------------------
  |  |  752|  72.3k|#define ZXC_LZ_MINDIST_PROBE_PER_KB 1024
  ------------------
 1414|  72.3k|    if (want < ZXC_LZ_MINDIST_PROBE_MIN) want = ZXC_LZ_MINDIST_PROBE_MIN;
  ------------------
  |  |  753|  72.3k|#define ZXC_LZ_MINDIST_PROBE_MIN 16
  ------------------
                  if (want < ZXC_LZ_MINDIST_PROBE_MIN) want = ZXC_LZ_MINDIST_PROBE_MIN;
  ------------------
  |  |  753|  65.1k|#define ZXC_LZ_MINDIST_PROBE_MIN 16
  ------------------
  |  Branch (1414:9): [True: 65.1k, False: 7.24k]
  ------------------
 1415|  72.3k|    if (want > ZXC_LZ_MINDIST_PROBE_MAX) want = ZXC_LZ_MINDIST_PROBE_MAX;
  ------------------
  |  |  754|  72.3k|#define ZXC_LZ_MINDIST_PROBE_MAX 64
  ------------------
                  if (want > ZXC_LZ_MINDIST_PROBE_MAX) want = ZXC_LZ_MINDIST_PROBE_MAX;
  ------------------
  |  |  754|      0|#define ZXC_LZ_MINDIST_PROBE_MAX 64
  ------------------
  |  Branch (1415:9): [True: 0, False: 72.3k]
  ------------------
 1416|  72.3k|    size_t stride = size / want;
 1417|  72.3k|    if (stride < d_max) stride = d_max;
  ------------------
  |  Branch (1417:9): [True: 3.48k, False: 68.8k]
  ------------------
 1418|       |
 1419|  72.3k|    const size_t planned = (size - sizeof(uint32_t) - d_max) / stride + 1;
 1420|  72.3k|    const size_t bar = (size_t)ZXC_LZ_MINDIST_MAX_SHORT_PCT * planned;
  ------------------
  |  |  762|  72.3k|#define ZXC_LZ_MINDIST_MAX_SHORT_PCT 20
  ------------------
 1421|       |
 1422|  72.3k|    size_t samples = 0;
 1423|  72.3k|    size_t hits = 0;
 1424|   775k|    for (size_t i = d_max; i + sizeof(uint32_t) <= size; i += stride) {
  ------------------
  |  Branch (1424:28): [True: 774k, False: 188]
  ------------------
 1425|   774k|        const uint32_t cur = zxc_le32(blk + i);
 1426|   774k|        samples++;
 1427|  17.7M|        for (size_t d = 1; d < d_max; d++) {
  ------------------
  |  Branch (1427:28): [True: 17.1M, False: 521k]
  ------------------
 1428|  17.1M|            if (zxc_le32(blk + i - d) == cur) {
  ------------------
  |  Branch (1428:17): [True: 253k, False: 16.9M]
  ------------------
 1429|   253k|                hits++;
 1430|   253k|                break;
 1431|   253k|            }
 1432|  17.1M|        }
 1433|   774k|        if (hits * 100U > bar) return 1;                           // can only rise
  ------------------
  |  Branch (1433:13): [True: 49.4k, False: 725k]
  ------------------
 1434|   725k|        if ((hits + (planned - samples)) * 100U <= bar) return 0;  // out of reach
  ------------------
  |  Branch (1434:13): [True: 22.7k, False: 702k]
  ------------------
 1435|   725k|    }
 1436|    188|    return hits * 100U > bar;
 1437|  72.3k|}
zxc_compress.c:zxc_le32:
 1385|  8.96G|static ZXC_ALWAYS_INLINE uint32_t zxc_le32(const void* p) {
 1386|  8.96G|    uint32_t v;
 1387|  8.96G|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  168|  8.96G|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1388|       |#ifdef ZXC_BIG_ENDIAN
 1389|       |    return ZXC_BSWAP32(v);
 1390|       |#else
 1391|  8.96G|    return v;
 1392|  8.96G|#endif
 1393|  8.96G|}
zxc_compress.c:zxc_le64:
 1448|  2.26G|static ZXC_ALWAYS_INLINE uint64_t zxc_le64(const void* p) {
 1449|  2.26G|    uint64_t v;
 1450|  2.26G|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  168|  2.26G|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1451|       |#ifdef ZXC_BIG_ENDIAN
 1452|       |    return ZXC_BSWAP64(v);
 1453|       |#else
 1454|  2.26G|    return v;
 1455|  2.26G|#endif
 1456|  2.26G|}
zxc_compress.c:zxc_ctz64:
 1677|   379M|static ZXC_ALWAYS_INLINE int zxc_ctz64(const uint64_t x) {
 1678|   379M|    if (x == 0) return 64;
  ------------------
  |  Branch (1678:9): [True: 0, False: 379M]
  ------------------
 1679|   379M|#if defined(__GNUC__) || defined(__clang__)
 1680|   379M|    return __builtin_ctzll(x);
 1681|       |#elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64))
 1682|       |    unsigned long r;
 1683|       |    _BitScanForward64(&r, x);
 1684|       |    return (int)r;
 1685|       |#elif defined(_MSC_VER)
 1686|       |    // Use two 32-bit scans to avoid fragile 64-bit De Bruijn multiplication.
 1687|       |    unsigned long r;
 1688|       |    const uint32_t lo = (uint32_t)x;
 1689|       |    if (_BitScanForward(&r, lo)) return (int)r;
 1690|       |    _BitScanForward(&r, (uint32_t)(x >> 32));
 1691|       |    return 32 + (int)r;
 1692|       |#else
 1693|       |    return zxc_ctz64_debruijn(x);
 1694|       |#endif
 1695|   379M|}
zxc_compress.c:zxc_ctz32:
 1655|  8.73M|static ZXC_ALWAYS_INLINE int zxc_ctz32(const uint32_t x) {
 1656|  8.73M|    if (x == 0) return 32;
  ------------------
  |  Branch (1656:9): [True: 0, False: 8.73M]
  ------------------
 1657|  8.73M|#if defined(__GNUC__) || defined(__clang__)
 1658|  8.73M|    return __builtin_ctz(x);
 1659|       |#elif defined(_MSC_VER)
 1660|       |    unsigned long r;
 1661|       |    _BitScanForward(&r, x);
 1662|       |    return (int)r;
 1663|       |#else
 1664|       |    return zxc_ctz32_debruijn(x);
 1665|       |#endif
 1666|  8.73M|}
zxc_compress.c:zxc_copy32:
 1602|  3.24M|static ZXC_ALWAYS_INLINE void zxc_copy32(void* dst, const void* src) {
 1603|       |#if defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512)
 1604|       |    // AVX2/AVX512: Single 256-bit (32 byte) unaligned load/store
 1605|       |    _mm256_storeu_si256((__m256i*)dst, _mm256_loadu_si256((const __m256i*)src));
 1606|       |#elif defined(ZXC_USE_SSE2)
 1607|       |    const __m128i a = _mm_loadu_si128((const __m128i*)src);
 1608|  3.24M|    const __m128i b = _mm_loadu_si128((const __m128i*)((const uint8_t*)src + 16));
 1609|  3.24M|    _mm_storeu_si128((__m128i*)dst, a);
 1610|  3.24M|    _mm_storeu_si128((__m128i*)((uint8_t*)dst + 16), b);
 1611|       |#elif defined(ZXC_USE_NEON64) || defined(ZXC_USE_NEON32)
 1612|       |    const uint8x16_t a = vld1q_u8((const uint8_t*)src);
 1613|       |    const uint8x16_t b = vld1q_u8((const uint8_t*)src + 16);
 1614|       |    vst1q_u8((uint8_t*)dst, a);
 1615|       |    vst1q_u8((uint8_t*)dst + 16, b);
 1616|       |#elif defined(__riscv_misaligned_fast) && !defined(__riscv_vector)
 1617|       |    uint8_t a[16], b[16];
 1618|       |    ZXC_MEMCPY(a, src, 16);
 1619|       |    ZXC_MEMCPY(b, (const uint8_t*)src + 16, 16);
 1620|       |    ZXC_MEMCPY(dst, a, 16);
 1621|       |    ZXC_MEMCPY((uint8_t*)dst + 16, b, 16);
 1622|       |#else
 1623|       |    ZXC_MEMCPY(dst, src, 32);
 1624|       |#endif
 1625|  3.24M|}
zxc_compress.c:zxc_opt_dp_sizes:
 1129|  73.3k|                                               size_t* RESTRICT sz_bm) {
 1130|  73.3k|    *sz_dp = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint32_t));
  ------------------
  |  |  384|  73.3k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  73.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  73.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  73.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  73.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1131|  73.3k|    *sz_pl = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint16_t));
  ------------------
  |  |  384|  73.3k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  73.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  73.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  73.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  73.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1132|  73.3k|    *sz_po = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint16_t));
  ------------------
  |  |  384|  73.3k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  73.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  73.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  73.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  73.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1133|  73.3k|    *sz_bm = ZXC_ALIGN_CL(ZXC_BITMAP_WORDS(chunk_size + 1) * sizeof(uint64_t));
  ------------------
  |  |  384|  73.3k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  73.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  73.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  73.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  73.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1134|  73.3k|}
zxc_compress.c:zxc_read_varint:
  630|  5.48M|static ZXC_ALWAYS_INLINE uint32_t zxc_read_varint(const uint8_t** ptr, const uint8_t* end) {
  631|  5.48M|    const uint8_t* p = *ptr;
  632|  5.48M|    if (UNLIKELY(p >= end)) return ZXC_VARINT_INVALID;
  ------------------
  |  |  152|  5.48M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 5.48M]
  |  |  ------------------
  ------------------
                  if (UNLIKELY(p >= end)) return ZXC_VARINT_INVALID;
  ------------------
  |  |  597|      0|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|      0|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|      0|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  633|       |
  634|  5.48M|    const uint32_t b0 = p[0];
  635|       |
  636|       |    // 1 Byte: 0xxxxxxx (7 bits) -> val < 128 (2^7)
  637|  5.48M|    if (LIKELY(b0 < 0x80)) {
  ------------------
  |  |  146|  5.48M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 4.66M, False: 821k]
  |  |  ------------------
  ------------------
  638|  4.66M|        *ptr = p + 1;
  639|  4.66M|        return b0;
  640|  4.66M|    }
  641|       |
  642|       |    // 2 Bytes: 10xxxxxx xxxxxxxx (14 bits) -> val < 16384 (2^14)
  643|   821k|    if (LIKELY(b0 < 0xC0)) {
  ------------------
  |  |  146|   821k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 805k, False: 15.8k]
  |  |  ------------------
  ------------------
  644|   805k|        if (UNLIKELY(p + 1 >= end)) {
  ------------------
  |  |  152|   805k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 805k]
  |  |  ------------------
  ------------------
  645|      0|            *ptr = end;
  646|      0|            return ZXC_VARINT_INVALID;
  ------------------
  |  |  597|      0|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|      0|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|      0|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  647|      0|        }
  648|   805k|        *ptr = p + 2;
  649|   805k|        return (b0 & 0x3F) | ((uint32_t)p[1] << 6);
  650|   805k|    }
  651|       |
  652|       |    // 3 Bytes: 110xxxxx xxxxxxxx xxxxxxxx (21 bits) -> val < 2^21. The longest
  653|       |    // a legitimate varint can be: values are (ll - MASK) or (ml - MASK), always
  654|       |    // strictly below block_size_max = 2^21.
  655|  16.1k|    if (LIKELY(b0 < 0xE0)) {
  ------------------
  |  |  146|  15.8k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 16.1k, False: 18.4E]
  |  |  ------------------
  ------------------
  656|  16.1k|        if (UNLIKELY(p + 2 >= end)) {
  ------------------
  |  |  152|  16.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 16.1k]
  |  |  ------------------
  ------------------
  657|      0|            *ptr = end;
  658|      0|            return ZXC_VARINT_INVALID;
  ------------------
  |  |  597|      0|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|      0|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|      0|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  659|      0|        }
  660|  16.1k|        *ptr = p + 3;
  661|  16.1k|        return (b0 & 0x1F) | ((uint32_t)p[1] << 5) | ((uint32_t)p[2] << 13);
  662|  16.1k|    }
  663|       |
  664|       |    // extra encoding: out-of-spec for the current format, reject.
  665|  18.4E|    *ptr = end;
  666|  18.4E|    return ZXC_VARINT_INVALID;
  ------------------
  |  |  597|  18.4E|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|  18.4E|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|  18.4E|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  667|  15.8k|}
zxc_compress.c:zxc_ss_prem_rle_q8:
  965|   105k|static inline int zxc_ss_prem_rle_q8(const int level) {
  966|   105k|    return (level >= ZXC_LEVEL_DENSITY) ? 1 : (256 >> ZXC_RLE_MARGIN_SHIFT);
  ------------------
  |  |  892|  32.7k|#define ZXC_RLE_MARGIN_SHIFT 5
  ------------------
  |  Branch (966:12): [True: 72.4k, False: 32.7k]
  ------------------
  967|   105k|}
zxc_compress.c:zxc_huf_enc_max_code_len:
 1051|   236k|static inline int zxc_huf_enc_max_code_len(const int level) {
 1052|   236k|    return (level >= ZXC_LEVEL_ULTRA) ? ZXC_HUF_MAX_CODE_LEN_ULTRA : ZXC_HUF_MAX_CODE_LEN_DENSITY;
  ------------------
  |  |  826|   229k|#define ZXC_HUF_MAX_CODE_LEN_ULTRA 11
  ------------------
                  return (level >= ZXC_LEVEL_ULTRA) ? ZXC_HUF_MAX_CODE_LEN_ULTRA : ZXC_HUF_MAX_CODE_LEN_DENSITY;
  ------------------
  |  |  831|  6.37k|#define ZXC_HUF_MAX_CODE_LEN_DENSITY 8
  ------------------
  |  Branch (1052:12): [True: 229k, False: 6.37k]
  ------------------
 1053|   236k|}
zxc_compress.c:zxc_ss_prem_huf_q8:
  984|   118k|static inline int zxc_ss_prem_huf_q8(const int level) {
  985|   118k|    return (level >= ZXC_LEVEL_DENSITY) ? 4 : (256 >> ZXC_HUF_MARGIN_SHIFT);
  ------------------
  |  |  896|      0|#define ZXC_HUF_MARGIN_SHIFT 5
  ------------------
  |  Branch (985:12): [True: 118k, False: 0]
  ------------------
  986|   118k|}
zxc_decompress.c:zxc_block_header_ok:
 1537|   146k|static ZXC_ALWAYS_INLINE int zxc_block_header_ok(const uint8_t* p) {
 1538|   146k|    uint8_t temp[ZXC_BLOCK_HEADER_SIZE];
 1539|   146k|    ZXC_MEMCPY(temp, p, ZXC_BLOCK_HEADER_SIZE);
  ------------------
  |  |  168|   146k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1540|   146k|    temp[7] = 0;  // The checksum covers the header with its own byte zeroed
 1541|   146k|    return p[7] == zxc_hash8(temp) && (p[1] | p[2]) == 0;
  ------------------
  |  Branch (1541:12): [True: 146k, False: 28]
  |  Branch (1541:39): [True: 146k, False: 2]
  ------------------
 1542|   146k|}
zxc_decompress.c:zxc_hash8:
 1524|   146k|static ZXC_ALWAYS_INLINE uint8_t zxc_hash8(const uint8_t* p) {
 1525|   146k|    const uint64_t h = (zxc_le64(p) ^ ZXC_HASH_GOLDEN64) * ZXC_HASH_GOLDEN64;
  ------------------
  |  |  797|   146k|#define ZXC_HASH_GOLDEN64 0x9E3779B97F4A7C15ULL
  ------------------
                  const uint64_t h = (zxc_le64(p) ^ ZXC_HASH_GOLDEN64) * ZXC_HASH_GOLDEN64;
  ------------------
  |  |  797|   146k|#define ZXC_HASH_GOLDEN64 0x9E3779B97F4A7C15ULL
  ------------------
 1526|       |
 1527|   146k|    return (uint8_t)(h >> 56);
 1528|   146k|}
zxc_decompress.c:zxc_le64:
 1448|  3.49M|static ZXC_ALWAYS_INLINE uint64_t zxc_le64(const void* p) {
 1449|  3.49M|    uint64_t v;
 1450|  3.49M|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  168|  3.49M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1451|       |#ifdef ZXC_BIG_ENDIAN
 1452|       |    return ZXC_BSWAP64(v);
 1453|       |#else
 1454|  3.49M|    return v;
 1455|  3.49M|#endif
 1456|  3.49M|}
zxc_decompress.c:zxc_le32:
 1385|  7.69M|static ZXC_ALWAYS_INLINE uint32_t zxc_le32(const void* p) {
 1386|  7.69M|    uint32_t v;
 1387|  7.69M|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  168|  7.69M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1388|       |#ifdef ZXC_BIG_ENDIAN
 1389|       |    return ZXC_BSWAP32(v);
 1390|       |#else
 1391|  7.69M|    return v;
 1392|  7.69M|#endif
 1393|  7.69M|}
zxc_decompress.c:zxc_copy32:
 1602|  34.1M|static ZXC_ALWAYS_INLINE void zxc_copy32(void* dst, const void* src) {
 1603|       |#if defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512)
 1604|       |    // AVX2/AVX512: Single 256-bit (32 byte) unaligned load/store
 1605|       |    _mm256_storeu_si256((__m256i*)dst, _mm256_loadu_si256((const __m256i*)src));
 1606|       |#elif defined(ZXC_USE_SSE2)
 1607|       |    const __m128i a = _mm_loadu_si128((const __m128i*)src);
 1608|  34.1M|    const __m128i b = _mm_loadu_si128((const __m128i*)((const uint8_t*)src + 16));
 1609|  34.1M|    _mm_storeu_si128((__m128i*)dst, a);
 1610|  34.1M|    _mm_storeu_si128((__m128i*)((uint8_t*)dst + 16), b);
 1611|       |#elif defined(ZXC_USE_NEON64) || defined(ZXC_USE_NEON32)
 1612|       |    const uint8x16_t a = vld1q_u8((const uint8_t*)src);
 1613|       |    const uint8x16_t b = vld1q_u8((const uint8_t*)src + 16);
 1614|       |    vst1q_u8((uint8_t*)dst, a);
 1615|       |    vst1q_u8((uint8_t*)dst + 16, b);
 1616|       |#elif defined(__riscv_misaligned_fast) && !defined(__riscv_vector)
 1617|       |    uint8_t a[16], b[16];
 1618|       |    ZXC_MEMCPY(a, src, 16);
 1619|       |    ZXC_MEMCPY(b, (const uint8_t*)src + 16, 16);
 1620|       |    ZXC_MEMCPY(dst, a, 16);
 1621|       |    ZXC_MEMCPY((uint8_t*)dst + 16, b, 16);
 1622|       |#else
 1623|       |    ZXC_MEMCPY(dst, src, 32);
 1624|       |#endif
 1625|  34.1M|}
zxc_decompress.c:zxc_read_varint:
  630|  2.77M|static ZXC_ALWAYS_INLINE uint32_t zxc_read_varint(const uint8_t** ptr, const uint8_t* end) {
  631|  2.77M|    const uint8_t* p = *ptr;
  632|  2.77M|    if (UNLIKELY(p >= end)) return ZXC_VARINT_INVALID;
  ------------------
  |  |  152|  2.77M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 2.77M]
  |  |  ------------------
  ------------------
                  if (UNLIKELY(p >= end)) return ZXC_VARINT_INVALID;
  ------------------
  |  |  597|      0|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|      0|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|      0|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  633|       |
  634|  2.77M|    const uint32_t b0 = p[0];
  635|       |
  636|       |    // 1 Byte: 0xxxxxxx (7 bits) -> val < 128 (2^7)
  637|  2.77M|    if (LIKELY(b0 < 0x80)) {
  ------------------
  |  |  146|  2.77M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 2.18M, False: 592k]
  |  |  ------------------
  ------------------
  638|  2.18M|        *ptr = p + 1;
  639|  2.18M|        return b0;
  640|  2.18M|    }
  641|       |
  642|       |    // 2 Bytes: 10xxxxxx xxxxxxxx (14 bits) -> val < 16384 (2^14)
  643|   592k|    if (LIKELY(b0 < 0xC0)) {
  ------------------
  |  |  146|   592k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 592k, False: 18.4E]
  |  |  ------------------
  ------------------
  644|   592k|        if (UNLIKELY(p + 1 >= end)) {
  ------------------
  |  |  152|   592k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 592k]
  |  |  ------------------
  ------------------
  645|      0|            *ptr = end;
  646|      0|            return ZXC_VARINT_INVALID;
  ------------------
  |  |  597|      0|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|      0|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|      0|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  647|      0|        }
  648|   592k|        *ptr = p + 2;
  649|   592k|        return (b0 & 0x3F) | ((uint32_t)p[1] << 6);
  650|   592k|    }
  651|       |
  652|       |    // 3 Bytes: 110xxxxx xxxxxxxx xxxxxxxx (21 bits) -> val < 2^21. The longest
  653|       |    // a legitimate varint can be: values are (ll - MASK) or (ml - MASK), always
  654|       |    // strictly below block_size_max = 2^21.
  655|  18.4E|    if (LIKELY(b0 < 0xE0)) {
  ------------------
  |  |  146|  18.4E|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 13.8k, False: 18.4E]
  |  |  ------------------
  ------------------
  656|  13.8k|        if (UNLIKELY(p + 2 >= end)) {
  ------------------
  |  |  152|  13.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 13.8k]
  |  |  ------------------
  ------------------
  657|      0|            *ptr = end;
  658|      0|            return ZXC_VARINT_INVALID;
  ------------------
  |  |  597|      0|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|      0|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|      0|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  659|      0|        }
  660|  13.8k|        *ptr = p + 3;
  661|  13.8k|        return (b0 & 0x1F) | ((uint32_t)p[1] << 5) | ((uint32_t)p[2] << 13);
  662|  13.8k|    }
  663|       |
  664|       |    // extra encoding: out-of-spec for the current format, reject.
  665|  18.4E|    *ptr = end;
  666|  18.4E|    return ZXC_VARINT_INVALID;
  ------------------
  |  |  597|  18.4E|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|  18.4E|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|  18.4E|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  667|  18.4E|}
zxc_decompress.c:zxc_copy16:
 1582|  19.6M|static ZXC_ALWAYS_INLINE void zxc_copy16(void* dst, const void* src) {
 1583|  19.6M|#if defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512) || defined(ZXC_USE_SSE2)
 1584|       |    // x86 SSE2/AVX2/AVX512: Single 128-bit unaligned load/store
 1585|  19.6M|    _mm_storeu_si128((__m128i*)dst, _mm_loadu_si128((const __m128i*)src));
 1586|       |#elif defined(ZXC_USE_NEON64) || defined(ZXC_USE_NEON32)
 1587|       |    vst1q_u8((uint8_t*)dst, vld1q_u8((const uint8_t*)src));
 1588|       |#else
 1589|       |    ZXC_MEMCPY(dst, src, 16);
 1590|       |#endif
 1591|  19.6M|}
zxc_decompress.c:zxc_le16:
 1366|  1.98M|static ZXC_ALWAYS_INLINE uint16_t zxc_le16(const void* p) {
 1367|  1.98M|    uint16_t v;
 1368|  1.98M|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  168|  1.98M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1369|       |#ifdef ZXC_BIG_ENDIAN
 1370|       |    return ZXC_BSWAP16(v);
 1371|       |#else
 1372|  1.98M|    return v;
 1373|  1.98M|#endif
 1374|  1.98M|}
zxc_decompress.c:zxc_checksum:
 1732|   101k|                                               const uint64_t seed, const uint8_t hash_method) {
 1733|   101k|    (void)hash_method; /* single algorithm for now; extend when adding more */
 1734|   101k|    const uint64_t hash = rapidhash_withSeed(input, len, seed);
 1735|       |
 1736|       |    return (uint32_t)(hash ^ (hash >> (sizeof(uint32_t) * CHAR_BIT)));
 1737|   101k|}
zxc_dict.c:zxc_checksum:
 1732|  19.4k|                                               const uint64_t seed, const uint8_t hash_method) {
 1733|  19.4k|    (void)hash_method; /* single algorithm for now; extend when adding more */
 1734|  19.4k|    const uint64_t hash = rapidhash_withSeed(input, len, seed);
 1735|       |
 1736|       |    return (uint32_t)(hash ^ (hash >> (sizeof(uint32_t) * CHAR_BIT)));
 1737|  19.4k|}
zxc_dispatch.c:zxc_validate_block_size:
 1178|  18.3k|static ZXC_ALWAYS_INLINE int zxc_validate_block_size(const size_t bs) {
 1179|  18.3k|    return bs >= ZXC_BLOCK_SIZE_MIN && bs <= ZXC_BLOCK_SIZE_MAX && (bs & (bs - 1)) == 0;
  ------------------
  |  |   73|  36.7k|#define ZXC_BLOCK_SIZE_MIN (1U << ZXC_BLOCK_SIZE_MIN_LOG2)
  |  |  ------------------
  |  |  |  |   67|  18.3k|#define ZXC_BLOCK_SIZE_MIN_LOG2 12
  |  |  ------------------
  ------------------
                  return bs >= ZXC_BLOCK_SIZE_MIN && bs <= ZXC_BLOCK_SIZE_MAX && (bs & (bs - 1)) == 0;
  ------------------
  |  |   75|  36.7k|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  ------------------
  |  |  |  |   69|  18.3k|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  ------------------
  ------------------
  |  Branch (1179:12): [True: 18.3k, False: 0]
  |  Branch (1179:40): [True: 18.3k, False: 0]
  |  Branch (1179:68): [True: 18.3k, False: 0]
  ------------------
 1180|  18.3k|}
zxc_driver.c:zxc_block_size_ceil:
 1159|  17.1k|static ZXC_ALWAYS_INLINE size_t zxc_block_size_ceil(const size_t v) {
 1160|  17.1k|    uint64_t x = (uint64_t)v - 1;
 1161|  17.1k|    x |= x >> 1;
 1162|  17.1k|    x |= x >> 2;
 1163|  17.1k|    x |= x >> 4;
 1164|  17.1k|    x |= x >> 8;
 1165|  17.1k|    x |= x >> 16;
 1166|  17.1k|    x |= x >> 32;
 1167|  17.1k|    x++;
 1168|  17.1k|    const size_t bs = (size_t)x;
 1169|  17.1k|    return (bs < ZXC_BLOCK_SIZE_MIN) ? ZXC_BLOCK_SIZE_MIN : bs;
  ------------------
  |  |   73|  17.1k|#define ZXC_BLOCK_SIZE_MIN (1U << ZXC_BLOCK_SIZE_MIN_LOG2)
  |  |  ------------------
  |  |  |  |   67|  17.1k|#define ZXC_BLOCK_SIZE_MIN_LOG2 12
  |  |  ------------------
  ------------------
                  return (bs < ZXC_BLOCK_SIZE_MIN) ? ZXC_BLOCK_SIZE_MIN : bs;
  ------------------
  |  |   73|      0|#define ZXC_BLOCK_SIZE_MIN (1U << ZXC_BLOCK_SIZE_MIN_LOG2)
  |  |  ------------------
  |  |  |  |   67|      0|#define ZXC_BLOCK_SIZE_MIN_LOG2 12
  |  |  ------------------
  ------------------
  |  Branch (1169:12): [True: 0, False: 17.1k]
  ------------------
 1170|  17.1k|}
zxc_driver.c:zxc_digest_combine:
 1752|   203k|                                                     const uint32_t block_checksum) {
 1753|   203k|    const uint64_t a = acc ^ ((uint64_t)block_checksum + 1U) * ZXC_HASH_GOLDEN64;
  ------------------
  |  |  797|   203k|#define ZXC_HASH_GOLDEN64 0x9E3779B97F4A7C15ULL
  ------------------
 1754|   203k|    const uint64_t b = ZXC_HASH_XORSHIFT64;
  ------------------
  |  |  799|   203k|#define ZXC_HASH_XORSHIFT64 0x2545F4914F6CDD1DULL
  ------------------
 1755|   203k|#if defined(__SIZEOF_INT128__)
 1756|   203k|    const __uint128_t r = (__uint128_t)a * b;
 1757|   203k|    return (uint64_t)r ^ (uint64_t)(r >> 64);
 1758|       |#else
 1759|       |    const uint64_t alo = (uint32_t)a, ahi = a >> 32, blo = (uint32_t)b, bhi = b >> 32;
 1760|       |    const uint64_t lolo = alo * blo, lohi = alo * bhi, hilo = ahi * blo, hihi = ahi * bhi;
 1761|       |    const uint64_t cross = (lolo >> 32) + (uint32_t)lohi + (uint32_t)hilo;
 1762|       |    const uint64_t hi = hihi + (lohi >> 32) + (hilo >> 32) + (cross >> 32);
 1763|       |    const uint64_t lo = (cross << 32) | (uint32_t)lolo;
 1764|       |    return lo ^ hi;
 1765|       |#endif
 1766|   203k|}
zxc_driver.c:zxc_seek_group_len:
  488|  12.9k|static ZXC_ALWAYS_INLINE uint32_t zxc_seek_group_len(const uint64_t nblocks, const uint64_t g) {
  489|  12.9k|    const uint64_t left = nblocks - g * ZXC_SEEK_GROUP;
  ------------------
  |  |  474|  12.9k|#define ZXC_SEEK_GROUP 64U
  ------------------
  490|  12.9k|    return left < ZXC_SEEK_GROUP ? (uint32_t)left : ZXC_SEEK_GROUP;
  ------------------
  |  |  474|  12.9k|#define ZXC_SEEK_GROUP 64U
  ------------------
                  return left < ZXC_SEEK_GROUP ? (uint32_t)left : ZXC_SEEK_GROUP;
  ------------------
  |  |  474|    877|#define ZXC_SEEK_GROUP 64U
  ------------------
  |  Branch (490:12): [True: 12.0k, False: 877]
  ------------------
  491|  12.9k|}
zxc_driver.c:zxc_le32:
 1385|   240k|static ZXC_ALWAYS_INLINE uint32_t zxc_le32(const void* p) {
 1386|   240k|    uint32_t v;
 1387|   240k|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  168|   240k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1388|       |#ifdef ZXC_BIG_ENDIAN
 1389|       |    return ZXC_BSWAP32(v);
 1390|       |#else
 1391|   240k|    return v;
 1392|   240k|#endif
 1393|   240k|}
zxc_driver.c:zxc_footer_layout:
 2508|  18.3k|                                                               const int checksum_enabled) {
 2509|  18.3k|    zxc_footer_layout_t l;
 2510|  18.3k|    l.skip = checksum_enabled ? (size_t)ZXC_FILE_DIGEST_SIZE : 0U;
  ------------------
  |  |  133|  12.1k|#define ZXC_FILE_DIGEST_SIZE 8
  ------------------
  |  Branch (2510:14): [True: 12.1k, False: 6.23k]
  ------------------
 2511|  18.3k|    l.nd = zxc_uint_bytes(src_size);
 2512|  18.3k|    const uint64_t base = prefix + l.skip + l.nd + 1;
 2513|  18.3k|    l.nf = 1;
 2514|  32.4k|    while (zxc_uint_bytes(base + l.nf) > l.nf) l.nf++;
  ------------------
  |  Branch (2514:12): [True: 14.0k, False: 18.3k]
  ------------------
 2515|  18.3k|    l.compressed_size = base + l.nf;
 2516|  18.3k|    l.len = l.skip + l.nd + l.nf + 1;
 2517|  18.3k|    return l;
 2518|  18.3k|}
zxc_driver.c:zxc_uint_bytes:
 2485|  50.8k|static ZXC_ALWAYS_INLINE size_t zxc_uint_bytes(const uint64_t v) {
 2486|  50.8k|    size_t n = 1;
 2487|   100k|    while (n < sizeof(uint64_t) && (v >> (8 * n)) != 0) n++;
  ------------------
  |  Branch (2487:12): [True: 100k, False: 0]
  |  Branch (2487:36): [True: 49.9k, False: 50.8k]
  ------------------
 2488|  50.8k|    return n;
 2489|  50.8k|}
zxc_huffman.c:zxc_log2_u32:
 1145|  5.00G|static ZXC_ALWAYS_INLINE uint32_t zxc_log2_u32(const uint32_t v) {
 1146|       |#ifdef _MSC_VER
 1147|       |    unsigned long index;
 1148|       |    return (v == 0) ? 0 : (_BitScanReverse(&index, v) ? index : 0);
 1149|       |#else
 1150|  5.00G|    return (v == 0) ? 0 : (uint32_t)(31 - __builtin_clz(v));
  ------------------
  |  Branch (1150:12): [True: 0, False: 5.00G]
  ------------------
 1151|  5.00G|#endif
 1152|  5.00G|}

LLVMFuzzerTestOneInput:
   95|  18.4k|int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   96|  18.4k|    if (size < 4) return 0;
  ------------------
  |  Branch (96:9): [True: 2, False: 18.4k]
  ------------------
   97|       |
   98|  18.4k|    const int level = (int)(data[0] % (unsigned)zxc_max_level()) + 1;
   99|  18.4k|    const int checksum = data[1] & 1;
  100|  18.4k|    const int seekable = (data[1] >> 1) & 1;
  101|  18.4k|    const int use_dict = (data[1] >> 2) & 1;
  102|  18.4k|    const int n_threads = ((data[1] >> 3) & 1) + 1;
  103|  18.4k|    const zxc_progress_callback_t cb = ((data[1] >> 4) & 1) ? on_progress : NULL;
  ------------------
  |  Branch (103:40): [True: 9.54k, False: 8.90k]
  ------------------
  104|  18.4k|    const size_t block_size = kBlockSizes[(data[1] >> 5) & 3];
  105|  18.4k|    const size_t tiles = (size_t)(data[2] & 7) + 1;
  106|  18.4k|    const int favor_decode_speed = (data[2] >> 3) & 1;
  107|  18.4k|    const int split_budget_pct =
  108|  18.4k|        1 + (data[2] >> 4) * (ZXC_FAVOR_DECODE_SPEED_MAX - 1) / 15; /* 1..100 */
  ------------------
  |  |   82|  18.4k|#define ZXC_FAVOR_DECODE_SPEED_MAX 100
  ------------------
  109|  18.4k|    const size_t dict_cap = ((size_t)data[3] + 1) * 256;
  110|       |
  111|  18.4k|    fuzz_raw(data, size, n_threads, checksum);
  112|       |
  113|  18.4k|    data += 4;
  114|  18.4k|    size -= 4;
  115|  18.4k|    if (size == 0 || size > FUZZ_STREAM_MAX_INPUT) return 0;
  ------------------
  |  |   36|  18.4k|#define FUZZ_STREAM_MAX_INPUT (256 << 10) /* 256 KiB, before tiling */
  ------------------
  |  Branch (115:9): [True: 52, False: 18.4k]
  |  Branch (115:22): [True: 7, False: 18.3k]
  ------------------
  116|       |
  117|  18.3k|    size_t dict_size = use_dict ? dict_cap : 0;
  ------------------
  |  Branch (117:24): [True: 9.72k, False: 8.67k]
  ------------------
  118|  18.3k|    if (dict_size > size) dict_size = size;
  ------------------
  |  Branch (118:9): [True: 5.30k, False: 13.0k]
  ------------------
  119|  18.3k|    if (dict_size > ZXC_DICT_SIZE_MAX) dict_size = ZXC_DICT_SIZE_MAX;
  ------------------
  |  |   94|  18.3k|#define ZXC_DICT_SIZE_MAX ((1U << 16) - 1U)
  ------------------
                  if (dict_size > ZXC_DICT_SIZE_MAX) dict_size = ZXC_DICT_SIZE_MAX;
  ------------------
  |  |   94|    175|#define ZXC_DICT_SIZE_MAX ((1U << 16) - 1U)
  ------------------
  |  Branch (119:9): [True: 175, False: 18.2k]
  ------------------
  120|       |
  121|  18.3k|    const size_t total = size * tiles;
  122|  18.3k|    uint8_t* const plain = (uint8_t*)malloc(total);
  123|  18.3k|    if (!plain) return 0;
  ------------------
  |  Branch (123:9): [True: 0, False: 18.3k]
  ------------------
  124|   147k|    for (size_t t = 0; t < tiles; t++) {
  ------------------
  |  Branch (124:24): [True: 129k, False: 18.3k]
  ------------------
  125|   129k|        memcpy(plain + t * size, data, size);
  126|   129k|        plain[t * size] ^= (uint8_t)t; /* distinct blocks */
  127|   129k|    }
  128|       |
  129|  18.3k|    const void* const dict = dict_size ? data : NULL;
  ------------------
  |  Branch (129:30): [True: 9.72k, False: 8.67k]
  ------------------
  130|  18.3k|    zxc_cctx* const co = zxc_create_cctx();
  131|  18.3k|    zxc_dctx* const dopts = zxc_create_dctx();
  132|  18.3k|    const int configured =
  133|  18.3k|        co && dopts && zxc_cctx_set_param(co, ZXC_C_THREADS, n_threads) == ZXC_OK &&
  ------------------
  |  Branch (133:9): [True: 18.3k, False: 0]
  |  Branch (133:15): [True: 18.3k, False: 0]
  |  Branch (133:24): [True: 18.3k, False: 0]
  ------------------
  134|  18.3k|        zxc_cctx_set_param(co, ZXC_C_LEVEL, level) == ZXC_OK &&
  ------------------
  |  Branch (134:9): [True: 18.3k, False: 0]
  ------------------
  135|  18.3k|        zxc_cctx_set_param(co, ZXC_C_BLOCK_SIZE, (int64_t)block_size) == ZXC_OK &&
  ------------------
  |  Branch (135:9): [True: 18.3k, False: 0]
  ------------------
  136|  18.3k|        zxc_cctx_set_param(co, ZXC_C_CHECKSUM, checksum) == ZXC_OK &&
  ------------------
  |  Branch (136:9): [True: 18.3k, False: 0]
  ------------------
  137|  18.3k|        zxc_cctx_set_param(co, ZXC_C_SEEKABLE, seekable) == ZXC_OK &&
  ------------------
  |  Branch (137:9): [True: 18.3k, False: 0]
  ------------------
  138|  18.3k|        zxc_cctx_set_param(co, ZXC_C_FAVOR_DECODE_SPEED,
  ------------------
  |  Branch (138:9): [True: 18.3k, False: 0]
  ------------------
  139|  18.3k|                           favor_decode_speed ? split_budget_pct : 0) == ZXC_OK &&
  ------------------
  |  Branch (139:28): [True: 14.2k, False: 4.14k]
  ------------------
  140|  18.3k|        zxc_cctx_set_dict(co, dict, dict_size, NULL) == ZXC_OK &&
  ------------------
  |  Branch (140:9): [True: 18.3k, False: 0]
  ------------------
  141|  18.3k|        zxc_cctx_set_progress(co, cb, NULL) == ZXC_OK &&
  ------------------
  |  Branch (141:9): [True: 18.3k, False: 0]
  ------------------
  142|  18.3k|        zxc_dctx_set_param(dopts, ZXC_D_THREADS, n_threads) == ZXC_OK &&
  ------------------
  |  Branch (142:9): [True: 18.3k, False: 0]
  ------------------
  143|  18.3k|        zxc_dctx_set_param(dopts, ZXC_D_CHECKSUM, checksum) == ZXC_OK &&
  ------------------
  |  Branch (143:9): [True: 18.3k, False: 0]
  ------------------
  144|  18.3k|        zxc_dctx_set_dict(dopts, dict, dict_size, NULL) == ZXC_OK &&
  ------------------
  |  Branch (144:9): [True: 18.3k, False: 0]
  ------------------
  145|  18.3k|        zxc_dctx_set_progress(dopts, cb, NULL) == ZXC_OK;
  ------------------
  |  Branch (145:9): [True: 18.3k, False: 0]
  ------------------
  146|  18.3k|    if (configured) roundtrip(plain, total, co, dopts);
  ------------------
  |  Branch (146:9): [True: 18.3k, False: 0]
  ------------------
  147|  18.3k|    zxc_free_cctx(co);
  148|  18.3k|    zxc_free_dctx(dopts);
  149|       |
  150|  18.3k|    free(plain);
  151|  18.3k|    return 0;
  152|  18.3k|}
fuzz_stream.c:on_progress:
   40|   111k|static void on_progress(uint64_t done, uint64_t total, const void* user_data) {
   41|   111k|    (void)done;
   42|   111k|    (void)total;
   43|   111k|    (void)user_data;
   44|   111k|}
fuzz_stream.c:fuzz_raw:
   46|  18.4k|static void fuzz_raw(const uint8_t* src, const size_t n, const int n_threads, const int checksum) {
   47|  18.4k|    FILE* const in = fmemopen((void*)src, n, "rb");
   48|  18.4k|    if (!in) return;
  ------------------
  |  Branch (48:9): [True: 0, False: 18.4k]
  ------------------
   49|  18.4k|    (void)zxc_stream_get_decompressed_size(in); /* restores the position */
   50|  18.4k|    zxc_dctx* const cfg = zxc_create_dctx();
   51|  18.4k|    if (cfg && zxc_dctx_set_param(cfg, ZXC_D_THREADS, n_threads) == ZXC_OK &&
  ------------------
  |  Branch (51:9): [True: 18.4k, False: 0]
  |  Branch (51:16): [True: 18.4k, False: 0]
  ------------------
   52|  18.4k|        zxc_dctx_set_param(cfg, ZXC_D_CHECKSUM, checksum) == ZXC_OK) {
  ------------------
  |  Branch (52:9): [True: 18.4k, False: 0]
  ------------------
   53|       |        (void)zxc_stream_decompress(in, NULL, cfg); /* no output: a bomb costs CPU, not memory */
   54|  18.4k|    }
   55|  18.4k|    zxc_free_dctx(cfg);
   56|  18.4k|    fclose(in);
   57|  18.4k|}
fuzz_stream.c:roundtrip:
   60|  18.3k|                      const zxc_dctx* dopts) {
   61|  18.3k|    char* comp = NULL;
   62|  18.3k|    size_t comp_len = 0;
   63|  18.3k|    FILE* in = fmemopen(plain, total, "rb");
   64|  18.3k|    FILE* out = open_memstream(&comp, &comp_len);
   65|  18.3k|    const int64_t csize = (in && out) ? zxc_stream_compress(in, out, co) : -1;
  ------------------
  |  Branch (65:28): [True: 18.3k, False: 0]
  |  Branch (65:34): [True: 18.3k, False: 0]
  ------------------
   66|  18.3k|    if (in) fclose(in);
  ------------------
  |  Branch (66:9): [True: 18.3k, False: 0]
  ------------------
   67|  18.3k|    if (out) fclose(out); /* comp / comp_len are final only now */
  ------------------
  |  Branch (67:9): [True: 18.3k, False: 0]
  ------------------
   68|  18.3k|    if (csize < 0 || !comp) {
  ------------------
  |  Branch (68:9): [True: 0, False: 18.3k]
  |  Branch (68:22): [True: 0, False: 18.3k]
  ------------------
   69|      0|        free(comp);
   70|      0|        return;
   71|      0|    }
   72|  18.3k|    assert((size_t)csize == comp_len);
  ------------------
  |  Branch (72:5): [True: 0, False: 18.3k]
  |  Branch (72:5): [True: 18.3k, False: 0]
  ------------------
   73|       |
   74|  18.3k|    char* dec = NULL;
   75|  18.3k|    size_t dec_len = 0;
   76|  18.3k|    in = fmemopen(comp, comp_len, "rb");
   77|  18.3k|    out = open_memstream(&dec, &dec_len);
   78|  18.3k|    if (in && out) {
  ------------------
  |  Branch (78:9): [True: 18.3k, False: 0]
  |  Branch (78:15): [True: 18.3k, False: 0]
  ------------------
   79|  18.3k|        const int64_t reported = zxc_stream_get_decompressed_size(in);
   80|  18.3k|        const int64_t dsize = zxc_stream_decompress(in, out, dopts);
   81|  18.3k|        fclose(out);
   82|  18.3k|        out = NULL;
   83|  18.3k|        assert(reported == (int64_t)total);
  ------------------
  |  Branch (83:9): [True: 0, False: 18.3k]
  |  Branch (83:9): [True: 18.3k, False: 0]
  ------------------
   84|  18.3k|        assert(dsize == (int64_t)total);
  ------------------
  |  Branch (84:9): [True: 0, False: 18.3k]
  |  Branch (84:9): [True: 18.3k, False: 0]
  ------------------
   85|  18.3k|        assert(dec_len == total && memcmp(dec, plain, total) == 0);
  ------------------
  |  Branch (85:9): [True: 0, False: 18.3k]
  |  Branch (85:9): [True: 0, False: 0]
  |  Branch (85:9): [True: 18.3k, False: 0]
  |  Branch (85:9): [True: 18.3k, False: 0]
  ------------------
   86|  18.3k|        (void)reported;
   87|  18.3k|        (void)dsize;
   88|  18.3k|    }
   89|  18.3k|    if (in) fclose(in);
  ------------------
  |  Branch (89:9): [True: 18.3k, False: 0]
  ------------------
   90|  18.3k|    if (out) fclose(out);
  ------------------
  |  Branch (90:9): [True: 0, False: 18.3k]
  ------------------
   91|  18.3k|    free(dec);
   92|  18.3k|    free(comp);
   93|  18.3k|}

