zxc_compress.c:rapidhash_withSeed:
  487|  6.58k|RAPIDHASH_INLINE_CONSTEXPR uint64_t rapidhash_withSeed(const void *key, size_t len, uint64_t seed) RAPIDHASH_NOEXCEPT {
  488|  6.58k|  return rapidhash_internal(key, len, seed, rapid_secret);
  489|  6.58k|}
zxc_compress.c:rapidhash_internal:
  244|  6.58k|RAPIDHASH_INLINE_CONSTEXPR uint64_t rapidhash_internal(const void *key, size_t len, uint64_t seed, const uint64_t* secret) RAPIDHASH_NOEXCEPT {
  245|  6.58k|  const uint8_t *p=(const uint8_t *)key;
  246|  6.58k|  seed ^= rapid_mix(seed ^ secret[2], secret[1]);
  247|  6.58k|  uint64_t a=0, b=0;
  248|  6.58k|  size_t i = len;
  249|  6.58k|  if (_likely_(len <= 16)) {
  ------------------
  |  |  107|  6.58k| # define _likely_(x)  __builtin_expect(x,1)
  |  |  ------------------
  |  |  |  Branch (107:24): [True: 424, False: 6.16k]
  |  |  ------------------
  ------------------
  250|    424|    if (len >= 4) {
  ------------------
  |  Branch (250:9): [True: 405, False: 19]
  ------------------
  251|    405|      seed ^= len;
  252|    405|      if (len >= 8) {
  ------------------
  |  Branch (252:11): [True: 373, False: 32]
  ------------------
  253|    373|        const uint8_t* plast = p + len - 8;
  254|    373|        a = rapid_read64(p);
  255|    373|        b = rapid_read64(plast);
  256|    373|      } else {
  257|     32|        const uint8_t* plast = p + len - 4;
  258|     32|        a = rapid_read32(p);
  259|     32|        b = rapid_read32(plast);
  260|     32|      }
  261|    405|    } else if (len > 0) {
  ------------------
  |  Branch (261:16): [True: 19, False: 0]
  ------------------
  262|     19|      a = (((uint64_t)p[0])<<45)|p[len-1];
  263|     19|      b = p[len>>1];
  264|     19|    } else
  265|      0|      a = b = 0;
  266|  6.16k|  } else {
  267|  6.16k|    if (len > 112) {
  ------------------
  |  Branch (267:9): [True: 4.91k, False: 1.24k]
  ------------------
  268|  4.91k|      uint64_t see1 = seed, see2 = seed;
  269|  4.91k|      uint64_t see3 = seed, see4 = seed;
  270|  4.91k|      uint64_t see5 = seed, see6 = seed;
  271|  4.91k|#ifdef RAPIDHASH_COMPACT
  272|   919k|      do {
  273|   919k|        seed = rapid_mix(rapid_read64(p) ^ secret[0], rapid_read64(p + 8) ^ seed);
  274|   919k|        see1 = rapid_mix(rapid_read64(p + 16) ^ secret[1], rapid_read64(p + 24) ^ see1);
  275|   919k|        see2 = rapid_mix(rapid_read64(p + 32) ^ secret[2], rapid_read64(p + 40) ^ see2);
  276|   919k|        see3 = rapid_mix(rapid_read64(p + 48) ^ secret[3], rapid_read64(p + 56) ^ see3);
  277|   919k|        see4 = rapid_mix(rapid_read64(p + 64) ^ secret[4], rapid_read64(p + 72) ^ see4);
  278|   919k|        see5 = rapid_mix(rapid_read64(p + 80) ^ secret[5], rapid_read64(p + 88) ^ see5);
  279|   919k|        see6 = rapid_mix(rapid_read64(p + 96) ^ secret[6], rapid_read64(p + 104) ^ see6);
  280|   919k|        p += 112;
  281|   919k|        i -= 112;
  282|   919k|      } while(i > 112);
  ------------------
  |  Branch (282:15): [True: 914k, False: 4.91k]
  ------------------
  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|  4.91k|      seed ^= see1;
  315|  4.91k|      see2 ^= see3;
  316|  4.91k|      see4 ^= see5;
  317|  4.91k|      seed ^= see6;
  318|  4.91k|      see2 ^= see4;
  319|  4.91k|      seed ^= see2;
  320|  4.91k|    }
  321|  6.16k|    if (i > 16) {
  ------------------
  |  Branch (321:9): [True: 5.59k, False: 572]
  ------------------
  322|  5.59k|      seed = rapid_mix(rapid_read64(p) ^ secret[2], rapid_read64(p + 8) ^ seed);
  323|  5.59k|      if (i > 32) {
  ------------------
  |  Branch (323:11): [True: 4.50k, False: 1.08k]
  ------------------
  324|  4.50k|          seed = rapid_mix(rapid_read64(p + 16) ^ secret[2], rapid_read64(p + 24) ^ seed);
  325|  4.50k|          if (i > 48) {
  ------------------
  |  Branch (325:15): [True: 3.52k, False: 981]
  ------------------
  326|  3.52k|              seed = rapid_mix(rapid_read64(p + 32) ^ secret[1], rapid_read64(p + 40) ^ seed);
  327|  3.52k|              if (i > 64) {
  ------------------
  |  Branch (327:19): [True: 2.32k, False: 1.19k]
  ------------------
  328|  2.32k|                  seed = rapid_mix(rapid_read64(p + 48) ^ secret[1], rapid_read64(p + 56) ^ seed);
  329|  2.32k|                  if (i > 80) {
  ------------------
  |  Branch (329:23): [True: 1.43k, False: 891]
  ------------------
  330|  1.43k|                      seed = rapid_mix(rapid_read64(p + 64) ^ secret[2], rapid_read64(p + 72) ^ seed);
  331|  1.43k|                      if (i > 96) {
  ------------------
  |  Branch (331:27): [True: 562, False: 875]
  ------------------
  332|    562|                          seed = rapid_mix(rapid_read64(p + 80) ^ secret[1], rapid_read64(p + 88) ^ seed);
  333|    562|                      }
  334|  1.43k|                  }
  335|  2.32k|              }
  336|  3.52k|          }
  337|  4.50k|      }
  338|  5.59k|    }
  339|  6.16k|    a=rapid_read64(p+i-16) ^ i;  b=rapid_read64(p+i-8);
  340|  6.16k|  }
  341|  6.58k|  a ^= secret[1];
  342|  6.58k|  b ^= seed;
  343|  6.58k|  rapid_mum(&a, &b);
  344|  6.58k|  return rapid_mix(a ^ secret[7], b ^ secret[1] ^ i);
  345|  6.58k|}
zxc_compress.c:rapid_mix:
  209|  6.46M|  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|  12.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_compress.c:rapid_read32:
  216|     64| 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|  6.47M| RAPIDHASH_INLINE_CONSTEXPR void rapid_mum(uint64_t *A, uint64_t *B) RAPIDHASH_NOEXCEPT {
  158|  6.47M| #if defined(__SIZEOF_INT128__)
  159|  6.47M|   __uint128_t r=*A; r*=*B;
  160|       |   #ifdef RAPIDHASH_PROTECTED
  161|       |   *A^=(uint64_t)r; *B^=(uint64_t)(r>>64);
  162|       |   #else
  163|  6.47M|   *A=(uint64_t)r; *B=(uint64_t)(r>>64);
  164|  6.47M|   #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|  6.47M| }
zxc_decompress.c:rapidhash_withSeed:
  487|  28.9k|RAPIDHASH_INLINE_CONSTEXPR uint64_t rapidhash_withSeed(const void *key, size_t len, uint64_t seed) RAPIDHASH_NOEXCEPT {
  488|  28.9k|  return rapidhash_internal(key, len, seed, rapid_secret);
  489|  28.9k|}
zxc_decompress.c:rapidhash_internal:
  244|  28.9k|RAPIDHASH_INLINE_CONSTEXPR uint64_t rapidhash_internal(const void *key, size_t len, uint64_t seed, const uint64_t* secret) RAPIDHASH_NOEXCEPT {
  245|  28.9k|  const uint8_t *p=(const uint8_t *)key;
  246|  28.9k|  seed ^= rapid_mix(seed ^ secret[2], secret[1]);
  247|  28.9k|  uint64_t a=0, b=0;
  248|  28.9k|  size_t i = len;
  249|  28.9k|  if (_likely_(len <= 16)) {
  ------------------
  |  |  107|  28.9k| # define _likely_(x)  __builtin_expect(x,1)
  |  |  ------------------
  |  |  |  Branch (107:24): [True: 2.90k, False: 26.0k]
  |  |  ------------------
  ------------------
  250|  2.90k|    if (len >= 4) {
  ------------------
  |  Branch (250:9): [True: 1.66k, False: 1.24k]
  ------------------
  251|  1.66k|      seed ^= len;
  252|  1.66k|      if (len >= 8) {
  ------------------
  |  Branch (252:11): [True: 1.51k, False: 153]
  ------------------
  253|  1.51k|        const uint8_t* plast = p + len - 8;
  254|  1.51k|        a = rapid_read64(p);
  255|  1.51k|        b = rapid_read64(plast);
  256|  1.51k|      } else {
  257|    153|        const uint8_t* plast = p + len - 4;
  258|    153|        a = rapid_read32(p);
  259|    153|        b = rapid_read32(plast);
  260|    153|      }
  261|  1.66k|    } else if (len > 0) {
  ------------------
  |  Branch (261:16): [True: 106, False: 1.13k]
  ------------------
  262|    106|      a = (((uint64_t)p[0])<<45)|p[len-1];
  263|    106|      b = p[len>>1];
  264|    106|    } else
  265|  1.13k|      a = b = 0;
  266|  26.0k|  } else {
  267|  26.0k|    if (len > 112) {
  ------------------
  |  Branch (267:9): [True: 21.0k, False: 5.05k]
  ------------------
  268|  21.0k|      uint64_t see1 = seed, see2 = seed;
  269|  21.0k|      uint64_t see3 = seed, see4 = seed;
  270|  21.0k|      uint64_t see5 = seed, see6 = seed;
  271|  21.0k|#ifdef RAPIDHASH_COMPACT
  272|  4.42M|      do {
  273|  4.42M|        seed = rapid_mix(rapid_read64(p) ^ secret[0], rapid_read64(p + 8) ^ seed);
  274|  4.42M|        see1 = rapid_mix(rapid_read64(p + 16) ^ secret[1], rapid_read64(p + 24) ^ see1);
  275|  4.42M|        see2 = rapid_mix(rapid_read64(p + 32) ^ secret[2], rapid_read64(p + 40) ^ see2);
  276|  4.42M|        see3 = rapid_mix(rapid_read64(p + 48) ^ secret[3], rapid_read64(p + 56) ^ see3);
  277|  4.42M|        see4 = rapid_mix(rapid_read64(p + 64) ^ secret[4], rapid_read64(p + 72) ^ see4);
  278|  4.42M|        see5 = rapid_mix(rapid_read64(p + 80) ^ secret[5], rapid_read64(p + 88) ^ see5);
  279|  4.42M|        see6 = rapid_mix(rapid_read64(p + 96) ^ secret[6], rapid_read64(p + 104) ^ see6);
  280|  4.42M|        p += 112;
  281|  4.42M|        i -= 112;
  282|  4.42M|      } while(i > 112);
  ------------------
  |  Branch (282:15): [True: 4.40M, False: 21.0k]
  ------------------
  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|  21.0k|      seed ^= see1;
  315|  21.0k|      see2 ^= see3;
  316|  21.0k|      see4 ^= see5;
  317|  21.0k|      seed ^= see6;
  318|  21.0k|      see2 ^= see4;
  319|  21.0k|      seed ^= see2;
  320|  21.0k|    }
  321|  26.0k|    if (i > 16) {
  ------------------
  |  Branch (321:9): [True: 23.6k, False: 2.45k]
  ------------------
  322|  23.6k|      seed = rapid_mix(rapid_read64(p) ^ secret[2], rapid_read64(p + 8) ^ seed);
  323|  23.6k|      if (i > 32) {
  ------------------
  |  Branch (323:11): [True: 19.0k, False: 4.57k]
  ------------------
  324|  19.0k|          seed = rapid_mix(rapid_read64(p + 16) ^ secret[2], rapid_read64(p + 24) ^ seed);
  325|  19.0k|          if (i > 48) {
  ------------------
  |  Branch (325:15): [True: 14.9k, False: 4.12k]
  ------------------
  326|  14.9k|              seed = rapid_mix(rapid_read64(p + 32) ^ secret[1], rapid_read64(p + 40) ^ seed);
  327|  14.9k|              if (i > 64) {
  ------------------
  |  Branch (327:19): [True: 9.90k, False: 5.01k]
  ------------------
  328|  9.90k|                  seed = rapid_mix(rapid_read64(p + 48) ^ secret[1], rapid_read64(p + 56) ^ seed);
  329|  9.90k|                  if (i > 80) {
  ------------------
  |  Branch (329:23): [True: 6.13k, False: 3.77k]
  ------------------
  330|  6.13k|                      seed = rapid_mix(rapid_read64(p + 64) ^ secret[2], rapid_read64(p + 72) ^ seed);
  331|  6.13k|                      if (i > 96) {
  ------------------
  |  Branch (331:27): [True: 2.38k, False: 3.74k]
  ------------------
  332|  2.38k|                          seed = rapid_mix(rapid_read64(p + 80) ^ secret[1], rapid_read64(p + 88) ^ seed);
  333|  2.38k|                      }
  334|  6.13k|                  }
  335|  9.90k|              }
  336|  14.9k|          }
  337|  19.0k|      }
  338|  23.6k|    }
  339|  26.0k|    a=rapid_read64(p+i-16) ^ i;  b=rapid_read64(p+i-8);
  340|  26.0k|  }
  341|  28.9k|  a ^= secret[1];
  342|  28.9k|  b ^= seed;
  343|  28.9k|  rapid_mum(&a, &b);
  344|  28.9k|  return rapid_mix(a ^ secret[7], b ^ secret[1] ^ i);
  345|  28.9k|}
zxc_decompress.c:rapid_mix:
  209|  31.1M|  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|  62.2M| 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|    306| 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|  31.1M| RAPIDHASH_INLINE_CONSTEXPR void rapid_mum(uint64_t *A, uint64_t *B) RAPIDHASH_NOEXCEPT {
  158|  31.1M| #if defined(__SIZEOF_INT128__)
  159|  31.1M|   __uint128_t r=*A; r*=*B;
  160|       |   #ifdef RAPIDHASH_PROTECTED
  161|       |   *A^=(uint64_t)r; *B^=(uint64_t)(r>>64);
  162|       |   #else
  163|  31.1M|   *A=(uint64_t)r; *B=(uint64_t)(r>>64);
  164|  31.1M|   #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|  31.1M| }

zxc_cctx_compute_workspace_size:
  226|  30.6k|                                       const size_t dict_size) {
  227|  30.6k|    if (UNLIKELY(chunk_size == 0)) return 0;
  ------------------
  |  |  154|  30.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 30.6k]
  |  |  ------------------
  ------------------
  228|  30.6k|    return compute_cctx_layout(chunk_size, mode, level, dict_size, 0).total;
  229|  30.6k|}
zxc_cctx_init_in_workspace:
  243|  74.8k|                               const int defer_entropy_scratch) {
  244|  74.8k|    if (UNLIKELY(!ctx || !workspace || chunk_size == 0)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  154|   299k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 74.8k]
  |  |  |  Branch (154:42): [True: 0, False: 74.8k]
  |  |  |  Branch (154:42): [True: 0, False: 74.8k]
  |  |  |  Branch (154:42): [True: 0, False: 74.8k]
  |  |  ------------------
  ------------------
  245|       |
  246|  74.8k|    const zxc_cctx_layout_t layout =
  247|  74.8k|        compute_cctx_layout(chunk_size, mode, level, dict_size, defer_entropy_scratch);
  248|  74.8k|    if (UNLIKELY(workspace_size < layout.total)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  74.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 74.8k]
  |  |  ------------------
  ------------------
  249|       |
  250|  74.8k|    ZXC_MEMSET(ctx, 0, sizeof(zxc_cctx_t));
  ------------------
  |  |  175|  74.8k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  251|  74.8k|    ctx->checksum_enabled = checksum_enabled;
  252|  74.8k|    ctx->chunk_size = chunk_size;
  253|  74.8k|    const uint32_t offset_bits = zxc_log2_u32((uint32_t)chunk_size);
  254|  74.8k|    ctx->offset_bits = offset_bits;
  255|  74.8k|    ctx->offset_mask = (uint32_t)((1ULL << offset_bits) - 1);
  256|  74.8k|    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|  74.8k|    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|  74.8k|    ctx->dict_size = dict_size;
  266|  74.8k|    if (dict_size > 0) {
  ------------------
  |  Branch (266:9): [True: 0, False: 74.8k]
  ------------------
  267|      0|        ctx->dict_buffer = mem + layout.off_dict;
  268|      0|        ctx->dict_buffer_cap = layout.sz_dict;
  269|      0|        ctx->dict_huf = (zxc_dict_huf_state_t*)(void*)(mem + layout.off_dict_huf);
  270|      0|    }
  271|       |
  272|  74.8k|    if (mode == 0) {
  ------------------
  |  Branch (272:9): [True: 59.5k, False: 15.3k]
  ------------------
  273|  59.5k|        ctx->work_buf = mem + layout.off_work;
  274|  59.5k|        ctx->work_buf_cap = chunk_size + ZXC_DECOMPRESS_TAIL_PAD;
  ------------------
  |  |  361|  59.5k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  674|  59.5k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|  59.5k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  522|  59.5k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|  59.5k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  59.5k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  59.5k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  331|  59.5k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  275|  59.5k|        ctx->lit_buffer = mem + layout.off_lit_dctx;
  276|  59.5k|        ctx->lit_buffer_cap = chunk_size + ZXC_PAD_SIZE;
  ------------------
  |  |  331|  59.5k|#define ZXC_PAD_SIZE 32
  ------------------
  277|  59.5k|        if (layout.sz_pivco_dctx) {
  ------------------
  |  Branch (277:13): [True: 30.6k, False: 28.9k]
  ------------------
  278|  30.6k|            ctx->tok_buffer = mem + layout.off_tok_dctx;
  279|  30.6k|            ctx->tok_buffer_cap = layout.sz_tok_dctx;
  280|  30.6k|            ctx->pivco_scratch = mem + layout.off_pivco_dctx;
  281|  30.6k|            ctx->pivco_scratch_cap = layout.sz_pivco_dctx;
  282|  30.6k|        }
  283|  59.5k|        return ZXC_OK;
  284|  59.5k|    }
  285|       |
  286|  15.3k|    ctx->hash_table = (uint32_t*)(mem + layout.off_hash_pos);
  287|  15.3k|    ctx->hash_tags = mem + layout.off_hash_tags;
  288|  15.3k|    ctx->chain_table = (uint16_t*)(mem + layout.off_chain);
  289|  15.3k|    ctx->buf_sequences = (uint32_t*)(mem + layout.off_seq_union);
  290|  15.3k|    ctx->buf_offsets = (uint16_t*)(mem + layout.off_seq_union);
  291|  15.3k|    ctx->buf_tokens = mem + layout.off_seq_union + layout.max_seq * sizeof(uint16_t);
  292|  15.3k|    ctx->buf_split = ctx->buf_tokens + layout.max_seq;
  293|  15.3k|    ctx->buf_split_hist = (zxc_spl_match_split_hist_t*)(void*)(mem + layout.off_split_hist);
  294|  15.3k|    ctx->buf_extras = mem + layout.off_extras;
  295|  15.3k|    ctx->literals = mem + layout.off_lit_cctx;
  296|  15.3k|    if (layout.sz_opt) {
  ------------------
  |  Branch (296:9): [True: 5.14k, False: 10.1k]
  ------------------
  297|  5.14k|        ctx->opt_scratch = mem + layout.off_opt;
  298|  5.14k|        ctx->opt_scratch_cap = layout.sz_opt;
  299|  5.14k|    }
  300|       |
  301|  15.3k|    ctx->compression_level = level;
  302|  15.3k|    ctx->epoch = 1;
  303|       |
  304|  15.3k|    ZXC_MEMSET(ctx->hash_table, 0, layout.sz_hash_pos);
  ------------------
  |  |  175|  15.3k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  305|  15.3k|    ZXC_MEMSET(ctx->hash_tags, 0, layout.sz_hash_tags);
  ------------------
  |  |  175|  15.3k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  306|  15.3k|    return ZXC_OK;
  307|  74.8k|}
zxc_cctx_init:
  320|  44.2k|                  const int level, const int checksum_enabled, const size_t dict_size) {
  321|  44.2k|    if (UNLIKELY(chunk_size == 0)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  154|  44.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 44.2k]
  |  |  ------------------
  ------------------
  322|       |    // Heap contexts defer the decode-side entropy scratch to the first entropy
  323|       |    // section; static workspaces must have it already, they may never allocate.
  324|  44.2k|    const int defer_entropy = (mode == 0);
  325|  44.2k|    const size_t total =
  326|  44.2k|        compute_cctx_layout(chunk_size, mode, level, dict_size, defer_entropy).total;
  327|  44.2k|    if (UNLIKELY(total == 0)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  154|  44.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 44.2k]
  |  |  ------------------
  ------------------
  328|       |
  329|  44.2k|    uint8_t* const mem = (uint8_t*)ZXC_ALIGNED_MALLOC(total, ZXC_CACHE_LINE_SIZE);
  ------------------
  |  |  134|  44.2k|#define ZXC_ALIGNED_MALLOC(size, alignment) zxc_aligned_malloc(size, alignment)
  ------------------
  330|  44.2k|    if (UNLIKELY(!mem)) return ZXC_ERROR_MEMORY;
  ------------------
  |  |  154|  44.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 44.2k]
  |  |  ------------------
  ------------------
  331|       |
  332|  44.2k|    const int rc = zxc_cctx_init_in_workspace(ctx, mem, total, chunk_size, mode, level,
  333|  44.2k|                                              checksum_enabled, dict_size, defer_entropy);
  334|  44.2k|    if (UNLIKELY(rc != ZXC_OK)) {
  ------------------
  |  |  154|  44.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 44.2k]
  |  |  ------------------
  ------------------
  335|       |        // LCOV_EXCL_START
  336|      0|        ZXC_ALIGNED_FREE(mem);
  ------------------
  |  |  137|      0|#define ZXC_ALIGNED_FREE(ptr) zxc_aligned_free(ptr)
  ------------------
  337|      0|        return rc;
  338|       |        // LCOV_EXCL_STOP
  339|      0|    }
  340|       |    // Library-owned buffer: record the allocation so zxc_cctx_free frees it.
  341|  44.2k|    ctx->memory_block = mem;
  342|  44.2k|    return ZXC_OK;
  343|  44.2k|}
zxc_cctx_alloc_entropy_scratch:
  353|  4.38k|int zxc_cctx_alloc_entropy_scratch(zxc_cctx_t* ctx) {
  354|  4.38k|    if (LIKELY(ctx->pivco_scratch)) return ZXC_OK;
  ------------------
  |  |  148|  4.38k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 0, False: 4.38k]
  |  |  ------------------
  ------------------
  355|       |
  356|       |    // Sized for the block the context was carved for, not chunk_size: a reader
  357|       |    // over frames of several block sizes lowers chunk_size per block.
  358|  4.38k|    size_t sz_tok = 0;
  359|  4.38k|    size_t sz_pivco = 0;
  360|  4.38k|    zxc_dctx_entropy_sizes(ctx->work_buf_cap - ZXC_DECOMPRESS_TAIL_PAD, &sz_tok, &sz_pivco);
  ------------------
  |  |  361|  4.38k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  674|  4.38k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|  4.38k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  522|  4.38k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|  4.38k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  4.38k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  4.38k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  331|  4.38k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  361|  4.38k|    const size_t total = ZXC_ALIGN_CL(sz_tok) + ZXC_ALIGN_CL(sz_pivco);
  ------------------
  |  |  373|  4.38k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  4.38k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  4.38k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  4.38k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  4.38k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  const size_t total = ZXC_ALIGN_CL(sz_tok) + ZXC_ALIGN_CL(sz_pivco);
  ------------------
  |  |  373|  4.38k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  4.38k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  4.38k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  4.38k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  4.38k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  362|       |
  363|  4.38k|    uint8_t* const mem = (uint8_t*)ZXC_ALIGNED_MALLOC(total, ZXC_CACHE_LINE_SIZE);
  ------------------
  |  |  134|  4.38k|#define ZXC_ALIGNED_MALLOC(size, alignment) zxc_aligned_malloc(size, alignment)
  ------------------
  364|  4.38k|    if (UNLIKELY(!mem)) return ZXC_ERROR_MEMORY;  // LCOV_EXCL_LINE
  ------------------
  |  |  154|  4.38k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 4.38k]
  |  |  ------------------
  ------------------
  365|       |
  366|  4.38k|    ctx->entropy_block = mem;
  367|  4.38k|    ctx->tok_buffer = mem;
  368|  4.38k|    ctx->tok_buffer_cap = sz_tok;
  369|  4.38k|    ctx->pivco_scratch = mem + ZXC_ALIGN_CL(sz_tok);
  ------------------
  |  |  373|  4.38k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  4.38k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  4.38k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  4.38k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  4.38k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  370|  4.38k|    ctx->pivco_scratch_cap = sz_pivco;
  371|  4.38k|    return ZXC_OK;
  372|  4.38k|}
zxc_cctx_free:
  380|  44.2k|void zxc_cctx_free(zxc_cctx_t* ctx) {
  381|  44.2k|    if (ctx->memory_block) {
  ------------------
  |  Branch (381:9): [True: 44.2k, False: 0]
  ------------------
  382|  44.2k|        ZXC_ALIGNED_FREE(ctx->memory_block);
  ------------------
  |  |  137|  44.2k|#define ZXC_ALIGNED_FREE(ptr) zxc_aligned_free(ptr)
  ------------------
  383|  44.2k|        ctx->memory_block = NULL;
  384|  44.2k|    }
  385|  44.2k|    if (ctx->entropy_block) {
  ------------------
  |  Branch (385:9): [True: 4.38k, False: 39.8k]
  ------------------
  386|  4.38k|        ZXC_ALIGNED_FREE(ctx->entropy_block);
  ------------------
  |  |  137|  4.38k|#define ZXC_ALIGNED_FREE(ptr) zxc_aligned_free(ptr)
  ------------------
  387|  4.38k|        ctx->entropy_block = NULL;
  388|  4.38k|    }
  389|       |
  390|  44.2k|    ctx->lit_buffer = NULL;
  391|  44.2k|    ctx->hash_table = NULL;
  392|  44.2k|    ctx->hash_tags = NULL;
  393|  44.2k|    ctx->chain_table = NULL;
  394|  44.2k|    ctx->buf_sequences = NULL;
  395|  44.2k|    ctx->buf_tokens = NULL;
  396|  44.2k|    ctx->buf_offsets = NULL;
  397|  44.2k|    ctx->buf_extras = NULL;
  398|  44.2k|    ctx->buf_split = NULL;
  399|  44.2k|    ctx->buf_split_hist = NULL;
  400|  44.2k|    ctx->literals = NULL;
  401|  44.2k|    ctx->work_buf = NULL;
  402|  44.2k|    ctx->tok_buffer = NULL;
  403|  44.2k|    ctx->pivco_scratch = NULL;
  404|  44.2k|    ctx->opt_scratch = NULL;
  405|  44.2k|    ctx->dict_buffer = NULL;
  406|  44.2k|    ctx->dict_huf = NULL;
  407|       |
  408|  44.2k|    ctx->epoch = 0;
  409|  44.2k|    ctx->lit_buffer_cap = 0;
  410|  44.2k|    ctx->work_buf_cap = 0;
  411|  44.2k|    ctx->tok_buffer_cap = 0;
  412|  44.2k|    ctx->pivco_scratch_cap = 0;
  413|  44.2k|    ctx->opt_scratch_cap = 0;
  414|  44.2k|    ctx->dict_buffer_cap = 0;
  415|  44.2k|    ctx->dict_size = 0;
  416|  44.2k|    ctx->dict_huf_tree_ok = 0;
  417|       |    ctx->lit_freq_acc = NULL;
  418|  44.2k|}
zxc_write_block_header:
  670|  21.5k|                           const zxc_block_header_t* RESTRICT bh) {
  671|  21.5k|    if (UNLIKELY(dst_capacity < ZXC_BLOCK_HEADER_SIZE)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  21.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 21.5k]
  |  |  ------------------
  ------------------
  672|       |
  673|  21.5k|    dst[0] = bh->block_type;
  674|  21.5k|    dst[1] = 0;  // Flags not used currently
  675|  21.5k|    dst[2] = 0;  // Reserved
  676|  21.5k|    zxc_store_le32(dst + 3, bh->comp_size);
  677|  21.5k|    dst[7] = 0;               // Zero before hashing
  678|  21.5k|    dst[7] = zxc_hash8(dst);  // Checksum at the end
  679|       |
  680|  21.5k|    return ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  428|  21.5k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
  681|  21.5k|}
zxc_write_spl_header_and_desc:
  928|  10.7k|                                  const uint32_t tok_comp) {
  929|  10.7k|    const size_t desc_sz = zxc_spl_desc_size(gh->enc_lit, gh->enc_tok);
  930|  10.7k|    const size_t needed = ZXC_SPL_HEADER_BINARY_SIZE + desc_sz;
  ------------------
  |  |  432|  10.7k|#define ZXC_SPL_HEADER_BINARY_SIZE 12
  ------------------
  931|       |
  932|  10.7k|    if (UNLIKELY(rem < needed)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  10.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 10.7k]
  |  |  ------------------
  ------------------
  933|       |
  934|  10.7k|    zxc_write_gnr_header(dst, gh);
  935|  10.7k|    uint8_t* p = dst + ZXC_SPL_HEADER_BINARY_SIZE;
  ------------------
  |  |  432|  10.7k|#define ZXC_SPL_HEADER_BINARY_SIZE 12
  ------------------
  936|       |
  937|  10.7k|    if (gh->enc_lit != ZXC_SECTION_ENCODING_RAW) {
  ------------------
  |  Branch (937:9): [True: 5.40k, False: 5.35k]
  ------------------
  938|  5.40k|        zxc_store_le32(p, lit_comp);
  939|  5.40k|        p += sizeof(uint32_t);
  940|  5.40k|    }
  941|  10.7k|    if (gh->enc_tok == ZXC_SECTION_ENCODING_HUFFMAN) {
  ------------------
  |  Branch (941:9): [True: 1.01k, False: 9.74k]
  ------------------
  942|  1.01k|        zxc_store_le32(p, tok_comp);
  943|  1.01k|    }
  944|       |
  945|  10.7k|    return (int)needed;
  946|  10.7k|}
zxc_read_spl_header_and_desc:
  953|  67.2k|                                 uint32_t* RESTRICT tok_comp) {
  954|  67.2k|    if (UNLIKELY(len < ZXC_SPL_HEADER_BINARY_SIZE)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  154|  67.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 210, False: 67.0k]
  |  |  ------------------
  ------------------
  955|       |
  956|  67.0k|    zxc_read_gnr_header(src, gh);
  957|       |
  958|  67.0k|    const size_t desc_sz = zxc_spl_desc_size(gh->enc_lit, gh->enc_tok);
  959|  67.0k|    const size_t needed = ZXC_SPL_HEADER_BINARY_SIZE + desc_sz;
  ------------------
  |  |  432|  67.0k|#define ZXC_SPL_HEADER_BINARY_SIZE 12
  ------------------
  960|  67.0k|    if (UNLIKELY(len < needed)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  154|  67.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 30, False: 67.0k]
  |  |  ------------------
  ------------------
  961|       |
  962|  67.0k|    const uint8_t* p = src + ZXC_SPL_HEADER_BINARY_SIZE;
  ------------------
  |  |  432|  67.0k|#define ZXC_SPL_HEADER_BINARY_SIZE 12
  ------------------
  963|       |
  964|  67.0k|    if (gh->enc_lit != ZXC_SECTION_ENCODING_RAW) {
  ------------------
  |  Branch (964:9): [True: 30.1k, False: 36.8k]
  ------------------
  965|  30.1k|        *lit_comp = zxc_le32(p);
  966|  30.1k|        p += sizeof(uint32_t);
  967|  36.8k|    } else {
  968|  36.8k|        *lit_comp = gh->n_literals;
  969|  36.8k|    }
  970|  67.0k|    *tok_comp = (gh->enc_tok == ZXC_SECTION_ENCODING_HUFFMAN) ? zxc_le32(p) : gh->n_sequences;
  ------------------
  |  Branch (970:17): [True: 30.7k, False: 36.2k]
  ------------------
  971|       |
  972|  67.0k|    return (int)needed;
  973|  67.0k|}
zxc_write_pak_header:
  984|  4.54k|                         const zxc_gnr_header_t* RESTRICT gh) {
  985|  4.54k|    if (UNLIKELY(rem < ZXC_PAK_HEADER_BINARY_SIZE)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  4.54k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 4.54k]
  |  |  ------------------
  ------------------
  986|       |
  987|  4.54k|    zxc_write_gnr_header(dst, gh);
  988|  4.54k|    return ZXC_PAK_HEADER_BINARY_SIZE;
  ------------------
  |  |  434|  4.54k|#define ZXC_PAK_HEADER_BINARY_SIZE 12
  ------------------
  989|  4.54k|}
zxc_read_pak_header:
  995|  19.0k|                        zxc_gnr_header_t* RESTRICT gh) {
  996|  19.0k|    if (UNLIKELY(len < ZXC_PAK_HEADER_BINARY_SIZE)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  154|  19.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 93, False: 18.9k]
  |  |  ------------------
  ------------------
  997|       |
  998|  18.9k|    zxc_read_gnr_header(src, gh);
  999|  18.9k|    return ZXC_OK;
 1000|  19.0k|}
zxc_compress_block_bound:
 1034|  15.3k|size_t zxc_compress_block_bound(const size_t input_size) {
 1035|       |    // Mirrors the Block API contract: outside [1, ZXC_BLOCK_SIZE_MAX] the call
 1036|       |    // would fail anyway, so the bound is undefined and 0 says "unusable". The cap
 1037|       |    // also makes the addition below trivially overflow-free.
 1038|  15.3k|    if (UNLIKELY(input_size == 0 || input_size > ZXC_BLOCK_SIZE_MAX)) return 0;
  ------------------
  |  |  154|  30.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 15.3k]
  |  |  |  Branch (154:42): [True: 0, False: 15.3k]
  |  |  |  Branch (154:42): [True: 0, False: 15.3k]
  |  |  ------------------
  ------------------
 1039|       |    // Outer block header + payload (worst case: incompressible, raw bytes)
 1040|       |    // + inner format overhead + optional checksum.
 1041|  15.3k|    return ZXC_BLOCK_HEADER_SIZE + input_size + ZXC_BLOCK_FORMAT_OVERHEAD + ZXC_BLOCK_CHECKSUM_SIZE;
  ------------------
  |  |  428|  15.3k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
                  return ZXC_BLOCK_HEADER_SIZE + input_size + ZXC_BLOCK_FORMAT_OVERHEAD + ZXC_BLOCK_CHECKSUM_SIZE;
  ------------------
  |  |  446|  15.3k|#define ZXC_BLOCK_FORMAT_OVERHEAD 68
  ------------------
                  return ZXC_BLOCK_HEADER_SIZE + input_size + ZXC_BLOCK_FORMAT_OVERHEAD + ZXC_BLOCK_CHECKSUM_SIZE;
  ------------------
  |  |  430|  15.3k|#define ZXC_BLOCK_CHECKSUM_SIZE 4
  ------------------
 1042|  15.3k|}
zxc_decompress_block_bound:
 1055|  15.3k|size_t zxc_decompress_block_bound(const size_t uncompressed_size) {
 1056|  15.3k|    if (UNLIKELY(uncompressed_size > ZXC_BLOCK_SIZE_MAX)) return 0;
  ------------------
  |  |  154|  15.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 15.3k]
  |  |  ------------------
  ------------------
 1057|  15.3k|    return uncompressed_size + ZXC_DECOMPRESS_TAIL_PAD;
  ------------------
  |  |  361|  15.3k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  674|  15.3k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|  15.3k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  522|  15.3k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|  15.3k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  15.3k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  15.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 */
  |  |  ------------------
  |  |  |  |  331|  15.3k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
 1058|  15.3k|}
zxc_max_level:
 1154|  15.3k|int zxc_max_level(void) { return ZXC_LEVEL_ULTRA; }
zxc_common.c:compute_cctx_layout:
  122|   149k|                                             const int defer_entropy_scratch) {
  123|   149k|    zxc_cctx_layout_t layout = {0};
  124|       |
  125|   149k|    const size_t max_seq = zxc_cctx_max_seq(chunk_size);
  126|       |
  127|   149k|    if (mode == 0) {
  ------------------
  |  Branch (127:9): [True: 119k, False: 30.6k]
  ------------------
  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|   119k|        const size_t sz_work = chunk_size + ZXC_DECOMPRESS_TAIL_PAD;
  ------------------
  |  |  361|   119k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  674|   119k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|   119k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  522|   119k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|   119k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   119k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   119k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  331|   119k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  132|   119k|        const size_t sz_lit = chunk_size + ZXC_PAD_SIZE;
  ------------------
  |  |  331|   119k|#define ZXC_PAD_SIZE 32
  ------------------
  133|       |
  134|   119k|        layout.off_work = layout.total;
  135|   119k|        layout.total += ZXC_ALIGN_CL(sz_work);
  ------------------
  |  |  373|   119k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|   119k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|   119k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|   119k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|   119k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  136|   119k|        layout.off_lit_dctx = layout.total;
  137|   119k|        layout.total += ZXC_ALIGN_CL(sz_lit);
  ------------------
  |  |  373|   119k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|   119k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|   119k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|   119k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|   119k|#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|   119k|        if (!defer_entropy_scratch) {
  ------------------
  |  Branch (143:13): [True: 61.2k, False: 57.8k]
  ------------------
  144|  61.2k|            size_t sz_tok = 0;
  145|  61.2k|            size_t sz_pivco = 0;
  146|  61.2k|            zxc_dctx_entropy_sizes(chunk_size, &sz_tok, &sz_pivco);
  147|  61.2k|            layout.sz_tok_dctx = sz_tok;
  148|  61.2k|            layout.off_tok_dctx = layout.total;
  149|  61.2k|            layout.total += ZXC_ALIGN_CL(layout.sz_tok_dctx);
  ------------------
  |  |  373|  61.2k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  61.2k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  61.2k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  61.2k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  61.2k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  150|  61.2k|            layout.sz_pivco_dctx = sz_pivco;
  151|  61.2k|            layout.off_pivco_dctx = layout.total;
  152|  61.2k|            layout.total += ZXC_ALIGN_CL(layout.sz_pivco_dctx);
  ------------------
  |  |  373|  61.2k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  61.2k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  61.2k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  61.2k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  61.2k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  153|  61.2k|        }
  154|   119k|    } else {
  155|       |        // Compress: 7 partitions + optional opt_scratch at level >= ZXC_LEVEL_DENSITY.
  156|  30.6k|        const uint32_t offset_bits = zxc_log2_u32((uint32_t)chunk_size);
  157|  30.6k|        layout.max_seq = max_seq;
  158|  30.6k|        layout.sz_hash_pos = ZXC_LZ_HASH_SIZE * sizeof(uint32_t);
  ------------------
  |  |  569|  30.6k|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  ------------------
  |  |  |  |  567|  30.6k|#define ZXC_LZ_HASH_BITS 15
  |  |  ------------------
  ------------------
  159|  30.6k|        layout.sz_hash_tags = ZXC_LZ_HASH_SIZE * sizeof(uint8_t);
  ------------------
  |  |  569|  30.6k|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  ------------------
  |  |  |  |  567|  30.6k|#define ZXC_LZ_HASH_BITS 15
  |  |  ------------------
  ------------------
  160|  30.6k|        const size_t sz_chain = ZXC_LZ_WINDOW_SIZE * sizeof(uint16_t);
  ------------------
  |  |  571|  30.6k|#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|  30.6k|        const size_t sz_seq_union = layout.max_seq * sizeof(uint32_t);
  164|  30.6k|        const size_t vbyte_len = (offset_bits + 6) / 7;
  165|  30.6k|        const size_t sz_extras = layout.max_seq * 2 * vbyte_len;
  166|  30.6k|        const size_t sz_lit = chunk_size + ZXC_PAD_SIZE;
  ------------------
  |  |  331|  30.6k|#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_size() and its
  171|       |        // consumer in zxc_compress.c.
  172|  30.6k|        if (level >= ZXC_LEVEL_DENSITY) {
  ------------------
  |  Branch (172:13): [True: 10.2k, False: 20.3k]
  ------------------
  173|  10.2k|            size_t sz_dp;
  174|  10.2k|            size_t sz_pl;
  175|  10.2k|            size_t sz_po;
  176|  10.2k|            size_t sz_bm;
  177|  10.2k|            zxc_opt_dp_sizes(chunk_size, &sz_dp, &sz_pl, &sz_po, &sz_bm);
  178|  10.2k|            const size_t dp_needed = sz_dp + sz_pl + sz_po + sz_bm;
  179|  10.2k|            layout.sz_opt =
  180|  10.2k|                (dp_needed > ZXC_HUF_NUDGE_SCRATCH_SIZE) ? dp_needed : ZXC_HUF_NUDGE_SCRATCH_SIZE;
  ------------------
  |  | 1091|  10.2k|#define ZXC_HUF_NUDGE_SCRATCH_SIZE (ZXC_HUF_NUDGE_SCRATCH_OFF + sizeof(zxc_huf_nudge_ws_t))
  |  |  ------------------
  |  |  |  | 1089|  10.2k|#define ZXC_HUF_NUDGE_SCRATCH_OFF ZXC_ALIGN_CL(ZXC_HUF_BUILD_SCRATCH_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  373|  10.2k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  371|  10.2k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  369|  10.2k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  371|  10.2k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  369|  10.2k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                              (dp_needed > ZXC_HUF_NUDGE_SCRATCH_SIZE) ? dp_needed : ZXC_HUF_NUDGE_SCRATCH_SIZE;
  ------------------
  |  | 1091|  14.5k|#define ZXC_HUF_NUDGE_SCRATCH_SIZE (ZXC_HUF_NUDGE_SCRATCH_OFF + sizeof(zxc_huf_nudge_ws_t))
  |  |  ------------------
  |  |  |  | 1089|  4.24k|#define ZXC_HUF_NUDGE_SCRATCH_OFF ZXC_ALIGN_CL(ZXC_HUF_BUILD_SCRATCH_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  373|  4.24k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  371|  4.24k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  369|  4.24k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  371|  4.24k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  369|  4.24k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (180:17): [True: 6.05k, False: 4.24k]
  ------------------
  181|  10.2k|        }
  182|       |
  183|  30.6k|        layout.off_hash_pos = layout.total;
  184|  30.6k|        layout.total += ZXC_ALIGN_CL(layout.sz_hash_pos);
  ------------------
  |  |  373|  30.6k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  30.6k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  30.6k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  30.6k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  30.6k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  185|  30.6k|        layout.off_hash_tags = layout.total;
  186|  30.6k|        layout.total += ZXC_ALIGN_CL(layout.sz_hash_tags);
  ------------------
  |  |  373|  30.6k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  30.6k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  30.6k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  30.6k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  30.6k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  187|  30.6k|        layout.off_chain = layout.total;
  188|  30.6k|        layout.total += ZXC_ALIGN_CL(sz_chain);
  ------------------
  |  |  373|  30.6k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  30.6k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  30.6k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  30.6k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  30.6k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  189|  30.6k|        layout.off_seq_union = layout.total;
  190|  30.6k|        layout.total += ZXC_ALIGN_CL(sz_seq_union);
  ------------------
  |  |  373|  30.6k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  30.6k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  30.6k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  30.6k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  30.6k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  191|  30.6k|        layout.off_split_hist = layout.total;
  192|  30.6k|        layout.total += ZXC_ALIGN_CL(sizeof(zxc_spl_match_split_hist_t));
  ------------------
  |  |  373|  30.6k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  30.6k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  30.6k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  30.6k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  30.6k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  193|  30.6k|        layout.off_extras = layout.total;
  194|  30.6k|        layout.total += ZXC_ALIGN_CL(sz_extras);
  ------------------
  |  |  373|  30.6k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  30.6k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  30.6k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  30.6k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  30.6k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  195|  30.6k|        layout.off_lit_cctx = layout.total;
  196|  30.6k|        layout.total += ZXC_ALIGN_CL(sz_lit);
  ------------------
  |  |  373|  30.6k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  30.6k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  30.6k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  30.6k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  30.6k|#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|  30.6k|        if (layout.sz_opt) {
  ------------------
  |  Branch (199:13): [True: 10.2k, False: 20.3k]
  ------------------
  200|  10.2k|            layout.off_opt = layout.total;
  201|  10.2k|            layout.total += ZXC_ALIGN_CL(layout.sz_opt);
  ------------------
  |  |  373|  10.2k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  10.2k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  10.2k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  10.2k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  10.2k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  202|  10.2k|        }
  203|  30.6k|    }
  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|   149k|    if (dict_size > 0) {
  ------------------
  |  Branch (207:9): [True: 0, False: 149k]
  ------------------
  208|      0|        layout.sz_dict = (mode == 1) ? (chunk_size + ZXC_DECOMPRESS_TAIL_PAD)
  ------------------
  |  |  361|      0|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  674|      0|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  522|      0|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|      0|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  331|      0|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  |  Branch (208:26): [True: 0, False: 0]
  ------------------
  209|      0|                                     : (dict_size + chunk_size + ZXC_DECOMPRESS_TAIL_PAD);
  ------------------
  |  |  361|      0|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  674|      0|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|      0|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  522|      0|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|      0|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  331|      0|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  210|      0|        layout.off_dict = layout.total;
  211|      0|        layout.total += ZXC_ALIGN_CL(layout.sz_dict);
  ------------------
  |  |  373|      0|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|      0|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|      0|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|      0|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|      0|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  212|      0|        layout.off_dict_huf = layout.total;
  213|      0|        layout.total += ZXC_ALIGN_CL(sizeof(zxc_dict_huf_state_t));
  ------------------
  |  |  373|      0|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|      0|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|      0|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|      0|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|      0|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  214|      0|    }
  215|   149k|    return layout;
  216|   149k|}
zxc_common.c:zxc_cctx_max_seq:
   74|   215k|static ZXC_ALWAYS_INLINE size_t zxc_cctx_max_seq(const size_t chunk_size) {
   75|   215k|    return chunk_size / ZXC_LZ_MIN_MATCH_LEN + 16;
  ------------------
  |  |  575|   215k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
   76|   215k|}
zxc_common.c:zxc_dctx_entropy_sizes:
   86|  65.6k|                                   size_t* RESTRICT sz_pivco) {
   87|  65.6k|    *sz_tok = zxc_cctx_max_seq(chunk_size) + ZXC_PAD_SIZE;
  ------------------
  |  |  331|  65.6k|#define ZXC_PAD_SIZE 32
  ------------------
   88|  65.6k|    *sz_pivco = chunk_size + ZXC_PIVCO_SCRATCH_PAD;
  ------------------
  |  | 1879|  65.6k|#define ZXC_PIVCO_SCRATCH_PAD 32
  ------------------
   89|  65.6k|}
zxc_common.c:zxc_spl_desc_size:
  912|  77.8k|static ZXC_ALWAYS_INLINE size_t zxc_spl_desc_size(const uint8_t enc_lit, const uint8_t enc_tok) {
  913|  77.8k|    return ((enc_lit != ZXC_SECTION_ENCODING_RAW) ? sizeof(uint32_t) : 0) +
  ------------------
  |  Branch (913:13): [True: 35.6k, False: 42.2k]
  ------------------
  914|  77.8k|           ((enc_tok == ZXC_SECTION_ENCODING_HUFFMAN) ? sizeof(uint32_t) : 0);
  ------------------
  |  Branch (914:13): [True: 31.7k, False: 46.0k]
  ------------------
  915|  77.8k|}
zxc_common.c:zxc_write_gnr_header:
  880|  15.3k|                                                   const zxc_gnr_header_t* RESTRICT gh) {
  881|  15.3k|    zxc_store_le32(dst, gh->n_sequences);
  882|  15.3k|    zxc_store_le32(dst + 4, gh->n_literals);
  883|       |
  884|  15.3k|    dst[8] = gh->enc_lit;
  885|  15.3k|    dst[9] = gh->enc_tok;
  886|  15.3k|    dst[10] = gh->enc_mlen;
  887|  15.3k|    dst[11] = gh->enc_off;
  888|  15.3k|}
zxc_common.c:zxc_read_gnr_header:
  897|  86.0k|                                                  zxc_gnr_header_t* RESTRICT gh) {
  898|  86.0k|    gh->n_sequences = zxc_le32(src);
  899|  86.0k|    gh->n_literals = zxc_le32(src + 4);
  900|  86.0k|    gh->enc_lit = src[8];
  901|  86.0k|    gh->enc_tok = src[9];
  902|  86.0k|    gh->enc_mlen = src[10];
  903|  86.0k|    gh->enc_off = src[11];
  904|  86.0k|}

zxc_compress_chunk_wrapper_default:
 2221|  15.3k|                               const uint64_t block_index) {
 2222|  15.3k|    if (UNLIKELY(dst_cap < ZXC_BLOCK_HEADER_SIZE)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  15.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 15.3k]
  |  |  ------------------
  ------------------
 2223|       |
 2224|  15.3k|    const size_t dict_sz = ctx->dict_size;
 2225|  15.3k|    const size_t block_sz = src_sz - dict_sz;
 2226|  15.3k|    const uint8_t* block_data = chunk + dict_sz;
 2227|  15.3k|    size_t w = 0;
 2228|  15.3k|    int res = ZXC_OK;
 2229|       |
 2230|  15.3k|    if (ctx->compression_level <= 2)
  ------------------
  |  Branch (2230:9): [True: 4.54k, False: 10.7k]
  ------------------
 2231|  4.54k|        res = zxc_encode_block_pak(ctx, chunk, src_sz, dst, dst_cap, &w);
 2232|  10.7k|    else
 2233|  10.7k|        res = zxc_encode_block_spl(ctx, chunk, src_sz, dst, dst_cap, &w);
 2234|       |
 2235|       |    // Check expansion against block data size (excluding dict prefix).
 2236|  15.3k|    if (UNLIKELY(res != ZXC_OK || w >= block_sz)) {
  ------------------
  |  |  154|  30.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 6.26k, False: 9.04k]
  |  |  |  Branch (154:42): [True: 0, False: 15.3k]
  |  |  |  Branch (154:42): [True: 6.26k, False: 9.04k]
  |  |  ------------------
  ------------------
 2237|  6.26k|        res = zxc_encode_block_raw(block_data, block_sz, dst, dst_cap, &w);
 2238|  6.26k|        if (UNLIKELY(res != ZXC_OK)) return res;
  ------------------
  |  |  154|  6.26k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 6.26k]
  |  |  ------------------
  ------------------
 2239|  6.26k|    }
 2240|       |
 2241|  15.3k|    if (ctx->checksum_enabled) {
  ------------------
  |  Branch (2241:9): [True: 6.58k, False: 8.72k]
  ------------------
 2242|  6.58k|        if (UNLIKELY(w + ZXC_BLOCK_CHECKSUM_SIZE > dst_cap)) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  154|  6.58k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 6.58k]
  |  |  ------------------
  ------------------
 2243|       |
 2244|  6.58k|        zxc_store_le32(dst + w,
 2245|  6.58k|                       zxc_checksum(block_data, block_sz, block_index, ZXC_CHECKSUM_RAPIDHASH));
  ------------------
  |  |  452|  6.58k|#define ZXC_CHECKSUM_RAPIDHASH 0
  ------------------
 2246|  6.58k|        w += ZXC_BLOCK_CHECKSUM_SIZE;
  ------------------
  |  |  430|  6.58k|#define ZXC_BLOCK_CHECKSUM_SIZE 4
  ------------------
 2247|  6.58k|    }
 2248|       |
 2249|  15.3k|    return (int)w;
 2250|  15.3k|}
zxc_compress.c:zxc_encode_block_pak:
 2021|  4.54k|                                size_t* RESTRICT const out_sz) {
 2022|  4.54k|    if (UNLIKELY(dst_cap < ZXC_BLOCK_HEADER_SIZE)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  4.54k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 4.54k]
  |  |  ------------------
  ------------------
 2023|       |
 2024|  4.54k|    const int level = ctx->compression_level;
 2025|  4.54k|    const size_t dict_sz = ctx->dict_size;
 2026|       |
 2027|  4.54k|    zxc_lz77_params_t lzp = zxc_get_lz77_params(level);
 2028|       |    // The floor is a candidate until the block itself clears it.
 2029|  4.54k|    if (lzp.min_offset > 1 && zxc_block_is_short_dist_bound(src + dict_sz, src_sz - dict_sz))
  ------------------
  |  Branch (2029:9): [True: 4.54k, False: 0]
  |  Branch (2029:31): [True: 3.28k, False: 1.25k]
  ------------------
 2030|  3.28k|        lzp.min_offset = 1;
 2031|       |
 2032|  4.54k|    ctx->epoch++;
 2033|  4.54k|    if (UNLIKELY(ctx->epoch >= ctx->max_epoch)) {
  ------------------
  |  |  154|  4.54k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 4.54k]
  |  |  ------------------
  ------------------
 2034|      0|        ZXC_MEMSET(ctx->hash_table, 0, ZXC_LZ_HASH_SIZE * sizeof(uint32_t));
  ------------------
  |  |  175|      0|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 2035|      0|        ZXC_MEMSET(ctx->hash_tags, 0, ZXC_LZ_HASH_SIZE * sizeof(uint8_t));
  ------------------
  |  |  175|      0|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 2036|      0|        ctx->epoch = 1;
 2037|      0|    }
 2038|  4.54k|    const uint32_t offset_bits = ctx->offset_bits;
 2039|  4.54k|    const uint32_t offset_mask = ctx->offset_mask;
 2040|  4.54k|    const uint32_t epoch_mark = ctx->epoch << offset_bits;
 2041|       |
 2042|  4.54k|    if (dict_sz > 0)
  ------------------
  |  Branch (2042:9): [True: 0, False: 4.54k]
  ------------------
 2043|      0|        zxc_lz_seed_dict(src, dict_sz, ctx->hash_table, ctx->hash_tags, ctx->chain_table,
 2044|      0|                         epoch_mark, offset_mask, level);
 2045|       |
 2046|  4.54k|    const uint8_t* ip = src + dict_sz;
 2047|  4.54k|    const uint8_t* iend = src + src_sz;
 2048|  4.54k|    const uint8_t* anchor = ip;
 2049|  4.54k|    const uint8_t* search_limit = iend - ZXC_LZ_SEARCH_MARGIN;
  ------------------
  |  |  717|  4.54k|#define ZXC_LZ_SEARCH_MARGIN (sizeof(uint64_t))
  ------------------
 2050|       |
 2051|  4.54k|    uint32_t* const hash_table = ctx->hash_table;
 2052|  4.54k|    uint8_t* const hash_tags = ctx->hash_tags;
 2053|  4.54k|    uint8_t* const buf_extras = ctx->buf_extras;
 2054|  4.54k|    uint16_t* const chain_table = ctx->chain_table;
 2055|  4.54k|    uint8_t* const literals = ctx->literals;
 2056|  4.54k|    uint32_t* const buf_sequences = ctx->buf_sequences;
 2057|       |
 2058|  4.54k|    uint32_t seq_c = 0;
 2059|  4.54k|    size_t extras_c = 0;
 2060|  4.54k|    size_t lit_c = 0;
 2061|       |
 2062|  2.84M|    while (LIKELY(ip < search_limit)) {
  ------------------
  |  |  148|  2.84M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 2.83M, False: 4.54k]
  |  |  ------------------
  ------------------
 2063|  2.83M|        size_t dist = (size_t)(ip - anchor);
 2064|  2.83M|        size_t step = lzp.step_base + (dist >> lzp.step_shift);
 2065|  2.83M|        if (UNLIKELY(ip + step >= search_limit)) step = 1;
  ------------------
  |  |  154|  2.83M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 51.8k, False: 2.78M]
  |  |  ------------------
  ------------------
 2066|       |
 2067|  2.83M|        ZXC_PREFETCH_READ(ip + step * 4 + ZXC_CACHE_LINE_SIZE);
  ------------------
  |  |  165|  2.83M|#define ZXC_PREFETCH_READ(ptr) __builtin_prefetch((const void*)(ptr), 0, 3)
  ------------------
 2068|       |
 2069|  2.83M|        if (LIKELY(ip + step + sizeof(uint64_t) <= iend)) {
  ------------------
  |  |  148|  2.83M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 2.83M, False: 0]
  |  |  ------------------
  ------------------
 2070|  2.83M|            const uint64_t v_next = zxc_le64(ip + step);
 2071|       |            // cppcheck-suppress unreadVariable
 2072|  2.83M|            const uint32_t h_next = zxc_hash_func(v_next, 0);
 2073|  2.83M|            ZXC_PREFETCH_READ(&hash_tags[h_next]);
  ------------------
  |  |  165|  2.83M|#define ZXC_PREFETCH_READ(ptr) __builtin_prefetch((const void*)(ptr), 0, 3)
  ------------------
 2074|  2.83M|            ZXC_PREFETCH_READ(&hash_table[h_next]);
  ------------------
  |  |  165|  2.83M|#define ZXC_PREFETCH_READ(ptr) __builtin_prefetch((const void*)(ptr), 0, 3)
  ------------------
 2075|  2.83M|        }
 2076|       |
 2077|  2.83M|        const zxc_match_t m =
 2078|  2.83M|            zxc_lz77_find_best_match(src, ip, iend, search_limit, anchor, hash_table, hash_tags,
 2079|  2.83M|                                     chain_table, epoch_mark, offset_mask, level, lzp,
 2080|  2.83M|                                     /*last_off=*/0U);
 2081|       |
 2082|  2.83M|        if (m.ref) {
  ------------------
  |  Branch (2082:13): [True: 402k, False: 2.43M]
  ------------------
 2083|   402k|            ip -= m.backtrack;
 2084|   402k|            const uint32_t ll = (uint32_t)(ip - anchor);
 2085|   402k|            const uint32_t ml = m.len - ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  575|   402k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 2086|   402k|            const uint32_t off = (uint32_t)(ip - m.ref);
 2087|       |
 2088|   402k|            if (ll > 0) zxc_flush_literals(literals, &lit_c, anchor, ll, iend);
  ------------------
  |  Branch (2088:17): [True: 263k, False: 138k]
  ------------------
 2089|       |
 2090|   402k|            const uint32_t ll_write = (ll >= ZXC_SEQ_LL_MASK) ? ZXC_SEQ_LL_MASK : ll;
  ------------------
  |  |  528|   402k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  ------------------
  |  |  |  |  522|   402k|#define ZXC_SEQ_LL_BITS 8
  |  |  ------------------
  ------------------
                          const uint32_t ll_write = (ll >= ZXC_SEQ_LL_MASK) ? ZXC_SEQ_LL_MASK : ll;
  ------------------
  |  |  528|  8.63k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  ------------------
  |  |  |  |  522|  8.63k|#define ZXC_SEQ_LL_BITS 8
  |  |  ------------------
  ------------------
  |  Branch (2090:39): [True: 8.63k, False: 393k]
  ------------------
 2091|   402k|            const uint32_t ml_write = (ml >= ZXC_SEQ_ML_MASK) ? ZXC_SEQ_ML_MASK : ml;
  ------------------
  |  |  530|   402k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  524|   402k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  ------------------
                          const uint32_t ml_write = (ml >= ZXC_SEQ_ML_MASK) ? ZXC_SEQ_ML_MASK : ml;
  ------------------
  |  |  530|  13.5k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  524|  13.5k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  ------------------
  |  Branch (2091:39): [True: 13.5k, False: 388k]
  ------------------
 2092|   402k|            const uint32_t seq_val = (ll_write << ZXC_SEQ_LL_SHIFT) |
  ------------------
  |  |  534|   402k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  524|   402k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  526|   402k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
 2093|   402k|                                     (ml_write << ZXC_SEQ_ML_SHIFT) |
  ------------------
  |  |  536|   402k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  ------------------
  |  |  |  |  526|   402k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
 2094|   402k|                                     ((off - ZXC_LZ_OFFSET_BIAS) & ZXC_SEQ_OFF_MASK);
  ------------------
  |  |  676|   402k|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
                                                   ((off - ZXC_LZ_OFFSET_BIAS) & ZXC_SEQ_OFF_MASK);
  ------------------
  |  |  532|   402k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  ------------------
  |  |  |  |  526|   402k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
 2095|   402k|            buf_sequences[seq_c] = seq_val;
 2096|   402k|            seq_c++;
 2097|       |
 2098|   402k|            if (UNLIKELY(!zxc_emit_extra(buf_extras, &extras_c, ll, ZXC_SEQ_LL_MASK) ||
  ------------------
  |  |  154|   804k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 402k]
  |  |  |  Branch (154:42): [True: 0, False: 402k]
  |  |  |  Branch (154:42): [True: 0, False: 402k]
  |  |  ------------------
  ------------------
 2099|   402k|                         !zxc_emit_extra(buf_extras, &extras_c, ml, ZXC_SEQ_ML_MASK)))
 2100|      0|                return ZXC_ERROR_OVERFLOW;
 2101|       |
 2102|   402k|            ip += m.len;
 2103|   402k|            anchor = ip;
 2104|  2.43M|        } else {
 2105|  2.43M|            ip += step;
 2106|  2.43M|        }
 2107|  2.83M|    }
 2108|       |
 2109|  4.54k|    const size_t last_lits = (size_t)(iend - anchor);
 2110|  4.54k|    if (last_lits > 0) {
  ------------------
  |  Branch (2110:9): [True: 4.14k, False: 402]
  ------------------
 2111|  4.14k|        ZXC_MEMCPY(literals + lit_c, anchor, last_lits);
  ------------------
  |  |  170|  4.14k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2112|  4.14k|        lit_c += last_lits;
 2113|  4.14k|    }
 2114|       |
 2115|  4.54k|    zxc_block_header_t bh = {.block_type = ZXC_BLOCK_PAK};
 2116|  4.54k|    uint8_t* const p = dst + ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  428|  4.54k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 2117|  4.54k|    size_t rem = dst_cap - ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  428|  4.54k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 2118|       |
 2119|  4.54k|    const zxc_gnr_header_t gh = {.n_sequences = seq_c,
 2120|  4.54k|                                 .n_literals = (uint32_t)lit_c,
 2121|  4.54k|                                 .enc_lit = ZXC_SECTION_ENCODING_RAW,
 2122|  4.54k|                                 .enc_tok = 0,
 2123|  4.54k|                                 .enc_mlen = 0,
 2124|  4.54k|                                 .enc_off = 0};
 2125|       |
 2126|  4.54k|    const int ghs = zxc_write_pak_header(p, rem, &gh);
 2127|  4.54k|    if (UNLIKELY(ghs < 0)) return ghs;
  ------------------
  |  |  154|  4.54k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 4.54k]
  |  |  ------------------
  ------------------
 2128|       |
 2129|  4.54k|    uint8_t* p_curr = p + ghs;
 2130|  4.54k|    rem -= (size_t)ghs;
 2131|       |
 2132|  4.54k|    const size_t sz_lit = lit_c;
 2133|  4.54k|    const size_t sz_seq = seq_c * sizeof(uint32_t);
 2134|  4.54k|    const size_t sz_ext = extras_c;
 2135|       |
 2136|       |    // See the SPL twin. PAK literals are always RAW, so the slack always
 2137|       |    // matters here.
 2138|  4.54k|    const size_t behind_lit = sz_seq + sz_ext;
 2139|  4.54k|    const size_t pad = (behind_lit < ZXC_BLOCK_LIT_SLACK) ? ZXC_BLOCK_LIT_SLACK - behind_lit : 0;
  ------------------
  |  |  345|  4.54k|#define ZXC_BLOCK_LIT_SLACK 32
  ------------------
                  const size_t pad = (behind_lit < ZXC_BLOCK_LIT_SLACK) ? ZXC_BLOCK_LIT_SLACK - behind_lit : 0;
  ------------------
  |  |  345|  2.31k|#define ZXC_BLOCK_LIT_SLACK 32
  ------------------
  |  Branch (2139:24): [True: 2.31k, False: 2.23k]
  ------------------
 2140|       |
 2141|  4.54k|    if (UNLIKELY(rem < sz_lit + sz_seq + sz_ext + pad)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  4.54k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 4.54k]
  |  |  ------------------
  ------------------
 2142|       |
 2143|  4.54k|    ZXC_MEMCPY(p_curr, literals, lit_c);
  ------------------
  |  |  170|  4.54k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2144|  4.54k|    p_curr += lit_c;
 2145|       |
 2146|       |    // Write sequences in little-endian order
 2147|       |#ifdef ZXC_BIG_ENDIAN
 2148|       |    for (uint32_t i = 0; i < seq_c; i++) {
 2149|       |        zxc_store_le32(p_curr, buf_sequences[i]);
 2150|       |        p_curr += sizeof(uint32_t);
 2151|       |    }
 2152|       |#else
 2153|  4.54k|    ZXC_MEMCPY(p_curr, buf_sequences, sz_seq);
  ------------------
  |  |  170|  4.54k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2154|  4.54k|    p_curr += sz_seq;
 2155|  4.54k|#endif
 2156|       |
 2157|       |    // --- WRITE EXTRAS ---
 2158|  4.54k|    ZXC_MEMCPY(p_curr, buf_extras, sz_ext);
  ------------------
  |  |  170|  4.54k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2159|  4.54k|    p_curr += sz_ext;
 2160|       |
 2161|  4.54k|    ZXC_MEMSET(p_curr, 0, pad);
  ------------------
  |  |  175|  4.54k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 2162|  4.54k|    p_curr += pad;
 2163|       |
 2164|  4.54k|    bh.comp_size = (uint32_t)(p_curr - (dst + ZXC_BLOCK_HEADER_SIZE));
  ------------------
  |  |  428|  4.54k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 2165|  4.54k|    const int hw = zxc_write_block_header(dst, dst_cap, &bh);
 2166|  4.54k|    if (UNLIKELY(hw < 0)) return hw;
  ------------------
  |  |  154|  4.54k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 4.54k]
  |  |  ------------------
  ------------------
 2167|       |
 2168|       |    // Checksum will be appended by the wrapper
 2169|  4.54k|    *out_sz = ZXC_BLOCK_HEADER_SIZE + bh.comp_size;
  ------------------
  |  |  428|  4.54k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 2170|  4.54k|    return ZXC_OK;
 2171|  4.54k|}
zxc_compress.c:zxc_hash_tag:
   61|  53.0M|static ZXC_ALWAYS_INLINE uint8_t zxc_hash_tag(const uint32_t val4) {
   62|  53.0M|    return (uint8_t)(val4 ^ (val4 >> 16));
   63|  53.0M|}
zxc_compress.c:zxc_epoch_pos:
   72|  51.0M|                                                const uint32_t epoch_mark) {
   73|  51.0M|    return ((head & ~offset_mask) == epoch_mark) ? (head & offset_mask) : 0;
  ------------------
  |  Branch (73:12): [True: 33.0M, False: 17.9M]
  ------------------
   74|  51.0M|}
zxc_compress.c:zxc_chain_delta:
   82|  52.0M|static ZXC_ALWAYS_INLINE uint16_t zxc_chain_delta(const uint32_t cur_pos, const uint32_t prev_idx) {
   83|  52.0M|    const uint32_t dist = cur_pos - prev_idx;
   84|       |    // cppcheck-suppress bitwiseOnBoolean
   85|  52.0M|    const uint32_t valid = 0U - (uint32_t)((prev_idx != 0) & (dist < ZXC_LZ_WINDOW_SIZE));
  ------------------
  |  |  571|  52.0M|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  ------------------
   86|  52.0M|    return (uint16_t)(dist & valid);
   87|  52.0M|}
zxc_compress.c:zxc_hash_func:
   45|  59.6M|static ZXC_ALWAYS_INLINE uint32_t zxc_hash_func(const uint64_t val, const int use_hash5) {
   46|  59.6M|    if (use_hash5) {
  ------------------
  |  Branch (46:9): [True: 54.0M, False: 5.67M]
  ------------------
   47|  54.0M|        const uint64_t v5 = val & 0xFFFFFFFFFFULL;
   48|  54.0M|        return (uint32_t)((v5 * ZXC_HASH_XORSHIFT64) >> (64 - ZXC_LZ_HASH_BITS));
  ------------------
  |  |  751|  54.0M|#define ZXC_HASH_XORSHIFT64 0x2545F4914F6CDD1DULL
  ------------------
                      return (uint32_t)((v5 * ZXC_HASH_XORSHIFT64) >> (64 - ZXC_LZ_HASH_BITS));
  ------------------
  |  |  567|  54.0M|#define ZXC_LZ_HASH_BITS 15
  ------------------
   49|  54.0M|    } else {
   50|  5.67M|        const uint64_t v4 = val ^ (val >> 15);
   51|  5.67M|        return ((uint32_t)v4 * ZXC_HASH_MULT32) >> (32 - ZXC_LZ_HASH_BITS);
  ------------------
  |  |  753|  5.67M|#define ZXC_HASH_MULT32 0x2D35182DU
  ------------------
                      return ((uint32_t)v4 * ZXC_HASH_MULT32) >> (32 - ZXC_LZ_HASH_BITS);
  ------------------
  |  |  567|  5.67M|#define ZXC_LZ_HASH_BITS 15
  ------------------
   52|  5.67M|    }
   53|  59.6M|}
zxc_compress.c:zxc_lz77_find_best_match:
  572|  51.9M|    const int level, const zxc_lz77_params_t p, const uint32_t last_off) {
  573|  51.9M|    const int use_hash5 = (level >= ZXC_LEVEL_DEFAULT);
  574|       |    // Sentinel length just below the minimum, so any valid match replaces it.
  575|  51.9M|    zxc_match_t best = (zxc_match_t){NULL, ZXC_LZ_MIN_MATCH_LEN - 1, 0};
  ------------------
  |  |  575|  51.9M|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
  576|       |
  577|  51.9M|    uint64_t cur_val8 = zxc_le64(ip);
  578|  51.9M|    uint32_t cur_val = (uint32_t)cur_val8;
  579|  51.9M|    uint32_t h = zxc_hash_func(cur_val8, use_hash5);
  580|       |
  581|       |    // 8-bit tag: XOR fold of first 4 bytes for fast rejection
  582|  51.9M|    const uint8_t cur_tag = zxc_hash_tag(cur_val);
  583|       |
  584|  51.9M|    const uint32_t cur_pos = (uint32_t)(ip - src);
  585|       |
  586|       |    // Tag-first filter on fast levels.
  587|  51.9M|    const uint8_t stored_tag = hash_tags[h];
  588|  51.9M|    uint32_t match_idx;
  589|  51.9M|    if (level <= ZXC_LEVEL_FAST && stored_tag != cur_tag) {
  ------------------
  |  Branch (589:9): [True: 2.83M, False: 49.0M]
  |  Branch (589:36): [True: 1.96M, False: 869k]
  ------------------
  590|  1.96M|        match_idx = 0;
  591|  49.9M|    } else {
  592|  49.9M|        match_idx = zxc_epoch_pos(hash_table[h], offset_mask, epoch_mark);
  593|  49.9M|    }
  594|       |
  595|       |    // skip_head still drives the chain walk on level >= 3 (advances past the
  596|       |    // mismatched head without comparing). On level <= 2 it is always 0 here:
  597|       |    // either match_idx == 0 (filter-skip) or stored_tag == cur_tag.
  598|       |    // cppcheck-suppress bitwiseOnBoolean
  599|  51.9M|    const int skip_head = (match_idx != 0) & (stored_tag != cur_tag);
  600|       |
  601|       |    // Split table writes
  602|  51.9M|    hash_table[h] = epoch_mark | cur_pos;
  603|  51.9M|    hash_tags[h] = cur_tag;
  604|       |
  605|  51.9M|    chain_table[cur_pos & ZXC_LZ_WINDOW_MASK] = zxc_chain_delta(cur_pos, match_idx);
  ------------------
  |  |  573|  51.9M|#define ZXC_LZ_WINDOW_MASK (ZXC_LZ_WINDOW_SIZE - 1U)
  |  |  ------------------
  |  |  |  |  571|  51.9M|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  |  |  ------------------
  ------------------
  606|       |
  607|  51.9M|    int attempts = p.search_depth;
  608|       |
  609|       |    // Repeat-offset seed (level-6 parser passes last_off; others pass 0).
  610|       |    // Probing the previous offset first often finds the longest match right
  611|       |    // away, speeding up the chain walk. It only raises best.len, never lowers
  612|       |    // it, so the result is unchanged - this is purely a speed optimization.
  613|  51.9M|    if (last_off != 0U && last_off >= p.min_offset && last_off <= (uint32_t)ZXC_LZ_MAX_DIST &&
  ------------------
  |  |  678|  95.5M|#define ZXC_LZ_MAX_DIST (ZXC_LZ_WINDOW_SIZE - 1)
  |  |  ------------------
  |  |  |  |  571|  43.6M|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  |  |  ------------------
  ------------------
  |  Branch (613:9): [True: 43.6M, False: 8.22M]
  |  Branch (613:27): [True: 43.6M, False: 0]
  |  Branch (613:55): [True: 43.6M, False: 0]
  ------------------
  614|  43.6M|        last_off <= cur_pos) {
  ------------------
  |  Branch (614:9): [True: 43.6M, False: 0]
  ------------------
  615|  43.6M|        const uint8_t* const rep_ref = src + (cur_pos - last_off);
  616|  43.6M|        if (zxc_le32(rep_ref) == cur_val) {
  ------------------
  |  Branch (616:13): [True: 14.1M, False: 29.5M]
  ------------------
  617|  14.1M|            uint32_t mlen = sizeof(uint32_t);
  618|  14.1M|            const uint8_t* const limit_8 = iend - sizeof(uint64_t);
  619|  67.2M|            while (ip + mlen < limit_8) {
  ------------------
  |  Branch (619:20): [True: 67.2M, False: 29.3k]
  ------------------
  620|  67.2M|                const uint64_t diff = zxc_le64(ip + mlen) ^ zxc_le64(rep_ref + mlen);
  621|  67.2M|                if (diff == 0) {
  ------------------
  |  Branch (621:21): [True: 53.0M, False: 14.1M]
  ------------------
  622|  53.0M|                    mlen += sizeof(uint64_t);
  623|  53.0M|                } else {
  624|  14.1M|                    mlen += (uint32_t)(zxc_ctz64(diff) >> 3);
  625|  14.1M|                    goto _rep_done;
  626|  14.1M|                }
  627|  67.2M|            }
  628|   135k|            while (ip + mlen < iend && rep_ref[mlen] == ip[mlen]) mlen++;
  ------------------
  |  Branch (628:20): [True: 119k, False: 16.6k]
  |  Branch (628:40): [True: 106k, False: 12.6k]
  ------------------
  629|  14.1M|        _rep_done:;
  630|  14.1M|            best.len = mlen;
  631|  14.1M|            best.ref = rep_ref;
  632|  14.1M|            if (UNLIKELY(best.len >= (uint32_t)p.sufficient_len || ip + best.len >= iend))
  ------------------
  |  |  154|  28.3M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 19.2k, False: 14.1M]
  |  |  |  Branch (154:42): [True: 2.58k, False: 14.1M]
  |  |  |  Branch (154:42): [True: 16.6k, False: 14.1M]
  |  |  ------------------
  ------------------
  633|  19.2k|                goto _finalize_match;
  634|  14.1M|        }
  635|  43.6M|    }
  636|       |
  637|  51.8M|    if (match_idx == 0) goto _finalize_match;
  ------------------
  |  Branch (637:9): [True: 19.7M, False: 32.1M]
  ------------------
  638|       |
  639|       |    // Optimization: If head tag doesn't match, advance immediately without loading the first
  640|       |    // mismatch.
  641|  32.1M|    if (skip_head) {
  ------------------
  |  Branch (641:9): [True: 16.4M, False: 15.6M]
  ------------------
  642|  16.4M|        const uint16_t delta = chain_table[match_idx & ZXC_LZ_WINDOW_MASK];
  ------------------
  |  |  573|  16.4M|#define ZXC_LZ_WINDOW_MASK (ZXC_LZ_WINDOW_SIZE - 1U)
  |  |  ------------------
  |  |  |  |  571|  16.4M|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  |  |  ------------------
  ------------------
  643|  16.4M|        const uint32_t next_idx = match_idx - delta;
  644|  16.4M|        match_idx = (delta != 0) ? next_idx : 0;
  ------------------
  |  Branch (644:21): [True: 9.51M, False: 6.95M]
  ------------------
  645|  16.4M|        attempts--;
  646|  16.4M|    }
  647|       |
  648|  1.03G|    while (match_idx > 0) {
  ------------------
  |  Branch (648:12): [True: 1.01G, False: 19.2M]
  ------------------
  649|  1.01G|        if (UNLIKELY(attempts-- < 0 || cur_pos - match_idx > ZXC_LZ_MAX_DIST)) break;
  ------------------
  |  |  154|  2.01G|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 12.6M, False: 1.00G]
  |  |  |  Branch (154:42): [True: 6.97M, False: 1.00G]
  |  |  |  Branch (154:42): [True: 5.69M, False: 1.00G]
  |  |  ------------------
  ------------------
  650|  1.00G|        const uint8_t* ref = src + match_idx;
  651|       |
  652|       |        // Load the next chain link early (before the compare) so its address
  653|       |        // resolves while we prefetch. The prefetch aims at the next gate for
  654|       |        // the current best.len; a longer match found here moves that gate.
  655|  1.00G|        const uint16_t delta = chain_table[match_idx & ZXC_LZ_WINDOW_MASK];
  ------------------
  |  |  573|  1.00G|#define ZXC_LZ_WINDOW_MASK (ZXC_LZ_WINDOW_SIZE - 1U)
  |  |  ------------------
  |  |  |  |  571|  1.00G|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  |  |  ------------------
  ------------------
  656|  1.00G|        const uint32_t next_idx = match_idx - delta;
  657|  1.00G|        ZXC_PREFETCH_READ(src + next_idx + best.len - 3);
  ------------------
  |  |  165|  1.00G|#define ZXC_PREFETCH_READ(ptr) __builtin_prefetch((const void*)(ptr), 0, 3)
  ------------------
  658|       |
  659|       |        // Gate first: most candidates share the head and fail on bytes
  660|       |        // [best.len-3, best.len], which a longer match must also cover.
  661|  1.00G|        const int should_compare = (cur_pos - match_idx) >= p.min_offset &&
  ------------------
  |  Branch (661:36): [True: 999M, False: 354k]
  ------------------
  662|   999M|                                   zxc_le32(ref + best.len - 3) == zxc_le32(ip + best.len - 3) &&
  ------------------
  |  Branch (662:36): [True: 50.3M, False: 949M]
  ------------------
  663|  50.3M|                                   zxc_le32(ref) == cur_val;
  ------------------
  |  Branch (663:36): [True: 50.3M, False: 13.7k]
  ------------------
  664|       |
  665|  1.00G|        if (should_compare) {
  ------------------
  |  Branch (665:13): [True: 50.3M, False: 949M]
  ------------------
  666|  50.3M|            uint32_t mlen = sizeof(uint32_t);  // We already know the first 4 bytes match
  667|       |
  668|       |            // Fast path: Scalar 64-bit comparison for short matches (=< 64 bytes)
  669|       |            // Most matches are short, so this avoids SIMD overhead for common cases
  670|  50.3M|            const uint8_t* limit_8 = iend - sizeof(uint64_t);
  671|  50.3M|            const uint8_t* scalar_limit = ip + mlen + 64;
  672|  50.3M|            if (scalar_limit > limit_8) scalar_limit = limit_8;
  ------------------
  |  Branch (672:17): [True: 104k, False: 50.2M]
  ------------------
  673|       |
  674|   105M|            while (ip + mlen < scalar_limit) {
  ------------------
  |  Branch (674:20): [True: 104M, False: 1.15M]
  ------------------
  675|   104M|                uint64_t diff = zxc_le64(ip + mlen) ^ zxc_le64(ref + mlen);
  676|   104M|                if (diff == 0)
  ------------------
  |  Branch (676:21): [True: 55.3M, False: 49.2M]
  ------------------
  677|  55.3M|                    mlen += sizeof(uint64_t);
  678|  49.2M|                else {
  679|  49.2M|                    mlen += (uint32_t)zxc_ctz64(diff) >> 3;
  680|  49.2M|                    goto _match_len_done;
  681|  49.2M|                }
  682|   104M|            }
  683|       |
  684|       |            // Long match path: Use SIMD for matches exceeding 64 bytes
  685|       |#if defined(ZXC_USE_AVX512)
  686|       |            const uint8_t* limit_64 = iend - 64;
  687|       |            while (ip + mlen < limit_64) {
  688|       |                const __m512i v_src = _mm512_loadu_si512((const void*)(ip + mlen));
  689|       |                const __m512i v_ref = _mm512_loadu_si512((const void*)(ref + mlen));
  690|       |                const __mmask64 mask = _mm512_cmpeq_epi8_mask(v_src, v_ref);
  691|       |                if (mask == 0xFFFFFFFFFFFFFFFF)
  692|       |                    mlen += 64;
  693|       |                else {
  694|       |                    mlen += (uint32_t)zxc_ctz64(~mask);
  695|       |                    goto _match_len_done;
  696|       |                }
  697|       |            }
  698|       |#elif defined(ZXC_USE_AVX2)
  699|       |            const uint8_t* limit_32 = iend - 32;
  700|       |            while (ip + mlen < limit_32) {
  701|       |                const __m256i v_src = _mm256_loadu_si256((const __m256i*)(ip + mlen));
  702|       |                const __m256i v_ref = _mm256_loadu_si256((const __m256i*)(ref + mlen));
  703|       |                const __m256i v_cmp = _mm256_cmpeq_epi8(v_src, v_ref);
  704|       |                const uint32_t mask = (uint32_t)_mm256_movemask_epi8(v_cmp);
  705|       |                if (mask == 0xFFFFFFFF)
  706|       |                    mlen += 32;
  707|       |                else {
  708|       |                    mlen += (uint32_t)zxc_ctz32(~mask);
  709|       |                    goto _match_len_done;
  710|       |                }
  711|       |            }
  712|       |#elif defined(ZXC_USE_SSE2)
  713|  1.15M|            const uint8_t* limit_16 = iend - 16;
  714|  4.44M|            while (ip + mlen < limit_16) {
  ------------------
  |  Branch (714:20): [True: 4.42M, False: 16.0k]
  ------------------
  715|  4.42M|                const __m128i v_src = _mm_loadu_si128((const __m128i*)(ip + mlen));
  716|  4.42M|                const __m128i v_ref = _mm_loadu_si128((const __m128i*)(ref + mlen));
  717|  4.42M|                const __m128i v_cmp = _mm_cmpeq_epi8(v_src, v_ref);
  718|  4.42M|                const uint32_t mask = (uint32_t)_mm_movemask_epi8(v_cmp);
  719|  4.42M|                if (mask == 0xFFFFU)
  ------------------
  |  Branch (719:21): [True: 3.28M, False: 1.14M]
  ------------------
  720|  3.28M|                    mlen += 16;
  721|  1.14M|                else {
  722|       |                    // mask != 0xFFFF => a differing byte exists in bits 0..15,
  723|       |                    // so the lowest set bit of ~mask lies in that range.
  724|  1.14M|                    mlen += (uint32_t)zxc_ctz32(~mask);
  725|  1.14M|                    goto _match_len_done;
  726|  1.14M|                }
  727|  4.42M|            }
  728|       |#elif defined(ZXC_USE_NEON64)
  729|       |            {
  730|       |                const uint8_t* limit_32 = iend - 32;
  731|       |                while (ip + mlen < limit_32) {
  732|       |                    const uint8x16_t s0 = vld1q_u8(ip + mlen);
  733|       |                    const uint8x16_t r0 = vld1q_u8(ref + mlen);
  734|       |                    const uint8x16_t c0 = vceqq_u8(s0, r0);
  735|       |                    const uint64_t m0 = vget_lane_u64(
  736|       |                        vreinterpret_u64_u8(vshrn_n_u16(vreinterpretq_u16_u8(c0), 4)), 0);
  737|       |                    if (UNLIKELY(m0 != ~(uint64_t)0)) {
  738|       |                        mlen += (uint32_t)(zxc_ctz64(~m0) >> 2);
  739|       |                        goto _match_len_done;
  740|       |                    }
  741|       |                    const uint8x16_t s1 = vld1q_u8(ip + mlen + 16);
  742|       |                    const uint8x16_t r1 = vld1q_u8(ref + mlen + 16);
  743|       |                    const uint8x16_t c1 = vceqq_u8(s1, r1);
  744|       |                    const uint64_t m1 = vget_lane_u64(
  745|       |                        vreinterpret_u64_u8(vshrn_n_u16(vreinterpretq_u16_u8(c1), 4)), 0);
  746|       |                    if (UNLIKELY(m1 != ~(uint64_t)0)) {
  747|       |                        mlen += 16 + (uint32_t)(zxc_ctz64(~m1) >> 2);
  748|       |                        goto _match_len_done;
  749|       |                    }
  750|       |                    mlen += 32;
  751|       |                }
  752|       |                if (ip + mlen < iend - 16) {
  753|       |                    const uint8x16_t v_src = vld1q_u8(ip + mlen);
  754|       |                    const uint8x16_t v_ref = vld1q_u8(ref + mlen);
  755|       |                    const uint8x16_t v_cmp = vceqq_u8(v_src, v_ref);
  756|       |                    const uint64_t mask = vget_lane_u64(
  757|       |                        vreinterpret_u64_u8(vshrn_n_u16(vreinterpretq_u16_u8(v_cmp), 4)), 0);
  758|       |                    if (LIKELY(mask == ~(uint64_t)0))
  759|       |                        mlen += 16;
  760|       |                    else {
  761|       |                        mlen += (uint32_t)(zxc_ctz64(~mask) >> 2);
  762|       |                        goto _match_len_done;
  763|       |                    }
  764|       |                }
  765|       |            }
  766|       |#elif defined(ZXC_USE_NEON32)
  767|       |            {
  768|       |                const uint8_t* limit_16 = iend - 16;
  769|       |                while (ip + mlen < limit_16) {
  770|       |                    const uint8x16_t v_src = vld1q_u8(ip + mlen);
  771|       |                    const uint8x16_t v_ref = vld1q_u8(ref + mlen);
  772|       |                    const uint8x16_t v_cmp = vceqq_u8(v_src, v_ref);
  773|       |                    uint8x8_t p1 = vpmin_u8(vget_low_u8(v_cmp), vget_high_u8(v_cmp));
  774|       |                    uint8x8_t p2 = vpmin_u8(p1, p1);
  775|       |                    uint8x8_t p3 = vpmin_u8(p2, p2);
  776|       |                    uint8x8_t p4 = vpmin_u8(p3, p3);
  777|       |                    uint8_t min_val = vget_lane_u8(p4, 0);
  778|       |                    if (min_val == 0xFF)
  779|       |                        mlen += 16;
  780|       |                    else {
  781|       |                        uint8x16_t v_diff = vmvnq_u8(v_cmp);
  782|       |                        uint64_t lo =
  783|       |                            (uint64_t)vgetq_lane_u32(vreinterpretq_u32_u8(v_diff), 0) |
  784|       |                            ((uint64_t)vgetq_lane_u32(vreinterpretq_u32_u8(v_diff), 1) << 32);
  785|       |                        if (lo != 0)
  786|       |                            mlen += (zxc_ctz64(lo) >> 3);
  787|       |                        else
  788|       |                            mlen +=
  789|       |                                8 + (zxc_ctz64(
  790|       |                                         (uint64_t)vgetq_lane_u32(vreinterpretq_u32_u8(v_diff), 2) |
  791|       |                                         ((uint64_t)vgetq_lane_u32(vreinterpretq_u32_u8(v_diff), 3)
  792|       |                                          << 32)) >>
  793|       |                                     3);
  794|       |                        goto _match_len_done;
  795|       |                    }
  796|       |                }
  797|       |            }
  798|       |#endif
  799|  16.4k|            while (ip + mlen < limit_8) {
  ------------------
  |  Branch (799:20): [True: 1.69k, False: 14.8k]
  ------------------
  800|  1.69k|                const uint64_t diff = zxc_le64(ip + mlen) ^ zxc_le64(ref + mlen);
  801|  1.69k|                if (diff == 0)
  ------------------
  |  Branch (801:21): [True: 449, False: 1.24k]
  ------------------
  802|    449|                    mlen += sizeof(uint64_t);
  803|  1.24k|                else {
  804|  1.24k|                    mlen += (uint32_t)zxc_ctz64(diff) >> 3;
  805|  1.24k|                    goto _match_len_done;
  806|  1.24k|                }
  807|  1.69k|            }
  808|  45.1k|            while (ip + mlen < iend && ref[mlen] == ip[mlen]) mlen++;
  ------------------
  |  Branch (808:20): [True: 43.7k, False: 1.40k]
  |  Branch (808:40): [True: 30.3k, False: 13.3k]
  ------------------
  809|       |
  810|  50.3M|        _match_len_done:;
  811|  50.3M|            const int better = (mlen > best.len);
  812|  50.3M|            best.len = better ? mlen : best.len;
  ------------------
  |  Branch (812:24): [True: 5.58M, False: 44.7M]
  ------------------
  813|  50.3M|            best.ref = better ? ref : best.ref;
  ------------------
  |  Branch (813:24): [True: 5.58M, False: 44.7M]
  ------------------
  814|       |
  815|  50.3M|            if (UNLIKELY(best.len >= (uint32_t)p.sufficient_len || ip + best.len >= iend)) break;
  ------------------
  |  |  154|   100M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 232k, False: 50.1M]
  |  |  |  Branch (154:42): [True: 231k, False: 50.1M]
  |  |  |  Branch (154:42): [True: 1.00k, False: 50.1M]
  |  |  ------------------
  ------------------
  816|  50.3M|        }
  817|       |
  818|   999M|        match_idx = (delta != 0) ? next_idx : 0;
  ------------------
  |  Branch (818:21): [True: 987M, False: 12.2M]
  ------------------
  819|   999M|    }
  820|       |
  821|  51.9M|_finalize_match:
  822|  51.9M|    if (best.ref) {
  ------------------
  |  Branch (822:9): [True: 16.0M, False: 35.8M]
  ------------------
  823|       |        // Backtrack to extend match backwards
  824|  16.0M|        const uint8_t* b_ip = ip;
  825|  16.0M|        const uint8_t* b_ref = best.ref;
  826|  16.6M|        while (b_ip > anchor && b_ref > src && b_ip[-1] == b_ref[-1]) {
  ------------------
  |  Branch (826:16): [True: 1.13M, False: 15.4M]
  |  Branch (826:33): [True: 1.12M, False: 921]
  |  Branch (826:48): [True: 527k, False: 602k]
  ------------------
  827|   527k|            b_ip--;
  828|   527k|            b_ref--;
  829|   527k|            best.len++;
  830|   527k|            best.backtrack++;
  831|   527k|        }
  832|  16.0M|        best.ref = b_ref;
  833|  16.0M|    }
  834|       |
  835|       |    // Lazy: a match two bytes longer at ip+1, or from level 4 three bytes longer
  836|       |    // at ip+2, cancels this one.
  837|  51.9M|    if (p.use_lazy && best.ref && best.len < (uint32_t)p.lazy_len_threshold &&
  ------------------
  |  Branch (837:9): [True: 3.82M, False: 48.0M]
  |  Branch (837:23): [True: 571k, False: 3.24M]
  |  Branch (837:35): [True: 558k, False: 13.0k]
  ------------------
  838|   558k|        ip + 1 < search_limit) {
  ------------------
  |  Branch (838:9): [True: 557k, False: 385]
  ------------------
  839|   557k|        if (zxc_lazy_probe(src, ip + 1, iend, best.len + 2, hash_table, hash_tags, chain_table,
  ------------------
  |  Branch (839:13): [True: 90.8k, False: 467k]
  ------------------
  840|   557k|                           epoch_mark, offset_mask, use_hash5, p) ||
  841|   467k|            (level >= ZXC_LEVEL_BALANCED && ip + 2 < search_limit &&
  ------------------
  |  Branch (841:14): [True: 386k, False: 80.9k]
  |  Branch (841:45): [True: 385k, False: 229]
  ------------------
  842|   385k|             zxc_lazy_probe(src, ip + 2, iend, best.len + 3, hash_table, hash_tags, chain_table,
  ------------------
  |  Branch (842:14): [True: 13.0k, False: 372k]
  ------------------
  843|   385k|                            epoch_mark, offset_mask, use_hash5, p)))
  844|   103k|            best.ref = NULL;
  845|   557k|    }
  846|       |
  847|  51.9M|    return best;
  848|  32.1M|}
zxc_compress.c:zxc_lazy_probe:
  513|   943k|                                            const int use_hash5, const zxc_lz77_params_t p) {
  514|   943k|    if (need > (size_t)(iend - lp)) return 0;  // too close to the end to win
  ------------------
  |  Branch (514:9): [True: 1.43k, False: 942k]
  ------------------
  515|       |
  516|   942k|    const uint64_t val8 = zxc_le64(lp);
  517|   942k|    const uint32_t val = (uint32_t)val8;
  518|   942k|    const uint32_t h = zxc_hash_func(val8, use_hash5);
  519|   942k|    const uint32_t pos = (uint32_t)(lp - src);
  520|   942k|    const uint32_t gate = zxc_le32(lp + need - 4);
  521|   942k|    uint32_t idx = zxc_epoch_pos(hash_table[h], offset_mask, epoch_mark);
  522|       |    // A head with another tag is another string: walk past it.
  523|   942k|    int skip = (hash_tags[h] != zxc_hash_tag(val));
  524|       |
  525|  4.42M|    for (int att = p.lazy_attempts; idx > 0 && att > 0; att--) {
  ------------------
  |  Branch (525:37): [True: 4.27M, False: 149k]
  |  Branch (525:48): [True: 3.89M, False: 377k]
  ------------------
  526|  3.89M|        if (UNLIKELY(pos - idx > ZXC_LZ_MAX_DIST)) break;
  ------------------
  |  |  154|  3.89M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 37.1k, False: 3.86M]
  |  |  ------------------
  ------------------
  527|  3.86M|        const uint8_t* const ref = src + idx;
  528|       |
  529|       |        // Filtered here too: a lazy hit only cancels best.ref, so a match
  530|       |        // we could never emit would drop a legal one for nothing.
  531|  3.86M|        if (pos - idx >= p.min_offset && !skip && zxc_le32(ref + need - 4) == gate &&
  ------------------
  |  Branch (531:13): [True: 3.78M, False: 74.4k]
  |  Branch (531:42): [True: 3.73M, False: 49.4k]
  |  Branch (531:51): [True: 241k, False: 3.49M]
  ------------------
  532|   241k|            zxc_le32(ref) == val && zxc_match_reaches(lp, ref, sizeof(uint32_t), need, iend))
  ------------------
  |  Branch (532:13): [True: 240k, False: 1.06k]
  |  Branch (532:37): [True: 103k, False: 136k]
  ------------------
  533|   103k|            return 1;
  534|       |
  535|  3.75M|        const uint16_t delta = chain_table[idx & ZXC_LZ_WINDOW_MASK];
  ------------------
  |  |  573|  3.75M|#define ZXC_LZ_WINDOW_MASK (ZXC_LZ_WINDOW_SIZE - 1U)
  |  |  ------------------
  |  |  |  |  571|  3.75M|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  |  |  ------------------
  ------------------
  536|  3.75M|        if (UNLIKELY(delta == 0)) break;
  ------------------
  |  |  154|  3.75M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 274k, False: 3.48M]
  |  |  ------------------
  ------------------
  537|  3.48M|        idx -= delta;
  538|  3.48M|        skip = 0;
  539|  3.48M|    }
  540|   838k|    return 0;
  541|   942k|}
zxc_compress.c:zxc_match_reaches:
  487|   240k|                                               const uint8_t* iend) {
  488|   640k|    while (from < need) {
  ------------------
  |  Branch (488:12): [True: 587k, False: 53.0k]
  ------------------
  489|   587k|        if (UNLIKELY((size_t)(iend - cur) - from < sizeof(uint64_t))) {
  ------------------
  |  |  154|   587k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 397, False: 586k]
  |  |  ------------------
  ------------------
  490|  1.34k|            while (from < need && cur[from] == ref[from]) from++;
  ------------------
  |  Branch (490:20): [True: 1.15k, False: 197]
  |  Branch (490:35): [True: 950, False: 200]
  ------------------
  491|    397|            return from >= need;
  492|    397|        }
  493|   586k|        const uint64_t d = zxc_le64(cur + from) ^ zxc_le64(ref + from);
  494|   586k|        if (d != 0) return from + (uint32_t)(zxc_ctz64(d) >> 3) >= need;
  ------------------
  |  Branch (494:13): [True: 187k, False: 399k]
  ------------------
  495|   399k|        from += sizeof(uint64_t);
  496|   399k|    }
  497|  53.0k|    return 1;
  498|   240k|}
zxc_compress.c:zxc_flush_literals:
  445|   550k|                                                 const uint8_t* iend) {
  446|   550k|    if (LIKELY(anchor + ZXC_PAD_SIZE <= iend)) {
  ------------------
  |  |  148|   550k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 546k, False: 4.03k]
  |  |  ------------------
  ------------------
  447|   546k|        zxc_copy32(literals + *lit_c, anchor);
  448|   546k|        if (UNLIKELY(ll > ZXC_PAD_SIZE))
  ------------------
  |  |  154|   546k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 76.5k, False: 469k]
  |  |  ------------------
  ------------------
  449|  76.5k|            ZXC_MEMCPY(literals + *lit_c + ZXC_PAD_SIZE, anchor + ZXC_PAD_SIZE, ll - ZXC_PAD_SIZE);
  ------------------
  |  |  170|  76.5k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  450|   546k|    } else {
  451|  4.03k|        ZXC_MEMCPY(literals + *lit_c, anchor, ll);
  ------------------
  |  |  170|  4.03k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  452|  4.03k|    }
  453|   550k|    *lit_c += ll;
  454|   550k|}
zxc_compress.c:zxc_emit_extra:
  234|  4.08M|                                            const uint32_t val, const uint32_t mask) {
  235|  4.08M|    if (LIKELY(val < mask)) return 1;
  ------------------
  |  |  148|  4.08M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 3.54M, False: 541k]
  |  |  ------------------
  ------------------
  236|   541k|    const size_t n = zxc_write_varint(extras + *used, val - mask);
  237|   541k|    if (UNLIKELY(n == 0)) return 0;
  ------------------
  |  |  154|   541k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 541k]
  |  |  ------------------
  ------------------
  238|   541k|    *used += n;
  239|   541k|    return 1;
  240|   541k|}
zxc_compress.c:zxc_write_varint:
  198|   541k|static ZXC_ALWAYS_INLINE size_t zxc_write_varint(uint8_t* RESTRICT dst, const uint32_t val) {
  199|       |    // Values above ZXC_MAX_VARINT_VALUE are out-of-spec and the decoder would
  200|       |    // reject them. Unreachable from the Block API, so this is defence in depth;
  201|       |    // callers must treat a return of 0 as an encoding error.
  202|   541k|    if (UNLIKELY(val > ZXC_MAX_VARINT_VALUE)) {
  ------------------
  |  |  154|   541k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 541k]
  |  |  ------------------
  ------------------
  203|      0|        return 0;
  204|      0|    }
  205|       |
  206|       |    // 1 byte: 0xxxxxxx (7 bits)
  207|   541k|    if (LIKELY(val < ZXC_VARINT_1B_LIMIT)) {
  ------------------
  |  |  148|   541k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 455k, False: 85.3k]
  |  |  ------------------
  ------------------
  208|   455k|        dst[0] = (uint8_t)val;
  209|   455k|        return 1;
  210|   455k|    }
  211|       |
  212|       |    // 2 bytes: 10xxxxxx xxxxxxxx (14 bits)
  213|  85.3k|    if (LIKELY(val < ZXC_VARINT_2B_LIMIT)) {
  ------------------
  |  |  148|  85.3k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 84.6k, False: 757]
  |  |  ------------------
  ------------------
  214|  84.6k|        dst[0] = (uint8_t)(0x80 | (val & 0x3F));
  215|  84.6k|        dst[1] = (uint8_t)(val >> 6);
  216|  84.6k|        return 2;
  217|  84.6k|    }
  218|       |
  219|       |    // 3 bytes: 110xxxxx xxxxxxxx xxxxxxxx (21 bits) -> max emittable value,
  220|       |    // matching ZXC_MAX_VARINT_VALUE = ZXC_BLOCK_SIZE_MAX - 1.
  221|    757|    dst[0] = (uint8_t)(0xC0 | (val & 0x1F));
  222|    757|    dst[1] = (uint8_t)(val >> 5);
  223|    757|    dst[2] = (uint8_t)(val >> 13);
  224|    757|    return 3;
  225|  85.3k|}
zxc_compress.c:zxc_encode_block_spl:
 1421|  10.7k|                                size_t* RESTRICT out_sz) {
 1422|  10.7k|    if (UNLIKELY(dst_cap < ZXC_BLOCK_HEADER_SIZE)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  10.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 10.7k]
  |  |  ------------------
  ------------------
 1423|       |
 1424|  10.7k|    const int level = ctx->compression_level;
 1425|  10.7k|    const size_t dict_sz = ctx->dict_size;
 1426|       |
 1427|  10.7k|    zxc_lz77_params_t lzp = zxc_get_lz77_params(level);
 1428|       |    // The floor is a candidate until the block itself clears it.
 1429|  10.7k|    if (lzp.min_offset > 1 && zxc_block_is_short_dist_bound(src + dict_sz, src_sz - dict_sz))
  ------------------
  |  Branch (1429:9): [True: 5.61k, False: 5.14k]
  |  Branch (1429:31): [True: 4.66k, False: 952]
  ------------------
 1430|  4.66k|        lzp.min_offset = 1;
 1431|       |
 1432|  10.7k|    ctx->epoch++;
 1433|  10.7k|    if (UNLIKELY(ctx->epoch >= ctx->max_epoch)) {
  ------------------
  |  |  154|  10.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 10.7k]
  |  |  ------------------
  ------------------
 1434|      0|        ZXC_MEMSET(ctx->hash_table, 0, ZXC_LZ_HASH_SIZE * sizeof(uint32_t));
  ------------------
  |  |  175|      0|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 1435|      0|        ZXC_MEMSET(ctx->hash_tags, 0, ZXC_LZ_HASH_SIZE * sizeof(uint8_t));
  ------------------
  |  |  175|      0|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 1436|      0|        ctx->epoch = 1;
 1437|      0|    }
 1438|  10.7k|    const uint32_t offset_bits = ctx->offset_bits;
 1439|  10.7k|    const uint32_t offset_mask = ctx->offset_mask;
 1440|  10.7k|    const uint32_t epoch_mark = ctx->epoch << offset_bits;
 1441|       |
 1442|  10.7k|    if (dict_sz > 0)
  ------------------
  |  Branch (1442:9): [True: 0, False: 10.7k]
  ------------------
 1443|      0|        zxc_lz_seed_dict(src, dict_sz, ctx->hash_table, ctx->hash_tags, ctx->chain_table,
 1444|      0|                         epoch_mark, offset_mask, level);
 1445|       |
 1446|  10.7k|    const uint8_t* ip = src + dict_sz;
 1447|  10.7k|    const uint8_t* iend = src + src_sz;
 1448|  10.7k|    const uint8_t* anchor = ip;
 1449|  10.7k|    const uint8_t* search_limit = iend - ZXC_LZ_SEARCH_MARGIN;
  ------------------
  |  |  717|  10.7k|#define ZXC_LZ_SEARCH_MARGIN (sizeof(uint64_t))
  ------------------
 1450|       |
 1451|  10.7k|    uint32_t* const hash_table = ctx->hash_table;
 1452|  10.7k|    uint8_t* const hash_tags = ctx->hash_tags;
 1453|  10.7k|    uint16_t* const chain_table = ctx->chain_table;
 1454|  10.7k|    uint8_t* const literals = ctx->literals;
 1455|  10.7k|    uint8_t* const buf_tokens = ctx->buf_tokens;
 1456|  10.7k|    uint16_t* const buf_offsets = ctx->buf_offsets;
 1457|  10.7k|    uint8_t* const buf_extras = ctx->buf_extras;
 1458|       |
 1459|  10.7k|    uint32_t seq_c = 0;
 1460|  10.7k|    size_t lit_c = 0;
 1461|  10.7k|    size_t extras_sz = 0;
 1462|  10.7k|    uint16_t max_offset = 0;  // Track max offset for 1-byte/2-byte mode decision
 1463|       |
 1464|       |    // Level 6+: price-based optimal parser (fills outputs and skips the
 1465|       |    // lazy loop + last_lits handling below via `goto parse_done`).
 1466|  10.7k|    if (level >= ZXC_LEVEL_DENSITY) {
  ------------------
  |  Branch (1466:9): [True: 5.14k, False: 5.61k]
  ------------------
 1467|  5.14k|        const int rc = zxc_lz77_optimal_parse_spl(
 1468|  5.14k|            ctx, src, src_sz, hash_table, hash_tags, chain_table, epoch_mark, offset_mask, level,
 1469|  5.14k|            literals, buf_tokens, buf_offsets, buf_extras, &seq_c, &lit_c, &extras_sz, &max_offset);
 1470|  5.14k|        if (UNLIKELY(rc != 0)) return rc;
  ------------------
  |  |  154|  5.14k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 5.14k]
  |  |  ------------------
  ------------------
 1471|  5.14k|        goto parse_done;
 1472|  5.14k|    }
 1473|       |
 1474|  3.82M|    while (LIKELY(ip < search_limit)) {
  ------------------
  |  |  148|  3.82M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 3.82M, False: 5.61k]
  |  |  ------------------
  ------------------
 1475|  3.82M|        const size_t dist = (size_t)(ip - anchor);
 1476|  3.82M|        size_t step = lzp.step_base + (dist >> lzp.step_shift);
 1477|  3.82M|        if (UNLIKELY(ip + step >= search_limit)) step = 1;
  ------------------
  |  |  154|  3.82M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 40.3k, False: 3.77M]
  |  |  ------------------
  ------------------
 1478|       |
 1479|  3.82M|        if (LIKELY(ip + step + sizeof(uint64_t) <= iend)) {
  ------------------
  |  |  148|  3.82M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 3.82M, False: 0]
  |  |  ------------------
  ------------------
 1480|  3.82M|            const uint64_t v_next = zxc_le64(ip + step);
 1481|       |            // cppcheck-suppress unreadVariable
 1482|  3.82M|            const uint32_t h_next = zxc_hash_func(v_next, 1);
 1483|  3.82M|            ZXC_PREFETCH_READ(&hash_tags[h_next]);
  ------------------
  |  |  165|  3.82M|#define ZXC_PREFETCH_READ(ptr) __builtin_prefetch((const void*)(ptr), 0, 3)
  ------------------
 1484|  3.82M|            ZXC_PREFETCH_READ(&hash_table[h_next]);
  ------------------
  |  |  165|  3.82M|#define ZXC_PREFETCH_READ(ptr) __builtin_prefetch((const void*)(ptr), 0, 3)
  ------------------
 1485|  3.82M|        }
 1486|       |
 1487|  3.82M|        const zxc_match_t m =
 1488|  3.82M|            zxc_lz77_find_best_match(src, ip, iend, search_limit, anchor, hash_table, hash_tags,
 1489|  3.82M|                                     chain_table, epoch_mark, offset_mask, level, lzp,
 1490|  3.82M|                                     /*last_off=*/0U);
 1491|       |
 1492|  3.82M|        if (m.ref) {
  ------------------
  |  Branch (1492:13): [True: 467k, False: 3.35M]
  ------------------
 1493|   467k|            ip -= m.backtrack;
 1494|   467k|            const uint32_t ll = (uint32_t)(ip - anchor);
 1495|   467k|            const uint32_t ml = m.len - ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  575|   467k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1496|   467k|            const uint32_t off = (uint32_t)(ip - m.ref);
 1497|   467k|            const uint16_t off_biased = (uint16_t)(off - ZXC_LZ_OFFSET_BIAS);
  ------------------
  |  |  676|   467k|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1498|       |
 1499|   467k|            if (ll > 0) zxc_flush_literals(literals, &lit_c, anchor, ll, iend);
  ------------------
  |  Branch (1499:17): [True: 287k, False: 180k]
  ------------------
 1500|       |
 1501|   467k|            if (UNLIKELY(!zxc_spl_put_seq(buf_tokens, buf_offsets, buf_extras, &seq_c, &extras_sz,
  ------------------
  |  |  154|   467k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 467k]
  |  |  ------------------
  ------------------
 1502|   467k|                                          &max_offset, ll, ml, off_biased)))
 1503|      0|                return ZXC_ERROR_OVERFLOW;
 1504|       |
 1505|   467k|            if (m.len > 2 && level > ZXC_LEVEL_BALANCED) {
  ------------------
  |  Branch (1505:17): [True: 467k, False: 0]
  |  Branch (1505:30): [True: 165k, False: 301k]
  ------------------
 1506|   165k|                const uint8_t* match_end = ip + m.len;
 1507|   165k|                if (match_end < iend - 7) {
  ------------------
  |  Branch (1507:21): [True: 165k, False: 601]
  ------------------
 1508|   165k|                    const uint32_t pos_u = (uint32_t)((match_end - 2) - src);
 1509|   165k|                    const uint64_t val_u8 = zxc_le64(match_end - 2);
 1510|   165k|                    const uint32_t val_u = (uint32_t)val_u8;
 1511|   165k|                    const uint32_t h_u = zxc_hash_func(val_u8, 1);
 1512|   165k|                    const uint32_t prev_idx =
 1513|   165k|                        zxc_epoch_pos(hash_table[h_u], offset_mask, epoch_mark);
 1514|   165k|                    hash_table[h_u] = epoch_mark | pos_u;
 1515|   165k|                    hash_tags[h_u] = zxc_hash_tag(val_u);
 1516|   165k|                    chain_table[pos_u & ZXC_LZ_WINDOW_MASK] = zxc_chain_delta(pos_u, prev_idx);
  ------------------
  |  |  573|   165k|#define ZXC_LZ_WINDOW_MASK (ZXC_LZ_WINDOW_SIZE - 1U)
  |  |  ------------------
  |  |  |  |  571|   165k|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  |  |  ------------------
  ------------------
 1517|   165k|                }
 1518|   165k|            }
 1519|       |
 1520|   467k|            ip += m.len;
 1521|   467k|            anchor = ip;
 1522|  3.35M|        } else {
 1523|  3.35M|            ip += step;
 1524|  3.35M|        }
 1525|  3.82M|    }
 1526|       |
 1527|  5.61k|    const size_t last_lits = (size_t)(iend - anchor);
 1528|  5.61k|    if (last_lits > 0) {
  ------------------
  |  Branch (1528:9): [True: 5.15k, False: 466]
  ------------------
 1529|  5.15k|        ZXC_MEMCPY(literals + lit_c, anchor, last_lits);
  ------------------
  |  |  170|  5.15k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1530|  5.15k|        lit_c += last_lits;
 1531|  5.15k|    }
 1532|       |
 1533|  10.7k|parse_done:;
 1534|       |    // Per-block match splitting on the parsed block (see zxc_spl_match_split_block).
 1535|  10.7k|    seq_c = zxc_spl_match_split_block(buf_tokens, buf_offsets, buf_extras, &extras_sz,
 1536|  10.7k|                                      ctx->buf_split, ctx->buf_split_hist, seq_c, lzp.split_max);
 1537|       |    // Dictionary-table trainer hook: accumulate the REAL post-LZ literal
 1538|       |    // frequencies (see zxc_dict_train_huf). Cold path, NULL outside training.
 1539|  10.7k|    if (UNLIKELY(ctx->lit_freq_acc)) {
  ------------------
  |  |  154|  10.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 10.7k]
  |  |  ------------------
  ------------------
 1540|      0|        for (size_t i = 0; i < lit_c; i++) ctx->lit_freq_acc[literals[i]]++;
  ------------------
  |  Branch (1540:28): [True: 0, False: 0]
  ------------------
 1541|      0|    }
 1542|       |
 1543|       |    // --- RLE ANALYSIS ---
 1544|  10.7k|    size_t rle_size = 0;
 1545|  10.7k|    int enc_lit = ZXC_SECTION_ENCODING_RAW;
 1546|  10.7k|    size_t best_j = lit_c;
 1547|       |
 1548|  10.7k|    if (lit_c > 0) {
  ------------------
  |  Branch (1548:9): [True: 10.7k, False: 0]
  ------------------
 1549|  10.7k|        const uint8_t* p = literals;
 1550|  10.7k|        const uint8_t* const p_end = literals + lit_c;
 1551|  10.7k|        const uint8_t* const p_end_4 = p_end - 3;  // Safe limit for 4-byte lookahead
 1552|       |
 1553|  74.8k|        while (LIKELY(p < p_end)) {
  ------------------
  |  |  148|  74.8k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 64.1k, False: 10.7k]
  |  |  ------------------
  ------------------
 1554|  64.1k|            const uint8_t b = *p;
 1555|  64.1k|            const uint8_t* run_start = p++;
 1556|       |
 1557|       |            // Fast run counting with early SIMD exit
 1558|       |#if defined(ZXC_USE_AVX512)
 1559|       |            const __m512i vb = _mm512_set1_epi8((char)b);
 1560|       |            while (p <= p_end - 64) {
 1561|       |                const __m512i v = _mm512_loadu_si512((const void*)p);
 1562|       |                const __mmask64 mask = _mm512_cmpeq_epi8_mask(v, vb);
 1563|       |                if (mask != 0xFFFFFFFFFFFFFFFFULL) {
 1564|       |                    p += (size_t)zxc_ctz64(~mask);
 1565|       |                    goto _run_done;
 1566|       |                }
 1567|       |                p += 64;
 1568|       |            }
 1569|       |#elif defined(ZXC_USE_AVX2)
 1570|       |            const __m256i vb = _mm256_set1_epi8((char)b);
 1571|       |            while (p <= p_end - 32) {
 1572|       |                const __m256i v = _mm256_loadu_si256((const __m256i*)p);
 1573|       |                const uint32_t mask = (uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, vb));
 1574|       |                if (mask != 0xFFFFFFFF) {
 1575|       |                    p += zxc_ctz32(~mask);
 1576|       |                    goto _run_done;
 1577|       |                }
 1578|       |                p += 32;
 1579|       |            }
 1580|       |#elif defined(ZXC_USE_SSE2)
 1581|       |            const __m128i vb = _mm_set1_epi8((char)b);
 1582|  87.8k|            while (p <= p_end - 16) {
  ------------------
  |  Branch (1582:20): [True: 80.0k, False: 7.78k]
  ------------------
 1583|  80.0k|                const __m128i v = _mm_loadu_si128((const __m128i*)p);
 1584|  80.0k|                const uint32_t mask = (uint32_t)_mm_movemask_epi8(_mm_cmpeq_epi8(v, vb));
 1585|  80.0k|                if (mask != 0xFFFFU) {
  ------------------
  |  Branch (1585:21): [True: 56.3k, False: 23.7k]
  ------------------
 1586|  56.3k|                    p += zxc_ctz32(~mask);
 1587|  56.3k|                    goto _run_done;
 1588|  56.3k|                }
 1589|  23.7k|                p += 16;
 1590|  23.7k|            }
 1591|       |#elif defined(ZXC_USE_NEON64)
 1592|       |            const uint8x16_t vb = vdupq_n_u8(b);
 1593|       |            while (p <= p_end - 16) {
 1594|       |                const uint8x16_t v = vld1q_u8(p);
 1595|       |                const uint8x16_t eq = vceqq_u8(v, vb);
 1596|       |                // SHRN nibble-mask: see find_best_match above for rationale.
 1597|       |                const uint64_t mask =
 1598|       |                    vget_lane_u64(vreinterpret_u64_u8(vshrn_n_u16(vreinterpretq_u16_u8(eq), 4)), 0);
 1599|       |                if (LIKELY(mask == ~(uint64_t)0)) {
 1600|       |                    p += 16;
 1601|       |                } else {
 1602|       |                    p += (size_t)(zxc_ctz64(~mask) >> 2);
 1603|       |                    goto _run_done;
 1604|       |                }
 1605|       |            }
 1606|       |#elif defined(ZXC_USE_NEON32)
 1607|       |            uint8x16_t vb = vdupq_n_u8(b);
 1608|       |            while (p <= p_end - 16) {
 1609|       |                uint8x16_t v = vld1q_u8(p);
 1610|       |                uint8x16_t eq = vceqq_u8(v, vb);
 1611|       |                uint8x16_t not_eq = vmvnq_u8(eq);
 1612|       |
 1613|       |                // 32-bit ARM NEON doesn't always support vgetq_lane_u64 / vreinterpretq_u64_u8 so
 1614|       |                // we treat the 128-bit vector as 4 x 32-bit lanes */
 1615|       |                const uint32x4_t neq32 = vreinterpretq_u32_u8(not_eq);
 1616|       |                const uint32_t l0 = vgetq_lane_u32(neq32, 0);
 1617|       |                const uint32_t l1 = vgetq_lane_u32(neq32, 1);
 1618|       |
 1619|       |                const uint64_t lo = ((uint64_t)l1 << 32) | l0;
 1620|       |                if (lo != 0) {
 1621|       |                    p += (size_t)(zxc_ctz64(lo) >> 3);
 1622|       |                    goto _run_done;
 1623|       |                }
 1624|       |
 1625|       |                const uint32_t h0 = vgetq_lane_u32(neq32, 2);
 1626|       |                const uint32_t h1 = vgetq_lane_u32(neq32, 3);
 1627|       |                const uint64_t hi = ((uint64_t)h1 << 32) | h0;
 1628|       |
 1629|       |                if (hi != 0) {
 1630|       |                    p += 8 + (zxc_ctz64(hi) >> 3);
 1631|       |                    goto _run_done;
 1632|       |                }
 1633|       |                p += 16;
 1634|       |            }
 1635|       |#endif
 1636|  22.3k|            while (p < p_end && *p == b) p++;
  ------------------
  |  Branch (1636:20): [True: 20.6k, False: 1.76k]
  |  Branch (1636:33): [True: 14.5k, False: 6.02k]
  ------------------
 1637|       |
 1638|  7.78k|#if defined(ZXC_USE_AVX512) || defined(ZXC_USE_AVX2) || defined(ZXC_USE_NEON64) || \
 1639|  7.78k|    defined(ZXC_USE_NEON32) || defined(ZXC_USE_SSE2)
 1640|  64.1k|        _run_done:;
 1641|  64.1k|#endif
 1642|  64.1k|            const size_t run = (size_t)(p - run_start);
 1643|       |
 1644|  64.1k|            if (run >= ZXC_LIT_RLE_RUN_MIN) {
  ------------------
  |  |  550|  64.1k|#define ZXC_LIT_RLE_RUN_MIN 4U
  ------------------
  |  Branch (1644:17): [True: 28.9k, False: 35.1k]
  ------------------
 1645|       |                // RLE run: 2 bytes per ZXC_LIT_RLE_RUN_MAX values, then remainder
 1646|       |                // Branchless: full_chunks * 2 + remainder handling
 1647|  28.9k|                const size_t full_chunks = run / ZXC_LIT_RLE_RUN_MAX;
  ------------------
  |  |  552|  28.9k|#define ZXC_LIT_RLE_RUN_MAX (ZXC_LIT_LEN_MASK + ZXC_LIT_RLE_RUN_MIN) /* 131 */
  |  |  ------------------
  |  |  |  |  546|  28.9k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  544|  28.9k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_LIT_RLE_RUN_MAX (ZXC_LIT_LEN_MASK + ZXC_LIT_RLE_RUN_MIN) /* 131 */
  |  |  ------------------
  |  |  |  |  550|  28.9k|#define ZXC_LIT_RLE_RUN_MIN 4U
  |  |  ------------------
  ------------------
 1648|  28.9k|                const size_t rem = run - full_chunks * ZXC_LIT_RLE_RUN_MAX;  // Avoid modulo
  ------------------
  |  |  552|  28.9k|#define ZXC_LIT_RLE_RUN_MAX (ZXC_LIT_LEN_MASK + ZXC_LIT_RLE_RUN_MIN) /* 131 */
  |  |  ------------------
  |  |  |  |  546|  28.9k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  544|  28.9k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_LIT_RLE_RUN_MAX (ZXC_LIT_LEN_MASK + ZXC_LIT_RLE_RUN_MIN) /* 131 */
  |  |  ------------------
  |  |  |  |  550|  28.9k|#define ZXC_LIT_RLE_RUN_MIN 4U
  |  |  ------------------
  ------------------
 1649|  28.9k|                rle_size += full_chunks * 2;
 1650|       |                // Remainder: if >= 4 -> 2 bytes (RLE), else 1 + rem (literal)
 1651|  28.9k|                if (rem >= ZXC_LIT_RLE_RUN_MIN)
  ------------------
  |  |  550|  28.9k|#define ZXC_LIT_RLE_RUN_MIN 4U
  ------------------
  |  Branch (1651:21): [True: 28.6k, False: 291]
  ------------------
 1652|  28.6k|                    rle_size += 2;
 1653|    291|                else if (rem > 0)
  ------------------
  |  Branch (1653:26): [True: 52, False: 239]
  ------------------
 1654|     52|                    rle_size += 1 + rem;
 1655|  35.1k|            } else {
 1656|       |                // Literal run: scan ahead with fast SIMD lookahead
 1657|  35.1k|                const uint8_t* lit_start = run_start;
 1658|       |
 1659|  35.1k|#if defined(ZXC_RLE_WIN)
 1660|  2.85M|                while (p <= p_end_4 - ZXC_RLE_WIN) {
  ------------------
  |  |  118|  2.85M|#define ZXC_RLE_WIN 16
  ------------------
  |  Branch (1660:24): [True: 2.84M, False: 12.6k]
  ------------------
 1661|  2.84M|                    const zxc_rle_mask_t m = zxc_rle_pair_mask(p);
 1662|  2.84M|                    const zxc_rle_mask_t mask = m & (m >> ZXC_RLE_BPB) & (m >> (2 * ZXC_RLE_BPB));
  ------------------
  |  |  119|  2.84M|#define ZXC_RLE_BPB 1
  ------------------
                                  const zxc_rle_mask_t mask = m & (m >> ZXC_RLE_BPB) & (m >> (2 * ZXC_RLE_BPB));
  ------------------
  |  |  119|  2.84M|#define ZXC_RLE_BPB 1
  ------------------
 1663|  2.84M|                    if (LIKELY(mask == 0)) {
  ------------------
  |  |  148|  2.84M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 2.63M, False: 203k]
  |  |  ------------------
  ------------------
 1664|  2.63M|                        p += ZXC_RLE_WIN - 2;
  ------------------
  |  |  118|  2.63M|#define ZXC_RLE_WIN 16
  ------------------
 1665|  2.63M|                        continue;
 1666|  2.63M|                    }
 1667|   203k|                    const unsigned rpos = (unsigned)(ZXC_RLE_CTZ(mask) / ZXC_RLE_BPB);
  ------------------
  |  |  120|   203k|#define ZXC_RLE_CTZ(x) zxc_ctz32(x)
  ------------------
                                  const unsigned rpos = (unsigned)(ZXC_RLE_CTZ(mask) / ZXC_RLE_BPB);
  ------------------
  |  |  119|   203k|#define ZXC_RLE_BPB 1
  ------------------
 1668|   203k|                    const unsigned rpairs =
 1669|   203k|                        (unsigned)(ZXC_RLE_CTZ(~(m >> (rpos * ZXC_RLE_BPB))) / ZXC_RLE_BPB);
  ------------------
  |  |  120|   203k|#define ZXC_RLE_CTZ(x) zxc_ctz32(x)
  ------------------
                                      (unsigned)(ZXC_RLE_CTZ(~(m >> (rpos * ZXC_RLE_BPB))) / ZXC_RLE_BPB);
  ------------------
  |  |  119|   203k|#define ZXC_RLE_BPB 1
  ------------------
 1670|   203k|                    if (UNLIKELY(rpos + rpairs >= ZXC_RLE_WIN)) {
  ------------------
  |  |  154|   203k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 22.4k, False: 180k]
  |  |  ------------------
  ------------------
 1671|  22.4k|                        p += rpos;
 1672|  22.4k|                        goto _lit_done; /* run may extend past the window */
 1673|  22.4k|                    }
 1674|   180k|                    const size_t seg = (size_t)(p + rpos - lit_start);
 1675|   180k|                    rle_size += seg + (seg + ZXC_LIT_LEN_MASK) / ZXC_LIT_RUN_MAX;
  ------------------
  |  |  546|   180k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  ------------------
  |  |  |  |  544|   180k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  ------------------
  ------------------
                                  rle_size += seg + (seg + ZXC_LIT_LEN_MASK) / ZXC_LIT_RUN_MAX;
  ------------------
  |  |  548|   180k|#define ZXC_LIT_RUN_MAX (ZXC_LIT_LEN_MASK + 1U) /* 128 */
  |  |  ------------------
  |  |  |  |  546|   180k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  544|   180k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1676|   180k|                    rle_size += 2; /* run fits one chunk: full_chunks=0, rem>=4 */
 1677|   180k|                    p += rpos + rpairs + 1;
 1678|   180k|                    lit_start = p;
 1679|   180k|                }
 1680|       |#elif defined(ZXC_USE_NEON32)
 1681|       |                while (p <= p_end_4 - 16) {
 1682|       |                    uint8x16_t v0 = vld1q_u8(p);
 1683|       |                    uint8x16_t v1 = vld1q_u8(p + 1);
 1684|       |                    const uint8x16_t pe = vceqq_u8(v0, v1);
 1685|       |                    const uint8x16_t zv = vdupq_n_u8(0);
 1686|       |                    const uint8x16_t eq =
 1687|       |                        vandq_u8(pe, vandq_u8(vextq_u8(pe, zv, 1), vextq_u8(pe, zv, 2)));
 1688|       |
 1689|       |                    uint32x4_t eq32 = vreinterpretq_u32_u8(eq);
 1690|       |                    uint32_t l0 = vgetq_lane_u32(eq32, 0);
 1691|       |                    uint32_t l1 = vgetq_lane_u32(eq32, 1);
 1692|       |                    uint64_t lo = ((uint64_t)l1 << 32) | l0;
 1693|       |
 1694|       |                    if (lo != 0) {
 1695|       |                        p += (zxc_ctz64(lo) >> 3);
 1696|       |                        goto _lit_done;
 1697|       |                    }
 1698|       |
 1699|       |                    uint32_t h0 = vgetq_lane_u32(eq32, 2);
 1700|       |                    uint32_t h1 = vgetq_lane_u32(eq32, 3);
 1701|       |                    uint64_t hi = ((uint64_t)h1 << 32) | h0;
 1702|       |
 1703|       |                    if (hi != 0) {
 1704|       |                        p += 8 + (zxc_ctz64(hi) >> 3);
 1705|       |                        goto _lit_done;
 1706|       |                    }
 1707|       |                    p += 14;
 1708|       |                }
 1709|       |#endif
 1710|  85.7k|                while (p < p_end_4) {
  ------------------
  |  Branch (1710:24): [True: 76.0k, False: 9.63k]
  ------------------
 1711|  76.0k|                    if (UNLIKELY(p[0] == p[1] && p[1] == p[2] && p[2] == p[3])) break;
  ------------------
  |  |  154|   170k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 3.05k, False: 73.0k]
  |  |  |  Branch (154:42): [True: 13.1k, False: 62.9k]
  |  |  |  Branch (154:42): [True: 5.54k, False: 7.59k]
  |  |  |  Branch (154:42): [True: 3.05k, False: 2.49k]
  |  |  ------------------
  ------------------
 1712|  73.0k|                    p++;
 1713|  73.0k|                }
 1714|  12.6k|                if (p >= p_end_4) p = p_end;
  ------------------
  |  Branch (1714:21): [True: 9.63k, False: 3.05k]
  ------------------
 1715|       |
 1716|  12.6k|#if defined(ZXC_USE_AVX512) || defined(ZXC_USE_AVX2) || defined(ZXC_USE_NEON64) || \
 1717|  12.6k|    defined(ZXC_USE_NEON32) || defined(ZXC_USE_SSE2)
 1718|  35.1k|            _lit_done:;
 1719|  35.1k|#endif
 1720|  35.1k|                const size_t lit_run = (size_t)(p - lit_start);
 1721|       |                // 1 header per ZXC_LIT_RUN_MAX bytes + all data bytes
 1722|  35.1k|                rle_size += lit_run + (lit_run + ZXC_LIT_LEN_MASK) / ZXC_LIT_RUN_MAX;
  ------------------
  |  |  546|  35.1k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  ------------------
  |  |  |  |  544|  35.1k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  ------------------
  ------------------
                              rle_size += lit_run + (lit_run + ZXC_LIT_LEN_MASK) / ZXC_LIT_RUN_MAX;
  ------------------
  |  |  548|  35.1k|#define ZXC_LIT_RUN_MAX (ZXC_LIT_LEN_MASK + 1U) /* 128 */
  |  |  ------------------
  |  |  |  |  546|  35.1k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  544|  35.1k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1723|  35.1k|            }
 1724|  64.1k|        }
 1725|       |
 1726|       |        // RLE over RAW: space-speed J comparison. The per-level premium
 1727|       |        // reproduces the historical margin exactly below ULTRA.
 1728|  10.7k|        const size_t rle_j = rle_size + ZXC_SS_TAX(lit_c, zxc_ss_prem_rle_q8(level));
  ------------------
  |  |  902|  10.7k|#define ZXC_SS_TAX(n, prem_q8) (((size_t)(n) * (size_t)(prem_q8)) >> 8)
  ------------------
 1729|  10.7k|        if (rle_j < best_j) {
  ------------------
  |  Branch (1729:13): [True: 4.89k, False: 5.87k]
  ------------------
 1730|  4.89k|            enc_lit = ZXC_SECTION_ENCODING_RLE;
 1731|  4.89k|            best_j = rle_j;
 1732|  4.89k|        }
 1733|  10.7k|    }
 1734|       |
 1735|       |    // Level >= 6: Huffman as a third literal-encoding candidate. Histogram,
 1736|       |    // length-limited code lengths, exact PivCo section size, and switch if its
 1737|       |    // J (size + decode tax) beats the current winner's.
 1738|  10.7k|    uint8_t huf_code_len[ZXC_HUF_NUM_SYMBOLS];
 1739|  10.7k|    size_t huf_total_size = SIZE_MAX;
 1740|  10.7k|    uint32_t lit_freq[ZXC_HUF_NUM_SYMBOLS]; /* valid iff huf_total_size != SIZE_MAX */
 1741|  10.7k|    if (level >= ZXC_LEVEL_DENSITY && lit_c >= ZXC_HUF_MIN_LITERALS) {
  ------------------
  |  |  951|  5.14k|#define ZXC_HUF_MIN_LITERALS 139
  ------------------
  |  Branch (1741:9): [True: 5.14k, False: 5.61k]
  |  Branch (1741:39): [True: 2.15k, False: 2.99k]
  ------------------
 1742|  2.15k|        uint32_t freq0[ZXC_HUF_NUM_SYMBOLS] = {0};
 1743|  2.15k|        uint32_t freq1[ZXC_HUF_NUM_SYMBOLS] = {0};
 1744|  2.15k|        uint32_t freq2[ZXC_HUF_NUM_SYMBOLS] = {0};
 1745|  2.15k|        uint32_t freq3[ZXC_HUF_NUM_SYMBOLS] = {0};
 1746|  2.15k|        {
 1747|  2.15k|            size_t i = 0;
 1748|  7.04M|            for (; i + 4 <= lit_c; i += 4) {
  ------------------
  |  Branch (1748:20): [True: 7.04M, False: 2.15k]
  ------------------
 1749|  7.04M|                freq0[literals[i + 0]]++;
 1750|  7.04M|                freq1[literals[i + 1]]++;
 1751|  7.04M|                freq2[literals[i + 2]]++;
 1752|  7.04M|                freq3[literals[i + 3]]++;
 1753|  7.04M|            }
 1754|  5.60k|            for (; i < lit_c; i++) freq0[literals[i]]++;
  ------------------
  |  Branch (1754:20): [True: 3.44k, False: 2.15k]
  ------------------
 1755|  2.15k|        }
 1756|  2.15k|        uint32_t* const freq = lit_freq;
 1757|   554k|        for (int k = 0; k < ZXC_HUF_NUM_SYMBOLS; k++) {
  ------------------
  |  |  785|   554k|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (1757:25): [True: 551k, False: 2.15k]
  ------------------
 1758|   551k|            freq[k] = freq0[k] + freq1[k] + freq2[k] + freq3[k];
 1759|   551k|        }
 1760|       |
 1761|  2.15k|        if (zxc_huf_build_code_lengths(freq, huf_code_len, ctx->opt_scratch,
  ------------------
  |  |   26|  2.15k|#define zxc_huf_build_code_lengths ZXC_CAT(zxc_huf_build_code_lengths, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   24|  2.15k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   23|  2.15k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1761:13): [True: 2.15k, False: 0]
  ------------------
 1762|  2.15k|                                       zxc_huf_enc_max_code_len(level)) == ZXC_OK) {
 1763|  2.15k|            (void)zxc_huf_nudge_code_lengths(freq, huf_code_len, ctx->opt_scratch,
 1764|  2.15k|                                             ctx->opt_scratch_cap, zxc_huf_enc_max_code_len(level));
 1765|  2.15k|            huf_total_size = zxc_huf_calc_size(freq, huf_code_len, 1);
  ------------------
  |  |   28|  2.15k|#define zxc_huf_calc_size ZXC_CAT(zxc_huf_calc_size, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   24|  2.15k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   23|  2.15k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1766|       |            // Space-speed: the entropy candidate must beat the current winner's
 1767|       |            // J, paying its own decode tax over the copy path.
 1768|  2.15k|            if (huf_total_size != SIZE_MAX) {
  ------------------
  |  Branch (1768:17): [True: 2.15k, False: 0]
  ------------------
 1769|  2.15k|                const size_t huf_j = huf_total_size + ZXC_SS_TAX(lit_c, zxc_ss_prem_huf_q8(level));
  ------------------
  |  |  902|  2.15k|#define ZXC_SS_TAX(n, prem_q8) (((size_t)(n) * (size_t)(prem_q8)) >> 8)
  ------------------
 1770|  2.15k|                if (huf_j < best_j) {
  ------------------
  |  Branch (1770:21): [True: 978, False: 1.17k]
  ------------------
 1771|    978|                    enc_lit = ZXC_SECTION_ENCODING_HUFFMAN;
 1772|    978|                    best_j = huf_j;
 1773|    978|                }
 1774|  2.15k|            }
 1775|  2.15k|        }
 1776|  2.15k|    }
 1777|       |
 1778|       |    // Shared dictionary table (level >= 6, dict with a table): the HUFFMAN
 1779|       |    // bitstream minus the 128-byte header, so it stays viable far below
 1780|       |    // ZXC_HUF_MIN_LITERALS. A literal without a code drops the candidate.
 1781|  10.7k|    size_t huf_dict_total_size = SIZE_MAX;
 1782|  10.7k|    if (level >= ZXC_LEVEL_DENSITY && ctx->dict_huf_tree_ok && lit_c > 0) {
  ------------------
  |  Branch (1782:9): [True: 5.14k, False: 5.61k]
  |  Branch (1782:39): [True: 0, False: 5.14k]
  |  Branch (1782:64): [True: 0, False: 0]
  ------------------
 1783|       |        // The dict candidate runs on sections too small for the per-block
 1784|       |        // table, so the histogram may not have been built above.
 1785|      0|        if (huf_total_size == SIZE_MAX) {
  ------------------
  |  Branch (1785:13): [True: 0, False: 0]
  ------------------
 1786|      0|            ZXC_MEMSET(lit_freq, 0, sizeof(uint32_t) * ZXC_HUF_NUM_SYMBOLS);
  ------------------
  |  |  175|      0|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 1787|      0|            for (size_t i = 0; i < lit_c; i++) lit_freq[literals[i]]++;
  ------------------
  |  Branch (1787:32): [True: 0, False: 0]
  ------------------
 1788|      0|        }
 1789|       |        // zxc_huf_calc_size returns SIZE_MAX for unencodable candidates
 1790|       |        // (a literal byte without a code in the shared table).
 1791|      0|        huf_dict_total_size =
 1792|      0|            zxc_huf_calc_size_dict(lit_freq, ctx->dict_huf->code_len, &ctx->dict_huf->tree);
  ------------------
  |  |   29|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1793|      0|        if (huf_dict_total_size != SIZE_MAX) {
  ------------------
  |  Branch (1793:13): [True: 0, False: 0]
  ------------------
 1794|       |            // Same J rule against the running winner: vs the per-block Huffman
 1795|       |            // candidate the equal entropy taxes cancel (pure size comparison),
 1796|       |            // while RAW/RLE baselines keep their decode-tax edge.
 1797|      0|            const size_t huf_dict_j =
 1798|      0|                huf_dict_total_size + ZXC_SS_TAX(lit_c, zxc_ss_prem_huf_q8(level));
  ------------------
  |  |  902|      0|#define ZXC_SS_TAX(n, prem_q8) (((size_t)(n) * (size_t)(prem_q8)) >> 8)
  ------------------
 1799|       |            // Last candidate: no need to keep best_j updated past this point.
 1800|      0|            if (huf_dict_j < best_j) enc_lit = ZXC_SECTION_ENCODING_HUFFMAN_DICT;
  ------------------
  |  Branch (1800:17): [True: 0, False: 0]
  ------------------
 1801|      0|        }
 1802|      0|    }
 1803|       |
 1804|       |    // Level-7 (ULTRA): Huffman-code the token stream with the literal codec -
 1805|       |    // tokens are a <= 256-symbol alphabet. Same J rule; the decoder picks the
 1806|       |    // path from gh.enc_tok. opt_scratch is free by now.
 1807|  10.7k|    uint8_t tok_code_len[ZXC_HUF_NUM_SYMBOLS];
 1808|  10.7k|    uint8_t enc_tok = ZXC_SECTION_ENCODING_RAW;
 1809|  10.7k|    size_t tok_huf_size = 0;
 1810|  10.7k|    uint32_t tfreq[ZXC_HUF_NUM_SYMBOLS];
 1811|  10.7k|    if (level >= ZXC_LEVEL_ULTRA && seq_c >= ZXC_HUF_MIN_LITERALS) {
  ------------------
  |  |  951|  4.03k|#define ZXC_HUF_MIN_LITERALS 139
  ------------------
  |  Branch (1811:9): [True: 4.03k, False: 6.73k]
  |  Branch (1811:37): [True: 1.20k, False: 2.82k]
  ------------------
 1812|  1.20k|        ZXC_MEMSET(tfreq, 0, sizeof(tfreq)); /* only the ULTRA path reads tfreq */
  ------------------
  |  |  175|  1.20k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 1813|  1.10M|        for (uint32_t i = 0; i < seq_c; i++) tfreq[buf_tokens[i]]++;
  ------------------
  |  Branch (1813:30): [True: 1.10M, False: 1.20k]
  ------------------
 1814|  1.20k|        if (zxc_huf_build_code_lengths(tfreq, tok_code_len, ctx->opt_scratch,
  ------------------
  |  |   26|  1.20k|#define zxc_huf_build_code_lengths ZXC_CAT(zxc_huf_build_code_lengths, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   24|  1.20k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   23|  1.20k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1814:13): [True: 1.20k, False: 0]
  ------------------
 1815|  1.20k|                                       zxc_huf_enc_max_code_len(level)) == ZXC_OK) {
 1816|  1.20k|            (void)zxc_huf_nudge_code_lengths(tfreq, tok_code_len, ctx->opt_scratch,
 1817|  1.20k|                                             ctx->opt_scratch_cap, zxc_huf_enc_max_code_len(level));
 1818|  1.20k|            tok_huf_size = zxc_huf_calc_size(tfreq, tok_code_len, 1);
  ------------------
  |  |   28|  1.20k|#define zxc_huf_calc_size ZXC_CAT(zxc_huf_calc_size, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   24|  1.20k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   23|  1.20k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1819|       |            // Space-speed J comparison (this path is ULTRA-only): the PivCo
 1820|       |            // token section pays the same decode tax as PivCo literals.
 1821|  1.20k|            if (tok_huf_size != SIZE_MAX &&
  ------------------
  |  Branch (1821:17): [True: 1.20k, False: 0]
  ------------------
 1822|  1.20k|                tok_huf_size + ZXC_SS_TAX((size_t)seq_c, zxc_ss_prem_huf_q8(level)) < (size_t)seq_c)
  ------------------
  |  |  902|  1.20k|#define ZXC_SS_TAX(n, prem_q8) (((size_t)(n) * (size_t)(prem_q8)) >> 8)
  ------------------
  |  Branch (1822:17): [True: 1.01k, False: 188]
  ------------------
 1823|  1.01k|                enc_tok = ZXC_SECTION_ENCODING_HUFFMAN;
 1824|  1.20k|        }
 1825|  1.20k|    }
 1826|       |
 1827|  10.7k|    zxc_block_header_t bh = {.block_type = ZXC_BLOCK_SPL};
 1828|  10.7k|    uint8_t* const p = dst + ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  428|  10.7k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 1829|  10.7k|    size_t rem = dst_cap - ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  428|  10.7k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 1830|       |
 1831|  10.7k|    const int use_8bit_off = (max_offset <= 255) ? 1 : 0;
  ------------------
  |  Branch (1831:30): [True: 7.83k, False: 2.93k]
  ------------------
 1832|  10.7k|    const size_t off_stream_size = use_8bit_off ? seq_c : (seq_c * 2);
  ------------------
  |  Branch (1832:36): [True: 7.83k, False: 2.93k]
  ------------------
 1833|       |
 1834|  10.7k|    const zxc_gnr_header_t gh = {.n_sequences = seq_c,
 1835|  10.7k|                                 .n_literals = (uint32_t)lit_c,
 1836|  10.7k|                                 .enc_lit = (uint8_t)enc_lit,
 1837|  10.7k|                                 .enc_tok = enc_tok,
 1838|  10.7k|                                 .enc_mlen = 0,
 1839|  10.7k|                                 .enc_off = (uint8_t)use_8bit_off};
 1840|       |
 1841|  10.7k|    const size_t sz_lit = (enc_lit == ZXC_SECTION_ENCODING_RLE)            ? rle_size
  ------------------
  |  Branch (1841:27): [True: 4.43k, False: 6.33k]
  ------------------
 1842|  10.7k|                          : (enc_lit == ZXC_SECTION_ENCODING_HUFFMAN)      ? huf_total_size
  ------------------
  |  Branch (1842:29): [True: 978, False: 5.35k]
  ------------------
 1843|  6.33k|                          : (enc_lit == ZXC_SECTION_ENCODING_HUFFMAN_DICT) ? huf_dict_total_size
  ------------------
  |  Branch (1843:29): [True: 0, False: 5.35k]
  ------------------
 1844|  5.35k|                                                                           : lit_c;
 1845|  10.7k|    const size_t sz_tok = (enc_tok == ZXC_SECTION_ENCODING_HUFFMAN) ? tok_huf_size : seq_c;
  ------------------
  |  Branch (1845:27): [True: 1.01k, False: 9.74k]
  ------------------
 1846|  10.7k|    const size_t sz_off = off_stream_size;
 1847|  10.7k|    const size_t sz_ext = extras_sz;
 1848|       |
 1849|  10.7k|    const int ghs = zxc_write_spl_header_and_desc(p, rem, &gh, (uint32_t)sz_lit, (uint32_t)sz_tok);
 1850|  10.7k|    if (UNLIKELY(ghs < 0)) return ghs;
  ------------------
  |  |  154|  10.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 10.7k]
  |  |  ------------------
  ------------------
 1851|       |
 1852|  10.7k|    uint8_t* p_curr = p + ghs;
 1853|  10.7k|    rem -= (size_t)ghs;
 1854|       |
 1855|  10.7k|    if (UNLIKELY(rem < sz_lit)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  10.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 10.7k]
  |  |  ------------------
  ------------------
 1856|       |
 1857|  10.7k|    if (enc_lit == ZXC_SECTION_ENCODING_HUFFMAN) {
  ------------------
  |  Branch (1857:9): [True: 978, False: 9.78k]
  ------------------
 1858|    978|        const int written =
 1859|    978|            zxc_huf_encode_section(literals, lit_c, lit_freq, huf_code_len, p_curr, rem);
  ------------------
  |  |   30|    978|#define zxc_huf_encode_section ZXC_CAT(zxc_huf_encode_section, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   24|    978|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   23|    978|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1860|    978|        if (UNLIKELY(written < 0)) return written;
  ------------------
  |  |  154|    978|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 978]
  |  |  ------------------
  ------------------
 1861|    978|        if (UNLIKELY((size_t)written != huf_total_size)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|    978|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 978]
  |  |  ------------------
  ------------------
 1862|    978|        p_curr += written;
 1863|  9.78k|    } else if (enc_lit == ZXC_SECTION_ENCODING_HUFFMAN_DICT) {
  ------------------
  |  Branch (1863:16): [True: 0, False: 9.78k]
  ------------------
 1864|      0|        const int written =
 1865|      0|            zxc_huf_encode_section_dict(literals, lit_c, lit_freq, ctx->dict_huf->code_len,
  ------------------
  |  |   31|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1866|      0|                                        &ctx->dict_huf->tree, ctx->dict_huf->codes, p_curr, rem);
 1867|      0|        if (UNLIKELY(written < 0)) return written;
  ------------------
  |  |  154|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1868|      0|        if (UNLIKELY((size_t)written != huf_dict_total_size)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1869|      0|        p_curr += written;
 1870|  9.78k|    } else if (enc_lit == ZXC_SECTION_ENCODING_RLE) {
  ------------------
  |  Branch (1870:16): [True: 4.43k, False: 5.35k]
  ------------------
 1871|       |        // Write RLE - optimized single-pass encoding
 1872|  4.43k|        const uint8_t* lit_ptr = literals;
 1873|  4.43k|        const uint8_t* const lit_end = literals + lit_c;
 1874|       |
 1875|   211k|        while (lit_ptr < lit_end) {
  ------------------
  |  Branch (1875:16): [True: 206k, False: 4.43k]
  ------------------
 1876|   206k|            uint8_t b = *lit_ptr;
 1877|   206k|            const uint8_t* run_start = lit_ptr++;
 1878|       |
 1879|  1.04M|            while (lit_ptr < lit_end && *lit_ptr == b) lit_ptr++;
  ------------------
  |  Branch (1879:20): [True: 1.03M, False: 1.38k]
  |  Branch (1879:41): [True: 834k, False: 205k]
  ------------------
 1880|   206k|            size_t run = (size_t)(lit_ptr - run_start);
 1881|       |
 1882|   206k|            if (run >= ZXC_LIT_RLE_RUN_MIN) {
  ------------------
  |  |  550|   206k|#define ZXC_LIT_RLE_RUN_MIN 4U
  ------------------
  |  Branch (1882:17): [True: 106k, False: 100k]
  ------------------
 1883|       |                // RLE runs: emit 2-byte tokens (header + value)
 1884|   212k|                while (run >= ZXC_LIT_RLE_RUN_MIN) {
  ------------------
  |  |  550|   212k|#define ZXC_LIT_RLE_RUN_MIN 4U
  ------------------
  |  Branch (1884:24): [True: 106k, False: 106k]
  ------------------
 1885|   106k|                    size_t chunk = (run > ZXC_LIT_RLE_RUN_MAX) ? ZXC_LIT_RLE_RUN_MAX : run;
  ------------------
  |  |  552|   106k|#define ZXC_LIT_RLE_RUN_MAX (ZXC_LIT_LEN_MASK + ZXC_LIT_RLE_RUN_MIN) /* 131 */
  |  |  ------------------
  |  |  |  |  546|   106k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  544|   106k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_LIT_RLE_RUN_MAX (ZXC_LIT_LEN_MASK + ZXC_LIT_RLE_RUN_MIN) /* 131 */
  |  |  ------------------
  |  |  |  |  550|   106k|#define ZXC_LIT_RLE_RUN_MIN 4U
  |  |  ------------------
  ------------------
                                  size_t chunk = (run > ZXC_LIT_RLE_RUN_MAX) ? ZXC_LIT_RLE_RUN_MAX : run;
  ------------------
  |  |  552|    879|#define ZXC_LIT_RLE_RUN_MAX (ZXC_LIT_LEN_MASK + ZXC_LIT_RLE_RUN_MIN) /* 131 */
  |  |  ------------------
  |  |  |  |  546|    879|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  544|    879|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_LIT_RLE_RUN_MAX (ZXC_LIT_LEN_MASK + ZXC_LIT_RLE_RUN_MIN) /* 131 */
  |  |  ------------------
  |  |  |  |  550|    879|#define ZXC_LIT_RLE_RUN_MIN 4U
  |  |  ------------------
  ------------------
  |  Branch (1885:36): [True: 879, False: 105k]
  ------------------
 1886|   106k|                    *p_curr++ = (uint8_t)(ZXC_LIT_RLE_FLAG | (chunk - ZXC_LIT_RLE_RUN_MIN));
  ------------------
  |  |  544|   106k|#define ZXC_LIT_RLE_FLAG 0x80U
  ------------------
                                  *p_curr++ = (uint8_t)(ZXC_LIT_RLE_FLAG | (chunk - ZXC_LIT_RLE_RUN_MIN));
  ------------------
  |  |  550|   106k|#define ZXC_LIT_RLE_RUN_MIN 4U
  ------------------
 1887|   106k|                    *p_curr++ = b;
 1888|   106k|                    run -= chunk;
 1889|   106k|                }
 1890|       |                // Leftover < 4 bytes: emit as literal
 1891|   106k|                if (run > 0) {
  ------------------
  |  Branch (1891:21): [True: 52, False: 105k]
  ------------------
 1892|     52|                    *p_curr++ = (uint8_t)(run - 1);
 1893|     52|                    ZXC_MEMCPY(p_curr, lit_ptr - run, run);
  ------------------
  |  |  170|     52|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1894|     52|                    p_curr += run;
 1895|     52|                }
 1896|   106k|            } else {
 1897|       |                // Literal run: scan ahead to find next RLE opportunity
 1898|   100k|                const uint8_t* lit_run_start = run_start;
 1899|       |
 1900|  6.86M|                while (lit_ptr < lit_end) {
  ------------------
  |  Branch (1900:24): [True: 6.85M, False: 3.42k]
  ------------------
 1901|  6.85M|                    if (UNLIKELY(lit_ptr + 3 < lit_end && lit_ptr[0] == lit_ptr[1] &&
  ------------------
  |  |  154|  28.1M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 97.2k, False: 6.76M]
  |  |  |  Branch (154:42): [True: 6.85M, False: 8.53k]
  |  |  |  Branch (154:42): [True: 522k, False: 6.32M]
  |  |  |  Branch (154:42): [True: 195k, False: 326k]
  |  |  |  Branch (154:42): [True: 97.2k, False: 98.6k]
  |  |  ------------------
  ------------------
 1902|  6.85M|                                 lit_ptr[1] == lit_ptr[2] && lit_ptr[2] == lit_ptr[3])) {
 1903|  97.2k|                        break;
 1904|  97.2k|                    }
 1905|  6.76M|                    lit_ptr++;
 1906|  6.76M|                }
 1907|       |
 1908|   100k|                size_t lit_run = (size_t)(lit_ptr - lit_run_start);
 1909|   100k|                const uint8_t* src_ptr = lit_run_start;
 1910|       |
 1911|       |                // Emit literal chunks (ZXC_LIT_RUN_MAX bytes each at most)
 1912|   235k|                while (lit_run > 0) {
  ------------------
  |  Branch (1912:24): [True: 134k, False: 100k]
  ------------------
 1913|   134k|                    size_t chunk = (lit_run > ZXC_LIT_RUN_MAX) ? ZXC_LIT_RUN_MAX : lit_run;
  ------------------
  |  |  548|   134k|#define ZXC_LIT_RUN_MAX (ZXC_LIT_LEN_MASK + 1U) /* 128 */
  |  |  ------------------
  |  |  |  |  546|   134k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  544|   134k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                  size_t chunk = (lit_run > ZXC_LIT_RUN_MAX) ? ZXC_LIT_RUN_MAX : lit_run;
  ------------------
  |  |  548|  33.9k|#define ZXC_LIT_RUN_MAX (ZXC_LIT_LEN_MASK + 1U) /* 128 */
  |  |  ------------------
  |  |  |  |  546|  33.9k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  544|  33.9k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1913:36): [True: 33.9k, False: 100k]
  ------------------
 1914|   134k|                    *p_curr++ = (uint8_t)(chunk - 1);
 1915|   134k|                    ZXC_MEMCPY(p_curr, src_ptr, chunk);
  ------------------
  |  |  170|   134k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1916|   134k|                    p_curr += chunk;
 1917|   134k|                    src_ptr += chunk;
 1918|   134k|                    lit_run -= chunk;
 1919|   134k|                }
 1920|   100k|            }
 1921|   206k|        }
 1922|  5.35k|    } else {
 1923|  5.35k|        ZXC_MEMCPY(p_curr, literals, lit_c);
  ------------------
  |  |  170|  5.35k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1924|  5.35k|        p_curr += lit_c;
 1925|  5.35k|    }
 1926|  10.7k|    rem -= sz_lit;
 1927|       |
 1928|  10.7k|    if (UNLIKELY(rem < sz_tok)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  10.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 10.7k]
  |  |  ------------------
  ------------------
 1929|       |
 1930|  10.7k|    if (enc_tok == ZXC_SECTION_ENCODING_HUFFMAN) {
  ------------------
  |  Branch (1930:9): [True: 1.01k, False: 9.74k]
  ------------------
 1931|  1.01k|        const int written =
 1932|  1.01k|            zxc_huf_encode_section(buf_tokens, seq_c, tfreq, tok_code_len, p_curr, rem);
  ------------------
  |  |   30|  1.01k|#define zxc_huf_encode_section ZXC_CAT(zxc_huf_encode_section, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   24|  1.01k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   23|  1.01k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1933|  1.01k|        if (UNLIKELY(written < 0)) return written;
  ------------------
  |  |  154|  1.01k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 1.01k]
  |  |  ------------------
  ------------------
 1934|  1.01k|        if (UNLIKELY((size_t)written != tok_huf_size)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  1.01k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 1.01k]
  |  |  ------------------
  ------------------
 1935|  1.01k|        p_curr += written;
 1936|  9.74k|    } else {
 1937|  9.74k|        ZXC_MEMCPY(p_curr, buf_tokens, seq_c);
  ------------------
  |  |  170|  9.74k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1938|  9.74k|        p_curr += seq_c;
 1939|  9.74k|    }
 1940|  10.7k|    rem -= sz_tok;
 1941|       |
 1942|  10.7k|    if (UNLIKELY(rem < sz_off)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  10.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 10.7k]
  |  |  ------------------
  ------------------
 1943|       |
 1944|  10.7k|    if (use_8bit_off) {
  ------------------
  |  Branch (1944:9): [True: 7.83k, False: 2.93k]
  ------------------
 1945|       |        // Write 1-byte offsets - unroll for better throughput
 1946|  7.83k|        uint32_t i = 0;
 1947|  11.7k|        for (; i + 8 <= seq_c; i += 8) {
  ------------------
  |  Branch (1947:16): [True: 3.94k, False: 7.83k]
  ------------------
 1948|  3.94k|            p_curr[0] = (uint8_t)buf_offsets[i + 0];
 1949|  3.94k|            p_curr[1] = (uint8_t)buf_offsets[i + 1];
 1950|  3.94k|            p_curr[2] = (uint8_t)buf_offsets[i + 2];
 1951|  3.94k|            p_curr[3] = (uint8_t)buf_offsets[i + 3];
 1952|  3.94k|            p_curr[4] = (uint8_t)buf_offsets[i + 4];
 1953|  3.94k|            p_curr[5] = (uint8_t)buf_offsets[i + 5];
 1954|  3.94k|            p_curr[6] = (uint8_t)buf_offsets[i + 6];
 1955|  3.94k|            p_curr[7] = (uint8_t)buf_offsets[i + 7];
 1956|  3.94k|            p_curr += 8;
 1957|  3.94k|        }
 1958|  23.0k|        for (; i < seq_c; i++) {
  ------------------
  |  Branch (1958:16): [True: 15.2k, False: 7.83k]
  ------------------
 1959|  15.2k|            *p_curr++ = (uint8_t)buf_offsets[i];
 1960|  15.2k|        }
 1961|  7.83k|    } else {
 1962|       |        // Write 2-byte offsets in little-endian order
 1963|       |#ifdef ZXC_BIG_ENDIAN
 1964|       |        for (uint32_t i = 0; i < seq_c; i++) {
 1965|       |            zxc_store_le16(p_curr, buf_offsets[i]);
 1966|       |            p_curr += sizeof(uint16_t);
 1967|       |        }
 1968|       |#else
 1969|  2.93k|        ZXC_MEMCPY(p_curr, buf_offsets, seq_c * sizeof(uint16_t));
  ------------------
  |  |  170|  2.93k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1970|  2.93k|        p_curr += seq_c * sizeof(uint16_t);
 1971|  2.93k|#endif
 1972|  2.93k|    }
 1973|  10.7k|    rem -= sz_off;
 1974|       |
 1975|       |    // The sections behind the literals must total ZXC_BLOCK_LIT_SLACK bytes so
 1976|       |    // the decoder's literal wild-copy can overshoot. Tokens and offsets alone
 1977|       |    // clear it from 16 sequences on, so pad is 0 on any real block. It rides
 1978|       |    // inside the extras section, which the decoder sizes from the payload
 1979|       |    // residue - hence no wire field.
 1980|  10.7k|    const size_t behind_lit = sz_tok + sz_off + sz_ext;
 1981|  10.7k|    const size_t pad = (behind_lit < ZXC_BLOCK_LIT_SLACK) ? ZXC_BLOCK_LIT_SLACK - behind_lit : 0;
  ------------------
  |  |  345|  10.7k|#define ZXC_BLOCK_LIT_SLACK 32
  ------------------
                  const size_t pad = (behind_lit < ZXC_BLOCK_LIT_SLACK) ? ZXC_BLOCK_LIT_SLACK - behind_lit : 0;
  ------------------
  |  |  345|  7.33k|#define ZXC_BLOCK_LIT_SLACK 32
  ------------------
  |  Branch (1981:24): [True: 7.33k, False: 3.43k]
  ------------------
 1982|       |
 1983|  10.7k|    if (UNLIKELY(rem < sz_ext + pad)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  10.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 10.7k]
  |  |  ------------------
  ------------------
 1984|       |
 1985|  10.7k|    ZXC_MEMCPY(p_curr, buf_extras, extras_sz);
  ------------------
  |  |  170|  10.7k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1986|  10.7k|    p_curr += extras_sz;
 1987|       |
 1988|  10.7k|    ZXC_MEMSET(p_curr, 0, pad);
  ------------------
  |  |  175|  10.7k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 1989|  10.7k|    p_curr += pad;
 1990|       |
 1991|  10.7k|    bh.comp_size = (uint32_t)(p_curr - (dst + ZXC_BLOCK_HEADER_SIZE));
  ------------------
  |  |  428|  10.7k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 1992|  10.7k|    const int hw = zxc_write_block_header(dst, dst_cap, &bh);
 1993|  10.7k|    if (UNLIKELY(hw < 0)) return hw;
  ------------------
  |  |  154|  10.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 10.7k]
  |  |  ------------------
  ------------------
 1994|       |
 1995|       |    // Checksum will be appended by the wrapper
 1996|  10.7k|    *out_sz = ZXC_BLOCK_HEADER_SIZE + bh.comp_size;
  ------------------
  |  |  428|  10.7k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 1997|  10.7k|    return ZXC_OK;
 1998|  10.7k|}
zxc_compress.c:zxc_lz77_optimal_parse_spl:
 1117|  5.14k|                                      uint16_t* RESTRICT max_offset_out) {
 1118|  5.14k|    zxc_lz77_params_t lzp_opt = zxc_get_lz77_params(level);
 1119|  5.14k|    lzp_opt.use_lazy = 0;  // guard
 1120|       |
 1121|       |    // With a dictionary, src = [dict | block]. The DP arrays index from the block
 1122|       |    // start, so src_base points at the first block byte for literal copies while
 1123|       |    // src stays the match finder's base.
 1124|  5.14k|    const size_t dict_sz = ctx->dict_size;
 1125|  5.14k|    const size_t block_sz = src_sz - dict_sz;
 1126|  5.14k|    const uint8_t* const src_base = src + dict_sz;
 1127|  5.14k|    const uint8_t* const iend = src + src_sz;
 1128|       |
 1129|       |    // Block too small for any match: emit all as literals.
 1130|  5.14k|    if (UNLIKELY(block_sz < ZXC_LZ_SEARCH_MARGIN + 1)) {
  ------------------
  |  |  154|  5.14k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 80, False: 5.06k]
  |  |  ------------------
  ------------------
 1131|     80|        if (block_sz > 0) ZXC_MEMCPY(literals, src_base, block_sz);
  ------------------
  |  |  170|     80|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  |  Branch (1131:13): [True: 80, False: 0]
  ------------------
 1132|     80|        *lit_c_out = block_sz;
 1133|     80|        *seq_c_out = 0;
 1134|     80|        *extras_sz_out = 0;
 1135|     80|        *max_offset_out = 0;
 1136|     80|        return 0;
 1137|     80|    }
 1138|       |
 1139|  5.06k|    const size_t search_limit_pos = block_sz - ZXC_LZ_SEARCH_MARGIN;
  ------------------
  |  |  717|  5.06k|#define ZXC_LZ_SEARCH_MARGIN (sizeof(uint64_t))
  ------------------
 1140|  5.06k|    const uint8_t* const search_limit = src + search_limit_pos;
 1141|       |
 1142|       |    // DP arrays carved from ctx->opt_scratch, one allocation reused across
 1143|       |    // blocks, each sub-buffer cache-line padded.
 1144|       |    //
 1145|       |    //   dp             : (chunk+1) x u32: min cost to reach position p.
 1146|       |    //   parent_len     : (chunk+1) x u16: 0 = literal, >= MIN_MATCH = match.
 1147|       |    //   parent_off     : (chunk+1) x u16: biased match offset (distance-1).
 1148|       |    //   match_end_bits : one bit per position, set when a match on the chosen
 1149|       |    //                    path ends there - a forward actions[] stack at 1/64
 1150|       |    //                    the cost.
 1151|       |    //
 1152|       |    // The same buffer doubles as package-merge scratch for the code-length
 1153|       |    // builder: that scratch is live before the DP and after the parse is read
 1154|       |    // out, never during, so capacity is just the larger of the two.
 1155|  5.06k|    size_t sz_dp;
 1156|  5.06k|    size_t sz_pl;
 1157|  5.06k|    size_t sz_po;
 1158|  5.06k|    size_t sz_bm;
 1159|  5.06k|    zxc_opt_dp_sizes(ctx->chunk_size, &sz_dp, &sz_pl, &sz_po, &sz_bm);
 1160|  5.06k|    const size_t n_bm_words = ZXC_BITMAP_WORDS(ctx->chunk_size + 1);
  ------------------
  |  |  382|  5.06k|#define ZXC_BITMAP_WORDS(n_bits) (((n_bits) + 63) / 64)
  ------------------
 1161|       |
 1162|       |    // Per-block literal cost (sample only block data, not dict prefix):
 1163|  5.06k|    const uint32_t lit_cost = zxc_opt_estimate_lit_bits(src_base, block_sz, ctx->opt_scratch);
 1164|       |
 1165|  5.06k|    uint32_t* const dp = (uint32_t*)ctx->opt_scratch;
 1166|  5.06k|    uint16_t* const parent_len = (uint16_t*)(ctx->opt_scratch + sz_dp);
 1167|  5.06k|    uint16_t* const parent_off = (uint16_t*)(ctx->opt_scratch + sz_dp + sz_pl);
 1168|  5.06k|    uint64_t* const match_end_bits = (uint64_t*)(ctx->opt_scratch + sz_dp + sz_pl + sz_po);
 1169|       |
 1170|  5.06k|    dp[0] = 0;
 1171|  5.06k|    ZXC_MEMSET(dp + 1, 0xFF, block_sz * sizeof(uint32_t));
  ------------------
  |  |  175|  5.06k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 1172|  5.06k|    ZXC_MEMSET(match_end_bits, 0, sz_bm);
  ------------------
  |  |  175|  5.06k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 1173|       |
 1174|       |    // Forward DP: visit every position, update reachable successors.
 1175|       |    // `skip_until` suppresses find_best_match strictly inside the last long
 1176|       |    // match - the transition from its start already covers dp[p+1..p+L], and
 1177|       |    // re-searching there is what makes the parser quadratic on repetitive data.
 1178|  5.06k|    size_t skip_until = 0;
 1179|       |    // Rolling repeat-offset seed for find_best_match
 1180|  5.06k|    uint32_t last_off = 0;
 1181|       |    // Previous matched position and the length relaxed from it.
 1182|  5.06k|    size_t prev_p = 0;
 1183|  5.06k|    size_t prev_len = 0;
 1184|  64.4M|    for (size_t p = 0; p < search_limit_pos; p++) {
  ------------------
  |  Branch (1184:24): [True: 64.4M, False: 5.06k]
  ------------------
 1185|  64.4M|        if (UNLIKELY(dp[p] == UINT32_MAX)) continue;
  ------------------
  |  |  154|  64.4M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 64.4M]
  |  |  ------------------
  ------------------
 1186|       |
 1187|       |        // Literal transition.
 1188|  64.4M|        const uint32_t lit_next = dp[p] + lit_cost;
 1189|  64.4M|        if (lit_next < dp[p + 1]) {
  ------------------
  |  Branch (1189:13): [True: 32.1M, False: 32.2M]
  ------------------
 1190|  32.1M|            dp[p + 1] = lit_next;
 1191|  32.1M|            parent_len[p + 1] = 0;
 1192|  32.1M|        }
 1193|       |
 1194|  64.4M|        if (p < skip_until) continue;
  ------------------
  |  Branch (1194:13): [True: 19.2M, False: 45.2M]
  ------------------
 1195|       |
 1196|       |        // Match transition: no lazy, no backtrack (anchor=ip). Sub-lengths are
 1197|       |        // iterated because any L <= max_L matches at the same offset and may end
 1198|       |        // at a more useful DP position. ip is absolute so dict references
 1199|       |        // resolve against src.
 1200|  45.2M|        const uint8_t* ip = src_base + p;
 1201|  45.2M|        const zxc_match_t m = zxc_lz77_find_best_match(
 1202|  45.2M|            src, ip, iend, search_limit, /*anchor=*/ip, hash_table, hash_tags, chain_table,
 1203|  45.2M|            epoch_mark, offset_mask, level, lzp_opt, last_off);
 1204|       |
 1205|  45.2M|        if (m.ref) {
  ------------------
  |  Branch (1205:13): [True: 15.1M, False: 30.1M]
  ------------------
 1206|  15.1M|            const uint32_t off = (uint32_t)(ip - m.ref);
 1207|  15.1M|            if (off > 0 && off <= ZXC_LZ_WINDOW_SIZE) {
  ------------------
  |  |  571|  15.1M|#define ZXC_LZ_WINDOW_SIZE (1U << 16)
  ------------------
  |  Branch (1207:17): [True: 15.1M, False: 0]
  |  Branch (1207:28): [True: 15.1M, False: 0]
  ------------------
 1208|  15.1M|                last_off = off;
 1209|  15.1M|                const size_t L_max_raw = (m.len > block_sz - p) ? (block_sz - p) : (size_t)m.len;
  ------------------
  |  Branch (1209:42): [True: 0, False: 15.1M]
  ------------------
 1210|  15.1M|                const size_t L_max = (L_max_raw > UINT16_MAX) ? UINT16_MAX : L_max_raw;
  ------------------
  |  Branch (1210:38): [True: 12, False: 15.1M]
  ------------------
 1211|       |
 1212|       |                // Cost is piecewise constant in varint segments, so split
 1213|       |                // [MIN_MATCH, L_max] into:
 1214|       |                //   1. cheap   : v < ML_MASK                   -> base
 1215|       |                //   2. varint1 : v in [ML_MASK, ML_MASK + VARINT_1B_LIMIT) -> base + 8
 1216|       |                //   3. varint2+: v >= ML_MASK + VARINT_1B_LIMIT            -> base + 16, ...
 1217|       |                // The first two have a constant nxt and vectorize; the third is
 1218|       |                // rare enough to stay scalar.
 1219|  15.1M|                const uint16_t off_biased = (uint16_t)(off - ZXC_LZ_OFFSET_BIAS);
  ------------------
  |  |  676|  15.1M|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1220|  15.1M|                const size_t L_max_plus = L_max + 1;
 1221|  15.1M|                const size_t L_cheap_end = ZXC_LZ_MIN_MATCH_LEN + ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  575|  15.1M|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
                              const size_t L_cheap_end = ZXC_LZ_MIN_MATCH_LEN + ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  513|  15.1M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  509|  15.1M|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
 1222|  15.1M|                const size_t L_v1_end = L_cheap_end + ZXC_VARINT_1B_LIMIT;
  ------------------
  |  |  589|  15.1M|#define ZXC_VARINT_1B_LIMIT (1U << 7)
  ------------------
 1223|  15.1M|                const uint32_t nxt_cheap = dp[p] + ZXC_OPT_MATCH_COST_BASE;
  ------------------
  |  |  726|  15.1M|#define ZXC_OPT_MATCH_COST_BASE ((uint32_t)(3U * CHAR_BIT))
  ------------------
 1224|  15.1M|                const uint32_t nxt_v1 = nxt_cheap + CHAR_BIT;
 1225|       |
 1226|       |                // Covered: each processed position q bounds dp[q+l] by
 1227|       |                // dp[q] + cost(l), by relaxing or through its own predecessor.
 1228|       |                // With dp[p] >= dp[p-1], length l only wins where cost(l) <
 1229|       |                // cost(l+1): the last length of the two classes below
 1230|       |                // ZXC_OPT_LONG_MATCH_SKIP. Costs ignore the offset.
 1231|  15.1M|                const int covered = prev_len > L_max && prev_p + 1 == p && dp[p] >= dp[p - 1];
  ------------------
  |  Branch (1231:37): [True: 12.9M, False: 2.13M]
  |  Branch (1231:57): [True: 12.9M, False: 16.6k]
  |  Branch (1231:76): [True: 12.6M, False: 270k]
  ------------------
 1232|  15.1M|                prev_p = p;
 1233|  15.1M|                prev_len = L_max;
 1234|       |
 1235|  15.1M|                if (covered) {
  ------------------
  |  Branch (1235:21): [True: 12.6M, False: 2.42M]
  ------------------
 1236|  12.6M|                    if (L_max_plus >= L_cheap_end)
  ------------------
  |  Branch (1236:25): [True: 6.89M, False: 5.80M]
  ------------------
 1237|  6.89M|                        zxc_opt_relax(dp, parent_len, parent_off, p, L_cheap_end - 1, nxt_cheap,
 1238|  6.89M|                                      off_biased);
 1239|  12.6M|                    if (L_max_plus >= L_v1_end)
  ------------------
  |  Branch (1239:25): [True: 555k, False: 12.1M]
  ------------------
 1240|   555k|                        zxc_opt_relax(dp, parent_len, parent_off, p, L_v1_end - 1, nxt_v1,
 1241|   555k|                                      off_biased);
 1242|  12.6M|                } else {
 1243|       |                    // 1. Cheap range.
 1244|  2.42M|                    size_t L = zxc_opt_dp_update_const_cost(
 1245|  2.42M|                        dp, parent_len, parent_off, p, ZXC_LZ_MIN_MATCH_LEN,
  ------------------
  |  |  575|  2.42M|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1246|  2.42M|                        (L_max_plus < L_cheap_end) ? L_max_plus : L_cheap_end, nxt_cheap,
  ------------------
  |  Branch (1246:25): [True: 2.05M, False: 373k]
  ------------------
 1247|  2.42M|                        off_biased);
 1248|       |
 1249|       |                    // 2. First varint level (1-byte extension).
 1250|  2.42M|                    if (L < L_max_plus)
  ------------------
  |  Branch (1250:25): [True: 359k, False: 2.06M]
  ------------------
 1251|   359k|                        L = zxc_opt_dp_update_const_cost(
 1252|   359k|                            dp, parent_len, parent_off, p, L,
 1253|   359k|                            (L_max_plus < L_v1_end) ? L_max_plus : L_v1_end, nxt_v1, off_biased);
  ------------------
  |  Branch (1253:29): [True: 322k, False: 36.9k]
  ------------------
 1254|       |
 1255|       |                    // 3. Higher varint levels: variable cost, kept scalar.
 1256|       |                    // Reached only by L >= ML_MASK + 128 + MIN_MATCH, so the
 1257|       |                    // v >= ML_MASK guard from the original loop is implied.
 1258|  19.5M|                    for (; L < L_max_plus; L++) {
  ------------------
  |  Branch (1258:28): [True: 17.1M, False: 2.42M]
  ------------------
 1259|  17.1M|                        uint32_t cost = ZXC_OPT_MATCH_COST_BASE;
  ------------------
  |  |  726|  17.1M|#define ZXC_OPT_MATCH_COST_BASE ((uint32_t)(3U * CHAR_BIT))
  ------------------
 1260|  17.1M|                        uint32_t v = (uint32_t)(L - ZXC_LZ_MIN_MATCH_LEN) - ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  575|  17.1M|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
                                      uint32_t v = (uint32_t)(L - ZXC_LZ_MIN_MATCH_LEN) - ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  513|  17.1M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  509|  17.1M|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
 1261|  17.1M|                        cost += CHAR_BIT;
 1262|  36.0M|                        while (v >= 128) {
  ------------------
  |  Branch (1262:32): [True: 18.9M, False: 17.1M]
  ------------------
 1263|  18.9M|                            v >>= 7;
 1264|  18.9M|                            cost += CHAR_BIT;
 1265|  18.9M|                        }
 1266|  17.1M|                        zxc_opt_relax(dp, parent_len, parent_off, p, L, dp[p] + cost, off_biased);
 1267|  17.1M|                    }
 1268|  2.42M|                }
 1269|  15.1M|                if (UNLIKELY(L_max >= ZXC_OPT_LONG_MATCH_SKIP)) skip_until = p + L_max - 1;
  ------------------
  |  |  154|  15.1M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 19.6k, False: 15.1M]
  |  |  ------------------
  ------------------
 1270|  15.1M|            }
 1271|  15.1M|        }
 1272|  45.2M|    }
 1273|       |
 1274|       |    // Tail (last ZXC_LZ_SEARCH_MARGIN bytes) can only be literals: the match finder
 1275|       |    // stops at search_limit so its 8-byte probe reads stay in bounds.
 1276|  45.6k|    for (size_t p = search_limit_pos; p < block_sz; p++) {
  ------------------
  |  Branch (1276:39): [True: 40.5k, False: 5.06k]
  ------------------
 1277|  40.5k|        if (UNLIKELY(dp[p] == UINT32_MAX)) continue;
  ------------------
  |  |  154|  40.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 40.5k]
  |  |  ------------------
  ------------------
 1278|  40.5k|        const uint32_t lit_next = dp[p] + lit_cost;
 1279|  40.5k|        if (lit_next < dp[p + 1]) {
  ------------------
  |  Branch (1279:13): [True: 31.4k, False: 9.11k]
  ------------------
 1280|  31.4k|            dp[p + 1] = lit_next;
 1281|  31.4k|            parent_len[p + 1] = 0;
 1282|  31.4k|        }
 1283|  40.5k|    }
 1284|       |
 1285|       |    // Backtrack from src_sz to 0. Only match endpoints are recorded; literals
 1286|       |    // are the unmarked runs between them, rebuilt at emission from lit_start,
 1287|       |    // so they need no backtrack storage.
 1288|  5.06k|    {
 1289|  5.06k|        size_t pos = block_sz;
 1290|  29.4M|        while (pos > 0) {
  ------------------
  |  Branch (1290:16): [True: 29.4M, False: 5.06k]
  ------------------
 1291|  29.4M|            const uint32_t L = parent_len[pos];
 1292|  29.4M|            if (L == 0) {
  ------------------
  |  Branch (1292:17): [True: 28.3M, False: 1.17M]
  ------------------
 1293|  28.3M|                pos -= 1;
 1294|  28.3M|            } else {
 1295|  1.17M|                match_end_bits[pos >> 6] |= (uint64_t)1 << (pos & 63);
 1296|  1.17M|                pos -= L;
 1297|  1.17M|            }
 1298|  29.4M|        }
 1299|  5.06k|    }
 1300|       |
 1301|       |    // Forward emission: walk match_end_bits word-by-word, peeling set bits
 1302|       |    // with ctzll. Each set bit gives a match endpoint; parent_len/parent_off
 1303|       |    // at that position recover (length, offset).
 1304|  5.06k|    uint32_t seq_c = 0;
 1305|  5.06k|    size_t lit_c = 0;
 1306|  5.06k|    size_t extras_sz = 0;
 1307|  5.06k|    uint16_t max_offset = 0;
 1308|  5.06k|    size_t lit_start = 0;
 1309|       |
 1310|  8.92M|    for (size_t word_idx = 0; word_idx < n_bm_words; word_idx++) {
  ------------------
  |  Branch (1310:31): [True: 8.91M, False: 5.06k]
  ------------------
 1311|  8.91M|        uint64_t w = match_end_bits[word_idx];
 1312|  10.0M|        while (w) {
  ------------------
  |  Branch (1312:16): [True: 1.17M, False: 8.91M]
  ------------------
 1313|  1.17M|            const size_t pos = (word_idx << 6) + (size_t)zxc_ctz64(w);
 1314|  1.17M|            w &= w - 1;
 1315|  1.17M|            const uint32_t L = parent_len[pos];
 1316|  1.17M|            const uint16_t off_biased = parent_off[pos];
 1317|  1.17M|            const size_t match_start = pos - L;
 1318|       |
 1319|  1.17M|            const size_t LL = match_start - lit_start;
 1320|  1.17M|            if (LL > 0) {
  ------------------
  |  Branch (1320:17): [True: 846k, False: 325k]
  ------------------
 1321|   846k|                ZXC_MEMCPY(literals + lit_c, src_base + lit_start, LL);
  ------------------
  |  |  170|   846k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1322|   846k|                lit_c += LL;
 1323|   846k|            }
 1324|  1.17M|            const uint32_t ll = (uint32_t)LL;
 1325|  1.17M|            const uint32_t ml = L - ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  575|  1.17M|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1326|  1.17M|            if (UNLIKELY(!zxc_spl_put_seq(buf_tokens, buf_offsets, buf_extras, &seq_c, &extras_sz,
  ------------------
  |  |  154|  1.17M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 1.17M]
  |  |  ------------------
  ------------------
 1327|  1.17M|                                          &max_offset, ll, ml, off_biased)))
 1328|      0|                return ZXC_ERROR_OVERFLOW;
 1329|  1.17M|            lit_start = pos;
 1330|  1.17M|        }
 1331|  8.91M|    }
 1332|       |
 1333|       |    // Tail literals after the last match (or all literals if no match).
 1334|  5.06k|    if (lit_start < block_sz) {
  ------------------
  |  Branch (1334:9): [True: 4.53k, False: 531]
  ------------------
 1335|  4.53k|        const size_t tail = block_sz - lit_start;
 1336|  4.53k|        ZXC_MEMCPY(literals + lit_c, src_base + lit_start, tail);
  ------------------
  |  |  170|  4.53k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1337|  4.53k|        lit_c += tail;
 1338|  4.53k|    }
 1339|       |
 1340|  5.06k|    *seq_c_out = seq_c;
 1341|  5.06k|    *lit_c_out = lit_c;
 1342|  5.06k|    *extras_sz_out = extras_sz;
 1343|  5.06k|    *max_offset_out = max_offset;
 1344|  5.06k|    return 0;
 1345|  5.06k|}
zxc_compress.c:zxc_opt_estimate_lit_bits:
 1032|  5.06k|                                          void* RESTRICT scratch) {
 1033|  5.06k|    if (UNLIKELY(src_sz < ZXC_OPT_LIT_SAMPLE_MIN)) return CHAR_BIT;
  ------------------
  |  |  154|  5.06k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 3.39k, False: 1.67k]
  |  |  ------------------
  ------------------
 1034|       |
 1035|  1.67k|    uint32_t hist[ZXC_HUF_NUM_SYMBOLS] = {0};
 1036|  1.67k|    const size_t step =
 1037|  1.67k|        (src_sz > ZXC_OPT_LIT_SAMPLE_TARGET) ? src_sz / ZXC_OPT_LIT_SAMPLE_TARGET : 1U;
  ------------------
  |  |  739|  1.67k|#define ZXC_OPT_LIT_SAMPLE_TARGET 4096
  ------------------
                      (src_sz > ZXC_OPT_LIT_SAMPLE_TARGET) ? src_sz / ZXC_OPT_LIT_SAMPLE_TARGET : 1U;
  ------------------
  |  |  739|  1.12k|#define ZXC_OPT_LIT_SAMPLE_TARGET 4096
  ------------------
  |  Branch (1037:9): [True: 1.12k, False: 553]
  ------------------
 1038|  1.67k|    size_t sampled = 0;
 1039|  6.39M|    for (size_t i = 0; i < src_sz; i += step) {
  ------------------
  |  Branch (1039:24): [True: 6.39M, False: 1.67k]
  ------------------
 1040|  6.39M|        hist[src[i]]++;
 1041|  6.39M|        sampled++;
 1042|  6.39M|    }
 1043|       |
 1044|  1.67k|    uint8_t code_len[ZXC_HUF_NUM_SYMBOLS];
 1045|  1.67k|    if (UNLIKELY(zxc_huf_build_code_lengths(hist, code_len, scratch,
  ------------------
  |  |  154|  1.67k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 1.67k]
  |  |  ------------------
  ------------------
 1046|  1.67k|                                            ZXC_HUF_MAX_CODE_LEN_DENSITY) != ZXC_OK))
 1047|      0|        return CHAR_BIT;
 1048|       |
 1049|       |    // Sample-weighted sum of code lengths = predicted Huffman bits; divide by
 1050|       |    // the sample count for bits/byte, rounded up. The DP is integer, and
 1051|       |    // rounding up favours matches over fractional-cost literals.
 1052|  1.67k|    uint32_t total_bits = 0;
 1053|   430k|    for (int k = 0; k < ZXC_HUF_NUM_SYMBOLS; k++) {
  ------------------
  |  |  785|   430k|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (1053:21): [True: 429k, False: 1.67k]
  ------------------
 1054|   429k|        total_bits += hist[k] * (uint32_t)code_len[k];
 1055|   429k|    }
 1056|  1.67k|    const uint32_t n = (uint32_t)sampled;
 1057|  1.67k|    const uint32_t avg = (total_bits + n - 1) / n;
 1058|       |
 1059|       |    // Cap at RAW cost: if Huffman can't beat 8 bits/byte on the sample,
 1060|       |    // the encoder will pick RAW anyway and 8 is the actual literal cost.
 1061|  1.67k|    return (avg < CHAR_BIT) ? avg : CHAR_BIT;
  ------------------
  |  Branch (1061:12): [True: 704, False: 972]
  ------------------
 1062|  1.67k|}
zxc_compress.c:zxc_opt_relax:
  858|  29.1M|                                            const uint16_t off_biased) {
  859|  29.1M|    if (nxt < dp[p + L]) {
  ------------------
  |  Branch (859:9): [True: 21.0M, False: 8.10M]
  ------------------
  860|  21.0M|        dp[p + L] = nxt;
  861|  21.0M|        parent_len[p + L] = (uint16_t)L;
  862|  21.0M|        parent_off[p + L] = off_biased;
  863|  21.0M|    }
  864|  29.1M|}
zxc_compress.c:zxc_opt_dp_update_const_cost:
  908|  2.78M|    const size_t p, size_t L, const size_t L_end, const uint32_t nxt, const uint16_t off_biased) {
  909|       |#if defined(ZXC_USE_AVX512) && defined(__AVX512VL__)
  910|       |    if (L + 16 <= L_end) {
  911|       |        const __m512i v_inc =
  912|       |            _mm512_setr_epi32(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  913|       |        const __m512i v_nxt = _mm512_set1_epi32((int)nxt);
  914|       |        const __m256i v_off = _mm256_set1_epi16((int16_t)off_biased);
  915|       |        for (; L + 16 <= L_end; L += 16) {
  916|       |            const __m512i v_L_lanes = _mm512_add_epi32(v_inc, _mm512_set1_epi32((int)L));
  917|       |            const __m512i v_dp = _mm512_loadu_si512((const void*)&dp[p + L]);
  918|       |            const __mmask16 m = _mm512_cmplt_epu32_mask(v_nxt, v_dp);
  919|       |            _mm512_mask_storeu_epi32(&dp[p + L], m, v_nxt);
  920|       |            const __m256i v_L_u16 = _mm512_cvtusepi32_epi16(v_L_lanes);
  921|       |            _mm256_mask_storeu_epi16((void*)&parent_len[p + L], m, v_L_u16);
  922|       |            _mm256_mask_storeu_epi16((void*)&parent_off[p + L], m, v_off);
  923|       |        }
  924|       |    }
  925|       |#elif defined(ZXC_USE_AVX2)
  926|       |    if (L + 8 <= L_end) {
  927|       |        const __m256i v_inc = _mm256_setr_epi32(0, 1, 2, 3, 4, 5, 6, 7);
  928|       |        const __m256i v_nxt = _mm256_set1_epi32((int)nxt);
  929|       |        const __m256i v_bias = _mm256_set1_epi32((int)0x80000000);
  930|       |        const __m256i v_nxt_b = _mm256_xor_si256(v_nxt, v_bias);
  931|       |        const __m128i v_off = _mm_set1_epi16((int16_t)off_biased);
  932|       |        for (; L + 8 <= L_end; L += 8) {
  933|       |            const __m256i v_L_lanes = _mm256_add_epi32(v_inc, _mm256_set1_epi32((int)L));
  934|       |            const __m256i v_dp = _mm256_loadu_si256((const __m256i*)&dp[p + L]);
  935|       |            // Unsigned-compare-via-bias trick:
  936|       |            //   (dp ^ 0x80000000) > (nxt ^ 0x80000000)  iff  dp > nxt
  937|       |            // because XOR with the sign bit maps unsigned ordering to
  938|       |            // signed ordering. AVX2 only has signed cmpgt for 32-bit.
  939|       |            const __m256i v_dp_b = _mm256_xor_si256(v_dp, v_bias);
  940|       |            const __m256i v_mask = _mm256_cmpgt_epi32(v_dp_b, v_nxt_b);
  941|       |            const __m256i v_dp_new = _mm256_blendv_epi8(v_dp, v_nxt, v_mask);
  942|       |            _mm256_storeu_si256((__m256i*)&dp[p + L], v_dp_new);
  943|       |            // Pack 8x int32 mask -> 8x int16 mask with signed saturation:
  944|       |            // 0xFFFFFFFF -> 0xFFFF, 0x00000000 -> 0x0000.
  945|       |            const __m128i v_mask16 = _mm_packs_epi32(_mm256_castsi256_si128(v_mask),
  946|       |                                                     _mm256_extracti128_si256(v_mask, 1));
  947|       |            const __m128i v_L_u16 = _mm_packus_epi32(_mm256_castsi256_si128(v_L_lanes),
  948|       |                                                     _mm256_extracti128_si256(v_L_lanes, 1));
  949|       |            const __m128i v_pl = _mm_loadu_si128((const __m128i*)&parent_len[p + L]);
  950|       |            const __m128i v_pl_new = _mm_blendv_epi8(v_pl, v_L_u16, v_mask16);
  951|       |            _mm_storeu_si128((__m128i*)&parent_len[p + L], v_pl_new);
  952|       |            const __m128i v_po = _mm_loadu_si128((const __m128i*)&parent_off[p + L]);
  953|       |            const __m128i v_po_new = _mm_blendv_epi8(v_po, v_off, v_mask16);
  954|       |            _mm_storeu_si128((__m128i*)&parent_off[p + L], v_po_new);
  955|       |        }
  956|       |    }
  957|       |#elif defined(ZXC_USE_NEON64) || defined(ZXC_USE_NEON32)
  958|       |    if (L + 4 <= L_end) {
  959|       |        static const uint32_t k_inc_array[4] = {0, 1, 2, 3};
  960|       |        const uint32x4_t v_inc = vld1q_u32(k_inc_array);
  961|       |        const uint32x4_t v_nxt = vdupq_n_u32(nxt);
  962|       |        const uint16x4_t v_off = vdup_n_u16(off_biased);
  963|       |        for (; L + 4 <= L_end; L += 4) {
  964|       |            const uint32x4_t v_L_lanes = vaddq_u32(v_inc, vdupq_n_u32((uint32_t)L));
  965|       |            const uint32x4_t v_dp = vld1q_u32(&dp[p + L]);
  966|       |            const uint32x4_t v_mask = vcgtq_u32(v_dp, v_nxt);
  967|       |            vst1q_u32(&dp[p + L], vbslq_u32(v_mask, v_nxt, v_dp));
  968|       |            const uint16x4_t v_mask16 = vmovn_u32(v_mask);
  969|       |            const uint16x4_t v_L_u16 = vqmovn_u32(v_L_lanes);
  970|       |            const uint16x4_t v_pl = vld1_u16(&parent_len[p + L]);
  971|       |            vst1_u16(&parent_len[p + L], vbsl_u16(v_mask16, v_L_u16, v_pl));
  972|       |            const uint16x4_t v_po = vld1_u16(&parent_off[p + L]);
  973|       |            vst1_u16(&parent_off[p + L], vbsl_u16(v_mask16, v_off, v_po));
  974|       |        }
  975|       |    }
  976|       |#elif defined(ZXC_OPT_SSE2)
  977|  2.78M|    if (L + 4 <= L_end) {
  ------------------
  |  Branch (977:9): [True: 1.36M, False: 1.42M]
  ------------------
  978|  1.36M|        const __m128i v_inc = _mm_setr_epi32(0, 1, 2, 3);
  979|  1.36M|        const __m128i v_nxt = _mm_set1_epi32((int)nxt);
  980|  1.36M|        const __m128i v_bias = _mm_set1_epi32((int)0x80000000);
  981|  1.36M|        const __m128i v_nxt_b = _mm_xor_si128(v_nxt, v_bias);
  982|  1.36M|        const __m128i v_off = _mm_set1_epi16((short)off_biased);
  983|  6.60M|        for (; L + 4 <= L_end; L += 4) {
  ------------------
  |  Branch (983:16): [True: 5.23M, False: 1.36M]
  ------------------
  984|  5.23M|            const __m128i v_L_lanes = _mm_add_epi32(v_inc, _mm_set1_epi32((int)L));
  985|  5.23M|            const __m128i v_dp = _mm_loadu_si128((const __m128i*)&dp[p + L]);
  986|       |            // Unsigned compare via sign-bit bias (SSE2 cmpgt is signed only):
  987|       |            //   (dp ^ 0x80000000) > (nxt ^ 0x80000000)  iff  dp > nxt.
  988|  5.23M|            const __m128i v_dp_b = _mm_xor_si128(v_dp, v_bias);
  989|  5.23M|            const __m128i v_mask = _mm_cmpgt_epi32(v_dp_b, v_nxt_b);
  990|  5.23M|            const __m128i v_dp_new = zxc_mm_blendv_epi8_sse2(v_dp, v_nxt, v_mask);
  991|  5.23M|            _mm_storeu_si128((__m128i*)&dp[p + L], v_dp_new);
  992|       |            // Narrow the 4x int32 mask / length lanes to 4x int16 (low 64 bits).
  993|       |            // packs: 0xFFFFFFFF -> 0xFFFF, 0 -> 0; packus (SSE2-emulated): u32->u16.
  994|  5.23M|            const __m128i v_mask16 = _mm_packs_epi32(v_mask, v_mask);
  995|  5.23M|            const __m128i v_L_u16 = zxc_mm_packus_epi32_sse2(v_L_lanes, v_L_lanes);
  996|  5.23M|            __m128i v_pl = _mm_loadl_epi64((const __m128i*)&parent_len[p + L]);
  997|  5.23M|            v_pl = zxc_mm_blendv_epi8_sse2(v_pl, v_L_u16, v_mask16);
  998|  5.23M|            _mm_storel_epi64((__m128i*)&parent_len[p + L], v_pl);
  999|  5.23M|            __m128i v_po = _mm_loadl_epi64((const __m128i*)&parent_off[p + L]);
 1000|  5.23M|            v_po = zxc_mm_blendv_epi8_sse2(v_po, v_off, v_mask16);
 1001|  5.23M|            _mm_storel_epi64((__m128i*)&parent_off[p + L], v_po);
 1002|  5.23M|        }
 1003|  1.36M|    }
 1004|  2.78M|#endif
 1005|       |    // Scalar tail (and full path on archs without SIMD).
 1006|       |    // L < L_end <= UINT16_MAX (caller precondition), so the cast is lossless.
 1007|  7.36M|    for (; L < L_end; L++) zxc_opt_relax(dp, parent_len, parent_off, p, L, nxt, off_biased);
  ------------------
  |  Branch (1007:12): [True: 4.58M, False: 2.78M]
  ------------------
 1008|  2.78M|    return L;
 1009|  2.78M|}
zxc_compress.c:zxc_mm_blendv_epi8_sse2:
  157|  15.7M|static ZXC_ALWAYS_INLINE __m128i zxc_mm_blendv_epi8_sse2(__m128i a, __m128i b, __m128i mask) {
  158|  15.7M|    return _mm_or_si128(_mm_and_si128(mask, b), _mm_andnot_si128(mask, a));
  159|  15.7M|}
zxc_compress.c:zxc_mm_packus_epi32_sse2:
  173|  5.23M|static ZXC_ALWAYS_INLINE __m128i zxc_mm_packus_epi32_sse2(__m128i a, __m128i b) {
  174|  5.23M|    const __m128i bias32 = _mm_set1_epi32(0x8000);
  175|  5.23M|    const __m128i bias16 = _mm_set1_epi16((short)0x8000);
  176|  5.23M|    const __m128i pa = _mm_sub_epi32(a, bias32);
  177|  5.23M|    const __m128i pb = _mm_sub_epi32(b, bias32);
  178|  5.23M|    return _mm_add_epi16(_mm_packs_epi32(pa, pb), bias16);
  179|  5.23M|}
zxc_compress.c:zxc_spl_put_seq:
  263|  1.63M|                                             const uint32_t ml, const uint16_t off_biased) {
  264|  1.63M|    const uint8_t ll_code = (ll >= ZXC_TOKEN_LL_MASK) ? ZXC_TOKEN_LL_MASK : (uint8_t)ll;
  ------------------
  |  |  511|  1.63M|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  ------------------
  |  |  |  |  507|  1.63M|#define ZXC_TOKEN_LIT_BITS 4
  |  |  ------------------
  ------------------
                  const uint8_t ll_code = (ll >= ZXC_TOKEN_LL_MASK) ? ZXC_TOKEN_LL_MASK : (uint8_t)ll;
  ------------------
  |  |  511|   251k|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  ------------------
  |  |  |  |  507|   251k|#define ZXC_TOKEN_LIT_BITS 4
  |  |  ------------------
  ------------------
  |  Branch (264:29): [True: 251k, False: 1.38M]
  ------------------
  265|  1.63M|    const uint8_t ml_code = (ml >= ZXC_TOKEN_ML_MASK) ? ZXC_TOKEN_ML_MASK : (uint8_t)ml;
  ------------------
  |  |  513|  1.63M|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  509|  1.63M|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
                  const uint8_t ml_code = (ml >= ZXC_TOKEN_ML_MASK) ? ZXC_TOKEN_ML_MASK : (uint8_t)ml;
  ------------------
  |  |  513|   267k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  509|   267k|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
  |  Branch (265:29): [True: 267k, False: 1.37M]
  ------------------
  266|  1.63M|    buf_tokens[*seq_c] = (uint8_t)((ll_code << ZXC_TOKEN_LIT_BITS) | ml_code);
  ------------------
  |  |  507|  1.63M|#define ZXC_TOKEN_LIT_BITS 4
  ------------------
  267|  1.63M|    buf_offsets[*seq_c] = off_biased;
  268|  1.63M|    if (off_biased > *max_offset) *max_offset = off_biased;
  ------------------
  |  Branch (268:9): [True: 80.1k, False: 1.55M]
  ------------------
  269|  1.63M|    if (UNLIKELY(!zxc_emit_extra(buf_extras, extras_sz, ll, ZXC_TOKEN_LL_MASK) ||
  ------------------
  |  |  154|  3.27M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 1.63M]
  |  |  |  Branch (154:42): [True: 0, False: 1.63M]
  |  |  |  Branch (154:42): [True: 0, False: 1.63M]
  |  |  ------------------
  ------------------
  270|  1.63M|                 !zxc_emit_extra(buf_extras, extras_sz, ml, ZXC_TOKEN_ML_MASK)))
  271|      0|        return 0;
  272|  1.63M|    (*seq_c)++;
  273|  1.63M|    return 1;
  274|  1.63M|}
zxc_compress.c:zxc_spl_match_split_block:
  378|  10.7k|                                          const uint32_t n_seq, const uint8_t cap) {
  379|  10.7k|    if (cap <= ZXC_SPL_INLINE_ML_CODE || n_seq == 0) return n_seq;
  ------------------
  |  |  666|  21.5k|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  ------------------
  |  |  |  |  513|  10.7k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|  10.7k|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (379:9): [True: 5.14k, False: 5.61k]
  |  Branch (379:42): [True: 603, False: 5.01k]
  ------------------
  380|  5.01k|    uint8_t ctx_bad[1U << ZXC_SPL_MATCH_SPLIT_CTX_BITS];
  381|  5.01k|    if (!zxc_spl_match_split_analyze(tokens, n_seq, hist_buf, ctx_bad, side)) return n_seq;
  ------------------
  |  Branch (381:9): [True: 3.15k, False: 1.85k]
  ------------------
  382|       |
  383|       |    // 1. Mark the matches to split (bad context, within the cap) and drop their
  384|       |    // varints; the other extras move forward.
  385|  1.85k|    const uint8_t* const extras_end = extras + *extras_sz;
  386|  1.85k|    size_t r = 0, w = 0;
  387|  1.85k|    uint32_t extra = 0;
  388|   228k|    for (uint32_t i = 0; i < n_seq; i++) {
  ------------------
  |  Branch (388:26): [True: 226k, False: 1.85k]
  ------------------
  389|   226k|        const uint8_t tok = tokens[i];
  390|   226k|        const int bad = ctx_bad[side[i]];
  391|   226k|        side[i] = 0;
  392|   226k|        if ((tok >> ZXC_TOKEN_LIT_BITS) == ZXC_TOKEN_LL_MASK)
  ------------------
  |  |  507|   226k|#define ZXC_TOKEN_LIT_BITS 4
  ------------------
                      if ((tok >> ZXC_TOKEN_LIT_BITS) == ZXC_TOKEN_LL_MASK)
  ------------------
  |  |  511|   226k|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  ------------------
  |  |  |  |  507|   226k|#define ZXC_TOKEN_LIT_BITS 4
  |  |  ------------------
  ------------------
  |  Branch (392:13): [True: 19.5k, False: 206k]
  ------------------
  393|  19.5k|            zxc_varint_keep(extras, &w, &r, extras_end);
  394|   226k|        if ((tok & ZXC_TOKEN_ML_MASK) != ZXC_TOKEN_ML_MASK) continue;
  ------------------
  |  |  513|   226k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  509|   226k|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
                      if ((tok & ZXC_TOKEN_ML_MASK) != ZXC_TOKEN_ML_MASK) continue;
  ------------------
  |  |  513|   226k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  509|   226k|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
  |  Branch (394:13): [True: 201k, False: 24.6k]
  ------------------
  395|  24.6k|        const uint8_t* p = extras + r;
  396|  24.6k|        const uint32_t code = zxc_read_varint(&p, extras_end) + ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  513|  24.6k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  509|  24.6k|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
  397|  24.6k|        if (bad && code <= cap) {
  ------------------
  |  Branch (397:13): [True: 17.9k, False: 6.66k]
  |  Branch (397:20): [True: 9.85k, False: 8.09k]
  ------------------
  398|  9.85k|            side[i] = (uint8_t)code;
  399|  9.85k|            extra += zxc_spl_match_split_pieces(code) - 1;
  400|  9.85k|            r = (size_t)(p - extras);
  401|  14.7k|        } else {
  402|  14.7k|            zxc_extras_move(extras, &w, &r, p);
  403|  14.7k|        }
  404|  24.6k|    }
  405|  1.85k|    *extras_sz = w;
  406|  1.85k|    if (extra == 0) return n_seq;
  ------------------
  |  Branch (406:9): [True: 634, False: 1.22k]
  ------------------
  407|       |
  408|       |    // 2. Expand backward. A marked sequence spans its pieces, written forward: the
  409|       |    // first keeps the literal nibble and its escape, the last takes the remainder.
  410|  1.22k|    uint32_t out = n_seq + extra;
  411|   219k|    for (uint32_t i = n_seq; i-- > 0;) {
  ------------------
  |  Branch (411:30): [True: 218k, False: 1.22k]
  ------------------
  412|   218k|        const uint8_t tok = tokens[i];
  413|   218k|        const uint16_t off = offsets[i];
  414|   218k|        if (side[i] == 0) {
  ------------------
  |  Branch (414:13): [True: 208k, False: 9.85k]
  ------------------
  415|   208k|            out--;
  416|   208k|            tokens[out] = tok;
  417|   208k|            offsets[out] = off;
  418|   208k|            continue;
  419|   208k|        }
  420|  9.85k|        uint32_t code = side[i];
  421|  9.85k|        uint8_t ll_bits = tok & (uint8_t)(ZXC_TOKEN_LL_MASK << ZXC_TOKEN_LIT_BITS);
  ------------------
  |  |  511|  9.85k|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  ------------------
  |  |  |  |  507|  9.85k|#define ZXC_TOKEN_LIT_BITS 4
  |  |  ------------------
  ------------------
                      uint8_t ll_bits = tok & (uint8_t)(ZXC_TOKEN_LL_MASK << ZXC_TOKEN_LIT_BITS);
  ------------------
  |  |  507|  9.85k|#define ZXC_TOKEN_LIT_BITS 4
  ------------------
  422|  9.85k|        out -= zxc_spl_match_split_pieces(code);
  423|  9.85k|        uint32_t k = out;
  424|  19.7k|        while (code > ZXC_SPL_INLINE_ML_CODE) {
  ------------------
  |  |  666|  19.7k|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  ------------------
  |  |  |  |  513|  19.7k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|  19.7k|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (424:16): [True: 9.85k, False: 9.85k]
  ------------------
  425|  9.85k|            const uint32_t p = zxc_spl_match_split_piece(code);
  426|  9.85k|            tokens[k] = (uint8_t)(ll_bits | p);
  427|  9.85k|            offsets[k++] = off;
  428|  9.85k|            ll_bits = 0;
  429|  9.85k|            code -= p + ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  575|  9.85k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
  430|  9.85k|        }
  431|  9.85k|        tokens[k] = (uint8_t)(ll_bits | code);
  432|  9.85k|        offsets[k] = off;
  433|  9.85k|    }
  434|  1.22k|    return n_seq + extra;
  435|  1.85k|}
zxc_compress.c:zxc_spl_match_split_analyze:
  315|  5.01k|                                       uint8_t* RESTRICT ctx_bad, uint8_t* RESTRICT side) {
  316|  5.01k|    uint32_t order = ZXC_SPL_MATCH_SPLIT_CTX_BITS;
  ------------------
  |  | 1007|  5.01k|#define ZXC_SPL_MATCH_SPLIT_CTX_BITS 8
  ------------------
  317|  34.0k|    while (order > 2 && (n_seq >> order) < 16) order--;
  ------------------
  |  Branch (317:12): [True: 29.4k, False: 4.59k]
  |  Branch (317:25): [True: 29.0k, False: 421]
  ------------------
  318|  5.01k|    const uint32_t hmask = (1U << order) - 1U;
  319|  5.01k|    uint32_t (*const ctx_hist)[2][1U << ZXC_SPL_MATCH_SPLIT_CTX_BITS] = *hist_buf;
  320|  25.0k|    for (uint32_t l = 0; l < 4; l++) {
  ------------------
  |  Branch (320:26): [True: 20.0k, False: 5.01k]
  ------------------
  321|  20.0k|        ZXC_MEMSET(ctx_hist[l][0], 0, (hmask + 1) * sizeof(uint32_t));
  ------------------
  |  |  175|  20.0k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  322|  20.0k|        ZXC_MEMSET(ctx_hist[l][1], 0, (hmask + 1) * sizeof(uint32_t));
  ------------------
  |  |  175|  20.0k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  323|  20.0k|    }
  324|  5.01k|    uint32_t hist = 0, n_esc = 0;
  325|   472k|    for (uint32_t i = 0; i < n_seq; i++) {
  ------------------
  |  Branch (325:26): [True: 467k, False: 5.01k]
  ------------------
  326|   467k|        const uint32_t esc = (tokens[i] & ZXC_TOKEN_ML_MASK) == ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  513|   467k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  509|   467k|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
                      const uint32_t esc = (tokens[i] & ZXC_TOKEN_ML_MASK) == ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  513|   467k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  509|   467k|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
  327|   467k|        side[i] = (uint8_t)hist;
  328|   467k|        ctx_hist[i & 3][esc][hist]++;
  329|   467k|        hist = ((hist << 1) | esc) & hmask;
  330|   467k|        n_esc += esc;
  331|   467k|    }
  332|       |    // No conditional sum here: GCC 14.2 miscompiles it for AVX-512
  333|  5.01k|    uint32_t errors = 0;
  334|  39.6k|    for (uint32_t c = 0; c <= hmask; c++) {
  ------------------
  |  Branch (334:26): [True: 34.6k, False: 5.01k]
  ------------------
  335|  34.6k|        uint32_t n0 = 0, n1 = 0;
  336|   173k|        for (uint32_t l = 0; l < 4; l++) {
  ------------------
  |  Branch (336:30): [True: 138k, False: 34.6k]
  ------------------
  337|   138k|            n0 += ctx_hist[l][0][c];
  338|   138k|            n1 += ctx_hist[l][1][c];
  339|   138k|        }
  340|  34.6k|        ctx_bad[c] = (n1 < n0);  // escape a strict minority in its context
  341|  34.6k|        errors += (n0 < n1) ? n0 : n1;
  ------------------
  |  Branch (341:19): [True: 5.75k, False: 28.9k]
  ------------------
  342|  34.6k|    }
  343|  5.01k|    return n_esc != 0 &&
  ------------------
  |  Branch (343:12): [True: 3.45k, False: 1.56k]
  ------------------
  344|  3.45k|           (uint64_t)errors * 100 >= (uint64_t)ZXC_SPL_MATCH_SPLIT_MIN_MISPREDICT_PCT * n_esc;
  ------------------
  |  | 1010|  3.45k|#define ZXC_SPL_MATCH_SPLIT_MIN_MISPREDICT_PCT 80
  ------------------
  |  Branch (344:12): [True: 1.85k, False: 1.59k]
  ------------------
  345|  5.01k|}
zxc_compress.c:zxc_varint_keep:
  284|  19.5k|                                              size_t* RESTRICT r, const uint8_t* end) {
  285|  19.5k|    const uint8_t* p = extras + *r;
  286|  19.5k|    (void)zxc_read_varint(&p, end);
  287|  19.5k|    zxc_extras_move(extras, w, r, p);
  288|  19.5k|}
zxc_compress.c:zxc_spl_match_split_pieces:
  291|  19.7k|static ZXC_ALWAYS_INLINE uint32_t zxc_spl_match_split_pieces(const uint32_t code) {
  292|  19.7k|    return (code + ZXC_LZ_MIN_MATCH_LEN + ZXC_SPL_MAX_INLINE_ML - 1) / ZXC_SPL_MAX_INLINE_ML;
  ------------------
  |  |  575|  19.7k|#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;
  ------------------
  |  |  672|  19.7k|#define ZXC_SPL_MAX_INLINE_ML (ZXC_SPL_INLINE_ML_CODE + ZXC_LZ_MIN_MATCH_LEN) /* 19 */
  |  |  ------------------
  |  |  |  |  666|  19.7k|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  513|  19.7k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  509|  19.7k|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_SPL_MAX_INLINE_ML (ZXC_SPL_INLINE_ML_CODE + ZXC_LZ_MIN_MATCH_LEN) /* 19 */
  |  |  ------------------
  |  |  |  |  575|  19.7k|#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;
  ------------------
  |  |  672|  19.7k|#define ZXC_SPL_MAX_INLINE_ML (ZXC_SPL_INLINE_ML_CODE + ZXC_LZ_MIN_MATCH_LEN) /* 19 */
  |  |  ------------------
  |  |  |  |  666|  19.7k|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  513|  19.7k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  509|  19.7k|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_SPL_MAX_INLINE_ML (ZXC_SPL_INLINE_ML_CODE + ZXC_LZ_MIN_MATCH_LEN) /* 19 */
  |  |  ------------------
  |  |  |  |  575|  19.7k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  ------------------
  ------------------
  293|  19.7k|}
zxc_compress.c:zxc_extras_move:
  278|  34.3k|                                              size_t* RESTRICT r, const uint8_t* to) {
  279|  73.0k|    while (extras + *r < to) extras[(*w)++] = extras[(*r)++];
  ------------------
  |  Branch (279:12): [True: 38.7k, False: 34.3k]
  ------------------
  280|  34.3k|}
zxc_compress.c:zxc_spl_match_split_piece:
  297|  9.85k|static ZXC_ALWAYS_INLINE uint32_t zxc_spl_match_split_piece(const uint32_t code) {
  298|  9.85k|    const uint32_t rest = code - ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  575|  9.85k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
  299|  9.85k|    return (rest < ZXC_SPL_INLINE_ML_CODE) ? rest : ZXC_SPL_INLINE_ML_CODE;
  ------------------
  |  |  666|  9.85k|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  ------------------
  |  |  |  |  513|  9.85k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|  9.85k|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  return (rest < ZXC_SPL_INLINE_ML_CODE) ? rest : ZXC_SPL_INLINE_ML_CODE;
  ------------------
  |  |  666|  5.12k|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  ------------------
  |  |  |  |  513|  5.12k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  509|  5.12k|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (299:12): [True: 4.73k, False: 5.12k]
  ------------------
  300|  9.85k|}
zxc_compress.c:zxc_rle_pair_mask:
  122|  2.84M|static ZXC_ALWAYS_INLINE zxc_rle_mask_t zxc_rle_pair_mask(const uint8_t* p) {
  123|  2.84M|    const __m128i v0 = _mm_loadu_si128((const __m128i*)p);
  124|  2.84M|    const __m128i v1 = _mm_loadu_si128((const __m128i*)(p + 1));
  125|  2.84M|    return (uint32_t)_mm_movemask_epi8(_mm_cmpeq_epi8(v0, v1));
  126|  2.84M|}
zxc_compress.c:zxc_encode_block_raw:
 2190|  6.26k|                                size_t* RESTRICT const out_sz) {
 2191|  6.26k|    if (UNLIKELY(dst_cap < ZXC_BLOCK_HEADER_SIZE + src_sz)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  6.26k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 6.26k]
  |  |  ------------------
  ------------------
 2192|       |
 2193|  6.26k|    zxc_block_header_t bh;
 2194|  6.26k|    bh.block_type = ZXC_BLOCK_RAW;
 2195|  6.26k|    bh.block_flags = 0;  // Checksum flag moved to file header
 2196|  6.26k|    bh.reserved = 0;
 2197|  6.26k|    bh.comp_size = (uint32_t)src_sz;
 2198|       |
 2199|  6.26k|    const int hw = zxc_write_block_header(dst, dst_cap, &bh);
 2200|  6.26k|    if (UNLIKELY(hw < 0)) return hw;
  ------------------
  |  |  154|  6.26k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 6.26k]
  |  |  ------------------
  ------------------
 2201|       |
 2202|  6.26k|    ZXC_MEMCPY(dst + ZXC_BLOCK_HEADER_SIZE, src, src_sz);
  ------------------
  |  |  170|  6.26k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2203|       |
 2204|       |    // Checksum will be appended by the wrapper
 2205|  6.26k|    *out_sz = ZXC_BLOCK_HEADER_SIZE + src_sz;
  ------------------
  |  |  428|  6.26k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 2206|  6.26k|    return ZXC_OK;
 2207|  6.26k|}

zxc_decompress_chunk_wrapper_default:
 1654|  67.4k|                                 const uint64_t block_index) {
 1655|  67.4k|    return zxc_decompress_chunk_wrapper_body(ctx, src, src_sz, dst, dst_cap, block_index, 0, 0);
 1656|  67.4k|}
zxc_decompress_chunk_wrapper_safe_default:
 1699|  62.0k|                                      const size_t dst_cap, const uint64_t block_index) {
 1700|  62.0k|    return zxc_decompress_chunk_wrapper_body(ctx, src, src_sz, dst, dst_cap, block_index, 0, 1);
 1701|  62.0k|}
zxc_decompress.c:zxc_decompress_chunk_wrapper_body:
 1588|   129k|    const int safe) {
 1589|   129k|    if (UNLIKELY(src_sz < ZXC_BLOCK_HEADER_SIZE)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  154|   129k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 129k]
  |  |  ------------------
  ------------------
 1590|       |
 1591|   129k|    const uint8_t type = src[0];
 1592|   129k|    const uint32_t comp_sz = zxc_le32(src + 3);
 1593|   129k|    const int has_checksum = ctx->checksum_enabled;
 1594|       |
 1595|       |    // A block never compresses past its own content size
 1596|   129k|    if (UNLIKELY((uint64_t)comp_sz > (uint64_t)ctx->chunk_size)) return ZXC_ERROR_BAD_BLOCK_SIZE;
  ------------------
  |  |  154|   129k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 12.6k, False: 116k]
  |  |  ------------------
  ------------------
 1597|       |
 1598|       |    // Check bounds: Header + Body + Checksum(if any)
 1599|   116k|    const size_t expected_sz =
 1600|   116k|        (size_t)ZXC_BLOCK_HEADER_SIZE + comp_sz + (has_checksum ? ZXC_BLOCK_CHECKSUM_SIZE : 0);
  ------------------
  |  |  428|   116k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
                      (size_t)ZXC_BLOCK_HEADER_SIZE + comp_sz + (has_checksum ? ZXC_BLOCK_CHECKSUM_SIZE : 0);
  ------------------
  |  |  430|  47.0k|#define ZXC_BLOCK_CHECKSUM_SIZE 4
  ------------------
  |  Branch (1600:52): [True: 47.0k, False: 69.7k]
  ------------------
 1601|   116k|    if (UNLIKELY(src_sz < expected_sz)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  154|   116k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 16.2k, False: 100k]
  |  |  ------------------
  ------------------
 1602|       |
 1603|   100k|    const uint8_t* data = src + ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  428|   100k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 1604|       |
 1605|   100k|    int decoded_sz = ZXC_ERROR_BAD_BLOCK_TYPE;
 1606|       |
 1607|   100k|    switch (type) {
 1608|  51.8k|        case ZXC_BLOCK_SPL:
  ------------------
  |  Branch (1608:9): [True: 51.8k, False: 48.5k]
  ------------------
 1609|  51.8k|            decoded_sz = safe       ? zxc_decode_block_spl_safe(ctx, data, comp_sz, dst, dst_cap)
  ------------------
  |  Branch (1609:26): [True: 26.7k, False: 25.1k]
  ------------------
 1610|  51.8k|                         : has_dict ? zxc_decode_block_spl_dict(ctx, data, comp_sz, dst, dst_cap)
  ------------------
  |  Branch (1610:28): [True: 0, False: 25.1k]
  ------------------
 1611|  25.1k|                                    : zxc_decode_block_spl(ctx, data, comp_sz, dst, dst_cap);
 1612|  51.8k|            break;
 1613|  19.0k|        case ZXC_BLOCK_PAK:
  ------------------
  |  Branch (1613:9): [True: 19.0k, False: 81.3k]
  ------------------
 1614|  19.0k|            decoded_sz = safe       ? zxc_decode_block_pak_safe(ctx, data, comp_sz, dst, dst_cap)
  ------------------
  |  Branch (1614:26): [True: 9.67k, False: 9.40k]
  ------------------
 1615|  19.0k|                         : has_dict ? zxc_decode_block_pak_dict(ctx, data, comp_sz, dst, dst_cap)
  ------------------
  |  Branch (1615:28): [True: 0, False: 9.40k]
  ------------------
 1616|  9.40k|                                    : zxc_decode_block_pak(ctx, data, comp_sz, dst, dst_cap);
 1617|  19.0k|            break;
 1618|  27.6k|        case ZXC_BLOCK_RAW:
  ------------------
  |  Branch (1618:9): [True: 27.6k, False: 72.7k]
  ------------------
 1619|       |            // For RAW blocks, comp_sz == raw_sz (uncompressed data stored as-is)
 1620|  27.6k|            if (UNLIKELY(comp_sz > dst_cap)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  27.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 72, False: 27.5k]
  |  |  ------------------
  ------------------
 1621|  27.5k|            ZXC_MEMCPY(dst, data, comp_sz);
  ------------------
  |  |  170|  27.5k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1622|  27.5k|            decoded_sz = (int)comp_sz;
 1623|  27.5k|            break;
 1624|    272|        case ZXC_BLOCK_EOF:
  ------------------
  |  Branch (1624:9): [True: 272, False: 100k]
  ------------------
 1625|       |            // EOF should be handled by the dispatcher, not here
 1626|    272|            return ZXC_ERROR_CORRUPT_DATA;
 1627|  1.53k|        default:
  ------------------
  |  Branch (1627:9): [True: 1.53k, False: 98.9k]
  ------------------
 1628|  1.53k|            return ZXC_ERROR_BAD_BLOCK_TYPE;
 1629|   100k|    }
 1630|       |
 1631|       |    // dst_cap includes the wild-copy margin: bound the block itself
 1632|  98.5k|    if (UNLIKELY(decoded_sz > 0 && (size_t)decoded_sz > ctx->chunk_size))
  ------------------
  |  |  154|   163k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 99, False: 98.4k]
  |  |  |  Branch (154:42): [True: 64.7k, False: 33.8k]
  |  |  |  Branch (154:42): [True: 99, False: 64.6k]
  |  |  ------------------
  ------------------
 1633|     99|        return ZXC_ERROR_BAD_BLOCK_SIZE;
 1634|       |
 1635|  98.4k|    if (has_checksum && LIKELY(decoded_sz >= 0)) {
  ------------------
  |  |  148|  38.7k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 28.9k, False: 9.72k]
  |  |  ------------------
  ------------------
  |  Branch (1635:9): [True: 38.7k, False: 59.7k]
  ------------------
 1636|  28.9k|        const uint32_t stored = zxc_le32(data + comp_sz);
 1637|  28.9k|        if (UNLIKELY(stored !=
  ------------------
  |  |  154|  28.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 2.61k, False: 26.3k]
  |  |  ------------------
  ------------------
 1638|  28.9k|                     zxc_checksum(dst, (size_t)decoded_sz, block_index, ZXC_CHECKSUM_RAPIDHASH)))
 1639|  2.61k|            return ZXC_ERROR_BAD_CHECKSUM;
 1640|  28.9k|    }
 1641|       |
 1642|  95.8k|    return decoded_sz;
 1643|  98.4k|}
zxc_decompress.c:zxc_decode_block_spl_safe:
 1532|  26.7k|                                                  const size_t dst_capacity) {
 1533|  26.7k|    return zxc_decode_block_spl_impl(ctx, src, src_size, dst, dst_capacity, 1, 0, 0);
 1534|  26.7k|}
zxc_decompress.c:zxc_decode_block_spl_impl:
  796|  67.2k|                                                       const int has_dict, const int tok_entropy) {
  797|  67.2k|    zxc_gnr_header_t gh;
  798|       |
  799|       |    // Constant 0 when !has_dict, so `d_floor` folds to `dst`.
  800|  67.2k|    const size_t dict_size = has_dict ? ctx->dict_size : 0;
  ------------------
  |  Branch (800:30): [True: 0, False: 67.2k]
  ------------------
  801|  67.2k|    uint32_t lit_comp;
  802|  67.2k|    uint32_t tok_comp;
  803|       |
  804|  67.2k|    const int hdr_sz = zxc_read_spl_header_and_desc(src, src_size, &gh, &lit_comp, &tok_comp);
  805|  67.2k|    if (UNLIKELY(hdr_sz < 0)) return ZXC_ERROR_BAD_HEADER;
  ------------------
  |  |  154|  67.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 240, False: 67.0k]
  |  |  ------------------
  ------------------
  806|       |
  807|       |    // Only 0 and 1 are defined widths.
  808|  67.0k|    if (UNLIKELY(gh.enc_off > 1)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  67.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 220, False: 66.8k]
  |  |  ------------------
  ------------------
  809|       |
  810|       |    // Entropy-coded tokens (level 7): tail-call the dedicated instantiation
  811|       |    // before any section work - it restarts from the header, so only the parse
  812|       |    // above is duplicated. Flags are constant per instantiation, so exactly one
  813|       |    // call survives and t_ptr keeps a single provenance below.
  814|  66.8k|    if (!tok_entropy && UNLIKELY(gh.enc_tok == ZXC_SECTION_ENCODING_HUFFMAN)) {
  ------------------
  |  |  154|  51.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 15.3k, False: 36.0k]
  |  |  ------------------
  ------------------
  |  Branch (814:9): [True: 51.4k, False: 15.3k]
  ------------------
  815|  15.3k|        if (safe) return zxc_decode_block_spl_entropy_safe(ctx, src, src_size, dst, dst_capacity);
  ------------------
  |  Branch (815:13): [True: 8.03k, False: 7.33k]
  ------------------
  816|  7.33k|        if (has_dict)
  ------------------
  |  Branch (816:13): [True: 0, False: 7.33k]
  ------------------
  817|      0|            return zxc_decode_block_spl_entropy_dict(ctx, src, src_size, dst, dst_capacity);
  818|  7.33k|        return zxc_decode_block_spl_entropy(ctx, src, src_size, dst, dst_capacity);
  819|  7.33k|    }
  820|       |
  821|  51.4k|    const uint8_t* p_data = src + (size_t)hdr_sz;
  822|  51.4k|    const uint8_t* p_curr = p_data;
  823|       |
  824|       |    // --- Literal Stream Setup ---
  825|  51.4k|    const uint8_t* l_ptr;
  826|  51.4k|    const uint8_t* l_end;
  827|  51.4k|    uint8_t* rle_buf = NULL;
  828|       |
  829|  51.4k|    size_t lit_stream_size = lit_comp;
  830|       |    // Decoded size of an encoded literal section (RAW ignores it).
  831|  51.4k|    const size_t required_size = gh.n_literals;
  832|       |
  833|  51.4k|    if (gh.enc_lit == ZXC_SECTION_ENCODING_HUFFMAN ||
  ------------------
  |  Branch (833:9): [True: 4.90k, False: 46.5k]
  ------------------
  834|  46.5k|        gh.enc_lit == ZXC_SECTION_ENCODING_HUFFMAN_DICT) {
  ------------------
  |  Branch (834:9): [True: 334, False: 46.2k]
  ------------------
  835|  5.23k|        if (UNLIKELY(lit_stream_size > (size_t)(src + src_size - p_curr)))
  ------------------
  |  |  154|  5.23k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 250, False: 4.98k]
  |  |  ------------------
  ------------------
  836|    250|            return ZXC_ERROR_CORRUPT_DATA;
  837|  4.98k|        if (required_size == 0) {
  ------------------
  |  Branch (837:13): [True: 29, False: 4.95k]
  ------------------
  838|     29|            l_ptr = p_curr;
  839|     29|            l_end = p_curr;
  840|  4.95k|        } else {
  841|  4.95k|            if (UNLIKELY(required_size > dst_capacity || required_size > SIZE_MAX - ZXC_PAD_SIZE))
  ------------------
  |  |  154|  9.55k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 368, False: 4.59k]
  |  |  |  Branch (154:42): [True: 368, False: 4.59k]
  |  |  |  Branch (154:42): [True: 0, False: 4.59k]
  |  |  ------------------
  ------------------
  842|    368|                return ZXC_ERROR_DST_TOO_SMALL;
  843|  4.59k|            const int rc =
  844|  4.59k|                (gh.enc_lit == ZXC_SECTION_ENCODING_HUFFMAN)
  ------------------
  |  Branch (844:17): [True: 4.52k, False: 70]
  ------------------
  845|  4.59k|                    ? zxc_decode_lit_pivco(ctx, p_curr, lit_stream_size, required_size)
  846|  4.59k|                    : zxc_decode_lit_pivco_dict(ctx, p_curr, lit_stream_size, required_size);
  847|  4.59k|            if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  154|  4.59k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 388, False: 4.20k]
  |  |  ------------------
  ------------------
  848|  4.20k|            l_ptr = ctx->lit_buffer;
  849|  4.20k|            l_end = ctx->lit_buffer + required_size;
  850|  4.20k|        }
  851|  46.2k|    } else if (gh.enc_lit == ZXC_SECTION_ENCODING_RLE) {
  ------------------
  |  Branch (851:16): [True: 20.1k, False: 26.1k]
  ------------------
  852|  20.1k|        if (required_size > 0) {
  ------------------
  |  Branch (852:13): [True: 19.7k, False: 313]
  ------------------
  853|  19.7k|            if (UNLIKELY(required_size > dst_capacity || required_size > SIZE_MAX - ZXC_PAD_SIZE))
  ------------------
  |  |  154|  39.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 350, False: 19.4k]
  |  |  |  Branch (154:42): [True: 350, False: 19.4k]
  |  |  |  Branch (154:42): [True: 0, False: 19.4k]
  |  |  ------------------
  ------------------
  854|    350|                return ZXC_ERROR_DST_TOO_SMALL;
  855|  19.4k|            const size_t alloc_size = required_size + ZXC_PAD_SIZE;
  ------------------
  |  |  331|  19.4k|#define ZXC_PAD_SIZE 32
  ------------------
  856|       |
  857|       |            // lit_buffer is pre-allocated to chunk_size + ZXC_PAD_SIZE by
  858|       |            // zxc_cctx_init (mode == 0).
  859|  19.4k|            if (UNLIKELY(ctx->lit_buffer_cap < alloc_size)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  19.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 89, False: 19.3k]
  |  |  ------------------
  ------------------
  860|       |
  861|  19.3k|            rle_buf = ctx->lit_buffer;
  862|  19.3k|            if (UNLIKELY(!rle_buf || lit_stream_size > (size_t)(src + src_size - p_curr)))
  ------------------
  |  |  154|  38.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 270, False: 19.0k]
  |  |  |  Branch (154:42): [True: 0, False: 19.3k]
  |  |  |  Branch (154:42): [True: 270, False: 19.0k]
  |  |  ------------------
  ------------------
  863|    270|                return ZXC_ERROR_CORRUPT_DATA;
  864|       |
  865|  19.0k|            const uint8_t* r_ptr = p_curr;
  866|  19.0k|            const uint8_t* r_end = r_ptr + lit_stream_size;
  867|  19.0k|            uint8_t* w_ptr = rle_buf;
  868|  19.0k|            const uint8_t* const w_end = rle_buf + required_size;
  869|       |
  870|  1.06M|            while (r_ptr < r_end && w_ptr < w_end) {
  ------------------
  |  Branch (870:20): [True: 1.04M, False: 18.8k]
  |  Branch (870:37): [True: 1.04M, False: 16]
  ------------------
  871|  1.04M|                uint8_t token = *r_ptr++;
  872|  1.04M|                if (LIKELY(!(token & ZXC_LIT_RLE_FLAG))) {
  ------------------
  |  |  148|  1.04M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 571k, False: 473k]
  |  |  ------------------
  ------------------
  873|       |                    // Raw copy (most common path): 32-byte wild copies (zxc_copy32 width)
  874|       |                    // token is 7-bit (0-127), so len is 1-128 bytes
  875|   571k|                    const uint32_t len = (uint32_t)token + 1;
  876|   571k|                    if (UNLIKELY(w_ptr + len > w_end || r_ptr + len > r_end))
  ------------------
  |  |  154|  1.14M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 181, False: 571k]
  |  |  |  Branch (154:42): [True: 13, False: 571k]
  |  |  |  Branch (154:42): [True: 168, False: 571k]
  |  |  ------------------
  ------------------
  877|    181|                        return ZXC_ERROR_CORRUPT_DATA;
  878|       |
  879|       |                    // Destination has ZXC_PAD_SIZE bytes of safe overrun space.
  880|       |                    // Source may not - check before wild copy.
  881|       |                    // Fast path: source holds a full zxc_copy32 read (most common)
  882|   571k|                    if (LIKELY(r_ptr + 32 <= r_end)) {
  ------------------
  |  |  148|   571k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 543k, False: 28.3k]
  |  |  ------------------
  ------------------
  883|       |                        // Single copy covers len <= 32 (most tokens)
  884|   543k|                        zxc_copy32(w_ptr, r_ptr);
  885|       |
  886|   543k|                        if (UNLIKELY(len > 32)) {
  ------------------
  |  |  154|   543k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 256k, False: 286k]
  |  |  ------------------
  ------------------
  887|       |                            // Unroll: max len=128, so max 4 copies total. The last
  888|       |                            // copy is placed to end exactly on len, overlapping the
  889|       |                            // previous one - unconditional stores beat branches here.
  890|   256k|                            if (len <= 64) {
  ------------------
  |  Branch (890:33): [True: 62.6k, False: 193k]
  ------------------
  891|  62.6k|                                zxc_copy32(w_ptr + len - 32, r_ptr + len - 32);
  892|   193k|                            } else if (len <= 96) {
  ------------------
  |  Branch (892:40): [True: 30.1k, False: 163k]
  ------------------
  893|  30.1k|                                zxc_copy32(w_ptr + 32, r_ptr + 32);
  894|  30.1k|                                zxc_copy32(w_ptr + len - 32, r_ptr + len - 32);
  895|   163k|                            } else {
  896|   163k|                                zxc_copy32(w_ptr + 32, r_ptr + 32);
  897|   163k|                                zxc_copy32(w_ptr + 64, r_ptr + 64);
  898|   163k|                                zxc_copy32(w_ptr + len - 32, r_ptr + len - 32);
  899|   163k|                            }
  900|   256k|                        }
  901|   543k|                    } else {
  902|       |                        // Near end of source: safe copy (rare cold path)
  903|  28.3k|                        ZXC_MEMCPY(w_ptr, r_ptr, len);
  ------------------
  |  |  170|  28.3k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  904|  28.3k|                    }
  905|       |
  906|   571k|                    w_ptr += len;
  907|   571k|                    r_ptr += len;
  908|   571k|                } else {
  909|       |                    // RLE run: fill with single byte
  910|   473k|                    const uint32_t len = (token & ZXC_LIT_LEN_MASK) + ZXC_LIT_RLE_RUN_MIN;
  ------------------
  |  |  546|   473k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  ------------------
  |  |  |  |  544|   473k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  ------------------
  ------------------
                                  const uint32_t len = (token & ZXC_LIT_LEN_MASK) + ZXC_LIT_RLE_RUN_MIN;
  ------------------
  |  |  550|   473k|#define ZXC_LIT_RLE_RUN_MIN 4U
  ------------------
  911|   473k|                    if (UNLIKELY(w_ptr + len > w_end || r_ptr >= r_end))
  ------------------
  |  |  154|   947k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 70, False: 473k]
  |  |  |  Branch (154:42): [True: 31, False: 473k]
  |  |  |  Branch (154:42): [True: 39, False: 473k]
  |  |  ------------------
  ------------------
  912|     70|                        return ZXC_ERROR_CORRUPT_DATA;
  913|   473k|                    ZXC_MEMSET(w_ptr, *r_ptr++, len);
  ------------------
  |  |  175|   473k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  914|   473k|                    w_ptr += len;
  915|   473k|                }
  916|  1.04M|            }
  917|  18.8k|            if (UNLIKELY(w_ptr != w_end || r_ptr != r_end)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  37.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 186, False: 18.6k]
  |  |  |  Branch (154:42): [True: 170, False: 18.6k]
  |  |  |  Branch (154:42): [True: 16, False: 18.6k]
  |  |  ------------------
  ------------------
  918|  18.6k|            l_ptr = rle_buf;
  919|  18.6k|            l_end = rle_buf + required_size;
  920|  18.6k|        } else {
  921|    313|            if (UNLIKELY(lit_stream_size != 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|    313|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 262, False: 51]
  |  |  ------------------
  ------------------
  922|     51|            l_ptr = p_curr;
  923|     51|            l_end = p_curr;
  924|     51|        }
  925|  26.1k|    } else if (gh.enc_lit == ZXC_SECTION_ENCODING_RAW) {
  ------------------
  |  Branch (925:16): [True: 25.9k, False: 125]
  ------------------
  926|  25.9k|        if (UNLIKELY(lit_stream_size > (size_t)(src + src_size - p_curr)))
  ------------------
  |  |  154|  25.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 347, False: 25.6k]
  |  |  ------------------
  ------------------
  927|    347|            return ZXC_ERROR_CORRUPT_DATA;
  928|  25.6k|        l_ptr = p_curr;
  929|  25.6k|        l_end = p_curr + lit_stream_size;
  930|  25.6k|    } else {
  931|    125|        return ZXC_ERROR_CORRUPT_DATA;
  932|    125|    }
  933|       |
  934|  48.5k|    p_curr += lit_stream_size;
  935|       |
  936|       |    // --- Stream Pointers & Validation ---
  937|       |    // Only the literal and token sizes are on the wire; offsets follow from the
  938|       |    // sequence count and width, and extras take the payload residue.
  939|  48.5k|    const size_t sz_tokens = tok_comp;
  940|  48.5k|    const uint64_t sz_offsets = SPL_OFF8 ? (uint64_t)gh.n_sequences : (uint64_t)gh.n_sequences * 2;
  ------------------
  |  |  553|  48.5k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  ------------------
  |  |  |  Branch (553:18): [True: 30.1k, False: 18.4k]
  |  |  ------------------
  ------------------
  941|       |
  942|  48.5k|    const size_t payload_avail = (size_t)(src + src_size - p_data);
  943|  48.5k|    const uint64_t consumed = (uint64_t)lit_stream_size + (uint64_t)sz_tokens + sz_offsets;
  944|  48.5k|    if (UNLIKELY(consumed > (uint64_t)payload_avail)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  48.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 546, False: 48.0k]
  |  |  ------------------
  ------------------
  945|  48.0k|    const size_t sz_extras = payload_avail - (size_t)consumed; /* slack padding included */
  946|       |
  947|       |    // RAW literals point into the caller's buffer and the wild copy overshoots,
  948|       |    // so it needs ZXC_BLOCK_LIT_SLACK readable bytes behind it. v7 staged short
  949|       |    // streams into a padded scratch here; v8 rejects instead. No underflow:
  950|       |    // lit_stream_size <= consumed <= payload_avail.
  951|  48.0k|    if (UNLIKELY(payload_avail - lit_stream_size < ZXC_BLOCK_LIT_SLACK))
  ------------------
  |  |  154|  48.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 58, False: 47.9k]
  |  |  ------------------
  ------------------
  952|     58|        return ZXC_ERROR_CORRUPT_DATA;
  953|       |
  954|       |    // Offsets/extras follow the on-disk token SECTION; sz_tokens is its size
  955|       |    // (== n_sequences when RAW, the Huffman payload size when enc_tok set).
  956|  47.9k|    const uint8_t* o_ptr = p_curr + sz_tokens;
  957|  47.9k|    const uint8_t* e_ptr = o_ptr + (size_t)sz_offsets;
  958|  47.9k|    const uint8_t* const e_end = e_ptr + sz_extras;
  959|       |
  960|  47.9k|    const uint8_t* RESTRICT t_ptr;
  961|  47.9k|    if (!tok_entropy) {
  ------------------
  |  Branch (961:9): [True: 34.1k, False: 13.8k]
  ------------------
  962|       |        // enc_tok == 2 was re-routed right after the header parse; any other
  963|       |        // value would have mis-sized the section descriptors above.
  964|  34.1k|        if (UNLIKELY(gh.enc_tok != 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  34.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 32, False: 34.0k]
  |  |  ------------------
  ------------------
  965|  34.0k|        t_ptr = p_curr;
  966|  34.0k|    } else {
  967|  13.8k|        if (UNLIKELY(gh.enc_tok != ZXC_SECTION_ENCODING_HUFFMAN)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  13.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 13.8k]
  |  |  ------------------
  ------------------
  968|  13.8k|        const int rc = zxc_decode_tok_pivco(ctx, p_curr, sz_tokens, gh.n_sequences);
  969|  13.8k|        if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  154|  13.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 270, False: 13.5k]
  |  |  ------------------
  ------------------
  970|  13.5k|        t_ptr = ctx->tok_buffer;
  971|  13.5k|    }
  972|       |
  973|  47.6k|    uint8_t* d_ptr = dst;
  974|  47.6k|    const uint8_t* const d_end = dst + dst_capacity;
  975|       |    // Lowest address a match may reach: the dictionary prefix if any, else dst.
  976|  47.6k|    const uint8_t* const d_floor = dst - dict_size;
  977|       |    // 4x loop margin: four sequences without a varint, the wild-copy overshoot, 4 of safety.
  978|  47.6k|    const size_t d_margin_4x = 4 * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE + 4;
  ------------------
  |  |  663|  47.6k|#define ZXC_SPL_MAX_INLINE_OUT_PER_SEQ ((ZXC_TOKEN_LL_MASK - 1U) + ZXC_SPL_MAX_INLINE_ML) /* 33 */
  |  |  ------------------
  |  |  |  |  511|  47.6k|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  507|  47.6k|#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 */
  |  |  ------------------
  |  |  |  |  672|  47.6k|#define ZXC_SPL_MAX_INLINE_ML (ZXC_SPL_INLINE_ML_CODE + ZXC_LZ_MIN_MATCH_LEN) /* 19 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  666|  47.6k|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  513|  47.6k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  509|  47.6k|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define ZXC_SPL_MAX_INLINE_ML (ZXC_SPL_INLINE_ML_CODE + ZXC_LZ_MIN_MATCH_LEN) /* 19 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  47.6k|#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;
  ------------------
  |  |  331|  47.6k|#define ZXC_PAD_SIZE 32
  ------------------
  979|  47.6k|    const uint8_t* const d_end_safe = (dst_capacity > d_margin_4x) ? d_end - d_margin_4x : dst;
  ------------------
  |  Branch (979:39): [True: 44.9k, False: 2.70k]
  ------------------
  980|       |
  981|       |    // Literal margin for the 4x loops: without a varint, ll <= 14 per sequence,
  982|       |    // so 4 * 14 = 56. Past that margin only the cold varint path checks l_ptr.
  983|  47.6k|    const size_t spl_sz_lit = (size_t)(l_end - l_ptr);
  984|  47.6k|    const size_t spl_margin_4x = 4 * (ZXC_TOKEN_LL_MASK - 1);  // 56
  ------------------
  |  |  511|  47.6k|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  ------------------
  |  |  |  |  507|  47.6k|#define ZXC_TOKEN_LIT_BITS 4
  |  |  ------------------
  ------------------
  985|  47.6k|    const size_t spl_margin_1x = ZXC_TOKEN_LL_MASK - 1;        // 14
  ------------------
  |  |  511|  47.6k|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  ------------------
  |  |  |  |  507|  47.6k|#define ZXC_TOKEN_LIT_BITS 4
  |  |  ------------------
  ------------------
  986|  47.6k|    const uint8_t* const l_end_safe_4x =
  987|  47.6k|        (spl_sz_lit > spl_margin_4x) ? l_end - spl_margin_4x : l_ptr;
  ------------------
  |  Branch (987:9): [True: 42.9k, False: 4.66k]
  ------------------
  988|  47.6k|    const uint8_t* const l_end_safe_1x =
  989|  47.6k|        (spl_sz_lit > spl_margin_1x) ? l_end - spl_margin_1x : l_ptr;
  ------------------
  |  Branch (989:9): [True: 45.2k, False: 2.44k]
  ------------------
  990|       |
  991|  47.6k|    uint32_t n_seq = gh.n_sequences;
  992|       |
  993|       |    // Offsets only need checking until the output is wider than the widest offset
  994|       |    // the format can encode (256 for 1-byte offsets, 65536 for 2-byte); past that
  995|       |    // none can reach below d_floor. A dictionary counts as already written, so a
  996|       |    // large one puts d_bounds at dst and skips the SAFE loop.
  997|  47.6k|    const size_t off_span = SPL_OFF8 ? (1U << 8) : (1U << 16);
  ------------------
  |  |  553|  47.6k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  ------------------
  |  |  |  Branch (553:18): [True: 29.7k, False: 17.8k]
  |  |  ------------------
  ------------------
  998|  47.6k|    const size_t span = (dict_size >= off_span) ? 0 : off_span - dict_size;
  ------------------
  |  Branch (998:25): [True: 0, False: 47.6k]
  ------------------
  999|  47.6k|    const uint8_t* const d_bounds = (span >= dst_capacity) ? d_end : dst + span;
  ------------------
  |  Branch (999:37): [True: 15.8k, False: 31.8k]
  ------------------
 1000|       |
 1001|       |    // --- SAFE Loop: offset validation until d_bounds (4x unroll) ---
 1002|  47.6k|    if (safe) {
  ------------------
  |  Branch (1002:9): [True: 23.9k, False: 23.7k]
  ------------------
 1003|       |        // SAFE variant: save per-batch state so overflow can rollback.
 1004|   685k|        while (n_seq >= 4 && d_ptr < d_end_safe && l_ptr < l_end_safe_4x && d_ptr < d_bounds) {
  ------------------
  |  Branch (1004:16): [True: 682k, False: 3.55k]
  |  Branch (1004:30): [True: 678k, False: 3.45k]
  |  Branch (1004:52): [True: 674k, False: 4.63k]
  |  Branch (1004:77): [True: 668k, False: 5.88k]
  ------------------
 1005|   668k|            const uint8_t* const t_save = t_ptr;
 1006|   668k|            const uint8_t* const o_save = o_ptr;
 1007|   668k|            const uint8_t* const e_save = e_ptr;
 1008|   668k|            uint8_t* const d_save = d_ptr;
 1009|   668k|            const uint8_t* const l_save = l_ptr;
 1010|   668k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  ------------------
  |  |  611|   668k|    do {                                                                                           \
  |  |  612|   668k|        uint32_t tokens = zxc_le32(t_ptr);                                                         \
  |  |  613|   668k|        t_ptr += sizeof(uint32_t);                                                                 \
  |  |  614|   668k|        uint64_t offs;                                                                             \
  |  |  615|   668k|        if (SPL_OFF8) {                                                                            \
  |  |  ------------------
  |  |  |  |  553|   668k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (553:18): [True: 20.8k, False: 647k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  616|  20.8k|            uint64_t x = zxc_le32(o_ptr);                                                          \
  |  |  617|  20.8k|            o_ptr += sizeof(uint32_t);                                                             \
  |  |  618|  20.8k|            x = (x | (x << 16)) & 0x0000FFFF0000FFFFULL;                                           \
  |  |  619|  20.8k|            offs = (x | (x << 8)) & 0x00FF00FF00FF00FFULL;                                         \
  |  |  620|   647k|        } else {                                                                                   \
  |  |  621|   647k|            offs = zxc_le64(o_ptr);                                                                \
  |  |  622|   647k|            o_ptr += sizeof(uint64_t);                                                             \
  |  |  623|   647k|        }                                                                                          \
  |  |  624|   668k|        DECODE_SPL_SEQ((tokens & 0x0F0) >> 4, (tokens & 0x00F),                                    \
  |  |  ------------------
  |  |  |  |  569|   668k|    do {                                                                                        \
  |  |  |  |  570|   668k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  571|   668k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  572|   668k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   668k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 107k, False: 561k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  573|   107k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  574|   107k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  575|   107k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  576|   107k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  577|   107k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  578|   107k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   214k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 576, False: 106k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 190, False: 107k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 386, False: 106k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  579|   107k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  580|   107k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  581|   107k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  582|   107k|                ON_FAIL;                                                                        \
  |  |  |  |  583|   107k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  584|   561k|        } else {                                                                                \
  |  |  |  |  585|   561k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  586|   561k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  587|   561k|        }                                                                                       \
  |  |  |  |  588|   668k|        l_ptr += ll;                                                                            \
  |  |  |  |  589|   667k|        d_ptr += ll;                                                                            \
  |  |  |  |  590|   667k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   667k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 106k, False: 561k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  591|   106k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  592|   106k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  593|   106k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   106k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 1.38k, False: 104k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  594|   106k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  595|   106k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  596|   106k|                ON_FAIL;                                                                        \
  |  |  |  |  597|   106k|        }                                                                                       \
  |  |  |  |  598|   667k|        ml += ZXC_LZ_MIN_MATCH_LEN;                                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   666k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  599|   666k|        DECODE(ml, OFF, zxc_decode_copy_match_spl);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1010|   666k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  528|   666k|    do {                                                                              \
  |  |  |  |  |  |  |  |  529|   666k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|   666k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (154:21): [True: 251, False: 666k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  530|   666k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  531|   666k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  532|   666k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (532:14): [Folded, False: 666k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  600|   666k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (600:14): [Folded, False: 666k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  625|   668k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs & 0xFFFF),                             \
  |  |  626|   668k|                       ((tokens >> 12) & 0xF) + ((tokens >> 20) & 0xF) + (tokens >> 28), 3U,       \
  |  |  627|   668k|                       DECODE, ON_FAIL);                                                           \
  |  |  628|   668k|        DECODE_SPL_SEQ((tokens & 0x0F000) >> 12, (tokens & 0x00F00) >> 8,                          \
  |  |  ------------------
  |  |  |  |  569|   666k|    do {                                                                                        \
  |  |  |  |  570|   666k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  571|   666k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  572|   666k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   666k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 102k, False: 564k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  573|   102k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  574|   102k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  575|   102k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  576|   102k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  577|   102k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  578|   102k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   203k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 517, False: 101k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 224, False: 101k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 293, False: 101k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  579|   102k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  580|   102k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  581|   102k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  582|   102k|                ON_FAIL;                                                                        \
  |  |  |  |  583|   102k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  584|   564k|        } else {                                                                                \
  |  |  |  |  585|   564k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  586|   564k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  587|   564k|        }                                                                                       \
  |  |  |  |  588|   666k|        l_ptr += ll;                                                                            \
  |  |  |  |  589|   665k|        d_ptr += ll;                                                                            \
  |  |  |  |  590|   665k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   665k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 104k, False: 560k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  591|   104k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  592|   104k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  593|   104k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   104k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 835, False: 103k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  594|   104k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  595|   104k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  596|   104k|                ON_FAIL;                                                                        \
  |  |  |  |  597|   104k|        }                                                                                       \
  |  |  |  |  598|   665k|        ml += ZXC_LZ_MIN_MATCH_LEN;                                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   664k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  599|   664k|        DECODE(ml, OFF, zxc_decode_copy_match_spl);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1010|   664k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  528|   664k|    do {                                                                              \
  |  |  |  |  |  |  |  |  529|   664k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|   664k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (154:21): [True: 66, False: 664k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  530|   664k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  531|   664k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  532|   664k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (532:14): [Folded, False: 664k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  600|   664k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (600:14): [Folded, False: 664k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  629|   666k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 16) & 0xFFFF),                     \
  |  |  630|   666k|                       ((tokens >> 20) & 0xF) + (tokens >> 28), 2U, DECODE, ON_FAIL);              \
  |  |  631|   666k|        DECODE_SPL_SEQ((tokens & 0x0F00000) >> 20, (tokens & 0x00F0000) >> 16,                     \
  |  |  ------------------
  |  |  |  |  569|   664k|    do {                                                                                        \
  |  |  |  |  570|   664k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  571|   664k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  572|   664k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   664k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 99.6k, False: 565k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  573|  99.6k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  574|  99.6k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  575|  99.6k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  576|  99.6k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  577|  99.6k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  578|  99.6k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   199k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 543, False: 99.0k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 245, False: 99.3k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 298, False: 99.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  579|  99.6k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  580|  99.6k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  581|  99.6k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  582|  99.6k|                ON_FAIL;                                                                        \
  |  |  |  |  583|  99.6k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  584|   565k|        } else {                                                                                \
  |  |  |  |  585|   565k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  586|   565k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  587|   565k|        }                                                                                       \
  |  |  |  |  588|   664k|        l_ptr += ll;                                                                            \
  |  |  |  |  589|   664k|        d_ptr += ll;                                                                            \
  |  |  |  |  590|   664k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   664k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 103k, False: 560k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  591|   103k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  592|   103k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  593|   103k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   103k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 761, False: 102k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  594|   103k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  595|   103k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  596|   103k|                ON_FAIL;                                                                        \
  |  |  |  |  597|   103k|        }                                                                                       \
  |  |  |  |  598|   664k|        ml += ZXC_LZ_MIN_MATCH_LEN;                                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   663k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  599|   663k|        DECODE(ml, OFF, zxc_decode_copy_match_spl);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1010|   663k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  528|   663k|    do {                                                                              \
  |  |  |  |  |  |  |  |  529|   663k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|   663k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (154:21): [True: 60, False: 663k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  530|   663k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  531|   663k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  532|   663k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (532:14): [Folded, False: 663k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  600|   663k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (600:14): [Folded, False: 663k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  632|   664k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 32) & 0xFFFF), (tokens >> 28), 1U, \
  |  |  633|   664k|                       DECODE, ON_FAIL);                                                           \
  |  |  634|   664k|        DECODE_SPL_SEQ((tokens >> 28), (tokens >> 24) & 0x0F,                                      \
  |  |  ------------------
  |  |  |  |  569|   663k|    do {                                                                                        \
  |  |  |  |  570|   663k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  571|   663k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  572|   663k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   663k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 100k, False: 563k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  573|   100k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  574|   100k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  575|   100k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  576|   100k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  577|   100k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  578|   100k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   200k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 542, False: 99.6k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 277, False: 99.9k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 265, False: 99.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  579|   100k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  580|   100k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  581|   100k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  582|   100k|                ON_FAIL;                                                                        \
  |  |  |  |  583|   100k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  584|   563k|        } else {                                                                                \
  |  |  |  |  585|   563k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  586|   563k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  587|   563k|        }                                                                                       \
  |  |  |  |  588|   663k|        l_ptr += ll;                                                                            \
  |  |  |  |  589|   662k|        d_ptr += ll;                                                                            \
  |  |  |  |  590|   662k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   662k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 104k, False: 557k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  591|   104k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  592|   104k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  593|   104k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   104k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 801, False: 104k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  594|   104k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  595|   104k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  596|   104k|                ON_FAIL;                                                                        \
  |  |  |  |  597|   104k|        }                                                                                       \
  |  |  |  |  598|   662k|        ml += ZXC_LZ_MIN_MATCH_LEN;                                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   661k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  599|   661k|        DECODE(ml, OFF, zxc_decode_copy_match_spl);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1010|   661k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  528|   661k|    do {                                                                              \
  |  |  |  |  |  |  |  |  529|   661k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|   661k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (154:21): [True: 58, False: 661k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  530|   661k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  531|   661k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  532|   661k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (532:14): [Folded, False: 661k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  600|   661k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (600:14): [Folded, False: 661k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  635|   663k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs >> 48), 0, 0U, DECODE, ON_FAIL);       \
  |  |  636|   663k|        n_seq -= 4;                                                                                \
  |  |  637|   661k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (637:14): [Folded, False: 661k]
  |  |  ------------------
  ------------------
 1011|   661k|            continue;
 1012|       |
 1013|   661k|        rollback_safe_4x:
 1014|  5.96k|            t_ptr = t_save;
 1015|  5.96k|            o_ptr = o_save;
 1016|  5.96k|            e_ptr = e_save;
 1017|  5.96k|            d_ptr = d_save;
 1018|  5.96k|            l_ptr = l_save;
 1019|  5.96k|            break;
 1020|   668k|        }
 1021|  23.9k|    } else {
 1022|   814k|        while (n_seq >= 4 && d_ptr < d_end_safe && l_ptr < l_end_safe_4x && d_ptr < d_bounds) {
  ------------------
  |  Branch (1022:16): [True: 809k, False: 5.45k]
  |  Branch (1022:30): [True: 807k, False: 1.72k]
  |  Branch (1022:52): [True: 801k, False: 5.77k]
  |  Branch (1022:77): [True: 794k, False: 6.93k]
  ------------------
 1023|   794k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  ------------------
  |  |  611|   794k|    do {                                                                                           \
  |  |  612|   794k|        uint32_t tokens = zxc_le32(t_ptr);                                                         \
  |  |  613|   794k|        t_ptr += sizeof(uint32_t);                                                                 \
  |  |  614|   794k|        uint64_t offs;                                                                             \
  |  |  615|   794k|        if (SPL_OFF8) {                                                                            \
  |  |  ------------------
  |  |  |  |  553|   794k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (553:18): [True: 20.4k, False: 774k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  616|  20.4k|            uint64_t x = zxc_le32(o_ptr);                                                          \
  |  |  617|  20.4k|            o_ptr += sizeof(uint32_t);                                                             \
  |  |  618|  20.4k|            x = (x | (x << 16)) & 0x0000FFFF0000FFFFULL;                                           \
  |  |  619|  20.4k|            offs = (x | (x << 8)) & 0x00FF00FF00FF00FFULL;                                         \
  |  |  620|   774k|        } else {                                                                                   \
  |  |  621|   774k|            offs = zxc_le64(o_ptr);                                                                \
  |  |  622|   774k|            o_ptr += sizeof(uint64_t);                                                             \
  |  |  623|   774k|        }                                                                                          \
  |  |  624|   794k|        DECODE_SPL_SEQ((tokens & 0x0F0) >> 4, (tokens & 0x00F),                                    \
  |  |  ------------------
  |  |  |  |  569|   794k|    do {                                                                                        \
  |  |  |  |  570|   794k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  571|   794k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  572|   794k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   794k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 127k, False: 666k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  573|   127k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  574|   127k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  575|   127k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  576|   127k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  577|   127k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  578|   127k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   255k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 417, False: 127k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 226, False: 127k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 191, False: 127k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  579|   127k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  580|   127k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  581|   127k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  582|   127k|                ON_FAIL;                                                                        \
  |  |  |  |  583|   127k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  584|   666k|        } else {                                                                                \
  |  |  |  |  585|   666k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  586|   666k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  587|   666k|        }                                                                                       \
  |  |  |  |  588|   794k|        l_ptr += ll;                                                                            \
  |  |  |  |  589|   794k|        d_ptr += ll;                                                                            \
  |  |  |  |  590|   794k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   794k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 123k, False: 670k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  591|   123k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  592|   123k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  593|   123k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   123k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 332, False: 123k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  594|   123k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  595|   123k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  596|   123k|                ON_FAIL;                                                                        \
  |  |  |  |  597|   123k|        }                                                                                       \
  |  |  |  |  598|   794k|        ml += ZXC_LZ_MIN_MATCH_LEN;                                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   793k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  599|   793k|        DECODE(ml, OFF, zxc_decode_copy_match_spl);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1023|   793k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  528|   793k|    do {                                                                              \
  |  |  |  |  |  |  |  |  529|   793k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|   793k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (154:21): [True: 142, False: 793k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  530|   793k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  531|   793k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  532|   793k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (532:14): [Folded, False: 793k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  600|   793k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (600:14): [Folded, False: 793k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  625|   794k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs & 0xFFFF),                             \
  |  |  626|   794k|                       ((tokens >> 12) & 0xF) + ((tokens >> 20) & 0xF) + (tokens >> 28), 3U,       \
  |  |  627|   794k|                       DECODE, ON_FAIL);                                                           \
  |  |  628|   794k|        DECODE_SPL_SEQ((tokens & 0x0F000) >> 12, (tokens & 0x00F00) >> 8,                          \
  |  |  ------------------
  |  |  |  |  569|   793k|    do {                                                                                        \
  |  |  |  |  570|   793k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  571|   793k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  572|   793k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   793k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 122k, False: 671k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  573|   122k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  574|   122k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  575|   122k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  576|   122k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  577|   122k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  578|   122k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   244k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 433, False: 121k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 287, False: 122k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 146, False: 121k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  579|   122k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  580|   122k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  581|   122k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  582|   122k|                ON_FAIL;                                                                        \
  |  |  |  |  583|   122k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  584|   671k|        } else {                                                                                \
  |  |  |  |  585|   671k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  586|   671k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  587|   671k|        }                                                                                       \
  |  |  |  |  588|   793k|        l_ptr += ll;                                                                            \
  |  |  |  |  589|   793k|        d_ptr += ll;                                                                            \
  |  |  |  |  590|   793k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   793k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 122k, False: 670k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  591|   122k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  592|   122k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  593|   122k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   122k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 370, False: 122k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  594|   122k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  595|   122k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  596|   122k|                ON_FAIL;                                                                        \
  |  |  |  |  597|   122k|        }                                                                                       \
  |  |  |  |  598|   793k|        ml += ZXC_LZ_MIN_MATCH_LEN;                                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   792k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  599|   792k|        DECODE(ml, OFF, zxc_decode_copy_match_spl);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1023|   792k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  528|   792k|    do {                                                                              \
  |  |  |  |  |  |  |  |  529|   792k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|   792k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (154:21): [True: 48, False: 792k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  530|   792k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  531|   792k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  532|   792k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (532:14): [Folded, False: 792k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  600|   792k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (600:14): [Folded, False: 792k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  629|   793k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 16) & 0xFFFF),                     \
  |  |  630|   793k|                       ((tokens >> 20) & 0xF) + (tokens >> 28), 2U, DECODE, ON_FAIL);              \
  |  |  631|   793k|        DECODE_SPL_SEQ((tokens & 0x0F00000) >> 20, (tokens & 0x00F0000) >> 16,                     \
  |  |  ------------------
  |  |  |  |  569|   792k|    do {                                                                                        \
  |  |  |  |  570|   792k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  571|   792k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  572|   792k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   792k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 119k, False: 673k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  573|   119k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  574|   119k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  575|   119k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  576|   119k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  577|   119k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  578|   119k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   238k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 470, False: 119k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 320, False: 119k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 150, False: 119k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  579|   119k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  580|   119k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  581|   119k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  582|   119k|                ON_FAIL;                                                                        \
  |  |  |  |  583|   119k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  584|   673k|        } else {                                                                                \
  |  |  |  |  585|   673k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  586|   673k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  587|   673k|        }                                                                                       \
  |  |  |  |  588|   792k|        l_ptr += ll;                                                                            \
  |  |  |  |  589|   792k|        d_ptr += ll;                                                                            \
  |  |  |  |  590|   792k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   792k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 121k, False: 670k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  591|   121k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  592|   121k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  593|   121k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   121k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 514, False: 121k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  594|   121k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  595|   121k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  596|   121k|                ON_FAIL;                                                                        \
  |  |  |  |  597|   121k|        }                                                                                       \
  |  |  |  |  598|   792k|        ml += ZXC_LZ_MIN_MATCH_LEN;                                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   791k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  599|   791k|        DECODE(ml, OFF, zxc_decode_copy_match_spl);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1023|   791k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  528|   791k|    do {                                                                              \
  |  |  |  |  |  |  |  |  529|   791k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|   791k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (154:21): [True: 35, False: 791k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  530|   791k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  531|   791k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  532|   791k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (532:14): [Folded, False: 791k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  600|   791k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (600:14): [Folded, False: 791k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  632|   792k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 32) & 0xFFFF), (tokens >> 28), 1U, \
  |  |  633|   792k|                       DECODE, ON_FAIL);                                                           \
  |  |  634|   792k|        DECODE_SPL_SEQ((tokens >> 28), (tokens >> 24) & 0x0F,                                      \
  |  |  ------------------
  |  |  |  |  569|   791k|    do {                                                                                        \
  |  |  |  |  570|   791k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  571|   791k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  572|   791k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   791k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 120k, False: 671k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  573|   120k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  574|   120k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  575|   120k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  576|   120k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  577|   120k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  578|   120k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   240k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 514, False: 119k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 381, False: 119k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 133, False: 119k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  579|   120k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  580|   120k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  581|   120k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  582|   120k|                ON_FAIL;                                                                        \
  |  |  |  |  583|   120k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  584|   671k|        } else {                                                                                \
  |  |  |  |  585|   671k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  586|   671k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  587|   671k|        }                                                                                       \
  |  |  |  |  588|   791k|        l_ptr += ll;                                                                            \
  |  |  |  |  589|   791k|        d_ptr += ll;                                                                            \
  |  |  |  |  590|   791k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   791k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 123k, False: 667k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  591|   123k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  592|   123k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  593|   123k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   123k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 537, False: 122k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  594|   123k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  595|   123k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  596|   123k|                ON_FAIL;                                                                        \
  |  |  |  |  597|   123k|        }                                                                                       \
  |  |  |  |  598|   791k|        ml += ZXC_LZ_MIN_MATCH_LEN;                                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   790k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  599|   790k|        DECODE(ml, OFF, zxc_decode_copy_match_spl);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1023|   790k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  528|   790k|    do {                                                                              \
  |  |  |  |  |  |  |  |  529|   790k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|   790k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (154:21): [True: 35, False: 790k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  530|   790k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  531|   790k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  532|   790k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (532:14): [Folded, False: 790k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  600|   790k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (600:14): [Folded, False: 790k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  635|   791k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs >> 48), 0, 0U, DECODE, ON_FAIL);       \
  |  |  636|   791k|        n_seq -= 4;                                                                                \
  |  |  637|   790k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (637:14): [Folded, False: 790k]
  |  |  ------------------
  ------------------
 1024|   794k|        }
 1025|  23.7k|    }
 1026|       |
 1027|       |    // --- FAST Loop: After threshold, no offset validation needed (4x unroll) ---
 1028|  43.3k|    if (safe) {
  ------------------
  |  Branch (1028:9): [True: 23.4k, False: 19.8k]
  ------------------
 1029|   224k|        while (n_seq >= 4 && d_ptr < d_end_safe && l_ptr < l_end_safe_4x) {
  ------------------
  |  Branch (1029:16): [True: 219k, False: 5.15k]
  |  Branch (1029:30): [True: 215k, False: 3.86k]
  |  Branch (1029:52): [True: 210k, False: 5.31k]
  ------------------
 1030|   210k|            const uint8_t* const t_save = t_ptr;
 1031|   210k|            const uint8_t* const o_save = o_ptr;
 1032|   210k|            const uint8_t* const e_save = e_ptr;
 1033|   210k|            uint8_t* const d_save = d_ptr;
 1034|   210k|            const uint8_t* const l_save = l_ptr;
 1035|   210k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  ------------------
  |  |  611|   210k|    do {                                                                                           \
  |  |  612|   210k|        uint32_t tokens = zxc_le32(t_ptr);                                                         \
  |  |  613|   210k|        t_ptr += sizeof(uint32_t);                                                                 \
  |  |  614|   210k|        uint64_t offs;                                                                             \
  |  |  615|   210k|        if (SPL_OFF8) {                                                                            \
  |  |  ------------------
  |  |  |  |  553|   210k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (553:18): [True: 49.4k, False: 161k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  616|  49.4k|            uint64_t x = zxc_le32(o_ptr);                                                          \
  |  |  617|  49.4k|            o_ptr += sizeof(uint32_t);                                                             \
  |  |  618|  49.4k|            x = (x | (x << 16)) & 0x0000FFFF0000FFFFULL;                                           \
  |  |  619|  49.4k|            offs = (x | (x << 8)) & 0x00FF00FF00FF00FFULL;                                         \
  |  |  620|   161k|        } else {                                                                                   \
  |  |  621|   161k|            offs = zxc_le64(o_ptr);                                                                \
  |  |  622|   161k|            o_ptr += sizeof(uint64_t);                                                             \
  |  |  623|   161k|        }                                                                                          \
  |  |  624|   210k|        DECODE_SPL_SEQ((tokens & 0x0F0) >> 4, (tokens & 0x00F),                                    \
  |  |  ------------------
  |  |  |  |  569|   210k|    do {                                                                                        \
  |  |  |  |  570|   210k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  571|   210k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  572|   210k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   210k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 29.7k, False: 180k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  573|  29.7k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  574|  29.7k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  575|  29.7k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  576|  29.7k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  577|  29.7k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  578|  29.7k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  59.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 865, False: 28.9k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 366, False: 29.4k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 499, False: 28.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  579|  29.7k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  580|  29.7k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  581|  29.7k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  582|  29.7k|                ON_FAIL;                                                                        \
  |  |  |  |  583|  29.7k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  584|   180k|        } else {                                                                                \
  |  |  |  |  585|   180k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  586|   180k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  587|   180k|        }                                                                                       \
  |  |  |  |  588|   210k|        l_ptr += ll;                                                                            \
  |  |  |  |  589|   209k|        d_ptr += ll;                                                                            \
  |  |  |  |  590|   209k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   209k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 46.5k, False: 163k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  591|  46.5k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  592|  46.5k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  593|  46.5k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  46.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 1.92k, False: 44.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  594|  46.5k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  595|  46.5k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  596|  46.5k|                ON_FAIL;                                                                        \
  |  |  |  |  597|  46.5k|        }                                                                                       \
  |  |  |  |  598|   209k|        ml += ZXC_LZ_MIN_MATCH_LEN;                                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   207k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  599|   207k|        DECODE(ml, OFF, zxc_decode_copy_match_spl);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1035|   207k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   207k|    do {                                 \
  |  |  |  |  |  |  |  |  538|   207k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  539|   207k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  540|   207k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (540:14): [Folded, False: 207k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  600|   207k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (600:14): [Folded, False: 207k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  625|   210k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs & 0xFFFF),                             \
  |  |  626|   210k|                       ((tokens >> 12) & 0xF) + ((tokens >> 20) & 0xF) + (tokens >> 28), 3U,       \
  |  |  627|   210k|                       DECODE, ON_FAIL);                                                           \
  |  |  628|   210k|        DECODE_SPL_SEQ((tokens & 0x0F000) >> 12, (tokens & 0x00F00) >> 8,                          \
  |  |  ------------------
  |  |  |  |  569|   207k|    do {                                                                                        \
  |  |  |  |  570|   207k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  571|   207k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  572|   207k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   207k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 28.9k, False: 178k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  573|  28.9k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  574|  28.9k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  575|  28.9k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  576|  28.9k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  577|  28.9k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  578|  28.9k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  57.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 863, False: 28.0k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 400, False: 28.5k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 463, False: 28.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  579|  28.9k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  580|  28.9k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  581|  28.9k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  582|  28.9k|                ON_FAIL;                                                                        \
  |  |  |  |  583|  28.9k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  584|   178k|        } else {                                                                                \
  |  |  |  |  585|   178k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  586|   178k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  587|   178k|        }                                                                                       \
  |  |  |  |  588|   207k|        l_ptr += ll;                                                                            \
  |  |  |  |  589|   206k|        d_ptr += ll;                                                                            \
  |  |  |  |  590|   206k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   206k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 45.4k, False: 161k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  591|  45.4k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  592|  45.4k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  593|  45.4k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  45.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 1.28k, False: 44.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  594|  45.4k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  595|  45.4k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  596|  45.4k|                ON_FAIL;                                                                        \
  |  |  |  |  597|  45.4k|        }                                                                                       \
  |  |  |  |  598|   206k|        ml += ZXC_LZ_MIN_MATCH_LEN;                                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   205k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  599|   205k|        DECODE(ml, OFF, zxc_decode_copy_match_spl);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1035|   205k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   205k|    do {                                 \
  |  |  |  |  |  |  |  |  538|   205k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  539|   205k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  540|   205k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (540:14): [Folded, False: 205k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  600|   205k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (600:14): [Folded, False: 205k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  629|   207k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 16) & 0xFFFF),                     \
  |  |  630|   207k|                       ((tokens >> 20) & 0xF) + (tokens >> 28), 2U, DECODE, ON_FAIL);              \
  |  |  631|   207k|        DECODE_SPL_SEQ((tokens & 0x0F00000) >> 20, (tokens & 0x00F0000) >> 16,                     \
  |  |  ------------------
  |  |  |  |  569|   205k|    do {                                                                                        \
  |  |  |  |  570|   205k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  571|   205k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  572|   205k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   205k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 28.8k, False: 176k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  573|  28.8k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  574|  28.8k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  575|  28.8k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  576|  28.8k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  577|  28.8k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  578|  28.8k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  57.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 864, False: 27.9k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 410, False: 28.4k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 454, False: 27.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  579|  28.8k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  580|  28.8k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  581|  28.8k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  582|  28.8k|                ON_FAIL;                                                                        \
  |  |  |  |  583|  28.8k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  584|   176k|        } else {                                                                                \
  |  |  |  |  585|   176k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  586|   176k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  587|   176k|        }                                                                                       \
  |  |  |  |  588|   205k|        l_ptr += ll;                                                                            \
  |  |  |  |  589|   204k|        d_ptr += ll;                                                                            \
  |  |  |  |  590|   204k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   204k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 44.0k, False: 160k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  591|  44.0k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  592|  44.0k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  593|  44.0k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  44.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 1.21k, False: 42.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  594|  44.0k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  595|  44.0k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  596|  44.0k|                ON_FAIL;                                                                        \
  |  |  |  |  597|  44.0k|        }                                                                                       \
  |  |  |  |  598|   204k|        ml += ZXC_LZ_MIN_MATCH_LEN;                                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   203k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  599|   203k|        DECODE(ml, OFF, zxc_decode_copy_match_spl);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1035|   203k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   203k|    do {                                 \
  |  |  |  |  |  |  |  |  538|   203k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  539|   203k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  540|   203k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (540:14): [Folded, False: 203k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  600|   203k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (600:14): [Folded, False: 203k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  632|   205k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 32) & 0xFFFF), (tokens >> 28), 1U, \
  |  |  633|   205k|                       DECODE, ON_FAIL);                                                           \
  |  |  634|   205k|        DECODE_SPL_SEQ((tokens >> 28), (tokens >> 24) & 0x0F,                                      \
  |  |  ------------------
  |  |  |  |  569|   203k|    do {                                                                                        \
  |  |  |  |  570|   203k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  571|   203k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  572|   203k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   203k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 28.3k, False: 175k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  573|  28.3k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  574|  28.3k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  575|  28.3k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  576|  28.3k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  577|  28.3k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  578|  28.3k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  56.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 861, False: 27.5k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 472, False: 27.9k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 389, False: 27.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  579|  28.3k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  580|  28.3k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  581|  28.3k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  582|  28.3k|                ON_FAIL;                                                                        \
  |  |  |  |  583|  28.3k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  584|   175k|        } else {                                                                                \
  |  |  |  |  585|   175k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  586|   175k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  587|   175k|        }                                                                                       \
  |  |  |  |  588|   203k|        l_ptr += ll;                                                                            \
  |  |  |  |  589|   202k|        d_ptr += ll;                                                                            \
  |  |  |  |  590|   202k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   202k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 42.9k, False: 159k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  591|  42.9k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  592|  42.9k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  593|  42.9k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  42.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 1.26k, False: 41.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  594|  42.9k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  595|  42.9k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  596|  42.9k|                ON_FAIL;                                                                        \
  |  |  |  |  597|  42.9k|        }                                                                                       \
  |  |  |  |  598|   202k|        ml += ZXC_LZ_MIN_MATCH_LEN;                                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   201k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  599|   201k|        DECODE(ml, OFF, zxc_decode_copy_match_spl);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1035|   201k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   201k|    do {                                 \
  |  |  |  |  |  |  |  |  538|   201k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  539|   201k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  540|   201k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (540:14): [Folded, False: 201k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  600|   201k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (600:14): [Folded, False: 201k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  635|   203k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs >> 48), 0, 0U, DECODE, ON_FAIL);       \
  |  |  636|   203k|        n_seq -= 4;                                                                                \
  |  |  637|   201k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (637:14): [Folded, False: 201k]
  |  |  ------------------
  ------------------
 1036|   201k|            continue;
 1037|       |
 1038|   201k|        rollback_fast_4x:
 1039|  9.13k|            t_ptr = t_save;
 1040|  9.13k|            o_ptr = o_save;
 1041|  9.13k|            e_ptr = e_save;
 1042|  9.13k|            d_ptr = d_save;
 1043|  9.13k|            l_ptr = l_save;
 1044|  9.13k|            break;
 1045|   210k|        }
 1046|  23.4k|    } else {
 1047|   252k|        while (n_seq >= 4 && d_ptr < d_end_safe && l_ptr < l_end_safe_4x) {
  ------------------
  |  Branch (1047:16): [True: 244k, False: 7.74k]
  |  Branch (1047:30): [True: 242k, False: 1.93k]
  |  Branch (1047:52): [True: 235k, False: 6.68k]
  ------------------
 1048|   235k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  ------------------
  |  |  611|   235k|    do {                                                                                           \
  |  |  612|   235k|        uint32_t tokens = zxc_le32(t_ptr);                                                         \
  |  |  613|   235k|        t_ptr += sizeof(uint32_t);                                                                 \
  |  |  614|   235k|        uint64_t offs;                                                                             \
  |  |  615|   235k|        if (SPL_OFF8) {                                                                            \
  |  |  ------------------
  |  |  |  |  553|   235k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (553:18): [True: 56.3k, False: 179k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  616|  56.3k|            uint64_t x = zxc_le32(o_ptr);                                                          \
  |  |  617|  56.3k|            o_ptr += sizeof(uint32_t);                                                             \
  |  |  618|  56.3k|            x = (x | (x << 16)) & 0x0000FFFF0000FFFFULL;                                           \
  |  |  619|  56.3k|            offs = (x | (x << 8)) & 0x00FF00FF00FF00FFULL;                                         \
  |  |  620|   179k|        } else {                                                                                   \
  |  |  621|   179k|            offs = zxc_le64(o_ptr);                                                                \
  |  |  622|   179k|            o_ptr += sizeof(uint64_t);                                                             \
  |  |  623|   179k|        }                                                                                          \
  |  |  624|   235k|        DECODE_SPL_SEQ((tokens & 0x0F0) >> 4, (tokens & 0x00F),                                    \
  |  |  ------------------
  |  |  |  |  569|   235k|    do {                                                                                        \
  |  |  |  |  570|   235k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  571|   235k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  572|   235k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   235k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 32.1k, False: 203k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  573|  32.1k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  574|  32.1k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  575|  32.1k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  576|  32.1k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  577|  32.1k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  578|  32.1k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  63.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 331, False: 31.7k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 275, False: 31.8k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 56, False: 31.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  579|  32.1k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  580|  32.1k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  581|  32.1k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  582|  32.1k|                ON_FAIL;                                                                        \
  |  |  |  |  583|  32.1k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  584|   203k|        } else {                                                                                \
  |  |  |  |  585|   203k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  586|   203k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  587|   203k|        }                                                                                       \
  |  |  |  |  588|   235k|        l_ptr += ll;                                                                            \
  |  |  |  |  589|   235k|        d_ptr += ll;                                                                            \
  |  |  |  |  590|   235k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   235k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 52.0k, False: 183k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  591|  52.0k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  592|  52.0k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  593|  52.0k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  52.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 602, False: 51.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  594|  52.0k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  595|  52.0k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  596|  52.0k|                ON_FAIL;                                                                        \
  |  |  |  |  597|  52.0k|        }                                                                                       \
  |  |  |  |  598|   235k|        ml += ZXC_LZ_MIN_MATCH_LEN;                                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   234k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  599|   234k|        DECODE(ml, OFF, zxc_decode_copy_match_spl);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1048|   234k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   234k|    do {                                 \
  |  |  |  |  |  |  |  |  538|   234k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  539|   234k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  540|   234k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (540:14): [Folded, False: 234k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  600|   234k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (600:14): [Folded, False: 234k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  625|   235k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs & 0xFFFF),                             \
  |  |  626|   235k|                       ((tokens >> 12) & 0xF) + ((tokens >> 20) & 0xF) + (tokens >> 28), 3U,       \
  |  |  627|   235k|                       DECODE, ON_FAIL);                                                           \
  |  |  628|   235k|        DECODE_SPL_SEQ((tokens & 0x0F000) >> 12, (tokens & 0x00F00) >> 8,                          \
  |  |  ------------------
  |  |  |  |  569|   234k|    do {                                                                                        \
  |  |  |  |  570|   234k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  571|   234k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  572|   234k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   234k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 31.8k, False: 202k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  573|  31.8k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  574|  31.8k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  575|  31.8k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  576|  31.8k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  577|  31.8k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  578|  31.8k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  63.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 367, False: 31.4k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 280, False: 31.5k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 87, False: 31.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  579|  31.8k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  580|  31.8k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  581|  31.8k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  582|  31.8k|                ON_FAIL;                                                                        \
  |  |  |  |  583|  31.8k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  584|   202k|        } else {                                                                                \
  |  |  |  |  585|   202k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  586|   202k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  587|   202k|        }                                                                                       \
  |  |  |  |  588|   234k|        l_ptr += ll;                                                                            \
  |  |  |  |  589|   234k|        d_ptr += ll;                                                                            \
  |  |  |  |  590|   234k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   234k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 51.8k, False: 182k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  591|  51.8k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  592|  51.8k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  593|  51.8k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  51.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 528, False: 51.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  594|  51.8k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  595|  51.8k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  596|  51.8k|                ON_FAIL;                                                                        \
  |  |  |  |  597|  51.8k|        }                                                                                       \
  |  |  |  |  598|   234k|        ml += ZXC_LZ_MIN_MATCH_LEN;                                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   233k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  599|   233k|        DECODE(ml, OFF, zxc_decode_copy_match_spl);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1048|   233k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   233k|    do {                                 \
  |  |  |  |  |  |  |  |  538|   233k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  539|   233k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  540|   233k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (540:14): [Folded, False: 233k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  600|   233k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (600:14): [Folded, False: 233k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  629|   234k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 16) & 0xFFFF),                     \
  |  |  630|   234k|                       ((tokens >> 20) & 0xF) + (tokens >> 28), 2U, DECODE, ON_FAIL);              \
  |  |  631|   234k|        DECODE_SPL_SEQ((tokens & 0x0F00000) >> 20, (tokens & 0x00F0000) >> 16,                     \
  |  |  ------------------
  |  |  |  |  569|   233k|    do {                                                                                        \
  |  |  |  |  570|   233k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  571|   233k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  572|   233k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   233k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 32.0k, False: 201k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  573|  32.0k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  574|  32.0k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  575|  32.0k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  576|  32.0k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  577|  32.0k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  578|  32.0k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  63.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 368, False: 31.6k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 283, False: 31.7k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 85, False: 31.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  579|  32.0k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  580|  32.0k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  581|  32.0k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  582|  32.0k|                ON_FAIL;                                                                        \
  |  |  |  |  583|  32.0k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  584|   201k|        } else {                                                                                \
  |  |  |  |  585|   201k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  586|   201k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  587|   201k|        }                                                                                       \
  |  |  |  |  588|   233k|        l_ptr += ll;                                                                            \
  |  |  |  |  589|   233k|        d_ptr += ll;                                                                            \
  |  |  |  |  590|   233k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   233k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 51.1k, False: 182k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  591|  51.1k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  592|  51.1k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  593|  51.1k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  51.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 496, False: 50.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  594|  51.1k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  595|  51.1k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  596|  51.1k|                ON_FAIL;                                                                        \
  |  |  |  |  597|  51.1k|        }                                                                                       \
  |  |  |  |  598|   233k|        ml += ZXC_LZ_MIN_MATCH_LEN;                                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   233k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  599|   233k|        DECODE(ml, OFF, zxc_decode_copy_match_spl);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1048|   233k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   233k|    do {                                 \
  |  |  |  |  |  |  |  |  538|   233k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  539|   233k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  540|   233k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (540:14): [Folded, False: 233k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  600|   233k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (600:14): [Folded, False: 233k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  632|   233k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 32) & 0xFFFF), (tokens >> 28), 1U, \
  |  |  633|   233k|                       DECODE, ON_FAIL);                                                           \
  |  |  634|   233k|        DECODE_SPL_SEQ((tokens >> 28), (tokens >> 24) & 0x0F,                                      \
  |  |  ------------------
  |  |  |  |  569|   233k|    do {                                                                                        \
  |  |  |  |  570|   233k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  571|   233k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  572|   233k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   233k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 31.9k, False: 201k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  573|  31.9k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  574|  31.9k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  575|  31.9k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  576|  31.9k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  577|  31.9k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  578|  31.9k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  63.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 347, False: 31.5k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 286, False: 31.6k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 61, False: 31.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  579|  31.9k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  580|  31.9k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  581|  31.9k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  582|  31.9k|                ON_FAIL;                                                                        \
  |  |  |  |  583|  31.9k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  584|   201k|        } else {                                                                                \
  |  |  |  |  585|   201k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  586|   201k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  587|   201k|        }                                                                                       \
  |  |  |  |  588|   233k|        l_ptr += ll;                                                                            \
  |  |  |  |  589|   232k|        d_ptr += ll;                                                                            \
  |  |  |  |  590|   232k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   232k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 50.5k, False: 182k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  591|  50.5k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  592|  50.5k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  593|  50.5k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  50.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 494, False: 50.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  594|  50.5k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  595|  50.5k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  596|  50.5k|                ON_FAIL;                                                                        \
  |  |  |  |  597|  50.5k|        }                                                                                       \
  |  |  |  |  598|   232k|        ml += ZXC_LZ_MIN_MATCH_LEN;                                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   232k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  599|   232k|        DECODE(ml, OFF, zxc_decode_copy_match_spl);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1048|   232k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   232k|    do {                                 \
  |  |  |  |  |  |  |  |  538|   232k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  539|   232k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  540|   232k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (540:14): [Folded, False: 232k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  600|   232k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (600:14): [Folded, False: 232k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  635|   233k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs >> 48), 0, 0U, DECODE, ON_FAIL);       \
  |  |  636|   233k|        n_seq -= 4;                                                                                \
  |  |  637|   232k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (637:14): [Folded, False: 232k]
  |  |  ------------------
  ------------------
 1049|   235k|        }
 1050|  19.8k|    }
 1051|       |
 1052|       |    // --- Remaining 1 sequence (Fast Path) ---
 1053|   172k|    while (n_seq > 0 && d_ptr < d_end_safe && l_ptr < l_end_safe_1x) {
  ------------------
  |  Branch (1053:12): [True: 165k, False: 7.55k]
  |  Branch (1053:25): [True: 149k, False: 16.0k]
  |  Branch (1053:47): [True: 142k, False: 6.73k]
  ------------------
 1054|       |        // Save pointers before reading (in case we need to fall back to Safe Path)
 1055|   142k|        const uint8_t* t_save = t_ptr;
 1056|   142k|        const uint8_t* o_save = o_ptr;
 1057|   142k|        const uint8_t* e_save = e_ptr;
 1058|       |
 1059|   142k|        uint8_t token = *t_ptr++;
 1060|   142k|        uint64_t ll = token >> ZXC_TOKEN_LIT_BITS;
  ------------------
  |  |  507|   142k|#define ZXC_TOKEN_LIT_BITS 4
  ------------------
 1061|   142k|        uint64_t ml = token & ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  513|   142k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  509|   142k|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
 1062|   142k|        uint32_t offset = ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  676|   142k|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1063|   142k|        if (SPL_OFF8) {
  ------------------
  |  |  553|   142k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  ------------------
  |  |  |  Branch (553:18): [True: 73.0k, False: 69.3k]
  |  |  ------------------
  ------------------
 1064|  73.0k|            offset += *o_ptr++;  // 1-byte offset (biased)
 1065|  73.0k|        } else {
 1066|  69.3k|            offset += zxc_le16(o_ptr);  // 2-byte offset (biased)
 1067|  69.3k|            o_ptr += sizeof(uint16_t);
 1068|  69.3k|        }
 1069|       |
 1070|   142k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {
  ------------------
  |  |  154|   142k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 12.8k, False: 129k]
  |  |  ------------------
  ------------------
 1071|  12.8k|            ll += zxc_read_varint(&e_ptr, e_end);
 1072|  12.8k|            if (UNLIKELY(ll > (size_t)(l_end - l_ptr))) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  154|  12.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 2.43k, False: 10.3k]
  |  |  ------------------
  ------------------
 1073|  12.8k|        }
 1074|   139k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) ml += zxc_read_varint(&e_ptr, e_end);
  ------------------
  |  |  154|   139k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 47.3k, False: 92.6k]
  |  |  ------------------
  ------------------
 1075|   139k|        ml += ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  575|   139k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1076|       |
 1077|       |        // Check bounds before wild copies - if too close to end, fall back to Safe Path
 1078|   139k|        if (UNLIKELY(ll + ml + ZXC_PAD_SIZE > (size_t)(d_end - d_ptr))) {
  ------------------
  |  |  154|   139k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 6.91k, False: 133k]
  |  |  ------------------
  ------------------
 1079|  6.91k|            t_ptr = t_save;
 1080|  6.91k|            o_ptr = o_save;
 1081|  6.91k|            e_ptr = e_save;
 1082|  6.91k|            break;
 1083|  6.91k|        }
 1084|       |
 1085|       |        // Unlike the 4x batch the copy cannot sit in the varint branch's else -
 1086|       |        // the rollback above must run first - so re-test ll instead. Exact:
 1087|       |        // the escape leaves ll >= ZXC_TOKEN_LL_MASK.
 1088|   133k|        if (LIKELY(ll < ZXC_TOKEN_LL_MASK)) {
  ------------------
  |  |  148|   133k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 124k, False: 8.94k]
  |  |  ------------------
  ------------------
 1089|   124k|            zxc_copy16(d_ptr, l_ptr);
 1090|   124k|        } else {
 1091|  8.94k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);
 1092|  8.94k|        }
 1093|   133k|        l_ptr += ll;
 1094|   133k|        d_ptr += ll;
 1095|       |
 1096|   133k|        if (UNLIKELY(d_ptr < d_bounds && (size_t)(d_ptr - d_floor) < offset))
  ------------------
  |  |  154|   212k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 107, False: 132k]
  |  |  |  Branch (154:42): [True: 79.5k, False: 53.5k]
  |  |  |  Branch (154:42): [True: 107, False: 79.4k]
  |  |  ------------------
  ------------------
 1097|    107|            return ZXC_ERROR_BAD_OFFSET;
 1098|       |
 1099|       |        // The loop entry check guarantees ll + ml + ZXC_PAD_SIZE bytes of
 1100|       |        // headroom, so the wild-copy ladder (incl. overlap/fill runs) is safe.
 1101|   132k|        zxc_decode_copy_match_spl(d_ptr, offset, ml);
 1102|   132k|        d_ptr += ml;
 1103|   132k|        n_seq--;
 1104|   132k|    }
 1105|       |
 1106|       |    // --- Safe Path for Remaining Sequences ---
 1107|   154k|    while (n_seq > 0) {
  ------------------
  |  Branch (1107:12): [True: 126k, False: 27.8k]
  ------------------
 1108|   126k|        uint8_t token = *t_ptr++;
 1109|   126k|        uint64_t ll = token >> ZXC_TOKEN_LIT_BITS;
  ------------------
  |  |  507|   126k|#define ZXC_TOKEN_LIT_BITS 4
  ------------------
 1110|   126k|        uint64_t ml = token & ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  513|   126k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  509|   126k|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
 1111|   126k|        uint32_t offset = ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  676|   126k|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1112|   126k|        if (SPL_OFF8) {
  ------------------
  |  |  553|   126k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  ------------------
  |  |  |  Branch (553:18): [True: 65.2k, False: 61.0k]
  |  |  ------------------
  ------------------
 1113|  65.2k|            offset += *o_ptr++;  // 1-byte offset (biased)
 1114|  65.2k|        } else {
 1115|  61.0k|            offset += zxc_le16(o_ptr);  // 2-byte offset (biased)
 1116|  61.0k|            o_ptr += sizeof(uint16_t);
 1117|  61.0k|        }
 1118|       |
 1119|   126k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) ll += zxc_read_varint(&e_ptr, e_end);
  ------------------
  |  |  154|   126k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 11.5k, False: 114k]
  |  |  ------------------
  ------------------
 1120|   126k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) ml += zxc_read_varint(&e_ptr, e_end);
  ------------------
  |  |  154|   126k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 32.2k, False: 94.0k]
  |  |  ------------------
  ------------------
 1121|   126k|        ml += ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  575|   126k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1122|       |
 1123|   126k|        if (UNLIKELY(ll + ml > (size_t)(d_end - d_ptr) || ll > (size_t)(l_end - l_ptr)))
  ------------------
  |  |  154|   244k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 9.34k, False: 116k]
  |  |  |  Branch (154:42): [True: 8.32k, False: 118k]
  |  |  |  Branch (154:42): [True: 1.02k, False: 116k]
  |  |  ------------------
  ------------------
 1124|  9.34k|            return ZXC_ERROR_OVERFLOW;
 1125|   116k|        ZXC_MEMCPY(d_ptr, l_ptr, ll);
  ------------------
  |  |  170|   116k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1126|   116k|        l_ptr += ll;
 1127|   116k|        d_ptr += ll;
 1128|       |
 1129|   116k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < offset)) return ZXC_ERROR_BAD_OFFSET;
  ------------------
  |  |  154|   116k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 132, False: 116k]
  |  |  ------------------
  ------------------
 1130|   116k|        const uint8_t* match_src = d_ptr - offset;
 1131|       |
 1132|   116k|        zxc_decode_copy_match_exact(d_ptr, match_src, offset, ml);
 1133|   116k|        d_ptr += ml;
 1134|   116k|        n_seq--;
 1135|   116k|    }
 1136|       |
 1137|       |    // --- Trailing Literals ---
 1138|       |    // Copy remaining literals from source stream (literal exhaustion)
 1139|  27.8k|    if (UNLIKELY(l_ptr > l_end)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  27.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 27.8k]
  |  |  ------------------
  ------------------
 1140|  27.8k|    if (UNLIKELY(d_ptr > d_end)) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  154|  27.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 27.8k]
  |  |  ------------------
  ------------------
 1141|       |
 1142|  27.8k|    const size_t remaining_literals = (size_t)(l_end - l_ptr);
 1143|  27.8k|    if (UNLIKELY(remaining_literals > (size_t)(d_end - d_ptr))) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  154|  27.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 191, False: 27.6k]
  |  |  ------------------
  ------------------
 1144|  27.6k|    ZXC_MEMCPY(d_ptr, l_ptr, remaining_literals);
  ------------------
  |  |  170|  27.6k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1145|  27.6k|    d_ptr += remaining_literals;
 1146|       |
 1147|  27.6k|    return (int)(d_ptr - dst);
 1148|  27.8k|}
zxc_decompress.c:zxc_decode_block_spl_entropy_safe:
 1433|  8.03k|                                                          const size_t dst_capacity) {
 1434|  8.03k|    return zxc_decode_block_spl_impl(ctx, src, src_size, dst, dst_capacity, 1, 0, 1);
 1435|  8.03k|}
zxc_decompress.c:zxc_decode_block_spl_entropy:
 1417|  7.33k|                                                     const size_t dst_capacity) {
 1418|  7.33k|    return zxc_decode_block_spl_impl(ctx, src, src_size, dst, dst_capacity, 0, 0, 1);
 1419|  7.33k|}
zxc_decompress.c:zxc_decode_lit_pivco:
  717|  4.52k|                                                      const size_t required_size) {
  718|  4.52k|    const int arc = zxc_ensure_entropy_scratch(ctx);
  719|  4.52k|    if (UNLIKELY(arc != ZXC_OK)) return arc;
  ------------------
  |  |  154|  4.52k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 4.52k]
  |  |  ------------------
  ------------------
  720|  4.52k|    if (UNLIKELY(ctx->lit_buffer_cap < required_size + ZXC_PAD_SIZE ||
  ------------------
  |  |  154|  9.03k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 5, False: 4.51k]
  |  |  |  Branch (154:42): [True: 5, False: 4.51k]
  |  |  |  Branch (154:42): [True: 0, False: 4.51k]
  |  |  ------------------
  ------------------
  721|  4.52k|                 ctx->pivco_scratch_cap < required_size + ZXC_PIVCO_SCRATCH_PAD))
  722|      5|        return ZXC_ERROR_DST_TOO_SMALL;
  723|  4.51k|    return zxc_huf_decode_section(payload, psize, ctx->lit_buffer, required_size,
  ------------------
  |  |   29|  4.51k|#define zxc_huf_decode_section ZXC_CAT(zxc_huf_decode_section, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   23|  4.51k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   22|  4.51k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  724|  4.51k|                                  ctx->pivco_scratch);
  725|  4.52k|}
zxc_decompress.c:zxc_ensure_entropy_scratch:
  709|  18.3k|static ZXC_NOINLINE ZXC_COLD int zxc_ensure_entropy_scratch(const zxc_cctx_t* RESTRICT ctx) {
  710|  18.3k|    if (LIKELY(ctx->pivco_scratch)) return ZXC_OK;
  ------------------
  |  |  148|  18.3k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 13.9k, False: 4.38k]
  |  |  ------------------
  ------------------
  711|  4.38k|    return zxc_cctx_alloc_entropy_scratch((zxc_cctx_t*)(uintptr_t)ctx);
  712|  18.3k|}
zxc_decompress.c:zxc_decode_lit_pivco_dict:
  730|     70|                                                           const size_t required_size) {
  731|     70|    if (UNLIKELY(!ctx->dict_huf_tree_ok)) return ZXC_ERROR_DICT_REQUIRED;
  ------------------
  |  |  154|     70|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 70, False: 0]
  |  |  ------------------
  ------------------
  732|      0|    const int arc = zxc_ensure_entropy_scratch(ctx);
  733|      0|    if (UNLIKELY(arc != ZXC_OK)) return arc;
  ------------------
  |  |  154|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  734|      0|    if (UNLIKELY(ctx->lit_buffer_cap < required_size + ZXC_PAD_SIZE ||
  ------------------
  |  |  154|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 0]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  735|      0|                 ctx->pivco_scratch_cap < required_size + ZXC_PIVCO_SCRATCH_PAD))
  736|      0|        return ZXC_ERROR_DST_TOO_SMALL;
  737|      0|    return zxc_huf_decode_section_dict(payload, psize, ctx->lit_buffer, required_size,
  ------------------
  |  |   30|      0|#define zxc_huf_decode_section_dict ZXC_CAT(zxc_huf_decode_section_dict, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   23|      0|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   22|      0|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  738|      0|                                       &ctx->dict_huf->tree, ctx->pivco_scratch);
  739|      0|}
zxc_decompress.c:zxc_decode_tok_pivco:
  743|  13.8k|                                                      const size_t psize, const size_t n_tok) {
  744|  13.8k|    const int arc = zxc_ensure_entropy_scratch(ctx);
  745|  13.8k|    if (UNLIKELY(arc != ZXC_OK)) return arc;
  ------------------
  |  |  154|  13.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 13.8k]
  |  |  ------------------
  ------------------
  746|  13.8k|    if (UNLIKELY(n_tok + ZXC_PAD_SIZE > ctx->tok_buffer_cap ||
  ------------------
  |  |  154|  27.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 82, False: 13.7k]
  |  |  |  Branch (154:42): [True: 82, False: 13.7k]
  |  |  |  Branch (154:42): [True: 0, False: 13.7k]
  |  |  ------------------
  ------------------
  747|  13.8k|                 n_tok + ZXC_PIVCO_SCRATCH_PAD > ctx->pivco_scratch_cap))
  748|     82|        return ZXC_ERROR_DST_TOO_SMALL;
  749|  13.7k|    return zxc_huf_decode_section(payload, psize, ctx->tok_buffer, n_tok, ctx->pivco_scratch);
  ------------------
  |  |   29|  13.7k|#define zxc_huf_decode_section ZXC_CAT(zxc_huf_decode_section, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   23|  13.7k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   22|  13.7k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  750|  13.8k|}
zxc_decompress.c:zxc_decode_copy_literals:
  405|  3.02M|                                                       const uint64_t ll) {
  406|  3.02M|    zxc_wild_copy32(dst, src, ll);
  407|  3.02M|}
zxc_decompress.c:zxc_wild_copy32:
  372|  5.32M|static ZXC_ALWAYS_INLINE void zxc_wild_copy32(uint8_t* dst, const uint8_t* src, const size_t len) {
  373|  5.32M|    zxc_copy32(dst, src);
  374|  5.32M|    if (UNLIKELY(len > 32)) {
  ------------------
  |  |  154|  5.32M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 1.74M, False: 3.57M]
  |  |  ------------------
  ------------------
  375|  1.74M|        size_t rem = len - 32;
  376|  1.74M|        dst += 32;
  377|  1.74M|        src += 32;
  378|  19.7M|        while (rem > 32) {
  ------------------
  |  Branch (378:16): [True: 17.9M, False: 1.74M]
  ------------------
  379|  17.9M|            zxc_copy32(dst, src);
  380|  17.9M|            dst += 32;
  381|  17.9M|            src += 32;
  382|  17.9M|            rem -= 32;
  383|  17.9M|        }
  384|  1.74M|        zxc_copy32(dst, src);
  385|  1.74M|    }
  386|  5.32M|}
zxc_decompress.c:zxc_decode_copy_match_spl:
  479|  7.71M|                                                        const uint64_t ml) {
  480|  7.71M|    if (LIKELY(ml <= ZXC_SPL_MAX_INLINE_ML)) {
  ------------------
  |  |  148|  7.71M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 6.38M, False: 1.32M]
  |  |  ------------------
  ------------------
  481|  6.38M|        zxc_decode_copy_match_short(d_ptr, off, ml);
  482|  6.38M|    } else {
  483|  1.32M|        zxc_decode_copy_match(d_ptr, off, ml);
  484|  1.32M|    }
  485|  7.71M|}
zxc_decompress.c:zxc_decode_copy_match_short:
  460|  6.38M|                                                          const uint32_t off, const uint64_t ml) {
  461|  6.38M|    const uint8_t* match_src = d_ptr - off;
  462|  6.38M|    if (LIKELY(off >= 32)) {
  ------------------
  |  |  148|  6.38M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 5.28M, False: 1.09M]
  |  |  ------------------
  ------------------
  463|  5.28M|        zxc_copy32(d_ptr, match_src);
  464|  5.28M|    } else if (off == 1) {
  ------------------
  |  Branch (464:16): [True: 400k, False: 698k]
  ------------------
  465|   400k|        zxc_decode_fill_run(d_ptr, match_src[0], ml);
  466|   698k|    } else {
  467|   698k|        zxc_decode_copy_overlap_short(d_ptr, off, ml);
  468|   698k|    }
  469|  6.38M|}
zxc_decompress.c:zxc_decode_fill_run:
  310|   862k|                                                  const uint64_t ml) {
  311|       |#if defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512)
  312|       |    const __m256i v = _mm256_set1_epi8((char)byte);
  313|       |    _mm256_storeu_si256((__m256i*)dst, v);
  314|       |    if (UNLIKELY(ml > 32)) {
  315|       |        uint8_t* p = dst;
  316|       |        const uint8_t* const last = dst + ml - 32;
  317|       |        do {
  318|       |            p += 32;
  319|       |            _mm256_storeu_si256((__m256i*)p, v);
  320|       |        } while (p < last);
  321|       |    }
  322|       |#elif defined(ZXC_USE_SSE2)
  323|       |    const __m128i v = _mm_set1_epi8((char)byte);
  324|   862k|    _mm_storeu_si128((__m128i*)dst, v);
  325|   862k|    _mm_storeu_si128((__m128i*)(dst + 16), v);
  326|   862k|    if (UNLIKELY(ml > 32)) {
  ------------------
  |  |  154|   862k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 248k, False: 613k]
  |  |  ------------------
  ------------------
  327|   248k|        uint8_t* p = dst;
  328|   248k|        const uint8_t* const last = dst + ml - 32;
  329|  20.9M|        do {
  330|  20.9M|            p += 32;
  331|  20.9M|            _mm_storeu_si128((__m128i*)p, v);
  332|  20.9M|            _mm_storeu_si128((__m128i*)(p + 16), v);
  333|  20.9M|        } while (p < last);
  ------------------
  |  Branch (333:18): [True: 20.7M, False: 248k]
  ------------------
  334|   248k|    }
  335|       |#elif defined(ZXC_USE_NEON64) || defined(ZXC_USE_NEON32)
  336|       |    const uint8x16_t v = vdupq_n_u8(byte);
  337|       |    vst1q_u8(dst, v);
  338|       |    vst1q_u8(dst + 16, v);
  339|       |    if (UNLIKELY(ml > 32)) {
  340|       |        uint8_t* p = dst;
  341|       |        const uint8_t* const last = dst + ml - 32;
  342|       |        do {
  343|       |            p += 32;
  344|       |            vst1q_u8(p, v);
  345|       |            vst1q_u8(p + 16, v);
  346|       |        } while (p < last);
  347|       |    }
  348|       |#else
  349|       |    ZXC_MEMSET(dst, byte, ml);
  350|       |#endif
  351|   862k|}
zxc_decompress.c:zxc_decode_copy_overlap_short:
  239|   698k|                                                            const uint64_t ml) {
  240|       |#if defined(ZXC_USE_NEON64)
  241|       |    const uint8x16_t s0 = vld1q_u8(dst - off);
  242|       |    vst1q_u8(dst, vqtbl1q_u8(s0, vld1q_u8(zxc_overlap_masks32[off])));
  243|       |    if (UNLIKELY(ml > 16)) {
  244|       |        uint8x16x2_t tbl;
  245|       |        tbl.val[0] = s0;
  246|       |        tbl.val[1] = vld1q_u8(dst - off + 16);
  247|       |        vst1q_u8(dst + 16, vqtbl2q_u8(tbl, vld1q_u8(zxc_overlap_masks32[off] + 16)));
  248|       |    }
  249|       |
  250|       |#elif defined(ZXC_USE_NEON32)
  251|       |    uint8x8x2_t lo_tbl;
  252|       |    lo_tbl.val[0] = vld1_u8(dst - off);
  253|       |    lo_tbl.val[1] = vld1_u8(dst - off + 8);
  254|       |    const uint8_t* const m = zxc_overlap_masks32[off];
  255|       |    vst1_u8(dst, vtbl2_u8(lo_tbl, vld1_u8(m)));
  256|       |    vst1_u8(dst + 8, vtbl2_u8(lo_tbl, vld1_u8(m + 8)));
  257|       |    if (UNLIKELY(ml > 16)) {
  258|       |        uint8x8x4_t tbl;
  259|       |        tbl.val[0] = lo_tbl.val[0];
  260|       |        tbl.val[1] = lo_tbl.val[1];
  261|       |        tbl.val[2] = vld1_u8(dst - off + 16);
  262|       |        tbl.val[3] = vld1_u8(dst - off + 24);
  263|       |        vst1_u8(dst + 16, vtbl4_u8(tbl, vld1_u8(m + 16)));
  264|       |        vst1_u8(dst + 24, vtbl4_u8(tbl, vld1_u8(m + 24)));
  265|       |    }
  266|       |
  267|       |#elif defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512)
  268|       |    // pshufb reaches 16 bytes, so only the upper half needs two tables: shuffle
  269|       |    // both and pick per byte on bit 4 of the index.
  270|       |    const __m128i t0 = _mm_loadu_si128((const __m128i*)(dst - off));
  271|       |    _mm_storeu_si128(
  272|       |        (__m128i*)dst,
  273|       |        _mm_shuffle_epi8(t0, _mm_load_si128((const __m128i*)zxc_overlap_masks32[off])));
  274|       |    if (UNLIKELY(ml > 16)) {
  275|       |        const __m128i t1 = _mm_loadu_si128((const __m128i*)(dst - off + 16));
  276|       |        const __m128i m_hi = _mm_load_si128((const __m128i*)(zxc_overlap_masks32[off] + 16));
  277|       |        _mm_storeu_si128(
  278|       |            (__m128i*)(dst + 16),
  279|       |            _mm_blendv_epi8(_mm_shuffle_epi8(t0, m_hi),
  280|       |                            _mm_shuffle_epi8(t1, _mm_sub_epi8(m_hi, _mm_set1_epi8(16))),
  281|       |                            _mm_slli_epi16(m_hi, 3)));
  282|       |    }
  283|       |
  284|       |#else
  285|   698k|    const uint8_t* src = dst - off;
  286|   698k|    const size_t n = (ml > 16) ? 32 : 16;
  ------------------
  |  Branch (286:22): [True: 45.6k, False: 653k]
  ------------------
  287|   698k|    uint32_t k = 0;
  288|  12.6M|    for (size_t i = 0; i < n; i++) {
  ------------------
  |  Branch (288:24): [True: 11.9M, False: 698k]
  ------------------
  289|  11.9M|        dst[i] = src[k];
  290|  11.9M|        if (++k == off) k = 0;
  ------------------
  |  Branch (290:13): [True: 803k, False: 11.1M]
  ------------------
  291|  11.9M|    }
  292|   698k|#endif
  293|   698k|}
zxc_decompress.c:zxc_decode_copy_match:
  433|  3.20M|                                                    const uint64_t ml) {
  434|  3.20M|    const uint8_t* match_src = d_ptr - off;
  435|  3.20M|    if (LIKELY(off >= 32)) {
  ------------------
  |  |  148|  3.20M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 2.29M, False: 910k]
  |  |  ------------------
  ------------------
  436|  2.29M|        zxc_wild_copy32(d_ptr, match_src, ml);
  437|  2.29M|    } else if (off == 1) {
  ------------------
  |  Branch (437:16): [True: 461k, False: 448k]
  ------------------
  438|   461k|        zxc_decode_fill_run(d_ptr, match_src[0], ml);
  439|   461k|    } else {
  440|   448k|        zxc_decode_copy_overlap_run32(d_ptr, off, ml);
  441|   448k|    }
  442|  3.20M|}
zxc_decompress.c:zxc_decode_copy_overlap_run32:
  144|   448k|                                                            const uint64_t ml) {
  145|   448k|    const size_t stride = zxc_overlap_strides32[off];
  146|   448k|    size_t copied = 0;
  147|       |#if defined(ZXC_USE_NEON64)
  148|       |    uint8x16x2_t tbl;
  149|       |    tbl.val[0] = vld1q_u8(dst - off);
  150|       |    tbl.val[1] = vld1q_u8(dst - off + 16);
  151|       |    const uint8x16_t pat_lo = vqtbl2q_u8(tbl, vld1q_u8(zxc_overlap_masks32[off]));
  152|       |    const uint8x16_t pat_hi = vqtbl2q_u8(tbl, vld1q_u8(zxc_overlap_masks32[off] + 16));
  153|       |    do {
  154|       |        vst1q_u8(dst + copied, pat_lo);
  155|       |        vst1q_u8(dst + copied + 16, pat_hi);
  156|       |        copied += stride;
  157|       |    } while (copied < ml);
  158|       |
  159|       |#elif defined(ZXC_USE_NEON32)
  160|       |    // VTBL reaches 8 bytes per lookup from a 4-register (32-byte) table, so the
  161|       |    // pattern takes four lookups instead of NEON64's two.
  162|       |    uint8x8x4_t tbl;
  163|       |    tbl.val[0] = vld1_u8(dst - off);
  164|       |    tbl.val[1] = vld1_u8(dst - off + 8);
  165|       |    tbl.val[2] = vld1_u8(dst - off + 16);
  166|       |    tbl.val[3] = vld1_u8(dst - off + 24);
  167|       |    const uint8_t* const m = zxc_overlap_masks32[off];
  168|       |    const uint8x8_t p0 = vtbl4_u8(tbl, vld1_u8(m));
  169|       |    const uint8x8_t p1 = vtbl4_u8(tbl, vld1_u8(m + 8));
  170|       |    const uint8x8_t p2 = vtbl4_u8(tbl, vld1_u8(m + 16));
  171|       |    const uint8x8_t p3 = vtbl4_u8(tbl, vld1_u8(m + 24));
  172|       |    do {
  173|       |        vst1_u8(dst + copied, p0);
  174|       |        vst1_u8(dst + copied + 8, p1);
  175|       |        vst1_u8(dst + copied + 16, p2);
  176|       |        vst1_u8(dst + copied + 24, p3);
  177|       |        copied += stride;
  178|       |    } while (copied < ml);
  179|       |
  180|       |#elif defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512)
  181|       |    // pshufb only reaches 16 bytes per lane, so the 32-byte table is emulated:
  182|       |    // shuffle both halves, then pick per byte on bit 4 of the index.
  183|       |    const __m128i t0 = _mm_loadu_si128((const __m128i*)(dst - off));
  184|       |    const __m128i t1 = _mm_loadu_si128((const __m128i*)(dst - off + 16));
  185|       |    const __m128i sixteen = _mm_set1_epi8(16);
  186|       |    const __m128i m_lo = _mm_load_si128((const __m128i*)zxc_overlap_masks32[off]);
  187|       |    const __m128i m_hi = _mm_load_si128((const __m128i*)(zxc_overlap_masks32[off] + 16));
  188|       |    const __m128i pat_lo =
  189|       |        _mm_blendv_epi8(_mm_shuffle_epi8(t0, m_lo),
  190|       |                        _mm_shuffle_epi8(t1, _mm_sub_epi8(m_lo, sixteen)), _mm_slli_epi16(m_lo, 3));
  191|       |    const __m128i pat_hi =
  192|       |        _mm_blendv_epi8(_mm_shuffle_epi8(t0, m_hi),
  193|       |                        _mm_shuffle_epi8(t1, _mm_sub_epi8(m_hi, sixteen)), _mm_slli_epi16(m_hi, 3));
  194|       |    do {
  195|       |        _mm_storeu_si128((__m128i*)(dst + copied), pat_lo);
  196|       |        _mm_storeu_si128((__m128i*)(dst + copied + 16), pat_hi);
  197|       |        copied += stride;
  198|       |    } while (copied < ml);
  199|       |
  200|       |#else
  201|       |    // SSE2 (no PSHUFB) and non-SIMD tiers: build the 32-byte pattern with a
  202|       |    // wrap counter (no per-byte modulo), then store it as two 16-byte halves.
  203|   448k|    const uint8_t* src = dst - off;
  204|   448k|    uint8_t pat[32];
  205|   448k|    uint32_t k = 0;
  206|  14.8M|    for (size_t i = 0; i < 32; i++) {
  ------------------
  |  Branch (206:24): [True: 14.3M, False: 448k]
  ------------------
  207|  14.3M|        pat[i] = src[k];
  208|  14.3M|        if (++k == off) k = 0;
  ------------------
  |  Branch (208:13): [True: 1.25M, False: 13.1M]
  ------------------
  209|  14.3M|    }
  210|  5.77M|    do {
  211|  5.77M|        zxc_copy16(dst + copied, pat);
  212|  5.77M|        zxc_copy16(dst + copied + 16, pat + 16);
  213|  5.77M|        copied += stride;
  214|  5.77M|    } while (copied < ml);
  ------------------
  |  Branch (214:14): [True: 5.33M, False: 448k]
  ------------------
  215|   448k|#endif
  216|   448k|}
zxc_decompress.c:zxc_decode_copy_match_exact:
  504|   168k|                                                     const size_t off, const size_t ml) {
  505|   168k|    if (off >= ml) {
  ------------------
  |  Branch (505:9): [True: 122k, False: 46.2k]
  ------------------
  506|   122k|        ZXC_MEMCPY(d_ptr, match_src, ml);
  ------------------
  |  |  170|   122k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  507|   122k|    } else if (ml < 16) {
  ------------------
  |  Branch (507:16): [True: 21.8k, False: 24.3k]
  ------------------
  508|   201k|        for (size_t i = 0; i < ml; i++) d_ptr[i] = match_src[i];
  ------------------
  |  Branch (508:28): [True: 179k, False: 21.8k]
  ------------------
  509|  24.3k|    } else {
  510|  24.3k|        size_t n = off;
  511|  24.3k|        ZXC_MEMCPY(d_ptr, match_src, n);
  ------------------
  |  |  170|  24.3k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  512|   127k|        while (n <= ml - n) {
  ------------------
  |  Branch (512:16): [True: 103k, False: 24.3k]
  ------------------
  513|   103k|            ZXC_MEMCPY(d_ptr + n, d_ptr, n);
  ------------------
  |  |  170|   103k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  514|   103k|            n <<= 1;
  515|   103k|        }
  516|  24.3k|        ZXC_MEMCPY(d_ptr + n, d_ptr, ml - n);
  ------------------
  |  |  170|  24.3k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  517|  24.3k|    }
  518|   168k|}
zxc_decompress.c:zxc_decode_block_spl:
 1452|  25.1k|                                const size_t dst_capacity) {
 1453|  25.1k|    return zxc_decode_block_spl_impl(ctx, src, src_size, dst, dst_capacity, 0, 0, 0);
 1454|  25.1k|}
zxc_decompress.c:zxc_decode_block_pak_safe:
 1553|  9.67k|                                                  const size_t dst_capacity) {
 1554|  9.67k|    return zxc_decode_block_pak_impl(ctx, src, src_size, dst, dst_capacity, 1, 0);
 1555|  9.67k|}
zxc_decompress.c:zxc_decode_block_pak_impl:
 1174|  19.0k|                                                       const int has_dict) {
 1175|  19.0k|    zxc_gnr_header_t gh;
 1176|       |
 1177|       |    // 0 when !has_dict (safe path) -> folds `d_floor` to `dst`.
 1178|  19.0k|    const size_t dict_size = has_dict ? ctx->dict_size : 0;
  ------------------
  |  Branch (1178:30): [True: 0, False: 19.0k]
  ------------------
 1179|       |
 1180|  19.0k|    if (UNLIKELY(zxc_read_pak_header(src, src_size, &gh) != ZXC_OK)) return ZXC_ERROR_BAD_HEADER;
  ------------------
  |  |  154|  19.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 93, False: 18.9k]
  |  |  ------------------
  ------------------
 1181|  18.9k|    if (UNLIKELY(gh.enc_lit != ZXC_SECTION_ENCODING_RAW || gh.enc_tok != 0))
  ------------------
  |  |  154|  37.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 89, False: 18.9k]
  |  |  |  Branch (154:42): [True: 65, False: 18.9k]
  |  |  |  Branch (154:42): [True: 24, False: 18.9k]
  |  |  ------------------
  ------------------
 1182|     89|        return ZXC_ERROR_CORRUPT_DATA;
 1183|       |
 1184|  18.9k|    const uint8_t* const p_data = src + ZXC_PAK_HEADER_BINARY_SIZE;
  ------------------
  |  |  434|  18.9k|#define ZXC_PAK_HEADER_BINARY_SIZE 12
  ------------------
 1185|  18.9k|    const uint8_t* p_curr = p_data;
 1186|       |
 1187|       |    // --- Stream Pointers & Validation ---
 1188|       |    // PAK carries no section descriptors: literals are always RAW, the sequence
 1189|       |    // stream is four bytes per sequence, and extras run to the payload end.
 1190|  18.9k|    const size_t sz_lit = gh.n_literals;
 1191|  18.9k|    const uint64_t sz_seqs = (uint64_t)gh.n_sequences * sizeof(uint32_t);
 1192|       |
 1193|  18.9k|    const size_t payload_avail = (size_t)(src + src_size - p_data);
 1194|  18.9k|    const uint64_t consumed = (uint64_t)sz_lit + sz_seqs;
 1195|  18.9k|    if (UNLIKELY(consumed > (uint64_t)payload_avail)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  18.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 194, False: 18.7k]
  |  |  ------------------
  ------------------
 1196|  18.7k|    const size_t sz_exts = payload_avail - (size_t)consumed; /* slack padding included */
 1197|       |
 1198|       |    // PAK literals are always RAW, so the slack is always load-bearing here.
 1199|       |    // No underflow: sz_lit <= consumed <= payload_avail.
 1200|  18.7k|    if (UNLIKELY(payload_avail - sz_lit < ZXC_BLOCK_LIT_SLACK)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  18.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 26, False: 18.6k]
  |  |  ------------------
  ------------------
 1201|       |
 1202|  18.6k|    const uint8_t* l_ptr = p_curr;
 1203|  18.6k|    const uint8_t* l_end = l_ptr + sz_lit;
 1204|  18.6k|    p_curr += sz_lit;
 1205|       |
 1206|  18.6k|    const uint8_t* seq_ptr = p_curr;
 1207|  18.6k|    const uint8_t* extras_ptr = p_curr + (size_t)sz_seqs;
 1208|  18.6k|    const uint8_t* const extras_end = extras_ptr + sz_exts;
 1209|       |
 1210|  18.6k|    uint8_t* d_ptr = dst;
 1211|  18.6k|    const uint8_t* const d_end = dst + dst_capacity;
 1212|       |    // Lowest address a match may reach: the dictionary prefix if any, else dst.
 1213|  18.6k|    const uint8_t* const d_floor = dst - dict_size;
 1214|  18.6k|    const uint8_t* const d_end_safe =
 1215|  18.6k|        (dst_capacity > ZXC_PAD_SIZE * 4) ? d_end - (ZXC_PAD_SIZE * 4) : dst;  // 128
  ------------------
  |  |  331|  18.6k|#define ZXC_PAD_SIZE 32
  ------------------
                      (dst_capacity > ZXC_PAD_SIZE * 4) ? d_end - (ZXC_PAD_SIZE * 4) : dst;  // 128
  ------------------
  |  |  331|  17.8k|#define ZXC_PAD_SIZE 32
  ------------------
  |  Branch (1215:9): [True: 17.8k, False: 838]
  ------------------
 1216|       |    // 4x loop margin: four sequences of inline output (ll <= 254, ml <= 254 + 5,
 1217|       |    // longer ones escape and check themselves) plus the wild-copy overshoot:
 1218|       |    // 4 x 513 + 32 = 2084, all of ZXC_DECOMPRESS_TAIL_PAD.
 1219|  18.6k|    const uint8_t* const d_end_fast =
 1220|  18.6k|        (dst_capacity > ZXC_DECOMPRESS_TAIL_PAD) ? d_end - ZXC_DECOMPRESS_TAIL_PAD : dst;
  ------------------
  |  |  361|  18.6k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  674|  18.6k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|  18.6k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  522|  18.6k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|  18.6k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  18.6k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  18.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 */
  |  |  ------------------
  |  |  |  |  331|  18.6k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
                      (dst_capacity > ZXC_DECOMPRESS_TAIL_PAD) ? d_end - ZXC_DECOMPRESS_TAIL_PAD : dst;
  ------------------
  |  |  361|  12.3k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  674|  12.3k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|  12.3k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  522|  12.3k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|  12.3k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  12.3k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  12.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 */
  |  |  ------------------
  |  |  |  |  331|  12.3k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  |  Branch (1220:9): [True: 12.3k, False: 6.29k]
  ------------------
 1221|       |
 1222|       |    // Literal margin for the PAK loops: without a varint, ll <= 254 per sequence,
 1223|       |    // so 4 * 254 = 1016. Past that only the cold varint path checks l_ptr.
 1224|  18.6k|    const size_t pak_margin_4x = 4 * (ZXC_SEQ_LL_MASK - 1);  // 1016
  ------------------
  |  |  528|  18.6k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  ------------------
  |  |  |  |  522|  18.6k|#define ZXC_SEQ_LL_BITS 8
  |  |  ------------------
  ------------------
 1225|  18.6k|    const size_t pak_margin_1x = ZXC_SEQ_LL_MASK - 1;        // 254
  ------------------
  |  |  528|  18.6k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  ------------------
  |  |  |  |  522|  18.6k|#define ZXC_SEQ_LL_BITS 8
  |  |  ------------------
  ------------------
 1226|  18.6k|    const uint8_t* const l_end_safe_4x = (sz_lit > pak_margin_4x) ? l_end - pak_margin_4x : l_ptr;
  ------------------
  |  Branch (1226:42): [True: 11.7k, False: 6.92k]
  ------------------
 1227|  18.6k|    const uint8_t* const l_end_safe_1x = (sz_lit > pak_margin_1x) ? l_end - pak_margin_1x : l_ptr;
  ------------------
  |  Branch (1227:42): [True: 13.9k, False: 4.70k]
  ------------------
 1228|       |
 1229|  18.6k|    uint32_t n_seq = gh.n_sequences;
 1230|       |
 1231|       |    // Same handover as SPL, but the PAK offset is inline in the sequence word and
 1232|       |    // always 16 bits -- enc_off is not a width here, so the span is fixed.
 1233|  18.6k|    const size_t off_span = 1U << 16;
 1234|  18.6k|    const size_t span = (dict_size >= off_span) ? 0 : off_span - dict_size;
  ------------------
  |  Branch (1234:25): [True: 0, False: 18.6k]
  ------------------
 1235|  18.6k|    const uint8_t* const d_bounds = (span >= dst_capacity) ? d_end : dst + span;
  ------------------
  |  Branch (1235:37): [True: 13.2k, False: 5.40k]
  ------------------
 1236|       |
 1237|       |    // --- SAFE loop: validate offsets until d_bounds (4x unroll) ---
 1238|  18.6k|    if (safe) {
  ------------------
  |  Branch (1238:9): [True: 9.41k, False: 9.27k]
  ------------------
 1239|       |        // SAFE variant: save per-batch state so an OVERFLOW can rollback and
 1240|       |        // hand over to the 1x loop / Safe Path. Wild writes already committed
 1241|       |        // are deterministically overwritten when the 1x loop replays.
 1242|   143k|        while (n_seq >= 4 && d_ptr < d_end_fast && l_ptr < l_end_safe_4x && d_ptr < d_bounds) {
  ------------------
  |  Branch (1242:16): [True: 142k, False: 937]
  |  Branch (1242:30): [True: 138k, False: 4.23k]
  |  Branch (1242:52): [True: 137k, False: 1.18k]
  |  Branch (1242:77): [True: 135k, False: 1.31k]
  ------------------
 1243|   135k|            const uint8_t* const t_save = seq_ptr;
 1244|   135k|            const uint8_t* const e_save = extras_ptr;
 1245|   135k|            uint8_t* const d_save = d_ptr;
 1246|   135k|            const uint8_t* const l_save = l_ptr;
 1247|   135k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x, (void)0);
  ------------------
  |  |  678|   135k|    do {                                                                                        \
  |  |  679|   135k|        uint32_t s1 = zxc_le32(seq_ptr);                                                        \
  |  |  680|   135k|        uint32_t s2 = zxc_le32(seq_ptr + sizeof(uint32_t));                                     \
  |  |  681|   135k|        uint32_t s3 = zxc_le32(seq_ptr + 2 * sizeof(uint32_t));                                 \
  |  |  682|   135k|        uint32_t s4 = zxc_le32(seq_ptr + 3 * sizeof(uint32_t));                                 \
  |  |  683|   135k|        seq_ptr += 4 * sizeof(uint32_t);                                                        \
  |  |  684|   135k|        PREFETCH;                                                                               \
  |  |  685|   135k|        DECODE_PAK_SEQ(                                                                         \
  |  |  ------------------
  |  |  |  |  645|   135k|    do {                                                                                     \
  |  |  |  |  646|   135k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  534|   135k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   135k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   135k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  647|   135k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  536|   135k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   135k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|   135k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   135k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  648|   135k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   135k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  649|   135k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   135k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 3.08k, False: 132k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  650|  3.08k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  651|  3.08k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  652|  3.08k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  653|  3.08k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  6.06k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 197, False: 2.88k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 95, False: 2.98k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 102, False: 2.88k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  654|  3.08k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  655|  3.08k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  656|  3.08k|                ON_FAIL;                                                                     \
  |  |  |  |  657|  3.08k|        }                                                                                    \
  |  |  |  |  658|   135k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   135k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 6.15k, False: 129k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  659|  6.15k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  660|  6.15k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  6.15k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 188, False: 5.96k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  661|  6.15k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  662|  6.15k|                ON_FAIL;                                                                     \
  |  |  |  |  663|  6.15k|        }                                                                                    \
  |  |  |  |  664|   135k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  532|   135k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   135k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  676|   135k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  665|   135k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  666|   135k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  667|   135k|        l_ptr += ll;                                                                         \
  |  |  |  |  668|   135k|        d_ptr += ll;                                                                         \
  |  |  |  |  669|   135k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1247|   135k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  528|   135k|    do {                                                                              \
  |  |  |  |  |  |  |  |  529|   135k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|   135k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (154:21): [True: 148, False: 135k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  530|   135k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  531|   135k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  532|   135k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (532:14): [Folded, False: 135k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  670|   135k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (670:14): [Folded, False: 135k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  686|   135k|            s1, (s2 >> ZXC_SEQ_LL_SHIFT) + (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), \
  |  |  687|   135k|            3U, DECODE, ON_FAIL);                                                               \
  |  |  688|   135k|        DECODE_PAK_SEQ(s2, (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), 2U, DECODE,     \
  |  |  ------------------
  |  |  |  |  645|   135k|    do {                                                                                     \
  |  |  |  |  646|   135k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  534|   135k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   135k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   135k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  647|   135k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  536|   135k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   135k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|   135k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   135k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  648|   135k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   135k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  649|   135k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   135k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 2.72k, False: 132k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  650|  2.72k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  651|  2.72k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  652|  2.72k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  653|  2.72k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  5.40k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 120, False: 2.60k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 50, False: 2.67k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 70, False: 2.60k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  654|  2.72k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  655|  2.72k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  656|  2.72k|                ON_FAIL;                                                                     \
  |  |  |  |  657|  2.72k|        }                                                                                    \
  |  |  |  |  658|   135k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   135k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 6.45k, False: 128k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  659|  6.45k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  660|  6.45k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  6.45k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 133, False: 6.32k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  661|  6.45k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  662|  6.45k|                ON_FAIL;                                                                     \
  |  |  |  |  663|  6.45k|        }                                                                                    \
  |  |  |  |  664|   135k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  532|   135k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   135k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  676|   135k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  665|   135k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  666|   135k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  667|   135k|        l_ptr += ll;                                                                         \
  |  |  |  |  668|   135k|        d_ptr += ll;                                                                         \
  |  |  |  |  669|   135k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1247|   135k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  528|   135k|    do {                                                                              \
  |  |  |  |  |  |  |  |  529|   135k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|   135k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (154:21): [True: 57, False: 135k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  530|   135k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  531|   135k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  532|   135k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (532:14): [Folded, False: 135k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  670|   135k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (670:14): [Folded, False: 135k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  689|   135k|                       ON_FAIL);                                                                \
  |  |  690|   135k|        DECODE_PAK_SEQ(s3, (s4 >> ZXC_SEQ_LL_SHIFT), 1U, DECODE, ON_FAIL);                      \
  |  |  ------------------
  |  |  |  |  645|   135k|    do {                                                                                     \
  |  |  |  |  646|   135k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  534|   135k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   135k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   135k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  647|   135k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  536|   135k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   135k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|   135k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   135k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  648|   135k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   135k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  649|   135k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   135k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 2.47k, False: 132k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  650|  2.47k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  651|  2.47k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  652|  2.47k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  653|  2.47k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  4.89k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 126, False: 2.35k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 60, False: 2.41k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 66, False: 2.35k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  654|  2.47k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  655|  2.47k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  656|  2.47k|                ON_FAIL;                                                                     \
  |  |  |  |  657|  2.47k|        }                                                                                    \
  |  |  |  |  658|   135k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   134k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 7.83k, False: 127k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  659|  7.83k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  660|  7.83k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  7.83k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 362, False: 7.47k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  661|  7.83k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  662|  7.83k|                ON_FAIL;                                                                     \
  |  |  |  |  663|  7.83k|        }                                                                                    \
  |  |  |  |  664|   134k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  532|   134k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   134k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  676|   134k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  665|   134k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  666|   134k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  667|   134k|        l_ptr += ll;                                                                         \
  |  |  |  |  668|   134k|        d_ptr += ll;                                                                         \
  |  |  |  |  669|   134k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1247|   134k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  528|   134k|    do {                                                                              \
  |  |  |  |  |  |  |  |  529|   134k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|   134k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (154:21): [True: 74, False: 134k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  530|   134k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  531|   134k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  532|   134k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (532:14): [Folded, False: 134k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  670|   134k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (670:14): [Folded, False: 134k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  691|   135k|        DECODE_PAK_SEQ(s4, 0, 0U, DECODE, ON_FAIL);                                             \
  |  |  ------------------
  |  |  |  |  645|   134k|    do {                                                                                     \
  |  |  |  |  646|   134k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  534|   134k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   134k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   134k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  647|   134k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  536|   134k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   134k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|   134k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   134k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  648|   134k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   134k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  649|   134k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   134k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 2.43k, False: 132k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  650|  2.43k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  651|  2.43k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  652|  2.43k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  653|  2.43k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  4.80k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 75, False: 2.35k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 57, False: 2.37k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 18, False: 2.35k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  654|  2.43k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  655|  2.43k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  656|  2.43k|                ON_FAIL;                                                                     \
  |  |  |  |  657|  2.43k|        }                                                                                    \
  |  |  |  |  658|   134k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   134k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 6.83k, False: 127k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  659|  6.83k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  660|  6.83k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  6.83k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 193, False: 6.63k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  661|  6.83k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  662|  6.83k|                ON_FAIL;                                                                     \
  |  |  |  |  663|  6.83k|        }                                                                                    \
  |  |  |  |  664|   134k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  532|   134k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   134k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  676|   134k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  665|   134k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  666|   134k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  667|   134k|        l_ptr += ll;                                                                         \
  |  |  |  |  668|   134k|        d_ptr += ll;                                                                         \
  |  |  |  |  669|   134k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1247|   134k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  528|   134k|    do {                                                                              \
  |  |  |  |  |  |  |  |  529|   134k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|   134k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (154:21): [True: 72, False: 134k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  530|   134k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  531|   134k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  532|   134k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (532:14): [Folded, False: 134k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  670|   134k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (670:14): [Folded, False: 134k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  692|   134k|        n_seq -= 4;                                                                             \
  |  |  693|   134k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (693:14): [Folded, False: 134k]
  |  |  ------------------
  ------------------
 1248|   134k|            continue;
 1249|       |
 1250|   134k|        rollback_safe_4x:
 1251|  1.39k|            seq_ptr = t_save;
 1252|  1.39k|            extras_ptr = e_save;
 1253|  1.39k|            d_ptr = d_save;
 1254|  1.39k|            l_ptr = l_save;
 1255|  1.39k|            break;
 1256|   135k|        }
 1257|  9.41k|    } else {
 1258|   169k|        while (n_seq >= 4 && d_ptr < d_end_fast && l_ptr < l_end_safe_4x && d_ptr < d_bounds) {
  ------------------
  |  Branch (1258:16): [True: 168k, False: 1.22k]
  |  Branch (1258:30): [True: 166k, False: 2.10k]
  |  Branch (1258:52): [True: 163k, False: 3.12k]
  |  Branch (1258:77): [True: 161k, False: 1.77k]
  ------------------
 1259|   161k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW, (void)0);
  ------------------
  |  |  678|   161k|    do {                                                                                        \
  |  |  679|   161k|        uint32_t s1 = zxc_le32(seq_ptr);                                                        \
  |  |  680|   161k|        uint32_t s2 = zxc_le32(seq_ptr + sizeof(uint32_t));                                     \
  |  |  681|   161k|        uint32_t s3 = zxc_le32(seq_ptr + 2 * sizeof(uint32_t));                                 \
  |  |  682|   161k|        uint32_t s4 = zxc_le32(seq_ptr + 3 * sizeof(uint32_t));                                 \
  |  |  683|   161k|        seq_ptr += 4 * sizeof(uint32_t);                                                        \
  |  |  684|   161k|        PREFETCH;                                                                               \
  |  |  685|   161k|        DECODE_PAK_SEQ(                                                                         \
  |  |  ------------------
  |  |  |  |  645|   161k|    do {                                                                                     \
  |  |  |  |  646|   161k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  534|   161k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   161k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   161k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  647|   161k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  536|   161k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   161k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|   161k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   161k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  648|   161k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   161k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  649|   161k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   161k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 4.05k, False: 157k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  650|  4.05k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  651|  4.05k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  652|  4.05k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  653|  4.05k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  8.00k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 161, False: 3.89k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 110, False: 3.94k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 51, False: 3.89k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  654|  4.05k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  655|  4.05k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  656|  4.05k|                ON_FAIL;                                                                     \
  |  |  |  |  657|  4.05k|        }                                                                                    \
  |  |  |  |  658|   161k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   161k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 7.26k, False: 153k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  659|  7.26k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  660|  7.26k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  7.26k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 69, False: 7.19k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  661|  7.26k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  662|  7.26k|                ON_FAIL;                                                                     \
  |  |  |  |  663|  7.26k|        }                                                                                    \
  |  |  |  |  664|   161k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  532|   161k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   161k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  676|   161k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  665|   161k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  666|   161k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  667|   161k|        l_ptr += ll;                                                                         \
  |  |  |  |  668|   161k|        d_ptr += ll;                                                                         \
  |  |  |  |  669|   161k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1259|   161k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  528|   161k|    do {                                                                              \
  |  |  |  |  |  |  |  |  529|   161k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|   161k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (154:21): [True: 80, False: 161k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  530|   161k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  531|   161k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  532|   161k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (532:14): [Folded, False: 161k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  670|   161k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (670:14): [Folded, False: 161k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  686|   161k|            s1, (s2 >> ZXC_SEQ_LL_SHIFT) + (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), \
  |  |  687|   161k|            3U, DECODE, ON_FAIL);                                                               \
  |  |  688|   161k|        DECODE_PAK_SEQ(s2, (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), 2U, DECODE,     \
  |  |  ------------------
  |  |  |  |  645|   161k|    do {                                                                                     \
  |  |  |  |  646|   161k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  534|   161k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   161k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   161k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  647|   161k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  536|   161k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   161k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|   161k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   161k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  648|   161k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   161k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  649|   161k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   161k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 3.38k, False: 157k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  650|  3.38k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  651|  3.38k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  652|  3.38k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  653|  3.38k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  6.70k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 100, False: 3.28k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 65, False: 3.31k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 35, False: 3.28k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  654|  3.38k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  655|  3.38k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  656|  3.38k|                ON_FAIL;                                                                     \
  |  |  |  |  657|  3.38k|        }                                                                                    \
  |  |  |  |  658|   161k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   160k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 7.80k, False: 153k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  659|  7.80k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  660|  7.80k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  7.80k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 74, False: 7.73k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  661|  7.80k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  662|  7.80k|                ON_FAIL;                                                                     \
  |  |  |  |  663|  7.80k|        }                                                                                    \
  |  |  |  |  664|   160k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  532|   160k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   160k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  676|   160k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  665|   160k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  666|   160k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  667|   160k|        l_ptr += ll;                                                                         \
  |  |  |  |  668|   160k|        d_ptr += ll;                                                                         \
  |  |  |  |  669|   160k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1259|   160k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  528|   160k|    do {                                                                              \
  |  |  |  |  |  |  |  |  529|   160k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|   160k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (154:21): [True: 38, False: 160k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  530|   160k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  531|   160k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  532|   160k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (532:14): [Folded, False: 160k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  670|   160k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (670:14): [Folded, False: 160k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  689|   161k|                       ON_FAIL);                                                                \
  |  |  690|   161k|        DECODE_PAK_SEQ(s3, (s4 >> ZXC_SEQ_LL_SHIFT), 1U, DECODE, ON_FAIL);                      \
  |  |  ------------------
  |  |  |  |  645|   160k|    do {                                                                                     \
  |  |  |  |  646|   160k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  534|   160k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   160k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   160k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  647|   160k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  536|   160k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   160k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|   160k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   160k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  648|   160k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   160k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  649|   160k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   160k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 3.09k, False: 157k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  650|  3.09k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  651|  3.09k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  652|  3.09k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  653|  3.09k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  6.12k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 109, False: 2.98k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 76, False: 3.02k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 33, False: 2.98k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  654|  3.09k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  655|  3.09k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  656|  3.09k|                ON_FAIL;                                                                     \
  |  |  |  |  657|  3.09k|        }                                                                                    \
  |  |  |  |  658|   160k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   160k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 9.09k, False: 151k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  659|  9.09k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  660|  9.09k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  9.09k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 101, False: 8.99k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  661|  9.09k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  662|  9.09k|                ON_FAIL;                                                                     \
  |  |  |  |  663|  9.09k|        }                                                                                    \
  |  |  |  |  664|   160k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  532|   160k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   160k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  676|   160k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  665|   160k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  666|   160k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  667|   160k|        l_ptr += ll;                                                                         \
  |  |  |  |  668|   160k|        d_ptr += ll;                                                                         \
  |  |  |  |  669|   160k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1259|   160k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  528|   160k|    do {                                                                              \
  |  |  |  |  |  |  |  |  529|   160k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|   160k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (154:21): [True: 58, False: 160k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  530|   160k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  531|   160k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  532|   160k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (532:14): [Folded, False: 160k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  670|   160k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (670:14): [Folded, False: 160k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  691|   160k|        DECODE_PAK_SEQ(s4, 0, 0U, DECODE, ON_FAIL);                                             \
  |  |  ------------------
  |  |  |  |  645|   160k|    do {                                                                                     \
  |  |  |  |  646|   160k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  534|   160k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   160k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   160k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  647|   160k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  536|   160k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   160k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|   160k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|   160k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  648|   160k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|   160k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  649|   160k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   160k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 3.00k, False: 157k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  650|  3.00k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  651|  3.00k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  652|  3.00k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  653|  3.00k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  5.93k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 86, False: 2.91k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 77, False: 2.92k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 9, False: 2.91k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  654|  3.00k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  655|  3.00k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  656|  3.00k|                ON_FAIL;                                                                     \
  |  |  |  |  657|  3.00k|        }                                                                                    \
  |  |  |  |  658|   160k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|   160k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 8.16k, False: 152k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  659|  8.16k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  660|  8.16k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  8.16k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 117, False: 8.04k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  661|  8.16k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  662|  8.16k|                ON_FAIL;                                                                     \
  |  |  |  |  663|  8.16k|        }                                                                                    \
  |  |  |  |  664|   160k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  532|   160k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|   160k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  676|   160k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  665|   160k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  666|   160k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  667|   160k|        l_ptr += ll;                                                                         \
  |  |  |  |  668|   160k|        d_ptr += ll;                                                                         \
  |  |  |  |  669|   160k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1259|   160k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  528|   160k|    do {                                                                              \
  |  |  |  |  |  |  |  |  529|   160k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|   160k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (154:21): [True: 52, False: 160k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  530|   160k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  531|   160k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  532|   160k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (532:14): [Folded, False: 160k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  670|   160k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (670:14): [Folded, False: 160k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  692|   160k|        n_seq -= 4;                                                                             \
  |  |  693|   160k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (693:14): [Folded, False: 160k]
  |  |  ------------------
  ------------------
 1260|   161k|        }
 1261|  9.27k|    }
 1262|       |
 1263|       |    // --- SAFE Loop tail: remaining sequences with offset validation (1x) ---
 1264|   279k|    while (n_seq > 0 && d_ptr < d_end_safe && d_ptr < d_bounds) {
  ------------------
  |  Branch (1264:12): [True: 274k, False: 4.87k]
  |  Branch (1264:25): [True: 268k, False: 6.12k]
  |  Branch (1264:47): [True: 264k, False: 3.73k]
  ------------------
 1265|   264k|        uint32_t seq = zxc_le32(seq_ptr);
 1266|   264k|        seq_ptr += sizeof(uint32_t);
 1267|       |
 1268|   264k|        uint64_t ll = seq >> ZXC_SEQ_LL_SHIFT;
  ------------------
  |  |  534|   264k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  524|   264k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  526|   264k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
 1269|   264k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) ll += zxc_read_varint(&extras_ptr, extras_end);
  ------------------
  |  |  154|   264k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 6.50k, False: 258k]
  |  |  ------------------
  ------------------
 1270|       |
 1271|   264k|        uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  536|   264k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  ------------------
  |  |  |  |  526|   264k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  530|   264k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  524|   264k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  ------------------
 1272|   264k|        uint64_t ml = m_bits + ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  575|   264k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1273|   264k|        if (UNLIKELY(m_bits == ZXC_SEQ_ML_MASK)) ml += zxc_read_varint(&extras_ptr, extras_end);
  ------------------
  |  |  154|   264k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 8.67k, False: 256k]
  |  |  ------------------
  ------------------
 1274|       |
 1275|   264k|        uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  532|   264k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  ------------------
  |  |  |  |  526|   264k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  676|   264k|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1276|       |
 1277|       |        // Strict bounds check: sequence must fit, AND wild copies must not overshoot
 1278|       |        // Check both destination (d_ptr) and source literal stream (l_ptr)
 1279|   264k|        if (UNLIKELY(ll + ml + ZXC_PAD_SIZE > (size_t)(d_end - d_ptr) ||
  ------------------
  |  |  154|   527k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 21.8k, False: 243k]
  |  |  |  Branch (154:42): [True: 2.50k, False: 262k]
  |  |  |  Branch (154:42): [True: 19.3k, False: 243k]
  |  |  ------------------
  ------------------
 1280|   264k|                     ll + ZXC_PAD_SIZE > (size_t)(l_end - l_ptr))) {
 1281|       |            // Fallback to exact copy (slow but safe)
 1282|  21.8k|            if (UNLIKELY(ll + ml > (size_t)(d_end - d_ptr) || ll > (size_t)(l_end - l_ptr)))
  ------------------
  |  |  154|  41.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 2.26k, False: 19.5k]
  |  |  |  Branch (154:42): [True: 1.67k, False: 20.1k]
  |  |  |  Branch (154:42): [True: 594, False: 19.5k]
  |  |  ------------------
  ------------------
 1283|  2.26k|                return ZXC_ERROR_OVERFLOW;
 1284|  19.5k|            ZXC_MEMCPY(d_ptr, l_ptr, ll);
  ------------------
  |  |  170|  19.5k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1285|  19.5k|            l_ptr += ll;
 1286|  19.5k|            d_ptr += ll;
 1287|       |
 1288|  19.5k|            if (UNLIKELY((size_t)(d_ptr - d_floor) < offset)) return ZXC_ERROR_BAD_OFFSET;
  ------------------
  |  |  154|  19.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 104, False: 19.4k]
  |  |  ------------------
  ------------------
 1289|  19.4k|            const uint8_t* match_src = d_ptr - offset;
 1290|       |
 1291|  19.4k|            zxc_decode_copy_match_exact(d_ptr, match_src, offset, ml);
 1292|  19.4k|            d_ptr += ml;
 1293|   243k|        } else {
 1294|   243k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);
 1295|   243k|            l_ptr += ll;
 1296|   243k|            d_ptr += ll;
 1297|   243k|            DECODE_MATCH_SAFE(ml, offset, zxc_decode_copy_match);
  ------------------
  |  |  528|   243k|    do {                                                                              \
  |  |  529|   243k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  ------------------
  |  |  |  |  154|   243k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (154:21): [True: 193, False: 242k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  530|   243k|        COPY(d_ptr, off, ml);                                                         \
  |  |  531|   242k|        d_ptr += ml;                                                                  \
  |  |  532|   242k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (532:14): [Folded, False: 242k]
  |  |  ------------------
  ------------------
 1298|   243k|        }
 1299|   262k|        n_seq--;
 1300|   262k|    }
 1301|       |
 1302|       |    // --- FAST Loop: After threshold, check large margin to avoid individual bounds checks ---
 1303|  14.7k|    if (safe) {
  ------------------
  |  Branch (1303:9): [True: 7.21k, False: 7.51k]
  ------------------
 1304|  53.5k|        while (n_seq >= 4 && d_ptr < d_end_fast && l_ptr < l_end_safe_4x) {
  ------------------
  |  Branch (1304:16): [True: 49.5k, False: 4.02k]
  |  Branch (1304:30): [True: 47.5k, False: 1.98k]
  |  Branch (1304:52): [True: 46.9k, False: 559]
  ------------------
 1305|  46.9k|            const uint8_t* const t_save = seq_ptr;
 1306|  46.9k|            const uint8_t* const e_save = extras_ptr;
 1307|  46.9k|            uint8_t* const d_save = d_ptr;
 1308|  46.9k|            const uint8_t* const l_save = l_ptr;
 1309|  46.9k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x,
  ------------------
  |  |  678|  46.9k|    do {                                                                                        \
  |  |  679|  46.9k|        uint32_t s1 = zxc_le32(seq_ptr);                                                        \
  |  |  680|  46.9k|        uint32_t s2 = zxc_le32(seq_ptr + sizeof(uint32_t));                                     \
  |  |  681|  46.9k|        uint32_t s3 = zxc_le32(seq_ptr + 2 * sizeof(uint32_t));                                 \
  |  |  682|  46.9k|        uint32_t s4 = zxc_le32(seq_ptr + 3 * sizeof(uint32_t));                                 \
  |  |  683|  46.9k|        seq_ptr += 4 * sizeof(uint32_t);                                                        \
  |  |  684|  46.9k|        PREFETCH;                                                                               \
  |  |  685|  46.9k|        DECODE_PAK_SEQ(                                                                         \
  |  |  ------------------
  |  |  |  |  645|  46.9k|    do {                                                                                     \
  |  |  |  |  646|  46.9k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  534|  46.9k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  46.9k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  46.9k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  647|  46.9k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  536|  46.9k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  46.9k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|  46.9k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  46.9k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  648|  46.9k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  46.9k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  649|  46.9k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  46.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 1.46k, False: 45.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  650|  1.46k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  651|  1.46k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  652|  1.46k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  653|  1.46k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  2.87k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 127, False: 1.33k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 46, False: 1.41k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 81, False: 1.33k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  654|  1.46k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  655|  1.46k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  656|  1.46k|                ON_FAIL;                                                                     \
  |  |  |  |  657|  1.46k|        }                                                                                    \
  |  |  |  |  658|  46.9k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  46.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 2.83k, False: 44.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  659|  2.83k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  660|  2.83k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  2.83k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 65, False: 2.77k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  661|  2.83k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  662|  2.83k|                ON_FAIL;                                                                     \
  |  |  |  |  663|  2.83k|        }                                                                                    \
  |  |  |  |  664|  46.8k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  532|  46.7k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  46.7k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  676|  46.7k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  665|  46.7k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  666|  46.7k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  667|  46.7k|        l_ptr += ll;                                                                         \
  |  |  |  |  668|  46.7k|        d_ptr += ll;                                                                         \
  |  |  |  |  669|  46.7k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1309|  46.7k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  46.7k|    do {                                 \
  |  |  |  |  |  |  |  |  538|  46.7k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  539|  46.7k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  540|  46.7k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (540:14): [Folded, False: 46.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  670|  46.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (670:14): [Folded, False: 46.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  686|  46.9k|            s1, (s2 >> ZXC_SEQ_LL_SHIFT) + (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), \
  |  |  687|  46.9k|            3U, DECODE, ON_FAIL);                                                               \
  |  |  688|  46.9k|        DECODE_PAK_SEQ(s2, (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), 2U, DECODE,     \
  |  |  ------------------
  |  |  |  |  645|  46.7k|    do {                                                                                     \
  |  |  |  |  646|  46.7k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  534|  46.7k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  46.7k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  46.7k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  647|  46.7k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  536|  46.7k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  46.7k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|  46.7k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  46.7k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  648|  46.7k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  46.7k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  649|  46.7k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  46.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 1.44k, False: 45.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  650|  1.44k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  651|  1.44k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  652|  1.44k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  653|  1.44k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  2.84k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 99, False: 1.34k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 45, False: 1.39k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 54, False: 1.34k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  654|  1.44k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  655|  1.44k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  656|  1.44k|                ON_FAIL;                                                                     \
  |  |  |  |  657|  1.44k|        }                                                                                    \
  |  |  |  |  658|  46.7k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  46.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 2.84k, False: 43.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  659|  2.84k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  660|  2.84k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  2.84k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 55, False: 2.78k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  661|  2.84k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  662|  2.84k|                ON_FAIL;                                                                     \
  |  |  |  |  663|  2.84k|        }                                                                                    \
  |  |  |  |  664|  46.7k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  532|  46.6k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  46.6k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  676|  46.6k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  665|  46.6k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  666|  46.6k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  667|  46.6k|        l_ptr += ll;                                                                         \
  |  |  |  |  668|  46.6k|        d_ptr += ll;                                                                         \
  |  |  |  |  669|  46.6k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1309|  46.6k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  46.6k|    do {                                 \
  |  |  |  |  |  |  |  |  538|  46.6k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  539|  46.6k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  540|  46.6k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (540:14): [Folded, False: 46.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  670|  46.6k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (670:14): [Folded, False: 46.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  689|  46.7k|                       ON_FAIL);                                                                \
  |  |  690|  46.7k|        DECODE_PAK_SEQ(s3, (s4 >> ZXC_SEQ_LL_SHIFT), 1U, DECODE, ON_FAIL);                      \
  |  |  ------------------
  |  |  |  |  645|  46.6k|    do {                                                                                     \
  |  |  |  |  646|  46.6k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  534|  46.6k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  46.6k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  46.6k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  647|  46.6k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  536|  46.6k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  46.6k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|  46.6k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  46.6k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  648|  46.6k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  46.6k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  649|  46.6k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  46.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 1.38k, False: 45.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  650|  1.38k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  651|  1.38k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  652|  1.38k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  653|  1.38k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  2.71k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 109, False: 1.27k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 49, False: 1.33k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 60, False: 1.27k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  654|  1.38k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  655|  1.38k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  656|  1.38k|                ON_FAIL;                                                                     \
  |  |  |  |  657|  1.38k|        }                                                                                    \
  |  |  |  |  658|  46.6k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  46.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 2.85k, False: 43.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  659|  2.85k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  660|  2.85k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  2.85k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 55, False: 2.79k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  661|  2.85k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  662|  2.85k|                ON_FAIL;                                                                     \
  |  |  |  |  663|  2.85k|        }                                                                                    \
  |  |  |  |  664|  46.5k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  532|  46.4k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  46.4k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  676|  46.4k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  665|  46.4k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  666|  46.4k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  667|  46.4k|        l_ptr += ll;                                                                         \
  |  |  |  |  668|  46.4k|        d_ptr += ll;                                                                         \
  |  |  |  |  669|  46.4k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1309|  46.4k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  46.4k|    do {                                 \
  |  |  |  |  |  |  |  |  538|  46.4k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  539|  46.4k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  540|  46.4k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (540:14): [Folded, False: 46.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  670|  46.4k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (670:14): [Folded, False: 46.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  691|  46.6k|        DECODE_PAK_SEQ(s4, 0, 0U, DECODE, ON_FAIL);                                             \
  |  |  ------------------
  |  |  |  |  645|  46.4k|    do {                                                                                     \
  |  |  |  |  646|  46.4k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  534|  46.4k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  46.4k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  46.4k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  647|  46.4k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  536|  46.4k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  46.4k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|  46.4k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  46.4k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  648|  46.4k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  46.4k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  649|  46.4k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  46.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 1.36k, False: 45.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  650|  1.36k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  651|  1.36k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  652|  1.36k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  653|  1.36k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  2.67k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 70, False: 1.29k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 48, False: 1.31k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 22, False: 1.29k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  654|  1.36k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  655|  1.36k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  656|  1.36k|                ON_FAIL;                                                                     \
  |  |  |  |  657|  1.36k|        }                                                                                    \
  |  |  |  |  658|  46.4k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  46.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 2.93k, False: 43.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  659|  2.93k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  660|  2.93k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  2.93k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 62, False: 2.86k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  661|  2.93k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  662|  2.93k|                ON_FAIL;                                                                     \
  |  |  |  |  663|  2.93k|        }                                                                                    \
  |  |  |  |  664|  46.4k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  532|  46.3k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  46.3k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  676|  46.3k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  665|  46.3k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  666|  46.3k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  667|  46.3k|        l_ptr += ll;                                                                         \
  |  |  |  |  668|  46.3k|        d_ptr += ll;                                                                         \
  |  |  |  |  669|  46.3k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1309|  46.3k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  46.3k|    do {                                 \
  |  |  |  |  |  |  |  |  538|  46.3k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  539|  46.3k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  540|  46.3k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (540:14): [Folded, False: 46.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  670|  46.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (670:14): [Folded, False: 46.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  692|  46.4k|        n_seq -= 4;                                                                             \
  |  |  693|  46.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (693:14): [Folded, False: 46.3k]
  |  |  ------------------
  ------------------
 1310|  46.9k|                                ZXC_PREFETCH_READ(l_ptr + ZXC_CACHE_LINE_SIZE));
 1311|  46.3k|            continue;
 1312|       |
 1313|  46.3k|        rollback_fast_4x:
 1314|    642|            seq_ptr = t_save;
 1315|    642|            extras_ptr = e_save;
 1316|    642|            d_ptr = d_save;
 1317|    642|            l_ptr = l_save;
 1318|    642|            break;
 1319|  46.9k|        }
 1320|  7.51k|    } else {
 1321|  64.8k|        while (n_seq >= 4 && d_ptr < d_end_fast && l_ptr < l_end_safe_4x) {
  ------------------
  |  Branch (1321:16): [True: 60.0k, False: 4.81k]
  |  Branch (1321:30): [True: 59.0k, False: 980]
  |  Branch (1321:52): [True: 58.0k, False: 1.04k]
  ------------------
 1322|  58.0k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW,
  ------------------
  |  |  678|  58.0k|    do {                                                                                        \
  |  |  679|  58.0k|        uint32_t s1 = zxc_le32(seq_ptr);                                                        \
  |  |  680|  58.0k|        uint32_t s2 = zxc_le32(seq_ptr + sizeof(uint32_t));                                     \
  |  |  681|  58.0k|        uint32_t s3 = zxc_le32(seq_ptr + 2 * sizeof(uint32_t));                                 \
  |  |  682|  58.0k|        uint32_t s4 = zxc_le32(seq_ptr + 3 * sizeof(uint32_t));                                 \
  |  |  683|  58.0k|        seq_ptr += 4 * sizeof(uint32_t);                                                        \
  |  |  684|  58.0k|        PREFETCH;                                                                               \
  |  |  685|  58.0k|        DECODE_PAK_SEQ(                                                                         \
  |  |  ------------------
  |  |  |  |  645|  58.0k|    do {                                                                                     \
  |  |  |  |  646|  58.0k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  534|  58.0k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  58.0k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  58.0k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  647|  58.0k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  536|  58.0k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  58.0k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|  58.0k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  58.0k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  648|  58.0k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  58.0k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  649|  58.0k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  58.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 1.96k, False: 56.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  650|  1.96k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  651|  1.96k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  652|  1.96k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  653|  1.96k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  3.85k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 104, False: 1.85k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 65, False: 1.89k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 39, False: 1.85k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  654|  1.96k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  655|  1.96k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  656|  1.96k|                ON_FAIL;                                                                     \
  |  |  |  |  657|  1.96k|        }                                                                                    \
  |  |  |  |  658|  58.0k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  57.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 3.52k, False: 54.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  659|  3.52k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  660|  3.52k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  3.52k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 82, False: 3.44k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  661|  3.52k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  662|  3.52k|                ON_FAIL;                                                                     \
  |  |  |  |  663|  3.52k|        }                                                                                    \
  |  |  |  |  664|  57.9k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  532|  57.8k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  57.8k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  676|  57.8k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  665|  57.8k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  666|  57.8k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  667|  57.8k|        l_ptr += ll;                                                                         \
  |  |  |  |  668|  57.8k|        d_ptr += ll;                                                                         \
  |  |  |  |  669|  57.8k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1322|  57.8k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  57.8k|    do {                                 \
  |  |  |  |  |  |  |  |  538|  57.8k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  539|  57.8k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  540|  57.8k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (540:14): [Folded, False: 57.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  670|  57.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (670:14): [Folded, False: 57.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  686|  58.0k|            s1, (s2 >> ZXC_SEQ_LL_SHIFT) + (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), \
  |  |  687|  58.0k|            3U, DECODE, ON_FAIL);                                                               \
  |  |  688|  58.0k|        DECODE_PAK_SEQ(s2, (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), 2U, DECODE,     \
  |  |  ------------------
  |  |  |  |  645|  57.8k|    do {                                                                                     \
  |  |  |  |  646|  57.8k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  534|  57.8k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  57.8k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  57.8k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  647|  57.8k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  536|  57.8k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  57.8k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|  57.8k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  57.8k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  648|  57.8k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  57.8k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  649|  57.8k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  57.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 1.91k, False: 55.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  650|  1.91k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  651|  1.91k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  652|  1.91k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  653|  1.91k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  3.75k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 92, False: 1.81k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 63, False: 1.84k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 29, False: 1.81k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  654|  1.91k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  655|  1.91k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  656|  1.91k|                ON_FAIL;                                                                     \
  |  |  |  |  657|  1.91k|        }                                                                                    \
  |  |  |  |  658|  57.8k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  57.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 3.55k, False: 54.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  659|  3.55k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  660|  3.55k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  3.55k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 67, False: 3.48k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  661|  3.55k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  662|  3.55k|                ON_FAIL;                                                                     \
  |  |  |  |  663|  3.55k|        }                                                                                    \
  |  |  |  |  664|  57.7k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  532|  57.6k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  57.6k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  676|  57.6k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  665|  57.6k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  666|  57.6k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  667|  57.6k|        l_ptr += ll;                                                                         \
  |  |  |  |  668|  57.6k|        d_ptr += ll;                                                                         \
  |  |  |  |  669|  57.6k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1322|  57.6k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  57.6k|    do {                                 \
  |  |  |  |  |  |  |  |  538|  57.6k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  539|  57.6k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  540|  57.6k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (540:14): [Folded, False: 57.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  670|  57.6k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (670:14): [Folded, False: 57.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  689|  57.8k|                       ON_FAIL);                                                                \
  |  |  690|  57.8k|        DECODE_PAK_SEQ(s3, (s4 >> ZXC_SEQ_LL_SHIFT), 1U, DECODE, ON_FAIL);                      \
  |  |  ------------------
  |  |  |  |  645|  57.6k|    do {                                                                                     \
  |  |  |  |  646|  57.6k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  534|  57.6k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  57.6k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  57.6k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  647|  57.6k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  536|  57.6k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  57.6k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|  57.6k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  57.6k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  648|  57.6k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  57.6k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  649|  57.6k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  57.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 1.84k, False: 55.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  650|  1.84k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  651|  1.84k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  652|  1.84k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  653|  1.84k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  3.61k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 104, False: 1.74k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 74, False: 1.77k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 30, False: 1.74k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  654|  1.84k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  655|  1.84k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  656|  1.84k|                ON_FAIL;                                                                     \
  |  |  |  |  657|  1.84k|        }                                                                                    \
  |  |  |  |  658|  57.6k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  57.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 3.51k, False: 54.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  659|  3.51k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  660|  3.51k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  3.51k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 67, False: 3.45k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  661|  3.51k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  662|  3.51k|                ON_FAIL;                                                                     \
  |  |  |  |  663|  3.51k|        }                                                                                    \
  |  |  |  |  664|  57.5k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  532|  57.4k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  57.4k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  676|  57.4k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  665|  57.4k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  666|  57.4k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  667|  57.4k|        l_ptr += ll;                                                                         \
  |  |  |  |  668|  57.4k|        d_ptr += ll;                                                                         \
  |  |  |  |  669|  57.4k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1322|  57.4k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  57.4k|    do {                                 \
  |  |  |  |  |  |  |  |  538|  57.4k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  539|  57.4k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  540|  57.4k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (540:14): [Folded, False: 57.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  670|  57.4k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (670:14): [Folded, False: 57.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  691|  57.6k|        DECODE_PAK_SEQ(s4, 0, 0U, DECODE, ON_FAIL);                                             \
  |  |  ------------------
  |  |  |  |  645|  57.4k|    do {                                                                                     \
  |  |  |  |  646|  57.4k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  534|  57.4k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  57.4k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  57.4k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  647|  57.4k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  536|  57.4k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  57.4k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|  57.4k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  57.4k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  648|  57.4k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  57.4k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  649|  57.4k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  57.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 1.78k, False: 55.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  650|  1.78k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  651|  1.78k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  652|  1.78k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  653|  1.78k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  3.50k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 86, False: 1.70k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 74, False: 1.71k]
  |  |  |  |  |  |  |  Branch (154:42): [True: 12, False: 1.70k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  654|  1.78k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  655|  1.78k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  656|  1.78k|                ON_FAIL;                                                                     \
  |  |  |  |  657|  1.78k|        }                                                                                    \
  |  |  |  |  658|  57.4k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  57.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 3.66k, False: 53.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  659|  3.66k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  660|  3.66k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  3.66k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:21): [True: 76, False: 3.58k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  661|  3.66k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  662|  3.66k|                ON_FAIL;                                                                     \
  |  |  |  |  663|  3.66k|        }                                                                                    \
  |  |  |  |  664|  57.4k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  532|  57.3k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  526|  57.3k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  676|  57.3k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  665|  57.3k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  666|  57.3k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  667|  57.3k|        l_ptr += ll;                                                                         \
  |  |  |  |  668|  57.3k|        d_ptr += ll;                                                                         \
  |  |  |  |  669|  57.3k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1322|  57.3k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  57.3k|    do {                                 \
  |  |  |  |  |  |  |  |  538|  57.3k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  539|  57.3k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  540|  57.3k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (540:14): [Folded, False: 57.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  670|  57.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (670:14): [Folded, False: 57.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  692|  57.4k|        n_seq -= 4;                                                                             \
  |  |  693|  57.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (693:14): [Folded, False: 57.3k]
  |  |  ------------------
  ------------------
 1323|  58.0k|                                ZXC_PREFETCH_READ(l_ptr + ZXC_CACHE_LINE_SIZE));
 1324|  58.0k|        }
 1325|  7.51k|    }
 1326|       |
 1327|       |    // --- Remaining 1 sequence (Fast Path) ---
 1328|  55.0k|    while (n_seq > 0 && d_ptr < d_end_safe && l_ptr < l_end_safe_1x) {
  ------------------
  |  Branch (1328:12): [True: 50.0k, False: 5.08k]
  |  Branch (1328:25): [True: 43.7k, False: 6.21k]
  |  Branch (1328:47): [True: 42.2k, False: 1.52k]
  ------------------
 1329|       |        // Save state for fallback
 1330|  42.2k|        const uint8_t* seq_save = seq_ptr;
 1331|  42.2k|        const uint8_t* ext_save = extras_ptr;
 1332|       |
 1333|  42.2k|        const uint32_t seq = zxc_le32(seq_ptr);
 1334|  42.2k|        seq_ptr += sizeof(uint32_t);
 1335|       |
 1336|  42.2k|        uint64_t ll = seq >> ZXC_SEQ_LL_SHIFT;
  ------------------
  |  |  534|  42.2k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  524|  42.2k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  526|  42.2k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
 1337|  42.2k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {
  ------------------
  |  |  154|  42.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 2.05k, False: 40.2k]
  |  |  ------------------
  ------------------
 1338|  2.05k|            ll += zxc_read_varint(&extras_ptr, extras_end);
 1339|  2.05k|            if (UNLIKELY(ll > (size_t)(l_end - l_ptr))) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  154|  2.05k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 443, False: 1.60k]
  |  |  ------------------
  ------------------
 1340|  2.05k|        }
 1341|       |
 1342|  41.8k|        uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  536|  41.8k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  ------------------
  |  |  |  |  526|  41.8k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  530|  41.8k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  524|  41.8k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  ------------------
 1343|  41.8k|        uint64_t ml = m_bits + ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  575|  41.8k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1344|  41.8k|        if (UNLIKELY(m_bits == ZXC_SEQ_ML_MASK)) ml += zxc_read_varint(&extras_ptr, extras_end);
  ------------------
  |  |  154|  41.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 3.34k, False: 38.4k]
  |  |  ------------------
  ------------------
 1345|       |
 1346|       |        // Strict bounds checks (including wild copy overrun safety)
 1347|  41.8k|        if (UNLIKELY(ll + ml + ZXC_PAD_SIZE > (size_t)(d_end - d_ptr) ||
  ------------------
  |  |  154|  83.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 787, False: 41.0k]
  |  |  |  Branch (154:42): [True: 623, False: 41.2k]
  |  |  |  Branch (154:42): [True: 164, False: 41.0k]
  |  |  ------------------
  ------------------
 1348|  41.8k|                     ll + ZXC_PAD_SIZE > (size_t)(l_end - l_ptr))) {
 1349|    787|            seq_ptr = seq_save;
 1350|    787|            extras_ptr = ext_save;
 1351|    787|            break;
 1352|    787|        }
 1353|  41.0k|        uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  532|  41.0k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  ------------------
  |  |  |  |  526|  41.0k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  676|  41.0k|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1354|       |
 1355|  41.0k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);
 1356|  41.0k|        l_ptr += ll;
 1357|  41.0k|        d_ptr += ll;
 1358|       |
 1359|  41.0k|        if (UNLIKELY(d_ptr < d_bounds && (size_t)(d_ptr - d_floor) < offset))
  ------------------
  |  |  154|  41.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 41.0k]
  |  |  |  Branch (154:42): [True: 0, False: 41.0k]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1360|      0|            return ZXC_ERROR_BAD_OFFSET;
 1361|       |
 1362|       |        // The loop entry check guarantees ll + ml + ZXC_PAD_SIZE bytes of
 1363|       |        // headroom, so the wild-copy ladder (incl. overlap/fill runs) is safe.
 1364|  41.0k|        zxc_decode_copy_match(d_ptr, offset, ml);
 1365|  41.0k|        d_ptr += ml;
 1366|  41.0k|        n_seq--;
 1367|  41.0k|    }
 1368|       |
 1369|       |    // --- Safe Path for Remaining Sequences ---
 1370|  45.9k|    while (n_seq > 0) {
  ------------------
  |  Branch (1370:12): [True: 34.0k, False: 11.8k]
  ------------------
 1371|  34.0k|        uint32_t seq = zxc_le32(seq_ptr);
 1372|  34.0k|        seq_ptr += sizeof(uint32_t);
 1373|       |
 1374|  34.0k|        uint64_t ll = seq >> ZXC_SEQ_LL_SHIFT;
  ------------------
  |  |  534|  34.0k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  524|  34.0k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  526|  34.0k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
 1375|  34.0k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) ll += zxc_read_varint(&extras_ptr, extras_end);
  ------------------
  |  |  154|  34.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 824, False: 33.2k]
  |  |  ------------------
  ------------------
 1376|       |
 1377|  34.0k|        uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  536|  34.0k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  ------------------
  |  |  |  |  526|  34.0k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  530|  34.0k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  524|  34.0k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  ------------------
 1378|  34.0k|        uint64_t ml = m_bits + ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  575|  34.0k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1379|  34.0k|        if (UNLIKELY(m_bits == ZXC_SEQ_ML_MASK)) ml += zxc_read_varint(&extras_ptr, extras_end);
  ------------------
  |  |  154|  34.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 2.89k, False: 31.1k]
  |  |  ------------------
  ------------------
 1380|  34.0k|        uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  532|  34.0k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  ------------------
  |  |  |  |  526|  34.0k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  676|  34.0k|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1381|       |
 1382|  34.0k|        if (UNLIKELY(ll + ml > (size_t)(d_end - d_ptr) || ll > (size_t)(l_end - l_ptr)))
  ------------------
  |  |  154|  67.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 1.71k, False: 32.3k]
  |  |  |  Branch (154:42): [True: 1.01k, False: 33.0k]
  |  |  |  Branch (154:42): [True: 708, False: 32.3k]
  |  |  ------------------
  ------------------
 1383|  1.71k|            return ZXC_ERROR_OVERFLOW;
 1384|  32.3k|        ZXC_MEMCPY(d_ptr, l_ptr, ll);
  ------------------
  |  |  170|  32.3k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1385|  32.3k|        l_ptr += ll;
 1386|  32.3k|        d_ptr += ll;
 1387|       |
 1388|  32.3k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < offset)) return ZXC_ERROR_BAD_OFFSET;
  ------------------
  |  |  154|  32.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 44, False: 32.3k]
  |  |  ------------------
  ------------------
 1389|  32.3k|        const uint8_t* match_src = d_ptr - offset;
 1390|       |
 1391|  32.3k|        zxc_decode_copy_match_exact(d_ptr, match_src, offset, ml);
 1392|  32.3k|        d_ptr += ml;
 1393|  32.3k|        n_seq--;
 1394|  32.3k|    }
 1395|       |
 1396|       |    // --- Trailing Literals ---
 1397|       |    // Copy remaining literals from source stream (literal exhaustion)
 1398|  11.8k|    if (UNLIKELY(l_ptr > l_end)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  11.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 11.8k]
  |  |  ------------------
  ------------------
 1399|  11.8k|    if (UNLIKELY(d_ptr > d_end)) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  154|  11.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 11.8k]
  |  |  ------------------
  ------------------
 1400|       |
 1401|  11.8k|    const size_t remaining_literals = (size_t)(l_end - l_ptr);
 1402|  11.8k|    if (UNLIKELY(remaining_literals > (size_t)(d_end - d_ptr))) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  154|  11.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 21, False: 11.8k]
  |  |  ------------------
  ------------------
 1403|  11.8k|    ZXC_MEMCPY(d_ptr, l_ptr, remaining_literals);
  ------------------
  |  |  170|  11.8k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1404|  11.8k|    d_ptr += remaining_literals;
 1405|       |
 1406|  11.8k|    return (int)(d_ptr - dst);
 1407|  11.8k|}
zxc_decompress.c:zxc_decode_block_pak:
 1470|  9.40k|                                const size_t dst_capacity) {
 1471|  9.40k|    return zxc_decode_block_pak_impl(ctx, src, src_size, dst, dst_capacity, 0, 0);
 1472|  9.40k|}

zxc_common.c:zxc_aligned_malloc:
  113|  48.6k|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|  48.6k|    void* ptr = NULL;
  118|  48.6k|    if (posix_memalign(&ptr, alignment, size) != 0) return NULL;
  ------------------
  |  Branch (118:9): [True: 0, False: 48.6k]
  ------------------
  119|  48.6k|    return ptr;
  120|  48.6k|#endif
  121|  48.6k|}
zxc_common.c:zxc_aligned_free:
  124|  48.6k|static inline void zxc_aligned_free(void* ptr) {
  125|       |#if defined(_WIN32)
  126|       |    _aligned_free(ptr);
  127|       |#else
  128|  48.6k|    free(ptr);
  129|  48.6k|#endif
  130|  48.6k|}

zxc_decompress_chunk_wrapper:
  436|  67.4k|                                 const uint64_t block_index) {
  437|       |    // dict_size is constant for a stream; this per-block branch (outside the decode
  438|       |    // loop) routes to the dict variant only when a dictionary is active, so the
  439|       |    // no-dict path runs the dict-free chunk wrapper (identical codegen to main).
  440|  67.4k|    const zxc_variant_set_t* v = zxc_variants();
  441|  67.4k|    return (ctx->dict_size ? v->decompress_dict : v->decompress)(ctx, src, src_sz, dst, dst_cap,
  ------------------
  |  Branch (441:13): [True: 0, False: 67.4k]
  ------------------
  442|  67.4k|                                                                 block_index);
  443|  67.4k|}
zxc_compress_chunk_wrapper:
  467|  15.3k|                               const uint64_t block_index) {
  468|  15.3k|    return zxc_variants()->compress(ctx, src, src_sz, dst, dst_cap, block_index);
  469|  15.3k|}
zxc_create_cctx:
 1007|  15.3k|zxc_cctx* zxc_create_cctx(void) {
 1008|  15.3k|    zxc_cctx* const cctx = (zxc_cctx*)ZXC_CALLOC(1, sizeof(zxc_cctx));
  ------------------
  |  |   74|  15.3k|#define ZXC_CALLOC(nmemb, size) calloc(nmemb, size)
  ------------------
 1009|  15.3k|    if (UNLIKELY(!cctx)) return NULL;  // LCOV_EXCL_LINE
  ------------------
  |  |  154|  15.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 15.3k]
  |  |  ------------------
  ------------------
 1010|  15.3k|    cctx->params = zxc_cparams_defaults();
 1011|  15.3k|    cctx->init_level = ZXC_LEVEL_DEFAULT;
 1012|  15.3k|    return cctx;
 1013|  15.3k|}
zxc_cparam_bounds:
 1017|  45.9k|int zxc_cparam_bounds(const zxc_cparam_t param, int64_t* min, int64_t* max) {
 1018|  45.9k|    int64_t lo, hi;
 1019|  45.9k|    switch (param) {
 1020|  15.3k|        case ZXC_C_LEVEL:
  ------------------
  |  Branch (1020:9): [True: 15.3k, False: 30.6k]
  ------------------
 1021|  15.3k|            lo = ZXC_LEVEL_FASTEST;
 1022|  15.3k|            hi = ZXC_LEVEL_ULTRA;
 1023|  15.3k|            break;
 1024|  15.3k|        case ZXC_C_BLOCK_SIZE:
  ------------------
  |  Branch (1024:9): [True: 15.3k, False: 30.6k]
  ------------------
 1025|  15.3k|            lo = ZXC_BLOCK_SIZE_MIN;
  ------------------
  |  |   73|  15.3k|#define ZXC_BLOCK_SIZE_MIN (1U << ZXC_BLOCK_SIZE_MIN_LOG2)
  |  |  ------------------
  |  |  |  |   67|  15.3k|#define ZXC_BLOCK_SIZE_MIN_LOG2 12
  |  |  ------------------
  ------------------
 1026|  15.3k|            hi = ZXC_BLOCK_SIZE_MAX;
  ------------------
  |  |   75|  15.3k|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  ------------------
  |  |  |  |   69|  15.3k|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  ------------------
  ------------------
 1027|  15.3k|            break;
 1028|      0|        case ZXC_C_THREADS:
  ------------------
  |  Branch (1028:9): [True: 0, False: 45.9k]
  ------------------
 1029|      0|            lo = 0;
 1030|      0|            hi = ZXC_MAX_THREADS;
  ------------------
  |  |  107|      0|#define ZXC_MAX_THREADS 512
  ------------------
 1031|      0|            break;
 1032|  15.3k|        case ZXC_C_CHECKSUM:
  ------------------
  |  Branch (1032:9): [True: 15.3k, False: 30.6k]
  ------------------
 1033|  15.3k|        case ZXC_C_SEEKABLE:
  ------------------
  |  Branch (1033:9): [True: 0, False: 45.9k]
  ------------------
 1034|  15.3k|            lo = 0;
 1035|  15.3k|            hi = 1;
 1036|  15.3k|            break;
 1037|      0|        default:
  ------------------
  |  Branch (1037:9): [True: 0, False: 45.9k]
  ------------------
 1038|      0|            return ZXC_ERROR_BAD_PARAM;
 1039|  45.9k|    }
 1040|  45.9k|    if (min) *min = lo;
  ------------------
  |  Branch (1040:9): [True: 45.9k, False: 0]
  ------------------
 1041|  45.9k|    if (max) *max = hi;
  ------------------
  |  Branch (1041:9): [True: 45.9k, False: 0]
  ------------------
 1042|  45.9k|    return ZXC_OK;
 1043|  45.9k|}
zxc_cctx_set_param:
 1052|  45.9k|int zxc_cctx_set_param(zxc_cctx* cctx, const zxc_cparam_t param, const int64_t value) {
 1053|  45.9k|    if (UNLIKELY(!cctx)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  154|  45.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 45.9k]
  |  |  ------------------
  ------------------
 1054|  45.9k|    int64_t lo, hi;
 1055|  45.9k|    const int rc = zxc_cparam_bounds(param, &lo, &hi);
 1056|  45.9k|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  154|  45.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 45.9k]
  |  |  ------------------
  ------------------
 1057|  45.9k|    if (value != 0 && (value < lo || value > hi)) {
  ------------------
  |  Branch (1057:9): [True: 37.2k, False: 8.72k]
  |  Branch (1057:24): [True: 0, False: 37.2k]
  |  Branch (1057:38): [True: 0, False: 37.2k]
  ------------------
 1058|      0|        if (param == ZXC_C_LEVEL) return ZXC_ERROR_BAD_LEVEL;
  ------------------
  |  Branch (1058:13): [True: 0, False: 0]
  ------------------
 1059|      0|        return param == ZXC_C_BLOCK_SIZE ? ZXC_ERROR_BAD_BLOCK_SIZE : ZXC_ERROR_BAD_PARAM;
  ------------------
  |  Branch (1059:16): [True: 0, False: 0]
  ------------------
 1060|      0|    }
 1061|       |
 1062|  45.9k|    zxc_cparams_t* const p = &cctx->params;
 1063|  45.9k|    switch (param) {
 1064|  15.3k|        case ZXC_C_LEVEL: {
  ------------------
  |  Branch (1064:9): [True: 15.3k, False: 30.6k]
  ------------------
 1065|       |            // 0 restores the default: on a static workspace, the pinned level.
 1066|  15.3k|            const int level = value != 0             ? (int)value
  ------------------
  |  Branch (1066:31): [True: 15.3k, False: 0]
  ------------------
 1067|  15.3k|                              : cctx->owns_workspace ? cctx->init_level
  ------------------
  |  Branch (1067:33): [True: 0, False: 0]
  ------------------
 1068|      0|                                                     : ZXC_LEVEL_DEFAULT;
 1069|       |            // A static workspace carved below the optimal-parser tier cannot grow into it.
 1070|  15.3k|            if (UNLIKELY(cctx->owns_workspace && level >= ZXC_LEVEL_DENSITY &&
  ------------------
  |  |  154|  30.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 15.3k]
  |  |  |  Branch (154:42): [True: 0, False: 15.3k]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1071|  15.3k|                         !cctx->inner.opt_scratch))
 1072|      0|                return ZXC_ERROR_BAD_LEVEL;
 1073|  15.3k|            p->level = level;
 1074|  15.3k|            break;
 1075|  15.3k|        }
 1076|  15.3k|        case ZXC_C_BLOCK_SIZE: {
  ------------------
  |  Branch (1076:9): [True: 15.3k, False: 30.6k]
  ------------------
 1077|  15.3k|            const size_t block_size = value != 0             ? (size_t)value
  ------------------
  |  Branch (1077:39): [True: 15.3k, False: 0]
  ------------------
 1078|  15.3k|                                      : cctx->owns_workspace ? cctx->last_block_size
  ------------------
  |  Branch (1078:41): [True: 0, False: 0]
  ------------------
 1079|      0|                                                             : ZXC_BLOCK_SIZE_DEFAULT;
  ------------------
  |  |   71|      0|#define ZXC_BLOCK_SIZE_DEFAULT (512 * 1024)
  ------------------
 1080|  15.3k|            if (UNLIKELY(!zxc_validate_block_size(block_size))) return ZXC_ERROR_BAD_BLOCK_SIZE;
  ------------------
  |  |  154|  15.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 15.3k]
  |  |  ------------------
  ------------------
 1081|  15.3k|            if (UNLIKELY(cctx->owns_workspace && block_size != cctx->last_block_size))
  ------------------
  |  |  154|  15.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 15.3k]
  |  |  |  Branch (154:42): [True: 0, False: 15.3k]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1082|      0|                return ZXC_ERROR_BAD_BLOCK_SIZE;
 1083|  15.3k|            p->block_size = block_size;
 1084|  15.3k|            break;
 1085|  15.3k|        }
 1086|      0|        case ZXC_C_THREADS:
  ------------------
  |  Branch (1086:9): [True: 0, False: 45.9k]
  ------------------
 1087|      0|            p->n_threads = (int)value;
 1088|      0|            break;
 1089|  15.3k|        case ZXC_C_CHECKSUM:
  ------------------
  |  Branch (1089:9): [True: 15.3k, False: 30.6k]
  ------------------
 1090|  15.3k|            p->checksum_enabled = (int)value;
 1091|  15.3k|            break;
 1092|      0|        case ZXC_C_SEEKABLE:
  ------------------
  |  Branch (1092:9): [True: 0, False: 45.9k]
  ------------------
 1093|      0|            p->seekable = (int)value;
 1094|      0|            break;
 1095|      0|        default:
  ------------------
  |  Branch (1095:9): [True: 0, False: 45.9k]
  ------------------
 1096|      0|            return ZXC_ERROR_BAD_PARAM;  // LCOV_EXCL_LINE: bounds already refused it
 1097|  45.9k|    }
 1098|  45.9k|    return ZXC_OK;
 1099|  45.9k|}
zxc_free_cctx:
 1165|  15.3k|void zxc_free_cctx(zxc_cctx* cctx) {
 1166|  15.3k|    if (UNLIKELY(!cctx)) return;
  ------------------
  |  |  154|  15.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 15.3k]
  |  |  ------------------
  ------------------
 1167|       |    // Static cctx: handle + inner buffers live inside the caller's workspace,
 1168|       |    // which we do not own. Free is a no-op; the caller owns the workspace.
 1169|  15.3k|    if (cctx->owns_workspace) return;
  ------------------
  |  Branch (1169:9): [True: 0, False: 15.3k]
  ------------------
 1170|  15.3k|    if (cctx->initialized) zxc_cctx_free(&cctx->inner);
  ------------------
  |  Branch (1170:9): [True: 15.3k, False: 0]
  ------------------
 1171|  15.3k|    ZXC_FREE(cctx->dict_copy.data);
  ------------------
  |  |   86|  15.3k|#define ZXC_FREE(ptr) free(ptr)
  ------------------
 1172|  15.3k|    ZXC_FREE(cctx);
  ------------------
  |  |   86|  15.3k|#define ZXC_FREE(ptr) free(ptr)
  ------------------
 1173|  15.3k|}
zxc_create_dctx:
 1331|  15.3k|zxc_dctx* zxc_create_dctx(void) {
 1332|  15.3k|    zxc_dctx* const dctx = (zxc_dctx*)ZXC_CALLOC(1, sizeof(zxc_dctx));
  ------------------
  |  |   74|  15.3k|#define ZXC_CALLOC(nmemb, size) calloc(nmemb, size)
  ------------------
 1333|  15.3k|    return dctx;
 1334|  15.3k|}
zxc_dparam_bounds:
 1338|  45.9k|int zxc_dparam_bounds(const zxc_dparam_t param, int64_t* min, int64_t* max) {
 1339|  45.9k|    int64_t lo, hi;
 1340|  45.9k|    switch (param) {
 1341|      0|        case ZXC_D_THREADS:
  ------------------
  |  Branch (1341:9): [True: 0, False: 45.9k]
  ------------------
 1342|      0|            lo = 0;
 1343|      0|            hi = ZXC_MAX_THREADS;
  ------------------
  |  |  107|      0|#define ZXC_MAX_THREADS 512
  ------------------
 1344|      0|            break;
 1345|  45.9k|        case ZXC_D_CHECKSUM:
  ------------------
  |  Branch (1345:9): [True: 45.9k, False: 0]
  ------------------
 1346|  45.9k|            lo = 0;
 1347|  45.9k|            hi = 1;
 1348|  45.9k|            break;
 1349|      0|        default:
  ------------------
  |  Branch (1349:9): [True: 0, False: 45.9k]
  ------------------
 1350|      0|            return ZXC_ERROR_BAD_PARAM;
 1351|  45.9k|    }
 1352|  45.9k|    if (min) *min = lo;
  ------------------
  |  Branch (1352:9): [True: 45.9k, False: 0]
  ------------------
 1353|  45.9k|    if (max) *max = hi;
  ------------------
  |  Branch (1353:9): [True: 45.9k, False: 0]
  ------------------
 1354|  45.9k|    return ZXC_OK;
 1355|  45.9k|}
zxc_dctx_set_param:
 1357|  45.9k|int zxc_dctx_set_param(zxc_dctx* dctx, const zxc_dparam_t param, const int64_t value) {
 1358|  45.9k|    if (UNLIKELY(!dctx)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  154|  45.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 45.9k]
  |  |  ------------------
  ------------------
 1359|  45.9k|    int64_t lo, hi;
 1360|  45.9k|    const int rc = zxc_dparam_bounds(param, &lo, &hi);
 1361|  45.9k|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  154|  45.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 45.9k]
  |  |  ------------------
  ------------------
 1362|  45.9k|    if (value != 0 && (value < lo || value > hi)) return ZXC_ERROR_BAD_PARAM;
  ------------------
  |  Branch (1362:9): [True: 19.7k, False: 26.1k]
  |  Branch (1362:24): [True: 0, False: 19.7k]
  |  Branch (1362:38): [True: 0, False: 19.7k]
  ------------------
 1363|  45.9k|    switch (param) {
 1364|      0|        case ZXC_D_THREADS:
  ------------------
  |  Branch (1364:9): [True: 0, False: 45.9k]
  ------------------
 1365|      0|            dctx->params.n_threads = (int)value;
 1366|      0|            break;
 1367|  45.9k|        case ZXC_D_CHECKSUM:
  ------------------
  |  Branch (1367:9): [True: 45.9k, False: 0]
  ------------------
 1368|  45.9k|            dctx->params.checksum_enabled = (int)value;
 1369|  45.9k|            break;
 1370|      0|        default:
  ------------------
  |  Branch (1370:9): [True: 0, False: 45.9k]
  ------------------
 1371|      0|            return ZXC_ERROR_BAD_PARAM;  // LCOV_EXCL_LINE: bounds already refused it
 1372|  45.9k|    }
 1373|  45.9k|    return ZXC_OK;
 1374|  45.9k|}
zxc_free_dctx:
 1423|  15.3k|void zxc_free_dctx(zxc_dctx* dctx) {
 1424|  15.3k|    if (UNLIKELY(!dctx)) return;
  ------------------
  |  |  154|  15.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 15.3k]
  |  |  ------------------
  ------------------
 1425|       |    // Static dctx: handle + inner buffers live inside the caller's workspace,
 1426|       |    // which we do not own. Free is a no-op; the caller owns the workspace.
 1427|  15.3k|    if (dctx->owns_workspace) return;
  ------------------
  |  Branch (1427:9): [True: 0, False: 15.3k]
  ------------------
 1428|  15.3k|    if (dctx->initialized) zxc_cctx_free(&dctx->inner);
  ------------------
  |  Branch (1428:9): [True: 15.3k, False: 0]
  ------------------
 1429|  15.3k|    ZXC_FREE(dctx->dict_copy.data);
  ------------------
  |  |   86|  15.3k|#define ZXC_FREE(ptr) free(ptr)
  ------------------
 1430|  15.3k|    ZXC_FREE(dctx);
  ------------------
  |  |   86|  15.3k|#define ZXC_FREE(ptr) free(ptr)
  ------------------
 1431|  15.3k|}
zxc_compress_block:
 1800|  15.3k|                           void* RESTRICT dst, const size_t dst_capacity) {
 1801|       |    return zxc_compress_block_at(cctx, src, src_size, dst, dst_capacity, NULL, 0);
 1802|  15.3k|}
zxc_compress_block_at:
 1806|  15.3k|                              const zxc_cparams_t* opts, const uint64_t block_index) {
 1807|  15.3k|    if (UNLIKELY(!cctx || !src || !dst || src_size == 0 || dst_capacity == 0))
  ------------------
  |  |  154|   122k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 15.3k]
  |  |  |  Branch (154:42): [True: 0, False: 15.3k]
  |  |  |  Branch (154:42): [True: 0, False: 15.3k]
  |  |  |  Branch (154:42): [True: 0, False: 15.3k]
  |  |  |  Branch (154:42): [True: 0, False: 15.3k]
  |  |  |  Branch (154:42): [True: 0, False: 15.3k]
  |  |  ------------------
  ------------------
 1808|      0|        return ZXC_ERROR_NULL_INPUT;
 1809|  15.3k|    if (UNLIKELY(src_size > ZXC_BLOCK_SIZE_MAX)) return ZXC_ERROR_BAD_BLOCK_SIZE;
  ------------------
  |  |  154|  15.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 15.3k]
  |  |  ------------------
  ------------------
 1810|       |
 1811|  15.3k|    const zxc_cparams_t* const cp = opts ? opts : &cctx->params;
  ------------------
  |  Branch (1811:37): [True: 0, False: 15.3k]
  ------------------
 1812|  15.3k|    zxc_cctx_opts_t o = zxc_cparams_resolve(cp);
 1813|       |    // Carve for the source if block_size is smaller; remember block_size as asked.
 1814|  15.3k|    zxc_cctx_opts_t carve = o;
 1815|  15.3k|    const size_t min_bs = zxc_block_size_ceil(src_size);
 1816|  15.3k|    if (carve.block_size < min_bs) carve.block_size = min_bs;
  ------------------
  |  Branch (1816:9): [True: 0, False: 15.3k]
  ------------------
 1817|       |
 1818|  15.3k|    return zxc_compress_block_resolved(cctx, src, src_size, dst, dst_capacity, carve, cp,
 1819|  15.3k|                                       block_index);
 1820|  15.3k|}
zxc_decompress_block:
 1908|  60.2k|                             void* RESTRICT dst, const size_t dst_capacity) {
 1909|  60.2k|    const zxc_dparams_t* const opts = dctx ? &dctx->params : NULL;
  ------------------
  |  Branch (1909:39): [True: 60.2k, False: 0]
  ------------------
 1910|  60.2k|    if (UNLIKELY(!dctx || !src || !dst || src_size < ZXC_BLOCK_HEADER_SIZE || dst_capacity == 0))
  ------------------
  |  |  154|   481k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 101, False: 60.1k]
  |  |  |  Branch (154:42): [True: 0, False: 60.2k]
  |  |  |  Branch (154:42): [True: 0, False: 60.2k]
  |  |  |  Branch (154:42): [True: 0, False: 60.2k]
  |  |  |  Branch (154:42): [True: 101, False: 60.1k]
  |  |  |  Branch (154:42): [True: 0, False: 60.1k]
  |  |  ------------------
  ------------------
 1911|    101|        return ZXC_ERROR_NULL_INPUT;
 1912|       |
 1913|       |    // One format-conformant block, so the payload cannot exceed
 1914|       |    // ZXC_BLOCK_SIZE_MAX; dst_capacity is bounded to that plus the tail-pad the
 1915|       |    // wild copies need. Larger outputs belong to the frame or streaming APIs.
 1916|  60.1k|    if (UNLIKELY(dst_capacity > ZXC_BLOCK_SIZE_MAX + ZXC_DECOMPRESS_TAIL_PAD))
  ------------------
  |  |  154|  60.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 60.1k]
  |  |  ------------------
  ------------------
 1917|      0|        return ZXC_ERROR_BAD_BLOCK_SIZE;
 1918|       |
 1919|  60.1k|    const int checksum_enabled = opts ? opts->checksum_enabled : 0;
  ------------------
  |  Branch (1919:34): [True: 60.1k, False: 0]
  ------------------
 1920|       |
 1921|  60.1k|    const uint8_t* dict = opts ? (const uint8_t*)opts->dict : NULL;
  ------------------
  |  Branch (1921:27): [True: 60.1k, False: 0]
  ------------------
 1922|  60.1k|    const size_t dict_size = ZXC_OPTS_DICT_SIZE(opts);
  ------------------
  |  |  988|  60.1k|#define ZXC_OPTS_DICT_SIZE(o) (((o) && (o)->dict) ? (o)->dict_size : (size_t)0)
  |  |  ------------------
  |  |  |  Branch (988:33): [True: 60.1k, False: 0]
  |  |  |  Branch (988:40): [True: 0, False: 60.1k]
  |  |  ------------------
  ------------------
 1923|  60.1k|    if (UNLIKELY(dctx->owns_workspace))
  ------------------
  |  |  154|  60.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 60.1k]
  |  |  ------------------
  ------------------
 1924|      0|        return zxc_static_decompress_block(dctx, (const uint8_t*)src, src_size, (uint8_t*)dst,
 1925|      0|                                           dst_capacity, checksum_enabled, 0);
 1926|       |
 1927|       |    // Carved for the block dst can hold. The tail pad must not round the carve
 1928|       |    // up to 4 MiB: its buffers would then outgrow ZXC_VARINT_INVALID.
 1929|  60.1k|    const size_t block_size =
 1930|  60.1k|        zxc_block_size_ceil(dst_capacity < ZXC_BLOCK_SIZE_MAX ? dst_capacity : ZXC_BLOCK_SIZE_MAX);
  ------------------
  |  |   75|  60.1k|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  ------------------
  |  |  |  |   69|  60.1k|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  ------------------
  ------------------
                      zxc_block_size_ceil(dst_capacity < ZXC_BLOCK_SIZE_MAX ? dst_capacity : 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
  |  |  ------------------
  ------------------
  |  Branch (1930:29): [True: 60.1k, False: 0]
  ------------------
 1931|  60.1k|    const int rc = zxc_dctx_prepare(dctx, block_size, dict_size, checksum_enabled);
 1932|  60.1k|    if (UNLIKELY(rc != ZXC_OK)) return rc;  // LCOV_EXCL_LINE
  ------------------
  |  |  154|  60.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 60.1k]
  |  |  ------------------
  ------------------
 1933|       |
 1934|  60.1k|    zxc_cctx_t* const ctx = &dctx->inner;
 1935|  60.1k|    ctx->dict_size = dict_size;
 1936|  60.1k|    if (UNLIKELY(zxc_ctx_sync_dict_huf(ctx, dctx->huf_cache, &dctx->huf_cached,
  ------------------
  |  |  154|   300k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 60.1k]
  |  |  |  Branch (154:42): [True: 60.1k, False: 0]
  |  |  |  Branch (154:42): [True: 0, False: 60.1k]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1937|  60.1k|                                       ZXC_OPTS_DICT_HUF(opts)) != ZXC_OK))
 1938|      0|        return ZXC_ERROR_CORRUPT_DATA;  // LCOV_EXCL_LINE
 1939|       |
 1940|       |    // The [dict | decode] buffer carries block_size + ZXC_DECOMPRESS_TAIL_PAD.
 1941|  60.1k|    const size_t work_sz = block_size + ZXC_DECOMPRESS_TAIL_PAD;
  ------------------
  |  |  361|  60.1k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  674|  60.1k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|  60.1k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  522|  60.1k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|  60.1k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  60.1k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  60.1k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  331|  60.1k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
 1942|       |
 1943|  60.1k|    int res;
 1944|  60.1k|    if (dict && dict_size > 0) {
  ------------------
  |  Branch (1944:9): [True: 0, False: 60.1k]
  |  Branch (1944:17): [True: 0, False: 0]
  ------------------
 1945|       |        // [dict | decode] assembled in the cctx-owned dict_buffer
 1946|      0|        uint8_t* const dec_buf = ctx->dict_buffer;
 1947|      0|        ZXC_MEMCPY(dec_buf, dict, dict_size);
  ------------------
  |  |  170|      0|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1948|      0|        res = zxc_decompress_chunk_wrapper(ctx, (const uint8_t*)src, src_size, dec_buf + dict_size,
 1949|      0|                                           work_sz, 0);
 1950|      0|        if (LIKELY(res > 0)) {
  ------------------
  |  |  148|      0|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1951|      0|            if (UNLIKELY((size_t)res > dst_capacity)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1952|      0|            ZXC_MEMCPY(dst, dec_buf + dict_size, (size_t)res);
  ------------------
  |  |  170|      0|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1953|      0|        }
 1954|  60.1k|    } else {
 1955|  60.1k|        res = zxc_decompress_chunk_wrapper(ctx, (const uint8_t*)src, src_size, (uint8_t*)dst,
 1956|  60.1k|                                           dst_capacity, 0);
 1957|       |        // A tight tail aborts a block that fits: work_buf has the margin.
 1958|       |        // Corrupt blocks report OVERFLOW too, and pay the second decode.
 1959|  60.1k|        if (UNLIKELY(res == ZXC_ERROR_OVERFLOW))
  ------------------
  |  |  154|  60.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 7.24k, False: 52.9k]
  |  |  ------------------
  ------------------
 1960|  7.24k|            return zxc_decode_bounce(ctx, (const uint8_t*)src, src_size, (uint8_t*)dst,
 1961|  7.24k|                                     dst_capacity, 0);
 1962|  60.1k|    }
 1963|  52.9k|    if (UNLIKELY(res < 0)) return res;
  ------------------
  |  |  154|  52.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 15.9k, False: 36.9k]
  |  |  ------------------
  ------------------
 1964|  36.9k|    return (int64_t)res;
 1965|  52.9k|}
zxc_decompress_block_safe:
 1977|  76.5k|                                  void* RESTRICT dst, const size_t dst_capacity) {
 1978|  76.5k|    const zxc_dparams_t* const opts = dctx ? &dctx->params : NULL;
  ------------------
  |  Branch (1978:39): [True: 76.5k, False: 0]
  ------------------
 1979|  76.5k|    if (UNLIKELY(!dctx || !src || !dst || src_size < ZXC_BLOCK_HEADER_SIZE || dst_capacity == 0))
  ------------------
  |  |  154|   612k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 202, False: 76.3k]
  |  |  |  Branch (154:42): [True: 0, False: 76.5k]
  |  |  |  Branch (154:42): [True: 0, False: 76.5k]
  |  |  |  Branch (154:42): [True: 0, False: 76.5k]
  |  |  |  Branch (154:42): [True: 202, False: 76.3k]
  |  |  |  Branch (154:42): [True: 0, False: 76.3k]
  |  |  ------------------
  ------------------
 1980|    202|        return ZXC_ERROR_NULL_INPUT;
 1981|       |
 1982|       |    // Strict-tail variant: dst_capacity matches the exact uncompressed size
 1983|  76.3k|    if (UNLIKELY(dst_capacity > ZXC_BLOCK_SIZE_MAX)) return ZXC_ERROR_BAD_BLOCK_SIZE;
  ------------------
  |  |  154|  76.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 76.3k]
  |  |  ------------------
  ------------------
 1984|  76.3k|    if (UNLIKELY(dctx->owns_workspace))
  ------------------
  |  |  154|  76.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 30.5k, False: 45.8k]
  |  |  ------------------
  ------------------
 1985|  30.5k|        return zxc_static_decompress_block(dctx, (const uint8_t*)src, src_size, (uint8_t*)dst,
 1986|  30.5k|                                           dst_capacity, opts ? opts->checksum_enabled : 0, 1);
  ------------------
  |  Branch (1986:58): [True: 30.5k, False: 0]
  ------------------
 1987|       |
 1988|       |    // A dict needs the [dict|payload] bounce; route to the bounce-capable path.
 1989|  45.8k|    if (opts && opts->dict && opts->dict_size > 0) {
  ------------------
  |  Branch (1989:9): [True: 45.8k, False: 0]
  |  Branch (1989:17): [True: 0, False: 45.8k]
  |  Branch (1989:31): [True: 0, False: 0]
  ------------------
 1990|      0|        return zxc_decompress_block(dctx, src, src_size, dst, dst_capacity);
 1991|      0|    }
 1992|       |
 1993|  45.8k|    const uint8_t type = ((const uint8_t*)src)[0];
 1994|       |    // RAW never wild-writes past dst_capacity: route to the existing fast API.
 1995|  45.8k|    if (type == ZXC_BLOCK_RAW) {
  ------------------
  |  Branch (1995:9): [True: 14.3k, False: 31.5k]
  ------------------
 1996|  14.3k|        return zxc_decompress_block(dctx, src, src_size, dst, dst_capacity);
 1997|  14.3k|    }
 1998|       |
 1999|       |    // SPL/PAK: use the strict-tail decoder (no bounce buffer required).
 2000|  31.5k|    const int checksum_enabled = opts ? opts->checksum_enabled : 0;
  ------------------
  |  Branch (2000:34): [True: 31.5k, False: 0]
  ------------------
 2001|  31.5k|    const int rc = zxc_dctx_prepare(dctx, zxc_block_size_ceil(dst_capacity), 0, checksum_enabled);
 2002|  31.5k|    if (UNLIKELY(rc != ZXC_OK)) return rc;  // LCOV_EXCL_LINE
  ------------------
  |  |  154|  31.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 31.5k]
  |  |  ------------------
  ------------------
 2003|  31.5k|    dctx->inner.dict_size = 0;
 2004|       |
 2005|  31.5k|    const int res = zxc_decompress_chunk_wrapper_safe_public(
 2006|  31.5k|        &dctx->inner, (const uint8_t*)src, src_size, (uint8_t*)dst, dst_capacity, 0);
 2007|  31.5k|    if (UNLIKELY(res < 0)) return res;
  ------------------
  |  |  154|  31.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 21.7k, False: 9.72k]
  |  |  ------------------
  ------------------
 2008|  9.72k|    return (int64_t)res;
 2009|  31.5k|}
zxc_static_dctx_workspace_size:
 2075|      3|size_t zxc_static_dctx_workspace_size(const size_t block_size) {
 2076|      3|    if (UNLIKELY(!zxc_validate_block_size(block_size))) return 0;
  ------------------
  |  |  154|      3|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 3]
  |  |  ------------------
  ------------------
 2077|      3|    const size_t inner_sz = zxc_cctx_compute_workspace_size(block_size, 0, 0, 0);
 2078|      3|    if (UNLIKELY(inner_sz == 0)) return 0;
  ------------------
  |  |  154|      3|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 3]
  |  |  ------------------
  ------------------
 2079|      3|    return ZXC_STATIC_DCTX_HDR_SIZE + inner_sz;
  ------------------
  |  | 2023|      3|#define ZXC_STATIC_DCTX_HDR_SIZE ZXC_ALIGN_CL(sizeof(struct zxc_dctx_s))
  |  |  ------------------
  |  |  |  |  373|      3|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  371|      3|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  369|      3|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  371|      3|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  369|      3|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2080|      3|}
zxc_init_static_dctx:
 2083|  30.6k|                               const size_t block_size) {
 2084|  30.6k|    if (UNLIKELY(!workspace)) return NULL;
  ------------------
  |  |  154|  30.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 30.6k]
  |  |  ------------------
  ------------------
 2085|  30.6k|    if (UNLIKELY(!zxc_validate_block_size(block_size))) return NULL;
  ------------------
  |  |  154|  30.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 30.6k]
  |  |  ------------------
  ------------------
 2086|       |
 2087|  30.6k|    const size_t inner_sz = zxc_cctx_compute_workspace_size(block_size, 0, 0, 0);
 2088|  30.6k|    if (UNLIKELY(inner_sz == 0)) return NULL;
  ------------------
  |  |  154|  30.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 30.6k]
  |  |  ------------------
  ------------------
 2089|  30.6k|    if (UNLIKELY(workspace_size < ZXC_STATIC_DCTX_HDR_SIZE + inner_sz)) return NULL;
  ------------------
  |  |  154|  30.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 30.6k]
  |  |  ------------------
  ------------------
 2090|       |
 2091|  30.6k|    zxc_dctx* const dctx = (zxc_dctx*)workspace;
 2092|  30.6k|    ZXC_MEMSET(dctx, 0, sizeof(*dctx));
  ------------------
  |  |  175|  30.6k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 2093|       |
 2094|  30.6k|    uint8_t* const inner_ws = (uint8_t*)workspace + ZXC_STATIC_DCTX_HDR_SIZE;
  ------------------
  |  | 2023|  30.6k|#define ZXC_STATIC_DCTX_HDR_SIZE ZXC_ALIGN_CL(sizeof(struct zxc_dctx_s))
  |  |  ------------------
  |  |  |  |  373|  30.6k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  371|  30.6k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  369|  30.6k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  371|  30.6k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  369|  30.6k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2095|       |    // mode == 0 init: checksum_enabled is updated per-call from the file
 2096|       |    // header flags, so it does not need to be locked at workspace init.
 2097|  30.6k|    if (UNLIKELY(zxc_cctx_init_in_workspace(&dctx->inner, inner_ws, inner_sz, block_size, 0, 0, 0,
  ------------------
  |  |  154|  30.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 30.6k]
  |  |  ------------------
  ------------------
 2098|  30.6k|                                            0, 0) != ZXC_OK))
 2099|      0|        return NULL;
 2100|       |
 2101|  30.6k|    dctx->owns_workspace = 1;
 2102|  30.6k|    dctx->initialized = 1;
 2103|  30.6k|    dctx->last_block_size = block_size;
 2104|  30.6k|    return dctx;
 2105|  30.6k|}
zxc_dispatch.c:zxc_variants:
  335|  82.7k|static ZXC_ALWAYS_INLINE const zxc_variant_set_t* zxc_variants(void) {
  336|  82.7k|    return &zxc_variants_default;
  337|  82.7k|}
zxc_dispatch.c:zxc_cparams_defaults:
 1003|  15.3k|static zxc_cparams_t zxc_cparams_defaults(void) {
 1004|  15.3k|    return (zxc_cparams_t){.level = ZXC_LEVEL_DEFAULT, .block_size = ZXC_BLOCK_SIZE_DEFAULT};
  ------------------
  |  |   71|  15.3k|#define ZXC_BLOCK_SIZE_DEFAULT (512 * 1024)
  ------------------
 1005|  15.3k|}
zxc_dispatch.c:zxc_cparams_resolve:
  995|  15.3k|static zxc_cctx_opts_t zxc_cparams_resolve(const zxc_cparams_t* p) {
  996|  15.3k|    return (zxc_cctx_opts_t){.level = p->level,
  997|  15.3k|                             .checksum = p->checksum_enabled,
  998|  15.3k|                             .seekable = p->seekable,
  999|  15.3k|                             .block_size = p->block_size};
 1000|  15.3k|}
zxc_dispatch.c:zxc_compress_block_resolved:
 1732|  15.3k|                                           const zxc_cparams_t* opts, const uint64_t block_index) {
 1733|       |    // When a dictionary is active, offset_bits must accommodate dict + block.
 1734|  15.3k|    const uint8_t* b_dict = opts ? (const uint8_t*)opts->dict : NULL;
  ------------------
  |  Branch (1734:29): [True: 15.3k, False: 0]
  ------------------
 1735|  15.3k|    const size_t b_dict_size = ZXC_OPTS_DICT_SIZE(opts);
  ------------------
  |  |  988|  15.3k|#define ZXC_OPTS_DICT_SIZE(o) (((o) && (o)->dict) ? (o)->dict_size : (size_t)0)
  |  |  ------------------
  |  |  |  Branch (988:33): [True: 15.3k, False: 0]
  |  |  |  Branch (988:40): [True: 0, False: 15.3k]
  |  |  ------------------
  ------------------
 1736|  15.3k|    const size_t effective_block_size =
 1737|  15.3k|        b_dict_size > 0 ? zxc_block_size_ceil(b_dict_size + o.block_size) : o.block_size;
  ------------------
  |  Branch (1737:9): [True: 0, False: 15.3k]
  ------------------
 1738|       |
 1739|       |    // Static cctx: the setters already refuse a dictionary, another block size
 1740|       |    // and a level raise, but a source larger than the pinned block would still
 1741|       |    // force a re-carve the workspace cannot hold.
 1742|  15.3k|    if (UNLIKELY(cctx->owns_workspace && effective_block_size != cctx->last_block_size))
  ------------------
  |  |  154|  15.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 15.3k]
  |  |  |  Branch (154:42): [True: 0, False: 15.3k]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1743|      0|        return ZXC_ERROR_BAD_BLOCK_SIZE;
 1744|       |
 1745|       |    // Re-init when [dict | block] outgrows the workspace (a larger one encodes
 1746|       |    // the same, so a smaller block keeps it), a level raise needs the
 1747|       |    // optimal-parser scratch, or a dictionary meets a context carved without it.
 1748|  15.3k|    if (UNLIKELY(!cctx->initialized || cctx->last_block_size < effective_block_size ||
  ------------------
  |  |  154|  45.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 15.3k, False: 0]
  |  |  |  Branch (154:42): [True: 15.3k, False: 0]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1749|  15.3k|                 (o.level >= ZXC_LEVEL_DENSITY && !cctx->inner.opt_scratch) ||
 1750|  15.3k|                 (b_dict_size > 0 && !cctx->inner.dict_buffer))) {
 1751|  15.3k|        if (cctx->initialized) {
  ------------------
  |  Branch (1751:13): [True: 0, False: 15.3k]
  ------------------
 1752|       |            // LCOV_EXCL_START
 1753|      0|            zxc_cctx_free(&cctx->inner);
 1754|      0|            cctx->initialized = 0;
 1755|       |            // LCOV_EXCL_STOP
 1756|      0|        }
 1757|       |        // LCOV_EXCL_START
 1758|  15.3k|        if (UNLIKELY(zxc_cctx_init(&cctx->inner, effective_block_size, 1, o.level, o.checksum,
  ------------------
  |  |  154|  15.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 15.3k]
  |  |  ------------------
  ------------------
 1759|  15.3k|                                   b_dict_size) != ZXC_OK))
 1760|      0|            return ZXC_ERROR_MEMORY;
 1761|       |        // LCOV_EXCL_STOP
 1762|  15.3k|        cctx->last_block_size = effective_block_size;
 1763|  15.3k|        cctx->initialized = 1;
 1764|  15.3k|        cctx->huf_cached = 0;
 1765|  15.3k|    } else {
 1766|      0|        cctx->inner.compression_level = o.level;
 1767|      0|        cctx->inner.checksum_enabled = o.checksum;
 1768|      0|    }
 1769|       |
 1770|  15.3k|    cctx->inner.dict_size = b_dict_size;
 1771|  15.3k|    if (UNLIKELY(zxc_ctx_sync_dict_huf(&cctx->inner, cctx->huf_cache, &cctx->huf_cached,
  ------------------
  |  |  154|  76.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 15.3k]
  |  |  |  Branch (154:42): [True: 15.3k, False: 0]
  |  |  |  Branch (154:42): [True: 0, False: 15.3k]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1772|  15.3k|                                       ZXC_OPTS_DICT_HUF(opts)) != ZXC_OK))
 1773|      0|        return ZXC_ERROR_CORRUPT_DATA;  // LCOV_EXCL_LINE
 1774|       |
 1775|  15.3k|    int res;
 1776|  15.3k|    if (b_dict && b_dict_size > 0) {
  ------------------
  |  Branch (1776:9): [True: 0, False: 15.3k]
  |  Branch (1776:19): [True: 0, False: 0]
  ------------------
 1777|       |        // [dict | block] assembled in the cctx-owned dict_buffer
 1778|      0|        uint8_t* const combined = cctx->inner.dict_buffer;
 1779|      0|        ZXC_MEMCPY(combined, b_dict, b_dict_size);
  ------------------
  |  |  170|      0|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1780|      0|        ZXC_MEMCPY(combined + b_dict_size, src, src_size);
  ------------------
  |  |  170|      0|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1781|      0|        res = zxc_compress_chunk_wrapper(&cctx->inner, combined, b_dict_size + src_size,
 1782|      0|                                         (uint8_t*)dst, dst_capacity, block_index);
 1783|  15.3k|    } else {
 1784|  15.3k|        res = zxc_compress_chunk_wrapper(&cctx->inner, (const uint8_t*)src, src_size, (uint8_t*)dst,
 1785|  15.3k|                                         dst_capacity, block_index);
 1786|  15.3k|    }
 1787|  15.3k|    if (UNLIKELY(res < 0)) return res;
  ------------------
  |  |  154|  15.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 15.3k]
  |  |  ------------------
  ------------------
 1788|  15.3k|    return (int64_t)res;
 1789|  15.3k|}
zxc_dispatch.c:zxc_static_decompress_block:
 1850|  30.5k|                                           const int strict) {
 1851|  30.5k|    const size_t carved = dctx->last_block_size;
 1852|  30.5k|    const size_t work_sz = carved + ZXC_DECOMPRESS_TAIL_PAD;
  ------------------
  |  |  361|  30.5k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  674|  30.5k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  528|  30.5k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  522|  30.5k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  530|  30.5k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  30.5k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  30.5k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  331|  30.5k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
 1853|  30.5k|    zxc_cctx_t* const ctx = &dctx->inner;
 1854|  30.5k|    ctx->checksum_enabled = checksum_enabled;
 1855|  30.5k|    ctx->dict_size = 0;
 1856|  30.5k|    int res;
 1857|  30.5k|    if (strict) {
  ------------------
  |  Branch (1857:9): [True: 30.5k, False: 0]
  ------------------
 1858|  30.5k|        const size_t cap = dst_capacity < work_sz ? dst_capacity : work_sz;
  ------------------
  |  Branch (1858:28): [True: 22.2k, False: 8.27k]
  ------------------
 1859|  30.5k|        res = zxc_decompress_chunk_wrapper_safe_public(ctx, src, src_size, dst, cap, 0);
 1860|  30.5k|    } else if (dst_capacity >= work_sz) {
  ------------------
  |  Branch (1860:16): [True: 0, False: 0]
  ------------------
 1861|      0|        res = zxc_decompress_chunk_wrapper(ctx, src, src_size, dst, work_sz, 0);
 1862|      0|    } else {
 1863|       |        // Bounce through work_buf when dst cannot absorb wild copies.
 1864|      0|        return zxc_decode_bounce(ctx, src, src_size, dst, dst_capacity, carved);
 1865|      0|    }
 1866|  30.5k|    if (UNLIKELY(res > 0 && (size_t)res > carved)) return ZXC_ERROR_BAD_BLOCK_SIZE;
  ------------------
  |  |  154|  46.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 30.5k]
  |  |  |  Branch (154:42): [True: 15.6k, False: 14.8k]
  |  |  |  Branch (154:42): [True: 0, False: 15.6k]
  |  |  ------------------
  ------------------
 1867|  30.5k|    return res;
 1868|  30.5k|}
zxc_dispatch.c:zxc_dctx_prepare:
 1875|  91.6k|                            const size_t dict_size, const int checksum_enabled) {
 1876|  91.6k|    if (LIKELY(dctx->initialized && dctx->last_block_size == block_size &&
  ------------------
  |  |  148|   322k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 62.7k, False: 28.9k]
  |  |  |  Branch (148:40): [True: 76.3k, False: 15.3k]
  |  |  |  Branch (148:40): [True: 62.7k, False: 13.6k]
  |  |  |  Branch (148:40): [True: 62.7k, False: 0]
  |  |  ------------------
  ------------------
 1877|  91.6k|               dctx->last_dict_size == dict_size)) {
 1878|  62.7k|        dctx->inner.checksum_enabled = checksum_enabled;
 1879|  62.7k|        return ZXC_OK;
 1880|  62.7k|    }
 1881|  28.9k|    if (dctx->initialized) {
  ------------------
  |  Branch (1881:9): [True: 13.6k, False: 15.3k]
  ------------------
 1882|  13.6k|        zxc_cctx_free(&dctx->inner);
 1883|  13.6k|        dctx->initialized = 0;
 1884|  13.6k|    }
 1885|       |    // LCOV_EXCL_START
 1886|  28.9k|    if (UNLIKELY(zxc_cctx_init(&dctx->inner, block_size, 0, 0, checksum_enabled, dict_size) !=
  ------------------
  |  |  154|  28.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 28.9k]
  |  |  ------------------
  ------------------
 1887|  28.9k|                 ZXC_OK))
 1888|      0|        return ZXC_ERROR_MEMORY;
 1889|       |    // LCOV_EXCL_STOP
 1890|  28.9k|    dctx->last_block_size = block_size;
 1891|  28.9k|    dctx->last_dict_size = dict_size;
 1892|  28.9k|    dctx->initialized = 1;
 1893|  28.9k|    dctx->huf_cached = 0;
 1894|  28.9k|    return ZXC_OK;
 1895|  28.9k|}
zxc_dispatch.c:zxc_ctx_sync_dict_huf:
  977|  75.4k|                                 int* RESTRICT cached, const uint8_t* RESTRICT dict_huf) {
  978|  75.4k|    if (dict_huf) {
  ------------------
  |  Branch (978:9): [True: 0, False: 75.4k]
  ------------------
  979|      0|        if (!*cached || memcmp(cache, dict_huf, ZXC_HUF_TABLE_SIZE) != 0) {
  ------------------
  |  |   96|      0|#define ZXC_HUF_TABLE_SIZE 128
  ------------------
  |  Branch (979:13): [True: 0, False: 0]
  |  Branch (979:25): [True: 0, False: 0]
  ------------------
  980|      0|            *cached = 0; /* a failed attach leaves inner without a tree */
  981|      0|            if (UNLIKELY(zxc_cctx_attach_dict_huf(inner, dict_huf) != ZXC_OK))
  ------------------
  |  |  154|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  982|      0|                return ZXC_ERROR_CORRUPT_DATA;
  983|      0|            ZXC_MEMCPY(cache, dict_huf, ZXC_HUF_TABLE_SIZE);
  ------------------
  |  |  170|      0|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  984|      0|            *cached = 1;
  985|      0|        }
  986|  75.4k|    } else if (*cached) {
  ------------------
  |  Branch (986:16): [True: 0, False: 75.4k]
  ------------------
  987|      0|        (void)zxc_cctx_attach_dict_huf(inner, NULL);
  988|      0|        *cached = 0;
  989|      0|    }
  990|  75.4k|    return ZXC_OK;
  991|  75.4k|}
zxc_dispatch.c:zxc_decode_bounce:
 1829|  7.24k|                                 const size_t dst_capacity, const size_t carved) {
 1830|       |    // Block API only: frameless blocks carry index 0.
 1831|  7.24k|    const int res =
 1832|  7.24k|        zxc_decompress_chunk_wrapper(ctx, src, src_size, ctx->work_buf, ctx->work_buf_cap, 0);
 1833|  7.24k|    if (UNLIKELY(res < 0)) return res;
  ------------------
  |  |  154|  7.24k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 5.70k, False: 1.54k]
  |  |  ------------------
  ------------------
 1834|  1.54k|    if (UNLIKELY(carved != 0 && (size_t)res > carved)) return ZXC_ERROR_BAD_BLOCK_SIZE;
  ------------------
  |  |  154|  1.54k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 1.54k]
  |  |  |  Branch (154:42): [True: 0, False: 1.54k]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1835|  1.54k|    if (UNLIKELY((size_t)res > dst_capacity)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  1.54k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 127, False: 1.41k]
  |  |  ------------------
  ------------------
 1836|  1.41k|    ZXC_MEMCPY(dst, ctx->work_buf, (size_t)res);
  ------------------
  |  |  170|  1.41k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1837|  1.41k|    return res;
 1838|  1.54k|}
zxc_dispatch.c:zxc_decompress_chunk_wrapper_safe_public:
  460|  62.0k|                                                    const uint64_t block_index) {
  461|  62.0k|    return zxc_decompress_safe_variant()(ctx, src, src_sz, dst, dst_cap, block_index);
  462|  62.0k|}
zxc_dispatch.c:zxc_decompress_safe_variant:
  392|  62.0k|static ZXC_ALWAYS_INLINE zxc_decompress_func_t zxc_decompress_safe_variant(void) {
  393|  62.0k|    return zxc_decompress_chunk_wrapper_safe_default;
  394|  62.0k|}

zxc_huf_build_code_lengths_default:
  164|  10.3k|                               void* RESTRICT scratch, const int max_code_len) {
  165|  10.3k|    ZXC_MEMSET(code_len, 0, ZXC_HUF_NUM_SYMBOLS);
  ------------------
  |  |  175|  10.3k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  166|       |
  167|  10.3k|    pm_leaf_t leaves[ZXC_HUF_NUM_SYMBOLS];
  168|  10.3k|    int n = 0;
  169|  2.66M|    for (int i = 0; i < ZXC_HUF_NUM_SYMBOLS; i++) {
  ------------------
  |  |  785|  2.66M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (169:21): [True: 2.65M, False: 10.3k]
  ------------------
  170|  2.65M|        if (freq[i] > 0) {
  ------------------
  |  Branch (170:13): [True: 1.72M, False: 926k]
  ------------------
  171|  1.72M|            leaves[n].w = freq[i];
  172|  1.72M|            leaves[n].sym = (int16_t)i;
  173|  1.72M|            n++;
  174|  1.72M|        }
  175|  2.65M|    }
  176|  10.3k|    if (UNLIKELY(n == 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  10.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 10.3k]
  |  |  ------------------
  ------------------
  177|  10.3k|    if (n == 1) {
  ------------------
  |  Branch (177:9): [True: 5, False: 10.3k]
  ------------------
  178|      5|        code_len[leaves[0].sym] = 1;
  179|      5|        return ZXC_OK;
  180|      5|    }
  181|       |
  182|  10.3k|    pm_leaves_sort(leaves, n);
  183|       |
  184|       |    // Callers pass max_code_len >= 8, and n <= 256 <= 2^max_code_len, so the
  185|       |    // length limit is always feasible (a full 8-bit code covers all 256 symbols).
  186|  10.3k|    const int max_per_level = 2 * n;
  187|       |
  188|       |    // Working buffers: either carve from caller-provided scratch (sized for
  189|       |    // the worst-case alphabet) or fall back to per-call malloc/free.
  190|  10.3k|    pm_item_t* items;
  191|  10.3k|    int* counts;
  192|  10.3k|    frame_t* stack;
  193|  10.3k|    pm_item_t* owned_items = NULL;
  194|  10.3k|    int* owned_counts = NULL;
  195|  10.3k|    frame_t* owned_stack = NULL;
  196|  10.3k|    if (scratch) {
  ------------------
  |  Branch (196:9): [True: 10.3k, False: 0]
  ------------------
  197|  10.3k|        uint8_t* p = (uint8_t*)scratch;
  198|  10.3k|        items = (pm_item_t*)p;
  199|  10.3k|        p +=
  200|  10.3k|            (size_t)ZXC_HUF_MAX_CODE_LEN_ULTRA * (size_t)ZXC_HUF_PM_LEVEL_BOUND * sizeof(pm_item_t);
  ------------------
  |  |  778|  10.3k|#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);
  ------------------
  |  | 1054|  10.3k|#define ZXC_HUF_PM_LEVEL_BOUND (2 * ZXC_HUF_NUM_SYMBOLS)
  |  |  ------------------
  |  |  |  |  785|  10.3k|#define ZXC_HUF_NUM_SYMBOLS 256
  |  |  ------------------
  ------------------
  201|  10.3k|        p = (uint8_t*)(((uintptr_t)p + 7U) & ~(uintptr_t)7U);
  202|  10.3k|        counts = (int*)p;
  203|  10.3k|        ZXC_MEMSET(counts, 0, (size_t)ZXC_HUF_MAX_CODE_LEN_ULTRA * sizeof(int));
  ------------------
  |  |  175|  10.3k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  204|  10.3k|        p += (size_t)ZXC_HUF_MAX_CODE_LEN_ULTRA * sizeof(int);
  ------------------
  |  |  778|  10.3k|#define ZXC_HUF_MAX_CODE_LEN_ULTRA 11
  ------------------
  205|  10.3k|        p = (uint8_t*)(((uintptr_t)p + 7U) & ~(uintptr_t)7U);
  206|  10.3k|        stack = (frame_t*)p;
  207|  10.3k|    } else {
  208|      0|        owned_items = (pm_item_t*)ZXC_MALLOC((size_t)ZXC_HUF_MAX_CODE_LEN_ULTRA *
  ------------------
  |  |   68|      0|#define ZXC_MALLOC(size) malloc(size)
  ------------------
  209|      0|                                             (size_t)max_per_level * sizeof(pm_item_t));
  210|      0|        owned_counts = (int*)ZXC_CALLOC((size_t)ZXC_HUF_MAX_CODE_LEN_ULTRA, sizeof(int));
  ------------------
  |  |   74|      0|#define ZXC_CALLOC(nmemb, size) calloc(nmemb, size)
  ------------------
  211|      0|        owned_stack = (frame_t*)ZXC_MALLOC((size_t)ZXC_HUF_MAX_CODE_LEN_ULTRA *
  ------------------
  |  |   68|      0|#define ZXC_MALLOC(size) malloc(size)
  ------------------
  212|      0|                                           (size_t)max_per_level * sizeof(frame_t));
  213|      0|        if (UNLIKELY(!owned_items || !owned_counts || !owned_stack)) {
  ------------------
  |  |  154|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 0]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  |  Branch (154:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  214|      0|            ZXC_FREE(owned_items);
  ------------------
  |  |   86|      0|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  215|      0|            ZXC_FREE(owned_counts);
  ------------------
  |  |   86|      0|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  216|      0|            ZXC_FREE(owned_stack);
  ------------------
  |  |   86|      0|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  217|      0|            return ZXC_ERROR_MEMORY;
  218|      0|        }
  219|      0|        items = owned_items;
  220|      0|        counts = owned_counts;
  221|      0|        stack = owned_stack;
  222|      0|    }
  223|  10.3k|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  224|       |
  225|       |    // Level 0 (logical level 1): the leaves themselves, already sorted.
  226|  1.73M|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (226:21): [True: 1.72M, False: 10.3k]
  ------------------
  227|  1.72M|        ITEM(0, i).weight = leaves[i].w;
  ------------------
  |  |  223|  1.72M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  228|  1.72M|        ITEM(0, i).left = -1;
  ------------------
  |  |  223|  1.72M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  229|  1.72M|        ITEM(0, i).right = -1;
  ------------------
  |  |  223|  1.72M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  230|  1.72M|        ITEM(0, i).sym = leaves[i].sym;
  ------------------
  |  |  223|  1.72M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  231|  1.72M|    }
  232|  10.3k|    counts[0] = n;
  233|       |
  234|       |    // Levels 1..max_code_len-1: merge sorted leaves with sorted packages from the previous
  235|       |    // level.
  236|  91.4k|    for (int k = 1; k < max_code_len; k++) {
  ------------------
  |  Branch (236:21): [True: 81.1k, False: 10.3k]
  ------------------
  237|  81.1k|        const int prev = counts[k - 1];
  238|  81.1k|        const int packs = prev / 2;
  239|  81.1k|        int li = 0;
  240|  81.1k|        int pi = 0;
  241|  81.1k|        int n_lvl = 0;
  242|  26.2M|        while (li < n || pi < packs) {
  ------------------
  |  Branch (242:16): [True: 25.2M, False: 991k]
  |  Branch (242:26): [True: 910k, False: 81.1k]
  ------------------
  243|  26.1M|            const uint32_t wl = (li < n) ? leaves[li].w : UINT32_MAX;
  ------------------
  |  Branch (243:33): [True: 25.2M, False: 910k]
  ------------------
  244|  26.1M|            const uint32_t wp =
  245|  26.1M|                (pi < packs)
  ------------------
  |  Branch (245:17): [True: 26.1M, False: 2.36k]
  ------------------
  246|  26.1M|                    ? (uint32_t)(ITEM(k - 1, 2 * pi).weight + ITEM(k - 1, 2 * pi + 1).weight)
  ------------------
  |  |  223|  26.1M|#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)
  ------------------
  |  |  223|  26.1M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  247|  26.1M|                    : UINT32_MAX;
  248|  26.1M|            if (wl <= wp && li < n) {
  ------------------
  |  Branch (248:17): [True: 13.9M, False: 12.2M]
  |  Branch (248:29): [True: 13.9M, False: 0]
  ------------------
  249|  13.9M|                ITEM(k, n_lvl).weight = wl;
  ------------------
  |  |  223|  13.9M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  250|  13.9M|                ITEM(k, n_lvl).left = -1;
  ------------------
  |  |  223|  13.9M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  251|  13.9M|                ITEM(k, n_lvl).right = -1;
  ------------------
  |  |  223|  13.9M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  252|  13.9M|                ITEM(k, n_lvl).sym = leaves[li].sym;
  ------------------
  |  |  223|  13.9M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  253|  13.9M|                li++;
  254|  13.9M|            } else {
  255|  12.2M|                ITEM(k, n_lvl).weight = wp;
  ------------------
  |  |  223|  12.2M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  256|  12.2M|                ITEM(k, n_lvl).left = (int16_t)(2 * pi);
  ------------------
  |  |  223|  12.2M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  257|  12.2M|                ITEM(k, n_lvl).right = (int16_t)(2 * pi + 1);
  ------------------
  |  |  223|  12.2M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  258|  12.2M|                ITEM(k, n_lvl).sym = -1;
  ------------------
  |  |  223|  12.2M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  259|  12.2M|                pi++;
  260|  12.2M|            }
  261|  26.1M|            n_lvl++;
  262|  26.1M|        }
  263|  81.1k|        counts[k] = n_lvl;
  264|  81.1k|    }
  265|       |
  266|       |    // Step 3: take first 2n-2 items at level max_code_len-1; trace back, counting leaf
  267|       |    // appearances.
  268|  10.3k|    int n_take = 2 * n - 2;
  269|  10.3k|    if (n_take > counts[max_code_len - 1]) n_take = counts[max_code_len - 1];
  ------------------
  |  Branch (269:9): [True: 0, False: 10.3k]
  ------------------
  270|       |
  271|       |    // Worst case stack depth: (max_code_len * n_take) frames; bounded by
  272|       |    // max_code_len * 2n <= ZXC_HUF_MAX_CODE_LEN_ULTRA * 2n. `stack` was set up earlier from
  273|       |    // scratch (or the local malloc fallback), sized for the ceiling.
  274|  10.3k|    int sp = 0;
  275|  3.44M|    for (int i = 0; i < n_take; i++) {
  ------------------
  |  Branch (275:21): [True: 3.43M, False: 10.3k]
  ------------------
  276|  3.43M|        stack[sp].lvl = (int8_t)(max_code_len - 1);
  277|  3.43M|        stack[sp].idx = (int16_t)i;
  278|  3.43M|        sp++;
  279|  3.43M|    }
  280|  24.4M|    while (sp > 0) {
  ------------------
  |  Branch (280:12): [True: 24.4M, False: 10.3k]
  ------------------
  281|  24.4M|        frame_t f = stack[--sp];
  282|  24.4M|        const pm_item_t* it = &ITEM(f.lvl, f.idx);
  ------------------
  |  |  223|  24.4M|#define ITEM(k, i) items[(size_t)(k) * (size_t)max_per_level + (size_t)(i)]
  ------------------
  283|  24.4M|        if (it->sym >= 0) {
  ------------------
  |  Branch (283:13): [True: 13.9M, False: 10.5M]
  ------------------
  284|  13.9M|            code_len[it->sym]++;
  285|  13.9M|        } else {
  286|  10.5M|            stack[sp].lvl = (int8_t)(f.lvl - 1);
  287|  10.5M|            stack[sp].idx = it->left;
  288|  10.5M|            sp++;
  289|  10.5M|            stack[sp].lvl = (int8_t)(f.lvl - 1);
  290|  10.5M|            stack[sp].idx = it->right;
  291|  10.5M|            sp++;
  292|  10.5M|        }
  293|  24.4M|    }
  294|       |
  295|  10.3k|    if (owned_items) {
  ------------------
  |  Branch (295:9): [True: 0, False: 10.3k]
  ------------------
  296|      0|        ZXC_FREE(owned_items);
  ------------------
  |  |   86|      0|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  297|      0|        ZXC_FREE(owned_counts);
  ------------------
  |  |   86|      0|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  298|      0|        ZXC_FREE(owned_stack);
  ------------------
  |  |   86|      0|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  299|      0|    }
  300|  10.3k|#undef ITEM
  301|  10.3k|    return ZXC_OK;
  302|  10.3k|}
zxc_huf_nudge_code_lengths:
  792|  3.36k|                               const int max_code_len) {
  793|  3.36k|    enum { LU = ZXC_HUF_MAX_CODE_LEN_ULTRA };
  794|  3.36k|    uint32_t blc0[LU + 1];
  795|  3.36k|    const int n = zxc_huf_nudge_classes(code_len, blc0);
  796|       |    // Degenerate alphabets have no shape freedom (and n == 1 is format-pinned
  797|       |    // to code length exactly 1): leave them untouched.
  798|  3.36k|    if (n < 4) return 0;
  ------------------
  |  Branch (798:9): [True: 4, False: 3.35k]
  ------------------
  799|       |
  800|       |    // Tables and DP planes live past the rebuilds' region of the scratch when it
  801|       |    // has the room (opt_scratch does), else in one allocation: no 10 KiB frame.
  802|  3.35k|    const int owned = !scratch || scratch_cap < ZXC_HUF_NUDGE_SCRATCH_SIZE;
  ------------------
  |  | 1091|  3.35k|#define ZXC_HUF_NUDGE_SCRATCH_SIZE (ZXC_HUF_NUDGE_SCRATCH_OFF + sizeof(zxc_huf_nudge_ws_t))
  |  |  ------------------
  |  |  |  | 1089|  3.35k|#define ZXC_HUF_NUDGE_SCRATCH_OFF ZXC_ALIGN_CL(ZXC_HUF_BUILD_SCRATCH_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  373|  3.35k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  371|  3.35k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  369|  3.35k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  371|  3.35k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  369|  3.35k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (802:23): [True: 0, False: 3.35k]
  |  Branch (802:35): [True: 0, False: 3.35k]
  ------------------
  803|  3.35k|    zxc_huf_nudge_ws_t* const ws =
  804|  3.35k|        owned ? (zxc_huf_nudge_ws_t*)ZXC_MALLOC(sizeof(*ws))
  ------------------
  |  |   68|      0|#define ZXC_MALLOC(size) malloc(size)
  ------------------
  |  Branch (804:9): [True: 0, False: 3.35k]
  ------------------
  805|  3.35k|              : (zxc_huf_nudge_ws_t*)((uint8_t*)scratch + ZXC_HUF_NUDGE_SCRATCH_OFF);
  ------------------
  |  | 1089|  3.35k|#define ZXC_HUF_NUDGE_SCRATCH_OFF ZXC_ALIGN_CL(ZXC_HUF_BUILD_SCRATCH_SIZE)
  |  |  ------------------
  |  |  |  |  373|  3.35k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  371|  3.35k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  369|  3.35k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  371|  3.35k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  369|  3.35k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  806|  3.35k|    if (UNLIKELY(!ws)) return 0;
  ------------------
  |  |  154|  3.35k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 3.35k]
  |  |  ------------------
  ------------------
  807|       |
  808|       |    // Baseline cost, exact (canonical-order frequency weighting).
  809|  3.35k|    uint64_t* const pf = ws->pf;
  810|  3.35k|    zxc_huf_nudge_pf_canonical(code_len, freq, blc0, pf);
  811|  3.35k|    zxc_huf_nudge_cost_t c0;
  812|  3.35k|    zxc_huf_nudge_eval(blc0, pf, &c0);
  813|       |
  814|       |    // Frequency-rank order shared by every candidate (rank 0 = most frequent;
  815|       |    // pm_leaves_sort is ascending, ties on symbol, so read it backwards).
  816|  3.35k|    pm_leaf_t* const leaves = ws->leaves;
  817|  3.35k|    int k = 0;
  818|   863k|    for (int s = 0; s < ZXC_HUF_NUM_SYMBOLS; s++) {
  ------------------
  |  |  785|   863k|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (818:21): [True: 859k, False: 3.35k]
  ------------------
  819|   859k|        if (!freq[s]) continue;
  ------------------
  |  Branch (819:13): [True: 317k, False: 541k]
  ------------------
  820|   541k|        leaves[k].w = freq[s];
  821|   541k|        leaves[k].sym = (int16_t)s;
  822|   541k|        k++;
  823|   541k|    }
  824|  3.35k|    pm_leaves_sort(leaves, n);
  825|  3.35k|    int16_t* const sym_order = ws->sym_order;
  826|  3.35k|    uint64_t* const pf_rank = ws->pf_rank;
  827|  3.35k|    pf_rank[0] = 0;
  828|   545k|    for (int r = 0; r < n; r++) {
  ------------------
  |  Branch (828:21): [True: 541k, False: 3.35k]
  ------------------
  829|   541k|        sym_order[r] = leaves[n - 1 - r].sym;
  830|   541k|        pf_rank[r + 1] = pf_rank[r] + leaves[n - 1 - r].w;
  831|   541k|    }
  832|       |
  833|       |    // Candidates: the greedy ledger walk, package-merge rebuilt at reduced caps
  834|       |    // (the pass loop runs max_depth + 1 times, so depth cuts attack the decoder's
  835|       |    // biggest fixed cost), and the slot-ledger DP below. All Kraft-exact.
  836|  3.35k|    uint8_t (*const cand)[ZXC_HUF_NUM_SYMBOLS] = ws->cand;
  837|  3.35k|    int n_cand = 0;
  838|  3.35k|    {
  839|  3.35k|        uint32_t blc_w[LU + 1];
  840|  3.35k|        zxc_huf_nudge_walk(blc0, pf_rank, n, max_code_len, blc_w);
  841|  3.35k|        zxc_huf_nudge_assign(blc_w, sym_order, cand[n_cand]);
  842|  3.35k|        n_cand++;
  843|  3.35k|    }
  844|  3.35k|    int max_len0 = 0;
  845|  9.67k|    for (int l = LU; l >= 1; l--) {
  ------------------
  |  Branch (845:22): [True: 9.67k, False: 0]
  ------------------
  846|  9.67k|        if (blc0[l]) {
  ------------------
  |  Branch (846:13): [True: 3.35k, False: 6.31k]
  ------------------
  847|  3.35k|            max_len0 = l;
  848|  3.35k|            break;
  849|  3.35k|        }
  850|  9.67k|    }
  851|  3.35k|    if (max_len0 >= 2) {
  ------------------
  |  Branch (851:9): [True: 3.35k, False: 0]
  ------------------
  852|  8.68k|        for (int cut = 1; cut <= 2; cut++) {
  ------------------
  |  Branch (852:27): [True: 6.41k, False: 2.26k]
  ------------------
  853|  6.41k|            const int cap2 = max_len0 - cut;
  854|  6.41k|            if (cap2 < 2 || ((uint32_t)1 << cap2) < (uint32_t)n) break;
  ------------------
  |  Branch (854:17): [True: 3, False: 6.41k]
  |  Branch (854:29): [True: 1.08k, False: 5.32k]
  ------------------
  855|  5.32k|            if (zxc_huf_build_code_lengths(freq, cand[n_cand], scratch, cap2) != ZXC_OK) break;
  ------------------
  |  |   42|  5.32k|#define zxc_huf_build_code_lengths ZXC_CAT(zxc_huf_build_code_lengths, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   41|  5.32k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|  5.32k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (855:17): [True: 0, False: 5.32k]
  ------------------
  856|  5.32k|            n_cand++;
  857|  5.32k|        }
  858|  3.35k|    }
  859|       |
  860|       |    // Slot-ledger DP: optimal class counts under the rank-weighted model, over
  861|       |    // groups of 2^G frequency-adjacent symbols (G = 0 is exact; coarser tiers
  862|       |    // keep the plane cache-resident, bounding the call to a few hundred us).
  863|       |    // When G does not divide n the lightest group is padded with zero-freq
  864|       |    // ghost leaves on unused byte values - wire-legal, empty runs, and the
  865|       |    // evaluator prices the burnt code space like anything else.
  866|  3.35k|    {
  867|  3.35k|        int g_log2 = 0; /* coarsen until the groups fit the DP plane */
  868|  7.96k|        while (((n + (1 << g_log2) - 1) >> g_log2) > ZXC_HUF_NUDGE_DP_M) g_log2++;
  ------------------
  |  | 1069|  7.96k|#define ZXC_HUF_NUDGE_DP_M 64
  ------------------
  |  Branch (868:16): [True: 4.61k, False: 3.35k]
  ------------------
  869|  3.35k|        const int g = 1 << g_log2;
  870|  3.35k|        const int m = (n + g - 1) / g;
  871|  3.35k|        const int cap_c = max_code_len - g_log2;
  872|  3.35k|        if (m >= 2 && cap_c >= 1 && m <= (1 << cap_c)) {
  ------------------
  |  Branch (872:13): [True: 3.35k, False: 0]
  |  Branch (872:23): [True: 3.35k, False: 0]
  |  Branch (872:37): [True: 3.35k, False: 0]
  ------------------
  873|  3.35k|            uint64_t* const pfg = ws->pfg;
  874|   179k|            for (int j2 = 0; j2 <= m; j2++) {
  ------------------
  |  Branch (874:30): [True: 176k, False: 3.35k]
  ------------------
  875|   176k|                int r = j2 * g;
  876|   176k|                if (r > n) r = n;
  ------------------
  |  Branch (876:21): [True: 1.23k, False: 175k]
  ------------------
  877|   176k|                pfg[j2] = pf_rank[r];
  878|   176k|            }
  879|  3.35k|            uint32_t cblc[LU + 1];
  880|  3.35k|            if (zxc_huf_nudge_dp_solve(ws, pfg, m, cap_c, LU - g_log2, g_log2, cblc)) {
  ------------------
  |  Branch (880:17): [True: 3.35k, False: 0]
  ------------------
  881|  3.35k|                uint8_t* const cl = cand[n_cand];
  882|  3.35k|                ZXC_MEMSET(cl, 0, ZXC_HUF_NUM_SYMBOLS);
  ------------------
  |  |  175|  3.35k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  883|  3.35k|                int r = 0;
  884|  3.35k|                int ghosts = 0;
  885|  3.35k|                uint8_t ghost_len = 0;
  886|  34.4k|                for (int lc = 1; lc <= cap_c; lc++) {
  ------------------
  |  Branch (886:34): [True: 31.1k, False: 3.35k]
  ------------------
  887|   204k|                    for (uint32_t q = 0; q < cblc[lc]; q++) {
  ------------------
  |  Branch (887:42): [True: 173k, False: 31.1k]
  ------------------
  888|   716k|                        for (int e = 0; e < g; e++, r++) {
  ------------------
  |  Branch (888:41): [True: 543k, False: 173k]
  ------------------
  889|   543k|                            if (r < n) {
  ------------------
  |  Branch (889:33): [True: 541k, False: 1.97k]
  ------------------
  890|   541k|                                cl[sym_order[r]] = (uint8_t)(lc + g_log2);
  891|   541k|                            } else {
  892|  1.97k|                                ghost_len = (uint8_t)(lc + g_log2);
  893|  1.97k|                                ghosts++;
  894|  1.97k|                            }
  895|   543k|                        }
  896|   173k|                    }
  897|  31.1k|                }
  898|  62.0k|                for (int s = 0; s < ZXC_HUF_NUM_SYMBOLS && ghosts; s++) {
  ------------------
  |  |  785|   124k|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (898:33): [True: 62.0k, False: 1]
  |  Branch (898:60): [True: 58.6k, False: 3.35k]
  ------------------
  899|  58.6k|                    if (freq[s] == 0 && cl[s] == 0) {
  ------------------
  |  Branch (899:25): [True: 1.97k, False: 56.6k]
  |  Branch (899:41): [True: 1.97k, False: 0]
  ------------------
  900|  1.97k|                        cl[s] = ghost_len;
  901|  1.97k|                        ghosts--;
  902|  1.97k|                    }
  903|  58.6k|                }
  904|  3.35k|                n_cand++;
  905|  3.35k|            }
  906|  3.35k|        }
  907|  3.35k|    }
  908|       |
  909|       |    // Adopt the cheapest candidate clearing both guard rails and strictly
  910|       |    // beating the baseline J; otherwise leave code_len byte-for-byte alone, so a
  911|       |    // rejection never depends on package-merge tie assignment.
  912|  3.35k|    const uint64_t j0 = zxc_huf_nudge_j(&c0);
  913|  3.35k|    uint64_t best_j = j0;
  914|  3.35k|    int best = -1;
  915|  15.3k|    for (int ci = 0; ci < n_cand; ci++) {
  ------------------
  |  Branch (915:22): [True: 12.0k, False: 3.35k]
  ------------------
  916|       |        // Every live symbol must keep a code; ghost-padded candidates carry
  917|       |        // MORE nonzero lengths than n, which is fine.
  918|  12.0k|        int valid = 1;
  919|  3.09M|        for (int s = 0; s < ZXC_HUF_NUM_SYMBOLS; s++) {
  ------------------
  |  |  785|  3.09M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (919:25): [True: 3.08M, False: 12.0k]
  ------------------
  920|  3.08M|            if (freq[s] != 0 && cand[ci][s] == 0) {
  ------------------
  |  Branch (920:17): [True: 1.91M, False: 1.17M]
  |  Branch (920:33): [True: 0, False: 1.91M]
  ------------------
  921|      0|                valid = 0;
  922|      0|                break;
  923|      0|            }
  924|  3.08M|        }
  925|  12.0k|        if (!valid) continue;
  ------------------
  |  Branch (925:13): [True: 0, False: 12.0k]
  ------------------
  926|  12.0k|        uint32_t blc[LU + 1];
  927|  12.0k|        (void)zxc_huf_nudge_classes(cand[ci], blc);
  928|  12.0k|        zxc_huf_nudge_pf_canonical(cand[ci], freq, blc, pf);
  929|  12.0k|        zxc_huf_nudge_cost_t c1;
  930|  12.0k|        zxc_huf_nudge_eval(blc, pf, &c1);
  931|  12.0k|        if (c1.bits * 1000 > c0.bits * ZXC_HUF_NUDGE_BITS_PERMIL) continue;
  ------------------
  |  |  868|  12.0k|#define ZXC_HUF_NUDGE_BITS_PERMIL 1015
  ------------------
  |  Branch (931:13): [True: 3.59k, False: 8.45k]
  ------------------
  932|  8.45k|        if (c1.touches * 256 > c0.touches * ZXC_HUF_NUDGE_MERGE_Q8) continue;
  ------------------
  |  |  871|  8.45k|#define ZXC_HUF_NUDGE_MERGE_Q8 230
  ------------------
  |  Branch (932:13): [True: 5.36k, False: 3.08k]
  ------------------
  933|  3.08k|        const uint64_t j = zxc_huf_nudge_j(&c1);
  934|  3.08k|        if (j < best_j) {
  ------------------
  |  Branch (934:13): [True: 2.75k, False: 333]
  ------------------
  935|  2.75k|            best_j = j;
  936|  2.75k|            best = ci;
  937|  2.75k|        }
  938|  3.08k|    }
  939|  3.35k|    if (best >= 0) ZXC_MEMCPY(code_len, cand[best], ZXC_HUF_NUM_SYMBOLS);
  ------------------
  |  |  170|  2.11k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  |  Branch (939:9): [True: 2.11k, False: 1.24k]
  ------------------
  940|  3.35k|    if (owned) ZXC_FREE(ws);
  ------------------
  |  |   86|      0|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  |  Branch (940:9): [True: 0, False: 3.35k]
  ------------------
  941|  3.35k|    return best >= 0;
  942|  3.35k|}
zxc_huf_pack_lengths_default:
  949|  1.99k|void zxc_huf_pack_lengths(const uint8_t* RESTRICT code_len, uint8_t* RESTRICT out) {
  950|   257k|    for (int i = 0; i < ZXC_HUF_NUM_SYMBOLS; i += 2) {
  ------------------
  |  |  785|   257k|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (950:21): [True: 255k, False: 1.99k]
  ------------------
  951|   255k|        const uint8_t lo = code_len[i] & 0x0F;
  952|   255k|        const uint8_t hi = code_len[i + 1] & 0x0F;
  953|   255k|        out[i >> 1] = (uint8_t)(lo | (hi << 4));
  954|   255k|    }
  955|  1.99k|}
zxc_huf_unpack_lengths_default:
  957|  18.1k|int zxc_huf_unpack_lengths(const uint8_t* RESTRICT in, uint8_t* RESTRICT code_len) {
  958|  18.1k|    int max_len = 0;
  959|  18.1k|    int n_present = 0;
  960|  2.33M|    for (int i = 0; i < ZXC_HUF_NUM_SYMBOLS; i += 2) {
  ------------------
  |  |  785|  2.33M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (960:21): [True: 2.31M, False: 18.1k]
  ------------------
  961|  2.31M|        const uint8_t b = in[i >> 1];
  962|  2.31M|        const uint8_t lo = b & 0x0F;
  963|  2.31M|        const uint8_t hi = (uint8_t)(b >> 4);
  964|  2.31M|        code_len[i] = lo;
  965|  2.31M|        code_len[i + 1] = hi;
  966|  2.31M|        if (lo > max_len) max_len = lo;
  ------------------
  |  Branch (966:13): [True: 25.2k, False: 2.29M]
  ------------------
  967|  2.31M|        if (hi > max_len) max_len = hi;
  ------------------
  |  Branch (967:13): [True: 24.6k, False: 2.29M]
  ------------------
  968|  2.31M|        if (lo) n_present++;
  ------------------
  |  Branch (968:13): [True: 699k, False: 1.61M]
  ------------------
  969|  2.31M|        if (hi) n_present++;
  ------------------
  |  Branch (969:13): [True: 712k, False: 1.60M]
  ------------------
  970|  2.31M|    }
  971|  18.1k|    if (UNLIKELY(max_len > ZXC_HUF_MAX_CODE_LEN_ULTRA || n_present == 0))
  ------------------
  |  |  154|  36.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 196, False: 17.9k]
  |  |  |  Branch (154:42): [True: 193, False: 17.9k]
  |  |  |  Branch (154:42): [True: 3, False: 17.9k]
  |  |  ------------------
  ------------------
  972|    196|        return ZXC_ERROR_CORRUPT_DATA;
  973|  17.9k|    return ZXC_OK;
  974|  18.1k|}
zxc_huf_calc_size_default:
 1202|  3.36k|                         const int with_header) {
 1203|  3.36k|    zxc_pivco_tree_t t;
 1204|  3.36k|    if (UNLIKELY(zxc_pivco_tree_build(code_len, &t) != 0)) return SIZE_MAX;
  ------------------
  |  |  154|  3.36k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 3.36k]
  |  |  ------------------
  ------------------
 1205|  3.36k|    const size_t body = zxc_huf_calc_size_dict(freq, code_len, &t);
  ------------------
  |  |   46|  3.36k|#define zxc_huf_calc_size_dict ZXC_CAT(zxc_huf_calc_size_dict, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   41|  3.36k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|  3.36k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1206|  3.36k|    if (UNLIKELY(body == SIZE_MAX)) return SIZE_MAX;
  ------------------
  |  |  154|  3.36k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 3.36k]
  |  |  ------------------
  ------------------
 1207|  3.36k|    return body + (with_header ? (size_t)ZXC_HUF_TABLE_SIZE : 0);
  ------------------
  |  |   96|  3.36k|#define ZXC_HUF_TABLE_SIZE 128
  ------------------
  |  Branch (1207:20): [True: 3.36k, False: 0]
  ------------------
 1208|  3.36k|}
zxc_huf_calc_size_dict_default:
 1216|  3.36k|                              const zxc_pivco_tree_t* RESTRICT tree) {
 1217|       |    // Encodability is part of the estimate: a histogram symbol the table has no
 1218|       |    // code for would be silently ignored below and undercount. Report the
 1219|       |    // candidate unencodable instead.
 1220|   864k|    for (int k = 0; k < ZXC_HUF_NUM_SYMBOLS; k++)
  ------------------
  |  |  785|   864k|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (1220:21): [True: 860k, False: 3.36k]
  ------------------
 1221|   860k|        if (UNLIKELY(freq[k] != 0 && code_len[k] == 0)) return SIZE_MAX;
  ------------------
  |  |  154|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 860k]
  |  |  |  Branch (154:42): [True: 541k, False: 318k]
  |  |  |  Branch (154:42): [True: 0, False: 541k]
  |  |  ------------------
  ------------------
 1222|  3.36k|    uint32_t count[ZXC_PIVCO_NODE_SLOTS];
 1223|  3.36k|    zxc_pivco_counts(tree, freq, count);
 1224|       |    return zxc_pivco_layout(tree, count, NULL);
 1225|  3.36k|}
zxc_huf_encode_section_default:
 1309|  1.99k|                           uint8_t* RESTRICT dst, const size_t dst_cap) {
 1310|  1.99k|    zxc_pivco_tree_t t;
 1311|  1.99k|    uint32_t codes[ZXC_HUF_NUM_SYMBOLS];
 1312|  1.99k|    if (UNLIKELY(zxc_pivco_tree_build(code_len, &t) != 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  1.99k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 1.99k]
  |  |  ------------------
  ------------------
 1313|  1.99k|    zxc_pivco_codes(&t, codes);
 1314|  1.99k|    return zxc_pivco_encode_core(literals, n_literals, freq, code_len, &t, codes, dst, dst_cap, 1);
 1315|  1.99k|}
zxc_huf_decode_section_default:
 2282|  18.2k|                           uint8_t* RESTRICT dst, const size_t n, uint8_t* RESTRICT scratch) {
 2283|  18.2k|    if (UNLIKELY(payload_size < (size_t)ZXC_HUF_TABLE_SIZE)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  18.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 160, False: 18.1k]
  |  |  ------------------
  ------------------
 2284|  18.1k|    uint8_t code_len[ZXC_HUF_NUM_SYMBOLS];
 2285|  18.1k|    const int rc = zxc_huf_unpack_lengths(payload, code_len);
  ------------------
  |  |   44|  18.1k|#define zxc_huf_unpack_lengths ZXC_CAT(zxc_huf_unpack_lengths, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   41|  18.1k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|  18.1k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2286|  18.1k|    if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  154|  18.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 196, False: 17.9k]
  |  |  ------------------
  ------------------
 2287|  17.9k|    zxc_pivco_tree_t t;
 2288|  17.9k|    if (UNLIKELY(zxc_pivco_tree_build(code_len, &t) != 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  17.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 101, False: 17.8k]
  |  |  ------------------
  ------------------
 2289|  17.8k|    return zxc_pivco_decode_core(payload + ZXC_HUF_TABLE_SIZE, payload_size - ZXC_HUF_TABLE_SIZE,
  ------------------
  |  |   96|  17.8k|#define ZXC_HUF_TABLE_SIZE 128
  ------------------
                  return zxc_pivco_decode_core(payload + ZXC_HUF_TABLE_SIZE, payload_size - ZXC_HUF_TABLE_SIZE,
  ------------------
  |  |   96|  17.8k|#define ZXC_HUF_TABLE_SIZE 128
  ------------------
 2290|  17.8k|                                 dst, n, &t, scratch);
 2291|  17.9k|}
zxc_huffman.c:pm_leaves_sort:
  108|  13.7k|static void pm_leaves_sort(pm_leaf_t* RESTRICT leaves, const int n) {
  109|       |    // One bucket per possible value of floor(log2(weight)) for a 32-bit
  110|       |    // weight, i.e. 32 buckets.
  111|  13.7k|    enum { NUM_BUCKETS = 32 };
  112|  13.7k|    int count[NUM_BUCKETS];
  113|  13.7k|    int offset[NUM_BUCKETS + 1]; /* +1 sentinel = n, avoids end-of-bucket branch. */
  114|  13.7k|    uint8_t bucket_of[ZXC_HUF_NUM_SYMBOLS];
  115|  13.7k|    pm_leaf_t tmp[ZXC_HUF_NUM_SYMBOLS];
  116|       |
  117|  13.7k|    ZXC_MEMSET(count, 0, sizeof(count));
  ------------------
  |  |  175|  13.7k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  118|  2.28M|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (118:21): [True: 2.26M, False: 13.7k]
  ------------------
  119|  2.26M|        const unsigned b = zxc_log2_u32(leaves[i].w);
  120|  2.26M|        bucket_of[i] = (uint8_t)b;
  121|  2.26M|        count[b]++;
  122|  2.26M|    }
  123|       |
  124|  13.7k|    int acc = 0;
  125|   452k|    for (int b = 0; b < NUM_BUCKETS; b++) {
  ------------------
  |  Branch (125:21): [True: 438k, False: 13.7k]
  ------------------
  126|   438k|        offset[b] = acc;
  127|   438k|        acc += count[b];
  128|   438k|    }
  129|  13.7k|    offset[NUM_BUCKETS] = n;
  130|       |
  131|  13.7k|    int pos[NUM_BUCKETS];
  132|  13.7k|    ZXC_MEMCPY(pos, offset, sizeof(pos));
  ------------------
  |  |  170|  13.7k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  133|  2.28M|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (133:21): [True: 2.26M, False: 13.7k]
  ------------------
  134|  2.26M|        tmp[pos[bucket_of[i]]++] = leaves[i];
  135|  2.26M|    }
  136|       |
  137|   452k|    for (int b = 0; b < NUM_BUCKETS; b++) {
  ------------------
  |  Branch (137:21): [True: 438k, False: 13.7k]
  ------------------
  138|   438k|        if (count[b] < 2) continue;
  ------------------
  |  Branch (138:13): [True: 367k, False: 71.8k]
  ------------------
  139|  71.8k|        const int s = offset[b];
  140|  71.8k|        const int e = offset[b + 1];
  141|  2.24M|        for (int i = s + 1; i < e; i++) {
  ------------------
  |  Branch (141:29): [True: 2.17M, False: 71.8k]
  ------------------
  142|  2.17M|            const pm_leaf_t key = tmp[i];
  143|  2.17M|            int j = i - 1;
  144|  38.4M|            while (j >= s && (tmp[j].w > key.w || (tmp[j].w == key.w && tmp[j].sym > key.sym))) {
  ------------------
  |  Branch (144:20): [True: 38.3M, False: 77.1k]
  |  Branch (144:31): [True: 36.2M, False: 2.09M]
  |  Branch (144:52): [True: 1.86M, False: 236k]
  |  Branch (144:73): [True: 0, False: 1.86M]
  ------------------
  145|  36.2M|                tmp[j + 1] = tmp[j];
  146|  36.2M|                j--;
  147|  36.2M|            }
  148|  2.17M|            tmp[j + 1] = key;
  149|  2.17M|        }
  150|  71.8k|    }
  151|       |
  152|  13.7k|    ZXC_MEMCPY(leaves, tmp, (size_t)n * sizeof(pm_leaf_t));
  ------------------
  |  |  170|  13.7k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  153|  13.7k|}
zxc_huffman.c:zxc_huf_nudge_classes:
  344|  15.4k|static int zxc_huf_nudge_classes(const uint8_t* RESTRICT code_len, uint32_t* RESTRICT blc) {
  345|  15.4k|    ZXC_MEMSET(blc, 0, (ZXC_HUF_MAX_CODE_LEN_ULTRA + 1) * sizeof(uint32_t));
  ------------------
  |  |  175|  15.4k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  346|  15.4k|    int n = 0;
  347|  3.95M|    for (int s = 0; s < ZXC_HUF_NUM_SYMBOLS; s++) {
  ------------------
  |  |  785|  3.95M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (347:21): [True: 3.94M, False: 15.4k]
  ------------------
  348|  3.94M|        const int l = code_len[s];
  349|  3.94M|        if (!l) continue;
  ------------------
  |  Branch (349:13): [True: 1.48M, False: 2.45M]
  ------------------
  350|  2.45M|        blc[l]++;
  351|  2.45M|        n++;
  352|  2.45M|    }
  353|  15.4k|    return n;
  354|  15.4k|}
zxc_huffman.c:zxc_huf_nudge_pf_canonical:
  367|  15.3k|                                       uint64_t* RESTRICT pf) {
  368|  15.3k|    uint32_t pos[ZXC_HUF_MAX_CODE_LEN_ULTRA + 1];
  369|  15.3k|    uint32_t acc = 0;
  370|   184k|    for (int l = 1; l <= ZXC_HUF_MAX_CODE_LEN_ULTRA; l++) {
  ------------------
  |  |  778|   184k|#define ZXC_HUF_MAX_CODE_LEN_ULTRA 11
  ------------------
  |  Branch (370:21): [True: 169k, False: 15.3k]
  ------------------
  371|   169k|        pos[l] = acc;
  372|   169k|        acc += blc[l];
  373|   169k|    }
  374|  15.3k|    uint32_t val[ZXC_HUF_NUM_SYMBOLS];
  375|  3.95M|    for (int s = 0; s < ZXC_HUF_NUM_SYMBOLS; s++) {
  ------------------
  |  |  785|  3.95M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (375:21): [True: 3.94M, False: 15.3k]
  ------------------
  376|  3.94M|        const int l = code_len[s];
  377|  3.94M|        if (l) val[pos[l]++] = freq[s];
  ------------------
  |  Branch (377:13): [True: 2.45M, False: 1.48M]
  ------------------
  378|  3.94M|    }
  379|  15.3k|    pf[0] = 0;
  380|  2.47M|    for (uint32_t i = 0; i < acc; i++) pf[i + 1] = pf[i] + val[i];
  ------------------
  |  Branch (380:26): [True: 2.45M, False: 15.3k]
  ------------------
  381|  15.3k|}
zxc_huffman.c:zxc_huf_nudge_eval:
  402|  96.4k|                               zxc_huf_nudge_cost_t* RESTRICT out) {
  403|  96.4k|    enum { LU = ZXC_HUF_MAX_CODE_LEN_ULTRA };
  404|  96.4k|    uint64_t bits = 0;
  405|  96.4k|    uint64_t touches = 0;
  406|  96.4k|    int max_len = 0;
  407|  96.4k|    uint32_t S = 0;    /* code-space cursor, in 2^-LU slots */
  408|  96.4k|    uint32_t base = 0; /* leaf index where the current run starts */
  409|  1.15M|    for (int l = 1; l <= LU; l++) {
  ------------------
  |  Branch (409:21): [True: 1.06M, False: 96.4k]
  ------------------
  410|  1.06M|        if (!blc[l]) continue;
  ------------------
  |  Branch (410:13): [True: 478k, False: 582k]
  ------------------
  411|   582k|        max_len = l;
  412|   582k|        bits += (uint64_t)l * (pf[base + blc[l]] - pf[base]);
  413|   582k|        const uint32_t w = 1U << (LU - l);
  414|   582k|        const uint32_t end = S + blc[l] * w;
  415|   582k|        uint32_t x = S;
  416|  1.95M|        while (x < end) {
  ------------------
  |  Branch (416:16): [True: 1.37M, False: 582k]
  ------------------
  417|  1.37M|            const uint32_t wx = x ? (x & (0U - x)) : (1U << LU);
  ------------------
  |  Branch (417:33): [True: 1.27M, False: 96.4k]
  ------------------
  418|  1.37M|            const uint32_t wr = 1U << zxc_log2_u32(end - x);
  419|  1.37M|            const uint32_t W = wx < wr ? wx : wr;
  ------------------
  |  Branch (419:32): [True: 410k, False: 962k]
  ------------------
  420|  1.37M|            const int D = (int)zxc_log2_u32(W) - (LU - l);
  421|  1.37M|            const uint32_t i0 = base + ((x - S) >> (LU - l));
  422|  1.37M|            const uint64_t mass = pf[i0 + (W >> (LU - l))] - pf[i0];
  423|  1.37M|            int t;
  424|  1.37M|            if (D == 0) {
  ------------------
  |  Branch (424:17): [True: 247k, False: 1.12M]
  ------------------
  425|   247k|                t = l + 1; /* lone leaf: one memset + merges above */
  426|  1.12M|            } else if (D == 1) {
  ------------------
  |  Branch (426:24): [True: 331k, False: 794k]
  ------------------
  427|   331k|                t = l; /* leaf pair: parent XOR-blend at depth l-1 */
  428|   794k|            } else {
  429|   794k|                t = (l - D) + 1; /* flat root: one unpack + merges above */
  430|   794k|                if (D > ZXC_PIVCO_UNPACK_FLAT_SIMD_MAX) t += ZXC_HUF_NUDGE_DEEP_FLAT_PENALTY;
  ------------------
  |  |  799|   794k|#define ZXC_PIVCO_UNPACK_FLAT_SIMD_MAX 6
  ------------------
                              if (D > ZXC_PIVCO_UNPACK_FLAT_SIMD_MAX) t += ZXC_HUF_NUDGE_DEEP_FLAT_PENALTY;
  ------------------
  |  |  876|  15.8k|#define ZXC_HUF_NUDGE_DEEP_FLAT_PENALTY 24
  ------------------
  |  Branch (430:21): [True: 15.8k, False: 778k]
  ------------------
  431|   794k|            }
  432|  1.37M|            touches += mass * (uint64_t)t;
  433|  1.37M|            x += W;
  434|  1.37M|        }
  435|   582k|        S = end;
  436|   582k|        base += blc[l];
  437|   582k|    }
  438|  96.4k|    touches += (uint64_t)ZXC_HUF_NUDGE_LEVEL_COST * (uint64_t)(max_len + 1);
  ------------------
  |  |  880|  96.4k|#define ZXC_HUF_NUDGE_LEVEL_COST 64
  ------------------
  439|  96.4k|    out->bits = bits;
  440|  96.4k|    out->touches = touches;
  441|  96.4k|}
zxc_huffman.c:zxc_huf_nudge_walk:
  526|  3.35k|                               const int n, const int cap, uint32_t* RESTRICT out_blc) {
  527|  3.35k|    enum { LU = ZXC_HUF_MAX_CODE_LEN_ULTRA };
  528|  3.35k|    ZXC_MEMSET(out_blc, 0, (LU + 1) * sizeof(uint32_t));
  ------------------
  |  |  175|  3.35k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  529|  3.35k|    uint32_t s = 2; /* the root's two slots at level 1 (n >= 4 => root is internal) */
  530|  3.35k|    uint32_t n_rem = (uint32_t)n;
  531|  33.0k|    for (int l = 1; l <= cap && n_rem; l++) {
  ------------------
  |  Branch (531:21): [True: 32.4k, False: 625]
  |  Branch (531:33): [True: 29.7k, False: 2.73k]
  ------------------
  532|  29.7k|        struct {
  533|  29.7k|            uint32_t c;
  534|  29.7k|            int flat_d; /* > 0: complete as one uniform run at depth l + flat_d */
  535|  29.7k|        } cand[6];
  536|  29.7k|        int n_cand = 0;
  537|  29.7k|        const uint32_t c_base = zxc_huf_nudge_clamp(blc0[l], s, n_rem, l, cap);
  538|  29.7k|        cand[n_cand].c = c_base;
  539|  29.7k|        cand[n_cand++].flat_d = 0;
  540|  29.7k|        if (c_base < n_rem) {
  ------------------
  |  Branch (540:13): [True: 26.3k, False: 3.35k]
  ------------------
  541|       |            // Shape the internal-node count i = s - c toward few set bits.
  542|  26.3k|            const uint32_t i_base = s - c_base;
  543|  26.3k|            const uint32_t i_dn = 1U << zxc_log2_u32(i_base);
  544|  26.3k|            const uint32_t rest = i_base - i_dn;
  545|  26.3k|            const uint32_t shapes[3] = {i_dn, i_dn << 1,
  546|  26.3k|                                        i_dn | (rest ? 1U << zxc_log2_u32(rest) : 0U)};
  ------------------
  |  Branch (546:49): [True: 16.1k, False: 10.1k]
  ------------------
  547|   105k|            for (int k = 0; k < 3; k++) {
  ------------------
  |  Branch (547:29): [True: 79.0k, False: 26.3k]
  ------------------
  548|  79.0k|                const uint32_t want = s > shapes[k] ? s - shapes[k] : 0;
  ------------------
  |  Branch (548:39): [True: 41.2k, False: 37.8k]
  ------------------
  549|  79.0k|                const uint32_t c = zxc_huf_nudge_clamp(want, s, n_rem, l, cap);
  550|  79.0k|                int dup = 0;
  551|   203k|                for (int p = 0; p < n_cand; p++) dup |= (cand[p].c == c);
  ------------------
  |  Branch (551:33): [True: 124k, False: 79.0k]
  ------------------
  552|  79.0k|                if (!dup) {
  ------------------
  |  Branch (552:21): [True: 39.5k, False: 39.5k]
  ------------------
  553|  39.5k|                    cand[n_cand].c = c;
  554|  39.5k|                    cand[n_cand++].flat_d = 0;
  555|  39.5k|                }
  556|  79.0k|            }
  557|       |            // Uniform finish: c leaves here, the rest as i complete depth-D
  558|       |            // subtrees (c*(2^D - 1) == s*2^D - n_rem must divide exactly).
  559|   151k|            for (int d = 1; d <= cap - l && n_cand < 6; d++) {
  ------------------
  |  Branch (559:29): [True: 136k, False: 14.6k]
  |  Branch (559:45): [True: 136k, False: 0]
  ------------------
  560|   136k|                const uint32_t den = (1U << d) - 1;
  561|   136k|                const int32_t num = (int32_t)(s << d) - (int32_t)n_rem;
  562|   136k|                if (num < 0 || (uint32_t)num % den) continue;
  ------------------
  |  Branch (562:21): [True: 67.4k, False: 69.2k]
  |  Branch (562:32): [True: 57.4k, False: 11.7k]
  ------------------
  563|  11.7k|                const uint32_t c = (uint32_t)num / den;
  564|  11.7k|                if (c >= s || c >= n_rem) continue; /* need i >= 1 and a remainder */
  ------------------
  |  Branch (564:21): [True: 0, False: 11.7k]
  |  Branch (564:31): [True: 0, False: 11.7k]
  ------------------
  565|  11.7k|                cand[n_cand].c = c;
  566|  11.7k|                cand[n_cand++].flat_d = d;
  567|  11.7k|                break; /* the shallowest exact finish is the aggressive one */
  568|  11.7k|            }
  569|  26.3k|        }
  570|  29.7k|        uint64_t best_j = UINT64_MAX;
  571|  29.7k|        uint32_t best_c = c_base;
  572|   110k|        for (int k = 0; k < n_cand; k++) {
  ------------------
  |  Branch (572:25): [True: 81.0k, False: 29.7k]
  ------------------
  573|  81.0k|            uint32_t tmp[LU + 1];
  574|  81.0k|            ZXC_MEMCPY(tmp, out_blc, sizeof(tmp));
  ------------------
  |  |  170|  81.0k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  575|  81.0k|            tmp[l] = cand[k].c;
  576|  81.0k|            const uint32_t rem = n_rem - cand[k].c;
  577|  81.0k|            if (rem) {
  ------------------
  |  Branch (577:17): [True: 77.6k, False: 3.35k]
  ------------------
  578|  77.6k|                if (cand[k].flat_d)
  ------------------
  |  Branch (578:21): [True: 11.7k, False: 65.9k]
  ------------------
  579|  11.7k|                    tmp[l + cand[k].flat_d] = rem;
  580|  65.9k|                else
  581|  65.9k|                    zxc_huf_nudge_complete(tmp, l, 2 * (s - cand[k].c), rem, blc0, cap);
  582|  77.6k|            }
  583|  81.0k|            zxc_huf_nudge_cost_t cc;
  584|  81.0k|            zxc_huf_nudge_eval(tmp, pf_rank, &cc);
  585|  81.0k|            const uint64_t j = zxc_huf_nudge_j(&cc);
  586|  81.0k|            if (j < best_j) {
  ------------------
  |  Branch (586:17): [True: 35.2k, False: 45.7k]
  ------------------
  587|  35.2k|                best_j = j;
  588|  35.2k|                best_c = cand[k].c;
  589|  35.2k|            }
  590|  81.0k|        }
  591|  29.7k|        out_blc[l] = best_c;
  592|  29.7k|        n_rem -= best_c;
  593|  29.7k|        s = 2 * (s - best_c);
  594|  29.7k|    }
  595|  3.35k|}
zxc_huffman.c:zxc_huf_nudge_clamp:
  473|   413k|                                    const int l, const int cap) {
  474|   413k|    if (n_rem <= s || l >= cap) return n_rem; /* forced finish */
  ------------------
  |  Branch (474:9): [True: 69.2k, False: 344k]
  |  Branch (474:23): [True: 0, False: 344k]
  ------------------
  475|   344k|    const uint32_t m = 1U << (cap - l);
  476|   344k|    const uint32_t lo = (2 * s > n_rem) ? 2 * s - n_rem : 0;
  ------------------
  |  Branch (476:25): [True: 97.4k, False: 246k]
  ------------------
  477|   344k|    uint32_t hi = s - 1;
  478|   344k|    const uint32_t cap_hi = (s * m - n_rem) / (m - 1);
  479|   344k|    if (cap_hi < hi) hi = cap_hi;
  ------------------
  |  Branch (479:9): [True: 251k, False: 92.4k]
  ------------------
  480|   344k|    const uint32_t c = want < lo ? lo : want;
  ------------------
  |  Branch (480:24): [True: 26.8k, False: 317k]
  ------------------
  481|   344k|    return c > hi ? hi : c;
  ------------------
  |  Branch (481:12): [True: 51.7k, False: 292k]
  ------------------
  482|   413k|}
zxc_huffman.c:zxc_huf_nudge_complete:
  496|  65.9k|                                   const uint32_t* RESTRICT blc0, const int cap) {
  497|   370k|    for (int j = l + 1; j <= cap && n_rem; j++) {
  ------------------
  |  Branch (497:25): [True: 339k, False: 31.6k]
  |  Branch (497:37): [True: 304k, False: 34.3k]
  ------------------
  498|   304k|        const uint32_t c = zxc_huf_nudge_clamp(blc0[j], s, n_rem, j, cap);
  499|   304k|        blc[j] = c;
  500|   304k|        n_rem -= c;
  501|   304k|        s = 2 * (s - c);
  502|   304k|    }
  503|  65.9k|}
zxc_huffman.c:zxc_huf_nudge_assign:
  771|  3.35k|                                 uint8_t* RESTRICT cand_len) {
  772|  3.35k|    ZXC_MEMSET(cand_len, 0, ZXC_HUF_NUM_SYMBOLS);
  ------------------
  |  |  175|  3.35k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  773|  3.35k|    int r = 0;
  774|  40.2k|    for (int l = 1; l <= ZXC_HUF_MAX_CODE_LEN_ULTRA; l++)
  ------------------
  |  |  778|  40.2k|#define ZXC_HUF_MAX_CODE_LEN_ULTRA 11
  ------------------
  |  Branch (774:21): [True: 36.9k, False: 3.35k]
  ------------------
  775|   578k|        for (uint32_t k = 0; k < blc[l]; k++) cand_len[sym_order[r++]] = (uint8_t)l;
  ------------------
  |  Branch (775:30): [True: 541k, False: 36.9k]
  ------------------
  776|  3.35k|}
zxc_huffman.c:zxc_huf_nudge_dp_solve:
  676|  3.35k|                                  uint32_t* RESTRICT out_cblc) {
  677|  3.35k|    if (UNLIKELY(m < 2 || m > ZXC_HUF_NUDGE_DP_M || cap_c < 1 ||
  ------------------
  |  |  154|  20.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 3.35k]
  |  |  |  Branch (154:42): [True: 0, False: 3.35k]
  |  |  |  Branch (154:42): [True: 0, False: 3.35k]
  |  |  |  Branch (154:42): [True: 0, False: 3.35k]
  |  |  |  Branch (154:42): [True: 0, False: 3.35k]
  |  |  ------------------
  ------------------
  678|  3.35k|                 cap_c > ZXC_HUF_MAX_CODE_LEN_ULTRA))
  679|      0|        return 0;
  680|       |
  681|  3.35k|    const size_t plane = (size_t)(m + 1) * (size_t)(m + 1);
  682|  3.35k|    const size_t arrive_cnt = (size_t)(cap_c + 1) * plane;
  683|  3.35k|    uint64_t* jcur = ws->jcur;
  684|  3.35k|    uint64_t* jnxt = ws->jnxt;
  685|  3.35k|    uint8_t* const arrive = ws->arrive;
  686|  3.35k|    int ok = 0;
  687|       |
  688|  3.35k|#define ZXC_NUDGE_DP_IDX(k, s) ((size_t)(k) * (size_t)(m + 1) + (size_t)(s))
  689|  9.84M|    for (size_t i = 0; i < plane; i++) jcur[i] = UINT64_MAX;
  ------------------
  |  Branch (689:24): [True: 9.84M, False: 3.35k]
  ------------------
  690|  3.35k|    jcur[ZXC_NUDGE_DP_IDX(0, 2)] = 0;
  ------------------
  |  |  688|  3.35k|#define ZXC_NUDGE_DP_IDX(k, s) ((size_t)(k) * (size_t)(m + 1) + (size_t)(s))
  ------------------
  691|  3.35k|    uint64_t best_j = UINT64_MAX;
  692|  3.35k|    int best_l = 0;
  693|  3.35k|    int best_k = 0;
  694|  3.35k|    int best_s = 0;
  695|  34.4k|    for (int lc = 1; lc <= cap_c; lc++) {
  ------------------
  |  Branch (695:22): [True: 31.1k, False: 3.35k]
  ------------------
  696|  90.1M|        for (size_t i = 0; i < plane; i++) jnxt[i] = UINT64_MAX;
  ------------------
  |  Branch (696:28): [True: 90.1M, False: 31.1k]
  ------------------
  697|  1.62M|        for (int k = 0; k < m; k++) {
  ------------------
  |  Branch (697:25): [True: 1.59M, False: 31.1k]
  ------------------
  698|  1.59M|            const uint32_t n_rem = (uint32_t)(m - k);
  699|  45.8M|            for (uint32_t s = 1; s <= n_rem; s++) {
  ------------------
  |  Branch (699:34): [True: 44.2M, False: 1.59M]
  ------------------
  700|  44.2M|                const size_t from = ZXC_NUDGE_DP_IDX(k, s);
  ------------------
  |  |  688|  44.2M|#define ZXC_NUDGE_DP_IDX(k, s) ((size_t)(k) * (size_t)(m + 1) + (size_t)(s))
  ------------------
  701|  44.2M|                if (UNLIKELY(from >= plane)) continue;
  ------------------
  |  |  154|  44.2M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 44.2M]
  |  |  ------------------
  ------------------
  702|  44.2M|                const uint64_t j0 = jcur[from];
  703|  44.2M|                if (j0 == UINT64_MAX) continue;
  ------------------
  |  Branch (703:21): [True: 39.5M, False: 4.73M]
  ------------------
  704|  4.73M|                if (s == n_rem) {
  ------------------
  |  Branch (704:21): [True: 272k, False: 4.45M]
  ------------------
  705|       |                    // Forced finish: fill every slot, close the tree here.
  706|   272k|                    const uint64_t j =
  707|   272k|                        j0 + zxc_huf_nudge_dp_run_j(lu, lc, g_log2, s, s, pfg, (uint32_t)k) +
  708|   272k|                        (uint64_t)ZXC_HUF_NUDGE_LAMBDA_Q8 * (uint64_t)ZXC_HUF_NUDGE_LEVEL_COST *
  ------------------
  |  |  865|   272k|#define ZXC_HUF_NUDGE_LAMBDA_Q8 26
  ------------------
                                      (uint64_t)ZXC_HUF_NUDGE_LAMBDA_Q8 * (uint64_t)ZXC_HUF_NUDGE_LEVEL_COST *
  ------------------
  |  |  880|   272k|#define ZXC_HUF_NUDGE_LEVEL_COST 64
  ------------------
  709|   272k|                            (uint64_t)(lc + g_log2 + 1);
  710|   272k|                    if (j < best_j) {
  ------------------
  |  Branch (710:25): [True: 38.2k, False: 233k]
  ------------------
  711|  38.2k|                        best_j = j;
  712|  38.2k|                        best_l = lc;
  713|  38.2k|                        best_k = k;
  714|  38.2k|                        best_s = (int)s;
  715|  38.2k|                    }
  716|   272k|                    continue;
  717|   272k|                }
  718|  4.45M|                if (lc == cap_c) continue; /* must finish at the cap */
  ------------------
  |  Branch (718:21): [True: 0, False: 4.45M]
  ------------------
  719|  4.45M|                const uint32_t mm = 1U << (cap_c - lc);
  720|  4.45M|                const uint32_t lo = (2 * s > n_rem) ? 2 * s - n_rem : 0;
  ------------------
  |  Branch (720:37): [True: 2.66M, False: 1.79M]
  ------------------
  721|  4.45M|                uint32_t hi = s - 1;
  722|  4.45M|                const uint32_t cap_hi = (s * mm - n_rem) / (mm - 1);
  723|  4.45M|                if (cap_hi < hi) hi = cap_hi;
  ------------------
  |  Branch (723:21): [True: 3.38M, False: 1.06M]
  ------------------
  724|  34.7M|                for (uint32_t c = lo; c <= hi; c++) {
  ------------------
  |  Branch (724:39): [True: 30.2M, False: 4.45M]
  ------------------
  725|  30.2M|                    const uint64_t j =
  726|  30.2M|                        j0 + zxc_huf_nudge_dp_run_j(lu, lc, g_log2, s, c, pfg, (uint32_t)k);
  727|  30.2M|                    const size_t to = ZXC_NUDGE_DP_IDX(k + (int)c, 2 * (s - c));
  ------------------
  |  |  688|  30.2M|#define ZXC_NUDGE_DP_IDX(k, s) ((size_t)(k) * (size_t)(m + 1) + (size_t)(s))
  ------------------
  728|  30.2M|                    const size_t arr = (size_t)(lc + 1) * plane + to;
  729|       |
  730|  30.2M|                    if (UNLIKELY(to >= plane || arr >= arrive_cnt)) continue;
  ------------------
  |  |  154|  60.5M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 30.2M]
  |  |  |  Branch (154:42): [True: 0, False: 30.2M]
  |  |  |  Branch (154:42): [True: 0, False: 30.2M]
  |  |  ------------------
  ------------------
  731|  30.2M|                    if (j < jnxt[to]) {
  ------------------
  |  Branch (731:25): [True: 18.9M, False: 11.3M]
  ------------------
  732|  18.9M|                        jnxt[to] = j;
  733|  18.9M|                        arrive[arr] = (uint8_t)c;
  734|  18.9M|                    }
  735|  30.2M|                }
  736|  4.45M|            }
  737|  1.59M|        }
  738|  31.1k|        uint64_t* tmp = jcur;
  739|  31.1k|        jcur = jnxt;
  740|  31.1k|        jnxt = tmp;
  741|  31.1k|    }
  742|  3.35k|    if (best_j == UINT64_MAX) goto done;
  ------------------
  |  Branch (742:9): [True: 0, False: 3.35k]
  ------------------
  743|  3.35k|    ZXC_MEMSET(out_cblc, 0, (ZXC_HUF_MAX_CODE_LEN_ULTRA + 1) * sizeof(uint32_t));
  ------------------
  |  |  175|  3.35k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  744|  3.35k|    out_cblc[best_l] = (uint32_t)best_s;
  745|  3.35k|    {
  746|  3.35k|        int k = best_k;
  747|  3.35k|        int s = best_s;
  748|  25.1k|        for (int lc = best_l; lc > 1; lc--) {
  ------------------
  |  Branch (748:31): [True: 21.7k, False: 3.35k]
  ------------------
  749|  21.7k|            const uint32_t c = arrive[(size_t)lc * plane + ZXC_NUDGE_DP_IDX(k, s)];
  ------------------
  |  |  688|  21.7k|#define ZXC_NUDGE_DP_IDX(k, s) ((size_t)(k) * (size_t)(m + 1) + (size_t)(s))
  ------------------
  750|  21.7k|            out_cblc[lc - 1] = c;
  751|  21.7k|            s = s / 2 + (int)c;
  752|  21.7k|            k -= (int)c;
  753|  21.7k|        }
  754|  3.35k|        if (UNLIKELY(k != 0 || s != 2)) goto done; /* backtrack corruption: drop candidate */
  ------------------
  |  |  154|  6.71k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 3.35k]
  |  |  |  Branch (154:42): [True: 0, False: 3.35k]
  |  |  |  Branch (154:42): [True: 0, False: 3.35k]
  |  |  ------------------
  ------------------
  755|  3.35k|    }
  756|  3.35k|    ok = 1;
  757|  3.35k|done:
  758|  3.35k|#undef ZXC_NUDGE_DP_IDX
  759|  3.35k|    return ok;
  760|  3.35k|}
zxc_huffman.c:zxc_huf_nudge_dp_run_j:
  620|  30.5M|                                       const uint64_t* RESTRICT pfg, const uint32_t k) {
  621|  30.5M|    if (!c) return 0;
  ------------------
  |  Branch (621:9): [True: 1.79M, False: 28.7M]
  ------------------
  622|  28.7M|    const int lr = lc + g_log2; /* real code length of these leaves */
  623|  28.7M|    const uint32_t w = 1U << (lu - lc);
  624|  28.7M|    const uint32_t S = (1U << lu) - s * w;
  625|  28.7M|    const uint32_t end = S + c * w;
  626|  28.7M|    const uint64_t bits = (uint64_t)lr * (pfg[k + c] - pfg[k]);
  627|  28.7M|    uint64_t touches = 0;
  628|  28.7M|    uint32_t x = S;
  629|   116M|    while (x < end) {
  ------------------
  |  Branch (629:12): [True: 87.9M, False: 28.7M]
  ------------------
  630|  87.9M|        const uint32_t wx = x ? (x & (0U - x)) : (1U << lu);
  ------------------
  |  Branch (630:29): [True: 87.8M, False: 139k]
  ------------------
  631|  87.9M|        const uint32_t wr = 1U << zxc_log2_u32(end - x);
  632|  87.9M|        const uint32_t W = wx < wr ? wx : wr;
  ------------------
  |  Branch (632:28): [True: 25.0M, False: 62.9M]
  ------------------
  633|  87.9M|        const int d = (int)zxc_log2_u32(W >> (lu - lc)) + g_log2;
  634|  87.9M|        const uint32_t i0 = k + ((x - S) >> (lu - lc));
  635|  87.9M|        const uint64_t mass = pfg[i0 + (W >> (lu - lc))] - pfg[i0];
  636|  87.9M|        int t;
  637|  87.9M|        if (d == 0) {
  ------------------
  |  Branch (637:13): [True: 4.10M, False: 83.8M]
  ------------------
  638|  4.10M|            t = lr + 1;
  639|  83.8M|        } else if (d == 1) {
  ------------------
  |  Branch (639:20): [True: 9.74M, False: 74.1M]
  ------------------
  640|  9.74M|            t = lr;
  641|  74.1M|        } else {
  642|  74.1M|            t = (lr - d) + 1;
  643|  74.1M|            if (d > ZXC_PIVCO_UNPACK_FLAT_SIMD_MAX) t += ZXC_HUF_NUDGE_DEEP_FLAT_PENALTY;
  ------------------
  |  |  799|  74.1M|#define ZXC_PIVCO_UNPACK_FLAT_SIMD_MAX 6
  ------------------
                          if (d > ZXC_PIVCO_UNPACK_FLAT_SIMD_MAX) t += ZXC_HUF_NUDGE_DEEP_FLAT_PENALTY;
  ------------------
  |  |  876|  66.7k|#define ZXC_HUF_NUDGE_DEEP_FLAT_PENALTY 24
  ------------------
  |  Branch (643:17): [True: 66.7k, False: 74.0M]
  ------------------
  644|  74.1M|        }
  645|  87.9M|        touches += mass * (uint64_t)t;
  646|  87.9M|        x += W;
  647|  87.9M|    }
  648|  28.7M|    return 256U * bits + (uint64_t)ZXC_HUF_NUDGE_LAMBDA_Q8 * touches;
  ------------------
  |  |  865|  28.7M|#define ZXC_HUF_NUDGE_LAMBDA_Q8 26
  ------------------
  649|  30.5M|}
zxc_huffman.c:zxc_huf_nudge_j:
  449|  87.5k|static ZXC_ALWAYS_INLINE uint64_t zxc_huf_nudge_j(const zxc_huf_nudge_cost_t* c) {
  450|  87.5k|    return 256U * c->bits + (uint64_t)ZXC_HUF_NUDGE_LAMBDA_Q8 * c->touches;
  ------------------
  |  |  865|  87.5k|#define ZXC_HUF_NUDGE_LAMBDA_Q8 26
  ------------------
  451|  87.5k|}
zxc_huffman.c:zxc_pivco_tree_build:
 1048|  23.2k|static int zxc_pivco_tree_build(const uint8_t* RESTRICT code_len, zxc_pivco_tree_t* RESTRICT t) {
 1049|  23.2k|    uint16_t bl_count[ZXC_HUF_MAX_CODE_LEN_ULTRA + 1] = {0};
 1050|  23.2k|    int n_present = 0;
 1051|  23.2k|    int max_depth = 0;
 1052|  5.98M|    for (int s = 0; s < ZXC_HUF_NUM_SYMBOLS; s++) {
  ------------------
  |  |  785|  5.98M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (1052:21): [True: 5.95M, False: 23.2k]
  ------------------
 1053|  5.95M|        const int l = code_len[s];
 1054|  5.95M|        if (l == 0) continue;
  ------------------
  |  Branch (1054:13): [True: 3.72M, False: 2.23M]
  ------------------
 1055|  2.23M|        if (UNLIKELY(l > ZXC_HUF_MAX_CODE_LEN_ULTRA)) return -1;
  ------------------
  |  |  154|  2.23M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 2.23M]
  |  |  ------------------
  ------------------
 1056|  2.23M|        bl_count[l]++;
 1057|  2.23M|        n_present++;
 1058|  2.23M|        if (l > max_depth) max_depth = l;
  ------------------
  |  Branch (1058:13): [True: 69.8k, False: 2.16M]
  ------------------
 1059|  2.23M|    }
 1060|  23.2k|    if (UNLIKELY(n_present == 0)) return -1;
  ------------------
  |  |  154|  23.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 23.2k]
  |  |  ------------------
  ------------------
 1061|  23.2k|    if (n_present >= 2) {
  ------------------
  |  Branch (1061:9): [True: 22.1k, False: 1.09k]
  ------------------
 1062|  22.1k|        uint32_t kraft = 0;
 1063|   266k|        for (int l = 1; l <= ZXC_HUF_MAX_CODE_LEN_ULTRA; l++)
  ------------------
  |  |  778|   266k|#define ZXC_HUF_MAX_CODE_LEN_ULTRA 11
  ------------------
  |  Branch (1063:25): [True: 243k, False: 22.1k]
  ------------------
 1064|   243k|            kraft += (uint32_t)bl_count[l] << (ZXC_HUF_MAX_CODE_LEN_ULTRA - l);
  ------------------
  |  |  778|   243k|#define ZXC_HUF_MAX_CODE_LEN_ULTRA 11
  ------------------
 1065|  22.1k|        if (UNLIKELY(kraft != (1U << ZXC_HUF_MAX_CODE_LEN_ULTRA))) return -1;
  ------------------
  |  |  154|  22.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 95, False: 22.0k]
  |  |  ------------------
  ------------------
 1066|  22.1k|    } else if (UNLIKELY(bl_count[1] != 1)) {
  ------------------
  |  |  154|  1.09k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 6, False: 1.09k]
  |  |  ------------------
  ------------------
 1067|      6|        return -1; /* the lone symbol is pinned at length 1 */
 1068|      6|    }
 1069|  23.1k|    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|  23.1k|    unsigned width = 1;
 1074|  23.1k|    unsigned first = 0;
 1075|  23.1k|    t->node_base[0] = 0;
 1076|  23.1k|    t->leaf_base[0] = 0;
 1077|   188k|    for (int d = 0; d <= max_depth; d++) {
  ------------------
  |  Branch (1077:21): [True: 164k, False: 23.1k]
  ------------------
 1078|   164k|        t->base[d] = (int16_t)(t->node_base[d] - (int)first);
 1079|   164k|        t->node_base[d + 1] = (uint16_t)(t->node_base[d] + width);
 1080|   164k|        t->leaf_base[d + 1] = (uint16_t)(t->leaf_base[d] + bl_count[d]);
 1081|   164k|        first = 2 * (first + bl_count[d]);
 1082|   164k|        width = (d == 0 && n_present == 1) ? 1U : 2 * (width - bl_count[d]);
  ------------------
  |  Branch (1082:18): [True: 23.1k, False: 141k]
  |  Branch (1082:28): [True: 1.09k, False: 22.0k]
  ------------------
 1083|   164k|    }
 1084|       |
 1085|  23.1k|    uint16_t pos[ZXC_HUF_MAX_CODE_LEN_ULTRA + 1];
 1086|   188k|    for (int d = 0; d <= max_depth; d++) pos[d] = t->leaf_base[d];
  ------------------
  |  Branch (1086:21): [True: 164k, False: 23.1k]
  ------------------
 1087|  5.95M|    for (int s = 0; s < ZXC_HUF_NUM_SYMBOLS; s++)
  ------------------
  |  |  785|  5.95M|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (1087:21): [True: 5.93M, False: 23.1k]
  ------------------
 1088|  5.93M|        if (code_len[s]) t->syms[pos[code_len[s]]++] = (uint8_t)s;
  ------------------
  |  Branch (1088:13): [True: 2.22M, False: 3.70M]
  ------------------
 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|  23.1k|    enum { INCOMPLETE = 0xFE };
 1094|  23.1k|    t->flat_d[t->node_base[max_depth + 1]] = 0;
 1095|   188k|    for (int d = max_depth; d >= 0; d--) {
  ------------------
  |  Branch (1095:29): [True: 164k, False: 23.1k]
  ------------------
 1096|   164k|        uint8_t* const h = t->flat_d + t->node_base[d];
 1097|   164k|        const uint8_t* const hc = t->flat_d + t->node_base[d + 1];
 1098|   164k|        const int L = zxc_pivco_leaves(t, d);
 1099|   164k|        const int N = t->node_base[d + 1] - t->node_base[d];
 1100|  2.39M|        for (int i = 0; i < L; i++) h[i] = 0;
  ------------------
  |  Branch (1100:25): [True: 2.22M, False: 164k]
  ------------------
 1101|  2.37M|        for (int i = L; i < N; i++) {
  ------------------
  |  Branch (1101:25): [True: 2.20M, False: 164k]
  ------------------
 1102|  2.20M|            const uint8_t a = hc[2 * (i - L)];
 1103|  2.20M|            const uint8_t b = hc[2 * (i - L) + 1];
 1104|  2.20M|            h[i] = (a == b && a != INCOMPLETE) ? (uint8_t)(a + 1) : (uint8_t)INCOMPLETE;
  ------------------
  |  Branch (1104:21): [True: 2.08M, False: 124k]
  |  Branch (1104:31): [True: 2.05M, False: 22.3k]
  ------------------
 1105|  2.20M|        }
 1106|   164k|    }
 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|   164k|    for (int d = 0; d < max_depth; d++) {
  ------------------
  |  Branch (1110:21): [True: 141k, False: 23.1k]
  ------------------
 1111|   141k|        uint8_t* const fd = t->flat_d + t->node_base[d];
 1112|   141k|        const uint8_t* const up =
 1113|   141k|            d ? t->flat_d + t->node_base[d - 1] + zxc_pivco_leaves(t, d - 1) : NULL;
  ------------------
  |  Branch (1113:13): [True: 118k, False: 23.1k]
  ------------------
 1114|   141k|        const int N = t->node_base[d + 1] - t->node_base[d];
 1115|  2.34M|        for (int i = zxc_pivco_leaves(t, d); i < N; i++) {
  ------------------
  |  Branch (1115:46): [True: 2.20M, False: 141k]
  ------------------
 1116|  2.20M|            if (up && up[i >> 1]) {
  ------------------
  |  Branch (1116:17): [True: 2.18M, False: 23.1k]
  |  Branch (1116:23): [True: 1.91M, False: 267k]
  ------------------
 1117|  1.91M|                fd[i] = ZXC_PIVCO_COVERED;
  ------------------
  |  |  802|  1.91M|#define ZXC_PIVCO_COVERED 0xFFU
  ------------------
 1118|  1.91M|            } else if (fd[i] < 2 || fd[i] == INCOMPLETE) {
  ------------------
  |  Branch (1118:24): [True: 38.9k, False: 251k]
  |  Branch (1118:37): [True: 146k, False: 104k]
  ------------------
 1119|   185k|                fd[i] = 0;
 1120|   185k|            } else {
 1121|   104k|                const int g = t->node_base[d] + i;
 1122|   104k|                zxc_pivco_bitrev_permute(t->syms + zxc_pivco_flat_leaves(t, g, d, fd[i]), fd[i]);
 1123|   104k|            }
 1124|  2.20M|        }
 1125|   141k|    }
 1126|  23.1k|    return 0;
 1127|  23.2k|}
zxc_huffman.c:zxc_pivco_leaves:
 1012|  1.24M|static ZXC_ALWAYS_INLINE int zxc_pivco_leaves(const zxc_pivco_tree_t* RESTRICT t, const int d) {
 1013|  1.24M|    return t->leaf_base[d + 1] - t->leaf_base[d];
 1014|  1.24M|}
zxc_huffman.c:zxc_pivco_bitrev_permute:
 1024|   104k|static void zxc_pivco_bitrev_permute(uint8_t* RESTRICT s, const int D) {
 1025|   104k|    const unsigned m = 1U << D;
 1026|   104k|    unsigned c = 0; /* r bit-reversed */
 1027|  2.22M|    for (unsigned r = 0; r < m; r++) {
  ------------------
  |  Branch (1027:26): [True: 2.12M, False: 104k]
  ------------------
 1028|  2.12M|        if (r < c) {
  ------------------
  |  Branch (1028:13): [True: 816k, False: 1.30M]
  ------------------
 1029|   816k|            const uint8_t x = s[r];
 1030|   816k|            s[r] = s[c];
 1031|   816k|            s[c] = x;
 1032|   816k|        }
 1033|  2.12M|        unsigned bit = m >> 1; /* reversed increment */
 1034|  4.14M|        for (; c & bit; bit >>= 1) c ^= bit;
  ------------------
  |  Branch (1034:16): [True: 2.02M, False: 2.12M]
  ------------------
 1035|  2.12M|        c |= bit;
 1036|  2.12M|    }
 1037|   104k|}
zxc_huffman.c:zxc_pivco_flat_leaves:
 1018|   170k|                                                   const int d, const int D) {
 1019|   170k|    const int e = d + D;
 1020|   170k|    return t->leaf_base[e] + t->base[e] - t->node_base[e] + ((g - t->base[d]) << D);
 1021|   170k|}
zxc_huffman.c:zxc_pivco_counts:
 1136|  5.35k|                             uint32_t* RESTRICT count) {
 1137|  5.35k|    count[t->node_base[t->max_depth + 1]] = 0;
 1138|  59.0k|    for (int d = t->max_depth; d >= 0; d--) {
  ------------------
  |  Branch (1138:32): [True: 53.6k, False: 5.35k]
  ------------------
 1139|  53.6k|        const int L = zxc_pivco_leaves(t, d);
 1140|  53.6k|        const int N = t->node_base[d + 1] - t->node_base[d];
 1141|  53.6k|        uint32_t* const cnt = count + t->node_base[d];
 1142|  53.6k|        const uint32_t* const ccnt = count + t->node_base[d + 1];
 1143|  53.6k|        const uint8_t* const sym = t->syms + t->leaf_base[d];
 1144|   903k|        for (int i = 0; i < L; i++) cnt[i] = freq[sym[i]];
  ------------------
  |  Branch (1144:25): [True: 849k, False: 53.6k]
  ------------------
 1145|   897k|        for (int i = L; i < N; i++) cnt[i] = ccnt[2 * (i - L)] + ccnt[2 * (i - L) + 1];
  ------------------
  |  Branch (1145:25): [True: 844k, False: 53.6k]
  ------------------
 1146|  53.6k|    }
 1147|  5.35k|}
zxc_huffman.c:zxc_pivco_layout:
 1189|  5.35k|                               uint32_t* RESTRICT cur) {
 1190|  5.35k|    size_t total = 0;
 1191|  53.6k|    for (int d = 0; d < t->max_depth; d++) {
  ------------------
  |  Branch (1191:21): [True: 48.3k, False: 5.35k]
  ------------------
 1192|   892k|        for (int g = t->node_base[d] + zxc_pivco_leaves(t, d); g < t->node_base[d + 1]; g++) {
  ------------------
  |  Branch (1192:64): [True: 844k, False: 48.3k]
  ------------------
 1193|   844k|            if (t->flat_d[g] == ZXC_PIVCO_COVERED) continue;
  ------------------
  |  |  802|   844k|#define ZXC_PIVCO_COVERED 0xFFU
  ------------------
  |  Branch (1193:17): [True: 743k, False: 100k]
  ------------------
 1194|   100k|            if (cur) cur[g] = (uint32_t)(total << 3);
  ------------------
  |  Branch (1194:17): [True: 40.3k, False: 59.7k]
  ------------------
 1195|   100k|            total += zxc_pivco_run_bytes(count[g], t->flat_d[g]);
 1196|   100k|        }
 1197|  48.3k|    }
 1198|  5.35k|    return total;
 1199|  5.35k|}
zxc_huffman.c:zxc_pivco_run_bytes:
 1178|  2.82M|static ZXC_ALWAYS_INLINE size_t zxc_pivco_run_bytes(const uint32_t count, const uint8_t flat_d) {
 1179|  2.82M|    return flat_d ? ((size_t)count * flat_d + 7) / 8 : ((size_t)count + 7) / 8;
  ------------------
  |  Branch (1179:12): [True: 2.51M, False: 309k]
  ------------------
 1180|  2.82M|}
zxc_huffman.c:zxc_pivco_codes:
 1150|  1.99k|static void zxc_pivco_codes(const zxc_pivco_tree_t* RESTRICT t, uint32_t* RESTRICT codes) {
 1151|  20.4k|    for (int d = 1; d <= t->max_depth; d++)
  ------------------
  |  Branch (1151:21): [True: 18.4k, False: 1.99k]
  ------------------
 1152|   325k|        for (int i = 0; i < zxc_pivco_leaves(t, d); i++)
  ------------------
  |  Branch (1152:25): [True: 306k, False: 18.4k]
  ------------------
 1153|   306k|            codes[t->syms[t->leaf_base[d] + i]] = (uint32_t)(t->node_base[d] + i - t->base[d]);
 1154|  1.99k|}
zxc_huffman.c:zxc_pivco_encode_core:
 1238|  1.99k|                                 const int with_header) {
 1239|  1.99k|    if (UNLIKELY(n_literals == 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  1.99k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 1.99k]
  |  |  ------------------
  ------------------
 1240|       |    // Every literal present in the histogram must have a code (a dict table
 1241|       |    // may lack codes for symbols unseen in training: the caller then falls
 1242|       |    // back to a per-block table, but a direct call must fail loudly).
 1243|   512k|    for (int k = 0; k < ZXC_HUF_NUM_SYMBOLS; k++)
  ------------------
  |  |  785|   512k|#define ZXC_HUF_NUM_SYMBOLS 256
  ------------------
  |  Branch (1243:21): [True: 510k, False: 1.99k]
  ------------------
 1244|   510k|        if (UNLIKELY(freq[k] != 0 && code_len[k] == 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|   817k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 510k]
  |  |  |  Branch (154:42): [True: 306k, False: 204k]
  |  |  |  Branch (154:42): [True: 0, False: 306k]
  |  |  ------------------
  ------------------
 1245|       |
 1246|  1.99k|    uint32_t count[ZXC_PIVCO_NODE_SLOTS];
 1247|  1.99k|    zxc_pivco_counts(t, freq, count);
 1248|  1.99k|    uint32_t cur[ZXC_PIVCO_MAX_NODES]; /* per-node write cursor, in payload bits */
 1249|  1.99k|    const size_t payload = zxc_pivco_layout(t, count, cur);
 1250|  1.99k|    const size_t hdr = with_header ? (size_t)ZXC_HUF_TABLE_SIZE : 0;
  ------------------
  |  |   96|  1.99k|#define ZXC_HUF_TABLE_SIZE 128
  ------------------
  |  Branch (1250:24): [True: 1.99k, False: 0]
  ------------------
 1251|       |    // +2: the packed-code emitter uses a 3-byte read-modify-write that may
 1252|       |    // touch up to 2 bytes past the payload end.
 1253|  1.99k|    if (UNLIKELY(hdr + payload + 2 > dst_cap)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  154|  1.99k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 1.99k]
  |  |  ------------------
  ------------------
 1254|       |
 1255|  1.99k|    if (with_header) zxc_huf_pack_lengths(code_len, dst);
  ------------------
  |  |   43|  1.99k|#define zxc_huf_pack_lengths ZXC_CAT(zxc_huf_pack_lengths, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   41|  1.99k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|  1.99k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1255:9): [True: 1.99k, False: 0]
  ------------------
 1256|  1.99k|    uint8_t* const out = dst + hdr;
 1257|  1.99k|    ZXC_MEMSET(out, 0, payload + 2);
  ------------------
  |  |  175|  1.99k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
 1258|       |
 1259|       |    // Emit MSB-first while descending. At a flat root, emit the code's last D
 1260|       |    // bits, its packed code, in one shot and stop. Batching the per-bit
 1261|       |    // read-modify-write buys nothing: accumulators would still touch memory
 1262|       |    // once per bit, and flat roots absorb the dense levels.
 1263|  15.0M|    for (size_t i = 0; i < n_literals; i++) {
  ------------------
  |  Branch (1263:24): [True: 15.0M, False: 1.99k]
  ------------------
 1264|  15.0M|        const uint8_t s = literals[i];
 1265|  15.0M|        const uint32_t c = codes[s];
 1266|  15.0M|        const int l = code_len[s];
 1267|  62.4M|        for (int d = 0; d < l; d++) {
  ------------------
  |  Branch (1267:25): [True: 59.3M, False: 3.08M]
  ------------------
 1268|  59.3M|            const int g = t->base[d] + (int)(c >> (l - d));
 1269|  59.3M|            const int fd = t->flat_d[g];
 1270|  59.3M|            if (fd) {
  ------------------
  |  Branch (1270:17): [True: 11.9M, False: 47.3M]
  ------------------
 1271|  11.9M|                const uint32_t p = cur[g];
 1272|  11.9M|                cur[g] += (uint32_t)fd;
 1273|  11.9M|                uint8_t* q = out + (p >> 3);
 1274|  11.9M|                const uint32_t sh = p & 7U;
 1275|  11.9M|                uint32_t w = (uint32_t)q[0] | ((uint32_t)q[1] << 8) | ((uint32_t)q[2] << 16);
 1276|  11.9M|                w |= (c & ((1U << fd) - 1U)) << sh; /* fd <= 8, sh <= 7: fits 24 bits */
 1277|  11.9M|                q[0] = (uint8_t)w;
 1278|  11.9M|                q[1] = (uint8_t)(w >> 8);
 1279|  11.9M|                q[2] = (uint8_t)(w >> 16);
 1280|  11.9M|                break;
 1281|  11.9M|            }
 1282|  47.3M|            const uint32_t bit = (c >> (l - 1 - d)) & 1U;
 1283|  47.3M|            const uint32_t p = cur[g]++;
 1284|  47.3M|            out[p >> 3] |= (uint8_t)(bit << (p & 7));
 1285|  47.3M|        }
 1286|  15.0M|    }
 1287|  1.99k|    return (int)(hdr + payload);
 1288|  1.99k|}
zxc_huffman.c:zxc_pivco_decode_core:
 2160|  17.8k|                                 const zxc_pivco_tree_t* RESTRICT t, uint8_t* RESTRICT scratch) {
 2161|  17.8k|    if (UNLIKELY(n == 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  17.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 6, False: 17.8k]
  |  |  ------------------
  ------------------
 2162|       |
 2163|       |    // Pass 1, in wire order: node counts from the partition bits, and where
 2164|       |    // each depth's runs start. Leaf-pair children (emitted by their parent) and
 2165|       |    // a flat root's inside get count 0: empty runs, nothing to flag.
 2166|  17.8k|    uint32_t count[ZXC_PIVCO_NODE_SLOTS];
 2167|  17.8k|    const uint8_t* lvl_run[ZXC_HUF_MAX_CODE_LEN_ULTRA];
 2168|  17.8k|    const int slot = t->node_base[t->max_depth + 1];
 2169|  17.8k|    count[0] = (uint32_t)n;
 2170|  17.8k|    count[slot] = 0;
 2171|  17.8k|    const uint8_t* p = payload;
 2172|  17.8k|    const uint8_t* const pend = payload + payload_size;
 2173|   111k|    for (int d = 0; d < t->max_depth; d++) {
  ------------------
  |  Branch (2173:21): [True: 93.4k, False: 17.7k]
  ------------------
 2174|  93.4k|        lvl_run[d] = p;
 2175|  93.4k|        const int L = zxc_pivco_leaves(t, d);
 2176|  93.4k|        const int N = t->node_base[d + 1] - t->node_base[d];
 2177|  93.4k|        const int Lc = zxc_pivco_leaves(t, d + 1);
 2178|  93.4k|        const uint32_t* const cnt = count + t->node_base[d];
 2179|  93.4k|        uint32_t* const ccnt = count + t->node_base[d + 1];
 2180|  93.4k|        const uint8_t* const fd = t->flat_d + t->node_base[d];
 2181|  1.45M|        for (int i = L; i < N; i++) {
  ------------------
  |  Branch (2181:25): [True: 1.36M, False: 93.4k]
  ------------------
 2182|  1.36M|            const uint32_t c = cnt[i];
 2183|  1.36M|            const int k2 = 2 * (i - L); /* first child */
 2184|  1.36M|            if (fd[i]) {
  ------------------
  |  Branch (2184:17): [True: 1.23M, False: 123k]
  ------------------
 2185|       |                // Packed-code run: no partition below, nothing to popcount.
 2186|  1.23M|                const size_t fbytes = zxc_pivco_run_bytes(c, fd[i]);
 2187|  1.23M|                if (UNLIKELY((size_t)(pend - p) < fbytes)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  1.23M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 8, False: 1.23M]
  |  |  ------------------
  ------------------
 2188|  1.23M|                p += fbytes;
 2189|  1.23M|                ccnt[k2] = 0;
 2190|  1.23M|                ccnt[k2 + 1] = 0;
 2191|  1.23M|                continue;
 2192|  1.23M|            }
 2193|   123k|            const size_t nbytes = zxc_pivco_run_bytes(c, 0); /* merge node: c partition bits */
 2194|   123k|            if (UNLIKELY((size_t)(pend - p) < nbytes)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|   123k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 21, False: 123k]
  |  |  ------------------
  ------------------
 2195|       |            // popcount of the c valid bits = the right child's count. All but the
 2196|       |            // last byte counted fast, the last one with its padding masked - if the
 2197|       |            // 8-byte loop swallowed it unmasked, padding bits would inflate `ones`.
 2198|   123k|            uint32_t ones = 0;
 2199|   123k|            if (nbytes) {
  ------------------
  |  Branch (2199:17): [True: 123k, False: 617]
  ------------------
 2200|   123k|                const size_t full = nbytes - 1;
 2201|   123k|                size_t k = 0;
 2202|  3.31M|                for (; k + 8 <= full; k += 8) {
  ------------------
  |  Branch (2202:24): [True: 3.19M, False: 123k]
  ------------------
 2203|  3.19M|                    uint64_t w;
 2204|  3.19M|                    ZXC_MEMCPY(&w, p + k, 8);
  ------------------
  |  |  170|  3.19M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 2205|  3.19M|                    ones += (uint32_t)zxc_pivco_popcnt64(w);
 2206|  3.19M|                }
 2207|   503k|                for (; k < full; k++) ones += (uint32_t)zxc_pivco_popcnt32(p[k]);
  ------------------
  |  Branch (2207:24): [True: 380k, False: 123k]
  ------------------
 2208|   123k|                uint8_t last = p[full];
 2209|   123k|                if (c & 7U) last &= (uint8_t)((1U << (c & 7U)) - 1U);
  ------------------
  |  Branch (2209:21): [True: 106k, False: 16.4k]
  ------------------
 2210|   123k|                ones += (uint32_t)zxc_pivco_popcnt32(last);
 2211|   123k|            }
 2212|   123k|            p += nbytes;
 2213|   123k|            if (UNLIKELY(ones > c)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|   123k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 123k]
  |  |  ------------------
  ------------------
 2214|   123k|            const int leaf_pair = k2 + 1 < Lc;
 2215|   123k|            ccnt[k2] = leaf_pair ? 0 : c - ones;
  ------------------
  |  Branch (2215:24): [True: 27.2k, False: 96.4k]
  ------------------
 2216|   123k|            ccnt[k2 + 1] = leaf_pair ? 0 : ones;
  ------------------
  |  Branch (2216:28): [True: 27.2k, False: 96.4k]
  ------------------
 2217|   123k|        }
 2218|  93.4k|    }
 2219|       |    // The slot stands for the lone-symbol root's missing child: no 1 bits.
 2220|  17.7k|    if (UNLIKELY(count[slot] != 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  154|  17.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 9, False: 17.7k]
  |  |  ------------------
  ------------------
 2221|       |
 2222|       |    // Pass 2, bottom-up. Runs and children follow position order, so two
 2223|       |    // running offsets replace per-node tables.
 2224|   128k|    for (int d = t->max_depth; d >= 0; d--) {
  ------------------
  |  Branch (2224:32): [True: 111k, False: 17.7k]
  ------------------
 2225|   111k|        uint8_t* const buf_d = (d & 1) ? scratch : dst;
  ------------------
  |  Branch (2225:32): [True: 51.5k, False: 59.6k]
  ------------------
 2226|   111k|        const uint8_t* const buf_c = (d & 1) ? dst : scratch; /* children at d+1 (read-only) */
  ------------------
  |  Branch (2226:38): [True: 51.5k, False: 59.6k]
  ------------------
 2227|   111k|        const int L = zxc_pivco_leaves(t, d);
 2228|   111k|        const int N = t->node_base[d + 1] - t->node_base[d];
 2229|   111k|        const uint32_t* const cnt = count + t->node_base[d];
 2230|   111k|        const uint8_t* const sym = t->syms + t->leaf_base[d];
 2231|   111k|        size_t off = 0;
 2232|  1.48M|        for (int i = 0; i < L; i++) {
  ------------------
  |  Branch (2232:25): [True: 1.37M, False: 111k]
  ------------------
 2233|  1.37M|            if (cnt[i]) ZXC_MEMSET(buf_d + off, sym[i], cnt[i]);
  ------------------
  |  |  175|  19.2k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  |  Branch (2233:17): [True: 19.2k, False: 1.35M]
  ------------------
 2234|  1.37M|            off += cnt[i];
 2235|  1.37M|        }
 2236|   111k|        if (d == t->max_depth) continue; /* leaves only, as in pass 1 */
  ------------------
  |  Branch (2236:13): [True: 17.7k, False: 93.3k]
  ------------------
 2237|  93.3k|        const uint8_t* run = lvl_run[d];
 2238|  93.3k|        const uint32_t* const ccnt = count + t->node_base[d + 1];
 2239|  93.3k|        const uint8_t* const csym = t->syms + t->leaf_base[d + 1];
 2240|  93.3k|        const int Lc = zxc_pivco_leaves(t, d + 1);
 2241|  93.3k|        const uint8_t* const fd = t->flat_d + t->node_base[d];
 2242|  93.3k|        size_t coff = 0;
 2243|  1.45M|        for (int i = L; i < N; i++) {
  ------------------
  |  Branch (2243:25): [True: 1.36M, False: 93.3k]
  ------------------
 2244|  1.36M|            const uint32_t c = cnt[i];
 2245|  1.36M|            const int k2 = 2 * (i - L);
 2246|  1.36M|            if (c) {
  ------------------
  |  Branch (2246:17): [True: 189k, False: 1.17M]
  ------------------
 2247|   189k|                if (fd[i]) {
  ------------------
  |  Branch (2247:21): [True: 66.1k, False: 123k]
  ------------------
 2248|  66.1k|                    const int D = fd[i];
 2249|  66.1k|                    const int leaves = zxc_pivco_flat_leaves(t, t->node_base[d] + i, d, D);
 2250|  66.1k|                    zxc_pivco_unpack_flat(buf_d + off, c, D, run, t->syms + leaves);
 2251|   123k|                } else if (k2 + 1 < Lc) {
  ------------------
  |  Branch (2251:28): [True: 26.9k, False: 96.0k]
  ------------------
 2252|  26.9k|                    zxc_pivco_emit_leaf_pair(buf_d + off, c, csym[k2], csym[k2 + 1], run);
 2253|  96.0k|                } else {
 2254|  96.0k|                    const uint32_t nl = ccnt[k2];
 2255|  96.0k|                    zxc_pivco_merge(buf_d + off, buf_c + coff, nl, c - nl, run);
 2256|  96.0k|                }
 2257|   189k|            }
 2258|  1.36M|            run += zxc_pivco_run_bytes(c, fd[i]);
 2259|  1.36M|            off += c;
 2260|  1.36M|            coff += ccnt[k2] + ccnt[k2 + 1];
 2261|  1.36M|        }
 2262|  93.3k|    }
 2263|  17.7k|    return ZXC_OK;
 2264|  17.7k|}
zxc_huffman.c:zxc_pivco_popcnt64:
 1009|  3.19M|static ZXC_ALWAYS_INLINE int zxc_pivco_popcnt64(const uint64_t v) { return (int)ZXC_POPCOUNT64(v); }
  ------------------
  |  |  157|  3.19M|#define ZXC_POPCOUNT64(v) __builtin_popcountll(v)
  ------------------
zxc_huffman.c:zxc_pivco_popcnt32:
 1007|  25.6M|static ZXC_ALWAYS_INLINE int zxc_pivco_popcnt32(const uint32_t v) { return (int)ZXC_POPCOUNT32(v); }
  ------------------
  |  |  156|  25.6M|#define ZXC_POPCOUNT32(v) __builtin_popcount(v)
  ------------------
zxc_huffman.c:zxc_pivco_unpack_flat:
 1556|  66.1k|                                  const uint8_t* RESTRICT bits, const uint8_t* RESTRICT c2s) {
 1557|  66.1k|    size_t i = 0;
 1558|       |#if defined(ZXC_USE_NEON64)
 1559|       |    if (D == 2) {
 1560|       |        uint8_t c2s16[16];
 1561|       |        for (int k = 0; k < 16; k++) c2s16[k] = c2s[k & 3];
 1562|       |        const uint8x16_t vc2s = vld1q_u8(c2s16);
 1563|       |        static const uint8_t rep4[16] = {0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3};
 1564|       |        static const int8_t sh2[16] = {0, -2, -4, -6, 0, -2, -4, -6, 0, -2, -4, -6, 0, -2, -4, -6};
 1565|       |        const uint8x16_t vrep = vld1q_u8(rep4);
 1566|       |        const int8x16_t vsh = vld1q_s8(sh2);
 1567|       |        const uint8x16_t vmask = vdupq_n_u8(0x03);
 1568|       |        while (i + 16 <= n) {
 1569|       |            uint8x16_t raw = vdupq_n_u8(0);
 1570|       |            raw = vreinterpretq_u8_u32(
 1571|       |                vsetq_lane_u32(zxc_le32(bits + ((i * 2) >> 3)), vreinterpretq_u32_u8(raw), 0));
 1572|       |            const uint8x16_t rep = vqtbl1q_u8(raw, vrep);
 1573|       |            const uint8x16_t codes = vandq_u8(vshlq_u8(rep, vsh), vmask);
 1574|       |            vst1q_u8(out + i, vqtbl1q_u8(vc2s, codes));
 1575|       |            i += 16;
 1576|       |        }
 1577|       |    } else if (D == 3) {
 1578|       |        // Odd D straddle bytes: build a 16-bit window {byte_j,byte_j+1} per lane
 1579|       |        // (byte_j = Di>>3), right-shift by Di&7, mask D bits. 16/step, two u16x8
 1580|       |        // halves sharing the shift vector. D=3: 6 source bytes.
 1581|       |        uint8_t c2s16[16];
 1582|       |        for (int k = 0; k < 16; k++) c2s16[k] = c2s[k & 7];
 1583|       |        const uint8x16_t vc2s = vld1q_u8(c2s16); /* 8 entries, padded to 16 */
 1584|       |        static const uint8_t idxA[16] = {0, 1, 0, 1, 0, 1, 1, 2, 1, 2, 1, 2, 2, 3, 2, 3};
 1585|       |        static const uint8_t idxB[16] = {3, 4, 3, 4, 3, 4, 4, 5, 4, 5, 4, 5, 5, 6, 5, 6};
 1586|       |        static const int16_t sh8[8] = {0, -3, -6, -1, -4, -7, -2, -5};
 1587|       |        const uint8x16_t vidxA = vld1q_u8(idxA);
 1588|       |        const uint8x16_t vidxB = vld1q_u8(idxB);
 1589|       |        const int16x8_t vsh = vld1q_s16(sh8);
 1590|       |        const uint16x8_t vmask = vdupq_n_u16(0x07);
 1591|       |        while (i + 16 <= n) {
 1592|       |            const size_t off = (i * 3) >> 3;
 1593|       |            uint32_t w0;
 1594|       |            uint16_t w1;
 1595|       |            ZXC_MEMCPY(&w0, bits + off, 4);
 1596|       |            ZXC_MEMCPY(&w1, bits + off + 4, 2); /* exactly 6 bytes read */
 1597|       |            uint8x16_t raw = vdupq_n_u8(0);
 1598|       |            raw = vreinterpretq_u8_u32(vsetq_lane_u32(w0, vreinterpretq_u32_u8(raw), 0));
 1599|       |            raw = vreinterpretq_u8_u16(vsetq_lane_u16(w1, vreinterpretq_u16_u8(raw), 2));
 1600|       |            const uint16x8_t winA = vreinterpretq_u16_u8(vqtbl1q_u8(raw, vidxA));
 1601|       |            const uint16x8_t winB = vreinterpretq_u16_u8(vqtbl1q_u8(raw, vidxB));
 1602|       |            const uint8x8_t cA = vmovn_u16(vandq_u16(vshlq_u16(winA, vsh), vmask));
 1603|       |            const uint8x8_t cB = vmovn_u16(vandq_u16(vshlq_u16(winB, vsh), vmask));
 1604|       |            vst1q_u8(out + i, vqtbl1q_u8(vc2s, vcombine_u8(cA, cB)));
 1605|       |            i += 16;
 1606|       |        }
 1607|       |    } else if (D == 4) {
 1608|       |        const uint8x16_t vc2s = vld1q_u8(c2s); /* 16 entries */
 1609|       |        static const uint8_t rep2[16] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7};
 1610|       |        static const int8_t sh4[16] = {0, -4, 0, -4, 0, -4, 0, -4, 0, -4, 0, -4, 0, -4, 0, -4};
 1611|       |        const uint8x16_t vrep = vld1q_u8(rep2);
 1612|       |        const int8x16_t vsh = vld1q_s8(sh4);
 1613|       |        const uint8x16_t vmask = vdupq_n_u8(0x0F);
 1614|       |        while (i + 16 <= n) {
 1615|       |            uint8x16_t raw = vdupq_n_u8(0);
 1616|       |            raw = vreinterpretq_u8_u64(
 1617|       |                vsetq_lane_u64(zxc_le64(bits + ((i * 4) >> 3)), vreinterpretq_u64_u8(raw), 0));
 1618|       |            const uint8x16_t rep = vqtbl1q_u8(raw, vrep);
 1619|       |            const uint8x16_t codes = vandq_u8(vshlq_u8(rep, vsh), vmask);
 1620|       |            vst1q_u8(out + i, vqtbl1q_u8(vc2s, codes));
 1621|       |            i += 16;
 1622|       |        }
 1623|       |    } else if (D == 5) {
 1624|       |        // Same window scheme as D=3; c2s has 32 entries (vqtbl2q). 10 bytes.
 1625|       |        const uint8x16x2_t vc2s = vld1q_u8_x2(c2s);
 1626|       |        static const uint8_t idxA[16] = {0, 1, 0, 1, 1, 2, 1, 2, 2, 3, 3, 4, 3, 4, 4, 5};
 1627|       |        static const uint8_t idxB[16] = {5, 6, 5, 6, 6, 7, 6, 7, 7, 8, 8, 9, 8, 9, 9, 10};
 1628|       |        static const int16_t sh8[8] = {0, -5, -2, -7, -4, -1, -6, -3};
 1629|       |        const uint8x16_t vidxA = vld1q_u8(idxA);
 1630|       |        const uint8x16_t vidxB = vld1q_u8(idxB);
 1631|       |        const int16x8_t vsh = vld1q_s16(sh8);
 1632|       |        const uint16x8_t vmask = vdupq_n_u16(0x1F);
 1633|       |        while (i + 16 <= n) {
 1634|       |            const size_t off = (i * 5) >> 3;
 1635|       |            uint64_t w0;
 1636|       |            uint16_t w1;
 1637|       |            ZXC_MEMCPY(&w0, bits + off, 8);
 1638|       |            ZXC_MEMCPY(&w1, bits + off + 8, 2);
 1639|       |            uint8x16_t raw = vdupq_n_u8(0);
 1640|       |            raw = vreinterpretq_u8_u64(vsetq_lane_u64(w0, vreinterpretq_u64_u8(raw), 0));
 1641|       |            raw = vreinterpretq_u8_u16(vsetq_lane_u16(w1, vreinterpretq_u16_u8(raw), 4));
 1642|       |            const uint16x8_t winA = vreinterpretq_u16_u8(vqtbl1q_u8(raw, vidxA));
 1643|       |            const uint16x8_t winB = vreinterpretq_u16_u8(vqtbl1q_u8(raw, vidxB));
 1644|       |            const uint8x8_t cA = vmovn_u16(vandq_u16(vshlq_u16(winA, vsh), vmask));
 1645|       |            const uint8x8_t cB = vmovn_u16(vandq_u16(vshlq_u16(winB, vsh), vmask));
 1646|       |            vst1q_u8(out + i, vqtbl2q_u8(vc2s, vcombine_u8(cA, cB)));
 1647|       |            i += 16;
 1648|       |        }
 1649|       |    } else if (D == 6) {
 1650|       |        // Same window scheme as D=3; c2s has 64 entries (vqtbl4q). 12 bytes.
 1651|       |        const uint8x16x4_t vc2s = vld1q_u8_x4(c2s);
 1652|       |        static const uint8_t idxA[16] = {0, 1, 0, 1, 1, 2, 2, 3, 3, 4, 3, 4, 4, 5, 5, 6};
 1653|       |        static const uint8_t idxB[16] = {6, 7, 6, 7, 7, 8, 8, 9, 9, 10, 9, 10, 10, 11, 11, 12};
 1654|       |        static const int16_t sh8[8] = {0, -6, -4, -2, 0, -6, -4, -2};
 1655|       |        const uint8x16_t vidxA = vld1q_u8(idxA);
 1656|       |        const uint8x16_t vidxB = vld1q_u8(idxB);
 1657|       |        const int16x8_t vsh = vld1q_s16(sh8);
 1658|       |        const uint16x8_t vmask = vdupq_n_u16(0x3F);
 1659|       |        while (i + 16 <= n) {
 1660|       |            const size_t off = (i * 6) >> 3;
 1661|       |            uint64_t w0;
 1662|       |            uint32_t w1;
 1663|       |            ZXC_MEMCPY(&w0, bits + off, 8);
 1664|       |            ZXC_MEMCPY(&w1, bits + off + 8, 4);
 1665|       |            uint8x16_t raw = vdupq_n_u8(0);
 1666|       |            raw = vreinterpretq_u8_u64(vsetq_lane_u64(w0, vreinterpretq_u64_u8(raw), 0));
 1667|       |            raw = vreinterpretq_u8_u32(vsetq_lane_u32(w1, vreinterpretq_u32_u8(raw), 2));
 1668|       |            const uint16x8_t winA = vreinterpretq_u16_u8(vqtbl1q_u8(raw, vidxA));
 1669|       |            const uint16x8_t winB = vreinterpretq_u16_u8(vqtbl1q_u8(raw, vidxB));
 1670|       |            const uint8x8_t cA = vmovn_u16(vandq_u16(vshlq_u16(winA, vsh), vmask));
 1671|       |            const uint8x8_t cB = vmovn_u16(vandq_u16(vshlq_u16(winB, vsh), vmask));
 1672|       |            vst1q_u8(out + i, vqtbl4q_u8(vc2s, vcombine_u8(cA, cB)));
 1673|       |            i += 16;
 1674|       |        }
 1675|       |    }
 1676|       |#elif defined(ZXC_USE_NEON32)
 1677|       |    // d-register mirrors of the AArch64 kernels: 8 codes per step, c2s lookup
 1678|       |    // via VTBL (16-entry table = two d-registers).
 1679|       |    if (D == 2) {
 1680|       |        uint8_t c2s8[8];
 1681|       |        for (int k = 0; k < 8; k++) c2s8[k] = c2s[k & 3];
 1682|       |        const uint8x8_t vc2s = vld1_u8(c2s8);
 1683|       |        static const uint8_t rep4[8] = {0, 0, 0, 0, 1, 1, 1, 1};
 1684|       |        static const int8_t sh2[8] = {0, -2, -4, -6, 0, -2, -4, -6};
 1685|       |        const uint8x8_t vrep = vld1_u8(rep4);
 1686|       |        const int8x8_t vsh = vld1_s8(sh2);
 1687|       |        const uint8x8_t vmask = vdup_n_u8(0x03);
 1688|       |        while (i + 8 <= n) {
 1689|       |            const uint16_t w = (uint16_t)((uint16_t)bits[(i * 2) >> 3] |
 1690|       |                                          ((uint16_t)bits[((i * 2) >> 3) + 1] << 8));
 1691|       |            const uint8x8_t raw = vreinterpret_u8_u16(vdup_n_u16(w));
 1692|       |            const uint8x8_t rep = vtbl1_u8(raw, vrep);
 1693|       |            const uint8x8_t codes = vand_u8(vshl_u8(rep, vsh), vmask);
 1694|       |            vst1_u8(out + i, vtbl1_u8(vc2s, codes));
 1695|       |            i += 8;
 1696|       |        }
 1697|       |    } else if (D == 3) {
 1698|       |        // 8 codes/step. 3-bit codes straddle bytes, so build a 16-bit window
 1699|       |        // {byte_j, byte_j+1} per lane via two VTBLs, then extract bits [s,s+3)
 1700|       |        // by multiply-by-2^(13-s) then >>13 - ARMv7 has no per-lane u16 variable
 1701|       |        // shift. 8 codes fit in 3 source bytes.
 1702|       |        const uint8x8_t vc2s = vld1_u8(c2s); /* 8 entries (2^3) */
 1703|       |        static const uint8_t idxlo[8] = {0, 1, 0, 1, 0, 1, 1, 2};
 1704|       |        static const uint8_t idxhi[8] = {1, 2, 1, 2, 2, 3, 2, 3};
 1705|       |        static const uint16_t mul8[8] = {8192, 1024, 128, 4096, 512, 64, 2048, 256};
 1706|       |        const uint8x8_t vidxlo = vld1_u8(idxlo);
 1707|       |        const uint8x8_t vidxhi = vld1_u8(idxhi);
 1708|       |        const uint16x8_t vmul = vld1q_u16(mul8);
 1709|       |        const uint16x8_t vmask = vdupq_n_u16(0x07);
 1710|       |        while (i + 8 <= n) {
 1711|       |            const size_t off = (i * 3) >> 3;
 1712|       |            const uint32_t w = (uint32_t)bits[off] | ((uint32_t)bits[off + 1] << 8) |
 1713|       |                               ((uint32_t)bits[off + 2] << 16); /* exactly 3 bytes */
 1714|       |            const uint8x8_t raw = vreinterpret_u8_u32(vdup_n_u32(w));
 1715|       |            const uint8x8_t wlo = vtbl1_u8(raw, vidxlo);
 1716|       |            const uint8x8_t whi = vtbl1_u8(raw, vidxhi);
 1717|       |            const uint16x8_t win = vreinterpretq_u16_u8(vcombine_u8(wlo, whi));
 1718|       |            const uint16x8_t codes16 = vandq_u16(vshrq_n_u16(vmulq_u16(win, vmul), 13), vmask);
 1719|       |            vst1_u8(out + i, vtbl1_u8(vc2s, vmovn_u16(codes16)));
 1720|       |            i += 8;
 1721|       |        }
 1722|       |    } else if (D == 4) {
 1723|       |        /* Register by register: GCC has no AArch32 vld1_u8_x2/_x4 before 14.
 1724|       |         * Loaded once per call, so the tuple form bought nothing anyway. */
 1725|       |        uint8x8x2_t vc2s;
 1726|       |        vc2s.val[0] = vld1_u8(c2s);
 1727|       |        vc2s.val[1] = vld1_u8(c2s + 8);
 1728|       |        static const uint8_t rep2[8] = {0, 0, 1, 1, 2, 2, 3, 3};
 1729|       |        static const int8_t sh4[8] = {0, -4, 0, -4, 0, -4, 0, -4};
 1730|       |        const uint8x8_t vrep = vld1_u8(rep2);
 1731|       |        const int8x8_t vsh = vld1_s8(sh4);
 1732|       |        const uint8x8_t vmask = vdup_n_u8(0x0F);
 1733|       |        while (i + 8 <= n) {
 1734|       |            uint32_t w;
 1735|       |            ZXC_MEMCPY(&w, bits + ((i * 4) >> 3), 4);
 1736|       |            const uint8x8_t raw = vreinterpret_u8_u32(vdup_n_u32(w));
 1737|       |            const uint8x8_t rep = vtbl1_u8(raw, vrep);
 1738|       |            const uint8x8_t codes = vand_u8(vshl_u8(rep, vsh), vmask);
 1739|       |            vst1_u8(out + i, vtbl2_u8(vc2s, codes));
 1740|       |            i += 8;
 1741|       |        }
 1742|       |    } else if (D == 5) {
 1743|       |        // Same window scheme as D=3; c2s has 32 entries (VTBL4). 5 source bytes.
 1744|       |        // Register by register: see D == 4.
 1745|       |        uint8x8x4_t vc2s;
 1746|       |        vc2s.val[0] = vld1_u8(c2s);
 1747|       |        vc2s.val[1] = vld1_u8(c2s + 8);
 1748|       |        vc2s.val[2] = vld1_u8(c2s + 16);
 1749|       |        vc2s.val[3] = vld1_u8(c2s + 24);
 1750|       |        static const uint8_t idxlo[8] = {0, 1, 0, 1, 1, 2, 1, 2};
 1751|       |        static const uint8_t idxhi[8] = {2, 3, 3, 4, 3, 4, 4, 5};
 1752|       |        static const uint16_t mul8[8] = {2048, 64, 512, 16, 128, 1024, 32, 256};
 1753|       |        const uint8x8_t vidxlo = vld1_u8(idxlo);
 1754|       |        const uint8x8_t vidxhi = vld1_u8(idxhi);
 1755|       |        const uint16x8_t vmul = vld1q_u16(mul8);
 1756|       |        const uint16x8_t vmask = vdupq_n_u16(0x1F);
 1757|       |        while (i + 8 <= n) {
 1758|       |            uint64_t w = 0;
 1759|       |            ZXC_MEMCPY(&w, bits + ((i * 5) >> 3), 5);
 1760|       |            const uint8x8_t raw = vcreate_u8(w);
 1761|       |            const uint16x8_t win =
 1762|       |                vreinterpretq_u16_u8(vcombine_u8(vtbl1_u8(raw, vidxlo), vtbl1_u8(raw, vidxhi)));
 1763|       |            const uint8x8_t codes =
 1764|       |                vmovn_u16(vandq_u16(vshrq_n_u16(vmulq_u16(win, vmul), 11), vmask));
 1765|       |            vst1_u8(out + i, vtbl4_u8(vc2s, codes));
 1766|       |            i += 8;
 1767|       |        }
 1768|       |    } else if (D == 6) {
 1769|       |        // Same window scheme; c2s has 64 entries: two VTBL4 halves, select by
 1770|       |        // code bit 5. 6 source bytes.
 1771|       |        uint8x8x4_t lo, hi;  // register by register: see D == 4
 1772|       |        lo.val[0] = vld1_u8(c2s);
 1773|       |        lo.val[1] = vld1_u8(c2s + 8);
 1774|       |        lo.val[2] = vld1_u8(c2s + 16);
 1775|       |        lo.val[3] = vld1_u8(c2s + 24);
 1776|       |        hi.val[0] = vld1_u8(c2s + 32);
 1777|       |        hi.val[1] = vld1_u8(c2s + 40);
 1778|       |        hi.val[2] = vld1_u8(c2s + 48);
 1779|       |        hi.val[3] = vld1_u8(c2s + 56);
 1780|       |        static const uint8_t idxlo[8] = {0, 1, 0, 1, 1, 2, 2, 3};
 1781|       |        static const uint8_t idxhi[8] = {3, 4, 3, 4, 4, 5, 5, 6};
 1782|       |        static const uint16_t mul8[8] = {1024, 16, 64, 256, 1024, 16, 64, 256};
 1783|       |        const uint8x8_t vidxlo = vld1_u8(idxlo);
 1784|       |        const uint8x8_t vidxhi = vld1_u8(idxhi);
 1785|       |        const uint16x8_t vmul = vld1q_u16(mul8);
 1786|       |        const uint16x8_t vmask = vdupq_n_u16(0x3F);
 1787|       |        while (i + 8 <= n) {
 1788|       |            uint64_t w = 0;
 1789|       |            ZXC_MEMCPY(&w, bits + ((i * 6) >> 3), 6);
 1790|       |            const uint8x8_t raw = vcreate_u8(w);
 1791|       |            const uint16x8_t win =
 1792|       |                vreinterpretq_u16_u8(vcombine_u8(vtbl1_u8(raw, vidxlo), vtbl1_u8(raw, vidxhi)));
 1793|       |            const uint8x8_t codes =
 1794|       |                vmovn_u16(vandq_u16(vshrq_n_u16(vmulq_u16(win, vmul), 10), vmask));
 1795|       |            const uint8x8_t sel =
 1796|       |                vbsl_u8(vcge_u8(codes, vdup_n_u8(32)), vtbl4_u8(hi, vsub_u8(codes, vdup_n_u8(32))),
 1797|       |                        vtbl4_u8(lo, codes));
 1798|       |            vst1_u8(out + i, sel);
 1799|       |            i += 8;
 1800|       |        }
 1801|       |    }
 1802|       |#elif defined(ZXC_USE_AVX512) || defined(ZXC_USE_AVX2) || \
 1803|       |    (defined(ZXC_USE_SSE2) && defined(__SSE4_1__))
 1804|       |#if defined(ZXC_USE_AVX512) && defined(__AVX512VBMI__)
 1805|       |    /* vpmultishiftqb reads an 8-bit field at an arbitrary bit offset: the
 1806|       |     * unaligned D-bit read, in one instruction. Two facts carry the rest -
 1807|       |     * 64 codes are exactly 8*D bytes and byte-aligned, so the tables are the
 1808|       |     * same every step; and only the low D bits of a field survive, so bytes
 1809|       |     * past 8*D are irrelevant and both accesses can be clamped to the run.
 1810|       |     * Clamping the store also ends the run, hence nothing narrower below. */
 1811|       |    if (D >= 2 && D <= 6) {
 1812|       |        uint8_t arr[64];
 1813|       |        uint8_t shf[64];
 1814|       |        for (int k = 0; k < 8; k++) {
 1815|       |            for (int j = 0; j < 8; j++) {
 1816|       |                arr[k * 8 + j] = (uint8_t)(k * D + j);
 1817|       |                shf[k * 8 + j] = (uint8_t)(j * D);
 1818|       |            }
 1819|       |        }
 1820|       |        const __m512i varr = _mm512_loadu_si512((const void*)arr);
 1821|       |        const __m512i vshf = _mm512_loadu_si512((const void*)shf);
 1822|       |        const __m512i vand = _mm512_set1_epi8((char)((1 << D) - 1));
 1823|       |        /* c2s holds 2^D entries and nothing is guaranteed past them. */
 1824|       |        const __mmask64 tm = (D == 6) ? ~(__mmask64)0 : (((__mmask64)1 << (1 << D)) - 1);
 1825|       |        const __m512i vc2s = _mm512_maskz_loadu_epi8(tm, (const void*)c2s);
 1826|       |        const size_t nbytes = zxc_pivco_run_bytes((uint32_t)n, (uint8_t)D);
 1827|       |        while (i < n) {
 1828|       |            const size_t off = ((size_t)i * (size_t)D) >> 3;
 1829|       |            const size_t avail = nbytes - off;
 1830|       |            const size_t left = n - i;
 1831|       |            const __mmask64 lm = (avail >= 64) ? ~(__mmask64)0 : (((__mmask64)1 << avail) - 1);
 1832|       |            const __mmask64 sm = (left >= 64) ? ~(__mmask64)0 : (((__mmask64)1 << left) - 1);
 1833|       |            const __m512i raw = _mm512_maskz_loadu_epi8(lm, (const void*)(bits + off));
 1834|       |            const __m512i q = _mm512_permutexvar_epi8(varr, raw);
 1835|       |            const __m512i codes = _mm512_and_si512(_mm512_multishift_epi64_epi8(vshf, q), vand);
 1836|       |            _mm512_mask_storeu_epi8((void*)(out + i), sm, _mm512_permutexvar_epi8(codes, vc2s));
 1837|       |            i += 64;
 1838|       |        }
 1839|       |        if (i > n) i = n;
 1840|       |    }
 1841|       |#else
 1842|       |#if defined(ZXC_USE_AVX2)
 1843|       |    /* Codes 16..31 start exactly 2*D bytes in, so the upper half runs the same
 1844|       |     * pattern over a shifted source: one shuffle vector serves both, and packus
 1845|       |     * leaves each half's codes in order in its own lane - no cross-lane fixup.
 1846|       |     * The bound keeps both 16-byte reads inside the run; the exact-length
 1847|       |     * 16-wide loops below take the tail. */
 1848|       |    if (D >= 2 && D <= 6) {
 1849|       |        uint8_t sa[16];
 1850|       |        uint8_t sb[16];
 1851|       |        uint16_t mu[8];
 1852|       |        for (int q = 0; q < 8; q++) {
 1853|       |            const int ba = (q * D) >> 3;
 1854|       |            sa[2 * q] = (uint8_t)ba;
 1855|       |            sa[2 * q + 1] = (uint8_t)(ba + 1);
 1856|       |            sb[2 * q] = (uint8_t)(ba + D); /* code q+8 sits D bytes further */
 1857|       |            sb[2 * q + 1] = (uint8_t)(ba + D + 1);
 1858|       |            mu[q] = (uint16_t)(1U << (16 - D - ((q * D) & 7)));
 1859|       |        }
 1860|       |        const __m256i vsa = _mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(void*)sa));
 1861|       |        const __m256i vsb = _mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(void*)sb));
 1862|       |        const __m256i vmu = _mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(void*)mu));
 1863|       |        const __m256i vand = _mm256_set1_epi8((char)((1 << D) - 1));
 1864|       |        uint8_t tab[64];
 1865|       |        for (int e = 0; e < 64; e++) tab[e] = c2s[e & ((1 << D) - 1)];
 1866|       |        const __m256i t0 = _mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(void*)tab));
 1867|       |        const __m256i t1 =
 1868|       |            _mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(void*)(tab + 16)));
 1869|       |        const __m256i t2 =
 1870|       |            _mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(void*)(tab + 32)));
 1871|       |        const __m256i t3 =
 1872|       |            _mm256_broadcastsi128_si256(_mm_loadu_si128((const __m128i*)(void*)(tab + 48)));
 1873|       |        const size_t nbytes = zxc_pivco_run_bytes((uint32_t)n, (uint8_t)D);
 1874|       |        while (i + 32 <= n && ((size_t)i * (size_t)D >> 3) + (size_t)(2 * D) + 16 <= nbytes) {
 1875|       |            const uint8_t* src = bits + ((size_t)i * (size_t)D >> 3);
 1876|       |            const __m256i raw = _mm256_inserti128_si256(
 1877|       |                _mm256_castsi128_si256(_mm_loadu_si128((const __m128i*)(const void*)src)),
 1878|       |                _mm_loadu_si128((const __m128i*)(const void*)(src + 2 * D)), 1);
 1879|       |            const __m256i ca =
 1880|       |                _mm256_srli_epi16(_mm256_mullo_epi16(_mm256_shuffle_epi8(raw, vsa), vmu), 16 - D);
 1881|       |            const __m256i cb =
 1882|       |                _mm256_srli_epi16(_mm256_mullo_epi16(_mm256_shuffle_epi8(raw, vsb), vmu), 16 - D);
 1883|       |            const __m256i codes = _mm256_and_si256(_mm256_packus_epi16(ca, cb), vand);
 1884|       |            __m256i sym;
 1885|       |            if (D <= 4) {
 1886|       |                sym = _mm256_shuffle_epi8(t0, codes);
 1887|       |            } else {
 1888|       |                const __m256i b4 = _mm256_slli_epi16(codes, 3); /* code bit 4 -> sign */
 1889|       |                const __m256i lo = _mm256_blendv_epi8(_mm256_shuffle_epi8(t0, codes),
 1890|       |                                                      _mm256_shuffle_epi8(t1, codes), b4);
 1891|       |                if (D == 5) {
 1892|       |                    sym = lo;
 1893|       |                } else {
 1894|       |                    const __m256i hi = _mm256_blendv_epi8(_mm256_shuffle_epi8(t2, codes),
 1895|       |                                                          _mm256_shuffle_epi8(t3, codes), b4);
 1896|       |                    sym = _mm256_blendv_epi8(lo, hi, _mm256_slli_epi16(codes, 2));
 1897|       |                }
 1898|       |            }
 1899|       |            _mm256_storeu_si256((__m256i*)(void*)(out + i), sym);
 1900|       |            i += 32;
 1901|       |        }
 1902|       |    }
 1903|       |#endif
 1904|       |    if (D == 4) {
 1905|       |        const __m128i vc2s = _mm_loadu_si128((const __m128i*)(const void*)c2s);
 1906|       |        const __m128i vrep = _mm_setr_epi8(0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7);
 1907|       |        const __m128i vmask = _mm_set1_epi8(0x0F);
 1908|       |        // even lanes keep low nibble, odd lanes take the high nibble: shift the
 1909|       |        // replicated bytes right by 4 via a 16-bit shift + odd-lane select.
 1910|       |        const __m128i vodd = _mm_set1_epi16(0x0F00 - 0x0F00 + (short)0xFF00);
 1911|       |        while (i + 16 <= n) {
 1912|       |            const __m128i raw =
 1913|       |                _mm_loadl_epi64((const __m128i*)(const void*)(bits + ((i * 4) >> 3)));
 1914|       |            const __m128i rep = _mm_shuffle_epi8(raw, vrep);
 1915|       |            const __m128i hi = _mm_and_si128(_mm_srli_epi16(rep, 4), _mm_set1_epi8(0x0F));
 1916|       |            const __m128i lo = _mm_and_si128(rep, vmask);
 1917|       |            const __m128i codes = _mm_blendv_epi8(lo, hi, vodd);
 1918|       |            _mm_storeu_si128((__m128i*)(void*)(out + i), _mm_shuffle_epi8(vc2s, codes));
 1919|       |            i += 16;
 1920|       |        }
 1921|       |    } else if (D == 2) {
 1922|       |        // 16 codes from 4 bytes. SSE has no per-lane byte shift, so shift by
 1923|       |        // multiply: (b << (6 - 2j)) >> 6 keeps bits [2j+1:2j]. Bytes spread to
 1924|       |        // u16 lanes, times {64,16,4,1}, shifted, then packed back.
 1925|       |        uint8_t c2s16[16];
 1926|       |        for (int k = 0; k < 16; k++) c2s16[k] = c2s[k & 3];
 1927|       |        const __m128i vc2s = _mm_loadu_si128((const __m128i*)(const void*)c2s16);
 1928|       |        const __m128i vspreadA =
 1929|       |            _mm_setr_epi8(0, (char)0x80, 0, (char)0x80, 0, (char)0x80, 0, (char)0x80, 1, (char)0x80,
 1930|       |                          1, (char)0x80, 1, (char)0x80, 1, (char)0x80);
 1931|       |        const __m128i vspreadB =
 1932|       |            _mm_setr_epi8(2, (char)0x80, 2, (char)0x80, 2, (char)0x80, 2, (char)0x80, 3, (char)0x80,
 1933|       |                          3, (char)0x80, 3, (char)0x80, 3, (char)0x80);
 1934|       |        const __m128i vmul = _mm_setr_epi16(64, 16, 4, 1, 64, 16, 4, 1);
 1935|       |        while (i + 16 <= n) {
 1936|       |            const __m128i raw = _mm_cvtsi32_si128(
 1937|       |                (int)((uint32_t)bits[(i * 2) >> 3] | ((uint32_t)bits[((i * 2) >> 3) + 1] << 8) |
 1938|       |                      ((uint32_t)bits[((i * 2) >> 3) + 2] << 16) |
 1939|       |                      ((uint32_t)bits[((i * 2) >> 3) + 3] << 24)));
 1940|       |            const __m128i a16 =
 1941|       |                _mm_srli_epi16(_mm_mullo_epi16(_mm_shuffle_epi8(raw, vspreadA), vmul), 6);
 1942|       |            const __m128i b16 =
 1943|       |                _mm_srli_epi16(_mm_mullo_epi16(_mm_shuffle_epi8(raw, vspreadB), vmul), 6);
 1944|       |            const __m128i codes = _mm_and_si128(_mm_packus_epi16(a16, b16), _mm_set1_epi8(3));
 1945|       |            _mm_storeu_si128((__m128i*)(void*)(out + i), _mm_shuffle_epi8(vc2s, codes));
 1946|       |            i += 16;
 1947|       |        }
 1948|       |    } else if (D == 3) {
 1949|       |        // 16-bit window {byte_j,byte_j+1} per lane (byte_j = Di>>3); SSE has no
 1950|       |        // per-lane u16 shift, so extract bits [s,s+D) of window w by w*2^(16-D-s)
 1951|       |        // (field lands in the top D bits) then >>(16-D); s_j = Dj&7. D=3: 6 bytes.
 1952|       |        uint8_t c2s16[16];
 1953|       |        for (int k = 0; k < 16; k++) c2s16[k] = c2s[k & 7];
 1954|       |        const __m128i vc2s = _mm_loadu_si128((const __m128i*)(const void*)c2s16);
 1955|       |        const __m128i shufA = _mm_setr_epi8(0, 1, 0, 1, 0, 1, 1, 2, 1, 2, 1, 2, 2, 3, 2, 3);
 1956|       |        const __m128i shufB = _mm_setr_epi8(3, 4, 3, 4, 3, 4, 4, 5, 4, 5, 4, 5, 5, 6, 5, 6);
 1957|       |        const __m128i vmul = _mm_setr_epi16(8192, 1024, 128, 4096, 512, 64, 2048, 256);
 1958|       |        while (i + 16 <= n) {
 1959|       |            const size_t off = (i * 3) >> 3;
 1960|       |            uint32_t w0;
 1961|       |            uint16_t w1;
 1962|       |            ZXC_MEMCPY(&w0, bits + off, 4);
 1963|       |            ZXC_MEMCPY(&w1, bits + off + 4, 2); /* exactly 6 bytes read */
 1964|       |            const __m128i raw = _mm_insert_epi16(_mm_cvtsi32_si128((int)w0), (int16_t)w1, 2);
 1965|       |            const __m128i cA =
 1966|       |                _mm_srli_epi16(_mm_mullo_epi16(_mm_shuffle_epi8(raw, shufA), vmul), 13);
 1967|       |            const __m128i cB =
 1968|       |                _mm_srli_epi16(_mm_mullo_epi16(_mm_shuffle_epi8(raw, shufB), vmul), 13);
 1969|       |            const __m128i codes = _mm_and_si128(_mm_packus_epi16(cA, cB), _mm_set1_epi8(7));
 1970|       |            _mm_storeu_si128((__m128i*)(void*)(out + i), _mm_shuffle_epi8(vc2s, codes));
 1971|       |            i += 16;
 1972|       |        }
 1973|       |    } else if (D == 5) {
 1974|       |        // c2s has 32 entries: pshufb does 16, so select lo/hi by code bit 4.
 1975|       |        const __m128i vlo = _mm_loadu_si128((const __m128i*)(const void*)c2s);
 1976|       |        const __m128i vhi = _mm_loadu_si128((const __m128i*)(const void*)(c2s + 16));
 1977|       |        const __m128i shufA = _mm_setr_epi8(0, 1, 0, 1, 1, 2, 1, 2, 2, 3, 3, 4, 3, 4, 4, 5);
 1978|       |        const __m128i shufB = _mm_setr_epi8(5, 6, 5, 6, 6, 7, 6, 7, 7, 8, 8, 9, 8, 9, 9, 10);
 1979|       |        const __m128i vmul = _mm_setr_epi16(2048, 64, 512, 16, 128, 1024, 32, 256);
 1980|       |        while (i + 16 <= n) {
 1981|       |            const size_t off = (i * 5) >> 3;
 1982|       |            uint16_t w1;
 1983|       |            ZXC_MEMCPY(&w1, bits + off + 8, 2); /* 10 source bytes */
 1984|       |            const __m128i raw = _mm_insert_epi16(
 1985|       |                _mm_loadl_epi64((const __m128i*)(const void*)(bits + off)), (int16_t)w1, 4);
 1986|       |            const __m128i cA =
 1987|       |                _mm_srli_epi16(_mm_mullo_epi16(_mm_shuffle_epi8(raw, shufA), vmul), 11);
 1988|       |            const __m128i cB =
 1989|       |                _mm_srli_epi16(_mm_mullo_epi16(_mm_shuffle_epi8(raw, shufB), vmul), 11);
 1990|       |            const __m128i codes = _mm_and_si128(_mm_packus_epi16(cA, cB), _mm_set1_epi8(0x1F));
 1991|       |            const __m128i sel =
 1992|       |                _mm_blendv_epi8(_mm_shuffle_epi8(vlo, codes), _mm_shuffle_epi8(vhi, codes),
 1993|       |                                _mm_slli_epi16(codes, 3));
 1994|       |            _mm_storeu_si128((__m128i*)(void*)(out + i), sel);
 1995|       |            i += 16;
 1996|       |        }
 1997|       |    } else if (D == 6) {
 1998|       |        // c2s has 64 entries: 4 pshufb sub-tables, select by code bits 4-5.
 1999|       |        const __m128i t0 = _mm_loadu_si128((const __m128i*)(const void*)c2s);
 2000|       |        const __m128i t1 = _mm_loadu_si128((const __m128i*)(const void*)(c2s + 16));
 2001|       |        const __m128i t2 = _mm_loadu_si128((const __m128i*)(const void*)(c2s + 32));
 2002|       |        const __m128i t3 = _mm_loadu_si128((const __m128i*)(const void*)(c2s + 48));
 2003|       |        const __m128i shufA = _mm_setr_epi8(0, 1, 0, 1, 1, 2, 2, 3, 3, 4, 3, 4, 4, 5, 5, 6);
 2004|       |        const __m128i shufB = _mm_setr_epi8(6, 7, 6, 7, 7, 8, 8, 9, 9, 10, 9, 10, 10, 11, 11, 12);
 2005|       |        const __m128i vmul = _mm_setr_epi16(1024, 16, 64, 256, 1024, 16, 64, 256);
 2006|       |        while (i + 16 <= n) {
 2007|       |            const size_t off = (i * 6) >> 3;
 2008|       |            uint32_t w1;
 2009|       |            ZXC_MEMCPY(&w1, bits + off + 8, 4); /* 12 source bytes */
 2010|       |            const __m128i raw = _mm_insert_epi32(
 2011|       |                _mm_loadl_epi64((const __m128i*)(const void*)(bits + off)), (int)w1, 2);
 2012|       |            const __m128i cA =
 2013|       |                _mm_srli_epi16(_mm_mullo_epi16(_mm_shuffle_epi8(raw, shufA), vmul), 10);
 2014|       |            const __m128i cB =
 2015|       |                _mm_srli_epi16(_mm_mullo_epi16(_mm_shuffle_epi8(raw, shufB), vmul), 10);
 2016|       |            const __m128i codes = _mm_and_si128(_mm_packus_epi16(cA, cB), _mm_set1_epi8(0x3F));
 2017|       |            const __m128i m4 = _mm_slli_epi16(codes, 3);
 2018|       |            const __m128i lo =
 2019|       |                _mm_blendv_epi8(_mm_shuffle_epi8(t0, codes), _mm_shuffle_epi8(t1, codes), m4);
 2020|       |            const __m128i hi =
 2021|       |                _mm_blendv_epi8(_mm_shuffle_epi8(t2, codes), _mm_shuffle_epi8(t3, codes), m4);
 2022|       |            _mm_storeu_si128((__m128i*)(void*)(out + i),
 2023|       |                             _mm_blendv_epi8(lo, hi, _mm_slli_epi16(codes, 2)));
 2024|       |            i += 16;
 2025|       |        }
 2026|       |    }
 2027|       |#endif /* AVX-512 VBMI, else AVX2 + SSE */
 2028|       |#endif
 2029|       |    // Generic scalar bit-reader (any D).
 2030|  66.1k|    {
 2031|  66.1k|        uint64_t bitpos = i * (uint64_t)D;
 2032|  66.1k|        const uint32_t m = (1U << D) - 1U;
 2033|  66.1k|        const size_t fbytes = (size_t)(((uint64_t)n * (uint64_t)D + 7U) >> 3);
 2034|  52.4M|        while (i < n) {
  ------------------
  |  Branch (2034:16): [True: 52.4M, False: 66.1k]
  ------------------
 2035|  52.4M|            const size_t byte = (size_t)(bitpos >> 3);
 2036|  52.4M|            uint32_t w = bits[byte];
 2037|  52.4M|            if (byte + 1 < fbytes) w |= (uint32_t)bits[byte + 1] << 8;
  ------------------
  |  Branch (2037:17): [True: 52.3M, False: 99.1k]
  ------------------
 2038|  52.4M|            if (D > 8 && byte + 2 < fbytes) w |= (uint32_t)bits[byte + 2] << 16;
  ------------------
  |  Branch (2038:17): [True: 0, False: 52.4M]
  |  Branch (2038:26): [True: 0, False: 0]
  ------------------
 2039|  52.4M|            out[i++] = c2s[(w >> (bitpos & 7U)) & m];
 2040|  52.4M|            bitpos += (uint64_t)D;
 2041|  52.4M|        }
 2042|  66.1k|    }
 2043|  66.1k|}
zxc_huffman.c:zxc_pivco_emit_leaf_pair:
 2055|  26.9k|                                                       const uint8_t* RESTRICT bits) {
 2056|  26.9k|    size_t i = 0;
 2057|       |#if defined(ZXC_USE_NEON64)
 2058|       |    const uint8x16_t vsym0 = vdupq_n_u8(sym0);
 2059|       |    const uint8x16_t vdelta = vdupq_n_u8((uint8_t)(sym0 ^ sym1));
 2060|       |    static const uint8_t rep_idx[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
 2061|       |    static const uint8_t bit_sel[16] = {1, 2, 4, 8, 16, 32, 64, 128, 1, 2, 4, 8, 16, 32, 64, 128};
 2062|       |    const uint8x16_t vrep = vld1q_u8(rep_idx);
 2063|       |    const uint8x16_t vsel = vld1q_u8(bit_sel);
 2064|       |    while (i + 16 <= n) {
 2065|       |        uint8x16_t ctrl = vdupq_n_u8(0);
 2066|       |        ctrl = vsetq_lane_u8(bits[i >> 3], ctrl, 0);
 2067|       |        ctrl = vsetq_lane_u8(bits[(i >> 3) + 1], ctrl, 1);
 2068|       |        const uint8x16_t rep = vqtbl1q_u8(ctrl, vrep);
 2069|       |        const uint8x16_t mask = vtstq_u8(rep, vsel);
 2070|       |        vst1q_u8(out + i, veorq_u8(vsym0, vandq_u8(vdelta, mask)));
 2071|       |        i += 16;
 2072|       |    }
 2073|       |#elif defined(ZXC_USE_NEON32)
 2074|       |    const uint8x8_t vsym0 = vdup_n_u8(sym0);
 2075|       |    const uint8x8_t vdelta = vdup_n_u8((uint8_t)(sym0 ^ sym1));
 2076|       |    static const uint8_t bit_sel8[8] = {1, 2, 4, 8, 16, 32, 64, 128};
 2077|       |    const uint8x8_t vsel = vld1_u8(bit_sel8);
 2078|       |    while (i + 8 <= n) {
 2079|       |        const uint8x8_t mask = vtst_u8(vdup_n_u8(bits[i >> 3]), vsel);
 2080|       |        vst1_u8(out + i, veor_u8(vsym0, vand_u8(vdelta, mask)));
 2081|       |        i += 8;
 2082|       |    }
 2083|       |#elif defined(ZXC_USE_AVX512) || defined(ZXC_USE_AVX2) || \
 2084|       |    (defined(ZXC_USE_SSE2) && defined(__SSSE3__))
 2085|       |#if defined(ZXC_USE_AVX512)
 2086|       |    /* The control word is already the blend mask; the masked store takes the
 2087|       |     * tail, hence nothing narrower below. */
 2088|       |    {
 2089|       |        const __m512i z0 = _mm512_set1_epi8((char)sym0);
 2090|       |        const __m512i z1 = _mm512_set1_epi8((char)sym1);
 2091|       |        while (i < n) {
 2092|       |            const size_t left = n - i;
 2093|       |            const size_t cb = (left + 7) >> 3;
 2094|       |            uint64_t ctrl = 0;
 2095|       |            ZXC_MEMCPY(&ctrl, bits + (i >> 3), cb < 8 ? cb : 8); /* not past the run */
 2096|       |            const __mmask64 sm = (left >= 64) ? ~(__mmask64)0 : (((__mmask64)1 << left) - 1);
 2097|       |            _mm512_mask_storeu_epi8((void*)(out + i), sm,
 2098|       |                                    _mm512_mask_blend_epi8((__mmask64)ctrl, z0, z1));
 2099|       |            i += 64;
 2100|       |        }
 2101|       |        if (i > n) i = n;
 2102|       |    }
 2103|       |#else
 2104|       |#if defined(ZXC_USE_AVX2)
 2105|       |    /* Broadcasting the control dword lets each 128-bit half pick its own two
 2106|       |     * bytes out of it. */
 2107|       |    {
 2108|       |        const __m256i y0 = _mm256_set1_epi8((char)sym0);
 2109|       |        const __m256i ydelta = _mm256_set1_epi8((char)(uint8_t)(sym0 ^ sym1));
 2110|       |        const __m256i yrep = _mm256_setr_epi8(0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
 2111|       |                                              2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3);
 2112|       |        const __m256i ysel =
 2113|       |            _mm256_setr_epi8(1, 2, 4, 8, 16, 32, 64, (char)128, 1, 2, 4, 8, 16, 32, 64, (char)128,
 2114|       |                             1, 2, 4, 8, 16, 32, 64, (char)128, 1, 2, 4, 8, 16, 32, 64, (char)128);
 2115|       |        while (i + 32 <= n) {
 2116|       |            uint32_t c4;
 2117|       |            ZXC_MEMCPY(&c4, bits + (i >> 3), 4);
 2118|       |            const __m256i rep = _mm256_shuffle_epi8(_mm256_set1_epi32((int)c4), yrep);
 2119|       |            const __m256i mask = _mm256_cmpeq_epi8(_mm256_and_si256(rep, ysel), ysel);
 2120|       |            _mm256_storeu_si256((__m256i*)(void*)(out + i),
 2121|       |                                _mm256_xor_si256(y0, _mm256_and_si256(ydelta, mask)));
 2122|       |            i += 32;
 2123|       |        }
 2124|       |    }
 2125|       |#endif
 2126|       |    const __m128i vsym0 = _mm_set1_epi8((char)sym0);
 2127|       |    const __m128i vdelta = _mm_set1_epi8((char)(uint8_t)(sym0 ^ sym1));
 2128|       |    const __m128i vrep = _mm_setr_epi8(0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1);
 2129|       |    const __m128i vsel =
 2130|       |        _mm_setr_epi8(1, 2, 4, 8, 16, 32, 64, (char)128, 1, 2, 4, 8, 16, 32, 64, (char)128);
 2131|       |    while (i + 16 <= n) {
 2132|       |        const __m128i ctrl = _mm_cvtsi32_si128(bits[i >> 3] | ((int)bits[(i >> 3) + 1] << 8));
 2133|       |        const __m128i rep = _mm_shuffle_epi8(ctrl, vrep);
 2134|       |        // lanes where the selected bit is set -> 0xFF
 2135|       |        const __m128i mask = _mm_cmpeq_epi8(_mm_and_si128(rep, vsel), vsel);
 2136|       |        _mm_storeu_si128((__m128i*)(void*)(out + i),
 2137|       |                         _mm_xor_si128(vsym0, _mm_and_si128(vdelta, mask)));
 2138|       |        i += 16;
 2139|       |    }
 2140|       |#endif /* AVX-512, else AVX2 + SSE */
 2141|       |#endif
 2142|  6.14M|    while (i < n) {
  ------------------
  |  Branch (2142:12): [True: 6.11M, False: 26.9k]
  ------------------
 2143|  6.11M|        const int bit = (bits[i >> 3] >> (i & 7)) & 1;
 2144|  6.11M|        out[i++] = bit ? sym1 : sym0;
  ------------------
  |  Branch (2144:20): [True: 2.88M, False: 3.22M]
  ------------------
 2145|  6.11M|    }
 2146|  26.9k|}
zxc_huffman.c:zxc_pivco_merge:
 1378|  96.0k|                                              const uint8_t* RESTRICT bits) {
 1379|  96.0k|    const uint8_t* L = src;
 1380|  96.0k|    const uint8_t* R = src + nl;
 1381|  96.0k|    const size_t n = nl + nr;
 1382|  96.0k|    size_t i = 0;
 1383|  96.0k|    size_t lp = 0;
 1384|  96.0k|    size_t rp = 0;
 1385|       |#if defined(ZXC_USE_NEON64)
 1386|       |    // 16 outputs per step: two-register TBL over {L[0..15], R[0..15]} with the
 1387|       |    // signed-index tables (see zxc_pivco_tables.h).
 1388|       |    while (i + 16 <= n) {
 1389|       |        const uint8_t b0 = bits[i >> 3];
 1390|       |        const uint8_t b1 = bits[(i >> 3) + 1];
 1391|       |        uint8x16x2_t tb;
 1392|       |        tb.val[0] = vld1q_u8(L + lp);
 1393|       |        tb.val[1] = vld1q_u8(R + rp);
 1394|       |        const int pc0 = zxc_pivco_popcnt32(b0);
 1395|       |        const uint8x8_t ia = vld1_u8(zxc_pivco_idxa_u8[b0]);
 1396|       |        const uint8x8_t ib = vld1_u8(zxc_pivco_idxb_pre[pc0][b1]);
 1397|       |        vst1q_u8(out + i, vqtbl2q_u8(tb, vcombine_u8(ia, ib)));
 1398|       |        const int pc = pc0 + zxc_pivco_popcnt32(b1);
 1399|       |        ZXC_PIVCO_MERGE_STEP(16, pc);
 1400|       |    }
 1401|       |#else /* x86 tiers */
 1402|       |#if defined(ZXC_USE_AVX512) && defined(__AVX512VBMI2__)
 1403|       |    // 64 outputs per step: the merge IS a pair of byte expands - L's bytes fill
 1404|       |    // the control word's 0-bit lanes, R's the 1-bit lanes. The masked expand
 1405|       |    // loads only touch the bytes they consume, so the speculative reads stay
 1406|       |    // fault-safe without extra buffer slack.
 1407|       |    const __m512i zero = _mm512_setzero_si512();
 1408|       |    while (i + 64 <= n) {
 1409|       |        uint64_t ctrl;
 1410|       |        ZXC_MEMCPY(&ctrl, bits + (i >> 3), 8);
 1411|       |        const __m512i vl =
 1412|       |            _mm512_mask_expandloadu_epi8(zero, (__mmask64)~ctrl, (const void*)(L + lp));
 1413|       |        const __m512i outv =
 1414|       |            _mm512_mask_expandloadu_epi8(vl, (__mmask64)ctrl, (const void*)(R + rp));
 1415|       |        _mm512_storeu_si512((void*)(out + i), outv);
 1416|       |        const int pc = zxc_pivco_popcnt64(ctrl);
 1417|       |        ZXC_PIVCO_MERGE_STEP(64, pc);
 1418|       |    }
 1419|       |#endif
 1420|       |#if defined(ZXC_USE_AVX512) || defined(ZXC_USE_AVX2) || \
 1421|       |    (defined(ZXC_USE_SSE2) && defined(__SSSE3__))
 1422|       |    // 16 outputs/step: pshufb(L, ix+0x70) | pshufb(R, ix-16) selects L[ix] or
 1423|       |    // R[ix-16] (out-of-range lanes zero out); 32/step unrolls it twice.
 1424|       |#if defined(ZXC_USE_AVX2)
 1425|       |    // Same thing at 256 bits, 32 outputs/step. Both selects take the index
 1426|       |    // unbiased: table lanes all sit in [0, 31], so pshufb masks to 4 bits and
 1427|       |    // bit 4 is the L/R selector - shifted into the sign it drives the blend,
 1428|       |    // and both bias vectors go away. L and R stay two 128-bit loads: the
 1429|       |    // second cursor is lp + (16 - pcA), never lp + 16.
 1430|       |    while (i + 32 <= n) {
 1431|       |        const uint8_t* cb = bits + (i >> 3);
 1432|       |        const int pcA0 = zxc_pivco_popcnt32(cb[0]);
 1433|       |        const int pcA = pcA0 + zxc_pivco_popcnt32(cb[1]);
 1434|       |        const int pcB0 = zxc_pivco_popcnt32(cb[2]);
 1435|       |        const int pcB = pcB0 + zxc_pivco_popcnt32(cb[3]);
 1436|       |        const size_t lpB = lp + (size_t)(16 - pcA);
 1437|       |        const size_t rpB = rp + (size_t)pcA;
 1438|       |        const __m256i vl = _mm256_inserti128_si256(
 1439|       |            _mm256_castsi128_si256(_mm_loadu_si128((const __m128i*)(const void*)(L + lp))),
 1440|       |            _mm_loadu_si128((const __m128i*)(const void*)(L + lpB)), 1);
 1441|       |        const __m256i vr = _mm256_inserti128_si256(
 1442|       |            _mm256_castsi128_si256(_mm_loadu_si128((const __m128i*)(const void*)(R + rp))),
 1443|       |            _mm_loadu_si128((const __m128i*)(const void*)(R + rpB)), 1);
 1444|       |        const __m128i ixA = _mm_unpacklo_epi64(
 1445|       |            _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxa_u8[cb[0]]),
 1446|       |            _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxb_pre[pcA0][cb[1]]));
 1447|       |        const __m128i ixB = _mm_unpacklo_epi64(
 1448|       |            _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxa_u8[cb[2]]),
 1449|       |            _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxb_pre[pcB0][cb[3]]));
 1450|       |        const __m256i ix = _mm256_inserti128_si256(_mm256_castsi128_si256(ixA), ixB, 1);
 1451|       |        _mm256_storeu_si256(
 1452|       |            (__m256i*)(void*)(out + i),
 1453|       |            _mm256_blendv_epi8(_mm256_shuffle_epi8(vl, ix), _mm256_shuffle_epi8(vr, ix),
 1454|       |                               _mm256_slli_epi16(ix, 3)));
 1455|       |        lp = lpB + (size_t)(16 - pcB);
 1456|       |        rp = rpB + (size_t)pcB;
 1457|       |        i += 32;
 1458|       |    }
 1459|       |#else
 1460|       |    while (i + 32 <= n) {
 1461|       |        const uint8_t* cb = bits + (i >> 3);
 1462|       |        const int pcA0 = zxc_pivco_popcnt32(cb[0]);
 1463|       |        const int pcA = pcA0 + zxc_pivco_popcnt32(cb[1]);
 1464|       |        const int pcB0 = zxc_pivco_popcnt32(cb[2]);
 1465|       |        const int pcB = pcB0 + zxc_pivco_popcnt32(cb[3]);
 1466|       |        const size_t lpB = lp + (size_t)(16 - pcA);
 1467|       |        const size_t rpB = rp + (size_t)pcA;
 1468|       |        const __m128i vlA = _mm_loadu_si128((const __m128i*)(const void*)(L + lp));
 1469|       |        const __m128i vrA = _mm_loadu_si128((const __m128i*)(const void*)(R + rp));
 1470|       |        const __m128i vlB = _mm_loadu_si128((const __m128i*)(const void*)(L + lpB));
 1471|       |        const __m128i vrB = _mm_loadu_si128((const __m128i*)(const void*)(R + rpB));
 1472|       |        const __m128i iaA = _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxa_u8[cb[0]]);
 1473|       |        const __m128i ibA =
 1474|       |            _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxb_pre[pcA0][cb[1]]);
 1475|       |        const __m128i iaB = _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxa_u8[cb[2]]);
 1476|       |        const __m128i ibB =
 1477|       |            _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxb_pre[pcB0][cb[3]]);
 1478|       |        const __m128i ixA = _mm_unpacklo_epi64(iaA, ibA);
 1479|       |        const __m128i ixB = _mm_unpacklo_epi64(iaB, ibB);
 1480|       |        const __m128i selA =
 1481|       |            _mm_or_si128(_mm_shuffle_epi8(vlA, _mm_add_epi8(ixA, _mm_set1_epi8(0x70))),
 1482|       |                         _mm_shuffle_epi8(vrA, _mm_sub_epi8(ixA, _mm_set1_epi8(16))));
 1483|       |        const __m128i selB =
 1484|       |            _mm_or_si128(_mm_shuffle_epi8(vlB, _mm_add_epi8(ixB, _mm_set1_epi8(0x70))),
 1485|       |                         _mm_shuffle_epi8(vrB, _mm_sub_epi8(ixB, _mm_set1_epi8(16))));
 1486|       |        _mm_storeu_si128((__m128i*)(void*)(out + i), selA);
 1487|       |        _mm_storeu_si128((__m128i*)(void*)(out + i + 16), selB);
 1488|       |        lp = lpB + (size_t)(16 - pcB);
 1489|       |        rp = rpB + (size_t)pcB;
 1490|       |        i += 32;
 1491|       |    }
 1492|       |#endif
 1493|       |    while (i + 16 <= n) {
 1494|       |        const uint8_t b0 = bits[i >> 3];
 1495|       |        const uint8_t b1 = bits[(i >> 3) + 1];
 1496|       |        const __m128i vl = _mm_loadu_si128((const __m128i*)(const void*)(L + lp));
 1497|       |        const __m128i vr = _mm_loadu_si128((const __m128i*)(const void*)(R + rp));
 1498|       |        const int pc0 = zxc_pivco_popcnt32(b0);
 1499|       |        const __m128i ia = _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxa_u8[b0]);
 1500|       |        const __m128i ib =
 1501|       |            _mm_loadl_epi64((const __m128i*)(const void*)zxc_pivco_idxb_pre[pc0][b1]);
 1502|       |        const __m128i ix = _mm_unpacklo_epi64(ia, ib);
 1503|       |        const __m128i sell = _mm_shuffle_epi8(vl, _mm_add_epi8(ix, _mm_set1_epi8(0x70)));
 1504|       |        const __m128i selr = _mm_shuffle_epi8(vr, _mm_sub_epi8(ix, _mm_set1_epi8(16)));
 1505|       |        _mm_storeu_si128((__m128i*)(void*)(out + i), _mm_or_si128(sell, selr));
 1506|       |        const int pc = pc0 + zxc_pivco_popcnt32(b1);
 1507|       |        ZXC_PIVCO_MERGE_STEP(16, pc);
 1508|       |    }
 1509|       |#elif defined(ZXC_USE_NEON32)
 1510|       |    // 8 outputs per step: four-register VTBL over {L[0..7], -, R[0..7], -}. The
 1511|       |    // shared index tables address a 32-lane view, and an 8-output step only
 1512|       |    // touches lanes 0..7 and 16..23, so the two spare d-registers stay zero.
 1513|       |    while (i + 8 <= n) {
 1514|       |        const uint8_t b = bits[i >> 3];
 1515|       |        uint8x8x4_t tb;
 1516|       |        tb.val[0] = vld1_u8(L + lp);
 1517|       |        tb.val[1] = vdup_n_u8(0);
 1518|       |        tb.val[2] = vld1_u8(R + rp);
 1519|       |        tb.val[3] = vdup_n_u8(0);
 1520|       |        vst1_u8(out + i, vtbl4_u8(tb, vld1_u8(zxc_pivco_idxa_u8[b])));
 1521|       |        const int pc = zxc_pivco_popcnt32(b);
 1522|       |        ZXC_PIVCO_MERGE_STEP(8, pc);
 1523|       |    }
 1524|       |#endif
 1525|  96.0k|#endif /* x86 tiers */
 1526|       |    // Portable 8-output path: byte selects from a 24-byte scratch laid out
 1527|       |    // as the low half of the 32-lane view the shared index tables assume
 1528|       |    // (L at offset 0, R at offset 16).
 1529|  25.2M|    while (i + 8 <= n) {
  ------------------
  |  Branch (1529:12): [True: 25.1M, False: 96.0k]
  ------------------
 1530|  25.1M|        const uint8_t b = bits[i >> 3];
 1531|  25.1M|        uint8_t comb[24];
 1532|  25.1M|        ZXC_MEMCPY(comb, L + lp, 8);
  ------------------
  |  |  170|  25.1M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1533|  25.1M|        ZXC_MEMCPY(comb + 16, R + rp, 8);
  ------------------
  |  |  170|  25.1M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1534|  25.1M|        const uint8_t* ix = zxc_pivco_idxa_u8[b];
 1535|   226M|        for (int j = 0; j < 8; j++) out[i + (size_t)j] = comb[ix[j]];
  ------------------
  |  Branch (1535:25): [True: 201M, False: 25.1M]
  ------------------
 1536|  25.1M|        const int pc = zxc_pivco_popcnt32(b);
 1537|  25.1M|        ZXC_PIVCO_MERGE_STEP(8, pc);
  ------------------
  |  | 1361|  25.1M|    do {                            \
  |  | 1362|  25.1M|        rp += (size_t)(pc);         \
  |  | 1363|  25.1M|        lp += (size_t)((w) - (pc)); \
  |  | 1364|  25.1M|        i += (w);                   \
  |  | 1365|  25.1M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1365:14): [Folded, False: 25.1M]
  |  |  ------------------
  ------------------
 1538|  25.1M|    }
 1539|   428k|    while (i < n) {
  ------------------
  |  Branch (1539:12): [True: 332k, False: 96.0k]
  ------------------
 1540|   332k|        const int bit = (bits[i >> 3] >> (i & 7)) & 1;
 1541|   332k|        out[i++] = bit ? R[rp++] : L[lp++];
  ------------------
  |  Branch (1541:20): [True: 172k, False: 160k]
  ------------------
 1542|   332k|    }
 1543|  96.0k|}

zxc_common.c:zxc_opt_dp_sizes:
 1101|  10.2k|                                               size_t* RESTRICT sz_bm) {
 1102|  10.2k|    *sz_dp = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint32_t));
  ------------------
  |  |  373|  10.2k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  10.2k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  10.2k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  10.2k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  10.2k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1103|  10.2k|    *sz_pl = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint16_t));
  ------------------
  |  |  373|  10.2k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  10.2k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  10.2k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  10.2k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  10.2k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1104|  10.2k|    *sz_po = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint16_t));
  ------------------
  |  |  373|  10.2k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  10.2k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  10.2k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  10.2k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  10.2k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1105|  10.2k|    *sz_bm = ZXC_ALIGN_CL(ZXC_BITMAP_WORDS(chunk_size + 1) * sizeof(uint64_t));
  ------------------
  |  |  373|  10.2k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  10.2k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  10.2k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  10.2k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  10.2k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1106|  10.2k|}
zxc_common.c:zxc_log2_u32:
 1117|   105k|static ZXC_ALWAYS_INLINE uint32_t zxc_log2_u32(const uint32_t v) {
 1118|       |#ifdef _MSC_VER
 1119|       |    unsigned long index;
 1120|       |    return (v == 0) ? 0 : (_BitScanReverse(&index, v) ? index : 0);
 1121|       |#else
 1122|   105k|    return (v == 0) ? 0 : (uint32_t)(31 - __builtin_clz(v));
  ------------------
  |  Branch (1122:12): [True: 0, False: 105k]
  ------------------
 1123|   105k|#endif
 1124|   105k|}
zxc_common.c:zxc_store_le32:
 1456|  58.6k|static ZXC_ALWAYS_INLINE void zxc_store_le32(void* p, const uint32_t v) {
 1457|       |#ifdef ZXC_BIG_ENDIAN
 1458|       |    const uint32_t s = ZXC_BSWAP32(v);
 1459|       |    ZXC_MEMCPY(p, &s, sizeof(s));
 1460|       |#else
 1461|  58.6k|    ZXC_MEMCPY(p, &v, sizeof(v));
  ------------------
  |  |  170|  58.6k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1462|  58.6k|#endif
 1463|  58.6k|}
zxc_common.c:zxc_le32:
 1356|   233k|static ZXC_ALWAYS_INLINE uint32_t zxc_le32(const void* p) {
 1357|   233k|    uint32_t v;
 1358|   233k|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  170|   233k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1359|       |#ifdef ZXC_BIG_ENDIAN
 1360|       |    return ZXC_BSWAP32(v);
 1361|       |#else
 1362|   233k|    return v;
 1363|   233k|#endif
 1364|   233k|}
zxc_common.c:zxc_le64:
 1419|  21.5k|static ZXC_ALWAYS_INLINE uint64_t zxc_le64(const void* p) {
 1420|  21.5k|    uint64_t v;
 1421|  21.5k|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  170|  21.5k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1422|       |#ifdef ZXC_BIG_ENDIAN
 1423|       |    return ZXC_BSWAP64(v);
 1424|       |#else
 1425|  21.5k|    return v;
 1426|  21.5k|#endif
 1427|  21.5k|}
zxc_common.c:zxc_hash8:
 1495|  21.5k|static ZXC_ALWAYS_INLINE uint8_t zxc_hash8(const uint8_t* p) {
 1496|  21.5k|    const uint64_t h = (zxc_le64(p) ^ ZXC_HASH_GOLDEN64) * ZXC_HASH_GOLDEN64;
  ------------------
  |  |  749|  21.5k|#define ZXC_HASH_GOLDEN64 0x9E3779B97F4A7C15ULL
  ------------------
                  const uint64_t h = (zxc_le64(p) ^ ZXC_HASH_GOLDEN64) * ZXC_HASH_GOLDEN64;
  ------------------
  |  |  749|  21.5k|#define ZXC_HASH_GOLDEN64 0x9E3779B97F4A7C15ULL
  ------------------
 1497|       |
 1498|  21.5k|    return (uint8_t)(h >> 56);
 1499|  21.5k|}
zxc_compress.c:zxc_get_lz77_params:
 1221|  20.4k|static ZXC_ALWAYS_INLINE zxc_lz77_params_t zxc_get_lz77_params(const int level) {
 1222|       |    // The distance floor stops at level 5: the slow levels keep every distance.
 1223|       |    // Match splitting at levels 3-5 only: 1-2 are PAK, 6-7 keep every escape.
 1224|       |    // search_depth, sufficient_len, use_lazy, lazy_attempts, lazy_len_threshold, step_base,
 1225|       |    // step_shift, min_offset, split_max
 1226|  20.4k|    static const zxc_lz77_params_t table[7] = {
 1227|  20.4k|        {3, 16, 0, 0, 0, 4, 4, ZXC_LZ_MINDIST, 0},        // fallback
  ------------------
  |  |  697|  20.4k|#define ZXC_LZ_MINDIST 32
  ------------------
 1228|  20.4k|        {3, 16, 0, 0, 0, 4, 4, ZXC_LZ_MINDIST, 0},        // level 1
  ------------------
  |  |  697|  20.4k|#define ZXC_LZ_MINDIST 32
  ------------------
 1229|  20.4k|        {3, 18, 0, 0, 0, 3, 6, ZXC_LZ_MINDIST, 0},        // level 2
  ------------------
  |  |  697|  20.4k|#define ZXC_LZ_MINDIST 32
  ------------------
 1230|  20.4k|        {3, 16, 1, 4, 128, 1, 4, ZXC_LZ_MINDIST, 33},     // level 3
  ------------------
  |  |  697|  20.4k|#define ZXC_LZ_MINDIST 32
  ------------------
 1231|  20.4k|        {3, 18, 1, 4, 128, 1, 5, ZXC_LZ_MINDIST, 24},     // level 4
  ------------------
  |  |  697|  20.4k|#define ZXC_LZ_MINDIST 32
  ------------------
 1232|  20.4k|        {64, 256, 1, 16, 128, 1, 8, ZXC_LZ_MINDIST, 23},  // level 5
  ------------------
  |  |  697|  20.4k|#define ZXC_LZ_MINDIST 32
  ------------------
 1233|  20.4k|        {64, 256, 0, 0, 0, 1, 8, 1, 0}                    // level 6
 1234|  20.4k|    };
 1235|  20.4k|    return (level >= ZXC_LEVEL_ULTRA)
  ------------------
  |  Branch (1235:12): [True: 8.06k, False: 12.4k]
  ------------------
 1236|  20.4k|               ? (zxc_lz77_params_t){128, 256, 0, 0, 0, 1, 8, 1, 0}
 1237|  20.4k|               : table[level < ZXC_LEVEL_FASTEST ? ZXC_LEVEL_FASTEST : level];
  ------------------
  |  Branch (1237:24): [True: 0, False: 12.4k]
  ------------------
 1238|  20.4k|}
zxc_compress.c:zxc_block_is_short_dist_bound:
 1379|  10.1k|                                                           const size_t size) {
 1380|  10.1k|    const size_t d_max = ZXC_LZ_MINDIST;
  ------------------
  |  |  697|  10.1k|#define ZXC_LZ_MINDIST 32
  ------------------
 1381|       |    // Too small to sample, and too small to gain: keep every distance.
 1382|  10.1k|    if (size < d_max + sizeof(uint32_t)) return 1;
  ------------------
  |  Branch (1382:9): [True: 1.69k, False: 8.47k]
  ------------------
 1383|       |
 1384|  8.47k|    size_t want = size / ZXC_LZ_MINDIST_PROBE_PER_KB;
  ------------------
  |  |  704|  8.47k|#define ZXC_LZ_MINDIST_PROBE_PER_KB 1024
  ------------------
 1385|  8.47k|    if (want < ZXC_LZ_MINDIST_PROBE_MIN) want = ZXC_LZ_MINDIST_PROBE_MIN;
  ------------------
  |  |  705|  8.47k|#define ZXC_LZ_MINDIST_PROBE_MIN 16
  ------------------
                  if (want < ZXC_LZ_MINDIST_PROBE_MIN) want = ZXC_LZ_MINDIST_PROBE_MIN;
  ------------------
  |  |  705|  7.73k|#define ZXC_LZ_MINDIST_PROBE_MIN 16
  ------------------
  |  Branch (1385:9): [True: 7.73k, False: 739]
  ------------------
 1386|  8.47k|    if (want > ZXC_LZ_MINDIST_PROBE_MAX) want = ZXC_LZ_MINDIST_PROBE_MAX;
  ------------------
  |  |  706|  8.47k|#define ZXC_LZ_MINDIST_PROBE_MAX 64
  ------------------
                  if (want > ZXC_LZ_MINDIST_PROBE_MAX) want = ZXC_LZ_MINDIST_PROBE_MAX;
  ------------------
  |  |  706|    391|#define ZXC_LZ_MINDIST_PROBE_MAX 64
  ------------------
  |  Branch (1386:9): [True: 391, False: 8.08k]
  ------------------
 1387|  8.47k|    size_t stride = size / want;
 1388|  8.47k|    if (stride < d_max) stride = d_max;
  ------------------
  |  Branch (1388:9): [True: 5.22k, False: 3.24k]
  ------------------
 1389|       |
 1390|  8.47k|    const size_t planned = (size - sizeof(uint32_t) - d_max) / stride + 1;
 1391|  8.47k|    const size_t bar = (size_t)ZXC_LZ_MINDIST_MAX_SHORT_PCT * planned;
  ------------------
  |  |  714|  8.47k|#define ZXC_LZ_MINDIST_MAX_SHORT_PCT 20
  ------------------
 1392|       |
 1393|  8.47k|    size_t samples = 0;
 1394|  8.47k|    size_t hits = 0;
 1395|  68.4k|    for (size_t i = d_max; i + sizeof(uint32_t) <= size; i += stride) {
  ------------------
  |  Branch (1395:28): [True: 68.4k, False: 0]
  ------------------
 1396|  68.4k|        const uint32_t cur = zxc_le32(blk + i);
 1397|  68.4k|        samples++;
 1398|  1.52M|        for (size_t d = 1; d < d_max; d++) {
  ------------------
  |  Branch (1398:28): [True: 1.48M, False: 44.7k]
  ------------------
 1399|  1.48M|            if (zxc_le32(blk + i - d) == cur) {
  ------------------
  |  Branch (1399:17): [True: 23.6k, False: 1.45M]
  ------------------
 1400|  23.6k|                hits++;
 1401|  23.6k|                break;
 1402|  23.6k|            }
 1403|  1.48M|        }
 1404|  68.4k|        if (hits * 100U > bar) return 1;                           // can only rise
  ------------------
  |  Branch (1404:13): [True: 6.26k, False: 62.1k]
  ------------------
 1405|  62.1k|        if ((hits + (planned - samples)) * 100U <= bar) return 0;  // out of reach
  ------------------
  |  Branch (1405:13): [True: 2.21k, False: 59.9k]
  ------------------
 1406|  62.1k|    }
 1407|      0|    return hits * 100U > bar;
 1408|  8.47k|}
zxc_compress.c:zxc_le32:
 1356|  2.09G|static ZXC_ALWAYS_INLINE uint32_t zxc_le32(const void* p) {
 1357|  2.09G|    uint32_t v;
 1358|  2.09G|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  170|  2.09G|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1359|       |#ifdef ZXC_BIG_ENDIAN
 1360|       |    return ZXC_BSWAP32(v);
 1361|       |#else
 1362|  2.09G|    return v;
 1363|  2.09G|#endif
 1364|  2.09G|}
zxc_compress.c:zxc_le64:
 1419|   404M|static ZXC_ALWAYS_INLINE uint64_t zxc_le64(const void* p) {
 1420|   404M|    uint64_t v;
 1421|   404M|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  170|   404M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1422|       |#ifdef ZXC_BIG_ENDIAN
 1423|       |    return ZXC_BSWAP64(v);
 1424|       |#else
 1425|   404M|    return v;
 1426|   404M|#endif
 1427|   404M|}
zxc_compress.c:zxc_ctz64:
 1612|  64.6M|static ZXC_ALWAYS_INLINE int zxc_ctz64(const uint64_t x) {
 1613|  64.6M|    if (x == 0) return 64;
  ------------------
  |  Branch (1613:9): [True: 0, False: 64.6M]
  ------------------
 1614|  64.6M|#if defined(__GNUC__) || defined(__clang__)
 1615|  64.6M|    return __builtin_ctzll(x);
 1616|       |#elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64))
 1617|       |    unsigned long r;
 1618|       |    _BitScanForward64(&r, x);
 1619|       |    return (int)r;
 1620|       |#elif defined(_MSC_VER)
 1621|       |    // Use two 32-bit scans to avoid fragile 64-bit De Bruijn multiplication.
 1622|       |    unsigned long r;
 1623|       |    const uint32_t lo = (uint32_t)x;
 1624|       |    if (_BitScanForward(&r, lo)) return (int)r;
 1625|       |    _BitScanForward(&r, (uint32_t)(x >> 32));
 1626|       |    return 32 + (int)r;
 1627|       |#else
 1628|       |    // Fallback De Bruijn for non-GCC/non-MSVC compilers
 1629|       |    static const int Debruijn64[64] = {
 1630|       |        0,  1,  48, 2,  57, 49, 28, 3,  61, 58, 50, 42, 38, 29, 17, 4,  62, 55, 59, 36, 53, 51,
 1631|       |        43, 22, 45, 39, 33, 30, 24, 18, 12, 5,  63, 47, 56, 27, 60, 41, 37, 16, 54, 35, 52, 21,
 1632|       |        44, 32, 23, 11, 46, 26, 40, 15, 34, 20, 31, 10, 25, 14, 19, 9,  13, 8,  7,  6};
 1633|       |    return Debruijn64[((x & (0ULL - x)) * 0x03F79D71B4CA8B09ULL) >> 58];
 1634|       |#endif
 1635|  64.6M|}
zxc_compress.c:zxc_ctz32:
 1586|  1.60M|static ZXC_ALWAYS_INLINE int zxc_ctz32(const uint32_t x) {
 1587|  1.60M|    if (x == 0) return 32;
  ------------------
  |  Branch (1587:9): [True: 0, False: 1.60M]
  ------------------
 1588|  1.60M|#if defined(__GNUC__) || defined(__clang__)
 1589|  1.60M|    return __builtin_ctz(x);
 1590|       |#elif defined(_MSC_VER)
 1591|       |    unsigned long r;
 1592|       |    _BitScanForward(&r, x);
 1593|       |    return (int)r;
 1594|       |#else
 1595|       |    // Fallback De Bruijn (32 bits)
 1596|       |    static const int DeBruijn32[32] = {0,  1,  28, 2,  29, 14, 24, 3,  30, 22, 20,
 1597|       |                                       15, 25, 17, 4,  8,  31, 27, 13, 23, 21, 19,
 1598|       |                                       16, 7,  26, 12, 18, 6,  11, 5,  10, 9};
 1599|       |    return DeBruijn32[((uint32_t)((x & (0U - x)) * 0x077CB531U)) >> 27];
 1600|       |#endif
 1601|  1.60M|}
zxc_compress.c:zxc_copy32:
 1558|   546k|static ZXC_ALWAYS_INLINE void zxc_copy32(void* dst, const void* src) {
 1559|       |#if defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512)
 1560|       |    // AVX2/AVX512: Single 256-bit (32 byte) unaligned load/store
 1561|       |    _mm256_storeu_si256((__m256i*)dst, _mm256_loadu_si256((const __m256i*)src));
 1562|       |#elif defined(ZXC_USE_SSE2)
 1563|       |    const __m128i a = _mm_loadu_si128((const __m128i*)src);
 1564|   546k|    const __m128i b = _mm_loadu_si128((const __m128i*)((const uint8_t*)src + 16));
 1565|   546k|    _mm_storeu_si128((__m128i*)dst, a);
 1566|   546k|    _mm_storeu_si128((__m128i*)((uint8_t*)dst + 16), b);
 1567|       |#elif defined(ZXC_USE_NEON64) || defined(ZXC_USE_NEON32)
 1568|       |    const uint8x16_t a = vld1q_u8((const uint8_t*)src);
 1569|       |    const uint8x16_t b = vld1q_u8((const uint8_t*)src + 16);
 1570|       |    vst1q_u8((uint8_t*)dst, a);
 1571|       |    vst1q_u8((uint8_t*)dst + 16, b);
 1572|       |#else
 1573|       |    ZXC_MEMCPY(dst, src, 32);
 1574|       |#endif
 1575|   546k|}
zxc_compress.c:zxc_opt_dp_sizes:
 1101|  5.06k|                                               size_t* RESTRICT sz_bm) {
 1102|  5.06k|    *sz_dp = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint32_t));
  ------------------
  |  |  373|  5.06k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  5.06k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  5.06k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  5.06k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  5.06k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1103|  5.06k|    *sz_pl = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint16_t));
  ------------------
  |  |  373|  5.06k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  5.06k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  5.06k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  5.06k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  5.06k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1104|  5.06k|    *sz_po = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint16_t));
  ------------------
  |  |  373|  5.06k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  5.06k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  5.06k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  5.06k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  5.06k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1105|  5.06k|    *sz_bm = ZXC_ALIGN_CL(ZXC_BITMAP_WORDS(chunk_size + 1) * sizeof(uint64_t));
  ------------------
  |  |  373|  5.06k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  5.06k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  5.06k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  371|  5.06k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  369|  5.06k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1106|  5.06k|}
zxc_compress.c:zxc_read_varint:
  619|  44.1k|static ZXC_ALWAYS_INLINE uint32_t zxc_read_varint(const uint8_t** ptr, const uint8_t* end) {
  620|  44.1k|    const uint8_t* p = *ptr;
  621|  44.1k|    if (UNLIKELY(p >= end)) return ZXC_VARINT_INVALID;
  ------------------
  |  |  154|  44.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 44.1k]
  |  |  ------------------
  ------------------
                  if (UNLIKELY(p >= end)) return ZXC_VARINT_INVALID;
  ------------------
  |  |  586|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  622|       |
  623|  44.1k|    const uint32_t b0 = p[0];
  624|       |
  625|       |    // 1 Byte: 0xxxxxxx (7 bits) -> val < 128 (2^7)
  626|  44.1k|    if (LIKELY(b0 < 0x80)) {
  ------------------
  |  |  148|  44.1k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 39.8k, False: 4.31k]
  |  |  ------------------
  ------------------
  627|  39.8k|        *ptr = p + 1;
  628|  39.8k|        return b0;
  629|  39.8k|    }
  630|       |
  631|       |    // 2 Bytes: 10xxxxxx xxxxxxxx (14 bits) -> val < 16384 (2^14)
  632|  4.31k|    if (LIKELY(b0 < 0xC0)) {
  ------------------
  |  |  148|  4.31k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 4.22k, False: 85]
  |  |  ------------------
  ------------------
  633|  4.22k|        if (UNLIKELY(p + 1 >= end)) {
  ------------------
  |  |  154|  4.22k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 4.22k]
  |  |  ------------------
  ------------------
  634|      0|            *ptr = end;
  635|      0|            return ZXC_VARINT_INVALID;
  ------------------
  |  |  586|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  636|      0|        }
  637|  4.22k|        *ptr = p + 2;
  638|  4.22k|        return (b0 & 0x3F) | ((uint32_t)p[1] << 6);
  639|  4.22k|    }
  640|       |
  641|       |    // 3 Bytes: 110xxxxx xxxxxxxx xxxxxxxx (21 bits) -> val < 2^21. The longest
  642|       |    // a legitimate varint can be: values are (ll - MASK) or (ml - MASK), always
  643|       |    // strictly below block_size_max = 2^21.
  644|     85|    if (LIKELY(b0 < 0xE0)) {
  ------------------
  |  |  148|     85|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 85, False: 0]
  |  |  ------------------
  ------------------
  645|     85|        if (UNLIKELY(p + 2 >= end)) {
  ------------------
  |  |  154|     85|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 0, False: 85]
  |  |  ------------------
  ------------------
  646|      0|            *ptr = end;
  647|      0|            return ZXC_VARINT_INVALID;
  ------------------
  |  |  586|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  648|      0|        }
  649|     85|        *ptr = p + 3;
  650|     85|        return (b0 & 0x1F) | ((uint32_t)p[1] << 5) | ((uint32_t)p[2] << 13);
  651|     85|    }
  652|       |
  653|       |    // extra encoding: out-of-spec for the current format, reject.
  654|      0|    *ptr = end;
  655|      0|    return ZXC_VARINT_INVALID;
  ------------------
  |  |  586|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  656|     85|}
zxc_compress.c:zxc_ss_prem_rle_q8:
  917|  10.7k|static inline int zxc_ss_prem_rle_q8(const int level) {
  918|  10.7k|    return (level >= ZXC_LEVEL_DENSITY) ? 1 : (256 >> ZXC_RLE_MARGIN_SHIFT);
  ------------------
  |  |  844|  5.61k|#define ZXC_RLE_MARGIN_SHIFT 5
  ------------------
  |  Branch (918:12): [True: 5.14k, False: 5.61k]
  ------------------
  919|  10.7k|}
zxc_compress.c:zxc_huf_enc_max_code_len:
 1023|  6.72k|static inline int zxc_huf_enc_max_code_len(const int level) {
 1024|  6.72k|    return (level >= ZXC_LEVEL_ULTRA) ? ZXC_HUF_MAX_CODE_LEN_ULTRA : ZXC_HUF_MAX_CODE_LEN_DENSITY;
  ------------------
  |  |  778|  5.92k|#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;
  ------------------
  |  |  783|    804|#define ZXC_HUF_MAX_CODE_LEN_DENSITY 8
  ------------------
  |  Branch (1024:12): [True: 5.92k, False: 804]
  ------------------
 1025|  6.72k|}
zxc_compress.c:zxc_ss_prem_huf_q8:
  936|  3.36k|static inline int zxc_ss_prem_huf_q8(const int level) {
  937|  3.36k|    return (level >= ZXC_LEVEL_DENSITY) ? 4 : (256 >> ZXC_HUF_MARGIN_SHIFT);
  ------------------
  |  |  848|      0|#define ZXC_HUF_MARGIN_SHIFT 5
  ------------------
  |  Branch (937:12): [True: 3.36k, False: 0]
  ------------------
  938|  3.36k|}
zxc_compress.c:zxc_store_le32:
 1456|  6.58k|static ZXC_ALWAYS_INLINE void zxc_store_le32(void* p, const uint32_t v) {
 1457|       |#ifdef ZXC_BIG_ENDIAN
 1458|       |    const uint32_t s = ZXC_BSWAP32(v);
 1459|       |    ZXC_MEMCPY(p, &s, sizeof(s));
 1460|       |#else
 1461|  6.58k|    ZXC_MEMCPY(p, &v, sizeof(v));
  ------------------
  |  |  170|  6.58k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1462|  6.58k|#endif
 1463|  6.58k|}
zxc_compress.c:zxc_checksum:
 1672|  6.58k|                                               const uint64_t seed, const uint8_t hash_method) {
 1673|  6.58k|    (void)hash_method; /* single algorithm for now; extend when adding more */
 1674|  6.58k|    const uint64_t hash = rapidhash_withSeed(input, len, seed);
 1675|       |
 1676|       |    return (uint32_t)(hash ^ (hash >> (sizeof(uint32_t) * CHAR_BIT)));
 1677|  6.58k|}
zxc_decompress.c:zxc_le32:
 1356|  4.16M|static ZXC_ALWAYS_INLINE uint32_t zxc_le32(const void* p) {
 1357|  4.16M|    uint32_t v;
 1358|  4.16M|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  170|  4.16M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1359|       |#ifdef ZXC_BIG_ENDIAN
 1360|       |    return ZXC_BSWAP32(v);
 1361|       |#else
 1362|  4.16M|    return v;
 1363|  4.16M|#endif
 1364|  4.16M|}
zxc_decompress.c:zxc_copy32:
 1558|  31.4M|static ZXC_ALWAYS_INLINE void zxc_copy32(void* dst, const void* src) {
 1559|       |#if defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512)
 1560|       |    // AVX2/AVX512: Single 256-bit (32 byte) unaligned load/store
 1561|       |    _mm256_storeu_si256((__m256i*)dst, _mm256_loadu_si256((const __m256i*)src));
 1562|       |#elif defined(ZXC_USE_SSE2)
 1563|       |    const __m128i a = _mm_loadu_si128((const __m128i*)src);
 1564|  31.4M|    const __m128i b = _mm_loadu_si128((const __m128i*)((const uint8_t*)src + 16));
 1565|  31.4M|    _mm_storeu_si128((__m128i*)dst, a);
 1566|  31.4M|    _mm_storeu_si128((__m128i*)((uint8_t*)dst + 16), b);
 1567|       |#elif defined(ZXC_USE_NEON64) || defined(ZXC_USE_NEON32)
 1568|       |    const uint8x16_t a = vld1q_u8((const uint8_t*)src);
 1569|       |    const uint8x16_t b = vld1q_u8((const uint8_t*)src + 16);
 1570|       |    vst1q_u8((uint8_t*)dst, a);
 1571|       |    vst1q_u8((uint8_t*)dst + 16, b);
 1572|       |#else
 1573|       |    ZXC_MEMCPY(dst, src, 32);
 1574|       |#endif
 1575|  31.4M|}
zxc_decompress.c:zxc_le64:
 1419|  1.76M|static ZXC_ALWAYS_INLINE uint64_t zxc_le64(const void* p) {
 1420|  1.76M|    uint64_t v;
 1421|  1.76M|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  170|  1.76M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1422|       |#ifdef ZXC_BIG_ENDIAN
 1423|       |    return ZXC_BSWAP64(v);
 1424|       |#else
 1425|  1.76M|    return v;
 1426|  1.76M|#endif
 1427|  1.76M|}
zxc_decompress.c:zxc_read_varint:
  619|  2.68M|static ZXC_ALWAYS_INLINE uint32_t zxc_read_varint(const uint8_t** ptr, const uint8_t* end) {
  620|  2.68M|    const uint8_t* p = *ptr;
  621|  2.68M|    if (UNLIKELY(p >= end)) return ZXC_VARINT_INVALID;
  ------------------
  |  |  154|  2.68M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 6.88k, False: 2.68M]
  |  |  ------------------
  ------------------
                  if (UNLIKELY(p >= end)) return ZXC_VARINT_INVALID;
  ------------------
  |  |  586|  6.88k|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|  6.88k|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|  6.88k|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  622|       |
  623|  2.68M|    const uint32_t b0 = p[0];
  624|       |
  625|       |    // 1 Byte: 0xxxxxxx (7 bits) -> val < 128 (2^7)
  626|  2.68M|    if (LIKELY(b0 < 0x80)) {
  ------------------
  |  |  148|  2.68M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 2.21M, False: 470k]
  |  |  ------------------
  ------------------
  627|  2.21M|        *ptr = p + 1;
  628|  2.21M|        return b0;
  629|  2.21M|    }
  630|       |
  631|       |    // 2 Bytes: 10xxxxxx xxxxxxxx (14 bits) -> val < 16384 (2^14)
  632|   470k|    if (LIKELY(b0 < 0xC0)) {
  ------------------
  |  |  148|   470k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 437k, False: 33.0k]
  |  |  ------------------
  ------------------
  633|   437k|        if (UNLIKELY(p + 1 >= end)) {
  ------------------
  |  |  154|   437k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 2.05k, False: 435k]
  |  |  ------------------
  ------------------
  634|  2.05k|            *ptr = end;
  635|  2.05k|            return ZXC_VARINT_INVALID;
  ------------------
  |  |  586|  2.05k|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|  2.05k|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|  2.05k|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  636|  2.05k|        }
  637|   435k|        *ptr = p + 2;
  638|   435k|        return (b0 & 0x3F) | ((uint32_t)p[1] << 6);
  639|   437k|    }
  640|       |
  641|       |    // 3 Bytes: 110xxxxx xxxxxxxx xxxxxxxx (21 bits) -> val < 2^21. The longest
  642|       |    // a legitimate varint can be: values are (ll - MASK) or (ml - MASK), always
  643|       |    // strictly below block_size_max = 2^21.
  644|  33.0k|    if (LIKELY(b0 < 0xE0)) {
  ------------------
  |  |  148|  33.0k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (148:19): [True: 27.5k, False: 5.49k]
  |  |  ------------------
  ------------------
  645|  27.5k|        if (UNLIKELY(p + 2 >= end)) {
  ------------------
  |  |  154|  27.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (154:21): [True: 1.69k, False: 25.8k]
  |  |  ------------------
  ------------------
  646|  1.69k|            *ptr = end;
  647|  1.69k|            return ZXC_VARINT_INVALID;
  ------------------
  |  |  586|  1.69k|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|  1.69k|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|  1.69k|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  648|  1.69k|        }
  649|  25.8k|        *ptr = p + 3;
  650|  25.8k|        return (b0 & 0x1F) | ((uint32_t)p[1] << 5) | ((uint32_t)p[2] << 13);
  651|  27.5k|    }
  652|       |
  653|       |    // extra encoding: out-of-spec for the current format, reject.
  654|  5.49k|    *ptr = end;
  655|  5.49k|    return ZXC_VARINT_INVALID;
  ------------------
  |  |  586|  5.49k|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|  5.49k|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|  5.49k|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  656|  33.0k|}
zxc_decompress.c:zxc_copy16:
 1539|  18.1M|static ZXC_ALWAYS_INLINE void zxc_copy16(void* dst, const void* src) {
 1540|  18.1M|#if defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512) || defined(ZXC_USE_SSE2)
 1541|       |    // x86 SSE2/AVX2/AVX512: Single 128-bit unaligned load/store
 1542|  18.1M|    _mm_storeu_si128((__m128i*)dst, _mm_loadu_si128((const __m128i*)src));
 1543|       |#elif defined(ZXC_USE_NEON64) || defined(ZXC_USE_NEON32)
 1544|       |    vst1q_u8((uint8_t*)dst, vld1q_u8((const uint8_t*)src));
 1545|       |#else
 1546|       |    ZXC_MEMCPY(dst, src, 16);
 1547|       |#endif
 1548|  18.1M|}
zxc_decompress.c:zxc_le16:
 1337|   130k|static ZXC_ALWAYS_INLINE uint16_t zxc_le16(const void* p) {
 1338|   130k|    uint16_t v;
 1339|   130k|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  170|   130k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1340|       |#ifdef ZXC_BIG_ENDIAN
 1341|       |    return ZXC_BSWAP16(v);
 1342|       |#else
 1343|   130k|    return v;
 1344|   130k|#endif
 1345|   130k|}
zxc_decompress.c:zxc_checksum:
 1672|  28.9k|                                               const uint64_t seed, const uint8_t hash_method) {
 1673|  28.9k|    (void)hash_method; /* single algorithm for now; extend when adding more */
 1674|  28.9k|    const uint64_t hash = rapidhash_withSeed(input, len, seed);
 1675|       |
 1676|       |    return (uint32_t)(hash ^ (hash >> (sizeof(uint32_t) * CHAR_BIT)));
 1677|  28.9k|}
zxc_dispatch.c:zxc_validate_block_size:
 1150|  45.9k|static ZXC_ALWAYS_INLINE int zxc_validate_block_size(const size_t bs) {
 1151|  45.9k|    return bs >= ZXC_BLOCK_SIZE_MIN && bs <= ZXC_BLOCK_SIZE_MAX && (bs & (bs - 1)) == 0;
  ------------------
  |  |   73|  91.8k|#define ZXC_BLOCK_SIZE_MIN (1U << ZXC_BLOCK_SIZE_MIN_LOG2)
  |  |  ------------------
  |  |  |  |   67|  45.9k|#define ZXC_BLOCK_SIZE_MIN_LOG2 12
  |  |  ------------------
  ------------------
                  return bs >= ZXC_BLOCK_SIZE_MIN && bs <= ZXC_BLOCK_SIZE_MAX && (bs & (bs - 1)) == 0;
  ------------------
  |  |   75|  91.8k|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  ------------------
  |  |  |  |   69|  45.9k|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  ------------------
  ------------------
  |  Branch (1151:12): [True: 45.9k, False: 0]
  |  Branch (1151:40): [True: 45.9k, False: 0]
  |  Branch (1151:68): [True: 45.9k, False: 0]
  ------------------
 1152|  45.9k|}
zxc_dispatch.c:zxc_block_size_ceil:
 1131|   106k|static ZXC_ALWAYS_INLINE size_t zxc_block_size_ceil(const size_t v) {
 1132|   106k|    uint64_t x = (uint64_t)v - 1;
 1133|   106k|    x |= x >> 1;
 1134|   106k|    x |= x >> 2;
 1135|   106k|    x |= x >> 4;
 1136|   106k|    x |= x >> 8;
 1137|   106k|    x |= x >> 16;
 1138|   106k|    x |= x >> 32;
 1139|   106k|    x++;
 1140|   106k|    const size_t bs = (size_t)x;
 1141|   106k|    return (bs < ZXC_BLOCK_SIZE_MIN) ? ZXC_BLOCK_SIZE_MIN : bs;
  ------------------
  |  |   73|   106k|#define ZXC_BLOCK_SIZE_MIN (1U << ZXC_BLOCK_SIZE_MIN_LOG2)
  |  |  ------------------
  |  |  |  |   67|   106k|#define ZXC_BLOCK_SIZE_MIN_LOG2 12
  |  |  ------------------
  ------------------
                  return (bs < ZXC_BLOCK_SIZE_MIN) ? ZXC_BLOCK_SIZE_MIN : bs;
  ------------------
  |  |   73|  53.9k|#define ZXC_BLOCK_SIZE_MIN (1U << ZXC_BLOCK_SIZE_MIN_LOG2)
  |  |  ------------------
  |  |  |  |   67|  53.9k|#define ZXC_BLOCK_SIZE_MIN_LOG2 12
  |  |  ------------------
  ------------------
  |  Branch (1141:12): [True: 53.9k, False: 53.0k]
  ------------------
 1142|   106k|}
zxc_huffman.c:zxc_log2_u32:
 1117|   181M|static ZXC_ALWAYS_INLINE uint32_t zxc_log2_u32(const uint32_t v) {
 1118|       |#ifdef _MSC_VER
 1119|       |    unsigned long index;
 1120|       |    return (v == 0) ? 0 : (_BitScanReverse(&index, v) ? index : 0);
 1121|       |#else
 1122|   181M|    return (v == 0) ? 0 : (uint32_t)(31 - __builtin_clz(v));
  ------------------
  |  Branch (1122:12): [True: 0, False: 181M]
  ------------------
 1123|   181M|#endif
 1124|   181M|}

LLVMFuzzerTestOneInput:
   74|  15.3k|int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   75|  15.3k|    if (size < FUZZ_BLOCK_CTRL || size > FUZZ_BLOCK_MAX_INPUT) return 0;
  ------------------
  |  |   34|  30.6k|#define FUZZ_BLOCK_CTRL 4                /* control bytes consumed below */
  ------------------
                  if (size < FUZZ_BLOCK_CTRL || size > FUZZ_BLOCK_MAX_INPUT) return 0;
  ------------------
  |  |   33|  15.3k|#define FUZZ_BLOCK_MAX_INPUT (256 << 10) /* 256 KiB of fuzzer bytes */
  ------------------
  |  Branch (75:9): [True: 2, False: 15.3k]
  |  Branch (75:35): [True: 5, False: 15.3k]
  ------------------
   76|  15.3k|    const int level = (int)(data[0] % (unsigned)zxc_max_level()) + 1;
   77|  15.3k|    const int checksum = data[1] & 1;
   78|  15.3k|    const size_t k = (size_t)((data[1] >> 1) % N_SIZES);
  ------------------
  |  |   35|  15.3k|#define N_SIZES 3
  ------------------
   79|  15.3k|    const size_t bs = kBlockSizes[k];
   80|       |    // Raw-decode capacity, 1 .. 2^18.
   81|  15.3k|    const size_t raw_cap = ((size_t)data[2] << 10 | (size_t)data[3] << 2 | (data[1] >> 6)) + 1;
   82|  15.3k|    data += FUZZ_BLOCK_CTRL;
  ------------------
  |  |   34|  15.3k|#define FUZZ_BLOCK_CTRL 4                /* control bytes consumed below */
  ------------------
   83|  15.3k|    size -= FUZZ_BLOCK_CTRL;
  ------------------
  |  |   34|  15.3k|#define FUZZ_BLOCK_CTRL 4                /* control bytes consumed below */
  ------------------
   84|  15.3k|    if (size == 0) return 0;
  ------------------
  |  Branch (84:9): [True: 1, False: 15.3k]
  ------------------
   85|       |
   86|  15.3k|    zxc_dctx* const heap = zxc_create_dctx();
   87|  15.3k|    if (!heap) return 0;
  ------------------
  |  Branch (87:9): [True: 0, False: 15.3k]
  ------------------
   88|  15.3k|    if (zxc_dctx_set_param(heap, ZXC_D_CHECKSUM, checksum) != ZXC_OK) {
  ------------------
  |  Branch (88:9): [True: 0, False: 15.3k]
  ------------------
   89|      0|        zxc_free_dctx(heap);
   90|      0|        return 0;
   91|      0|    }
   92|       |
   93|       |    /* 1. Raw input as a block. */
   94|  15.3k|    {
   95|  15.3k|        uint8_t *fast = NULL, *safe = NULL, *stat = NULL;
   96|  15.3k|        const int64_t rf = decode(heap, 0, data, size, raw_cap, &fast);
   97|  15.3k|        const int64_t rs = decode(heap, 1, data, size, raw_cap, &safe);
   98|  15.3k|        agree(rf, fast, rs, safe);
   99|  15.3k|        zxc_dctx* const sd = static_dctx(k, checksum);
  100|  15.3k|        if (sd) {
  ------------------
  |  Branch (100:13): [True: 15.3k, False: 0]
  ------------------
  101|  15.3k|            const int64_t rt = decode(sd, 1, data, size, raw_cap, &stat);
  102|  15.3k|            agree(rs, safe, rt, stat);
  103|  15.3k|        }
  104|  15.3k|        free(fast);
  105|  15.3k|        free(safe);
  106|  15.3k|        free(stat);
  107|  15.3k|    }
  108|       |
  109|       |    /* 2. Round trip of one block of at most bs bytes. */
  110|  15.3k|    const size_t n = size < bs ? size : bs;
  ------------------
  |  Branch (110:22): [True: 15.1k, False: 177]
  ------------------
  111|  15.3k|    const size_t cb = zxc_compress_block_bound(n);
  112|  15.3k|    zxc_cctx* const cctx = zxc_create_cctx();
  113|  15.3k|    const int configured = cctx && zxc_cctx_set_param(cctx, ZXC_C_LEVEL, level) == ZXC_OK &&
  ------------------
  |  Branch (113:28): [True: 15.3k, False: 0]
  |  Branch (113:36): [True: 15.3k, False: 0]
  ------------------
  114|  15.3k|                           zxc_cctx_set_param(cctx, ZXC_C_CHECKSUM, checksum) == ZXC_OK &&
  ------------------
  |  Branch (114:28): [True: 15.3k, False: 0]
  ------------------
  115|  15.3k|                           zxc_cctx_set_param(cctx, ZXC_C_BLOCK_SIZE, (int64_t)bs) == ZXC_OK;
  ------------------
  |  Branch (115:28): [True: 15.3k, False: 0]
  ------------------
  116|  15.3k|    uint8_t* const comp = cb ? (uint8_t*)malloc(cb) : NULL;
  ------------------
  |  Branch (116:27): [True: 15.3k, False: 0]
  ------------------
  117|  15.3k|    const int64_t c = (configured && comp) ? zxc_compress_block(cctx, data, n, comp, cb) : -1;
  ------------------
  |  Branch (117:24): [True: 15.3k, False: 0]
  |  Branch (117:38): [True: 15.3k, False: 0]
  ------------------
  118|  15.3k|    if (c > 0) {
  ------------------
  |  Branch (118:9): [True: 15.3k, False: 0]
  ------------------
  119|  15.3k|        const size_t len = (size_t)c;
  120|  15.3k|        const size_t padded = (size_t)zxc_decompress_block_bound(n);
  121|  15.3k|        uint8_t* out = NULL;
  122|  15.3k|        int64_t r;
  123|       |
  124|  15.3k|        r = decode(heap, 0, comp, len, padded, &out);
  125|  15.3k|        assert(r == (int64_t)n && memcmp(out, data, n) == 0);
  ------------------
  |  Branch (125:9): [True: 0, False: 15.3k]
  |  Branch (125:9): [True: 0, False: 0]
  |  Branch (125:9): [True: 15.3k, False: 0]
  |  Branch (125:9): [True: 15.3k, False: 0]
  ------------------
  126|  15.3k|        free(out);
  127|  15.3k|        r = decode(heap, 0, comp, len, n, &out);
  128|  15.3k|        assert(r == (int64_t)n && memcmp(out, data, n) == 0);
  ------------------
  |  Branch (128:9): [True: 0, False: 15.3k]
  |  Branch (128:9): [True: 0, False: 0]
  |  Branch (128:9): [True: 15.3k, False: 0]
  |  Branch (128:9): [True: 15.3k, False: 0]
  ------------------
  129|  15.3k|        free(out);
  130|  15.3k|        r = decode(heap, 1, comp, len, n, &out);
  131|  15.3k|        assert(r == (int64_t)n && memcmp(out, data, n) == 0);
  ------------------
  |  Branch (131:9): [True: 0, False: 15.3k]
  |  Branch (131:9): [True: 0, False: 0]
  |  Branch (131:9): [True: 15.3k, False: 0]
  |  Branch (131:9): [True: 15.3k, False: 0]
  ------------------
  132|  15.3k|        free(out);
  133|  15.3k|        zxc_dctx* const sd = static_dctx(k, checksum);
  134|  15.3k|        if (sd) {
  ------------------
  |  Branch (134:13): [True: 15.3k, False: 0]
  ------------------
  135|  15.3k|            r = decode(sd, 1, comp, len, n, &out);
  136|  15.3k|            assert(r == (int64_t)n && memcmp(out, data, n) == 0);
  ------------------
  |  Branch (136:13): [True: 0, False: 15.3k]
  |  Branch (136:13): [True: 0, False: 0]
  |  Branch (136:13): [True: 15.3k, False: 0]
  |  Branch (136:13): [True: 15.3k, False: 0]
  ------------------
  137|  15.3k|            free(out);
  138|  15.3k|        }
  139|       |
  140|       |        // Truncated: a block's length is part of its header, so any cut fails.
  141|  15.3k|        r = decode(heap, 1, comp, len - 1, n, &out);
  142|  15.3k|        assert(r < 0);
  ------------------
  |  Branch (142:9): [True: 0, False: 15.3k]
  |  Branch (142:9): [True: 15.3k, False: 0]
  ------------------
  143|  15.3k|        free(out);
  144|  15.3k|        (void)r;
  145|  15.3k|    }
  146|  15.3k|    free(comp);
  147|  15.3k|    zxc_free_cctx(cctx);
  148|  15.3k|    zxc_free_dctx(heap);
  149|  15.3k|    return 0;
  150|  15.3k|}
fuzz_block.c:decode:
   56|   122k|                      const size_t cap, uint8_t** out) {
   57|   122k|    uint8_t* const dst = (uint8_t*)malloc(cap);
   58|   122k|    if (!dst) return INT64_MIN;
  ------------------
  |  Branch (58:9): [True: 0, False: 122k]
  ------------------
   59|   122k|    const int64_t r = safe ? zxc_decompress_block_safe(d, src, len, dst, cap)
  ------------------
  |  Branch (59:23): [True: 76.5k, False: 45.9k]
  ------------------
   60|   122k|                           : zxc_decompress_block(d, src, len, dst, cap);
   61|   122k|    assert(r < 0 || (size_t)r <= cap);
  ------------------
  |  Branch (61:5): [True: 122k, False: 0]
  |  Branch (61:5): [True: 0, False: 0]
  |  Branch (61:5): [True: 58.3k, False: 64.1k]
  |  Branch (61:5): [True: 64.1k, False: 0]
  ------------------
   62|   122k|    *out = dst;
   63|   122k|    return r;
   64|   122k|}
fuzz_block.c:agree:
   67|  30.6k|static void agree(const int64_t r1, const uint8_t* b1, const int64_t r2, const uint8_t* b2) {
   68|  30.6k|    if (r1 > 0 && r2 > 0) {
  ------------------
  |  Branch (68:9): [True: 1.40k, False: 29.2k]
  |  Branch (68:19): [True: 1.05k, False: 346]
  ------------------
   69|  1.05k|        assert(r1 == r2);
  ------------------
  |  Branch (69:9): [True: 0, False: 1.05k]
  |  Branch (69:9): [True: 1.05k, False: 0]
  ------------------
   70|  1.05k|        assert(memcmp(b1, b2, (size_t)r1) == 0);
  ------------------
  |  Branch (70:9): [True: 0, False: 1.05k]
  |  Branch (70:9): [True: 1.05k, False: 0]
  ------------------
   71|  1.05k|    }
   72|  30.6k|}
fuzz_block.c:static_dctx:
   41|  30.6k|static zxc_dctx* static_dctx(const size_t k, const int checksum) {
   42|  30.6k|    static void* ws[N_SIZES];
   43|  30.6k|    static size_t ws_size[N_SIZES];
   44|  30.6k|    if (!ws[k]) {
  ------------------
  |  Branch (44:9): [True: 3, False: 30.6k]
  ------------------
   45|      3|        ws_size[k] = (zxc_static_dctx_workspace_size(kBlockSizes[k]) + 63) & ~(size_t)63;
   46|      3|        ws[k] = aligned_alloc(64, ws_size[k]);
   47|      3|        if (!ws[k]) return NULL;
  ------------------
  |  Branch (47:13): [True: 0, False: 3]
  ------------------
   48|      3|    }
   49|  30.6k|    zxc_dctx* const d = zxc_init_static_dctx(ws[k], ws_size[k], kBlockSizes[k]);
   50|  30.6k|    if (d && zxc_dctx_set_param(d, ZXC_D_CHECKSUM, checksum) != ZXC_OK) return NULL;
  ------------------
  |  Branch (50:9): [True: 30.6k, False: 0]
  |  Branch (50:14): [True: 0, False: 30.6k]
  ------------------
   51|  30.6k|    return d;
   52|  30.6k|}

